Logic #1 is checking the returned value of the preg_match
function with respect to 0
and with operator ===
. That means the returned value of the preg_match
function has to be (int) 0
or (string) 0
. And after that it is checking if $_REQUEST['author']
is empty or not.
And in Logic #2 is checking the same thing above, but with !()
(not) operator. And this method also additionally check the $_REQUEST['author']
is integer
or not.
Checking the $_REQUEST['author']
data type actually makes Logic #2 better than above Logic #1, I think. Cause, though data type doesn’t matter in PHP
(PHP
is a loosely typed language) but it’s better to use them. It defines a concrete base for your application and ensures some core security as well as it’s the best practice.
Hope that answer satisfies your quest.
Related Posts:
- Basic auth WordPress REST API dilemma
- security+best practices: root or www-data on a wordpress content folder?
- Any reason to be concerned by a wave of “zombie” blog signups?
- How to change WordPress user ID?
- Setting WP Admin passwords to expire
- What do spammers gain by signing up as a user?
- How can I secure a WordPress blog using OpenID from a single provider?
- Force user to change their password on the frontend at the first login and password policy
- Should I encrypt the response that triggers an Ajax action? Is nonce sufficient?
- Are there mutiple ways to get usernames (as a hacker)
- Reset Password policy
- How do I protect user_activation_key?
- Failed login attempts
- Separate Out Real Users
- WordPress Password security related questions
- Force users to use password with specifications
- Iterating users while user iteration is suppressed
- Require confirmation of current user’s email before updating database and before send_email_change_email
- Securely log in a user without a password using a link?
- What techniques can a user employ to achieve a password rated “strong” in the WordPress password checker
- WordPress – Security Question at Login from User’s Meta Data
- How to allow an user role to create a new user under a role which lower than his level only?
- How to programatically change username (user_login)?
- How to get userid at wp_logout action hook?
- What’s the difference between the capability remove_users and delete_users?
- How to change user_login with wp-cli?
- Replacing the WordPress password validation
- alphabetically order role drop-down selection in dashboard
- WordPress auto login after registration not working
- How to hide media uploads by other users in the Media menu?
- Retrieve all users from wordpress database via REST/JSON API
- Get users with atleast one post
- edit profile validation refreshes all field if missing wordpress
- How to order users alphabetically by their last name?
- How to use hyperdb to separate and share a user dataset between wordpress installs?
- \WP_User Object | What’s the Difference Between {caps} and {allcaps}?
- pre_user_query meta_query admin user list
- Return ID of authors who have at least one post
- How to list users that have written custom post types and hide the ones that have not?
- Front end user meta options for users
- How to migrate wordpress users from one blog to another
- Drop down list in user profile page
- How can I link users across multiple subdomains?
- Importing Existing Users with Passwords
- Create not-activated user in code, wordpress
- How to add user meta for all users
- Is there any function available to echo current user’s profile url?
- How can I allow users to sign up but prevent them from accessing the WordPress backend?
- How to delete all post and attachments of a user when I delete it?
- Redirect user to login before viewing custom post
- Force user to change their password on first log in of site using shortcode
- How to export bbPress (forums, topics, replies) and all users?
- Display users in order by an “order” custom meta field
- Translate emails into the language of the user
- C# user_nicename and Display name blank
- WP users page doesn’t show users count by role
- Can I check which users ran which updates?
- Extend backend User search to custom user meta
- Move users and passwords from one wordpress site to another
- Bulk lock users without email address?
- How to implement friend system for WordPress?
- Delete user after Contact Form 7 submission [closed]
- Delete Users without a First and Last Name
- Specific way to allow WordPress users to view their current password? And edit it?
- How to do a task only once for logged in users
- How to add registration date and last login date to user list page
- Filter users in a search
- How to set all external links from a certain user to “nofollow”?
- Show WordPress users in grid with image and name
- How can i login with user’s password in WordPress being an admin?
- Redirect users after login
- How to hide some users to unlogged users [closed]
- List all users and current week entries
- How to get current user on a multi site that is using domain mapping?
- Use members from 1 site on another one
- Can I edit the database to change a login?
- User(s) already exists show error please provide a valid username
- User Meta stuff
- Is it possible to make specific posts editable by all authors?
- User can’t search himself on rest api
- How do I update user email from frontend input field?
- Cannot update newly added User field using wp_update_user
- Block editor completely gone for second of two super user
- How to prevent multiple user accounts with the same meta field?
- How do I set a maximum upload size for a specific user role (Editor)
- Create relationships between users or user roles
- User Permissions on custom post type
- update custom field user profile from front end form
- Insert user register into my own user table instead of wp own user
- throttle/limit a logged in user’s http requests to specific page on a per day basis
- I try to add informations to User profile
- Limit roles displayed in users.php depending on custom role
- Add a column before username in the users profile table
- Will mass deleting WP Users then reimporting CSV with the same userid break WP?
- Create a wordpress admin user and only let them edit and post blog posts?
- Shopping plugin with user groups [closed]
- determine active user browser at the same time
- get Discussion setting in wordpress
- Set a minimal number for next user_id
- Remove My Account Menu items in Woocommerce based on user roles