Hi all
i have a login system with ASP
and Sql 2000 DB
my user names is in Arabic and Farsi and passwords in Latin
but
on the login page I have a code that it
is for checking user names that it is in DB or not
when i use Latin user names its ok and work fine
but when i register with Arabic or Farsi usernames
and when i want to login from the login page it tell me the Username
is incorrect i checked and i found that the usernames in the DB
are Arabic even i read those from DB and when i show those on the pages they are Arabic and correct
so i know tha usernames in the DB is correct so just my problem
is reading those from DB
I don`t know when the system want compare the username on the DB with other one
that user entered in the login pages form , it tell it that the username is incorrect
and now i want to know is there any way that
read a username or anything from DB with a specific Charset
for example for my pages UTF-8
Note: I am using UTF-8 for all of my pages
and even i tested Response.Charset = "65001"
on the login page that contain the ASP codes
but ... nothing
Some body told me that i must use
this code:
Code:
sql="insert into smpl(name,family) values(N'"+n+"', N'"+f+"')";
but i don`t know what is that and how can i use that
this is my codes
First Page
The form Page For Register User
Code:
<% @ Language=VBScript %>
<%
session.CodePage=65001
%>
<%
Dim strSQLServerName
Dim strSQLDBUserName
Dim strSQLDBPassword
Dim strSQLDBName
Dim adoCon
Dim strCon
Dim rsCheckUser
Dim strAccessDB
Dim strSQL
Dim strUserName
Dim strPassword
'================================================================================================
strSQLServerName = "server"
strSQLDBUserName = "username"
strSQLDBPassword = "pass"
strSQLDBName = "DB name"
strCon = "Provider=SQLOLEDB;Server=" & strSQLServerName & ";User ID=" & strSQLDBUserName & ";Password=" & strSQLDBPassword & ";Database=" & strSQLDBName & ";"
'Create an ADO connection object
Set adoCon = Server.CreateObject("ADODB.Connection")
'Create an ADO recordset object
Set rsAddComments = Server.CreateObject("ADODB.Recordset")
'Set an active connection to the Connection object
adoCon.Open strCon
'Initialise the strSQL variable with an SQL statement to query the database with
strSQL = "SELECT tblUsers.UserID, tblUsers.password FROM tblUsers;"
'Set the cursor type we are using so we can navigate through the recordset
rsAddComments.CursorType = 2
'Set the lock type so that the record is locked by ADO when it is updated
rsAddComments.LockType = 3
'Open the recordset with the SQL query
rsAddComments.Open strSQL, adoCon
'Tell the recordset we are adding a new record to it
rsAddComments.AddNew
'Add
rsAddComments.Fields("UserID") = Request.Form("name")
rsAddComments.Fields("password") = Request.Form("password")
'Write the updated recordset to the database
rsAddComments.Update
'Reset server variables
rsAddComments.Close
Set rsAddComments = Nothing
Set adoCon = Nothing
%>
<head>
<meta http-equiv="Content-Language" content="en-us">
</head>
<form method="POST" action="reg.asp">
<p align="center">User Name : <input type="text" name="name" size="20"></p>
<p align="center">Password : <input type="text" name="password" size="20"></p>
<p align="center"><input type="submit" value="Submit" name="B1">
<input type="reset" value="Reset" name="B2"></p>
</form>
and this is My Check User Page > this page is for comparing usernames and passwords on the form with DB
Code:
<% @ Language=VBScript %>
<%
'Dimension variables
Dim adoCon
Dim strCon
Dim rsCheckUser
Dim strAccessDB
Dim strSQL
Dim strUserName
Dim strSQLServerName
Dim strSQLDBUserName
Dim strSQLDBPassword
Dim strSQLDBName
'================================================================================================
strSQLServerName = "server"
strSQLDBUserName = "username"
strSQLDBPassword = "pass"
strSQLDBName = "login"
strCon = "Provider=SQLOLEDB;Server=" & strSQLServerName & ";User ID=" & strSQLDBUserName & ";Password=" & strSQLDBPassword & ";Database=" & strSQLDBName & ";"
strUserName = Request.Form("txtUserName")
'Create a connection odject
Set adoCon = Server.CreateObject("ADODB.Connection")
'Set an active connection to the Connection object
adoCon.Open strCon
'Create a recordset object
Set rsCheckUser = Server.CreateObject("ADODB.Recordset")
'Initalise the strSQL variable with an SQL statement to query the database
strSQL = "SELECT tblUsers.Password FROM tblUsers WHERE tblUsers.UserID ='" & strUserName & "'"
'Query the database
rsCheckUser.Open strSQL, strCon
'If the recordset finds a record for the username entered then read in the password for the user
If NOT rsCheckUser.EOF Then
'Read in the password for the user from the database
If (Request.Form("txtUserPass")) = rsCheckUser("Password") Then
'If the password is correct then set the session variable to True
Session("blnIsUserGood") = True
'Close Objects before redirecting
Set adoCon = Nothing
Set strCon = Nothing
Set rsCheckUser = Nothing
'Redirect to the authorised user page and send the users name
Response.Redirect"AP.asp"
End If
End If
'Close Objects
Set adoCon = Nothing
Set strCon = Nothing
Set rsCheckUser = Nothing
'If the script is still running then the user must not be authorised
Session("blnIsUserGood") = False
'Redirect to the unautorised user page
Response.Redirect"unauthorised_user_page.htm"
%>
and the login page is a simple HTML page
with a form with 2 field Username and Password
and its method is POST to the Check_User.asp Page
So if any body know what i must to do
and if you can tell me how can i use that code with my codes
please insert that code to my pages and Reply
Thanks for your reply
Regards,
Farshad