1

(13 replies, posted in PunBB 1.2 troubleshooting)

Below is what the config looks like after the script was copied over

Still not having any luck here


<?php
/***********************************************************************

  Copyright (C) 2002-2005  Rickard Andersson (rickard@punbb.org)

  This file is part of PunBB.

  PunBB is free software; you can redistribute it and/or modify it
  under the terms of the GNU General Public License as published
  by the Free Software Foundation; either version 2 of the License,
  or (at your option) any later version.

  PunBB is distributed in the hope that it will be useful, but
  WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  GNU General Public License for more details.

  You should have received a copy of the GNU General Public License
  along with this program; if not, write to the Free Software
  Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  MA  02111-1307  USA

************************************************************************/


// Tell header.php to use the admin template
define('PUN_ADMIN_CONSOLE', 1);

define('PUN_ROOT', './');
require PUN_ROOT.'include/common.php';
require PUN_ROOT.'include/common_admin.php';

<?php

$db_type = 'mysql';
$db_host = 'myhost.com';
$db_name = 'db_name';
$db_username = 'username';
$db_password = 'pass';
$db_prefix = '';
$p_connect = false;

$cookie_name = 'punbb_cookie';
$cookie_domain = '';
$cookie_path = '/';
$cookie_secure = 0;

define('PUN', 1);

?>
{
    confirm_referrer('admin_bans.php');

    $ban_user = trim($_POST['ban_user']);
    $ban_ip = trim($_POST['ban_ip']);
    $ban_email = strtolower(trim($_POST['ban_email']));
    $ban_message = trim($_POST['ban_message']);
    $ban_expire = trim($_POST['ban_expire']);

    if ($ban_user == '' && $ban_ip == '' && $ban_email == '')
        message('You must enter either a username, an IP address or an e-mail address (at least).');

    // Validate IP/IP range (it's overkill, I know)
    if ($ban_ip != '')
    {
        $ban_ip = preg_replace('/[\s]{2,}/', ' ', $ban_ip);
        $addresses = explode(' ', $ban_ip);
        $addresses = array_map('trim', $addresses);

        for ($i = 0; $i < count($addresses); ++$i)
        {
            $octets = explode('.', $addresses[$i]);

            for ($c = 0; $c < count($octets); ++$c)
            {
                $octets[$c] = (strlen($octets[$c]) > 1) ? ltrim($octets[$c], "0") : $octets[$c];

                if ($c > 3 || preg_match('/[^0-9]/', $octets[$c]) || intval($octets[$c]) > 255)
                    message('You entered an invalid IP/IP-range.');
            }

            $cur_address = implode('.', $octets);
            $addresses[$i] = $cur_address;
        }

        $ban_ip = implode(' ', $addresses);
    }

    require PUN_ROOT.'include/email.php';
    if ($ban_email != '' && !is_valid_email($ban_email))
    {
        if (!preg_match('/^[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,4})$/', $ban_email))
            message('The e-mail address (e.g. user@domain.com) or partial e-mail address domain (e.g. domain.com) you entered is invalid.');
    }

    if ($ban_expire != '' && $ban_expire != 'Never')
    {
        $ban_expire = strtotime($ban_expire);

        if ($ban_expire == -1 || $ban_expire <= time())
            message('You entered an invalid expire date. The format should be YYYY-MM-DD and the date must be at least one day in the future.');
    }
    else
        $ban_expire = 'NULL';

    $ban_user = ($ban_user != '') ? '\''.$db->escape($ban_user).'\'' : 'NULL';
    $ban_ip = ($ban_ip != '') ? '\''.$db->escape($ban_ip).'\'' : 'NULL';
    $ban_email = ($ban_email != '') ? '\''.$db->escape($ban_email).'\'' : 'NULL';
    $ban_message = ($ban_message != '') ? '\''.$db->escape($ban_message).'\'' : 'NULL';

    if ($_POST['mode'] == 'add')
        $db->query('INSERT INTO '.$db->prefix.'bans (username, ip, email, message, expire) VALUES('.$ban_user.', '.$ban_ip.', '.$ban_email.', '.$ban_message.', '.$ban_expire.')') or error('Unable to add ban', __FILE__, __LINE__, $db->error());
    else
        $db->query('UPDATE '.$db->prefix.'bans SET username='.$ban_user.', ip='.$ban_ip.', email='.$ban_email.', message='.$ban_message.', expire='.$ban_expire.' WHERE id='.$_POST['ban_id']) or error('Unable to update ban', __FILE__, __LINE__, $db->error());

    // Regenerate the bans cache
    require_once PUN_ROOT.'include/cache.php';
    generate_bans_cache();

    redirect('admin_bans.php', 'Ban '.(($_POST['mode'] == 'edit') ? 'edited' : 'added').'. Redirecting …');
}


// Remove a ban
<?php

$db_type = 'mysql';
$db_host = 'myhost.com';
$db_name = 'db_name';
$db_username = 'username';
$db_password = 'pass';
$db_prefix = 'x';
$p_connect = false;

$cookie_name = 'punbb_cookie';
$cookie_domain = '';
$cookie_path = '/';
$cookie_secure = 0;
$cookie_seed = 'd5fad767';

define('PUN', 1);

?>

2

(13 replies, posted in PunBB 1.2 troubleshooting)

it is there and spelled correctly, deleting the install file had no effect either, now when i get the error message and click the install link it simply tells me that file no longer exists...

3

(13 replies, posted in PunBB 1.2 troubleshooting)

i uploaded everything, ran install and then uploaded the config.php file

now when i try to go to the main page of the forum i get an error message "config.php does not exist or is corrupt"