PDA

View Full Version : Anyone Help


Dingo14
03-05-2009, 04:53 AM
I get this message at the top of forum when I click on a post anyone know what it might be thanks in advance

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in [path]/includes/plugins_usercountd.php on line 190

Also get this if I click a thread

Unable to add cookies, header already sent.
File: /home/badboys/public_html/forum/includes/class_core.php
Line: 3243

TigerC10
03-05-2009, 05:12 AM
plugins_usercountd.php is not a default vBulletin script - it belongs to one of your plugins. You should turn off that plugin and ask whoever wrote it to fix it.


That, or if you know how to program you should go to line 190 of that script and see why mysql_fetch_array() is failing. Either way, we can't help you without the source code.

Dingo14
03-05-2009, 05:25 AM
plugins_usercountd.php this is the php could you look at it thanks


<?php

/* ================================================== ==================== *\
|| ||
|| User Countdown AddOn for vBulletin ||
|| (c)2006 Michael "Hellcat" Hengstmann ||
|| hellcat@hellcat.net ||
|| -------------------------------------------------------------------- ||
|| You may use this script for free, but not redistribute ||
|| without giving the propper credits! ||
|| ||
\* ================================================== ==================== */

// \\
// ========== Script Version: 1.10 ========== \\
// \\

global $vbulletin, $permissions;

