Search the Community
Showing results for tags 'php'.
Found 6 results
-
IPB 4. izmanto jauku funkciju ar kuras palīdzību varam izvilkt ārpus IPB foruma vai lietotājs ir ienācis foruma profilā. Viņu izmantot ir ļoti elementāri, viss kas jāizdara ir : <?php /* Norādam ceļu uz galvano foruma mapi*/ require $_SERVER['DOCUMENT_ROOT'].'/init.php'; /* Uzsākam sesiju lai pārbaudītu, kas ir ienācis profilā */ \IPS\Session\Front::i(); if(\IPS\Member::loggedIn()->member_group_id == 2){ echo 'Tu esi viesis'; }else{ ?> <img src="<?php echo \IPS\Member::load(\IPS\Member::loggedIn()->member_id )->get_photo();?>"> <p>Profila vārds : <?php echo \IPS\Member::loggedIn()->name;?> <p>Profila vārds SEO vārds: <?php echo \IPS\Member::loggedIn()->members_seo_name;?> <p>Profila lietotāja id: <?php echo \IPS\Member::loggedIn()->member_id;?> <p>Profila lietotāja grupas id: <?php echo \IPS\Member::loggedIn()->member_group_id;?> <p>Profila lietotāja warn līmenis: <?php echo \IPS\Member::loggedIn()->warn_level;?> <p>Profila lietotāja grupas vizualizāciju: <?php echo \IPS\Member::loggedIn()->group['prefix'];?> Grupa <?php echo \IPS\Member::loggedIn()->group['suffix'];?> <p><?php /* Noskaidrojam vai lietotajs ir Administrators */ if(\IPS\Member::loggedIn()->isAdmin()){ echo 'Tu esi administrātors'; }else{ echo 'Tu neesi administrators'; }?> <p><?php /* Noskaidrojam vai lietotajs ir Moderātors */ if(\IPS\Member::loggedIn()->modPermission()){ echo 'Tu esi Mods'; }else{ echo 'Tu neesi Mods'; }?> </p> <?php } ?> Cik testēju ir iespējams izvilkt jebko no: core_members db tabulas. Vēl ja nav ir jāizveido constants.php fails iekš galvenās foruma mapes un jāpievieno:(Izcelts dēļ analfabētiem) define( 'COOKIE_PATH', '/' ); Lai šis strādātu pa visu mājaslapu ārpus foruma mapes. Demo ar izvadīto informāciju: https://wam.lv/skripti/ipbsso.php Uzlabotā versija: https://wam.lv/topic/74-izmantojam-ipb-single-sign-onsso-un-izveidojam-lietotāja-paneli-mājaslapā/?tab=comments#comment-360
-
<?php /* Norādam ceļu uz galveno foruma mapi*/ require $_SERVER['DOCUMENT_ROOT'].'/init.php'; $news_id = 2; /* Noregulējam no kura foruma sadaļas izvilkt jaunumus */ $limit = 5; /* Noregulējam cik jaunumus izvada */ $news = \IPS\Db::i()->select( '*', 'forums_topics',[ 'forum_id=?', $news_id , 'topic_hiddenposts' ,0],'tid desc', $limit ); $news = $news->join( 'forums_posts', 'forums_posts.pid=forums_topics.topic_firstpost', 'LEFT' ); foreach( $news as $row ) { $news_link_fix = str_replace("<___base_url___>", rtrim(\IPS\Settings::i()->base_url,"/"), $row['post']); ?> <h1><a href="<?php echo\IPS\Settings::i()->base_url.'topic/'.$row['tid'].'-'.$row['title_seo'];?>"><?php echo $row['title'];?></a></h1> <h4>Tēmu uzsāka : <img src="<?php echo \IPS\Member::load( $row['author_id'] )->get_photo();?>" width="25px"> <a href="<?php echo\IPS\Settings::i()->base_url.'profile/'.$row['author_id'].'-'.$row['author_name'];?>"><?php echo $row['author_name'] ;?></a> - šādā laikā: <?php echo date("Y-m-d H:i:s",$row['post_date']);?> - tēma ir saņemusi <?php echo $row['posts'] ;?> ierakstus un <?php echo $row['views'] ;?> skatījumus. </h4> <?php echo $news_link_fix; ?> <h6>Pēdējo komentāru veica: <img src="<?php echo \IPS\Member::load( $row['last_poster_id'] )->get_photo();?>" width="25px"> <a href="<?php echo\IPS\Settings::i()->base_url.'profile/'.$row['last_poster_id'].'-'.$row['last_poster_name'];?>"><?php echo $row['last_poster_name'] ;?></a> - šādā laikā: <?php echo date("Y-m-d H:i:s",$row['last_real_post']);?> </h6> <?php } ?> Demo: https://wam.lv/skripti/ipbnews.php
-
<?php /* Norādam ceļu uz galveno foruma mapi*/ require $_SERVER['DOCUMENT_ROOT'].'/init.php'; $limit = 5; /* Noregulējam cik tēmas izvada */ $topics = \IPS\Db::i()->select( '*', 'forums_topics',NULL,'tid desc', $limit ); foreach( $topics as $row ) {?> <p><a href="<?php echo\IPS\Settings::i()->base_url.'topic/'.$row['tid'].'-'.$row['title_seo'];?>"><?php echo $row['title'] ;?></a> <p>Tēmu uzsāka:<img src="<?php echo \IPS\Member::load( $row['starter_id'] )->get_photo();?>" width="25px"> <a href="<?php echo\IPS\Settings::i()->base_url.'profile/'.$row['starter_id'].'-'.$row['starter_name'];?>"><?php echo $row['starter_name'] ;?></a> <p>Pēdejo postu veica: <img src="<?php echo \IPS\Member::load( $row['last_poster_id'] )->get_photo();?>" width="25px"> <a href="<?php echo\IPS\Settings::i()->base_url.'profile/'.$row['last_poster_id'].'-'.$row['last_poster_name'];?>"><?php echo $row['last_poster_name'] ;?></a> <p>Tēmas skatijumi : <?php echo $row['views'] ;?> <p>Ieraksti tēmā : <?php echo $row['posts'] ;?> <p>Uzsākšanas datums: <?php echo date("Y-m-d H:i:s",$row['start_date']);?> </p> <?php } ?> Demo: https://wam.lv/skripti/ipblasttopics.php
-
<?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
-
<?php /* Norādam ceļu uz galveno foruma mapi*/ require $_SERVER['DOCUMENT_ROOT'].'/init.php'; $total_posts = \IPS\Db::i()->select( "COUNT(*)", 'forums_posts' )->first(); $total_topics = \IPS\Db::i()->select( "COUNT(*)", 'forums_topics' )->first(); $mostOnline = json_decode( \IPS\Settings::i()->most_online, TRUE ); $member_count = \IPS\Db::i()->select( 'COUNT(*)', 'core_members' )->first(); ?> <p>Forumā kopā ieraksti: <?php echo $total_posts;?> <p>Forumā kopā tēmas: <?php echo $total_topics;?> <p>Visvairāk cilvēku forumā vienlaicīgi: <?php echo $mostOnline['count'];?> šajā laikā <?php echo date("Y-m-d H:i:s",$mostOnline['time']);?> <p>Forumā kopā reģistrējušies: <?php echo $member_count;?> </p> Demo: https://wam.lv/skripti/ipbstats.php
-
<?php define( "STEAM_GID" , "WAMLV" );/* Ievadi savu steam grupas id. Piemērs: Pilnais grupas links: https://steamcommunity.com/groups/WAMLV ievadi daļu aiz /groups/ */ $url = "https://steamcommunity.com/groups/".STEAM_GID."/memberslistxml?xml=1"; $xml = simplexml_load_file($url); $memberscount = $xml->memberCount; $name = $xml->groupDetails->groupName; $summary = $xml->groupDetails->summary; $avatarI = $xml->groupDetails->avatarIcon; $avatarM = $xml->groupDetails->avatarMedium; $avatarF = $xml->groupDetails->avatarFull; $membersingame = $xml->groupDetails->membersInGame; $membersonline = $xml->groupDetails->membersOnline; $membersinchat = $xml->groupDetails->membersInChat; ?> <h2> Mūsu steam grupa - <?=$name;?></h2> <p><img src="<?= $avatarI;?>"> <img src="<?= $avatarM;?>"> <img src="<?= $avatarF;?>"> <p>Grupas apraksts : <?=$summary;?> <p>Biedri kopā: <?=$memberscount;?> <p>Biedri čatā: <?=$membersinchat;?> <p>Biedri iekš spēles : <?=$membersingame;?> <p>Biedri online: <?=$membersonline;?> <p><a href="https://steamcommunity.com/groups/<?= STEAM_GID;?>">Pievienojies mūsu steam grupai</a> Live piemērs: https://wam.lv/skripti/steam.php