Re: [PHP] php code to upload a url correctly

2007-01-29 Thread Richard Lynch
On Fri, January 26, 2007 8:10 am, Corden James (RW3) CM&MC Manchester wrote: > I have a form in which users submit a url. I am having problems as > some > people submit the url in the format http://www.blah.blah.org > while others submit in the format > www.blah.blah.or

Re: [PHP] php code to upload a url correctly

2007-01-26 Thread Jochem Maas
Dave Goodchild wrote: > Wouldn't it have been less hassle to not send that comment when all I > was doing was trying to help, am pressed for time, and copied and pasted > my solution? no hassle on my part. :-D I doubt you want me to point out that you original comment that I commented on and the

Re: [PHP] php code to upload a url correctly

2007-01-26 Thread Jochem Maas
Stut wrote: > Jochem Maas wrote: >> Németh Zoltán wrote: > ... > > I don't have numbers, but I'd bet this is quicker than doing a parse_url. I didn't realise speed was an issue. and if it really was an issue I would suggest offloading the url normailization into a batch routine that is run out

Re: [PHP] php code to upload a url correctly

2007-01-26 Thread Stut
Jochem Maas wrote: Németh Zoltán wrote: You should first check the url and only add "http://"; at the beginning if its not there I do it like if (substr($url, 0, 4) != "http") {$url = "http://"; . $url;} in my website, although it is probably not the most elegant solution ;) it will break i

Re: [PHP] php code to upload a url correctly

2007-01-26 Thread Németh Zoltán
On p, 2007-01-26 at 16:46 +0100, Jochem Maas wrote: > Németh Zoltán wrote: > > On p, 2007-01-26 at 14:10 +, Corden James (RW3) CM&MC Manchester > > wrote: > >> I have a form in which users submit a url. I am having problems as some > >> people submit the url in the format http://www.blah.blah.o

Re: [PHP] php code to upload a url correctly

2007-01-26 Thread Jochem Maas
Dave Goodchild wrote: > This is what I use: > > $site = (!preg_match('#^http://#', $_POST['c_site'])) ? > raw_param(trim(strip_tags("http:\/\/" . $_POST['c_site']))) : > raw_param(trim(strip_tags($_POST['c_site']))); this is much better: http://php.net/parse_url > > don't worry about raw_param,

Re: [PHP] php code to upload a url correctly

2007-01-26 Thread Jochem Maas
Németh Zoltán wrote: > On p, 2007-01-26 at 14:10 +, Corden James (RW3) CM&MC Manchester > wrote: >> I have a form in which users submit a url. I am having problems as some >> people submit the url in the format http://www.blah.blah.org >> while others submit in the

Re: [PHP] php code to upload a url correctly

2007-01-26 Thread Dave Goodchild
This is what I use: $site = (!preg_match('#^http://#', $_POST['c_site'])) ? raw_param(trim(strip_tags("http:\/\/" . $_POST['c_site']))) : raw_param(trim(strip_tags($_POST['c_site']))); don't worry about raw_param, that's a function of my own, but you get the idea.

Re: [PHP] php code to upload a url correctly

2007-01-26 Thread Németh Zoltán
On p, 2007-01-26 at 14:10 +, Corden James (RW3) CM&MC Manchester wrote: > I have a form in which users submit a url. I am having problems as some > people submit the url in the format http://www.blah.blah.org > while others submit in the format > www.blah.blah.org <

[PHP] php code to upload a url correctly

2007-01-26 Thread Corden James (RW3) CM&MC Manchester
I have a form in which users submit a url. I am having problems as some people submit the url in the format http://www.blah.blah.org while others submit in the format www.blah.blah.org I have designed the form so that it seems fairly obvious