Hi, pls help me...
I have a login page (login.php):
//check if user is coming from a form
if ($_POST['op'] == "ds") {
//check username and password
if (($_POST[username] != "admin") || ($_POST[password] != "inv123")) {
//handle bad login
$msg = "<P><strong> <center>You Are Not Authorized!!</center> </strong></P>";
$show_form = "yes";
} else {
//handle good login
$valid = "yes";
$_SESSION[valid] = $valid;
$show_menu = "yes";
}
} else {
//determine what to show
if ($valid == "yes") {
$show_menu = "yes";
} else {
$show_form = "yes";
}
}
//build form block
$form_block ="
<p></p>
<p></p>
<h1><center>Administrator</center></h1>
<form method=POST action=\"$_SERVER[PHP_SELF]\">
$msg
<b><center>Please enter username and password: </center></b>
<P align=center><strong>Username:</strong><br>
<input type=\"text\" name=\"username\" size=15 maxlength=25></P>
<P align=center><strong>Password:</strong><br>
<input type=\"password\" name=\"password\" size=15 maxlength=25></P>
<input type=\"hidden\" name=\"op\" value=\"ds\">
<P align=center><input type=\"submit\" name=\"submit\" value=\"Login\">
<input type=\"reset\" name=\"reset\" value=\"Cancel\"></P>
</FORM>";
//build menu block
$menu_block ="
<h1><center>Proforma Invoice System</center></h1>
<P align=center><strong> Administration Menu</strong></p>[list]<center>
<li><a href=\"addform.php\">Add a New Invoice</a>
<li><a href=\"mod.php\">Modify an Existing Invoice</a>
<li><a href=\"del.php\">Delete an Existing Invoice</a>
<li><a href=\"admin_logout.php\">Logout</a>
</center></ul>
<P align=center><strong>View Records</strong>[list]
<li><center><a href=\"show_inv.php\">Show All Invoices.<center></a>
</ul></p>";
//assign the block to show to the $display_block variable
if ($show_form == "yes") {
$display_block = $form_block;
} else if ($show_menu == "yes"){
$display_block = $menu_block;
}
?>
When I run at browser,
http://192.168.0.9/inv/login.php
I get this error:
Notice: Undefined index: op in C:\Inetpub\wwwroot\inv\login.php on line 15
Notice: Undefined variable: valid in C:\Inetpub\wwwroot\inv\login.php on line 35
Notice: Undefined variable: msg in C:\Inetpub\wwwroot\inv\login.php on line 52
How to fix it?
I use PHP4 Win2000 Service Pack 4 IIS 5.0
Thanks in advance!!!