SitePoint Sponsor

User Tag List

Results 1 to 10 of 10

Thread: login?

  1. #1
    SitePoint Wizard lukeurtnowski's Avatar
    Join Date
    Mar 2003
    Location
    Coronado
    Posts
    1,644
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)

    login?

    I have a login page
    http://fixmysite.us/masterasp/login.php
    use
    username: g
    password: g
    but once I login, how do I refresh only the header of the page so it welcomes the user right off the bat, instead of welcoming the user when they go to another page?
    "Oh, and Jenkins--apparently your mother died this morning."

  2. #2
    Foozle Reducer ServerStorm's Avatar
    Join Date
    Feb 2005
    Location
    Burlington, Canada
    Posts
    2,699
    Mentioned
    89 Post(s)
    Tagged
    6 Thread(s)
    Quote Originally Posted by lukeurtnowski View Post
    I have a login page
    http://fixmysite.us/masterasp/login.php
    use
    username: g
    password: g
    but once I login, how do I refresh only the header of the page so it welcomes the user right off the bat, instead of welcoming the user when they go to another page?
    It worked the way you want for me when I logged in.
    ictus==""

  3. #3
    SitePoint Zealot
    Join Date
    Jan 2011
    Location
    Portland
    Posts
    148
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ajax
    coming soon sitejuju.com my new development portfolio

  4. #4
    SitePoint Wizard lukeurtnowski's Avatar
    Join Date
    Mar 2003
    Location
    Coronado
    Posts
    1,644
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    "Oh, and Jenkins--apparently your mother died this morning."

  5. #5
    SitePoint Wizard lukeurtnowski's Avatar
    Join Date
    Mar 2003
    Location
    Coronado
    Posts
    1,644
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    I tried to follow that tutorial and it seems like its not refreshing, but I the login/register thing is there so I guess the thing is just not reading the session variables, isnt it suposed to refresh after 5 seconds?
    I set three session variables being set upon sucessful login.
    "Oh, and Jenkins--apparently your mother died this morning."

  6. #6
    SitePoint Member
    Join Date
    Sep 2011
    Location
    Somewhere in a coding bug.
    Posts
    14
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by lukeurtnowski View Post
    I have a login page
    http://fixmysite.us/masterasp/login.php
    use
    username: g
    password: g
    but once I login, how do I refresh only the header of the page so it welcomes the user right off the bat, instead of welcoming the user when they go to another page?
    I am not exactly sure which header you mean...
    <?php
    while (1) {while ($i == 1) {$i = 0;} else {$i = 1;}}
    //Wow...
    ?>

  7. #7
    SitePoint Wizard lukeurtnowski's Avatar
    Join Date
    Mar 2003
    Location
    Coronado
    Posts
    1,644
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    Sorry, I'm pretty bad at explaining things...
    Here what I'm saying when I login
    http://fixmysite.us/masterasp/login.php
    u: g
    x: g
    I get the sucessful login thing, so this is run
    PHP Code:
    echo "<h3>Welcome, {$user}</h3>";
    echo 
    "<p align=\"center\">Thank you for Logging in.  You may now <a href=\"providers/become_a_provider.php\">sign up</a> to become a provider, or <a href=\"reviews/submit_a_review.php\">review</a>";
    echo 
    " a provider</p><p align=\"center\"><img src=\"images/success.jpg\" class=\"result\"></p>";
    $_SESSION['logged'] = 1;
    $_SESSION['user'] = $user;
    $_SESSION['id'] = $info['id']; 
    but In my <header>, I have,
    HTML Code:
    <script src="/masterasp/js/ajax.js"></script>
    <script type="text/javascript"><!--
    refreshdiv();
    // --></script>
    <div id="top"></div>
    
    <h1><a href="/masterasp/">MasterASP</a></h1>
    <nav>
    <ul>
    <li><a href="/masterasp/">Home</a></li>
    <li><a href="/masterasp/providers/">Providers</a></li>
    <li><a href="/masterasp/reviews">Reviews</a></li>
    <li><a href="/masterasp/forum/">Community</a></li>
    <li><a href="/masterasp/faq.php">FAQ</a></li>
    <li><a href="/masterasp/contact.php">Contact</a></li>
    </ul>
    </nav>
    Im trying to refresh the top div (using the ajax thing) and in it is
    PHP Code:
    <?php
    if($_SESSION['logged'] == 1){
        echo 
    "<span>Welcome ".$_SESSION["user"]."</span>"
        echo 
    "<ul>";
        echo 
    "<li><a href=\"/masterasp/logout.php\">Logout</a></li>";
        echo 
    "</ul>";
    } else {  
        echo 
    "<ul>";
        echo 
    "<li><a href=\"/masterasp/login.php\">Login</a></li>";
        echo 
    "<li><a href=\"/masterasp/register.php\">Register</a></li>";
        echo 
    "</ul>";
    }
    ?>
    but it looks like that if statement never evaluates to true, and I dont see why not
    "Oh, and Jenkins--apparently your mother died this morning."

  8. #8
    SitePoint Member
    Join Date
    Sep 2011
    Location
    Somewhere in a coding bug.
    Posts
    14
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I see absolutly nothing wrong with that code. I am just as stumped as you...
    <?php
    while (1) {while ($i == 1) {$i = 0;} else {$i = 1;}}
    //Wow...
    ?>

  9. #9
    SitePoint Zealot
    Join Date
    Jul 2012
    Location
    Scarborough, North Yorkshire, United Kingdom
    Posts
    100
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Are you calling session_start() at the top of each page?
    Richard
    Resell SSL Certificates - API / WHMCS / HostBill / ClientExec
    ServerTastic - RapidSSL, Geotrust, Thawte, Symantec, SmarterTools and more

  10. #10
    SitePoint Wizard lukeurtnowski's Avatar
    Join Date
    Mar 2003
    Location
    Coronado
    Posts
    1,644
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    Yes, I have session_start(): on the top of each page. I tried to do a little debugging.
    so I login at
    http://fixmysite.us/masterasp/login.php
    (I added a time thing in the <div id="top"> which seems to be updated every 5 seconds so I gather it should work).

    I also added
    var_dump($_SESSION);
    after logging in so you can see my three session variables, but I have
    var_dump($_SESSION);
    in the refreshing div, and the three variables doesnt seem to be transferred after the refresh.


    Does this help at all?
    "Oh, and Jenkins--apparently your mother died this morning."


Bookmarks

Posting Permissions

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