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

/beta/admin/errorHandler.asp

http://github.com/khaneh/Orders
ASP | 306 lines | 241 code | 41 blank | 24 comment | 48 complexity | 67331051bb4c2fe5e009fa206e0b8192 MD5 | raw file
  1<%@LANGUAGE="VBSCRIPT" CODEPAGE="1256"%><%
  2' Admin
  3PageTitle=server.HTMLEncode("������ ���")
  4SubmenuItem=10
  5%>
  6<!--#include file="top.asp" -->
  7<!--#include file="../include_farsiDateHandling.asp" -->
  8<style>
  9.myTable
 10TD { 
 11	border-bottom: 1pt solid black;
 12	border-left: 1pt solid gray;
 13	border-right: 1pt solid gray;
 14	}
 15</style>
 16<SCRIPT LANGUAGE="JavaScript">
 17<!--
 18	function selectAll(src){
 19		totalItems=document.getElementsByName("errID").length
 20		checked=src.checked
 21		for (i=0;i<totalItems;i++)
 22			document.getElementsByName("errID")[i].checked=checked;
 23	}
 24	
 25//-->
 26</SCRIPT>
 27<%
 28
 29function pad (inpStr,padSize)
 30	result = inpStr
 31	while len(result) < padSize 
 32		result = "0" & result
 33	wend
 34	pad = result
 35end function
 36
 37function sqlSafe (s)
 38  st=s
 39  st=replace(St,"'","`")
 40  st=replace(St,chr(34),"`")
 41  sqlSafe=st
 42end function
 43
 44session.codepage="1252"
 45'-----------------------------------------------------------------------------------------------------
 46'---------------------------------------------------------------------------------- Submit new AO MEMO
 47'-----------------------------------------------------------------------------------------------------
 48if request("act")="update" then
 49	
 50	CheckerComment = sqlSafe(request.form("CheckerComment"))
 51
 52	for i=1 to request("errID").count
 53		errID=request("errID")(i)
 54		Conn.Execute("UPDATE errLog SET Checked = 1, CheckedBy ="& session("id") & ", CheckerComment =N'" & CheckerComment & "' where id = " & errID)
 55	next
 56'-----------------------------------------------------------------------------------------------------
 57'---------------------------------------------------------------------------------- Submit new AO MEMO
 58'-----------------------------------------------------------------------------------------------------
 59elseif request("act")="showDetails" then
 60	
 61
 62	'======================================================= Khotoote Zir Kaare Khaasi nemikonan 
 63	'set RSV=Conn.Execute ("SELECT id,errdate FROM errLog") 
 64	'Do while not RSV.eof
 65	'	errDate = RSV("errDate")
 66	'	a = right(errDate,len(errDate)-5)
 67	'	newErrDate = left(errDate,4) & "/" & pad(left(a,instr(a,"/")-1),2) & "/"& pad(mid(a,instr(a,"/")+1,len(a)-instr(a,"/")),2) 
 68	'	Conn.Execute ("update errLog set errDate=N'"& newErrDate & "' WHERE id=" & RSV("id")) 
 69	'RSV.moveNext
 70	'Loop
 71	'RSV.close
 72	'response.write "<br>Radife" 
 73	'response.end
 74	'===========================================================================================  
 75
 76end if
 77'-----------------------------------------------------------------------------------------------------
 78'---------------------------------------------------------------------------------- Submit new AO MEMO
 79'-----------------------------------------------------------------------------------------------------
 80DateFrom		= sqlSafe(request.form("DateFrom"))
 81DateTo			= sqlSafe(request.form("DateTo"))
 82status			= sqlSafe(request.form("status"))
 83errBy			= sqlSafe(request.form("errBy"))
 84perPage			= sqlSafe(request.form("perPage"))
 85File			= sqlSafe(request.form("File"))
 86LineNo			= sqlSafe(request.form("LineNo"))
 87
 88if request("s") = "y" then
 89	DateFrom		= sqlSafe(session("DateFrom"))
 90	DateTo			= sqlSafe(session("DateTo"))
 91	status			= sqlSafe(session("status"))
 92	errBy			= sqlSafe(session("errBy"))
 93	perPage			= sqlSafe(session("perPage"))
 94	File			= sqlSafe(session("File"))
 95	LineNo			= sqlSafe(session("LineNo"))
 96
 97end if
 98
 99session("DateFrom")	= DateFrom
