0

Hi guys, creating a log in script so my users can login to my website.

This is the code so far

<!DOCTYPE html> 
<html> 
<head> 
        <title>Richard Hemmings  </title>
        <meta name="viewpoint" content="width=device-width, intail-scale=1.0"> 
        <link href = "css/bootstrap.min.css"rel = "stylesheet"> 
        <link href = "css/stylesheet.css" rel = "stlesheet"> 

        </head>
        <body>

            <div class = "navbar navbar-inverse navbar-static-top">
                <div class = "container"> 
                 <div class = "navbar navbar-default navbar-fixed-bottom"> 

                <div class = "container"> 
                    <P class = "navbar-text">Site build and belongs to Richard Hemmings (C) 2015</P> 

                </div> 

        </div>
       <script src = "http://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script><script src = "js/bootstrap/js" ></script>




</body>

</html>              

<?php
include('inc/header.php');
require('connection_db.php'); 

if (isset($_POST['submit'])){
    $uname = mysql_escape_string($_POST['uname']);
    $pass = mysql_escape_string ($_POST['pass']);
    $pass = md5 ($pass) ; 

    $uname = mysql_query("SELECT * FROM `users` WHERE `uname` = '$uname' AND `pass` = '$pass'"); 
if(mysql_num_rows($sql) > 0 {
    echo "you are now logged in successfully!"; 
    exit (); 

}else{ 
echo "Wrong Username and password entered please try again";
}

}else{


    echo $form = <<<EOT 
    <form action"login.php" method="POST">
    Username: <input type="text" name ="uname" /><br /> 
    password: <input type="password" name="pass" /><br />
    <input type="submit" name="submit" value="Log in" /> 
    </form> 

    EOT; 
} 




?>

This is the error message that I'm getting at the moment

Parse error: syntax error, unexpected '{' in C:\xampp\htdocs\login.php on line 37

Any help would be brilliant sorry again for been a apain

2
Contributors
3
Replies
26
Views
2 Years
Discussion Span
Last Post by stokie-rich
0

Try that.

<?php
include('inc/header.php');
require('connection_db.php'); 

if (isset($_POST['submit'])){

    $uname = mysql_escape_string($_POST['uname']);
    $pass = mysql_escape_string ($_POST['pass']);
    $pass = md5 ($pass) ; 
    $uname = mysql_query("SELECT * FROM `users` WHERE `uname` = '$uname' AND `pass` = '$pass'"); 


    if(mysql_num_rows($sql)) > 0 {
        echo "you are now logged in successfully!"; 
        exit (); 
    }else{

    echo "Wrong Username and password entered please try again";

    }

}else{
    echo $form = <<<EOT 
    <form action"login.php" method="POST">
    Username: <input type="text" name ="uname" /><br /> 
    password: <input type="password" name="pass" /><br />
    <input type="submit" name="submit" value="Log in" /> 
    </form> 
    EOT; 
} 
?>
0

hey thanks for the replay I have tried what you said with the changes to the code you suggested

I'm now getting the following Parse error: syntax error, unexpected '>' in C:\xampp\htdocs\login.php on line 39

Here is the code

?php
include('inc/header.php');
require('connection_db.php'); 
if (isset($_POST['submit'])){
    $uname = mysql_escape_string($_POST['uname']);
    $pass = mysql_escape_string ($_POST['pass']);
    $pass = md5 ($pass) ; 
    $uname = mysql_query("SELECT * FROM `users` WHERE `uname` = '$uname' AND `pass` = '$pass'"); 
    if(mysql_num_rows($sql)) > 0 {
        echo "you are now logged in successfully!"; 
        exit (); 
    }else{
    echo "Wrong Username and password entered please try again";
    }
}else{
    echo $form = <<<EOT 
    <form action"login.php" method="POST">
    Username: <input type="text" name ="uname" /><br /> 
    password: <input type="password" name="pass" /><br />
    <input type="submit" name="submit" value="Log in" /> 
    </form> 
    EOT; 
} 
?>
0

Morning people I need to pick your brains I'm now getting the following erorr message:

Parse error: syntax error, unexpected end of file, expecting variable (T_VARIABLE) or heredoc end (T_END_HEREDOC) or ${ (T_DOLLAR_OPEN_CURLY_BRACES) or {$ (T_CURLY_OPEN) in C:\xampp\htdocs\login.php on line 54

This is my code so far

<!DOCTYPE html> 
<html> 
<head> 
        <title>Richard Hemmings  </title>
        <meta name="viewpoint" content="width=device-width, intail-scale=1.0"> 
        <link href = "css/bootstrap.min.css"rel = "stylesheet"> 
        <link href = "css/stylesheet.css" rel = "stlesheet"> 

        </head>
        <body>

            <div class = "navbar navbar-inverse navbar-static-top">
                <div class = "container"> 
                 <div class = "navbar navbar-default navbar-fixed-bottom"> 

                <div class = "container"> 
                    <P class = "navbar-text">Site build and belongs to Richard Hemmings (C) 2015</P> 

                </div> 

        </div>
       <script src = "http://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script><script src = "js/bootstrap/js" ></script>




</body>

</html>              

<?php
include('inc/header.php');
require('connection_db.php'); 
if (isset($_POST['submit'])){
    $uname = mysql_escape_string($_POST['uname']);
    $pass = mysql_escape_string ($_POST['pass']);
    $pass = md5 ($pass) ; 
    $uname = mysql_query("SELECT * FROM `users` WHERE `uname` = '$uname' AND `pass` = '$pass'"); 
   if(mysql_num_rows($sql) > 0 ) {  
        echo "you are now logged in successfully!"; 
        exit (); 
    }else{
    echo "Wrong Username and password entered please try again";
    }
}else{
    echo $form =<<<EOT
    //<form action"login.php" method="POST">
    Username: <input type="text" name ="uname" /><br /> 
    password: <input type="password" name="pass" /><br />
    <input type="submit" name="submit" value="Log in" /> 
    </form> 
EOT; 
}   
?>
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.