%
response.expires = -1
TOPIC = ""
subTOPIC = ""
dontDisplayLogin = TRUE
DontCheckLogin = TRUE
DisplayLogin = FALSE
%>
<%=HTML_Title%>
<%
dim UserName
dim Password
dim sql
dim aff_id
dim NoLog
'dsn = "SQLConn"
set c = Server.createobject("adodb.connection")
set rs= Server.createobject("adodb.recordset")
if Trim(Request("action"))="login" then
UserName = Trim(replace(request("username"),"'","''"))
Password = Trim(replace(request("password"),"'","''"))
NoLog = trim(request.form("nolog"))
Val_Username = UserName
if len(username)>3 and len(password)>3 then
set c=server.createobject("adodb.connection")
set rs=server.createobject("adodb.recordset")
set temprs=server.createobject("adodb.recordset")
c.open DSN
sql = "SELECT * from TBL_Affiliates where Affiliate_User='"&username&"' and Affiliate_Pass='"&password&"'"
rs.open sql,c,3,1
if not rs.eof then
Response.Cookies("AFF")("Username") = Trim(request("username"))
Response.Cookies("AFF").expires = date + 300
aff_id = rs("Affiliate_ID")
session("Aff_ID") = rs("Affiliate_ID")
if not isnull(rs("Affiliate_specialSale")) then
if rs("Affiliate_specialSale") then
if (month(now()) = 7 or month(now()) = 8) and (year(now())=2006) then
'session("specialSale") = TRUE
end if
end if
end if
Logged = TRUE
if not isNull(rs("Affiliate_LastLogin")) then
Response.Cookies("AFF")("LastLogin") = rs("Affiliate_lastLogin")
end if
Response.Cookies("AFF")("IP") = Request.ServerVariables("REMOTE_ADDR")
Response.Cookies("AFF")("First") = rs("Affiliate_FirstName")
Response.Cookies("AFF")("Last") = rs("Affiliate_LastName")
on error resume next
if (NoLog <> "true") then
' set login time
sql = "UPDATE TBL_Affiliates SET Affiliate_lastLogin=getdate() " _
& " WHERE (Affiliate_ID = " & aff_id & ")"
c.execute sql
sql = "INSERT INTO TBL_AffLogs(Affiliate_ID,AffLog_IP) values(" & aff_ID & ",'" & Request.ServerVariables("REMOTE_ADDR") & "')"
c.execute sql
end if
errLongStr=""
NotFound=False
'response.write "DSN":response.end
temprs.open "SELECT * FROM TBL_AffiliateCommision WHERE Aff_ID = " & rs("Affiliate_ID") & " ORDER BY ID DESC",c,3,1
if tempRS("Affiliate_Percent") > 0 then session("affComm") = tempRS("Affiliate_Percent") else session("affComm") = "25"
if tempRS("Affiliate_Percent_sec") > 0 then session("affComm") = session("affComm") & ";" & tempRS("Affiliate_Percent_sec") else session("affComm") = session("affComm") & ";5"
temprs.close
rs.close
if trim(session("affComm")) = "" then session("affComm") = "25;5"
REM in august we sent the affs a newsletter telling them that we upgraded their commission, this part
REM handles the commission upgrade in case they didn't get it up until now (25 for brand 30 for generic)
rs.open "SELECT top 1 * FROM TBL_AffComm WHERE ProductType_ID = 1 AND Affiliate_ID = " & session("Aff_ID") & " ORDER BY AffComm_ID DESC;",c,3,3
if rs.eof then
' in case that the commission was not found
rs.addnew
rs("Affiliate_ID") = session("Aff_ID")
rs("ProductType_ID") = 1
rs("AffComm_Comm") = 30
rs("AffComm_2ndComm") = 5
rs("AffManager_ID") = 0
rs.update
commUpgrade = "?commup=on"
else
if rs("AffComm_Comm") < 30 then
rs.addnew
rs("Affiliate_ID") = session("Aff_ID")
rs("ProductType_ID") = 1
rs("AffComm_Comm") = 30
rs("AffComm_2ndComm") = 5
rs("AffManager_ID") = 0
rs.update
commUpgrade = "?commup=on"
end if
end if
rs.close
rs.open "SELECT top 1 * FROM TBL_AffComm WHERE ProductType_ID = 2 AND Affiliate_ID = " & session("Aff_ID") & " ORDER BY AffComm_ID DESC;",c,3,3
if rs.eof then
' in case that the commission was not found
rs.addnew
rs("Affiliate_ID") = session("Aff_ID")
rs("ProductType_ID") = 2
rs("AffComm_Comm") = 25
rs("AffComm_2ndComm") = 5
rs("AffManager_ID") = 0
rs.update
commUpgrade = "?commup=on"
else
if rs("AffComm_Comm") < 25 then
rs.addnew
rs("Affiliate_ID") = session("Aff_ID")
rs("ProductType_ID") = 2
rs("AffComm_Comm") = 25
rs("AffComm_2ndComm") = 5
rs("AffManager_ID") = 0
rs.update
commUpgrade = "?commup=on"
end if
end if
rs.close
set rs = nothing
set temprs = nothing
set c = nothing
response.redirect "index.html" & commUpgrade
else
Response.Cookies("AFF")("Username") = ""
Response.Cookies("AFF").expires = date + 300
errLongStr="Wrong Login ID/Password"
NotFound=True
end if
rs.close
set rs=nothing
set c=nothing
else
errLongStr="Enter your Login ID and Password"
NotFound=True
end if
else
errLongStr=""
end if
%>
Please enter your login ID and password :
|
<%=errLongStr%>
|
|