SHARE
TWEET

Untitled

a guest Apr 20th, 2018 47 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2. session_start();
  3. $_SESSION['msg']='Password Updated';
  4. $total=0;
  5.  
  6. if ($_SERVER['REQUEST_METHOD'] == 'POST')
  7. {
  8.     $mail=$_SESSION['email'];
  9.     $db = @mysqli_connect('localhost','root','','test0');
  10.     $query = "SELECT * FROM user_login_info where Email = '$mail' ";
  11.     $response=mysqli_query($db,$query);
  12.     $user=mysqli_fetch_assoc($response);
  13.  
  14.     $opassword=trim($_POST["opassword"]);
  15.  
  16.     if($opassword != $user["Password"])
  17.     {
  18.         $_SESSION['msg']='Old Password is Not correct';
  19.     }
  20.     else
  21.     {
  22.         $fname=trim($_POST["fname"]);
  23.         if(!empty($fname))
  24.         {
  25.             $total=1;
  26.             $query = "UPDATE user_login_info SET FirstName='$fname' where Email = '$mail' ";
  27.             mysqli_query($db,$query);
  28.             $_SESSION['msg']='First Name Updated';
  29.         }
  30.  
  31.         $lname=trim($_POST["sname"]);
  32.         if(!empty($lname))
  33.         {
  34.             $total=1;
  35.             $query = "UPDATE user_login_info SET SecondName='$sname' where Email = '$mail' ";
  36.             mysqli_query($db,$query);
  37.             $_SESSION['msg']='Second Name Updated';
  38.  
  39.         }
  40.  
  41.         $number=trim($_POST["number"]);
  42.         if(!empty($number))
  43.         {
  44.             $total=1;
  45.             $query = "UPDATE user_login_info SET ContactNumber='$number' where Email = '$mail' ";
  46.             mysqli_query($db,$query);
  47.             $_SESSION['msg']='Contact Number Updated';
  48.         }
  49.  
  50.         $anumber=trim($_POST["identification"]);
  51.         if(!empty($anumber))
  52.         {
  53.             $total=1;
  54.             $query = "UPDATE user_login_info SET aadhar='$anumber' where Email = '$mail' ";
  55.             mysqli_query($db,$query);
  56.             $_SESSION['msg']='Aadhar Number Updated';
  57.  
  58.         }
  59.  
  60.        
  61.         $password=trim($_POST["password"]);
  62.         $password2=trim($_POST["password2"]);
  63.  
  64.         if(!empty($password))
  65.         {
  66.             $total=1;
  67.            
  68.            
  69.             if(empty($password2))
  70.             {
  71.                 $_SESSION['msg']='Please Confirm your new password';
  72.  
  73.             }
  74.             else if($password != $password2)
  75.             {
  76.                 $_SESSION['msg']='New Passwords do not match';
  77.  
  78.             }
  79.             else
  80.             {
  81.                 $query = "UPDATE user_login_info SET Password='$password' where Email = '$mail' ";
  82.                 mysqli_query($db,$query);
  83.                 $_SESSION['msg']='Password Updated';
  84.  
  85.             }
  86.            
  87.         }
  88.  
  89.         if($total==0)
  90.         {
  91.             $_SESSION['msg']='Nothing to Change';
  92.  
  93.         }
  94.     }
  95. }
  96.  
  97.  
  98.  
  99. ?>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top