Jump to content


Photo

unset() [solved]


  • Please log in to reply
1 reply to this topic

#1 foreverhex

foreverhex
  • Members
  • PipPipPip
  • Advanced Member
  • 91 posts

Posted 26 July 2006 - 03:27 PM

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.

<?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' ?>


#2 foreverhex

foreverhex
  • Members
  • PipPipPip
  • Advanced Member
  • 91 posts

Posted 26 July 2006 - 03:31 PM

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




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users