Ctrl+v

Gestart doorAzdin1.270 reacties19.956 weergaven

1.271 berichten · pagina 59 van 85

Berichten
15.958
Reputatie
1
Punten
0,00
Lid sinds
Laatst gezien
15 November 2016
0
Berichten
10.421
Reputatie
4
Punten
0,00
Lid sinds
Laatst gezien
??
0
Berichten
4.213
Reputatie
0
Punten
0,02
Lid sinds
Laatst gezien
Spoiler tonen
Codeblok (voorbeeld.php):
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


class Stat {
private $data;///
function __construct($tot,&$totaltime,$precision=2) {
$this->data[total] = $tot;
$this->calculate($totaltime);
$this->format($precision);
}
function
__get($v) {
return $this->data[$v];
}

private function calculate(&$time) {
$this->data[persecond] = $this->total/$time;
$this->data[perminute] = $this->total/($time/60);
$this->data[perhour] = $this->total/($time/3600);
$this->data[perday] = $this->total/($time/86400);
}

private function format(&$precision) {
$zero = number_format($this->data[total],0);
array_walk($this->data,function(&$value,$key) use ($precision) {
$value = number_format($value,$precision);
});

$this->data[total] = $zero;
}
}

/**
An alternative to whatever the WhatPulse website script offers. To be honest this was written before I discovered that WhatPulse has their own script ready to be deployed. Nonetheless, this code does appear to work and should suffice for most purposes.
@brief retrieves data from the whatpulse web API
@author Roy YiWei Zheng
@version 0.1
*/

