I'm trying to make a form only submitable after entering a username and password but can't seem to get it to work. The edit.php contains the php form there going to be editing.
The html that submits to that page...PHP Code:<?php
$username = $_POST['user'];
$password = $_POST['password'];
if (user=="name1" || user=="name2") {
if (password=="thepassword") {
include("edit.php");
}
else
{
echo "Username or Password not entered correctly please try again.";
}
}
?>
This is what the edit.php contains don't know if it's displayable with the include but i hope it is...Code:<form method="post" action="word.php" style="border:#000000 2px solid; width:375px;"> Username: <input type="text" name="user" size="35" /> <br /> Password: <input type="password" name="password" size="35" /><br /> <input type="submit" value="Submit Password" style="text-align:center;" /> </center></form>
PHP Code:<!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>Edit Questions</title>
</head>
<body>
<?php
$ipi = getenv("REMOTE_ADDR");
$httprefi = getenv ("HTTP_REFERER");
$httpagenti = getenv ("HTTP_USER_AGENT");
?>
<input type="hidden" name="ip" value="<?php echo $ipi ?>" />
<input type="hidden" name="httpref" value="<?php echo $httprefi ?>" />
<input type="hidden" name="httpagent" value="<?php echo $httpagenti ?>" />
Your Name:
<input type="text" name="name" size="35" />
<br />
<textarea name="question" rows="4" cols="44"><?php
$myFile = "questions.txt";
$fh = fopen($myFile, 'r');
$theData = fread($fh, 20000000);
fclose($fh);
echo $theData;
?></textarea>
<br /><center>
<input type="submit" value="Send Your Question" style="text-align:center;" />
</center></form>
</body>
</html>
Thanks for any help and suggestions you can offer.



Reply With Quote


Bookmarks