Re: [PHP] Please Help Me ASAP

2009-04-10 Thread Jignesh Thummar
whenever you want to print HTMLs in your code you don't need to call echo or
print everytime.
You can use plain HTML in your php code this way.


your HTML code

your HTML code

or you can use HEREDOC to print long string ( http://in.php.net/types.string)

- Jignesh

On Fri, Apr 10, 2009 at 12:37 PM, Bipin Upadhyay wrote:

> kunal sharma 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
>> MANDATORYi dont understand ...y soi'm pasting my code
>> here...please
>> help me asap ...
>> each and every suggestion will be appreciat'd
>>
>>
>>
>> Here Is The Code:
>>
>> > $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 "";
>> echo " ";
>> echo " ";
>> echo " ";
>> echo " ";
>> echo " ";
>> echo " ";
>> echo " ";
>> echo " ";
>> echo " ";
>> echo "> bordercolor=#FF6600 bgcolor=#C0C0C0 width=50% height=10>";
>> echo " > style=font-size:11pt;>Minimum length values for Username or Password or
>> Pincode or Mobile is missing. Please try again with correct
>> values.   ";
>> include 'signup.php';
>> exit;
>> //die("User/password was not long enough!");
>> }elseif (!is_numeric($code) || !is_numeric($phone)){
>> echo "";
>> echo " ";
>> echo " ";
>> echo " ";
>> echo " ";
>> echo " ";
>> echo " ";
>> echo " ";
>> echo " ";
>> echo " ";
>> echo "> bordercolor=#FF6600 bgcolor=#C0C0C0 width=50% height=10>";
>> echo " > style=font-size:11pt;>Non Numeric Character Where only Numeric Value is
>> Allowed.   ";
>> 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 "";
>> //echo " ";
>> //echo " ";
>> //echo " ";
>> //echo " ";
>> //echo " ";
>> //echo " ";
>> //echo " ";
>> //echo " ";
>> //echo " ";
>> //echo "> bordercolor=#FF6600 bgcolor=#C0C0C0 width=50% height=10>";
>> //echo " > style=font-size:11pt;>All fields are
>> Mandatory
>>   //";
>> //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 "";
>> echo " ";
>> echo " ";
>> echo " ";
>> echo " ";
>> echo " ";
>> echo " ";
>> echo " ";
>> echo " ";
>> echo " ";
>> echo "> bordercolor=#FF6600 bgcolor=#C0C0C0 width=50% height=10>";
>> echo " > style=font-size:11pt;>I'm sorry but the username you specified has
>> already been taken. Please pick another one.
>>   ";
>> unset($username);
>> include 'signup.php';
>> }elseif($referid_exist > 0){
>> echo "";
>> echo " ";
>> echo " ";
>> echo " ";
>> echo " ";
>> echo " ";
>> echo " ";
>> echo " ";
>> echo " ";
>> echo " ";
>> echo "> bordercolor=#FF6600 bgcolor=#C0C0C0 width=50% height=10>";
>> echo " > style=font-size:11pt;>I'm sorry but the referral id doesn't exist.
>> Please
>> check the referral id or enter the valid one.
>>   ";
>> 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, p

Re: [PHP] Please Help Me ASAP

2009-04-10 Thread Bipin Upadhyay

kunal sharma 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
MANDATORYi dont understand ...y soi'm pasting my code here...please
help me asap ...
each and every suggestion will be appreciat'd



Here Is The Code:

";
echo " ";
echo " ";
echo " ";
echo " ";
echo " ";
echo " ";
echo " ";
echo " ";
echo " ";
echo "";
echo " Minimum length values for Username or Password or
Pincode or Mobile is missing. Please try again with correct
values.   ";
include 'signup.php';
exit;
//die("User/password was not long enough!");
}elseif (!is_numeric($code) || !is_numeric($phone)){
echo "";
echo " ";
echo " ";
echo " ";
echo " ";
echo " ";
echo " ";
echo " ";
echo " ";
echo " ";
echo "";
echo " Non Numeric Character Where only Numeric Value is
Allowed.   ";
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 "";
//echo " ";
//echo " ";
//echo " ";
//echo " ";
//echo " ";
//echo " ";
//echo " ";
//echo " ";
//echo " ";
//echo "";
//echo " All fields are Mandatory
  //";
//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 "";
echo " ";
echo " ";
echo " ";
echo " ";
echo " ";
echo " ";
echo " ";
echo " ";
echo " ";
echo "";
echo " I'm sorry but the username you specified has
already been taken. Please pick another one.
  ";
unset($username);
include 'signup.php';
}elseif($referid_exist > 0){
echo "";
echo " ";
echo " ";
echo " ";
echo " ";
echo " ";
echo " ";
echo " ";
echo " ";
echo " ";
echo "";
echo " I'm sorry but the referral id doesn't exist. Please
check the referral id or enter the valid one.
  ";
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 "";
echo " ";
echo " ";
echo " ";
echo " ";
echo " ";
echo " ";
echo " ";
echo " ";
echo " ";
echo "";
echo " You have successfully Registered, Please
Login   ";
include 'login.php';
}
}
}
?>

