Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Authorization include file 1

Status
Not open for further replies.

InShadows

IS-IT--Management
Jul 7, 2000
36
US
I am currently writing a system that will log in a user with a username and password and then upon validation will give them a session variable entitled CCFPLevel. On each page the Level needs to be checked to see if the user has the proper authorization. I was going to write an include file. In the file I would grab the filename that was calling up the include file and test that against a list I supply and against the CCFPLevel session variable. How would I grab just the filename of the file that the user is on and not the include file that this code will be in?
Dave Highfield
dave.highfield@cmsis.com

I couldn't think of a sig so here it is.
 
dim pageName, pathArray
pageName = request.servervariables("SCRIPT_NAME")
pathArray = split(pageName, "/")
pageName = pathArray(ubound(pathArray))

The variable, 'pageName', now holds the name of the page that made the request.

If you want to axe the .asp off the end, then just add this:

pageName = left(pageName,len(pageName)-4)

:)
penny.gif
penny.gif
 
thanks.. works perfectly since I had already written the pages according to type in the beginning so I just took the left(pagename,2) and can then check their access level.. thanx again.


Dave Highfield
dave.highfield@cmsis.com

I couldn't think of a sig so here it is.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top