Code: Select all
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>
<?php
$con = mysql_connect("localhost", "tutorial", "LsGQmFYsMBjUwvL4");
mysql_select_db("tutorial", $con);
$q = "SELECT * FROM `logintable` WHERE user='$usernamefield' AND pass='$passwordfield'";
$logincheck = mysql_query($q, $con) or die(mysql_error($con));
if(!isset($_POST['username']) || !isset($_POST['password'])){
print "No username/password defined";}
print_r($logincheck)."<br/>";
print_r($rows);
$usernamefield = $_POST['username'];
$passwordfield = $_POST['password'];
$rows = mysql_fetch_array($logincheck);
if ($rows != "") {
echo "Welcome please select your lake";
}
else {
?>
<form id="form1" name="form1" method="post" action="">
<p>
<label>
User Name:
<input type="text" name="username" id="username" />
</label>
</p>
<p>Password:
<label>
<input type="text" name="password" id="password" />
</label>
</p>
<p>
<label>
<input type="submit" name="submit" id="submit" value="Submit" />
</label>
</p>
</form>
</body>
</html>
