bannersysteem

Gesponsorde koppelingen

PHP script bestanden

  1. bannersysteem

« Lees de omschrijving en reacties

MySQL tabellen: (copy/paste dit in je SQL execute veld in bijv. phpMyAdmin)

CREATE TABLE php_banner_login (
id int(11) NOT NULL auto_increment,
loginnaam varchar(10) NOT NULL default '',
wachtwoord varchar(10) NOT NULL default '',
url varchar(200) NOT NULL default '',
PRIMARY KEY (id)
) TYPE=MyISAM;

CREATE TABLE php_banner_out (
id int(11) NOT NULL auto_increment,
url varchar(200) NOT NULL default '',
out int(15) NOT NULL default '0',
views int(11) NOT NULL default '0',
datum varchar(20) NOT NULL default '',
PRIMARY KEY (id)
) TYPE=MyISAM;

CREATE TABLE php_banner_rotation (
id int(11) NOT NULL auto_increment,
bid int(2) NOT NULL default '0',
PRIMARY KEY (id)
) TYPE=MyISAM;

CREATE TABLE php_banners (
id int(11) NOT NULL auto_increment,
url varchar(200) NOT NULL default '',
pic varchar(200) NOT NULL default '',
alt varchar(50) NOT NULL default '',
bid int(2) NOT NULL default '0',
PRIMARY KEY (id)
) TYPE=MyISAM;

Code:
//-/****************************************/-//
ZET DE VOLGENDE SCRIPTS IN EEN APPARTE
MAP, BIJVOORBEELD: WWW.DOMEIN.NL/BANNERSTATS/
//-/****************************************/-//

*********************databaseconnect.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
15
16
17
18
19
20
<?
    session_start();
    
    $host = "localhost";
    $user = "database user";
    $pass = "database paswoord";
    $dbdb = "database naam";
    
    if (!@mysql_select_db($dbdb, @mysql_connect($host, $user, $pass)))
    {

        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();
    }

    
    $host = "";
    $user = "";
    $pass = "";
    $dbdb = "";
?>


********************bannerinstellingen.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
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
<?php
session_start();

// inlog check!! staat letterlijk, als er NIET een session bestaat met ** loginnaam,
// dus niet goed bent ingelogd, ga terug naar index.php!!

if (!$_SESSION['banid'])
{
header("location: index.php"); }

