banner-systeem

Gesponsorde koppelingen

PHP script bestanden

  1. banner-systeem

« Lees de omschrijving en reacties

//-/****************************************/-//
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 = "";
?>


-------- sessiecheck.php --------
Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
2
3
4
5
6
7
8
9
<?
    if (!$HTTP_SESSION_VARS["banid"])
    {

        echo "U heeft niet de juiste rechten om deze pagina te bekijken.<p>";
        
        echo "Om uw banner statistieken te bekijken moet u <a href=\"index.php\">inloggen</a>.";
        exit();
    }

?>


------- navigatie.php ---------
Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
2
3
4
5
6
7
8
9
10
11
<?
    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>";
?>


----- 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
<?
    session_start();
    require("databaseconnect.php");
    require("sessioncheck.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 ($HTTP_POST_VARS["submit"])
    {

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

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


    echo "<form method=\"post\" action=\"$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 ($HTTP_POST_VARS["submit"])
    {

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

    else
        $total = date("d.m.Y");
    
    $sql = "SELECT out,views FROM php_banner_out WHERE url = '$HTTP_SESSION_VARS[banurl]' AND datum = '$total'";
    $res = mysql_query($sql);
    $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 ($HTTP_POST_VARS["submit"])
    {

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

    else
        $total = date("m.Y");
    
    $sql = "SELECT out,views FROM php_banner_out WHERE url = '$HTTP_SESSION_VARS[banurl]' AND SUBSTRING(datum, 4, 9) = '$total'";
    $res = mysql_query($sql);
    
    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>";


?>


-------- 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
<?
    session_start();
    require("databaseconnect.php");

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

    
    if ($HTTP_POST_VARS["submit"])
    {

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

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


    echo "<form method=\"post\" action=\"$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 ($HTTP_POST_VARS["submit"])
    {

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

    else
        $total = date("d.m.Y");
    
    $sql = "SELECT out,views FROM php_banner_out WHERE url = '$HTTP_SESSION_VARS[banurl]' AND datum = '$total'";
    $res = mysql_query($sql);
    $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>";


?>


------ 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
<?
    session_start();
    require("databaseconnect.php");

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

    
    if ($HTTP_POST_VARS["submit"])
    {

        $selmm = $HTTP_POST_VARS[mm];
        $selyy = $HTTP_POST_VARS[yy];
    }

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


    echo "<form method=\"post\" action=\"$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 ($HTTP_POST_VARS["submit"])
    {

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

    else
        $total = date("m.Y");
    
    $sql = "SELECT out,views FROM php_banner_out WHERE url = '$HTTP_SESSION_VARS[banurl]' AND SUBSTRING(datum, 4, 9) = '$total'";
    $res = mysql_query($sql);
    
    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>";


?>


------ 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
<?
    session_start();
    require("databaseconnect.php");

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

    
    if ($HTTP_POST_VARS["submit"] && $HTTP_POST_VARS["alt"] && $HTTP_POST_VARS["url"])
    {

        if (!$HTTP_POST_VARS["confirm"])
        {

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

        elseif ($HTTP_POST_VARS["confirm"])
        {

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

    else
    {
        if ($HTTP_POST_VARS["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>";
        
        //echo "<span class=\"error\">Onthoud!</span> Als u uw url adres wijzigt vervallen de statistieken en zullen er nieuwe statistieken worden aangemaakt. Als u uw 'oude' url adres vervolgens weer terug zet heeft u uw oude statistieken weer.<p>";
        
        $sql = "SELECT url,alt,pic FROM php_banners WHERE url = '$HTTP_SESSION_VARS[banurl]'";
        $res = mysql_query($sql);
        $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=\"$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>";
    }



?>


----------- 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
<?
    session_start();

    if ($HTTP_POST_VARS["loginnaam"] && $HTTP_POST_VARS["wachtwoord"])
    {

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

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

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

    elseif ($HTTP_SESSION_VARS["banid"])
    {

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

    else
    {
        if ($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>
Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
2
3
<?
    }
?>




//-/****************************************/-//
GEBRUIKT DIT VOOR OP JE PAGINA
//-/****************************************/-//


-------- 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
<?
    // maak db connectie (hoeft dus niet als je al 1 hebt)
    $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 = "";
    
    $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);
    
    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 "<a href=\"http://www.phphulp.nl/out.php?url=$row[url]\" target=\"_blank\"><img src=\"$row[pic]\" alt=\"$row[alt]\" border=\"1\" style=\"border-color: #000000\"></a><p>";
        $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);
    
    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);
    $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);
    
?>


-------- 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
<?
    if ($HTTP_GET_VARS["url"])
    {

        // maak db connectie (hoeft dus niet als je al 1 hebt)
        $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 = "";

        $sql = "UPDATE php_banner_out SET out=out+1 WHERE url = '$HTTP_GET_VARS[url]'";
        mysql_query($sql);

        header("Location: $url");
    }

?>

 
 

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.