Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 General Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 12-11-2007, 06:44 PM
EuroPk EuroPk is offline
 
Join Date: Feb 2007
Posts: 34
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Need Help With This.

Ok Basically... I Made this Plugin to Read outta MYSQL data to post on the main site forums.php





$database = mysql_connect ('localhost','ihpk_xx' ,'xxxx');

mysql_select_db ('ihpk_ihpk', $database );

$SelectString = "SELECT * FROM pklog ORDER by id DESC";

$pkliste_result = mysql_query($SelectString);

$pkliste = mysql_fetch_array ( $pkliste_result);



$groupidfetch_result = mysql_query(sprintf("SELECT * FROM user WHERE username = '%s'", $pkliste['killer']));



$groupidfetch = mysql_fetch_array ( $groupidfetch_result );

$UserGroupID = $groupidfetch['usergroupid'];

$tagfetch_result = mysql_query("SELECT * FROM usergroup WHERE usergroupid = ".$UserGroupID);



$tagfetch = mysql_fetch_array( $tagfetch_result);

$killer = $tagfetch['opentag']. $pkliste['killer'] . "</b></font>";



$lastpk="<a href=pklog.php><center><font color=red><b><u>Our Last Victim</b></u></center></font></a><br>".$pkliste['o_name']. " a Level ".$pkliste['o_level']." ". $pkliste['o_typ'] ." was slain by <a href=pklog.php?viewname=".$pkliste['killer'].">".$killer."</a> on <a href=pklog.php?realm=" . $pkliste['realm'] . ">".$pkliste['realm']. "</a> at <a href=pklog.php?sort=time>". $pkliste['zeit'] . "</a>";









Now if my memory serves me right..





This is the Template / Plugin i've made for my clan's TopList





-

*/



// ####################### SET PHP ENVIRONMENT ###########################

error_reporting(E_ALL & ~E_NOTICE);



// #################### DEFINE IMPORTANT CONSTANTS #######################

define('THIS_SCRIPT', 'Toplist');





// ######################### REQUIRE BACK-END ############################

require_once('./global.php');

require_once(DIR . '/includes/functions_misc.php');

require_once(DIR . '/includes/class_postbit.php');

include(DIR . '/includes/config.php');

// ################################################## #####################

// ######################## START MAIN SCRIPT ############################

// ################################################## #####################





// build navbar

$navbits = array('' => $vbphrase['Toplist']);

$templatename = 'Toplist';

// Connecting to MYSQL Database

$database = mysql_connect ( $config['MasterServer']['servername'] ,$config['MasterServer']['username'] ,$config['MasterServer']['password']);

mysql_select_db ( $config['Database']['dbname'], $database );



function GetTotalPKs($forumname) {

$pkliste_result = mysql_query("SELECT * FROM pklog WHERE killer='$forumname'");

$i=0;

while ( $pkliste = mysql_fetch_array ( $pkliste_result) )

$i=$i + 1;

return $i;

}



function GetTotalScore($forumname) {

$pkliste_result = mysql_query("SELECT * FROM pklog WHERE killer='$forumname'");

$i=0;

while ( $pkliste = mysql_fetch_array ( $pkliste_result) )

$i = $i + $pkliste[o_level] * 6;

return $i;

}



$SelectString = 'SELECT SUM(o_level) AS Summe, SUM(Points) AS points, killer FROM pklog GROUP BY killer ORDER BY Summe DESC';

$SelectString ='SELECT SUM( o_level ) AS Summe, SUM( Points ) AS Points,

MAX( o_level ) AS high, zeit AS time1, killer FROM pklog GROUP BY killer ORDER BY Summe DESC';



$pklog_result = mysql_query($SelectString);



// Building Table

$toplist = '<table class="tborder" border="0" width="100%" align="center">

<tr align="center">

<td class="thead">#</td>

<td class="thead">Name</td>

<td class="thead">Score</td>

<td class="thead">PK Points</td>

<td class="thead">Total PKs</td>

<td class="thead">Average PK Level</td>

<td class="thead">Highest PK</td>

<td class="thead">Latest PK</td>



</tr>';

while ( $pkliste = mysql_fetch_array ( $pklog_result ) ) {

if($pkliste['killer'][0]!='*') {

$i++;

$score = GetTotalScore($pkliste['killer']);

$kills = GetTotalPKs($pkliste['killer']);

$average = round(($score/6)/$kills,2);

$points = $pkliste[Points];

$killer = GetMemberTagByName($pkliste['killer']) . $pkliste['killer'] ."</font>";

$high = $pkliste[high];

// $timeago = TimeAgo(strtotime($pkliste['time1']));

$timeago = $pkliste['time1'];

$toplist = $toplist . '<tr>

<td align="center" class="alt1" NOWRAP>'.$i.'</td>

<td align="center" class="alt1" NOWRAP><a href=pklog.php?viewname='.$pkliste['killer'].'>'.$killer.'</a></td>

<td align="center" class="alt1" NOWRAP>'.$score.'</td>

<td align="center" class="alt1" NOWRAP>'.$points.'</td>

<td align="center" class="alt1" NOWRAP>'.$kills.'</td>

<td align="center" class="alt1" NOWRAP>'.$average.' </td>

<td align="center" class="alt1" NOWRAP>'.$high.' </td>

<td align="center" class="alt1" NOWRAP>'.$timeago.' </td>

</tr>';

}

}

$toplist = $toplist. "</table>";



if ($templatename != '')

{

$navbits[''] = 'Toplist';

$navbits = construct_navbits($navbits);

eval('$navbar = "' . fetch_template('navbar') . '";');

eval('print_output("' . fetch_template($templatename) . '");');

}







?>





What i wanna do is in the Postbit templates or posts





I'd Like a Box Like this to show up.



If anyone has any pointers let me know please.




Reply With Quote
  #2  
Old 12-11-2007, 06:49 PM
EuroPk EuroPk is offline
 
Join Date: Feb 2007
Posts: 34
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

This is what i want to happen but i dont know how to do it.
Reply With Quote
  #3  
Old 12-12-2007, 08:23 PM
EuroPk EuroPk is offline
 
Join Date: Feb 2007
Posts: 34
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Can anyone actually help me with this , i put it in the wrong place the other day lol.
Reply With Quote
Reply


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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 04:21 AM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.03836 seconds
  • Memory Usage 2,196KB
  • Queries Executed 13 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (3)post_thanks_box
  • (3)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (3)post_thanks_postbit_info
  • (3)postbit
  • (3)postbit_onlinestatus
  • (3)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete