Re: 2 questions: Search in array and detect JS

From: Date: Sat, 15 Apr 2006 13:26:00 +0000
Subject: Re: 2 questions: Search in array and detect JS
Groups: php.general 
Request: Send a blank email to php-general+get-234035@lists.php.net to get a copy of this message
Hey Stut, Thanks for replying. ------------------- The way I do this is to serve the 'notmal page' first, but with the following snippet of JS in it... <script language="javascript"> <!-- location.href = '/url/for/ajax/page.php'; --> </script>----------------------Makes sense and pretty easy, this was suggested a while back, since you have supported itI think I'll start using this method.------------------- You should be able to craft some combination of array_walk and a custom function that checks each element with stristr to do what you need. -------------Actually, I solved this thanks to Richard from the list who suggested strpos, a function I had never usedbefore ( Tedd from the list gave me the same suggestion as you to use stristr, I didnt want to use stristr as its a bit expensive esp with a really large array) the problem I ran into was that strpos is a php5 function....but reading the user contributed articles on strpos at thephp site I got the code that does exactly that in 2-3 linesCheers!

« previous php.general (#234035) next »