Click here to Skip to main content
14,430,378 members
Rate this:
Please Sign up or sign in to vote.
See more:

$host = "localhost";
$user = "root";
$Password = "";
$db = "NewWeb";

mysql_connect($host, $user, $Password);

if (isset($_post['UserName'])) 
	$Uname = $_post['UserName'];
	$Password = $_post['Password'];

	$sql = "select * form loginform where User01='".$Uname."' AND Pass='".$Password."' limit 1";


		echo "You have sucessfully logged in";
				echo "You have entered incorrect Password";

<!DOCTYPE html>
	<link rel="stylesheet" type="text/css" href="logingform.css">
	<div class="logingbox">
		<img src="user.png" class="avatar">
		<h1>Loging Here</h1>
			<form method="post" action="#">
				<p>User name</p>
				<input type="text" name="User Name" placeholder="Enter UserName">
				<input type="Password" name="Password" placeholder="Enter Password"><br>
				<input type="submit" name="submit" value="Login"><br>
				<a href="a">Forget Password</a><br><br>
				<p class="not-an-account">If you don't have a account</p>
				                      <a href="b">Sign Up</a>

What I have tried:

( ! ) Parse error: syntax error, unexpected $end in C:\wamp\www\PHP\New_Web\LoginForm.php on line 53 - how to fix
Updated 13-Dec-19 5:59am
Richard Deeming 13-Dec-19 10:56am
Your code is vulnerable to SQL Injection[^]. NEVER use string concatenation to build a SQL query. ALWAYS use a parameterized query.

PHP: SQL Injection - Manual[^]
Richard Deeming 13-Dec-19 10:57am
You're also storing passwords in plain text. Don't do that.
Secure Password Authentication Explained Simply[^]
Salted Password Hashing - Doing it Right[^]

PHP even has built-in methods to help you do the right thing:
PHP: password_hash[^]
PHP: password_verify[^]
Richard Deeming 13-Dec-19 10:58am
And neither of the code blocks you've posted in your question have 53 lines, so the error on line 53 cannot relate to the code you've posted.

1 solution

Rate this:
Please Sign up or sign in to vote.

Solution 1

Mismatched curly brackets: You need to add another at the end to match the first one.

If you indent all your code correctly, it's easier to see.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100