Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Your original code throws <code>Undefined variable:</code> errors on all your variables, you should always set variables before using them, this includes $_POST variables, you should enable error reporting <code>error_reporting(E_ALL)</code> when developing and then change too <code>error_reporting(0)</code> when you upload to a live site then your see the errors that are stopping the processing/updating of the image.</p> <p>Ive fixed your code with some changes:</p> <pre><code>&lt;?php header("Cache-Control: no-cache, must-revalidate"); //remind the browser not to cache the image header("Expires: Sat, 26 Jul 1997 05:00:00 GMT"); error_reporting(E_ALL); //Change to 0 when live ?&gt; &lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt; &lt;html xmlns="http://www.w3.org/1999/xhtml"&gt; &lt;head&gt; &lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8" /&gt; &lt;title&gt;Tracker&lt;/title&gt; &lt;/head&gt; &lt;body bgcolor="#4b7bb2"&gt; &lt;font face="arial"&gt; &lt;center&gt; &lt;?php $password=''; //pre-set thos vars $status=''; $server=''; $room=''; if(isset($_POST['submit'])){ $password = $_POST['password']; if($password == "1234"){ $status = $_POST['status']; $server = $_POST['server']; $room = $_POST['room']; $im = imagecreatefrompng("in.png"); $colour = imagecolorallocate($im, 255, 255, 255); $font = 'BurbankBigRegular-Bold.ttf'; // imagettftext($im, 20, 0, 100, 68, $colour, $font, $status); imagettftext($im, 20, 0, 95, 95, $colour, $font, $server); imagettftext($im, 20, 0, 85, 127, $colour, $font, $room); imagepng($im,'out.png'); imagedestroy($im); $result="&lt;b&gt; Updated! &lt;/b&gt;"; }else{ $result="&lt;p&gt;&lt;b&gt;Incorrect Password!&lt;/b&gt;&lt;/p&gt;"; } } echo (isset($result))?$result:''; ?&gt; &lt;form action="" method="POST" /&gt; &lt;p&gt;Password: &lt;input type="password" name="password" value="&lt;?php echo htmlentities($password); ?&gt;"/&gt;&lt;/p&gt; &lt;p&gt;Status: &lt;select name="status"&gt; &lt;option value=""&gt;Select...&lt;/option&gt; &lt;?php echo "&lt;option value=\"Online\""; if($status=='Online'){ echo" selected=\"selected\"";} echo"&gt; Online&lt;/option&gt;\n"; echo "&lt;option value=\"Offline\""; if($status=='Offline'){ echo" selected=\"selected\"";} echo"&gt; Offline&lt;/option&gt;\n"; echo "&lt;option value=\"Tracking...\""; if($status=='Tracking...'){ echo" selected=\"selected\"";} echo"&gt; Tracking&lt;/option&gt;\n"; ?&gt; &lt;/select&gt; &lt;/p&gt; &lt;p&gt;Server: &lt;input type="text" name="server" value="&lt;?php echo htmlentities($server); ?&gt;"/&gt;&lt;/p&gt; &lt;p&gt;Room: &lt;input type="text" name="room" value="&lt;?php echo htmlentities($room); ?&gt;"/&gt;&lt;/p&gt; &lt;p&gt;&lt;input type="submit" name="submit"/&gt;&lt;/p&gt; &lt;/form&gt; &lt;p&gt;Tracker:&lt;/p&gt; &lt;p&gt;&lt;img src="out.png" alt="Tracker" /&gt;&lt;/P&gt; &lt;a href="http://ClubPenguincheatsy.com/cptrackers"s&gt;Back to Tracker Dashbaord&lt;/a&gt; &lt;/center&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>Notice the <code>htmlentities()</code> &amp; the non use of <code>$_SERVER['PHP_SELF']</code> in the form.</p> <p><strong>EDIT:</strong> Taken from <a href="http://php.net/manual/en/function.imagettftext.php" rel="nofollow">http://php.net/manual/en/function.imagettftext.php</a></p> <blockquote> <p>The path to the TrueType font you wish to use.</p> <p>Depending on which version of the GD library PHP is using, when fontfile does not begin with a leading / then .ttf will be appended to the filename and the library will attempt to search for that filename along a library-defined font path.</p> <p>When using versions of the GD library lower than 2.0.18, a space character, rather than a semicolon, was used as the 'path separator' for different font files. Unintentional use of this feature will result in the warning message: Warning: Could not find/open font. For these affected versions, the only solution is moving the font to a path which does not contain spaces.</p> <p>In many cases where a font resides in the same directory as the script using it the following trick will alleviate any include problems.</p> </blockquote> <pre><code>&lt;?php // Set the enviroment variable for GD putenv('GDFONTPATH=' . realpath('.')); // Name the font to be used (note the lack of the .ttf extension) $font = 'BurbankBigRegular-Bold'; ?&gt; </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload