<?php ob_start(); ?>
<!DOCTYPE html>
<html>
<?php include "layouts/db_connect.php"; ?>
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>INFOSSEL - ICLOUD AUTO FINANCE</title>
    <link rel="icon" href="layouts/favicon.ico" type="image/x-icon">
    <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.8.1/css/all.css"
    integrity="sha384-50oBUHEmvpQ+1lW4y57PTFmhCaXp0ML5d60M1M7uH2+nqUivzIebhndOJK28anvf"
    crossorigin="anonymous">
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous">
    <script src="https://cdn.jsdelivr.net/npm/@popperjs/core@2.9.2/dist/umd/popper.min.js" integrity="sha384-IQsoLXl5PILFhosVNubq5LC7Qb9DXgDA9i+tQ8Zj3iwWAwPtgFTxbJ8NT4GN1R8p" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/js/bootstrap.min.js" integrity="sha384-cVKIPhGWiC2Al4u+LWgxfKTRIcfu0JTxR+EQDz/bgldoEyl4H0zUF0QKbrJ0EcQF" crossorigin="anonymous"></script>
    <link rel="stylesheet" href="./style.css">

</head>
<body>

      <section class="container-fluid" style="height: 100vh;">
        
       <div class="row row-cols-1 row-cols-lg-6 g-2 g-lg-3">
        <div class="col-lg-8" >
            <div id="carouselExampleFade" class="carousel slide carousel-fade" data-bs-ride="carousel">
                <div class="carousel-inner">
                </br></br></br> </br>  <div class="carousel-item active">
                   <center> <img src="gold.gif" class="img-fluid  h-100 w-100" alt="..." style="object-fit: fill;"></center>
                  </div>
               <!--   <div class="carousel-item">
                    <img src="./cloud-2.gif" class="img-fluid h-100 w-100 container-fluid" alt="...">
                  </div>
                  <div class="carousel-item">
                    <img src="./cloud-5.gif" class="img-fluid h-100 w-100 container-fluid" alt="...">
                  </div> -->
                </div>
                <button class="carousel-control-prev" type="button" data-bs-target="#carouselExampleFade" data-bs-slide="prev">
                  <span class="carousel-control-prev-icon" aria-hidden="true"></span>
                  <span class="visually-hidden">Previous</span>
                </button>
                <button class="carousel-control-next" type="button" data-bs-target="#carouselExampleFade" data-bs-slide="next">
                  <span class="carousel-control-next-icon" aria-hidden="true"></span>
                  <span class="visually-hidden">Next</span>
                </button>
              </div>
        </div>
        <div class="col-lg-4 bg-light">
            <div class="form-container ">
				  <?php $sql3=mysqli_query($conn, "select * from mfin");
	  $row3 = mysqli_fetch_array($sql3);
	  $mmfin = $row3['name']; ?>
