Jump to content

[SOLVED] Unset() variables


ballhogjoni

Recommended Posts

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);
}
?>

Link to comment
https://forums.phpfreaks.com/topic/56894-solved-unset-variables/
Share on other sites

Archived

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

×
×
  • Create New...

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.