MyBB-Plugins Forums

Full Version: Turn off php warnings for individual pages?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I'm not sure why,  but one of my custom pages is sending me a:  

the followings warnings occurred message.

Its a: Warning [2] cannot modify header information- headers already sent warning.

It only occurs for guests Huh Huh  ( which I have denied access to the page) I have other users that are denied access, but for those groups the access denied displays correctly( no php warning)

2 questions

1) any ideas why?
2) is there a way to turn off the warnings on the individual page.


Quote:[PHP]                                          errorHandler->error

/inc/functions.php        1649         header

/inc/class_session.php
    348        my_setcookie
/inc/class_session.php     98         session->load_guest
/global.php                     55          session->init
Hi,

I don't know which page it is. Anyway, if you're modifying pages with the Windows Notepad, you'll likely have problems like this.

Regards,
Diogo
using notepad++

making my own custom pages



PHP Code:
<?php 

$templatelist 
'BookDB7';
define('IN_MYBB'1); require "./global.php";

add_breadcrumb("BookDB7""BookDB7.php"); 

eval(
"\$html = \"".$templates->get("BookDB7")."\";"); 

if(
in_array($mybb->user['usergroup'], array('1','89','120','157')))
{
error("Access denied");


output_page($html);

?>
this is the code for the page

but is there a way just to turn off the warnings for this page?
Hmm you have "PHP Code:" before <?php

Regarding individual page configuration, I don't think it's possible.

It would still be nice to see a screenshot otherwise it's hard to understand when the warning happens and why.
I will try to post a screen shot when I get a chance.

That" Php code" is a copy error, I corrected it above.
I figured it out. Not sure why but, your first assessment was correct. It was a linebreak or whitespace issue.
I compressed the code to 1 line in an editor and it fixed it on the new upload.

what editor are you using to make sure this does not happen to you?
I use Notepad++ Smile At some point you might have opened it with another editor probably or copy/pasted something, I have no idea.
(12-23-2017, 05:05 AM)Diogo Parrinha Wrote: [ -> ]I use Notepad++ Smile At some point you might have opened it with another editor probably or copy/pasted something, I have no idea.

Thanks for pointing me in the right direction Wink