Reputation: 1315
Since the script gets $_SERVER['HTTP_ACCEPT_LANGUAGE']
from the visitor it could be anything. So how can I validate it? What is acceptable?
To get the first language inside the string I use:
substr($_SERVER["HTTP_ACCEPT_LANGUAGE"],0,2)
Upvotes: 3
Views: 425
Reputation: 880
For example
$user_lang= split(",",$_SERVER["HTTP_ACCEPT_LANGUAGE"]);
$language = $user_lang[0];
// header injection.
if(stripos($language, 'Content-Type') !== FALSE ) { exit; }
Upvotes: 1