______________________
index.php
______________________
<?php
//maxaantalwedstrijden tellen
if(file_exists("database/clubs.txt")){
$clubs=file("database/clubs.txt");
$aantalclubs=count($clubs);
$maxaantalwedstrijden=($aantalclubs*2)-2;}
else {$maxaantalwedstrijden="0";}

//Tijdstip laatste wijziging
$laatstewijziging=date ("d-m-Y @ H:i:s", filectime("database/resultaten.txt"));
echo" De stand is het laatst bijgewerkt op: <strong>".$laatstewijziging."</strong>";

$clubs=file("database/clubs.txt");
$aantalclubs=count($clubs);
?>
  <table border="0" cellpadding="0" cellspacing="0" width="100%">
    <tr>
      <td width="100%"><br></td> </tr>
  </table>
  </center>

<table border="1" cellpadding="3" cellspacing="0" width="75%">
<tr><td align="center">&nbsp;</td>
      <td><strong>Club</strong></td>
      <td align="center">Gespeeld</td>
      <td align="center">Punten</td>
<td align="center">Winst</td>
      <td align="center">Gelijk</td>
      <td align="center">Verlies</td>
    <td align="center">Voor</td>
    <td align="center">Tegen</td>
   <td align="center">Saldo</td>
  </tr>
<?php
if(file_exists("database/resultaten.txt")){
  $gegevensbestand=file("database/resultaten.txt");}

//tijdens het testen bleek dit teklkens correct te sorteren

