% Const IMGS_DIR = "/daily_photos/" Dim objFSO, objFolderObject, objFileCollection, objFile Dim intFileNumberToUse, intFileLooper Dim objImageFileToUse Dim strImageSrcText Set objFSO = Server.CreateObject("Scripting.FileSystemObject") Set objFolderObject = objFSO.GetFolder(Server.MapPath(IMGS_DIR)) Set objFSO = Nothing Set objFileCollection = objFolderObject.Files Set objFolderObject = Nothing Randomize() intFileNumberToUse = Int(objFileCollection.Count * Rnd) + 1 intFileLooper = 1 For Each objFile in objFileCollection If intFileLooper = intFileNumberToUse Then Set objImageFileToUse = objFile Exit For End If intFileLooper = intFileLooper + 1 Next Set objFileCollection = Nothing strImageSrcText = IMGS_DIR & objImageFileToUse.Name Set objImageFileToUse = Nothing %> <% Const DAILY_DIR = "/daily_photos/" Dim objDSO, objDailyFolderObject, objDailyCollection, objDaily Dim intDailyNumberToUse, intDailyLooper Dim objDailyImageToUse Dim strDailySrcText Set objDSO = Server.CreateObject("Scripting.FileSystemObject") Set objDailyFolderObject = objDSO.GetFolder(Server.MapPath(DAILY_DIR)) Set objDSO = Nothing Set objDailyCollection = objDailyFolderObject.Files Set objDailyFolderObject = Nothing Dim myDate myDate = cDate("September 27, 1969") intDailyNumberToUse = DateDiff("d", myDate, Date) MOD objDailyCollection.Count intDailyLooper = 1 For Each objDaily in objDailyCollection If intDailyLooper = intDailyNumberToUse Then Set objDailyImageToUse = objDaily Exit For End If intDailyLooper = intDailyLooper + 1 Next Set objDailyCollection = Nothing strDailySrcText = DAILY_DIR & objDailyImageToUse.Name Set objDailyImageToUse = Nothing %>
|
||||||||||||||||||
|
| |
||||||||||||||
|
||||||||||||||
|
|
|||||||||||||
| |
||||||||||||||
|
||||||||||||||