Help with PhpBB warnings

Status
Not open for further replies.

callumacrae

not alex mac
Community Support
Messages
5,257
Reaction score
97
Points
48
Hello,

On my forum one of my moderators gave me a warning.

Does anyone know how to get rid of it?
It is very annoying.
 

TechAsh

Retired
Messages
5,853
Reaction score
7
Points
38
I don't think there is a way to do it normally. So, you could either edit the database and remove it that way,or you could use this script which will do it for you.

Hope this helps.
 

callumacrae

not alex mac
Community Support
Messages
5,257
Reaction score
97
Points
48
It's not working for me:
Parse error: syntax error, unexpected ';', expecting T_PAAMAYIM_NEKUDOTAYIM in /home/alexmac/public_html/forum/remove_warning.php on line 6
 

TechAsh

Retired
Messages
5,853
Reaction score
7
Points
38
Strange, it worked first time for me. Are your sure you copied & pasted the code exactly as it should be?

I think "T_PAAMAYIM_NEKUDOTAYIM" is Hebrew for "double colon".
 

woiwky

New Member
Messages
390
Reaction score
0
Points
0
Show us the code at and around line 6 in that file, please. From viewing the code given on the page that TechAsh provided, it shouldn't be throwing that error. Perhaps you modified it inadvertently.
 

callumacrae

not alex mac
Community Support
Messages
5,257
Reaction score
97
Points
48
Code:
<?php

//&nbsp;@copyright&nbsp;(c)&nbsp;2005&nbsp;KTUK&nbsp;Group
//&nbsp;@license&nbsp;http://opensource.org/licenses/gpl-license.php&nbsp;GNU&nbsp;Public&nbsp;License

define('IN_PHPBB',&nbsp; true);
$phpbb_root_path&nbsp;=&nbsp;(defined('PHPBB_ROOT_PATH'))&nbsp;?&nbsp;PHPBB_ROOT_PATH&nbsp;:&nbsp;'./';
$phpEx&nbsp;=&nbsp;substr(strrchr(__FILE__,&nbsp;'.'),&nbsp;1);
include($phpbb_root_path&nbsp;.&nbsp;'common.'&nbsp;.&nbsp;$phpEx);
include($phpbb_root_path&nbsp;.&nbsp;'includes/functions_display.'&nbsp;.&nbsp;$phpEx);

//&nbsp;Start&nbsp;session&nbsp;management
$user->session_begin();
$auth->acl($user->data);
$user->setup('');

//some&nbsp;essentail&nbsp;variables&nbsp;being&nbsp;set
$username&nbsp;=&nbsp;request_var('username',&nbsp;'');
$count&nbsp;=&nbsp;request_var('count',&nbsp;0);
$submit&nbsp;=&nbsp;request_var('submit',&nbsp;'');
$done&nbsp;=&nbsp;false;
//define&nbsp;some&nbsp;variables
$row_user&nbsp;=&nbsp;'';
$warning&nbsp;=&nbsp;'';
$warning_new&nbsp;=&nbsp;'';

//are&nbsp;you&nbsp;an&nbsp;Admin,&nbsp;if&nbsp;not&nbsp;throw&nbsp;an&nbsp;error&nbsp;;)
if(!$auth->acl_get('a_')&nbsp;||&nbsp;!$auth->acl_get('m_'))

{
&nbsp;&nbsp;&nbsp;&nbsp;trigger_error('Only&nbsp;Administrators or Moderators can&nbsp;remove&nbsp;a&nbsp;warning.');
}

//Has&nbsp;the&nbsp;form&nbsp;been&nbsp;submitted?&nbsp;If&nbsp;not&nbsp;display&nbsp;form.
if(!$submit)
{
&nbsp;&nbsp;&nbsp;&nbsp;print&nbsp;"<form&nbsp;action=\"".$_SERVER['SCRIPT_NAME']."\"&nbsp;method=\"post\"&nbsp;/>
&nbsp;&nbsp;&nbsp;&nbsp;Username:&nbsp;<input&nbsp;type=\"text\"&nbsp;name=\"username\"&nbsp;/>
&nbsp;&nbsp;&nbsp;&nbsp;Count:&nbsp;<input&nbsp;type=\"text\"&nbsp;name=\"count\"&nbsp;maxlength=\"2\"&nbsp;size=\"2\"&nbsp;/>
&nbsp;&nbsp;&nbsp;&nbsp;<input&nbsp;type=\"submit\"&nbsp;value=\"submit\"&nbsp;name=\"submit\"&nbsp;/>
&nbsp;&nbsp;&nbsp;&nbsp;</form>";
}

