mirror of
https://github.com/Znote/ZnoteAAC.git
synced 2025-04-30 03:09:22 +02:00
Merge pull request #96 from cornex1/patch-2
Fix #79 Fixed illegal string filter on name change
This commit is contained in:
commit
02179065f3
@ -97,6 +97,17 @@ if (!empty($_POST['change_name'])) {
|
|||||||
$error = true;
|
$error = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// Check name for illegal characters.
|
||||||
|
function checkNewNameForIllegal($name) {
|
||||||
|
if (preg_match('#^[\0-9åäö&()+%/*$€é,.\'"-]*$#i', $name)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (checkNewNameForIllegal($newname)) {
|
||||||
|
$error = true;
|
||||||
|
echo 'This name contains illegal characters.';
|
||||||
|
}
|
||||||
if ($error === false) {
|
if ($error === false) {
|
||||||
// Change the name!
|
// Change the name!
|
||||||
mysql_update("UPDATE `players` SET `name`='$newname' WHERE `id`='".$player['id']."' LIMIT 1;");
|
mysql_update("UPDATE `players` SET `name`='$newname' WHERE `id`='".$player['id']."' LIMIT 1;");
|
||||||
@ -359,4 +370,4 @@ if (!empty($_POST['selected_comment'])) {
|
|||||||
</div>
|
</div>
|
||||||
<?php
|
<?php
|
||||||
}
|
}
|
||||||
include 'layout/overall/footer.php'; ?>
|
include 'layout/overall/footer.php'; ?>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user