login problems

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • nazgul42
    New Member
    • Jul 2007
    • 12

    #1

    login problems

    Ok... On my website, I have a login form that submits the information through POST to a php page, but my problem is that my php page is not getting the POST information. I know my form is sending the information, but the php page gets "" strings. My code is here:
    [PHP]
    <?php
    $GLOBALS['username'] = ucfirst(strtolo wer($POST['Username']));
    $GLOBALS['password'] = $POST['Password'];
    @mysql_connect( "mysql3.freehos tia.com", "jonaxt3_genera l", "mellon") or die("Cannot Connect To DB!");
    @mysql_select_d b("jonaxt3_gene ral") or die("Cannot Select DB!");
    $sql = 'SELECT id FROM users WHERE username=\''
    .
    $GLOBALS['username']
    .
    '\' and password=\''
    .
    $GLOBALS['password']
    .
    '\'';
    $r = mysql_query($sq l);
    if(!$r) {
    $err=mysql_erro r();
    print $err;
    exit();
    }
    if(mysql_num_ro ws($r)==0){
    print "no such login in the system. please try again.";
    echo "<br>Userna me: " . $POST['Username'];
    echo "<br>Passwo rd: " . $POST['Password'];
    exit();
    }
    else{
    echo "Congrats!" ;
    //proceed to perform website’s functionality – e.g. present information to the user
    }
    ?>
    [/PHP]
    I know it is not very secure, but it is a work in progress, and I plan to add that later.
  • adamalton
    New Member
    • Feb 2007
    • 93

    #2
    At a very quick glance, you seem to be missing the underscores in $_POST. (You've got $POST, which wont work.)

    Comment

    • mwasif
      Recognized Expert Contributor
      • Jul 2006
      • 802

      #3
      In you previous posts you always used $_POST instead of $POST.

      Comment

      • nazgul42
        New Member
        • Jul 2007
        • 12

        #4
        Thank you, that helped.

        Comment

        Working...