Edit: http://us3.php.net/manual/en/function.str-ireplace.php
Enjoy.

Code:
<?php
function strireplace($needle,$replace,$haystack)
{
   if ($needle == '') {echo '<B>Error:</B> empty needle (haystack='.$haystack.')!<BR />'; return $haystack;}
   if ($haystack == '') {echo '<B>Error:</B> empty haystack (needle='.$needle.')<BR />'; return $haystack;}
   $where = 0;
   $needle = strtolower($needle);
   while ($where < strlen($haystack))
   {
      $thiswhere = @strpos(strtolower($haystack),$needle,$where);
      if ($thiswhere === FALSE)
      {
         $where = strlen($haystack);
      } else {
         if ($thiswhere == 0)
         {
            $haystack = $replace . substr($haystack,strlen($needle),strlen($haystack) - strlen($needle));
         } else if ($thiswhere == (strlen($haystack) - strlen($needle))) {
            $haystack = substr($haystack,0,strlen($haystack) - strlen($needle)) . $replace;            
         } else {
            $haystack = substr($haystack,0,$thiswhere) . $replace . substr($haystack,$thiswhere+strlen($needle),strlen($haystack) - $thisswhere - strlen($needle));
         }
      $where=$thiswhere+strlen($replace);
      }
   }
   return $haystack;
}
?>
dude, that's AWESOME...

(i needed that)

thanks a million!
Heh, no problem. And your sig is still borked. Wink
care for teh fixxorz?
alex10819 wrote:
care for teh fixxorz?


it has to be an image, phpbb won't allow non-image URLs in the [img] tags - elfprince has a workaround using .htaccess though, ask him
I've done that too...just add a mod_rewrite to your htaccess.
grr... Kerm, couldnt you just set .php files to be read as images by phpBB? i know there's a way in IPB...
That's a danger with that though, notably the injection of raw PHP into my site from a malicious user via the sig.
true, and it'd be too much work to do some of the other ideas i've got...
Alex, I could easily have you set up to do elprinces way if you want
That's what I was saying.
btw, what does that php script do?
rivereye wrote:
btw, what does that php script do?


--> http://us3.php.net/manual/en/function.str-ireplace.php <--

that function is PHP5 only, Kerm's script is the equivelant, but for PHP 3 and 4
It's a case-insensitive strreplace - replaces every instance of needle with replace in string haystack regardless of needle's case.
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 1 of 1
» All times are UTC - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement