Jump to content

Appending $_SERVER['QUERY_STRING'] safe?


phpzone

Recommended Posts

I just wanted to check, is appending QUERY_STRING to create $more_link like this considered ok or do people recommending sanitizing the variable in some way first?

 

<?php
  		foreach( $el->entries as $key=>$entry )
	  		{			

		$more_link = $_SERVER['PHP_SELF'] . '?' . $_SERVER['QUERY_STRING'] . '&entry_id=' . $entry['entry_id'];

  			print <<<_DISPLAY_ITEM

		<div class="blog-entry">

			<p class="blog-title">{$entry['entry_title']}</p>

			<p class="blog-preface">{$entry['entry_preface']}</p>

			<p class="blog-more"><a href="{$more_link}">read more</a></p>					

		</div>

_DISPLAY_ITEM;
?>

Link to comment
https://forums.phpfreaks.com/topic/109422-appending-_serverquery_string-safe/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.