Jump to content

Recommended Posts

Hey im trying to add a homepage to my server everything seems to be working apart from the register.php script.

This is the original page: Click Here!

Here is the register.php

Register.php 

<h2>Registration</h2>
<?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'])) {
  
    if(isset($_POST['submit']) && strtolower($_POST['submit']) == 'registrieren') {
      
      $error = false;
      $errorString = "";

      if(empty($_POST['login'])) {
        $errorString .= '<li>You must insert a username to continue</li>';
      } elseif(strlen($_POST['login']) > 16) {
        $errorString .= '<li>The username can only have a maximum of 16 characters</li>';
      } elseif(strlen($_POST['login']) < 5) {
        $errorString .= '<li>The username must have a minimum of 5 characters</li>';
      } elseif(!ctype_alnum(str_replace(' ', '', $_POST['login']))) {
        $errorString .= '<li>The username can only contain letters or numbers</li>';
      } else {
        $login = mysql_real_escape_string($_POST['login']);
      }

      if(empty($_POST['real_name'])) {
        $errorString .= '<li>You must insert a name to continue</li>';
      } elseif(strlen($_POST['real_name']) > 20) {
        $errorString .= '<li>The name can only have a maximum of 20 characters</li>';
      } elseif(strlen($_POST['real_name']) < 3) {
        $errorString .= '<li>The name must have a minimum of 3 characters</li>';
      } elseif(!ctype_alnum(str_replace(' ', '', $_POST['real_name']))) {
        $errorString .= '<li>The name can only contain letters or numbers</li>';
      } else {
        $real_name = mysql_real_escape_string($_POST['real_name']);
      }

      if(empty($_POST['password'])) {
        $errorString .= '<li>You must insert a password to continue</li>';
      } elseif(strlen($_POST['password']) > 32) {
        $errorString .= '<li>The password can only have a maximum of 32 characters</li>';
      } elseif(strlen($_POST['password']) < 8) {
        $errorString .= '<li>The password must have a minimum of 8 characters</li>';
      } else {
        $password = mysql_real_escape_string($_POST['password']);
      }

      if(empty($_POST['email'])) {
        $errorString .= '<li>You must insert an email address to continue</li>';
      } elseif($_POST['email'] === false) {
        $errorString .= '<li>The email address you have provided is invalid</li>';
      } else {
        $email = mysql_real_escape_string($_POST['email']);
        $qry = mysql_query("SELECT email FROM account.account WHERE email = '" . $email . "'", $sqlServ);
        if($qry && mysql_num_rows($qry) > 0) {
          $errorString .= '<li>This email already belongs to another username on the server</li>';
        }
      }

      if(empty($_POST['social_id'])) {
        $errorString .= '<li>You must insert a deletion code to continue</li>';
      } elseif(strlen($_POST['social_id']) != 7) {
        $errorString .= '<li>The deletion code can only have a minimum of 7 characters</li>';
      } elseif(!ctype_alnum($_POST['social_id'])) {
        $errorString .= '<li>The deletion code can only contain letters or numbers</li>';
      } else {
        $social_id = mysql_real_escape_string($_POST['social_id']);
      }

      if(empty($_POST['sicherheitsa'])) {
        $errorString .= '<li>You must insert a security answer to continue</li>';
      } elseif(strlen($_POST['sicherheitsa']) < 3) {
        $errorString .= '<li>The security answer can only have a minimum of 7 characters</li>';
      } elseif(strlen($_POST['sicherheitsa']) > 16) {
        $errorString .= '<li>The security answer can only have a maxium of 16 characters</li>';
      } elseif(!ctype_alnum($_POST['sicherheitsa'])) {
        $errorString .= '<li>The security answer can only contain letters or numbers</li>';
      } elseif(empty($_POST['sicherheitsf']) || !is_numeric($_POST['sicherheitsf'])) {
        $errorString .= '<li>Please select a security question to continue</li>';
      } else {
        $hashSF = md5($_POST['sicherheitsa']);
        $sfNum = mysql_real_escape_string($_POST['sicherheitsf']);
      }

      if(empty($_SESSION['captcha_id']) || empty($_POST['captcha'])) {
        $errorString .= '<li>You must insert an answer to the captcha to continue</li>';
      } elseif($_POST['captcha'] != $_SESSION['captcha_id']) {
        $errorString .= '<li>The captcha you have inserted is incorrect.Please enter the correct one</li>';
      }

      if(!empty($errorString)) {
        $error = true;
      }

      if($error) {
        echo '<div class="meldung">';
        echo '<p><strong>These errors have occurred during the registration:</strong></p>';
        echo '<ul>';
        echo $errorString;
        echo '</ul>';
        echo '</div>';

      } else {
        $sqlCmd = "INSERT INTO account.account 
        (login,password,real_name,email,social_id,question1,answer1,create_time,status,coins,autoloot_expire,safebox_expire) 
        VALUES 
        ('" . $login . "',PASSWORD('" . $password . "'),'" . $real_name . "','" . $email . "','" . $social_id . "','" . $sfNum . "','" . $hashSF . "','" . $sqlZeit . "','OK','" . $regCoins . "','" . $expireDate . "','" . $expireDate."')";
        $sqlQry = mysql_query($sqlCmd,$sqlServ);

        if($sqlQry) {
          echo'<p class="meldung">Registration successful : You can login to your account now.</p>';
        } else {
          echo'<p class="meldung">Registration failed : Please fill in all fields properly.</p>';
        }
      }
    }

    if(!isset($error) || $error) {

  ?>
    <form action="index.php?s=register" method="POST" id="registerForm">
      <table>
        <tr>
          <th class="topLine">Account:</th>
          <td class="tdunkel"><input type="text" name="login" maxlength="16" size="16" placeholder="5-16 Characters (only a-Z,0-9)"<?php echo isset($_POST['login']) ? ' value="' . $_POST['login'] . '"' : ''; ?>></td>
        </tr>
        <tr>
          <th class="topLine">Name:</th>
          <td class="thell"><input type="text" name="real_name" maxlength="20" size="16" placeholder="3-20 Characters (only a-Z,0-9)"<?php echo isset($_POST['name']) ? ' value="' . $_POST['name'] . '"' : ''; ?>></td>
        </tr>
        <tr>
          <th class="topLine">Password:</th>
          <td class="tdunkel"><input type="password" name="password" maxlength="32" size="16" placeholder="8-32 Characters (only a-Z,0-9)"></td>
        </tr>
        <tr>
          <th class="topLine">E-Mail:</th>
          <td class="tdunkel"><input type="text" name="email" maxlength="50" size="25" placeholder="max. 50 Characters"<?php echo isset($_POST['email']) ? ' value="' . $_POST['email'] . '"' : ''; ?>></td>
        </tr>
        <tr>
          <th class="topLine">L&ouml;schcode:</th>
          <td class="tdunkel"><input type="text" name="social_id" maxlength="7" size="7" placeholder="7 Characters (only a-Z,0-9)"<?php echo isset($_POST['social_id']) ? ' value="' . $_POST['social_id'] . '"' : ''; ?>></td>
        </tr>
        <tr>
          <th class="topLine">Security Question:</th>
          <td class="thell">
            <select name="sicherheitsf">
              <?PHP
                foreach($sFrage AS $fragew => $frage) {
                  echo'<option value="'.$fragew.'">'.$frage.'</option>';
                }
              ?>
            </select>
            <br/>
            <input type="text" name="sicherheitsa" maxlength="16" size="16" placeholder="3-16 Characters (only a-Z,0-9)">
          </td>
        </tr>
        <tr>
          <th class="topLine">Captcha:</th>
          <td class="tdunkel"><img src="./captcha/captcha.php" title="Captcha" class="captchaImg"/><br /><input type="text" name="captcha" maxlength="5" size="5"></td>
        </tr>
        <tr>
          <th class="topLine" style="text-align:center;" colspan="2"><input type="submit" name="submit" value="Register"></th>
        </tr>
      </table>
    </form>
  <?PHP
    }

  }
  else {
    echo'<p class="meldung">Registration is disabled or you are already logged in to an account. You must log out to create another account.</p>';
  }
?>
 

here is the table names for the required db:

id
login
password
real_name
social_id
email
phone1
phone2
address
zipcode
create_time
question1
answer1
question2
answer2
is_testor
status
securitycode
newsletter
empire
name_checked
availDt
mileage
cash
gold_expire
silver_expire
safebox_expire
autoloot_expire
fish_mind_expire
marriage_fast_expire
money_drop_rate_expire
ttl_cash
ttl_mileage
channel_company
last_play
coins
web_admin
web_ip
web_aktiviert
lastvote
dp
dm
admin
 

if u prefer to help me in private u can always pm me 

Link to comment
Share on other sites

  • Replies 1
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

Announcements



×
×
  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.