mamma* Posted January 16, 2009 Report Share Posted January 16, 2009 kā uztādīt šo scriptu?? šis ir tipa rāda webā ipb foruma online list.varbūt kāds var paskaidrot kā viņu uzstādīt? Tipa saliku kā vaig bet neiet <? /* * Marcis Kalnins * [email protected] */ /* ### Usage: include('class_ipb_online.php'); // include class to your script $online = new ipb_online; // step 1 - start the class # if you have database connection defined, continue to step 7 $online->db_host='localhost'; // step 2 - set the host of database, default is locahost $online->db_user='username'; // step 3 - set the username of database user $online->db_pass='password'; // step 4 - set the password of database user $online->db_name='forum'; // step 5 - set the name of database $online->db(); // step 6 - create database connection $error=false; // optional parameter to handle errors if($online->create_cache('ibf_')){ // step 7 - give table prefix to function and get all online users from database if($all=$online->get_all()){ // getting numbers of all users online and members online echo ' Online: '.$all->total.'<br /> Guests: '.$all->guests.'<br /> Members: '.$all->members.' '; if($members=$online->get_members('/forum/?showuser=',', ')){ // get all members online, give user url template and delimiter to function ', ' or '<br />' or anything you like :) echo $members; }else{ $error=true; } }else{ $error=true; } }else{ $error=true; } if($error==true){ echo 'We have no users online right now :('; } */ class ipb_online { var $db_host='localhost'; var $db_user; var $db_pass; var $db_name; private $data; function db(){ @mysql_connect($this->db_host,$this->db_user,$this->db_pass)or die(mysql_error()); @mysql_select_db($this->db_name)or die(mysql_error()); } function create_cache($prefix=''){ $sql="SELECT member_name, member_id, member_group FROM `".$prefix."sessions` ORDER BY running_time DESC"; $res=mysql_query($sql); if(@mysql_num_rows($res)<1){ return false; } while($row=mysql_fetch_assoc($res)){ $this->data[]=(object)$row; } return true; } function get_all(){ if(empty($this->data) || !is_array($this->data)){ return false; } $total=$members=$guests=0; foreach($this->data as $value){ ++$total; if(!empty($value->member_id)){ ++$members; }else{ ++$guests; } } return (object)array('total'=>$total,'members'=>$members,'guests'=>$guests); } function get_members($url='?showuser=',$glue=', '){ if(empty($this->data) || !is_array($this->data)){ return false; } $out=array(); foreach($this->data as $value){ if(empty($value->member_id)){ continue; } $out[]='<a href="'.$url.intval($value->member_id).'" class="group_'.$value->member_group.'">'.$value->member_name.'</a>'; } return implode($glue,$out); } } ?> Link to comment Share on other sites More sharing options...
X ID Posted January 16, 2009 Report Share Posted January 16, 2009 Es tev jau teicu @ php.lv foruma. Link to comment Share on other sites More sharing options...
mamma* Posted January 16, 2009 Author Report Share Posted January 16, 2009 (edited) loti ludzu nelielu pamacibu tos kur sakuma jasalirk tos es ok saprotu a pectam? Edited January 16, 2009 by mamma* Link to comment Share on other sites More sharing options...
X ID Posted January 16, 2009 Report Share Posted January 16, 2009 (edited) Pareizā pieeja būtu šāda: <? include('class_ipb_online.php'); $online = new ipb_online; $online->db_host='localhost'; $online->db_user='username'; $online->db_pass='password'; $online->db_name='forum'; $online->db(); $error=false; if($online->create_cache('ibf_')){ if($all=$online->get_all()){ echo ' Online: '.$all->total.'<br /> Guests: '.$all->guests.'<br /> Members: '.$all->members.' '; if($members=$online->get_members('/forum/?showuser=',', ')){ echo $members; }else{ $error=true; } }else{ $error=true; } }else{ $error=true; } if($error==true){ echo 'We have no users online right now :('; } ?> Edited January 16, 2009 by X ID Link to comment Share on other sites More sharing options...
mamma* Posted January 16, 2009 Author Report Share Posted January 16, 2009 Pa skyp negribi palidzet caur teamwiewer Link to comment Share on other sites More sharing options...
X ID Posted January 16, 2009 Report Share Posted January 16, 2009 Negribu gan. Link to comment Share on other sites More sharing options...
mamma* Posted January 16, 2009 Author Report Share Posted January 16, 2009 hmmm moš īsu video? Link to comment Share on other sites More sharing options...
Recommended Posts