Currently it is setup so that visitors that want to download a PDF file, can do so, only after they have either completed a full registration or an email registration.
I need to know how to properly code the register/index.asp page so that visitors looking to download a file can click on a link that reads "skip registration" and it will allow them to skip the registration altogether and go directly to the file they were intending to download initially.
In effect giving them 3 options:
Full Registration (This option already in place)
Email Only Registration (This option already in place)
Skip Registration (This option NEED ASSISTANCE)
The website is LightingControls.com
The page in need of help is Lightingcontrols.com/register/index.asp
Please Assist.
Thanks
CoopASP
yamaharuss
04-21-2010, 06:35 PM
You need to explain your setup further. If it's just a file they are downloading then just
<a href="http://yoursite/yourfile.pdf">Skip Registration</a>
You can't do both - restrict the file from download until registered AND download without registering. What's the point?
coopASP
04-21-2010, 07:08 PM
Yamaharuss,
Thanks for the reply.
Actually, WHY they are deciding to allow visitors to either download the file after registering or allow them to skip registration altogether, is out of my hands.
I believe it's because they still want to grab as many sign-ups as possible, but, there have been a few complaints so, they're implementing the "skip" option.
Currently the way it works it; if the user is signed in, they can download one of 4 PDF/DOC files directly from the homepage. If the user is not signed in, after clicking on the PDF/DOC file, they are automatically redirected to the Registration page where they are prompted to register.
We're attempting to add a Skip Registration link to allow the user to download the file they initially clicked on, on the homepage.
The coding is structured using "If, Else, Else If" procedures. I can't figure out how to code the Registration Page to allow the user to download the file without registering.
All that is require to register is an email address.
I can't figure out how to trick the page into thinking that a valid email address has been input, when the user clicks on the "skip registration" link.
Any help?
yamaharuss
04-22-2010, 06:30 AM
You still didn't explain how the link to the PDF is setup. You say they are redirected after clicking on the pdf file... HOW are you redirecting them?
The only way possible to require a login when clicking on a PDF link would be to use some sort of directory security on the server.
If I click a link to a pdf file, it will either load the pdf in the browser or prompt me to download it. The browser doesn't know to perform a different task with a file type of pdf.
Show the code, I did not see a link to your PDF/DOC file anywhere
coopASP
04-22-2010, 02:03 PM
Thanks for stickin with me Yamaha. I appreciate the help.
On the lightingcontrols.com homepage, under "system overview" there is a section of links that allow the user to download a PDF/DOC if they are signed in. If they aren't signed in and they click one of the links, it will redirect them to a Register page where they must, at minimum, enter an email address to be able to retrieve the PDF/DOC they initially clicked on, on the homepage.
Register Page: (where the visitor is redirected if they aren't logged in and attempt a PDF/DOC download.)
<%
isDownloadRequest=True
ErrorMessage = ""
If Request.QueryString("errorMsg") <>"" then
ErrorMessage = Request.QueryString("errorMsg")
End If
If trim(Request.Form("camefrom")) <>"" then
CameFrom = Request.Form("camefrom")
ElseIf Request.QueryString("camefrom")<>"" Then
CameFrom = Request.QueryString("camefrom")
ElseIf Request.QueryString<>"" Then
If Left(Request.QueryString,1)="q" Then
isDownloadRequest=False
CameFrom="/"
End If
CameFrom = Request.QueryString
ElseIf Request.ServerVariables("HTTP_REFERER")<>"" Then
CameFrom = Request.ServerVariables("HTTP_REFERER")
Else
CameFrom = "/"
isDownloadRequest=False
End If
Guest = trim(Request.Cookies("Guest"))
If Guest="" or Guest="GUEST" then
Response.Cookies("Guest") = "GUEST"
Response.Cookies("UserName") = "GUEST"
Response.Cookies("Guest").Expires = #Jan 1,1998#
Response.Cookies("UserName").Expires = #Jan 1,1998#
Guest = "GUEST"
End if
isUnity = True 'registration is required
unity="y"
'unity = Request.QueryString("unity")
'If unity="y" Then isUnity = True
%>
<html>
<head>
<title>Lighting Control & Design: registration.</title>
<meta http-equiv="Content-Type" content="text/asp; charset=iso-8859-1">
<script language="JavaScript">
<!--
function MM_swapImgRestore() { //v3.0
var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_preloadImages() { //v3.0
var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
function MM_findObj(n, d) { //v4.01
var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
if(!x && d.getElementById) x=d.getElementById(n); return x;
}
function MM_swapImage() { //v3.0
var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
function MM_openBrWindow(theURL,winName,features) { //v2.0
window.open(theURL,winName,features);
}
function MM_validateForm() { //v4.0
var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=MM_findObj(args[i]);
if (val) { nm=val.name; if ((val=val.value)!="") {
if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain an e-mail address.\n';
} else if (test!='R') { num = parseFloat(val);
if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';
if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
min=test.substring(8,p); max=test.substring(p+1);
if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
} } } else if (test.charAt(0) == 'R') errors += '- '+nm+' is required.\n'; }
} if (errors) alert('The following error(s) occurred:\n'+errors);
document.MM_returnValue = (errors == '');
}
function validateEmail()
{
var emailPattern = /^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$/;
var elementValue = document.getElementById('emailaddress').value;
Check Registration Page (the page of codes that the Register Page uses to validate email address to determine if a user has logged in or not before granting access to a file.)
<!--#include virtual="/Utility/db_ConnectionString.asp"-->
<!--#include virtual="/Utility/db_sanitize.asp"-->
<%
Function sendThankYouEmail(emailAddress)
Set fso = Server.CreateObject("Scripting.FileSystemObject")
bodyHTML = fso.OpenTextFile(Server.Mappath("thank_you.html")).ReadAll
Set mymail = CreateObject("CDO.Message")
mymail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
mymail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "mail.lightingcontrols.com"
mymail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
mymail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate")=1
mymail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusername")="mailrelay"
mymail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendpassword")="mr091"
mymail.Configuration.Fields.Update
mymail.to = emailAddress
mymail.From = "thankyou@lightingcontrols.com"
mymail.Subject = "Thank you for your online registration!"
mymail.BCC = "lcd_dougm@hotmail.com"
mymail.HTMLbody = bodyHTML
mymail.Send
Set mymail = Nothing
End Function
Function sendRegistrationAlert(emailAddress)
Dim ObjCdo1
Set ObjCdo1 = CreateObject("CDO.Message")
ObjCdo1.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
ObjCdo1.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "mail.lightingcontrols.com"
ObjCdo1.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
ObjCdo1.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate")=1
ObjCdo1.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusername")="mailrelay"
ObjCdo1.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendpassword")="mr091"
ObjCdo1.Configuration.Fields.Update
ObjCdo1.From = "inews@lightingcontrols.com"
'TAKE OUT
ObjCdo1.To = "lcd_dougm@hotmail.com"
ObjCdo1.Subject = "Thank you for your online registration!"
ObjCdo1.HTMLbody = "New registration received from website: " & emailAddress
ObjCdo1.Send
Set ObjCdo1 = Nothing
End Function
'==============================='
If Trim(Request.Form("camefrom")) <>"" then
CameFrom = Request.Form("camefrom")
ElseIf Request.QueryString("camefrom")<>"" Then
CameFrom = Request.QueryString("camefrom")
ElseIf Request.QueryString<>"" Then
CameFrom = Request.QueryString
Else
CameFrom = "/"
End If
unity = Request.Form("unity")
If unity="" Then Request.QueryString("unity")
If unity="" Then unity = "n"
'this cannot be blank
emailAddress=Trim(LCase(Request.Form("emailaddress")))
'The below items are not factored into the registration and should be. Needs to be updated when the site is rewritten.
varName = Trim(LCase(Request.Form("varName")))
varCompany = Trim(LCase(Request.Form("varCompany")))
varAddress = Trim(LCase(Request.Form("varAddress")))
varCity = Trim(LCase(Request.Form("varCity")))
varState = Trim(LCase(Request.Form("varState")))
varZip = Trim(LCase(Request.Form("varZip")))
varPhone = Trim(LCase(Request.Form("varPhone")))
varCell = Trim(LCase(Request.Form("varCell")))
varFax = Trim(LCase(Request.Form("varFax")))
varFirmtype = Trim(LCase(Request.Form("varFirmtype")))
varContactme = Trim(LCase(Request.Form("varContactme")))
varOptin = Trim(LCase(Request.Form("varOptin")))
Else
'must synchronize with web database for backwards compatibility
Set Conn = Server.CreateObject("ADODB.Connection")
Conn.Open loosecannon_connector 'string_Connection
Set rs = Server.CreateObject("ADODB.Recordset")
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' ''''''''''''''''''''''''
'NEED TO GET IT WORKING WITH STORED PROCEDURE - CAN PUT THIS BACK IN LATER
Set dbo = Server.CreateObject("ADODB.Connection")
dbo.ConnectionTimeout = 90
dbo.Open loosecannon_connector
Set rso = Server.CreateObject("ADODB.Recordset")
rso.Open "SELECT fID, fEmailAddress, fStatus FROM tEmailAddresses WHERE fEmailAddress='" & emailAddress & "';",dbo,3,1,1
If rso.BOF and rso.EOF Then
'new registrant, ask if qualified and interested in survey
dbo.Execute "INSERT INTO tEmailAddresses (fStatus,fEmailAddress,fSource,fDatabaseSource,fContactSource) VALUES('F','" & emailAddress & "','Web Registration','Web','Web Registration');"
Dim rsIdentity
Set rsIdentity = dbo.Execute("SELECT fID FROM tEmailAddresses WHERE fEmailAddress = '" & emailAddress & "'")
Dim iCurrentValue
iCurrentValue = rsIdentity(0)
dbo.Execute "INSERT INTO tNewsletterLists (fNewsletterPartnerID,fEmailAddressID) VALUES (2,'" & iCurrentValue & "');"