PageRenderTime 33ms CodeModel.GetById 21ms app.highlight 4ms RepoModel.GetById 1ms app.codeStats 1ms

/beta/home/errHandler.asp

http://github.com/khaneh/Orders
ASP | 156 lines | 133 code | 14 blank | 9 comment | 4 complexity | d74ca81127ee91bcec88f44a63345f94 MD5 | raw file
  1<%@LANGUAGE="VBSCRIPT" CODEPAGE="1256"%><BR><BR>
  2<HTML>
  3<HEAD>
  4<meta http-equiv="Content-Type" content="text/html; charset=windows-1256">
  5<meta http-equiv="Content-Language" content="fa">
  6<TITLE>���!</TITLE>
  7</head>
  8<BODY>
  9<CENTER><H3>����� ������ ��� ���� ���</H3>
 10<!--���� ��� ��� ����� ���� ��   ����� ��� ���� ��� ����.<BR><BR>
 11���� <A HREF="javascript:history.go(-1)">������ ��� ���ϡ </A>�� �� ���� ���� ����� ����� ���� ����� �� ���� ������.
 12-->
 13</CENTER>
 14<BR><BR>
 15<%
 16'Response.CharSet = "arabic-1256"
 17
 18	function sqlSafe (inpStr)
 19	  tmpStr=inpStr
 20	  tmpStr=replace(tmpStr,"'","`")
 21	  tmpStr=replace(tmpStr,chr(34),"`")
 22	  sqlsafe=tmpStr
 23	end function
 24	
 25	function pad (inpStr,padSize)
 26		result = inpStr
 27		while len(result) < padSize 
 28			result = "0" & result
 29		wend
 30		pad = result
 31	end function
 32
 33	
 34	dim obje
 35	set obje = server.GetLastError()
 36
 37	aspCode		= obje.ASPCode
 38	Number		= obje.Number
 39	Source		= sqlSafe(obje.Source)
 40	Category	= sqlSafe(obje.Category)
 41	File		= sqlSafe(obje.File)
 42	Line		= obje.Line
 43	Column		= obje.Column
 44	Description = sqlSafe (obje.Description)
 45	Extended	= sqlSafe (obje.ASPDescription)
 46
 47	rquerystring = sqlSafe(request.querystring)
 48	tmpDate		= date()
 49	tmpTime		= time()
 50	rdate		= year(tmpDate) & "/" & pad(Month(tmpDate),2) & "/" & pad(Day(tmpDate),2)
 51	rtime		= hour(tmpTime)  & ":" & minute(tmpTime)  & ":" & second(tmpTime)
 52	httpReferer = sqlSafe(Request.ServerVariables("HTTP_REFERER"))
 53	clientIP	= Request.ServerVariables("REMOTE_ADDR")
 54	rURL		= Request.ServerVariables("URL")
 55
 56	rform	= "Binary Form"
 57	ON ERROR Resume Next
 58		rform	= sqlSafe(request.form)
 59	ON ERROR GOTO 0
 60
 61%>
 62<div dir="ltr">
 63<TABLE align="center" dir="ltr" style="border:2pt solid white; width=50%">
 64<TR>
 65	<TD align="center" colspan=2 bgcolor="eeeeee">������ ��� �����</TD>
 66</TR>
 67<TR>
 68	<TD align="right" bgcolor="bbbbbb" bgcolor="bbbbbb">aspCode:</TD>
 69	<TD align="left"> <%=aspCode%></TD>
 70</TR>
 71<TR>
 72	<TD align="right" bgcolor="bbbbbb">Number:</TD>
 73	<TD align="left"> <%=Number%></TD>
 74</TR>
 75<TR>
 76	<TD align="right" bgcolor="bbbbbb">Source:</TD>
 77	<TD align="left"> <%=Source%></TD>
 78</TR>
 79<TR>
 80	<TD align="right" bgcolor="bbbbbb">Category:</TD>
 81	<TD align="left"> <%=Category%></TD>
 82</TR>
 83<TR>
 84	<TD align="right" bgcolor="bbbbbb">File:</TD>
 85	<TD align="left"> <%=File%></TD>
 86</TR>
 87<TR>
 88	<TD align="right" bgcolor="bbbbbb">Line:</TD>
 89	<TD align="left"> <%=Line%></TD>
 90</TR>
 91<TR>
 92	<TD align="right" bgcolor="bbbbbb">Column:</TD>
 93	<TD align="left"> <%=Column%></TD>
 94</TR>
 95<TR>
 96	<TD align="right" bgcolor="bbbbbb">Description:</TD>
 97	<TD align="left"> <%=Description%></TD>
 98</TR>
 99<TR>
