An aid for the "two-click" rule

The boards prohibit a direct link to a site that may be offensive. To provide an intermediate link I have set up the following page

http://www.seigle.net/extraclick.php

You can create a link that will give you an extra click by following the above with

?=

then your URL. For example, suppose you are concerned that someone might find Disney World offensive. You could link like this:


http://www.seigle.net/extraclick.php?u=disneyworld.disney.go.com/wdw/index

and here is the actual link

http://www.seigle.net/extraclick.php?u=disneyworld.disney.go.com/wdw/index

Very impressive.

Test.

Sweet.

Nicely done. I notice that it handles non-http URL schemes–did you have to code that part, or is there a standard package that’ll do that for you?

Cool.

One other approach, of course, is to provide the url but not the link. You can do this easily by unchecking the button to “automaticaly parse links in text” found in the “Additional Options” area below the reply screen.

For those who are confused, our goal is not censorship, but to be sure direct links are “workplace safe” – that is, if you accidentally click on a link while at work, that’s just the moment your boss will walk by, and we don’t want her to see [insert favorite movie star] naked on your screen. Our assumption is that you might accidentally click on a link, lord knows that happens easily enough, but a second click is intentional, and be our guest.

So, a disabled link or just the URL is fine, that requires deliberate action on your part to get there.

It just passes through the URL provided, and does not even look at the scheme. If an invalid scheme (xyz://yoursite.com) is provided, the link will be created anyway and left for your browser to find out it’s invalid when you click on it.

If you provided a URL without a scheme, it will assume you meant http://

It is written in PHP. The logic is very simple. It first checks to see that the URL was actually provided. If not, it just gives a few lines about how to use the site. Otherwise, it checks for a scheme by looking for “://”. If it does not find it, it prepends “http://”. Then it creates the link, showing the URL.

It also checks the URL for “<”, which is illegal in a URL and could also indicate somebody is trying to sneak in some funky HTML, which could allow them to display just about anything they wanted on the page. For example, you could code a fake URL that looked like
http://<img src=“http://somepornsite.com/somenastyphoto.jpg”>

and the objectionable image itself would be displayed on the page.

Here is the core code:



<?php

$destination_url = $_GET['u'];
if (strlen($destination_url) == 0) {
   ?>

   <p>This page is provided blah blah blah
   <?php

}
else {

   ?>

   <p>You have been takenblah blah blah
   <?php

   if (strrpos($destination_url, "<")) {
      print "Sorry, but there was an illegal character '<' found in requested URL.";
   }

   else {
      if (!strrpos($destination_url, "://"))
        $destination_url = "http://" . $destination_url;

      print '<a href="' . $destination_url . '">' . $destination_url . '</a>';

   }

}


Y’know, I’ve got almost 2,000 posts and I never noticed that checkbox. :smack:

Well, anyway, posters can decide whether to do a little extra work once and make it easy for readers, or shift the work to the reader to copy & paste a URL (which many will probably say is no more difficult than two clicks anyway).

You have probably figured out by now that should be

?=u

Or, actually

?u=
:smack: :smack:

www.tinyurl.com has a preview option which can display a redirect page for you to click on to get to the target page. You must enable this at the tinyurl site, which will save a cookie with this option.

www.shorl.com sends you to a redirect page for a few seconds before automatically sending you to the final destination, allowing you time to close the window if you don’t like the link.