Hello,
I'm building my own website without any knowledge of PHP, & i'm almost done with that..as my website works fine on my local server
i:e WAMPSERVER 2.0,
but the same code is not working on server...n i'm rilli piss'd of coz of that...

The error is :"PHP Parse error: syntax error, unexpected $end in /home/usang2me/public_html/sign_up.php on line 145"

"145" happens to be last line i:e "?>" , but here becoz of pattern..itz not into its proper way...

&
After filling the sign up form correctly . it says ALL FIELD ARE MANDATORY....i dont understand ...y so....i'm pasting my code here...please help me asap ...
each and every suggestion will be appreciat'd

Thanks Kunal

Here Is The Code:

<?php
$username = $_POST['username'];
$password1 = $_POST['password1'];
$password2 = $_POST['password2'];
$name = $_POST['name'];
$address = $_POST['address'];
$city = $_POST['city'];
$state = $_POST['state'];
$code = $_POST['code'];
$phone = $_POST['phone'];
$email = $_POST['email'];
//$bankname = $_POST['bankname'];
//$bankbranch = $_POST['bankbranch'];
//$accountnumber = $_POST['bankac'];
$refer_id = $_POST['refer_id'];
//$country = $_POST['country']; 
// Connects to your Database 
include('database_connect_local.php');
//This makes sure they did not leave any fields blank
$minuser_len = 6; //username minimum length
$minpass_len = 6; //password minimum length
$mincode_len = 6; //code minimum length
$minphone_len = 10; //phone minimum length
//$refer_id_len = 6; //refer_id minimum length

if (strlen($username) < $minuser_len || strlen($password1) < $minpass_len || strlen($code) < $mincode_len || strlen($phone) < $minphone_len)
{
echo "<html>";
echo "&nbsp;";
echo "&nbsp;";
echo "&nbsp;";
echo "&nbsp;";
echo "&nbsp;";
echo "&nbsp;";
echo "&nbsp;";
echo "&nbsp;";
echo "&nbsp;";
echo "<table align=center border=1 cellpadding=0 cellspacing=0  bordercolor=#FF6600 bgcolor=#C0C0C0 width=50% height=10>";
echo "<tr> <td align=center><p font color=black span style=font-size:11pt;><b>Minimum length values for Username or Password or Pincode or Mobile is missing. Please try again with correct values.</b></span></font></p></td> </tr> </table> </html>";
    include 'signup.php';
exit;
//die("User/password was not long enough!");
}elseif (!is_numeric($code) || !is_numeric($phone)){
echo "<html>";
echo "&nbsp;";
echo "&nbsp;";
echo "&nbsp;";
echo "&nbsp;";
echo "&nbsp;";
echo "&nbsp;";
echo "&nbsp;";
echo "&nbsp;";
echo "&nbsp;";
echo "<table align=center border=1 cellpadding=0 cellspacing=0  bordercolor=#FF6600 bgcolor=#C0C0C0 width=50% height=10>";
echo "<tr> <td align=center><p font color=black span style=font-size:11pt;><b>Non Numeric Character Where only Numeric Value is Allowed.</b></span></font></p></td> </tr> </table> </html>";
    include 'signup.php';
exit;
//}elseif (empty($username)|| empty($password1) || empty($password2) || empty($name) || empty($address) || empty($city) || empty($state) || empty($code) || //empty($phone) || empty($email) || empty($refer_id)){
//echo "<html>";
//echo "&nbsp;";
//echo "&nbsp;";
//echo "&nbsp;";
//echo "&nbsp;";
//echo "&nbsp;";
//echo "&nbsp;";
//echo "&nbsp;";
//echo "&nbsp;";
//echo "&nbsp;";
//echo "<table align=center border=1 cellpadding=0 cellspacing=0  bordercolor=#FF6600 bgcolor=#C0C0C0 width=50% height=10>";
//echo "<tr> <td align=center><p font color=black span style=font-size:11pt;><b>All fields are Mandatory</b></span></font></p></td> </tr> </table> //</html>";
//include 'signup.php';
}else{
// checks if the username is in use
$checkuser = mysql_query("SELECT username FROM id_users WHERE username='$username'"); 
$username_exist = mysql_num_rows($checkuser);
$referid = mysql_query("SELECT username FROM id_users WHERE username='$refer_id'");
$referid_exist = mysql_num_rows($referid);
if($username_exist != 0){
echo "<html>";
echo "&nbsp;";
echo "&nbsp;";
echo "&nbsp;";
echo "&nbsp;";
echo "&nbsp;";
echo "&nbsp;";
echo "&nbsp;";
echo "&nbsp;";
echo "&nbsp;";
echo "<table align=center border=1 cellpadding=0 cellspacing=0  bordercolor=#FF6600 bgcolor=#C0C0C0 width=50% height=10>";
echo "<tr> <td align=center><p font color=black span style=font-size:11pt;><b>I'm sorry but the username you specified has already been taken.  Please pick another one.</b></span></font></p></td> </tr> </table> </html>";
    unset($username);
	include 'signup.php';
}elseif($referid_exist > 0){
echo "<html>";
echo "&nbsp;";
echo "&nbsp;";
echo "&nbsp;";
echo "&nbsp;";
echo "&nbsp;";
echo "&nbsp;";
echo "&nbsp;";
echo "&nbsp;";
echo "&nbsp;";
echo "<table align=center border=1 cellpadding=0 cellspacing=0  bordercolor=#FF6600 bgcolor=#C0C0C0 width=50% height=10>";
echo "<tr> <td align=center><p font color=black span style=font-size:11pt;><b>I'm sorry but the referral id doesn't exist.  Please check the referral id or enter the valid one.</b></span></font></p></td> </tr> </table> </html>";
    unset($username);
	include 'signup.php';
}else{
// this makes sure both passwords entered match
if ($password1 != $password2) {
die('Your passwords did not match.');
}else{
//}
// now we insert it into the database
//$password3 = md5($_POST['password1']);//
$insert = "INSERT INTO id_users (username, password, name, address, city, state, code, phone, email, payment_status, member_status, total_member, refer_id) 
VALUES ('$username', '$password1', '$name', '$address', '$city', '$state', '$code', '$phone', '$email', '0', '0', '0', '$refer_id'); UPDATE id_users SET refer_id = '1' where username = 'refer_id';";
$queries = preg_split("/;+(?=([^'|^\\\']*['|\\\'][^'|^\\\']*['|\\\'])*[^'|^\\\']*[^'|^\\\']$)/", $insert); 
foreach ($queries as $query){ 
if (strlen(trim($query)) != 0) mysql_query($query) or die(mysql_error()); 
} 
//mysql_query($insert) or die(mysql_error());
//mysql_close();

//$update = "update id_users set refer_id='1' where username='refer_id'";
//mysql_query($update) or die(mysql_error());
//mysql_close();
echo "<html>";
echo "&nbsp;";
echo "&nbsp;";
echo "&nbsp;";
echo "&nbsp;";
echo "&nbsp;";
echo "&nbsp;";
echo "&nbsp;";
echo "&nbsp;";
echo "&nbsp;";
echo "<table align=center border=1 cellpadding=0 cellspacing=0  bordercolor=#FF6600 bgcolor=#C0C0C0 width=50% height=10>";
echo "<tr> <td align=center><p font color=black span style=font-size:11pt;><b>You have successfully Registered, Please Login</b></span></font></p></td> </tr> </table> </html>";
include 'login.php';
}
}
}
?>

