Menu
Forums
All threads
Latest threads
New posts
Trending threads
New posts
Search forums
Trending
What's new
New posts
New profile posts
Latest activity
Members
Current visitors
New profile posts
Search profile posts
Upgrades
Log in
Register
What's new
Search
Search
Search titles only
By:
All threads
Latest threads
New posts
Trending threads
New posts
Search forums
Menu
Log in
Register
Navigation
Install the app
Install
More options
Contact us
Close Menu
Forums
Software Development
Programming
Programming Q&A
[PHP]Code-Review
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="RastaLulz" data-source="post: 428152" data-attributes="member: 1"><p> <ol> <li data-xf-list-type="ol">Instead of sanitizing the value, validate it, and return an error if it doesn't fit your constraints.</li> <li data-xf-list-type="ol">The password is hashed, not encrypted; there's a difference.</li> <li data-xf-list-type="ol">For the sack of my eyes, please take a look at <a href="https://www.php-fig.org/psr/psr-1/" target="_blank">PSR-1 (Basic Coding Standard)</a> and <a href="https://www.php-fig.org/psr/psr-2/" target="_blank">PSR-2 (Coding Style Guide)</a>.</li> <li data-xf-list-type="ol">I don't know how your script is entirely setup, but you can check if the form has been submitted at the top, and return instead of doing needless checks to later determine that. You can also infer later in the script that it has been posted, reducing the need for unnecessary checks.</li> <li data-xf-list-type="ol">Instead of checking $_REQUEST['submit'], you should only care if it were POST'd in this context.</li> <li data-xf-list-type="ol">Instead of checking if the username is not null, use <a href="http://php.net/manual/en/function.isset.php" target="_blank">isset()</a>; this will prevent warnings.</li> </ol><p>I'm sure there's more I could nitpick.</p></blockquote><p></p>
[QUOTE="RastaLulz, post: 428152, member: 1"] [LIST=1] [*]Instead of sanitizing the value, validate it, and return an error if it doesn't fit your constraints. [*]The password is hashed, not encrypted; there's a difference. [*]For the sack of my eyes, please take a look at [URL='https://www.php-fig.org/psr/psr-1/']PSR-1 (Basic Coding Standard)[/URL] and [URL='https://www.php-fig.org/psr/psr-2/']PSR-2 (Coding Style Guide)[/URL]. [*]I don't know how your script is entirely setup, but you can check if the form has been submitted at the top, and return instead of doing needless checks to later determine that. You can also infer later in the script that it has been posted, reducing the need for unnecessary checks. [*]Instead of checking $_REQUEST['submit'], you should only care if it were POST'd in this context. [*]Instead of checking if the username is not null, use [URL='http://php.net/manual/en/function.isset.php']isset()[/URL]; this will prevent warnings. [/LIST] I'm sure there's more I could nitpick. [/QUOTE]
Insert quotes…
Verification
Post reply
Forums
Software Development
Programming
Programming Q&A
[PHP]Code-Review
Top