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 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Jul 2010
    Posts
    2
    Thanks
    1
    Thanked 0 Times in 0 Posts

    PHP causing CSS to misbehave sometimes.

    Apologies in advance if this is a 'newb question,' I am pretty new to this, but google isn't turning up anything relevant to my specific problem.

    I am working on a set of pages that involve user login info stored in session variables.

    I was designing the basic page first, including some CSS (including colors and fonts) on an external stylesheet. Everything worked fine.

    I added the information to track login info. So before anything, I open PHP, start a session, process session variables, then call a function to connect to a database, a function to make sure the user entered a valid name and password, and one to make sure they have the right 'user level' to view said page. If they fail one of those tests, they get redirected to another page via a header(Location: ) command. All is still working fine.

    If they get to go to the right page (and previous header command never happens), the page comes up and SOME CSS information is used, but the color and background colors revert to default black and white. Press F5 to reload the page (and say yes, resend the data), and the color comes up as it should. Only default information gets skipped (i.e. not a specific class, but something that applies to the whole page). I can get around this by defining a body class and calling it, but would like to understand why it is behaving the way it is.

    Code:
    <?php session_start(); 
    $_SESSION["userName"] = $_POST["userName"];
    $_SESSION ["password"] = $_POST ["password"];
    
    $userName = $_SESSION ["userName"];
    $password = $_SESSION ["password"];
    
    
    include "procedures.php";
    $calculate = new procedures();
    $calculate->getDB();
    
    if (($calculate->validateUser($userName, $password)== "FALSE") or ($calculate->validateLevel($userName)==0)){
       $calculate->missed();
       }
    ?>  
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html lang = "EN" dir="ltr" xmlns="http://www.w3.org/19999/xhtml">
    <head>
      <title>Home</title>
      
      <link rel = "stylesheet"
            type = "text/css"
            href = "styling.css" />
    </head>
        
          <body>
          
               
            <img class = "banner" src = "images\Banner.jpg" />
            <p class = "intro"> some inane text that shows up in the CSS selsected font, but the wrong color </p>
    </body>
    </html>

  • #2
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,862
    Thanks
    160
    Thanked 2,223 Times in 2,210 Posts
    If they get to go to the right page (and previous header command never happens), the page comes up and SOME CSS information is used, but the color and background colors revert to default black and white. Press F5 to reload the page (and say yes, resend the data), and the color comes up as it should. Only default information gets skipped (i.e. not a specific class, but something that applies to the whole page). I can get around this by defining a body class and calling it, but would like to understand why it is behaving the way it is.
    Can we have a link to your page with a sample username & password?

    Or check the html source of the page when the error occurs to see if anything going wrong.
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)

  • Users who have thanked abduraooft for this post:

    v3rlon (07-26-2010)

  • #3
    New to the CF scene
    Join Date
    Jul 2010
    Posts
    2
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Said page is not in the wild yet

    I was working on it offline until it was actually starting to do what I intended (or at least at lot closer than it is).

    I can try and set something up when I get home (for some reason, this internet does not connect to my website on Lunarpages. Whoever knew there were two internets? ).

    Thank you for the quick response though.


  •  

    Posting Permissions

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