[b]MySQL database[/b]
[code]
-- tbl_landen --

CREATE TABLE `tbl_landen` (
  `land_id` int(8) NOT NULL auto_increment,
  `landnaam` varchar(40) NOT NULL default '',
  `Vlag` varchar(100) NOT NULL default '',
  `poule` varchar(10) default NULL,
  `gespeeld` int(4) default '0',
  `winst` int(4) default '0',
  `gelijk` int(4) default '0',
  `verlies` int(4) default '0',
  `punten` int(4) default '0',
  `voor` int(4) default '0',
  `tegen` int(4) default '0',
  PRIMARY KEY  (`land_id`)
) ENGINE=MyISAM DEFAULT AUTO_INCREMENT=0 ;


-- tbl_stadion --

CREATE TABLE `tbl_stadion` (
  `stadion_id` int(8) NOT NULL auto_increment,
  `stadionnaam` varchar(40) NOT NULL default '',
  PRIMARY KEY  (`stadion_id`)
) ENGINE=MyISAM DEFAULT AUTO_INCREMENT=0 ;


-- tbl_typewedstrijd --

CREATE TABLE `tbl_typewedstrijd` (
  `type_id` int(8) NOT NULL auto_increment,
  `type` varchar(40) NOT NULL default '',
  PRIMARY KEY  (`type_id`)
) ENGINE=MyISAM DEFAULT AUTO_INCREMENT=0 ;

-- 
-- Dumping data for table `tbl_typewedstrijd`
-- 

INSERT INTO `tbl_typewedstrijd` VALUES (6, 'Voorronden');
INSERT INTO `tbl_typewedstrijd` VALUES (5, '8e Finale');
INSERT INTO `tbl_typewedstrijd` VALUES (4, 'Kwart Finale');
INSERT INTO `tbl_typewedstrijd` VALUES (3, 'Halve Finale');
INSERT INTO `tbl_typewedstrijd` VALUES (2, 'Troost Finale');
INSERT INTO `tbl_typewedstrijd` VALUES (1, 'Finale');


-- tbl_user --

DROP TABLE IF EXISTS `tbl_user`;
CREATE TABLE `tbl_user` (
  `user_id` int(8) NOT NULL auto_increment,
  `username` varchar(40) NOT NULL default '',
  `password` varchar(40) NOT NULL default '',
  `email` varchar(150) NOT NULL default '',
  `admin` int(1) default NULL,
  `punten` int(4) default '0',
  PRIMARY KEY  (`user_id`)
) ENGINE=MyISAM DEFAULT AUTO_INCREMENT=0 ;


-- tbl_voorspelling --

CREATE TABLE `tbl_voorspelling` (
  `voorspelling_id` int(8) NOT NULL auto_increment,
  `user_id` int(8) NOT NULL default '0',
  `wedstrijd_id` int(8) NOT NULL default '0',
  `punten_thuis` int(2) NOT NULL default '0',
  `punten_uit` int(2) NOT NULL default '0',
  `rodekaarten` int(2) default NULL,
  `gelekaarten` int(2) default NULL,
  PRIMARY KEY  (`voorspelling_id`)
) ENGINE=MyISAM DEFAULT AUTO_INCREMENT=0 ;


--  tbl_wedstrijd --

CREATE TABLE `tbl_wedstrijd` (
  `wedstrijd_id` int(8) NOT NULL auto_increment,
  `thuisploeg_id` int(8) NOT NULL default '0',
  `uitploeg_id` int(8) NOT NULL default '0',
  `stadion_id` int(8) NOT NULL default '0',
  `dag` date NOT NULL default '0000-00-00',
  `tijd` time NOT NULL default '00:00:00',
  `type_id` int(1) NOT NULL default '0',
  `uitslag_thuis` int(2) default NULL,
  `uitslag_uit` int(2) default NULL,
  `rodekaarten` int(2) default NULL,
  `gelekaarten` int(2) default NULL,
  `poule` varchar(45) default NULL,
  PRIMARY KEY  (`wedstrijd_id`)
) ENGINE=MyISAM DEFAULT AUTO_INCREMENT=0 ;

[/code]
[code]INDEX.PHP;

[code]<?php

/* 
	WK POOL  --  A FREE SOCCER GAME MANAGER
	Author: Ed Kolman - ekolman@ekolman.nl
	

	Copyright (C) 2006 ekolman.nl

	This library is free software; you can redistribute it and/or
	modify it under the terms of the GNU Lesser General Public
	License as published by the Free Software Foundation; either
	version 2.1 of the License, or (at your option) any later version.

	This library is distributed in the hope that it will be useful,
	but WITHOUT ANY WARRANTY; without even the implied warranty of
	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
	Lesser General Public License for more details.

	You should have received a copy of the GNU Lesser General Public
	License along with this library; if not, write to the Free Software
	Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

	Ekolman.nl
	http://www.ekolman.nl
	Netherlands
	ekolman@ekolman.nl

*/
?>

<html>
    <head><title>Voetbalpool</title>
	<link rel="stylesheet" type="text/css" href="css/style.css"/>
    </head>    
    <body>
	
	<center><H1>Voetbalpool Login</H1>
	<br><br>
	Geef uw gebruikersnaam en wachtwoord in om in te loggen<br><br>
	Nog geen account? <a href=add_user.php>Klik hier om er een aan te maken!</a><br><br>

	<form action=main.php method=post>
	    <table>
		<tr>
		    <td>Gebruikersnaam:</td><td><input type=text name=gebruikersnaam></td>
		</tr>
		<tr>
		    <td>Wachtwoord:</td><td><input type=password name=wachtwoord></td>
		</tr>
		
		<td>Admin Demo:  Demo, Demo</td><td>
		
	    </table>
	    <input type=submit name=Login value=Login>
	</form>
	</center>
    </body>[/code]

ADD_USER.PHP;

[code]<?php
/* 
	WK POOL  --  A FREE SOCCER GAME MANAGER
	Author: Ed Kolman - ekolman@ekolman.nl
	

	Copyright (C) 2006 ekolman.nl

	This library is free software; you can redistribute it and/or
	modify it under the terms of the GNU Lesser General Public
	License as published by the Free Software Foundation; either
	version 2.1 of the License, or (at your option) any later version.

	This library is distributed in the hope that it will be useful,
	but WITHOUT ANY WARRANTY; without even the implied warranty of
	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
	Lesser General Public License for more details.

	You should have received a copy of the GNU Lesser General Public
	License along with this library; if not, write to the Free Software
	Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

	Ekolman.nl
	http://www.ekolman.nl
	Netherlands
	ekolman@ekolman.nl

*/
include ('db.php');

$gebruikersnaam = $_POST['gebruikersnaam'];
$wachtwoord1 = $_POST['wachtwoord1'];
$wachtwoord2 = $_POST['wachtwoord2'];
?>

<html>
    <head><title>Voetbalpoel</title>
	<link rel="stylesheet" type="text/css" href="css/style.css"/>
    </head>    
    <body>
	<center><H1>Gebruikers account aanmaken</H1>
	<br><br>

	<?php
	if (!$gebruikersnaam)
	{
	    ?>
	    <form method=post>
	        <table>
	  	    <tr>
		        <td>Gebruikersnaam:</td><td><input type=text name=gebruikersnaam></td>
		    </tr>
		    <tr>
		        <td>Wachtwoord:</td><td><input type=password name=wachtwoord1></td>
		    </tr>
		    <tr>
		        <td>Wachtwoord (herhaal):</td><td><input type=password name=wachtwoord2></td>
		    </tr>
		    <tr>
		        <td>E-mail:</td><td><input type=text name=email></td>
		    </tr>
	        </table>
	        <input type=submit name=Opslaan value=Opslaan>
	    </form>
	    </center>
	    <?php
	}
	else
	{
	    if ($wachtwoord1==$wachtwoord2)
	    {
		//wachtwoord controle goed!
		//Check in db voor gebruikersnaam
		
		$sql = mysql_query("SELECT * FROM tbl_user WHERE `username`='$gebruikersnaam'");
		$result = mysql_num_rows($sql);
		if ($result<1)
		{
		    if (!email)
		    {
			print "Error: Geen E-mail opgegeven!";
	   	    }
		    else
		    {
		        //komt niet voor! AANMAKEN
		        $sql = mysql_query("INSERT INTO `tbl_user` (`username`,`password`,`email`,`admin`) VALUES ('$gebruikersnaam','$wachtwoord1', '$email', '0')");
			print "Gebruiker '".$gebruikersnaam."' aangemaakt u kunt nu inloggen met uw gebruikersnaam!<br>";
		  	print "<a href=login.php>Terug naar inlog menu</a>";
		    }
		}
		else
		{
		    print "Error: Gebruikersnaam bestaat al!";
		}
 	    }
	    else
	    {
		print "Error: Wachtwoorden komen niet overeen!";
	    }
	}

	?>
	</center>
    </body>
</html>[/code]

LOGIN.PHP;