if ( $THIS_HOOK == "profile_fetch_profilefields" )
{
if ( ( $profilefield["title"] == "User Countdown" ) AND ( $permissions["hc_usercountdown"] & $vbulletin->bf_ugp["hc_usercountdown"]["canusecountdown"] ) )
{
$profilefield["type"] = "";

$cdsettings = unserialize( str_replace( "&quot;", '"', $vbulletin->userinfo[$profilefieldname] ) );
$oprofilefieldtitle = $profilefield["title"];
$oprofilefieldname = $profilefieldname;
$oprofilefielddescription = $profilefield["description"];

$radiobits = "";
$options = array( "Yes" => $vbphrase["countdown_on"], "No" => $vbphrase["countdown_off"] );
$profilefield[title] = $vbphrase["countdown_enable"];
$profilefield[description] = $vbphrase["countdown_enable_desc"];
$profilefieldname = $oprofilefieldname . "_enable";
foreach ($options AS $vkey => $option)
{
$key = $vkey;
$val = $option;

if ( $key == $cdsettings["enabled"] ) { $checked = 'checked = "checked"'; } else { $checked = ""; }

eval('$radiobits .= "' . fetch_template('userfield_radio_option') . '";');
}
eval('$radio_enable = "' . fetch_template('userfield_radio') . '";');

$selectbits = "";
$profilefield["title"] = $vbphrase["day"];
$profilefield["description"] = "";
$profilefieldname = $oprofilefieldname . "_day";
for ( $i = 1; $i <= 31; $i++ )
{
$key = trim( strval( $i ) );
$val = $key;

if ( $val == $cdsettings["day"] ) { $selected = "selected"; } else { $selected = ""; }

eval('$selectbits .= "' . fetch_template('userfield_select_option') . '";');
}
eval('$dayselect = "' . fetch_template('userfield_select') . '";');

$selectbits = "";
$profilefield["title"] = $vbphrase["month"];
$profilefield["description"] = "";
$profilefieldname = $oprofilefieldname . "_month";
for ( $i = 1; $i <= 12; $i++ )
{
$key = trim( strval( $i ) );
$val = $key;

if ( $val == $cdsettings["month"] ) { $selected = "selected"; } else { $selected = ""; }

eval('$selectbits .= "' . fetch_template('userfield_select_option') . '";');
}
eval('$monthselect = "' . fetch_template('userfield_select') . '";');

$selectbits = "";
$profilefield["title"] = $vbphrase["year"];
$profilefield["description"] = "";
$profilefieldname = $oprofilefieldname . "_year";
for ( $i = date("Y"); $i <= 2020; $i++ )
{
$key = trim( strval( $i ) );
$val = $key;

if ( $val == $cdsettings["year"] ) { $selected = "selected"; } else { $selected = ""; }

eval('$selectbits .= "' . fetch_template('userfield_select_option') . '";');
}
eval('$yearselect = "' . fetch_template('userfield_select') . '";');

$selectbits = "";
$profilefield["title"] = $vbphrase["countdown_hour"];
$profilefield["description"] = "";
$profilefieldname = $oprofilefieldname . "_hour";
for ( $i = 0; $i <= 23; $i++ )
{
$key = trim( strval( $i ) );
$val = $key;

if ( $val == $cdsettings["hour"] ) { $selected = "selected"; } else { $selected = ""; }

eval('$selectbits .= "' . fetch_template('userfield_select_option') . '";');
}
eval('$hourselect = "' . fetch_template('userfield_select') . '";');

$selectbits = "";
$profilefield["title"] = $vbphrase["countdown_minute"];
$profilefield["description"] = "";
$profilefieldname = $oprofilefieldname . "_minute";
for ( $i = 0; $i <= 59; $i++ )
{
$key = trim( strval( $i ) );
$val = $key;

if ( $val == $cdsettings["minute"] ) { $selected = "selected"; } else { $selected = ""; }

eval('$selectbits .= "' . fetch_template('userfield_select_option') . '";');
}
eval('$minuteselect = "' . fetch_template('userfield_select') . '";');

$profilefield["title"] = $vbphrase["countdown_event"];
$profilefield["description"] = $vbphrase["countdown_event_desc"];
$profilefieldname = $oprofilefieldname . "_event";
$bbuserinfo[$profilefieldname] = $cdsettings["event"];
$profilefield["size"] = "48";
$profilefield["maxlength"] = "128";
eval('$text_event = "' . fetch_template('userfield_textbox') . '";');
$text_event = str_replace( 'value=""', 'value="' . $cdsettings["event"] . '"', $text_event );

$profilefield["title"] = $vbphrase["countdown_overmsg"];
$profilefield["description"] = $vbphrase["countdown_overmsg_desc"];
$profilefieldname = $oprofilefieldname . "_overmsg";
$bbuserinfo[$profilefieldname] = $cdsettings["overmsg"];
$profilefield["size"] = "48";
$profilefield["maxlength"] = "128";
eval('$text_overmsg = "' . fetch_template('userfield_textbox') . '";');
$text_overmsg = str_replace( 'value=""', 'value="' . $cdsettings["overmsg"] . '"', $text_overmsg );

$profilefield["title"] = $vbphrase["countdown_title"];
$profilefieldname = $oprofilefieldname;
$profilefield["description"] = $vbphrase["countdown_desc"];

$wrapper_template = 'userfield_countdown';
$fields = array('radio_enable', 'text_event', 'text_overmsg', 'dayselect', 'monthselect', 'yearselect', 'hourselect', 'minuteselect');

foreach ($fields AS $field)
{
$$field = str_replace('userfield', 'cdsettings', $$field);
} } if ( ( $profilefield["title"] == "User Countdown" ) AND !( $permissions["hc_usercountdown"] & $vbulletin->bf_ugp["hc_usercountdown"]["canusecountdown"] ) ) {
$profilefield["type"] = "";
$tempcustom = "";
}
}

// ************************************************** ******************** \\

if ( ( $THIS_HOOK == "profile_updateoptions" ) AND ( $permissions["hc_usercountdown"] & $vbulletin->bf_ugp["hc_usercountdown"]["canusecountdown"] ) )
{
$vbulletin->input->clean_array_gpc('p', array( "countdownuserfield" => TYPE_STR,
"cdsettings" => TYPE_ARRAY ));

$cdsettings = $vbulletin->GPC["cdsettings"];
$cdprofilefield = $vbulletin->GPC["countdownuserfield"];

$cddata["enabled"] = $cdsettings[$cdprofilefield . "_enable"];
$cddata["day"] = $cdsettings[$cdprofilefield . "_day"];
$cddata["month"] = $cdsettings[$cdprofilefield . "_month"];
$cddata["year"] = $cdsettings[$cdprofilefield . "_year"];
$cddata["hour"] = $cdsettings[$cdprofilefield . "_hour"];
$cddata["minute"] = $cdsettings[$cdprofilefield . "_minute"];
$cddata["event"] = $cdsettings[$cdprofilefield . "_event"];
$cddata["overmsg"] = $cdsettings[$cdprofilefield . "_overmsg"];

$vbuserfields[$cdprofilefield] = serialize( $cddata );
$vbuserfields[$cdprofilefield . "_set"] = "1";
$vbuserfields[$cdprofilefield . "_opt"] = "";

$userdata->set_userfields( $vbuserfields );
}

