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
Old 11-12-2004, 02:04 PM   #1 (permalink)
freeups
Registered User
 
Join Date: Nov 2004
Posts: 1
freeups is on a distinguished road
Login With Sessions

In Login With Sessions by sde which is great. It works with one annoying error message. I keep getting the following error message
I have PHP 5.02

Warning: Unknown: Your script possibly relies on a session side-effect which existed until PHP 4.2.3. Please be advised that the session extension does not consider global variables as a source of data, unless register_globals is enabled. You can disable this functionality and this warning by setting session.bug_compat_42 or session.bug_compat_warn to off, respectively. in Unknown on line 0

I have been trying to read on how to fix it. It seems to be something in auth.php in the tutorial (below). After doing some research it seems to be something to do with the following statements.

session_register("username");
session_register("password");

I am probably wrong. Anyway the full code is below. Any help is appreciated.


<?
// Login & Session example by sde
// auth.php

// start session
session_start();

// convert username and password from _POST or _SESSION
if($_POST["username"])
{
$username=$_POST["username"];
$password=$_POST["password"];
}
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
where username='" . $username . "' and password='" . $password . "'");

// retrieve number of rows resulted
$num=mysql_num_rows($result);

// print login form and exit if failed.
if($num < 1){
session_destroy();
echo "You are not authenticated. Please login.<br><br>

<form method=POST action=index.php>
username: <input type=text name=\"username\">
password: <input type=password name=\"password\">
<input type=submit>
</form>";

exit;
}
?>
freeups is offline   Reply With Quote
Old 11-12-2004, 05:57 PM   #2 (permalink)
sde
Moderator
 
sde's Avatar
 
Join Date: May 2002
Location: us.ca
Posts: 4,487
sde is on a distinguished road
yeah, starting and using sessions now is a lot easier: example:
PHP Code:
session_start();
$_SESSION['username'] = "sde";
$_SESSION['password'] = "123"
you don't need to use session_register() anymore. i need to update the tutorial.
__________________
Mike
sde is offline   Reply With Quote
Old 11-12-2004, 07:18 PM   #3 (permalink)
Kernel_Killer
Regular Contributor
 
Kernel_Killer's Avatar
 
Join Date: Feb 2003
Location: indisclosed
Posts: 210
Kernel_Killer is on a distinguished road
On this note, how would you go about using a UNIX user login?
__________________
Network Synapse
Screaming Electron
Kernel_Killer is offline   Reply With Quote
Old 11-12-2004, 07:24 PM   #4 (permalink)
sde
Moderator
 
sde's Avatar
 
Join Date: May 2002
Location: us.ca
Posts: 4,487
sde is on a distinguished road
could you write a shell script to validate if a user / pass sent to it is valid? if so, make the script output 0 or 1, and then you can have php execute that script and use the output as a pass/fail indicator.

other than that, i have no clue.
__________________
Mike
sde is offline   Reply With Quote
Old 11-12-2004, 09:05 PM   #5 (permalink)
Kernel_Killer
Regular Contributor
 
Kernel_Killer's Avatar
 
Join Date: Feb 2003
Location: indisclosed
Posts: 210
Kernel_Killer is on a distinguished road
That could work. I'll try it later, and let you know how it goes.
__________________
Network Synapse
Screaming Electron
Kernel_Killer 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
login session help please Namraw PHP 2 09-14-2004 03:26 PM
Sessions are constantly dropping mtlinfo PHP 3 03-26-2004 12:20 AM
php sessions a_o PHP 6 11-27-2003 02:05 AM
narrowed down login trouble trevor PHP 7 01-18-2003 05:50 PM


All times are GMT -8. The time now is 11:32 AM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.0.0 RC8





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