Recommended Answers

All 35 Replies

Your closing bracket (the last '}' ) does not have a corresponding opening bracket. That is why this is not valid PHP syntax.

It may help to indent your code so you can spot things like this more easily :-)

Aside from the comments in the previous post, you ahave a lot of redundant code there.

Rather than coding HTML like:

echo "<html>";
echo "&nbsp;";
echo "&nbsp;";
echo "&nbsp;";
echo "&nbsp;";
echo "&nbsp;";
echo "&nbsp;";
echo "&nbsp;";
echo "&nbsp;";
echo "&nbsp;";
echo "<table align=center border=1 cellpadding=0 cellspacing=0  bordercolor=#FF6600 bgcolor=#C0C0C0 width=50% height=10>";
echo "<tr> <td align=center><p font color=black span style=font-size:11pt;><b>Minimum length values for Username or Password or Pincode or Mobile is missing. Please try again with correct values.</b></span></font></p></td> </tr> </table> </html>";

This would be better:

?>
<html>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<table align=center border=1 cellpadding=0 cellspacing=0  bordercolor=#FF6600 bgcolor=#C0C0C0 width=50% height=10>
<tr>
<td align=center>
<p font color=black>
<span style=font-size:11pt;>
<b>Minimum length values for Username or Password or Pincode or Mobile is missing. Please try again with correct values</b>
</span>
</font>
</p>
</td>
</tr>
</table>
</html>
<?php

You also had missing brackets (> and <) between the P and the Span elements.

Also, since you are using the same styles for each table, it would be better to use CSS to save duplication of code.

Finally, there is no validation of POST data, very bad idea, you might want to look at sorting that.

Thanks Xan & kokoro90 , for your suggestions.......
i'll try it...n let u knw abt da same

Thanks
Kunal

Your closing bracket (the last '}' ) does not have a corresponding opening bracket. That is why this is not valid PHP syntax.

It may help to indent your code so you can spot things like this more easily :-)

i tried what u said , but after doing that i have an error
i:e
Parse error: syntax error, unexpected $end in /home/justearn/public_html/sign_up.php on line 137

and 137 is the closing line for php "?>"

Can you re-post say lines 120 - 137 of the file sign_up.php for us to look at please?

Can you re-post say lines 120 - 137 of the file sign_up.php for us to look at please?

Here Are the lines Buddy ....from 115-137

if (strlen(trim($query)) > 0) mysql_query($query) or die(mysql_error()); } 
//mysql_query($insert) or die(mysql_error());
//mysql_close();

//$update = "update id_users set refer_id ='1' where username = 'refer_id'";
//mysql_query($update) or die(mysql_error());
//mysql_close();
echo "<html>";
echo "&nbsp;";
echo "&nbsp;";
echo "&nbsp;";
echo "&nbsp;";
echo "&nbsp;";
echo "&nbsp;";
echo "&nbsp;";
echo "&nbsp;";
echo "&nbsp;";
echo "<table align=center border=1 cellpadding=0 cellspacing=0  bordercolor=#FF6600 bgcolor=#C0C0C0 width=50% height=10>";
echo "<tr> <td align=center><p font color=black span style=font-size:11pt;><b>You have successfully Registered, Please Login</b></span></font></p></td> </tr> </table> </html>";
include 'login.php';
}
}
?>

you are not closing you " } " properly.

Well your error seems to be that you declare a variable called $end somewhere in that file in an unexpected place. I notice that you include a file called signup.php, but the error is in the file called sign_up.php? Might be worthwhile searching both files for the $end variable. Also, search login.php as well, especially if this contains inline code as I think it might from the logic of your displayed code.

EDIT: BzzBee, this is only the last few lines of the file, not the entire file, so we can't be sure what has come before it. From the looks of the second posted code, usang2me has fixed the misatching braces as suggested by xan and kokoro90.

you are not closing you " } " properly.

I tried everything man, but could get through....and you know wat rilli piss'd me .....the same code n everything working fine on local....but not on Host......

is it becoz of windows & linux problem...

