login.php code:
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/hatml; charset=iso-8859-1" />
<title>Login</title>
<link href="style.css" rel="stylesheet" type="text/css" />
<?php
session_start();
include 'config.php';
if(isset($_POST['login']))
{
$username = trim(addslashes($_POST['username']));
$password = md5(trim($_POST['password']));
$query = mysql_query("SELECT * FROM Users WHERE Username = '$username' AND Password = '$password' LIMIT 1") or die(mysql_error());
$row = mysql_fetch_array($query);
// now we check if they are activated
if(mysql_num_rows($query) > 0)
{
if($row['Activated'] > 0)
{
$_SESSION['s_logged_n'] = 'true';
$_SESSION['s_username'] = $username;
$_SESSION['s_name'] = $row['Name'];
header("Location: member.php");
} else {
echo '
<html>
<head>
<title>Login</title>
<link href="style.css" rel="stylesheet" type="text/css">
</head>
<body>
<div id="error"><p>Sorry, you must activate your account first. Please check your email for the email.</p>
<p>Didn'."'".'t get your validation email? <a href="resend.php">Click here</a> to resend the validation email.</p></div>
</body>
</html>
';
}
} else {
echo '
<html>
<head>
<title>Login</title>
<link href="style.css" rel="stylesheet" type="text/css">
</head>
<body>
<div id="error"><p>There was an error processing your login, it appears that your username and/or password was incorrect. Please try again.</p>
<p>Didn'."'".'t get your validation email? <a href="resend.php">Click here</a> to resend the validation email.</p>
</div>
</body>
</html>
';
}
} else {
?>
</head>
<body>
<center>
<table width="800" border="1">
<tr>
<th scope="col"><table width="800" height="924" border="0" bgcolor="#CCCCCC">
<tr>
<th height="39"><?php
include "upper.htm";
?>
</p>
<hr /></th>
</tr>
<tr>
<td height="834"><p>
</p>
<div id="wrapper">
<div id="head">Login</div>
<br />
<div id="main">
<p>Je moet hier inloggen om deze pagina te kunnen zien. Type je Username en wachtwoord in! </p>
<form method="post" action="<?= $_SERVER['PHP_SELF'] ?>">
<p>Username:<br />
<input name="username" type="text" cid="username" />
</p>
<p>Wachtwoord:<br />
<input name="password" type="password" id="password" />
</p>
<p>
<input name="login" type="submit" id="login" value="Submit" />
</p>
</form>
<p>Kreeg je je activeringsmail niet? <a href="resend.php">Klik hier </a> om de activeringsmail opnieuw aan te krijgen. </p>
<p>Nog geen account? <a href="register.php">Klik hier </a>om te registreren. Het is volledig gratis ! </p>
</div>
</div>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p></td>
</tr>
<tr>
<td height="30"><?php
include "down.htm";
?></td>
</tr>
</table></th>
</tr>
</table>
</center>
</body>
</html>
<? } mysql_close($l); ?>