%@ LANGUAGE="VBScript" %>
GetImage
<%
Set Connection = Server.CreateObject("ADODB.Connection")
Connection.Mode = adModeRead
Connection.Open phdb_rd_repl
SQLStmt="SELECT to_char(le.log_date,'MM/DD/YYYY HH24:MI:SS') ldate,lp.picture_type,lc.text user_comment,round(dbms_lob.getlength(lp.picture)/1024,2) ksize "
SQLStmt= SQLStmt & " FROM phoffline.log_picture lp,phoffline.log_entries le,phoffline.log_comments lc "
SQLStmt= SQLStmt & " where le.logid = " & Request("logid")
SQLStmt= SQLStmt & " and le.logid = lp.logid "
SQLStmt= SQLStmt & " and le.logid = lc.logid "
' response.write(SQLStmt & "
")
Set RS = Connection.Execute(SQLStmt)
ldate=CStr(RS("ldate"))
ksize=CStr(RS("ksize"))
comment=CStr(RS("user_comment"))
file_type=CStr(RS("picture_type"))
If file_type="Unknown" Then
file_type="gif"
End If
Connection.Close
Set Connection=nothing
seed=-(second(now())+60*minute(now())+3600*hour(now())+3600*24*day(now()))
filename="logbook" & cstr(int(100000.*rnd(seed))) & "." & file_type
filename_full=ph_image_directory & filename
Set Upload = Server.CreateObject("Persits.Upload.1")
On Error Resume Next
If Upload.FileExists(filename_full) Then
response.write("file exists !!")
End If
if Err <> 0 Then
Response.Write "Error managing the file : " & Err.Description
End If
SQLStmt="SELECT picture FROM phoffline.log_picture where logid = " & Request("logid")
On Error Resume Next
Upload.FromDatabase "DSN=phdb_v8;UID=webuser;PWD=phobos;", SQLStmt, filename_full
if Err <> 0 Then
Response.Write "Error saving the file: " & Err.Description
Else
%>
| (<%=ldate%>) <%=comment%> |
 |
<%
End If
Set Upload = nothing
%>