require("databaseconnect.php");
require("navigatie.php");

    
    if ($_POST['submit'] && $_POST['alt'] && $_POST['url'])
    {

        if (!$_POST['confirm'])
        {

            echo "<b>Weet u zeker dat u de volgende wijzigingen wilt aanbrengen?</b><p>";
            
            if (substr($url, 0, 7) != "http://")
                $url = "http://" . $_POST['url'];
            else
                $url = $_POST['url'];
          
            echo "<b>Url:</b>". $_POST['url']."<br>";
            echo "<b>Alt:</b>". $_POST['alt']."<br>";
            
            echo "<form method=\"post\" action=\"" . $_SERVER['PHP_SELF'] . "\">";
            echo "<input type=\"hidden\" name=\"confirm\" value=\"1\">";
            echo "<input type=\"hidden\" name=\"url\" value=\"$url\">";
            echo "<input type=\"hidden\" name=\"alt\" value=\"$_POST[alt]\">";
            echo "<input type=\"submit\" name=\"submit\" value=\"wijzigingen aanbrengen\"> | <a href=\"" . $_SERVER['PHP_SELF'] . "\">annuleren</a>";
            echo "</form>";
        }

        elseif ($_POST['confirm'])
        {

            $sql = "UPDATE php_banners SET url = '" . $_POST['url']. "', alt = '" . $_POST['alt'] ."' WHERE url = '". $_POST['banurl'] ."' ";
            $res = mysql_query($sql) or die(mysql_error());
            
            $sql = "UPDATE php_banner_login SET url = '" . $_POST['url'] ."' WHERE id = '" . $_POST['banid'] ."' ";
            $res = mysql_query($sql) or die(mysql_error());
            
            $sql = "UPDATE php_banner_out SET url = '" .$_POST['url'] ."' WHERE url = '" . $_POST['banurl'] ."' ";
            $res = mysql_query($sql) or die(mysql_error());
            
            $sql = "SELECT url FROM php_banners WHERE url = '" . $_POST['url']."' ";
            $res = mysql_query($sql) or die(mysql_error());
            $banurl = mysql_result($res, 0);
            
            session_unregister(banurl);
            
            session_register(banurl);
            echo "<script language=\"javascript\" type=\"text/javascript\">window.location='" . $_SERVER['PHP_SELF'] . "?edit=1'</script>";
        }
    }

    else
    {
        if ($_POST['submit'])
            echo "<span class=\"error\">U bent enkele velden vergeten in te vullen.</span><p>";
        elseif ($edit)
            echo "<span class=\"error\">Uw wijzigingen zijn aangebracht.</span><p>";
            
        echo "De huidige gegevens zijn de standaard waardes in de invoer velden. Na op de 'wijzigen' knop ";
        echo "te hebben geklikt zult u de nieuwe gegevens moeten bevestigen. Dit ter beveiliging.<p>";
        
        $sql = "SELECT url,alt,pic FROM php_banners WHERE url = '" .$_SESSION['banurl'] ."' ";
        $res = mysql_query($sql) or die(mysql_error());
        $row = mysql_fetch_array($res);
        
        if (substr($row['url'], 0, 7) != "http://")
            $furl = "http://" . $row['url'];
        else
            $furl = $row['url'];
            
        if (substr($row['pic'], 0, 7) != "http://")
            $purl = "http://" . $row['pic'];
        else
            $purl = $row['pic'];
        
        echo "<form method=\"post\" action=\"" . $_SERVER['PHP_SELF'] . "\">";
        echo "<table border=\"1\" cellspacing=\"0\" cellpadding=\"0\" bordercolor=\"#000000\" bgcolor=\"#BBD4F1\"><tr><td>";
        echo "<table border=\"0\" cellspacing=\"0\" cellpadding=\"5\">";
        echo "<tr><td width=\"100\">Uw URL adres:</td><td><input type=\"text\" name=\"url\" value=\"$furl\" size=\"60\" maxlength=\"200\"></td></tr>";
        echo "<tr><td width=\"100\">Uw alt tekst:</td><td><input type=\"text\" name=\"alt\" value=\"$row[alt]\" size=\"50\" maxlength=\"50\"></td></tr>";
        echo "<tr><td>&nbsp;</td><td><input type=\"submit\" name=\"submit\" value=\"wijzigen\"></td></tr>";
        echo "</table>";
        echo "</td></tr></table>";
        echo "</form><p>";
        
        echo "<center><span class=\"small\">banner weergave</span><br>";
        echo "<img src=\"$purl\" alt=\"$row[alt]\" border=\"1\" style=\"border-color: #000000\">";
        echo "</center>";
    }



?>


************************banners.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
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
<?php
session_start();

// inlog check!! staat letterlijk, als er NIET een session bestaat met ** loginnaam,
// dus niet goed bent ingelogd, ga terug naar index.php!!

if (!$_SESSION['banid'])
{
header("location: index.php"); }

// maak db connectie (hoeft dus niet als je al 1 hebt)
$host = "";
$user = "";
$pass = "";
$dbdb = "";
    
    if (!@mysql_select_db($dbdb, @mysql_connect($host, $user, $pass)))
    {

        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();
    }

    
    $host = "localhost";
    $user = "";
    $pass = "";
    $dbdb = "";
    
    $btable     = "php_banners";
    $btable2     = "php_banner_rotation";

    $rsql     = "SELECT bid FROM $btable2 WHERE id = 1";
    $rres     = mysql_query($rsql);
    $row     = mysql_fetch_array($rres);
    
    if (mysql_num_rows($rres) >= 1)
        $bid = $row[bid];
    else
        $bid = 1;

    $sql = "SELECT id,url,pic,alt FROM $btable WHERE bid = '$bid' ";
    $res = mysql_query($sql) or die(mysql_error());
    
    if (mysql_num_rows($res) >= 1)
    {

        $total = mysql_num_rows($res);
        $row = mysql_fetch_array($res);
        
        if (substr($row['url'], 0, 7) != "http://")
            $row['url'] = "http://" . $row['url'];
        if (substr($row['pic'], 0, 7) != "http://")
            $row['pic'] = "http://" . $row['pic'];
        
        echo "<center><a href='http://www.lissydesign.info/bannerstats/out.php?url=".$row['url']."' target='_blank'><img src='".$row['pic']."' alt='".$row['alt']."' border=\"1\" style=\"border-color: #000000\"></a></center>";
        $url = $row['url'];
    }

    
    $datum = date("d.m.Y");
    $sql = "SELECT id FROM php_banner_out WHERE datum = '$datum' AND url = '$url'";
    $res = mysql_query($sql) or die(mysql_error());
    
    if (mysql_num_rows($res) >= 1)
        $sql = "UPDATE php_banner_out SET views = views+1 WHERE datum = '$datum' AND url = '$url'";
    else
        $sql = "INSERT INTO php_banner_out (id, url, views, datum) VALUES ('', '$url', '1', '$datum')";
    @
