Advertisement
Guest User

register.php

a guest
Mar 5th, 2014
149
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 11.48 KB | None | 0 0
  1. <?php
  2. require_once 'engine/init.php';
  3. logged_in_redirect();
  4. include 'layout/overall/header.php';
  5.  
  6. if (empty($_POST) === false) {
  7.     // $_POST['']
  8.     $required_fields = array('username', 'password', 'password_again', 'email', 'selected');
  9.     foreach($_POST as $key=>$value) {
  10.         if (empty($value) && in_array($key, $required_fields) === true) {
  11.             $errors[] = 'You need to fill in all fields.';
  12.             break 1;
  13.         }
  14.     }
  15.    
  16.     // check errors (= user exist, pass long enough
  17.     if (empty($errors) === true) {
  18.         /* Token used for cross site scripting security */
  19.         if (!Token::isValid($_POST['token'])) {
  20.             $errors[] = 'Token is invalid.';
  21.         }
  22.  
  23.         if ($config['use_captcha']) {
  24.             include_once 'captcha/securimage.php';
  25.             $securimage = new Securimage();
  26.             if ($securimage->check($_POST['captcha_code']) == false) {
  27.               $errors[] = 'Captcha image verification was submitted wrong.';
  28.             }
  29.         }
  30.        
  31.         if (user_exist($_POST['username']) === true) {
  32.             $errors[] = 'Sorry, that Account Number already exist.';
  33.         }
  34.        
  35.         // Don't allow "default admin names in config.php" access to register.
  36.         $isNoob = in_array(strtolower($_POST['username']), $config['page_admin_access']) ? true : false;
  37.         if ($isNoob) {
  38.             $errors[] = 'This Account Number is blocked for registration.';
  39.         }
  40.         if (strtolower($_POST['username']) === true) {
  41.             $errors[] = 'Sorry, that Account Number already exist.';
  42.         }
  43.         if (preg_match("/^[0-9]+$/", $_POST['username']) == false) {
  44.             $errors[] = 'Your Account Number can only contain numbers.';
  45.         }
  46.         // name restriction
  47.         $resname = explode(" ", $_POST['username']);
  48.         foreach($resname as $res) {
  49.             if(in_array(strtolower($res), $config['invalidNameTags'])) {
  50.                 $errors[] = 'Your Account Number can only contain numbers.';
  51.             }
  52.             else if(strlen($res) < 5) {
  53.                 $errors[] = 'Too short numbers in your Account Number.';
  54.             }
  55.         }
  56.         // end name restriction
  57.         if (strlen($_POST['password']) < 6) {
  58.             $errors[] = 'Your password must be at least 6 characters.';
  59.         }
  60.         if (strlen($_POST['password']) > 32) {
  61.             $errors[] = 'Your password must be less than 33 characters.';
  62.         }
  63.         if ($_POST['password'] !== $_POST['password_again']) {
  64.             $errors[] = 'Your passwords do not match.';
  65.         }
  66.         if (filter_var($_POST['email'], FILTER_VALIDATE_EMAIL) === false) {
  67.             $errors[] = 'A valid email address is required.';
  68.         }
  69.         if (user_email_exist($_POST['email']) === true) {
  70.             $errors[] = 'That email address is already in use.';
  71.         }
  72.         if ($_POST['selected'] != 1) {
  73.             $errors[] = 'You are only allowed to have an account if you accept the rules.';
  74.         }
  75.         if (validate_ip(getIP()) === false && $config['validate_IP'] === true) {
  76.             $errors[] = 'Failed to recognize your IP address. (Not a valid IPv4 address).';
  77.         }
  78.     }
  79. }
  80.  
  81. ?>
  82. <h1>Register Account</h1>
  83. <?php
  84. if (isset($_GET['success']) && empty($_GET['success'])) {
  85.     echo 'Congratulations! Your account has been created. You may now login to create a character.';
  86. } else {
  87.     if (empty($_POST) === false && empty($errors) === true) {
  88.         if ($config['log_ip']) {
  89.             znote_visitor_insert_detailed_data(1);
  90.         }
  91.         //Register
  92.         $register_data = array(
  93.             'id'    =>  $_POST['username'],
  94.             'password'  =>  $_POST['password'],
  95.             'email'     =>  $_POST['email'],
  96.             'ip'    =>  ip2long(getIP()),
  97.             'created'   =>  time()
  98.         );
  99.        
  100.         user_create_account($register_data);
  101.         header('Location: register.php?success');
  102.         exit();
  103.         //End register
  104.        
  105.     } else if (empty($errors) === false){
  106.         echo '<font color="red"><b>';
  107.         echo output_errors($errors);
  108.         echo '</b></font>';
  109.     }
  110. ?>
  111.     <form action="" method="post">
  112.         <ul>
  113.             <li>
  114.                 Account Number:<br>
  115.                 <input type="text" name="username">
  116.             </li>
  117.             <li>
  118.                 Password:<br>
  119.                 <input type="password" name="password">
  120.             </li>
  121.             <li>
  122.                 Password again:<br>
  123.                 <input type="password" name="password_again">
  124.             </li>
  125.             <li>
  126.                 Email:<br>
  127.                 <input type="text" name="email">
  128.             </li>
  129.             <?php
  130.             if ($config['use_captcha']) {
  131.                 ?>
  132.                 <li>
  133.                     <b>Write the image symbols in the text field to verify that you are a human:</b>
  134.                     <img id="captcha" src="captcha/securimage_show.php" alt="CAPTCHA Image" /><br>
  135.                     <input type="text" name="captcha_code" size="10" maxlength="6" />
  136.                     <a href="#" onclick="document.getElementById('captcha').src = 'captcha/securimage_show.php?' + Math.random(); return false">[ Different Image ]</a><br><br>
  137.                 </li>
  138.                 <?php
  139.             }
  140.             ?>
  141.             <li>Server Rules<br>
  142.                 <td colspan="2"><div style="overflow-y: scroll; height: 760px;">
  143.                     <td>Tibia World RPG OldSchool is an online role-playing game in which thousands of players from all over the world meet everyday. In order to ensure that the game is fun for everyone, Tibia World RPG Team expects all players to behave in a reasonable and respectful manner.<br><br>
  144.                    
  145.                     Tibia World RPG Team reserves the right to stop destructive behaviour in the game, on the official website or in any other part of Tibia World RPG Team's services. Such behaviour includes, but is not limited to, the following offences:<br><br>
  146.                    
  147.                     <table border="0" cellpadding="0" cellspacing="0" width="100%"><tbody><tr><td width="15"></td><td><table border="0" cellpadding="0" cellspacing="2" width="100%">
  148.                     <tbody><tr><td><b>1.</b></td><td><b>Names</b></td></tr>
  149.                     <tr><td></td><td><table border="0" cellpadding="0" cellspacing="3" width="100%">
  150.                     <tbody><tr><td valign="top"><b>a)</b></td><td><b>Offensive Name</b><br>
  151.                     Names that are insulting, racist, sexually related, drug-related, harassing or generally objectionable.</td></tr>
  152.                     <tr><td valign="top"><b>b)</b></td><td><b>Invalid Name Format</b><br>
  153.                     Names that contain parts of sentences (except for guild names), badly formatted words or nonsensical combinations of letters.</td></tr>
  154.                     <tr><td valign="top"><b>c)</b></td><td><b>Name Containing Forbidden Advertising</b><br></td></tr>
  155.                     <tr><td valign="top"><b>d)</b></td><td><b>Unsuitable Name</b><br>
  156.                     Names that express religious or political views or generally do not fit into Tibia's medieval fantasy setting.</td></tr>
  157.                     <tr><td valign="top"><b>e)</b></td><td><b>Name Supporting Rule Violation</b><br>
  158.                     Names that support, incite, announce or imply a violation of the Tibia Rules.</td></tr>
  159.                     </tbody></table></td></tr>
  160.                     <tr><td colspan="2">&nbsp;</td></tr>
  161.                     <tr><td><b>2.</b></td><td><b>Statements</b></td></tr>
  162.                     <tr><td></td><td><table border="0" cellpadding="0" cellspacing="3" width="100%">
  163.                     <tbody><tr><td valign="top"><b>a)</b></td><td><b>Offensive Statement</b><br>
  164.                     Insulting, racist, sexually related, drug-related, harassing or generally objectionable statements.</td></tr>
  165.                     <tr><td valign="top"><b>b)</b></td><td><b>Spamming</b><br>
  166.                     Excessively repeating identical or similar statements or using badly formatted or nonsensical text.</td></tr>
  167.                     <tr><td valign="top"><b>c)</b></td><td><b>Forbidden Advertising</b><br>
  168.                     Advertising brands, products or services of third parties, content which is not related to the game or trades for real money.</td></tr>
  169.                     <tr><td valign="top"><b>d)</b></td><td><b>Off-Topic Public Statement</b><br>
  170.                     Religious or political public statements or other public statements which are not related to the topic of the used channel or board.</td></tr>
  171.                     <tr><td valign="top"><b>e)</b></td><td><b>Violating Language Restriction</b><br>
  172.                     Non-English statements in boards and channels where the use of English is explicitly required.</small></td></tr>
  173.                     <tr><td valign="top"><b>f)</b></td><td><b>Disclosing Personal Data of Others</b><br>
  174.                     Disclosing personal data of other people.</td></tr>
  175.                     <tr><td valign="top"><b>g)</b></td><td><b>Supporting Rule Violation</b><br>
  176.                     Statements that support, incite, announce or imply a violation of the Tibia Rules.</td></tr>
  177.                     </tbody></table></td></tr>
  178.                     <tr><td colspan="2">&nbsp;</td></tr>
  179.                     <tr><td><b>3.</b></td><td><b>Cheating</b></td></tr>
  180.                     <tr><td></td><td><table border="0" cellpadding="0" cellspacing="3" width="100%">
  181.                     <tbody><tr><td valign="top"><b>a)</b></td><td><b>Bug Abuse</b><br>
  182.                     Exploiting obvious errors of the game or any other part of Tibia World RPG Team's services.</td></tr>
  183.                     <tr><td valign="top"><b>b)</b></td><td><b>Using Unofficial Software to Play</b><br>
  184.                     Manipulating the official client program or using additional software to play the game.</td></tr>
  185.                     </tbody></table></td></tr>
  186.                     <tr><td colspan="2">&nbsp;</td></tr>
  187.                     <tr><td><b>4.</b></td><td><b>Tibia World RPG Team</b></td></tr>
  188.                     <tr><td></td><td><table border="0" cellpadding="0" cellspacing="3" width="100%">
  189.                     <tbody><tr><td valign="top"><b>a)</b></td><td><b>Pretending to be Tibia World RPG Team</b><br>
  190.                     Pretending to be a representative of Tibia World RPG Team or to have their legitimation or powers.</td></tr>
  191.                     <tr><td valign="top"><b>b)</b></td><td><b>Slandering or Agitating against Tibia World RPG Team</b><br>
  192.                     Publishing clearly wrong information about or calling a boycott against Tibia World RPG Team or its services.</td></tr>
  193.                     <tr><td valign="top"><b>c)</b></td><td><b>False Information to Tibia World RPG Team</b><br>
  194.                     Intentionally giving wrong or misleading information to Tibia World RPG Team in reports about rule violations, complaints, bug reports or support requests.</td></tr>
  195.                     </tbody></table></td></tr>
  196.                     <tr><td colspan="2">&nbsp;</td></tr>
  197.                     <tr><td><b>5.</b></td><td><b>Legal Issues</b></td></tr>
  198.                     <tr><td></td><td><table border="0" cellpadding="0" cellspacing="3" width="100%">
  199.                     <tbody><tr><td valign="top"><b>a)</b></td><td><b>Account Trading or Sharing</b><br>
  200.                     Offering account data to other players, accepting other players' account data or allowing other players to use your account.</td></tr>
  201.                     <tr><td valign="top"><b>b)</b></td><td><b>Hacking</b><br>
  202.                     Stealing other players' account or personal data.</td></tr>
  203.                     <tr><td valign="top"><b>c)</b></td><td><b>Attacking Tibia World RPG Team Service</b><br>
  204.                     Attacking, disrupting or damaging the operation of any Tibia World RPG Team server, the game or any other part of Tibia World RPG Team's services.</td></tr>
  205.                     <tr><td valign="top"><b>d)</b></td><td><b>Violating Law or Regulations</b><br>
  206.                     Violating any applicable law, the Tibia Service Agreement or rights of third parties.</td></tr>
  207.                     </tbody></table></td></tr>
  208.                     <tr><td colspan="2">&nbsp;</td></tr>
  209.                     </tbody></table></td><td width="15"></td></tr></tbody></table><br>
  210.                    
  211.                     Violating or attempting to violate the Tibia Rules may lead to a temporary suspension of characters and accounts. In severe cases the removal or modification of character skills, attributes and belongings, as well as the permanent removal of characters and accounts without any compensation may be considered. The sanction is based on the seriousness of the rule violation and the previous record of the player. It is determined at the sole discretion of Tibia World RPG Team and can be imposed without any previous warning.<br><br>
  212.                    
  213.                     These rules may be changed at any time. All changes will be announced on the official website.
  214.                     </td>
  215.                 </td>
  216.             </li><br>
  217.             <li>
  218.                 Do you agree to follow the Tibia World RPG OldSchool rules?<br>
  219.                 <select name="selected">
  220.                   <option value="1">Yes.</option>
  221.                   <option value="2">No.</option>
  222.                 </select>
  223.             </li>
  224.             <?php
  225.                 /* Form file */
  226.                 Token::create();
  227.             ?>
  228.             <li>
  229.                 <input type="submit" value="Create Account">
  230.             </li>
  231.         </ul>
  232.     </form>
  233. <?php
  234. }
  235. include 'layout/overall/footer.php';
  236. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement