Jump to content

PHP/MySQL database question!


emma26iver

Recommended Posts

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
Link to comment
Share on other sites

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


Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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