Guest User

Untitled

a guest
Apr 9th, 2018
282
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.85 KB | None | 0 0
  1.  <?php
  2.      
  3.         include('../pages/connect.php');
  4.         $query = "SELECT * FROM `res_admin` WHERE `id` = 12345465";
  5.         $result = mysql_query($query);
  6.         if (mysql_num_rows($result) > 0){
  7.             while ($row = mysql_fetch_array($result)){
  8.                 $res_admin_user = $row[1];
  9.                 $res_admin_pwd = $row[2];
  10.                 $res_admin_email = $row[3];
  11.             }
  12.         }
  13.         if($_SERVER['SCRIPT_NAME'] == '/restaurant/rest_yadmin/index.php') {
  14.             if(isset($_POST['submit'])) {
  15.                 $ver_algoritm = sha1($_POST['password'].'j3@2a.8#1').'a8217fa914'.sha1($_POST['password'].'43z.%2f[{,');   
  16.                 if($res_admin_user == $_POST['username'] && $res_admin_pwd == $ver_algoritm ) {
  17.                     header("Location: panel.php");
  18.                     $_SESSION['verify'] = 12;
  19.                 }
  20.                 else{
  21.                     echo '<center><span style="color:red;font-family:verdana;"><b>Username or password is incorrect.</b></span></center>';
  22.                 }
  23.             }  
  24.             if(isset($_GET['page'])) {
  25.                 $page = $_GET['page'];
  26.                 if($page == 'forgot') {
  27.                     if(!isset($_POST['submit']) || !isset($_POST['username']) || !isset($_POST['password'])) {
  28.                         $to = $res_admin_email;
  29.                         $rand_pass = str_shuffle('4g%23,.j6#zGREl^f');
  30.                         $headers = "From: Trattoria: Recuperare parola";
  31.                         $subject = "Trattoria: Recuperare parola";
  32.                         $body = 'Ati solicitat o resetare a parolei: <br /> Acum parola dvs este: '.$rand_pass;
  33.                         if(@mail($to,$subject,$body,$headers)) {
  34.                             $algoritm = sha1($rand_pass.'j3@2a.8#1').'a8217fa914'.sha1($rand_pass.'43z.%2f[{,');   
  35.                             mysql_query("UPDATE  `trattoria`.`res_admin` SET  `password` =  '".$algoritm."' WHERE  `res_admin`.`id` =12345465");
  36.                             echo '<center><span style="color:green;font-family:verdana;"><b>Verify your e-mail adress.</b></span></center>';
  37.                         }else{
  38.                             echo '<center><span style="color:red;font-family:verdana;"><b>Error with server.</b></span></center>'; 
  39.                         }  
  40.                     }
  41.                 }
  42.             }
  43.         }  
  44.     ?>
Add Comment
Please, Sign In to add comment