Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- include('../pages/connect.php');
- $query = "SELECT * FROM `res_admin` WHERE `id` = 12345465";
- $result = mysql_query($query);
- if (mysql_num_rows($result) > 0){
- while ($row = mysql_fetch_array($result)){
- $res_admin_user = $row[1];
- $res_admin_pwd = $row[2];
- $res_admin_email = $row[3];
- }
- }
- if($_SERVER['SCRIPT_NAME'] == '/restaurant/rest_yadmin/index.php') {
- if(isset($_POST['submit'])) {
- $ver_algoritm = sha1($_POST['password'].'j3@2a.8#1').'a8217fa914'.sha1($_POST['password'].'43z.%2f[{,');
- if($res_admin_user == $_POST['username'] && $res_admin_pwd == $ver_algoritm ) {
- header("Location: panel.php");
- $_SESSION['verify'] = 12;
- }
- else{
- echo '<center><span style="color:red;font-family:verdana;"><b>Username or password is incorrect.</b></span></center>';
- }
- }
- if(isset($_GET['page'])) {
- $page = $_GET['page'];
- if($page == 'forgot') {
- if(!isset($_POST['submit']) || !isset($_POST['username']) || !isset($_POST['password'])) {
- $to = $res_admin_email;
- $rand_pass = str_shuffle('4g%23,.j6#zGREl^f');
- $headers = "From: Trattoria: Recuperare parola";
- $subject = "Trattoria: Recuperare parola";
- $body = 'Ati solicitat o resetare a parolei: <br /> Acum parola dvs este: '.$rand_pass;
- if(@mail($to,$subject,$body,$headers)) {
- $algoritm = sha1($rand_pass.'j3@2a.8#1').'a8217fa914'.sha1($rand_pass.'43z.%2f[{,');
- mysql_query("UPDATE `trattoria`.`res_admin` SET `password` = '".$algoritm."' WHERE `res_admin`.`id` =12345465");
- echo '<center><span style="color:green;font-family:verdana;"><b>Verify your e-mail adress.</b></span></center>';
- }else{
- echo '<center><span style="color:red;font-family:verdana;"><b>Error with server.</b></span></center>';
- }
- }
- }
- }
- }
- ?>
Add Comment
Please, Sign In to add comment