PageRenderTime 4ms CodeModel.GetById 1ms app.highlight 1ms RepoModel.GetById 1ms app.codeStats 0ms

/beta/admin/login.asp

http://github.com/khaneh/Orders
ASP | 139 lines | 127 code | 10 blank | 2 comment | 18 complexity | cd0ac490477f46a4fd76bd455fcea365 MD5 | raw file
  1<%@LANGUAGE="VBSCRIPT" CODEPAGE="1256"%>
  2<% 'Response.Addheader "WWW-Authenticate", "BASIC" %>
  3<%
  4function sqlSafe (s)
  5  st=s
  6  st=replace(St,"'","`")
  7  st=replace(St,chr(34),"`")
  8  sqlSafe=st
  9end function
 10%>
 11<HTML>
 12<HEAD>
 13<meta http-equiv="Content-Type" content="text/html; charset=windows-1256">
 14<meta http-equiv="Content-Language" content="fa">
 15<style>
 16	Table { font-size: 10pt;}
 17</style>
 18<TITLE>Login </TITLE>
 19<SCRIPT LANGUAGE="JavaScript">
 20<!--
 21var tempKeyBuffer;
 22function myKeyDownHandler(){
 23	tempKeyBuffer=window.event.keyCode;
 24}
 25function myKeyPressHandler(){
 26//	alert (tempKeyBuffer)
 27	if (tempKeyBuffer>=65 && tempKeyBuffer<=90){
 28		window.event.keyCode=tempKeyBuffer+32;
 29	}
 30	else if(tempKeyBuffer==186){
 31		window.event.keyCode=59;
 32	}
 33	else if(tempKeyBuffer==188){
 34		window.event.keyCode=44;
 35	}
 36	else if(tempKeyBuffer==190){
 37		window.event.keyCode=46;
 38	}
 39	else if(tempKeyBuffer==191){
 40		window.event.keyCode=47;
 41	}
 42	else if(tempKeyBuffer==192){
 43		window.event.keyCode=96;
 44	}
 45	else if(tempKeyBuffer>=219 && tempKeyBuffer<=221){
 46		window.event.keyCode=tempKeyBuffer-128;
 47	}
 48	else if(tempKeyBuffer==222){
 49		window.event.keyCode=39;
 50	}
 51}
 52//-->
 53</SCRIPT>
 54</HEAD>
 55
 56<BODY onLoad="document.all.UserName.focus();">
 57<TABLE cellspacing=0 cellpadding=0 width=300 height=150 style='border:4px solid <%=SelectedMenuColor%>;' dir=rtl align=center>
 58<TR>
 59	<TD>
 60		<font face="tahoma">
 61		<%
 62		if request("act")="����" then
 63'			conStr="DRIVER={SQL Server};SERVER=(local);DATABASE=sefareshat;UID=sefadmin; PWD=5tgb;"
 64conStr = "Provider=SQLNCLI10.1;Persist Security Info=False;User ID=sefadmin;Initial Catalog=jame;Data Source=.\sqlexpress;PWD=5tgb;"
 65			'	conStr = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & Server.MapPath("kid.mdb")
 66			
 67			Set conn = Server.CreateObject("ADODB.Connection")
 68			conn.open conStr
 69
 70			u = sqlSafe(request("UserName"))
 71			p = sqlSafe(request("Password"))
 72			Set RS1 = conn.Execute("SELECT * FROM [Users] WHERE [UserName]='" & u & "' AND  [Password]='" & p & "' ")
 73			If (RS1.EOF) or (u<>"samimi" and u<>"mohammad" and u<>"kid" and u<>"vazehi" and u<>"zamani") Then
 74				session.abandon
 75			%>
 76					<div align=center style='background-color: #FF8888;width:300' >�������� �� ���� ���� ������ ���&nbsp;</div><br><br>
 77			<%else
 78				session("AID")=RS1("ID")
 79				session("ID")=RS1("ID")
 80				session("CSRName") = RS1("RealName")
 81
 82				Set RS2 = conn.Execute("SELECT GLs.Name, GLs.ID, GLs.FiscalYear, UserDefaults.[User] FROM GLs INNER JOIN UserDefaults ON GLs.ID = UserDefaults.WorkingGL WHERE (UserDefaults.[User] = '"& RS1("ID") & "') OR (UserDefaults.[User] = 0) ORDER BY ABS(UserDefaults.[User]) DESC")
 83				session("OpenGL")=RS2("id")
 84				session("FiscalYear")=RS2("FiscalYear")
 85				session("OpenGLName")=RS2("name")
 86				RS2.close
 87
 88				RS1.close
 89				conn.Close
 90				
 91				response.redirect "default.asp"
 92			End If
 93
 94			conn.Close
 95		elseif request.querystring("err")<>"" then 
 96		%>
 97					<div align=center style='background-color: #FF8888;width:300'><%=request.querystring("err")%>&nbsp;</div><br><br>
 98		<%
 99		end if
100		%>
101	</TD>
102</TR>
103<TR>
104	<TD>
105
106		<FORM METHOD=POST ACTION="login.asp">
107		<div dir='rtl' align = "center" >
108		<!--IMG SRC="images/khaneh.jpg" WIDTH="350" HEIGHT="20" BORDER=0 ALT=""-->
109
110		<TABLE>
111		<TR>
112			<TD colspan="2" align="center"></TD>
113		</TR>
114		<TR>
115			<TD> ��� ����� </TD>
116			<TD><INPUT TYPE="text" NAME="UserName" onkeyDown="return myKeyDownHandler();" onKeyPress="return myKeyPressHandler();"></TD>
117		</TR>
118		<TR>
119			<TD> ��� ���� </TD>
120			<TD><INPUT TYPE="password" NAME="Password" onkeyDown="return myKeyDownHandler();" onKeyPress="return myKeyPressHandler();"></TD>
121		</TR>
122		<TR>
123			<TD></TD>
124			<TD><INPUT style="font-family:tahoma; width:100%;" TYPE="submit" name="act" value="����"></TD>
125		</TR>
126		</TABLE>
127		 <br>
128		&nbsp; 
129		<br>
130		</div>
131		</FORM>
132		<br>
133		</font>
134	</TD>
135</TR>
136</TABLE>
137
138</BODY>
139</HTML>