Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 10 of 10
  1. #1
    New Coder
    Join Date
    Feb 2008
    Posts
    30
    Thanks
    0
    Thanked 0 Times in 0 Posts

    can someone tell me wats wrong

    when I upload this "register.php" to my site and try to use it it doesn't work. it keeps saying there is an error on LINE 208.
    Thanks for everything in advanced.
    Code:
    <? 
    session_start();
    ?>
    <? include('header.php'); ?>
    <?
    
    if(isset($_COOKIE["usNick"]) && isset($_COOKIE["usPass"]))
    {
    
    ?>
    
    <b><a href="#" onClick="window.location.reload()">Reload Page</a></b>
    
    <? include('footer.php'); ?>
    
    
    <? exit(); } ?>
    
    
    
    <?
    
    
    
    // incluimos archivos necesarios
    
    require('config.php');
    //require('admin/funciones.php');
    
    if (isset($_POST["username"])) {
     
    if( strtolower($_POST['code'])!= strtolower($_SESSION['texto'])){ 
    
    echo "<br><br>Error: Please enter the correct security code. If you have problems seeing the security code, please contact our staff.  "; 
    
    include('footer.php'); exit();
    }
    
    
    // Declaramos las variables
    
    $username = $_POST["username"];
    $password = $_POST["password"];
    $cpassword = $_POST["cpassword"];
    $email = $_POST["email"];
    $cemail = $_POST["cemail"];
    $pemail = $_POST["pemail"];
    $country = $_POST["country"];
    
    
    // comprobamos que no haya campos en blanco
    
    if($username==NULL|$password==NULL|$cpassword==NULL|$email==NULL|$cemail==NULL) {
    echo "Error: Please enter information for all *required fields.";
    }else{
    
    if($username==NULL) {
    echo "Error: Please enter a valid username.";
    }else{
    
    if($password==NULL) {
    echo "Error: Please enter a valid password.";
    }else{
    
    if($email==NULL) {
    echo "Error: Please enter a valid E-Mail address.";
    }else{
    
    
    // sanitizamos las variables
    
    $username = uc($username);
    $password = uc($password);
    $cpassword = uc($cpassword);
    $email = limpiar($email);
    $cemail = limpiar($cemail);
    $pemail = limpiar($pemail);
    $country = limpiar($country);
    
    
    // limitamos el numero de caracteres
    
    $username=limitatexto($username,15);
    $password=limitatexto($password,15);
    $cpassword=limitatexto($cpassword,15);
    $email=limitatexto($email,100);
    $cemail=limitatexto($cemail,100);
    $pemail=limitatexto($pemail,100);
    $country=limitatexto($country,15);
    
    
    // comprobamos que tengan un minimo de caracteres
    
    minimo($username);
    minimopass($password);
    
    
    // &#191;Coinciden las contrase&#241;as?
    if($password!=$cpassword) {
    echo "Error: The passwords you entered do not match.";
    }else{
    
    
    // &#191;Coinciden los emails?
    if($email!=$cemail) {
    echo "Error: The E-mails you entered do not match.";
    }else{
    
    
    // Comprobamos que sea un email valido
    ValidaMail($email);
    
    
    // Comprobamos que sea un email valido
    ValidaMail($pemail);
    
    
    
    
    
    // Comprobamos que no se haya creado otra cuenta desde la misma ip
    
    $laip = getRealIP();
    
    
    if($laip!="127.0.0.1")
    {
    
        $checkip = mysql_query("SELECT ip FROM tb_users WHERE ip='$laip'");
        $ip_exist = mysql_num_rows($checkip);
    
    }
    
    if ($ip_exist>0) {
    echo "Error: You have already created an account! Multiple accounts is against our Terms Of Service.";
    }else{
    
    
    // Comprobamos que el nombre de usuario, email y el email de paypal no existan
    
    $checkuser = mysql_query("SELECT username FROM tb_users WHERE username='$username'");
    $username_exist = mysql_num_rows($checkuser);
    
    $checkemail = mysql_query("SELECT email FROM tb_users WHERE email='$email'");
    $email_exist = mysql_num_rows($checkemail);
    
    $checkpemail = mysql_query("SELECT pemail FROM tb_users WHERE pemail='$pemail'");
    $pemail_exist = mysql_num_rows($checkpemail);
    
    if ($email_exist>0|$username_exist>0) {
    echo "Error: The Username or E-Mail address you have entered is already in use.";
    }else{
    
    if ($pemail_exist>0) {
    echo "Error: The PayPal E-mail address you have entered is either invalid or already in use.";
    }else{
    
    
    // Si se ha introducido un referer comprobamos que exista
    
    if ($_POST["referer"] != "") {
    
    // Sanitizamos la variable
    
    $referer = limpiar($_POST["referer"]);
    $referer=limitatexto($referer,15);
    
    $checkref = mysql_query("SELECT username FROM tb_users WHERE username='$referer'");
    $referer_exist = mysql_num_rows($checkref);
    
    if ($referer_exist<1) {
    // En caso de no existir el referer damos un mensaje de error
    echo "Error: The Referer that you have entered does not exist."; include('footer.php');exit();
    }else{
    // Si todo parece correcto procedemos con la inserccion
          $sqlz = "SELECT * FROM tb_users WHERE username='$referer'";
          $resultz = mysql_query($sqlz);        
          $myrowz = mysql_fetch_array($resultz);
    
    $numero=$myrowz["referals"];
    
          $sqlex = "UPDATE tb_users SET referals='$numero' +1 WHERE username='$referer'";
          $resultex = mysql_query($sqlex);
    }
    
    }
    
    
    // Si todo parece correcto procedemos con la inserccion
    
    $joindate=time();
    
    $query = "INSERT INTO tb_users (username, password, ip, email, pemail, referer, country, joindate) VALUES('$username','$password','$laip','$email','$pemail','$referer','$country','$joindate')";
    mysql_query($query) or die(mysql_error());
    
    echo "Congratulations! You have successfully created an account <b>$username</b>. Login and start earning money! <a href=\"login.php\">login</a>.";
    
    
    }
    }
    }
    }
    }
    }
    
    // En caso de no haber sido enviado los datos mostramos el formulario
    
    }else{
    
    ?>
    <div align="center"><div id="form">
    
    <form action="register.php" method="POST">
    <fieldset><legend><center><h1>Register<h1></center></legend>
    <table width="400" border="0" align="center">
      <tr>
        <td width="150" align="left"><p><label>*Username:</label></p></td>
        <td width="250" align="left"><input type='text' size='15' maxlength='25' name='username' autocomplete="off" value="" tabindex="1" /></td>
      </tr>
      <tr>
        <td width="150" align="left"><p><label>*Password:</label></p></td>
    	<td width="250" align="left"><input type="password" size="25" maxlength="15" name="password" autocomplete="off" class="field" value="" tabindex="1" /></td>
      </tr>
      <tr>
        <td width="150" align="left"><p><label>*Confirm Password:</label></p></td>
    	<td width="250" align="left"><input type="password" size="25" maxlength="15" name="cpassword" autocomplete="off" class="field" value="" tabindex="1" /></td>
      </tr>
      <tr>
        <td width="150" align="left"><p><label>*E-Mail:</label></p></td>
    	<td width="250" align="left"><input type="text" size="25" maxlength="100" name="email" autocomplete="off" class="field" value="" tabindex="1" /></td>
      </tr>
      <tr>
        <td width="150" align="left"><p><label>*Confirm E-Mail:</label></p></td>
    	<td width="250" align="left"><input type="text" size="25" maxlength="100" name="cemail" autocomplete="off" class="field" value="" tabindex="1" /></td>
      </tr>
      <tr>
        <td width="150" align="left"><p><label>PayPal E-Mail:</label></p></td>
    	<td width="250" align="left"><input type="text" size="25" maxlength="100" name="pemail" autocomplete="off" class="field" value="" tabindex="1" /></td>
      </tr>
      <tr>
        <td width="150" align="left"><p><label>Country:</label></p></td>
    	<td width="250" align="left"><input type="text" size="25" maxlength="100" name="country" autocomplete="off" class="field" value="" tabindex="1" /></td>
      </tr>
      <tr>
        <td width="150" align="left"><p><label>Referrer:</label></p></td>
    	<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>
      </tr>
      <tr>
       <td width="150" align="left"><p><label>*Security Code:</label></p></td>
        <td width="250" align="left"><input type='text' size='3' maxlength='3' name='code' autocomplete="off" class="securitycode" value="" tabindex="3" />
          <img src="image.php?<?php echo $res; ?>" /></td>
      </tr>
      <tr>
        <td width="150" align="left">&nbsp;</td>
        <td width="250" align="right"><input type="submit" value="Enter" class="submit" tabindex="4" />
    	</td>
      </tr>
    </table>
    </form>
    </fieldset>
    </div></div>
    
    <?
    }
    ?>
    
    
    
    
    
    
    <? include('footer.php'); ?>

  • #2
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    What is the exact error and what is line 208?
    ||||If you are getting paid to do a job, don't ask for help on it!||||

  • #3
    New Coder
    Join Date
    Feb 2008
    Posts
    30
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I Have No Idea

  • #4
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    When you get the error copy and paste it here. Thats what I mean by the EXACT error.
    ||||If you are getting paid to do a job, don't ask for help on it!||||

  • #5
    New Coder
    Join Date
    Feb 2008
    Posts
    30
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I get this error: Parse error: syntax error, unexpected T_ELSE in /mnt/w0510/d03/s37/b02d224d/www/MYSITE.net/register.php on line 208

    LINE 208:
    Code:
    }else{
    Last edited by jayvee; 03-11-2008 at 06:01 AM.

  • #6
    Senior Coder rafiki's Avatar
    Join Date
    Aug 2006
    Location
    Floating around somewhere...
    Posts
    2,042
    Thanks
    19
    Thanked 42 Times in 42 Posts
    a couple of lines above 208? maybe missing an ; or something. or maybe use elseif

  • #7
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    Make sure your opening and closing brackets line up. Change this
    PHP Code:
    }

    // En caso de no haber sido enviado los datos mostramos el formulario

    }else{ 
    to this
    PHP Code:
                    }
                }
            }
        }
                      
    // En caso de no haber sido enviado los datos mostramos el formulario
        
    else
        { 
    Last edited by _Aerospace_Eng_; 03-11-2008 at 05:28 PM.
    ||||If you are getting paid to do a job, don't ask for help on it!||||

  • #8
    New Coder
    Join Date
    Feb 2008
    Posts
    30
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Code:
    }
    }
    }
    }
    }
    }
    
    // En caso de no haber sido enviado los datos mostramos el formulario
    
    }else{
    that is the current code. do I change the top "}" to the code u gave me as well? because when I tried it didn't work.

  • #9
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    Just use this
    PHP Code:
    <?php
      session_start
    ();
      include(
    'header.php');
      if (isset(
    $_COOKIE["usNick"]) && isset($_COOKIE["usPass"]))
      {
    ?>

    <b><a href="#" onClick="window.location.reload()">Reload Page</a></b>
    <?php
          
    include('footer.php');
          exit();
      }
    ?>
    <?php
      
    // incluimos archivos necesarios
      
    require('config.php');
      
    //require('admin/funciones.php');
      
    if (isset($_POST["username"]))
      {
          if (
    strtolower($_POST['code']) != strtolower($_SESSION['texto']))
          {
              echo 
    "<br><br>Error: Please enter the correct security code. If you have problems seeing the security code, please contact our staff.  ";
              include(
    'footer.php');
              exit();
          }
          
          
    // Declaramos las variables
          
    $username $_POST["username"];
          
    $password $_POST["password"];
          
    $cpassword $_POST["cpassword"];
          
    $email $_POST["email"];
          
    $cemail $_POST["cemail"];
          
    $pemail $_POST["pemail"];
          
    $country $_POST["country"];
          
          
    // comprobamos que no haya campos en blanco
          
    if ($username == null $password == null $cpassword == null $email == null $cemail == null)
          {
              echo 
    "Error: Please enter information for all *required fields.";
          }
          else
          {
              if (
    $username == null)
              {
                  echo 
    "Error: Please enter a valid username.";
              }
              else
              {
                  if (
    $password == null)
                  {
                      echo 
    "Error: Please enter a valid password.";
                  }
                  else
                  {
                      if (
    $email == null)
                      {
                          echo 
    "Error: Please enter a valid E-Mail address.";
                      }
                      else
                      {
                          
    // sanitizamos las variables
                          
    $username uc($username);
                          
    $password uc($password);
                          
    $cpassword uc($cpassword);
                          
    $email limpiar($email);
                          
    $cemail limpiar($cemail);
                          
    $pemail limpiar($pemail);
                          
    $country limpiar($country);
                          
                          
    // limitamos el numero de caracteres
                          
    $username limitatexto($username15);
                          
    $password limitatexto($password15);
                          
    $cpassword limitatexto($cpassword15);
                          
    $email limitatexto($email100);
                          
    $cemail limitatexto($cemail100);
                          
    $pemail limitatexto($pemail100);
                          
    $country limitatexto($country15);
                          
                          
    // comprobamos que tengan un minimo de caracteres
                          
    minimo($username);
                          
    minimopass($password);
                          
                          
    // ¿Coinciden las contraseñas?
                          
    if ($password != $cpassword)
                          {
                              echo 
    "Error: The passwords you entered do not match.";
                          }
                          else
                          {
                              
    // ¿Coinciden los emails?
                              
    if ($email != $cemail)
                              {
                                  echo 
    "Error: The E-mails you entered do not match.";
                              }
                              else
                              {
                                  
    // Comprobamos que sea un email valido
                                  
    ValidaMail($email);
                                  
                                  
    // Comprobamos que sea un email valido
                                  
    ValidaMail($pemail);
                                  
                                  
                                  
    // Comprobamos que no se haya creado otra cuenta desde la misma ip
                                  
    $laip getRealIP();
                                  
                                  if (
    $laip != "127.0.0.1")
                                  {
                                      
    $checkip mysql_query("SELECT ip FROM tb_users WHERE ip='$laip'");
                                      
    $ip_exist mysql_num_rows($checkip);
                                  }
                                  if (
    $ip_exist 0)
                                  {
                                      echo 
    "Error: You have already created an account! Multiple accounts is against our Terms Of Service.";
                                  }
                                  else
                                  {
                                      
    // Comprobamos que el nombre de usuario, email y el email de paypal no existan
                                      
    $checkuser mysql_query("SELECT username FROM tb_users WHERE username='$username'");
                                      
    $username_exist mysql_num_rows($checkuser);
                                      
    $checkemail mysql_query("SELECT email FROM tb_users WHERE email='$email'");
                                      
    $email_exist mysql_num_rows($checkemail);
                                      
    $checkpemail mysql_query("SELECT pemail FROM tb_users WHERE pemail='$pemail'");
                                      
    $pemail_exist mysql_num_rows($checkpemail);
                                      if (
    $email_exist $username_exist 0)
                                      {
                                          echo 
    "Error: The Username or E-Mail address you have entered is already in use.";
                                      }
                                      else
                                      {
                                          if (
    $pemail_exist 0)
                                          {
                                              echo 
    "Error: The PayPal E-mail address you have entered is either invalid or already in use.";
                                          }
                                          else
                                          {
                                              
    // Si se ha introducido un referer comprobamos que exista
                                              
    if ($_POST["referer"] != "")
                                              {
                                                  
    // Sanitizamos la variable
                                                  
    $referer limpiar($_POST["referer"]);
                                                  
    $referer limitatexto($referer15);
                                                  
    $checkref mysql_query("SELECT username FROM tb_users WHERE username='$referer'");
                                                  
    $referer_exist mysql_num_rows($checkref);
                                                  if (
    $referer_exist 1)
                                                  {
                                                      
    // En caso de no existir el referer damos un mensaje de error
                                                      
    echo "Error: The Referer that you have entered does not exist.";
                                                      include(
    'footer.php');
                                                      exit();
                                                  }
                                                  else
                                                  {
                                                      
    // Si todo parece correcto procedemos con la inserccion
                                                      
    $sqlz "SELECT * FROM tb_users WHERE username='$referer'";
                                                      
    $resultz mysql_query($sqlz);
                                                      
    $myrowz mysql_fetch_array($resultz);
                                                      
    $numero $myrowz["referals"];
                                                      
    $sqlex "UPDATE tb_users SET referals='$numero' +1 WHERE username='$referer'";
                                                      
    $resultex mysql_query($sqlex);
                                                  }
                                              }
                                              
                                              
    // Si todo parece correcto procedemos con la inserccion
                                              
    $joindate time();
                                              
    $query "INSERT INTO tb_users (username, password, ip, email, pemail, referer, country, joindate) VALUES('$username','$password','$laip','$email','$pemail','$referer','$country','$joindate')";
                                              
    mysql_query($query) or die(mysql_error());
                                              echo 
    "Congratulations! You have successfully created an account <b>$username</b>. Login and start earning money! <a href=\"login.php\">login</a>.";
                                          }
                                      }
                                  }
                              }
                          }
                      }
                  }
              }
          }
      }
      
    // En caso de no haber sido enviado los datos mostramos el formulario
      
    else
      {
    ?>
    <div align="center">
        <div id="form">
            <form action="register.php" method="POST">
                <fieldset>
                <legend>
                <center>
                <h1>
                Register
                <h1>
                </center>
                </legend>
                <table width="400" border="0" align="center">
                    <tr>
                        <td width="150" align="left"><p>
                                <label>*Username:</label>
                            </p></td>
                        <td width="250" align="left"><input type='text' size='15' maxlength='25' name='username' autocomplete="off" value="" tabindex="1" /></td>
                    </tr>
                    <tr>
                        <td width="150" align="left"><p>
                                <label>*Password:</label>
                            </p></td>
                        <td width="250" align="left"><input type="password" size="25" maxlength="15" name="password" autocomplete="off" class="field" value="" tabindex="1" /></td>
                    </tr>
                    <tr>
                        <td width="150" align="left"><p>
                                <label>*Confirm Password:</label>
                            </p></td>
                        <td width="250" align="left"><input type="password" size="25" maxlength="15" name="cpassword" autocomplete="off" class="field" value="" tabindex="1" /></td>
                    </tr>
                    <tr>
                        <td width="150" align="left"><p>
                                <label>*E-Mail:</label>
                            </p></td>
                        <td width="250" align="left"><input type="text" size="25" maxlength="100" name="email" autocomplete="off" class="field" value="" tabindex="1" /></td>
                    </tr>
                    <tr>
                        <td width="150" align="left"><p>
                                <label>*Confirm E-Mail:</label>
                            </p></td>
                        <td width="250" align="left"><input type="text" size="25" maxlength="100" name="cemail" autocomplete="off" class="field" value="" tabindex="1" /></td>
                    </tr>
                    <tr>
                        <td width="150" align="left"><p>
                                <label>PayPal E-Mail:</label>
                            </p></td>
                        <td width="250" align="left"><input type="text" size="25" maxlength="100" name="pemail" autocomplete="off" class="field" value="" tabindex="1" /></td>
                    </tr>
                    <tr>
                        <td width="150" align="left"><p>
                                <label>Country:</label>
                            </p></td>
                        <td width="250" align="left"><input type="text" size="25" maxlength="100" name="country" autocomplete="off" class="field" value="" tabindex="1" /></td>
                    </tr>
                    <tr>
                        <td width="150" align="left"><p>
                                <label>Referrer:</label>
                            </p></td>
                        <td width="250" align="left"><input type="text" size="25" maxlength="15" name="referer" value="<?php echo limpiar($_GET["r"]);?>" autocomplete="off" class="field" value="" tabindex="1" /></td>
                    </tr>
                    <tr>
                        <td width="150" align="left"><p>
                                <label>*Security Code:</label>
                            </p></td>
                        <td width="250" align="left"><input type='text' size='3' maxlength='3' name='code' autocomplete="off" class="securitycode" value="" tabindex="3" />
                            <img src="image.php?<?php echo $res;?>" /></td>
                    </tr>
                    <tr>
                        <td width="150" align="left">&nbsp;</td>
                        <td width="250" align="right"><input type="submit" value="Enter" class="submit" tabindex="4" />
                        </td>
                    </tr>
                </table>
            </form>
            </fieldset>
        </div>
    </div>
    <?php
      
    }
      include(
    'footer.php');
    ?>
    Last edited by _Aerospace_Eng_; 03-11-2008 at 09:35 PM.
    ||||If you are getting paid to do a job, don't ask for help on it!||||

  • #10
    New Coder
    Join Date
    Feb 2008
    Posts
    30
    Thanks
    0
    Thanked 0 Times in 0 Posts
    thanks man it works great! I love this forum.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •