Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 10 of 10

Thread: Display Issue

  1. #1
    New Coder
    Join Date
    Sep 2010
    Posts
    77
    Thanks
    13
    Thanked 1 Time in 1 Post

    Display Issue

    I had a topic created earlier on having issues when logged in. I fixed it but now I have a problem when not logged in. I can't seem to win. Just go here to see what I mean:

    http://motorcyclemods.net23.net/index.php

    You will see the member total is in the wrong spot. Part of it is below the sign up link. Logging in it goes away.

    You can log in with the following info:

    Username: sample
    Password: sample

    I compared the codes and when not signed in it's creating a tag tbody. I have no idea why. I have messed with it for about 2 hours now... I just can't seem to figure it out.

  • #2
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    Where should the member total be? Also I'm not seeing the tbody tag. You do have some errors in your code though. I suggest validating it which I'm sure others have already told you. You have this for your login.
    Code:
    <form action="process.php" method="POST">
    <table align="left" border="0" cellspacing="0" cellpadding="3">
    <tr><td>Username:</td><td><input type="text" name="user" maxlength="30" class="form" value=""></td><td></td></tr>
    <tr><td>Password:</td><td><input type="password" name="pass" maxlength="30" class="form" value=""></td><td></td></tr>
    <tr><td colspan="2" align="left"><input type="checkbox" name="remember" >
    <font size="2">Remember me next time </font> &nbsp;&nbsp;&nbsp;&nbsp;
    
    <input type="hidden" name="sublogin" value="1">
    <br><br>
    <input type="submit" value="Login" class="btn" ></td></tr>
    <tr><td colspan="2" align="left"><br><font size="2">[<a href="forgotpage.php">Forgot Password?</a>]</td></tr>
    <tr><td colspan="2" align="left"><br>Not registered? <a href="registerpage.php">Sign-Up!</a></td></tr>
    </table>
    </form>
    
    <br><br><b>Member Total:</b> 2<br>There are 0 registered members and 1 guests viewing the site.<br><br><br>
    Because of the form and the table member total is always going to go below it.
    ||||If you are getting paid to do a job, don't ask for help on it!||||

  • #3
    New Coder
    Join Date
    Sep 2010
    Posts
    77
    Thanks
    13
    Thanked 1 Time in 1 Post
    Before Login (problem)

    Code:
    <h3>Login</h3>
    
    <form action="process.php" method="POST">
    <table align="left" border="0" cellspacing="0" cellpadding="3">
    <tr><td>Username:</td><td><input type="text" name="user" maxlength="30" class="form" value=""></td><td></td></tr>
    <tr><td>Password:</td><td><input type="password" name="pass" maxlength="30" class="form" value=""></td><td></td></tr>
    <tr><td colspan="2" align="left"><input type="checkbox" name="remember" >
    <font size="2">Remember me next time </font> &nbsp;&nbsp;&nbsp;&nbsp;
    
    <input type="hidden" name="sublogin" value="1">
    <br><br>
    <input type="submit" value="Login" class="btn" ></td></tr>
    <tr><td colspan="2" align="left"><br><font size="2">[<a href="forgotpage.php">Forgot Password?</a>]</td></tr>
    <tr><td colspan="2" align="left"><br>Not registered? <a href="registerpage.php">Sign-Up!</a></td></tr>
    </table>
    </form>
    
    <br><br><b>Member Total:</b> 2<br>There are 0 registered members and 1 guests viewing the site.<br><br><br>	</div>
    
    					<div class="box">
    After Login (No Problem)

    Code:
    <h3>Logged In</h3>Welcome <b>sample</b>, you are logged in. <br><br>[<a href="infopage.php?user=sample">My Account</a>] &nbsp;[<a href="editpage.php">Edit Account</a>] &nbsp;[<a href="logout.php">Logout</a>]<br><br><b>Member Total:</b> 2<br>There are 1 registered members and 0 guests viewing the site.<br><br><table align="left" border="1" cellspacing="0" cellpadding="3">
    
    <tr><td><font size="2">
    <a href="infopage.php?user=sample">sample</a> / </font></td></tr></table><br>
    <br>	</div>
    I just figured out I get the tbody tag thing when I hit selection source instead of just view source in firefox.

    The member total should be where it is when your logged in. (log in to see where it is).

    I'll go through it and try to clean it up. It's hard because it's a php file and the verifier doesn't recognize that so it gives me a bunch of warnings for something that is fine (at least I believe it's ok).
    Last edited by zachatk; 09-07-2010 at 07:57 PM.

  • #4
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    Quote Originally Posted by zachatk View Post
    I'll go through it and try to clean it up. It's hard because it's a php file and the verifier doesn't recognize that so it gives me a bunch of warnings for something that is fine (at least I believe it's ok).
    Don't give it the php page. Give it the actual url of the page. Okay I logged in an the member total didn't move. It just moved up because the form wasn't there anymore. What browser are you using?
    ||||If you are getting paid to do a job, don't ask for help on it!||||

  • #5
    New Coder
    Join Date
    Sep 2010
    Posts
    77
    Thanks
    13
    Thanked 1 Time in 1 Post
    Using Firefox, just tried it in IE, same thing. Here are pictures just to further show what I mean (for anyone else).

    Problem:



    No Problem (logged in)



    I submitted the link and gonna start cleaning it up.

    I have a bunch of:

    "end tag for "br" omitted, but OMITTAG NO was specified"

    What's it mean?
    Last edited by zachatk; 09-07-2010 at 08:58 PM.

  • #6
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    In XHTML all tags must have a closing tag unless its element that doesn't have a closing tag in which case it needs to be self closed i.e. <br />.

    As for the issue. I am also using Firefox but I am not getting the same results. Screenshot is attached.

    ||||If you are getting paid to do a job, don't ask for help on it!||||

  • #7
    New Coder
    Join Date
    Sep 2010
    Posts
    77
    Thanks
    13
    Thanked 1 Time in 1 Post
    What? How could that be? How do I know that it will display properly for anyone else?

  • #8
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    Get rid of align="left" on the table. That seems to fix it in IE.
    ||||If you are getting paid to do a job, don't ask for help on it!||||

  • #9
    New Coder
    Join Date
    Sep 2010
    Posts
    77
    Thanks
    13
    Thanked 1 Time in 1 Post
    Still no different. I don't know what it is... I appreciate your help a lot!

    More info perhaps could help:

    A script called main.php is included on all pages of the site. It checks if the user is logged in. If not it displays the login form. If they the person is logged in then it shows the login information.

    After that it closes the brackets and there is a piece of code that includes a file called view_active. That displays the members active and logged in. If it helps here is main.php:

    PHP Code:
    <?
    /**
     * Main.php
     *
     * This is an example of the main page of a website. Here
     * users will be able to login. However, like on most sites
     * the login form doesn't just have to be on the main page,
     * but re-appear on subsequent pages, depending on whether
     * the user has logged in or not.
     *
     * Written by: Jpmaster77 a.k.a. The Grandmaster of C++ (GMC)
     * Last Updated: August 26, 2004
     */
    include("session.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 
    "<h3>Logged In</h3>";
       echo 
    "Welcome <b>$session->username</b>, you are logged in. <br><br>"
           
    ."[<a href=\"infopage.php?user=$session->username\">My Account</a>] &nbsp;"
           
    ."[<a href=\"editpage.php\">Edit Account</a>] &nbsp;";
       if(
    $session->isAdmin()){
          echo 
    "[<a href=\"adminpage.php\">Admin Center</a>] &nbsp;";
       }
       echo 
    "[<a href=\"logout.php\">Logout</a>]";
    }
    else{
    ?>

    <h3>Login</h3>
    <?
    /**
     * User not logged in, display the login form.
     * If user has already tried to login, but errors were
     * found, display the total number of errors.
     * If errors occurred, they will be displayed.
     */
    if($form->num_errors 0){
       echo 
    "<font size=\"2\" color=\"#ff0000\">".$form->num_errors." Error(s) Found</font>";
    }
    ?>

    <form action="process.php" method="POST">
    <table align="left" border="0" cellspacing="0" cellpadding="3">
    <tr><td>Username:</td><td><input type="text" name="user" maxlength="30" class="form" 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" class="form" 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 </font> &nbsp;&nbsp;&nbsp;&nbsp;
    <input type="hidden" name="sublogin" value="1">
    <br><br>
    <input type="submit" value="Login" class="btn" ></td></tr>
    <tr><td colspan="2" align="left"><br><font size="2">[<a href="forgotpage.php">Forgot Password?</a>]</td></tr>
    <tr><td colspan="2" align="left"><br>Not registered? <a href="registerpage.php">Sign-Up!</a></td></tr>
    </table>
    </form>

    <?
    }


    /**
     * Just a little page footer, tells how many registered members
     * there are, how many users currently logged in and viewing site,
     * and how many guests viewing site. Active users are displayed,
     * with link to their user information.
     */
    echo "<br>";
    echo 
    "<br>";
    echo 
    "<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(
    "view_active.php");
    echo 
    "<br>";
    ?>
    view_active looks like this:

    PHP Code:
    <?
    if(!defined('TBL_ACTIVE_USERS')) {
      die(
    "Error processing page");
    }

    $q "SELECT username FROM ".TBL_ACTIVE_USERS
        
    ." ORDER BY timestamp DESC,username";
    $result $database->query($q);
    /* Error occurred, return given name by default */
    $num_rows mysql_numrows($result);
    if(!
    $result || ($num_rows 0)){
       echo 
    "Error displaying info";
    }
    else if(
    $num_rows 0){
       
    /* Display active users, with link to their info */
       
    echo "<table border=\"1\" cellspacing=\"0\" cellpadding=\"3\">\n";
       echo 
    "<tr><td><font size=\"2\">\n";
       for(
    $i=0$i<$num_rows$i++){
          
    $uname mysql_result($result,$i,"username");

          echo 
    "<a href=\"infopage.php?user=$uname\">$uname</a> / ";
       }
       echo 
    "</font></td></tr></table><br>\n";
    }
    ?>

  • #10
    New Coder
    Join Date
    Sep 2010
    Posts
    77
    Thanks
    13
    Thanked 1 Time in 1 Post
    I went through and cleaned up the code. There are 2 things however I can't do because it is automatically inserted on the page by the host. Here is what I get:

    Code:
    # Line 208, Column 78: document type does not allow element "script" here
    
    …type="text/javascript" src="http://analytics.hosting24.com/count.php"></script>
    
    The element named above was found in a context where it is not allowed. This could mean that you have incorrectly nested elements -- such as a "style" element in the "body" section instead of inside "head" -- or two elements that overlap (which is not allowed).
    
    One common cause for this error is the use of XHTML syntax in HTML documents. Due to HTML's rules of implicitly closed elements, this error can create cascading effects. For instance, using XHTML's "self-closing" tags for "meta" and "link" in the "head" section of a HTML document may cause the parser to infer the end of the "head" section and the beginning of the "body" section (where "link" and "meta" are not allowed; hence the reported error).
    # Error Line 209, Column 10: document type does not allow element "noscript" here
    
    <noscript><a href="http://www.hosting24.com/"><img src="http://analytics.hostin…
    
    The element named above was found in a context where it is not allowed. This could mean that you have incorrectly nested elements -- such as a "style" element in the "body" section instead of inside "head" -- or two elements that overlap (which is not allowed).
    
    One common cause for this error is the use of XHTML syntax in HTML documents. Due to HTML's rules of implicitly closed elements, this error can create cascading effects. For instance, using XHTML's "self-closing" tags for "meta" and "link" in the "head" section of a HTML document may cause the parser to infer the end of the "head" section and the beginning of the "body" section (where "link" and "meta" are not allowed; hence the reported error).

    It's either that causing the problem or improper div lineup (some might be canceling out or something).

    Anyone know?


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •