Pagina 2 van 2

Geplaatst: 28 aug 2007, 14:41
door devilkin
BBB schreef:heeft er iemand ervaring met phptelemeter en om dit op een windows pc te laten werken?
Het is in principe mogelijk, maar heeft er iemand dit ook gedaan?
Ik heb dit getest op Windows XP, werkte zonder problemen, gebruik makende van de php5 zoals je die vind op http://www.php.net

Geplaatst: 28 aug 2007, 14:42
door devilkin
Nikon schreef:kheb met uw code en PHP GD functies iets gemaakt zodat er nen sig wordt gemaakt met mijne traffiek count

voorbeeldje:

http://www.heretic.be/schedom/sig.php

helaas ask die link als image zet in mijne signature hier opt forum krijgek enkel tekst te zien, wss een restrictie van phpbb

twerkt wel op forums zoals PunBB
Cool. Eventueel geen zin om dit te opensourcen? Dan kan ik - mits jouw goedkeuring - bij in de phptelemeter distributie steken

Geplaatst: 28 aug 2007, 14:47
door Nikon
devilkin schreef:
Nikon schreef:kheb met uw code en PHP GD functies iets gemaakt zodat er nen sig wordt gemaakt met mijne traffiek count

voorbeeldje:

http://www.heretic.be/schedom/sig.php

helaas ask die link als image zet in mijne signature hier opt forum krijgek enkel tekst te zien, wss een restrictie van phpbb

twerkt wel op forums zoals PunBB
Cool. Eventueel geen zin om dit te opensourcen? Dan kan ik - mits jouw goedkeuring - bij in de phptelemeter distributie steken
sure, tenige nadeel hieraan is dat ge cron moet draaien om da ding te laten updaten, da kan wel aangepast worden natuurlijk naar iets beters om te updaten

Geplaatst: 28 aug 2007, 14:50
door devilkin
Nikon schreef:
devilkin schreef:
Nikon schreef:kheb met uw code en PHP GD functies iets gemaakt zodat er nen sig wordt gemaakt met mijne traffiek count

voorbeeldje:

http://www.heretic.be/schedom/sig.php

helaas ask die link als image zet in mijne signature hier opt forum krijgek enkel tekst te zien, wss een restrictie van phpbb

twerkt wel op forums zoals PunBB
Cool. Eventueel geen zin om dit te opensourcen? Dan kan ik - mits jouw goedkeuring - bij in de phptelemeter distributie steken
sure, tenige nadeel hieraan is dat ge cron moet draaien om da ding te laten updaten, da kan wel aangepast worden natuurlijk naar iets beters om te updaten
Mja, ik zou er een publisher van maken zodat ik het kan 'inpluggen' in mijn huidige architectuur. Dan kan het als het ware wel on-demand - evenwel niet aan te raden, uwe server gaat dat niet tof vinden :p

Geplaatst: 28 aug 2007, 14:53
door meon
Moet ge een soort caching inbouwen die eerst controleert of de gegenereerde cache niet ouder is dan X aantal uren/minuten. Zal sneller zijn dan telkens de code op te halen. Dan hebt ge de vertraging maar 1x per zoveel uren/minuten ...

Geplaatst: 28 aug 2007, 14:55
door Nikon
devilkin schreef: Mja, ik zou er een publisher van maken zodat ik het kan 'inpluggen' in mijn huidige architectuur. Dan kan het als het ware wel on-demand - evenwel niet aan te raden, uwe server gaat dat niet tof vinden :p
kzal het eerst een beke dynamischer make zodat ge het makkelijk in uw project kunt steken, kheb et ni gebouwd me het doel dynamisch te zijn, maar da vraagt amper werk
meon schreef:Moet ge een soort caching inbouwen die eerst controleert of de gegenereerde cache niet ouder is dan X aantal uren/minuten. Zal sneller zijn dan telkens de code op te halen. Dan hebt ge de vertraging maar 1x per zoveel uren/minuten ...
inderdaad daar dacht ik ook aan ter vervanging

Geplaatst: 28 aug 2007, 16:05
door Nikon
Vereisten:
- GD Image functions voor PHP
- Beschrijfbaar traffic.txt bestand (in dezelfde map als script) (chmod 777)
- Dommel signature genaamd als sig.png (in dezelfde map als script)
- visitor1.ttf font van userbars.be (in dezelfde map als script)

Voorbeeld:
http://www.heretic.be/schedom/sig.php

Code: Selecteer alles

<?php
/*
    Copyright (C) 2007 Koen Vandenabeele

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
	
	Credits:
	- curl fetching code by Devil_Kin
*/
// Configuration
$username = 'username'; // aanpassen
$password = 'pass'; // aanpassen

// Don't touch
$clientid = 0;
$servid = 0;

