I'm trying to remove <> html tags, from posts, using str_replace, but It's not working quite right. I'm getting a phrase error, and pulling my hair out over it. What am I doing wrong in this code:
<?php
// Define and remove backslashes
$out = fopen("posts.txt", "a");
if (strpos($name, "<'")){
do{
$name = str_replace("<'", "'", "$name");
} while(strpos($name, "<'"));
} else if (strpos($name, "<"")) {
do {
$name = str_replace('<"', '"', "$name");
}while(strpos($name, '<"'));
}
$name = str_replace('<', '[', "$name"); return($name)
if (strpos($mess, "<'")){
do{
$mess = str_replace("<'", "'", "$mess");
}while(strpos($mess, "<'"));
}else if (strpos($mess, "<"")){
do{
$mess = str_replace('<"', '"', "$mess");
}while(strpos($mess, '<"'));
}
$mess = str_replace('<', '|', "$mess"); return($mess)
$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@heh.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);
?>