السلام عليكم
ارجو اولا ان توضحوا لي ما هو فائدة الخاصية cookies
ومتى نستخدمها وفي اي حالة؟
بالنسبة لهذا الكود يتعلق بادخال اسم مستخدم وكلمة مرور
..هنا استخدمنا ال cookies و Name_Cooky
ارجو توضيح الكود
ولكم خالص الشكر
<%@ Language=VBScript CodePage = "1256"%>
<% Name=Request.form("Name")
Password=Request.form("Password")
If Name = "" Then
response.redirect ("admin.asp?error=Name_Null")
Else
If Password = "" Then
response.redirect ("admin.asp?error=Pass_Null")
Else
%><!--#include file="connection.txt" --><%
SelectSql="Select * from admin where name='"&Name&"'"
set rs=ADO.execute (SelectSql)
If rs.eof then '
response.Redirect ("admin.asp?error=Name_Entry")
Else
If rs("password") <> password Then
response.redirect ("admin.asp?error=Pass_Entry")
Else
Name_Cooky= request.cookies("Name")
If Name_Cooky <> Name then
response.cookies ("Name")=Name
End IF
response.Redirect ("adminsection.asp")
End If
End If
End Ifوهذه صفحة admin.asp
<%@ Language=VBScript CodePage = "1256"%>
<html dir="rtl">
<head>
<meta http-equiv="Content-Language" content="en-us">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1256">
<title>الإسم</title>
</head>
<body dir="rtl">
<form method="POST" action="validentry.asp" name="Login">
<p dir="rtl">
</p>
<p >
أدخل اسم المستخدم والرقم السري للدخول لصفحة الإدارة</p>
<p >
اسم المستخدم :
<input type="text" name="Name" size="20"></p>
<p>الرقم السري: <input type="password" name="Password" size="20"></p>
<p>
<input type="submit" value="إرسال" name="submit"></p>
</form>
<%
error=Request("error")
If error <> "" then
If error = "Name_Null" Then
Response.write "<font color=#FF0000>لم تدخل اسم المستخدم</font>"
Else
If error = "Pass_Null" Then
Response.write "<font color=#FF0000>لم تدخل الرقم السري</font>"
Else
If error = "Name_Entry" Then
Response.write "<font color=#FF0000>لقد ادخلت اسم مستخدم خطأ</font>"
Else
If error = "Pass_Entry" Then
Response.write "<font color=#FF0000>لقد أدخلت رقم سري خطأ</font>"
End If
End If
End If
End If
End If
%>
</body>
</html>