Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- header("Content-type: image/png");
- $username = 'Liam_Walker';
- $password = 'nemeinpwbekommstdunicht';
- $ch = curl_init();
- curl_setopt($ch, CURLOPT_URL, 'http://cp.rpg-city.de/main/org/');
- curl_setopt($ch, CURLOPT_POST, true);
- curl_setopt($ch, CURLOPT_POSTFIELDS, 'name='.$username.'&password='.$password.'&login=true');
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
- $data = curl_exec($ch);
- libxml_use_internal_errors(true);
- $doc = new DOMDocument();
- $doc->loadHTML($data);
- $xpath = new DOMXPath($doc);
- $co = 0;
- $on = 0;
- foreach($xpath->query('//*[@id="memberList"]//tr[td]') as $row) {
- $co++;
- if(strpos($row->nodeValue, ' online') !== FALSE){
- $on++;
- }
- }
- $mainheight = ($co*40)+5;
- $main = imagecreatetruecolor(500, $mainheight);
- //imagesavealpha($main, true);
- $ay = 0;
- $header = imagecreatefrompng("off.png");
- imagestring($header, 30, 10, 10, 'Sicilian Industries ('.$co.' Member, '.$on.' online)', $white);
- imagecopymerge($main, $header, 0, $ay, 0, 0, 500, 40, 100);
- $ay = ($ay+40);
- foreach($xpath->query('//*[@id="memberList"]//tr[td]') as $row) {
- $x = 10;
- $rv = $row->nodeValue;
- imagedestroy($im);
- if(strpos($rv, ' online') !== FALSE){
- imagedestroy($im);
- $im = imagecreatefrompng("on.png");
- imageAlphaBlending($im, true);
- foreach($row->getElementsByTagName("td") as $field) {
- $white = imagecolorallocate($im, 255, 255, 255);
- imagestring($im, 30, $x, 10, $field->nodeValue, $white);
- if($x == 225){
- $x = 435;
- }
- if($x == 10){
- $x = 225;
- }
- }
- }else{
- $im = imagecreatefrompng("off.png");
- imageAlphaBlending($im, true);
- foreach($row->getElementsByTagName("td") as $field) {
- $white = imagecolorallocate($im, 255, 255, 255);
- imagestring($im, 30, $x, 10, $field->nodeValue, $white);
- if($x == 225){
- $x = 320;
- }
- if($x == 10){
- $x = 225;
- }
- }
- }
- $x = 10;
- imagecopymerge($main, $im, 0, $ay, 0, 0, 500, 40, 100);
- $ay = ($ay+42);
- }
- $black = imagecolorallocate($main, 0, 0, 0);
- imagecolortransparent($main, $black);
- imagepng($main);
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement