<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<?php
// connection to MySQL server
mysql_connect('localhost','root','');
mysql_select_db('administration');
// *** Validate request to login to this site.
//session_start();
if (isset($_POST['username'])) {
$loginUsername=$_POST['username'];
$loginPassword=$_POST['password'];
$MM_redirectLoginSuccess = "validated.php";
$MM_redirectLoginFailed = "admin.php";
$MM_redirecttoReferrer = true;
mysql_select_db('administration');
$errors = array();
if(empty($_POST['username'])) {
$errors[] = 'You think your father going to fill up the USERNAME for you?';
}
if(empty($_POST['password'])) {
$errors[] = 'Where is the PASSWORD you asshole!';
}
if (empty($errors)) {
$loginUsername = get_magic_quotes_gpc() ? $loginUsername : addslashes($loginUsername);
$password = get_magic_quotes_gpc() ? $password : addslashes($password);
$LoginRS_query = "SELECT username, password FROM adminprofile WHERE username='$loginUsername' AND password='$loginPassword'";
$LoginRS = mysql_query($LoginRS_query) or die(mysql_error());
$loginFoundUser = mysql_num_rows($LoginRS);
if ($loginFoundUser) {
setcookie ('username', $loginFoundUser[0]);
setcookie ('password', $loginFoundUser[1]);
$url = 'http://' . $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']);
if ((substr($url, -1) == '/') OR (substr($url, -1) == '\\') ) {
$url = substr ($url, 0, -1);
}
$url .= '/validated.php';
header("Location: $url");
exit();
}
else {
$errors[] = 'The email address and password entered do not match those on file.';
$errors[] = mysql_error() . '<br /><br />Query: ' . $query;
}
}
}
mysql_close();
?>
<html>
<head>
<title>Cycle Tracks Portal - Administrator's Page</title>
<style type="text/css" media="all">@import "images/style.css";
</style>
<link rel="alternate" type="application/rss+xml" title="RSS 2.0" href="rss/" />
</head>
<body>
<div class="content">
<div class="topmenu">
<div class="date_"><? echo date('l dS \of F Y'); ?></div>
</div>
<div id="submenu">
</div>
<div class="cycle">
<div class="title" style="text-align: center; width: 179px">
<sup>
<span class="copynresv">©</span></sup>CYCLE TRACKS<sup><span class="copynresv">®</span></sup></div>
<div class="slogan" style="width: 223px; height: 11px">"We are ONE of the BEST and NOT like the REST!</div>
</div>
<div class="nav">
<ul>
<li><a href="#">HOME</a> | </li>
<li><a href="#">INSTRUCTIONS</a> | </li>
<li><a href="#">FIND</a> | </li>
<li><a href="#">DISPLAY</a> | </li>
<li><a href="#">ADMIN</a> | </li>
<li><a href="#">CREDITS</a></li>
</ul>
</div>
<br>
</br>
<table style="width: 764px; height: 141px;"align="center" cellspacing="1">
<tr>
<td>
<form name="adminInput" action="admin.php" method="post" style="height: 99px">
<table style="width: 284px; height: 56px" align="center">
<tr>
<td style="width: 189px; height: 21px;" class="uspstyle">Username</td>
<td style="width: 191px; height: 21px;">
<input type="text" name="username" size="30"/>
</td>
</tr>
<tr>
<td style="width: 189px; height: 21px;" class="uspstyle">Password</td>
<td style="width: 191px; height: 21px;">
<input type="password" name="password" size="30"/>
</td>
</tr>
<tr>
<td style="width: 189px; height: 36px;" class="uspstyle"></td>
<td style="width: 191px; height: 36px;">
<table style="width: 100%">
<tr>
<td style="width: 89px">
<input type="submit" name="submit" value="Login" class="uspstyle2" style="height: 23px; width: 88px"/></td>
<td style="width: 89px">
<input type="reset" name="reset" value="Clear" class="uspstyle2" style="height: 23px; width: 88px"/></td>
</tr>
</table>
</td>
</tr>
</table>
</form>
<?php
if (!empty($errors)) { // Print any error messages.
echo '<h1 class="errorLog1">Error!</h1>
<p class="errorLog2">The following error(s) occurred:<br />';
foreach ($errors as $msg) { // Print each error.
echo " - $msg<br />\n";
}
echo '</p><p class="errorLog3">Please try again.</p>';
}
?>
</td>
</tr>
</table>
<div class="footer">
<div class="padding">
© Copyright Cycle Tracks <span>®</span></div>
</div>
</div>
</body>
</html>
<?php
?>
errors:
Warning: Cannot modify header information - headers already sent by (output started at E:\xampp\htdocs\cycle\admin.php:3) in E:\xampp\htdocs\cycle\admin.php on line 37
Warning: Cannot modify header information - headers already sent by (output started at E:\xampp\htdocs\cycle\admin.php:3) in E:\xampp\htdocs\cycle\admin.php on line 38
Warning: Cannot modify header information - headers already sent by (output started at E:\xampp\htdocs\cycle\admin.php:3) in E:\xampp\htdocs\cycle\admin.php on line 46
Please help.