coz m working on windows...n server is using Linux........

I'm sending you my whole code......please check it n suggest sumthing .....

Thanks
Kunal

commented: Please do not swear in posts. We know it is frustrating, but we are trying to help... -1

you are missing a closing } at line 109

see the color brackets.

1.
      <?php
   2.
      $username = $_POST['username'];
   3.
      $password1 = $_POST['password1'];
   4.
      $password2 = $_POST['password2'];
   5.
      $name = $_POST['name'];
   6.
      $address = $_POST['address'];
   7.
      $city = $_POST['city'];
   8.
      $state = $_POST['state'];
   9.
      $code = $_POST['code'];
  10.
      $phone = $_POST['phone'];
  11.
      $email = $_POST['email'];
  12.
      //$bankname = $_POST['bankname'];
  13.
      //$bankbranch = $_POST['bankbranch'];
  14.
      //$accountnumber = $_POST['bankac'];
  15.
      $refer_id = $_POST['refer_id'];
  16.
      //$country = $_POST['country'];
  17.
      // Connects to your Database
  18.
      include('database_connect_local.php');
  19.
      //This makes sure they did not leave any fields blank
  20.
      $minuser_len = 6; //username minimum length
  21.
      $minpass_len = 6; //password minimum length
  22.
      $mincode_len = 6; //code minimum length
  23.
      $minphone_len = 10; //phone minimum length
  24.
      //$refer_id_len = 6; //refer_id minimum length
  25.
       
  26.
      if (strlen($username) < $minuser_len || strlen($password1) < $minpass_len || strlen($code) < $mincode_len || strlen($phone) < $minphone_len)
  27.
      {
  28.
      echo "<html>";
  29.
      echo "&nbsp;";
  30.
      echo "&nbsp;";
  31.
      echo "&nbsp;";
  32.
      echo "&nbsp;";
  33.
      echo "&nbsp;";
  34.
      echo "&nbsp;";
  35.
      echo "&nbsp;";
  36.
      echo "&nbsp;";
  37.
      echo "&nbsp;";
  38.
      echo "<table align=center border=1 cellpadding=0 cellspacing=0 bordercolor=#FF6600 bgcolor=#C0C0C0 width=50% height=10>";
  39.
      echo "<tr> <td align=center><p font color=black span style=font-size:11pt;><b>Minimum length values for Username or Password or Pincode or Mobile is missing. Please try again with correct values.</b></span></font></p></td> </tr> </table> </html>";
  40.
      include 'signup.php';
  41.
      exit;
  42.
      //die("User/password was not long enough!");
  43.
      }elseif (!is_numeric($code) || !is_numeric($phone)){
  44.
      echo "<html>";
  45.
      echo "&nbsp;";
  46.
      echo "&nbsp;";
  47.
      echo "&nbsp;";
  48.
      echo "&nbsp;";
  49.
      echo "&nbsp;";
  50.
      echo "&nbsp;";
  51.
      echo "&nbsp;";
  52.
      echo "&nbsp;";
  53.
      echo "&nbsp;";
  54.
      echo "<table align=center border=1 cellpadding=0 cellspacing=0 bordercolor=#FF6600 bgcolor=#C0C0C0 width=50% height=10>";
  55.
      echo "<tr> <td align=center><p font color=black span style=font-size:11pt;><b>Non Numeric Character Where only Numeric Value is Allowed.</b></span></font></p></td> </tr> </table> </html>";
  56.
      include 'signup.php';
  57.
      exit;
  58.
      //}elseif (empty($username)|| empty($password1) || empty($password2) || empty($name) || empty($address) || empty($city) || empty($state) || empty($code) || //empty($phone) || empty($email) || empty($refer_id)){
  59.
      //echo "<html>";
  60.
      //echo "&nbsp;";
  61.
      //echo "&nbsp;";
  62.
      //echo "&nbsp;";
  63.
      //echo "&nbsp;";
  64.
      //echo "&nbsp;";
  65.
      //echo "&nbsp;";
  66.
      //echo "&nbsp;";
  67.
      //echo "&nbsp;";
  68.
      //echo "&nbsp;";
  69.
      //echo "<table align=center border=1 cellpadding=0 cellspacing=0 bordercolor=#FF6600 bgcolor=#C0C0C0 width=50% height=10>";
  70.
      //echo "<tr> <td align=center><p font color=black span style=font-size:11pt;><b>All fields are Mandatory</b></span></font></p></td> </tr> </table> //</html>";
  71.
      //include 'signup.php';
  72.
      }
else
{
  73.
      // checks if the username is in use
  74.
      $checkuser = mysql_query("SELECT username FROM id_users WHERE username='$username'");
  75.
      $username_exist = mysql_num_rows($checkuser);
  76.
      $referid = mysql_query("SELECT username FROM id_users WHERE username='$refer_id'");
  77.
      $referid_exist = mysql_num_rows($referid);
  78.
      if($username_exist != 0){ // inner brackets in green color
  79.
      echo "<html>";
  80.
      echo "&nbsp;";
  81.
      echo "&nbsp;";
  82.
      echo "&nbsp;";
  83.
      echo "&nbsp;";
  84.
      echo "&nbsp;";
  85.
      echo "&nbsp;";
  86.
      echo "&nbsp;";
  87.
      echo "&nbsp;";
  88.
      echo "&nbsp;";
  89.
      echo "<table align=center border=1 cellpadding=0 cellspacing=0 bordercolor=#FF6600 bgcolor=#C0C0C0 width=50% height=10>";
  90.
      echo "<tr> <td align=center><p font color=black span style=font-size:11pt;><b>I'm sorry but the username you specified has already been taken. Please pick another one.</b></span></font></p></td> </tr> </table> </html>";
  91.
      unset($username);
  92.
      include 'signup.php';
  93.
      }elseif($referid_exist > 0){
  94.
      echo "<html>";
  95.
      echo "&nbsp;";
  96.
      echo "&nbsp;";
  97.
      echo "&nbsp;";
  98.
      echo "&nbsp;";
  99.
      echo "&nbsp;";
 100.
      echo "&nbsp;";
 101.
      echo "&nbsp;";
 102.
      echo "&nbsp;";
 103.
      echo "&nbsp;";
 104.
      echo "<table align=center border=1 cellpadding=0 cellspacing=0 bordercolor=#FF6600 bgcolor=#C0C0C0 width=50% height=10>";
 105.
      echo "<tr> <td align=center><p font color=black span style=font-size:11pt;><b>I'm sorry but the referral id doesn't exist. Please check the referral id or enter the valid one.</b></span></font></p></td> </tr> </table> </html>";
 106.
      unset($username);
 107.
      include 'signup.php';
 108.
      }
 109.
      }// there should be closing bracket of else
