php character match and allow special characters <p>I am trying to make a <strong>website</strong> which will use <code>registration, login actions</code>. </p> <p>I am trying it in my <strong>localhost</strong>. At this stage I've created only database for users and login action. </p> <p>The <strong>problem</strong> is I've set my username "viral4ever" in database. Login action is working properly but I can login using "viral4ever", "VIRAL4EVER" and all. I don't want that in my system. I want to <strong>check every character</strong> in my database to login, if it matches "viral4ever" then it should get me in, not with Viral4ever or vIRAL4ever or VIRAL4EVER and all. </p> <p>I also want to allow users to use <strong>".", "_","-"</strong> in their username. So kindly help me with this.</p> <p>I am using MySQL database and to login and check users I am using this function...</p> <pre><code>function user_exists($username){ $username = sanitize($username); return (mysql_result(mysql_query("SELECT `user_id` FROM `users` WHERE `username` = '$username'"), 0) == 1) ? true : false; } function sanitize($data) { return mysql_real_escape_string($data); } </code></pre>