Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls
 

current users online

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #1  
Old 03-19-2004, 06:42 AM
 
shirtshop shirtshop is offline
 

Senior Member
  
Join Date: Nov 2002
Posts: 127
 

Default current users online

I want to add a php script to see how many users are online.
This will be nice when it's showing under the subscribe button from the newsletter.
I'm a newby and hope that someone can help me.
This is the script that i found. Maybe there's a better one.
<?

session_start();

/**
* Calculate the number of users online by
* counting the number of session files. Returns the
* number of users on success, or -1 on failure.
*/
function getUsersOnline() {
$count = 0;

$handle = opendir(session_save_path());
if ($handle == false) return -1;

while (($file = readdir($handle)) != false) {
if (ereg("^sess", $file)) $count++;
}
closedir($handle);

return $count;
}

echo "users online = " . getUsersOnline() . "
";

?>
Reply With Quote
  #2  
Old 03-19-2004, 09:27 AM
  groovico's Avatar 
groovico groovico is offline
 

X-Man
  
Join Date: Apr 2003
Location: Firetanksoftware.com
Posts: 2,326
 

Default

Check out our traffic monitor add on for x-cart, it does that but at a much wider level and it's 100% x-cart specific.

It covers

- Live customers on site

- Customers on site along with the pages they took through the and the total time spent on it.

- Highlights any customer currently in the checkout process.

- Shop cart revenue generated

It also tells you refering sites.

And search engine keywords that were used to find your site along with the search engines they eminated from.

http://www.firetanksoftware.com/fts/customer/product.php?productid=25

There's also a new add on coming from us for x-cart that tracks exactly where your sales are coming from with $$$$ values allocated to specific incoming links and unique visitor reports.

Our traffic monitor works on both your PHP shop and your HTML catalog.

Small tip, it's bad practise to put how many people are online on the front of your site unless you have a really busy site. Customers seeing "1 person on site" generally get the impression your site isn't very popular and serves little purpose to the customer.
__________________
Groovico

Used by X-carters the world over:
Marketing Manager Pro Bundle For X-cart
Featured Product Manager for X-cart
Feed manager pro for X-cart

http://www.firetanksoftware.com

Celebrating 7 Years of providing quality X-cart Add ons and X-cart Mods for x-cart 3.X to X-cart 4.4.X
Reply With Quote
  #3  
Old 03-19-2004, 09:47 AM
 
shirtshop shirtshop is offline
 

Senior Member
  
Join Date: Nov 2002
Posts: 127
 

Default

Thanks for the tip
Reply With Quote
  #4  
Old 03-19-2004, 09:56 AM
  Jon's Avatar 
Jon Jon is offline
 

X-Guru
  
Join Date: Oct 2002
Location: Vancouver, Canada
Posts: 4,200
 

Default

As much as I'd love you pay you $45.00, I'm not in need of a package with all this functionality.

I'd just like the Online Visitors total.

If you could provide code for this at a small price, I'd likely be willing to go for it. I imagine all the information needed is basically recorded somewhere in the x-cart system with advanced stats, just a matter of figuring out what info to pull.
Reply With Quote
  #5  
Old 03-19-2004, 12:00 PM
  CenturyPerf's Avatar 
CenturyPerf CenturyPerf is offline
 

eXpert
  
Join Date: Jun 2003
Location: Reno, Nevada
Posts: 396
 

Default

Groovico,

The way I understand his request in that he wants website VISITORS to be able to see who is online like what we have here in the forums (bottom of page). This type of script is used in most forum software, DNN, php-Nuke, etc.

Your mod is great for site administration, but not for what he wants.

I would suggest to Jon would be to copy the script from phpBB forums or one of the other programs that use it.

Read This: http://forums.devshed.com/showthread.php?threadid=21831&forumid=5
__________________
Best Regards,

Sam Solace - Pres/CEO
Century Performance Center, Inc.
http://www.centuryperformance.com

(3) sites using X-Cart 5.3.5.5
X-Payments Enterprise 3.1.4
Reply With Quote
  #6  
