<?php
$db=mysql_connect('localhost','root','') or die('Cannot connect to MySQL!');
@mysql_select_db('dbriomra')or die('Cannot connect to database');
// Retrieve username and password from database according to user's input
$login = mysql_query("SELECT * FROM login WHERE (username = '" . mysql_real_escape_string($_POST['compid']) . "') and (password = '" . mysql_real_escape_string($_POST['pword']) . "')");
// Check username and password match
if (mysql_num_rows($login) == 1) {
// Set username session variable
$_SESSION['username'] = $_POST['compid'];
// Jump to secured page
header('Location: employee.php'); // kung anong file.php mag ffall ung user pag valid ung log in procedures nya.
}
else {
// Jump to secured page
//header('Location: index.php'); //homepage mo pag invalid
}
?>
i want to put a restriction, like, invalid username and password, but i don't know how, im new in php. thank you :)