usort($gegevensbestand, strnatcmp); 
$gegevensbestand=array_reverse($gegevensbestand); 

 for ($i=0;$i<$aantalclubs;$i++)  {
       list($punten,$nogtespelen,$saldo,$voor,$tegen,$club,$winst,$gelijk,$verlies,$gespeeld)=explode('||',$gegevensbestand[$i]);

if($saldo=="0") {$saldo=$saldo;} else{ $saldo=$saldo-1000;}

$club2 = preg_replace('#([^a-z0-9]+)#i', '_', $club);

//totaal aantal doelpunten dat gescoord is
$aantaldoelpunten=$aantaldoelpunten+$voor;

if($nogtespelen=="") {$nogtespelen=$maxaantalwedstrijden;}

echo" 
    <tr>
<td align=\"center\">".($i+1)."</td>
      <td><strong><a href=\"\"onClick=\"window.open('clubinfo.php?club=$club2', 'Clubinformatie', 'width=450, height=350, scrollbars=yes'); return false;\" title=\"Meer informatie over ".$club."\">".$club."</A></strong></td>
      <td align=\"center\"><strong>".$gespeeld."</strong></td>
      <td align=\"center\"><strong>".$punten."</strong></td>
 <td align=\"center\">".$winst."</td>
      <td align=\"center\">".$gelijk."</td>
 <td align=\"center\">".$verlies."</td>
       <td align=\"center\">".$voor."</td>
    <td align=\"center\">".$tegen."</td>
   <td align=\"center\">".$saldo."</td>
  </tr>";}
?>

</td>
    </tr>
  </table><br/><br/>

<strong>Statistieken:</strong>
<ul>
<?php

//aantal gespeelde wedstrijden tot nu toe
$wedstrijdenbestand=file("database/alleuitslagen.txt");
$aantalgespeeldewedstrijden=count($wedstrijdenbestand);

if($aantalgespeeldewedstrijden!="0") {
echo "<li>Er zijn ".$aantalgespeeldewedstrijden." wedstrijden gespeeld.</li>";

//gemiddelde per wedstrijd
$gemiddelde=$aantaldoelpunten/$aantalgespeeldewedstrijden;
echo"<li>Er is  ".$aantaldoelpunten." keer gescoord. Dat is gemiddeld ".round($gemiddelde,2)." doelpunten per wedstrijd.</li>";}

?>
</ul>

<?php
function copyright ($script,$versie) { 
echo"<br><br><center><div class=\"kleiner\">".$script." Versie ".$versie."</div>
<a href=\"http://www.nummer11.nl/elf\" target=\"_blank\">
<b>2005 &copy; Nummer11.nl</b>
</center></a>";}
copyright("Competitiemanager","V1.0");
?>

________________________________
clubtoevoegen.php
________________________________
<HEAD>

<SCRIPT LANGUAGE="JavaScript">
function toForm() {
document.nieuweclub.nieuweclub.focus();}
</script>

<script type="text/javascript"> 
// ADDTEXT 
function addtext(veld,text) 
{ 
    document.nieuweclub.elements[veld].value += " "+text+" "; 
    document.nieuweclub.elements[veld].focus(); 
} 
</script>
</HEAD>

<BODY onLoad="toForm()">

<?php
if(isset($_POST['nieuweclub'])) {

//html-tags verwijderen
$_POST['nieuweclub'] = stripslashes($_POST['nieuweclub']);
$_POST['nieuweclub'] = ucfirst ($_POST['nieuweclub']);
$_POST['tenue']=trim($_POST['tenue']);

//wegschrijven naar een bestand
$logfile = fopen("database/clubs.txt","a"); 
fwrite($logfile, $_POST['nieuweclub']."||".$_POST['tenue']."||\n"); 
fclose($logfile);

//wegschrijven naar een resultatenbestand
//iedere club begint met 0 punten
//nul wedstrijden enz ...

$logfile = fopen("database/resultaten.txt","a"); 
fwrite($logfile, "0||||0||0||0||".$_POST['nieuweclub']."||0||0||0||0||\n"); 
fclose($logfile);

$club=file("database/clubs.txt");
foreach ($club as $regel){
list($clubs)=explode('||',$regel);
if($_POST['nieuweclub']==$clubs) {
echo $_POST['nieuweclub']." is toegevoegd aan de competite";}
}
}

?>

<h3>Nieuwe club invoeren </H3>

<form method="POST" name="nieuweclub" action="<?php echo $PHP_SELF; ?>">
Clubnaam: <input type="text" name="nieuweclub" size="40"><br>

Clubkleuren: <input type="text" name="tenue" size="40"><br> (klik slecht één tenuetje aan !!!)

<table width="50%">

<?php
$kolom="6";
$tenue=array();
$tenue=file("database/tenue.txt");

for($x = 0; $x < count($tenue); $x++){ 
$kleding=explode('||',$tenue[$x]);
    if($x%$kolom==0) 
        echo "<TR>\n"; 
 echo "<TD  align=\"center\"><a href=\"javascript:addtext('tenue','".$kleding[0]."')\"><img src=\"database/images/".$kleding[0]."\" border=\"0\" alt=\"".$kleding[0]."\"</a>\n"; 
    if($x%$kolom==$kolom-1) 
        echo "</TR>\n\n"; 
} 
if($x%$kolom!=0) 
{ 
    while($x++%$kolom!=0) 
        echo "<TD>&nbsp;</TD>\n"; 
    echo "</TR>\n"; }
?>
      
</table>

<p><input type="submit" value="Voeg toe" name="B1" class="knop"> 
 <input type="reset" value="Invoer wissen" name="B2" class="knop">

</form></body></html>
________________________________
clubinfo.php
________________________________

<head>
<title>Clubinformatie</title>
</head><body>

<?php
$clubs=file("database/clubs.txt");
foreach ($clubs as $line) {
list($club,$tenue)=explode('||',$line);

$club2 = preg_replace('#([^a-z0-9]+)#i', '_', $club);


if($_GET['club']===$club2) {echo"
<table cellpadding=\"5\"><tr>
<td><img src=\"database/images/".$tenue."\"></td>
<td><h3> ".$club."</h3></td></tr></table>";}}
?>

<hr>
Gespeelde wedstrijden:<br><br>
<table cellpadding="3">

<?php
$wedstrijden=file("database/alleuitslagen.txt");

sort($wedstrijden);

foreach ($wedstrijden as $regel) {
list($datum_id,$datum,$thuisploeg,$uitploeg,$thuisgescoord,$uitgescoord)=explode('||',$regel);

$datum=date("d-m-Y",$datum_id);

$thuisploeg2 = preg_replace('#([^a-z0-9]+)#i', '_', $thuisploeg);
$uitploeg2 = preg_replace('#([^a-z0-9]+)#i', '_', $uitploeg);

if($_GET['club'] ==$thuisploeg2) {
$colorthuis="#cc33000";} else {$colorthuis="#ffffff";}

if($_GET['club'] ==$uitploeg2) {
$coloruit="#cc3300";} else {$coloruit="#ffffff";}

if(($_GET['club'] ==$thuisploeg2) || ($_GET['club'] ==$uitploeg2)) {
echo"<tr>
<td>".$datum."</td><td bgcolor=\"".$colorthuis."\">".$thuisploeg."</td><td> - </td><td bgcolor=\"".$coloruit."\">".$uitploeg."</td><td>".$thuisgescoord." - ".$uitgescoord."</td></tr>";}
}

?>
</table>

<br><br><p>
<a href="javascript:window.close()">
Sluit dit venster</A></p>

</body></html>
_______________________________
verwerkresultaten.php
_______________________________
<?php

if(isset($_POST['thuisploeg'])) {
//maxaantalwedstrijden tellen
$clubs=file("database/clubs.txt");
$aantalclubs=count($clubs);
$maxaantalwedstrijden=($aantalclubs*2)-2;

$alleuitslagen=file("database/alleuitslagen.txt");
 foreach($alleuitslagen as $line) {
         list($datum_id,$datum,$thuisploeg,$uitploeg,$doelpuntenthuis,$doelpuntenuit)=explode('||',$line);

if(($_POST['thuisploeg'] == $thuisploeg)&&($_POST['uitploeg'] == $uitploeg)) {$eerdergespeeld="ja";}}

if($_POST['thuisploeg'] == $_POST['uitploeg']) {
echo $_POST['thuisploeg']." kan natuurlijk nooit tegen zichzelf voetballen !!!";} 
elseif ($eerdergespeeld=="ja")
{echo" Deze wedstrijd is reeds gespeeld !!</strong>";} else {

$datum=$_POST['wedstrijddag']."-".$_POST['wedstrijdmaand']."-".$_POST['wedstrijdjaar'];

$datum_id=mktime ( 0, 0, 0, $_POST['wedstrijdmaand'], $_POST['wedstrijddag'], $_POST['wedstrijdjaar']); 

$_POST['thuisploeg']=stripslashes($_POST['thuisploeg']);
$_POST['uitploeg']=stripslashes($_POST['uitploeg']);

//wegschrijven naar een bestand
$logfile = fopen("database/alleuitslagen.txt","a"); 
fputs($logfile, $datum_id."||".$datum."||".$_POST['thuisploeg']."||".$_POST['uitploeg']."||".$_POST['doelpuntenthuis']."||".$_POST['doelpuntenuit']."||||||\n"); 
fclose($logfile);

if($_POST['doelpuntenthuis'] > $_POST['doelpuntenuit']) {
$puntenthuisploeg="3";
$puntenuitploeg="0";
$winstthuis="1"; $verliesthuis="0"; $gelijkthuis="0";
$winstuit="0"; $verliesuit="1"; $gelijkuit="0";}
elseif
($_POST['doelpuntenthuis'] < $_POST['doelpuntenuit']) {
$puntenthuisploeg="0";;
$puntenuitploeg="3";
$winstthuis="0"; $verliesthuis="1"; $gelijkthuis="0";
$winstuit="1"; $verliesuit="0"; $gelijkuit="0";}
else {
$puntenthuisploeg="1";
$puntenuitploeg="1";
$winstthuis="0"; $verliesthuis="0"; $gelijkthuis="1";
$winstuit="0"; $verliesuit="0"; $gelijkuit="1";}

//berekening voor de thuisploeg

$gegevensbestand=file("database/resultaten.txt");
foreach ($gegevensbestand as $regelnummer => $line) {
list($punten,$nogtespelen,$saldo,$voor,$tegen,$club,$winst,$gelijk,$verlies,$gespeeld)=explode('||',$line);

if($club==$_POST['thuisploeg']) {

$tpuntennieuw=$punten+$puntenthuisploeg;
$tnugespeeld=$gespeeld+1;
$tnieuwvoor=$voor+$_POST['doelpuntenthuis'];
$tnieuwtegen=$tegen+$_POST['doelpuntenuit'];
$tsaldonieuw=$tnieuwvoor-$tnieuwtegen;

//om later met sorteren geen negatief saldo
//te krijgen wordt er 1000 bij opgeteld.
//Later in bekijk.php word er weer 1000
//afgetrokken.
$tsaldonieuw=$tsaldonieuw+1000;

$tnieuwwinst=$winst+$winstthuis;
$tnieuwgelijk=$gelijk+$gelijkthuis;
$tnieuwverlies=$verlies+$verliesthuis;
$tnunogtespelen=$maxaantalwedstrijden-$tnugespeeld;

unset($gegevensbestand[$regelnummer]);
$gegevensbestand = implode('',$gegevensbestand); 
$fp = fopen("database/resultaten.txt",'w'); 
$fw = fwrite($fp,$gegevensbestand); 
fclose($fp);

//nieuwe gegevens wegschrijven 
$logfile = fopen("database/resultaten.txt","a"); 
fwrite($logfile, $tpuntennieuw."||".$tnunogtespelen."||".$tsaldonieuw."||".$tnieuwvoor."||".$tnieuwtegen."||".$club."||".$tnieuwwinst."||".$tnieuwgelijk."||".$tnieuwverlies."||".$tnugespeeld."||\n"); 
fclose($logfile);}}

//berekening punten uitploeg

$gegevensbestand=file("database/resultaten.txt");
foreach ($gegevensbestand as $regelnummer => $line) {
list($punten,$nogtespelen,$rekensaldo,$voor,$tegen,$club,$winst,$gelijk,$verlies,$gespeeld,$saldo)=explode('||',$line);

if($club==$_POST['uitploeg']) {

$upuntennieuw=$punten+$puntenuitploeg;
$unugespeeld=$gespeeld+1;
$unieuwvoor=$voor+$_POST['doelpuntenuit'];
$unieuwtegen=$tegen+$_POST['doelpuntenthuis'];
$usaldonieuw=$unieuwvoor-$unieuwtegen;
$usaldonieuw=$usaldonieuw+1000;
$unieuwwinst=$winst+$winstuit;
$unieuwgelijk=$gelijk+$gelijkuit;
$unieuwverlies=$verlies+$verliesuit;
$ununogtespelen=$maxaantalwedstrijden-$unugespeeld;

unset($gegevensbestand[$regelnummer]);
$gegevensbestand = implode('',$gegevensbestand); 
$fp = fopen("database/resultaten.txt",'w'); 
$fw = fwrite($fp,$gegevensbestand); 
fclose($fp);

//nieuwe gegevens wegschrijven 
$logfile = fopen("database/resultaten.txt","a"); 
fwrite($logfile, $upuntennieuw."||".$ununogtespelen."||".$usaldonieuw."||".$unieuwvoor."||".$unieuwtegen."||".$club."||".$unieuwwinst."||".$unieuwgelijk."||".$unieuwverlies."||".$unugespeeld."||\n"); 
fclose($logfile);}}

}}
?>
<hr>
<?php
function clubs() {
       $clubs = file("database/clubs.txt");
 sort($clubs);             
        foreach($clubs as $line) {
list($club)=explode('||',$line);
echo "<option value=\"".$club."\">".$club."</option>";}
 }  


function doelpunten() {
      for($x=0;$x<26;$x++)
echo "<option value=\"".$x."\">".$x."</option>";}
?>


<HEAD>

<SCRIPT LANGUAGE="JavaScript">
<!-- Original:  Wayne Nolting (wayne@dtg.net) -->

<!-- This script and many more are available free online at -->
<!-- The JavaScript Source!! http://javascript.internet.com -->

<!-- Begin
function toForm() {
document.formulier.wedstrijddag.focus();
// Replace field1 in the script with the field name of which you want to place the focus.
}
//  End -->
</script>

</HEAD>

<BODY onLoad="toForm()">

<form method="POST" name="formulier" action="verwerkresultaten.php">

<b>Wedstrijddatum</b>(standaard is vandaag):<br/><br/>
       
Dag:&nbsp;
<select size="1" name="wedstrijddag">
       <? 
        $i = 1; 
        while($i <= 31) 
        { 
            $dagnu = date("j"); 
            echo "<option value=\"".$i."\""; 
             
            if($dagnu == $i) 
            { 
                echo "selected"; 
            } 
            echo ">".$i."</option>"; 
            $i++; 
        } 
       ?> 
      </select> 
&nbsp; 
Maand:&nbsp;
<select size="1" name="wedstrijdmaand">
       
<? 
        $i = 1; 
        while($i <= 12) 
        { 
            $maandnu = date("n"); 
            echo "<option value=\"".$i."\""; 
             
            if($maandnu == $i) 
            { 
                echo "selected"; 
            } 
            echo ">".$i."</option>"; 
            $i++; 
        } 
       ?> 
 
      </select> &nbsp;

Jaar:&nbsp;
<select size="1" name="wedstrijdjaar">
       <? 
        $jaarnu = date("Y",time())-1; 
        $eindjaar = date("Y",time()); 
         
        while ($eindjaar >= $jaarnu) 
        { 
            echo "<option value =\"".$jaarnu."\" "; 
             
            if ($jaarnu == date("Y",time())) 
            { 
                echo "selected"; 
            } 
            echo ">".$jaarnu."</option>\n"; 
            $jaarnu ++; 
        } 
       ?> 
      </select> &nbsp;<br/><br/>

<table>
<tr><td align="center"><b>Thuis</b></td>
       <td align="center"><b>Uit</b></td></tr>

 <tr>
    <td align="center"><select size="1" name="thuisploeg"><?php clubs() ?></td>
      <td align="center"><select size="1" name="uitploeg"><?php clubs() ?></td>
  </tr>
<tr>
   
    <td align="center"><br>Doelpunten thuis</td>
    <td align="center"><br>Doelpunten uit</td>
  </tr>
  <tr>
    <td align="center"><select size="1" name="doelpuntenthuis"><?php doelpunten() ?></td>
         <td align="center"><select size="1" name="doelpuntenuit"><?php doelpunten() ?></td>
  </tr>
      </table><br/><br/>
<input type="submit" class="knop"  value="Verwerk de gegevens !!!" name="B2">
 <input type="reset" value="Invoer wissen" name="B2" class="knop"onclick="toForm();">
</form></body></html>

__________________________________________________
terugtrekken.php
__________________________________________________

<?php
if(file_exists("menu.php")) {
include("menu.php");}

//doorzoeken van een bestand

function file_search($file, $str)  
// file_search, zoekt in $file naar $str 

{  
    $fp= fopen($file, 'r');  
    $read= fread($fp, filesize($file));  
    fclose($fp);  

        $str= preg_quote($str);  
    $preg= "!$s$str$s!i";  
    return preg_match($preg, $read);  
}  


if(isset($_POST['club'])) {

if (file_search("database/alleuitslagen.txt",$_POST['club'])){  
    echo "<br/><br/>".$_POST['club']." heeft nog wedstrijden staan in de database !!!<br/>
Deze moeten eerst verwijderd worden !!!<br/>";  
}  
else { 
$gegevensbestand=file("database/resultaten.txt");
foreach ($gegevensbestand as $regelnummer => $line) {
list($punten,$nogtespelen,$saldo,$voor,$tegen,$club,$winst,$gelijk,$verlies,$gespeeld,$inmindering)=explode('||',$line);

if($_POST['club'] ==$club) {

unset($gegevensbestand[$regelnummer]);
$gegevensbestand = implode('',$gegevensbestand); 
$fp = fopen("database/resultaten.txt",'w'); 
$fw = fwrite($fp,$gegevensbestand); 
fclose($fp);}}

$clubs=file("database/clubs.txt");
foreach ($clubs as $regelnummer => $line) {
list($club,$tenue)=explode('||',$line);

if($club==$_POST['club']) {

unset($clubs[$regelnummer]);
$clubs = implode('',$clubs); 
$fp = fopen("database/clubs.txt",'w'); 
$fw = fwrite($fp,$clubs); 
fclose($fp);}}



}} 
?>


<hr>
<br/><br/>
Kies de club die je wilt terugtrekken uit de competitie !!!<br/>
Van deze club moeten eerst alle uitslagen <a href="verwijderen.php">verwijderd</a> worden uit de database !!!

<br/><br/><br/>

<form method="POST" name="corrigeren" action="terugtrekken.php">
<select name="club" size ="1">
<?php

$clubs=file("database/clubs.txt");
$aantalclubs=count($clubs);

sort($clubs);

foreach ($clubs as $regel) {
list($club, $logo)=explode('||',$regel);
echo"
<option value=\"".$club."\">".$club."</option>";
}
?>
</select>
<input type="submit" value="Kies een club !!!" name="B2">
</form>
</body></html>

______________________________________________
backup.php
______________________________________________
<?php
if(file_exists("menu.php")) {
include("menu.php");}
?><br/><br/>
<hr>
<h3>Back-up van alle gegevens !!!</H3>

<?php
$id=date("d_m_Y_H_i_s",time());

if(isset($_POST['bestand'])) {

//backup maken van gekozen bestand

copy("database/".$_POST['bestand'].".txt","backup/".$_POST['bestand'].".txt");
if(!file_exists("backup/".$_POST['bestand']."".$id.".txt")) {
rename("backup/".$_POST['bestand'].".txt", "backup/".$id."".$_POST['bestand'].".txt");}
}
?>

<form method="POST" name="coureur" action="<?php echo $PHP_SELF; ?>">

Kies bestand: 
<select size="1" name="bestand">
<option value="alleuitslagen">Alle uitslagen</option>
<option value="resultaten">De resultaten</option>
</select>

<input type="submit" value="Back up" name="B1"> 
<br/><br/>
<?php
//Controleren of er ook echt
//een backup gemaakt is !!
if(file_exists("backup/".$id."".$_POST['bestand'].".txt")) {
echo"De backup van ".$_POST['bestand'].".txt is met succes gemaakt !!!<br/>";}


?>
________________________________________
verwijderen.php
________________________________________
<?php
if(file_exists("menu.php")) {
include("menu.php");}


if(isset($_POST['club'])) {
echo"

<hr>
Gespeelde wedstrijden door ".$_POST['club'].":<br><br>

<table cellpadding=\"3\" border=\"0\">";
$wedstrijden=file("database/alleuitslagen.txt");

foreach ($wedstrijden as $regelnummer => $regel) {
list($datum_id,$datum,$thuisploeg,$uitploeg,$thuisgescoord,$uitgescoord)=explode('||',$regel);

$datum=date("d-m-Y",$datum_id);

if($_POST['club'] ==$thuisploeg) {
$colorthuis="#cc33000";} else {$colorthuis="#000000";}

if($_POST['club'] ==$uitploeg) {
$coloruit="#cc3300";} else {$coloruit="#000000";}

if(($_POST['club'] ==$thuisploeg) || ($_POST['club'] ==$uitploeg)) {
echo"<tr>

<td valign=\"top\">".$datum."</td><td valign=\"top\"><font color=\"".$colorthuis."\">".$thuisploeg."</font></td>
<td valign=\"top\"> - </td><td valign=\"top\"\"><font color=\"".$coloruit."\">".$uitploeg."</font></td>
<td valign=\"top\">".$thuisgescoord." - ".$uitgescoord."</td>
<td valign=\"top\">
<form method=\"POST\" name=\"formulier\" action=\"verwijderen.php\">
<input type=\"hidden\" name=\"thuisploeg\"  value=\"".$thuisploeg."\">
<input type=\"hidden\" name=\"uitploeg\"  value=\"".$uitploeg."\">
<input type=\"hidden\" name=\"doelpuntenthuis\"  value=\"".$thuisgescoord."\">
<input type=\"hidden\" name=\"doelpuntenuit\"  value=\"".$uitgescoord."\">
<input type=\"hidden\" name=\"regelnummer\"  value=\"".$regelnummer."\">
<input type=\"submit\" value=\"Verwijder deze uitslag uit de database !!!\" name=\"B2\">

</form>
</td>
</tr>";}
}

echo"</table>";
}

elseif(isset($_POST['regelnummer'])) {

//uitslag verwijderen uit uitslagen.txt

$uitslagen=file("database/alleuitslagen.txt");
$regelnummer=$_POST['regelnummer'];
unset($uitslagen[$regelnummer]);
$uitslagen = implode('',$uitslagen); 
$fp = fopen("database/alleuitslagen.txt",'w'); 
$fw = fwrite($fp,$uitslagen); 
fclose($fp);

//maxaantalwedstrijden tellen
$clubs=file("database/clubs.txt");
$aantalclubs=count($clubs);
$maxaantalwedstrijden=($aantalclubs*2)-2;


if($_POST['doelpuntenthuis'] > $_POST['doelpuntenuit']) {
$puntenthuisploeg="-3";
$puntenuitploeg="0";
$winstthuis="-1"; $verliesthuis="0"; $gelijkthuis="0";
$winstuit="0"; $verliesuit="-1"; $gelijkuit="0";}
elseif
($_POST['doelpuntenthuis'] < $_POST['doelpuntenuit']) {
$puntenthuisploeg="0";;
$puntenuitploeg="-3";
$winstthuis="0"; $verliesthuis="-1"; $gelijkthuis="0";
$winstuit="-1"; $verliesuit="0"; $gelijkuit="0";}
else {
$puntenthuisploeg="-1";
$puntenuitploeg="-1";
$winstthuis="0"; $verliesthuis="0"; $gelijkthuis="-1";
$winstuit="0"; $verliesuit="0"; $gelijkuit="-1";}

//corrigeren voor de thuisploeg

$gegevensbestand=file("database/resultaten.txt");
foreach ($gegevensbestand as $regelnummer => $line) {
list($punten,$nogtespelen,$saldo,$voor,$tegen,$club,$winst,$gelijk,$verlies,$gespeeld,$inmindering)=explode('||',$line);

if($club==$_POST['thuisploeg']) {

$tpuntennieuw=$punten+$puntenthuisploeg;
$tnugespeeld=$gespeeld-1;
$tnieuwvoor=$voor-$_POST['doelpuntenthuis'];
$tnieuwtegen=$tegen-$_POST['doelpuntenuit'];
$tsaldonieuw=$tnieuwvoor-$tnieuwtegen;

//om later met sorteren geen negatief saldo
//te krijgen wordt er 1000 bij opgeteld.
//Later in bekijk.php word er weer 1000
//afgetrokken.
$tsaldonieuw=$tsaldonieuw+1000;

$tnieuwwinst=$winst+$winstthuis;
$tnieuwgelijk=$gelijk+$gelijkthuis;
$tnieuwverlies=$verlies+$verliesthuis;
$tnunogtespelen=$maxaantalwedstrijden-$tnugespeeld;

unset($gegevensbestand[$regelnummer]);
$gegevensbestand = implode('',$gegevensbestand); 
$fp = fopen("database/resultaten.txt",'w'); 
$fw = fwrite($fp,$gegevensbestand); 
fclose($fp);

//nieuwe gegevens wegschrijven 
$logfile = fopen("database/resultaten.txt","a"); 
fwrite($logfile, $tpuntennieuw."||".$tnunogtespelen."||".$tsaldonieuw."||".$tnieuwvoor."||".$tnieuwtegen."||".$club."||".$tnieuwwinst."||".$tnieuwgelijk."||".$tnieuwverlies."||".$tnugespeeld."||".$inmindering."||\n"); 
fclose($logfile);}}


//corrigeren punten uitploeg

$gegevensbestand=file("database/resultaten.txt");
foreach ($gegevensbestand as $regelnummer => $line) {
list($punten,$nogtespelen,$saldo,$voor,$tegen,$club,$winst,$gelijk,$verlies,$gespeeld,$inmindering)=explode('||',$line);

if($club==$_POST['uitploeg']) {

$upuntennieuw=$punten+$puntenuitploeg;
$unugespeeld=$gespeeld-1;
$unieuwvoor=$voor-$_POST['doelpuntenuit'];
$unieuwtegen=$tegen-$_POST['doelpuntenthuis'];
$usaldonieuw=$unieuwvoor-$unieuwtegen;
$usaldonieuw=$usaldonieuw+1000;
$unieuwwinst=$winst+$winstuit;
$unieuwgelijk=$gelijk+$gelijkuit;
$unieuwverlies=$verlies+$verliesuit;
$ununogtespelen=$maxaantalwedstrijden-$unugespeeld;

unset($gegevensbestand[$regelnummer]);
$gegevensbestand = implode('',$gegevensbestand); 
$fp = fopen("database/resultaten.txt",'w'); 
$fw = fwrite($fp,$gegevensbestand); 
fclose($fp);

//nieuwe gegevens wegschrijven 
$logfile = fopen("database/resultaten.txt","a"); 
fwrite($logfile, $upuntennieuw."||".$ununogtespelen."||".$usaldonieuw."||".$unieuwvoor."||".$unieuwtegen."||".$club."||".$unieuwwinst."||".$unieuwgelijk."||".$unieuwverlies."||".$unugespeeld."||".$inmindering."||\n"); 
fclose($logfile);}}


}
?>
<hr>
<br/><br/>
Kies de club waarvan je een uitslag wilt verwijderen !!!<br/>
Een onjuist uitslag dient eerst verwijderd te worden, om vervolgens <a href="verwerkresultaten.php">de juiste uitslag in te voeren !!!</a>

<br/><br/><br/>

<form method="POST" name="corrigeren" action="verwijderen.php">
<select name="club" size ="1">
<?php

$clubs=file("database/clubs.txt");
$aantalclubs=count($clubs);

sort($clubs);

foreach ($clubs as $regel) {
list($club, $logo)=explode('||',$regel);
echo"
<option value=\"".$club."\">".$club."</option>";
}
?>
</select>
<input type="submit" value="Kies een club !!!" name="B2">
</form>
</body></html>

___________________________________________
puntentellingbijwerken.php
___________________________________________
<?php
//hier kunnen punten in mindering worden gebracht !!!

if(file_exists("menu.php")) {
include("menu.php");}

function punten() {
      for($x=1;$x<4;$x++)
echo "<option value=\"".$x."\">".$x."</option>";}
?>

<h3>Puntentelling bijwerken</h3>
Het bijwerken van de puntentelling kan nodig zijn als een club punten in mindering heeft gekregen !!<br/><br/>

<?php

if(isset($_POST['club'])) {

$gegevensbestand=file("database/resultaten.txt");
foreach ($gegevensbestand as $regelnummer => $line) {
list($punten,$nogtespelen,$saldo,$voor,$tegen,$club,$winst,$gelijk,$verlies,$gespeeld)=explode('||',$line);

if($club==$_POST['club']) {
echo"
<form method=\"POST\" name=\"tellingbewerken\" action=\"puntenveranderen.php\">

<input type=\"hidden\" name=\"club\"  value=\"".$club."\">
<input type=\"hidden\" name=\"regelnummer\"  value=\"".$regelnummer."\">

<table border=\"1\" cellpadding=\"3\" cellspacing=\"0\" width=\"75%\">
<tr><td align=\"center\">&nbsp;</td>
      <td><strong>Club</strong></td>
      <td align=\"center\">Gespeeld</td>
      <td align=\"center\">Huidige aantal punten</td>
<td align=\"center\">In mindering</td>
<td align=\"center\">W</td>
      <td align=\"center\">G</td>
      <td align=\"center\">V</td>
    <td align=\"center\">dpv</td>
    <td align=\"center\">dpt</td>
   <td align=\"center\">Saldo</td>
  </tr>
 <tr>
<td align=\"center\">".$regelnummer.")</td>
      <td><strong>".$club."</strong></td>
      <td align=\"center\"><strong>".$gespeeld."</strong></td>
      <td align=\"center\"><strong>".$punten."</strong></td>
 <td align=\"center\"><select size=\"1\" name=\"punteninmindering\">"; punten() ; echo"</td>
 <td align=\"center\">".$winst."</td>
      <td align=\"center\">".$gelijk."</td>
 <td align=\"center\">".$verlies."</td>
       <td align=\"center\">".$voor."</td>
    <td align=\"center\">".$tegen."</td>
   <td align=\"center\">".($saldo-1000)."</td>
  </tr></table>
<br/><br/><input type=\"submit\" value=\"Wijzig puntenaantal van ".$club."\" name=\"puntenveranderen\"> 
</form>";}
}
} else {
?>

<br/><br/>
Kies de ploeg:

<br/><br/><br/>

<form method="POST" name="puntentelling" action="puntentellingbijwerken.php">
<select name="club" size ="1">
<?php

//Tijdstip laatste wijziging
$laatstewijziging=date ("d-m-Y @ H:i:s", filectime("database/resultaten.txt"));
echo" De stand is het laatst bijgewerkt op: <strong>".$laatstewijziging."</strong>";

$clubs=file("database/clubs.txt");
$aantalclubs=count($clubs);

sort($clubs);

foreach ($clubs as $regel) {
list($club, $logo)=explode('||',$regel);
echo"
<option value=\"".$club."\">".$club."</option>";
}
?>
</select>
<input type="submit" value="Kies een club !!!" name="B2">
</form>
<?php
}
?>
_________________________________________
puntenveranderen.php
_________________________________________
<?php
//het verwerken van de punten in mindering

$punteninminderinggebracht=$_POST['punteninmindering'];

$gegevensbestand=file("database/resultaten.txt");
foreach ($gegevensbestand as $regel => $line) {
list($punten,$nogtespelen,$saldo,$voor,$tegen,$club,$winst,$gelijk,$verlies,$gespeeld,$punteninmindering)=explode('||',$line);

if($club==$_POST['club']) {

$puntennieuw=$punten-$punteninminderinggebracht;
$minder=$punteninmindering+$punteninminderinggebracht;
$regelnummer=$_POST['regelnummer'];

unset($gegevensbestand[$regelnummer]);
$gegevensbestand = implode('',$gegevensbestand); 
$fp = fopen("database/resultaten.txt",'w'); 
$fw = fwrite($fp,$gegevensbestand); 
fclose($fp);

//nieuwe gegevens wegschrijven 
$logfile = fopen("database/resultaten.txt","a"); 
fwrite($logfile, $puntennieuw."||".$nogtespelen."||".$saldo."||".$voor."||".$tegen."||".$club."||".$winst."||".$gelijk."||".$verlies."||".$gespeeld."||".$minder."||\n"); 
fclose($logfile);
}}
?>

<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<meta http-equiv="refresh" content="0;URL=bekijk.php">

<title>::: Competite :::</title>
</head>
<body>
</body></html>
