Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $submit = strip_tags($_POST['submit']);
- $username = strtolower(strip_tags($_POST['username']));
- $oldpassword = strip_tags($_POST['oldpassword']);
- $newpassword = strip_tags($_POST['newpassword']);
- $firstname = strip_tags($_POST['first']);
- $lastname = strip_tags($_POST['last']);
- $gender = strip_tags($_POST['gender']);
- $address = strip_tags($_POST['address']);
- $zipcode = strip_tags($_POST['zip']);
- $contact = strip_tags($_POST['con']);
- $email = strip_tags($_POST['mail']);
- error_reporting(E_ALL);
- if ($submit)
- {
- if ($username && $oldpassword && $newpassword && $firstname && $lastname && $address && $zipcode && $contact && $email)
- {
- $connect = mysql_connect("localhost", "root", "") or die(mysql_error());
- mysql_select_db("brightlights") or die(mysql_error());
- $updatecheck = mysql_query("SELECT * FROM tb_user WHERE username='$username'");
- $count = mysql_num_rows($updatecheck);
- if ($count <= 1)
- {
- if ($_SESSION['password'] == ($oldpassword))
- {
- mysql_query("UPDATE tb_user SET username = '$username', password = '$newpassword', Firstname = '$firstname', Lastname = '$lastname', gender = '$gender', address = '$address', zipcode = '$zipcode', contact = '$contact', email = '$email' WHERE username='" . $_SESSION['username'] . "'");
- $_SESSION['username'] = $username;
- $_SESSION['password'] = $newpassword;
- $_SESSION['Firstname'] = $firstname;
- $_SESSION['Lastname'] = $lastname;
- $_SESSION['gender'] = $gender;
- $_SESSION['address'] = $address;
- $_SESSION['zipcode'] = $zipcode;
- $_SESSION['contact'] = $contact;
- $_SESSION['email'] = $email;
- session_write_close();
- echo "Succesfully Updated!";
- } else {
- echo "Password not match!";
- }
- } else {
- echo "Username already Taken!";
- }
- } else {
- echo "Please fill up all form!";
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement