Page 1 of 1

Browser cuts off the code

Posted: Sat Feb 25, 2012 6:04 pm
by elcarim
Hello everybody:)
I am new here so please be gentle;) I am doing a website with login option and it all works perfectly unless I combine the php with the html on one page... When I do it, everything belowsome point in the code is just invisible but when I do it in the Dreamweaver, it all shows fine in the design mode. When I looked at the source code of the website in the browser i noticed something strange: the browser cuts off about a half of my code.
This is the code:

Code: Select all

<body>

<div class="container">

<div class="header">
<img src="../social.jpg" width="145" height="56" alt="""" align="right" />
<!-- end .header --></div>
  <div class="content">
    <div style="width:940px;height:auto;-webkit-border-radius: 20px;-moz-border-radius: 20px;border-radius: 20px;border:3px solid #000000;background-color:#FFFFFF;padding:10px;">

<table>
<tr><td>


<?php
/**
 * User has already logged in, so display relavent links, including
 * a link to the admin center if the user is an administrator.
 */
if($session->logged_in){
   echo "<h1>Logged In</h1>";
   echo "Welcome <b>$session->username</b>, you are logged in. <br><br>"
       ."[<a href=\"userinfo.php?user=$session->username\">My Account</a>] &nbsp;&nbsp;"
       ."[<a href=\"useredit.php\">Edit Account</a>] &nbsp;&nbsp;";
   if($session->isAdmin()){
      echo "[<a href=\"admin/admin.php\">Admin Center</a>] &nbsp;&nbsp;";
   }
   echo "[<a href=\"process.php\">Logout</a>]";
}
else{
?>
<?php

if($form->num_errors > 0){
   echo "<font size=\"2\" color=\"#ff0000\">".$form->num_errors." error(s) found</font>";
}
?>

<form action="process.php" method="post">
<tr><td>Username:

This is the point where the browser cuts the code off.

Code: Select all

</td><td><input type="text" name="user" maxlength="30" value="<? echo $form->value("user"); ?>"></td><td><? echo $form->error("user"); ?></td></tr>
<tr><td>Password:</td><td><input type="password" name="pass" maxlength="30" value="<? echo $form->value("pass"); ?>"></td><td><? echo $form->error("pass"); ?></td></tr>
<tr><td colspan="2" align="left"><input type="checkbox" name="remember" <? if($form->value("remember") != ""){ echo "checked"; } ?>>
<font size="2">Remember me next time &nbsp;&nbsp;&nbsp;&nbsp;
<input type="hidden" name="sublogin" value="1">
<input type="submit" value="Login"></td></tr>
<tr><td colspan="2" align="left"><br><font size="2">[<a href="forgotpass.php">Forgot Password?</a>]</font></td><td align="right"></td></tr>
<tr><td colspan="2" align="left"><br>Not registered? <a href="register.php">Sign-Up!</a></td></tr>
</table>
</form>

<?php
}


echo "</td></tr><tr><td align=\"center\"><br><br>";
echo "<b>Member Total:</b> ".$database->getNumMembers()."<br>";
echo "There are $database->num_active_users registered members and ";
echo "$database->num_active_guests guests viewing the site.<br><br>";

include("include/view_active.php");

?>


</td></tr>
</table>
        
        
    
      <!-- end .content --></p>
      <p>&nbsp;</p>
    </div>
  </div>
  <div class="footer"> <div class="content">
    <div style="width:960px;height:auto;-webkit-border-radius: 20px;-moz-border-radius: 20px;border-radius: 20px;border:3px solid #000000;background-color:#FFFFFF;">
      <center><p>Our partners:<br />
      
      </p></center>
      <p><center><a href="http://www.fitnessworld.dk"><img src="../fitmessworld.jpg" alt="Fitness World" width="161" height="60" border="0"/></a><a href="../www.fitness.dk"><img src="../fitnessdk.jpg" alt="fitness.dk" width="109" height="60" border="0" /></a><img src="../stadium.jpg" alt="stadium" width="191" height="65" /><a href="../www.sunset-boulevard.dk"><img src="../sunsetboulevard.jpg" alt="Sunset Boulevard" width="92" height="60" /></a>
      </center></p>
    </div>
    <p><!-- end .footer --></p>
  </div>
  <!-- end .container --></div>
  </div>
</ body>
Please guys, help me out because I'm really desperate at this point... Thank you in advance.

Re: Browser cuts off the code

Posted: Sat Feb 25, 2012 11:26 pm
by califdon
Please excuse me if I'm misunderstanding what you are saying, but it sounds like you are expecting to see PHP code when you view the source code in a browser, which is impossible unless your server is misconfigured. PHP is strictly server-side script and should never be exposed to the browser, only the results of the PHP code are sent as HTML or CSS or Javascript that PHP has assembled and echoed (or printed) should ever reach the browser. If you intended to say something else, please re-state your question.

Re: Browser cuts off the code

Posted: Sun Feb 26, 2012 2:28 am
by elcarim
Ok, the file has extention.php, I load it on the server of one.com. I don't want the php code to be visible, only the working forms and echoed statements.
Here is the source code:
http://www.mediafire.com/?4r4pf3d51inzcfn

Do you see anything wrong here? Please please let me know

Re: Browser cuts off the code

Posted: Sun Feb 26, 2012 12:53 pm
by califdon
I downloaded your main.php file and ran it on my server and I don't see any PHP code in the source page. There are several error messages, but those are just errors you must correct, it is not PHP code. I don't know what you are referring to.