Hi everyone i am having problems creating a change password function. I did have this working but for some reason it wont now.
Form Code:
- HTML: Select all
<form action="updatePass.php" post="post">
<input id="oldpass" type="text" class="contentText" name="oldpass">
<input id="newpass" type="text" class="contentText" name="newpass">
</form>
PHP code:
- PHP: Select all
<?php
include "config.php";
$username = $_COOKIE['loggedin'];
if (!isset($_COOKIE['loggedin'])) die("You are not logged in, <a href=index.html>click here</a> to login.");
mysql_connect($server, $db_user, $db_pass) or die (mysql_error());
mysql_select_db($database)
or die ("Could not select database because ".mysql_error());
mysql_query("UPDATE $table SET password = '".$_POST['newpass']."'
WHERE password = '".$_POST['oldpass']."'");
?>
When i try it at the minute it just deletes the current password from DB.
Any ideas or is there an easier way to do it?
Thanks
Robert