Jump to content

change password help?


mattm1712

Recommended Posts

 

can any1 help me this script just guves me a blank scrren i had it working then i add the bit where it tells the user there password has changed now it doesnt work  plz help

 

 

<?php

 

session_start();

 

$user = $_SESSION['user'];

 

If ($user)

 

if ($_POST['submit'])

{

 

$oldpassword = md5($_POST['oldpassword']);

$newpassword = md5($_POST['newpassword']);

$repeatnewpassword = md5($_POST['repeatnewpassword']);

 

echo "$oldpassword/$newpassword/$repeatnewpassword";

 

include 'connect.inc';

 

$queryget = mysql_query("SELECT pass FROM users WHERE name='$user'");

$row = mysql_fetch_assoc($queryget);

echo $oldpassworddb."<br>";

echo $oldpassword."<br>";

 

$oldpassworddb =$row['password'];

 

 

if ($oldpassword==$oldpassworddb)

{

if ($newpassword==$repeatnewpassword)

{

echo "pass changed";

}

else

die("pass dont  match!");

 

}

else

{

 

echo"

 

<form action='newpass.php' method='POST'>

Old password: <input type='text' name='oldpassword'><br>

New password: <input type='password' name='newpassword'><br>

Repeat password: <input type='password' name='repeatnewpassword'><br>

<input type='submit' name='submit' value='change password'>

</form>

";

}

}

?>

Link to comment
https://forums.phpfreaks.com/topic/197045-change-password-help/
Share on other sites

<?php

session_start();

$user = $_SESSION['user'];

if ($user){

if ($_POST['submit']){

$oldpassword = md5($_POST['oldpassword']);
$newpassword = md5($_POST['newpassword']);
$repeatnewpassword = md5($_POST['repeatnewpassword']);

echo "$oldpassword/$newpassword/$repeatnewpassword";

include 'connect.inc';

$queryget = mysql_query("SELECT pass FROM users WHERE name='$user'");
$row = mysql_fetch_assoc($queryget);
echo $oldpassworddb."<br>";
echo $oldpassword."<br>";

$oldpassworddb =$row['password'];


if ($oldpassword==$oldpassworddb){

   if ($newpassword==$repeatnewpassword) {
   echo "pass changed";
   }else{
   die("pass dont  match!");
   }
   
}else{

echo "<form action='newpass.php' method='POST'>
   Old password: <input type='text' name='oldpassword'><br>
   New password: <input type='password' name='newpassword'><br>
   Repeat password: <input type='password' name='repeatnewpassword'><br>
   <input type='submit' name='submit' value='change password'>
</form>";
}
}
}
?>

hi i try using this code but i get this error

 

Parse error: syntax error, unexpected $end in /home/sites/moseleyengineering.co.uk/public_html/matt/newpass.php  on line 45

 

normally when i get errors like this i have missed brackets out but your code looks fine

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.