| | |
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
- Php Help: Login, Logout Script (PHP)
- how to get login and logout time of User..? (PHP)
- XP stuck in login-logout loop! (Windows NT / 2000 / XP)
- 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
Views: 417 | Replies: 2
| Thread Tools | Search this Thread |
Tag cloud for PHP
.htaccess access ajax apache api array beginner binary broken cakephp checkbox class cms code cron curl database date datepart directory display download dynamic echo email error file files folder form forms function functions google href htaccess html image include insert integration ip java javascript joomla jquery limit link list login loop mail menu methods mlm mod_rewrite multiple mysql oop parse password paypal pdf php problem query radio random recursion regex remote script search select seo server sessions sms soap source space speed sql structure syntax system table tutorial update updates upload url validation validator variable video web webdesign xml youtube





