vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   Member Archives (https://vborg.vbsupport.ru/forumdisplay.php?f=202)
-   -   Quick Help (https://vborg.vbsupport.ru/showthread.php?t=43820)

Bloodfist 09-22-2002 05:31 PM

Quick Help
 
Alright, I think this should be pretty easy for you PHP gurus. On my forum, I have the Karma hack installed.

The problem is guests. All I need to know is how to alter this code to not display error messages like this at the top of the page where a thread contains posts from guests:

Code:

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/worldof/public_html/forums/admin/functions.php on line 182

Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result resource in /home/worldof/public_html/forums/admin/functions.php on line 186

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/worldof/public_html/forums/admin/functions.php on line 197

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/worldof/public_html/forums/admin/functions.php on line 200

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/worldof/public_html/forums/admin/functions.php on line 226

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/worldof/public_html/forums/admin/functions.php on line 182

Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result resource in /home/worldof/public_html/forums/admin/functions.php on line 186

This is this code in admin/functions.php
PHP Code:

//Karma
                            
$gettotalpoint=mysql_query("SELECT newthread, reply, view, admin_mod, morereply, totalpenalty, date, redeem_points from storepoint where uid=$post[userid]");
                            
$numrows_gettotal mysql_num_rows($gettotalpoint);

                            if (
$numrows_gettotal '0' || $numrows_gettotal != '0' || $numrows_gettotal != ''
                            {
                                list (
$newthread$reply$view$admin_mod$morereply$totalpenalty$date$redeem_points) = mysql_fetch_row($gettotalpoint);
                            }

                            
$gettotalpoint1=mysql_query("SELECT agreepoint, dispoint, imaword from point");
                            
$numrows_gettotal1 mysql_num_rows($gettotalpoint1);
                            if (
$numrows_gettotal1 0
                            {
                                list (
$agreepoint$dispoint$imaword) = mysql_fetch_row($gettotalpoint1);
                            }

                            
$getagree=mysql_query("SELECT * from adis where post_userid=$post[userid] and adis='a'");
                            
$numrows_getagree mysql_num_rows($getagree);
    
                            
$getdis=mysql_query("SELECT * from adis where post_userid=$post[userid] and adis='d'");
                            
$numrows_getdis mysql_num_rows($getdis);
    
                            
$adisagree = ($agreepoint) * ($numrows_getagree);
                            
$adisdis = ($dispoint) * ($numrows_getdis);
                            
$newadis = ($adisagree) + ($adisdis);
    
                            
$post[totalpoint] = (($newthread) + ($reply) + ($view) + ($admin_mod) + ($morereply) + ($newadis)) - ($redeem_points);
                            
$possible_total = ($newthread) + ($reply) + ($view) + ($admin_mod) + ($morereply) + ($newadis) + ($redeem_points);

                            if (
$possible_total == '0'
                            {
                                
$coverage "0";
                                
$coverage $coverage '%';
                                
$post[totalpoint] = "0";
                                
$possible_total "0";
                            }
                            else
                            {
                                
$coverage = ($post[totalpoint]/$possible_total) * 100;
                                
$coverage $coverage '%';
                            }
    
                           
//Checking Karma
                           
if ($bbuserinfo[userid] != $post[userid]) 
                           {
                                
$getkarma mysql_query("SELECT * FROM adis WHERE userid = $bbuserinfo[userid] AND post_userid = $post[userid] AND postid = $post[postid]");
                                
$resultkarma mysql_num_rows($getkarma);

                                if (
$resultkarma == 0
                                {
                                    
$post[flag] = 0;
                                }
                                else
                                {
                                    
$post[flag] = 1;
                                }
                            }
                            
//choose image/word/progress bar
                            
if ($imaword == '0'
                            {     
                                
$check_posneg substr($post[totalpoint], 01);
                                if (
$check_posneg != '-' && $post[totalpoint] != '0'
                                {
                                    
$post[imaword] = "<a href=\"java script:void(0);\" onclick=\"java script:alert('".addslashes($post[username])." has a total of $post[totalpoint] karma points.');\"";
                                    
$post[imaword].=" onMouseOver=\"window.status='".addslashes($post[username])." has a total of $post[totalpoint] karma points.'; return true;\" onMouseOut=\"window.status=''; return true;\"><img src=\"https://vborg.vbsupport.ru/images/kpos.gif\" border=\"0\" alt=\"Positive Karma\"></a><br>";
                                }
                                elseif (
$check_posneg == '-'
                                {
                                    
$post[imaword] = "<a href=\"java script:void(0);\" onclick=\"java script:alert('".addslashes($post[username])." has a total of $post[totalpoint] karma points.');\"";
                                    
$post[imaword].=" onMouseOver=\"window.status='".addslashes($post[username])." has a total of $post[totalpoint] karma points.'; return true;\" onMouseOut=\"window.status=''; return true;\"><img src=\"https://vborg.vbsupport.ru/images/kneg.gif\" border=\"0\" alt=\"Negative Karma\"></a><br>";
                                }
                                else
                                {
                                    
$post[imaword] = "<a href=\"java script:void(0);\" onclick=\"java script:alert('".addslashes($post[username])." has a total of $post[totalpoint] karma points.');\"";
                                    
$post[imaword].=" onMouseOver=\"window.status='".addslashes($post[username])." has a total of $post[totalpoint] karma points.'; return true;\" onMouseOut=\"window.status=''; return true;\"><img src=\"https://vborg.vbsupport.ru/images/kbalance.gif\" border=\"0\" alt=\"Balance Karma\"></a><br>";
                                }

                            }
                            elseif (
$imaword == '1'
                            {
                                
$post[imaword] = "<smallfont>$post[totalpoint]</smallfont><br>";
                            }
                            elseif (
$imaword == '2'
                            {
                                
$post[table] = "<TABLE border=1 cellPadding=0 cellSpacing=0 style=\"BORDER-BOTTOM: #104a7b 1px solid; BORDER-LEFT: #104a7b 1px solid; BORDER-RIGHT: #104a7b 1px solid; BORDER-TOP: #104a7b 1px solid; PADDING-BOTTOM: 1px; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; PADDING-TOP: 1px\" width=\"60%\" height=\"10\"><tr>";
    
                                if (
$post[totalpoint] == '0' && $possible_total == '0'
                                {
                                    
$post[td] = "<td width=100% bgcolor='white'></td>";
                                }
                                elseif (
$redeem_points == '0' && $post[totalpoint] != '0'
                                {
                                    
$post[td] = "<td width=100% bgcolor='blue'></td>";
                                }
                                elseif (
$post[totalpoint] != '0' && $possible_total != '0'
                                {
                                    
$post[td] = "<td width='$coverage' bgcolor='blue'></td>";
                                }

                                
$post[td1] = "<td bgcolor='white'></td></tr></table>";
                                
$post[over] = "<smallfont><b>" $post[totalpoint] . "/" $possible_total "</b></smallfont>";

                                
$post[imaword] = $post[table] . $post[td] . $post[td1] . $post[over];
                            } 

Any help would be appriciated. Thanks.

Xenon 09-22-2002 08:17 PM

try this:
PHP Code:

if($post[userid]!=0) {
//Karma
                            
$gettotalpoint=mysql_query("SELECT newthread, reply, view, admin_mod, morereply, totalpenalty, date, redeem_points from storepoint where uid=$post[userid]");
                            
$numrows_gettotal mysql_num_rows($gettotalpoint);

                            if (
$numrows_gettotal '0' || $numrows_gettotal != '0' || $numrows_gettotal != ''
                            {
                                list (
$newthread$reply$view$admin_mod$morereply$totalpenalty$date$redeem_points) = mysql_fetch_row($gettotalpoint);
                            }

                            
$gettotalpoint1=mysql_query("SELECT agreepoint, dispoint, imaword from point");
                            
$numrows_gettotal1 mysql_num_rows($gettotalpoint1);
                            if (
$numrows_gettotal1 0
                            {
                                list (
$agreepoint$dispoint$imaword) = mysql_fetch_row($gettotalpoint1);
                            }

                            
$getagree=mysql_query("SELECT * from adis where post_userid=$post[userid] and adis='a'");
                            
$numrows_getagree mysql_num_rows($getagree);
    
                            
$getdis=mysql_query("SELECT * from adis where post_userid=$post[userid] and adis='d'");
                            
$numrows_getdis mysql_num_rows($getdis);
    
                            
$adisagree = ($agreepoint) * ($numrows_getagree);
                            
$adisdis = ($dispoint) * ($numrows_getdis);
                            
$newadis = ($adisagree) + ($adisdis);
    
                            
$post[totalpoint] = (($newthread) + ($reply) + ($view) + ($admin_mod) + ($morereply) + ($newadis)) - ($redeem_points);
                            
$possible_total = ($newthread) + ($reply) + ($view) + ($admin_mod) + ($morereply) + ($newadis) + ($redeem_points);

                            if (
$possible_total == '0'
                            {
                                
$coverage "0";
                                
$coverage $coverage '%';
                                
$post[totalpoint] = "0";
                                
$possible_total "0";
                            }
                            else
                            {
                                
$coverage = ($post[totalpoint]/$possible_total) * 100;
                                
$coverage $coverage '%';
                            }
    
                           
//Checking Karma
                           
if ($bbuserinfo[userid] != $post[userid]) 
                           {
                                
$getkarma mysql_query("SELECT * FROM adis WHERE userid = $bbuserinfo[userid] AND post_userid = $post[userid] AND postid = $post[postid]");
                                
$resultkarma mysql_num_rows($getkarma);

                                if (
$resultkarma == 0
                                {
                                    
$post[flag] = 0;
                                }
                                else
                                {
                                    
$post[flag] = 1;
                                }
                            }
                            
//choose image/word/progress bar
                            
if ($imaword == '0'
                            {     
                                
$check_posneg substr($post[totalpoint], 01);
                                if (
$check_posneg != '-' && $post[totalpoint] != '0'
                                {
                                    
$post[imaword] = "<a href=\"java script:void(0);\" onclick=\"java script:alert('".addslashes($post[username])." has a total of $post[totalpoint] karma points.');\"";
                                    
$post[imaword].=" onMouseOver=\"window.status='".addslashes($post[username])." has a total of $post[totalpoint] karma points.'; return true;\" onMouseOut=\"window.status=''; return true;\"><img src=\"https://vborg.vbsupport.ru/images/kpos.gif\" border=\"0\" alt=\"Positive Karma\"></a><br>";
                                }
                                elseif (
$check_posneg == '-'
                                {
                                    
$post[imaword] = "<a href=\"java script:void(0);\" onclick=\"java script:alert('".addslashes($post[username])." has a total of $post[totalpoint] karma points.');\"";
                                    
$post[imaword].=" onMouseOver=\"window.status='".addslashes($post[username])." has a total of $post[totalpoint] karma points.'; return true;\" onMouseOut=\"window.status=''; return true;\"><img src=\"https://vborg.vbsupport.ru/images/kneg.gif\" border=\"0\" alt=\"Negative Karma\"></a><br>";
                                }
                                else
                                {
                                    
$post[imaword] = "<a href=\"java script:void(0);\" onclick=\"java script:alert('".addslashes($post[username])." has a total of $post[totalpoint] karma points.');\"";
                                    
$post[imaword].=" onMouseOver=\"window.status='".addslashes($post[username])." has a total of $post[totalpoint] karma points.'; return true;\" onMouseOut=\"window.status=''; return true;\"><img src=\"https://vborg.vbsupport.ru/images/kbalance.gif\" border=\"0\" alt=\"Balance Karma\"></a><br>";
                                }

                            }
                            elseif (
$imaword == '1'
                            {
                                
$post[imaword] = "<smallfont>$post[totalpoint]</smallfont><br>";
                            }
                            elseif (
$imaword == '2'
                            {
                                
$post[table] = "<TABLE border=1 cellPadding=0 cellSpacing=0 style=\"BORDER-BOTTOM: #104a7b 1px solid; BORDER-LEFT: #104a7b 1px solid; BORDER-RIGHT: #104a7b 1px solid; BORDER-TOP: #104a7b 1px solid; PADDING-BOTTOM: 1px; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; PADDING-TOP: 1px\" width=\"60%\" height=\"10\"><tr>";
    
                                if (
$post[totalpoint] == '0' && $possible_total == '0'
                                {
                                    
$post[td] = "<td width=100% bgcolor='white'></td>";
                                }
                                elseif (
$redeem_points == '0' && $post[totalpoint] != '0'
                                {
                                    
$post[td] = "<td width=100% bgcolor='blue'></td>";
                                }
                                elseif (
$post[totalpoint] != '0' && $possible_total != '0'
                                {
                                    
$post[td] = "<td width='$coverage' bgcolor='blue'></td>";
                                }

                                
$post[td1] = "<td bgcolor='white'></td></tr></table>";
                                
$post[over] = "<smallfont><b>" $post[totalpoint] . "/" $possible_total "</b></smallfont>";

                                
$post[imaword] = $post[table] . $post[td] . $post[td1] . $post[over];
                            }



Bloodfist 09-22-2002 08:37 PM

Awesome man, that worked!

Xenon 09-22-2002 08:40 PM

:) you're welcome


All times are GMT. The time now is 11:05 AM.

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.02183 seconds
  • Memory Usage 1,930KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_code_printable
  • (2)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (4)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.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/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.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
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete