-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathclean_message.php
58 lines (49 loc) · 1.74 KB
/
clean_message.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
<?php
// = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
// TextfileBB
// Website: http://tfbb.jcink.com
//
// Modify freely, as long as you're not turning the forum
// into a board service of any form. Please ask for permission
// first to redistribute any of the TextfileBB code.
//
// Thanks.
//
// ----------------------------------------------------------------------------------------
// Module: clean_message.php - Last update: May 02, 2006
// ----------------------------------------------------------------------------------------
//
//
// = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
?>
<?php
require("forum_conf.php");
// Define stuff.
$message=$_POST['message'];
$topicname=$_POST['topicname'];
$topicdesc=$_POST['topicdesc'];
// Filter swearing
$file = file("filter.txt");
$i=-1;
while ($i <= count($file)) {
$i++;
$message= str_replace(rtrim($file[$i]), "@!&^*%", $message);
$topicname = str_replace(rtrim($file[$i]), "@!&^*%", $topicname);
$topicdesc = str_replace(rtrim($file[$i]), "@!&^*%", $topicdesc);
}
// For xss
$message=str_replace("&#62;", ">", $message);
$message=str_replace("&#60;", "<", $message);
// No html peroid
$topicname = htmlspecialchars($topicname, ENT_QUOTES);
$message = htmlspecialchars($message, ENT_QUOTES);
$topicdesc = htmlspecialchars($topicdesc, ENT_QUOTES);
// for brs
$message = eregi_replace("\n", "<br>", $message);
$topicname = eregi_replace("\n", "<br>", $topicname);
$topicdesc = eregi_replace("\n", "<br>", $topicdesc);
// Strip Slashes
//$message = stripslashes($message);
//$topicname = stripslashes($topicname);
//$topicdesc = stripslashes($topicdesc);
?>