pro_se Posted January 9, 2007 Share Posted January 9, 2007 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 More sharing options...
pro_se Posted January 9, 2007 Author Share Posted January 9, 2007 same problem as this guy.. [url=http://www.phpfreaks.com/forums/index.php/topic,6460.0.html]http://www.phpfreaks.com/forums/index.php/topic,6460.0.html[/url] Link to comment https://forums.phpfreaks.com/topic/33428-session-help-i-know-_/#findComment-156486 Share on other sites More sharing options...
magic2goodil Posted January 9, 2007 Share Posted January 9, 2007 how come i don't see you using session_start(); at all? Link to comment https://forums.phpfreaks.com/topic/33428-session-help-i-know-_/#findComment-156488 Share on other sites More sharing options...
pro_se Posted January 9, 2007 Author Share Posted January 9, 2007 its there.. at the top.. ahah, dont worry im not that stupid.. or wait, is that supposed to be in the same <?php ?> thing? Link to comment https://forums.phpfreaks.com/topic/33428-session-help-i-know-_/#findComment-156489 Share on other sites More sharing options...
magic2goodil Posted January 9, 2007 Share Posted January 9, 2007 naw i think it can be called in a separate <?php ?> Link to comment https://forums.phpfreaks.com/topic/33428-session-help-i-know-_/#findComment-156491 Share on other sites More sharing options...
pro_se Posted January 9, 2007 Author Share Posted January 9, 2007 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 More sharing options...
magic2goodil Posted January 9, 2007 Share Posted January 9, 2007 well in all technicality, it needs to be before any html is parsed onto the page Link to comment https://forums.phpfreaks.com/topic/33428-session-help-i-know-_/#findComment-156495 Share on other sites More sharing options...
pro_se Posted January 9, 2007 Author Share Posted January 9, 2007 yup, im way ahead of you but thats beside the point.. do you know why it would show that i am different users everytime that i refresh the page? Link to comment https://forums.phpfreaks.com/topic/33428-session-help-i-know-_/#findComment-156497 Share on other sites More sharing options...
alpine Posted January 9, 2007 Share Posted January 9, 2007 And you should remove all those session_register(), learn more: http://no2.php.net/manual/en/function.session-register.php Link to comment https://forums.phpfreaks.com/topic/33428-session-help-i-know-_/#findComment-156498 Share on other sites More sharing options...
pro_se Posted January 9, 2007 Author Share Posted January 9, 2007 k, imma try that nd see what happens... Link to comment https://forums.phpfreaks.com/topic/33428-session-help-i-know-_/#findComment-156499 Share on other sites More sharing options...
pro_se Posted January 9, 2007 Author Share Posted January 9, 2007 nope, took out the register_session thingys. it still does the exact same thing... Link to comment https://forums.phpfreaks.com/topic/33428-session-help-i-know-_/#findComment-156500 Share on other sites More sharing options...
pro_se Posted January 9, 2007 Author Share Posted January 9, 2007 does anyone see a reason for this happening? Link to comment https://forums.phpfreaks.com/topic/33428-session-help-i-know-_/#findComment-156544 Share on other sites More sharing options...
magic2goodil Posted January 9, 2007 Share Posted January 9, 2007 sorry man, but I have never seen that problem in my life..it's odd Link to comment https://forums.phpfreaks.com/topic/33428-session-help-i-know-_/#findComment-156755 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.