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.

<?php
//php code
?>
your HTML code
<?php
//php 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 <muxical.g...@gmail.com>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
>> 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 "&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';
>> }
>> }
>> }
>> ?>
>>
>> Thanks Kunal
>>
>>
>>
> Kunal,
>
> The trouble is the way you've commented things here (and in the following
> lines):
> <code>
> //}elseif (empty($username)|| empty($password1) || empty($password2) ||
> empty($name) || empty($address) || empty($city) || empty($state) ||
> empty($code) || //empty($phone) || empty($email) || empty($refer_id)){
> ...............
> </code>
>
> 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
>
>

Reply via email to