Ik heb een eigen spel gemaakt genaamd Destiny Tibia, en ik heb hier ook een website voor, maar ik ben niet zo goed in php en mysql, maar zou iemand misschien kunnen uitleggen of willen maken hoe ik een namen filter kan maken bijvoorbeeld als het woord: "gm" of "demon" voorkomt dat de text verschijnt van "sorry the name you picked isn't aloud"
dit is het script dat ik op het moment gebruik:
<?
session_start();
include('db.php');
mysql_connect($ip,$username,$password);
@mysql_select_db($database) or die( "Unable to select database");
$check = mysql_query('SELECT * FROM players WHERE (name = '.$namein.')');
$acc = "";
$pass = "";
$acc = $_SESSION['account'];
$pass = $_SESSION['password'];
$playername = $_POST['name'];
if ($acc != "" && $acc != null && $pass != "" && $pass != null) {
?>
<?
$result = $_GET['result'];
if (isset($result) && $result != "" && $result != null) {
if ($result == "char_failed") {
$error = $_GET['error'];
if (isset($error) && $error == "malformed_name") {
echo "<font color=\"red\">Your character's name is not valid. Keep in mind that only letters and blankspaces are permitted. Please choose another one.</font><br><br>";
} else if (isset($error) && $error == "wrong_length") {
echo "<font color=\"red\">Your character's name is not valid. You must use a name with at least 2 letters and at most 20 letters. Please choose another one.</font><br><br>";
} else {
echo "<font color=\"red\">WARNING! An unknown error was returned: $error. If this happens again, please contact a gamemaster.</font><br><br>";
}
} else {
echo "<font color=\"orange\">Unknown contents of the result varibale.</font><br><br>";
}
}
?>
<table border="0" align="center" width="100%" background="images/interface_21.gif">
<tr>
<th><font color="#FFF7C6">Create new character:</th>
</tr>
<br>
<form action="savenewchar.php" method="POST">
<table border="0" align="center" width="100%">
<tr>
<th></th>
</tr>
<tr>
<td><b>Name:</b></td><td><input type="text" name="name" class="textfield"><font color="red"><i> (2-20 letters and blankspaces)</i></font><br><hr></td>
</tr>
<tr>
<td><b>Start:</b></td>
<td>
<input type="radio" name="voc" value="0" style="border: 0;"> Rookgaard<br>
<br><hr>
</td>
</tr>
<tr>
<td><b>Sex:</b></td>
<td>
<input type="radio" name="sex" value="1" style="border: 0;"> Male<br>
<input type="radio" name="sex" value="0" style="border: 0;"> Female<br>
</td>
</tr>
<tr>
<td><input type="submit" value="Create">
<a href="account_home.php">Home</a></td></tr>
<?
}
//this aac was created by ©"Coppie"/"Coppes"
//It was fixed and modified by ©"MartienoS"/"Njitram"
?>
1.244 views