Thanks Kunal

  

Kunal,

The trouble is the way you've commented things here (and in the 
following lines):


//}elseif (empty($username)|| empty($password1) || empty($password2) ||
empty($name) || empty($address) || empty($city) || empty($state) ||
empty($code) || //empty($phone) || empty($email) || empty($refer_id)){
...


Due to these comments, you are missing a semicolon.

On a very friendly note, here are a few comments:
1. The code is very ugly. Almost unmaintainable.
2. It seems to have almost every vulnerability I can think of -SQL 
Injection, XSS, etc.
3. You don't seem to be using an IDE. Any basic PHP IDE will at least 
eliminate these parsing related issues.

4. .

There are a few things that you'd need to learn before you can actually 
put your code in a live environment.

BTW, which book are you referring to write code?

--Bipin Upadhyay.
http://projectbee.org/



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Please Help Me ASAP

2009-04-09 Thread abdulazeez alugo


 

> Date: Fri, 10 Apr 2009 08:33:10 +0530
> From: usang...@gmail.com
> To: php-general@lists.php.net
> Subject: [PHP] Please Help Me ASAP
> 
> 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
> MANDATORYi dont understand ...y soi'm pasting my code here...please
> help me asap ...
> each and every suggestion will be appreciat'd
> 
> 
> 
> Here Is The Code:
> 
>  $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 "";
> echo " ";
> echo " ";
> echo " ";
> echo " ";
> echo " ";
> echo " ";
> echo " ";
> echo " ";
> echo " ";
> echo " bordercolor=#FF6600 bgcolor=#C0C0C0 width=50% height=10>";
> echo "  style=font-size:11pt;>Minimum length values for Username or Password or
> Pincode or Mobile is missing. Please try again with correct
> values.   ";
> include 'signup.php';
> exit;
> //die("User/password was not long enough!");
> }elseif (!is_numeric($code) || !is_numeric($phone)){
> echo "";
> echo " ";
> echo " ";
> echo " ";
> echo " ";
> echo " ";
> echo " ";
> echo " ";
> echo " ";
> echo " ";
> echo " bordercolor=#FF6600 bgcolor=#C0C0C0 width=50% height=10>";
> echo "  style=font-size:11pt;>Non Numeric Character Where only Numeric Value is
> Allowed.   ";
> 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 "";
> //echo " ";
> //echo " ";
> //echo " ";
> //echo " ";
> //echo " ";
> //echo " ";
> //echo " ";
> //echo " ";
> //echo " ";
> //echo " bordercolor=#FF6600 bgcolor=#C0C0C0 width=50% height=10>";
> //echo "  style=font-size:11pt;>All fields are Mandatory
>   //";
> //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 "";
> echo " ";
> echo " ";
> echo " ";
> echo " ";
> echo " ";
> echo " ";
> echo " ";
> echo " ";
> echo " ";
> echo " bordercolor=#FF6600 bgcolor=#C0C0C0 width=50% height=10>";
> echo &q

Re: [PHP] Please Help Me ASAP

2009-04-09 Thread Jason Pruim



Jason Pruim

On Apr 9, 2009, at 11:03 PM, kunal sharma  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
MANDATORYi dont understand ...y soi'm pasting my code  
here...please

help me asap ...
each and every suggestion will be appreciat'd



Here Is The Code:

if (strlen($username) < $minuser_len || strlen($password1) <  
$minpass_len ||

strlen($code) < $mincode_len || strlen($phone) < $minphone_len)
{
echo "";
echo " ";
echo " ";
echo " ";
echo " ";
echo " ";
echo " ";
echo " ";
echo " ";
echo " ";
echo "";
echo " style=font-size:11pt;>Minimum length values for Username or  
Password or

Pincode or Mobile is missing. Please try again with correct
values.   ";
include 'signup.php';
exit;
//die("User/password was not long enough!");
}elseif (!is_numeric($code) || !is_numeric($phone)){
echo "";
echo " ";
echo " ";
echo " ";
echo " ";
echo " ";
echo " ";
echo " ";
echo " ";
echo " ";
echo "";
echo " style=font-size:11pt;>Non Numeric Character Where only Numeric  
Value is

Allowed.   ";
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 "";
//echo " ";
//echo " ";
//echo " ";
//echo " ";
//echo " ";
//echo " ";
//echo " ";
//echo " ";
//echo " ";
//echo "";
//echo " style=font-size:11pt;>All fields are Mandatoryp>

  //";
//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 "";
echo " ";
echo " ";
echo " ";
echo " ";
echo " ";
echo " ";
echo " ";
echo " ";
echo " ";
echo "";
echo " I'm sorry but the username you specified has
already been taken. Please pick another one.td>

  ";
unset($username);
include 'signup.php';
}elseif($referid_exist > 0){
echo "";
echo " ";
echo " ";
echo " ";
echo " ";
echo " ";
echo " ";
echo " ";
echo " ";
echo " ";
echo "";
echo " style=font-size:11pt;>I'm sorry but the referral id doesn't  
exist. Please
check the referral id or enter the valid one.td>

  ";
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 "";
echo " ";
echo " ";
echo " ";
echo " ";
echo " ";
echo " ";
echo " ";
echo " ";
echo " ";
echo "";
echo " You have successfully Registered, Please
Login   ";
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



[PHP] Please Help Me ASAP

2009-04-09 Thread kunal sharma
 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
MANDATORYi dont understand ...y soi'm pasting my code here...please
help me asap ...
each and every suggestion will be appreciat'd



Here Is The Code:

";
echo " ";
echo " ";
echo " ";
echo " ";
echo " ";
echo " ";
echo " ";
echo " ";
echo " ";
echo "";
echo " Minimum length values for Username or Password or
Pincode or Mobile is missing. Please try again with correct
values.   ";
include 'signup.php';
exit;
//die("User/password was not long enough!");
}elseif (!is_numeric($code) || !is_numeric($phone)){
echo "";
echo " ";
echo " ";
echo " ";
echo " ";
echo " ";
echo " ";
echo " ";
echo " ";
echo " ";
echo "";
echo " Non Numeric Character Where only Numeric Value is
Allowed.   ";
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 "";
//echo " ";
//echo " ";
//echo " ";
//echo " ";
//echo " ";
//echo " ";
//echo " ";
//echo " ";
//echo " ";
//echo "";
//echo " All fields are Mandatory
  //";
//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 "";
echo " ";
echo " ";
echo " ";
echo " ";
echo " ";
echo " ";
echo " ";
echo " ";
echo " ";
echo "";
echo " I'm sorry but the username you specified has
already been taken. Please pick another one.
  ";
unset($username);
include 'signup.php';
}elseif($referid_exist > 0){
echo "";
echo " ";
echo " ";
echo " ";
echo " ";
echo " ";
echo " ";
echo " ";
echo " ";
echo " ";
echo "";
echo " I'm sorry but the referral id doesn't exist. Please
check the referral id or enter the valid one.
  ";
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 "";
echo " ";
echo " ";
echo " ";
echo " ";
echo " ";
echo " ";
echo " ";
echo " ";
echo " ";
echo "";
echo " You have successfully Registered, Please
Login   ";
include 'login.php';
}
}
}
?>

Thanks Kunal