[code]<?php
/* 
	WK POOL  --  A FREE SOCCER GAME MANAGER
	Author: Ed Kolman - ekolman@ekolman.nl
	

	Copyright (C) 2006 ekolman.nl

	This library is free software; you can redistribute it and/or
	modify it under the terms of the GNU Lesser General Public
	License as published by the Free Software Foundation; either
	version 2.1 of the License, or (at your option) any later version.

	This library is distributed in the hope that it will be useful,
	but WITHOUT ANY WARRANTY; without even the implied warranty of
	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
	Lesser General Public License for more details.

	You should have received a copy of the GNU Lesser General Public
	License along with this library; if not, write to the Free Software
	Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

	Ekolman.nl
	http://www.ekolman.nl
	Netherlands
	ekolman@ekolman.nl

*/

?>
<html>
    <head><title>Voetbalpool</title>
	<link rel="stylesheet" type="text/css" href="css/style.css"/>
    </head>    
    <body>
	
	<center><H1>Voetbalpool Login</H1>
	<br><br>
	Geef uw gebruikersnaam en wachtwoord in om in te loggen<br><br>
	Nog geen account? <a href=add_user.php>Klik hier om er een aan te maken!</a><br><br>

	<form action=main.php method=post>
	    <table>
		<tr>
		    <td>Gebruikersnaam:</td><td><input type=text name=gebruikersnaam></td>
		</tr>
		<tr>
		    <td>Wachtwoord:</td><td><input type=password name=wachtwoord></td>
		</tr>
	    </table>
	    <input type=submit name=Login value=Login>
	</form>
	</center>
    </body>
</html>[/code]

MAIN.PHP;

[code]<?php

/* 
	WK POOL  --  A FREE SOCCER GAME MANAGER
	Author: Ed Kolman - ekolman@ekolman.nl
	

	Copyright (C) 2006 ekolman.nl

	This library is free software; you can redistribute it and/or
	modify it under the terms of the GNU Lesser General Public
	License as published by the Free Software Foundation; either
	version 2.1 of the License, or (at your option) any later version.

	This library is distributed in the hope that it will be useful,
	but WITHOUT ANY WARRANTY; without even the implied warranty of
	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
	Lesser General Public License for more details.

	You should have received a copy of the GNU Lesser General Public
	License along with this library; if not, write to the Free Software
	Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

	Ekolman.nl
	http://www.ekolman.nl
	Netherlands
	ekolman@ekolman.nl

*/

include ('db.php');
session_start();

$gebruikersnaam = $_POST['gebruikersnaam'];
$wachtwoord = $_POST['wachtwoord'];

