Wanted PHP Expert to fix a simple login problem

Discussion in 'Programming' started by primster7, Sep 28, 2008.

  1. #1
    Hello,

    I'm looking for someone to fix a simple php problem. I have a script where users signup. They later can login and change their person information like name/email etc.

    For some reason when the user logs in, it just goes to the default user #1 instead of the user that logs in.

    I'm willing to pay $15 via Paypal if anyone can work with me to fix this problem.

    Thanks!
     
    primster7, Sep 28, 2008 IP
  2. JAY6390

    JAY6390 Peon

    Messages:
    918
    Likes Received:
    31
    Best Answers:
    0
    Trophy Points:
    0
    As Seller:
    100% - 0
    As Buyer:
    100% - 0
    #2
    If you post the code here, you can more than likely save yourself that $15
     
    JAY6390, Sep 28, 2008 IP
  3. primster7

    primster7 Well-Known Member

    Messages:
    801
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    110
    As Seller:
    100% - 0
    As Buyer:
    100% - 0
    #3
    Ok here is the login php script:

    <?php
    // *** Validate request to login to this site.
    if (!isset($_SESSION)) {
    session_start();
    }

    $loginFormAction = $_SERVER['PHP_SELF'];
    if (isset($_GET['accesscheck'])) {
    $_SESSION['PrevUrl'] = $_GET['accesscheck'];
    }

    if (isset($_POST['email'])) {
    $loginUsername=$_POST['email'];
    $password=$_POST['password'];
    $MM_fldUserAuthorization = "";
    $MM_redirectLoginSuccess = "myAccount.php";
    $MM_redirectLoginFailed = "login_failed.php";
    $MM_redirecttoReferrer = true;
    mysql_select_db($database_SQLConnection1, $SQLConnection1);

    $LoginRS__query=sprintf("SELECT email, password FROM login_table WHERE email=%s AND password=%s",
    GetSQLValueString($loginUsername, "text"), GetSQLValueString($password, "text"));

    $LoginRS = mysql_query($LoginRS__query, $SQLConnection1) or die(mysql_error());
    $loginFoundUser = mysql_num_rows($LoginRS);
    if ($loginFoundUser) {
    $loginStrGroup = "";

    //declare two session variables and assign them
    $_SESSION['MM_Username'] = $loginUsername;
    $_SESSION['MM_UserGroup'] = $loginStrGroup;

    if (isset($_SESSION['PrevUrl']) && true) {
    $MM_redirectLoginSuccess = $_SESSION['PrevUrl'];
    }
    header("Location: " . $MM_redirectLoginSuccess );
    }
    else {
    header("Location: ". $MM_redirectLoginFailed );
    }
    }
    ?>


    Here is the Account php script

    <?php require_once('../Connections/SQLConnection1.php');
    //initialize the session

    session_start();

    if (! isset($_SESSION['MM_Username'])){

    header("location: supplier_login.php");
    exit;

    }

    $id = $_SESSION['MM_Username'];

    ///////////////////////////////////////////

    $query = sprintf("SELECT * FROM login_table WHERE login_table.email");
    $result = @mysql_query($query);
    $rowAccount = @mysql_fetch_array($result);

    /////////////////////////////////////////

    ?>
     
    primster7, Sep 28, 2008 IP
  4. techcone

    techcone Banned

    Messages:
    206
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    0
    As Seller:
    100% - 0
    As Buyer:
    100% - 0
    #4
    I m ready to fix the problem If I have whole code so that I can simulate on my system and test it. PM me if interested !!!
     
    techcone, Sep 28, 2008 IP
  5. JAY6390

    JAY6390 Peon

    Messages:
    918
    Likes Received:
    31
    Best Answers:
    0
    Trophy Points:
    0
    As Seller:
    100% - 0
    As Buyer:
    100% - 0
    #5
    $query = sprintf("SELECT * FROM login_table WHERE login_table.email");
    that is the problem line.

    it should be something like
    $query  = sprintf("SELECT * FROM login_table WHERE login_table.username = '%s'",$id);
    PHP:
    I'm not too sure what your username field is called, but you need to change .username to whatever it is in your table and it should work
     
    JAY6390, Sep 28, 2008 IP
  6. kmap

    kmap Well-Known Member

    Messages:
    2,215
    Likes Received:
    29
    Best Answers:
    2
    Trophy Points:
    135
    As Seller:
    100% - 0
    As Buyer:
    100% - 1
    #6
    hi

    I can fix the issue in $15
    50% advance

    If not allready done

    Regards

    Alex
     
    kmap, Sep 28, 2008 IP
  7. AdnanAhsan

    AdnanAhsan Well-Known Member

    Messages:
    601
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    110
    As Seller:
    100% - 0
    As Buyer:
    100% - 0
    #7
    Contact me on msn brother, i am interested to solve your problem:) Here is my msn
    Thanks
     
    AdnanAhsan, Sep 29, 2008 IP
  8. Bohra

    Bohra Prominent Member

    Messages:
    12,573
    Likes Received:
    537
    Best Answers:
    0
    Trophy Points:
    310
    As Seller:
    100% - 0
    As Buyer:
    100% - 0
    #8
    If you still didnt get someone i am ready to help you out
     
    Bohra, Sep 29, 2008 IP
  9. primster7

    primster7 Well-Known Member

    Messages:
    801
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    110
    As Seller:
    100% - 0
    As Buyer:
    100% - 0
    #9
    For some reason it's still not working.

    I think that it needs the following:


    The script needs to set a session variable that can be carried over/remebered through out the users session.
     
    primster7, Sep 30, 2008 IP
  10. siaosiaokia

    siaosiaokia Guest

    Messages:
    24
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    As Seller:
    100% - 0
    As Buyer:
    100% - 0
    #10
    Job Done.

    Payment received.

    Thanks!
     
    siaosiaokia, Oct 2, 2008 IP