Brian,

I hope your not using the code below anywhere as it looks wide open to SQL Injection.

Adam

Quoting Brian Butterworth <[EMAIL PROTECTED]>:
PHP code sample to do the "tinyURL" bit...


<?

$link = mysql_connect(MYSQLHOST, MYSQLUSER, MYSQLPASS) or die("Could not
connect");
mysql_select_db(MYSQLDB) or die("Could not select database");

$strURL="http://invalidvaluelocation";;

$result2 = mysql_query("SELECT strURL FROM tblRedirects WHERE txtShortCode=
\"" . @$_GET["code"] . "\";") or die("Query failed");
if (mysql_num_rows($result2)>0)  while ($line = mysql_fetch_array($result2,
MYSQL_ASSOC)) if ($line["strURL"]!="") $strURL=$line["strURL"];

header ("Location: $strURL");

?>



On 07/11/2007, Brian Butterworth <[EMAIL PROTECTED]> wrote:



On 06/11/2007, James Cox <[EMAIL PROTECTED]> wrote:
>
>
>  On 6 Nov 2007, at 00:07, Andrew Bowden wrote:
>
>  From: [EMAIL PROTECTED] on behalf of James Cox
>
> 'course, bbc.co.uk has had some kind of redirect magic for a while:
> http://bbc.co.uk/zanelowe/
>
>
>
> First time I've seen a big fat httpd.conf called magic :)
>
>
>
> and there I was thinking you had some nice routing controller thin-app
> which had some clever logging, tracking and management of such urls.... :)
>

1544804416 entries would be a bit much for a httpd.conf file, I suspect
what would be required is a ... database.


   though i suspect the problem (and usage of tinyurl) is that to get
> one of those nice urls hooked up, you gotta email someone a request,
> who needs to get approval from a manager....
>
>
>
> Well lets just say there is a process and it has to be done sensibly
> else you'd get loads of random redirects.  Although I still think
> bbc.co.uk/breakfast should go to a big portal page for all the BBC's
> breakfast shows :)
>
>
>
>
>
>
>  --
>
> *James Cox,
> *Internet Consultant
> t: 07968 349990  e: [EMAIL PROTECTED] w: http://imaj.es/
>
>
>
>



--
Please email me back if you need any more help.

Brian Butterworth
www.ukfree.tv




--
Please email me back if you need any more help.

Brian Butterworth
www.ukfree.tv






-
Sent via the backstage.bbc.co.uk discussion group.  To unsubscribe, please 
visit http://backstage.bbc.co.uk/archives/2005/01/mailing_list.html.  
Unofficial list archive: http://www.mail-archive.com/backstage@lists.bbc.co.uk/

Reply via email to