Pomoc - Szukaj - Użytkownicy - Kalendarz
Pełna wersja: [Rejestracja] na stronie www
Forum PHP.pl > Forum > Bazy danych > MySQL
geralt55
Witam. Mam oto taki problem. Posiadam program xaamp w wersji 1.6.6a. System windows 7. A problem polega na tym, iż po uzupełnieniu wszystkich pól w formularzu rejestracji i po zatwierdzeniu strona tak jakby się odświeża i nie tworzy nowego konta. Problemu nie miałem wcześniej. Nie mogę jednak przypomnieć sobie co mogło sprawić daną nieprawidłowość. (wersja najnowsza xaamp w ogóle nie współgrała z mysql na windows 7). Skrypt ten nie jest mój aczkolwiek był udostępniony do własnych potrzeb. Oto cały plik register.php. Jeżeli mam podać inny to napiszcie. Z góry dzięki.

  1. <div id="content"> <div class="postui2 text-title">
  2. <h2>
  3. Rejestracja
  4.  
  5. </h2>
  6.  
  7. </div>
  8. <div class="postui2 text-con">
  9. <div class="con-wrap">
  10. <?PHP
  11.  
  12. $regCoins = 0; // Startcoins
  13.  
  14. $laufZeit = 365; //Tage autoloot,safebox
  15. $calcLZ = (60*60*24)*365;
  16. $expireStamp = time()+$calcLZ;
  17. $expireDate = date("Y-m-d H:i:s",$expireStamp);
  18.  
  19. if($serverSettings['register_on'] && (!isset($_SESSION['user_admin']) && !checkInt($_SESSION['user_admin']) && !$_SESSION['user_admin']>=0)) {
  20.  
  21. if(isset($_POST['submit']) && $_POST['submit']=="registrieren") {
  22. 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)) {
  23.  
  24. $hashSF = md5($_POST['sicherheitsa']);
  25. $sfNum = mysql_real_escape_string($_POST['sicherheitsf']);
  26. $lcode = mysql_real_escape_string($_POST['loeschcode']);
  27.  
  28. $zuFall = rand(99999,999999999);
  29. $userpass=mysql_real_escape_string($_POST['pass']);
  30.  
  31. $aktivHash = ($serverSettings['mail_activation']) ? md5($zuFall):'';
  32. $accountStatus = ($serverSettings['mail_activation']) ? 'BLOCK':'OK';
  33.  
  34. $sqlCmd = "INSERT INTO account.account
  35. (login,password,real_name,email,social_id,question1,answer1,create_time,stat
    us,coins,autoloot_expire,safebox_expire,web_aktiviert)
  36. VALUES
  37. ('".$_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."')";
  38. $sqlQry = mysql_query($sqlCmd,$sqlServ);
  39. if($sqlQry) {
  40.  
  41.  
  42. $absender = $serverSettings['titel']." Registration";
  43. $email = $serverSettings['reg_mail'];
  44. $empfaenger = $_POST['email'];
  45. $mail_body = "Hallo ".$_POST['uname'].",
  46.  
  47. deine Registration auf ".$serverSettings['titel']." war erfolgreich! Um auch auf dem Server spielen zu können, musst du deinen Account aktivieren.
  48. Das kannst du über den folgenden Link tun:
  49.  
  50. ".$serverSettings['url']."/index.php?s=login&do=aktivieren&hash=".$aktivHash."
  51.  
  52. Deine Daten sind:
  53. Account: ".$_POST['account']."
  54. Passwort: ".$userpass."
  55.  
  56. Löschcode: ".$lcode."
  57. Sicherheitsfrage: ".$sFrage[$sfNum]."
  58. Antwort: ".$_POST['sicherheitsa']."
  59.  
  60. Viel Spaß beim Spielen,
  61.  
  62. Dein ".$serverSettings['titel']."-Team
  63.  
  64.  
  65. Diese E-Mail wurde automatisch generiert. Bitte keine Antworten an diese Adresse schicken.";
  66. $titel = "Registrierung auf ".$serverSettings['titel'];
  67.  
  68. $header = "X-Priority: 3\n";
  69. $header .= "X-Mailer: ".$serverSettings['titel']." Homepage Mailer\n";
  70. $header .= "MIME-Version: 1.0\n";
  71. $header .= "From: ".$absender." <".$serverSettings['reg_mail'].">\n";
  72. $header .= "Reply-To: ".$serverSettings['reg_mail']."\n";
  73. $header .= "Content-Type: text/plain; charset=iso-8859-1\n";
  74.  
  75.  
  76. if($serverSettings['mail_activation']) {
  77. mail($empfaenger, $titel, $mail_body, $header);
  78. echo'<p class="meldung">Account erfolgreich angelegt. Bitte &uuml;berprüfen Sie Ihr Postfach, um die Registrierung zu best&auml;tigen.</p>';
  79. }
  80. else {
  81. echo'<p class="meldung">Account erfolgreich angelegt. Sie k&ouml;nnen sich nun anmelden.</p>';
  82. }
  83.  
  84. }
  85. else {
  86. echo'<p class="meldung">Registrierung fehlgeschlagen: Der Account existiert bereits.</p>';
  87. }
  88.  
  89. }
  90. else {
  91. echo'<p class="meldung">Registrierung fehlgeschlagen: bitte alle Felder richtig angeben</p>';
  92. }
  93. }
  94. ?><align="center"><img src="img/icons/password2.png" hight="50" width="50"/>
  95. <p>Wszystkie pola musza zostac wypelnione<?PHP if($serverSettings['mail_activation']) { echo'<br/><b>Der Account wird per E-Mail aktiviert, also eine richtige E-Mail eingeben!</b>'; } ?></p>
  96. <form action="index.php?s=register" method="POST">
  97. <table>
  98. <tr>
  99. <th class="topLine">Konto:</th>
  100. <td class="tdunkel"><input type="text" name="account" maxlength="16" size="16"/> 8-16 Znakow (tylko a-Z,0-9)</td>
  101. </tr>
  102. <tr>
  103. <th class="topLine">Nazwa:</th>
  104. <td class="thell"><input type="text" name="uname" maxlength="16" size="16"/> 3-20 Znakow (tylko a-Z,0-9)</td>
  105. </tr>
  106. <tr>
  107. <th class="topLine">Haslo:</th>
  108. <td class="tdunkel"><input type="password" name="pass" maxlength="16" size="16"/> 8-16 Znakow (tylko a-Z,0-9)</td>
  109. </tr>
  110. <tr>
  111. <th class="topLine">Potwierdz haslo:</th>
  112. <td class="thell"><input type="password" name="pass2" maxlength="16" size="16"/></td>
  113. </tr>
  114. <tr>
  115. <th class="topLine">E-Mail:</th>
  116. <td class="tdunkel"><input type="text" name="email" maxlength="50" size="25"/> max. 40 Znakow</td>
  117. </tr>
  118. <tr>
  119. <th class="topLine">Potwierdz E-Mail:</th>
  120. <td class="thell"><input type="text" name="email2" maxlength="50" size="25"/></td>
  121. </tr>
  122. <tr>
  123. <th class="topLine">Kod usuniecia postaci:</th>
  124. <td class="tdunkel"><input type="text" name="loeschcode" maxlength="7" size="7"/> 7 Znakow (tylko a-Z,0-9)</td>
  125. </tr>
  126. <tr>
  127. <th class="topLine">Pytanie:</th>
  128. <td class="thell">
  129. <select name="sicherheitsf">
  130. <?PHP
  131. foreach($sFrage AS $fragew => $frage) {
  132. echo'<option value="'.$fragew.'">'.$frage.'</option>';
  133. }
  134. ?>
  135. </select>
  136. <input type="text" name="sicherheitsa" maxlength="16" size="16"/> 3-16 Znakow (tylko a-Z,0-9)
  137. </td>
  138. </tr>
  139. <tr>
  140. <th class="topLine">Captcha:</th>
  141. <td class="tdunkel"><img src="./captcha/captcha.php" title="Captcha"/>&nbsp;<input type="text" name="captcha" maxlength="5" size="5"/></td>
  142. </tr>
  143. <tr>
  144. <th class="topLine" style="text-align:center;" colspan="2"><input type="submit" name="submit" value="zarejestruj"/> &bull; <input type="reset" value="anuluj"/></th>
  145. </tr>
  146. </table>
  147. </form>
  148. <?PHP
  149. }
  150. else {
  151. echo'<p class="meldung">Die Registration ist deaktiviert oder Sie sind bereits angemeldet. Es kann kein weiterer Account erstellt werden.</p>';
  152. }
  153. ?>
  154.  
  155. </div>
  156.  
  157. </div>
  158. <div class="postui2 text-end">
  159.  
  160.  
  161.  
  162. </div></div>


blooregard
Zacznij od tego:

Temat: Najczestsze bledy
geralt55
Dzięki już sobie poradziłem. thumbsupsmileyanim.gif
To jest wersja lo-fi głównej zawartości. Aby zobaczyć pełną wersję z większą zawartością, obrazkami i formatowaniem proszę kliknij tutaj.
Invision Power Board © 2001-2025 Invision Power Services, Inc.