i want to delete everything in the file so to make it easy for myself, i made it delete the file, then rewrite it... so why wont it work?
PHP Code:<?php include('mysql.php'); ?>
<?
$username = $_COOKIE['ID_my_site'];
$wordfile = "chatbox.txt";
$word = $_POST['word'];
$contentword = file_get_contents($ipfile);
$cword = explode("\r\n",$contentword);
if(!$wordfile) {die("No such file. Go <a href=\"chat.php\">back</a>.");};
$in = array_search($username, $cword);
$pass = $_COOKIE['Key_my_site'];
$check = mysql_query("SELECT * FROM users WHERE username = '$username'") or die(mysql_error());
while($info = mysql_fetch_array( $check )) {
if(isset($word)) {
if($username != "Demonicman"){
die('You are not an admin!');
};
/* Delete File */
unlink($wordfile);
/* Rewrite File */
$FileHandle = fopen($wordfile, 'w') or die("can't create file");
fclose($FileHandle);
/* Echo Out continue */
echo '<a href="chat.php">Continue</a>';
};
}
?>




Reply With Quote

Bookmarks