	<?php ob_start(); ?>
	<!DOCTYPE html>
	<html>
	<?php include "layouts/db_connect.php";
				session_start('ERP');
				
				if($_SESSION['uname']==""&&$_SESSION['pwd']=="")
				{
				
					header("location:index.php");
				}
				
	if(isset($_SESSION['code'])) {
	  $code = $_SESSION['code'];
	  $scode = $_SESSION['code'];
	   $mfin = $_SESSION['mfin'];
		$staff = $_SESSION['name'];
		 $postt = $_SESSION['postt'];
	}
							if(isset($_POST))
							{
							    extract($_POST);

							    
$alpha = "1234567890";
$alpha_upper = "1234567890";
$numeric = "0123456789";
$special = "1234567890";
$chars = "";
 
if (isset($_POST['length'])){
    // if you want a form like above
    if (isset($_POST['alpha']) && $_POST['alpha'] == 'on')
        $chars .= $alpha;
     
    if (isset($_POST['alpha_upper']) && $_POST['alpha_upper'] == 'on')
        $chars .= $alpha_upper;
     
    if (isset($_POST['numeric']) && $_POST['numeric'] == 'on')
        $chars .= $numeric;
     
    if (isset($_POST['special']) && $_POST['special'] == 'on')
        $chars .= $special;
     
    $length = $_POST['length'];
} 
else {
    // default [a-zA-Z0-9]{9}
    $chars = $alpha . $alpha_upper . $numeric;
    $length = 3;
}
$len = strlen($chars);
$pw = '';
 
for ($i=0;$i<$length;$i++)
        $pw .= substr($chars, rand(0, $len-1), 1);
 
// the finished password
$otp1 = str_shuffle($pw);

$username="senthoor"; 
$password="Somu1712.";
$message="Hello ".$name." , ".$otp1." is the OTP for ".$mfin." . INFOSSEL SOFT SOLUTIONS.";
$sender="SENTOR"; //ex:INVITE
$mobile_number=$pno;

$url="http://osm.bulksms5.com/sendmessage.php?user=".urlencode($username)."&password=".urlencode($password)."&mobile=".urlencode($mobile_number)."&message=".urlencode($message)."&sender=".urlencode($sender)."&type=".urlencode('3');

$ch = curl_init($url);

curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

echo $curl_scraped_page = curl_exec($ch);

curl_close($ch);






$alpha = "1234567890";
$alpha_upper = "1234567890";
$numeric = "0123456789";
$special = "1234567890";
$chars = "";
 
if (isset($_POST['length'])){
    // if you want a form like above
    if (isset($_POST['alpha']) && $_POST['alpha'] == 'on')
        $chars .= $alpha;
     
    if (isset($_POST['alpha_upper']) && $_POST['alpha_upper'] == 'on')
        $chars .= $alpha_upper;
     
    if (isset($_POST['numeric']) && $_POST['numeric'] == 'on')
        $chars .= $numeric;
     
    if (isset($_POST['special']) && $_POST['special'] == 'on')
        $chars .= $special;
     
    $length = $_POST['length'];
} 
else {
    // default [a-zA-Z0-9]{9}
    $chars = $alpha . $alpha_upper . $numeric;
    $length = 3;
}
$len = strlen($chars);
$pw2 = '';
 
for ($i=0;$i<$length;$i++)
        $pw2 .= substr($chars, rand(0, $len-1), 1);
 
// the finished password
$otp2 = str_shuffle($pw2);


$message2="Hello ".$cobname." , ".$otp2." is the OTP for ".$mfin." . INFOSSEL SOFT SOLUTIONS.";

$mobile_number2=$cobpno;

$url2="http://osm.bulksms5.com/sendmessage.php?user=".urlencode($username)."&password=".urlencode($password)."&mobile=".urlencode($mobile_number2)."&message=".urlencode($message2)."&sender=".urlencode($sender)."&type=".urlencode('3');

$ch2 = curl_init($url2);

curl_setopt($ch2, CURLOPT_RETURNTRANSFER, true);

echo $curl_scraped_page = curl_exec($ch2);

curl_close($ch2);




							    $selected_date2=$hpdate;
		  	$selected_date=strtotime( $selected_date2 );
		
			$hpdate5 = date( 'Y-m-d', $selected_date );
			$month = date( 'm', $selected_date );
			$day = date( 'd', $selected_date );
				$year = date( 'Y', $selected_date );
				$geo = $geo;
				if($geo!=NULL){
					$sql55 = mysqli_query($conn, "select * from geo where code='$geo'");
					$row55 = mysqli_fetch_array($sql55);
					$lat = $row55['lat'];
					$lang = $row55['lang'];
				}
						date_default_timezone_set('Asia/Kolkata');
$date33 = date('h:i:s a m/d/y');
$dddttt =  date('h:i:s a d/m/y', strtotime($date33));			
							$defamt	= $defamt/12;
							
								$insert=mysqli_query($conn, "insert into entry(vval,loanr,otp1,otp2,createdate,hpdate5,dd,mm,yy,status,cow01,cow02,address1,address2,oaddress1,oaddress2,co01,co02,co201,co202,coaland,coaland2,hname,lmark,cofname,cofname2,pmode,cow,cow2,oaddress,fname,eno,cno,area,hlamt,hlreturn,hpdate2,cobname2,cobpno2,co2,pnooffice,pnoresi,profession,dealer,chqamt,defamt,irr,remarks,imgveh,mfin,scode,hpl,lat,lang,uimg,vno,model,vname,color,hpamount,inter,hpdate,duemnt,dueamt,interest,total,name,pno,address,cobname,cobpno,co,img,bname,bcommission,document,totalhpamt,g1,g2,g3,gi1,gi2,gi3,b1,b2,b3,bi1,bi2,bi3,nname)
								values('$vval','$loanr','$otp1','$otp2','$dddttt','$hpdate5','$day','$month','$year','Active','$cow01','$cow02','$address1','$address2','$oaddress1','$oaddress2','$co01','$co02','$co201','$co202','$coaland','$coaland2','$hname','$lmark','$cofname','$cofname2','$pmode','$cow','$cow2','$oaddress','$fname','$eno','$cno','$area','$hlamt','$hlreturn','$hpdate2','$cobname2','$cobpno2','$co2','$pnooffice','$pnoresi','$profession','$dealer','$chqamt','$defamt','$irr','$remarks','$imgveh','$mfin55','$scode','$hpl','$lat','$lang','$uimg','$vno','$model','$vname','$color','$hpamount','$inter','$hpdate','$duemnt','$dueamt','$interest','$total','$name','$pno','$address','$cobname','$cobpno','$co','$img','$bname','$bcommission','$document','$totalhpamt','$g1','$g2','$g3','$gi1','$gi2','$gi3','$b1','$b2','$b3','$bi1','$bi2','$bi3','$nnamef')");
							
								
								if($insert)
								{
							header("location:entryotp.php?hpl=$hpl&mfin=$mfin");
									
								}
								else
								{
									echo "Failure";
								}
							}
?>
</html>