<form class="form-horizontal" method="post" action="" enctype="multipart/form-data" role="form">
                    <center><img class="img-fluid w-75 h-75" style="margin-top: 70px;" src="GOLD FINANCE.jpg" alt=""></center>
                    <p><strong>SRINIVASA NAGAI ADAGU KADAI</strong>
                  
                    <center><input type="username" name="uname" placeholder="Username" required style="width: 70%;height: 40px;border: none;background-color: #eee;color: #222;border-radius:20px;text-align: center;" /></center> 
                   <center><input type="password" name="pwd" placeholder="Password" required style="width: 70%;height: 40px;border: none;background-color: #eee;color: #222;border-radius:20px;text-align: center;margin-top: 20px;"/></center> 
                   <center>
				   <select  name="mfin" style="text-align: center;width:70%;height: 40px;border: none;background-color: #eee;color: #222;margin-top: 30px;border-radius: 20px;">
                       	<?php $sql2 = mysqli_query($conn, "select * from mfin");  while($row2 = mysqli_fetch_array($sql2)) { ?>
				<option><?php echo $row2['name']; ?></option> <?php } ?>
				</select>
                        
                      </select></center>
                 <center>  <button class="bg-danger"  name="s2"style="border-radius: 20px;margin-top: 20px;width: 70%;height: 40px;">log In</button></center> 
    <div>
	  <?php
								if(isset($_POST['s2']))
								{
									extract($_POST);
									
							 $uname = str_replace(' ', '-', $uname); 

  $uname = preg_replace('/@![^A-Za-z0-9\-]/', '', $uname);
     $pwd = str_replace(' ', '-', $pwd); 

  $pwd = preg_replace('/@![^A-Za-z0-9\-]/', '', $pwd);
									$qry=mysqli_query($conn, "select * from customer where mail='$uname' && pwd='$pwd'");
																
                						
										
									$n=mysqli_num_rows($qry);
									
									if($n==0)
									{
									echo '<script language="javascript">';
echo 'alert("Invalid username or password")';
echo '</script>';	
									}
									else
									{
										$row=mysqli_fetch_array($qry);
										$dis = $row['desig'];
										$pno = $row['mno'];
										$name = $row['name']; $mfin222 = $row['inter']; $ff = NULL;
									if(($mfin222 == 'All Company') || ($mfin222 == NULL)) {  }
									else { $mfin = $mfin222; }
										if($dis=='MDD') { 
$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
$pw = str_shuffle($pw);

$username="senthoor"; 
$password="Somu1712.";
$message="Hello ".$name." , ".$pw." is the OTP for senthoormotorfinance.in . 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);

$_SESSION['uname']=$uname;
$_SESSION['pwd']=$pwd;
$_SESSION['code']=$row['code'];
	$_SESSION['mfin']=$mfin;
		$_SESSION['mfin222']=$mfin222;
$_SESSION['name']=$row['name'];
$_SESSION['postt']=$row['desig'];
$_SESSION['otp']=$pw;
$_SESSION['id']=11;
$_SESSION['username']="admin";
$_SESSION['usertype']="adminn";	
header("location:indexotp.php");

										}
										
										
										
										
										
										
										
										
										else {
										$timef = strtotime($row['timef']);
										$timet = strtotime($row['timet']);
										$timec2 =  date('H:i:s');
										$timec = strtotime($timec2);
									
										if(($timef<=$timec) && ($timet>=$timec)) {
										    	session_start();
										$_SESSION['uname']=$uname;
					                                        $_SESSION['pwd']=$pwd;						
										$code = $row['code'];
										$_SESSION['code']=$row['code'];
										$_SESSION['mfin']=$mfin;
										$_SESSION['mfin222']=$mfin222;
										$_SESSION['name']=$row['name'];
										$_SESSION['postt']=$row['desig'];
																		$_SESSION['id']=11;
$_SESSION['username']="admin";
$_SESSION['usertype']="adminn";
date_default_timezone_set("Asia/Kolkata");
$ipp = $_SERVER['REMOTE_ADDR'];
$date =  date("Y-m-d"); 
$dtime =  date("d-m-Y h:i:sa"); 
	$insert=mysqli_query($conn, "insert into loginlog(code,uname,date,dtime,ipp,mfin)
	values('$code','$uname','$date','$dtime','$ipp','$mfin')");
	if($insert) {
	header("location:index3.php"); }
										
										} 
										
										else {
echo '<script language="javascript">';
echo 'alert("Un Official Login Time . Contact Admin.")';
echo '</script>';										
										}
										
										}
								
										}
								}
							?>
	 </div> </form>
            </div>
        </div>
       </div>


      </section>

     <!-- <div class="wrapper">
    <div><span class="dot"></span></div>
    <div><span class="dot"></span></div>
    <div><span class="dot"></span></div>
    <div><span class="dot"></span></div>
    <div><span class="dot"></span></div>
    <div><span class="dot"></span></div>
    <div><span class="dot"></span></div>
    <div><span class="dot"></span></div>
    <div><span class="dot"></span></div>
    <div><span class="dot"></span></div>
    <div><span class="dot"></span></div>
    <div><span class="dot"></span></div>
    <div><span class="dot"></span></div>
    <div><span class="dot"></span></div>
    <div><span class="dot"></span></div>
  </div> -->
<!-- <div class="container" id="container">
       
        <div class="form-container sign-in-container">
            <form action="#">
                <h1> LAKSHA GOLD FINANCE</h1>
                <input type="username" placeholder="Username" required />
                <input type="password" placeholder="Password" required/>
                <select name="cars" id="cars" style="width: 100%;height: 40px;border: none;background-color: #eee;color: #222;">
                    <option value="saab">INFOSSEL AUTO FINANCE</option>
                    <option value="opel">MURUGAN FINANCE</option>
                    <option value="opel">TRICHY FINANCE</option>
                    <option value="opel">LAKSHA FINANCE</option>
                    
                  </select>
                <a href="#">Forgot your password?</a>
                <button>log In</button>
            </form>
        </div>
        <div class="overlay-container">
            <div class="overlay">
               
                <div class="overlay-panel overlay-right">
                    <img src="./WhatsApp_Image_2023-02-20_at_12.06.22_PM-removebg-preview.png" alt="" height="300" width="300" style="margin-top: -70px;">
                   <a href="https://www.youtube.com/watch?v=6hDy3wuQ2Og"><h1 style="margin-top: -70px;color: #222;text-align: center;text-decoration: underline;">FOR MORE DETAILS</h1></a>
                    <h3 style="color: #222;text-align: center;">contact: <br> +91 99522 92120 <br> +91 82207 18028 <br>+91 93619 23399</h3>
                    <p style="color: #222;text-align: center;">©2022 All Rights Reserved.</p>
                </div>
            </div>
        </div>
    </div>
    -->


    <!-- <div class="row container-fluid">
        <div class="col-lg-7">
            <div id="carouselExampleFade" class="carousel slide carousel-fade" data-bs-ride="carousel">
                <div class="carousel-inner">
                  <div class="carousel-item active">
                    <img src="./jewellery-photography-1000x1000.webp" class="img-fluid h-100 w-100 container-fluid" alt="...">
                  </div>
                  <div class="carousel-item">
                    <img src="./ca25d3e81c9923f5445ed05b0ad40b96.jpg" class="img-fluid h-100 w-100 container-fluid" alt="...">
                  </div>
                  <div class="carousel-item">
                    <img src="./creative-jewellery-photography-on-stones(1).jpg" class="img-fluid h-100 w-100 container-fluid" alt="...">
                  </div>
                </div>
                <button class="carousel-control-prev" type="button" data-bs-target="#carouselExampleFade" data-bs-slide="prev">
                  <span class="carousel-control-prev-icon" aria-hidden="true"></span>
                  <span class="visually-hidden">Previous</span>
                </button>
                <button class="carousel-control-next" type="button" data-bs-target="#carouselExampleFade" data-bs-slide="next">
                  <span class="carousel-control-next-icon" aria-hidden="true"></span>
                  <span class="visually-hidden">Next</span>
                </button>
              </div>
        </div>
        <div class="col-lg-5">
            <div class="form-container ">
            <form action="#">
                <h1> LAKSHA GOLD FINANCE</h1>
                <input type="username" placeholder="Username" required />
                <input type="password" placeholder="Password" required/>
                <select name="cars" id="cars" style="width: 100%;height: 40px;border: none;background-color: #eee;color: #222;">
                    <option value="saab">INFOSSEL AUTO FINANCE</option>
                    <option value="opel">MURUGAN FINANCE</option>
                    <option value="opel">TRICHY FINANCE</option>
                    <option value="opel">LAKSHA FINANCE</option>
                    
                  </select>
                <a href="#">Forgot your password?</a>
                <button>log In</button>
            </form>
        </div>
        </div>

    </div> -->
    <script src='https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js'></script>
    <script src="./script.js"></script>
</body>
</html>