Old 03-19-2004, 12:25 PM
  groovico's Avatar 
groovico groovico is offline
 

X-Man
  
Join Date: Apr 2003
Location: Firetanksoftware.com
Posts: 2,326
 

Default

Century you're right about that, ours is entirely for administration and serious marketing purposes. I read the post that shirtshop wanted to see users online from his point of view not the customers, sorry if I misread that.

Jon, if all you want to do is show how many customers are online, there's a number of scripts out there that do that kind of stuff. Bear in mind though if you take the PHP code route, it won't take into account users on your HTML pages. Our add on doesn't actually use the x-cart data for it's online user figures or any of it's tracking data.
__________________
Groovico

Used by X-carters the world over:
Marketing Manager Pro Bundle For X-cart
Featured Product Manager for X-cart
Feed manager pro for X-cart

http://www.firetanksoftware.com

Celebrating 7 Years of providing quality X-cart Add ons and X-cart Mods for x-cart 3.X to X-cart 4.4.X
Reply With Quote
  #7  
Old 03-19-2004, 01:08 PM
  CenturyPerf's Avatar 
CenturyPerf CenturyPerf is offline
 

eXpert
  
Join Date: Jun 2003
Location: Reno, Nevada
Posts: 396
 

Default

I was reading between the lines a little bit after he balked at your product, taking a "guess" that he was wanting a more simple script.
__________________
Best Regards,

Sam Solace - Pres/CEO
Century Performance Center, Inc.
http://www.centuryperformance.com

(3) sites using X-Cart 5.3.5.5
X-Payments Enterprise 3.1.4
Reply With Quote
  #8  
Old 03-19-2004, 01:50 PM
 
PhilJ PhilJ is offline
 

X-Guru
  
Join Date: Nov 2002
Posts: 4,094
 

Default

here's one - http://www.faultysanity.com/coding_stuff.php
Reply With Quote
  #9  
Old 03-19-2004, 10:08 PM
  Jon's Avatar 
Jon Jon is offline
 

X-Guru
  
Join Date: Oct 2002
Location: Vancouver, Canada
Posts: 4,200
 

Default

There's lots of scripts out there right that do this, they are generally the same principle of writing an IP address to a database for a given period of time and removing them after a certain period of time.

Nothing difficult to setup.

What I'm wondering, is that with all the statistics that x-cart keeps track of, is it not possible to pull from current statistics to form the number?

I'm not sure exactly what stats are kept.

But with sessions stored in a mysql table, are non logged in users given a session? If they are, you could simply count the number only by counting the number of entries in the sessions table.
Reply With Quote
  #10  
Old 03-20-2004, 09:02 AM
  groovico's Avatar 
groovico groovico is offline
 

X-Man
  
Join Date: Apr 2003
Location: Firetanksoftware.com
Posts: 2,326
 

Default

X-cart uses three different ways of storing user sessions, it can store them in the mysql db, in filesystem, and also has a default option only called "other method", it's down to how you set your config up.

If you rely on x-cart sessions, anyone on your static catalog won't be counted in users online and you'll also be tied into the x-cart session time out too.

Only those on the php side of the cart that have actually started a session would be counted. You could have 10 users on the static HTML pages and only 1 user who used the search or added anything to the cart so it would show 1 user online instead of 11.

The catalog part would also constantly show "0 users online".

It's only an issue though if you rely on the static catalog for search engines traffic.

It's actually got me curious now, if we have a bit of time at firetank we'll see if we can code up something that works happily on all pages of the site.
__________________
Groovico

Used by X-carters the world over:
Marketing Manager Pro Bundle For X-cart
Featured Product Manager for X-cart
Feed manager pro for X-cart

http://www.firetanksoftware.com

Celebrating 7 Years of providing quality X-cart Add ons and X-cart Mods for x-cart 3.X to X-cart 4.4.X
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design



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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 02:34 AM.

   

 
X-Cart forums © 2001-2020