Nested if/else/elseifs are usually too complex for me to figure out.
I’d change your code to use SWITCH/CASE to determine proper input and to change the password if all is OK.
And to sanitize $_POST (and $_GET) inputs, I just put this in my functions file:
$_GET = filter_input_array(INPUT_GET, FILTER_SANITIZE_STRING);
$_POST = filter_input_array(INPUT_POST, FILTER_SANITIZE_STRING);
Then I don’t have to remember to sanitize things elsewhere.
Related Posts:
- Is there any good tutorial to write custom login, registration and password recovery forms? [closed]
- Tips on using a custom template with Ultimate Member
- Gravityforms login form custom redirect if form not submitted
- Contact form 7 select box different value-text than content-text in option [closed]
- Where the Nickname is being used in WordPress
- Remove WordPress Toolbar buttons
- Simple form that saves to database
- How do I email a new page password to somebody every month?
- Let readers suggest edits from the frontend
- Get selected values from checkboxes and radio buttons via Gravity Forms gform_after_submission hook [closed]
- Where should my plugin POST to?
- How to hide fields from my user profiles
- Plugin development: how to create a form and get custom data?
- Add new password rule to Ultimate Member register form
- login to wordpress with Get variables instead of Post
- Multi step form, custom plugin
- Multiple Password Portal Page BEFORE User Account Set Up
- shortcode doesn’t work
- Is it possible to block subscriber users to changing its password?
- Contact Form 7 plugin refreshing page on submit [closed]
- Template plugin for blog posts? [closed]
- Plugin form unable to process
- Trying to add admin file upload form plugin
- Problem protecting a page with a password
- How to disable autocomplete for inputs in contact form 7? [closed]
- Remove toolbar option (and set to default to no) in user profile
- Login with email (WP Modal Login)
- How to display public user profile with 2 additional fields? (GitHub source code included)
- How to create a word press user with hashedpassword
- WordPress Custom Application form
- When is it useful to use wp_verify_nonce
- Datepicker not supporting timepicker
- add function to saving change on Options Pages
- Disable WordPress password reset via mails,instead notify admin about the reset request
- WordPress plugin form not saving data
- Admin page: form with enctype=”multipart/form-data” does not transfer its data
- jQuery Plugin to use WordPress functions in AJAX request
- WordPress login with Phone Number [closed]
- How to make first_name and last_name required fields in user profile?
- Preventing BFA in WordPress without using a plugin
- How to upload user profile image from frontend in wordpress ?
- Add form fields dynamically on button click
- How to trigger $_GET request within admin plugin page?
- Retrieving a Value from a wp-database
- Custom CSS for plugin form
- Form doesn’t submit on second submit call
- WP plugins for building a database?
- Hook into and send mail using WP Mail SMTP type plugin from HTML static front page?
- Custom form action to handle data inside a plugin
- How to delete Passwrd Protected posts cookies when a user logged out from the site
- Is there an earlier hook than login_head or login_enqueue_scripts?
- wp_create_nonce function doesn’t work inside a plugin?
- Form isn’t inserting data into database with ajax plugin
- New User Form – Custom Menu Page
- Image upload and other options in the same plugin settings form?
- Information and Videos for Customers in the Backend [closed]
- When using Simple Fields plugin, how do I pull the information out of the database to display on a page?
- Anonymous Postings
- Creating an online questionnaire form – by Importing the questions from a spreadsheet?
- Can I use custom CSS and js plugin to put JavaScript in to validate my forms
- Using a custom plugin to capture input data via Ajax and PHP
- Redirecting a buddyboss profile tab to a different tab if not subscribed to a specific membership
- Redirect already logged in users away from a page to a specific page base on user role
- auto populate list of questions if user select a category xyz
- WordPress WPforms customization
- Contributive page where people logged in can write
- Contact Form 7 Get Image Function [closed]
- Submit page limited in time to upload image
- Adapt PHP form action for WordPress?
- Is there any way to use google input tool or any other language keyboard with WordPress [closed]
- Ajax fail and get 504 error
- Take input from form and pass it to function using a wp-plugin
- Checkbox conflict in my custom plugin admin page
- Can you use another Profile Builder shortcodes through advanced custom fields
- How to insert HTML/JavaScript form into WordPress page? [closed]
- Trying to fix form resubmition with PRG (Getting error: Cannot modify header information – headers already sent by)
- How do I make a child theme I made POST through a 3rd party plugin?
- WP Plugins – Use includes to display page content
- How to redirect users to their profile after they successfully edit their profile
- How to fetch form data and show it to my page?
- Plugin to create forms using HTML [closed]
- Submit custom form from post content and execute in plugin
- How to allow user to select User ID in Formidable Pro form? [closed]
- Char limit on custom blog-post form? [closed]
- Enqueue stylesheet in plugin for wp-login.php
- AJAX fileupload – TypeError: not a function ajaxSubmit()
- Is there a way to embed a Google Docs form in a page without using plugins?
- Detailed form plugin, with ability to export to excel etc. OR edit PDF live? [closed]
- easy steps to make front end form without plugin
- Form that generates an ID for the customer
- Completely disabling password reset/recovery
- How to have sample page for each new register users in a membership website
- Submit Form data to another page via Ajax (WordPress Way)
- How to extract data from ‘edit my profile’ page in WordPress?
- Editing a text file from plugin menu
- Specific way to allow WordPress users to view their current password? And edit it?
- how to connect the author profile with google webmaster tools in multiuser blog?
- Ajax Plugin Not Echoing Response
- Plugin that will output submitted form data for user? [closed]
- How to handle forms from sidebar widgets – Processing $_POST variables using get_field_name()