linkssysteem-met-categorien-v21
Gesponsorde koppelingen
PHP script bestanden
MYSQL code:
Code (php)
1
2
3
4
5
6
7
8
9
2
3
4
5
6
7
8
9
CREATE TABLE IF NOT EXISTS `links` (
`id` int(11) NOT NULL auto_increment,
`url` varchar(90) NOT NULL default '',
`name` varchar(20) NOT NULL default '',
`lang` char(2) NOT NULL default '',
`geklikt` int(11) NOT NULL default '10',
`cat` int(11) NOT NULL default '0',
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
`id` int(11) NOT NULL auto_increment,
`url` varchar(90) NOT NULL default '',
`name` varchar(20) NOT NULL default '',
`lang` char(2) NOT NULL default '',
`geklikt` int(11) NOT NULL default '10',
`cat` int(11) NOT NULL default '0',
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
PHP code:
Code (php)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
<?php
error_reporting(E_ALL);
$hostname = "localhost";
$username = "";
$password = "";
$db = "";
$eigensite = "http://www.jousite.nl/";
$fout = "Er kan geen database connectie gemaakt worden..<br>Probeer het na enkele minuten opnieuw. Wil het dan nog niet, neem dan contact met de webmaster op.";
@mysql_connect($hostname,$username,$password);
@mysql_select_db($db) or die ($fout);
// Catagorieen, voeg $fullcat[nummer] = "Catagorienaam" toe voor een nieuwe catagorie.
$fullcat[1] = "Overig";
if ( isset($_GET['out']) )
{
$id = mysql_escape_string($_GET['out']);
$sql = "SELECT * FROM links WHERE id=1;";
$tmp = mysql_query($sql);
$uitvoer = mysql_fetch_array($tmp);
$url= $uitvoer['url'];
if ($id > 0)
{
if (isset($_COOKIE["out"]))
{
header("Location: $url");
}
else
{
$url= $uitvoer['url'];
$sql = "UPDATE links SET geklikt=geklikt-1 WHERE id = '" . $id . "'";
mysql_query($sql);
setcookie("out", "ja", time()+86400);
header("Location: $url");
}
}
header("Location: $eigensite");
}
if ( isset($_GET['in']) )
{
if (isset($_COOKIE["in"]))
{
header("Location: $eigensite");
}
else
{
$id = mysql_escape_string($_GET['in']);
$sql = "UPDATE links SET geklikt=geklikt-1 WHERE id = '" . $id . "'";
mysql_query($sql);
setcookie("in", "ja", time()+86400);
header("Location: $eigensite");
}
}
else
{
$sql = "SELECT * FROM links WHERE geklikt > 0 ORDER BY geklikt DESC;";
$tmp = mysql_query($sql);
foreach ( $fullcat AS $index => $value )
{
echo ':: <b><u>'.$value.'</u></b><br /><br />';
while ( $list = mysql_fetch_array($tmp) )
{
if ( $list['cat'] == $index )
{
echo ' :: <a href="links.php?out='.$list['id'].'" target="_blank">';
echo $list['name'].'</a> <span class="small">['.$list['lang'].']</span><br />'."\n";
}
}
}
}
?>
error_reporting(E_ALL);
$hostname = "localhost";
$username = "";
$password = "";
$db = "";
$eigensite = "http://www.jousite.nl/";
$fout = "Er kan geen database connectie gemaakt worden..<br>Probeer het na enkele minuten opnieuw. Wil het dan nog niet, neem dan contact met de webmaster op.";
@mysql_connect($hostname,$username,$password);
@mysql_select_db($db) or die ($fout);
// Catagorieen, voeg $fullcat[nummer] = "Catagorienaam" toe voor een nieuwe catagorie.
$fullcat[1] = "Overig";
if ( isset($_GET['out']) )
{
$id = mysql_escape_string($_GET['out']);
$sql = "SELECT * FROM links WHERE id=1;";
$tmp = mysql_query($sql);
$uitvoer = mysql_fetch_array($tmp);
$url= $uitvoer['url'];
if ($id > 0)
{
if (isset($_COOKIE["out"]))
{
header("Location: $url");
}
else
{
$url= $uitvoer['url'];
$sql = "UPDATE links SET geklikt=geklikt-1 WHERE id = '" . $id . "'";
mysql_query($sql);
setcookie("out", "ja", time()+86400);
header("Location: $url");
}
}
header("Location: $eigensite");
}
if ( isset($_GET['in']) )
{
if (isset($_COOKIE["in"]))
{
header("Location: $eigensite");
}
else
{
$id = mysql_escape_string($_GET['in']);
$sql = "UPDATE links SET geklikt=geklikt-1 WHERE id = '" . $id . "'";
mysql_query($sql);
setcookie("in", "ja", time()+86400);
header("Location: $eigensite");
}
}
else
{
$sql = "SELECT * FROM links WHERE geklikt > 0 ORDER BY geklikt DESC;";
$tmp = mysql_query($sql);
foreach ( $fullcat AS $index => $value )
{
echo ':: <b><u>'.$value.'</u></b><br /><br />';
while ( $list = mysql_fetch_array($tmp) )
{
if ( $list['cat'] == $index )
{
echo ' :: <a href="links.php?out='.$list['id'].'" target="_blank">';
echo $list['name'].'</a> <span class="small">['.$list['lang'].']</span><br />'."\n";
}
}
}
}
?>