Hi,
I'm trying to use this code (found it on codewalkers). It was working fine, I have changed login variable to be login instead of Login. It gave me undefined PHP_SELF so I replaced the following line:
<form id="form1" name="form1" method="post" action="<? echo $PHP_SELF;>">
with this:
<form id="form1" name="form1" method="post" action="<? echo $_SERVER['PHP_SELF']?>">
Now its giving me error on line 13 which is this line:
$Login = $_POST['login'];
I don't know why? I mean for me I cant see where the error in that line is.
Any help,
Thanks so much
Here is almost the whole code that I'm using:
<?
//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();
include_once("include/db_connection.php");
$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.
//Check matching of username and password.
$result=mysql_query("select * from reviewer where username='$username' and password='$md5_password'");
if(mysql_num_rows($result)!='0'){ // if match.
session_register("username"); // Craete session username.
header("location:main.php"); // Re-direct to main.php
exit;
}else { // if not match.
$message="<font size='3' color='red'>--- Incorrect username or password. Please try again ---</font>";
}
} // 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>Welcome to Movies Reviews</title>
</head>
<body>
<?php echo $message; ?>
<form id="form1" name="form1" method="post" action="<? echo $_SERVER['PHP_SELF']?>">
<table>
<tr>
<td>User : </td>
.....