// this makes sure both passwords entered match
 110.
      if ($password1 != $password2) {
 111.
      die('Your passwords did not match.');
 112.
      }else{
 113.
      //}
 114.
      // now we insert it into the database
 115.
      //$password3 = md5($_POST['password1']);//
 116.
      $insert = "INSERT INTO id_users (username, password, name, address, city, state, code, phone, email, payment_status, member_status, total_member, refer_id)
 117.
      VALUES ('$username', '$password1', '$name', '$address', '$city', '$state', '$code', '$phone', '$email', '0', '0', '0', '$refer_id'); UPDATE id_users SET refer_id = '1' where username = 'refer_id';";
 118.
      $queries = preg_split("/;+(?=([^'|^\\\']*['|\\\'][^'|^\\\']*['|\\\'])*[^'|^\\\']*[^'|^\\\']$)/", $insert);
 119.
      foreach ($queries as $query){
 120.
      if (strlen(trim($query)) != 0) mysql_query($query) or die(mysql_error());
 121.
      }
 122.
      //mysql_query($insert) or die(mysql_error());
 123.
      //mysql_close();
 124.
       
 125.
      //$update = "update id_users set refer_id='1' where username='refer_id'";
 126.
      //mysql_query($update) or die(mysql_error());
 127.
      //mysql_close();
 128.
      echo "<html>";
 129.
      echo "&nbsp;";
 130.
      echo "&nbsp;";
 131.
      echo "&nbsp;";
 132.
      echo "&nbsp;";
 133.
      echo "&nbsp;";
 134.
      echo "&nbsp;";
 135.
      echo "&nbsp;";
 136.
      echo "&nbsp;";
 137.
      echo "&nbsp;";
 138.
      echo "<table align=center border=1 cellpadding=0 cellspacing=0 bordercolor=#FF6600 bgcolor=#C0C0C0 width=50% height=10>";
 139.
      echo "<tr> <td align=center><p font color=black span style=font-size:11pt;><b>You have successfully Registered, Please Login</b></span></font></p></td> </tr> </table> </html>";
 140.
      include 'login.php';
 141.
      }
 142.
      }
 143.
      }
 144.
      ?>

Well your error seems to be that you declare a variable called $end somewhere in that file in an unexpected place. I notice that you include a file called signup.php, but the error is in the file called sign_up.php? Might be worthwhile searching both files for the $end variable. Also, search login.php as well, especially if this contains inline code as I think it might from the logic of your displayed code.

EDIT: BzzBee, this is only the last few lines of the file, not the entire file, so we can't be sure what has come before it. From the looks of the second posted code, usang2me has fixed the misatching braces as suggested by xan and kokoro90.

Thanks Man....i'm working on ur suggestion now.....

you are missing a closing } at line 109

