Jump to content

[SOLVED] Undefined Index


SkyRanger

Recommended Posts

I am getting this error, I probably looked at it 10x but keeps getting by me.  I am missing something very obvious but can't seem to see it.  Can somebody have a look at this and let me know what the problem is.  The error I am getting is:

 

Notice: Undefined index: Login in admin\index.php on line 19
which is:
$Login=$_POST['Login'];

 

I never started getting this error until I put in:

$filename = '../install/index.php';

if (file_exists($filename)) {
    header('Location: ../install/index.php');
} else {

 

 

error_reporting(E_ALL);

$filename = '../install/index.php';

if (file_exists($filename)) {
    header('Location: ../install/index.php');
} else {
// Use session variable on this page. This function must put on the top of page.
session_start();

////// Logout Section. Delete all session variable.
session_destroy();

$message="";

////// Login Section.
$Login=$_POST['Login'];
if($Login){ // If clicked on Login button.
$username=$_POST['username'];
$md5_password=md5($_POST['password']); // Encrypt password with md5() function.

// Connect database.

include '../inc/dbconnect.php';

mysql_connect($dbhost,$dbuname,$dbpass);
mysql_select_db($dbname);

// Check matching of username and password.
$result=mysql_query("select * from admin where username='$username' and password='$md5_password'");
if(mysql_num_rows($result)!='0'){ // If match.
session_register("username"); // Craete session username.
header("location:calendar.php"); // Re-direct to calendar.php
exit;
}else{ // If not match.
$message="--- Incorrect Username or Password ---";
$message1="--- Click below to recover password ---";
}

} // End Login authorize check.
?>

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>ESSCalendar :: Administration</title>
</head>

<body>
<table width="298" border="0" align="center" cellpadding="2" cellspacing="2">
  <tr>
    <td width="290"><center><? echo $message; ?></center></td>
  </tr>
  <tr>
    <td><center><? echo $message1; ?></center></td>
  </tr>
</table>


<form id="form1" name="form1" method="post" action="<? echo $PHP_SELF; ?>">
<table width="400" border="1" align="center" cellpadding="2" cellspacing="2">
  <tr>
    <td width="100" rowspan="3" align="center" valign="middle"><img src="../images/callock.png"></td>
    <td width="79">User: </td>
    <td width="193"><input name="username" type="text" id="username" /></td>
  </tr>
  <tr>
    <td>Password: </td>
    <td><input name="password" type="password" id="password" /></td>
  </tr>
  <tr>
    <td colspan="2"><div align="middle"><input name="Login" type="submit" id="Login" value="Login" /></div></td>
    </tr>
</table>
</form>
<div align="center"><a href="recover.php">Recover Password</a></div>
</body>
</html> 
<?php	
}
?>

Link to comment
https://forums.phpfreaks.com/topic/153758-solved-undefined-index/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.