View Single Post
Old 07-27-2004, 05:00 PM   #1 (permalink)
cengen
Registered User
 
Join Date: Jul 2004
Posts: 1
cengen is on a distinguished road
help with "Login with Sessions" tutorial

[disclaimer]
I am new to LAMP, php, mysql, ect... come from 'wintel' world and mostly "MikeRoweSoft" languages

[issue]
I am having a lot of difficulty with sessions. I have tried three examples from different sources, and something is not happy....

with the wonderfully simple and great example 'Login with sessions' I get the following errors

[errors]
Notice: Undefined index: username in /var/www/html/auth.php on line 9

Notice: Undefined index: username in /var/www/html/auth.php on line 14

Notice: Undefined variable: username in /var/www/html/auth.php on line 29

Notice: Undefined variable: password in /var/www/html/auth.php on line 29


[code snippet]
here is the code from SDE's example, starting on line 8, first php code on line 9;

// convert username and password from _POST or _SESSION

Line 9 --->if($_POST["username"])
{
$username=$_POST["username"];
$password=$_POST["password"];
}
Line 14 ---->elseif($_SESSION["username"])
{
$username=$_SESSION["username"];
$password=$_SESSION["password"];
}

// start and register session variables
session_register("username");
session_register("password");

// connect to database
include("connect.php");

// query for a user/pass match
$result=mysql_query("select * from users
Line 29 ---> where username='".$username."' and password='".$password."'");

[Plea for help] (help me, help me !!)
If anyone can help a new guy to the world of php, please help !!

Thanks, - Charlie

cengen is offline   Reply With Quote