Tuesday, 23 July 2013

How To Update a Password In php

How To Update a Password In php


<!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>Update password</title>
</head>

<body>
<?php
mysql_connect("localhost","root","");
mysql_select_db("login");
$old=$_REQUEST['pwd'];
$new=$_REQUEST['npwd'];
$cnew=$_REQUEST['cpwd'];

if($new==$cnew)

{
$q="update loginhere set password='$cnew' WHERE password='$old'";

$qu=mysql_query($q);

if($qu)
{
echo "password updated";
}}
else
{
echo "password missmatch";
}

?>

</body>

</html>

No comments: