Reply to Re: [PHP] sessions problems

Your name:

Reply:


Posted by Deep on 04/30/05 10:19

Hi,

When someone hit the logout page say "logout.php".
You can write the code in that page itself to update
the record. Since the username of that particular user
is stored as a session as long as the user closes the
browser window.

So in the logout page you can add like this.....

session_start();
include("connect.php");
$uname=$_SESSION['username'];
$sql = mysql_query("UPDATE users SET online='0'
WHERE username='$uname'");

//alternatively u can also delete that particular user
from the database instead of updating the online
status to '0'.

I hope this might help you.

Regards
...Deeps..

--- Anasta <neretlis@westnet.com.au> wrote:
> Anyone know how to update a record on logout, heres
> what i am using for
> login, however there iare no variables for the
> logout page.
>
> ?
> session_start(); // Start Session
>
> include("connect.php");
>
> $username = $_POST['username'];
> $password = $_POST['password'];
>
> // Register some session variables
> session_register('username');
> $_SESSION['username'] = $username;
> //sets user online to yes
> $sql = mysql_query("UPDATE users SET online='1'
> WHERE username='$username'
> AND password='$password'");
>
> if (($username == "admin") And ($password ==
> "admin")) {
> header("location: login_admin.php");
> } else {
> header("location: login_success.php");
> }
>
> ?>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

________________________________________________________________________
Yahoo! India Matrimony: Find your life partner online
Go to: http://yahoo.shaadi.com/india-matrimony

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация