In my databases I store these values:
- Android GCM registration ID
- IOS identifier for vendor
- Device IMEI
- PHP uniqid
It seems like they have these character sets:
GCM id: AZaz09-_
Identifier for vendor: AZ09-
IMEI: 09
PHP uniqid: az09
I need to sanitize these ids just before saving to database.
So I'm not sure how to sanitize them.
PHP's mysqli_real_escape_string
is an option but I prefer solutions like preg_replace('/[^A-Za-z0-9\_]/', '', $deviceid)
. But does current character sets can change in future ? How can I sanitize them so I can cover future changes ?