ERROR IN CHANGE PASSWORD TUTORIAL
Title
Question
HELLO ! THANX FOR YOUR TUTORIALS . THESE WERE VERY HELPFUL FOR ME.. BUT AFTER I FOUND ALL , I COULDN'T GO RIGHT WITH CHANGE PASSWORD TUTORIAL. THERE IS AN ERROR COMING ON MY SCREEN .. YOU PLEASE CHECK IT OUT... Fatal error: Function name must be a string in C:\xampp\htdocs\changepassword.php on line 195 PLEASE TELL ME WAT IS THE PROBLEM
<?php
@$username = $_SESSION['username'];
@$submit=$_POST['submit'];
if ($username)
{
if('submit')
{
@$oldpassword =md5($_POST['oldpassword']);
@$newpassword =md5($_POST['newpassword']);
@$repassword =md5($_POST['repassword']);
$connect = mysql_connect("localhost","root","");
mysql_select_db("userlogin") or die();
$queryget = mysql_query("SELECT password FROM users WHERE username='$username'") or die("couldn't connect!");
$row = mysql_fetch_assoc($queryget);
$oldpassworddb = $row['password'];
if($oldpassword==$oldpassworddb)
{
if($newpassword==$repassword)
{
$querychange =mysql_query("UPDATE users SET password='$newpassword' WHERE username='$username'");
die("Your password has been changed. <a href='mbkpage.php'>Return</a> back to main page");
}
else
die ("New Passwords Do Not Match");
}
ELSE
die ("Old Passwords doesnt match");
}
else
{
echo"<form action='changepassword.php' method='POST'>
Old Password: <input type='text' name='oldpassword'><p>
New Password: <input type='password' name='newpassword'><br>
Repeat New Password: <input type='password' name='repassword'><p>
<input type='submit' name='submit' value='Change Password'>
</form>
";
}
}
else
die ("you must be logged in");
?>
<?php
@$username = $_SESSION['username'];
@$submit=$_POST['submit'];
if ($username)
{
if('submit')
{
@$oldpassword =md5($_POST['oldpassword']);
@$newpassword =md5($_POST['newpassword']);
@$repassword =md5($_POST['repassword']);
$connect = mysql_connect("localhost","root","");
mysql_select_db("userlogin") or die();
$queryget = mysql_query("SELECT password FROM users WHERE username='$username'") or die("couldn't connect!");
$row = mysql_fetch_assoc($queryget);
$oldpassworddb = $row['password'];
if($oldpassword==$oldpassworddb)
{
if($newpassword==$repassword)
{
$querychange =mysql_query("UPDATE users SET password='$newpassword' WHERE username='$username'");
die("Your password has been changed. <a href='mbkpage.php'>Return</a> back to main page");
}
else
die ("New Passwords Do Not Match");
}
ELSE
die ("Old Passwords doesnt match");
}
else
{
echo"<form action='changepassword.php' method='POST'>
Old Password: <input type='text' name='oldpassword'><p>
New Password: <input type='password' name='newpassword'><br>
Repeat New Password: <input type='password' name='repassword'><p>
<input type='submit' name='submit' value='Change Password'>
</form>
";
}
}
else
die ("you must be logged in");
?>
PHP-and-MySQL User-Password-Change-Part-3 03-04 min 0-10 sec
Answers:
Dear User,
Can you please paste your code in the question.
Can you please paste your code in the question.
Login to add comment