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

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 07-29-2005, 07:10 PM
derekivey derekivey is offline
 
Join Date: Apr 2005
Location: Pennsylvania, USA
Posts: 1,186
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default How can I make this php code into a plugin?

Hi,

I was wondering how I can make this code into a plugin:

PHP Code:
mysql_connect("localhost","username","password");
mysql_select_db("traffic_traffic");

$ts_number_of_users "SELECT * FROM users";
$ts_number_of_userss mysql_query($ts_number_of_users);
$ts_number_of_users_reg mysql_num_rows($ts_number_of_userss);

$credits 0;
while(
$sr mysql_fetch_array($ts_number_of_userss)) {
    
$credits $credits+$sr['credits'];
}

$new_user "SELECT username FROM users ORDER BY id DESC LIMIT 1";
$new_userr mysql_query($new_user);
$new_userrr mysql_fetch_row($new_userr); 
I tried creating it in the plugin manager with the hook location being forumhome_start but I get sql errors on my forum:

Quote:
Originally Posted by Error1
Database error in vBulletin 3.5.0 Release Candidate 1:

Invalid SQL:

SELECT
user.username, (user.options & 512) AS invisible, user.usergroupid,
session.userid, session.inforum, session.lastactivity,
IF(displaygroupid=0, user.usergroupid, displaygroupid) AS displaygroupid
FROM session AS session
LEFT JOIN user AS user ON(user.userid = session.userid)
WHERE session.lastactivity > 1122666824
ORDER BY username ASC;

MySQL Error : Table 'traffic_traffic.session' doesn't exist
Error Number : 1146
Date : Friday, July 29th 2005 @ 04:08:45 PM
Script : http://192.168.1.25/vbtest/index.php
Referrer : http://192.168.1.25/vbtest/index.php?
IP Address : 192.168.1.20
Username : Derek
Classname : vb_database
and also:

Quote:
Originally Posted by Error2
Database error in vBulletin 3.5.0 Release Candidate 1:

Invalid SQL:

UPDATE session
SET lastactivity = 1122667724, location = '/vbtest/index.php', inforum = 0, inthread = 0, incalendar = 0, badlocation = 0, bypass = 0
WHERE sessionhash = '57f30c4294a9a53452c0f3de55df0c00';

MySQL Error : Table 'traffic_traffic.session' doesn't exist
Error Number : 1146
Date : Friday, July 29th 2005 @ 04:08:48 PM
Script : http://192.168.1.25/vbtest/index.php
Referrer : http://192.168.1.25/vbtest/index.php?
IP Address : 192.168.1.20
Username : Derek
Classname : vb_database
The code for the template is:

Code:
<!-- TrafficSurfer Stats --> 
<tbody> 
        <tr> 
                <td class="thead" colspan="2">
			<a style="float:$stylevar[right]" href="#top" onclick="return toggle_collapse('forumhome_trafficsurfer')"><img id="collapseimg_forumhome_stats" src="$stylevar[imgdir_button]/collapse_thead$vbcollapse[collapseimg_forumhome_stats].gif" alt="" border="0" /></a> 
                        TrafficSurfer Stats: 
                </td> 
        </tr> 
</tbody> 
<tbody id="collapseobj_forumhome_trafficsurfer" style="$vbcollapse[collapseobj_forumhome_todayusers]"> 
        <tr> 
                <td class="alt2"><img src="$stylevar[imgdir_misc]/stats.gif" alt="<phrase 1="$vboptions[bbtitle]">$vbphrase[x_statistics]</phrase>" border="0" /></td> 
                <td class="alt1" width="100%"><div class="smallfont"> 
               Number of users Preregisterred: $ts_number_of_users_reg, Total Credits Given Out: $credits, Newest User: $new_userrr[0]
                </div></td> 
        </tr> 
</tbody> 
<!-- / TrafficSurfer Stats -->
Any ideas?

Thanks,
Derek
Reply With Quote
 


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 09:38 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.03764 seconds
  • Memory Usage 2,370KB
  • 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)bbcode_code
  • (1)bbcode_php
  • (2)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (5)post_thanks_box
  • (5)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (5)post_thanks_postbit_info
  • (5)postbit
  • (5)postbit_onlinestatus
  • (5)postbit_wrapper
  • (1)showthread_list
  • (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_threadedmode.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • 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_threaded
  • showthread_threaded_construct_link
  • 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