<% 'Global Settings dim strAccessDB, strCon, adoCon, adoRec, varCount strAccessDB = "/fpdb/db" '--------------------------------------------------------- ' Function to Show the Counter '--------------------------------------------------------- Function ShowCounter() 'Create a connection odject Set adoCon = Server.CreateObject("ADODB.Connection") Set adoRec = Server.CreateObject("ADODB.Recordset") strCon = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath(strAccessDB) 'Open the recordset and do the operation adoCon.Open strCon adoRec.LockType = 3 adoRec.Open "SELECT Count FROM HitCounter where ID=1", adoCon adoRec("Count") = adoRec("Count") + 1 adoRec.Update ShowCounter = adoRec("Count") 'Reset Sever Objects Set adoCon = Nothing Set adoRec = Nothing End Function '--------------------------------------------------------- ' Function to Show Books '--------------------------------------------------------- Sub ShowBooks() 'Create a connection odject Set adoCon = Server.CreateObject("ADODB.Connection") Set adoRec = Server.CreateObject("ADODB.Recordset") strCon = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath(strAccessDB) 'Open the recordset and do the operation adoCon.Open strCon adoRec.LockType = 3 adoRec.Open "SELECT * FROM Books", adoCon color = "#ffffff" While not adoRec.EOF if adoRec("Image") = "" then ImagePath=" " else ImagePath="" end if Response.Write "" Response.Write "" & ImagePath & "" Response.Write "اسم الكتاب: " & adoRec("Name") & "
موضوعه: " & adoRec("Topic") & "" Response.Write "" & adoRec("Author") & "" Response.Write "

الحجم: " & adoRec("Size") & " ك.ب
مرات التنزيل: " & adoRec("Download") & "" Response.Write "" if color="#ffffff" then color="#F9F7F2" else color="#ffffff" end if adoRec.MoveNext Wend 'Reset Sever Objects Set adoCon = Nothing Set adoRec = Nothing End Sub '--------------------------------------------------------- ' Function to Show Books for Administrator '--------------------------------------------------------- Sub ShowAdminBooks() 'Create a connection odject Set adoCon = Server.CreateObject("ADODB.Connection") Set adoRec = Server.CreateObject("ADODB.Recordset") strCon = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath(strAccessDB) 'Open the recordset and do the operation adoCon.Open strCon adoRec.LockType = 3 adoRec.Open "SELECT * FROM Books", adoCon color = "#ffffff" While not adoRec.EOF if adoRec("Image") = "" then ImagePath=" " else ImagePath="" end if Response.Write "" Response.Write "" & ImagePath & "" Response.Write "اسم الكتاب: " & adoRec("Name") & "
موضوعه: " & adoRec("Topic") & "" Response.Write "" & adoRec("Author") & "" Response.Write "

الحجم: " & adoRec("Size") & " ك.ب
مرات التنزيل: " & adoRec("Download") & "" Response.Write "" Response.Write "" Response.Write "تعديل الكتاب   |   حذف الكتاب" Response.Write "" if color="#ffffff" then color="#F9F7F2" else color="#ffffff" end if adoRec.MoveNext Wend 'Reset Sever Objects Set adoCon = Nothing Set adoRec = Nothing End Sub '--------------------------------------------------------- ' Function to Update/Add Book details '--------------------------------------------------------- Function UpdateRecord(Action,varID,varName,varTopic,varImage,varAuthor,varPath,varSize,varDownload) 'Create a connection odject Set adoCon = Server.CreateObject("ADODB.Connection") Set adoRec = Server.CreateObject("ADODB.Recordset") strCon = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath(strAccessDB) 'Open the recordset and do the operation adoCon.Open strCon adoRec.LockType = 3 Response.Write Action if Action="Save" then 'Update the book adoRec.Open "select * from Books where ID=" & varID, adoCon adoRec("Name") = varName adoRec("Topic") = varTopic adoRec("Image") = varImage adoRec("Author") = varAuthor adoRec("Path") = varPath adoRec("Size") = varSize adoRec("Download") = varDownload adoRec.update else 'Add new Book 'Response.Write "insert into Books(Name,Topic,Image,Author, Path, Size, Download) values('" & varName &"','" & varTopic &"','" & varImage & "','" & varAuthor & "','" & varPath & "'," & varSize & "," & varDownload &")" 'Response.End adoRec.Open "insert into Books(Name,Topic,Image,Author, Path, Size, Download) values('" & varName &"','" & varTopic &"','" & varImage & "','" & varAuthor & "','" & varPath & "'," & varSize & "," & varDownload &")", adoCon 'adoRec("Name") = varName 'adoRec("Topic") = varTopic 'adoRec("Image") = varImage 'adoRec("Author") = varAuthor 'adoRec("Path") = varPath 'adoRec("Size") = varSize 'adoRec("Download") = varDownload end if end function %>