السلام عليكم ..
كل عام وانتم بخير وتقبل الله منا ومنكم صالح الأعمال ..
عندي مشكلة في كود تغيير الباسوورد لـ مستخدم user يريد تغيير كلمة المرور بعد تسجيل الدخول ..
عند تنفيذ الكود يظهر لي الخطأ :
Parse error: parse error, expecting `','' or `';'' in D:\xampp\htdocs\abha_hotel\change_password.php on line 54
طبعاً لما راجعت الكود مالقيت شي مريب خصوصاً وأن السطر 54 عبارة عن بداية الوسم لـ form وهو كالتالي:
<form action="change_password.php" method="post">
لا أدري ما المشكلة هنا؟!
ياليت المساعدة ..
<?php
session_start();
$user= $_SESSION['username']; // to check if the user logged in
if ($user)
{
if ($_POST['submit'])
{
// check fields
$oldpass= $_POST['oldpass']; // using md5 encrypted password
$newpass= $_POST['newpass'];
$renewpass= $_POST['repeatnewpass'];
// check password against DB
// connect to DB
$connect= mysql_connect("localhost","root","") OR die ("couldn't connect!!");
mysql_select_db("abha_hotel") OR die ("couldn't fine DB");
$queryget= mysql_query("SELECT password FROM customers WHERE username='$username'") or die ("Query doesn't work");
$row= mysql_fetch_assoc($queryget); // this creates an array
$oldpassdb= $row['password'];
// check passwords
if ($oldpass == $oldpassdb)
{
// check tow new passwords
if ($newpass == $renewpass)
{
// success
// change passwords in DB
$querychange= mysql_query("
UPDATE customers SET password= '$newpass' WHERE username = '$username'
");
session_destroy();
die("your password has been changed. <a href='login1.php'>Return</a> to the login page");
}
else
die ("New passwords do not match");
}
else
die ("Old password does not match");
}
else
{
echo"
<form action="change_password.php" method="post">
<table width="51%" border="0">
<tr>
<th colspan="2" bgcolor="#CCCCCC" scope="row">Change password</th>
</tr>
<tr>
<th width="42%" class="style3" scope="row"><div align="right" class="style3">Old password:</div></th>
<td width="58%"><label>
<input type="text" name="oldpass" id="oldpass" />
</label></td>
</tr>
<tr>
<th bgcolor="#E8E8E8" class="style3" scope="row"><div align="right" class="style3">New password:</div></th>
<td bgcolor="#E8E8E8"><label>
<input type="password" name="newpass" id="newpass" />
</label></td>
</tr>
<tr>
<th class="style3" scope="row"><div align="right" class="style3">Re-enter New Password:</div></th>
<td><label>
<input type="password" name="repeatnewpass" id="repeatnewpass" />
</label></td>
</tr>
<tr>
<th colspan="2" scope="row"> </th>
</tr>
<tr>
<th scope="row"> </th>
<td><label>
<input type="submit" name="submit" id="submit" value="Change password" />
<input type="reset" name="Reset" id="Reset" value="Reset" />
</label></td>
</tr>
</table>
</form>
";
}
}
else
die("you must be logged in to change the password. You can <a href='login1.php'>login</a> now.");
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>change_password</title>
</head>
<body>
</body>
</html>شكراً لكم
رمضان كريم ،،