Wrox Home  
Search P2P Archive for: Go

  Return to Index  

pro_php thread: Easiest way to log out?


Message #1 by Jefferis Peterson <jefferis@p...> on Thu, 31 May 2001 15:20:45 -0400
I am still learning php but what about

session_destroy();

-CAA


-----Original Message-----
From: Jefferis Peterson [mailto:jefferis@p...]
Sent: Thursday, May 31, 2001 2:21 PM
To: professional php
Subject: [pro_php] Easiest way to log out?


What is the easiest way to destroy a session authentication?  I am
tracking the current user by the following code with the Mysql database:
 
>    //authenticate vistor  
>
>    if ($g_databasename=="")  
>    {  
>       /* include("my_const.h");  */
>    }  
>
>        $con2 = mysql_connect($hostname,$user,$password);  
>
>    if ($con2==0)  
>    {      
>        echo("303 Problem connecting to MySQL\n");  
>        exit(0);  
>    }  
>          
>        $db2 = mysql_select_db($g_databasename,$con2);  
>
>        $sql2=sprintf("select userid from sessions where
>ipaddress=\"%s\"",$REMOTE_ADDR);  
>        $res2=mysql_query($sql2,$con2);  
>
>    $nr=mysql_num_rows($res2);  
>
>    mysql_free_result($res2);  
>
>           if ($nr==0)      
>    {  
>        echo("<font face=arial><h1>Access Denied!</h1>\n");  
>        echo("If you have reached this page in error, <a
>href=\"javascript:history.go(-1);\">click  
>here to  try again.</a><br> If you do not have a username and password, <a

>href=\"newmember.php\">click here to fill out an application.</a>\n");  
>        exit();  
>    }  
>
>?>  
>  

-- 
Jefferis Kent Peterson
www.PetersonSales.net
Flash, Web Design and Marketing 
ICQ 19112253


  Return to Index