Page 1 of 1

display.php

Posted: Sun Dec 09, 2018 7:34 pm
by jack31
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). :)

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

Re: display.php

Posted: Mon Dec 10, 2018 8:14 am
by Klemen
Unfortunately I do not understand your question.

Are you trying to display the number of clicks on your website? Did you follow instructions in Admin panel > Instructions > Displaying click count on your website?

Re: display.php

Posted: Mon Dec 10, 2018 11:38 pm
by jack31
Good evening and thank you Klemen for your answer.

I thought the display.php page publicly displayed the list of links but it seems that I'm wrong. : - //

For information, I encountered difficulties to run the script on my server that may be experiencing transient problems (or is good on another server).

Everything is OK

Nice script my faith. :)

Ps: Sorry for the translation

---> French
Bonsoir et merci Klemen pour votre réponse.

Je pensais que la page display.php affichait publiquement la liste des liens mais il semble que je me trompe. :-//

Pour information, j'ai rencontré des difficultés à faire fonctionner le script sur mon serveur qui peut-être rencontre des problèmes passagers.

Tout est OK sur un autre serveur.

Joli script ma foi.