Response.Write "<b>You are not logged on..............................

M

mallyonline

I last posted to this group about 6 months ago and was very pleased by the
excellent response I got and the great help offered to me. I am back this
time with another request for your expert help on a bit of ASP code I use on
my windows server 2003 with IIS6 machine.

I would like the code below to display in different colours depending on the
status of the page. I am looking to make the not logged in code appear red
and the logged in code green.

The code:
<%
If Len(Session("UID")) = 0 Then
Response.Write "<b>You are not logged on. If You don't have a username
or password you can register for one by clicking > </b>"
Else
Response.Write "<b>You are logged on as " & Session("UID") & "</b>"
End If
%>

If anyone can help this would be great.

Thank you

malcolm
 
T

Tim Slattery

mallyonline said:
I would like the code below to display in different colours depending on the
status of the page. I am looking to make the not logged in code appear red
and the logged in code green.

The code:
<%
If Len(Session("UID")) = 0 Then
Response.Write "<b>You are not logged on. If You don't have a username

Response.Write said:
or password you can register for one by clicking > </b>"
Else
Response.Write "<b>You are logged on as " & Session("UID") & "</b>"
Response.Write "<b style='color:green'>You are logged on...."
 
S

Steven Burn

<%
'// #ff0000 = red
'// #339900 = green
If Len(Session("UID")) = 0 Then
Response.Write said:
</font></b>"
Else
Response.Write "<b><font color=""#339900"">You are logged on as " &
Session("UID") & "</font></b>"
End If
%>


--
Regards

Steven Burn
Ur I.T. Mate Group
www.it-mate.co.uk

Keeping it FREE!
 
M

McKirahan

mallyonline said:
I last posted to this group about 6 months ago and was very pleased by the
excellent response I got and the great help offered to me. I am back this
time with another request for your expert help on a bit of ASP code I use on
my windows server 2003 with IIS6 machine.

I would like the code below to display in different colours depending on the
status of the page. I am looking to make the not logged in code appear red
and the logged in code green.

The code:
<%
If Len(Session("UID")) = 0 Then
Response.Write "<b>You are not logged on. If You don't have a username
or password you can register for one by clicking > </b>"
Else
Response.Write "<b>You are logged on as " & Session("UID") & "</b>"
End If
%>

If anyone can help this would be great.

Thank you

malcolm

http://www.aspfaq.com/5003 again!
 
M

malcolm whyte

Thank you, It has worked a treat. I wonder if you guy's could also help
with this particular bit of code also related to logon.

Sometimes depending on how i am directed to the logon page the code will
do it's job and other times again it depends on how i get to the logon
page the code fails and i get an error

The code:
<%
' Was this page posted to?
If UCase(Request.ServerVariables("HTTP_METHOD")) = "POST" Then
' If so, check the username/password that was entered.
If ComparePassword(Request("UID"),Request("PWD")) Then
' If comparison was good, store the user name...
Session("UID") = Request("UID")
' ...and redirect back to the original page.
Response.Redirect Session("REFERRER")
End If
End If
%>

The error:
Response object error 'ASP 0158 : 80004005'
Missing URL
/logon/logon.asp, line 11
A URL is required.

Line 11 is this bit of code here so it depends on the REFERRER page.
Response.Redirect Session("REFERRER")

It still loggs me into the protected area as can be seen when a small
inline frame refreshes on the top area of the page with my login
username.
What i would like to do is have some safe code that will maybe just show
me as logged on. But at the same time i do not want to lose the
functionality of the code redirecting to the referrer page.


Again thank you
malcolm
 
S

Steven Burn

Ensure your session var actually contains a URL .... (there would be alot
more to it to check the URL it contains is actually valid, but this should
give you a start).

sRef =Session("REFERRER")
If Len(sRef) > 0 Then Response.Redirect sRef Else Response.Write "<b>Invalid
Referer:</b> " & sRef

--
Regards

Steven Burn
Ur I.T. Mate Group
www.it-mate.co.uk

Keeping it FREE!
 
M

mallyonline

I have now read and fully understand what you are saying.

Kind Regards
Malcolm
 
M

mallyonline

Steven,

Thank you for your help.

I think it may have been you who helped me out last time i posted regarding
listing the names of files held in a folder on the server and making the
list appear clickable. This i have now used but appear to have a problem?
When the link is clicked rather than open the said file (.mp3) for playing
in a media player what actually happens is a new browser window tries to
open objFl.Name which obviously it cannot. I have since made some changes to
IIS6

What happens now is i have the server open a new window that allows
directory browsing. This is just a temporary measure to get a list of files
that open in media player. But i would obviously like it if the code would
open a media player possibly even in a new frame :) this would allow me to
see the files and have them play in another frame at the same time.



The code:

<%
Dim objFSO,objFldr,objFl, sPath
sPath = "E:\Inetpub\wwwroot\mp3"
Set objFSO=Server.CreateObject("Scripting.FileSystemObject")
Set objFldr=objFSO.GetFolder(sPath)
For Each objFl in objFldr.Files
'Print the name of all files in the test folder



Response.Write "<a href=""mp3/"" target=""I1"">" & objFl.Name & "</a><br />"
Next
Set objFldr=Nothing
Set objFSO=Nothing
%>



If you could help on this i would be much appreciative.

Kind Regards

Malcolm
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,754
Messages
2,569,527
Members
44,999
Latest member
MakersCBDGummiesReview

Latest Threads

Top