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

Reply
 
Thread Tools Display Modes
  #1  
Old 07-12-2005, 03:06 AM
sketch42's Avatar
sketch42 sketch42 is offline
 
Join Date: May 2004
Location: Brooklyn, NY
Posts: 361
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Help with editing Tables

well basically i need help with this hack and the author has yet to provide answers for near a week both here and on his support forums on his site

basically what i need to do is modify this so when its ran it doesnt look for the prefix's in the database. his installation script never inserted prefixs

any help would be greatly appreciated.
TIA


PHP Code:
<?php

// ####################### SET PHP ENVIRONMENT ###########################
error_reporting(E_ALL & ~E_NOTICE);

// #################### DEFINE IMPORTANT CONSTANTS #######################
define('NO_REGISTER_GLOBALS'1);
define('THIS_SCRIPT''nutt_maintenance');

// ################### PRE-CACHE TEMPLATES AND DATA ######################
// get special phrase groups
$phrasegroups = array();

// get special data templates from the datastore
$specialtemplates = array();

// pre-cache templates used by all actions
$globaltemplates = array();

// pre-cache templates used by specific actions
$actiontemplates = array();

// ######################### REQUIRE BACK-END ############################
require_once('./nutt_global.php');
require_once(
'./includes/adminfunctions.php');

// get permissions to view eaccelerator config
// change 1 to your userid
if (!can_administer())
{
        
print_no_permission();
}

if (empty(
$_REQUEST['do']))
{
        
$_REQUEST['do'] = 'options';
}

if (
$_REQUEST['do'] == 'passkeys')
{
        
$users $DB_site->query("
                                SELECT userid, passkey, username, salt
                                FROM " 
TABLE_PREFIX "user
                                "
);
        
        while (
$user $DB_site->fetch_array($users))
        {
                if (empty(
$user['passkey']))
                {
                        if (
$_REQUEST['extra'] == 'show')
                        {
                                echo 
$user['username'] . '<br />';
                        }
                        else
                        {
                                
$passkey md5($user['username'].time().$user['salt']);
                                
$update $DB_site->query("
                                                UPDATE " 
TABLE_PREFIX "user
                                                SET passkey = '
$passkey'
                                                WHERE userid = 
$user[userid]
                                                "
);
                        }
                }
        }
        
        print(
"<a href=\"nutt_maintenance.php?do=options\">Done! Go back.</a><br />");
}

if (
$_REQUEST['do'] == 'deletethreads')
{
        
$threads $DB_site->query("
                                        SELECT * 
                                        FROM " 
TABLE_PREFIX "thread
                                        WHERE forumid = 
$vboptions[nutt_forumid]
                                        "
);
        while (
$thread $DB_site->fetch_array($threads))
        {
                
$DB_site->query("
                        DELETE
                        FROM " 
TABLE_PREFIX "thread
                        WHERE threadid = 
$thread[threadid]
                        "
);
                        
                
$DB_site->query("
                        DELETE
                        FROM " 
TABLE_PREFIX "post
                        WHERE threadid = 
$thread[threadid]
                        "
);
        }
        
        print(
"<a href=\"nutt_maintenance.php?do=options\">Done! Go back.</a><br />");
}

