Results 1 to 9 of 9

Thread: out.php?type=rss

  1. #1
    Join Date
    Mar 2008
    Posts
    122
    Thanks
    17
    Thanked 5 Times in 5 Posts

    Default out.php?type=rss

    hi, i need a php script written for me where if in the address bar it says out.php?type=rss it will redirect to my rss feed (which is default.xml). thanks in advance

  2. #2
    Join Date
    May 2007
    Location
    England, UK
    Posts
    235
    Thanks
    3
    Thanked 6 Times in 6 Posts

    Default

    This will redirect to a specific page:
    PHP Code:
    $type $_GET['type']; // This will store the info from the url in a variable

    if ($type == "rss")
        {
        
    header('Location: http://www.whatever.com/default.php');     
        } 
    Where as this will include the page:
    PHP Code:
    $type $_GET['type']; // This will store the info from the url in a variable

    if ($type == "rss")
        {
        include(
    'default.php');    
        } 
    Hope that helps!

  3. The Following User Says Thank You to jc_gmk For This Useful Post:

    hmsnacker123 (04-25-2008)

  4. #3
    Join Date
    Jan 2008
    Posts
    4,168
    Thanks
    28
    Thanked 628 Times in 624 Posts
    Blog Entries
    1

    Default

    You can also do this:
    PHP Code:
    $type $_GET['type'];
    switch(
    $type){
    case 
    'rss':
    include(
    $type.'.php');
    break;
    default:
    echo 
    "Your not on a page!";

    Jeremy | jfein.net

  5. The Following User Says Thank You to Nile For This Useful Post:

    hmsnacker123 (04-25-2008)

  6. #4
    Join Date
    Mar 2008
    Posts
    122
    Thanks
    17
    Thanked 5 Times in 5 Posts

    Default

    thanks nile

  7. #5
    Join Date
    Jan 2008
    Posts
    4,168
    Thanks
    28
    Thanked 628 Times in 624 Posts
    Blog Entries
    1

    Default

    Anytime.
    Jeremy | jfein.net

  8. #6
    Join Date
    Mar 2008
    Posts
    122
    Thanks
    17
    Thanked 5 Times in 5 Posts

    Default

    ok guys one more thing i need one to go :

    download.php?file=example.zip

  9. #7
    Join Date
    May 2007
    Location
    England, UK
    Posts
    235
    Thanks
    3
    Thanked 6 Times in 6 Posts

    Default

    you can use the same script just replace some of the words.

    Instead of $type use $file.

    Might be worth having a read of this.

    http://www.w3schools.com/php/default.asp

    It will give you a pretty good insight into PHP.

  10. #8
    Join Date
    Jan 2008
    Posts
    4,168
    Thanks
    28
    Thanked 628 Times in 624 Posts
    Blog Entries
    1

    Default

    Try this:
    PHP Code:
    $type $_GET['type'];
    switch(
    $type){
    case 
    'example.zip':
    echo 
    '<a href="$type">Example.zip</a>';
    break;
    case 
    'example2.zip':
    echo 
    '<a href="$type">Example2.zip</a>';
    break;
    default:
    echo 
    "Your not on a page!";

    Jeremy | jfein.net

  11. #9
    Join Date
    Nov 2006
    Location
    Northeast USA
    Posts
    408
    Thanks
    8
    Thanked 30 Times in 28 Posts

    Default

    Or Even:
    Code:
    $file = $_GET['file'];
    if(file_exists($file")
    {
    header("location: $file");
    }
    else
    {
    echo "We're sorry, that file is not available.";
    }
    -Ben -- THE DYNAMIC DRIVERS
    My Links: My DD Profile||My Youtube Video Tutorials||DD Helping Coders||DD Coders In Training
    I told my client to press F5, the client pressed F, then 5, *facepalm*

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
  •