Jump to content


Mysql and Sessions

  • Please log in to reply
1 reply to this topic

#1 Bavilo

  • Members
  • PipPip
  • Member
  • 19 posts

Posted 24 May 2006 - 05:03 AM

Hello everyone,

I'm helping a friend with some scripting. I made a register and login script that takes the raw input and puts it into a database, the password is encrypted in md5, that part works, aswell as the login part but i need to display a unique page for each user. Basically my friend will create the usernames and passwords with the register script, lets say the username is 123 and the password is 321, when i enter 123 in the login box and i successfully login the page should now display information about only the user "123" such as a schedule, of things this user has to do and so on. I was thinking about using something like this.

    if (isset($_SESSION['s_username'])) {
    echo "<b>Welcome</b> ".$_SESSION['s_username']."!"; }

This will display the name of the username that was entered in the login script, but instead i want it to check what username was entered, (in this case "123") take that username, check if its in the database and use that in the session code above instead of "username". Also, if 123 is logged in, it will not echo
<b>Welcome</b> ".$_SESSION['s_username']."!";
, but other php snippets, codes, html, whatever.

Ok just to wrap it up, what i am trying to figure out is how to change the content on a page such as a schedule that will be different for every user that signs on. Hopefully someone can point me to some examples or explain how this could be done. If anything is unclear please let me know, i will try to explain it some more.


#2 trq

  • Staff Alumni
  • Advanced Member
  • 31,041 posts

Posted 24 May 2006 - 05:07 AM

Stoe a users info in the datebase, then simply run a query like...
$sql = "SELECT * FROM users WHERE user_id = {$_SESSION['id']};";

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users