# ###################################################### /# # banner.html /# # ###################################################### /# EXPAND FILE="/nodecheck/getLiveNode.html" /EXPAND EXPAND FILE="/apps/dbmirror/mirror.html" /EXPAND RunInTestMode = 'FALSE' TOPDIR = cut(dirname(PAGE), '/banners') expand file=TOPDIR+'include/defineDirs.htx' /expand expand file=INCLUDEDIR+'defineDBs.htx' /expand SITEDB = "c00:"+SITEDB USERDB = "c00:"+USERDB #/ Parse the received tag. The column index numbers have /# #/ the following meanings: /# #/ 1 = S: Show image; C: click-through /# #/ 2 = Web Partner ID code /# siteInfo = listtorow(tag, ",") ADID = siteInfo[2,1] dbresults = dbget(SITEDB, 'DB_SITEID="'+siteInfo[2,1]+'"', 1) if dbresults[2,1] = 1 then DB_RECORD = RECORD else #/ Some kind of a major error has occurred. We should /# #/ tell someone about it, and handle it somehow. /# #/ For now, just write it to a file. /# append tag+LF to file=LOGDIR+'bannerError.log' /append DB_RECORD = "" DB_SITEID = siteInfo[2,1] DB_ADINDEX = 1 DB_RANDOM = "N" DB_VIEWCOUNT = "" DB_HITCOUNT = "" DB_FIRSTVIEW = "" DB_LASTVIEW = "" DB_FIRSTHIT = "" DB_LASTHIT = "" DB_TOTALVIEWS = "" DB_TOTALHITS = "" /if thisUser = trim(getenv("REMOTE_ADDR")) dbSearchString = 'U_IDCODE="'+thisUser+'" AND U_SITEID="'+siteInfo[2,1]+'"' dbresults = dbget(USERDB, dbSearchString, 1) dbSearchString = "" if dbresults[1,1] = 'TRUE' and dbresults[5,1] <> 0 then U_RECORD = RECORD else U_RECORD = '' U_INDEX = 1 U_IDCODE = thisUser /if #/ Show the current image /# if trim(siteInfo[1,1]) = "S" then #/ First, read the rotation file, and separate it /# #/ into individual entries. /# tempImage = sysls(ADIMAGEDIR) tempImage = getcoleq(tempImage, 4, 'FILE') tempImage = getcol(tempImage, 1) tempImage = getcolnoteq(tempImage, 1, '') tempImage = getcolnoteq(tempImage, 1, 'ERROR') adCount = rows(tempImage) #/ Calculate index number /# if DB_RANDOM = 'Y' then tempList = listtocol(DB_HITCOUNT, '|') tempList = fillindexcol(tempList, 2) for name=x value=1 to adCount do tempList[1,x] = tempList[1,x] + RANDOM(1, adCount) tempList[1,x] = cut(tempList[1,x], 'ERROR') /for thisIndexRow = getcoleq(tempList, 1, maxcol(tempList, 1)) thisIndex = thisIndexRow[2,1] else thisIndex = DB_ADINDEX DB_ADINDEX = DB_ADINDEX + 1 if DB_ADINDEX > adCount then DB_ADINDEX = 1 /if /if #/ Get the current image /# thisImage = ADIMAGEDIR+tempImage[1,thisIndex] tempImage = "" #/ Update the view count /# DB_VIEWCOUNT = replaceall(DB_VIEWCOUNT, 'ERROR', '0') tempList = listtocol(DB_VIEWCOUNT, '|') tempList[1,thisIndex] = cutall((tempList[1,thisIndex] + 1), 'ERROR') DB_TOTALVIEWS = sumcol(tempList, 1) DB_VIEWCOUNT = coltolist(tempList, 1, '|') tempList = "" #/ Set the first view date, if necessary /# tempList = listtocol(DB_FIRSTVIEW, '|') if isblank(tempList[1,thisIndex]) or iserror(tempList[1,thisIndex]) then tempList[1,thisIndex] = TODAY DB_FIRSTVIEW = coltolist(tempList, 1, '|') /if tempList = "" #/ Always set the current view date. /# tempList = listtocol(DB_LASTVIEW, '|') tempList[1,thisIndex] = TODAY DB_LASTVIEW = coltolist(tempList, 1, '|') tempList = "" #/ Now save the changes to the site database /# if isblank(DB_RECORD) then dbresults = dbaddmirror(SITEDB) else dbresults = dbeditmirror(SITEDB, DB_RECORD) /if U_IDCODE = thisUser U_SITEID = DB_SITEID U_INDEX = thisIndex U_VIEWCOUNT = cutall((U_VIEWCOUNT + 1), 'ERROR') if not(isdate(U_FIRSTVIEW)) then U_FIRSTVIEW = TODAY /if U_LASTVIEW = TODAY if isblank(U_RECORD) then dbresults = dbaddmirror(USERDB) else dbresults = dbeditmirror(USERDB, U_RECORD) /if thisIndex = "" #/ Clear everything /# adCount = "" dbresults = "" DB_RECORD = "" DB_LOGIN = "" DB_PASSWORD = "" DB_SITENAME = "" DB_SITEURL = "" DB_SITEID = "" DB_ADINDEX = "" DB_RANDOM = "" DB_VIEWCOUNT = "" DB_HITCOUNT = "" DB_FIRSTVIEW = "" DB_LASTVIEW = "" DB_FIRSTHIT = "" DB_LASTHIT = "" DB_TOTALVIEWS = "" DB_TOTALHITS = "" U_RECORD = "" U_IDCODE = "" U_SITEID = "" U_INDEX = "" U_VIEWCOUNT = "" U_HITCOUNT = "" U_FIRSTVIEW = "" U_LASTVIEW = "" U_FIRSTHIT = "" U_LASTHIT = "" stat = filepush(thisImage, "image/"+right(thisImage, 3)) else #/ This was a click-through. Update the site hitcount. /# DB_HITCOUNT = replaceall(DB_HITCOUNT, 'ERROR', '0') tempHits = listtocol(DB_HITCOUNT, '|') tempHits[1,U_INDEX] = cutall((tempHits[1,U_INDEX] + 1), 'ERROR') DB_TOTALHITS = sumcol(tempHits, 1) DB_HITCOUNT = coltolist(tempHits, 1, '|') #/ Set the first hit date, if necessary /# tempList = listtocol(DB_FIRSTHIT, '|') if isblank(tempList[1,U_INDEX]) or iserror(tempList[1,U_INDEX]) then tempList[1,U_INDEX] = TODAY DB_FIRSTHIT = coltolist(tempList, 1, '|') /if tempList = "" #/ Always set the current hit date. /# tempList = listtocol(DB_LASTHIT, '|') tempList[1,U_INDEX] = TODAY DB_LASTHIT = coltolist(tempList, 1, '|') tempList = "" #/ Save the changes to the site DB /# if isblank(DB_RECORD) then dbresults = dbaddmirror(SITEDB) else dbresults = dbeditmirror(SITEDB, DB_RECORD) /if U_HITCOUNT = cutall((U_HITCOUNT + 1), 'ERROR') if not(isdate(U_FIRSTHIT)) then U_FIRSTHIT = TODAY /if U_LASTHIT = TODAY if isblank(U_RECORD) then dbresults = dbaddmirror(USERDB) else dbresults = dbeditmirror(USERDB, U_RECORD) /if if not(istrue(RunInTestMode)) then #/ Clear everything /# dbresults = "" DB_RECORD = "" DB_LOGIN = "" DB_PASSWORD = "" DB_SITENAME = "" DB_SITEURL = "" DB_SITEID = "" DB_ADINDEX = "" DB_RANDOM = "" DB_VIEWCOUNT = "" DB_HITCOUNT = "" DB_FIRSTVIEW = "" DB_LASTVIEW = "" DB_FIRSTHIT = "" DB_LASTHIT = "" DB_TOTALVIEWS = "" DB_TOTALHITS = "" U_RECORD = "" U_SITEID = "" U_INDEX = "" U_VIEWCOUNT = "" U_HITCOUNT = "" U_FIRSTVIEW = "" U_LASTVIEW = "" U_FIRSTHIT = "" U_LASTHIT = "" #/ See if this is an old link; if so, log the ADID code. /# if locate(getenv('SCRIPT_NAME'), 'cgiwrap') <> 0 then append adid+LF to file=LOGDIR+'wp/oldLinks.log' /append /if goto "http://www.blossoms.com/cgi-bin/start.cgi/start.html" goto 'http://'+DOMAINNAME+'/cgi-bin/start.cgi/start.html?adid='+adid+'|'+U_IDCODE /if /if >>
siteInfo = <