Jump to content

session help.. i know.. -_-


pro_se

Recommended Posts

ok, so i have this website where users can login -- yadda yadda.. ok, anyways.. i create the session varibles when the users are validated during login (as such)[code] session_register('userid');
        $_SESSION['userid'] = $userid;
        session_register('username');
        $_SESSION['username'] = $username;
session_register('logged_in123');
$_SESSION['logged_in123'] = 'true123';
        session_register('first_name');
        $_SESSION['first_name'] = $first_name;
        session_register('last_name');
        $_SESSION['last_name'] = $last_name;
        session_register('email_address');
        $_SESSION['email_address'] = $email_address;[/code]

and i display the session varibles as such:
[code]<?php
$logged_in123 = $_SESSION['logged_in123'];
if ($logged_in123 == 'true123') {
include '/home/cvnetwor/inc/cvnetworks_settings_form.php'; } else {
echo "<p><strong>You must be logged in to access this area...</strong></p>";
include '/home/cvnetwor/inc/cvnetworks_login_form.php';
} ?>[/code]

ok, i keep getting this funny thing where it shows the other users usernames:
[code]<?php
$logged_in123 = $_SESSION['logged_in123'];
$sessionstoredname = $_SESSION['username'];
if ($logged_in123 == 'true123') { echo 'Welcome '.$sessionstoredname.'. (<a href="http://cvnetworks.net/logout.php">Logout</a>)'; } else { echo 'Welcome Guest. (<a href="http://cvnetworks.net/login.php">Login</a> | <a href="http://cvnetworks.net/register.php">Register</a>)'; } ?>[/code]

there is one user called (cvarma and one called omgpants and my phpmyadmin username sudo keep getting switched up with these sessions) it displays all kinda funky names in the status thing right here ^

my question is why am i getting different usernames to show up in there?
Link to comment
Share on other sites

kk, i tried to put it in the same <?php ?> thing and this is what i got...
[quote]Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/.jumper/cvnetwor/cvnetworks.net/logout.php:6) in /home/.jumper/cvnetwor/cvnetworks.net/logout.php on line 21[/quote]

apparently it needs to be the first thing...
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.