fork download
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <title>Generate Signature</title>
  5. </head>
  6.  
  7. <body>
  8. <p>
  9. <?php
  10. $font_dir = 'fonts/';
  11. $image_dir = 'images/';
  12. $picture_dir = 'userpics/';
  13.  
  14. if(isset($_POST['username'])){
  15.  
  16. $error = 0;
  17.  
  18. $username = $_POST['username'];
  19. $avatar = $_POST['avatar'];
  20. $motto = $_POST['motto'];
  21.  
  22. if(strlen($username)>11){
  23. $error = 1;
  24. echo('Username too long!<br>');
  25. }
  26.  
  27. if(strlen($motto)>16){
  28. $error = 1;
  29. echo('Motto too long!<br>');
  30. }
  31.  
  32. if($username==''){
  33. $error = 1;
  34. echo('You must enter a username!<br>');
  35. }
  36.  
  37. if($avatar==''){
  38. $error = 1;
  39. echo('You must choose an avatar!<br>');
  40. }
  41.  
  42. if($motto==''){
  43. $error = 1;
  44. echo('You must enter a motto!<br>');
  45. }
  46.  
  47. if($error ==0){
  48.  
  49. $background = '';
  50. $background .= $image_dir."signature_".$avatar;
  51. $fontpath = $font_dir.'trajanProRegular.ttf';
  52. $username = strtoupper($username);
  53. $avatar = strtoupper($avatar);
  54.  
  55. $img = imagecreatefrompng($background);
  56.  
  57. $font_color = imagecolorallocate($img, 82, 41, 16);
  58.  
  59. imagettftext($img, 36, 0, 177, 102, $font_color, $fontpath, $username);
  60. imagettftext($img, 24, 0, 179, 136, $font_color, $fontpath, $username);
  61.  
  62. $r = rand(0,1000);
  63.  
  64. $pic = $picture_dir.$username.$r.'.png';
  65.  
  66. imagepng($img, $picture_dir);
  67. imagedestroy($img);
  68.  
  69. echo('<img src = "'.$pic.'"/>');
  70. echo('<br/><br/>If you like the image please save it as we do not provide hosting.');
  71. }
  72.  
  73. }
  74.  
  75. ?>
  76. </p>
  77. <p><a href="index.php">Create a new signature</p>
  78. </body>
  79. </html>
Success #stdin #stdout 0.02s 13112KB
stdin
Standard input is empty
stdout
<!DOCTYPE html>
<html>
	<head>
		<title>Generate Signature</title>
	</head>

	<body>
		<p>
				</p>
		<p><a href="index.php">Create a new signature</p>
	</body>
</html>