Hi guys,
I just got a new pc and copied all my php projects from the old pc.
I also installed the latest version of XAMPP, Netbeans and PHP.
All my projects were fine but now are showing the following errors:
Notice: Undefined index: Submit in C:\xampp\htdocs\QuickBeam\index.php on line 8
Notice: Undefined index: action in C:\xampp\htdocs\QuickBeam\index.php on line 63
Notice: Undefined variable: warning in C:\xampp\htdocs\QuickBeam\index.php on line 104
I have been working with PHP 5 for the last 2 years and never saw this error.
I dont know if it has anything to do with the new version of PHP I installed.
<?php
require_once 'inc.php';
?>
<?php
//DO Login when the button is clicked
if("Login" == $_POST['Submit']){
$_user = CleanData($_POST['user_name']);
$_pwd = CleanData($_POST['user_pwd']);
//both fields required
if("" != $_user && "" != $_pwd)
{
$hash_val = md5($_pwd);
$password = $hash_val;
//set object from authentication class
$User = strtolower($_user);
$auth = new Registration();
$auth->Login($User, $password);
//call the helper function to find out the valaue of sucsees property
if($auth->Success()){
//set user session
$_SESSION['regis_user'] =$User;
//redirect the user
header("location: index.php");
exit();
}else{
$auth2 = new Authentication();
$auth2->login($User,$password);
if($auth2->Success()){
//set user session
$_SESSION['admin_user'] =$User;
//redirect the user
header("location: admin/home.php");
exit();
}else{
$warning=" Incorrect username or Password!";
}
}
} else{
$warning=" Both fields are required!";
}
}
?>
<?php
//check for logout
if("logout"==$_GET['action']){
$auth=new Authentication();
$auth->logout();
$auth2=new Registration();
$auth2->Logout();
}
?>
<?php PublicHeader();?>
<?php PublicNav();?>
<div id="wrapper">
<div id="content">
<?php if(!isset($_SESSION['regis_user'])){
if(!isset($_SESSION['admin_user'])) {?>
<fieldset id="fld_login">
<form method="post" action="index.php">
<table>
<td>
<label for="user_name" class="required">Name:</label>
<input type="text" name="user_name" id="user_name" size="30" value="<?php echo $_user; ?>">
</td>
<td>
<label for="user_pwd" class="required">Password:</label>
<input type="password" name="user_pwd" id="user_pwd" size="30">
</td>
<td>
<input type="submit" name="Submit" value="Login" class="button">
</td>
<td><?php if($warning){ echo("<p class='error_message'>{$warning}");}?></td>
</table>
</form>
</fieldset>
<?php }} ?>
<div align="center"><h2>Welcome to QuickBeam</h2></div>
<form method="post" action="<?php echo $_SERVER['PHP_SELF']?>">
<input type="text" name="date" id="date">
</form>
<div align="left"><img alt ="" src="images/myimg2.jpg" />
</div>
</div>
</div>
<?php PublicFooter();?>
Any help is welcome,
Mike