[wp-hackers] 2 Questions: $_REQUEST equivalent and using GET in mod_rewrite

Alex Günsche ag.ml2007 at zirona.com
Tue Aug 28 19:15:38 GMT 2007


On Tue, 2007-08-28 at 19:56 +0100, Alex Andrews wrote:
> 1. How to santize the incoming data from $_GET. Or whereever.

Depends on where you want to use them. If you want them in a DB query,
use $wpdb->escape(). If it's for usage as HTML attribute, use
attribute_escape(). There are more functions like this, as I said,
depends on the specific case, which one to use.

> 2. How to work the mod_rewrite facilities (preferably from within
> Wordpress) to pass /artist/a/ onto artists.php?artist_id=a .

What seems to be the problem?

<?php
	$artist_id = sanitize_foo($_GET['artist_id']);
	require($mypath.'artists.php');
?>

simply make sure that your plugin gets to handle /artists/a/ (as
described before). There's no need for further rewriting.

Alex


-- 
Alex Günsche, Zirona OpenSource-Consulting
Blogs: http://www.zirona.com/ | http://www.regularimpressions.net
PubKey for this address: http://www.zirona.com/misc/ag.ml2007.asc



More information about the wp-hackers mailing list