1.
      <?php
   2.
      $username = $_POST['username'];
   3.
      $password1 = $_POST['password1'];
   4.
      $password2 = $_POST['password2'];
   5.
      $name = $_POST['name'];
   6.
      $address = $_POST['address'];
   7.
      $city = $_POST['city'];
   8.
      $state = $_POST['state'];
   9.
      $code = $_POST['code'];
  10.
      $phone = $_POST['phone'];
  11.
      $email = $_POST['email'];
  12.
      //$bankname = $_POST['bankname'];
  13.
      //$bankbranch = $_POST['bankbranch'];
  14.
      //$accountnumber = $_POST['bankac'];
  15.
      $refer_id = $_POST['refer_id'];
  16.
      //$country = $_POST['country'];
  17.
      // Connects to your Database
  18.
      include('database_connect_local.php');
  19.
      //This makes sure they did not leave any fields blank
  20.
      $minuser_len = 6; //username minimum length
  21.
      $minpass_len = 6; //password minimum length
  22.
      $mincode_len = 6; //code minimum length
  23.
      $minphone_len = 10; //phone minimum length
  24.
      //$refer_id_len = 6; //refer_id minimum length
  25.
       
  26.
      if (strlen($username) < $minuser_len || strlen($password1) < $minpass_len || strlen($code) < $mincode_len || strlen($phone) < $minphone_len)
  27.
      {
  28.
      echo "<html>";
  29.
      echo "&nbsp;";
  30.
      echo "&nbsp;";
  31.
      echo "&nbsp;";
  32.
      echo "&nbsp;";
  33.
      echo "&nbsp;";
  34.
      echo "&nbsp;";
  35.
      echo "&nbsp;";
  36.
      echo "&nbsp;";
  37.
      echo "&nbsp;";
  38.
      echo "<table align=center border=1 cellpadding=0 cellspacing=0 bordercolor=#FF6600 bgcolor=#C0C0C0 width=50% height=10>";
  39.
      echo "<tr> <td align=center><p font color=black span style=font-size:11pt;><b>Minimum length values for Username or Password or Pincode or Mobile is missing. Please try again with correct values.</b></span></font></p></td> </tr> </table> </html>";
  40.
      include 'signup.php';
  41.
      exit;
  42.
      //die("User/password was not long enough!");
  43.
      }elseif (!is_numeric($code) || !is_numeric($phone)){
  44.
      echo "<html>";
  45.
      echo "&nbsp;";
  46.
      echo "&nbsp;";
  47.
      echo "&nbsp;";
  48.
      echo "&nbsp;";
  49.
      echo "&nbsp;";
  50.
      echo "&nbsp;";
  51.
      echo "&nbsp;";
  52.
      echo "&nbsp;";
  53.
      echo "&nbsp;";
  54.
      echo "<table align=center border=1 cellpadding=0 cellspacing=0 bordercolor=#FF6600 bgcolor=#C0C0C0 width=50% height=10>";
  55.
      echo "<tr> <td align=center><p font color=black span style=font-size:11pt;><b>Non Numeric Character Where only Numeric Value is Allowed.</b></span></font></p></td> </tr> </table> </html>";
  56.
      include 'signup.php';
  57.
      exit;
  58.
      //}elseif (empty($username)|| empty($password1) || empty($password2) || empty($name) || empty($address) || empty($city) || empty($state) || empty($code) || //empty($phone) || empty($email) || empty($refer_id)){
  59.
      //echo "<html>";
  60.
      //echo "&nbsp;";
  61.
      //echo "&nbsp;";
  62.
      //echo "&nbsp;";
  63.
      //echo "&nbsp;";
  64.
      //echo "&nbsp;";
  65.
      //echo "&nbsp;";
  66.
      //echo "&nbsp;";
  67.
      //echo "&nbsp;";
  68.
      //echo "&nbsp;";
  69.
      //echo "<table align=center border=1 cellpadding=0 cellspacing=0 bordercolor=#FF6600 bgcolor=#C0C0C0 width=50% height=10>";
  70.
      //echo "<tr> <td align=center><p font color=black span style=font-size:11pt;><b>All fields are Mandatory</b></span></font></p></td> </tr> </table> //</html>";
  71.
      //include 'signup.php';
  72.
      }else{
  73.
      // checks if the username is in use
  74.
      $checkuser = mysql_query("SELECT username FROM id_users WHERE username='$username'");
  75.
      $username_exist = mysql_num_rows($checkuser);
  76.
      $referid = mysql_query("SELECT username FROM id_users WHERE username='$refer_id'");
  77.
      $referid_exist = mysql_num_rows($referid);
  78.
      if($username_exist != 0){
  79.
      echo "<html>";
  80.
      echo "&nbsp;";
  81.
      echo "&nbsp;";
  82.
      echo "&nbsp;";
  83.
      echo "&nbsp;";
  84.
      echo "&nbsp;";
  85.
      echo "&nbsp;";
  86.
      echo "&nbsp;";
  87.
      echo "&nbsp;";
  88.
      echo "&nbsp;";
  89.
      echo "<table align=center border=1 cellpadding=0 cellspacing=0 bordercolor=#FF6600 bgcolor=#C0C0C0 width=50% height=10>";
  90.
      echo "<tr> <td align=center><p font color=black span style=font-size:11pt;><b>I'm sorry but the username you specified has already been taken. Please pick another one.</b></span></font></p></td> </tr> </table> </html>";
  91.
      unset($username);
  92.
      include 'signup.php';
  93.
      }elseif($referid_exist > 0){
  94.
      echo "<html>";
  95.
      echo "&nbsp;";
  96.
      echo "&nbsp;";
  97.
      echo "&nbsp;";
  98.
      echo "&nbsp;";
  99.
      echo "&nbsp;";
 100.
      echo "&nbsp;";
 101.
      echo "&nbsp;";
 102.
      echo "&nbsp;";
 103.
      echo "&nbsp;";
 104.
      echo "<table align=center border=1 cellpadding=0 cellspacing=0 bordercolor=#FF6600 bgcolor=#C0C0C0 width=50% height=10>";
 105.
      echo "<tr> <td align=center><p font color=black span style=font-size:11pt;><b>I'm sorry but the referral id doesn't exist. Please check the referral id or enter the valid one.</b></span></font></p></td> </tr> </table> </html>";
 106.
      unset($username);
 107.
      include 'signup.php';
 108.
      }else{
 109.
      }// there should be closing bracket of else
// this makes sure both passwords entered match
 110.
      if ($password1 != $password2) {
 111.
      die('Your passwords did not match.');
 112.
      }else{
 113.
      //}
 114.
      // now we insert it into the database
 115.
      //$password3 = md5($_POST['password1']);//
 116.
      $insert = "INSERT INTO id_users (username, password, name, address, city, state, code, phone, email, payment_status, member_status, total_member, refer_id)
 117.
      VALUES ('$username', '$password1', '$name', '$address', '$city', '$state', '$code', '$phone', '$email', '0', '0', '0', '$refer_id'); UPDATE id_users SET refer_id = '1' where username = 'refer_id';";
 118.
      $queries = preg_split("/;+(?=([^'|^\\\']*['|\\\'][^'|^\\\']*['|\\\'])*[^'|^\\\']*[^'|^\\\']$)/", $insert);
 119.
      foreach ($queries as $query){
 120.
      if (strlen(trim($query)) != 0) mysql_query($query) or die(mysql_error());
 121.
      }
 122.
      //mysql_query($insert) or die(mysql_error());
 123.
      //mysql_close();
 124.
       
 125.
      //$update = "update id_users set refer_id='1' where username='refer_id'";
 126.
      //mysql_query($update) or die(mysql_error());
 127.
      //mysql_close();
 128.
      echo "<html>";
 129.
      echo "&nbsp;";
 130.
      echo "&nbsp;";
 131.
      echo "&nbsp;";
 132.
      echo "&nbsp;";
 133.
      echo "&nbsp;";
 134.
      echo "&nbsp;";
 135.
      echo "&nbsp;";
 136.
      echo "&nbsp;";
 137.
      echo "&nbsp;";
 138.
      echo "<table align=center border=1 cellpadding=0 cellspacing=0 bordercolor=#FF6600 bgcolor=#C0C0C0 width=50% height=10>";
 139.
      echo "<tr> <td align=center><p font color=black span style=font-size:11pt;><b>You have successfully Registered, Please Login</b></span></font></p></td> </tr> </table> </html>";
 140.
      include 'login.php';
 141.
      }
 142.
      }
 143.
      }
 144.
      ?>

