Jump to content
Sign in to follow this  
DJkikisa

Primitīvs online lietotāju scripts

Recommended Posts

<?php
/* Norādam ceļu uz galveno foruma mapi*/
require '../init.php';

$users = \IPS\Session\Store::i()->getOnlineUsers( 10, 'desc', NULL, NULL, TRUE );
$guests = \IPS\Session\Store::i()->getOnlineUsers( \IPS\Session\Store::ONLINE_GUESTS | \IPS\Session\Store::ONLINE_COUNT_ONLY, 'desc', NULL, NULL, TRUE );
$biedri = 0;

foreach( $users as $row ){?>
<p>
	<a href="<?php echo \IPS\Settings::i()->base_url.'profile/'.$row['member_id'].'-'.$row['seo_name'];?>">
		<img src="<?php echo \IPS\Member::load( $row['member_id'] )->get_photo();?>" width="25px">
			<?php echo $row['member_name'];?>
	</a>
	<br>

</p>
<?php $biedri++;} ?>
Kopā online: <?php echo $biedri;?> Biedri un <?php echo $guests;?> Viesi.

Demo : https://wam.lv/skripti/ipbonline.php

Edited by DJkikisa
Pievientos, ka izvada arī viesus.

Share this post


Link to post
Share on other sites
43 minutes ago, CMNTS said:

Forši, ka šādas lietas paliek vienkāršākas un īsāks kods jālieto.

Kā būtu, ja vajadzētu izvilkt status, kā pieņemsim http://prntscr.com/mg1heu un http://prntscr.com/mg1hk6 ?

To ir ērtāk un ātrāk izdarīt ir manuāli uzrakstot DB queries, nekā no IPB source koda izvilkt.
Bet nu rekur ir no IPB source koda izvelkot: 

 

Share this post


Link to post
Share on other sites
26 minutes ago, DJkikisa said:

To ir ērtāk un ātrāk izdarīt ir manuāli uzrakstot DB queries, nekā no IPB source koda izvilkt.
Bet nu rekur ir no IPB source koda izvelkot: 

 

Paldies, galīgi neieraudzīju šo postu "Skripti" sadaļā... Laikam acis beidzot pierē būs jāpaņem. 😶

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...