Jump to content

Archived

This topic is now archived and is closed to further replies.

foreverhex

unset() [solved]

Recommended Posts

This script is supposed to turn someones text into a gif file and then show them their info. The issue Im having is they can hit refresh a million and 2 times and keep making these image which in the long run is going to screw up the database. Now the varibles I want unset were made in a session, because the form gets checked over two different pages. I hope thats not the issue, but here is my code.

[code]
<?php
$page_name = ' :: Upload Art';
include 'top.php' ?>

<!-------BODY-------->
<table class="fullbody" align=left valign=top>
<tr valign=top>
<td align=left>

<?php

//Name the file for saving later
$randomnum = md5(mktime());
$filename = $randomnum . $artname . '.gif';

if(isset($text) || ($artname)) {
$newtext = wordwrap($text, 60, "\n", 1);
$im = imagecreate (525, 400);
$bgcolor = imagecolorallocate($im, 17, 0, 0);
$fontcolor = ImageColorAllocate ($im, 255, 255, 255);
imagecolortransparent($im, $bgcolor);
ImageTTFText ($im, 11, 0, 1, 20, $fontcolor, "arial.ttf",
"$newtext");
imagegif($im, "art/" . $filename);
imagedestroy($im);

echo '<img src="art/' . $filename . '" width=250></td>
<td align=left><b>You\'re Art upload was a success! Thanks for adding your visions to the Syblings Family! The tumbnail to the left does not reflect how you poem will accually look.</b><br /><br />
<b>Title:</b> ' . $artname . '<br />
<b>Medium:</b> Poetry<br />
<b>Description:</b> ' . $description . '<br /><br />
<a href="art.php">Continue to see you art.</a>';
} else {

echo '<br><center><b>There was an error uploading the file, please <a href="/aeart.php">try again</a>!</b></center><br>';

}

//unset the varibles so they cant screw anything up
unset($artname, $text, $description);

?>

</td>
</tr>
</table>
<!-------/BODY-------->



</td>
</tr>
</table>

<?php include 'bottom.html' ?>[/code]

Share this post


Link to post
Share on other sites
nevermind. It was the seesion thing. I needed to change unset($artname, $text, $description); to unset($_SESSION['text']...ect

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.