[PHP]how can i create a log out page?

Status
Not open for further replies.
Joined
Apr 24, 2011
Messages
1,235
Reaction score
405
how do i create a log out page using php?

If You Need My Logged_in.php Here It Is
PHP:
<?

include "config.php";

include "func.ban.php";

checkban($_SERVER['REMOTE_ADDR']);

?>

<?

session_start();

include_once "includes/db_connect.php";

include_once "includes/functions.php";



logincheck();

?>



<html>

<head>

<link rel="shortcut icon" href="favicon.ico.png">
<title>Way of The Mafia</title>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

<link rel=stylesheet href=includes/in.css type=text/css>

</head>

<frameset rows="*" cols="168,*" frameborder="no" border="0" framespacing="0">

<frame src="menu.php" name="leftFrame" scrolling="auto" noresize="noresize" id="leftFrame" title="leftFrame">


<? if($info->bann == "0"){ ?>
<frameset rows="68,*" cols="*" framespacing="0" frameborder="no" border="0">

<frame src="banner.php" name="banner" scrolling="No" noresize="noresize" id="topFrame" title="topFrame">
<? } ?>


<frameset rows="24,*"  cols="*" framespacing="0" frameborder="NO" border="0">

<frame src="mini.php" name="topFrame" scrolling="NO" noresize >









<frameset rows="*" cols="*<? if($info->box == "0"){ ?>,180<? } ?>" frameborder="no" border="0" framespacing="0">

<frame src="story.php" name="middle" id="mainFrame" title="mainFrame">
<? if($info->box == "0"){ ?>
<frame src="/chat/index.php" name="shoutbox" scrolling="auto" noresize="noresize" id="shoutbox" title="shoutbox">

<? } ?>







</frameset>

</frameset>

</frameset>

</frameset>

<noframes><body></frameset>

</body></noframes>

</html>

If You Could Help Me That Would be Great.

After WE Have Created the Log_out.php how would i add it to my menu?
ill post screeny of where i want it to go
Her - [PHP]how can i create a log out page? - RaGEZONE Forums
 
Re: how can i create a log out page?

PHP:
session_destroy();
Along as your only using sessions to keep login data this will work
 
Re: how can i create a log out page?

all i have to do is put session_destroy() in a new php file and call it log_out.php?

---------- Post added at 05:58 PM ---------- Previous post was at 05:57 PM ----------

and how could i put it under vote. so people dont have to type it in?
 
Re: how can i create a log out page?

all i have to do is put session_destroy() in a new php file and call it log_out.php?

Yep, As you know the way php knows your logged in is by the data you store in the session, When you use session_destory() it will clear out ALL sessions saved, Same as when you close your browser it will log you out. Session's are only temp data.

EDIT:
You dont know how to add a hyperlink? I think you should learn more about html before you learn php. Add me on msn and i could help you more.

MSN: [email protected]
 
Re: how can i create a log out page?

Done Added,

---------- Post added at 06:06 PM ---------- Previous post was at 06:04 PM ----------

can you tell me how to hyperlink on here please. i dont have msn on my laptop only my mobile

---------- Post added at 06:07 PM ---------- Previous post was at 06:06 PM ----------

and im using sessions as it says on logged_in.php
PHP:
session_started();
 
Re: how can i create a log out page?

i dont have enough time to read all that. i need it now like urgent lol.

im looking at another log_out.php
and it looks like this
PHP:
<?php

session_start();
$sessid=$_SESSION['userid'];
$atk=$_SESSION['attacking'];

if($_SESSION['attacking'])
{
print "You lost all your EXP for running from the fight.<br />";
include "config.php";
include "language.php";
global $_CONFIG;
define("MONO_ON", 1);
require "class/class_db_{$_CONFIG['driver']}.php";
$db=new database;
$db->configure($_CONFIG['hostname'],
 $_CONFIG['username'],
 $_CONFIG['password'],
 $_CONFIG['database'],
 $_CONFIG['persistent']);
$db->connect();
$c=$db->connection_id;
$db->query("UPDATE users SET exp=0,attacking=0 WHERE userid=$sessid");
$_SESSION['attacking']==0;
session_unset();
session_destroy();
die("<a href='login.php'>Continue to login...</a>");
}
session_unset();
session_destroy();
header("Location: login.php");

?>

what should i edit in that so it logs out on mine?
 
Status
Not open for further replies.
Back