function filter($string) {
	$items = array('<br>','</br>','<b>','</b>','<i>','</i>',"onClick=\"MM_openBrWindow2('","','webadmin','schedom')\"><img");
	foreach ($items as $item) {
		$string = str_replace($item,' ',$string);
	}

	return $string;
}
function clean($array) {
	$newarray = array();
	foreach ($array as $item) {
		if ($item!=' '&&$item!='') {
			array_push($newarray,$item);
		}
	}
	return $newarray;
}

function calculate() {
	global $username,$password,$clientid,$servid;

	$ch = curl_init();
	// login
	$url = "https://crm.schedom-europe.net/login.php?username=$username&password=$password&op=login";
	curl_setopt($ch, CURLOPT_URL, $url);
	curl_setopt($ch, CURLOPT_HEADER, 1);
	curl_setopt($ch, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']);
	curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
	curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
	curl_setopt($ch, CURLOPT_COOKIEJAR, $cookiejar);
	curl_setopt($ch, CURLOPT_COOKIEFILE, $cookiejar);
	curl_setopt($ch, CURLOPT_POST, 1);
	curl_setopt($ch, CURLOPT_POSTFIELDS, $vars);
	curl_exec($ch);
	
	// get servid & clientid
	$newurl = 'https://crm.schedom-europe.net/user.php?op=view&tile=mypackages';
	curl_setopt($ch, CURLOPT_COOKIEJAR, $cookiejar);
	curl_setopt($ch, CURLOPT_URL, $newurl);
	curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)'); // IE6
	curl_setopt($ch, CURLOPT_HEADER, false);
	curl_setopt($ch, CURLOPT_COOKIESESSION, true);
	curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
	$buffer = curl_exec($ch);
	
	$buffer = explode("\n",$buffer);
	foreach ($buffer as $line) {
		if (strstr($line,'dslinfo')) {
			$line = filter($line);
			$line = explode(' ',$line);
			$line = clean($line);
			$url = parse_url($line[2]);
			$query = $url['query'];
			$query = explode('&',$query);
			$query[0] = explode('=',$query[0]);
			$query[2] = explode('=',$query[2]);
			$servid = $query[0][1];
			$clientid = $query[2][1];
			break;
		}
	}
	
	// count
	$newurl = "https://crm.schedom-europe.net/include/scripts/linked/dslinfo/dslinfo.php?servid=$servid&password=$password&client_id=$clientid";
	curl_setopt($ch, CURLOPT_COOKIEJAR, $cookiejar);
	curl_setopt($ch, CURLOPT_URL, $newurl);
	curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)'); // IE6
	curl_setopt($ch, CURLOPT_HEADER, false);
	curl_setopt($ch, CURLOPT_COOKIESESSION, true);
	curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
	$buffer = curl_exec($ch);
	
	$buffer = explode("\n",$buffer);
	foreach ($buffer as $line) {
		if (strstr($line,'downloaded in broadband:')) {
			$line = filter($line);
			$line = explode(' ',$line);
			$line = clean($line);
			$downloaded = $line[5];
			$total = $line[21]+$downloaded;
			break;
		}
	}
	
	$fp = fopen('traffic.txt','w');
	fputs($fp,time()." $downloaded $total");
	fclose($fp);
}

function lastupdated() {
	if (file_exists('traffic.txt')) {
		$fp = fopen('traffic.txt','r');
		$buffer = fgets($fp);
		$buffer = explode(' ',$buffer);
		return $buffer[0];
		fclose($fp);
	} else {
		return 0;
	}
}

if ((time()-lastupdated())>600) {
	calculate();
}

// ------------- show image

header("Content-type: image/png");

// initialize
$im = imagecreatefrompng("./sig.png");

$white = imagecolorallocate($im, 255, 255, 255);
$black = imagecolorallocate($im, 0, 0, 0);

// add text
$buffer = file_get_contents("./traffic.txt");
$buffer = explode(' ',$buffer);
imagettftext($im,10,0,140,14,$black,"./visitor1.ttf",$buffer[1]." / ".$buffer[2]);

// show
imagepng($im);
imagedestroy($im);

?>

Geplaatst: 28 aug 2007, 16:42
door devilkin
Overgenomen in phptelemeter, in een binnenkort beschikbare build near you ;)

Geplaatst: 23 maa 2008, 22:03
door devilkin
Eindelijk eens werk van gemaakt...

svn commit 258

Geplaatst: 24 maa 2008, 01:52
door gr4vity
Ik heb ineens mijn eigen versie gemaakt van het script van Nikon :)

Re: simpele volumecheck php

Geplaatst: 28 okt 2009, 21:38
door meon
Misschien phpTelemeter iets meer PHP5-compatibel maken?

