I have a problem with the steam authenticator for the web. As you know, steam provides a script to allow people to connect on your site through the steam database. My problem is : As soon as someone has a special chars in its name like simple quote, it just adds a blank name in my database...
This is the code from steam :
if($openid->validate()) {
$id = $openid->identity;
$ptn = "/^http:\/\/steamcommunity\.com\/openid\/id\/(7[0-9]{15,25}+)$/";
preg_match($ptn, $id, $matches);
$_SESSION['steamid'] = $matches[1];
$link = mysql_connect("localhost", "", "");
$db_selected = mysql_select_db('', $link);
$query = mysql_query("SELECT * FROM users WHERE steamid='".$_SESSION['steamid']."'");
if (mysql_num_rows($query) == 0) {
mysql_query("INSERT INTO users (steamid) VALUES ('".$_SESSION['steamid']."')") or die("MySQL ERROR: ".mysql_error());
}
if (isset($steamauth['loginpage'])) {
header('Location: '.$steamauth['loginpage']);
}
} else {
echo "User is not logged in.\n";
}
I tried to move it to PDO but impossible to even connect. Anyone has an idea to add the steamname to my database without having the quotes ? or accepting them as no-mysql ?
I know there were a function in mysql, but it doesn't work anymore (mysql_real_escape_string)