jonassvensson4

Untitled

Sep 15th, 2015
133
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.20 KB | None | 0 0
  1.     if(isset($_POST['Update'])) //OM UPDATE KNAPPEN TRYCKS PÅ SÅ...
  2.     {
  3.  
  4.         $PW = $_POST['Password'];
  5.  
  6.         if(password_verify($PW, $row['Password'])) //KOLLAR OM LÖSENORDET MATCHAR MED DET I DATABASEN
  7.         {
  8.  
  9.             if(isset($_POST['NewPassword'])) //KOLLAR OM NYA-LÖSENORDS-FÄLTET ÄR I FYLLT -- HOPPAR ÖVER DENNA
  10.             {
  11.                 if($_POST["NewPassword"] == $_POST["RepPassword"])
  12.                 {
  13.                     $UpdatePW = $_POST['NewPassword'];
  14.                
  15.                     $StorePassword = password_hash($UpdatePW, PASSWORD_BCRYPT, array('cost' => 10));
  16.  
  17.                     $sql = $con->query("UPDATE user SET Password = '{$StorePassword}' where UserID=$User");
  18.  
  19.                     echo '<script>';
  20.                     echo 'Alert("Ditt lösenord är uppdaterat!");';
  21.                     echo '</script>';
  22.  
  23.                     header('Location: logout.php');
  24.                 }
  25.                 else
  26.                 {
  27.                     echo '<script>';
  28.                     echo 'alert("Lösenordern matchar inte!");';
  29.                     echo '</script>';
  30.                 }
  31.             }
  32.  
  33.             /*if(isset($_POST['Skola']))
  34.             {
  35.                 $UpdateSchool = $_POST['Skola'];
  36.  
  37.                 $sql = $con->query("UPDATE user SET School = '{$UpdateSchool}' where UserID=$User");
  38.  
  39.                 header('Location: account.php');
  40.             }*/
  41.         }
  42.         else
  43.         {
  44.             echo '<script>';
  45.             echo 'alert("Du har anget fel lösenord!");';
  46.             echo '</script>';
  47.         }
  48.     }
Advertisement
Add Comment
Please, Sign In to add comment