+ Reply to Thread
Results 1 to 5 of 5

Thread: Is there any way to prevent access to a page without viewing the home page?

  1. #1
    QuwenQ is offline x10 Elder QuwenQ is an unknown quantity at this point
    Join Date
    Sep 2007
    Posts
    977

    Is there any way to prevent access to a page without viewing the home page?

    Is there any way to prevent going to a page, unless the viewer has visited the front page?

    So that if they try to access any page without viewing the front page they are automatically redirected to the main page?

    I'd be willing to add a code to every single page.

  2. #2
    flinx is offline x10Hosting Member flinx is an unknown quantity at this point
    Join Date
    Oct 2007
    Posts
    68

    Re: Is there any way to prevent access to a page without viewing the home page?

    You might use sessions.

    On top of the main page

    PHP Code:
    <?php
    session_start
    ();
    $_SESSION['main'] = 1;
    ?>
    On top of all the other pages

    PHP Code:
    <?php
    session_start
    ();
    if (!isset(
    $_SESSION['main'])) {
       
    header("http://www.sitename.com/index.php");
       exit();
    }
    ?>
    Make sure to put this code before everything else in the script.

    Read more about headers here.
    Read more about sessions here.
    Last edited by flinx; 10-18-2007 at 02:58 AM.

  3. #3
    QuwenQ is offline x10 Elder QuwenQ is an unknown quantity at this point
    Join Date
    Sep 2007
    Posts
    977

    Re: Is there any way to prevent access to a page without viewing the home page?

    Thank you! =)

  4. #4
    bigjoe4 is offline x10 Elder bigjoe4 is an unknown quantity at this point
    Join Date
    Jan 2008
    Posts
    907

    Re: Is there any way to prevent access to a page without viewing the home page?

    Does this require PHP 2 to work?
    Please visit my site: Circuit designer

  5. #5
    Synkc's Avatar
    Synkc is offline Lord Of The Keys Synkc is an unknown quantity at this point
    Join Date
    Jun 2007
    Location
    Hervey Bay, Australia
    Posts
    1,765

    Re: Is there any way to prevent access to a page without viewing the home page?

    Quote Originally Posted by bigjoe4 View Post
    Does this require PHP 2 to work?
    It should work fine with just the Basic version. ;)
    E-mail: synkc[at]x10hosting[dot]com
    Hirokima.com

+ Reply to Thread

Similar Threads

  1. I need help with public viewing of my page
    By Squeaky Neb in forum Graphics & Webdesign
    Replies: 3
    Last Post: 10-04-2007, 11:19 AM
  2. I need help with public viewing of my page
    By Squeaky Neb in forum Scripts & 3rd Party Apps
    Replies: 3
    Last Post: 10-02-2007, 08:24 PM
  3. home page not opening
    By eagles051387 in forum Free Hosting
    Replies: 3
    Last Post: 06-27-2007, 04:39 PM
  4. Website blank page & Cannot access cpanel
    By hansch in forum Free Hosting
    Replies: 5
    Last Post: 06-27-2007, 11:31 AM
  5. Can not access the site...Page not found
    By repusmod in forum Off Topic
    Replies: 2
    Last Post: 05-18-2005, 11:19 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
x10hosting free hosting for the masses
dedicated servers