Advertisement
Guest User

Untitled

a guest
Oct 15th, 2016
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.05 KB | None | 0 0
  1. <?php
  2. header("Content-type: image/png");
  3.  
  4. $username = 'Liam_Walker';
  5. $password = 'nemeinpwbekommstdunicht';
  6. $ch = curl_init();
  7. curl_setopt($ch, CURLOPT_URL, 'http://cp.rpg-city.de/main/org/');
  8. curl_setopt($ch, CURLOPT_POST, true);
  9. curl_setopt($ch, CURLOPT_POSTFIELDS, 'name='.$username.'&password='.$password.'&login=true');
  10. curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  11. $data = curl_exec($ch);
  12. libxml_use_internal_errors(true);
  13. $doc = new DOMDocument();
  14. $doc->loadHTML($data);
  15. $xpath = new DOMXPath($doc);
  16.  
  17. $co = 0;
  18. $on = 0;
  19. foreach($xpath->query('//*[@id="memberList"]//tr[td]') as $row) {
  20.  $co++;
  21.  if(strpos($row->nodeValue, ' online') !== FALSE){
  22.     $on++;
  23.  }
  24. }
  25.  
  26. $mainheight = ($co*40)+5;
  27. $main = imagecreatetruecolor(500, $mainheight);
  28. //imagesavealpha($main, true);
  29. $ay = 0;
  30.  
  31. $header = imagecreatefrompng("off.png");
  32. imagestring($header, 30, 10, 10, 'Sicilian Industries ('.$co.' Member, '.$on.' online)', $white);
  33. imagecopymerge($main, $header, 0, $ay, 0, 0, 500, 40, 100);
  34.  
  35. $ay = ($ay+40);
  36. foreach($xpath->query('//*[@id="memberList"]//tr[td]') as $row) {
  37.     $x = 10;
  38.     $rv = $row->nodeValue;
  39.    
  40.     imagedestroy($im);
  41.     if(strpos($rv, ' online') !== FALSE){
  42.         imagedestroy($im);
  43.         $im = imagecreatefrompng("on.png");
  44.         imageAlphaBlending($im, true);
  45.         foreach($row->getElementsByTagName("td") as $field) {  
  46.             $white = imagecolorallocate($im, 255, 255, 255);
  47.             imagestring($im, 30, $x, 10, $field->nodeValue, $white);
  48.             if($x == 225){
  49.                 $x = 435;
  50.             }
  51.             if($x == 10){
  52.                 $x = 225;
  53.             }
  54.         }
  55.     }else{
  56.         $im = imagecreatefrompng("off.png");
  57.         imageAlphaBlending($im, true);
  58.         foreach($row->getElementsByTagName("td") as $field) {  
  59.             $white = imagecolorallocate($im, 255, 255, 255);
  60.             imagestring($im, 30, $x, 10, $field->nodeValue, $white);
  61.             if($x == 225){
  62.                 $x = 320;
  63.             }
  64.             if($x == 10){
  65.                 $x = 225;
  66.             }
  67.         }
  68.     }
  69.    
  70.     $x = 10;
  71.     imagecopymerge($main, $im, 0, $ay, 0, 0, 500, 40, 100);
  72.     $ay = ($ay+42);
  73.    
  74. }
  75.     $black = imagecolorallocate($main, 0, 0, 0);
  76.     imagecolortransparent($main, $black);
  77.     imagepng($main);
  78. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement