1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Login page problem

Discussion in 'PHP & Perl' started by arang67, May 26, 2012.

  1. arang67

    arang67 Registered Member

    Joined:
    Feb 14, 2012
    Messages:
    90
    Likes Received:
    28
    Occupation:
    businessman
    Location:
    somewhere
    Home Page:
    hii all i want to login
    but the problem is i enter the username and password it says failed.
    im very sure the username and password is correct.anyone can explain why this happen?

     
  2. t0.sh

    t0.sh Registered Member

    Joined:
    Jun 6, 2012
    Messages:
    55
    Likes Received:
    24
    Location:
    UVB-76
    According to your code, this script is checking the database for the username, user type and password and matching it to what was typed into the form. The script is returning as failed since it hasn't found any users that exactly match the user information you typed into the form. The script could be failing for any number of reasons. Is there any chance you'd be able to post your database structure and the HTML of the form so we can help you more with this?
     
  3. Tensegrity

    Tensegrity Jr. VIP Jr. VIP Premium Member

    Joined:
    Apr 22, 2009
    Messages:
    1,823
    Likes Received:
    968
    This isn't really the best way to do this. There are a few problems that I see here.


    1. you should be registering your variables to the session
    2. you should be using mysql_real_escape_string() instead of addslashes()
    3. i can't see your mysql connection functions, but you should have mysql_error() in there to see what mysql is telling you cuz it's clearly a problem with your MySQL statement
    4. your MySQL statement should be putting the table in `` quotes, so try it like `users`