- Joined
- Jun 16, 2010
- Messages
- 249
- Reaction score
- 76
Change Password Script
The UberCMS is leaked, therefore incomplete. It has a lot of features missing, including the "Change Password" option. Below is how I would form a change password script (general idea thinking of how it could work, what would need to be coded and what variables may need to be set if you were to officially make one).
Post your opinions on how this could be setup, and how it should be setup. Feel free to use this base and complete it.
Legend:
COLOR - Needs to be modified to match what it should be.
The HTML: (could look something like this)
Code:
<form method="post" action="">
<table>
<tr>
<td>New Password</td>
</tr>
<tr>
<td><input type="password" name="npassword"></td>
</tr>
<tr>
<td>Re-enter New Password</td>
</tr>
<tr>
<td><input type="password" name="rnpassword"></td>
</tr>
<tr>
<td></td>
<td><input type="submit" name="submit"></td>
</tr>
</table>
</form>
The PHP: (could look something like this)
Code:
<?php
$error_message_1 = "<span style="color:red;">The new password must be 3-15 characters in length.</span>"; //Error Message (password length)
$error_message_2 = "<span style="color:red;">The passwords must match.</span>"; //Error Message (passwords must match)
$success_message_1 = "<span style="color:green;">The new password has been successfully updated!</span>"; //Success Message (password updated)
[COLOR="YellowGreen"]$susername = $_SESSION['username'];[/COLOR] //Variable for the session username
$npassword = $_POST['npassword']; //Variable for the new password
$rnpassword = $_POST['rnpassword']; //Variable for the confirmed new password
$submit = $_POST['submit']; //Variable for the submit button
if (isset($submit) == true) {
$password = strtolower(preg_replace("/[^a-zA-Z0-9\-\_\!\$\#\@\^\&\*\(\)\^\+\ \.\?]/", "", $npassword));
if ((isset($submit) == true) and ((strlen($npassword) > 15) || (strlen($npassword) < 3) || (strlen($rnpassword) > 15) || (strlen($rnpassword) < 3))) {
echo $error_message_1;
}
else if ((isset($submit)) and ($npassword != $rnpassword)) {
echo $error_message_2;
} else {
$query = mysql_query("[COLOR="YellowGreen"]REGISTER NEW PASSWORD QUERY[/COLOR]");
echo $success_message_1;
}
}
?>
Last edited: