more than 1 per row?
Web Server forum
Back To The Forum Home!Search!Private Messaging System

Web Server Talk Web Server Talk > Web Servers reviews > IIS server support > IIS ASP > more than 1 per row?




Pages (2): [1] 2 »   Last Thread   Next Thread Next
  Show Printable Version Email this Page Subscribe to this Thread      Post New Thread    Post A Reply      

    more than 1 per row?  
Jeff


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
03-19-07 06:22 AM

Hey gang.
I know this is probably an easy solution, but I don't remember how to do it.

I have this code;

<%
If rstActiveUsers.RecordCount > 0 Then
rstActiveUsers.MoveFirst
Do While Not rstActiveUsers.EOF
var_user1 = session("username") %>
<td class="tdblock" align="left">
<font color="#FFFFFF" style="font-size:
9pt"><%=var_user1%></font></td>
</tr>
<% rstActiveUsers.MoveNext
Loop
End If
%>

it shows names like this;

name1
name2
name3

what i would like it to do, is show like this, with 3 across

name1 name2 name3

i think i remember using a mod or something to pull this off.

can someone help??

TIA
Jeff







[ Post a follow-up to this message ]



    Re: more than 1 per row?  
Jeff


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
03-19-07 06:22 AM


"Jeff" <bam@gig-gamers.com> wrote in message
 news:45fe0813$0$24707$4c368faf@roadrunne
r.com...
> Hey gang.
> I know this is probably an easy solution, but I don't remember how to do
> it.
>
> I have this code;
>
> <%
>              If rstActiveUsers.RecordCount > 0 Then
>              rstActiveUsers.MoveFirst
>              Do While Not rstActiveUsers.EOF
>              var_user1 = session("username") %>
>              <td class="tdblock" align="left">
>               <font color="#FFFFFF" style="font-size:
> 9pt"><%=var_user1%></font></td>
>              </tr>
>              <% rstActiveUsers.MoveNext
>              Loop
>              End If
> %>
>
> it shows names like this;
>
> name1
> name2
> name3
>
> what i would like it to do, is show like this, with 3 across
>
> name1 name2 name3
>
> i think i remember using a mod or something to pull this off.
>
> can someone help??
>
> TIA
> Jeff
>

ok, along with this, i thought i had this working in the global.asa, but it
isn't.

i have this in the asa file:..

<object runat="Server" scope="Application"
id="rstActiveUsers" progid="ADODB.Recordset">
</object>

<script language="VBScript" runat="Server">

Sub Application_OnStart()

Const adInteger = 3
Const adVarChar = 200
Const adDate = 7

rstActiveUsers.Fields.Append "id", adInteger
rstActiveUsers.Fields.Append "ip", adVarChar, 15
rstActiveUsers.Fields.Append "browser", adVarChar, 255
rstActiveUsers.Fields.Append "started", adDate

rstActiveUsers.Open
End Sub

Sub Session_OnStart()

Session.Timeout = 20

Session("Start") = Now()

If Not rstActiveUsers.EOF Then rstActiveUsers.MoveLast

rstActiveUsers.AddNew

rstActiveUsers.Fields("id").Value = _
Session.SessionID

rstActiveUsers.Fields("ip").Value = _
Request.ServerVariables("REMOTE_HOST")

rstActiveUsers.Fields("browser").Value = _
Request.ServerVariables("HTTP_USER_AGENT")

rstActiveUsers.Fields("started").Value = _
Now()

rstActiveUsers.Update

End Sub

Sub Session_OnEnd()

Const adSearchForward = 1
Const adBookmarkFirst = 1
Const adAffectCurrent = 1

rstActiveUsers.Find "id = " & Session.SessionID, _
0, adSearchForward, adBookmarkFirst



If Not rstActiveUsers.EOF Then
rstActiveUsers.Delete adAffectCurrent
End If
End Sub

Sub Application_OnEnd()
rstActiveUsers.Close
End Sub
</script>


now what i don't have, and am unable to figure out, is how to get the actual
session usernames.

i have the cookie values as session("username")  but i am unsure of where to
put that. i have searched the usual tutorial places, but i don't see where
to get that info.

if anyone can help, i would appreciate it.
at least point me to where i can find this.







[ Post a follow-up to this message ]



    Re: more than 1 per row?  
Bob Barrows [MVP]


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
03-19-07 12:25 PM

Jeff wrote:
> <object runat="Server" scope="Application"
> id="rstActiveUsers" progid="ADODB.Recordset">
> </object>

Bad ... no ... HORRIBLE idea. Do NOT store ADO objects in application or
session unless you have modified the server's registry to mark them
"free-threaded" (which will mean they cannot be used for Jet)
http://www.aspfaq.com/2053

Use an array or free-threaded XML document instead.
--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"







[ Post a follow-up to this message ]



    Re: more than 1 per row?  
Bob Barrows [MVP]


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
03-19-07 12:25 PM

Jeff wrote:
> <%
>              If rstActiveUsers.RecordCount > 0 Then

I hope this recordset is disconnected and the connection closed ...

> it shows names like this;
>
> name1
> name2
> name3
>
> what i would like it to do, is show like this, with 3 across
>
> name1 name2 name3
>
> i think i remember using a mod or something to pull this off.
>
Look, all you are doing in ASP code is generating a string of html
characters. With that in mind, start by creating the hetml that would
display the data as you desire. Then modify the vbscript code to generate
that html.

In this case, instead of writing cell and row end and start tags after each
record, you would write them after a set number of records. Yes, you could
use mod to do this:
if recordsprocessed % 3 =0 then
'write the end and beginning tags
end if
'write the data

Bob Barrows
--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"







[ Post a follow-up to this message ]



    Re: more than 1 per row?  
Jeff


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
03-19-07 06:28 PM

> Bad ... no ... HORRIBLE idea. Do NOT store ADO objects in application or
> session unless you have modified the server's registry to mark them
> "free-threaded" (which will mean they cannot be used for Jet)
> http://www.aspfaq.com/2053
>
> Use an array or free-threaded XML document instead.

ok, say I am going to totally redo the asa file. Which I am currently
reading on it with the links you provided,
I still can't figure how to use the session("username") for anything in the
asa file. Unless I am missing something, I just don't get it.







[ Post a follow-up to this message ]



    Re: more than 1 per row?  
Bob Barrows [MVP]


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
03-19-07 06:28 PM

Jeff wrote: 
>
> ok, say I am going to totally redo the asa file. Which I am currently
> reading on it with the links you provided,
> I still can't figure how to use the session("username") for anything
> in the asa file. Unless I am missing something, I just don't get it.

I didn't say anything about that because frankly I don't understand the
problem. A session variable contains nothing until you put something
into it. So you have to get the user name from a user and put it into
the session variable.

--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.







[ Post a follow-up to this message ]



    Re: more than 1 per row?  
Jeff


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
03-19-07 06:28 PM


"Bob Barrows [MVP]" <reb01501@NOyahoo.SPAMcom> wrote in message
news:e6n8LHjaHHA.2064@TK2MSFTNGP05.phx.gbl...
> Jeff wrote: 
>
> I didn't say anything about that because frankly I don't understand the
> problem. A session variable contains nothing until you put something
> into it. So you have to get the user name from a user and put it into
> the session variable.
>
> --
> Microsoft MVP -- ASP/ASP.NET
> Please reply to the newsgroup. The email account listed in my From
> header is my spam trap, so I don't check it very often. You will get a
> quicker response by posting to the newsgroup.
>
>

correct. i do have the session variable ("username") as the login name of
the user. this gets assigned on the login page. the problem i am having, is
what to use on the asa page as the session("username") so i can work with it
there.

i guess i am not explaining myself to well.

Session.SessionID

that is the actual session id of the user.


Session.UserName
i know this isn't the session("username")







[ Post a follow-up to this message ]



    Re: more than 1 per row?  
Bob Barrows [MVP]


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
03-19-07 06:28 PM

Jeff wrote:
> "Bob Barrows [MVP]" <reb01501@NOyahoo.SPAMcom> wrote in message
> news:e6n8LHjaHHA.2064@TK2MSFTNGP05.phx.gbl... 
[vbcol=seagreen]
> correct. i do have the session variable ("username") as the login
> name of the user. this gets assigned on the login page. the problem i
> am having, is what to use on the asa page as the session("username")
> so i can work with it there.

You can't. What do you want to do with it in global.asa? There are only
4 event procedures that run in global.asa: application_onstart,
application_onend, session_onstart, and session_onend.
The session_onstart event runs BEFORE that login page runs. The user's
name does not exist at this point. You have to assign it into the
session variable at the point that the login page gets it from the user.

>
> i guess i am not explaining myself to well.
>
> Session.SessionID
>
> that is the actual session id of the user.
True
>
>
> Session.UserName
> i know this isn't the session("username")
True.
Unless you are creating an intranet application that uses Windows
Authentication, the login name has to be gotten from the user.* Unless
you've stored it in a cookie on the user's machine (not very reliable),
it will not be available in global.asa ... and even then, I am not sure
that non-session cookies are available to global.asa. I don't have time
right now to look it up, but you can read through the documentation
here:
http://msdn.microsoft.com/library/e... />
651779.asp

Bob Barrows

* If you ARE using Windows Authentication with Anonymous Access
disabled, the username can be found in
Request.SessionVariables("LOGON_USER")
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.







[ Post a follow-up to this message ]



    Re: more than 1 per row?  
Jeff


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
03-20-07 12:23 AM

> You can't. What do you want to do with it in global.asa? There are only
> 4 event procedures that run in global.asa: application_onstart,
> application_onend, session_onstart, and session_onend.
> The session_onstart event runs BEFORE that login page runs. The user's
> name does not exist at this point. You have to assign it into the
> session variable at the point that the login page gets it from the user.
>

ok. then maybe i need to work this with a database. and grab the logon
username.

the only problem i can see, which may or may not be a problem, is removing
the name in the db once the session is closed.
i think i can write a code that checks the login time, and sets any name in
there to delete after the same time that the session expires.








[ Post a follow-up to this message ]



    Re: more than 1 per row?  
Bob Barrows [MVP]


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
03-20-07 12:23 AM

Jeff wrote: 
>
> ok. then maybe i need to work this with a database. and grab the logon
> username.
>
> the only problem i can see, which may or may not be a problem, is
> removing the name in the db once the session is closed.
> i think i can write a code that checks the login time, and sets any
> name in there to delete after the same time that the session expires.

Well, then, you will want to look at these articles:
http://www.aspfaq.com/show.asp?id=2491
http://classicasp.aspfaq.com/genera...sion-onend.html

--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.







[ Post a follow-up to this message ]



    Sponsored Links  




 





   All times are GMT. The time now is 06:00 AM.      Post New Thread    Post A Reply      
Pages (2): [1] 2 »   Last Thread   Next Thread Next


Most Popular forums 

Forum Jump:
Rate This Thread:

Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is OFF
vB code is ON
Smilies are ON
[IMG] code is OFF
 
Medical and Health forum | Computer Games Reviews | Graphics design forum

Back To The Top
Home | Usercp | Faq | Register