login script

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts
  • grabatrainingseat
    Private

    • Feb 2009
    • 1

    login script

    Can someone please tell me why this script is not working, I keep getting this as a response when I publish it:

    Parse error: syntax error, unexpected T_VARIABLE in /home/blywjso/public_html/trial.php on line 100

    Also where the line says: $con=mysql_connect('ftp address','masterusername','masterpassword');

    Can you confirm whether I the above to connect to the mysql please? or whether I need to use something else.



    94 <?php session_start();?>
    95 <html>
    96 <head />
    97 <body>
    98
    99 <form action='index.php?login=yes' method=POST>
    100 <username:<input type=text name'username'><br/>
    101 <password:<input type=password name'password'><br/>
    102 <input type=submit value='Submit!'>
    103 </form>

    104 <?php

    $username$_POST['username'];
    $password$_POST['password'];
    $login$_GET['login'];

    if($login=='yes'){
    $con=mysql_connect('_________','________','_______ _');
    mysql_select_db(blywjso_ABVFP);

    $get=mysql_query("SELECT count(id) FROM _Form_Nr_2 WHERE username='$username' and password='$password');
    $result=mysql_result($get, 0);

    mysql_close($con);

    if ($result!=1)echo 'Login Attempt Failed!';
    else
    {echo"login success!";
    $_SESSION['username']=$username;
    };
    };

    ?>



    </body>
    </html>
  • navaldesign
    General & Forum Moderator

    • Oct 2005
    • 12080

    #2
    Re: login script

    Correct code:

    $username = $_POST['username'];
    $password = $_POST['password'];
    $login = $_GET['login'];
    if($login=='yes'){
    $con=mysql_connect('_________','________','_______ _');
    mysql_select_db('blywjso_ABVFP');
    $get=mysql_query("SELECT count(id) FROM _Form_Nr_2 WHERE username='$username' and password='$password'");
    $result=mysql_result($get, 0);
    mysql_close($con);
    if ($result!=1)echo 'Login Attempt Failed!';
    else
    {
    echo "login success!";
    $_SESSION['username'] = $username;
    }
    }
    ?>


    Please note that I only checked the syntax, not the functionality.

    I don't think ABVFP adds a "id" column........ Unless you have such a field added by your own code...

    In other words, I'm unsure if your query SELECT count(id) FROM _Form_Nr_2 WHERE .... is correct, i think not

    Should be count(Record_nr) i believe.
    Navaldesign
    Logger Lite: Low Cost, Customizable, multifeatured Login script
    Instant Download Cart: a Powerfull, Customized, in site, DB driven, e-products Cart
    DBTechnosystems.com Forms, Databases, Shopping Carts, Instant Download Carts, Loggin Systems and more....
    Advanced BlueVoda Form Processor : No coding form processor! Just install and use! Now with built in CAPTCHA!

    Comment

    Working...
    X