1. <?
  2. session_start();
  3. ?>
  4. <? include('header.php'); ?>
  5.  
  6. .style2 {color: #c21b1b}
  7.  
  8. <?
  9.  
  10. if(isset($_COOKIE["usNick"]) && isset($_COOKIE["usPass"]))
  11. {
  12.  
  13. ?>
  14.  
  15. <b><a href="#" onClick="window.location.reload()">Reload Page</a></b>
  16.  
  17. <? include('footer.php'); ?>
  18.  
  19.  
  20. <? exit(); } ?>
  21.  
  22.  
  23.  
  24. <?
  25.  
  26.  
  27.  
  28. // incluimos archivos necesarios
  29.  
  30. require('config.php');
  31. //require('admin/funciones.php');
  32.  
  33. if (isset($_POST["username"])) {
  34.  
  35. if( strtolower($_POST['code'])!= strtolower($_SESSION['texto'])){
  36.  
  37. echo "<br><br>Error: Please enter the correct security code. If you have problems seeing the security code, please contact our staff. ";
  38.  
  39. include('footer.php'); exit();
  40. }
  41.  
  42.  
  43. // Declaramos las variables
  44.  
  45. $username = $_POST["username"];
  46. $password = $_POST["password"];
  47. $cpassword = $_POST["cpassword"];
  48. $email = $_POST["email"];
  49. $cemail = $_POST["cemail"];
  50. $pemail = $_POST["pemail"];
  51. $country = $_POST["country"];
  52.  
  53.  
  54. // comprobamos que no haya campos en blanco
  55.  
  56. if($username==NULL|$password==NULL|$cpassword==NULL|$email==NULL|$cemail==NULL) {
  57. echo "Error: Please enter information for all *required fields.";
  58. }else{
  59.  
  60. if($username==NULL) {
  61. echo "Error: Please enter a valid username.";
  62. }else{
  63.  
  64. if($password==NULL) {
  65. echo "Error: Please enter a valid password.";
  66. }else{
  67.  
  68. if($email==NULL) {
  69. echo "Error: Please enter a valid E-Mail address.";
  70. }else{
  71.  
  72.  
  73. // sanitizamos las variables
  74.  
  75. $username = uc($username);
  76. $password = uc($password);
  77. $cpassword = uc($cpassword);
  78. $email = limpiar($email);
  79. $cemail = limpiar($cemail);
  80. $pemail = limpiar($pemail);
  81. $country = limpiar($country);
  82.  
  83.  
  84. // limitamos el numero de caracteres
  85.  
  86. $username=limitatexto($username,15);
  87. $password=limitatexto($password,15);
  88. $cpassword=limitatexto($cpassword,15);
  89. $email=limitatexto($email,100);
  90. $cemail=limitatexto($cemail,100);
  91. $pemail=limitatexto($pemail,100);
  92. $country=limitatexto($country,15);
  93.  
  94.  
  95. // comprobamos que tengan un minimo de caracteres
  96.  
  97. minimo($username);
  98. minimopass($password);
  99.  
  100.  
  101. // ¿Coinciden las contraseñas?
  102. if($password!=$cpassword) {
  103. echo "Error: The passwords you entered do not match.";
  104. }else{
  105.  
  106.  
  107. // ¿Coinciden los emails?
  108. if($email!=$cemail) {
  109. echo "Error: The E-mails you entered do not match.";
  110. }else{
  111.  
  112.  
  113. // Comprobamos que sea un email valido
  114. ValidaMail($email);
  115.  
  116.  
  117. // Comprobamos que sea un email valido
  118. ValidaMail($pemail);
  119.  
  120.  
  121.  
  122.  
  123.  
  124. // Comprobamos que no se haya creado otra cuenta desde la misma ip
  125.  
  126. $laip = getRealIP();
  127.  
  128.  
  129. if($laip!="127.0.0.1")
  130. {
  131.  
  132. $checkip = mysql_query("SELECT ip FROM tb_users WHERE ip='$laip'");
  133. $ip_exist = mysql_num_rows($checkip);
  134.  
  135. }
  136.  
  137. if ($ip_exist>0) {
  138. echo "Error: You have created an account.";
  139. }else{
  140.  
  141.  
  142. // Comprobamos que el nombre de usuario, email y el email de paypal no existan
  143.  
  144. $checkuser = mysql_query("SELECT username FROM tb_users WHERE username='$username'");
  145. $username_exist = mysql_num_rows($checkuser);
  146.  
  147. $checkemail = mysql_query("SELECT email FROM tb_users WHERE email='$email'");
  148. $email_exist = mysql_num_rows($checkemail);
  149.  
  150. $checkpemail = mysql_query("SELECT pemail FROM tb_users WHERE pemail='$pemail'");
  151. $pemail_exist = mysql_num_rows($checkpemail);
  152.  
  153. if ($email_exist>0|$username_exist>0) {
  154. echo "Error: The Username or E-Mail address you have entered is already in use.";
  155. }else{
  156.  
  157. if ($pemail_exist>0) {
  158. echo "Error: The PayPal E-mail address you have entered is either invalid or already in use.";
  159. }else{
  160.  
  161.  
  162. // Si se ha introducido un referer comprobamos que exista
  163.  
  164. if ($_POST["referer"] != "") {
  165.  
  166. // Sanitizamos la variable
  167.  
  168. $referer = limpiar($_POST["referer"]);
  169. $referer=limitatexto($referer,15);
  170.  
  171. $checkref = mysql_query("SELECT username FROM tb_users WHERE username='$referer'");
  172. $referer_exist = mysql_num_rows($checkref);
  173.  
  174. if ($referer_exist<1) {
  175. // En caso de no existir el referer damos un mensaje de error
  176. echo "Error: The Referer that you have entered does not exist."; include('footer.php');exit();
  177. }else{
  178. // Si todo parece correcto procedemos con la inserccion
  179. $sqlz = "SELECT * FROM tb_users WHERE username='$referer'";
  180. $resultz = mysql_query($sqlz);
  181. $myrowz = mysql_fetch_array($resultz);
  182.  
  183. $numero=$myrowz["referals"];
  184.  
  185. $sqlex = "UPDATE tb_users SET referals='$numero' +1 WHERE username='$referer'";
  186. $resultex = mysql_query($sqlex);
  187. }
  188.  
  189. }
  190.  
  191.  
  192. // Si todo parece correcto procedemos con la inserccion
  193.  
  194. $joindate=time();
  195.  
  196. $query = "INSERT INTO tb_users (username, password, ip, email, pemail, referer, country, joindate) VALUES('$username','$password','$laip','$email','$pemail','$referer','$country','$joindate')";
  197. mysql_query($query) or die(mysql_error());
  198.  
  199. echo "Congratulations! You have successfully registered <b>$username</b>. Login now and start earning money! <a href=\"login.php\">login</a>.";
  200.  
  201.  
  202. }
  203. }
  204. }
  205. }
  206. }
  207. }
  208.  
  209. // En caso de no haber sido enviado los datos mostramos el formulario
  210.  
  211. }else{
  212.  
  213. ?>
  214. <div align="center"><div id="form">
  215.  
  216. <form action="register.php" method="POST">
  217. <fieldset><legend><center><h1><span class="style2">Register</span></h1></center></legend>
  218. <table width="400" border="0" align="center">
  219. <tr>
  220. <td width="150" align="left"><p><label>*Username:</label></p></td>
  221. <td width="250" align="left"><input type='text' size='15' maxlength='25' name='username' autocomplete="off" value="" tabindex="1" /></td>
  222. </tr>
  223. <tr>
  224. <td width="150" align="left"><p><label>*Password:</label></p></td>
  225. <td width="250" align="left"><input type="password" size="25" maxlength="15" name="password" autocomplete="off" class="field" value="" tabindex="1" /></td>
  226. </tr>
  227. <tr>
  228. <td width="150" align="left"><p><label>*Confirm Password:</label></p></td>
  229. <td width="250" align="left"><input type="password" size="25" maxlength="15" name="cpassword" autocomplete="off" class="field" value="" tabindex="1" /></td>
  230. </tr>
  231. <tr>
  232. <td width="150" align="left"><p><label>*E-Mail:</label></p></td>
  233. <td width="250" align="left"><input type="text" size="25" maxlength="100" name="email" autocomplete="off" class="field" value="" tabindex="1" /></td>
  234. </tr>
  235. <tr>
  236. <td width="150" align="left"><p><label>*Confirm E-Mail:</label></p></td>
  237. <td width="250" align="left"><input type="text" size="25" maxlength="100" name="cemail" autocomplete="off" class="field" value="" tabindex="1" /></td>
  238. </tr>
  239. <tr>
  240. <td width="150" align="left"><p><label>PayPal E-Mail:</label></p></td>
  241. <td width="250" align="left"><input type="text" size="25" maxlength="100" name="pemail" autocomplete="off" class="field" value="" tabindex="1" /></td>
  242. </tr>
  243. <tr>
  244. <td width="150" align="left"><p><label>Country:</label></p></td>
  245. <td width="250" align="left"><input type="text" size="25" maxlength="100" name="country" autocomplete="off" class="field" value="" tabindex="1" /></td>
  246. </tr>
  247. <tr>
  248. <td width="150" align="left"><p><label>Referrer:</label></p></td>
  249. <td width="250" align="left"><input type="text" size="25" maxlength="15" name="referer" value="<? echo limpiar($_GET["r"]); ?>" autocomplete="off" class="field" value="" tabindex="1" /></td>
  250. </tr>
  251. <tr>
  252. <td width="150" align="left"><p><label>*Security Code:</label></p></td>
  253. <td width="250" align="left"><input type='text' size='3' maxlength='3' name='code' autocomplete="off" class="securitycode" value="" tabindex="3" />
  254. <img src="image.php?<?php echo $res; ?>" /></td>
  255. </tr>
  256. <tr>
  257. <td width="150" align="left"> </td>
  258. <td width="250" align="right"><input type="submit" value="Enter" class="submit" tabindex="4" />
  259. </td>
  260. </tr>
  261. </table>
  262. </form>
  263. </fieldset>
  264. </div></div>
  265.  
  266. <?
  267. }
  268. ?>
  269.  
  270.  
  271.  
  272.  
  273.  
  274.  
  275. <? include('footer.php'); ?>
  276.