How can I disable certain pages in a dynamic site

Discussion in 'PHP' started by thesamemanhal, Mar 13, 2010.

  1. #1
    I have an auto-updated youtube api website where the site urls are always in the form

    www.mydomain.com/video/yt.php?$TITLE

    or

    www.mydomain.com/video/$ID/$TITLE.html

    where $ID is the video id and $TITLE is the video title.

    Now I want to disable/ban any page that the $TITLE contains a certain word (e.g. sex).

    Any idea how can I do that?
     
    thesamemanhal, Mar 13, 2010 IP
  2. Kaizoku

    Kaizoku Well-Known Member

    Messages:
    1,261
    Likes Received:
    20
    Best Answers:
    1
    Trophy Points:
    105
    #2
    You can use mod_rewrite to redirect them to home page etc.
     
    Kaizoku, Mar 14, 2010 IP
  3. danx10

    danx10 Peon

    Messages:
    1,179
    Likes Received:
    44
    Best Answers:
    2
    Trophy Points:
    0
    #3
    www.mydomain.com/video/yt.php?$TITLE

    In yt.php add the following php code at the very top:

    <?php
    //example...
    $banned_words = array('sex');
    if(in_array($_GET['yt'], $banned_words)) {
    header('Location: http://'.$_SERVER['HTTP_HOST']);
    }
    
    ?>
    PHP:
     
    danx10, Mar 14, 2010 IP
  4. thesamemanhal

    thesamemanhal Active Member

    Messages:
    1,126
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    55
    #4
    i will try the trick, thank you danx10
     
    thesamemanhal, Mar 15, 2010 IP