mysql_query($sql);
    
    $sql = "SELECT id FROM $btable";
    $res = mysql_query($sql) or die(mysql_error());
    $count = mysql_num_rows($res);

    if ($bid == $count)
        $bid = "0";
        
    $sql = "UPDATE $btable2 SET bid = $bid+1";
    @
mysql_query($sql);
    
    unset($sql);
    unset($count);
    unset($res);
    unset($row);
    unset($rres);
    unset($rsql);
    
?>


**************************dagmaandoverzicht.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
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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
<?php
session_start();

// inlog check!! staat letterlijk, als er NIET een session bestaat met ** id,
// dus niet goed bent ingelogd, ga terug naar index.php!!

if (!$_SESSION['banid'])
{
header("location: index.php"); }
    
    require("databaseconnect.php");
    require("navigatie.php");

    
    function
GetMonth($month)
    {

        if ($month == "01")
            $month = "Januari";
        elseif ($month == "02")
            $month = "Februari";
        elseif ($month == "03")
            $month = "Maart";
        elseif ($month == "04")
            $month = "April";
        elseif ($month == "05")
            $month = "Mei";
        elseif ($month == "06")
            $month = "Juni";
        elseif ($month == "07")
            $month = "Juli";
        elseif ($month == "08")
            $month = "Augustus";
        elseif ($month == "09")
            $month = "September";
        elseif ($month == "10")
            $month = "Oktober";
        elseif ($month == "11")
            $month = "November";
        elseif ($month == "12")
            $month = "December";
            
        return $month;
    }

    
    if ($_POST['submit'])
    {

        $seldd = $_POST['dd'];
        $selmm = $_POST['mm'];
        $selyy = $_POST['yy'];
    }

    else
    {
        $seldd = date("d");
        $selmm = date("m");
        $selyy = date("Y");
    }


    echo "<form method=\"post\" action=\"" . $_SERVER['PHP_SELF'] . "\">";
    echo "<select name=\"dd\">";
    for ($i = 1; $i <= 31; $i++)
    {

        if ($i < 10)
            $dd = "0" . $i;
        else
            $dd = $i;
        
        if ($seldd == $i)
            echo "<option value=\"$dd\" selected>$dd</option>";
        else
            echo "<option value=\"$dd\">$dd</option>";
    }

    echo "</select> ";
    echo "<select name=\"mm\">";
    if ($selmm == "01")
        echo "<option value=\"01\" selected>Jan</option>";
    else
        echo "<option value=\"01\">Jan</option>";
        
    if ($selmm == "02")
        echo "<option value=\"02\" selected>Feb</option>";
    else
        echo "<option value=\"02\">Feb</option>";
    
    if ($selmm == "03")
        echo "<option value=\"03\" selected>Mar</option>";
    else    
        echo "<option value=\"03\">Mar</option>";
    
    if ($selmm == "04")
        echo "<option value=\"04\" selected>Apr</option>";
    else
        echo "<option value=\"04\">Apr</option>";
    
    if ($selmm == "05")
        echo "<option value=\"05\" selected>Mei</option>";
    else
        echo "<option value=\"05\">Mei</option>";
    
    if ($selmm == "06")
        echo "<option value=\"06\" selected>Jun</option>";
    else
        echo "<option value=\"06\">Jun</option>";
    
    if ($selmm == "07")
        echo "<option value=\"07\" selected>Jul</option>";
    else
        echo "<option value=\"07\">Jul</option>";
    
    if ($selmm == "08")
        echo "<option value=\"08\" selected>Aug</option>";
    else
        echo "<option value=\"08\">Aug</option>";
    
    if ($selmm == "09")
        echo "<option value=\"09\" selected>Sep</option>";
    else
        echo "<option value=\"09\">Sep</option>";
    
    if ($selmm == "10")
        echo "<option value=\"10\" selected>Okt</option>";
    else
        echo "<option value=\"10\">Okt</option>";
    
    if ($selmm == "11")
        echo "<option value=\"11\" selected>Nov</option>";
    else
        echo "<option value=\"11\">Nov</option>";
    
    if ($selmm == "12")
        echo "<option value=\"12\" selected>Dec</option>";
    else
        echo "<option value=\"12\">Dec</option>";
    
    echo "</select> ";
    
    $cyear = date("Y");
    $firstyear = $cyear - 2;
    echo "<select name=\"yy\">";
    for ($i = $firstyear; $i <= $cyear; $i++)
    {

        if ($selyy == $i)
            echo "<option value=\"$i\" selected>$i</option>";
        else
            echo "<option value=\"$i\">$i</option>";
    }

    echo "</select> ";
    echo "<input type=\"submit\" name=\"submit\" value=\"toon datum\">";
    echo "</form><P>";
    
    if ($_POST["submit"])
    {

        $sqldd = $_POST['dd'];
        $sqlmm = $_POST['mm'];
        $sqlyy = $_POST['yy'];
        $total = $sqldd . "." . $sqlmm . "." . $sqlyy;
    }

    else
        $total = date("d.m.Y");
    
    $sql = "SELECT out,views FROM php_banner_out WHERE url = '" . $_SESSION['banurl'] . "' AND datum = '" .$total . "' ";  
    $res = mysql_query($sql) or die(mysql_error());
    $row = mysql_fetch_array($res);
    $out = $row['out'];
    $views = $row['views'];
    
    if ($views == "")
    {

        $imgwidth = "1";
        $views = "0";
    }

    else
    {
        $imgwidth = $views;
    }

    
    if ($imgwidth > 550)
        $imgwidth = 550;
        
    if ($out == "")
    {

        $imgwidth2 = "1";
        $out = "0";
    }

    else
    {
        $imgwidth2 = $out;
    }

    
    if ($imgwidth2 > 550)
        $imgwidth2 = 550;
    
    echo "<b>Views</b> <span class=\"small\">$total</span><P>";
    
    echo "<table border=\"1\" cellspacing=\"0\" cellpadding=\"0\" bordercolor=\"#000000\" width=\"100%\" bgcolor=\"#BBD4F1\"><tr><td>";
    echo "<table border=\"0\" cellspacing=\"0\" cellpadding=\"5\">";
    echo "<tr>";
    echo "<td valign=\"top\"><p>Beneden ziet u de <i>views</i> van uw banner. Dit is dus hoe vaak uw banner bekeken is op <i>$total</i>.</p>";
    echo "<span class=\"small\">totaal: $views <img src=\"imgs/stats.gif\" width=\"$imgwidth\" height=\"10\"></td>";
    echo "</tr>";
    echo "</table>";
    echo "</td></tr></table><p>";
    
    echo "<table border=\"1\" cellspacing=\"0\" cellpadding=\"0\" bordercolor=\"#000000\" width=\"100%\" bgcolor=\"#BBD4F1\"><tr><td>";
    echo "<table border=\"0\" cellspacing=\"0\" cellpadding=\"5\">";
    echo "<tr>";
    echo "<td valign=\"top\"><p>Beneden ziet u de <i>kliks</i> van uw banner. Dit is dus hoe vaak er op uw banner geklikt is op <i>$total</i>.</p>";
    echo "<span class=\"small\">totaal: $out <img src=\"imgs/stats.gif\" width=\"$imgwidth2\" height=\"10\"></td>";
    echo "</tr>";
    echo "</table>";
    echo "</td></tr></table><p>";
    
    if ($_POST['submit'])
    {

        $sqlmm = $_POST['mm'];
        $sqlyy = $_POST['yy'];
        $total = $sqlmm . "." . $sqlyy;
    }

    else
        $total = date("m.Y");
        
    $sql = "SELECT out,views FROM php_banner_out WHERE url = '" . $_SESSION['banurl'] . "' AND SUBSTRING(datum, 4, 9) = '" .$total . "' ";
    //$sql = "SELECT out,views FROM php_banner_out WHERE url = '$_SESSION['banurl']' AND SUBSTRING(datum, 4, 9) = '$total'";
    $res = mysql_query($sql) or die(mysql_error());
    
    unset($out);
    unset($views);
    
    while ($row = mysql_fetch_array($res))
    {

        if (!$row['out'])
            $row['out'] = "0";
        if (!$row['views'])
            $row['views'] = "0";
        
        if (!$out)
            $out = $row['out'];
        else
            $out = $out+$row['out'];
        
        if (!$views)
            $views = $row['views'];
        else
            $views = $views+$row['views'];
    }

    
    if ($views == "")
    {

        $imgwidth = "1";
        $views = "0";
    }

    else
    {
        $imgwidth = $views;
    }

    
    if ($imgwidth > 550)
        $imgwidth = 550;
        
    if ($out == "")
    {

        $imgwidth2 = "1";
        $out = "0";
    }

    else
    {
        $imgwidth2 = $out;
    }

    
    if ($imgwidth2 > 550)
        $imgwidth2 = 550;
        
    $total = substr($total, 0, 2);
    $total = GetMonth($total);
    
    echo "<b>Clicks</b> <span class=\"small\">$total</span><p>";
    
    echo "<table border=\"1\" cellspacing=\"0\" cellpadding=\"0\" bordercolor=\"#000000\" width=\"100%\" bgcolor=\"#BBD4F1\"><tr><td>";
    echo "<table border=\"0\" cellspacing=\"0\" cellpadding=\"5\">";
    echo "<tr>";
    echo "<td valign=\"top\"><p>Beneden ziet u de <i>views</i> van uw banner. Dit is dus hoe vaak uw banner is bekeken in de maand $total.</p>";
    echo "<span class=\"small\">totaal: $views <img src=\"imgs/stats.gif\" width=\"$imgwidth\" height=\"10\"></td>";
    echo "</tr>";
    echo "</table>";
    echo "</td></tr></table><p>";
    
    echo "<table border=\"1\" cellspacing=\"0\" cellpadding=\"0\" bordercolor=\"#000000\" width=\"100%\" bgcolor=\"#BBD4F1\"><tr><td>";
    echo "<table border=\"0\" cellspacing=\"0\" cellpadding=\"5\">";
    echo "<tr>";
    echo "<td valign=\"top\"><p>Beneden ziet u de <i>kliks</i> van uw banner. Dit is dus hoe vaak er op uw banner is geklikt in de maand $total.</p>";
    echo "<span class=\"small\">totaal: $out <img src=\"imgs/stats.gif\" width=\"$imgwidth2\" height=\"10\"></td>";
    echo "</tr>";
    echo "</table>";
    echo "</td></tr></table>";


