Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / NewStats: 3,151,402 members, 7,812,180 topics. Date: Monday, 29 April 2024 at 09:37 AM |
Nairaland Forum / Science/Technology / Programming / I Need Explanation On This Code?? Php Programmers (609 Views)
Please I Need Explanation Of This Express.js Code / Abuja Php Programmers Where Are You? I Have A Job For You / Need Professional Php Programmers For A Project, Money Involved (2) (3) (4)
I Need Explanation On This Code?? Php Programmers by WallStreetfx(m): 12:18pm On Jan 24, 2023 |
please i need explanation i dont what the variable is result is doing in the function
|
Re: I Need Explanation On This Code?? Php Programmers by qtguru(m): 12:38pm On Jan 24, 2023 |
Checks if Email is valid, why not consult php manual ? |
Re: I Need Explanation On This Code?? Php Programmers by stanliwise(m): 12:31am On Jan 25, 2023 |
WallStreetfx:That is filter_var() function, it is used to check or validate input based on the choice of algorithm you choose. FILTER_VALIDATE_EMAIL is a constant that will choose algorithm for validating email |
Re: I Need Explanation On This Code?? Php Programmers by fhranchez(m): 11:14pm On Jan 25, 2023 |
Why would anyone want to validate emails from the backend? Unless for educational purposes, all data are being validated at the frontend to save time |
Re: I Need Explanation On This Code?? Php Programmers by qtguru(m): 12:17am On Jan 26, 2023 |
fhranchez: JS can be disabled, Backend is your best point to secure bad input 4 Likes |
Re: I Need Explanation On This Code?? Php Programmers by truthCoder: 1:52am On Jan 26, 2023 |
fhranchez: Every good programmer validates at the backend. 4 Likes |
Re: I Need Explanation On This Code?? Php Programmers by airsaylongcome: 9:03am On Jan 26, 2023 |
qtguru: Baba, let's link up on Slack. There's a possible Laravel/Django gig from Malta |
Re: I Need Explanation On This Code?? Php Programmers by silento(m): 10:47am On Jan 26, 2023 |
fhranchez: First rule of web development never trust an input from a user Unless you are coding for yourself , always validate every input at backend else ...., 1 Like |
Re: I Need Explanation On This Code?? Php Programmers by bassdow: 11:37am On Jan 26, 2023 |
fhranchez: never trust the USER. I suggest frontEnd + backEnd Validations. That way, the frontEnd validation spots and informs the user of potential errors so as to save time of going back & fort. The backEnd validation is a must and should never be skipped. Moreover that code above is unnecessarily long. Shouldn't exceed 4 lines, and with ternary operator, should be just a single line. Still recall when PHP was the only language I spoke. Kai 1 Like |
Re: I Need Explanation On This Code?? Php Programmers by fhranchez(m): 1:43pm On Jan 26, 2023 |
bassdow:you mean data sanitization? |
Re: I Need Explanation On This Code?? Php Programmers by fhranchez(m): 1:45pm On Jan 26, 2023 |
Wow, so ya'll devs can't differentiate between data validation and and data sanitization? |
Re: I Need Explanation On This Code?? Php Programmers by bassdow: 3:33pm On Jan 26, 2023 |
fhranchez: Sanitizing differs from Validation. |
Re: I Need Explanation On This Code?? Php Programmers by fhranchez(m): 10:38pm On Jan 26, 2023 |
bassdow:thank you, not trusting the user is sanitizing the input, but guiding the user to make valid inputs is validation. So, why should i do that in the backend again, if not for time wasting |
Re: I Need Explanation On This Code?? Php Programmers by 404Dev: 10:52pm On Jan 26, 2023 |
fhranchez: 1. Javascript can be disabled and your validation rules would not even run and you would run into big problems by working with wrong input (database errors, huge logical errors). 2. Anything on the front end can y manipulated by the user. 98% of users would not know how to do this, but it can be done, so if you are using user input without validation and sanitation, you are setting yourself up for big headaches. An example for context, let's say you are building a grants app that allows users to request grants from the government. But each user can request a maximum of NGN 500,000 only. And you create a validation function on the frontend that checks the input and ensures the value is below the limit before submitting the form. If I decide javascript from my browser, then your validation function will never run and I successfully request for a grant of NGN 10,000,000 without any issues. So even if you validate on the frontend, you should always always validate on the backend. Never ever trust any input from the end user. |
Re: I Need Explanation On This Code?? Php Programmers by fhranchez(m): 12:47am On Jan 27, 2023 |
404Dev:hmm, nice one |
Re: I Need Explanation On This Code?? Php Programmers by truthCoder: 2:51am On Jan 27, 2023 |
fhranchez: So you don’t validate inputs on your backend? Every garbage that can bypass the frontend wham…straight into your database? Wonderment. |
(1) (Reply)
Rate My Portfolio Website / The Next X Prize Wants To Revolutionize Education / After PHP What Next?
(Go Up)
Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health religion celebs tv-movies music-radio literature webmasters programming techmarket Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10) Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 34 |