Webmaster Forums - Webmaster forum for HTML, PHP, ASP, CSS and more

Go Back   Webmaster Forums - Webmaster forum for HTML, PHP, ASP, CSS and more > Web Programming > PHP Development
User Name
Password

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
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
Old 12-21-2006, 10:50 PM   #2 (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 Re: PHP Modification

What the *BUMP*
__________________
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
Old 12-23-2006, 12:51 PM   #3 (permalink)
goliath
Junior Member
 
goliath's Avatar
 
Join Date: Oct 2006
Posts: 18
Default Re: PHP Modification

include_once('lib/output' . PHPEX);

createHead("Index");

openDB();

***********************************

Look for that 'createHead' function.

It looks like it takes an input value, so you may be able to change it.

Just find the 'index' template info and update so that if you are a logged in admin, it shows stats.

If you create a new header, you'll have to put the if statement in the file you posted. If admin it shows one header, if not admin then another.

goliath is offline   Reply With Quote
Old 12-27-2006, 07:28 PM   #4 (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 Re: PHP Modification

Awsome i was thinking about ading another header template with the admin things and just using that on the admin page and the regular one on the others

~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
Old 12-28-2006, 01:02 PM   #5 (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 Re: PHP Modification

Goliath

Here is the If statment you were talking abotu i think, Its in Javascript let me know how i could need to add something to this to only allow admin to see stats.

PHP Code:
<script language={DQUOTE}javascript{DQUOTEtype={DQUOTE}text/javascript{DQUOTE}>
function 
admin(){
    if( 
confirm({DQUOTE}OK for the Admin PanelCancel for the Quiz Creation Panel{DQUOTE},{DQUOTE}2{DQUOTE}) ){location.href = {DQUOTE}admin{DQUOTE}+{DQUOTE}<!--{phpex}-->{DQUOTE};}
    else{
location.href = {DQUOTE}quizcreate{DQUOTE}+{DQUOTE}<!--{phpex}-->{DQUOTE};}
}
</script> 

~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
Old 12-29-2006, 06:11 AM   #6 (permalink)
goliath
Junior Member
 
goliath's Avatar
 
Join Date: Oct 2006
Posts: 18
Default Re: PHP Modification

it's a two-part modification.

I'll PM you a demo to see if I understand correctly.

goliath is offline   Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Points Per Thread View: 1.00
Points Per Thread: 11.00
Points Per Reply: 5.00



» Sponsors

» Links

» Affiliates
Web Hosting
Online Backup Reviews
Marketing Find
Merchant Select
SiteMap Builder
Host Compare
Dedicated Servers

» Links

» Sports Network
Paintball Forum
Football Forum
Hockey Forum
Golf Forum
Boxing Forum
Lacrosse Forum
Baseball Forum
SnowBoarding Forum
Soccer Forum
MMA Forum


All times are GMT -4. The time now is 04:55 PM.



LinkBacks Enabled by vBSEO 3.0.0 RC8
Webmaster Forums