links-cat-out-systeem
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
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
<?
// Configuratie voor catagorieen, voeg $catagorie[nummer] = "Catagorienaam" toe voor een nieuwe catagorie.
$fullcat[1] = "Catagorie 1";
$fullcat[2] = "Catagorie 2";
$dbhost = "localhost";
$dbuser = "username";
$dbpass = "password";
$dbdbdb = "databasename";
if (!@mysql_select_db($dbdbdb, @mysql_connect($dbhost, $dbuser, $dbpass)))
{
echo "<font face=\"Verdana, Arial, Helvetica\" size=\"2\">Sorry, er kon geen connectie worden gemaakt met de database.<p>";
echo "Probeer het a.u.b opnieuw. Blijft dit probleem zich voordoen, neemt u dan contact op met de webmaster.</font>";
exit();
}
$dbhost = "";
$dbuser = "";
$dbpass = "";
$dbdbdb = "";
//-- set dynamic vars
$tab_links = "links";
if ($_GET['url'])
{
$sql = "UPDATE links SET out=out+1 WHERE url = '" . $_GET['url'] . "'";
mysql_query($sql);
header("Location: " . $_GET['$url']);
}
else
{
function linkscat($cat)
{
return $fullcat[$cat];
}
$sql = "SELECT name,url,lang,cat,out FROM " . $tab_links . " ORDER BY cat,name";
$res = mysql_query($sql);
while ($row = mysql_fetch_array($res))
{
if ($curcat == "")
{
$thiscat = linkscat($row[cat]);
$curcat = $row['cat'];
echo "<b>" . $thiscat . "</b><p>";
echo "<a href=\"" . $_SERVER['PHP_SELF'] . "?url=" . $row['url'] . "\" title=\"" . $row['name'] . "\" target=\"_blank\">" . $row['name'] . "</a> <span class=\"small\">[" . $row['lang'] . "] [out: " . $row['out'] . "]</span>";
}
else
{
if ($curcat == $row['cat'])
{
echo "<br><a href=\"" . $_SERVER['PHP_SELF'] . "?url=" . $row['url'] . "\" title=\"" . $row['name'] . "\" target=\"_blank\">" . $row['name'] . "</a> <span class=\"small\">[" . $row['lang'] . "] [out: " . $row['out'] . "]</span>";
}
else
{
$thiscat = linkscat($row[cat]);
$curcat = $row['cat'];
echo "<p><b>" . $thiscat . "</b></b><p>";
echo "<a href=\"" . $_SERVER['PHP_SELF'] . "?url=" . $row['url'] . "\" title=\"" . $row['name'] . "\" target=\"_blank\">" . $row['name'] . "</a> <span class=\"small\">[" . $row['lang'] . "] [out: " . $row['out'] . "]</span>";
}
}
}
}
?>
// Configuratie voor catagorieen, voeg $catagorie[nummer] = "Catagorienaam" toe voor een nieuwe catagorie.
$fullcat[1] = "Catagorie 1";
$fullcat[2] = "Catagorie 2";
$dbhost = "localhost";
$dbuser = "username";
$dbpass = "password";
$dbdbdb = "databasename";
if (!@mysql_select_db($dbdbdb, @mysql_connect($dbhost, $dbuser, $dbpass)))
{
echo "<font face=\"Verdana, Arial, Helvetica\" size=\"2\">Sorry, er kon geen connectie worden gemaakt met de database.<p>";
echo "Probeer het a.u.b opnieuw. Blijft dit probleem zich voordoen, neemt u dan contact op met de webmaster.</font>";
exit();
}
$dbhost = "";
$dbuser = "";
$dbpass = "";
$dbdbdb = "";
//-- set dynamic vars
$tab_links = "links";
if ($_GET['url'])
{
$sql = "UPDATE links SET out=out+1 WHERE url = '" . $_GET['url'] . "'";
mysql_query($sql);
header("Location: " . $_GET['$url']);
}
else
{
function linkscat($cat)
{
return $fullcat[$cat];
}
$sql = "SELECT name,url,lang,cat,out FROM " . $tab_links . " ORDER BY cat,name";
$res = mysql_query($sql);
while ($row = mysql_fetch_array($res))
{
if ($curcat == "")
{
$thiscat = linkscat($row[cat]);
$curcat = $row['cat'];
echo "<b>" . $thiscat . "</b><p>";
echo "<a href=\"" . $_SERVER['PHP_SELF'] . "?url=" . $row['url'] . "\" title=\"" . $row['name'] . "\" target=\"_blank\">" . $row['name'] . "</a> <span class=\"small\">[" . $row['lang'] . "] [out: " . $row['out'] . "]</span>";
}
else
{
if ($curcat == $row['cat'])
{
echo "<br><a href=\"" . $_SERVER['PHP_SELF'] . "?url=" . $row['url'] . "\" title=\"" . $row['name'] . "\" target=\"_blank\">" . $row['name'] . "</a> <span class=\"small\">[" . $row['lang'] . "] [out: " . $row['out'] . "]</span>";
}
else
{
$thiscat = linkscat($row[cat]);
$curcat = $row['cat'];
echo "<p><b>" . $thiscat . "</b></b><p>";
echo "<a href=\"" . $_SERVER['PHP_SELF'] . "?url=" . $row['url'] . "\" title=\"" . $row['name'] . "\" target=\"_blank\">" . $row['name'] . "</a> <span class=\"small\">[" . $row['lang'] . "] [out: " . $row['out'] . "]</span>";
}
}
}
}
?>