I lost access when I installed one ext..
I tried this script but doesnt work for me
need help thx
Code: Select all
<?php
/***
*
* Usage: Download and unzip the file, upload it to your Board's root (i.e.: www.mydomain.com/phpBB3/)
* Point your browser to i.e.: www.mydomain.com/phpBB3/ext_disable.php) and follow instructions.
*
* Version 1.0.0 - david63 2017
* Based on modisson.php - Oyabun1 2015
*
* This script is free software. It comes without any warranty.
* license http://opensource.org/licenses/GPL-2.0 GNU General Public License v2.
*
* Ensure that you have a backup of your Database before to run this tool
*
*/
define('IN_PHPBB', true);
$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
// Change this to 'false' if you do not want to delete this file
$remove_me = true;
include($phpbb_root_path . 'common.' . $phpEx);
include_once($phpbb_root_path . 'includes/functions_admin.' . $phpEx);
include_once($phpbb_root_path . 'phpbb/extension/manager.' . $phpEx);
// Start session management
$user->session_begin();
$auth->acl($user->data);
/* If ANONYMOUS = login box */
if ((int) $user->data['user_id'] == ANONYMOUS)
{
login_box(request_var('redirect', "ext_disable.$phpEx"));
}
// Limit this to founders or admins
if ((int) $user->data['user_type'] !== USER_FOUNDER || !$auth->acl_get('a_'))
{
trigger_error('You do not have permission to alter the database.
You need to be logged in as a founder or administrator.');
}
// Let's see how many extension we can disable
$orig_ext_count = get_active_ext();
// Create a HTML5 page to add some form elements and display stuff
echo '<!DOCTYPE html>';
echo '<html>';
echo '<head>';
echo '<meta http-equiv="content-type" content="text/html; charset=UTF-8" />';
echo '<title>' . basename(__FILE__) . '</title>';
echo '<style type="text/css">
body {
font-size: 1em;
background-color: #C0C0C0 ;
width: 600px;
margin: 2em auto 0;
}
form {
text-align: center;
line-height: 230%;
}
fieldset {
-moz-border-radius:7px;
border-radius: 7px;
-webkit-border-radius: 7px;
}
h3 {
text-align: center;
}
label {
cursor: pointer;
background-color: #FFD700;
border-style: outset;
border-width; 1px;
border-radius: 7px;
border-color: #808080;
font-size: 1.1em;
padding: 2px;
margin: 2px;
}
input[type="checkbox"]:disabled {
opacity:0;
}
input[type="checkbox"] {
cursor: pointer;
}
img.mid {
display: block;
margin-top: 1em;
margin-left: auto;
margin-right: auto
}
/* Buttons based on Pressable CSS Buttons by Joshua Hibbert */
.button {
background-image: -webkit-linear-gradient(hsla(0,0%,100%,.05), hsla(0,0%,0%,.1));
background-image: -moz-linear-gradient(hsla(0,0%,100%,.05), hsla(0,0%,0%,.1));
background-image: -ms-linear-gradient(hsla(0,0%,100%,.05), hsla(0,0%,0%,.1));
background-image: -o-linear-gradient(hsla(0,0%,100%,.05), hsla(0,0%,0%,.1));
background-image: linear-gradient(hsla(0,0%,100%,.05), hsla(0,0%,0%,.1));
border: none;
border-radius: 1.25em;
box-shadow: inset 0 0 0 1px hsla(0,0%,0%,.25),
inset 0 2px 0 hsla(0,0%,100%,.1),
inset 0 1.2em 0 hsla(0,0%,100%,.05),
inset 0 -.2em 0 hsla(0,0%,100%,.1),
inset 0 -.25em 0 hsla(0,0%,0%,.5),
0 .25em .25em hsla(0,0%,0%,.1);
color: #fff;
text-shadow: 0 -1px 1px hsla(0,0%,0%,.25);
cursor: pointer;
display: inline-block;
font-family: sans-serif;
font-size: 1.1em;
font-weight: bold;
line-height: 150%;
margin: 0 .5em;
padding: .25em .75em .5em;
position: relative;
text-decoration: none;
vertical-align: middle;
}
.button:hover {
outline: none;
}
.button:hover, .button:focus {
box-shadow: inset 0 0 0 1px hsla(0,0%,0%,.25),
inset 0 2px 0 hsla(0,0%,100%,.1),
inset 0 1.2em 0 hsla(0,0%,100%,.05),
inset 0 -.2em 0 hsla(0,0%,100%,.1),
inset 0 -.25em 0 hsla(0,0%,0%,.5),
inset 0 0 0 3em hsla(0,0%,100%,.2),
0 .25em .25em hsla(0,0%,0%,.1);
}
.button:active {
box-shadow: inset 0 0 0 1px hsla(0,0%,0%,.25),
inset 0 2px 0 hsla(0,0%,100%,.1),
inset 0 1.2em 0 hsla(0,0%,100%,.05),
inset 0 0 0 3em hsla(0,0%,100%,.2),
inset 0 .25em .5em hsla(0,0%,0%,.05),
0 -1px 1px hsla(0,0%,0%,.1),
0 1px 1px hsla(0,0%,100%,.25);
margin-top: .25em;
outline: none;
padding-bottom: .5em;
}
.green {
background-color: #228B22;
}
.remove_me {
color: #FFFFFF;
width: 560px;
margin: 2em auto 0;
padding: .5em;
font-size: 1.1em;
background-color: #8B0000;
}
</style>';
echo '</head>';
echo '<body>';
// Create a form with a checkbox
echo '<h3>Disable all extensions</h3>';
echo '<fieldset><legend><strong>Check the selection box and click the Run button.</strong></legend>';
echo '<form action="' . basename(__FILE__) . '" method="post" onsubmit="return confirm(\'You are about to disable ' . $orig_ext_count . ' extensions. \n Make sure you first have a database backup. \n If you click OK there is no going back.\')">';
echo '<label title="Disable '. $orig_ext_count . ' extensions"><input type="checkbox" name="chkExt"
value="Yes" />Disable '. $orig_ext_count . ' extensions </label> ';
echo '<p><button type="submit" class="button green";>Run</button></p>';
echo '</form>';
echo '</fieldset><br>';
echo '<fieldset style="background-color:#F5FCFF; border-color:#00CC00; border-style: solid;"><legend>
<strong>Result</strong></legend>';
// Use request_var() to get the returned value of the selection
$chk_ext = (request_var('chkExt', ''));
// Get the current version from 'includes/constants.php'
$version = PHPBB_VERSION;
// Let's make sure that we are running phpBB > 3.1
if (phpbb_version_compare($version, '3.1.0', '>='))
{
// Disable extensions
if($chk_ext == 'Yes')
{
// Get the enabled extensions
$sql = 'SELECT ext_name
FROM ' . EXT_TABLE . '
WHERE ext_active = 1';
$result = $db->sql_query($sql);
// Now we can try to disable the extensions
if (!empty($result))
{
while ($ext_name = $db->sql_fetchrow($result))
{
while ($phpbb_extension_manager->disable_step($ext_name['ext_name']));
}
$db->sql_freeresult($result);
}
else
{
echo 'No extensions found to disable';
remove_me();
}
// Get count of extensions disabled
$disabled_ext = $orig_ext_count - get_active_ext();
// Add disable action to the admin log
add_log('admin', $disabled_ext . ' extensions disabled');
echo $disabled_ext . ' extensions have been disabled.';
remove_me();
}
}
else
{
// User has an invalid version of phpBB
echo 'This script can only be run on versions of phpBB greater than 3.1.0<br />Your version of phpBB: /includes/constants.php ' . $version .'<br>Since the version is invalid no extensions are able to be disabled.<br>';
remove_me();
}
echo '</form>';
echo '</fieldset>';
echo '</body>';
echo '</html>';
// Get count of active extensions
function get_active_ext()
{
global $db;
$sql = 'SELECT COUNT(ext_active) AS active_ext
FROM ' . EXT_TABLE . '
WHERE ext_active = 1';
$result = $db->sql_query($sql);
$ext_count = (int)$db->sql_fetchfield('active_ext');
$db->sql_freeresult($result);
return $ext_count;
}
// Try to delete this file
function remove_me()
{
if ($remove_me)
{
@unlink(__FILE__);
// Windows IIS servers may have a problem with unlinking recently created files.
// So check if file exists and give a message
if (file_exists(__FILE__))
{
echo '<p class="remove_me">File could not be deleted. You will need to manually delete the ' . basename(__FILE__) . ' file from the server.</p>';
}
}
}