need immediate help with login code
Posted: Thu Dec 19, 2013 3:11 pm
i havethis login code which is not working,I m new to php
login.php:
form contains the username field and password field
and sql server connection is also working ,its just the login not working
!!!
login.php:
Code: Select all
<?php
include("sqltestlocal.php"); //including config.php in our file
$username = $_POST['username']; //Storing username in $username variable.
$password = $_POST['password']; //Storing password in $password variable.
$match = "select * from tbllogin where username = '".$username."' and password = '".$password."'";
$qry = sqlsrv_query($match);
$row_count = sqlsrv_num_rows($qry);
if ($row_count == 1) {
$row = sqlsrv_fetch_array($qry);
session_start();
$_SESSION['firstname'] = $row['firstname'];
$_SESSION['logged'] = TRUE;
header("Location: test1.html"); // Modify to go to the page you would like
exit;
login.php:
//echo $row_count;
//echo $username;
//echo $password;
//echo "Try notagainnnnnnnnnnnnn";
//sqlsrv_free_stmt($conn,$qry);
//exit;
} else {
header("iisstart.html");
exit;
// It is the page where you want to redirect user after login.
}
?>and sql server connection is also working ,its just the login not working
!!!