//fetch&nbsp;user&nbsp;info
$sql&nbsp;=&nbsp;"SELECT&nbsp;*&nbsp;FROM&nbsp;"&nbsp;.&nbsp;USERS_TABLE&nbsp;.&nbsp;"
WHERE&nbsp;username&nbsp;=&nbsp;'$username'";
$result&nbsp;=&nbsp;$db->sql_query($sql);
$row_user&nbsp;=&nbsp;$db->sql_fetchrow($result);
$db->sql_freeresult($result);

//assign&nbsp;warning&nbsp;count&nbsp;so&nbsp;we&nbsp;can&nbsp;change&nbsp;it&nbsp;in&nbsp;the&nbsp;loop
$warning_count&nbsp;=&nbsp;$row_user['user_warnings'];

for($i=1;$i<=$count;$i++)
{&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;//does&nbsp;the&nbsp;user&nbsp;exist?
&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(isset($row_user['user_id']))
&nbsp;&nbsp;&nbsp;&nbsp;{
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//fetch&nbsp;warning&nbsp;info
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$sql&nbsp;=&nbsp;"SELECT&nbsp;*&nbsp;FROM&nbsp;"&nbsp;.&nbsp;WARNINGS_TABLE&nbsp;.&nbsp;"
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;WHERE&nbsp;user_id&nbsp;=&nbsp;".$row_user['user_id']."
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ORDER&nbsp;BY&nbsp;warning_time&nbsp;DESC&nbsp;LIMIT&nbsp;1";
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$result&nbsp;=&nbsp;$db->sql_query($sql);
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$warning&nbsp;=&nbsp;$db->sql_fetchrow($result);
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$db->sql_freeresult($result);
&nbsp;&nbsp;&nbsp;&nbsp;}
&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;//is&nbsp;there&nbsp;a&nbsp;warning&nbsp;to&nbsp;remove?
&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(isset($warning['warning_id']))
&nbsp;&nbsp;&nbsp;&nbsp;{
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//result&nbsp;printing
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$result&nbsp;=&nbsp;'';
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//remove&nbsp;warning&nbsp;log
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$sql&nbsp;=&nbsp;"DELETE&nbsp;FROM&nbsp;"&nbsp;.&nbsp;LOG_TABLE&nbsp;.&nbsp;"
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;WHERE&nbsp;log_id&nbsp;=&nbsp;".$warning['log_id'];
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$db->sql_query($sql);
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;print&nbsp;$result&nbsp;=&nbsp;($db->sql_query($sql))&nbsp;?&nbsp;"Warning&nbsp;log&nbsp;removed.<br&nbsp;/>"&nbsp;:&nbsp;'';
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//remove&nbsp;last&nbsp;warning
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$sql&nbsp;=&nbsp;"DELETE&nbsp;FROM&nbsp;"&nbsp;.&nbsp;WARNINGS_TABLE&nbsp;.&nbsp;"
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;WHERE&nbsp;warning_id&nbsp;=&nbsp;".$warning['warning_id'];
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$db->sql_query($sql);
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//success
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;print&nbsp;$result&nbsp;=&nbsp;($db->sql_query($sql))&nbsp;?&nbsp;"Last&nbsp;warning&nbsp;removed.<br&nbsp;/>"&nbsp;:&nbsp;'';
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//lets&nbsp;reduce&nbsp;the&nbsp;warning&nbsp;count&nbsp;for&nbsp;the&nbsp;user
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$warning_count&nbsp;=&nbsp;($warning_count&nbsp;-&nbsp;1);
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$sql&nbsp;=&nbsp;"UPDATE&nbsp;"&nbsp;.&nbsp;USERS_TABLE&nbsp;."
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;SET&nbsp;user_warnings&nbsp;=&nbsp;".$warning_count."
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;WHERE&nbsp;user_id&nbsp;=&nbsp;".$row_user['user_id'];
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$db->sql_query($sql);
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//success
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;print&nbsp;$result&nbsp;=&nbsp;($db->sql_query($sql))&nbsp;?&nbsp;"User&nbsp;warning&nbsp;count&nbsp;reduced.<br&nbsp;/>"&nbsp;:&nbsp;'';
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//Now&nbsp;we&nbsp;need&nbsp;the&nbsp;new&nbsp;last&nbsp;warning&nbsp;time&nbsp;to&nbsp;be&nbsp;able&nbsp;to&nbsp;update&nbsp;the&nbsp;user&nbsp;table&nbsp;last&nbsp;warning&nbsp;time
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$sql&nbsp;=&nbsp;"SELECT&nbsp;warning_time&nbsp;FROM&nbsp;"&nbsp;.&nbsp;WARNINGS_TABLE&nbsp;.&nbsp;"
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;WHERE&nbsp;user_id&nbsp;=&nbsp;".$row_user['user_id']."
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ORDER&nbsp;BY&nbsp;warning_time&nbsp;DESC&nbsp;LIMIT&nbsp;1";
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$result&nbsp;=&nbsp;$db->sql_query($sql);
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$warning_new&nbsp;=&nbsp;$db->sql_fetchrow($result);
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$db->sql_freeresult($result);
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$warning_new['warning_time']&nbsp;=&nbsp;($warning_new['warning_time'])&nbsp;?&nbsp;$warning_new['warning_time']&nbsp;:&nbsp;0;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//lets&nbsp;update&nbsp;that&nbsp;last&nbsp;warning&nbsp;time
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$sql&nbsp;=&nbsp;"UPDATE&nbsp;"&nbsp;.&nbsp;USERS_TABLE&nbsp;.&nbsp;"
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;SET&nbsp;user_last_warning&nbsp;=&nbsp;".$warning_new['warning_time']."
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;WHERE&nbsp;user_id&nbsp;=&nbsp;".$row_user['user_id'];
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$db->sql_query($sql);
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//success
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;print&nbsp;$result&nbsp;=&nbsp;($db->sql_query($sql))&nbsp;?&nbsp;"Users&nbsp;last&nbsp;warning&nbsp;time&nbsp;updated&nbsp;if&nbsp;there&nbsp;are&nbsp;previous&nbsp;warnings.<br&nbsp;/><br&nbsp;/>"&nbsp;:&nbsp;'';
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//add&nbsp;admin&nbsp;log&nbsp;about&nbsp;removal
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;add_log('admin',&nbsp;'Removed&nbsp;user&nbsp;warning',&nbsp;$user_row['username']);
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//yay&nbsp;complete&nbsp;success
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$done&nbsp;=&nbsp;true;
&nbsp;&nbsp;&nbsp;&nbsp;}
}

