Help me with this php "(:(:(

 

Results 1 to 9 of 9
<?php if ( "M ON THIS IS URL" ) : ?> then content here <?php ...
  1. #1
    jr D.I.P's Avatar
    jr D.I.P is offline i'm Deep singhal
    Join Date
    Jan 2012
    Location
    goo.gl/h3INI
    Posts
    618
    Thanks
    299
    Thanked 309 Times in 146 Posts

    Default Help me with this php "(:(:(

    <?php if ( "M ON THIS IS URL" ) : ?>


    then content here


    <?php endif; ?>


    how to "??




  2. #2
    Zapdos's Avatar
    Zapdos is offline Power Member
    Join Date
    Oct 2011
    Location
    Eastern North Carolina
    Posts
    592
    Thanks
    78
    Thanked 688 Times in 411 Posts

    Default Re: Help me with this php "(:(:(

    http://php.net/manual/en/reserved.variables.server.php

    $_SERVER['SCRIPT_FILENAME']
    $_SERVER['REQUEST_URI']
    $_SERVER['PATH_INFO']

    Depending on your needs.

  3. #3
    alias_unknown is offline Newbies
    Join Date
    Dec 2012
    Posts
    40
    Thanks
    3
    Thanked 4 Times in 4 Posts

    Default Re: Help me with this php "(:(:(

    Please can you try to explain the problem further...

  4. #4
    Kilise's Avatar
    Kilise is offline Newbies
    Join Date
    Dec 2011
    Posts
    34
    Thanks
    8
    Thanked 5 Times in 5 Posts

    Default Re: Help me with this php "(:(:(

    Lets say you are on:
    http://yoursite.com/index.php?page=here

    if($_GET['page'] == 'here'){
    echo "IM HERE";
    }else{
    echo "this will be shown if the page isnt here";
    }

  5. #5
    firescape is offline Newbies
    Join Date
    Jan 2013
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Help me with this php "(:(:(

    You can use query strings, cookies, or other means of tracking state. I recommend you learn how to make an if statement and the basics before learning this.

  6. #6
    Eightomic's Avatar
    Eightomic is offline Newbie
    Join Date
    Oct 2012
    Location
    United States
    Posts
    12
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default Re: Help me with this php "(:(:(

    Just replace the example URLs with the correct URLs and this will work:

    Code:
    <?php
        $url = 'your full url here';
        $getCurrentUrl = $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'];
        if (strstr($fullUrl, 'your full url here')):
    ?>
        Place page content here.
    <?php else: ?>
        Other content here.
    <?php endif; ?>
    ?>
    If you just want to use what comes after the domain name, use only $_SERVER['REQUEST_URI'] as shown below:

    Code:
    <?php
        $url = 'your full URL here';
        $afterUrl = $_SERVER['REQUEST_URI'];
        if (strstr($afterUrl, 'your partial url here')):
    ?>
        Place page content here.
    <?php else: ?>
        Other content here.
    <?php endif; ?>
    ?>
    Last edited by Eightomic; 02-24-2013 at 07:20 PM. Reason: Add <code> tags

  7. #7
    nickcarter's Avatar
    nickcarter is offline Newbies
    Join Date
    Feb 2013
    Posts
    15
    Thanks
    0
    Thanked 3 Times in 2 Posts

    Default Re: Help me with this php "(:(:(

    Quote Originally Posted by jr D.I.P View Post
    <?php if ( "M ON THIS IS URL" ) : ?>


    then content here


    <?php endif; ?>


    how to "??
    ANY-URL?M=any-variable

    <?php
    if(isset($_GET['M']) && $_GET['M']!=='') :
    ?>

    any content

    <?php endif ?>

  8. #8
    g0g0l is offline Jr. VIP
    Join Date
    Sep 2010
    Posts
    2,522
    Thanks
    4,244
    Thanked 2,311 Times in 1,235 Posts
    Blog Entries
    3

  9. #9
    g0g0l is offline Jr. VIP
    Join Date
    Sep 2010
    Posts
    2,522
    Thanks
    4,244
    Thanked 2,311 Times in 1,235 Posts
    Blog Entries
    3

    Default Re: Help me with this php "(:(:(

    Are you kidding ?! cookiess for determining the page url?
    Quote Originally Posted by firescape View Post
    You can use query strings, cookies, or other means of tracking state. I recommend you learn how to make an if statement and the basics before learning this.


Similar Threads

  1. Replies: 5
    Last Post: 07-26-2013, 01:03 PM
  2. [WTH] PHP Curl "IP LOCKED" Video Page - $15 (NOT HARD)
    By baokyrox in forum Hire a Freelancer
    Replies: 0
    Last Post: 06-08-2012, 09:21 PM
  3. Replies: 12
    Last Post: 08-12-2010, 05:09 PM
  4. Get:"Head First PHP & MySQL (With Source Code)"
    By chuapasa in forum Web Design
    Replies: 1
    Last Post: 10-16-2009, 08:40 AM

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
  •  




BlackHatWorld on Twitter BlackHatWorld on FaceBook


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101