View Single Post
Old 12-21-2006, 05:42 PM   #1 (permalink)
O~Snapple
Moderator Of The Year
 
O~Snapple's Avatar
 
Join Date: Jul 2006
Location: Cali Breeze
Posts: 716
Send a message via MSN to O~Snapple Send a message via Skype™ to O~Snapple
Default PHP Modification

Im modifying WPquiz to meet my needs but i would like to disable the stats bar for everyone except the admin.

here is some code from the index.php

PHP Code:
<?php

/*************************************************

                      wpQuiz
__________________________________________________

file     : index.php
desc.    : base commands

website  : http://www.wplastik.com
e-mail   : jcccf@hotmail.com


*************************************************/

include_once('extension.inc');
include_once(
'lib/constants' PHPEX);
include_once(
'lib/database' PHPEX);
if( 
getCfgVal('indexview') == ){
    include_once(
'lib/login' PHPEX);
}
include_once(
'lib/output' PHPEX);

createHead("Index");

openDB();

welcomeMessage();

$getcat mysql_query("SELECT * FROM categories");
?>
<table>
<tr>
<td width="10%"><b><?=getlang("indexid",1)?></b></td><td width="34%"><b><?=getlang("indexname",1)?></b></td><td width="10%"><b><?=getlang("indexrating",1)?></b></td><td width="20%"><b><?=getlang("indexcreator",1)?></b></td><td width="10%"><b><?=getlang("indexquestions",1)?></b></td><td width="8%"><b><?=getlang("indexstatistics",1)?></b></td><td width="8%"><b><?=getlang("indexcomments",1)?></b></td>
</tr>
<?php

