Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Old 08-12-2007, 11:12 AM PHP Sessions
evans123's Avatar
Ultra Talker

Posts: 468
Trades: 0
I dnt know why but when i call $_SESSION['loggedin'] from another file it doesnt get it because i think the session is blank and i cnt see why.

Can any one help me?

PHP Code:
<?php ob_start(); 

include(
"config.php");
if (isset (
$_POST['login']))
{
        
$num_rows mysql_num_rows(mysql_query("SELECT * FROM championship__login WHERE username='" $_POST['username'] . "' AND password='" md5($_POST['password']) . "'"));
        if (
$num_rows 0
        {
            
session_start();
            
$_SESSION['loggedin'] = $_POST['username'];
            
mysql_query("INSERT INTO `championship__online_users` SET `ip` = '" $_SERVER['REMOTE_ADDR'] . "', `username` = '" $_POST['username'] . "', `login_time` = '" time() . "', `last_active` = '" time() . "'");
            
header ('Location: index.php');
            exit;
        } 
        else 
        {
        
$message "Invalid username and password combination or non-activated account.<br /><br />";
        }
        }
include(
"includes/header.tpl.php");
include(
"includes/index_content.tpl.php");
include(
"includes/footer.tpl.php");
ob_end_flush();
?>
evans123 is offline
Reply With Quote
View Public Profile Visit evans123's homepage!
 
 
Register now for full access!
Old 08-12-2007, 11:51 AM Re: PHP Sessions
bas
Super Talker

Posts: 108
Name: Bas
Trades: 0
You have to call to this first:

PHP Code:
session_start(); 
Place it in the upper-top of your file (before any data is send to the user) and then it should work.
bas is offline
Reply With Quote
View Public Profile
 
Old 08-12-2007, 12:00 PM Re: PHP Sessions
evans123's Avatar
Ultra Talker

Posts: 468
Trades: 0
cheers thats all it was!
evans123 is offline
Reply With Quote
View Public Profile Visit evans123's homepage!
 
Reply     « Reply to PHP Sessions
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.11581 seconds with 12 queries