View file login.php

File size: 1.02Kb
<?php
include('head.php');
require_once('session.php');

$error = '0';
if (isset($_POST['submitBtn'])){
$username = isset($_POST['username']) ? $_POST['username'] : '';
$password = isset($_POST['password']) ? $_POST['password'] : '';
$error = loginUser($username,$password);
}
?>
<?php if ($error != '') {?>
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post" name="loginform"><center>

Username: <br/><input name="username" type="text"  />
<br/>
Password: <br/><input name="password" type="password" />
<br/>
<input class="text" type="submit" name="submitBtn" value="Login" />
</center></form>
<?php
}
if (isset($_POST['submitBtn'])){

?>
<?php
if ($error == '') {
echo "<center>Welcome $username! <br/>";
$online=@fopen('online_list.txt','a+'); @chmod('online_list.txt',0777); @fwrite($online,'<center><a href="prof.php?user='.$_SESSION["userName"].'">'.$_SESSION["userName"].'</a></center>'); @fclose($online);
echo '<a href="index.php">Continue..</a></center>';
}
else echo $error;

?>
<?php
}
?>
<?php include('foot.php'); ?>