Guest User

Untitled

a guest
Oct 18th, 2017
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.19 KB | None | 0 0
  1. <?php
  2.     session_start();
  3.     include '../_inc/loader.php';
  4.    
  5.     if($user->loggedIn()) {
  6.         include("../_html/header.html");
  7.         if(isset($_POST['email']) && isset($_POST['password']) && isset($_POST['cpassword'])) {
  8.             if(empty($_POST['email']) || empty($_POST['password']) || empty($_POST['cpassword'])) {
  9.                 echo "<center>Field was left blank!</center>";
  10.             } else {
  11.                 $email = $security->data($_POST['email']);
  12.                 $password = $security->encrypt($_POST['password']);
  13.                 $cpassword = $security->encrypt($_POST['cpassword']);
  14.                 if($password != $cpassword) {
  15.                     echo "<center>Passwords did not match</center>";
  16.                 } else {
  17.                     $query = $db->query("SELECT * FROM `users` WHERE `username` = '{$_SESSION['username']}' && `password` = '{$password}'");
  18.                     $fetch = $db->fetch($query);
  19.                     if($password != $fetch['password']) {
  20.                         echo "<center>Password does not match current one!</center>";
  21.                     } else {
  22.                         $db->query("UPDATE `users` SET `emailc` = '{$email}' WHERE `username` = '{$_SESSION['username']}'");
  23.                         echo "<center>Profile Updated!</center>";
  24.                     }
  25.                 }
  26.             }
  27.         } else {
  28.             include("../_html/_forms/form_settings.html");
  29.         }
  30.     } else {
  31.         header('Location: login.php');
  32.     }
Add Comment
Please, Sign In to add comment