Hallo Leute
hier habt ihr ein Register Script was Sonderzeichen nicht erlaubt
und funzt.
Alles anzeigen
mfg DooM
hier habt ihr ein Register Script was Sonderzeichen nicht erlaubt
und funzt.
PHP-Quellcode
- <?php
- ini_set('display_errors', 0);
- $connection = mssql_connect('MSSQL Benutzer', 'sa', 'PW'); //Change YOURHOST and YOURPASSWORD
- //
- if(!connection || !mssql_select_db('ACCOUNT_DBF', $connection))
- {
- die('Unable to connect or select database!');
- }
- $checkusername = $_POST['Username'];
- $query = mssql_query("SELECT account FROM ACCOUNT_TBL WHERE account = '$checkusername'");
- $result = mssql_fetch_row($query);
- if(isset($_POST['submit'])){
- if($_POST['Username'] == ""){
- $error = '<font color="red"><b>Please enter a username.</b></font>';
- }
- else if($result[0] == $checkusername){
- $error = '<font color="red"><b>This username already exists. Please choose another one.</b></font>';
- }
- else if($_POST['Password'] == ""){
- $error = '<font color="red"><b>Please enter a password.</b></font>';
- }
- else if($_POST['Password'] != $_POST['Password2']){
- print("Die angegebenen Passwoerter stimmen nicht ueberein.");
- }
- else if (!preg_match("/^[a-zA-Z0-9]+$/i", trim($_POST['Username'])) || !preg_match("/^[a-zA-Z0-9]+$/i", trim($_POST['Password']))) {
- print("Es sind keine Sonderzeichen erlaubt.");
- }
- else{
- $userRev = strtolower($userRev);
- $passRev = strtolower($passRev);
- $password = md5('kikugalanet' . $_POST['Password']);
- $stmt = mssql_init('webCreateAcc', $connection);
- mssql_bind($stmt, '@account', $checkusername, SQLVARCHAR, false, false, 15);
- mssql_bind($stmt, '@password', $password, SQLVARCHAR, false, false, 36);
- mssql_bind($stmt, '@birthday', $checkusername, SQLVARCHAR, false, false, 120);
- mssql_bind($stmt, '@email', $checkusername, SQLVARCHAR, false, false, 120);
- mssql_execute($stmt) or die ("Could not complete the registration. Please try again.");
- mssql_free_statement($stmt);
- $error = '<font color="green"><b>Registration complete!</b></font>';
- }
- }
- echo '<form action="register.php" method="post">';
- echo 'Account: <input type="text" name="Username" /><br /><br />';
- echo 'Passwort: <input type="password" name="Password" /><br /><br />';
- echo 'Passwort wiederholen: <input type="password" name="Password2" /><br /><br />';
- echo 'Geburtsdatum: <input type="text" name="birthday" /><br /><br />';
- echo 'E-mail Adresse: <input type="text" name="mail" /><br />';
- echo '<input type="submit" name="submit" value="Registrieren" />';
- echo '</form>';
- echo $error;
- ?>
mfg DooM