Snitz Forums 2000
Snitz Forums 2000
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Snitz Forums 2000 DEV-Group
 DEV Discussions (General)
 UserLoggedIn() and UserName()
 New Topic  Topic Locked
 Printer Friendly
Author Previous Topic Topic Next Topic  

leska
Starting Member

9 Posts

Posted - 30 January 2005 :  10:43:53  Show Profile
I'm trying to build my own page to allow user to upload files.
I'd like to allow upload only to users who are registered and logged in a forum, e.g.:

if UserLoggedIn() then
  response.write "Hello " UserName()
  ...
else
  response.write "Please log in first."
  response.redirect("login.asp?target=myUploadPage.asp")
end

Q1: Is there a simple way to check if user is logged in?

Q2: What's the easiest way to find out user name and user id?

Thanks in advance!

Edited by - leska on 30 January 2005 10:47:07

gerardW
Starting Member

Mexico
13 Posts

Posted - 30 January 2005 :  11:38:00  Show Profile
You can get the membername by using the next statement:
strMemberName = Request.Cookies("Snitz00User")("Name")

And with the next SQL-statement you can get their 'real' name:
strSQL = "SELECT M_Firstname, M_Lastname FROM FORUM_MEMBERS WHERE M_NAME = '" & strMemberName & "'"

(Depending on some settings in the forum, this is the default I believe)

A user is logged in when the string strMemberName is not empty.
Go to Top of Page

leska
Starting Member

9 Posts

Posted - 31 January 2005 :  11:12:07  Show Profile
quote:
Originally posted by gerardW

You can get the membername by using the next statement:
strMemberName = Request.Cookies("Snitz00User")("Name")



Gerard, thanks.
The code works just fine if it's inside forum directory (i.e. /root/forum).
However, when the code runs from /root or some other directory (e.g. /root/upload) the string is empty.
Any solution to this?
Go to Top of Page

gerardW
Starting Member

Mexico
13 Posts

Posted - 31 January 2005 :  11:30:11  Show Profile
quote:

The code works just fine if it's inside forum directory (i.e. /root/forum).
However, when the code runs from /root or some other directory (e.g. /root/upload) the string is empty.
Any solution to this?



In Main Forum Configuration you should set Cookie To WebSite.
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Topic Locked
 Printer Friendly
Jump To:
Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.81 seconds. Powered By: Snitz Forums 2000 Version 3.4.07