Maracles Posted May 25, 2009 Share Posted May 25, 2009 I am following a tutorial in a book which uses the code: get_magic_quotes_gpc however it does really explain what use this has. Can anyone tell me? It does not seem to be the name of a variable or Array or anything. Thanks. Quote Link to comment Share on other sites More sharing options...
Daniel0 Posted May 25, 2009 Share Posted May 25, 2009 A deprecated way of escaping GET, POST and COOKIE values. Burn the book and buy a new one. It's too old. Quote Link to comment Share on other sites More sharing options...
Maracles Posted May 25, 2009 Author Share Posted May 25, 2009 Thank you for the update. What would a more modern way of writing the same code be? The current code it is used in is: // create short variable names $searchtype=$_POST['searchtype']; $searchterm=trim($_POST['searchterm']); if (!$searchtype || !$searchterm) { echo 'You have not entered search details. Please go back and try again.'; exit; } if (!get_magic_quotes_gpc()){ $searchtype = addslashes($searchtype); $searchterm = addslashes($searchterm); } Quote Link to comment Share on other sites More sharing options...
Daniel0 Posted May 25, 2009 Share Posted May 25, 2009 It depends on what the search term and type is used for later on in the script. I've written a tutorial you might want to read that covers things like that: http://www.phpfreaks.com/tutorial/php-security Quote Link to comment Share on other sites More sharing options...
Maracles Posted May 25, 2009 Author Share Posted May 25, 2009 Thanks for the help. I will try and read that tutorial tonight. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.