Ben şimdi ben ne yapıyorum sana söylüyorum .. benim ana sayfasına link değişim şifre var ...
- İlk i üç textboxes eski şifre, yeni şifre sahip olduğu edit_profile.php adında bir html form oluştururken tüm, password.I şifresini değiştirmek için ana sayfasına bir bağlantı olarak bu sayfayı attcahed onaylamak.
- Sonraki sayfa i yeni şifre ve onaylamak şifreleri eşit ya değilse ben comaparing am hangi adında edit_profile1.php tasarladık
- Sonra ben password = Eski şifre ile veri aramak için bir sorgu yapmak
I kodunu size iki dosya veriyorum ve son olarak ben karşı karşıyayım ne tür hata söyleyecektir working.Now Ancak bu sayfa değil ..
edit_profile.php
<?php
session_start();
?>
<html>
<body bgcolor="pink">
<table cellpadding="10" cellspacing="6" align="center" width="500">
<form name="form" action="edit_profile1.php" method="POST" >
<tr>
<td><b><i>Your Username</i></b></td>
<td><input type="text" name="username" id="username" size="30" maxlength="30" value="<?php echo $_SESSION['employee']['username']; ?>" disabled="disabled"></td>
</tr>
<tr>
<td><b><i>Old Password</i></b></td>
<td><input type="password" name="opassword" id="opassword" size="30" maxlength="30" value="" ></td>
</tr>
<tr>
<td><b><i>New Password</i></b></td>
<td><input type="password" name="npassword" id="npassword" size="30" maxlength="30" value="" ></td>
</tr>
<tr>
<td><b><i>Confirm Password</i></b></td>
<td><input type="password" name="cpassword" id="cpassword" size="30" maxlength="30" value="" ></td>
</tr>
<tr>
<td align="center" colspan="100"> <input type="submit" name="submit" value="Change Password"></td>
</tr>
</table>
</body>
</html>
Sonraki Sayfa
Next page is for edit_profile1.php
<?php
session_start();
if(isset($_POST['opassword']) && ($_POST['npassword']))
{
$con=mysql_connect("localhost","root","");
if(!$con)
{
die('Could Not Connect:'.mysql_error());
}
mysql_select_db("tcs",$con);
$a=$_POST['opassword']; //old password value
$b=$_POST['npassword']; //new password value
$c=$_POST['cpassword'];
if ($b==$c) //checking if both new passowrd and c.password are equal or not
{
$pwd=hash('sha1',$b); //new value is assigned to pwd variable
$usr=$_SESSION['employee']['username']; //this varaible have value of username
$query="select * from employee where Username='{$usr}' and Password='{$a}'";
$result=mysql_query($query,$con);
$count = mysql_num_rows($result);
if ($count == 1)
{
$sql="update employee set Password='$pwd'";
$deepak=mysql_query($sql,$con);
if($deepak)
{
echo "Updation Successfull";
}
else
{
echo "Updation Not Possible.Some Error is there";
}
}
else
{
echo "There is some problem in macthing the old password with database password";
}
}
else
{
echo "Both Passwords are Not equal";
}
}
else
{
echo 'Error! Passwords were not sent!';
}
?>
<html>
<body bgcolor="orange">
<h4 style="position: relative;"><a href="home_page.php" style="position: absolute; left: 0;">Home Page</a></h4>
</body>
</html>
Hata:
Every time i try to execute my programe the error is Thhere is some problem in macthing the old password with database password
I tek bir kullanıcı row.Plz hata nedir söyle bana var wrong.In veritabanını düşüyorum nerede Şimdi ben almıyorum