Here is my mainpage indexbody.php :
[php]<?php
require_once("…/.common/.init.php");
$style = ‘…/.common/default.css’;
$ip = $_SERVER[‘REMOTE_ADDR’];
//if ($ip != $status_ip1 and $ip != $status_ip2 and $ip != $status_ip3) {$status = ‘sorry’;}
$db = new PDO(DBASE);
$result = $db->query(“SELECT * FROM Teksten WHERE soort=‘adres’;”);
foreach($result as $row)
{ extract($row); $adres = $tekst;}
$telefoon = ‘Vragen? Bel ons! (dinsdag t/m vrijdag tussen 10 en 16 uur)’;
$nwsbrief = “…/nieuwsbrief/print.php”;
$nwsbriefbeheer = $nwsbrief."?status=1234";
$omschrijvingRW = <<< OMSCHR
Bij de Ruilwinkel helpen we elkaar met spullen en diensten.
De waardering gaat in punten, geld speelt geen rol.
U kunt punten verdienen door andere deelnemers te helpen, met spullen die u zelf over hebt, of door een klusje op te knappen.
Met de verdiende punten kunt u zelf spullen afnemen of hulp vragen bij dingen waar u zelf minder goed in bent.
Dankzij de punten is ruilen met gelijk oversteken niet nodig!
OMSCHR;
function setHeader() {
extract($GLOBALS);
if($_GET['amount'] != "")
$amount = "&amount=".$_GET['amount'];
else
$amount = "";
if($status == $statuscode) {
echo "<div id='header' style='width: 1010px; height: 85px; background-color: #4B259C;'>
<h2 style='position: absolute; margin-left: 30px; margin-top: 32px; color: green'>BEHEER</h2>
<a href = '../paginas/indexbody.php?status=1234$amount' target = '_top' ><img style='position: absolute; margin-left: 780px; margin-top: 15px; width: 180px; height: 50px;' src='../.common/ruilwinkel.gif' title='$omschrijvingRW' border='0'/></a>
<a href='$nwsbriefbeheer' target='_blank'><img style='position: absolute; margin-left: 570px; margin-top: 2px' src='../.common/nwsbrief.gif' title='laatste nieuwsbrief' border='0'/></a>
<div style= 'position: absolute; margin-left: 200px; margin-top: 8px; width: 500px; color: yellow; text-align: left;' title='Zie ook kaartje onderaan deze website'>$adres</div>
</div>";
}
else {
echo "<div id='header' style='width: 1010px; height: 85px; background-color: #4B259C;'>
<a href='indexbody.php?service=Bericht$amount' style='position: absolute; margin-left: 700px; margin-top: 12px; '><img src='../images/brief.gif' border='0' title='mail ons! Klik hier voor contact-formulier' /></a>
<img style='position: absolute; margin-left: 5px; margin-top: 3px; width: 40px; height: 40px;' src='../.common/logo.gif' title='$omschrijvingRW' border='0'>";
if($amount != "")
$amount = str_replace('&','', '?'.$amount);
echo"<a href = '../paginas/indexbody.php$amount' target = '_top' ><img style='position: absolute; margin-left: 45px; margin-top: 8px; width: 140px; height: 36px' src='../.common/ruilwinkel.gif' title='$omschrijvingRW' border='0'/></a>
<h6 style='position: absolute; margin-left: 45px; margin-top: 54px;' title = '$telefoon'>010-2151657</h6>
<a href='$nwsbrief' target='_blank'><img style='position: absolute; margin-left: 850px; margin-top: 10px; width: 135px; height: 60px;' src='../.common/nieuws.gif' title='laatste nieuws' border='0'/></a>
<div style= 'position: absolute; margin-left: 200px; margin-top: 8px; width: 500px; color: yellow; text-align: left;' title='Zie ook kaartje onderaan deze website'>$adres</div>
</div>";
}
}
function setServTitel() {
extract($GLOBALS);
if(!isset($_GET[‘service’]))
$_GET[‘service’] = “Spulaanbod”;
switch($_GET['service'])
{
case "Spulaanbod": echo $status == $statuscode ? "<a class='beheer' href = 'indexbody.php?service=Spulaanbod_Beheer&status=$statuscode'>+</a>" : ""; echo"<span class='title'>Spullen Aangeboden</span>";break;
case "Spulgevraagd": echo $status == $statuscode ? "<a class='beheer' href = 'indexbody.php?service=Spulgevraagd_Beheer'>+</a>" : ""; echo "<span class='title'>Spullen Gevraagd</span>";break;
case "Hulpaanbod": echo $status == $statuscode ? "<a class='beheer' href = 'indexbody.php'>+</a>" : ""; echo "<span class='title'>Hulp Aangeboden</span>";break;
case "Hulpgevraagd": echo $status == $statuscode ? "<a class='beheer' href = 'indexbody.php'>+</a>" : ""; echo "<span class='title'>Hulp Gevraagd</span>";break;
case "Leenaanbod": echo $status == $statuscode ? "<a class='beheer' href = 'indexbody.php'>+</a>" : ""; echo "<span class='title'>Te Leen Aangeboden</span>";break;
case "Spulaanbod_Beheer": echo "<span class='title'>Spulaanbod Beheer</span>";break;
case "Spulgevraagd_Beheer": echo "<span class='title'>Spulgevraagd Beheer</span>";break;
case "Info":echo "<span class='title'>Info</span>";break;
case "Bericht": echo "<span class='title'>Bericht Versturen</span>";break;
}
}
function setService() {
extract($GLOBALS);
switch($_GET['service'])
{
case "Spulaanbod": include '../paginas/nwspul.php';break;
case "Spulaanbod_Beheer": include '../.beheer/.nwspul_form.php';break;
case "Spulgevraagd_Beheer": break;
case "Spulgevraagd": include'../paginas/vraag.php';break;
case "Hulpaanbod": include'../paginas/dienstenA.php';break;
case "Hulpgevraagd": include'../paginas/dienstenV.php';break;
case "Leenaanbod": include '../paginas/uitleen.php';break;
case "Bericht": include '../paginas/bericht.php';break;
}
}
function setServices() {
extract($GLOBALS);
include ‘…/paginas/services.php’;
}
function setPages() {
extract($GLOBALS);
if(!isset($_GET['page']))
$_GET['page'] = 1;
switch($_GET['service'])
{
case "Spulaanbod": $result = $db->query("SELECT COUNT(*) AS Aantal FROM AanbodSpul;");break;
case "Spulgevraagd": $result = $db->query("SELECT COUNT(*) AS Aantal FROM Vraag;");break;
case "Hulpaanbod": $result = $db->query("SELECT COUNT(*) AS Aantal FROM DienstenA;");break;
case "Hulpgevraagd": $result = $db->query("SELECT COUNT(*) AS Aantal FROM DienstenV;");break;
case "Leenaanbod": $result = $db->query("SELECT COUNT(*) AS Aantal FROM Uitleen;"); break;
}
if($_GET['service'] != "Info" && $_GET['service'] != "Bericht" && $_GET['service'] != "Spulaanbod_Beheer") {
foreach($result as $row)
{ extract($row); }
$_GET['pages'] = ceil($Aantal/$page_limit);
if($_GET['pages'] == 0)
$_GET['pages'] = 1;
echo "<span id='pages'>Pagina ".$_GET['page']." van ".$_GET['pages']."</span>";
}
}
function setButtons() {
$page = $_GET['page'];
$pages = $_GET['pages'];
$serv = $_GET['service'];
if($_GET['amount'] != "")
$am = "&amount=".$_GET['amount'];
else
$am = "";
if($_GET['status'] != "")
$stat = "&status=".$_GET['status'];
else
$stat = "";
if($page > 1) {
echo"<a class='a' href='indexbody.php?service=$serv&page=1$am$stat'><div id='first'>|< </div></a>";
echo"<a class='a' href='indexbody.php?service=$serv&page=".($page - 1)."$am$stat'><div id='previous'> < </div></a>";
}
if($pages > 10)
$left_range = 8;
else
$left_range = 9;
if($page >= 10)
$right_range = 1;
else
$right_range = 10 - $page;
for($i = ($page - $left_range) ; $i <= ($page + $right_range); $i++) {
if($i > 0 && $i <= $pages) {
if($page == $i)
echo"<a class='a'><div id='selected'>$i</div></a>";
else
echo"<a class='a' href='indexbody.php?service=$serv&page=$i$am$stat'><div id='p'>$i</div></a>";
}
}
if($page < $pages) {
echo"<a class='a' href='indexbody.php?service=$serv&page=".($page + 1)."$am$stat'><div id='next'> > </div></a>";
echo"<a class='a' href='indexbody.php?service=$serv&page=$pages$am$stat'><div id='last'> >| </div></a>";
}
}
function setNumberPerPage($id) {
$options = array(
6 => 6,
12 => 12,
18 => 18,
24 => 24,
30 => 30
);
if($_GET['service'] != "Info" && $_GET['service'] != "Bericht" && $_GET['service'] != "Spulaanbod_Beheer") {
echo"<form name = 'form' action = 'indexbody.php' method = 'GET'>
<label for = 'amount' id = 'label'>Aantal: </label>
<select id='$id' name='amount' onchange='setAmount(this)'>";
foreach($options as $key => $value) {
$selected = $_GET['amount'] == $key ? 'selected' : '';
if($key == 24 && !$_GET['amount'])
$selected = 'selected';
echo"<option value = '".$key."' ".$selected.">".$value."</option>";
}
echo"</select></form>";
}
}
if($_GET[‘amount’] != “”)
$amount = “&amount=”.$_GET[‘amount’];
else
$amount = “”;
if($_GET[‘status’] != “”)
$stat = “&status=”.$_GET[‘status’];
else
$stat = “”;
$menu = <<< MENU
MENU;
echo <<< START
Test
START;
?>
<? echo "
";
setHeader();
echo "
$menu
";setServTitel(); echo" |
";setNumberPerPage("amount1"); echo" |
";setPages(); echo" |
";setButtons();
echo" |
";setService(); echo "
";setServTitel(); echo" |
";setNumberPerPage("amount2"); echo" |
";setPages(); echo" |
";setButtons();
echo" |
";setServices(); echo "
$menu
Copyright © 2013 Fijenoord Ruilwinkel
";
?>[/php]
and this is nwspul.php :
[php]<?php
require_once("…/.common/.init.php");
$db = new PDO(DBASE);
$table = “AanbodSpul”;
print <<< START
bekijk de nieuwe spullen
START;
function Delete($id) {
extract($GLOBALS);
if (isset($id)) {
$db->query("DELETE FROM $table WHERE id = $id;");
if (is_file("../fotoos/$id.jpg")) {unlink("../fotoos/$id.jpg");}
echo "ID: $id";
}
}
$offset = ($_GET[‘page’] - 1) * $page_limit;
//advertenties
$result = $db->query(“SELECT * FROM $table ORDER BY id DESC LIMIT $page_limit OFFSET $offset;”);
$i=-1;
echo “”;
echo “
”;
foreach($result as $row)
{ extract($row);
$i++;
//$tekst = stripslashes($tekst);
if (is_numeric($lidnr)){
$plaatje="../fotoos/".$id.".jpg";
$ext = "jpg";
if (!is_file($plaatje))
{$plaatje='../fotoos/blanco.gif'; $ext = "gif"; }
$src="resizefoto.php?plaatje=$plaatje&ext=$ext";
$info = "Spullen:$id <small>$datum</small>";
//ad
echo “
”;
if ($status == $statuscode) {
echo"<input type='submit' id='wisbutton' name='wisbutton[$i]' value='Delete' title='wis advertentie'>";
if($wisbutton[$i])
Delete($id);
}
echo"</td>";
}
}
echo"
|
";
$db = NULL;
print <<<EINDE
EINDE;
?> [/php]
This is the link to the webpage: http://expopunt.nl/.kwikweb/paginas/indexbody.php?service=Spulaanbod&status=1234
You can see only the picture is deleted.