Activity Stream
48,167 MEMBERS
6746 ONLINE
besthostingforums On YouTube Subscribe to our Newsletter besthostingforums On Twitter besthostingforums On Facebook besthostingforums On facebook groups

Results 1 to 2 of 2

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1.     
    #1
    Member
    Website's:
    rootw.net

    Default Quick PHP help...

    Hey everyone. I'm coding a simple members area for my website, but i need Alittle help.

    Basically I want it to be something like /path/membersindex.php and /path/subpage.php etc.

    So on every page i want there to be the code below to check if the person is logged in, and if they're not it shows a logged in screen.

    So far I got:

    PHP Code: 
    <?php
    if(!empty($_SESSION['LoggedIn']) && !empty($_SESSION['Username']))
    {
        
    //content here
    }
    else
    {
        
    //put the login form here
    }
    <
    ?>
    Really what I want help with is if theres a more conventional way to do the above. Like have something like:
    PHP Code: 
    <?php
    require "sessioncheck.php"//checks  if user is logged in, if they aren't, the page displays a login screen. 

    //rest of the page content here
    Thanks
    narutoroot Reviewed by narutoroot on . Quick PHP help... Hey everyone. I'm coding a simple members area for my website, but i need Alittle help. Basically I want it to be something like /path/membersindex.php and /path/subpage.php etc. So on every page i want there to be the code below to check if the person is logged in, and if they're not it shows a logged in screen. So far I got: <?php Rating: 5

  2.   Sponsored Links

  3.     
    #2
    Respected Member
    That should work except use require_once and not require. Also make sure to add a return after it displays the login form so it doesn't drop into the code below it.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Quick hello
    By Jim Haynes in forum Introductions
    Replies: 5
    Last Post: 7th Feb 2012, 01:09 AM
  2. Just a quick hello.
    By NordicNode in forum Introductions
    Replies: 12
    Last Post: 13th Dec 2011, 02:12 AM
  3. [Hiring] Quick Job - $5
    By viruz99 in forum Completed Transactions
    Replies: 6
    Last Post: 9th Nov 2011, 05:07 PM
  4. [Hiring] After Effects Editor (Quick Job = Quick Money)
    By MasterDKR in forum Completed Transactions
    Replies: 4
    Last Post: 21st Jun 2011, 08:09 PM
  5. A quick LOL.
    By Luke in forum General Discussion
    Replies: 4
    Last Post: 8th Jun 2009, 11:09 AM

Tags for this Thread

BE SOCIAL