---MySQL---

CREATE TABLE `links` (
  `id` int(11) NOT NULL auto_increment,
  `naam` text NOT NULL,
  `website` text NOT NULL,
  `clicks` varchar(100) NOT NULL default '0',
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=13 ;


---config.php---
[code]
<?php    
// Script gemaakt door
// Edwin baednet@chello.nl
// Davey
//
// www.baed-net.eu
//
// Verander hieronder je eigen instellingen
$database ="tut"; // Zet hier je database naam neer  
$server ="localhost";   // Verander naar je database host
$user ="root";   // Database username
$wachtwoord ="";   // Wachtwoord
// Niks meer veranderen hieronder
mysql_connect("$server","$user", "$wachtwoord");    
mysql_select_db("$database");
?>
[/code]

---index.php---
[code]
<?php
include "config.php";
$query = "SELECT * FROM links ORDER BY clicks DESC";
$info =mysql_query($query) or die ("Error!");
print "<table>";
while ($link = mysql_fetch_array($info)) {
print "<tr><td>".$link['id']."</td><td>".$link['naam']."</td><td><a href='click.php?id=".$link['id']."'>Kliks: ".$link['clicks']."</a></tr>";
}
print "</table>";
print "<br>Copyright by <a href='http://baed-net.eu'>Baed Soft</a>";
?>
[/code]

---add.php---
[code]
<title>Links</title>
<?php
include "config.php";
if(isset($_GET['actie']) && ($_GET['actie'] == "post")) {

$naam = $_POST['naam'];
$url = $_POST['url'];

	if (empty($_POST['naam']) || empty($_POST['url'])) {

		print "Je hebt je naam en/of website vergeten in te vullen";

	}else{

		mysql_query("INSERT INTO links (naam, website) VALUES ('".$naam."', '".$url."')") or die(mysql_error());
		print "URL toegevoegt!";

	}

} else {
?>
<form method="post" action="?actie=post">
Naam website: <input type="text" name="naam"><br>
Website: <input type="text" name="url"><br>
<input type="submit" name="submit" value="Verzend!"> <input type="reset" value="Reset!">
</form>
<?php
}
?>
[/code]

---delete.php---
[code]
<title>Delete</title>
<?php
include "config.php";
if(isset($_GET['actie']) && ($_GET['actie'] == "post")) {

$id = $_POST['id'];

	if (empty($_POST['id'])) {

		print "Je hebt de id vergeten in te vullen";

	}else{

		mysql_query("DELETE FROM links WHERE id = ".$id."") or die(mysql_error());
		print "Je link is suc6 vol verwijdert!";

	}

} else {
?>
<form method="post" action="?actie=post">
ID: <input type="text" name="id"><br>
<input type="submit" name="submit" value="Verzend!"> <input type="reset" value="Reset!">
</form>
<?php
}
?>
[/code]

---click.php---
[code]
<?php
include "config.php";
if(isset($_GET['id']) && (is_numeric($_GET['id']))) {
mysql_query("UPDATE links SET clicks = clicks+1 WHERE id = '".$_GET['id']."'") or die(mysql_error());
$hamburger = mysql_query("SELECT * FROM links WHERE id = '".$_GET['id']."'") or die(mysql_error());
$sla = mysql_fetch_object($hamburger);
header("Location: http://".$sla->website);
exit("U wordt doorgestuurd");
}
?>
[/code]