1 / 12

Server Side Validation with PHP

Server Side Validation with PHP. By Ben Dougherty. What is Server Side Validation ?. A term used to validate user input on a web server. To understand server side validation we need to first understand HTTP requests. What are HTTP Requests?.

devin
Download Presentation

Server Side Validation with PHP

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Server Side Validation with PHP By Ben Dougherty

  2. What is Server Side Validation? A term used to validate user input on a web server. To understand server side validation we need to first understand HTTP requests.

  3. What are HTTP Requests? Hyper Text Transfer Protocol or HTTP is a term used to describe 8 methods available to us for communicating with a resource on a server. We are only going to talk about two of these today, GET and POST

  4. HTTP Request Steps HTTP requests are sent from the users browser to our web server. The web server processes the request and responds sending the requested page back to the web browser Validation code runshere at the server Database Client Requests Web Page Client’s Browser Server Server processes request and serves up web page

  5. POST Vs GET Both POST and GET requests use URL encoding and data is sent in key, value pairs. The GET method sends all data in the URL The POST method sends data in the header of the HTTP request.

  6. How to decide which one to use? Generally speaking GET should be used for displaying data, such as pagination. Eghttp://www.domain.com/index.php?page=5 POST is used when we want to hide the data been sent. Eg, Sending email or updating a database .

  7. Why do we need validation? To prevent intentional and accidental incorrect user input. To stop people without access from entering restricted area’s. To prevent damaging behaviour on the server, such as updating a database.

  8. Server Side Vs Client Side Client Side Client side validation is displayed faster to the user. Client side validation means no page refresh and therefore is instantly displayed. Unfortunately the user can disable client side validation.

  9. Server Side Vs Client Side Server Side Allows for more thorough validation Can not be disabled and therefore is more secure. Slower as information has to be sent to and from the server.

  10. PHP and $_POST PHP or HyperText Pre-processor is a server side scripting language making dynamic web development easy. Through PHP we can use $_POST which is a global array allowing us to access all information sent via a POST request. $_REQUEST also give’s you access to information inside the HTTP request but is now out dated and insecure.

  11. Lets see the code? Check for empty values Make sure user name is available Validate Phone numbers are numeric Validate email Check both emails match Validate length of password Check both passwords match

  12. BensBlogWa.com

More Related