// ************************************************** ******************** \\

if ( $THIS_HOOK == "postbit_display_complete" )
{
if ( strlen($post["signature"]) > 0 )
{
$cdfield = "field" . $vbulletin->options["countdownfield"];
$query = $vbulletin->db->query_read( "SELECT $cdfield FROM " . TABLE_PREFIX . "userfield WHERE userid='" . $post["userid"] . "';" );
$result = mysql_fetch_array( $query );

$cddata = unserialize( str_replace( "&quot;", '"', $result[$cdfield] ) );

if ( $cddata["enabled"] == "Yes" )
{
require_once( "./includes/class_bbcode.php" );
require_once( "./includes/functions_newpost.php" );
$vbulletin->cdbbcode_parse =& new vB_BbCodeParser($vbulletin, fetch_tag_list());

$eta = mktime ( intval( $cddata["hour"] ), intval( $cddata["minute"] ), 0, intval( $cddata["month"] ), intval( $cddata["day"] ), intval( $cddata["year"] ) );
$tremain = $eta - time();
if ( $tremain > 0 )
{
$t = $tremain;
$remain["days"] = intval ( $t / 86400 );
$t = $t - ( $remain["days"] * 86400 );
$remain["hours"] = intval ( $t / 3600 );
$t = $t - ( $remain["hours"] * 3600 );
$remain["minutes"] = intval ( $t / 60 );

$counter = $remain["minutes"] . $vbphrase["countdown_minutes"];

if ( ( $remain["hours"] != 0 ) OR ( $remain["days"] != 0 ) )
{
$counter = $remain["hours"] . $vbphrase["countdown_hours"] . " " . $counter;
}

if ( $remain["days"] != 0 )
{
$counter = $remain["days"] . $vbphrase["countdown_days"] . " " . $counter;
}
} else {
$counter = $vbulletin->cdbbcode_parse->parse(convert_url_to_bbcode($cddata["overmsg"]), 'nonforum');
}
$event = $vbulletin->cdbbcode_parse->parse(convert_url_to_bbcode($cddata["event"]), 'nonforum');

eval('$counterhtml = "' . fetch_template('usercountdown_display') . '";');

$sig = $post['signature'] . $counterhtml;
$post['signature'] = $sig;
}
}
}


?>

Lynne
03-05-2009, 02:57 PM
You need to post for help with the plugin in the modification thread.

TigerC10
03-05-2009, 10:46 PM
You need to post for help with the plugin in the modification thread.

Hellcat hasn't logged in for like 2 years... It won't do any good.



@Dingo14, here's the problem...


$query = $vbulletin->db->query_read( "SELECT $cdfield FROM " . TABLE_PREFIX . "userfield WHERE userid='" . $post["userid"] . "';" );
$result = mysql_fetch_array( $query );


Change that code in the php file to...


$query = $vbulletin->db->query_read( "SELECT $cdfield FROM " . TABLE_PREFIX . "userfield WHERE userid='" . $post["userid"] . "';" );
if( !empty($query) ) { $result = mysql_fetch_array( $query ); }

Lynne
03-06-2009, 12:57 AM
Hellcat hasn't logged in for like 2 years... It won't do any good.
In many modification threads, other users will help out. So, one should first post in the modification thread for help - or read the modification thread to see if the issue has already been brought up and a fix posted.

Dingo14
03-06-2009, 06:58 AM
sorry Lynne wasn't sure where to put this will be more careful in future

and thanks TigerC10 for all the help