‘;}
if ($ip==”){echo ”;}
else {
if ($TPGpassword==”){echo ‘Please pay Joey money :D’;}
else {
$url = “https://cyberstore.tpg.com.au/your_account/index.php?function=checkaccountusage”;
$useragent=”Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.1) Gecko/20061204 Firefox/2.0.0.1″;
$ch = curl_init();
curl_setopt($ch, CURLOPT_USERAGENT, $useragent);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, ‘0’);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, ‘0’);
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, ‘check_username=’.$TPGusername.”&password=”.$TPGpassword.”&Submit=GO%21″);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$result= curl_exec ($ch);
curl_close ($ch);
$regexp = “Peak.+”;if(preg_match_all(“/$regexp/i”, $result, $matches, PREG_SET_ORDER)){$data = $matches[0][0];}
$Expiry = “Expiry Date.+”;if(preg_match_all(“/$Expiry/i”, $result, $matches, PREG_SET_ORDER)){$Expiry1 = $matches[0][0];}
$Peak = “Peak Download.+”;if(preg_match(“/$Peak/i”, $result, $Peak1))
$OffPeak = “Off-Peak Download.+”;if(preg_match_all(“/$OffPeak/i”, $result, $matches, PREG_SET_ORDER)){$OffPeak1 = $matches[0][0];}
$Peak1 = preg_split(‘
‘, $Peak1[0], -1, PREG_SPLIT_OFFSET_CAPTURE);
// echo ‘
'.$Expiry1.'
'; print_r ($Expiry1); echo '
‘;
$Expiry1 = substr($Expiry1, 17, 99);
$Expiry1Len = strlen($Expiry1)-10;
$Expiry1 = substr($Expiry1, 0, $Expiry1Len);
$Expiry2 = strtotime($Expiry1);
$Quack=strtotime(“+23 hour 59 minutes 59 seconds”,$Expiry2);
if (date(‘O’)==’+1100′) $startdate=strtotime(“-1 hour”,time());
else $startdate = time();
$enddate = $Quack;
$time_period = ( $enddate – $startdate );
$days = 0; $hours = 0;$minutes = 0;$seconds = 0;
$time_increments = array( ‘Days’ => 86400,’Hours’ => 3600,’Minutes’ => 60,’Seconds’ => 1 );
$Peak2 = $Peak1[0][0];
$Peak2 = substr($Peak2, 21, 99);
$Peak2Len = strlen($Peak2)-1;
$Peak2 = substr($Peak2, 0, $Peak2Len);
$OffPeak1 = substr($OffPeak1, 25, 99);
$OffPeak1Len = strlen($OffPeak1)-5;
$OffPeak1 = substr($OffPeak1, 0, $OffPeak1Len);
$PeakPercent = $Peak2/$peaklimit*100;
$OffPeakPercent = $OffPeak1/$offpeaklimit*100;
$SecInMonth = date(t)*86400;
$TimePercent = $time_period/$SecInMonth*100;
$TimePercent1 = 100-$TimePercent;
$PeakUsage = round($PeakPercent,0);
$OffPeakUsage = round($OffPeakPercent,0);
$PeriodHour=date(‘H’);
if (date(‘O’)==’+1100′)$PeriodHour=$PeriodHour-1;
if ($PeriodHour==-1){$PeriodHour=23;}
if ($PeriodHour==’01’ || $PeriodHour==’21’)$Extra=’st’;
elseif ($PeriodHour==’02’ || $PeriodHour==’22’)$Extra=’nd’;
elseif ($PeriodHour==’03’ || $PeriodHour==’23’)$Extra=’rd’;
else $Extra=’th’;
if ($PeriodHour>=’00’ && $PeriodHour<='01'){$Current='Peak';} elseif ($PeriodHour>=’02’ && $PeriodHour<='07'){$Current='Off-Peak';} elseif ($PeriodHour>=’08’ && $PeriodHour<='23'){$Current='Peak';} else {$Current='Joey screwed this up...';} echo "
echo “
JoeyLau.com – “.$TPGusername.”
\n
It’s the “.$PeriodHour.””.$Extra.” hour It’s “.$Current.” now! |
Working: FF, IE Not working: Chrome |
|||||
Peak: | “.$Peak2.” |
|
||||
---|---|---|---|---|---|---|
Off-Peak: | “.$OffPeak1.” |
|
||||
Expiry: | “.$Expiry1.” |
|
||||
Time Left: | $time_span = array(); while( list( $key, $value ) = each( $time_increments )) {$this_value = (int) ( $time_period / $value );$time_period = ( $time_period % $value );$time_span[$key] = $this_value;} while( list( $key, $value ) = each( $time_span )) {print “$value $key, “;} echo ” |
“;}}
?>