Print Page | Close Window

dbase password

Printed From: Web Wiz Forums
Category: General Discussion
Forum Name: Classic ASP Discussion
Forum Description: Discussion on Active Server Pages (Classic ASP).
URL: https://forums.webwiz.net/forum_posts.asp?TID=2949
Printed Date: 29 March 2026 at 10:14am
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: dbase password
Posted By: sahdow
Subject: dbase password
Date Posted: 22 May 2003 at 11:03am

Hello All,

I'm new to ASP and learn by example, basically a beginning coder.

I would like to setup a password protected area on my website that allows me to direct specific users to specific locations. When a person logs in Iwant them to go to their directory and nowhere else.

Can anyone provide a sample of asp code that would do this with an access dbase?




Replies:
Posted By: Mart
Date Posted: 22 May 2003 at 12:59pm
response.redirect(rslogin("directory"))


Posted By: farrukh
Date Posted: 22 May 2003 at 5:13pm

 i cant understand wat u want. If u want only redirection then its given by Mart. If ne thing else then im waiting for it.



-------------
i have collected some nice avatars (37) and smileys (227) here you can download
http://www24.brinkster.com/webmastertool/download.html


Posted By: Bluefrog
Date Posted: 23 May 2003 at 9:28am

What you're asking for requires preparation. If you are a beginning coder, learn the file system object(s). You'll need to create directories for each user. This is probably best done when you create the user - i.e. create the user and use an autonumber. In SQL something like:

User_Index int identity(1,1) NOT NULL CONSTRAINT PK_user_name1 PRIMARY KEY

You'll then be guranteed that each user will be unique.

Use the filesystemobject to create the directory when they register, then like posted above, use that column to determine where they go. You may wish to have a default set of files to write to their directory. I'd create that set and then read it in, replace whatever you need then write it to their directory.

What you've described is more than just a few lines of code. As posted above, response.redirect will do the redirection, and that's pretty much dirt simple. Here's a simple script that I use to write files (not directories):

<%
SUB fileWriter(PathName, FileName, FileString)

 dim fsoMyFile
 dim myfile
 SET fsoMyFile = CreateObject("Scripting.FileSystemObject")
 SaveToLocation = PathName & FileName
 SET myfile = fsoMyFile.CreateTextFile(SaveToLocation, 1, 0)

 myfile.write FileString
 myfile.close

 set fsoMyFile = nothing
 set myfile = nothing

END SUB
%>

The function accepts three things: the path (your directory), the new file name, and a string for the actual file you want to write.

I'll leave it up to you to figure out how to create directories. (It isn't that much different.)

HOWEVER - each page in the user's directory should check to find out if that is the right user, and if not, response.redirect ("../index.asp") or whatever. You'll probably need to use cookies there as well.

As for the Access database, that is the least of your worries. You've got a lot to figure out for what you've asked.

 



Posted By: sahdow
Date Posted: 23 May 2003 at 10:09am
Thanks for the help everyone, Now its time to start tinkering.



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.08 - https://www.webwizforums.com
Copyright ©2001-2026 Web Wiz Ltd. - https://www.webwiz.net