Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- session_start();
- include '../_inc/loader.php';
- if($user->loggedIn()) {
- include("../_html/header.html");
- if(isset($_POST['email']) && isset($_POST['password']) && isset($_POST['cpassword'])) {
- if(empty($_POST['email']) || empty($_POST['password']) || empty($_POST['cpassword'])) {
- echo "<center>Field was left blank!</center>";
- } else {
- $email = $security->data($_POST['email']);
- $password = $security->encrypt($_POST['password']);
- $cpassword = $security->encrypt($_POST['cpassword']);
- if($password != $cpassword) {
- echo "<center>Passwords did not match</center>";
- } else {
- $query = $db->query("SELECT * FROM `users` WHERE `username` = '{$_SESSION['username']}' && `password` = '{$password}'");
- $fetch = $db->fetch($query);
- if($password != $fetch['password']) {
- echo "<center>Password does not match current one!</center>";
- } else {
- $db->query("UPDATE `users` SET `emailc` = '{$email}' WHERE `username` = '{$_SESSION['username']}'");
- echo "<center>Profile Updated!</center>";
- }
- }
- }
- } else {
- include("../_html/_forms/form_settings.html");
- }
- } else {
- header('Location: login.php');
- }
Add Comment
Please, Sign In to add comment