Code for users online...

Mike2

Baseband Member
Messages
49
Dave, its mike from LTI and 50megs,


On Matrix28.com you have a thing that says how many users are on this forum...

How did you do that?
 
Open Sources\Subs.pl and search for 1; and add:


sub printwhoisonline {
print "Content-type: text/html\n\n";
$guests = 0;
$users = '';
fopen(FILE, "$vardir/log.txt");
@entries = <FILE>;
fclose(FILE);
foreach $curentry (@entries) {
chomp $curentry;
($name, $value) = split(/\|/, $curentry);
if( $name ) {
&LoadUser($name);
if( exists $userprofile{$name} ) {
$users .= qq~ <a href="$scripturl?action=viewprofile&username=$useraccount{$name}">$userprofile{$name}->[1]</a><font size=1>,</font> \n~;
}
else { ++$guests; }
}
}
$users =~ s~<font size=1>,</font> \n\Z~~;
if ($INFO{'group'} eq "guests") { print "$guests"; }
if ($INFO{'group'} eq "users") { print "$users"; }
exit;
}
Before it.
Save and open YaBB.pl and search for
elsif ($action eq 'profile2') { require "$sourcedir/Profile.pl"; &ModifyProfile2; }
and add after:
elsif ($action eq 'printwhoisonline') { require "$sourcedir/Subs.pl"; &printwhoisonline($INFO{'group'}); }
and then

To add the welcome message:
<script src="http://www.yourdomain.com/YaBB.pl?action=welcome"></script>

To add the number of private messages the user has received:
<script src="http://www.yourdomain.com/YaBB.pl?action=welcome2"></script>

To add the number of guests:
<script src="http://www.yourdomain.com/YaBB.pl?action=printwhoisonline&group=guests"></script>

To add the users that are online:
<script src="http://www.yourdomain.com/YaBB.pl?action=printwhoisonline&group=users"></script>

To display the latest topics (original script by S.M.art.Y):
<script src="http://www.yourdomain.com/YaBB.pl?action=recent1&display=7"></script>
 
David Lindon said:
Mike, why did you change your username?

I was not cookied.

Thought we had to register again because you upgraded tyour fourm...
 
Back
Top Bottom