?>


****************************maandoverzicht.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
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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
<?php
session_start();

// inlog check!! staat letterlijk, als er NIET een session bestaat met ** id,
// dus niet goed bent ingelogd, ga terug naar index.php!!

if (!$_SESSION['banid'])
{
header("location: index.php"); }

    require("databaseconnect.php");
    require("navigatie.php");

    
    if ($_POST['submit'])
    {

        $selmm = $_POST['mm'];
        $selyy = $_POST['yy'];
    }

    else
    {
        $selmm = date("m");
        $selyy = date("Y");
    }


    echo "<form method=\"post\" action=\"" . $_SERVER['PHP_SELF'] . "\">";
    echo "<select name=\"mm\">";
    if ($selmm == "01")
        echo "<option value=\"01\" selected>Jan</option>";
    else
        echo "<option value=\"01\">Jan</option>";
        
    if ($selmm == "02")
        echo "<option value=\"02\" selected>Feb</option>";
    else
        echo "<option value=\"02\">Feb</option>";
    
    if ($selmm == "03")
        echo "<option value=\"03\" selected>Mar</option>";
    else    
        echo "<option value=\"03\">Mar</option>";
    
    if ($selmm == "04")
        echo "<option value=\"04\" selected>Apr</option>";
    else
        echo "<option value=\"04\">Apr</option>";
    
    if ($selmm == "05")
        echo "<option value=\"05\" selected>Mei</option>";
    else
        echo "<option value=\"05\">Mei</option>";
    
    if ($selmm == "06")
        echo "<option value=\"06\" selected>Jun</option>";
    else
        echo "<option value=\"06\">Jun</option>";
    
    if ($selmm == "07")
        echo "<option value=\"07\" selected>Jul</option>";
    else
        echo "<option value=\"07\">Jul</option>";
    
    if ($selmm == "08")
        echo "<option value=\"08\" selected>Aug</option>";
    else
        echo "<option value=\"08\">Aug</option>";
    
    if ($selmm == "09")
        echo "<option value=\"09\" selected>Sep</option>";
    else
        echo "<option value=\"09\">Sep</option>";
    
    if ($selmm == "10")
        echo "<option value=\"10\" selected>Okt</option>";
    else
        echo "<option value=\"10\">Okt</option>";
    
    if ($selmm == "11")
        echo "<option value=\"11\" selected>Nov</option>";
    else
        echo "<option value=\"11\">Nov</option>";
    
    if ($selmm == "12")
        echo "<option value=\"12\" selected>Dec</option>";
    else
        echo "<option value=\"12\">Dec</option>";
    
    echo "</select> ";
    
    $cyear = date("Y");
    $firstyear = $cyear - 2;
    echo "<select name=\"yy\">";
    for ($i = $firstyear; $i <= $cyear; $i++)
    {

        if ($selyy == $i)
            echo "<option value=\"$i\" selected>$i</option>";
        else
            echo "<option value=\"$i\">$i</option>";
    }

    echo "</select> ";
    echo "<input type=\"submit\" name=\"submit\" value=\"toon datum\">";
    echo "</form><P>";
    
    if ($_POST['submit'])
    {

        $sqlmm = $_POST['mm'];
        $sqlyy = $_POST['yy'];
        $total = $sqlmm . "." . $sqlyy;
    }

    else
        $total = date("m.Y");
    
    $sql = "SELECT out,views FROM php_banner_out WHERE url = '" . $_SESSION['banurl'] . "' AND SUBSTRING(datum, 4, 9) = '" .$total . "' ";
    //$sql = "SELECT out,views FROM php_banner_out WHERE url = '$_SESSION['banurl']' AND SUBSTRING(datum, 4, 9) = '$total'";
    $res = mysql_query($sql) or die(mysql_error());
    
    unset($out);
    unset($views);
    
    while ($row = mysql_fetch_array($res))
    {

        if (!$row[out])
            $row[out] = "0";
        if (!$row[views])
            $row[views] = "0";
        
        if (!$out)
            $out = $row[out];
        else
            $out = $out+$row[out];
        
        if (!$views)
            $views = $row[views];
        else
            $views = $views+$row[views];
    }

    
    if ($views == "")
    {

        $imgwidth = "1";
        $views = "0";
    }

    else
    {
        $imgwidth = $views;
    }

    
    if ($imgwidth > 550)
        $imgwidth = 550;
        
    if ($out == "")
    {

        $imgwidth2 = "1";
        $out = "0";
    }

    else
    {
        $imgwidth2 = $out;
    }

    
    if ($imgwidth2 > 550)
        $imgwidth2 = 550;
    
    echo "<table border=\"1\" cellspacing=\"0\" cellpadding=\"0\" bordercolor=\"#000000\" width=\"100%\" bgcolor=\"#BBD4F1\"><tr><td>";
    echo "<table border=\"0\" cellspacing=\"0\" cellpadding=\"5\">";
    echo "<tr>";
    echo "<td valign=\"top\"><p>Beneden ziet u de <i>views</i> van uw banner. Dit is dus hoe vaak uw banner is bekeken in deze maand.</p>";
    echo "<span class=\"small\">totaal: $views <img src=\"imgs/stats.gif\" width=\"$imgwidth\" height=\"10\"></td>";
    echo "</tr>";
    echo "</table>";
    echo "</td></tr></table><p>";
    
    echo "<table border=\"1\" cellspacing=\"0\" cellpadding=\"0\" bordercolor=\"#000000\" width=\"100%\" bgcolor=\"#BBD4F1\"><tr><td>";
    echo "<table border=\"0\" cellspacing=\"0\" cellpadding=\"5\">";
    echo "<tr>";
    echo "<td valign=\"top\"><p>Beneden ziet u de <i>kliks</i> van uw banner. Dit is dus hoe vaak er op uw banner is geklikt in deze maand.</p>";
    echo "<span class=\"small\">totaal: $out <img src=\"imgs/stats.gif\" width=\"$imgwidth2\" height=\"10\"></td>";
    echo "</tr>";
    echo "</table>";
    echo "</td></tr></table>";


