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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
|
<?php
htmlHeader();
?>
<body>
<?php
topbar($Links);
include('./includes/maps.php');
include_once('./includes/sqlEmbedded.php');
function validatename($name) {
if (strlen($name) < 1)
return false;
if ($name != htmlentities($name))
return false;
if (strlen($name) > 14)
return false;
return true;
}
if (isset($_POST['displayName'])) {
$inputname = sql_clean($_POST['displayName']);
$inputname = chatFilter($inputname);
$userID = $_SESSION['userID'];
if ($accepted) {
if (validatename($inputname)) {
$sql = "UPDATE `users`
SET `displayName` = '$inputname'
WHERE `ID` = '$userID'
";
mysql_query($sql);
$_SESSION['displayName'] = $inputname;
DoRedirect("Name change success!");
exit;
//echo "<br /><b>Name change success (Your name may take a moment to be updated)</b> <br />";
} else {
echo "<br />Invalid name";
}
}
}
$displayName = htmlspecialchars($_SESSION['displayName'], ENT_COMPAT | ENT_HTML5);
?>
<div class="wrapper">
<h2>Change your display name</h2>
<form action="cp" method="post" name="changename">
<input type="text" size="20" maxlength="14" value="<?php echo $displayName ?>" name="displayName" class="forminput" />
<input type="submit" value="Change name" class="forminput" />
</div>
</form>
<?php
function chatFilter($chat) {
//cuss words
$chat = str_replace("fuck you", "i am moron", $chat);
$chat = str_replace("fuck", "dumb", $chat);
$chat = str_replace("asshole", "dumb", $chat);
$chat = str_replace("damnit", "dumb", $chat);
$chat = str_replace("damn", "dumb", $chat);
$chat = str_replace("cunt", "dumb", $chat);
$chat = str_replace("shit", "dumb", $chat);
$chat = str_replace("bitch", "dumb", $chat);
$chat = str_replace("sucks ass", "is dumb", $chat);
$chat = str_replace("suck ass", "is dumb", $chat);
$chat = str_replace("stfu", "shutup", $chat);
$chat = str_replace("omfg", "omg", $chat);
$chat = str_replace("fuk", "dumb", $chat);
return $chat;
}
htmlFooter();
?>
|