Code: Selecteer alles

PHP Deprecated:  Call-time pass-by-reference has been deprecated in C:\Scripts\Twitter\phptelemeter-1.35\phptelemeter.php on line 43
PHP Deprecated:  Call-time pass-by-reference has been deprecated in C:\Scripts\Twitter\phptelemeter-1.35\phptelemeter.php on line 43
PHP Deprecated:  Call-time pass-by-reference has been deprecated in C:\Scripts\Twitter\phptelemeter-1.35\phptelemeter.php on line 98
PHP Deprecated:  Call-time pass-by-reference has been deprecated in C:\Scripts\Twitter\phptelemeter-1.35\phptelemeter.inc.php on line 325
PHP Deprecated:  Comments starting with '#' are deprecated in C:\Documents and Settings\User/.phptelemeter.cache on line 1 in C:\Scripts\Twitter\phptelemeter-1.35\phptelemeter.inc.php on line 916
phptelemeter - version 1.35
PHP Notice:  Undefined variable: usedPos in C:\Scripts\Twitter\phptelemeter-1.35\modules\parser_skynet_web.inc.php on line 81
PHP Notice:  Undefined index:  in C:\Scripts\Twitter\phptelemeter-1.35\modules\parser_skynet_web.inc.php on line 81
PHP Notice:  Undefined offset: 1 in C:\Scripts\Twitter\phptelemeter-1.35\modules\parser_skynet_web.inc.php on line 82
PHP Notice:  Undefined offset: 2 in C:\Scripts\Twitter\phptelemeter-1.35\modules\parser_skynet_web.inc.php on line 85
PHP Notice:  Undefined variable: remainingPos in C:\Scripts\Twitter\phptelemeter-1.35\modules\parser_skynet_web.inc.php on line 88
PHP Notice:  Undefined index:  in C:\Scripts\Twitter\phptelemeter-1.35\modules\parser_skynet_web.inc.php on line 88
PHP Notice:  Undefined offset: 2 in C:\Scripts\Twitter\phptelemeter-1.35\modules\parser_skynet_web.inc.php on line 89
PHP Warning:  date(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'Europe/Paris' for '1.0/no DST' instead in C:\Scripts\Twitter\phptelemeter-1.35\modules\parser_skynet_web.inc.php on line 92
PHP Warning:  date(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'Europe/Paris' for '1.0/no DST' instead in C:\Scripts\Twitter\phptelemeter-1.35\modules\parser_skynet_web.inc.php on line 92
PHP Warning:  mktime(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'Europe/Paris' for '1.0/no DST' instead in C:\Scripts\Twitter\phptelemeter-1.35\modules\parser_skynet_web.inc.php on line 92
PHP Warning:  date(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'Europe/Paris' for '1.0/no DST' instead in C:\Scripts\Twitter\phptelemeter-1.35\modules\parser_skynet_web.inc.php on line 92
PHP Warning:  mktime(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'Europe/Paris' for '1.0/no DST' instead in C:\Scripts\Twitter\phptelemeter-1.35\phptelemeter.inc.php on line 759
PHP Warning:  date(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'Europe/Paris' for '1.0/no DST' instead in C:\Scripts\Twitter\phptelemeter-1.35\phptelemeter.inc.php on line 759
PHP Warning:  date(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'Europe/Paris' for '1.0/no DST' instead in C:\Scripts\Twitter\phptelemeter-1.35\phptelemeter.inc.php on line 759
PHP Warning:  date(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected ' Europe/Paris' for '1.0/no DST' instead in C:\Scripts\Twitter\phptelemeter-1.35\phptelemeter.inc.php on line 759
PHP Warning:  mktime(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezo
ne_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected
 'Europe/Paris' for '1.0/no DST' instead in C:\Scripts\Twitter\phptelemeter-1.35\phptelemeter.inc.php on line 759
PHP Warning:  Division by zero in C:\Scripts\Twitter\phptelemeter-1.35\phptelemeter.inc.php on line 696
PHP Warning:  date(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone
_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected '
Europe/Paris' for '1.0/no DST' instead in C:\Scripts\Twitter\phptelemeter-1.35\modules\publisher_plaintext.inc.php on line 68
Fetching information for bk000000...done!

Usage statistics on 28/10/2009
------------------------------
Quota used: [                    ] -     0 MiB ( 0%)
Werkt de parser eigenlijk nog na die 'aanpassingen' aan de Selfcare/e-Services ?
Ter info:

Code: Selecteer alles

C:\Scripts\Twitter\phptelemeter-1.35>php --version
PHP 5.3.0 (cli) (built: Jun 29 2009 21:44:56)
Copyright (c) 1997-2009 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2009 Zend Technologies