Login with Arabic characters

I did register and register php script. The registration part is ok with Arabic

and English characters

.

However, logging in with Arabic characters

does not work, but when it English characters

does.

Any hint of further work?

This is my code. Hope this is clear.

function login($username, $password){
$user_id = user_id_from_username($username);
$username = sanitize($username);
$password = md5($password);

return (mysql_result(mysql_query("SELECT COUNT(`user_id`) FROM `users` WHERE `username` = '$username' AND `password` = '$password'"), 0 ) == 1) ? $user_id  :false;}

function user_id_from_username($username){
$username = sanitize($username);
return mysql_result(mysql_query("SELECT `user_id` FROM `users` WHERE `username` = '$username'"), 0, 'user_id');}

<?php

if (empty($_POST) === false) {
    $username = $_POST['username'];
    $password = $_POST['password'];

    if (empty($username) === true || empty($password) === true) {
        $errors[] = ' ◄ يجب آلا تكون الحقول فارغة!';
    } else if (user_exists($username) === false) {
        $errors[] = '◄   إسم المستخدم الذي أدخلته غير مسجل لدينا !!';
    } else if (user_active($username)=== false){
        $errors[] = '';
    } else {

        if(strlen($password) > 32){
            $errors[] = '◄  كلمة المرور غير صالحة ! ';
        }

        $login = login($username, $password);
        if ($login === false) {
            $errors[] = '◄   يوجد خطاء في البيانات التي أدخلتها.. تأكد من اللغة أو حالة الأحرف  !!';
        }else{
            //set the user session للمستخدم الحالي فقط
            $_SESSION['user_id'] = $login;
            // redirect user
            header ('location: challengersland-cboard.php');
            exit();
        }
    }
} else {
    $errors[] = 'عذرا، لم يتم إستلام أية بيانات.';
}


if(empty($errors) === false) {
?>
    <h3>▼ عذراً،حدثت الأخطاء التالية أثناء محاولتك تسجيل الدخول ▼</h3>
<?php

    echo output_errors($errors);
}
?>

      

+3
php character arabic


source to share


No one has answered this question yet

See similar questions:

1140
UTF-8 all the way through
0
Create a login form with Arabic input. How to match records

or similar:

797
What characters do I need to hide in XML documents?
529
What characters are valid for JavaScript variable names?
450
Repeat character N times
3
mysqli_result doesn't work converting mysql to mysqli
3
PHP cookies
0
ActionScript sees no changes in the text box
0
My PHP won't register my $ _SESSIONs
0
PHP Login / Error Logging
0
Android login error with Arabic values
0
PHP error: cannot navigate to line 0 in MySQL



All Articles
Loading...
X
Show
Funny
Dev
Pics