Solved

PHP Sanitize GET

Posted on 2011-09-13
3
219 Views
Last Modified: 2012-05-12
Hi,
I would like a block of PHP in the header of a page that recieves the input via a GET url string, I want to stop any encoded rubbish and forward to a page where I can give instructions.

Thanks
0
Comment
Question by:tonypearce
  • 2
3 Comments
 
LVL 8

Expert Comment

by:PranjalShah
ID: 36532135
I think you want to redirect to a particular page if you receive an input via url, you can do

if($_GET['urlvariable']){
        header ('Location: ' . "http://mysite.com");
}
0
 

Author Comment

by:tonypearce
ID: 36532185
Kind of, what i need to do is redirect if any bad chars are detected
0
 
LVL 8

Accepted Solution

by:
PranjalShah earned 500 total points
ID: 36532233
See the Sanitize Input section at http://www.w3schools.com/php/php_filter.asp
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction HTML checkboxes provide the perfect way for a web developer to receive client input when the client's options might be none, one or many.  But the PHP code for processing the checkboxes can be confusing at first.  What if a checkbox is…
Developers of all skill levels should learn to use current best practices when developing websites. However many developers, new and old, fall into the trap of using deprecated features because this is what so many tutorials and books tell them to u…
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

792 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question