Jason Pruim
On Apr 9, 2009, at 11:03 PM, kunal sharma <usang2me@xxxxxxxxx> wrote:
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 ****'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
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 " ";
echo " ";
echo " ";
echo " ";
echo " ";
echo " ";
echo " ";
echo " ";
echo " ";
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 " ";
echo " ";
echo " ";
echo " ";
echo " ";
echo " ";
echo " ";
echo " ";
echo " ";
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 " ";
//echo " ";
//echo " ";
//echo " ";
//echo " ";
//echo " ";
//echo " ";
//echo " ";
//echo " ";
//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 " ";
echo " ";
echo " ";
echo " ";
echo " ";
echo " ";
echo " ";
echo " ";
echo " ";
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 " ";
echo " ";
echo " ";
echo " ";
echo " ";
echo " ";
echo " ";
echo " ";
echo " ";
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 " ";
echo " ";
echo " ";
echo " ";
echo " ";
echo " ";
echo " ";
echo " ";
echo " ";
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 Kunal
Just based on a quick look i'd guess you don't have the right number
of curly braces at the end of the file.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php