links-systeem

Gesponsorde koppelingen

PHP script bestanden

  1. links-systeem

« Lees de omschrijving en reacties

=============Links.php======================

Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
2
3
4
5
6
7
8
9
10
11
12
13
14
<?php
$dbh
=mysql_connect("localhost","gebruikersnaam","passwoord");
$db="databasename";
$site="http://www.che-lives-clan.com/";
$email="[email protected]";
if ($_GET[out] ==! ""){
$res=mysql_db_query("$db","select linkout, url from links WHERE linkscode ='$_GET[out]';",$dbh);
    $row=mysql_fetch_row($res);
$out ="$row[0]";
$out++;
mysql_db_query("$db","update links set linkout='$out' where linkscode ='$_GET[out]';",$dbh);
echo "<script>document.location=\"$row[1]\"</script>";}
//Dit is het best bovenaan
?>



Code (php)
PHP script in nieuw venster Selecteer het PHP script
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
<?
//Hierboven alles aan passen aan jouw gegevens

//begin link toevoegen

if ($_POST[writelink] == "1")
{

if (empty($value)) {
echo "Please fill in all fields<br>click <a href=\"$PHP_SELF\">here</a> to try again";
//De foutmelding als niet alles is ingegeven
}
$res=mysql_db_query("$db","insert into links set url ='$_POST[url]', websitename ='$_POST[websitename]', description  ='$_POST[description]', banner ='$_POST[banner]', linkin ='0', linkout ='0'",$dbh);
mysql_query($res);
$res=mysql_db_query("$db","select linkscode from links where url='$_POST[url]';",$dbh);
$row=mysql_fetch_row($res);
//hier voegt hij alles in in de database

$message="A link was added\nUrl: $_POST[url]\nSite Name: $_POST[websitename]\nBanner: $_POST[banner]\nDescription: $_POST[description]";
//bericht dat jou gestuurd word

mail("$email", "A new link", "$message", "From: $mailfrom");
//de mail functie
echo "Your link was added<br>This is your link <a href=\"$site?in=$row[0]\">$site?in=$row[0]</a>";
//het bericht dat er op komt
}



elseif ($_GET[a] =="1"){
//Deze pagina is voor een link toe te voegen
echo "<form action=\"$PHP_SELF\" method=\"post\">";
echo "<input type=\"hidden\" name=\"writelink\" value=\"1\">";
echo "<table width=\"100%\">";
echo "<tr><td colspan=\"3\" align=\"center\" border=\"1\">";
echo "Submit A link";
echo "</td></tr>";
echo "<tr><td width=\"50%\" border=\"1\"> ";
echo "Url:";
echo "</td><td align=\"right\" valign=\"middle\" width=\"50%\" border=\"1\">";
echo "<input type=\"text\" name=\"url\" size=\"30\">";
echo "</td></tr>";
echo "<tr><td width=\"50%\" border=\"1\"> ";
echo "Website name:";
echo "</td><td align=\"right\" valign=\"middle\" width=\"50%\" border=\"1\">";
echo "<input type=\"text\" name=\"websitename\" size=\"30\">";
echo "</td></tr>";
echo "<tr><td border=\"1\">";
echo "Description:";
echo "</td><td align=\"right\" border=\"1\">";
echo "<input type=\"text\" name=\"description\" size=\"30\">";
echo "</td></tr>";
echo "<tr><td width=\"50%\" border=\"1\"> ";
echo "Banner:";
echo "</td><td align=\"right\" valign=\"middle\" width=\"50%\" border=\"1\">";
echo "<input type=\"text\" name=\"banner\" size=\"30\">";
echo "</td></tr>";
echo "<tr><td colspan=\"3\" align=\"center\">";
echo "<input type=\"submit\" value=\"Submit\" name=\"submit\">";
echo "<input type=\"reset\" value=\"Reset\">";
echo "</td></tr></form>";
echo "</table>";
}

else{
//Deze pagina toont de links
if (!$dbh) {
        echo "<br><br>";
    echo "<font color=\"#FF0000\"> ERROR ! Cannot create connection to $db database.</font><br>\n";
    echo "</body></html>";
    exit;
    }

//Als database connectie mislukt
$res=mysql_db_query("$db","select url, websitename, description,  linkin, linkout, banner, linkscode from links;",$dbh);
$fout=mysql_errno($dbh);

if ($fout != 0) {
    $fout=mysql_error($dbh);
    echo "<font color=\#FF0000\">$fout</font>";
    mysql_close($dbh);
    echo "</body></html>";
    exit;
    }

//Als database connectie mislukt
$aantal_lijnen=mysql_num_rows($res);
echo "<a href=\"links.php?a=1\">Submit Link</a><table width=\"100%\"><tr><td border=\"1\">Links</td><td border=\"1\" width=\"20\">in</td><td border=\"1\" width=\"20\">out</td></tr>";
for($i=0;$i<$aantal_lijnen;$i++) {
    $row=mysql_fetch_row($res);
    echo "<tr><td border=\"1\"><a href=\"links.php?out=$row[6]\" target=\"_blank\">$row[1]</a><br>";
if($row[5] == "")
{
echo "<br>$row[2]</td><td border=\"1\">$row[3]</td><td border=\"1\">$row[4]</td></tr>";}
else
{echo "<a href=\"links.php?out=$row[6]\" target=\"_blank\"><img src=\"$row[5]\" border=\"0\"></a>";
echo "<br>$row[2]</td><td border=\"1\">$row[3]</td><td border=\"1\">$row[4]</td></tr>";}
    }

echo "</table>";}
//Als database connectie lukt toont hij links
?>


=================Einde Links.php ===================

===============Bovenaan de pagina $site ===============
Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
2
3
4
5
6
7
8
9
10
11
<?php
$dbh
=mysql_connect("localhost","gebruikersnaam","passwoord");
$db="databasename";
if ($_GET[in] ==! ""){
$res=mysql_db_query("$db","select linkin from links WHERE linkscode ='$_GET[in]';",$dbh);
    $row=mysql_fetch_row($res);
$in ="$row[0]";
$in++;
mysql_db_query("$db","update links set linkin='$in' where linkscode ='$_GET[in]';",$dbh);
}

?>

=================================================

 
 

Om de gebruiksvriendelijkheid van onze website en diensten te optimaliseren maken wij gebruik van cookies. Deze cookies gebruiken wij voor functionaliteiten, analytische gegevens en marketing doeleinden. U vindt meer informatie in onze privacy statement.