Subversion Repositories webcounter

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
3 daniel-mar 1
<?php
2
 
3
/*
4
 * PHP Counter mit Reloadsperre, Textdatenbank und Graphic-Libary (without Error Images)
5
 * (C)Copyright 2010 - 2017 Daniel Marschall
6
 * Revision: 2017-05-05
7
 */
8
 
9
if (!file_exists(__DIR__ . '/config/config.inc.php')) {
10
        die('Please edit config/config_dist.inc.php and then rename it to config/config.inc.php !');
11
}
12
 
13
require_once __DIR__ . '/config/config.inc.php';
14
 
15
$pdo = new PDO(PDO_HOST, PDO_USER, PDO_PASS);
16
$statement = $pdo->prepare("SELECT COUNT(*) AS cnt, SUM(counter) AS total FROM counter_visitors");
17
$statement->execute();
18
$stats = $statement->fetch();
19
 
20
?><!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
21
 
22
<html>
23
 
24
<head>
25
        <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
26
 
27
        <meta name="author" content="Daniel Marschall">
28
        <meta name="keywords" content="Freeware, webcounter, visitors, counter, homepage, tools, HTML, PHP, Website, Internet">
29
        <meta name="description" content="Free webcounter for your homepage!">
30
 
31
        <title>Web counter by Daniel Marschall</title>
32
 
33
        <style type="text/css">
34
        body {
35
                font-family: Verdana;
36
                background-color: #D6EAF8;
37
        }
38
 
39
        .tooltip {
40
                border-bottom: 1px dotted #000;
41
                text-decoration: none;
42
                cursor: help;
43
        }
44
        </style>
45
</head>
46
 
47
<body>
48
 
49
<h1>Web counter by Daniel Marschall</h1>
50
 
51
<h2>Features</h2>
52
 
53
<ul>
54
        <li>No registration needed! Just use any value for "id" that is free. A counter will be automatically created.</li>
55
        <li>Reload lock for <?php echo RELOADSPERRE_MINS; ?> minutes (Refresh button will not cause the counter to increase). The IP of the visitor is hashed to ensure privacy.</li>
56
        <li>Supports SSL, so there won't be any warnings when you include this counter to your HTTPS website.</li>
57
        <li>You can use several themes and modes simultaneously.</li>
58
        <li>Private and secure: No forced back-links, no cookies, no JavaScript!</li>
59
        <li>Note: Counters which are not visited for more than 1 year automatically get removed from the database.</li>
60
</ul>
61
 
62
<p>Currently hosted web counters: <b><?php echo $stats['cnt']; ?></b><br>
63
Visitors total: <b><?php echo $stats['total']; ?></b></p>
64
 
65
<h2>Available counters and modes</h2>
66
 
67
<?php
68
 
69
$dirs = array_filter(glob('themes/*'), 'is_dir');
70
$themes = array();
71
foreach ($dirs as $d) $themes[] = explode('/', $d, 2)[1];
72
foreach ($themes as $theme) {
73
        echo '<h3>Theme "'.$theme.'"</h3>';
74
        echo 'URL: '.OWN_URL.'counter.php?id=<b><span class="tooltip" title="Choose any ID you like. No registration needed!">demo</span></b>&amp;format=<b>graphic</b>&amp;theme=<b>'.$theme.'</b><br><br>';
75
        echo 'HTML example:<br><textarea cols="110" rows="4">&lt;a href="'.OWN_URL.'"&gt;&lt;img src="'.OWN_URL.'counter.php?id=demo&amp;amp;format=graphic&amp;amp;theme='.$theme.'" alt="Visitors" title="Visitors"&gt;&lt;/a&gt;</textarea><br>';
76
        echo '<br><a href="'.OWN_URL.'"><img src="'.OWN_URL.'counter.php?id=demo&amp;format=graphic&amp;theme='.$theme.'" alt="Visitors" title="Visitors"></a>';
77
}
78
 
79
echo '<h3>Spacer (1x1 invisible image)</h3>';
80
echo 'URL: '.OWN_URL.'counter.php?id=<b><span class="tooltip" title="Choose any ID you like. No registration needed!">demo</span></b>&amp;format=<b>spacer</b><br><br>';
81
echo 'HTML example:<br><textarea cols="110" rows="2">&lt;img src="'.OWN_URL.'counter.php?id=demo&amp;amp;format=spacer" alt=""&gt;</textarea><br>';
82
 
83
echo '<h3>Silent (no output)</h3>';
84
echo 'URL: '.OWN_URL.'counter.php?id=<b><span class="tooltip" title="Choose any ID you like. No registration needed!">demo</span></b>&amp;format=<b>silent</b><br>';
85
echo '<a href="'.OWN_URL.'counter.php?id=demo&amp;format=silent">Demo</a>';
86
 
87
echo '<h3>Text</h3>';
88
echo 'URL: '.OWN_URL.'counter.php?id=<b><span class="tooltip" title="Choose any ID you like. No registration needed!">demo</span></b>&amp;format=<b>plaintext</b><br>';
89
echo '<a href="'.OWN_URL.'counter.php?id=demo&amp;format=plaintext">Demo</a>';
90
 
91
echo '<h3>JSON</h3>';
92
echo 'URL: '.OWN_URL.'counter.php?id=<b><span class="tooltip" title="Choose any ID you like. No registration needed!">demo</span></b>&amp;format=<b>json</b><br>';
93
echo '<a href="'.OWN_URL.'counter.php?id=demo&amp;format=json">Demo</a>';
94
 
95
?>
96
 
97
<h2>Different hues</h2>
98
 
99
<p>You can change the hue of every counter by adding the argument "&amp;hue=" followed by a number between <b>1</b> and <b>359</b> . Just try out a few numbers until you see the color you desire.</p>
100
 
101
<p><u>Example:</u></p>
102
 
103
<?php
104
$theme = 'digital';
105
$hue = 145;
106
echo 'URL: '.OWN_URL.'counter.php?id=<b><span class="tooltip" title="Choose any ID you like. No registration needed!">demo</span></b>&amp;format=<b>graphic</b>&amp;theme=<b>'.$theme.'</b>&amp;hue=<b>'.$hue.'</b><br><br>';
107
echo 'HTML example:<br><textarea cols="110" rows="4">&lt;a href="'.OWN_URL.'"&gt;&lt;img src="'.OWN_URL.'counter.php?id=demo&amp;amp;format=graphic&amp;amp;theme='.$theme.'&amp;amp;hue='.$hue.'" alt="Visitors" title="Visitors"&gt;&lt;/a&gt;</textarea><br>';
108
echo '<br><a href="'.OWN_URL.'"><img src="'.OWN_URL.'counter.php?id=demo&amp;format=graphic&amp;theme='.$theme.'&amp;hue='.$hue.'" alt="Visitors" title="Visitors"></a>';
109
?>
110
 
111
<hr>
112
 
113
<p>
114
        <a href="https://validator.w3.org/check?uri=referer"><img src="https://www.w3.org/Icons/valid-html401" alt="Valid HTML 4.01 Transitional" height="31" width="88"></a>
115
        <a href="https://jigsaw.w3.org/css-validator/check/referer"><img style="border:0;width:88px;height:31px" src="https://jigsaw.w3.org/css-validator/images/vcss" alt="CSS ist valide!"></a>
116
</p>
117
 
118
</body>
119
 
120
</html>