note 104344 modified in function.urlencode by danbrown
| From: | danbrown@php.net | Date: | Fri, 10 Jun 2011 15:29:14 +0000 |
| Subject: | note 104344 modified in function.urlencode by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-180424@lists.php.net to get a copy of this message | ||
I write this code, to full protect from XSS:
<?php
$url = "";
for($i = 0; $i < strlen($value); $i++)
$url .= strpos("/:@&%=?.#", $value[$i]) === False ? urlencode($value[$i]) :
$value[$i];
$value = $url;
?>
--was--
I write this code, to full protect from XSS:
$url = "";
for($i = 0; $i < strlen($value); $i++)
$url .= strpos("/:@&%=?.#", $value[$i]) === False ? urlencode($value[$i]) :
$value[$i];
$value = $url;
http://php.net/manual/en/function.urlencode.php