thangappan Posted February 5, 2009 Share Posted February 5, 2009 I passed the psql query to another page using http_build_array() function.In that I have a problem to receive the query as the same what I have sent. Example: $query = "select * from test where first_name ilike '%page%';"; $string = http_build_array(array('query' => $query)); echo "<script language=\"javascript\" > window.location=\"Pagination.php?$string\" </script>"; In receiving end, echo $_GET['query']; It prints, select * from test where first_name ilike \'%page%\'; In this page I want to execute this query.Because of \ database tells error. Please solve my problem. Link to comment https://forums.phpfreaks.com/topic/143883-passing-query-to-another-page/ Share on other sites More sharing options...
corbin Posted February 5, 2009 Share Posted February 5, 2009 From a security point of view, that's a terrible idea. Pass the page number, and then build the query. But, the \ is most likely being added because of magic quotes. Link to comment https://forums.phpfreaks.com/topic/143883-passing-query-to-another-page/#findComment-754985 Share on other sites More sharing options...
thangappan Posted February 7, 2009 Author Share Posted February 7, 2009 I found the answer for this question. Using stripslashes() function, we can remove the \ in the string. Link to comment https://forums.phpfreaks.com/topic/143883-passing-query-to-another-page/#findComment-756681 Share on other sites More sharing options...
PFMaBiSmAd Posted February 7, 2009 Share Posted February 7, 2009 I'll repeat what corbin already told you. DON'T pass a query string through a URL or any other method where the user has the ability to change it. As soon as a hacker finds your site, they will read every table in your database and then they will add, change, and delete your data. Link to comment https://forums.phpfreaks.com/topic/143883-passing-query-to-another-page/#findComment-756691 Share on other sites More sharing options...
ratcateme Posted February 7, 2009 Share Posted February 7, 2009 pass only the page number and run a mysql_real_escape_string on it to avoid hackers doing stuff to your query Scott. Link to comment https://forums.phpfreaks.com/topic/143883-passing-query-to-another-page/#findComment-756697 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.