Thanks Man...i'll check it...
Thanks again..for ur valuable time

I tried everything man, but could get through....and you know wat rilli piss'd me .....the same code n everything working fine on local....but not on Host......

is it becoz of windows & linux problem...

coz m working on windows...n server is using Linux........

I'm sending you my whole code......please check it n suggest sumthing .....

Thanks
Kunal

check all your include files syntax....one by one.

send me your file as an attachment

send me your file as an attachment

Here It is man...

Thanks for your concern

I had customized your code. try it now...

<?php
$username 	= $_POST['username'];
$password1 	= $_POST['password1'];
$password2 	= $_POST['password2'];
$name 		= $_POST['name'];
$address 	= $_POST['address'];
$city 		= $_POST['city'];
$state 		= $_POST['state'];
$code 		= $_POST['code'];
$phone 		= $_POST['phone'];
$email 		= $_POST['email'];
$refer_id 	= $_POST['refer_id'];
include('database_connect_local.php');
$minuser_len 	= 6; //username minimum length
$minpass_len 	= 6; //password minimum length
$mincode_len 	= 6; //code minimum length
$minphone_len 	= 10; //phone minimum length

if (strlen($username) < $minuser_len || strlen($password1) < $minpass_len || strlen($code) < $mincode_len || strlen($phone) < $minphone_len)
{
echo "<html> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
echo "<table align=center border=1 cellpadding=0 cellspacing=0 bordercolor=#FF6600 bgcolor=#C0C0C0 width=50% height=10>";
echo "<tr> <td align=center><p font color=black span style=font-size:11pt;><b>Minimum length values for Username or Password or Pincode or Mobile is missing. Please try again with correct values.</b></span></font></p></td> </tr> </table> </html>";
include 'signup.php';
exit;
}
elseif (!is_numeric($code) || !is_numeric($phone))
{
echo "<html> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
echo "<table align=center border=1 cellpadding=0 cellspacing=0 bordercolor=#FF6600 bgcolor=#C0C0C0 width=50% height=10>";
echo "<tr> <td align=center><p font color=black span style=font-size:11pt;><b>Non Numeric Character Where only Numeric Value is Allowed.</b></span></font></p></td> </tr> </table> </html>";
include 'signup.php';
exit;
}
else
{
$checkuser = mysql_query("SELECT username FROM id_users WHERE username='$username'");
$username_exist = mysql_num_rows($checkuser);
$referid = mysql_query("SELECT username FROM id_users WHERE username='$refer_id'");
$referid_exist = mysql_num_rows($referid);
	if($username_exist != 0)
	{
	echo "<html> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
	echo "<table align=center border=1 cellpadding=0 cellspacing=0 bordercolor=#FF6600 bgcolor=#C0C0C0 width=50% height=10>";
	echo "<tr> <td align=center><p font color=black span style=font-size:11pt;><b>I'm sorry but the username you specified has already been taken. Please pick another one.</b></span></font></p></td> </tr> </table> </html>";
	unset($username);
	include 'signup.php';
	}
	elseif($referid_exist > 0)
	{
	echo "<html> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
	echo "<table align=center border=1 cellpadding=0 cellspacing=0 bordercolor=#FF6600 bgcolor=#C0C0C0 width=50% height=10>";
	echo "<tr> <td align=center><p font color=black span style=font-size:11pt;><b>I'm sorry but the referral id doesn't exist. Please check the referral id or enter the valid one.</b></span></font></p></td> </tr> </table> </html>";
	unset($username);
	include 'signup.php';
	}
}

if ($password1 != $password2) 
{
die('Your passwords did not match.');
}
else
{
$insert = "INSERT INTO id_users (username, password, name, address, city, state, code, phone, email, payment_status, member_status, total_member, refer_id)VALUES ('$username', '$password1', '$name', '$address', '$city', '$state', '$code', '$phone', '$email', '0', '0', '0', '$refer_id'); UPDATE id_users SET refer_id = '1' where username = 'refer_id';";
$queries = preg_split("/;+(?=([^'|^\\\']*['|\\\'][^'|^\\\']*['|\\\'])*[^'|^\\\']*[^'|^\\\']$)/", $insert);
	foreach ($queries as $query)
	{
	if (strlen(trim($query)) != 0) mysql_query($query) or die(mysql_error());
	}

echo "<html> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
echo "<table align=center border=1 cellpadding=0 cellspacing=0 bordercolor=#FF6600 bgcolor=#C0C0C0 width=50% height=10>";
echo "<tr> <td align=center><p font color=black span style=font-size:11pt;><b>You have successfully Registered, Please Login</b></span></font></p></td> </tr> </table> </html>";
include 'login.php';
}
?>

hello? i am here for you.. is it fine now???? i cant check it at my end. just can check the code. and i have customized it for you.

Thanks Bzzbee

the problem is now....

i want that when user submit the details....
the referral name he/she gave must update in refer_id field..in DB

