Author |
Topic  |
|
tolsky
Starting Member
23 Posts |
Posted - 17 May 2005 : 10:49:01
|
Hi, I have my forum set up so that I use my own login page. I do this with a redirect in inc_header.asp around line 372 (I've installed some mods and made some changes myself so I'm not entirely sure that your line numbers would match).
Anyways, the problem occurs when someone uses the send topic to a friend feature and a url is e-mailed to someone. When they click on the link they get redirected to the login page and after logging in get sent to the main forum page.
So basically I need a way of knowing where they were trying to go originally so I can redirect them to the appropriate place.
I tried the following code:
Response.redirect("fandr.asp?red=" & Request.ServerVariables("URL"))
where red would contain the original page "/snitz/topic.asp?TOPIC_ID=XX" but instead it ends up containing "/snitz/login.asp"
Does anyone know a solution to this problem? Thanks.
Ben Tolsky
|
|
Shaggy
Support Moderator
    
Ireland
6780 Posts |
Posted - 17 May 2005 : 10:58:28
|
What you're going to have to do there is grab the HTTP_REFERER server variable on login.asp and drop it into a hidden input in your login form. Then, once you've prcessed the login and verified a member's identity, retrieve the URI from the hidden input and redirect.
Incidentally, this should be posted in the Mod W/O Code forum as it is not directly related to the base Snitz code.
|
Search is your friend “I was having a mildly paranoid day, mostly due to the fact that the mad priest lady from over the river had taken to nailing weasels to my front door again.” |
 |
|
tolsky
Starting Member
23 Posts |
Posted - 17 May 2005 : 11:36:24
|
That doesn't work, the HTTP_REFERER variable is only populated when a form is submited, but it seems like snitz is somewhere doing a redirect to login.asp before it gets to my redirect in inc_header.asp where I try passing thru the server variable in a query string.
Do you know where this original redirect takes place? If I can find that then I can pass thru the URL server variable at that point.
And sorry about the wrong folder thing.
Ben
quote: Originally posted by Shaggy
What you're going to have to do there is grab the HTTP_REFERER server variable on login.asp and drop it into a hidden input in your login form. Then, once you've prcessed the login and verified a member's identity, retrieve the URI from the hidden input and redirect.
Incidentally, this should be posted in the Mod W/O Code forum as it is not directly related to the base Snitz code.
|
 |
|
Shaggy
Support Moderator
    
Ireland
6780 Posts |
Posted - 17 May 2005 : 11:40:22
|
This is the code you need to look for:if strRequireReg = "1" and strDBNTUserName = "" then
if not Instr(strScriptName,"policy.asp") > 0 and _
not Instr(strScriptName,"register.asp") > 0 and _
not Instr(strScriptName,"password.asp") > 0 and _
not Instr(strScriptName,"faq.asp") > 0 and _
not Instr(strScriptName,"login.asp") > 0 then
scriptname = split(request.servervariables("SCRIPT_NAME"),"/")
if Request.QueryString <> "" then
Response.Redirect("login.asp?target=" & lcase(scriptname(ubound(scriptname))) & "?" & Request.QueryString)
else
Response.Redirect("login.asp?target=" & lcase(scriptname(ubound(scriptname))))
end if
end if
end if |
Search is your friend “I was having a mildly paranoid day, mostly due to the fact that the mad priest lady from over the river had taken to nailing weasels to my front door again.” |
 |
|
tolsky
Starting Member
23 Posts |
Posted - 17 May 2005 : 11:51:26
|
I was able to just pass thru the target querystring variable and it works now. Thanks for the help!
Ben
quote: Originally posted by Shaggy
This is the code you need to look for:if strRequireReg = "1" and strDBNTUserName = "" then
if not Instr(strScriptName,"policy.asp") > 0 and _
not Instr(strScriptName,"register.asp") > 0 and _
not Instr(strScriptName,"password.asp") > 0 and _
not Instr(strScriptName,"faq.asp") > 0 and _
not Instr(strScriptName,"login.asp") > 0 then
scriptname = split(request.servervariables("SCRIPT_NAME"),"/")
if Request.QueryString <> "" then
Response.Redirect("login.asp?target=" & lcase(scriptname(ubound(scriptname))) & "?" & Request.QueryString)
else
Response.Redirect("login.asp?target=" & lcase(scriptname(ubound(scriptname))))
end if
end if
end if
|
 |
|
Shaggy
Support Moderator
    
Ireland
6780 Posts |
Posted - 17 May 2005 : 11:58:31
|
You're welcome 
|
Search is your friend “I was having a mildly paranoid day, mostly due to the fact that the mad priest lady from over the river had taken to nailing weasels to my front door again.” |
Edited by - Shaggy on 17 May 2005 11:59:01 |
 |
|
jeffery
Junior Member
 
USA
176 Posts |
Posted - 06 August 2005 : 09:55:17
|
I have a similar issue but I'm trying to link to users profiles (pop_profile.asp) from an email. When the users are logged in already its fine, but when users are logged out they get 'There Was A Problem! You must be logged in to view a Member's Profile.'
So I tried adding this to pop_profile.aspselect case Request.QueryString("mode")
case "display" '## Display Profile
if strDBNTUserName = "" then
Err_Msg = "You must be logged in to view a Member's Profile"
Response.Write " <p align=""center""><font face=""" & strDefaultFontFace & """ size=""" & strHeaderFontSize & """ color=""" & strHiLiteFontColor & """>There Was A Problem!</font></p>" & vbNewLine & _
" <p align=""center""><font face=""" & strDefaultFontFace & """ size=""" & strDefaultFontSize & """ color=""" & strHiLiteFontColor & """>" & Err_Msg & "</font></p>" & vbNewLine & _
" <p align=""center""><font face=""" & strDefaultFontFace & """ size=""" & strDefaultFontSize & """><a href=""JavaScript:history.go(-1)"">Back to Forum</a></font></p>" & vbNewLine & _
" <br />" & vbNewLine
if not(strUseExtendedProfile) then
Writefooter
Response.Redirect("login.asp?target=pop_profile.asp&id=" & ppMember_ID & "")
Response.End
else
writefooter
Response.Redirect("login.asp?target=pop_profile.asp&id=" & ppMember_ID & "")
Response.End
end if
end if
Using 'target' in the url doesnt seem to be redirecting to pop_profile.asp after login.
|
www.thomasforum.com |
Edited by - jeffery on 08 August 2005 09:24:36 |
 |
|
jeffery
Junior Member
 
USA
176 Posts |
|
Shaggy
Support Moderator
    
Ireland
6780 Posts |
Posted - 08 August 2005 : 05:04:21
|
Replace the ampersand you have before id with a question mark.
|
Search is your friend “I was having a mildly paranoid day, mostly due to the fact that the mad priest lady from over the river had taken to nailing weasels to my front door again.” |
 |
|
jeffery
Junior Member
 
USA
176 Posts |
Posted - 08 August 2005 : 09:03:17
|
Ok, still doesnt redirect after login. Maybe login.asp doesnt have this functionality? |
www.thomasforum.com |
 |
|
Shaggy
Support Moderator
    
Ireland
6780 Posts |
Posted - 08 August 2005 : 09:12:57
|
Use a reponse.write in place of the response.redirect to write the URI to screen and make sure it is correct.
|
Search is your friend “I was having a mildly paranoid day, mostly due to the fact that the mad priest lady from over the river had taken to nailing weasels to my front door again.” |
 |
|
|
Topic  |
|