Sam
28-01-2007, 04:36 AM
Yeah well.. Wrong section but no-one reads the coding section..
This is the code for my changepass.php but its 4am and i really cant figure out the problem (Its probablly wayyyyy simple) And i only have like 5 mins on pc tomorrow and want to get it done..
Just tell me what you think the error is ;)
<?php
include ("connect.php");
$oldpass = htmlspecialchars ($_POST[oldpass]);
$newpass = htmlspecialchars ($_POST[newpass]);
$newpass2 = htmlspecialchars ($_POST[newpass2]);
$checkpass = mysql_query("SELECT `password` from `usertable` where username= '$_SESSION['username']' and password='".$oldpass."'");
$valid = mysql_fetch_array($checkpass);
if($newpass != $newpass2) {
die("The new passes dont match. Please try again");
}
$countrow = mysql_num_rows($checkpass);
if ($countrow ==1 ) {
$update_data = mysql_query ("UPDATE `usertable` SET password='$password' WHERE
username= $_SESSION['username']");
echo ' Your pass has been changed';
}
else
{
echo 'There was an error`;
}
?>
<form name="passchange" method="post" action="<? echo $PHP_SELF; ?>">
Old Password:<br/>
<input type="password" name="oldpass" class="textbox"><br/><br/>
New Password:<br/>
<input type="password" name="newpass" class="textbox"><br/><br/>
New Password <i>(Again)</i>:<br/>
<input type="password" name="newpass2" class="textbox"><br/><br/>
<input type="submit" value="Submit" class="login" name="submit">
</form>
Cheeerrs
This is the code for my changepass.php but its 4am and i really cant figure out the problem (Its probablly wayyyyy simple) And i only have like 5 mins on pc tomorrow and want to get it done..
Just tell me what you think the error is ;)
<?php
include ("connect.php");
$oldpass = htmlspecialchars ($_POST[oldpass]);
$newpass = htmlspecialchars ($_POST[newpass]);
$newpass2 = htmlspecialchars ($_POST[newpass2]);
$checkpass = mysql_query("SELECT `password` from `usertable` where username= '$_SESSION['username']' and password='".$oldpass."'");
$valid = mysql_fetch_array($checkpass);
if($newpass != $newpass2) {
die("The new passes dont match. Please try again");
}
$countrow = mysql_num_rows($checkpass);
if ($countrow ==1 ) {
$update_data = mysql_query ("UPDATE `usertable` SET password='$password' WHERE
username= $_SESSION['username']");
echo ' Your pass has been changed';
}
else
{
echo 'There was an error`;
}
?>
<form name="passchange" method="post" action="<? echo $PHP_SELF; ?>">
Old Password:<br/>
<input type="password" name="oldpass" class="textbox"><br/><br/>
New Password:<br/>
<input type="password" name="newpass" class="textbox"><br/><br/>
New Password <i>(Again)</i>:<br/>
<input type="password" name="newpass2" class="textbox"><br/><br/>
<input type="submit" value="Submit" class="login" name="submit">
</form>
Cheeerrs