right now...they can register with or without correct referral name.....

referral name = username already exist on my DB

pls look @ it

Thanks

let me see

what is refer_id? what the purpose? can u send me the table structure?

let me see

Ohhk buddy , i'm waiting very desperately 4 ur reply......as dis is very imp. 2 me

try it now

<?php
$username 	= $_POST['username'];
$password1 	= $_POST['password1'];
$password2 	= $_POST['password2'];
$name 		= $_POST['name'];
$address 	= $_POST['address'];
$city 		= $_POST['city'];
$state 		= $_POST['state'];
$code 		= $_POST['code'];
$phone 		= $_POST['phone'];
$email 		= $_POST['email'];
$refer_id 	= $_POST['refer_id'];
include('database_connect_local.php');
$minuser_len 	= 6; //username minimum length
$minpass_len 	= 6; //password minimum length
$mincode_len 	= 6; //code minimum length
$minphone_len 	= 10; //phone minimum length

if (strlen($username) < $minuser_len || strlen($password1) < $minpass_len || strlen($code) < $mincode_len || strlen($phone) < $minphone_len)
{
echo "<html> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
echo "<table align=center border=1 cellpadding=0 cellspacing=0 bordercolor=#FF6600 bgcolor=#C0C0C0 width=50% height=10>";
echo "<tr> <td align=center><p font color=black span style=font-size:11pt;><b>Minimum length values for Username or Password or Pincode or Mobile is missing. Please try again with correct values.</b></span></font></p></td> </tr> </table> </html>";
include 'signup.php';
exit;
}
elseif (!is_numeric($code) || !is_numeric($phone))
{
echo "<html> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
echo "<table align=center border=1 cellpadding=0 cellspacing=0 bordercolor=#FF6600 bgcolor=#C0C0C0 width=50% height=10>";
echo "<tr> <td align=center><p font color=black span style=font-size:11pt;><b>Non Numeric Character Where only Numeric Value is Allowed.</b></span></font></p></td> </tr> </table> </html>";
include 'signup.php';
exit;
}
else
{
$checkuser = mysql_query("SELECT username FROM id_users WHERE username='$username' or username='$refer_id' ");
$username_exist = mysql_num_rows($checkuser);

	if($username_exist != 0)
	{
	echo "<html> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
	echo "<table align=center border=1 cellpadding=0 cellspacing=0 bordercolor=#FF6600 bgcolor=#C0C0C0 width=50% height=10>";
	echo "<tr> <td align=center><p font color=black span style=font-size:11pt;><b>I'm sorry but the username you specified has already been taken or referral id doesn't exist. Please pick another one.</b></span></font></p></td> </tr> </table> </html>";
	unset($username);
	include 'signup.php';
	}
}

if ($password1 != $password2) 
{
die('Your passwords did not match.');
}
else
{
$insert = "INSERT INTO id_users (username, password, name, address, city, state, code, phone, email, payment_status, member_status, total_member, refer_id)VALUES ('$username', '$password1', '$name', '$address', '$city', '$state', '$code', '$phone', '$email', '0', '0', '0', '$refer_id'); UPDATE id_users SET refer_id = '1' where username = 'refer_id';";
$queries = preg_split("/;+(?=([^'|^\\\']*['|\\\'][^'|^\\\']*['|\\\'])*[^'|^\\\']*[^'|^\\\']$)/", $insert);
	foreach ($queries as $query)
	{
	if (strlen(trim($query)) != 0) mysql_query($query) or die(mysql_error());
	}

echo "<html> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
echo "<table align=center border=1 cellpadding=0 cellspacing=0 bordercolor=#FF6600 bgcolor=#C0C0C0 width=50% height=10>";
echo "<tr> <td align=center><p font color=black span style=font-size:11pt;><b>You have successfully Registered, Please Login</b></span></font></p></td> </tr> </table> </html>";
include 'login.php';
}
?>

what is refer_id? what the purpose? can u send me the table structure?

Check here .....www.justearnin.com/signup.php

dis is my page......itz working very fine @ local....but not into server

i am checking it. but i dont understand the difference between referral id and username. does referral id is numeric or character? whats the purpose of it?

run the code above...

test it

<?php
$username 	= $_POST['username'];
$password1 	= $_POST['password1'];
$password2 	= $_POST['password2'];
$name 		= $_POST['name'];
$address 	= $_POST['address'];
$city 		= $_POST['city'];
$state 		= $_POST['state'];
$code 		= $_POST['code'];
$phone 		= $_POST['phone'];
$email 		= $_POST['email'];
$refer_id 	= $_POST['refer_id'];
include('database_connect_local.php');
$minuser_len 	= 6; //username minimum length
$minpass_len 	= 6; //password minimum length
$mincode_len 	= 6; //code minimum length
$minphone_len 	= 10; //phone minimum length

if (strlen($username) < $minuser_len || strlen($password1) < $minpass_len || strlen($code) < $mincode_len || strlen($phone) < $minphone_len)
{
echo "<html> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
echo "<table align=center border=1 cellpadding=0 cellspacing=0 bordercolor=#FF6600 bgcolor=#C0C0C0 width=50% height=10>";
echo "<tr> <td align=center><p font color=black span style=font-size:11pt;><b>Minimum length values for Username or Password or Pincode or Mobile is missing. Please try again with correct values.</b></span></font></p></td> </tr> </table> </html>";
include 'signup.php';
exit;
}
elseif (!is_numeric($code) || !is_numeric($phone))
{
echo "<html> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
echo "<table align=center border=1 cellpadding=0 cellspacing=0 bordercolor=#FF6600 bgcolor=#C0C0C0 width=50% height=10>";
echo "<tr> <td align=center><p font color=black span style=font-size:11pt;><b>Non Numeric Character Where only Numeric Value is Allowed.</b></span></font></p></td> </tr> </table> </html>";
include 'signup.php';
exit;
}
else
{
$checkuser = mysql_query("SELECT username FROM id_users WHERE username='$username' or username='$refer_id' ");
$username_exist = mysql_num_rows($checkuser);

	if($username_exist != 0)
	{
	echo "<html> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
	echo "<table align=center border=1 cellpadding=0 cellspacing=0 bordercolor=#FF6600 bgcolor=#C0C0C0 width=50% height=10>";
	echo "<tr> <td align=center><p font color=black span style=font-size:11pt;><b>I'm sorry but the username you specified has already been taken or referral id doesn't exist. Please pick another one.</b></span></font></p></td> </tr> </table> </html>";
	unset($username);
	include 'signup.php';
	}
}

