Chcialbym dodac wiadomosc po nieudanym logowaniu, ale nie wiem jak zabardzo.
utowrzylem zmienna $error_msg i chcialem ja wyswietlic po nieudanym logowaiu tuz nad formularzem, ale nie dziala. Moze mi ktos z tym pomoc?
<?php
$username = $_POST['username'];
$password = $_POST['password'];
if ($username&&$password)
{
$connect = mysql_connect("localhost","uo151818_fallena","pass1234") or
die ("Could not connect");
$query = mysql_query("SELECT * FROM users WHERE username ='$username'");
if ($numrows !=0)
{
{
$dbusername = $row['username'];
$dbpassword = $row['password'];
}
if ($username==$dbusername&&$password==$dbpassword)
{
$_SESSION['username']=$dbusername;
}
else
$error_msg = "Enter correct login and password.";
}
}
?>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>.:Fallen Angels Tatto and Bodypiercing:.</title>
<link rel="stylesheet" href="themes/blackandwhite.min.css" />
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.3.1/jquery.mobile.structure-1.3.1.min.css" />
<script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
<script src="http://code.jquery.com/mobile/1.3.1/jquery.mobile-1.3.1.min.js"></script>
</head>
<body>
<div data-role="page" data-theme="a">
<div data-role="header">
<h1>Fallen Angels</h1>
<div data-role="navbar">
<ul>
<li><a href="index.php" data-transition="slide" data-icon="home" data-iconpos="left">Home Page</a></li>
</ul>
</div><!-- /navbar -->
</div><!-- /header -->
<div data-role="content" class="ui-hide-label">
<h3> Login: </h3>
<form action="login.php" method="post">
<p>
<?php echo $error_msg; ?></p>
<label for="username">Username:</label>
<input type="text" name="username" id="username" value="" placeholder="Username"/></br>
<label for="password">Password:</label>
<input type="password" name="password" id="password" value="" placeholder="Password"/>
<div data-role="controlgroup" data-type="horizontal" align="center">
<input type="submit" value="Submit">
<input type="reset" value="Reset">
</div>
<form>
</div><!-- /content -->
<div data-role="footer" data-position="fixed">
<h4>Fallen Angels 2013. All right reserved.</h4>
</div><!-- /footer -->
</div><!-- /page -->
</body>
</html>