linkssysteem-met-categorien-v2
Gesponsorde koppelingen
PHP script bestanden
## tabel ##
Code (php)
1
2
3
4
5
6
7
8
9
2
3
4
5
6
7
8
9
CREATE TABLE 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 '0',
cat int(11) NOT NULL default '0',
PRIMARY KEY (id)
) TYPE=MyISAM;
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 '0',
cat int(11) NOT NULL default '0',
PRIMARY KEY (id)
) TYPE=MyISAM;
## links.php ##
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
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
<?
error_reporting(E_ALL);
$hostname = "localhost";
$username = "username";
$password = "password";
$db = "database";
$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] = "KLJ Site's";
$fullcat[2] = "Andere";
$fullcat[3] = "Muziek";
//als er op de link geklikt is
if ( isset($_GET['url']) )
{
$url = mysql_escape_string($_GET['url'] );
$sql = "UPDATE links SET geklikt=geklikt+1 WHERE url = '{$url}'";
mysql_query($sql);
header("Location: $url");
}
//anders toon de links
else
{
$sql = "SELECT * FROM links ORDER BY name;";
$tmp = mysql_query($sql);
foreach ( $fullcat AS $index => $value )
{
echo '<br>:: <b><u>'.$value.'</u></b><br /><br />';
$tmp2 = $tmp;
while ( $list = mysql_fetch_array($tmp2) )
{
if ( $list['cat'] == $index )
{
echo ' :: <a href="home.php?menu=links&url='.$list['url'].'" target="_blank">';
echo $list['name'].'</a> <span class="small">['.$list['lang'].'] [out: '.$list['geklikt'].']</span><br />'."\n";
}
}
mysql_data_seek($tmp,0);
}
}
?>
error_reporting(E_ALL);
$hostname = "localhost";
$username = "username";
$password = "password";
$db = "database";
$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] = "KLJ Site's";
$fullcat[2] = "Andere";
$fullcat[3] = "Muziek";
//als er op de link geklikt is
if ( isset($_GET['url']) )
{
$url = mysql_escape_string($_GET['url'] );
$sql = "UPDATE links SET geklikt=geklikt+1 WHERE url = '{$url}'";
mysql_query($sql);
header("Location: $url");
}
//anders toon de links
else
{
$sql = "SELECT * FROM links ORDER BY name;";
$tmp = mysql_query($sql);
foreach ( $fullcat AS $index => $value )
{
echo '<br>:: <b><u>'.$value.'</u></b><br /><br />';
$tmp2 = $tmp;
while ( $list = mysql_fetch_array($tmp2) )
{
if ( $list['cat'] == $index )
{
echo ' :: <a href="home.php?menu=links&url='.$list['url'].'" target="_blank">';
echo $list['name'].'</a> <span class="small">['.$list['lang'].'] [out: '.$list['geklikt'].']</span><br />'."\n";
}
}
mysql_data_seek($tmp,0);
}
}
?>