note 89983 rejected from function.session-start by danbrown
| From: | danbrown@php.net | Date: | Wed, 01 Apr 2009 01:00:30 +0000 |
| Subject: | note 89983 rejected from function.session-start by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-152674@lists.php.net to get a copy of this message | ||
Note Submitter: tomanne10 at yahoo dot com dot ph
----
Please recheck the code, so that it will not automatically get the value from form without even
adding value for each input object please help me. Thanks.
<html>
<head><title>Updating Password</title>
</head>
<body bgcolor="FFCC99">
<form name="form1" method="POST">
<center>
<B><font size=3>PASSWORD UPDATE</font></B><BR><BR>
<table>
<tr><td>
<B>Username:</B></td><td><input DISABLED= "TRUE"
type="text" name="userid" size=15 maxlength=6 value=<?php
if (isset($_REQUEST['userid'])) {
echo $_REQUEST['userid'];
}
?>></td></tr>
<tr><td>
<B>Enter New Password:</B></td><td><input type="password"
name="newpassword" size=15 maxlength=15 ></td></tr>
<tr><td>
<B>Re- Enter New Password:</B></td><td><input type="password"
name="confirmpassword" size=15 maxlength=15></td></tr>
<tr><td colspan=2 align="center"><BR>
<input type="submit" value="OK"></td></tr>
</table>
</center>
</form></body>
<?php
$userid = $_POST['userid'];
$confirmpassword = $_POST['confirmpassword'];
$newpassword = $_POST['newpassword'];
// Make a MySQL Connection
$mysql_connect = mysql_connect("localhost","anne","annezai") or
die(mysql_error());
mysql_select_db("sample") or die(mysql_error());
//New Password and Confirm Password Mismatch
if ( $newpassword <> $confirmpassword)
{echo "<script>alert('New and Confirmation Password
Mismatch')</script>"; }
else if (strlen($newpassword) < 15 and strlen($confirmpassword) > 8)
{
$confirmpassword = substr(crypt($confirmpassword),0,10);
$update_query = "UPDATE
sampltb SET password =
'$confirmpassword'
WHERE sampltb.id = '$userid'";
mysql_query($update_query) or die(mysql_error());}
else
{echo "<script>alert('Password must at least 8 to 15 characters
length')</script>"; }
?>
</html>