User input cannot be trusted. Malicious user can always supply the application with unexpected data. As such malformed input data can cause undesired application actions, it is important to filter all user input and validate that it matches the intended patterns. In the context of PHP applications, typical user input are URL parameters, HTTP post data, and cookie values. PHP makes these user input values available for the application via the following global arrays:
If the feature Register Global is turned on, PHP also creates global variables for the con-tents of the above arrays. It is strongly recommended to turn this feature off, however if it is turned on, the values of these global input variables must be treated as user input too. See section 2.3 for more information about Register Global. Depending on the scenario, it might be necessary to consider data from sources like files or databases as user input too. This might for example be necessary if the application fetches data from third party databases. In order to ensure that all user input is filtered before it is used in the application; it is advisable to adhere to the following guidelines:
Other useful functions are the character type functions. They check for example whether a string consists of only alphanumeric characters. PHP provides various of these functions that check for different character classes. The following list contains especially useful examples with respect to input filtering:
More specialized methods for validating user input are presented in the following sections of this paper. Recommendations:
For more help & guide line ask question with our Dedicated PHP Developer or well known PHP Development Company