function random_password($length = 8) { $chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#\$%^&*()_-=+;:,.?"; $password = substr(str_shuffle($chars), 0, $length); return $password; } if (isset($_POST)) { $location = $_POST['location']; $mailid = $_POST['mailid']; $otableuser = new GenericTable($dbh, 'fb_userdetails'); $otablepassword = new GenericTable($dbh, 'fb_password'); $pass = random_password(8); $password = md5($pass); $updatelist = array('password' => $password, 'changepassword' => 'Y'); $clause = "where location='{$location}'"; $otableuser->updateRow($updatelist, $clause); $plist = array('LOCNAME' => $location, 'EMAIL' => $mailid, 'PASSWORD' => $pass, 'TIMESTAMP' => time()); $otablepassword->insertRow($plist); //Email Header $emailheader = "From: ikure <*****@*****.**>\r\nContent-type: text/html"; $to = $mailid; $subject = "Password Reset"; $txt = "Your account password has been reset to the following password.<BR/> Password: "******"text/javascript"> alert("Your password has been send to registered mail id."); window.location.href = "login.php"; </script> <?php } else {
<?php include_once "model/GenericTable.php"; include_once "header.php"; if (isset($_POST)) { $location = $_POST['location']; $status = $_POST['status']; $otablefeedback = new GenericTable($dbh, 'fb_location'); if ($status == 'Y') { $disable = 'N'; } else { $disable = 'Y'; } $list = array('DISABLE' => $disable); $clause = "where LOCID='{$location}'"; $otablefeedback->updateRow($list, $clause); echo "true"; }
<?php include_once "model/GenericTable.php"; include_once "header.php"; if (isset($_POST)) { $userid = $_POST['userid']; $status = $_POST['status']; $otableUserDetails = new GenericTable($dbh, 'fb_userdetails'); if ($status == 'Y') { $disable = 'N'; } else { $disable = 'Y'; } $list = array('DISABLE' => $disable); $clause = "where USERID='{$userid}'"; $otableUserDetails->updateRow($list, $clause); echo "true"; }