100	<TD align="right" bgcolor="bbbbbb">Extended:</TD>
101	<TD align="left"> <%=Extended%></TD>
102</TR>
103<TR>
104	<TD align="right" bgcolor="bbbbbb">request.form:</TD>
105	<TD align="left"> <%=replace(rform,"&","<br>")%></TD>
106</TR>
107<TR>
108	<TD align="right" bgcolor="bbbbbb">request.querystring:</TD>
109	<TD align="left"> <%=replace(rquerystring,"&","<br>")%></TD>
110</TR>
111<TR>
112	<TD align="right" bgcolor="bbbbbb">Date:</TD>
113	<TD align="left"> <%=rdate%></TD>
114</TR>
115<TR>
116	<TD align="right" bgcolor="bbbbbb">Time:</TD>
117	<TD align="left"> <%=rtime%></TD>
118</TR>
119<TR>
120	<TD align="right" bgcolor="bbbbbb">HTTP Referer:</TD>
121	<TD align="left"> <%=httpReferer%></TD>
122</TR>
123<TR>
124	<TD align="right" bgcolor="bbbbbb">Client IP:</TD>
125	<TD align="left"> <%=clientIP%></TD>
126</TR>
127</TABLE><BR>
128<%
129'errConStr="DRIVER={SQL Server};SERVER=(local);DATABASE=sefareshat;UID=sefadmin; PWD=5tgb;"
130errConStr = "Provider=SQLNCLI10.1;Persist Security Info=False;User ID=sefadmin;Initial Catalog=sefareshat;Data Source=(local);PWD=5tgb;"
131'***** NOTE: If conStr changed, you should change it in /config.asp too
132
133Set errConn = Server.CreateObject("ADODB.Connection")
134errConn.open errConStr
135if session("id")<>"" then errBy = session("id") else errBy = "-100"
136
137errSQL = "INSERT INTO errLog (errDate, errTime, errBy, url, httpReferer, clientIP, aspCode, Number, Source, Category, [File], Line, [Column], Description, Extended, requestForm, requestQuerystring) VALUES ('" & rdate & "','" & rtime & "'," & errBy & ",'" & rURL & "' ,N'" & httpReferer & "','" & clientIP & "','" & aspCode & "','" & Number & "','" & Source & "','" & Category & "','" & File & "','" & Line & "','" & Column & "','" & Description & "','" & Extended & "','" & rform & "','" & rquerystring & "')"
138
139errConn.Execute errSQL 
140'response.write errSQL 
141'response.end
142
143errSQL = "SELECT id FROM errLog where errDate='" & rdate & "' and errTime='" & rtime & "'"
144
145set errRS = errConn.Execute (errSQL)
146	if not errRS.EOF then
147		response.write "<CENTER style='direction:rtl;'>���� ����� ��� �� �� ����� ����� ���ϡ ����� �� ������ ���:  " & 		"<BR><div dir=ltr style='font:17pt'> " & errRS("id") & "</div></CENTER><BR>"
148		
149	end if
150'Show All Server Variables
151'for i = 1 to 49
152'response.write Request.ServerVariables.Key(i) & " = " & Request.ServerVariables(i) & "<br>" 
153'next 
154 %>
155</div>
156</BODY>