Jump to content


Photo

PHP/MySQL database question!


  • Please log in to reply
2 replies to this topic

#1 emma26iver

emma26iver
  • New Members
  • Pip
  • Newbie
  • 2 posts

Posted 21 June 2006 - 12:44 PM

I need a little help here, so I'm hoping you can help.

I am creating a website for a friend, and she requires a members login section so people can sign up for registration to her services. For this I'm using a simple MySQL and PHP members directory database that I'm writing. The thing is, I want each user to have their own information displayed on the page, i.e their name at the top of the page etc.

Her website is a female only taxi company. You can only use the services if you are registered. Each member will have to pay for their fare using credits. She wants members to be able to top-up their credits online using their credit card. Thus the reason why each member should have their own section, so they can check their balance.

Can anyone let me know how to make each user go to their own section???

Cheers!

Emma

#2 teomanersan

teomanersan
  • Members
  • PipPip
  • Member
  • 12 posts

Posted 21 June 2006 - 01:37 PM

after you made the necessary settings (for.e.g checking user name and password is OK ) you have to add a unique variable to the user session such as

<? $_SESSION['user'] = $user_info['nick']; ?>

where $_SESSION['user'] is the variable which holds the nickname of the logged user as the session variable, $user_info['nick'] is the nickname of the user which is the user`s nick fetched from database
(of course before assigning the session u have to make the necessary checks else it will cause security problems)

in every page you have to get unique data`s for the logged member:
<?
session_start() ; // start the session , let`s check if member is logged properly

if(isset($_SESSION['user'] == FALSE) // if this member is not authorized ?
{
include_once('login.php'); // show login page for authorization


}
else
{
// fetch necessary data u`d like.. u can assign $_SESSION['nick'] to a variable and use it in your sql queries ,

}

hope this helps..

good coding




#3 emma26iver

emma26iver
  • New Members
  • Pip
  • Newbie
  • 2 posts

Posted 22 June 2006 - 09:26 AM

Thanks for that. Will give it a try and let you know how it turns out!

Emma




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users