?>


****************************dagoverzicht.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
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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
<?php
session_start();

// inlog check!! staat letterlijk, als er NIET een session bestaat met ** id,
// dus niet goed bent ingelogd, ga terug naar index.php!!

if (!$_SESSION['banid'])
{
header("location: index.php"); }

require("databaseconnect.php");  
require("navigatie.php");

    
    if ($_POST['submit'])
    {

        $seldd = $_POST['dd'];
        $selmm = $_POST['mm'];
        $selyy = $_POST['yy'];
    }

    else
    {
        $seldd = date("d");
        $selmm = date("m");
        $selyy = date("Y");
    }


    echo "<form method=\"post\" action=\"" . $_SERVER['PHP_SELF'] . "\">";
    echo "<select name=\"dd\">";
    for ($i = 1; $i <= 31; $i++)
    {

        if ($i < 10)
            $dd = "0" . $i;
        else
            $dd = $i;
        
        if ($seldd == $i)
            echo "<option value=\"$dd\" selected>$dd</option>";
        else
            echo "<option value=\"$dd\">$dd</option>";
    }

    echo "</select> ";
    echo "<select name=\"mm\">";
    if ($selmm == "01")
        echo "<option value=\"01\" selected>Jan</option>";
    else
        echo "<option value=\"01\">Jan</option>";
        
    if ($selmm == "02")
        echo "<option value=\"02\" selected>Feb</option>";
    else
        echo "<option value=\"02\">Feb</option>";
    
    if ($selmm == "03")
        echo "<option value=\"03\" selected>Mar</option>";
    else    
        echo "<option value=\"03\">Mar</option>";
    
    if ($selmm == "04")
        echo "<option value=\"04\" selected>Apr</option>";
    else
        echo "<option value=\"04\">Apr</option>";
    
    if ($selmm == "05")
        echo "<option value=\"05\" selected>Mei</option>";
    else
        echo "<option value=\"05\">Mei</option>";
    
    if ($selmm == "06")
        echo "<option value=\"06\" selected>Jun</option>";
    else
        echo "<option value=\"06\">Jun</option>";
    
    if ($selmm == "07")
        echo "<option value=\"07\" selected>Jul</option>";
    else
        echo "<option value=\"07\">Jul</option>";
    
    if ($selmm == "08")
        echo "<option value=\"08\" selected>Aug</option>";
    else
        echo "<option value=\"08\">Aug</option>";
    
    if ($selmm == "09")
        echo "<option value=\"09\" selected>Sep</option>";
    else
        echo "<option value=\"09\">Sep</option>";
    
    if ($selmm == "10")
        echo "<option value=\"10\" selected>Okt</option>";
    else
        echo "<option value=\"10\">Okt</option>";
    
    if ($selmm == "11")
        echo "<option value=\"11\" selected>Nov</option>";
    else
        echo "<option value=\"11\">Nov</option>";
    
    if ($selmm == "12")
        echo "<option value=\"12\" selected>Dec</option>";
    else
        echo "<option value=\"12\">Dec</option>";
    
    echo "</select> ";
    
    $cyear = date("Y");
    $firstyear = $cyear - 2;
    echo "<select name=\"yy\">";
    for ($i = $firstyear; $i <= $cyear; $i++)
    {

        if ($selyy == $i)
            echo "<option value=\"$i\" selected>$i</option>";
        else
            echo "<option value=\"$i\">$i</option>";
    }

    echo "</select> ";
    echo "<input type=\"submit\" name=\"submit\" value=\"toon datum\">";
    echo "</form><P>";
    
    if ($_POST['submit'])
    {

        $sqldd = $_POST['dd'];
        $sqlmm = $_POST['mm'];
        $sqlyy = $_POST['yy'];
        $total = $sqldd . "." . $sqlmm . "." . $sqlyy;
    }

    else
        $total = date("d.m.Y");
    
    $sql = "SELECT out,views FROM php_banner_out WHERE url = '" . $_SESSION['banurl'] . "' AND datum = '" .$total . "' ";  
    //$sql = "SELECT out,views FROM php_banner_out WHERE url = '$_SESSION['banurl']' AND datum = '$total' ";
    $res = mysql_query($sql) or die(mysql_error());
    $row = mysql_fetch_array($res);
    $out = $row['out'];
    $views = $row['views'];
    
    if ($views == "")
    {

        $imgwidth = "1";
        $views = "0";
    }

    else
    {
        $imgwidth = $views;
    }

    
    if ($imgwidth > 550)
        $imgwidth = 550;
        
    if ($out == "")
    {

        $imgwidth2 = "1";
        $out = "0";
    }

    else
    {
        $imgwidth2 = $out;
    }

    
    if ($imgwidth2 > 550)
        $imgwidth2 = 550;
    
    echo "<table border=\"1\" cellspacing=\"0\" cellpadding=\"0\" bordercolor=\"#000000\" width=\"100%\" bgcolor=\"#BBD4F1\"><tr><td>";
    echo "<table border=\"0\" cellspacing=\"0\" cellpadding=\"5\">";
    echo "<tr>";
    echo "<td valign=\"top\"><p>Beneden ziet u de <i>views</i> van uw banner. Dit is dus hoe vaak uw banner is bekeken.</p>";
    echo "<span class=\"small\">totaal: $views <img src=\"imgs/stats.gif\" width=\"$imgwidth\" height=\"10\"></td>";
    echo "</tr>";
    echo "</table>";
    echo "</td></tr></table><p>";
    
    echo "<table border=\"1\" cellspacing=\"0\" cellpadding=\"0\" bordercolor=\"#000000\" width=\"100%\" bgcolor=\"#BBD4F1\"><tr><td>";
    echo "<table border=\"0\" cellspacing=\"0\" cellpadding=\"5\">";
    echo "<tr>";
    echo "<td valign=\"top\"><p>Beneden ziet u de <i>kliks</i> van uw banner. Dit is dus hoe vaak er op uw banner is geklikt.</p>";
    echo "<span class=\"small\">totaal: $out <img src=\"imgs/stats.gif\" width=\"$imgwidth2\" height=\"10\"></td>";
    echo "</tr>";
    echo "</table>";
    echo "</td></tr></table>";