if( isset($_GET['catid'])){
    if(
$_GET['catid'] == "nocat"){
        
$phpself $_SERVER['PHP_SELF'];
        
$catid 'nocat';
        
$o_catname getlang("indexnocategory",1);
        eval(
"echo \"".getTemplate("category_header_bit")."\";");
        
$otherquiz mysql_query("SELECT * FROM sets WHERE catid = '' AND isopen='1' ORDER BY name");
    }
    else{
        
$checkCat mysql_fetch_array(mysql_query("SELECT * FROM categories WHERE id='".$_GET['catid']."'"));
        if(
$checkCat['name'] == ""){
            
getError("indexcategoryinvalid");
        }
        
$otherquiz mysql_query("SELECT * FROM sets WHERE catid = '".$_GET['catid']."' AND isopen='1' ORDER BY name");
        if(
mysql_affected_rows() != 0){
            
$phpself $_SERVER['PHP_SELF'];
            
$catid $_GET['catid'];
            
$o_catname $checkCat['name'];
            eval(
"echo \"".getTemplate("category_header_bit")."\";");
        }
    }
    while(
$aotherquiz mysql_fetch_array($otherquiz)){
        
$noqn mysql_query("SELECT COUNT(*) as numfound FROM questions WHERE setid = '".$aotherquiz['id']."'");
        
$noqn mysql_fetch_array($noqn);
        
$o_id $aotherquiz['id'];
        
$o_name $aotherquiz['name'];
        if(
$aotherquiz['password'] != ""){
                
$o_name .= "<img src=\"img/c_locked.gif\" alt=\"".getlang("indexlocked",1)."\">";
        }
        
$o_rating "N/A";
        
$o_ratingimg "img/c_rating0.gif";
        
$ao2ratings mysql_query("SELECT * FROM ratings WHERE setid='".$o_id."'");
        if( 
mysql_affected_rows() != ){
            
$voters 0;
            
$totalvote 0;
            while(
$aratings mysql_fetch_array($ao2ratings)){
                
$totalvote += $aratings['rating'];
                
$voters++;
            }
            
$o_rating round($totalvote/$voters2)." [".$voters."]";
            
$ratingsimage round($totalvote/$voters);
            
$o_ratingimg "img/c_rating".$ratingsimage.".gif";
        }
        
$o_creator $aotherquiz['creator'];
        
$o_numfound $noqn['numfound'];
        
$phpex PHPEX;
        eval(
"echo \"".getTemplate("category_set_bit")."\";");
    }
}
else{
    
$getcat mysql_query("SELECT * FROM categories");
    while(
$agetcat mysql_fetch_array($getcat)){
        
$phpself $_SERVER['PHP_SELF'];
        
$catid $agetcat['id'];
        
$o_catname $agetcat['name'];
        eval(
"echo \"".getTemplate("category_header_bit")."\";");
        
$quizselect mysql_query("SELECT * FROM sets WHERE catid = '".$agetcat['id']."' AND isopen='1' ORDER BY name");
        while ( 
$aquizselect mysql_fetch_array($quizselect) ){
            
$noqn mysql_query("SELECT COUNT(*) as numfound FROM questions WHERE setid = '".$aquizselect['id']."'");
            
$noqn mysql_fetch_array($noqn);
            
$o_id $aquizselect['id'];
            
$o_name $aquizselect['name'];
            if(
$aquizselect['password'] != ""){
                
$o_name .= "<img src=\"img/c_locked.gif\" alt=\"".getlang("indexlocked",1)."\">";
            }
            
$o_rating "N/A";
            
$o_ratingimg "img/c_rating0.gif";
            
$ratings mysql_query("SELECT * FROM ratings WHERE setid='".$o_id."'");
            if( 
mysql_affected_rows() != ){
                
$voters 0;
                
$totalvote 0;
                while(
$aratings mysql_fetch_array($ratings)){
                    
$totalvote += $aratings['rating'];
                    
$voters++;
                }
                
$o_rating round($totalvote/$voters2)." [".$voters."]";
                
$ratingsimage round($totalvote/$voters);
                
$o_ratingimg "img/c_rating".$ratingsimage.".gif";
            }
            
$o_creator $aquizselect['creator'];
            
$o_numfound $noqn['numfound'];
            
$phpex PHPEX;
            eval(
"echo \"".getTemplate("category_set_bit")."\";");
        }
        
br();
    }

    
$otherquiz mysql_query("SELECT * FROM sets WHERE catid = '' AND isopen='1' ORDER BY name");
    if(
mysql_affected_rows() != 0){
        
$phpself $_SERVER['PHP_SELF'];
        
$catid 'nocat';
        
$o_catname getlang("indexnocategory",1);
        eval(
"echo \"".getTemplate("category_header_bit")."\";");
    }
    while(
$aotherquiz mysql_fetch_array($otherquiz)){
        
$noqn mysql_query("SELECT COUNT(*) as numfound FROM questions WHERE setid = '".$aotherquiz['id']."'");
        
$noqn mysql_fetch_array($noqn);
        
$o_id $aotherquiz['id'];
        
$o_name $aotherquiz['name'];
        if(
$aotherquiz['password'] != ""){
                
$o_name .= "<img src=\"img/c_locked.gif\" alt=\"".getlang("indexlocked",1)."\">";
        }
        
$o_rating "N/A";
        
$o_ratingimg "img/c_rating0.gif";
        
$otherratings mysql_query("SELECT * FROM ratings WHERE setid='".$aotherquiz['id']."'");
        if( 
mysql_affected_rows() != ){
            
$voters 0;
            
$totalvote 0;
            while(
$aotherratings mysql_fetch_array($otherratings)){
                
$totalvote += $aotherratings['rating'];
                
$voters++;
            }
            
$o_rating round($totalvote/$voters2)." [".$voters."]";
            
$ratingsimage round($totalvote/$voters);
            
$o_ratingimg "img/c_rating".$ratingsimage.".gif";
        }
        
$o_creator $aotherquiz['creator'];
        
$o_numfound $noqn['numfound'];
        
$phpex PHPEX;
        eval(
"echo \"".getTemplate("category_set_bit")."\";");
    }
}
echo 
"</table>";
createTail();
?>

the header template is what i need to change but only for this one page, what i was thinking was making a second header page called header1 and using that without the stats link.

Where is the gettemplate Header in that code i cant seem to find it

~Snapple
__________________
The Real Truth
Epademik Emcee Esq. New Album The 3rd Finger is in Stores Now!
Snap Marketing Management and Consulting
O~Snapple is offline   Reply With Quote
Sponsored Links