Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New Coder
    Join Date
    Aug 2006
    Posts
    50
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Session Problem - Urgent Help Needed

    Hi Guys,

    ok here is my problem

    on my site i have 2 login pages, they both redirect to different locations
    ( for personal and business users )

    After successfull login they create a session
    called either 'business' or 'personal' and the value for the sessions
    is the auto_increment id inumber

    on the index page in the corresponding folders
    personal or business, the code check for the corresponding session name

    however my problem is that if i login as business i can then also access the personal area and vise versa

    Here is the code from 1 of the login pages ( they are both similar with only name changes )

    PHP Code:
    session_start();
    mysql_select_db($dbn$dbc);
    $loginquery mysql_query("SELECT * FROM `business` WHERE email='$email' and password='$password'"$dbc);
    $result mysql_fetch_assoc($loginquery);
    // Result Process
    if(!$result){
    header("Location: buslogin.php?message=Invalid Username / Password</br>Please Try Again");
    } else {
    $GLOBALS['business'] = "$result[businessid]";
    session_register('business');
    header("Location: business/index.php");

    and here is the code on the page successfull login is redirected too
    PHP Code:
    session_start();
    if(!isset(
    $_SESSION['business'])){
    header("Location: ../buslogin.php");
    } else { 
    anyone got any ideas as to why if im logged in and the session name business is set i can access a page that checks for a session called personal ?

    this is extremely urgent as teh site is supposed to be going live in 2 days time, but i cant let it go live like this

    please help

    chris

  • #2
    New Coder
    Join Date
    Aug 2006
    Posts
    50
    Thanks
    0
    Thanked 0 Times in 0 Posts
    guys,

    i found the problem

    on the login page at the top ( the form page which passes the data to the page i posted )

    i checked the sessions but the location for successful redirection was the same

    so that was the issue

    regards
    chris

  • #3
    Regular Coder
    Join Date
    Mar 2005
    Location
    Pakistan
    Posts
    207
    Thanks
    0
    Thanked 0 Times in 0 Posts
    thats the best thing if u solve ur problem urself
    with best wishes
    God helps those who help others.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •