Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

who's online enhancement


Guest

Recommended Posts

Hi all,

I use the who's online infobox for showing how many customers are on the site. Now I'm trying to figure out how to show for example also the newest custumer. I tried some things but nu luck........my php/mysql skills are :'( .

The php from whos_online.php:

<tr>

<td>

<?php

 

// Set expiration time, default is 900 secs (15 mins)

$xx_mins_ago = (time() - 600);

 

tep_db_query("delete from " . TABLE_WHOS_ONLINE . " where time_last_click < '" . $xx_mins_ago . "'");

 

$whos_online_query = tep_db_query("select customer_id from " . TABLE_WHOS_ONLINE);

while ($whos_online = tep_db_fetch_array($whos_online_query)) {

if (!$whos_online['customer_id'] == 0) $n_members++;

if ($whos_online['customer_id'] == 0) $n_guests++;

 

$user_total = sprintf(tep_db_num_rows($whos_online_query)); }

 

if ($user_total == 1) {

$there_is_are = BOX_WHOS_ONLINE_THEREIS . ' ';

} else {

$there_is_are = BOX_WHOS_ONLINE_THEREARE . ' ';

}

 

if ($n_guests == 1) {

$word_guest = ' ' . BOX_WHOS_ONLINE_GUEST;

}else{

$word_guest = ' ' . BOX_WHOS_ONLINE_GUESTS;

}

 

if ($n_members == 1) {

$word_member = ' ' . BOX_WHOS_ONLINE_MEMBER;

}else{

$word_member = ' ' . BOX_WHOS_ONLINE_MEMBERS;

}

 

 

if (($n_guests >= 1) && ($n_members >= 1)) $word_and = ' ' . BOX_WHOS_ONLINE_AND . ' <br>';

 

$textstring = $there_is_are;

if ($n_guests >= 1) $textstring .= $n_guests . $word_guest;

 

$textstring .= $word_and;

if ($n_members >= 1) $textstring .= $n_members . $word_member;

 

$textstring .= ' online.';

 

 

$info_box_contents = array();

$info_box_contents[] = array('align' => 'left',

'text' => BOX_HEADING_WHOS_ONLINE

);

new infoBoxHeading($info_box_contents);

 

$info_box_contents = array();

$info_box_contents[] = array('align' => 'left',

'text' => $textstring

);

new infoBox($info_box_contents);

?>

</td>

</tr>

<!-- whos_online_eof //-->

 

I would really appriciate some help in this?!

thanks in advance,

Chris

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...