?>


****************************index.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
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
<?php
session_start();

    // maak db connectie (hoeft dus niet als je al 1 hebt)
    $host = "";
    $user = "";
    $pass = "";
    $dbdb = "";
    
    if (!@mysql_select_db($dbdb, @mysql_connect($host, $user, $pass)))
    {

        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();
    }


    if ($_POST['loginnaam'] && $_POST['wachtwoord'])
    {

        $sql = "SELECT id,url FROM php_banner_login WHERE loginnaam = '".$_POST['loginnaam']."' AND wachtwoord = '".$_POST['wachtwoord']."'";
        $res = mysql_query($sql) or die(mysql_error());
        if (mysql_num_rows($res) >= 1)
        {

            $row = mysql_fetch_array($res);
            
            $_SESSION['banid']     = $row['id'];
            $_SESSION['banurl'] = $row['url'];
            
            echo "<script language=\"javascript\" type=\"text/javascript\">window.location='" . $_SERVER['PHP_SELF'] . "'</script>";
        }

        else
        {
            echo "<script language=\"javascript\" type=\"text/javascript\">window.location='" . $_SERVER['PHP_SELF'] . "?err=1'</script>";
        }
    }

    elseif ($_SESSION['banid'])
    {

        require("navigatie.php");
        echo "U bent reeds ingelogd.<p>";
        
        echo "De navigatie kunt u aan de bovenkant van de pagina vinden.";
    }

    else
    {
        if($_GET['err'])  
            echo "<p class=\"error\">U heeft een ongeldige login naam of wachtwoord ingevoerd. Probeer het opnieuw.</p>";
?>

        <p>Welkom bij de banner statistieken. Hier kunt u uw
              banner statistieken tot op de dag volgen.</p>
            <p>Om in te loggen moet u uw login naam en wachtwoord die u van ons
              heeft gekregen, in onderstaande velden invullen. Mocht u nog vragen
              hebben of bent u uw login gegevens kwijt, neem dan contact met ons
              op. Voor een snel antwoord kunt u mailen naar <a href="mailto:[email protected]">[email protected]</a>.</p>
            <form name="form1" method="post" action="">
              <table width="243" border="0" cellspacing="0" cellpadding="0">
                <tr valign="top" align="left">
                  <td width="93">login naam</td>
                  <td width="166">
                    <input type="text" name="loginnaam" size="10" maxlength="10">
                  </td>
                </tr>
                <tr valign="top" align="left">
                  <td width="93">wachtwoord</td>
                  <td width="166">
                    <input type="password" name="wachtwoord" size="10" maxlength="10">
                  </td>
                </tr>
                <tr valign="top" align="left">
                  <td width="93">&nbsp;</td>
                  <td width="166">
                    <input type="submit" name="submit" value="inloggen">
                  </td>
                </tr>
              </table>
            </form>
            <p>&nbsp;</p>
<?php
    }
