<?php



ini_set('session.gc_maxlifetime', 30*60);

session_start();

include '../includes/config.php';


$DID = $_GET['DID'];
$user_ID = $_GET['user_ID'];




$Error='';

$Verification_Code = $_GET['Verification_Code'];
$D_ID = $_GET['D_ID'];
$Phone_Number = $_GET['Phone_Number'];


$PN = '+962'.substr($Phone_Number, 1);



if(isset($_POST['Submit1']))
{


$Verification_Code = $_POST['Verification_Code'];
$D_ID = $_POST['D_ID'];
$Code = $_POST['Code'];


$query = mysqli_query($dbConn,"UPDATE drivers set Status='Active' where ID='$D_ID'"); 



if ($Code==$Verification_Code){
	
	
	echo '<script language="JavaScript">
            document.location="Drivers/";
        </script>';
	
	
}else{
	
	
	$Error = 'Error ! verification code is not correct !';

	
	
}



}







if(isset($_POST['Submit2']))
{


$Verification_Code = $_POST['Verification_Code'];
$D_ID = $_POST['D_ID'];
$Code = $_POST['Code'];
$Phone_Number = $_POST['Phone_Number'];



$PN = '+962'.substr($Phone_Number, 1);




 //file_get_contents('http://josmsservice.com/smsonline/msgservicejo.cfm?numbers='.$PN.'&senderid=FutureDel&AccName=futureds&AccPass=C@So$L8lu5!7&msg='.$Verification_Code.'&requesttimeout=5000000');

	$Error = 'Verification code resend !';



}




?>

<!doctype html>
<html lang="en">
<head>
    <!-- Required meta tags -->
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">

    <!-- Bootstrap CSS -->
    <link rel="stylesheet" href="../css/bootstrap.min.css">
    <!-- FontAwesome -->
    <link rel="stylesheet" href="../css/fontawesome.css">
    <!-- Main Style -->
    <link rel="stylesheet" href="../css/styles.css">
    <title>Sign up</title>
	
	<style>
@font-face {
   font-family: myFirstFont;
   src: url(../fonts/Arial-Rounded-MT-Bold-Regular.ttf);
   font-size:8px;
}



body {
   font-family: myFirstFont !important;
   text-align: right !important;
}


</style>


	
	    <link rel="shortcut icon" href="../images/icon.ico"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0,user-scalable=0"/>


</head>
<body>

<!--Loading Container Start-->
<div id="load" class="loading-overlay display-flex flex-column justify-content-center align-items-center">
    <div class="primary-color font-28 fas fa-spinner fa-spin"></div>
</div>
<!--Loading Container End-->

<div class="row h-100">
    <div class="col-xs-12 col-sm-12">

       
        <!--Page Title & Icons Start-->
        <div class="header-icons-container text-center">
           <!-- <a href="sign-up.html">
                <span class="float-left">
                    <img src="icons/back.svg" alt="Back Icon">
                </span>
            </a>-->
            <span><br>Sign up</span>
        </div>
        <!--Page Title & Icons End-->
        <div class="rest-container">
            <div class="text-center header-icon-logo-margin e">
                <img src="../images/icon.png" width="20%" style="border-radius: 10%;" alt="Main Logo">

                <!--Verification Information Container Start-->
                <div class="margin-top-25">
                    <div class="verify-text">
                       <span class="font-20" style="color:#011F39">Verify code</span>
                    </div>
                    <span class="font-weight-light font-roboto font-15" style="color:#011F39">
                        Please check your sms. <br/>
                        We just sent a verification code on your phone number
                        <br/>
                        <?php echo $PN; ?>
                    </span>
                </div>
                <!--Verification Information Container Start-->

            </div>

            <!--Enter Verification Code Container Start-->
            <div class="sign-up-form-container text-center">
                <form class="width-100" method="post" action="Drivers-Sign-Up-3.php?DID=<?php echo $DID; ?>&user_ID=<?php echo $user_ID; ?>&Phone_Number=<?php echo $Phone_Number; ?>&Verification_Code=<?php echo $Verification_Code; ?>&D_ID=<?php echo $D_ID; ?>">

<input name="Verification_Code" type="hidden" value="<?php echo $Verification_Code; ?>"/>
					<input name="D_ID" type="hidden" value="<?php echo $D_ID; ?>"/>
					<input name="Phone_Number" type="hidden" value="<?php echo $Phone_Number; ?>"/>
					                  

				  <div class="form-group">
                        <div class="input-group border-bottom">
                            <input class="form-control verify-sms" type="tel" name="Code" placeholder="----" maxlength="4" required>
							<div class="input-group-append password-visibility">
                               
                            </div>
                        </div>
                    </div>
                   <div class="font-roboto">
                        <span style="color:#011F39">Didn't get a code? </span> <input type="submit" name="Submit2" style="height:50px; font-size: 16px; width:150px !important; border-radius: 12px; color:#fff; border:none; background-image: linear-gradient(to right, #B3E207 0%, #3ADBDB 100%);" style="10%" class="btn btn-default  btn-xs " value="Resend code"/>
                    </div>
                    <div class="form-submit-button">
					<input type="submit" name="Submit1" style="height:50px; font-size: 16px; width:250px !important; border-radius: 12px; color:#fff; border:none; background-image: linear-gradient(to right, #B3E207 0%, #3ADBDB 100%);" class="btn  w-100 mb-3" value="Verify"/>
						<br><br>
											<center><span style="color:red"><?php echo $Error; ?></span></center>

                    </div>
                </form>
            </div>
            <!--Enter Verification Code Container End-->

        </div>
    </div>

   <!--Terms And Conditions Agreement Container Start-->
      <div class="col-xs-12 col-sm-12 text-center sms-rate-text font-roboto flex-end margin-bottom-30">
        <div class="container-sms-rate-text width-100 font-11">
            <span class="light-gray font-weight-light" style="color:#011F39">By signing up you have agreed to our </span>
            <br/>
            <a style="color:#011F39" href="Terms_Policy.php?DID=<?php echo $DID; ?>&user_ID=<?php echo $user_ID; ?>" class="dark-link">
                <span class="font-weight-light" style="011F39">Terms of use & privacy policy</span>
            </a>
        </div>
    </div>
    <!--Terms And Conditions Agreement Container End-->


<div class="footer" style="margin-top:-200px">
</div>

</div>


<style>
  .footer {
    background-image: url('../images/footer.png');
    background-size: cover;
    background-repeat: no-repeat;
    height: 280px; 
    bottom: 0;
    width: 120%;
	
  }
</style>
<!-- Optional JavaScript -->
<!-- jQuery first, then Popper.js, then Bootstrap JS -->
<script src="../js/jquery-3.4.1.js"></script>
<script src="../js/popper.min.js"></script>
<script src="../js/bootstrap.min.js"></script>
<script src="../js/main.js"></script>
</body>
</html>