Jump to content

webie

New Members
  • Posts

    3
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

webie's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. [!--quoteo(post=378247:date=May 29 2006, 07:14 PM:name=Ferenc)--][div class=\'quotetop\']QUOTE(Ferenc @ May 29 2006, 07:14 PM) [snapback]378247[/snapback][/div][div class=\'quotemain\'][!--quotec--] I dont think you should send headers before you set $ _SESSION['value'] header() messes with sessions... basicly you arent in the same session when you get to page 2 You can append the SID to the url and check if it is the corect one Ah.. here is the problem... [/quote] how will im going to passed the value to the second page if am not going to use header to redirect to the second page? how will am going to passed the session id and how will am going to use it on the second page to access the session variables that i have? sorry i just had a lot of questions, i can get this session working, thats what in the tutorial here. thank you so much! I also append the session id in the url and i got the same session id, but the session variable still wont appear when i echo it, what will am going to do, pls help
  2. [!--quoteo(post=378179:date=May 29 2006, 03:33 PM:name=Richard181)--][div class=\'quotetop\']QUOTE(Richard181 @ May 29 2006, 03:33 PM) [snapback]378179[/snapback][/div][div class=\'quotemain\'][!--quotec--] check to see if there is any value in the database at all.. and i dont' think you need $_seesion and session_registe.. just one or the other would do fine.. [/quote] Yah theres data on my database. i just followed what the tutorial here, but i dont knw why isnt working.
  3. Hi there, i tried the codes here for creating sessions but i have problems when am going to display the value saved in the session variables in my welcome page, it wont print the value of the session var. This is the code i used in checking user: <? /* Check User Script */ session_start();// Start Session header("Cache-control: private"); include '../inc/db_conn.php'; // Conver to simple variables $username = $_POST['user']; $password = $_POST['passwd']; if((!$user) || (!$passwd)){ echo "Please enter ALL of the information! <br />"; include 'index.php'; exit(); } // Convert password to md5 hash $passwd = md5($passwd); // check if the user info validates the db $sql = mysql_query("SELECT * FROM users WHERE username='$user' AND password='$passwd' AND activated='1'"); $login_check = mysql_num_rows($sql); if($login_check > 0){ while($row = mysql_fetch_array($sql)){ foreach( $row AS $key => $val ){ $$key = stripslashes( $val ); } // Register some session variables! 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; session_register('username'); $_SESSION['username'] = $username; mysql_query("UPDATE users SET last_login=now() WHERE userid='$userid'"); header("Location: ../members/"); } } else { echo "You could not be logged in! Either the username and password do not match or you have not validated your membership!<br /> Please try again!<br />"; include 'index.php'; } ?> and this is the code for the successful login page (welcome page) <? session_start(); echo "Welcome ". $_SESSION['first_name'] ." ". $_SESSION['last_name'] ."! You have made it to the members area!<br /><br />"; ?> but the $_SESSION['first_name'] and $_SESSION['last_name'] is empty, i dont knw why. i open my session files in my c:\temp, i saw the value og the session there but when i echo the session $_SESSION['first_name'] and $_SESSION['last_name'], its empty, what did i do wrong? please help me
×
×
  • 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.