Re: Administrator page and password problem
| From: | Erik Gjertsen | Date: | Wed, 07 Apr 2004 22:41:22 +0000 |
| Subject: | Re: Administrator page and password problem | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-182737@lists.php.net to get a copy of this message | ||
Thanks for help Red.
Cut and past is not always wok
But I have a new problem in the last line.
I don't understand why it's problem here
Thanks
Erik Gjertsen
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xml:lang="en" lang="en">
<head>
<title>Black PHP script</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<?php # script 3.11 register.php
// set the page title and include the html header.
if (isset($_POST["submit"])) { // Handel the form
// check for name
if (strlen($_POST["name"]) > 0) {
$name = TRUE;
} else {
$name = FALSE;
echo '<p>you have forgot to enter your name</p>';
}
// check for email adress
if (strlen($_POST["email"]) > 0) {
$email = TRUE;
} else {
$email = FALSE;
echo '<p>you have forgot to enter your email adress</p>';
}
// check for a usermame
if (strlen($_POST["usermame"]) > 0) {
$usermame = TRUE;
} else {
$usermame = FALSE;
echo '<p>you have forgot to enter your usermame</p>';
}
//check for a password and match against the comfirmed password.
if ( strlen ( $_POST['password1'] ) > 0 ) {
if ( $_POST['password1'] == $_POST['password2'] ) {
$password = TRUE ;
} else {
$password = FALSE;
echo '<p<Your password did not match the confirmed password!</p>';
}
} else {
$password = FALSE;
echo '<p>You forgot to enter your password!</p>';
}
if ($name && $email && $username && $password)
{ // if everyting's okayOK.
//Register the user.
echo '<p>you are now register.</p>';
} else { //Something is not TRUE.
echo '<p>Please go back and try again.</p>';
}
} else {// Display the form
?>
<form action="<?php echo
$_SERVER['PHP_SELF']; ?>" method="post">
<fieldset><legend>Enter your information in the form below</legend>
<p><b>Name:</b> <input type="text" name="name"
size="20" maxlength="40"
/></p>
<p><b>Email:</b> <input type="text" name="name"
size="40" maxlength="60"
/></p>
<p><b>User name:</b> <input type="text" name="usermame"
size="20"
maxlength="40" /></p>
<p><b>Password:</b> <input type="password"
name="password1" size="20"
maxlength="40" /></p>
<p><b>Confirm Password:</b> <input type="password"
name="password2"
size="20" maxlength="40" /></p>
</fieldset>
<div align="center"> <input type="submit" name="submit"
value="Submit
information" /></div>
</form>
</body>
</html>
"Erik Gjertsen" <erik@gjertsen.as> wrote in message
news:20040407210918.88583.qmail@pb1.pair.com...
> I try to made a administrator page that I need to writ user name and
> password. But I have problem with the password. There comes one error
where
> I writ 1..(one)
> I have not made a table on MySql but in the book I read it scowl work.
> Can some one tell me why it not work.
> Here is the code:
>
> <?php # script 3.11 register.php
> if (isset($_POST['submit'])) { // Handel the form
> // check for name
> if (strlen($_POST['name']) > 0) {
> $name = TRUE;
> } else {
> $name = FALSE;
> echo '<p>you have forgot to enter your name</p>';
> }
> // check for email adress
> if (strlen($_POST['email']) > 0) {
> $email = TRUE;
> } else {
> $email = FALSE;
> echo '<p>you have forgot to enter your email adress</p>';
> }
> // check for a usermame
> if (strlen($_POST['usermame']) > 0) {
> $usermame = TRUE;
> } else {
> $usermame = FALSE;
> echo '<p>you have forgot to enter your usermame</p>';
> }
>
> //check for a password and match against the comfirmed password.
>
> if (strlen($_POST['password1']) > 0) {
> if ($_POST['password1'] ==
> ($_POST['password2'] {
> 1..... $password = TRUE;
>
> } else {
> $password = FALSE;
> echo '<p<Your password did not match the confirmed password!</p>'
> }
> } else {
> $password = FALSE;
> echo '<p>You forgot to enter your password!</p>';
> }
> if ($name && $email && $username && $password)
> { // if everyting's okayOK.
> //Register the user.
> echo '<p>you are now register.</p>'
> } else { //Something is not TRUE.
> echo '<p>Please go back and try again.</p>'
> } else {
>
> ?>
>
> <form action="<?php echo
> $_SERVER['PHP_SELF']; ?>" method="post">
> <fieldset><legend>Enter your information in the form below</legend>
> <p><b>Name:</b> <input type="text" name="name"
> size="20" maxlength="40"
> /></p>
> <p><b>Email:</b> <input type="text" name="name"
> size="40" maxlength="60"
> /></p>
> <p><b>User name:</b> <input type="text"
> name="usermame" size="20"
> maxlength="40" /></p>
> <p><b>Password:</b> <input type="password"
> name="password1" size="20"
> maxlength="40" /></p>
> <p><b>Confirm Password:</b> <input type="password"
> name="password2"
> size="20" maxlength="40" /></p>
> </fieldset>
> <div align="center"> <input type="submit" name="submit"
> value="Submit
> information" /></div>
>
> </form>
>
> Thanks fore any help
>
> Erik Gjertsen