index.php pagina
login.php pagina
PHP:
<?php
$aPages = array('login',
'artikelen');
if(isset($_GET['page']) && in_array($_GET['page'], $aPages)){
if(file_exists($_GET['page'].'.php')){
include_once $_GET['page'].'.php';
}else{
include_once '404.html';
}
}else{
include_once '400.html';
} ?>
<?php require_once('Connections/site.php');
if(strlen($_POST['titel']) > 0){
$query_rsgegevens =("SELECT * FROM tabel WHERE titel LIKE '%". $_POST['titel'] ."%'");
while($query_rsgegevens = mysql_fetch_array($rsgegevens)){
echo($query_rsgegevens['titel'] .'<BR>');
}
}
?>
<!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/html; charset=utf-8" />
<title>Cheap4Students</title>
<script src="SpryAssets/SpryValidationTextField.js" type="text/javascript"></script>
<link href="SpryAssets/SpryValidationTextField.css" rel="stylesheet" type="text/css" />
</head>
<body>
<p align="center"><img src="top.jpg" width="700" height="100" /></p>
<table align="left" width="20%" border="0" cellpadding="5" cellspacing="0">
<tr>
<td valign="top" class="menu">
<?php
$file = "bericht.txt";
$fp = fopen($file, "r");
$data = fread($fp, filesize($file));
fclose($fp);
echo "<a href=toevoegen.php>plaats bericht</a><br><br>";
$alleberichten = count_chars($data);
$alleberichten=$alleberichten[ord("^&*")];
echo "aantal berichten: ".$alleberichten."<br><br>";
$heelbericht=explode("^&*",$data);
$start=0;
?>
</td>
</tr>
<td valign="top"><a href="?page=artikelen">Bedrijven</a></td>
</tr>
<tr>
<td valign="top" class="menu">Zoek</td>
</tr>
<tr>
<td valign="top" class="menu"><a href="?page=login">Admin</a></td>
</tr>
<tr>
<td valign="top" class="menu">Mail ons</td>
</tr>
</table>
<table width="59%" height="123%" border="0" align="left" cellpadding="5" cellspacing="0" style="height:100%;">
<tr>
<td height="33" valign="top" bgcolor="#E5E5E5" class="locator" style="border: 2px #FFFFFF solid;"><div align="center">welkom</div>
<?php
echo "<marquee>";
while($start<$alleberichten)
{
$deelbericht=explode("%$£",$heelbericht[$start]);
echo " <font color=red>[".$deelbericht[0]."]</font> ". $deelbericht[1];
$start++;
}
echo "</marquee>";
?>
</td>
</tr>
<tr>
<td valign="top" height="100%"><h1> </h1>
<p> </p>
<p align="center">This site is currently under construction.</p></td>
</tr>
</table>
</body>
</html>
login.php pagina
PHP:
<?php
session_start();
if(file_exists('setup.php')){
exit("<h1>Error</h1>\n<p>You must delete <strong>setup.php</strong> first.</p>\n");
}
require_once('config.php');
if(isset($_SESSION['name'])){
header('Location: '.$pagina);
}
if($_SERVER['REQUEST_METHOD'] == 'POST'){
if(!empty($_POST['login_name']) AND !empty($_POST['login_pass']) AND file_exists('members/' . htmlentities($_POST['login_name'], ENT_QUOTES) . '.php')){
$login['name'] = htmlentities($_POST['login_name'], ENT_QUOTES);
$login['pass'] = md5($_POST['login_pass']);
require_once('members/' . htmlentities($login['name'], ENT_QUOTES) . '.php');
if($password == $login['pass']){
$_SESSION['name'] = htmlentities($login['name'], ENT_QUOTES);
$_SESSION['ip'] = $_SERVER['REMOTE_ADDR'];
header("Location: " . $pagina);
}else {
echo "<h1>Error</h1>\n<p>Wrong password.</p>\n";
}
}else{
echo "<h1>Error</h1>\n<p>Login incorrect, please try again!</p>\n";
}
}else{
?>
<style type="text/css">
<!--
.stijl1 {
color: #FF0000;
font-weight: bold;
}
-->
</style>
<form method="post" action="#">
<h1 align="center"><img src="top.jpg" width="700" height="100" /></h1>
<p align="center">Registratie alleen mogelijk voor Team administrators Cheap4Students</p>
<p align="center">registratie voor members is niet <span class="stijl1">toegestaan</span>.</p>
<p align="center">gebruikers <a href="index.php">Klik hier</a></p>
<h1 align="center">Admin Login</h1>
<p align="center">Username:<br /><input type="text" name="login_name" maxlength="20" /></p>
<p align="center">Password:<br /><input type="password" name="login_pass" maxlength="20" /></p>
<p align="center"><input type="submit" name="submit" value="Login" /></p>
</form>
<?php
}
?>