?>

***************************navigatie.php************************

Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
2
3
4
5
6
7
8
9
10
11
<?php
    echo "<a href=\"dagoverzicht.php\" target=\"_top\">dag overzicht</a>";
    echo " | ";
    echo "<a href=\"maandoverzicht.php\" target=\"_top\">maand overzicht</a>";
    echo " | ";
    echo "<a href=\"dagmaandoverzicht.php\" target=\"_top\">dag/maand overzicht</a>";
    echo " | ";
    echo "<a href=\"bannerinstellingen.php\" target=\"_top\">banner instellingen</a>";
    echo " | ";
    echo "<a href=\"uitloggen.php\" target=\"_top\">uitloggen</a>";
?>


***************************out.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
15
16
17
18
19
20
21
22
23
24
25
26
27
28
<?php
    if ($_GET['url'])
    {

        // maak db connectie (hoeft dus niet als je al 1 hebt)
        $host = "";
        $user = "";
        $pass = "";
        $dbdb = "";
          
        if (!@mysql_select_db($dbdb, @mysql_connect($host, $user, $pass)))
        {

            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();
        }

          
        $host = "";
        $user = "";
        $pass = "";
        $dbdb = "";
        
        $sql = "UPDATE php_banner_out SET out=out+1 WHERE url = '" . $_GET['url'] . "' ";
        mysql_query($sql) or die(mysql_error());

        //header("Location: $url");
        header("Location: ". $_GET['url']);
    }

?>


*****************************uitloggen.php************************

Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
2
3
4
5
6
<?php
session_start();
session_destroy();

echo "u bent uitgelogd, klik <a href=\"http://www.lissydesign.info/\">hier</a> om verder te gaan.";
?>

 
 

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.