File manager - Edit - /home/autoph/public_html/connectv1/resources/views/employees/activate.php
Back
<?php include('cfg/db.php'); if(isset($_SESSION['user'])){ header('location:home.php'); } if(!isset($_GET['account']) || trim($_GET['account']) == '' ){ header('location:home.php'); } // select * from employee T where // TIMESTAMPDIFF(MINUTE,T.date_registered,NOW()) < 5 $account_key = $db -> escape(trim($_GET['account'])); $account_information = $db -> sql_query("SELECT ea.`employee_id`, ea.`account_key`, ea.`account_code`,ea.date_start,ea.date_expire , ec.contact_number, ea.status FROM `employee_account_key` ea INNER JOIN employee_contact ec ON ea.employee_id=ec.employee_id WHERE ea.account_key = '$account_key' AND status = 1"); $account_information_count = $account_information -> num_rows; // echo "SELECT ea.`employee_id`, ea.`account_key`, ea.`account_code`,ea.date_start,ea.date_expire , ec.contact_number, ea.status // FROM `employee_account_key` ea // INNER JOIN employee_contact ec // ON ea.employee_id=ec.employee_id // WHERE ea.account_key = '$account_key' AND status = 1"; if($account_information_count > 0){ while($row = $account_information->fetch_assoc()) { $employee_id = $row['employee_id']; $account_key = $row['account_key']; $account_code = $row['account_code']; $contact_number = "0".$row['contact_number']; $date_start = $row['date_start']; $date_expire = $row['date_expire']; // if($date_expire == ''){ // $db -> sql_query("UPDATE employee_account_key SET `date_expire`= NOW() WHERE employee_id = '$employee_id' AND employee_account_key = '$account_key'"); // } // echo "SELECT id FROM employee_account_key T WHERE TIMESTAMPDIFF(MINUTE,T.date_expire,NOW()) < 3 AND `account_key` = '$account_key'"; if($db -> sql_query("SELECT id FROM employee_account_key T WHERE TIMESTAMPDIFF(MINUTE,T.date_expire,NOW()) < 3 AND `account_key` = '$account_key'") -> num_rows == 0){ //update and send $db -> sql_query("UPDATE employee_account_key SET `date_expire`= NOW() WHERE employee_id = '$employee_id' AND account_key = '$account_key' "); //SEND SMS $site_link = str_replace("https","http",$variable['site_link']); $url = $site_link.'app/sms/sms.php'; $data = array('number' => $contact_number,'message' => $db->select("SELECT value FROM `settings_notification` WHERE `name` = 'activation_sms_message'").' '.$account_code); // use key 'http' even if you send the request to https://... $options = array( 'http' => array( 'header' => "Content-type: application/x-www-form-urlencoded\r\n", 'method' => 'POST', 'content' => http_build_query($data) ) ); $context = stream_context_create($options); $result = file_get_contents($url, false, $context); if ($result === FALSE) { /* Handle error */ } // var_dump($result); } //clcylate diff } }else{ header('location:home.php'); } ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title><?php echo $variable['site_name']; ?> | Recover Password</title> <!-- Google Font: Source Sans Pro --> <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,400i,700&display=fallback"> <!-- Font Awesome --> <link rel="stylesheet" href="plugins/fontawesome-free/css/all.min.css"> <!-- icheck bootstrap --> <link rel="stylesheet" href="plugins/icheck-bootstrap/icheck-bootstrap.min.css"> <!-- Theme style --> <link rel="stylesheet" href="dist/css/adminlte.min.css"> <!-- overlayScrollbars --> <link rel="stylesheet" href="plugins/overlayScrollbars/css/OverlayScrollbars.min.css"> <!-- overlayScrollbars --> <link rel="stylesheet" href="plugins/overlayScrollbars/css/OverlayScrollbars.min.css"> <link href="dist/img/<?php echo $variable['logo']; ?>" rel="icon" /> </head> <body class="hold-transition login-page"> <div class="login-box"> <div class="card card-outline card-primary"> <!-- <div class="card-header text-center"> <a href="home.php" class="h1"><b><?php echo $variable['site_name']; ?></b></a> </div> --> <div class="card-header text-center"> <center><a href="home.php"><img class="brand-image img-circle elevation-3" src="dist/img/<?php echo $variable['logo']; ?>" alt="<?php echo $variable['logo']; ?>" width="130px" height="130px"></a></center> <a href="home.php" class="h1"><b></b><?php /*$pieces = explode(" ", $variable['site_name']); echo $pieces[1];*/ echo "Connect"; ?></a> </div> <div class="overlay" id="loader" style="display:none;"> <div class="fas fa-2x fa-sync-alt fa-spin "> </div> <strong><span class="ml-2" id="loading-message"> Loading...</span></strong> </div> <div class="card-body"> <form id="login_form"> <div class="alert" role="alert" id="error-alert" style="display:none;"> <span id="error-icon" class="icon fas"> </span> <span id="alert-message"></span></a> </div> <p class="login-box-msg" id="number-label">Mobile Number: <?php echo "********".substr($contact_number,strlen($contact_number)-2,strlen($contact_number)) ?></p> <div class="input-group mb-3" id = "code-div"> <input oninput="this.value=this.value.slice(0,this.maxLength)" type = "number" maxlength = "6" id="code" class="form-control" placeholder="Activation Code" > <div class="input-group-append"> <div class="input-group-text"> <span class="fas fa-lock"></span> </div> </div> </div> <div class="row"> <div class="col-6"> <span name="resend" id="resend" href="#" class="btn btn-primary btn-block">Resend Code</span> </div> <div class="col-6"> <button type="submit" name="activate" id="activate" class="btn btn-primary btn-block">Activate</button> </div> <!-- /.col --> </div> <p class="mt-3 mb-1"> <a href="signin.php">Login</a> </p> </div> </div> <!-- /.login-card-body --> </div> </div> <!-- /.login-box --> <!-- jQuery --> <script src="plugins/jquery/jquery.min.js"></script> <!-- Bootstrap 4 --> <script src="plugins/bootstrap/js/bootstrap.bundle.min.js"></script> <!-- AdminLTE App --> <script src="dist/js/adminlte.min.js"></script> <script> $("#resend").click(function(){ $('#resend').attr('disabled', true); location.reload(); }); </script> <script> $(document).ready(function(){ $('#error-icon').addClass("fa-check"); $('#error-alert').addClass("alert-success"); $('#alert-message').text('Activation code sent to your number.'); $('#error-alert').fadeIn(); setTimeout(function () { $('#error-alert').fadeOut()}, 5000); }); </script> <script> // $("#activate").click(function(){ $("#login_form").submit(function(event){ event.preventDefault(); $('#code').removeClass("is-invalid"); var account_key = '<?php echo $account_key; ?>'; var input_code = $.trim($("#code").val()); if(input_code.length < 6){ $('#code').addClass("is-invalid"); $("#code").focus(); return; } $.ajax({ url: "app/employee/activate_account.php", data: { account_key : account_key, input_code : input_code } , type: "POST", dataType: 'json', beforeSend:function(){ $('#error-icon').addClass("fa-info"); $('#error-alert').addClass("alert-info"); $('#error-alert').fadeIn(); $('#alert-message').text(" Activating your account, please wait..."); $('#activate').attr('disabled', true); $('#resend').attr('disabled', true); }, success: function (result) { $('#activate').attr('disabled', false); $('#resend').attr('disabled', false); if (result.status!=1) { remove_alert_bg(); $('#error-icon').addClass("fa-ban"); $('#error-alert').addClass("alert-danger"); $('#alert-message').text(result.message); }else{ remove_alert_bg(); $('#error-icon').addClass("fa-check"); $('#error-alert').addClass("alert-success"); $('#alert-message').text(result.message); $('#code-div').fadeOut(); $('#activate').fadeOut(); $('#resend').fadeOut(); $('#number-label').fadeOut(); } $('#resend').attr('disabled', false); }, error: handleError }); }); function handleError(xhr, status, error){ remove_alert_bg(); $('#error-icon').addClass("fa-ban"); $('#error-alert').addClass("alert-danger"); $('#alert-message').text("Error has occured. Please try again."); $('#activate').attr('disabled', false); $('#resend').attr('disabled', false); } function remove_alert_bg(){ $('#error-alert').removeClass("alert-success"); $('#error-alert').removeClass("alert-danger"); $('#error-alert').removeClass("alert-info"); $('#error-icon').removeClass("fa-check"); $('#error-icon').removeClass("fa-info"); $('#error-icon').removeClass("fa-ban"); } </script> </body> </html>
| ver. 1.4 |
.
| PHP 7.3.33 | Generation time: 0 |
proxy
|
phpinfo
|
Settings