display.php
Posted: Sun Dec 09, 2018 7:34 pm
Script URL:
Version of script: 2.1.2
Hosting company:
URL of phpinfo.php: https://reseauk.info/neuf/phpinfo.php
URL of session_test.php:
What terms did you try when SEARCHING for a solution: display.php, ccount
Hello everyone,
I test your smithy script ccounter and do not understand why the php of the page display.php seems not to be interpreted like your own website at this hour.
https://www.phpjunkyard.com/ccount/display.php
(Firefox and Chrome whiths Ubuntu)
Having found no answer on your forum, I ask you the question here.
Sorry, I do not speak English very well (I'm French).
Version of script: 2.1.2
Hosting company:
URL of phpinfo.php: https://reseauk.info/neuf/phpinfo.php
URL of session_test.php:
What terms did you try when SEARCHING for a solution: display.php, ccount
Hello everyone,

I test your smithy script ccounter and do not understand why the php of the page display.php seems not to be interpreted like your own website at this hour.
https://www.phpjunkyard.com/ccount/display.php
(Firefox and Chrome whiths Ubuntu)
Having found no answer on your forum, I ask you the question here.
Sorry, I do not speak English very well (I'm French).

Code: Select all
var ccount={'1':{c:1,u:1},'':{}};
// Outputs a formatted number to the browser
function ccount_write(sum)
{
document.write(sum.formatThousands('US'));
}
// Displays total clicks for an ID
function ccount_display(id)
{
ccount_write(ccount[id]['c']);
}
// Displays unique clicks for an ID
function ccount_unique(id)
{
ccount_write(ccount[id]['u']);
}
// Sums total clicks for IDs passed as arguments
function ccount_sum()
{
var sum = 0;
for (var i=0; i<arguments.length; i++) { // >
if (typeof ccount[arguments[i]]!=='undefined') {
sum += ccount[arguments[i]]['c'];
}
}
ccount_write(sum);
}
// Sums unique clicks for IDs passed as arguments
function ccount_sum_unique()
{
var sum = 0;
for (var i=0; i<arguments.length; i++) { // >
if (typeof ccount[arguments[i]]!=='undefined') {
sum += ccount[arguments[i]]['u'];
}
}
ccount_write(sum);
}
// Displays total clicks count
function ccount_total()
{
var sum = 0;
for (var key in ccount) {
if (ccount.hasOwnProperty(key) && key !== '') {
sum += ccount[key]['c'];
}
}
ccount_write(sum);
}
// Displays total unique clicks count
function ccount_total_unique()
{
var sum = 0;
for (var key in ccount) {
if (ccount.hasOwnProperty(key) && key !== '') {
sum += ccount[key]['u'];
}
}
ccount_write(sum);
}
// Adds a thousands separator to a number
Number.prototype.formatThousands = function(notation)
{
var n = this, separator = "";
switch (notation)
{
case "US":
separator = ",";
break;
case "UK":
separator = ".";
break;
case "FR":
separator = " ";
break;
default:
return n;
}
n = parseInt(n) + "";
j = (j = n.length) > 3 ? j % 3 : 0;
return (j ? n.substr(0, j) + separator : "") + n.substr(j).replace(/(\d{3})(?=\d)/g, "$1" + separator);
}