View Single Post
  #1 (permalink)  
Old 10-04-03, 02:41 PM
TinnyFusion TinnyFusion is offline
New Member
 
Join Date: Oct 2003
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Question PHP & sessions, why won't it work?

Hi all, I have made a simple username & password login script that uses sessions.
The problem is that it just does not do anything at all....
On my system I can not login at all, it just seems to clear the username & password form no matter if the username & password are correct or not.

Please could someone advise me of what I need to change either in my php.ini or my httpd.conf so that I can get sessions working ok.

Here is the code:

config.php
PHP Code:

<?

# Admin Panel User Name
$uname "admin";
# Admin Panel Password
$pword "admin";
?>
index.php
PHP Code:

<? 

require ("config.php");
session_start();
if ((!
$username) || (!$password)) {
echo 
'<form name=login method=post action="">
user:<input type=text name=username><br>
pass:<input type=text name=password><br>
<input type=submit value=go>
</form>'
;
}
else {
if (
$username=="$uname")  {
session_register("username"); 
session_register("password"); 
echo 
"user is $uname, and password is $pword
<br> <a href=\"?m=1\" >unreg</a>"
;
}
else echo 
"nope";
}
if (
$m==1) {
session_unregister("username"); 
session_unregister("password"); 
}
?>
If it helps here is a bit of a run down to what I have installed at the moment:
Apache Server v2.0.47
ActivePerl v5.8.0
PHP v4.3.2
MySQL v4.0.15
phpMyAdmin v2.5.3
All running from Windows XP pro

Also, I have tried quite a lot of scripts to add a 'members' section to my website and all are the same, I simply can not login to any of them so I am guessing that its something to do with my server setup.

Thank you in advance, TinnyFusion

(I have added the code as an attachment to this post)
Attached Files
File Type: zip session.zip (1.0 KB, 236 views)

Last edited by TinnyFusion; 10-04-03 at 02:47 PM.
Reply With Quote