if (!$gebruikersnaam or !$wachtwoord)
{
    print "Error!!!";
}
else
{
    $sql = mysql_query("SELECT * FROM tbl_user WHERE username='$gebruikersnaam'");
    $result = mysql_num_rows($sql);
    if ($result<1)
    {
	print "Error: Gebruiker niet gevonden!";	
    }
    else
    {
 	while ($row = mysql_fetch_array($sql))
	{
	    $wachtwoord_db = $row['password'];
	    $user_id = $row['user_id'];
	    if ($wachtwoord==$wachtwoord_db)
	    {
		$_SESSION['toegang'] = true;
		$_SESSION['loguser_id'] = $user_id;
		$_SESSION['gebruiker'] = $gebruikersnaam;
		$_SESSION['admin'] = $row['admin'];
	        echo ("
		     <frameset cols=180,*>
  		        <frame src=menu.php name=menu>
  		        <frame src=welkom.php name=main>
		     </frameset>
		     ");
	    }
	    else
	    {
		print "Error: Wachtwoord verkeerd!";
	    }
	}
    }
}?>[/code]

MENU.PHP;

[code]<?php
/* 
	WK POOL  --  A FREE SOCCER GAME MANAGER
	Author: Ed Kolman - ekolman@ekolman.nl
	

	Copyright (C) 2006 ekolman.nl

	This library is free software; you can redistribute it and/or
	modify it under the terms of the GNU Lesser General Public
	License as published by the Free Software Foundation; either
	version 2.1 of the License, or (at your option) any later version.

	This library is distributed in the hope that it will be useful,
	but WITHOUT ANY WARRANTY; without even the implied warranty of
	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
	Lesser General Public License for more details.

	You should have received a copy of the GNU Lesser General Public
	License along with this library; if not, write to the Free Software
	Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

	Ekolman.nl
	http://www.ekolman.nl
	Netherlands
	ekolman@ekolman.nl

*/

include ("db.php");
include ("authorized.php");
include("function.php");

?>
<html>
<head><title>Voetbalpool</title>
<link rel="stylesheet" type="text/css" href="css/style.css"/>
</head>    
<body>
<?php

//gebruikersmenu!
print "<center>";
print "<img src=img/logo.gif>";
print "<br>";
print "$datum";
//print "<br>";
//print "$currentTime";

print "<br><br><br>";
print "<br>";
print "<H3>Menu</H3>";
print "<a href=voorspellen.php target=main>Voorspellen</a><br><br>";
print "<a href=wedstrijden.php target=main>Bekijk wedstrijd overzicht</a><br>";
print "<a href=pers_score.php target=main>Bekijk persoonlijke score</a><br>";
print "<a href=score.php target=main>Bekijk Top10</a><br><br>";
print "<a href=stadia.php target=main>Bekijk alle stadions</a><br><br>";
print "<a href=profiel.php target=main>Profiel bewerken</a><br>";

//einde gebruikersmenu!

if ($_SESSION['admin'])
{
    //extra admintoei
    print "<br><br><hr><br><H3>Administrator</H3>";
    print "<b>Management</b><br><br>";
    print "<a href=admin/admin_clubs.php target=main>Club Management</a><br>";
    print "<a href=admin/admin_stadia.php target=main>Stadia Management</a><br>";
    print "<a href=admin/admin_wedstrijd.php target=main>Wedstrijd Management</a><br>";
    print "<a href=admin/admin_uitslag.php target=main>Uitslag Management</a><br><br>";
    print "<b>Gebruikers</b><br><br>";
    print "Gebruikers Management</a>";
}
print "<br><br><hr><br>";
print "<br><br><br><b><i>Ingelogd: ".$_SESSION['gebruiker']."</i></b>";
?>
 <meta http-equiv="refresh" content="120;URL=menu.php" />[/code]

PERS_SCORE.PHP;

[code]<?php
/* 
	WK POOL  --  A FREE SOCCER GAME MANAGER
	Author: Ed Kolman - ekolman@ekolman.nl
	

	Copyright (C) 2006 ekolman.nl

	This library is free software; you can redistribute it and/or
	modify it under the terms of the GNU Lesser General Public
	License as published by the Free Software Foundation; either
	version 2.1 of the License, or (at your option) any later version.

	This library is distributed in the hope that it will be useful,
	but WITHOUT ANY WARRANTY; without even the implied warranty of
	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
	Lesser General Public License for more details.

	You should have received a copy of the GNU Lesser General Public
	License along with this library; if not, write to the Free Software
	Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

	Ekolman.nl
	http://www.ekolman.nl
	Netherlands
	ekolman@ekolman.nl

*/
include ("db.php");
include ("authorized.php");


?>
<html>
<head><title>Voetbalpool</title>
<link rel="stylesheet" type="text/css" href="css/style.css"/>
</head>    
<body>
<?php

print "<center>";
print "<h1>Persoonlijke score</h1>";
print "<br><br>";
print "<br><br>";


    $sql = mysql_query("SELECT * FROM tbl_typewedstrijd ORDER BY type_id DESC");
    while ($row = mysql_fetch_array($sql))
    {

	print "<H2>".$row[1]."</H2><br>";
	print "<table><tr><th>Thuisploeg</th><th>Uitploeg</th><th>Uitslag</th><th><img src=img/geel.jpg></th><th><img src=img/rood.jpg></th><th>Voorspelde Uitslag</th><th><img src=img/geel.jpg></th><th><img src=img/rood.jpg></th><th>Score</th></tr>";
	$sql_details = mysql_query("SELECT * FROM tbl_wedstrijd WHERE `type_id`='$row[0]' ORDER BY 'dag'");
	while ($row_detail = mysql_fetch_array($sql_details))
	{
	    $id = $row_detail[0];
	    $thuisploeg = $row_detail[1];
	    $uitploeg = $row_detail[2];
	    $datum = $row_detail['dag'];
	    $tijd = $row_detail['tijd'];
	    $geel = $row_detail['gelekaarten'];
	    $rood = $row_detail['rodekaarten'];
	    $uitslag = $row_detail[7]." - ".$row_detail[8];
	    $stadion_id = $row_detail['stadion_id'];
	    if ($uitslag==" - ")
	    {
		$uitslag = "";
  	    }
	    $sql_land = mysql_query("SELECT * FROM tbl_landen WHERE `land_id`='$thuisploeg'");
	    while ($row_land = mysql_fetch_array($sql_land))
	    {
		$thuisploeg = $row_land[1];
		$thuisploegvlag = $row_land[2];
     	    }
	    $sql_land = mysql_query("SELECT * FROM tbl_landen WHERE `land_id`='$uitploeg'");
	    while ($row_land = mysql_fetch_array($sql_land))
	    {
		$uitploeg = $row_land[1];
		$uitploegvlag = $row_land[2];
     	    }
	    $sql_stadion = mysql_query("SELECT * FROM tbl_stadion WHERE `stadion_id`='$stadion_id'");
	    while ($row_stadion = mysql_fetch_array($sql_stadion))
	    {
		$stadion = $row_stadion[1];
     	    }
	    if ($uitslag!=="")
	    {
		$sql_voor = mysql_query("SELECT * FROM tbl_voorspelling WHERE `user_id`='$_SESSION[loguser_id]' AND `wedstrijd_id`='$id'");
	   	while ($row_voor = mysql_fetch_array($sql_voor))
	  	{
		    $voor_uitslag = $row_voor['punten_thuis']." - ".$row_voor['punten_uit'];
		    $voor_geel = $row_voor['gelekaarten'];
		    $voor_rood = $row_voor['rodekaarten'];

 		    $aantalpunten = 0;
		    if ($row_voor['punten_thuis']==$thuisploeg AND $row_voor['punten_uit']==$uitploeg)
		    {
			$aantalpunten = $aantalpunten + 3;
	 	    }
		    else
		    {
			if ($row_voor['punten_thuis']<$row_voor['punten_uit'] AND $thuisploeg<$uitploeg)
			{
			    $aantalpunten = $aantalpunten + 2;
			}
			elseif ($row_voor['punten_thuis']>$row_voor['punten_uit'] AND $thuisploeg>$uitploeg)
			{
			    $aantalpunten = $aantalpunten + 2;
			}
		    }

		    if ($voor_rood==$rood AND $voor_geel==$geel)
		    {
			$aantalpunten = $aantalpunten + 3;
	  	    }
		    elseif ($voor_rood==$rood)
		    {
			$aantalpunten = $aantalpunten + 1;
		    }
		    elseif ($voor_geel==$geel)
		    {
			$aantalpunten = $aantalpunten + 1;
		    }
		}
	        print "<tr><td><img src=img/vlaggen/".$thuisploegvlag.".gif height=15> ".$thuisploeg."</td>";
	        print "<td><img src=img/vlaggen/".$uitploegvlag.".gif height=15> ".$uitploeg."</td>";
	        print "<td>".$uitslag."</td>";
	        print "<td>".$geel."</td>";
	        print "<td>".$rood."</td>";
	        print "<td>".$voor_uitslag."</td>";
	        print "<td>".$voor_geel."</td>";
	        print "<td>".$voor_rood."</td>";
	        print "<td>".$aantalpunten."</td></tr>";
	    }
	}
	print "</table>";
    }

?>[/code]

PROFIEL.PHP;

[code]<?php
/* 
	WK POOL  --  A FREE SOCCER GAME MANAGER
	Author: Ed Kolman - ekolman@ekolman.nl
	

	Copyright (C) 2006 ekolman.nl

	This library is free software; you can redistribute it and/or
	modify it under the terms of the GNU Lesser General Public
	License as published by the Free Software Foundation; either
	version 2.1 of the License, or (at your option) any later version.

	This library is distributed in the hope that it will be useful,
	but WITHOUT ANY WARRANTY; without even the implied warranty of
	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
	Lesser General Public License for more details.

	You should have received a copy of the GNU Lesser General Public
	License along with this library; if not, write to the Free Software
	Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

	Ekolman.nl
	http://www.ekolman.nl
	Netherlands
	ekolman@ekolman.nl

*/

include ("db.php");

?>
<html>
<head><title>Voetbalpool</title>
<link rel="stylesheet" type="text/css" href="css/style.css"/>
</head>    
<body>
<?php

print "<center>";
print "<h1>Profiel Management</h1>";
print "<a href=profiel.php?do=weergeven>Geef profiel weer</a> - <a href=profiel.php?do=edit>profiel aanpassen</a>";
print "<br><br>";
print "<br><br>";

if ($do=="" or $do=="weergeven")
{
print "<br><br><br><table><tr><th>id</th><th>Naam</th><th>password</th><th>mail-adres</th></tr>";
	    $sql = mysql_query("SELECT * FROM tbl_user WHERE user_id='$_SESSION[loguser_id]'");
    	    while ($row = mysql_fetch_array($sql))
    	    
    	    
	    {
		print "<tr><td>";
		print $row[0];
		print "</td><td>";
		print $row[1];
		print "</td><td>";
		print $row[2];
		print "</td><td>";
		print $row[3];
		print "</td><td>";
		
	    }
	    print "</table>";
	    print "</td></tr>";
	    

}
	   
elseif ($do=="edit")
{
	
		print "<b>Edit uw profiel</b><br><br>";
    print "<form action=profiel.php?do=edit method=post>";

	$sql = mysql_query("SELECT * FROM tbl_user WHERE user_id='$_SESSION[loguser_id]'");
    	while ($row = mysql_fetch_array($sql))
    	
{
	$user_id = $row ['user_id'];
	$username = $row['username'];
	$password = $row['password'];
	$email = $row['email'];
	$user_id_changed = $_POST['user_id_changed'];
	$username_changed = $_POST['username_changed'];
	$password_changed = $_POST['password_changed'];
	$email_changed = $_POST['email_changed'];
	
print "<br><br><br><table><tr><th>password</th><th>mail-adres</th></tr>";

if (!$user_id_changed)

	    {	      
		// geef form weer het profiel te wijzigen!
		?>
		<form method=post>

			    
		   	    </td><td><input type=text name=password_changed value="<?php print $password; ?>">
		   	    </td><td><input type=text name=email_changed value="<?php print $email; ?>">
		   	    

		   	    <input type=hidden name=user_id_changed value=<?php print $user_id; ?>>


			
		<td><br><input type=submit name=edit value=Opslaan>
		 </form>
		<?php

			    }
	    else
	    {
		// opslaan verandering

		
		$sql = "UPDATE tbl_user SET password='$password_changed', email='$email_changed' WHERE user_id=$user_id_changed";
	   	$result = mysql_query($sql) or die (mysql_error());
	   	
?>
 <meta http-equiv="refresh" content="0;URL=profiel.php" />

<?php
	   	
	   	
	    }


	}




}
?>[/code]

SCORE.PHP;

[code]<?php
/* 
	WK POOL  --  A FREE SOCCER GAME MANAGER
	Author: Ed Kolman - ekolman@ekolman.nl
	

	Copyright (C) 2006 ekolman.nl

	This library is free software; you can redistribute it and/or
	modify it under the terms of the GNU Lesser General Public
	License as published by the Free Software Foundation; either
	version 2.1 of the License, or (at your option) any later version.

	This library is distributed in the hope that it will be useful,
	but WITHOUT ANY WARRANTY; without even the implied warranty of
	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
	Lesser General Public License for more details.

	You should have received a copy of the GNU Lesser General Public
	License along with this library; if not, write to the Free Software
	Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

	Ekolman.nl
	http://www.ekolman.nl
	Netherlands
	ekolman@ekolman.nl

*/
include ("db.php");
include ("authorized.php");

?>
<html>
<head><title>Voetbalpool</title>
<link rel="stylesheet" type="text/css" href="css/style.css"/>
</head>    
<body>
<?php

print "<center>";
print "<h1>TOP10!</h1>";
print "<br><br>";
print "<i>Wil je hier ook in komen! Beter gokken dan!</i>";
print "<br><br>";
$i = 0;
print "<table><tr><th>Plaats</th><th>Naam</th><th>Punten</th></tr>";
$sql = mysql_query("SELECT * FROM tbl_user ORDER BY punten DESC LIMIT 10");
while ($row = mysql_fetch_array($sql))
{
    $i = $i + 1;
    print "<tr>";
    print "<td>".$i."</td>";
    print "<td>";
    if ($i==1) 
    {
	print "<b>";
    }
    print $row[1];
    if ($i==1) 
    {
	print "</b>";	
    }
    print "</td>";
    print "<td>".$row[5]."</td>";
    print "</tr>";
}

?>[/code]

STADIA.PHP;

<?php
/* 
	WK POOL  --  A FREE SOCCER GAME MANAGER
	Author: Ed Kolman - ekolman@ekolman.nl
	

	Copyright (C) 2006 ekolman.nl

	This library is free software; you can redistribute it and/or
	modify it under the terms of the GNU Lesser General Public
	License as published by the Free Software Foundation; either
	version 2.1 of the License, or (at your option) any later version.

	This library is distributed in the hope that it will be useful,
	but WITHOUT ANY WARRANTY; without even the implied warranty of
	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
	Lesser General Public License for more details.

	You should have received a copy of the GNU Lesser General Public
	License along with this library; if not, write to the Free Software
	Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

	Ekolman.nl
	http://www.ekolman.nl
	Netherlands
	ekolman@ekolman.nl

*/

?>
<html>
<head><title>Voetbalpool</title>
<link rel="stylesheet" type="text/css" href="css/style.css"/>
</head>

  
<?php
print "<img src=img/wk2006.jpg>";
print "<br><br><br>";
print "<br>";
print "<H3>Kies een stadion</H3>";
print "<a href=stadia/munchen.php target=main>Munchen</a><br>";
print "<a href=stadia/Gelsenkirchen.php target=main>Gelsenkirchen</a><br>";
print "<a href=stadia/nurnberg.php target=main>Nürnberg</a><br>";
print "<a href=stadia/Kaiserslautern.php target=main>Kaiserslautern</a><br>";
print "<a href=stadia/Stuttgart.php target=main>Stuttgart</a><br>";
print "<a href=stadia/Hamburg.php target=main>Hamburg</a><br>";
print "<a href=stadia/Koln.php target=main>Köln</a><br>";
print "<a href=stadia/Hannover.php target=main>Hannover</a><br>";
print "<a href=stadia/Berlijn.php target=main>Berlijn</a><br>";
print "<a href=stadia/Frankfurt.php target=main>Frankfurt</a><br>";
print "<a href=stadia/Dortmund.php target=main>Dortmund</a><br>";
print "<a href=stadia/Leipzig.php target=main>Leipzig</a><br>";

VOORSPELLEN.PHP;

<?php
/* 
	WK POOL  --  A FREE SOCCER GAME MANAGER
	Author: Ed Kolman - ekolman@ekolman.nl
	

	Copyright (C) 2006 ekolman.nl

	This library is free software; you can redistribute it and/or
	modify it under the terms of the GNU Lesser General Public
	License as published by the Free Software Foundation; either
	version 2.1 of the License, or (at your option) any later version.

	This library is distributed in the hope that it will be useful,
	but WITHOUT ANY WARRANTY; without even the implied warranty of
	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
	Lesser General Public License for more details.

	You should have received a copy of the GNU Lesser General Public
	License along with this library; if not, write to the Free Software
	Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

	Ekolman.nl
	http://www.ekolman.nl
	Netherlands
	ekolman@ekolman.nl

*/
session_start();
include("db.php");
include("authorized.php");
include("function.php");

?>
<html>
<head><title>Voetbalpool</title>
<link rel="stylesheet" type="text/css" href="css/style.css"/>
</head>
<body>
<?php

print "<center>";
print "<h1>Voorspellen!</h1>";
print "<br><br>";
print "<a href=voorspellen.php?do=weergeven>Geef voorspellingen weer</a> - <a href=voorspellen.php?do=toevoegen>Voorspelling maken</a> - <a href=voorspellen.php?do=edit>Edit Wedstrijden</a>";
print "<br><br>";

if ($do=="" or $do=="weergeven")
{

    print "<table><tr><th>Thuis ploeg</th><th>Uit ploeg</th><th>Wedstrijd Type</th><th>Voorspelling</th><th><img src=img/geel.jpg></th><th><img src=img/rood.jpg></th></tr>";

   // $datum = date("Y-m-d");
   // $tijd = date("G:i:s");
    $sql = mysql_query("SELECT * FROM tbl_voorspelling WHERE user_id='$_SESSION[loguser_id]'");
    while ($row = mysql_fetch_array($sql))
    {
 	$wedstrijd_id = $row['wedstrijd_id'];
	$thuis = $row['punten_thuis'];
	$uit = $row['punten_uit'];
	$rood = $row['rodekaarten'];
	$geel = $row['gelekaarten'];

	$sql_w = mysql_query("SELECT * FROM tbl_wedstrijd WHERE Wedstrijd_id = '$wedstrijd_id'");
	while ($row_w = mysql_fetch_array($sql_w))
	{
	    $type_id = $row_w['type_id'];
	    $sql_land = mysql_query("SELECT * FROM tbl_landen WHERE `land_id`='$row_w[1]'");
	    while ($row_land = mysql_fetch_array($sql_land))
	    {
	   	$thuisploeg = $row_land[1];
	    	$thuisploegvlag = $row_land[2];
	    }
	    $sql_land = mysql_query("SELECT * FROM tbl_landen WHERE `land_id`='$row_w[2]'");
	    while ($row_land = mysql_fetch_array($sql_land))
	    {
	    	$uitploeg = $row_land[1];
	    	$uitploegvlag = $row_land[2];
	    }
	    $sql_t = mysql_query("SELECT * FROM tbl_typewedstrijd WHERE Type_id = '$type_id'");
	    while ($row_t = mysql_fetch_array($sql_t))
	    {
		$type = $row_t[1];
 	    }

            print "<tr><td><img src=img/vlaggen/".$thuisploegvlag.".jpg height=15> ".$thuisploeg."</td><td><img src=img/vlaggen/".$uitploegvlag.".jpg height=15> ".$uitploeg."</td>";

            print "<td>".$type."</td>";
            print "<td>".$thuis." - ".$uit."</td>";
            print "<td>".$geel."</td>";
            print "<td>".$rood."</td></tr>";

print "</td></tr>";

	}

    }

    // print "</table>";


}


elseif ($do=="toevoegen")
{
    print "<b>Maak uw voorspelling</b><br><br>";
    print "<form action=voorspellen.php?do=add method=post>";
    print "<table><tr><th>Thuisploeg</th><th>Uitploeg</th><th>Type</th><th>Punten thuis</th><th>Punten uit</th><th>Gele kaarten</th><th>Rode kaarten</th></tr>";

     $sql = mysql_query("SELECT * FROM tbl_wedstrijd WHERE dag > '$datum'");
    while ($row = mysql_fetch_array($sql))
    {
	$wedstrijd_id = $row[0];
	$thuisploeg_id = $row[1];
	$uitploeg_id = $row[2];
	$type_id = $row[6];
	$tijd_db =  $row[5];

	$sql_land = mysql_query("SELECT * FROM tbl_landen WHERE `land_id`='$thuisploeg_id'");
	while ($row_land = mysql_fetch_array($sql_land))
	{
	    $thuisploeg = $row_land[1];
	    $thuisploegvlag = $row_land[2];
	}
	$sql_land = mysql_query("SELECT * FROM tbl_landen WHERE `land_id`='$uitploeg_id'");
	while ($row_land = mysql_fetch_array($sql_land))
	{
	    $uitploeg = $row_land[1];
	    $uitploegvlag = $row_land[2];
	}
	$sql_type = mysql_query("SELECT * FROM tbl_typewedstrijd WHERE `type_id`='$type_id'");
	while ($row_type = mysql_fetch_array($sql_type))
	{
	    $type = $row_type[1];
	}
	$sql_user = mysql_query("SELECT * FROM tbl_voorspelling WHERE user_id = '$_SESSION[loguser_id]' AND wedstrijd_id = '$wedstrijd_id'");
	if (mysql_num_rows($sql_user)<1)
	{
	    print "<tr><td><img src=img/vlaggen/".$thuisploegvlag.".jpg height=15> ".$thuisploeg."</td><td><img src=img/vlaggen/".$uitploegvlag.".jpg height=15> ".$uitploeg."</td>";
	    print "<td>".$type."</td>";
            print "<td><input type=input name=thuis".$wedstrijd_id."></td>";
	    print "<td><input type=input name=uit".$wedstrijd_id."></td>";
	    print "<td><input type=input name=geel".$wedstrijd_id."></td>";
	    print "<td><input type=input name=rood".$wedstrijd_id."></td>";
	    print "</tr>";
	}
    }
    print "</table>";
    print "<br><br>";
    print "<input type=submit name=Ok value=Ok>";
    print "</form>";
}
elseif ($do=="add")
{
    $i = 0;
    $sql = mysql_query("SELECT * FROM tbl_wedstrijd");
    while ($row = @mysql_fetch_array($sql))
    {
	$wedstrijd_id = $row[0];

	$thuispunten = $_POST['thuis'.$wedstrijd_id];
	$uitpunten = $_POST['uit'.$wedstrijd_id];
	$gelekaarten = $_POST['geel'.$wedstrijd_id];
	$rodekaarten = $_POST['rood'.$wedstrijd_id];

	if ($thuispunten!=="" and $uitpunten!=="")
	{
	    if (is_numeric($thuispunten) and is_numeric($uitpunten))
	    {
        	$query[$i] = "INSERT INTO tbl_voorspelling (`user_id`, `wedstrijd_id`, `punten_thuis`, `punten_uit`, `gelekaarten`, `rodekaarten`) VALUES ('$_SESSION[loguser_id]', '$wedstrijd_id', '$thuispunten' , '$uitpunten', '$gelekaarten', '$rodekaarten')";
		$i = $i + 1;
	    }
        }
    }
    $x = 0;
    While ($x <= $i)
    {
        $sql = mysql_query($query[$x]);
	$x = $x + 1;
    }
    print $i." voorspelling(en) toegevoegd!";

}
elseif ($do=="edit")
{
	print "<b>Edit uw wedstrijden</b><br><br>";
    print "<form action=voorspellen.php?do=edit method=post>";

    print "<table><tr><th>Thuis ploeg</th><th>Uit ploeg</th><th>Wedstrijd Type</th><th>thuisploeg</th><th>uitploeg</th><th><img src=img/geel.jpg></th><th><img src=img/rood.jpg></th></tr>";


     $sql = mysql_query("SELECT * FROM tbl_voorspelling WHERE user_id='$_SESSION[loguser_id]'");
    while ($row = @mysql_fetch_array($sql))
   

    
    {
	
	$voorspelling_id = $row ['voorspelling_id'];
	$user_id = $_GET ['user_id'];
 	$wedstrijd_id = $row['wedstrijd_id'];
	$thuis = $row['punten_thuis'];
	$uit = $row['punten_uit'];
	$rood = $row['rodekaarten'];
	$geel = $row['gelekaarten'];
	$voorspelling_id_changed = $_POST['voorspelling_id_changed'];
	$thuis_changed = $_POST['thuis_changed'];
	$uit_changed = $_POST['uit_changed'];
	$rood_changed = $_POST['rood_changed'];
	$geel_changed = $_POST['geel_changed'];

	$sql_w = mysql_query("SELECT * FROM tbl_wedstrijd WHERE Wedstrijd_id = '$wedstrijd_id' AND dag > '$datum'");
	while ($row_w = mysql_fetch_array($sql_w))
	{
	    $type_id = $row_w['type_id'];
	    $sql_land = mysql_query("SELECT * FROM tbl_landen WHERE `land_id`='$row_w[1]'");
	    while ($row_land = mysql_fetch_array($sql_land))
	    {
	   	$thuisploeg = $row_land[1];
	    	$thuisploegvlag = $row_land[2];
	    }
	    $sql_land = mysql_query("SELECT * FROM tbl_landen WHERE `land_id`='$row_w[2]'");
	    while ($row_land = mysql_fetch_array($sql_land))
	    {
	    	$uitploeg = $row_land[1];
	    	$uitploegvlag = $row_land[2];
	    }
	    $sql_t = mysql_query("SELECT * FROM tbl_typewedstrijd WHERE Type_id = '$type_id'");
	    while ($row_t = mysql_fetch_array($sql_t))
	    {
		$type = $row_t[1];
 	    }
            print "<tr><td><img src=img/vlaggen/".$thuisploegvlag.".jpg height=15> ".$thuisploeg."</td><td><img src=img/vlaggen/".$uitploegvlag.".jpg height=15> ".$uitploeg."</td>";
            print "<td>".$type."</td>";

       
            
            
            if (!$voorspelling_id_changed)

	    {	      
		// geef form weer om vraag te wijzigen!
		?>
		<form method=post>

			    
		   	    </td><td><input type=text name=thuis_changed value="<?php print $thuis; ?>">
		   	    </td><td><input type=text name=uit_changed value="<?php print $uit; ?>">
		   	    </td><td><input type=text name=geel_changed value="<?php print $geel; ?>">
		   	    </td><td><input type=text name=rood_changed value="<?php print $rood; ?>">

		   	    <input type=hidden name=voorspelling_id_changed value=<?php print $voorspelling_id; ?>>


			
		<td><br><input type=submit name=edit value=Opslaan>
		 </form>
		<?php
	    }
	    
	    else
	    {
	
		    
		IF (dag < '$datum') print "Je bent te laat met veanderen";
	    
	    else
	    {
		// opslaan verandering

		
		$sql = "UPDATE tbl_voorspelling SET punten_thuis='$thuis_changed', punten_uit='$uit_changed', rodekaarten='$rood_changed', gelekaarten='$geel_changed' WHERE voorspelling_id=$voorspelling_id_changed";
	   	$result = mysql_query($sql) or die (mysql_error());


	   	
	   	

            
?>
 <meta http-equiv="refresh" content="0;URL=voorspellen.php" />

<?php

	    }


	}



}
}

    }
    else
    {
	print "U Heeft geen toegang tot deze site!";
}
?>


WEDSTRIJDEN.PHP;

<?php
/* 
	WK POOL  --  A FREE SOCCER GAME MANAGER
	Author: Ed Kolman - ekolman@ekolman.nl
	

	Copyright (C) 2006 ekolman.nl

	This library is free software; you can redistribute it and/or
	modify it under the terms of the GNU Lesser General Public
	License as published by the Free Software Foundation; either
	version 2.1 of the License, or (at your option) any later version.

	This library is distributed in the hope that it will be useful,
	but WITHOUT ANY WARRANTY; without even the implied warranty of
	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
	Lesser General Public License for more details.

	You should have received a copy of the GNU Lesser General Public
	License along with this library; if not, write to the Free Software
	Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

	Ekolman.nl
	http://www.ekolman.nl
	Netherlands
	ekolman@ekolman.nl

*/
include ("db.php");
include ("authorized.php");


?>
<html>
<head><title>Voetbalpool</title>
<link rel="stylesheet" type="text/css" href="css/style.css"/>
</head>    
<body>
<?php

print "<center>";
print "<h1>Wedstrijd overzicht</h1>";
print "<br><br>";
print "<br><br>";


    $sql = mysql_query("SELECT * FROM tbl_typewedstrijd ORDER BY type_id DESC");
    while ($row = mysql_fetch_array($sql))
    {

	print "<H2>".$row[1]."</H2><br>";
	print "<table><tr><th>Thuisploeg</th><th>Uitploeg</th><th>Stadion</th><th>Datum</th><th>Tijd</th><th>Uitslag</th><th><img src=img/geel.jpg></th><th><img src=img/rood.jpg></th></tr>";
	$sql_details = mysql_query("SELECT * FROM tbl_wedstrijd WHERE `type_id`='$row[0]' ORDER BY 'dag'");
	while ($row_detail = mysql_fetch_array($sql_details))
	{
	    $id = $row_detail[0];
	    $thuisploeg = $row_detail[1];
	    $uitploeg = $row_detail[2];
	    $datum = $row_detail['dag'];
	    $tijd = $row_detail['tijd'];
	    $geel = $row_detail['gelekaarten'];
	    $rood = $row_detail['rodekaarten'];
	    $uitslag = $row_detail[7]." - ".$row_detail[8];
	    $stadion_id = $row_detail['stadion_id'];
	    if ($uitslag==" - ")
	    {
		$uitslag = "";
  	    }
	    $sql_land = mysql_query("SELECT * FROM tbl_landen WHERE `land_id`='$thuisploeg'");
	    while ($row_land = mysql_fetch_array($sql_land))
	    {
		$thuisploeg = $row_land[1];
		$thuisploegvlag = $row_land[2];
     	    }
	    $sql_land = mysql_query("SELECT * FROM tbl_landen WHERE `land_id`='$uitploeg'");
	    while ($row_land = mysql_fetch_array($sql_land))
	    {
		$uitploeg = $row_land[1];
		$uitploegvlag = $row_land[2];
     	    }
	    $sql_stadion = mysql_query("SELECT * FROM tbl_stadion WHERE `stadion_id`='$stadion_id'");
	    while ($row_stadion = mysql_fetch_array($sql_stadion))
	    {
		$stadion = $row_stadion[1];
     	    }
	    print "<td><img src=img/vlaggen/".$thuisploegvlag.".jpg height=15> ".$thuisploeg."</td>";
	    print "<td><img src=img/vlaggen/".$uitploegvlag.".jpg height=15> ".$uitploeg."</td>";
	    
	    print "<td>".$stadion."</td>";
	    print "<td>".$datum."</td>";
	    print "<td>".$tijd."</td>";
	    print "<td>".$uitslag."</td>";
	    print "<td>".$geel."</td>";
	    print "<td>".$rood."</td></tr>";
	}
	print "</table>";
    }



?>

WELKOM.PHP;

<?php
/* 
	WK POOL  --  A FREE SOCCER GAME MANAGER
	Author: Ed Kolman - ekolman@ekolman.nl
	

	Copyright (C) 2006 ekolman.nl

	This library is free software; you can redistribute it and/or
	modify it under the terms of the GNU Lesser General Public
	License as published by the Free Software Foundation; either
	version 2.1 of the License, or (at your option) any later version.

	This library is distributed in the hope that it will be useful,
	but WITHOUT ANY WARRANTY; without even the implied warranty of
	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
	Lesser General Public License for more details.

	You should have received a copy of the GNU Lesser General Public
	License along with this library; if not, write to the Free Software
	Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

	Ekolman.nl
	http://www.ekolman.nl
	Netherlands
	ekolman@ekolman.nl

*/

?>

<html>
<head><title>Voetbalpool</title>
<link rel="stylesheet" type="text/css" href="css/style.css"/>
</head>    
<body>


<?php

//gebruikersmenu!
print "<center>";
print "<img src=img/wk2006.jpg>";
print "<br><br><br>";
print "<br>";
print "<br><br><hr><br><H3>Welkom bij de Voetbalpool</H3>";

print "<br><br><hr><br><H4>Uitleg</H4>";
print "<br><H5>Bij elke exacte goede score uitslag krijg je 3 punten (voorspelling 1-1 en uitslag 1-1)</H5>";
print "<H5>Bij elke goede score uitslag krijg je 2punten (voorspelling 2-2 en uitslag 1-1)</H5>";
print "<H5>Bij elke exacte goede aantal gele en rode kaarten krijg je 3 punten</H5>";
print "<H5>Bij elke exacte goede aantal gele kaarten krijg je 1 punt</H5>";
print "<H5>Bij elke exacte goede aantal rode kaarten krijg je 1 punt</H5>";


ADMIN_AUTHORIZED.PHP;

<?php
/* 
	WK POOL  --  A FREE SOCCER GAME MANAGER
	Author: Ed Kolman - ekolman@ekolman.nl
	

	Copyright (C) 2006 ekolman.nl

	This library is free software; you can redistribute it and/or
	modify it under the terms of the GNU Lesser General Public
	License as published by the Free Software Foundation; either
	version 2.1 of the License, or (at your option) any later version.

	This library is distributed in the hope that it will be useful,
	but WITHOUT ANY WARRANTY; without even the implied warranty of
	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
	Lesser General Public License for more details.

	You should have received a copy of the GNU Lesser General Public
	License along with this library; if not, write to the Free Software
	Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

	Ekolman.nl
	http://www.ekolman.nl
	Netherlands
	ekolman@ekolman.nl

*/
session_start();
if ($_SESSION['toegang']==true)
{
    if (!$_SESSION['admin'])
    {
 	print "U hebt geen toegang!";
   	exit;
    }
}
else
{
    print "U hebt geen toegang!";
    exit;
}
?>

ADMIN_CLUBS.PHP;

<?php
/* 
	WK POOL  --  A FREE SOCCER GAME MANAGER
	Author: Ed Kolman - ekolman@ekolman.nl
	

	Copyright (C) 2006 ekolman.nl

	This library is free software; you can redistribute it and/or
	modify it under the terms of the GNU Lesser General Public
	License as published by the Free Software Foundation; either
	version 2.1 of the License, or (at your option) any later version.

	This library is distributed in the hope that it will be useful,
	but WITHOUT ANY WARRANTY; without even the implied warranty of
	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
	Lesser General Public License for more details.

	You should have received a copy of the GNU Lesser General Public
	License along with this library; if not, write to the Free Software
	Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

	Ekolman.nl
	http://www.ekolman.nl
	Netherlands
	ekolman@ekolman.nl

*/

include ("admin_authorized.php");
include ("../db.php");

$do = $_GET['do'];

?>
<html>
<head><title>Voetbalpool</title>
<link rel="stylesheet" type="text/css" href="../css/style.css"/>
</head>    
<body>
<?php

print "<center>";
print "<h1>Club Management</h1>";
print "<br><br>";
print "<a href=admin_clubs.php?do=weergeven>Clubs Weergeven</a> - <a href=admin_clubs.php?do=toevoegen>Club Toevoegen</a>";
print "<br><br>";

if ($do=="weergeven" or $do=="")
{
    //geef alle clubs weer
    print "<table><tr>";
    print "<th>Id</th><th>Naam</th><th>Vlag</th><th>Verwijderen</th></tr>";
    
    $sql = mysql_query("SELECT * FROM tbl_landen");
    while ($row = mysql_fetch_array($sql))
    {
	$id = $row['land_id'];
	$naam = $row['Landnaam'];
	$vlag = $row['Vlag'];
	print "<tr><td>".$id."</td>";
	print "<td>".$naam."</td>";
	print "<td><img src=../img/vlaggen/".$vlag.".jpg></td>";
	print "<td><a href=admin_clubs.php?do=verwijder&id=".$id.">Verwijder</a></td>";
	print "</tr>";
    }
    print "</table>";

}
elseif ($do=="toevoegen")
{
    $clubnaam = $_POST['clubnaam'];
    $vlag = $_POST['vlag'];

    if (!$clubnaam)
    {
	//club toevoegen!
	echo "<form action=admin_clubs.php?do=toevoegen method=post><table>
	    <tr>
	        <td>Club naam</td><td><input type=text name=clubnaam></td>
	    </tr>
	    <tr>
	        <td>Vlag <i>*</i></td><td><input type=text name=vlag></td>
	    </tr>
	</table>
	<i>* Vlag alleen opgeven als deze afwijkt van de landnaam!</i>
	<br><br>
	<input type=submit name=Opslaan value=Opslaan>
	</form>";
    }
    else
    {
	//opslaan!
	if (!$vlag)
	{
	    $vlag = $clubnaam;
	}
	$sql = mysql_query("INSERT INTO `tbl_landen` (`Landnaam`,`Vlag`) VALUES ('$clubnaam','$vlag')");
	print "<b>Club toegevoegd!</b>";
    }
}
elseif ($do=="verwijder")
{
    //verwijderen
    $id = $_GET['id'];

    if ($antwoord == "")
    {
	print "<br><br><b>Weet u zeker dat u de Club wil verwijderen?<br></b><br><br><a href=admin_clubs.php?do=verwijder&id=$id&antwoord=yes>Ja</a> - <a href=admin_clubs.php?do=verwijder&del=$del&antwoord=no>Nee</a>";
    }
    else
    {
	if ($antwoord=="yes")
	{

	    $result = mysql_query("DELETE FROM tbl_landen WHERE land_id = $id");
	    print "<br><br><b>Club verwijderd!</b>";
	}
	else
	{
	    exit;
	}
    }
    
}

?>

ADMIN_STADIA.PHP;

<?php
/* 
	WK POOL  --  A FREE SOCCER GAME MANAGER
	Author: Ed Kolman - ekolman@ekolman.nl
	

	Copyright (C) 2006 ekolman.nl

	This library is free software; you can redistribute it and/or
	modify it under the terms of the GNU Lesser General Public
	License as published by the Free Software Foundation; either
	version 2.1 of the License, or (at your option) any later version.

	This library is distributed in the hope that it will be useful,
	but WITHOUT ANY WARRANTY; without even the implied warranty of
	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
	Lesser General Public License for more details.

	You should have received a copy of the GNU Lesser General Public
	License along with this library; if not, write to the Free Software
	Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

	Ekolman.nl
	http://www.ekolman.nl
	Netherlands
	ekolman@ekolman.nl

*/
include ("admin_authorized.php");
include ("../db.php");

$do = $_GET['do'];

?>
<html>
<head><title>Voetbalpool</title>
<link rel="stylesheet" type="text/css" href="../css/style.css"/>
</head>    
<body>
<?php

print "<center>";
print "<h1>Stadia Management</h1>";
print "<br><br>";
print "<a href=admin_stadia.php?do=weergeven>Stadia Weergeven</a> - <a href=admin_stadia.php?do=toevoegen>Stadion Toevoegen</a>";
print "<br><br>";

if ($do=="weergeven" or $do=="")
{
    //geef alle stadia weer
    print "<table><tr>";
    print "<th>Id</th><th>Naam</th><th>Verwijderen</th></tr>";
    
    $sql = mysql_query("SELECT * FROM tbl_stadion");
    while ($row = mysql_fetch_array($sql))
    {
	$id = $row['stadion_id'];
	$naam = $row['stadionnaam'];
	print "<tr><td>".$id."</td>";
	print "<td>".$naam."</td>";
	print "<td><a href=admin_stadia.php?do=verwijder&id=".$id.">Verwijder</a></td>";
	print "</tr>";
    }
    print "</table>";

}
elseif ($do=="toevoegen")
{
    $stadionnaam = $_POST['stadionnaam'];

    if (!$stadionnaam)
    {
	//stadia toevoegen!
	echo "<form action=admin_stadia.php?do=toevoegen method=post><table>
	    <tr>
	        <td>Stadion naam</td><td><input type=text name=stadionnaam></td>
	    </tr>
	</table>
	<br><br>
	<input type=submit name=Opslaan value=Opslaan>
	</form>";
    }
    else
    {
	//opslaan!
	$sql = mysql_query("INSERT INTO `tbl_stadion` (`Stadionnaam`) VALUES ('$stadionnaam')");
	print "<b>Stadion toegevoegd!</b>";
    }
}
elseif ($do=="verwijder")
{
    //verwijderen
    $id = $_GET['id'];

    if ($antwoord == "")
    {
	print "<br><br><b>Weet u zeker dat u het Stadium wil verwijderen?<br></b><br><br><a href=admin_stadia.php?do=verwijder&id=$id&antwoord=yes>Ja</a> - <a href=onderwerp_stadia.php?do=verwijder&del=$del&antwoord=no>Nee</a>";
    }
    else
    {
	if ($antwoord=="yes")
	{

	    $result = mysql_query("DELETE FROM tbl_stadion WHERE stadion_id = $id");
	    print "<br><br><b>Stadion verwijderd!</b>";
	}
	else
	{
	    exit;
	}
    }
    
}

?>

ADMIN_UITSLAG.PHP;

<?php
/* 
	WK POOL  --  A FREE SOCCER GAME MANAGER
	Author: Ed Kolman - ekolman@ekolman.nl
	

	Copyright (C) 2006 ekolman.nl

	This library is free software; you can redistribute it and/or
	modify it under the terms of the GNU Lesser General Public
	License as published by the Free Software Foundation; either
	version 2.1 of the License, or (at your option) any later version.

	This library is distributed in the hope that it will be useful,
	but WITHOUT ANY WARRANTY; without even the implied warranty of
	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
	Lesser General Public License for more details.

	You should have received a copy of the GNU Lesser General Public
	License along with this library; if not, write to the Free Software
	Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

	Ekolman.nl
	http://www.ekolman.nl
	Netherlands
	ekolman@ekolman.nl

*/

include ("admin_authorized.php");
include ("../db.php");

$type = $_POST['type'];
$wedstrijd = $_POST['wedstrijd'];
$Opslaan = $_POST['Opslaan'];

?>
<html>
<head><title>Voetbalpool</title>
<link rel="stylesheet" type="text/css" href="../css/style.css"/>
</head>    
<body>
<?php

print "<center>";
print "<h1>Uitslag Invoeren</h1>";
print "<br><br>";
print "<br><br>";

if (!$Opslaan)
{
	if (!$type)
	{
	    // kies het type wedstrijd
	    print "<form method=post>";
	    print "Kies het type wedstrijd:";
	    print "<select name=type class=Combobox>";
	    $datum = date("Y-d-m");
	    $sql = mysql_query("SELECT * FROM tbl_typewedstrijd ORDER BY type_id DESC");
	    while ($row = mysql_fetch_array($sql))
	    {	
		print "<option value=";
		print $row[0];
		print ">";
		print $row[1];
	    }
	    print "</select>";
	    print "<br><br>";
	    print "<input type=submit name=Ok value=Ok>";
	    print "</form>";
	}
	else
	{
	    print "<form method=post>";
	    print "Kies de wedstrijd:";
	    $datum = date("Y-m-d");
	    print "<select name=wedstrijd class=Combobox>";
	    $sql = mysql_query("SELECT * FROM tbl_wedstrijd WHERE dag < '$datum' AND type_id='$type'");
	    while ($row = mysql_fetch_array($sql))
	    {	
		print "<option value=";
		print $row[0];
		print ">";
	
		$sql_land = mysql_query("SELECT * FROM tbl_landen WHERE `land_id`='$row[1]'");
		while ($row_land = mysql_fetch_array($sql_land))
		{
		    $thuisploeg = $row_land[1];
	     	}
		$sql_land = mysql_query("SELECT * FROM tbl_landen WHERE `land_id`='$row[2]'");
		while ($row_land = mysql_fetch_array($sql_land))
		{
		    $uitploeg = $row_land[1];
	     	}
	
		print $thuisploeg." - ".$uitploeg;
	    }
	    print "</select>";
	    print "<br><br><table><tr><td>";
	    print "Punten thuisploeg:</td><td><input type=input name=puntenthuis></td></tr><tr><td>";
	    print "Punten uitploeg:</td><td><input type=input name=puntenuit></td></tr><tr><td>";
	    print "Gele kaarten:</td><td><input type=input name=geel></td></tr><tr><td>";
	    print "Rode kaarten:</td><td><input type=input name=rood></td></tr>";
	    print "</table><br><br>";
	    print "<input type=submit name=Opslaan value=Opslaan>";
	    print "</form>";
	}
}
else
{

    $wedstrijd = $_POST['wedstrijd'];
    $puntenthuis = $_POST['puntenthuis'];
    $puntenuit = $_POST['puntenuit'];
    $geel = $_POST['geel'];
    $rood = $_POST['rood'];



    if ($puntenuit or $puntenthuis or $wedstrijd)
    {
        $result = mysql_query("UPDATE tbl_wedstrijd SET uitslag_thuis = '$puntenthuis', uitslag_uit = '$puntenuit', gelekaarten = '$geel', rodekaarten = '$rood' WHERE wedstrijd_id = '$wedstrijd'");
	
	// bereken de puntjes voor elke gok :P
	$sql = mysql_query("SELECT * FROM tbl_voorspelling WHERE `wedstrijd_id` = '$wedstrijd'");
	while ($row_gok = mysql_fetch_array($sql))
	{
    	    $aantalpunten = 0;
	    $user_db = $row_gok['user_id'];
	    $thuis_db = $row_gok['punten_thuis'];
	    $uit_db = $row_gok['punten_uit'];
	    $rood_db = $row_gok['rodekaarten'];
	    $geel_db = $row_gok['gelekaarten'];

	    if ($thuis_db==$puntenthuis AND $uit_db==$puntenuit)
	    {
		$aantalpunten = $aantalpunten + 3;
 	    }
	    elseif ($thuis_db<$uit_db AND $puntenthuis<$puntenuit)
	    {
		$aantalpunten = $aantalpunten + 2;
	    }
	    elseif ($thuis_db>$uit_db AND $puntenthuis>$puntenuit)
	    {
		$aantalpunten = $aantalpunten + 2;
	    }

	    if ($rood_db==$rood AND $geel_db==$geel)
	    {
		$aantalpunten = $aantalpunten + 3;
  	    }
	    elseif ($rood_db==$rood)
	    {
		$aantalpunten = $aantalpunten + 1;
	    }
	    elseif ($geel_db==$geel)
	    {
		$aantalpunten = $aantalpunten + 1;
	    }
	    $sql_u = mysql_query("SELECT * FROM tbl_user WHERE user_id = '$user_db'");
	    while ($row_u = mysql_fetch_row($sql_u))
	    {
		$punten_db = $row_u[5];
	    }
	    $aantalpunten = $aantalpunten + $punten_db;

            $result = mysql_query("UPDATE tbl_user SET punten = '$aantalpunten' WHERE user_id = '$user_db'");	    
	}
        print "<br><br>Uitslag opgeslagen en Punten berekend!";
    }
    else
    {
  	print "<br><br>De gegevens zijn niet juist ingevoerd!";
    }
}

?>

ADMIN_USERMANAGEMENT.PHP;

<?php
/* 
	WK POOL  --  A FREE SOCCER GAME MANAGER
	Author: Ed Kolman - ekolman@ekolman.nl
	

	Copyright (C) 2006 ekolman.nl

	This library is free software; you can redistribute it and/or
	modify it under the terms of the GNU Lesser General Public
	License as published by the Free Software Foundation; either
	version 2.1 of the License, or (at your option) any later version.

	This library is distributed in the hope that it will be useful,
	but WITHOUT ANY WARRANTY; without even the implied warranty of
	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
	Lesser General Public License for more details.

	You should have received a copy of the GNU Lesser General Public
	License along with this library; if not, write to the Free Software
	Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

	Ekolman.nl
	http://www.ekolman.nl
	Netherlands
	ekolman@ekolman.nl

*/

include ("admin_authorized.php");
include ("../db.php");

$do = $_GET['do'];

?>
<html>
<head><title>Voetbalpool</title>
<link rel="stylesheet" type="text/css" href="../css/style.css"/>
</head>    
<body>
<?php

print "<center>";
print "<h1>User Management</h1>";
print "<br><br>";
print "<a href=admin_usermanagement.php?do=weergeven>Users Weergeven</a> - <a href=admin_usermanagement.php?do=toevoegen>admin Toevoegen</a>";
print "<br><br>";




	if ($do==weergeven or $do=="")
	{
	    // laad alle users in een tabel!
	    print "<br><br><br><table><tr><th>id</th><th>Naam</th><th>password</th><th>mail-adres</th><th>admin</th><th>Verwijder?</th></tr>";
	    $sql = mysql_query("SELECT * FROM tbl_user");
    	    while ($row = mysql_fetch_array($sql))
	    {
		print "<tr><td>";
		print $row[0];
		print "</td><td>";
		print $row[1];
		print "</td><td>";
		print $row[2];
		print "</td><td>";
		print $row[3];
		print "</td><td>";
		print $row[4];
		print "</td><td>";
		print "<a href=admin_usermanagement.php?do=verwijder&del=$row[0]>Verwijder</a>";
	    }
	    print "</table>";
	}
	
	elseif ($do==toevoegen)
	{
	    $naam = $_POST['naam'];
	    $pass1 = $_POST['pass1'];
	    $pass2 = $_POST['pass2'];

	    if (!$naam)
	    {
		// geef form weer om admin toe te voegen!
		?>
		<form method=post>
		    <table>
		        <tr>
		   	    <td>User:</td><td><input type=text name=naam>
			</tr>
			
		        <tr>
		   	    <td>email:</td><td><input type=text name=email>
			</tr>
			
		        <tr>
		   	    <td>Password:</td><td><input type=password name=pass2>
			</tr>
		        <tr>
		   	    <td>Password retype:</td><td><input type=password name=pass1>
			</tr>
			
		        <tr>
		   	
		   	
		   	    
			</tr>
		    </table>
		<br><input type=submit name=Opslaan value=opslaan>
		</form>
		<?php
	    }
	    else
	    {
		// opslaan in tabel admin in tabel!
		$sql = mysql_query("SELECT * FROM tbl_user WHERE username = '$naam'");
    		$row = mysql_fetch_array($sql);
    		$naam_db = $row['username'];
		if ($naam_db==$naam)
		{
		    print "<br><br><b>Admin komt reeds voor in database!</b>";
		}
		else
		{
		    if ($pass1==$pass2)
		    {
		        // voeg admin toe!
		        $result = mysql_query("INSERT INTO tbl_user (user_id, username, password, email, admin) VALUES ('', '$naam', '$pass1', '$email', '$admin')");
		        print "<br><br><b>Admin toegevoegd!</b>";
		    }
		    else
		    {
			print "<br><br><b>Wachtwoorden niet gelijk!!!</b>";
		    }
		}
	    }
	}
	elseif ($do==verwijder)
	{
	    $del = $_GET['del'];
	    $result = mysql_query("DELETE FROM tbl_user WHERE user_id = $del");
	    print "<br><br><b>Admin verwijderd!</b>";
	}
	
	?>
	</center>
	<?php


?>

ADMIN_WEDSTRIJD.PHP;

<?php
/* 
	WK POOL  --  A FREE SOCCER GAME MANAGER
	Author: Ed Kolman - ekolman@ekolman.nl
	

	Copyright (C) 2006 ekolman.nl

	This library is free software; you can redistribute it and/or
	modify it under the terms of the GNU Lesser General Public
	License as published by the Free Software Foundation; either
	version 2.1 of the License, or (at your option) any later version.

	This library is distributed in the hope that it will be useful,
	but WITHOUT ANY WARRANTY; without even the implied warranty of
	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
	Lesser General Public License for more details.

	You should have received a copy of the GNU Lesser General Public
	License along with this library; if not, write to the Free Software
	Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

	Ekolman.nl
	http://www.ekolman.nl
	Netherlands
	ekolman@ekolman.nl

*/

include ("admin_authorized.php");
include ("../db.php");

$do = $_GET['do'];

?>
<html>
<head><title>Voetbalpool</title>
<link rel="stylesheet" type="text/css" href="../css/style.css"/>
</head>    
<body>
<?php

print "<center>";
print "<h1>Wedstrijd Management</h1>";
print "<br><br>";
print "<a href=admin_wedstrijd.php?do=weergeven>Wedstrijden Weergeven</a> - <a href=admin_wedstrijd.php?do=toevoegen>Wedstrijd Toevoegen</a>";
print "<br><br>";


if ($do=="weergeven" or $do=="")
{
    $sql = mysql_query("SELECT * FROM tbl_typewedstrijd ORDER BY type_id DESC");
    while ($row = mysql_fetch_array($sql))
    {
	print "<H2>".$row[1]."</H2><br>";
	$sql_details = mysql_query("SELECT * FROM tbl_wedstrijd WHERE `type_id`='$row[0]'");
	while ($row_detail = mysql_fetch_array($sql_details))
	{
	    $id = $row_detail[0];
	    $thuisploeg = $row_detail[1];
	    $uitploeg = $row_detail[2];
	    $uitslag = $row_detail[7]." - ".$row_detail[8];
	    if ($uitslag==" - ")
	    {
		$uitslag = "";
  	    }
	    $sql_land = mysql_query("SELECT * FROM tbl_landen WHERE `land_id`='$thuisploeg'");
	    while ($row_land = mysql_fetch_array($sql_land))
	    {
		$thuisploeg = $row_land[1];
		$thuisploegvlag = $row_land[2];
     	    }
	    $sql_land = mysql_query("SELECT * FROM tbl_landen WHERE `land_id`='$uitploeg'");
	    while ($row_land = mysql_fetch_array($sql_land))
	    {
		$uitploeg = $row_land[1];
		$uitploegvlag = $row_land[2];
     	    }
	    print "<img src=../img/vlaggen/".$thuisploegvlag.".jpg height=20> ".$thuisploeg." - <img src=../img/vlaggen/".$uitploegvlag.".jpg height=20> ".$uitploeg." | ".$uitslag. " | ";
	    print "<a href=admin_wedstrijd.php?do=verwijder&id=".$id.">Verwijder</a><br><br>";
	}
	print "<br><br><br>";
    }

}
elseif ($do=="toevoegen")
{
    $Opslaan = $_POST['Opslaan'];
    $thuisploeg = $_POST['thuisploeg'];
    $uitploeg = $_POST['uitploeg'];
    $stadion = $_POST['stadion'];
    $datum = $_POST['datum'];
    $tijd = $_POST['tijd'];
    $type = $_POST['type'];

    if (!$Opslaan)
    {
	//stadia toevoegen!
	echo "<form action=admin_wedstrijd.php?do=toevoegen method=post><table>
	    <tr>
	        <td>Type webstrijd</td><td>";
		print "<select name=type class=Combobox>";
		$sql = mysql_query("SELECT * FROM tbl_typewedstrijd");
		while ($row = mysql_fetch_array($sql))
		{		
		    print "<option value=";
		    print $row[0];
		    print ">";
		    print $row[1];
		}
		print "</select>";
	    echo "</td></tr>
	    <tr>
	        <td>Thuis Speler</td><td>";
		print "<select name=thuisploeg class=Combobox>";
		$sql = mysql_query("SELECT * FROM tbl_landen");
		while ($row = mysql_fetch_array($sql))
		{		
		    print "<option value=";
		    print $row[0];
		    print ">";
		    print $row[1];
		}
		print "</select>";
	    echo "</td></tr>
	    <tr>
	        <td>Uit Speler</td><td>";
		print "<select name=uitploeg class=Combobox>";
		$sql = mysql_query("SELECT * FROM tbl_landen");
		while ($row = mysql_fetch_array($sql))
		{		
		    print "<option value=";
		    print $row[0];
		    print ">";
		    print $row[1];
		}
		print "</select>";
	    echo "</td></tr>
	    <tr>
	        <td>Stadion</td><td>";
		print "<select name=stadion class=Combobox>";
		$sql = mysql_query("SELECT * FROM tbl_stadion");
		while ($row = mysql_fetch_array($sql))
		{		
		    print "<option value=";
		    print $row[0];
		    print ">";
		    print $row[1];
		}
		print "</select>";
	    echo "</td></tr>
	    <tr>
	        <td>Datum <i>*</i></td><td><input type=text name=datum value=YYYY-MM-DD></td>
	    </tr>
	    <tr>
	        <td>Tijd <i>**</i></td><td><input type=text name=tijd value=00:00></td>
	    </tr>
	</table>
	<br><br>
	<i>* Datum in formaat YYYY-MM-DD</i><br>
	<i>** Tijd in formaat 24:00</i><br>
	<br>
	<input type=submit name=Opslaan value=Opslaan>
	</form>";
    }
    else
    {
	//opslaan!
	if ($type and $thuisploeg and $uitploeg and $stadion and $date!=="YYYY-MM-DD" and $time!=="00:00" and $thuisploeg!==$uitploeg)
	{
	    $sql = mysql_query("INSERT INTO `tbl_wedstrijd` (`thuisploeg_id`, `uitploeg_id`, `stadion_id`, `dag`, `tijd`, `type_id`) VALUES ('$thuisploeg', '$uitploeg', '$stadion', '$datum', '$tijd', '$type')");
	    print "<b>Wedstrijd toegevoegd!</b>";
	}
	else
	{
	    print "<b>Voer alle gegevens juist in aub!</b>";
	}
    }

}
elseif ($do=="verwijder")
{
    //verwijderen
    $antwoord = $_GET['antwoord'];
    $id = $_GET['id'];

    if ($antwoord == "")
    {
	print "<br><br><b>Weet u zeker dat u de wedstrijd wil verwijderen?<br></b><br><br><a href=admin_wedstrijd.php?do=verwijder&id=$id&antwoord=yes>Ja</a> - <a href=admin_wedstrijd.php?do=verwijder&del=$del&antwoord=no>Nee</a>";
    }
    else
    {
	if ($antwoord=="yes")
	{

	    $result = mysql_query("DELETE FROM tbl_wedstrijd WHERE wedstrijd_id = '$id'");
	    print "<br><br><b>Wedstrijd verwijderd!</b>";
	}
	else
	{
	    exit;
	}
    }
}
?>
AUTHIRIZED.PHP;

<?php

session_start();

if ($_SESSION['toegang']!==true)
{
    print "U heeft geen toegang tot deze site!";
    exit;
}

?>

FUNCTION.PHP;

<?php
$TimeDiff = -7+date('I'); 	//If there is a differance between the time off your provider server change the number in your right time zone
$TimeZoneEpoc = time() - ($TimeDiff*60*60);
$datum = date('Y-m-d G:i:s',$TimeZoneEpoc);
?>
[/code]