if (
$_REQUEST['do'] == 'makethreads')
{
        
$torrents $DB_site->query("
                                        SELECT * 
                                        FROM " 
TABLE_PREFIX "nutt_torrents
                                        WHERE threadid = ''
                                        "
);
        while (
$torrent $DB_site->fetch_array($torrents))
        {
                
$DB_site->query("
                        INSERT INTO " 
TABLE_PREFIX "thread(title, lastpost, forumid, open, replycount, postusername, postuserid, lastposter, dateline, visible, sticky)
                        VALUES (\"
$torrent[name]\", \"$torrent[added]\", $vboptions[nutt_forumid], 1, 0, \"$torrent[owner]\", $torrent[ownerid], \"$torrent[owner]\", \"$torrent[added]\",        1,        0)
                "
);
                
$threadid $DB_site->insert_id();
                
                
// Now add Post to thread
                
$message mysql_real_escape_string("[URL=".$vboptions['nutt_url']."/details.php?t=".$torrent['id']."]".$torrent['name']."[/URL]\n\r".$torrent['descr']);
        
                
$DB_site->query("
                        INSERT INTO " 
TABLE_PREFIX "post(threadid, parentid, title, username, userid, dateline, pagetext, allowsmilie, showsignature, ipaddress, iconid, visible, attach)
                        VALUES (
$threadid,        0,        \"$torrent[name]\", \"$torrent[owner]\", $torrent[ownerid], \"$torrent[added]\", \"$message\", 1,        1, '$_SERVER[REMOTE_ADDR]', 0, 1, 0)
                "
);
                
$postid $DB_site->insert_id();
                
                
$DB_site->query("
                        UPDATE " 
TABLE_PREFIX "thread
                        SET firstpostid = 
$postid
                        WHERE threadid = 
$threadid
                "
);
                
                
$DB_site->query("
                        UPDATE " 
TABLE_PREFIX "forum
                        SET threadcount = threadcount + 1,
                        replycount = replycount + 1
                        WHERE forumid = 
$vboptions[nutt_forumid]
                "
);
                
                
$DB_site->query("
                        UPDATE " 
TABLE_PREFIX "nutt_torrents
                        SET threadid = 
$threadid
                        WHERE id = 
$torrent[id]
                "
);
                
                
$DB_site->query("
                        UPDATE " 
TABLE_PREFIX "forum
                        SET lastpost = "
.time().",
                        lastposter = \"
$bbuserinfo[username]\",
                        lastthread = \"
$torrent\",
                        lastthreadid = 
$threadid,
                        threadcount = threadcount + 1,
                        replycount = replycount + 1
                        WHERE forumid = 
$forumid
                "
);
        }
        
        print(
"<a href=\"nutt_maintenance.php?do=options\">Done! Go back.</a><br />");
}

if (
$_REQUEST['do'] == 'comments')
{
        
$torrents $DB_site->query("
                                        SELECT * 
                                        FROM " 
TABLE_PREFIX "nutt_torrents
                                        WHERE comments = 0
                                        "
);
        while (
$torrent $DB_site->fetch_array($torrents))
        {
                unset(
$posts$comments$update);
                
                
$posts $DB_site->query_first("
                                        SELECT COUNT(*) as count
                                        FROM " 
TABLE_PREFIX "post
                                        WHERE threadid = 
$torrent[threadid]
                                        "
);
                
$comments $posts['count'] -1;
                
                
$update $DB_site->query("
                                        UPDATE " 
TABLE_PREFIX "nutt_torrents
                                        SET comments = 
$comments
                                        WHERE id = 
$torrent[id]
                                        "
);
        }
        
        print(
"<a href=\"nutt_maintenance.php?do=options\">Done! Go back.</a><br />");
}

if (
$_REQUEST['do'] == 'resettemp')
{
        
$update $DB_site->query("
                                        UPDATE " 
TABLE_PREFIX "user
                                        SET tempuploaded = '', tempdownloaded = '', tempreset = " 
time() . "
                                        WHERE tempuploaded > 0 OR tempdownloaded > 0
                                        "
);
        
        print(
"<a href=\"nutt_maintenance.php?do=options\">Done! Go back.</a><br />");
}

if (
$_REQUEST['do'] == 'resetpeers')
{
        
$update $DB_site->query("
                                        DELETE FROM " 
TABLE_PREFIX "nutt_peers
                                        "
);
        
        print(
"<a href=\"nutt_maintenance.php?do=options\">Done! Go back.</a><br />");
}

if (
$_REQUEST['do'] == 'resettorrentpeers')
{
        
$update $DB_site->query("
                                        UPDATE " 
TABLE_PREFIX "nutt_torrents
                                        SET seeders = 0, leechers = 0
                                        "
);
        
        print(
"<a href=\"nutt_maintenance.php?do=options\">Done! Go back.</a><br />");
}

if (
$_REQUEST['do'] == 'rehash')
{
        
}

if (
$_REQUEST['do'] == 'options')
{
        print(
'<center>');        
        print(
'NuTT Maintenace 0.1<br /><br />');
        print(
"<a href=\"nutt_maintenance.php?do=resetpeers\">Reset peers</a><br />");
        print(
"<a href=\"nutt_maintenance.php?do=resettorrentpeers\">Reset seeds/leechers</a><br />");
        print(
"<a href=\"nutt_maintenance.php?do=resettemp\">Reset temp stats</a><br />");
        print(
"<a href=\"nutt_maintenance.php?do=makethreads\">Make torrent threads</a><br />");
        print(
"<a href=\"nutt_maintenance.php?do=deletethreads\">Delete torrent threads</a><br />");
        print(
"<a href=\"nutt_maintenance.php?do=comments\">Update comment counts</a><br />");
        print(
"<a href=\"nutt_maintenance.php?do=rehash\">Rehash all torrents</a><br />");
        print(
"<a href=\"nutt_maintenance.php?do=passkeys\">Generate passkeys</a>");
        print(
'</center>');
}
?>
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 11:25 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.06607 seconds
  • Memory Usage 2,371KB
  • Queries Executed 11 (?)
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_php
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)post_thanks_box
  • (1)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit_info
  • (1)postbit
  • (1)postbit_onlinestatus
  • (1)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