Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9063499
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T16:01:00+00:00 2026-06-16T16:01:00+00:00

Ok i’m using a page count to count the number of time profile.php is

  • 0

Ok i’m using a page count to count the number of time profile.php is accessed by users. If they are not logged in they can only view 5 users profiles.

Each profile has an extension of profile.php e.g. profile.php?id=1 or id=2 etc.

The page count works fine, basically if a user tries to click on more than 5 profiles it will redirect them to the limit.php page which tells the user they have reached their limit an to login in to view more.

I have set it to exclude a few profiles as listed below.

basically what the problem is, if the user clicks on the excluded profiles such as 99999 or 99998 it wont redirect the user to the limit.php page. This is fine because i want it to exclude these profiles, however, if the user clicks on another profile such as 1 or 8 etc in between and the user tried to revisit 99999 or 99998 then it wont let them and redirects them?

Can anyone show me how i can edit the script to still allow users to access profiles 99999 or 99998 even after or during them visiting other profiles without it redirecting them?

Hope this is clear. Thanks

 <?php 

    !session_id() ? session_start() : null;
    if(!isset($_SESSION['page_access_count'])){
        $_SESSION['page_access_count'] = 1;
    }elseif($_SESSION['page_access_count'] >= 6){
        // redirect to signup page
        header('Location: limit.php');
        exit;
    }

      $free_profiles = array(99999,99998,99997,99996,99995,99994,99993); // array of profile IDs to exclude

    if (! in_array($_GET['id'], $free_profiles)) {
      $_SESSION['page_access_count']++;
    }


        ?>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T16:01:01+00:00Added an answer on June 16, 2026 at 4:01 pm

    I wrapped the limit verification logic in a function called verify_profile_visit_limit. Now we can get the “id” of the page using $_GET (as it’s a query string) and skip the limit check if it was in the $free_profile array by exiting the verify_profile_visit_limit function using return function.

    !session_id() ? session_start() : null;
    
    verify_profile_visit_limit();
    
    function verify_profile_visit_limit(){
        $free_profiles = array(99999,99998,99997,99996,99995,99994,99993);
    
        if(in_array($_GET["id"], $free_profiles)) return;
    
        if(! isset($_SESSION["page_access_count"])){
            $_SESSION["page_access_count"] = 0;
        }
    
        $_SESSION["page_access_count"]++;
    
        if($_SESSION["page_access_count"] > 5){
            header("Location: limit.php");
            exit();
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using Paperclip to handle profile photo uploads in my app. They upload
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
I want to count how many characters a certain string has in PHP, but
I am using the SimpleRSS gem to parse a WordPress RSS feed. The only
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
I'm making a simple page using Google Maps API 3. My first. One marker
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I would like to count the length of a string with PHP. The string
link Im having trouble converting the html entites into html characters, (&# 8217;) i

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.