Sorry if this is a frequent question but I'm stumped.
<?php
session_start();
unset($_SESSION['logerror']);
$host="localhost"; // Host name
$db_name="website_database.sqlite"; // Database name
$tbl_name="User"; // Table name
$con= sqlite_open("Website_Database.sqlite");
// username and password sent from form
$username=$_POST['Username'];
$password=$_POST['Password'];
$sql="SELECT * FROM ".$tbl_name." WHERE Username='".$username."' and Password='".$password."'";
$result= sqlite_query($con,$sql);
// Mysql_num_row is counting table row
$count= sqlite_num_rows($result);
// If result matched $username and $password, table row must be 1 row
if($count==1){
// Register username, $password and redirect to file "login_success.php"
session_register("username");
session_register("password");
echo "Login Successful";
}
else {
echo "does this work nikhil";
}
?>
I am using SQLite and it is running off a USB. The file is website_database.sqlite
The table is User. The data within is Username : 000001 and Password : password
The post data coming from the previous form is this
<form action="checklogin.php" method="post">
<div class="wrap"> <!--make a container that will have all our elements and will be the main stucture of you pages-->
<div class="logo"></div><!--The logo container-->
<div class="header_text">Room Booking</div><!--The main header of the fomr-->
<div class="logins_details_container"><!--The top container-->
<table class="fields_container"> <!--A simple 2x2 table for the form. We choose to use table as for this simple kind of stuff helps us to be everything well stuctured and putting less attributes at the css-->
<tr>
<td><span>Username</span></td>
<td><input class="field" id="Username" name="Username" value="" placeholder="" type="text" /></td>
</tr>
<tr>
<td><span>Password</span></td>
<td><input class="field" id="Password" type="Password" name="Password" value="" placeholder="" /></td>
</tr>
</table>
<div class="remeber_me_container"><!--A container for the Remember me text and the checkbox-->
<div class="remember_me">Remember Me?</div>
<input id="remeber_me" name="" value="" type="checkbox" />
</div>
<div class="login_btn"><!-- The login button-->
<input name="login_btn" value="Login" type="submit" />
</div>
</div>
<form/><!-- End of the logins_details_container -->