Jump to content

LogIn with hebrew username, Problam!


Aviway
 Share

Recommended Posts

Hi,I have a little problem with my entry system to my CMS/I have a CMS with a few managers. I want to identify them each time that one of them or all of them enter to the CMS.For that I build an entry form with username and password, each manager should type his UN&Pass, for the CMS to identify him.

<form method="post" action="check_login.php" name="entry_frm">	<label>שם:</label><input type="text" name="entry_name" /><br /><br />	<label>סיסמא:</label><input type="password" name="entry_pass" /><br /><br />	<input type="submit" /></form>

I ran into a Hebrew problem. The Username that i chose for the managers is they're first name in hebrew.But when I submit the form, this masage is appears:

That user doesnt exist!
.This is the php login code: (check_login.php)
<?	$username = $_POST['entry_name'];	$password = $_POST['entry_pass']; 	if ($username&&$password)	{				$query = mysql_query("SELECT * FROM users WHERE user_name='$username'");		$numrows = mysql_num_rows($query);		if($numrows!=0)		{		while ($row = mysql_fetch_assoc($query))			{				$dbusername = $row['user_name'];				$dbpassword = $row['user_password'];			}		// check to see if they match		if ($username==$dbusername&&$password==$dbpassword)			{				header('Location:index.php');				$_SESSION['user_name']=$dbusername;			}			else				echo "Incorect password";				}else			die("That user doesnt exist!");	}	else		die("Please fill the fields");?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-type" content="text/html;charset=UTF-8" /></head><body></body></html>

I directed the DB collation to "utf8_unicode_ci"Thanks in advance

Edited by Aviway
Link to comment
Share on other sites

Hi!Try This Code:xxxxxxxxxxxxxxxxxxxxxxxxxindex.htm<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>Untitled Document</title></head><body><form method="post" action="check_login.php" name="entry_frm"><label>שם:</label><input type="text" name="entry_name" /><br /><br /><label>סיסמא:</label><input type="password" name="entry_pass" /><br /><br /><input type="submit" /></form></body></html>xxxxxxxxxxxxxxxxxxxxxxxxxxcheck_login.php<?php $username = $_POST['entry_name']; $password = $_POST['entry_pass']; if ($username && isset($password)) { $query = mysql_query("SELECT * FROM users WHERE user_name='$username'"); $numrows = mysql_num_rows($query); if($numrows!=0) { $row = mysql_fetch_assoc($query); $dbusername = $row['user_name']; $dbpassword = $row['user_password']; // check to see if they match if ($username == $dbusername && $password == $dbpassword) { session_start(); $_SESSION['user_name'] = $dbusername; header('Location: Welcome.php'); } else { print "Incorect password"; } } else { die("That user doesnt exist!"); } } else { die("Please fill the fields"); }?>xxxxxxxxxxxxxxxxxxxxxxxxWelcome.php<?phpsession_start();print "Login Seccessful" . "<br />" . "Session Name: " . $_SESSION['user_name'];?>

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...