See, what I'm using is a simple post submission, sending it to a text File, and then displaying it on a table, like a cheap "shout box", and I'm out of SQL databases, only allowed so many. So, I'm turning to submitting it to a text file. The thing is, I need to make it safe obviously, so I need to remove the arrow tags, so html can't be executed.
<?php
// Define and remove backslashes
$out = fopen("posts.txt", "a");
$mess = stripslashes($mess);
$name = stripslashes($name);
// if the file could not be opened for whatever reason, print
// an error message and exit the program
if (!$out) {
print("Could not append to file, please contact the [email]webmaster@blah.net[/email]");
exit;
}
// fputs writes output to a file. the syntax is where to write
// followed by what to write
fputs($out,"<b>[ $name ]:</b>\t $mess\n<hr size=1 color=#000000 noshade>\n");
fclose($out);
?>
Can Include this (the htmlentitles) you pointed me to, in the script above?
function myhtmlentities($str) {
$tbl=get_html_translation_table(HTML_ENTITIES);
unset ($tbl["<"]);
unset ($tbl[">"]);
unset ($tbl["'"]);
unset ($tbl['"']);
$tbl["“"]=""";
$tbl["”"]=""";
$tbl["…"]="...";
$tbl["—"]="-";
$tbl["»"]="»";
$tbl["«"]="«";
return str_replace(array_keys($tbl),array_values($tbl),$str);
}
Or is the a simpler way? Thank you greatly for your help.
-- Derrick