[SOLVED] Show "Image" Depends On User "Status"?

This is a discussion on "[SOLVED] Show "Image" Depends On User "Status"?" within the Classic ASP section. This forum, and the thread "[SOLVED] Show "Image" Depends On User "Status"? are both part of the Program Your Website category.


 Subscribe in a reader

Go Back   Webforumz.com > Main Forums > Program Your Website > Classic ASP

Notices




Reply
 
LinkBack Thread Tools
  #1  
Old Oct 8th, 2007, 04:50
Most Reputable Member
Join Date: Feb 2004
Location: Borneo
Age: 27
Posts: 1,612
Blog Entries: 2
Thanks: 0
Thanked 4 Times in 3 Posts
[SOLVED] Show "Image" Depends On User "Status"?

Hai guys,

Is it possible if I want to show 2 different kind of image (for example: online and offline gif) depends on the "status" of the user?

In my page, when the user login, it will set the user "status" (a field in my database) to be "Online" and when he logout, it will set the "status" to "Offline".

So when the user has logged in, I want to display the Online.gif just beside the user name. Just like a toggle function in javascript.

Code: Select all
if "status" == Online {
display "online.gif"
}
else
display "offline.gif"
If this things can be done in any other way other that javascript, please tell me,

Thanks....
Last Blog Entry: ASP Programming Tips and Technique (Oct 26th, 2007)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote

  #2  
Old Oct 8th, 2007, 09:45
Rakuli's Avatar
SuperMember

SuperMember
Join Date: Sep 2007
Location: Australia
Age: 24
Posts: 956
Blog Entries: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Show "Image" Depends On User "Status"?

Hi monie,

What type of server side scripting do you have available? You can't achieve this with javascript alone as javascript has no knowledge of what other user's are up to.

If you have PHP, I can help you. Let me know and I'll move this thread over there.

Cheers,
Last Blog Entry: The wannabe juggler's quest (Oct 27th, 2007)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #3  
Old Oct 9th, 2007, 00:51
Most Reputable Member
Join Date: Feb 2004
Location: Borneo
Age: 27
Posts: 1,612
Blog Entries: 2
Thanks: 0
Thanked 4 Times in 3 Posts
Re: Show "Image" Depends On User "Status"?

I am using ASP (..currently learning PHP-WAMP)

If you can teach me using PHP, go on. I'll learn by doing. If you know the ASP way, maybe it will be easier for me to understand...

Thanks by the way...
Last Blog Entry: ASP Programming Tips and Technique (Oct 26th, 2007)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #4  
Old Oct 12th, 2007, 15:58
Most Reputable Member
Join Date: Feb 2004
Location: Borneo
Age: 27
Posts: 1,612
Blog Entries: 2
Thanks: 0
Thanked 4 Times in 3 Posts
Re: Show "Image" Depends On User "Status"?

Any thing so far Rakuli?
Last Blog Entry: ASP Programming Tips and Technique (Oct 26th, 2007)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #5  
Old Oct 12th, 2007, 21:15
Rakuli's Avatar
SuperMember

SuperMember
Join Date: Sep 2007
Location: Australia
Age: 24
Posts: 956
Blog Entries: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Show "Image" Depends On User "Status"?

Hi Monie, sorry I missed this one. If you have a look at http://www.webforumz.com/php-forum/6...-beginners.htm it has some links to PHP starter tutorials but it may be easier for you to see the ASP way

Moving to the ASP forum
Last Blog Entry: The wannabe juggler's quest (Oct 27th, 2007)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #6  
Old Oct 15th, 2007, 09:18
Up'n'Coming Member
Join Date: Sep 2007
Location: Wales, UK
Age: 36
Posts: 88
Thanks: 1
Thanked 0 Times in 0 Posts
Re: Show "Image" Depends On User "Status"?

Hi Monie,

Is this for a forum kind of "User Online"? if so you will need to flag it in the database, if you just want an image to show to the user that is logged in then you can just use a session variable and us the following:-

Code: Select all
<%If Session("svUserName") <> "" Then%>
Code for the online image goes here......
<%Else%>
Code for the offline image goes here......
<%End If%>
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #7  
Old Oct 16th, 2007, 01:22
Most Reputable Member
Join Date: Feb 2004
Location: Borneo
Age: 27
Posts: 1,612
Blog Entries: 2
Thanks: 0
Thanked 4 Times in 3 Posts
Re: Show "Image" Depends On User "Status"?

Yes, I did it. Thanks robbied.

Code: Select all
<%
    Session("userStatus") = rs("status")
    If Session("userStatus") = "Online" Then
        Response.Write ("<img src=img/online.gif>")
    Else
        Response.Write ("<img src=img/offline.gif>")
    End If
%>
Last Blog Entry: ASP Programming Tips and Technique (Oct 26th, 2007)

Last edited by Monie; Oct 16th, 2007 at 05:09.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Creating a "tag" system to find relevant "related" pages MrQuestions PHP Forum 3 Mar 20th, 2008 23:06
? IS "meta name="robots" content="?" necessary in pages ? Love2Java Starting Out 6 Aug 8th, 2007 13:48
window.opener.document["nameForm"].getElementById("someid").value; doesnt work drpompeii JavaScript Forum 0 Feb 17th, 2007 23:09
<option value="yes" class="x"> problem in Firefox mameha1977 Web Page Design 1 Jun 21st, 2006 11:20
Need to build a "Trip" or "Journey Planner" jswebdev PHP Forum 4 Dec 5th, 2005 23:22


All times are GMT. The time now is 14:01.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42