class WhatPulse {

private $id;//whatpulse id
private $xml;//xml obtained from whatpulse
private $clicks;///
private $keys;///
private $minutes;///
private $hours;///
private $days;///
private $network;///
private $networkratio;///
private $download;///
private $upload;///
private $uptime;///
private $lastpulse;///
private $lastpulseago;///
private $_retrievable = array(id,totalclicks,totalkeys,minutes,hours,days);///
private $built;///
/**
@param $id the WhatPulse ID of the user
@brief constructs the object using the passed ID, simultaneously retrieving the necessary data
*/

public function __construct($id) {
$this->id = $id;
$this->getXML();
$this->perform();
}

/**
@brief magic function to retrieve data with $myWhatPulse->totalclicks;
*/

public function __get($name) {
switch($name) {
case
name:
return $this->xml->AccountName;
case
rank:
return $this->xml->Rank;
case
id:
return $this->xml->UserID;
case
pulses:
return $this->xml->Pulses;
}

if(!in_array($name,$this->_retrievable))
throw new Exception(Variable .$name. does not exist in class WhatPulse.);
return $this->$name;
}

/**
@brief formats the raw data into a readable string, also performs calculations
*/

private function perform() {
//time calculation
$totaltime = time()-strtotime($this->xml->DateJoined);
$minutes = $totaltime/60;
$hours = $minutes/60;
$days = $hours/24;
$this->minutes = number_format($minutes,2);
$this->hours = number_format($hours,2);
$this->days = number_format($days,2);

$this->clicks = new Stat($this->xml->Clicks+0.0,$totaltime);
$this->keys = new Stat($this->xml->Keys+0.0,$totaltime);
//lastpulse
$temp = date_default_timezone_get();//temporarily store current timezone
date_default_timezone_set(Europe/Belgrade);//belgrade is where server located
$datetime = new DateTime($this->xml->LastPulse);//create new DT from belgrade time
$datetime->setTimezone(new DateTimeZone($temp));//convert belgrade time to current time

date_default_timezone_set($temp);//reset timezone back to default

$this->lastpulse = $datetime->getTimestamp();//set lastpulse unix timestamp
$this->lastpulseago = time()-$this->lastpulse;//get time diff between now and lastpulse
//echo $datetime->format(Y-m-d H:i:s).::::.$this->xml->LastPulse;
//-----------------------------------------------------------------------------
//network

$inception = 1356156000;///
$inception = time()-$inception;
$this->network = number_format($this->xml->DownloadMB+$this->xml->UploadMB,2);
$this->networkratio = number_format($this->xml->DownloadMB/$this->xml->UploadMB,2);
if($inception > $totaltime)
$inception = $totaltime;
$this->download = new Stat($this->xml->DownloadMB+0.0,$inception);
$this->upload = new Stat($this->xml->UploadMB+0.0,$inception);

$this->uptime = number_format($this->xml->UptimeSeconds/3600,2);
}

/**
@brief grabs the data from the WhatPulse API, setting the objects SimpleXMLElement
*/

private function getXML() {
$url = http://whatpulse.org/api/user.php?format=xml&user=dj301;

$f = fopen($url.$this->id,r);
if($f === false) {
throw new Exception(Could not open .$url.$this->id.. Please check your internet connection);
}

$content = stream_get_contents($f);
//echo $content;
$this->xml = new SimpleXMLElement($content);
//var_dump($this->xml);
}
/**
@brief useful for debugging, prints out all class data
*/

function printStats() {
echo Account Name: .$this->xml->AccountName. (id .$this->xml->UserID.")n";
echo $this->xml->Pulses. pulses (last pulsed .number_format($this->lastpulseago/3600,2). hours ago .date(n/j/y @ g:iA,$this->lastpulse).")n";
echo Key presses: .$this->keys->total. (ranked .$this->xml->Ranks->Keys.")n";
echo "t".$this->keys->perminute./minute."nt".$this->keys->perhour./hour."nt".$this->keys->perday./day."n";
echo Mouse clicks: .$this->clicks->total. (ranked .$this->xml->Ranks->Clicks.")n";
echo "t".$this->clicks->perminute./minute."nt".$this->clicks->perhour./hour."nt".$this->clicks->perday./day."n";
echo Total network operations: .$this->network. MBytes (.$this->networkratio. D/U ratio.")n";
echo "t".$this->download->total. MBytes downloaded (ranked .$this->xml->Ranks->Download.")n";
echo "tt".$this->download->perminute./minute."n";
echo "tt".$this->download->perhour./hour."n";
echo "tt".$this->download->perday./day."n";
echo "t".$this->upload->total. MBytes uploaded (ranked .$this->xml->Ranks->Upload.")n";
echo "tt".$this->upload->perminute./minute."n";
echo "tt".$this->upload->perhour./hour."n";
echo "tt".$this->upload->perday./day."n";
echo Total uptime: .$this->uptime." hoursn";
echo Date joined: .$this->xml->DateJoined. (.$this->days. days)."n";

}

}


?>
0
Berichten
5
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
logincheck();
bancheck();
jailcheck();
?>
0
Berichten
3.001
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Gratis internet in de trein
Mobiele versie
Nederlands
English
Maak verbinding met Internet en accepteer voorwaarden
NS verwerkt persoonsgegevens voor geen enkel ander doel dan het tot stand brengen van de dienst internet in de trein. Deze gegevens worden weer verwijderd zodra de sessie geëindigd is of als u de trein heeft verlaten. Ik ga hiermee akkoord. (Let op de beveiliging van dataverkeer tegen onbevoegde kennisneming.)

Gebruikersvoorwaarden
Privacy Statement

Veelgestelde vragen: Gratis internet in de trein

Hoe kan ik veilig gebruik maken van gratis internet in de trein?
Wat is gratis internet in de trein?
Hoe kan ik gebruik maken van gratis internet in de trein?
Meer vragen en antwoorden

U bevindt zich in de intercity naar:
Vlissingen
18:43
Let op: er zijn meldingen over dit traject

Het volgende station is: Roosendaal

Aankomst Vertrek Station Spoor Details
18:49 18:52 Roosendaal 4b
U kunt hier overstappen naar:
19:20 Etten-Leur 1 Intercity
Alle actuele vertrektijden voor Roosendaal
19:01 19:01 Bergen op Zoom
19:10 19:10 Rilland-Bath
19:14 19:14 Krabbendijke
19:19 19:19 Kruiningen-Yerseke
19:25 19:25 Kapelle-Biezelinge
19:31 19:32 Goes
19:41 19:41 Arnemuiden
19:46 19:46 Middelburg
19:50 19:50 Vlissingen Souburg
19:54 Vlissingen

Plan uw volgende reis met onze reisplanner
Bekijk de actuele vertrektijden
Voeg deze pagina toe aan mijn favorieten

--

Kennelijk per ongeluk gekopieerd clown
0
Berichten
5.274
Reputatie
1
Punten
0,01
Lid sinds
Laatst gezien

Eindhoven, Nederland

Fish finger
0
Berichten
16.500
Reputatie
1
Punten
0,00
Lid sinds
Laatst gezien
natrium aluminium hydroxide
0
Rik

Lid

Berichten
18.393
Reputatie
0
Punten
0,04
Lid sinds
Laatst gezien
eau de toilette
0
Berichten
35.796
Reputatie
1
Punten
0,00
Lid sinds
Laatst gezien
bestuurdersaansprakelijkheidsverzekering
0
Berichten
16.500
Reputatie
1
Punten
0,00
Lid sinds
Laatst gezien
39 28-09-16
0

Jouw reactie

Deel je idee, stel een vraag of help een ander verder.

Editor laden…

Praat mee met de One2xs-community.

Inloggen om te reageren