if($submit)
{
&nbsp;&nbsp;&nbsp;&nbsp;//suppose&nbsp;we&nbsp;better&nbsp;let&nbsp;them&nbsp;know&nbsp;the&nbsp;warning&nbsp;has&nbsp;been&nbsp;removed
&nbsp;&nbsp;&nbsp;&nbsp;mail($row_user['user_email'],&nbsp;'Warning&nbsp;Removal',&nbsp;'A&nbsp;Moderator&nbsp;on the Paper Forum has&nbsp;removed&nbsp;a&nbsp;board&nbsp;warning&nbsp;or&nbsp;warnings&nbsp;which&nbsp;they&nbsp;believe&nbsp;were&nbsp;issued&nbsp;incorrectly&nbsp;or&nbsp;by&nbsp;mistake.');
&nbsp;&nbsp;&nbsp;&nbsp;//did&nbsp;it&nbsp;work?
&nbsp;&nbsp;&nbsp;&nbsp;print&nbsp;$done&nbsp;=&nbsp;($done)&nbsp;?&nbsp;"Finished&nbsp;and&nbsp;warning&nbsp;or&nbsp;warnings&nbsp;removed."&nbsp;:&nbsp;"Finished but no&nbsp;actions&nbsp;carried&nbsp;out.";
&nbsp;&nbsp;&nbsp;&nbsp;//get&nbsp;form&nbsp;ready&nbsp;for&nbsp;another&nbsp;submit
&nbsp;&nbsp;&nbsp;&nbsp;unset($submit);
&nbsp;&nbsp;&nbsp;&nbsp;print&nbsp;"<br&nbsp;/><a&nbsp;href=\"./remove_warning.php\">BACK</a>";
}

?>

That's it.

Is it meant to have no break space quite that often?
I think I will try again...
Edit:
When I save it, the cPanel puts loads of them in

Aargh! And again...And again...And again... Boring.
What now? It doesn't do it for any other files
 
Last edited:

TechAsh

Retired
Messages
5,853
Reaction score
7
Points
38
I've had that problem (WYSIWYG editors adding $nbsp), I suggest creating the file on your computer, then uploading it. That way those &nbsp won't be added.
 

callumacrae

not alex mac
Community Support
Messages
5,257
Reaction score
97
Points
48
Oh, that works fine. Thanks!
 
Last edited:

LHVWB

New Member
Messages
1,308
Reaction score
0
Points
0
This thread has been solved. If they want to, the thread starter should be able to re-open it.

* Closed *
 
Status
Not open for further replies.
Top