You last visited: Today at 03:11
Advertisement
[HELP]Sicherheitsabfrage
Discussion on [HELP]Sicherheitsabfrage within the General Coding forum part of the Coders Den category.
01/31/2011, 14:45
#1
elite*gold: 0
Join Date: Jul 2010
Posts: 1,398
Received Thanks: 663
[HELP]Sicherheitsabfrage
Hallo,
ich wolte fragen ob mir jemand eine Sicherheitsabfrage in meine Registrierung Coden kann.
Die fragen solte folgend lauten: Was ist die Haupstadt von Deutschland ?
Die Antwort solte " Berlin " lauten.
PHP Code:
<div class="main_contant_title">Registration</div>
<?PHP
$regCoins = 0 ; // Startcoins
$laufZeit = 365 ; //Tage autoloot,safebox
$calcLZ = ( 60 * 60 * 24 )* 365 ;
$expireStamp = time ()+ $calcLZ ;
$expireDate = date ( "Y-m-d H:i:s" , $expireStamp );
if( $serverSettings [ 'register_on' ] && (!isset( $_SESSION [ 'user_admin' ]) && ! checkInt ( $_SESSION [ 'user_admin' ]) && ! $_SESSION [ 'user_admin' ]>= 0 )) {
if(isset( $_POST [ 'submit' ]) && $_POST [ 'submit' ]== "Registrieren" ) {
if(( checkAnum ( $_POST [ 'account' ]) && strlen ( $_POST [ 'account' ])>= 8 && strlen ( $_POST [ 'account' ])<= 16 ) && checkAnum ( $_POST [ 'pass' ]) && strlen ( $_POST [ 'pass' ])>= 8 && strlen ( $_POST [ 'pass2' ])<= 16 && !empty( $_POST [ 'pass2' ]) && ( checkName ( $_POST [ 'uname' ]) && strlen ( $_POST [ 'uname' ])>= 3 && strlen ( $_POST [ 'uname' ])<= 20 ) && $_POST [ 'pass' ]== $_POST [ 'pass2' ] && checkMail ( $_POST [ 'email' ]) && strlen ( $_POST [ 'email' ])<= 40 && $_POST [ 'captcha' ]== $_SESSION [ 'captcha_id' ] && $_POST [ 'email' ]== $_POST [ 'email2' ] && ( checkAnum ( $_POST [ 'sicherheitsa' ]) && strlen ( $_POST [ 'sicherheitsa' ])>= 3 && strlen ( $_POST [ 'sicherheitsa' ])<= 16 ) && checkInt ( $_POST [ 'sicherheitsf' ]) && ( checkAnum ( $_POST [ 'loeschcode' ]) && strlen ( $_POST [ 'loeschcode' ])== 7 ) && ( $_POST [ "agb" ])) {
$hashSF = md5 ( $_POST [ 'sicherheitsa' ]);
$sfNum = mysql_real_escape_string ( $_POST [ 'sicherheitsf' ]);
$lcode = mysql_real_escape_string ( $_POST [ 'loeschcode' ]);
$zuFall = rand ( 99999 , 999999999 );
$userpass = mysql_real_escape_string ( $_POST [ 'pass' ]);
$aktivHash = ( $serverSettings [ 'mail_activation' ]) ? md5 ( $zuFall ): '' ;
$accountStatus = ( $serverSettings [ 'mail_activation' ]) ? 'BLOCK' : 'OK' ;
$sqlCmd = "INSERT INTO account.account
(login,password,real_name,email,social_id,question1,answer1,create_time,status,coins,autoloot_expire,safebox_expire,web_aktiviert)
VALUES
('" . $_POST [ 'account' ]. "',PASSWORD('" . $userpass . "'),'" . mysql_real_escape_string ( $_POST [ 'uname' ]). "','" . mysql_real_escape_string ( $_POST [ 'email' ]). "','" . $lcode . "','" . $sfNum . "','" . $hashSF . "','" . $sqlZeit . "','" . $accountStatus . "','" . $regCoins . "','" . $expireDate . "','" . $expireDate . "','" . $aktivHash . "')" ;
$sqlQry = mysql_query ( $sqlCmd , $sqlServ );
if( $sqlQry ) {
$absender = $serverSettings [ 'titel' ]. " Registration" ;
$email = $serverSettings [ 'reg_mail' ];
$empfaenger = $_POST [ 'email' ];
$mail_body = "Hallo " . $_POST [ 'uname' ]. ",
deine Registration auf " . $serverSettings [ 'titel' ]. " war erfolgreich! Um auch auf dem Server spielen zu können, musst du deinen Account aktivieren.
Das kannst du über den folgenden Link tun:
" . $serverSettings [ 'url' ]. "/index.php?s=login&do=aktivieren&hash=" . $aktivHash . "
Deine Daten sind:
Account: " . $_POST [ 'account' ]. "
Passwort: " . $userpass . "
Löschcode: " . $lcode . "
Sicherheitsfrage: " . $sFrage [ $sfNum ]. "
Antwort: " . $_POST [ 'sicherheitsa' ]. "
Viel Spaß beim Spielen,
Dein " . $serverSettings [ 'titel' ]. "-Team
Diese E-Mail wurde automatisch generiert. Bitte keine Antworten an diese Adresse schicken." ;
$titel = "Registrierung auf " . $serverSettings [ 'titel' ];
$header = "X-Priority: 3\n" ;
$header .= "X-Mailer: " . $serverSettings [ 'titel' ]. " Homepage Mailer\n" ;
$header .= "MIME-Version: 1.0\n" ;
$header .= "From: " . $absender . " <" . $serverSettings [ 'reg_mail' ]. ">\n" ;
$header .= "Reply-To: " . $serverSettings [ 'reg_mail' ]. "\n" ;
$header .= "Content-Type: text/plain; charset=iso-8859-1\n" ;
if( $serverSettings [ 'mail_activation' ]) {
mail ( $empfaenger , $titel , $mail_body , $header );
echo '<div class="main_contant_title3"><p class="success">Bitte überprüfen Sie Ihr Postfach, um die Registrierung zu bestätigen.</p></div>' ;
}
else {
echo '<div class="main_contant_title3"><p class="success">Account erfolgreich angelegt. Sie können sich nun anmelden.</p></div>' ;
}
}
else {
echo '<div class="main_contant_title3"><p class="fail">Registrierung fehlgeschlagen: Der Account existiert bereits.</p></div>' ;
}
}
else {
echo '<div class="main_contant_title3"><p class="fail">Registrierung fehlgeschlagen: Bitte alle Felder richtig angeben.</p></div>' ;
}
}
?>
<p class="main_contant_title4">Alle Felder sind Pflichtfelder und müssen ausgefüllt werden.</p>
<form action="index.php?s=register" method="POST">
<table>
<tr>
<th class="topLine">Account:</th>
<td class="tdunkel"><input type="text" name="account" maxlength="16" class="text"/> 8-16 Zeichen (nur a-Z,0-9)</td>
</tr>
<tr>
<th class="topLine">Name:</th>
<td class="thell"><input type="text" name="uname" maxlength="16" class="text"/> 3-20 Zeichen (nur a-Z,0-9)</td>
</tr>
<tr>
<th class="topLine">Password:</th>
<td class="tdunkel"><input type="password" name="pass" maxlength="16" class="text"/> 8-16 Zeichen (nur a-Z,0-9)</td>
</tr>
<tr>
<th class="topLine">Password wiederholen:</th>
<td class="thell"><input type="password" name="pass2" maxlength="16" class="text"/></td>
</tr>
<tr>
<th class="topLine">E-Mail:</th>
<td class="tdunkel"><input type="text" name="email" maxlength="50" class="text"/> max. 40 Zeichen</td>
</tr>
<tr>
<th class="topLine">E-Mail wiederholen:</th>
<td class="thell"><input type="text" name="email2" maxlength="50" class="text"/></td>
</tr>
<tr>
<th class="topLine">Löschcode:</th>
<td class="tdunkel"><input type="text" name="loeschcode" maxlength="7" class="text"/> 7 Zeichen (nur a-Z,0-9)</td>
</tr>
<tr>
<th class="topLine">Sicherheitsfrage:</th>
<td class="thell">
<select name="sicherheitsf" class="text">
<?PHP
foreach( $sFrage AS $fragew => $frage ) {
echo '<option value="' . $fragew . '">' . $frage . '</option>' ;
}
?>
</select>
<input type="text" name="sicherheitsa" maxlength="16" class="text"/> 3-16 Zeichen (nur a-Z,0-9)
</td>
</tr>
<tr>
<th class="topLine">Captcha:</th>
<td class="tdunkel"><img src="./captcha/captcha.php" title="Captcha"/> <input type="text" name="captcha" maxlength="5" class="text"/></td>
</tr>
<tr>
<th class="topLine">AGBs:</th>
<td class="tdunkel"><input name="agb" type="checkbox" /> Ich habe die <a href="#">AGBs</a> gelesen und akzeptiert.</td>
</tr>
<tr>
<th class="topLine" style="text-align:center;" colspan="2"><input type="submit" name="submit" class="text_button" value="Registrieren"/></th>
</tr>
</table>
</form>
<?PHP
}
else {
echo '<p class="main_contant_title4">Die Registration ist deaktiviert, versuch es später noch einmal.</p>' ;
}
?>
?>
Mfg
KaneWayne
01/31/2011, 14:47
#2
elite*gold: 0
Join Date: Jun 2010
Posts: 3,406
Received Thanks: 2,024
ich glaube da wärst du in der coding section besser mit aufgehoben
01/31/2011, 14:52
#3
elite*gold: 0
Join Date: Feb 2010
Posts: 603
Received Thanks: 322
Jop wrong section...
01/31/2011, 17:13
#4
elite*gold: 0
Join Date: Jul 2010
Posts: 1,398
Received Thanks: 663
Jetzt ist es richtige section.
02/01/2011, 12:05
#5
elite*gold: 20
Join Date: Nov 2008
Posts: 14
Received Thanks: 4
Versuche es mal hier mit:
PHP Code:
<div class="main_contant_title">Registration</div>
<?PHP
$sFrage [ 'deutschland' ] = 'Was ist die Haupstadt von Deutschland ?' ;
$regCoins = 0 ; // Startcoins
$laufZeit = 365 ; //Tage autoloot,safebox
$calcLZ = ( 60 * 60 * 24 )* 365 ;
$expireStamp = time ()+ $calcLZ ;
$expireDate = date ( "Y-m-d H:i:s" , $expireStamp );
if( $serverSettings [ 'register_on' ] && (!isset( $_SESSION [ 'user_admin' ]) && ! checkInt ( $_SESSION [ 'user_admin' ]) && ! $_SESSION [ 'user_admin' ]>= 0 )) {
if(isset( $_POST [ 'submit' ]) && $_POST [ 'submit' ]== "Registrieren" ) {
if(( checkAnum ( $_POST [ 'account' ]) && strlen ( $_POST [ 'account' ])>= 8 && strlen ( $_POST [ 'account' ])<= 16 ) && checkAnum ( $_POST [ 'pass' ]) && strlen ( $_POST [ 'pass' ])>= 8 && strlen ( $_POST [ 'pass2' ])<= 16 && !empty( $_POST [ 'pass2' ]) && ( checkName ( $_POST [ 'uname' ]) && strlen ( $_POST [ 'uname' ])>= 3 && strlen ( $_POST [ 'uname' ])<= 20 ) && $_POST [ 'pass' ]== $_POST [ 'pass2' ] && checkMail ( $_POST [ 'email' ]) && strlen ( $_POST [ 'email' ])<= 40 && $_POST [ 'captcha' ]== $_SESSION [ 'captcha_id' ] && $_POST [ 'email' ]== $_POST [ 'email2' ] && ( checkAnum ( $_POST [ 'sicherheitsa' ]) && strlen ( $_POST [ 'sicherheitsa' ])>= 3 && strlen ( $_POST [ 'sicherheitsa' ])<= 16 ) && checkInt ( $_POST [ 'sicherheitsf' ]) && ( checkAnum ( $_POST [ 'loeschcode' ]) && strlen ( $_POST [ 'loeschcode' ])== 7 ) && ( $_POST [ "agb" ])) {
if( $_POST [ 'sicherheitsf' ] == 'deutschland' && strtolower ( $_POST [ 'sicherheitsa' ]) == 'berlin' ){
$hashSF = md5 ( $_POST [ 'sicherheitsa' ]);
$sfNum = mysql_real_escape_string ( $_POST [ 'sicherheitsf' ]);
$lcode = mysql_real_escape_string ( $_POST [ 'loeschcode' ]);
$zuFall = rand ( 99999 , 999999999 );
$userpass = mysql_real_escape_string ( $_POST [ 'pass' ]);
$aktivHash = ( $serverSettings [ 'mail_activation' ]) ? md5 ( $zuFall ): '' ;
$accountStatus = ( $serverSettings [ 'mail_activation' ]) ? 'BLOCK' : 'OK' ;
$sqlCmd = "INSERT INTO account.account
(login,password,real_name,email,social_id,question1,answer1,create_time,status,coins,autoloot_expire,safebox_expire,web_aktiviert)
VALUES
('" . $_POST [ 'account' ]. "',PASSWORD('" . $userpass . "'),'" . mysql_real_escape_string ( $_POST [ 'uname' ]). "','" . mysql_real_escape_string ( $_POST [ 'email' ]). "','" . $lcode . "','" . $sfNum . "','" . $hashSF . "','" . $sqlZeit . "','" . $accountStatus . "','" . $regCoins . "','" . $expireDate . "','" . $expireDate . "','" . $aktivHash . "')" ;
$sqlQry = mysql_query ( $sqlCmd , $sqlServ );
if( $sqlQry ) {
$absender = $serverSettings [ 'titel' ]. " Registration" ;
$email = $serverSettings [ 'reg_mail' ];
$empfaenger = $_POST [ 'email' ];
$mail_body = "Hallo " . $_POST [ 'uname' ]. ",
deine Registration auf " . $serverSettings [ 'titel' ]. " war erfolgreich! Um auch auf dem Server spielen zu können, musst du deinen Account aktivieren.
Das kannst du über den folgenden Link tun:
" . $serverSettings [ 'url' ]. "/index.php?s=login&do=aktivieren&hash=" . $aktivHash . "
Deine Daten sind:
Account: " . $_POST [ 'account' ]. "
Passwort: " . $userpass . "
Löschcode: " . $lcode . "
Sicherheitsfrage: " . $sFrage [ $sfNum ]. "
Antwort: " . $_POST [ 'sicherheitsa' ]. "
Viel Spaß beim Spielen,
Dein " . $serverSettings [ 'titel' ]. "-Team
Diese E-Mail wurde automatisch generiert. Bitte keine Antworten an diese Adresse schicken." ;
$titel = "Registrierung auf " . $serverSettings [ 'titel' ];
$header = "X-Priority: 3\n" ;
$header .= "X-Mailer: " . $serverSettings [ 'titel' ]. " Homepage Mailer\n" ;
$header .= "MIME-Version: 1.0\n" ;
$header .= "From: " . $absender . " <" . $serverSettings [ 'reg_mail' ]. ">\n" ;
$header .= "Reply-To: " . $serverSettings [ 'reg_mail' ]. "\n" ;
$header .= "Content-Type: text/plain; charset=iso-8859-1\n" ;
if( $serverSettings [ 'mail_activation' ]) {
mail ( $empfaenger , $titel , $mail_body , $header );
echo '<div class="main_contant_title3"><p class="success">Bitte überprüfen Sie Ihr Postfach, um die Registrierung zu bestätigen.</p></div>' ;
}
else {
echo '<div class="main_contant_title3"><p class="success">Account erfolgreich angelegt. Sie können sich nun anmelden.</p></div>' ;
}
}
else {
echo '<div class="main_contant_title3"><p class="fail">Registrierung fehlgeschlagen: Der Account existiert bereits.</p></div>' ;
}
}else{
echo '<div class="main_contant_title3"><p class="fail">Registrierung fehlgeschlagen: Sicherheitsfrage falsch beantwortet.</p></div>' ;
}
}
else {
echo '<div class="main_contant_title3"><p class="fail">Registrierung fehlgeschlagen: Bitte alle Felder richtig angeben.</p></div>' ;
}
}
?>
<p class="main_contant_title4">Alle Felder sind Pflichtfelder und müssen ausgefüllt werden.</p>
<form action="index.php?s=register" method="POST">
<table>
<tr>
<th class="topLine">Account:</th>
<td class="tdunkel"><input type="text" name="account" maxlength="16" class="text"/> 8-16 Zeichen (nur a-Z,0-9)</td>
</tr>
<tr>
<th class="topLine">Name:</th>
<td class="thell"><input type="text" name="uname" maxlength="16" class="text"/> 3-20 Zeichen (nur a-Z,0-9)</td>
</tr>
<tr>
<th class="topLine">Password:</th>
<td class="tdunkel"><input type="password" name="pass" maxlength="16" class="text"/> 8-16 Zeichen (nur a-Z,0-9)</td>
</tr>
<tr>
<th class="topLine">Password wiederholen:</th>
<td class="thell"><input type="password" name="pass2" maxlength="16" class="text"/></td>
</tr>
<tr>
<th class="topLine">E-Mail:</th>
<td class="tdunkel"><input type="text" name="email" maxlength="50" class="text"/> max. 40 Zeichen</td>
</tr>
<tr>
<th class="topLine">E-Mail wiederholen:</th>
<td class="thell"><input type="text" name="email2" maxlength="50" class="text"/></td>
</tr>
<tr>
<th class="topLine">Löschcode:</th>
<td class="tdunkel"><input type="text" name="loeschcode" maxlength="7" class="text"/> 7 Zeichen (nur a-Z,0-9)</td>
</tr>
<tr>
<th class="topLine">Sicherheitsfrage:</th>
<td class="thell">
<select name="sicherheitsf" class="text">
<?PHP
foreach( $sFrage AS $fragew => $frage ) {
echo '<option value="' . $fragew . '">' . $frage . '</option>' ;
}
?>
</select>
<input type="text" name="sicherheitsa" maxlength="16" class="text"/> 3-16 Zeichen (nur a-Z,0-9)
</td>
</tr>
<tr>
<th class="topLine">Captcha:</th>
<td class="tdunkel"><img src="./captcha/captcha.php" title="Captcha"/> <input type="text" name="captcha" maxlength="5" class="text"/></td>
</tr>
<tr>
<th class="topLine">AGBs:</th>
<td class="tdunkel"><input name="agb" type="checkbox" /> Ich habe die <a href="#">AGBs</a> gelesen und akzeptiert.</td>
</tr>
<tr>
<th class="topLine" style="text-align:center;" colspan="2"><input type="submit" name="submit" class="text_button" value="Registrieren"/></th>
</tr>
</table>
</form>
<?PHP
}
else {
echo '<p class="main_contant_title4">Die Registration ist deaktiviert, versuch es später noch einmal.</p>' ;
}
?>
?>
02/01/2011, 23:49
#6
elite*gold: 0
Join Date: Nov 2010
Posts: 463
Received Thanks: 357
Wenn du es richtig machen willst dann hiermit:
1.
2.
hier einige Vokabeln aneignen
Similar Threads
sicherheitsabfrage ???
05/02/2010 - CrossFire - 16 Replies
mal eine frage:wenn ich auf LOST ID/PSW/Security Answer gehe und meine email adresse eingebe kommt dann eine sicherheitsabfrage ??
All times are GMT +2. The time now is 03:11 .