100session("DateTo")	= DateTo
101session("status")	= status
102session("errBy")	= errBy
103session("perPage")	= perPage
104session("File")		= File
105session("LineNo")	= LineNo
106
107if not ( perPage <> "" and isNumeric(perPage) ) then
108	perPage = 20
109end if
110
111%>
112<BR><BR>
113
114<FORM METHOD=POST ACTION="errorHandler.asp">
115	&nbsp;&nbsp;
116	�� ����� <INPUT  dir="LTR"  TYPE="text" NAME="DateFrom" maxlength="10" size="10"  value="<%=DateFrom%>"> &nbsp;&nbsp;
117	�� ����� <INPUT  dir="LTR"  TYPE="text" NAME="DateTo" maxlength="10" size="10"  value="<%=DateTo%>"> &nbsp;&nbsp;
118	���� <select name="errBy" class=inputBut >
119		<option value="1000">���</option>
120		<option value="1000">-------------------</option>
121	<% set RSV=Conn.Execute ("SELECT * FROM Users WHERE Display=1 ORDER BY RealName") 
122	Do while not RSV.eof
123	%>
124		<option value="<%=RSV("ID")%>" <%
125			if trim(RSV("ID"))=trim(errBy) then
126				response.write " selected "
127			end if
128			%>><%=server.HTMLEncode(RSV("RealName"))%></option>
129	<%
130	RSV.moveNext
131	Loop
132	RSV.close
133	%>
134	</select> 
135	&nbsp;&nbsp;����� <select name="status" class=inputBut >
136		<option value="1000">���</option>
137		<option value="1" <% if trim(status)="1" then %> selected <% end if %>>����� ���</option>
138		<option value="0" <% if trim(status)="0" then %> selected <% end if %>>����� ����</option>
139	</select> &nbsp;&nbsp;
140	&nbsp;&nbsp;�����<select name="perPage" class=inputBut >
141		<option value="10" <% if trim(perPage)="10" then %> selected <% end if %>>10</option>
142		<option value="20" <% if trim(perPage)="20" then %> selected <% end if %>>20</option>
143		<option value="50" <% if trim(perPage)="50" then %> selected <% end if %>>50</option>
144		<option value="100" <% if trim(perPage)="100" then %> selected <% end if %>>100</option>
145		<option value="200" <% if trim(perPage)="200" then %> selected <% end if %>>200</option>
146		<option value="500" <% if trim(perPage)="500" then %> selected <% end if %>>500</option>
147		<option value="1000" <% if trim(perPage)="1000" then %> selected <% end if %>>1000</option>
148	</select> &nbsp;&nbsp;
149	<br><br>
150	&nbsp;&nbsp;
151	���� <INPUT  dir="LTR"  TYPE="text" NAME="File" size="20"  value="<%=File%>"> &nbsp;&nbsp;
152	����� �� <INPUT  dir="LTR"  TYPE="text" NAME="LineNo" maxlength="5" size="5"  value="<%=LineNo%>"> &nbsp;&nbsp;
153
154	<INPUT TYPE="submit" NAME="submit" value="������">
155</FORM>
156
157<%
158	conditions = "(1=1)"
159
160	if DateFrom <> "" then
161		conditions = conditions & " AND errLog.errDate >= N'"& DateFrom & "' "
162	end if
163
164	if DateTo <> "" then
165		conditions = conditions & " AND errLog.errDate <= N'"& DateTo & "' "
166	end if
167
168	if errBy <> "1000" and errBy <> "" then
169		conditions = conditions & " AND errLog.errBy = " & errBy
170	end if
171
172	if status <> "1000" and status <> "" then
173		conditions = conditions & " AND errLog.Checked = "& status 
174	end if
175
176	if File <> "" then
177		conditions = conditions & " AND errLog.[File] Like '%"& File & "%'"
178	end if
179
180	if LineNo <> "" then
181		conditions = conditions & " AND errLog.Line = "& cint(LineNo) 
182	end if
183
184SA_RecordLimit = perPage
185
186Set SA_RS1 = Server.CreateObject("ADODB.Recordset")
187SA_RS1.CursorLocation=3 '---------- Alix: Because in ADOVBS_INC adUseClient=3
188SA_RS1.PageSize = SA_RecordLimit
189
190SA_mySQL="SELECT errLog.[file] as myFile, errLog.[line] as myLine, errLog.*, Users.RealName, Users_1.RealName AS checkerName FROM errLog INNER JOIN Users ON errLog.errBy = Users.ID LEFT OUTER JOIN Users Users_1 ON errLog.CheckedBy = Users_1.ID where "& conditions & " order by errLog.ID DESC"
191
192'		SA_RS1.Open SA_mySQL ,Conn,adOpenStatic,,adcmdcommand 
193SA_RS1.Open SA_mySQL ,Conn,3,,adcmdcommand 
194FilePages = SA_RS1.PageCount
195Records = SA_RS1.RecordCount
196
197Page=1
198if isnumeric(Request.QueryString("p")) then
199  if (clng(Request.QueryString("p")) <= FilePages) and clng(Request.QueryString("p") > 0) then
200	Page=clng(Request.QueryString("p"))
201  end if
202end if
203
204if not SA_RS1.eof then
205	SA_RS1.AbsolutePage=Page
206end if
207
208%>
209&nbsp;&nbsp;&nbsp;&nbsp;����� �� ����� ����� : <%=Records%><BR><BR>
210<TABLE class="myTable" border=0 align=center width=95% cellspacing=0 cellpadding=2>
211	<TR bgcolor=white>
212		<TD><INPUT TYPE="checkbox" NAME="aaa" onclick="selectAll(this)"></TD>
213		<TD>�����</TD>
214		<TD>����</TD>
215		<TD>����</TD>
216		<TD>��</TD>
217		<TD>�����</TD>
218		<TD>Form</TD>
219		<TD>QueryString</TD>
220	</TR>
221	<FORM METHOD=POST ACTION="?act=update&p=<%=page%>&s=y">
222<%
223if (SA_RS1.eof) then ' Not Found
224	response.write "<br><TR align=center><TD colspan=8>"
225
226	response.write server.HTMLEncode("���� ���� ���" )
227
228	response.write "</TD></TR>"
229	session.codepage="1256"
230	response.end
231
232end if 
233Do while not SA_RS1.eof and (SA_RS1.AbsolutePage = Page)
234	%>
235	<A HREF="errorDetails.asp?id=<%=SA_RS1("id")%>" target="_blank">
236	<TR dir=LTR style="cursor:hand">
237		
238		<TD dir=rtl title="<%=SA_RS1("id")%>&nbsp;<% if SA_RS1("checkerName")<>"" then %> <%=chr(13)%><%=server.HTMLEncode("���� " & SA_RS1("checkerName"))%> [<%=SA_RS1("CheckerComment")%>]<% end if %>" style="border-bottom: 1pt solid black">
239			<INPUT TYPE="checkbox" name="errID" <% if SA_RS1("Checked") then %> checked disabled<% end if %> value="<%=SA_RS1("id")%>">
240		</TD>
241		
242		<TD title="<%=shamsiDate(cdate(SA_RS1("errDate"))) & vbCrLf & SA_RS1("errTime")%>">
243			<%=SA_RS1("errDate")%>
244		</TD>
245		
246		<TD dir=rtl title="clientIP:<%=SA_RS1("clientIP")%>">
247			<%=server.HTMLEncode(SA_RS1("RealName"))%>
248		</TD>
249		
250
251		<TD title="URL:<%=replace(SA_RS1("URL"),"/beta/","")%><%=chr(13)%>-------------------------------------<%=chr(13)%><%=SA_RS1("httpReferer")%>">
252			<INPUT TYPE="text" style="background:transparent;border:none; width:140pt" readonly value="<%=replace(unescape(SA_RS1("myFile")),"/beta/", "")%>">
253		</TD>
254		<TD title="Column:<%=SA_RS1("Column")%>">
255			<%=SA_RS1("myLine")%>
256		</TD>
257
258		<TD title="<%=SA_RS1("Description")%><% if SA_RS1("Source")<>"" then%><%=chr(13)%>-----Source: ---------------------------------<%=chr(13)%><% end if %><%=server.HTMLEncode(SA_RS1("Source"))%>">
259			<INPUT TYPE="text" style="background:transparent;border:none; width:140pt" readonly value="<%=SA_RS1("Description")%>">
260		</TD>
261
262		<TD title="<%=replace(replace(unescape(SA_RS1("requestForm")),"&", chr(13)),"+"," ")%>">
263			<INPUT TYPE="text" style="background:transparent;border:none; width:70pt" readonly value="<%=replace(unescape(SA_RS1("requestForm")),"&", chr(13))%>">
264		</TD>
265
266		<TD title="<%=replace(replace(unescape(SA_RS1("requestQuerystring")),"&", chr(13)),"+"," ")%>">
267			<INPUT TYPE="text" style="background:transparent;border:none; width:70pt" readonly value="<%=replace(unescape(SA_RS1("requestQuerystring")),"&", chr(13))%>"  title="<%=replace(replace(unescape(SA_RS1("requestQuerystring")),"&", chr(13)),"+"," ")%>">
268		</TD>
269	</TR>
270	</A>
271	<%
272	SA_RS1.moveNext
273Loop
274SA_RS1.close
275%>
276	<TR bgcolor=white>
277		<TD colspan=8>
278	<%
279			if FilePages>1 then
280				response.write server.HTMLEncode("���� ") & "&nbsp;"
281				for i=1 to FilePages 
282					if i = page then %>
283						[<%=i%>]&nbsp;
284<%					else%>
285						<A HREF="?p=<%=i%>&s=y&act=HX6600"><%=i%></A>&nbsp;
286<%					end if 
287				next 
288			end if
289%>
290		</TD>
291	</TR>
292</TABLE>
293<TABLE align=center>
294<TR>
295		<TD colspan=7 align=center>
296			<BR><BR>
297			�����: <INPUT TYPE="text" NAME="CheckerComment" size=126>
298			<INPUT TYPE="submit" value="���">
299		</TD>
300	</TR>
301	</FORM>
302</TABLE><BR><BR>
303<%
304session.codepage="1256"
305%>
306<!--#include file="tah.asp" -->