<?php
session_start();
echo 'POST: ';
print_r($_POST);
echo '<br />SESSION: ';
print_r($_SESSION);

require("DBconnect.php");
$user=$_SESSION['username'];
$pass=$_POST['password'];
echo $pass;
$salt = dechex(mt_rand(0, 2147483647)) . dechex(mt_rand(0, 2147483647)); 
$password = hash('sha256', $pass . $salt); 
for($round = 0; $round < 65536; $round++) 
{ 
    $p= hash('sha256', $password . $salt); 
}
echo $salt;
echo "....";
echo $p;
$qry="update users set password='$p' and salt='$salt' where username='$user'";
$result=mysql_query($qry);
if($result)
{

     echo "password updated successfully";

}
else
{
    die();
}

?>

***everything is working fine but in database it is not updating the values ,i am getting the values of user,salt,p still not updating if($result is also woking
***

Member Avatar for iamthwee

check if db password field has enough characters allocated eg varchar(500)

i allocated 500 to password field again it is updating 0

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.