php - Request url on a save way -


i read url. www.domain.com?cookie=set&redirect=yes

now want use $ _server['request_uri'] not work strip_tags , htmlspecialchars.

also many read should watch xss.

does know how save url can used get?

$url = "http://'.$_server[http_host]$_server[request_uri]; $url = strip_tags($url);//doesnt work $url = htmlspecialchars($url);//doesnt work 

thanks!

edit (doesnt work):

$url = "http://".$_server[http_host]."".$_server[request_uri]; $url = strip_tags($url); echo $url; 

for example www.domain.com?cookie=set&redirect=yes

output => index.php?cookie=se%3cscript%3et&re%3cb%3ed%3c/b%3eirect=yes

this line

$url = "http://'.$_server[http_host]$_server[request_uri]; 

needs either

$url = "http://{$_server['http_host']}{$_server['request_uri']}"; 

or

$url = "http://".$_server['http_host'].$_server['request_uri']; 

the way doing not concatenate data correctly.

issues line:

  1. your mixing quotes around protocol " open , ' close
  2. you not quoting $_server params e.g $_server['param']
  3. you not joining 2 $_server vars you'll syntax error

Comments

Popular posts from this blog

blackberry 10 - how to add multiple markers on the google map just by url? -

php - guestbook returning database data to flash -

java - Using an Integer ArrayList in Android -