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
https://forums.phpfreaks.com/topic/33428-session-help-i-know-_/
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
https://forums.phpfreaks.com/topic/33428-session-help-i-know-_/#findComment-156494
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.