Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - code to redirect guests away?
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

code to redirect guests away?

 Post Reply Post Reply
Author
jarv View Drop Down
Groupie
Groupie


Joined: 15 December 2008
Status: Offline
Points: 45
Post Options Post Options   Thanks (0) Thanks(0)   Quote jarv Quote  Post ReplyReply Direct Link To This Post Topic: code to redirect guests away?
    Posted: 11 February 2009 at 10:58am
Hi,

I would like my forum to be very secure (not available for the public).
Does anyone have any code that redirects visitors to the login page if they try to look at the forum?

thanks

J
Back to Top
jarv View Drop Down
Groupie
Groupie


Joined: 15 December 2008
Status: Offline
Points: 45
Post Options Post Options   Thanks (0) Thanks(0)   Quote jarv Quote  Post ReplyReply Direct Link To This Post Posted: 11 February 2009 at 4:26pm
sorted, I am using:


<% @ Language=VBScript %>
<% Option Explicit %>
<!--#include file="common.asp" -->
<% If blnGuest AND blnGuestSessions = True Then
    response.Redirect("login_user.asp")
End If %>

at the top of my other pages
Back to Top
Scotty32 View Drop Down
Moderator Group
Moderator Group


Joined: 30 November 2002
Location: Manchester, UK
Status: Offline
Points: 1682
Post Options Post Options   Thanks (0) Thanks(0)   Quote Scotty32 Quote  Post ReplyReply Direct Link To This Post Posted: 11 February 2009 at 5:58pm
As I said in my Member-Only Pages you should make sure to close the connection to the database.

you can do this by adding the following line to your code:
<% @ Language=VBScript %>
<% Option Explicit %>
<!--#include file="common.asp" -->
<% If blnGuest AND blnGuestSessions = True Then
    Call closeDatabase()
    response.Redirect("login_user.asp")
End If %>


Though you dont need the Guest Sessions part as i believe that relates to the ?SID=245435645 in URLs, and I simply used the lngLoggedInUserID = 2 in my tutorial which is the "Guest" members Author ID in the database.

You could also adapt this so that you could enter it into the common.asp file, with an added variable blnNoLogin which you would add to pages such as registration pages and the login page its self, like so:

blnNoLogin = true
S2H.co.uk - WebWiz Mods and Skins

For support on my mods + skins, please use my forum.
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.08
Copyright ©2001-2026 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Notice

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT at 20% unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2026 Web Wiz Ltd. All rights reserved.