Code Newbie
News     Forums     Search     Members     Sign Up    

My Code Newbie
Username

Password

Articles/Snippets
ASP Classic
ASP.NET
C
C#
C++
HTML / CSS
Java
Javascript
Linux / BSD
Perl
PHP
Python
Ruby
SQL
VB 6
VB.NET

C.N. Friends
  Planet Rome

Link to Us!
Code Newbie
  Code Newbie
    forums

Go Back   Code Forums > Application and Web Development > PHP

Reply
 
LinkBack Thread Tools Display Modes
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
Old 07-28-2004, 09:54 AM   #2 (permalink)
sde
Moderator
 
sde's Avatar
 
Join Date: May 2002
Location: us.ca
Posts: 4,532
sde is on a distinguished road
Hi Charlie,

Locate your php.ini file and modify the line below: ( usually /etc/php4/php.ini )
Code:
error_reporting  =  E_ALL & ~E_NOTICE
it is also pretty common to turn register globals to on. ( just not as secure )
Code:
register_globals On
once you make the change(s), restart apache and try it again.
__________________
Mike
sde is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How does the tutorial section work? DavH27 Lounge 3 08-27-2004 03:46 AM
Anyone Know of a Generic C++ Builder Autorun Tutorial ? Nicotine Standard C, C++ 0 05-11-2004 08:32 PM
The Largest Tutorial in Code Newbie History! sde Code Newbie News 5 04-24-2004 08:19 PM
New Tutorial: Python Lists Overview sde Code Newbie News 3 03-24-2004 10:54 AM
tutorial stats sde Lounge 1 03-20-2004 03:45 PM


All times are GMT -8. The time now is 07:03 PM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0 RC8 ©2007, Crawlability, Inc.





Copyright © 2000-2008, Milano Interactive
Web Hosting provided by Portal 360 Web Hosting