Add: banned word DB
This commit is contained in:
@@ -19,10 +19,12 @@ AccountValidator.prototype.messageForInvalidMaestroID = function(textID) {
|
||||
return "마에스트로 계정명은 " + AccountValidator.MAESTRO_ID_LENGTH_MINIMUM + "글자 이상이어야 합니다.";
|
||||
else if(textID.length > AccountValidator.MAESTRO_ID_LENGTH_MAXIMUM)
|
||||
return "마에스트로 계정명은 " + AccountValidator.MAESTRO_ID_LENGTH_MAXIMUM + "글자 이하이어야 합니다.";
|
||||
else if((/\s/.test(textID)))
|
||||
return "마에스트로 계정명에는 띄어쓰기를 허용하지 않고 있습니다.";
|
||||
else if(!(/^[A-Za-z]/.test(textID)))
|
||||
return "마에스트로 계정명은 알파벳으로 시작해야 합니다.";
|
||||
return "마에스트로 계정명은 글자와 숫자로만 적어주세요.";
|
||||
else if((/[^\w]/g).test(textID))
|
||||
return "마에스트로 계정명은 알파벳과 숫자로만 적어주세요.";
|
||||
return "마에스트로 계정명은 글자와 숫자로만 적어주세요.";
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -7,6 +7,13 @@ include "./../setup/connect_db.php";
|
||||
$maestro_name = $_POST["maestro_name"];
|
||||
|
||||
|
||||
$banned_word = banned_maestro_name($maestro_name);
|
||||
if($banned_word !== null) {
|
||||
set_error_message($maestro_name." : 금칙어로 등록된 이름입니다. 다른 아이디로 입력해주세요.");
|
||||
send_result_fail();
|
||||
exit;
|
||||
}
|
||||
|
||||
$maestro_id = get_maestro_id($maestro_name);
|
||||
if($maestro_id !== null) {
|
||||
set_error_code("registered_name");
|
||||
@@ -20,6 +27,25 @@ exit;
|
||||
|
||||
|
||||
|
||||
function banned_maestro_name($maestroName) {
|
||||
global $db_conn;
|
||||
|
||||
$query = "
|
||||
SELECT Word
|
||||
FROM banned_word
|
||||
WHERE Word = ?
|
||||
";
|
||||
$stmt = $db_conn->prepare($query);
|
||||
$stmt->bind_param("s", $maestroName);
|
||||
$stmt->execute();
|
||||
$stmt->bind_result($maestroID);
|
||||
// while($stmt->fetch())
|
||||
$stmt->fetch();
|
||||
$stmt->close();
|
||||
|
||||
return $maestroID;
|
||||
}
|
||||
|
||||
function get_maestro_id($maestro_name) {
|
||||
global $db_conn;
|
||||
|
||||
|
||||
@@ -101,3 +101,8 @@ CREATE TABLE ranking (
|
||||
FOREIGN KEY (AppID) REFERENCES app(AppID),
|
||||
FOREIGN KEY (PlayerID) REFERENCES player(PlayerID)
|
||||
);
|
||||
|
||||
CREATE TABLE banned_word (
|
||||
BannedWordID INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
||||
Word CHAR(50) NOT NULL
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user