Advertisement
Guest User

Untitled

a guest
May 27th, 2017
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.23 KB | None | 0 0
  1. <?php
  2.  
  3. $username = $_GET['username'];
  4.  
  5. // Create the image
  6. $im = imagecreatefrompng("images/image.PNG");
  7.  
  8. // Create some colors
  9. $white = imagecolorallocate($im, 255, 255, 255);
  10. $grey = imagecolorallocate($im, 128, 128, 128);
  11. $black = imagecolorallocate($im, 0, 0, 0);
  12.  
  13. //SQL connection stuff
  14.  
  15. include "connect.php";
  16.  
  17. $sql = "SELECT * FROM hfslayer WHERE username='".$username."'";
  18. $res = mysql_query($sql)or die(mysql_error());
  19. $row = mysql_fetch_array($res);
  20.  
  21. $totaltime = doubleVal($row['time']);
  22. $totalxp = doubleVal($row['xp']);
  23. $totalprofit = doubleVal($row['profit']);
  24. $totaltask = doubleVal($row['task']);
  25.  
  26. // The text to draw
  27. $s1 = "Hours ran: ";
  28. $ts1 = $s1 . $totaltime;
  29.  
  30. $s2 = "XP gained: ";
  31. $ts2 = $s2 . $totalxp . "K";
  32.  
  33. $s3 = "Profit: ";
  34. $ts3 = $s3 . $totalprofit . "K";
  35.  
  36. $s4 = "Tasks done: ";
  37. $ts4 = $s4 . $totaltask;
  38.  
  39. //ImageFill($im, 0, 0, $grey);
  40. imagestring($im, 60, 10, 60, $ts1, $white);
  41. imagestring($im, 75, 10, 75, $ts2, $white);
  42. imagestring($im, 90, 10, 90, $ts3, $white);
  43. imagestring($im, 105, 10, 105, $ts4, $white);
  44.  
  45. // Set the content-type
  46. header("Content-type: image/png");
  47.  
  48. // Using imagepng() results in clearer text compared with imagejpeg()
  49. imagepng($im);
  50. imagedestroy($im);
  51. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement