Results 1 to 7 of 7

Thread: PHP links script

  1. #1
    Website Developer
    Join Date
    Oct 2004
    Posts
    1,607

    PHP links script

    I noticed a lot of sites use asp for their external links. The link will be something like http://www.website.com/links/goto.asp?id=9999

    Is there a way to do this in PHP? I have limited programming knowledge.

    The reason I am asking is because I want to block outgoing PR for certain links on a page I am working on.

    Thanks!
    Make more money - Read my Web Publishing Blog

  2. #2
    Registered abelony's Avatar
    Join Date
    May 2004
    Posts
    47
    Sure, here is a little piece of code for a url like this: http://www.website.com/links/goto.php?id=9999

    The code below will be your goto.php file

    PHP Code:

    If (!Isset($id)){
    $URL="anywher you want to direct the user"//if the $id is not set
    }
    else
    {
      
    // If you have the url stored in a database you can run a 
      //query here and get the URL that the visitor will be sent to.
    }

    header ("Location: $URL"); //This will send your visitor to the URL. 

  3. #3
    Registered abelony's Avatar
    Join Date
    May 2004
    Posts
    47
    Forgot to mention that you can tell the spider not to follow the link by putting the following code in a robots.txt file.

    User-agent: *
    Disallow: /links/goto.php

    Anyone, if you notice a mistake please let us know. This is my very first programming advice.

  4. #4
    Senior Member
    Join Date
    Jul 2003
    Posts
    774
    where do u set the id of the url ?

  5. #5
    Senior Member AndyH's Avatar
    Join Date
    May 2004
    Location
    Australia
    Posts
    553
    Quote Originally Posted by s2kinteg916
    where do u set the id of the url ?
    PHP Code:
    If (!Isset($id)){
    $URL="anywher you want to direct the user"//if the $id is not set
    }
    else
    {
      if (
    $id == 1) { $URL "http://www.google.com"; }
      elseif (
    $id == 2) { $URL "http://www.msn.com"; }
      elseif ( 
    $id == 3) { $URL "http://www.yahoo.com"; }
     }

    header ("Location: $URL"); //This will send your visitor to the URL. 
    Like that
    New website released. ya rly!

  6. #6
    Senior Member
    Join Date
    Jul 2003
    Posts
    774
    Cool thanks very useful...

  7. #7
    Website Developer
    Join Date
    Oct 2004
    Posts
    1,607
    Excellant, I appreciate the help.
    Make more money - Read my Web Publishing Blog

Similar Threads

  1. Script to turn all links into javascript or redirects
    By Westech in forum Website Programming & Databases
    Replies: 5
    Last Post: 10-20-2014, 04:34 PM
  2. AWS PHP Script with Caching?
    By intelliot in forum Website Programming & Databases
    Replies: 7
    Last Post: 08-11-2004, 09:23 AM
  3. Looking for affiliates.. (to sell a PHP script)
    By listenmirndt in forum The Marketplace
    Replies: 4
    Last Post: 04-12-2004, 02:58 AM
  4. AWS PHP script problems
    By tempyyyst in forum Advertising & Affiliate Programs
    Replies: 8
    Last Post: 04-04-2004, 07:12 AM
  5. php script problems
    By wrigh_g in forum HTML, CSS, Layout, and Design
    Replies: 4
    Last Post: 01-24-2004, 06:54 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
  •