I am using $wpdb and the following is part of the codes that calls $wpdb->update.
This code works well if it's normal [email protected], but when if users were to use the + sign in their username, e.g. [email protected], wpdb doesn't read the + sign
Below variables are from $_GET but i'm putting in values for readability.
$open_email = '[email protected]';
$open_key = '2f1e4b16a9a882bbef9b00906fc5c8f563fd70a5';
$open_time = time();
if (strlen($open_key) == 40) {
$status_update = $wpdb->update('status',
array(
'invite_status' => 'opened',
'open_time' => $open_time
),
array(
'invite_email' => $open_email,
'invite_token' => $open_key
),
array(
'%s',
'%d'
),
array(
'%s',
'%s'
)
);
}
var dump of $wpdb->last_query and $wpdb->last_error returns the followings.
string(235) "UPDATE status SET invite_status = 'opened', open_time = 1461103507 WHERE invite_email = 'something [email protected]' AND rating_invite_token = '2f1e4b16a9a882bbef9b00906fc5c8f563fd70a5'"
I notice above part in error, highlighted in bold, that my plus (+) sign is gone and it left a space, causing the above statement not to update.
May I know am I missing out anything?
Update: I am asking because some users of gmails does use the + sign to categorise their emails, as [email protected] still goes back to [email protected]
If there's any sanitisation which I am supposed to do, but i miss out, please guide me as well. I presume all $_GET data should have been sanitised.