SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Addict
    Join Date
    Mar 2008
    Location
    Sterling, CO
    Posts
    275
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    How to include only if url has a certan string?

    Hi,

    How do you include a file but only if there is a string but not the whole url?

    Like this url:

    ht tps://w ww.asite.com/index.php?microtime=0.31278700+1254482221&update_quantity%5B1caee2f638824bb2d4a283bdfb1d46b6...on-and-on

    but it changes everytime.

    how could I just include it by maybe saying only if the url has "index?microtime=" in it?

  2. #2
    Utopia, Inc. silver trophy
    ScallioXTX's Avatar
    Join Date
    Aug 2008
    Location
    The Netherlands
    Posts
    9,097
    Mentioned
    153 Post(s)
    Tagged
    3 Thread(s)
    PHP Code:
    if (isset($_GET['microtime'])) { include('/some/file.php'); } 
    Rémon - Hosting Advisor

    SitePoint forums will switch to Discourse soon! Make sure you're ready for it!

    Minimal Bookmarks Tree
    My Google Chrome extension: browsing bookmarks made easy

  3. #3
    SitePoint Addict
    Join Date
    Mar 2008
    Location
    Sterling, CO
    Posts
    275
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I'm trying to actually get it to display if the page before it was microtime. I thought it would work with something like this:


    PHP Code:
    <?php if ($_SERVER[HTTP_REFERER] = isset($_GET['microtime'])) { include('code.php'); } ?>
    but it doesn't. What I'm I doing wrong?

  4. #4
    SitePoint Evangelist
    Join Date
    Aug 2009
    Posts
    406
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    PHP Code:
    if (strstr($url"some_string"))
    {
    include(
    '/some/file.php');

    Daniel, Helpdesk Leader
    Hosting24.com Web Hosting - First class web hosting services.
    Reseller Hosting - Provide unlimited disk space and bandwidth


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
  •