I'm having issues writing to the file VarLog.txt, It's not read only (In properties), I'm trying to write the Variable or SQL Query as a string in the logs file that I created, I also wrote a check to see if VarLog exists, and if it doesn't, make it. Here's the Code
if (!file_exists( "VarLog.txt")) {
$fh = fopen("VarLog.txt", 'w') or die("can't open file");
fclose($fh);
}
function anti_injection($sql) {
$fp = fopen("VarLog.txt", "a+");
$sql = preg_replace(sql_regcase("/(from|select|insert|delete|where|drop table|show tables|#|\*|--|\\\\)/"),"",$sql);
$sql = trim($sql);
$sql = strip_tags($sql);
$sql = addslashes($sql);
fwrite($fp, "SQL Query/String: $sql");
fclose($fp);
return $sql;
}
An Example of a $_POST variable
anti_injection($_POST['email']);