Author |
Topic  |
leatherlips
Senior Member
   
USA
1838 Posts |
Posted - 10 July 2007 : 13:07:53
|
I am using the following script to prevent anyone from accessing a private page unless they approach it from a certain previous page first:
<% If Instr(Request.ServerVariables("http_Referer"),"mangionemagic.com/forum/topic.asp")<1 Then Response.Redirect "no.htm" End If %>
It works fine, however, I'd like to make it have to come from a specific page from within the forum such as topic.asp?TOPIC_ID=300
I can't seem to get it to work. If I add the ?TOPIC_ID=300 it will not work at all. If I don't add that then they can end up going to the private page from any topic.asp page.
How can I add the topic id into the code?
|
Mangione Magic Forum - The Music of Chuck Mangione
My Mods: Googiespell MOD | Link To Reply MOD | Petition MOD | Contact Page MOD | Share This Topic MOD | MP3 MOD | PageEar MOD | Google Viewer MOD |
|
ruirib
Snitz Forums Admin
    
Portugal
26364 Posts |
|
AnonJr
Moderator
    
United States
5768 Posts |
Posted - 10 July 2007 : 13:14:02
|
Should work:
Edit: Dang, just a little too slow... |
Edited by - AnonJr on 10 July 2007 13:14:42 |
 |
|
leatherlips
Senior Member
   
USA
1838 Posts |
|
AnonJr
Moderator
    
United States
5768 Posts |
Posted - 10 July 2007 : 16:07:40
|
Are you getting any errors? |
 |
|
ILLHILL
Junior Member
 
Netherlands
341 Posts |
Posted - 10 July 2007 : 16:24:33
|
quote: Originally posted by leatherlips
I've tried both, but it will not work. What should the whole code look like? I'm probably not inserting it correctly.
Think it will look like this:
<% If Instr(Request.ServerVariables("http_Referer"), "mangionemagic.com/forum/topic.asp")<1 Then If Request.QueryString("TOPIC_ID") <> "300" Then Response.Redirect "no.htm" End If End If %>
Greets, Dominic
|
Edited by - ILLHILL on 10 July 2007 16:29:29 |
 |
|
leatherlips
Senior Member
   
USA
1838 Posts |
|
AnonJr
Moderator
    
United States
5768 Posts |
Posted - 10 July 2007 : 17:24:44
|
Duh, I see... you may want to consider passing some extra variable in the query string to check for in place of the topic ID since its not getting passed as rui said earlier. Stupid me forgot that it wouldn't be a part of the QueryString unless you added it as part of the link - and then it wouldn't be hard to pass that around.
Is this VIP section a part of the site or a part of the forum? (assuming you haven't tightly integrated them... if you have I've got a couple ideas.) |
 |
|
leatherlips
Senior Member
   
USA
1838 Posts |
|
ruirib
Snitz Forums Admin
    
Portugal
26364 Posts |
|
leatherlips
Senior Member
   
USA
1838 Posts |
|
ruirib
Snitz Forums Admin
    
Portugal
26364 Posts |
|
leatherlips
Senior Member
   
USA
1838 Posts |
|
AnonJr
Moderator
    
United States
5768 Posts |
Posted - 10 July 2007 : 18:51:11
|
You would have to have "linktosecurepage.asp?TOPIC_ID=300" as your link to get the topic ID on your page since its not passed in the HTTP_REFERER and you're not on the actual topic page when you are checking.
Just a thought - I'm on a short "mental break" at work right now so I don't have time to really hash it out - but:
Have the link in the forum post send them to a custom page in your forum that check's if they have permission - either via a UserGroup or checking if they came from that topic or if they have permission to view that topic's forum.
If they have permission, set a custom cookie and then re-direct them. On your target page check for the cookie.
Now this is assuming all pages are in the same domain... |
 |
|
ruirib
Snitz Forums Admin
    
Portugal
26364 Posts |
Posted - 10 July 2007 : 19:55:54
|
Try this:
scriptname = split(request.servervariables("SCRIPT_NAME"),"/")
if scriptname(ubound(scriptname))="topic.asp" then
if Request.QueryString("TOPIC_ID")<>"300" then
Response.Redirect "no.htm"
end if
end if
|
Snitz 3.4 Readme | Like the support? Support Snitz too |
 |
|
AnonJr
Moderator
    
United States
5768 Posts |
Posted - 10 July 2007 : 20:21:09
|
Unless I've really misunderstood leatherlips, the page this code is running on is not topic.asp, nor is it a forum page - custom or otherwise. Therefore the SCRIPT_NAME will hold the name of the .asp page that this is running on and it will also not hold the TOPIC_ID variable.
He wants the only way to get to the page outside the forum to be from a link inside a specific MembersOnly forum. |
 |
|
Topic  |
|