if ($password1 != $password2) 
{
die('Your passwords did not match.');
}
else
{
$insert = "INSERT INTO id_users (username, password, name, address, city, state, code, phone, email, payment_status, member_status, total_member, refer_id)VALUES ('$username', '$password1', '$name', '$address', '$city', '$state', '$code', '$phone', '$email', '0', '0', '0', '$refer_id'); UPDATE id_users SET refer_id = '1' where username = 'refer_id';";
$queries = preg_split("/;+(?=([^'|^\\\']*['|\\\'][^'|^\\\']*['|\\\'])*[^'|^\\\']*[^'|^\\\']$)/", $insert);
	foreach ($queries as $query)
	{
	if (strlen(trim($query)) != 0) mysql_query($query) or die(mysql_error());
	}

echo "<html> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
echo "<table align=center border=1 cellpadding=0 cellspacing=0 bordercolor=#FF6600 bgcolor=#C0C0C0 width=50% height=10>";
echo "<tr> <td align=center><p font color=black span style=font-size:11pt;><b>You have successfully Registered, Please Login</b></span></font></p></td> </tr> </table> </html>";
include 'login.php';
}
?>

Thanks Bzzbee,
i'm checking it now....sry i lost connection 2 internet that time......
thanks again 4 ur so much support...

:) its ok. i will be glad if i can resolve your issue

little change in query

<?php
$username 	= $_POST['username'];
$password1 	= $_POST['password1'];
$password2 	= $_POST['password2'];
$name 		= $_POST['name'];
$address 	= $_POST['address'];
$city 		= $_POST['city'];
$state 		= $_POST['state'];
$code 		= $_POST['code'];
$phone 		= $_POST['phone'];
$email 		= $_POST['email'];
$refer_id 	= $_POST['refer_id'];
include('database_connect_local.php');
$minuser_len 	= 6; //username minimum length
$minpass_len 	= 6; //password minimum length
$mincode_len 	= 6; //code minimum length
$minphone_len 	= 10; //phone minimum length

if (strlen($username) < $minuser_len || strlen($password1) < $minpass_len || strlen($code) < $mincode_len || strlen($phone) < $minphone_len)
{
echo "<html> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
echo "<table align=center border=1 cellpadding=0 cellspacing=0 bordercolor=#FF6600 bgcolor=#C0C0C0 width=50% height=10>";
echo "<tr> <td align=center><p font color=black span style=font-size:11pt;><b>Minimum length values for Username or Password or Pincode or Mobile is missing. Please try again with correct values.</b></span></font></p></td> </tr> </table> </html>";
include 'signup.php';
exit;
}
elseif (!is_numeric($code) || !is_numeric($phone))
{
echo "<html> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
echo "<table align=center border=1 cellpadding=0 cellspacing=0 bordercolor=#FF6600 bgcolor=#C0C0C0 width=50% height=10>";
echo "<tr> <td align=center><p font color=black span style=font-size:11pt;><b>Non Numeric Character Where only Numeric Value is Allowed.</b></span></font></p></td> </tr> </table> </html>";
include 'signup.php';
exit;
}
else
{
$checkuser = mysql_query("SELECT username FROM id_users WHERE username='$username' and username='$refer_id' ");
$username_exist = mysql_num_rows($checkuser);

	if($username_exist != 0)
	{
	echo "<html> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
	echo "<table align=center border=1 cellpadding=0 cellspacing=0 bordercolor=#FF6600 bgcolor=#C0C0C0 width=50% height=10>";
	echo "<tr> <td align=center><p font color=black span style=font-size:11pt;><b>I'm sorry but the username you specified has already been taken or referral id doesn't exist. Please pick another one.</b></span></font></p></td> </tr> </table> </html>";
	unset($username);
	include 'signup.php';
	}
}

if ($password1 != $password2) 
{
die('Your passwords did not match.');
}
else
{
$insert = "INSERT INTO id_users (username, password, name, address, city, state, code, phone, email, payment_status, member_status, total_member, refer_id)VALUES ('$username', '$password1', '$name', '$address', '$city', '$state', '$code', '$phone', '$email', '0', '0', '0', '$refer_id'); UPDATE id_users SET refer_id = '1' where username = 'refer_id';";
$queries = preg_split("/;+(?=([^'|^\\\']*['|\\\'][^'|^\\\']*['|\\\'])*[^'|^\\\']*[^'|^\\\']$)/", $insert);
	foreach ($queries as $query)
	{
	if (strlen(trim($query)) != 0) mysql_query($query) or die(mysql_error());
	}

echo "<html> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
echo "<table align=center border=1 cellpadding=0 cellspacing=0 bordercolor=#FF6600 bgcolor=#C0C0C0 width=50% height=10>";
echo "<tr> <td align=center><p font color=black span style=font-size:11pt;><b>You have successfully Registered, Please Login</b></span></font></p></td> </tr> </table> </html>";
include 'login.php';
}
?>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.