File manager - Edit - /home/autoph/public_html/data03252025consolidation/app/employee/reset_password.php
Back
<?php include_once("../../cfg/db.php"); $return_arr["status"]=0; $return_arr["message"]=" No Action."; if(isset($_POST['email'])){ $post_email = $db -> escape(trim($_POST['email'])); // echo "SELECT COUNT(1) FROM employee_contact WHERE email_address = '$post_email'"; if(intval($db -> select("SELECT COUNT(1) FROM employee_contact WHERE email_address = '$post_email'")) < 1){ $return_arr["status"]=0; $return_arr["message"]=" Email address not yet registered."; echo json_encode($return_arr); return; }else{ $account_currrent_key = $db -> select("SELECT eak.`account_key` FROM `employee_account_key` eak INNER JOIN employee_contact ec ON eak.employee_id=ec.employee_id WHERE ec.email_address = '$post_email' ORDER BY eak.id DESC LIMIT 1"); // if($db -> sql_query("SELECT id FROM employee_account_key T WHERE TIMESTAMPDIFF(MINUTE,T.date_expire,NOW()) < 2 AND `account_key` = '$account_currrent_key'") -> num_rows == 0){ $post_employeeid = $db -> select("SELECT `employee_id` FROM `employee_contact` WHERE `email_address` = '$post_email'"); $account_key = md5(uniqid()); $account_code = mt_rand(100000, 999999); $db -> sql_query("DELETE FROM `employee_account_key` WHERE `employee_id` = '$post_employeeid' AND `type` = '2'"); $query_account_key = "INSERT INTO `employee_account_key`(`employee_id`, `account_key`, `account_code`,`type`) VALUES ('$post_employeeid','$account_key','$account_code', '2')"; $db -> sql_query($query_account_key); // ToDo Insert activation Here $site_link = str_replace("https","http",$variable['site_link']); $url = $site_link.'app/mail/mail.php'; $data = array('email' => $post_email,'subject' => $db->select("SELECT value FROM `settings_notification` WHERE `name` = 'reset_email_subject'"),'message' => $db->select("SELECT value FROM `settings_notification` WHERE `name` = 'reset_email_message'").'<br><br>'.$variable['site_link'].'recover.php?account='.$account_key); // 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); // } $return_arr["status"]=1; $return_arr["message"]=" Password reset link sent to your email."; echo json_encode($return_arr); } } ?>
| ver. 1.4 |
.
| PHP 7.3.33 | Generation time: 0 |
proxy
|
phpinfo
|
Settings