PDA

View Full Version : Error with script



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

Tomm
28-01-2007, 08:18 AM
And the error message is ''/

Blob
28-01-2007, 10:29 AM
And the error message is ''/

Yes that would help lol.

YouFail
28-01-2007, 10:53 AM
There isnt an error =/ It just doesnt submit it. You should of remembered to tell them that Sam...

Sam
28-01-2007, 01:17 PM
Look at the time it was posted >.>

Rofl..

Umm i think i did say..

The text just disappears when you hit submit and it doesnt update the database.

Want to hide these adverts? Register an account for free!