vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   Unknown Error in index.php Code (https://vborg.vbsupport.ru/showthread.php?t=191621)

Lynne 09-25-2008 03:24 PM

Ah ha! This is where you are going wrong:
<?php include("mypoll.php"); ?>
(I think that's the one.)

Look at what it spits out. It starts with an <html> tag again (and another <head> and <body> tag)

legionofangels 09-25-2008 03:30 PM

PHP Code:

<?php

//uncomment this and then change the directory if this is above your forums directory
//chdir('./forums');
require_once ('./global.php');

require_once (
'./includes/functions_bigthree.php');
require_once (
'./includes/functions_misc.php');
require_once (
'./includes/class_bbcode.php');

$poll mypoll();
echo 
$poll;


function 
mypoll()
{
    global 
$vbulletin$stylevar$vbphrase;
    
$query = array();
    
$query['orderby'] = 'poll.dateline';
    
$query['sortorder'] = 'DESC';
    
$pollforumids1 = array(16,17,18,19,20,21,23,24,25,26,28,29,30,31,32,2,3,4,5,7,8,9,10,12,13,14,34,35,36,37,40,54,198,153,200);
    
$pollforumids = array();
    foreach (
$pollforumids1 as $key => $pollforumid)
    {
        
$pollforumids[$key] = trim($pollforumid);
    }
    
$mods['inforums'] = 'AND thread.forumid IN(' implode(','$pollforumids) . ')';
    if (
$vbulletin->userinfo['userid'])
    {
        
$query['pollfields'] = ', voteoption';
        
$query['polljoin'] = 'LEFT JOIN ' TABLE_PREFIX .
            
'pollvote AS pollvote ON (pollvote.pollid = poll.pollid AND pollvote.userid = ' .
            
$vbulletin->userinfo['userid'] . ')';
    }
    
$pollinfo $vbulletin->db->query_first("
        SELECT thread.pollid, open, threadid, replycount, forumid, question, poll.dateline, options, votes, active, numberoptions, timeout, multiple, voters, public 
$query[pollfields]
        FROM " 
TABLE_PREFIX "poll AS poll
        INNER JOIN " 
TABLE_PREFIX "thread AS thread USING (pollid)
        
$query[polljoin]
        WHERE open <> 10 
        AND visible = 1 
        AND active = 1
        
$mods[inforums]
        ORDER BY 
$query[orderby] $query[sortorder]
    "
);
    if (
$pollinfo['pollid'])
    {
        
$bbcode_parser = &new vB_BbCodeParser($vbulletinfetch_tag_list());
        
$pollinfo['question'] = $bbcode_parser->parse($pollinfo['question'], 'nonforum'true);

        
$splitoptions explode('|||'$pollinfo['options']);
        
$splitvotes explode('|||'$pollinfo['votes']);

        
$pollinfo['nvotes'] = iif($pollinfo['multiple'], $pollinfo['voters'], array_sum
            
($splitvotes));

        
$pollforumperms fetch_permissions($pollinfo['forumid']);

        if (!
$pollinfo['active'] or !$pollinfo['open'] or ($pollinfo['dateline'] + ($pollinfo['timeout'] *
            
86400) < TIMENOW and $pollinfo['timeout']) or !($pollforumperms $vbulletin->bf_ugp_forumpermissions['canvote']))
        {
            
$pollinfo['showresults'] = 1;

            
$pollinfo['message'] = iif(($pollforumperms $vbulletin->bf_ugp_forumpermissions['canvote']),
                
$vbphrase['this_poll_is_closed'], $vbphrase['you_may_not_vote_on_this_poll']);
        }

        if (
fetch_bbarray_cookie('poll_voted'$pollinfo['pollid']) or $pollinfo['voteoption'])
        {
            
$pollinfo['showresults'] = 1;
            
$pollinfo['message'] = $vbphrase['you_have_already_voted_on_this_poll'];
        }

        if (
can_moderate($pollinfo['forumid'], 'caneditpoll'))
        {
            
$show['editpoll'] = true;
        }

        
$pollbits '';
        
$option '';
        foreach (
$splitvotes as $key => $value)
        {
            
$option['question'] = $bbcode_parser->parse($splitoptions["$key"], ''$mod_options['portal_poll_allowsmilies']);
            
$show['voteital'] = '';

            if (
$pollinfo['voteoption'] == ($key 1))
            {
                
$show['voteital'] = 1;
            }

            
$option['votes'] = $value;
            
$option['number'] = $key 1;

            if (
$pollinfo['showresults'])
            {
                
$option['percent'] = 0;
                if (
$value)
                {
                    
$option['percent'] = vb_number_format($value $pollinfo['nvotes'] * 1002);
                }

                
$option['graphicnumber'] = $option['number'] % 1;
                
$option['barnumber'] = intval($option['percent'] * 1.4);

                eval(
'$pollbits .= "' fetch_template('adv_portal_pollresult') . '";');
            } elseif (
$pollinfo['multiple'])
            {
                eval(
'$pollbits .= "' fetch_template('adv_portal_polloption_multiple') . '";');
            }
            else
            {
                eval(
'$pollbits .= "' fetch_template('adv_portal_polloption') . '";');
            }
        }
        
//eval('$polltotal .= "' . fetch_template('adv_portal_poll') . '";');
        
$polltotal .= "<form method=\"post\" action=\"./poll.php\">";
        
$polltotal .= "<table>";
        
$polltotal .= "<tr>";
        
$polltotal .= "<td class=\"thead\">" $pollinfo['question'] . "</td>";
        
$polltotal .= "</tr>";
        
$polltotal .= $pollbits;
        
$polltotal .= "<tr>";
        
$polltotal .= "<td align=\"" $stylevar['left'] . "\" class=\"alt1\">";
        if (
$pollinfo['showresults'])
        {
            
$polltotal .= "<span class=\"smallfont\"><b>" $vbphrase['votes'] . ": " $pollinfo['nvotes'] .
                
"</b><br />" $pollinfo['message'] . ".</span>";
        }
        else
        {
            
$polltotal .= "<input name=\"s\" type=\"hidden\" value=\"" $vbulletin->session->vars['dbsessionhash'] .
                
"\" />";
            
$polltotal .= "<input name=\"do\" type=\"hidden\" value=\"pollvote\" />";
            
$polltotal .= "<input type=\"hidden\" name=\"securitytoken\" value=\"" $vbulletin->userinfo['securitytoken'] .
                
"\" />\n";
            
$polltotal .= "<input name=\"pollid\" type=\"hidden\" value=\"" $pollinfo['pollid'] .
                
"\" />";
            
$polltotal .= "<input class=\"button\" name=\"button\" type=\"submit\" value=\"" .
                
$vbphrase['vote_now'] . "\" />";
        }
        
$polltotal .= "</td>";
        
$polltotal .= "</tr>";
        
$polltotal .= "<tr>";
        
$polltotal .= "<td class=\"alt2\">";
        
$polltotal .= "<div class=\"smallfont\">&raquo; <a href=\"" $vbulletin->options['bburl'] .
            
"/poll.php?" $vbulletin->session->vars['sessionurl'] .
            
"do=showresults&amp;pollid=" $pollinfo['pollid'] . "\">" $vbphrase['view_poll_results'] .
            
"</a></div>";
        if (
$mod_options['portal_poll_allowreplies'])
        {
            
$polltotal .= "<div class=\"smallfont\">&raquo; <a href=\"" $vbulletin->options['bburl'] .
                
"/newreply.php?" $vbulletin->session->vars['sessionurl'] . "t=" $pollinfo['threadid'] .
                
"\">" $vbphrase['discuss_this_poll'] . "</a></div>";
            
$polltotal .= "<div class=\"smallfont\">&raquo; <a href=\"" $vbulletin->options['bburl'] .
                
"/showthread.php?" $vbulletin->session['sessionurl'] . "t=" $pollinfo['threadid'] .
                
"\">" $vbphrase['this_poll_has'] . " " $pollinfo['replycount'];
            if (
$pollinfo['replycount'] == 1)
            {
                
$polltotal .= $vbphrase['reply'];
            }
            else
            {
                
$polltotal .= $vbphrase['replies'];
            }
            
$polltotal .= "</a></div>";
        }

        if (
$show['editpoll'])
        {
            
$polltotal .= "<div class=\"smallfont\">&raquo; <a href=\"" $vbulletin->options['bburl'] .
                
"/poll.php?" $vbulletin->session->vars['sessionurl'] .
                
"do=polledit&amp;pollid=" $pollinfo['pollid'] . "\">" $vbphrase['edit_poll'] .
                
"</a></div>";
        }
        
$polltotal .= "</td>";
        
$polltotal .= "</tr>";
        
$polltotal .= "</table>";
        
$polltotal .= "</form>";
        return 
$polltotal;

    }
}

?>

There is the mypoll.php, what should we modify?

Thanks for your help so far, but we're still not seeing what the problem is.

Lynne 09-25-2008 03:39 PM

What do the templates look like - adv_portal_pollresult, etc.? Do they start with the <html> tag?


To see the problem, view your page source right after you spit out the showthread pages and you'll see this:
HTML Code:

<div class="content" style="position:relative;float:left;background-color:white;left:71px;">

<html dir="" lang="">
<head>


        <title>Legion of Angels Forums</title>

</head>
<body>


<br /><br /><br />


<table class="tborder" cellpadding="" cellspacing="" border="0" width="70%" align="center">
<tr>
        <td class="tcat"></td>
</tr>
<tr>
        <td class="panelsurround" align="center">
        <div class="panel">
                <div align="">
       
                               
                        <!-- main error message -->
                       
                       
                        <div style="margin: 10px">Unable to add cookies, header already sent.<br />
File: /homepages/26/d196297218/htdocs/index2.php<br />
Line: 8<br /></div>
                       
                               
                        <!-- / main error message -->

Notice how you've got a whole page 'started' again in the middle of your page.

legionofangels 09-25-2008 03:44 PM

This is one of his templates:

adv_portal_polloption_multiple

HTML Code:

<tr>
<td class="$bgclass"><label for="pollchoice_$option[number]"><input id="pollchoice_$option[number]" name="optionnumber[$option[number]]" type="checkbox" value="yes" /> <span class="smallfont">$option[question]</span></label></td>
</tr>

--------------- Added [DATE]1222361256[/DATE] at [TIME]1222361256[/TIME] ---------------

I got a pm from someone on this, what if we put that code in the middle box in an iframe, will that fix the error?

It'll make that one section of the front page no content, but there will be a ton of other content in divs anyway.

--------------- Added [DATE]1222361393[/DATE] at [TIME]1222361393[/TIME] ---------------

This is:

adv_portal_poll

HTML Code:

<tr>
        <td class="thead">$pollinfo[question]</td>
</tr>

$pollbits

<tr>
        <td align="$stylevar[left]" class="$altbgclass">
                <if condition="$pollinfo['showresults']">
                        <span class="smallfont"><b>$vbphrase[total_votes]: $pollinfo[nvotes]</b><br />$pollinfo[message].</span>
                <else />
                        <input name="s" type="hidden" value="$session[dbsessionhash]" />
        <input type="hidden" name="securitytoken" value="$bbuserinfo[securitytoken]" />
                        <input name="do" type="hidden" value="pollvote" />
                        <input name="pollid" type="hidden" value="$pollinfo[pollid]" />
                        <input class="button" name="button" type="submit" value="$vbphrase[vote_now]" />
                </if>
        </td>
</tr>
<tr>
        <td class="$bgclass">
                <div class="smallfont">&raquo; <a href="$vboptions[bburl]/poll.php?$session[sessionurl]do=showresults&amp;pollid=$pollinfo[pollid]">$vbphrase[view_poll_results]</a></div>
                <if condition="$mod_options['portal_poll_allowreplies']">
                        <div class="smallfont">&raquo; <a href="$vboptions[bburl]/newreply.php?$session[sessionurl]t=$pollinfo[threadid]">$vbphrase[discuss_this_poll]</a></div>
                        <div class="smallfont">&raquo; <a href="$vboptions[bburl]/showthread.php?$sddession[sessionurl]t=$pollinfo[threadid]">$vbphrase[this_poll_has] $pollinfo[replycount] <if condition="$pollinfo['replycount'] == 1">$vbphrase[reply]<else />$vbphrase[replies]</if></a></div>
                </if>

                <if condition="$show['editpoll']">
                        <div class="smallfont">&raquo; <a href="$vboptions[bburl]/poll.php?$session[sessionurl]do=polledit&amp;pollid=$pollinfo[pollid]">$vbphrase[edit_poll]</a></div>
                </if>
        </td>
</tr>

--------------- Added [DATE]1222361502[/DATE] at [TIME]1222361502[/TIME] ---------------

This is:

adv_portal_polloption

HTML Code:

<tr>
        <td class="$bgclass" valign="middle"><label for="pollchoice_$option[number]"><input id="pollchoice_$option[number]" name="optionnumber" type="radio" value="$option[number]" /><span class="smallfont">$option[question]</span></label></td>
</tr>


Tact7626 09-25-2008 03:52 PM

i can't find the culprits within the guys poll files/code. i thought he would have "echo:html"

the only echo's i see are

echo $poll;

are the double/body/headers coming from another template?

legionofangels 09-25-2008 03:52 PM

This is:

adv_portal_pollresult


HTML Code:

<tr>
        <td class="$bgclass">
                <span class="smallfont"><if condition="$show['voteital']"><em>$option[question] - $option[percent]%</em><else />$option[question] - $option[percent]%</if></span><br />
<img alt="" height="10" src="$stylevar[imgdir_poll]/bar$option[graphicnumber]-l.gif" width="3" /><img alt="$option[votes] <if condition="$option['votes'] <> 1">$vbphrase[votes]<else />$vbphrase[vote]</if>" height="10" src="$stylevar[imgdir_poll]/bar$option[graphicnumber].gif" width="$option[barnumber]" /><img alt="" height="10" src="$stylevar[imgdir_poll]/bar$option[graphicnumber]-r.gif" width="3" />
        </td>
</tr>

That is all the templates.

Lynne 09-25-2008 03:52 PM

I really don't know anything about iframes, so I don't know if that will fix the error. Did you look in the page source and see what I am talking about?

Tact7626 09-25-2008 03:57 PM

yep. we see it. were still trying to figure out what part of the mypoll.php is making it come out.

it's definately mypoll.php. but idk php so i don't know how he's making a whole new page echo out like that.

Lynne 09-25-2008 04:01 PM

Hmmm, I'm really not sure either. I guess I might go and compare mypoll.php to usage.php and see what the differences are.

legionofangels 09-25-2008 04:02 PM

Quote:

Originally Posted by Lynne (Post 1630111)

Also, you may want to correct this line (//feed2.js is incorrect):
HTML Code:

<script language="JavaScript" src="http://feed2js.org//feed2js.php?src=http%3A%2F%2Frss.cnn.com%2Frss%2Fcnn_showbiz.rss&amp;chan=title&amp;num=7&amp;desc=1" type="text/javascript"></script>

Those 3 feeds in the top 3 boxes will be replaced, it's jumbled at the moment the lower left box looks like unfinished code, but it's more like unfinished CSS, that works and will be applied to 5 off those 6 boxes in different arrays.

Quote:

Originally Posted by Lynne (Post 1630149)
I really don't know anything about iframes, so I don't know if that will fix the error. Did you look in the page source and see what I am talking about?

I know even less than he does on the php. The iframe didn't work we isolated it to that bottom middle box and the 6th lower right box which disappears when we make the error occur is now back but the iframe is showing no data or information what so ever, just a blank white box. So the iframe didn't work either.

--------------- Added [DATE]1222362390[/DATE] at [TIME]1222362390[/TIME] ---------------

Quote:

Originally Posted by Lynne (Post 1630155)
Hmmm, I'm really not sure either. I guess I might go and compare mypoll.php to usage.php and see what the differences are.

I think what you're basically saying is look for html in those php files? That shouldn't be there??


All times are GMT. The time now is 04:39 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.01350 seconds
  • Memory Usage 1,897KB
  • 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
  • (6)bbcode_html_printable
  • (1)bbcode_php_printable
  • (3)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (3)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)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
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete