E-mail check

02/04/2015 20:22 _-Russian-_#1
Hello,
Wie man E-Mail-Adresse zu machen wird nicht wiederholt?


Hier ist mein registr.php:
Code:
<?php if (!defined('access')) {die("Die gesuchte Ressource wurde entfernt oder umbenannt, oder sie steht vorübergehend nicht zur Verfügung.");} ?>
<p class="page_title"><?php echo $_LANG['regist_siteTitle']; ?></p>

<?php
	if(isset($_POST['registSubmit'])) {
		$account = cleanSqlInput($_POST['registAccountID']);
		$pass1 = cleanSqlInput($_POST['registPassword']);
		$pass2 = cleanSqlInput($_POST['registPasswordRepeat']);
		$email = cleanSqlInput($_POST['registMail']);
		$email2 = cleanSqlInput($_POST['registMailRepeat']);
		$provider = preg_replace("^(.*?)@(.*?)^", "$2", $email);
		$gefra = cleanSqlInput($_POST['registSecretQuestion']);
		$geant = cleanSqlInput($_POST['registSecretAnswer']);
		$birthday = cleanSqlInput($_POST['registBirthday']);
		$md5pw = md5($_CONFIG['allg_svr_salt'].$pass1);
		$strOutputErrorArray = array();

		$accountcheck1 = @odbc_num_rows(@odbc_exec($odbc_connect, 'SELECT [account] FROM [' . $_CONFIG['db_databases']['acc'] . '].[dbo].[ACCOUNT_TBL] WHERE account = \''.$account.'\''));
		$accountcheck2 = @odbc_num_rows(@odbc_exec($odbc_connect, 'SELECT [account] FROM [' . $_CONFIG['db_databases']['web'] . '].[dbo].[VALIDATE] WHERE [type] = 0 AND [account] = \''.$account.'\''));
		
		
		

		if(!$_CONFIG['registration_enabled']) {
			$strOutputErrorArray[] = $_LANG['error_registration_disabled'];
		}
        if(isSpamming($_POST['inputCheckTimestamp'], $_POST['inputCheckKey'], $_SESSION['inputCheckKey'])) {
            $strOutputErrorArray[] = $_LANG['error_spam'];
        }
		if(empty($account) or empty($pass1) or empty($pass2) or empty($email) or empty($email2) or empty($gefra) or empty($geant) or empty($birthday)) {
			$strOutputErrorArray[] = $_LANG['error_fill_in_all_fields'];
		}
		if(!isset($_POST['registCheckbox'])) {
			$strOutputErrorArray[] = $_LANG['error_confirm_reading_rules'];
		}
		
		if($accountcheck1 > 0 OR $accountcheck2 > 0) {
			$strOutputErrorArray[] = $_LANG['error_accountname_is_taken'];
		}	
			
		if($emailcheck1 > 0 OR $emailcheck2 > 0) {
			$strOutputErrorArray[] = $_LANG['error_email_is_taken'];
		}
		
		if((strlen($account) > 16) || (strlen($account) < 3)) {
			$strOutputErrorArray[] = $_LANG['error_account_length'];
		}
		if ($account != preg_replace ("/[^A-Za-z0-9]/", "", $account)) {
			$strOutputErrorArray[] = $_LANG['error_no_special_characters_account'];
		}
		if((strlen($pass1) > 16) || (strlen($pass1) < 6)) {
			$strOutputErrorArray[] = $_LANG['error_password_length'];
		}
		if($pass1 != $pass2) {
			$strOutputErrorArray[] = $_LANG['error_passwords_indistinguishable'];
		}
		if($geant != preg_replace('/[^A-Za-z0-9 ]/', '', $geant)) {
			$strOutputErrorArray[] = $_LANG['error_no_special_characters_secret_answer'];
		}
		if(strtolower($email) != strtolower($email2)) {
			$strOutputErrorArray[] = $_LANG['error_mails_indistinguishable'];
		}
        if(!preg_match('/^[a-zA-Z0-9-_.]+@[a-zA-Z0-9-_.]+\.[a-zA-Z]{2,4}$/', $email)) {
            $strOutputErrorArray[] = $_LANG['error_mail_must_be_valid'];
        }
		if(in_array($provider, $_CONFIG['web_mail_provider'])) {
			$strOutputErrorArray[] = $_LANG['error_spam_provider'];
		}
		if(!strtotime($birthday)) {
			$strOutputErrorArray[] = $_LANG['error_valid_birthday'];
		}
		if(count($strOutputErrorArray) > 0) {
			echo createMessage($strOutputErrorArray, 'fail');
		}
		else {
            if($_CONFIG['registration_verify_mail_enabled'] AND $_CONFIG['web_mailserver_enabled']) {
                $key = random_string();
                if(
                    mailRegistration($email, $account, $pass1, $_CONFIG['allg_secretquestions'][$gefra], $geant, date($_CONFIG['web_date_format']['date'], strtotime($birthday)), $key)
                AND
                    @odbc_exec($odbc_connect, '
                        INSERT INTO [' . $_CONFIG['db_databases']['web'] . '].[dbo].[VALIDATE] (
                            [key],
                            [type],
                            [account],
							[email],
                            [timestamp],
                            [fieldAlfa],
                            [fieldBravo],
                            [fieldCharlie],
                            [fieldDelta],
                            [fieldEcho],
                            [fieldFoxtrot]
                        ) VALUES (
                            \'' . $key . '\',
                            0,
                            \''.$account.'\',
                            \''.time().'\',
                            \''.$email.'\',
                            \''.$md5pw.'\',
                            \''.md5($_CONFIG['security_secretAnswerSalt'].$geant).'\',
                            \''.date($_CONFIG['web_date_format']['date'], strtotime($birthday)).'\',
                            '.$gefra.',
                            \''.$_SERVER['REMOTE_ADDR'].'\'
                        )
                    ')) {
                    echo createMessage($_LANG['success_registration_mail'], 'success');
                }
                else {
                    echo createMessage($_LANG['error_could_not_register'], 'fail');
                }
            }
            else {
                if(odbc_exec($odbc_connect, '
                    EXEC [' . $_CONFIG['db_databases']['acc'] . '].[dbo].[usp_createAccount] @account=\'' . $account . '\', @pw=\''.$md5pw.'\', @email=\''.$email.'\', @gefra=\''.$gefra.'\', @geant=\''.md5($_CONFIG['security_secretAnswerSalt'].$geant).'\', @birthday=\''.date($_CONFIG['web_date_format']['date'], strtotime($birthday)).'\', @ip = \'' . $_SERVER['REMOTE_ADDR'] . '\', @lang=\'' . $_CONFIG['web_default_lang'] . '\'
                ')) {
                    $_SESSION['user'] = strtolower($account);
                    $_SESSION['lang'] = $_CONFIG['web_default_lang'];
                    echo createMessage($_LANG['success_registration'], 'success');
                }
                else {
                    echo createMessage($_LANG['error_could_not_register'], 'fail');
                }
            }
		}
	}
	else {
		if($_CONFIG['registration_enabled']) {
            if($_CONFIG['registration_verify_mail_enabled']) {
			    echo createMessage($_LANG['notify_registration'], 'hint');
            }
		}
		else {
			echo createMessage($_LANG['error_registration_disabled'], 'fail');
		}
	}
?>
<form method="post"><br />
	<input type="hidden" name="inputCheckTimestamp" value="<?php echo time();?>" />
	<input type="hidden" name="inputCheckKey" value="<?php echo random_string();?>" />
<fieldset>
	<legend><?php echo $_LANG['regist_account_information_subTitle']; ?></legend>
	<input type="text" name="registAccountID" id="registAccountID" maxlength="16" placeholder="<?php echo $_LANG['account']; ?>" required="required"/><label class="labelRegistration" for="registAccountID"><?php echo $_LANG['account']; ?>:</label><br />
	<input type="password" name="registPassword" id="registPassword" placeholder="<?php echo $_LANG['password']; ?>" required="required"/> <input type="password" name="registPasswordRepeat" id="registPasswordRepeat" class="password" placeholder="<?php echo $_LANG['password_repeat']; ?>" required="required"/><label class="labelRegistration" for="registPassword"><?php echo $_LANG['password']; ?>:</label><br />
</fieldset>
<br />
<fieldset>
	<legend><?php echo $_LANG['regist_security_subTitle']; ?></legend>
	<input type="email" name="registMail" id="registMail" class="email" placeholder="[Only registered and activated users can see links. Click Here To Register...]" required="required"/> <input type="email" name="registMailRepeat" id="registMailRepeat" class="email" placeholder="<?php echo $_LANG['mail_repeat']; ?>" required="required"/><label class="labelRegistration" for="registMail"><?php echo $_LANG['mail']; ?>:</label>
	<input type="text" name="registBirthday" id="registBirthday" class="birthday" placeholder="14.05.1993" required="required"/><label class="labelRegistration" for="registBirthday"><?php echo $_LANG['birthday']; ?>:</label><br />
	<select name="registSecretQuestion" id="registSecretQuestion" class="frage" required="required">
		<option value="" selected="selected"></option>
		<?php 
		foreach($_CONFIG['allg_secretquestions'] as $id => $frage) {
			echo '<option value="'.$id.'" >'.$frage.'</option>';
		}
		?>
	</select><label class="labelRegistration" for="registSecretQuestion"><?php echo $_LANG['secret_question']; ?>:</label><br />
	<input type="text" name="registSecretAnswer" id="registSecretAnswer" class="antwort" placeholder="<?php echo $_LANG['secret_answer']; ?>" required="required"/><label class="labelRegistration" for="registSecretAnswer"><?php echo $_LANG['secret_answer']; ?>:</label>
</fieldset>
<br />
<fieldset>
	<legend><?php echo $_LANG['regist_rules_subTitle']; ?></legend>
	<input type="checkbox" name="registCheckbox" id="registCheckbox" style="margin:14px 10px;" required="required"/><label style="float:left;" for="registCheckbox"><?php echo $_LANG['regist_read_confirmation']; ?> </label><br /><br style="clear:both;"/>
</fieldset>
	<input type="submit" name="registSubmit" value="<?php echo $_LANG['button_send_registration']; ?>" class="button_235" style="margin:10px 0px 10px 190px;" />
</form>
up