/* Login Functions */
function login($usr, $pass) {
$sql = "SELECT * FROM users WHERE usrNAME = '$usr' AND usrPASS = '$pass'";
$query = mysql_query($sql);
$row = mysql_fetch_assoc($query);
if (mysql_num_rows($query) == 1) {
// in here is what it should do if successful
} else {
// in here is what it should do if faild
}
}
// header
<?php
if (($_POST['submit'])){
login($_POST['username'], $_POST['password']);
}
?>
// somewhere in the body section
<?php
if($_SESSION['loged'] == "false") {
echo '
<div class="loginfailed" align="center">Login Failed!</div>
';
}
?>
<form action="#" method="POST">
Username:<br />
<input name="username" type="text" tabindex="1" maxlength="45" class="inputbox" /><br />
Password:<br />
<input name="password" type="password" tabindex="2" maxlength="55" class="inputbox" /><br />
<div align="center"><input type="submit" name="submit" value="Login" tabindex="3" class="inputbutton" /></div>
</form>
scarcella 11 Senior Software Architect
mschroeder 251 Bestower of Knowledge Team Colleague
scarcella 11 Senior Software Architect
mschroeder 251 Bestower of Knowledge Team Colleague
scarcella 11 Senior Software Architect
scarcella 11 Senior Software Architect
mschroeder 251 Bestower of Knowledge Team Colleague
scarcella 11 Senior Software Architect
Stefano Mtangoo 455 Senior Poster
mschroeder 251 Bestower of Knowledge Team Colleague
scarcella 11 Senior Software Architect
Stefano Mtangoo 455 Senior Poster
scarcella 11 Senior Software Architect
mschroeder 251 Bestower of Knowledge Team Colleague
scarcella 11 Senior Software Architect
scarcella 11 Senior Software Architect
mschroeder 251 Bestower of Knowledge Team Colleague
scarcella 11 Senior Software Architect
Stefano Mtangoo 455 Senior Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.