Jump to content


Photo

php script for onlogin image change


  • Please log in to reply
5 replies to this topic

#1 mrjameer

mrjameer
  • Members
  • PipPipPip
  • Advanced Member
  • 102 posts

Posted 03 September 2006 - 03:03 PM

hi

i want to change the image of a webpage on user login using php.bydefault i have some other image on my webpage.after user login when i open this web page in some other browser i need the second image..how to do it help me

jameer
???

#2 syed

syed
  • Members
  • PipPipPip
  • Advanced Member
  • 151 posts
  • LocationEngland

Posted 03 September 2006 - 03:34 PM

Hi please explain a bit more, whats the image, how do you want it to change, when should it change?

#3 mrjameer

mrjameer
  • Members
  • PipPipPip
  • Advanced Member
  • 102 posts

Posted 03 September 2006 - 03:57 PM

hi syed,

iam developing a website.on main page i have one red button image on header.below that login box.when i enter username/password it will display welcome message on the same page(other web contents should remain same)  and on the same page the red button image should change to green button image.

second, once the user login,if i open the same page in other browser it should display the green button image(means user is online like that)

jameer

#4 acdx

acdx
  • Members
  • PipPipPip
  • Advanced Member
  • 40 posts

Posted 03 September 2006 - 07:47 PM

<?php
if( user is logged in )
  echo("<img src=\"green.gif\" />");
else
  echo("<img src=\"red.gif\" />");
?>

.

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 


 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

.


 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 


#5 mrjameer

mrjameer
  • Members
  • PipPipPip
  • Advanced Member
  • 102 posts

Posted 04 September 2006 - 10:36 AM

hi,

iam developing a web site with online customer service feature.
1.when a customer opens my site then he should see the red button image on header(means the sales operator is not available like that)which is default.

2.when the sales operator is logged in then the red button image should change to green button image  on main page(means that operator is online).

3.when second customer open our site,after sales operators login, he should see green button image(means he can chat with the operator) and  similarly when sales operator logged out then the green button image should change to red one.

i have login script but when i test the condition of after login image should change,its not working.after login red button as it is.i want to do this with php/javascript...

thanks

mrjameer

#6 Jenk

Jenk
  • Members
  • PipPipPip
  • Advanced Member
  • 778 posts

Posted 04 September 2006 - 12:14 PM

dude.. you've been given an example. From that example you can tell what needs doing..

<?php

if ($user->isLoggedIn()) {
    if ($user->isOperator()) {
        $image = 'pink with yellow pokadots';
    } else {
        $image = 'green'; //display green image
    }
} else {
    $image = 'red'; //display red image
}

?>





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users