View Single Post
Old 07-02-2007   #2 (permalink)
basicwe
Steven
 
Join Date: Jun 2005
Location: McAlester, OKlahaoma - United States
Posts: 21

On the member.php the code to check if a member is logged in is
PHP Code:
<?php
session_start
();
if(
$_SESSION['s_logged_n'] == 'true'){
include 
'process.php';
?>
In the login file the code to check if they are logged and to send them back to the main page is

PHP Code:
<?php
session_start
();
include 
'config.php';

if(isset(
$_POST['login']))
{

$username trim(addslashes($_POST['username']));
$password md5(trim($_POST['password']));

$query mysql_query("SELECT * FROM Users WHERE Username = '$username' AND Password = '$password' LIMIT 1") or die(mysql_error());

$row mysql_fetch_array($query);

// now we check if they are activated

if(mysql_num_rows($query) > 0)
{

if(
$row['Activated'] > 0)
{

$_SESSION['s_logged_n'] = 'true';
$_SESSION['s_username'] = $username;
$_SESSION['s_name'] = $row['Name'];

header("Location: member.php");
__________________
--
Steven
basicwe is offline