ballhogjoni Posted June 23, 2007 Share Posted June 23, 2007 How do i unset these variables? ok this is my code <?php $filename = $_POST['file_name']; $filecontent = $_POST['filecontent']; if (!empty($filecontent) && !empty($filename)) { $uid = $filename; include('config.php'); $query = mysql_query("SELECT * FROM popular_cards") or die(mysql_error()); /*while ($row = mysql_fetch_array($query)) { echo "ID: ".$row["ID"]." & the code is: ".$row["code"]."<br>"; }*/ $handle = fopen("$filename", "a+") or die("Failed to create ".$filename.", check the file's CHMOD permissions."); fclose($handle); $query1 = "INSERT INTO popular_cards (code, uid) VALUES ('$filecontent','$uid')"; mysql_query($query1); if (is_writable($filename)) { if (!$handle1 = fopen($filename, 'a+')) { echo "Cannot open file ($filename)"; exit; } // Write $somecontent to our opened file. if (fwrite($handle1, $filecontent) === FALSE) { echo "Cannot write to file ($filename)"; exit; } echo "<center><font color=\"red\">Success, wrote the script to file ($filename)</font></center>"; fclose($handle1); } else { echo "The file $filename is not writable"; } } if (!empty($filecontent) && !empty($filename)) { unset($_POST['file_name']); unset($_POST['filecontent']); unset($filename); unset($filecontent); } ?> Quote Link to comment Share on other sites More sharing options...
Wuhtzu Posted June 23, 2007 Share Posted June 23, 2007 I don't think it's possible to unset them... Why do you want to unset them? Quote Link to comment Share on other sites More sharing options...
cooldude832 Posted June 23, 2007 Share Posted June 23, 2007 you can't "unset" the post ones i do believe nor can you "set" anything that is super global. Quote Link to comment Share on other sites More sharing options...
ballhogjoni Posted June 24, 2007 Author Share Posted June 24, 2007 What can you do about this problem then? Quote Link to comment Share on other sites More sharing options...
soycharliente Posted June 24, 2007 Share Posted June 24, 2007 You could use header(location:) to redirect the page to itself without posting anything. Quote Link to comment Share on other sites More sharing options...
cooldude832 Posted June 24, 2007 Share Posted June 24, 2007 why do you need them unset, instead why don't you just add a GET var to the URL thats says File failed instead Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.