Greetings,
New to PHP so bear with me.
I have a login page whose index.php goes through about 6 .php files to determine if the person is logged in. I am trying to put a confidentiality notice in the main login page.
Here is the code:
I want to place the HTML formatted text after the if ($num < 1) statement, but I can't figure it out. Can someone help me find a way around this?
Thank you so much.
New to PHP so bear with me.
I have a login page whose index.php goes through about 6 .php files to determine if the person is logged in. I am trying to put a confidentiality notice in the main login page.
Here is the code:
Code:
<?php
// Login & Session example by sde
// auth.php
// start session
session_start();
// convert username and password from _POST or _SESSION
if($_POST){
$_SESSION['username']=$_POST["username"];
$_SESSION['password']=$_POST["password"];
}
// query for a user/pass match
$result=mysql_query("select * from users
where username='" . $_SESSION['username'] . "' and password='" . $_SESSION['password'] . "'");
// retrieve number of rows resulted
$num=mysql_num_rows($result);
// print login form and exit if failed.
if($num < 1){
echo "You are not authenticated. Please login.<br><br>
<form method=POST action=index.php>
username: <input type=text name=\"username\"> <BR><BR>
password: <input type=password name=\"password\"> <BR><BR>
<input type=submit value='Login'>
</form>";
exit;
}
else
?>
I want to place the HTML formatted text after the if ($num < 1) statement, but I can't figure it out. Can someone help me find a way around this?
Thank you so much.