| | |
Users have to login and logout twice, why?
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Jul 2009
Posts: 20
Reputation:
Solved Threads: 0
Hi..
I'm newbie here..
I have a problem with my login and logout script..
Here is the login script:
here is the logout script:
and I have a variable which is called in every page that define some one logged in:
With that code, users have to login twice before he is in real login state. It happens to with logout.
Why?
Thank's for helping me..
I'm newbie here..
I have a problem with my login and logout script..
Here is the login script:
PHP Syntax (Toggle Plain Text)
<?php $q = "SELECT * FROM members WHERE username='%s' AND password='%s'"; $q = sprintf($q, $username, $password); $q = mysql_query($q); if (mysql_num_rows($q) > 0) { $_SESSION['id'] = $q[0]['id']; $IS_LOGGED_IN = true; } ?>
here is the logout script:
PHP Syntax (Toggle Plain Text)
<?php session_start(); unset($_SESSION['userid']); session_destroy(); $_SESSION = array(); header('Location: index.php'); ?>
and I have a variable which is called in every page that define some one logged in:
$IS_LOGGED_IN = (isset($_SESSION['userid'] && $_SESSION['userid'] !== ''); With that code, users have to login twice before he is in real login state. It happens to with logout.
Why?
Thank's for helping me..
•
•
Join Date: Aug 2009
Posts: 1
Reputation:
Solved Threads: 0
Check all of your links to the other web pages. I had the same problem with the session resetting itself when I had the <a href="http://www.yoursite.com/page.php"> instead of <a href="page.php"> I set all of them the same way no mixing and matching them together to navigate through the page and it worked.
![]() |
Similar Threads
- how to get login and logout time of User..? (PHP)
- XP stuck in login-logout loop! (Windows NT / 2000 / XP)
- Php Help: Login, Logout Script (PHP)
- How to display online users (PHP)
- Plz help me out for the source code in java for login-logout (Java)
- PHP Query, Make users login before accessing a movie? (PHP)
Other Threads in the PHP Forum
- Previous Thread: Simple PHP Regex Question!
- Next Thread: PHP variable in link
| Thread Tools | Search this Thread |
# 5.2.10 alexa apache api array beginner binary broken cakephp checkbox class clean clients cms code cron curl database date directory display dissertation dynamic echo echo$_get[x]changingitintovariable... email encode error fairness file files folder form forms function functions google href htaccess html image images include indentedsubcategory insert ip javascript joomla legislation limit link local login mail memberships menu mlm multiple multipletables mysql mysqlquery newsletters oop open paypal pdf persist php problem provider query radio random recursion remote rss script search server sessions simple sms sockets source space spam sql syntax system table tutorial update upload url validator variable video web youtube





