Everything appears fine with the site, so unless it continues regarding the validator for an indefinite period, I wouldn't worry. I got caught out by the W3C validator throwing a wobbler when I was making all the code Xhtml 1.1 compliant, so it does happen. (Usually when you least expect it). big_smile That one caused me hours of unnecessary code scanning for a non-existent problem. big_smile

Just use FF with the html validator plugin whilst you're working on things, and then use the W3C validator as a final check. That's what I do these days.

It may just be a temporary glitch they're suffering. It happens occasionally.

bingiman wrote:

Hi Matt,

You need to edit the code above you have an extra ")" on the following line:

        $_SERVER['REQUEST_URI'] = $pun_config['o_base_url'].'/'.basename(isset($_SERVER['PHP_SELF']) ? $_SERVER['PHP_SELF'] : '').'?'.(isset($_SERVER['QUERY_STRING']) ? $_SERVER['QUERY_STRING'] : ''));

My mistake. It's one short, not one too many. big_smile That should have been:

$_SERVER['REQUEST_URI'] = $pun_config['o_base_url'].'/'.basename((isset($_SERVER['PHP_SELF']) ? $_SERVER['PHP_SELF'] : '').'?'.(isset($_SERVER['QUERY_STRING']) ? $_SERVER['QUERY_STRING'] : ''));

Try changing that clause from:

if (!isset($_SERVER['REQUEST_URI']))
{
        $_SERVER['REQUEST_URI'] = (isset($_SERVER['PHP_SELF']) ? $_SERVER['PHP_SELF'] : '').'?'.(isset($_SERVER['QUERY_STRING']) ? $_SERVER['QUERY_STRING'] : '');
}

to:

if (!isset($_SERVER['REQUEST_URI']))
{
        $_SERVER['REQUEST_URI'] = $pun_config['o_base_url'].'/'.basename(isset($_SERVER['PHP_SELF']) ? $_SERVER['PHP_SELF'] : '').'?'.(isset($_SERVER['QUERY_STRING']) ? $_SERVER['QUERY_STRING'] : ''));
}
else
{
        $_SERVER['REQUEST_URI'] = $pun_config['o_base_url'].'/'.basename($_SERVER['REQUEST_URI']);
}

1,255

(5 replies, posted in Programming)

I'll ditch this idea before I start then. big_smile Better to avoid another one of those 'whatever possessed me to try' sessions while I have the chance. big_smile Cheers Smartys. smile

1,256

(5 replies, posted in Programming)

Btw, I'll just add, the reason I'm trying not to study the existing mod properly is so that I don't sway my train of thought by looking at how, specifically, someone else has done it. big_smile

1,257

(5 replies, posted in Programming)

From looking at the other code, it seems to be far more 'extravagant' than it has to be, however, or is my view too simplistic? big_smile I believe it also fetches the post id's as well as just, (or rather than)?, the topic id's? Is there any valid reason for serialising the id's before placing into the db as in the existing mod, btw?

I'll be honest in that I haven't looked at the existing mod indepth, but from the cursory glance I've had, it would appear possible to do the same with approximately half the code?

1,258

(5 replies, posted in Programming)

Just wanting to have a quick brainpick on the basic idea. smile The existing mod looks somewhat overly complicated, so just wondering if there is an easier was to go about it.

The basic idea, (and very sketchy at the moment), is literally just checking the db topics table for the last_post time entry and comparing to the users table last_visit entry and creating a topic id's array from there, entering it into a new column in the user table, then comparing against those topic id's in the index/viewforum scripts. Is that general theory sound?

Would entering the id's into the new users table column as a comma separated list, and then using explode to create an array from those id's and using in_array when in index/viewforum viewing be the best way to go about it?

As I mentioned, this idea has only had minimal brain time at the moment, so may well be completely flawed. big_smile


Cheers,

Matt

1,259

(7 replies, posted in PunBB 1.2 show off)

sirena wrote:

Suggestion: adding a little dash of colour into the style probably wouldn't kill you smile

This is one of those rare occasions where I'd say otherwise, and leave as is. I'm usually no fan of light themes, but the subtle blending on that one does actually look rather nice.

Ben271185 wrote:

I don't know a lot about PHP so I don't know what to do with this. Can you please give me more information.

You need to alter the write/execute permissions on your cache dir or files. It can be done via your ftp client if you do not have shell access. The search facility on here will return plenty of info on the subject. smile

True, but if the information isn't useful/relevant, it doesn't have to be used. big_smile Using the search facility will return cartloads of matches regarding cache permissions.

Change this:

else if (isset($_POST['send_message']))
{

        require_once PUN_ROOT.'include/email.php';

        // Display the admin navigation menu
        generate_admin_menu($plugin);

        $sql = "SELECT username, email
                                FROM ".$db->prefix."users
                                WHERE username != 'Guest'
                                ORDER BY username";

to this:

else if (isset($_POST['send_message']))
{

        require_once PUN_ROOT.'include/email.php';

        // Display the admin navigation menu
        generate_admin_menu($plugin);

//--------------------------------------------------------------------//

        $banned_array = array();
        $idcheck = $db->query('SELECT username FROM '.$db->prefix.'bans') or error('Unable to fetch banned users', __FILE__, __LINE__, $db->error());

        while (false !== ($banned = $db->fetch_assoc($idcheck)))
        {
                $banned_array[] = '\''.$db->escape($banned['username']).'\'';
        }

        $banned_array[] = '\'Guest\'';

//--------------------------------------------------------------------//

        $sql = "SELECT username, email
                        FROM ".$db->prefix."users
                        WHERE username NOT IN (".implode(', ', $banned_array).")
                        ORDER BY username";

chmod -R 777 [/path/to/cachedir]

1,264

(8 replies, posted in PunBB 1.2 troubleshooting)

You haven't copied your existing forum folder over to the new installation site have you? Are you starting with clean PunBB source?

1,265

(8 replies, posted in PunBB 1.2 troubleshooting)

What do you mean by problems with a different SQL server? Have you already a functional forum, and are trying to create a second?

1,266

(71 replies, posted in News)

Aye. I'd read that blog entry awhile ago. smile I know I'm going against the flow here, big_smile but I must admit, I'll probably be running 1.2* for a good while after 1.3 comes out. In all honesty, there's not really anything which a bit of coding can't sort which I don't have that I want in 1.2*. smile

1,267

(71 replies, posted in News)

MattF wrote:

Cheers for the update. smile Just one quickie. With the profile.php change, would it not be simpler to just make that a preliminary check in profile.php near the top of the file, so that it acts as a cover all incase anyone mods their file later on with something problematical?

Just prodding on this one. smile Would a general check of:

if (isset($_POST['form_sent']))
{
    if ($pun_user['g_id'] < PUN_GUEST)
        {
        confirm_referrer('profile.php');
         }
}

at the top of profile.php prevent any future possibility of that occuring with any additions to profile.php, i.e: mods?


Cheers,

Matt

1,268

(1 replies, posted in PunBB 1.2 troubleshooting)

POP is a reception protocol, not for transmission. smile Go into your admin panel, and under options you can set the smtp server settings. If using the standard port, it's 25. If you define a port, whatever port you define.

Glad to help. smile

That's not a PunBB bug. That is merely caused by your rewrite rules. It would appear that is happening due to everything being forwarded to a hardcoded destination directory. You need to use a regex for capturing and defining the destination directory location.

1,271

(12 replies, posted in Programming)

Here's the code, (kept as basic as humanly possible), big_smile for it.

The first file, include/annoy_arrays.php

<?php

// Get a random number to decide what we are going to do

$randnum = rand(1, 30);


// Get delay time for page loads/redirects

$delay = rand(1, 30);


// Redirect to another page/site settings

$rdirtrue = array(8, 13, 15);

$rdirnum = rand(1, 3);

$rdir_array = array();
$rdir_array[1] = 'help.php';
$rdir_array[2] = 'index.php';
$rdir_array[3] = 'forums.php';


// Error settings

$errortrue = array(1, 6, 23);


// Blank page settings

$blanktrue = array(2, 11, 19, 26);


// Generic load delay setting

$delaytrue = array(9, 16, 27);

?>

The second file, annoy.php

<?php

define('PUN_ROOT', './');
include PUN_ROOT.'include/annoy_arrays.php';

if (in_array($randnum, $rdirtrue))
{
        sleep($delay);
        header("Location: $rdir_array[$rdirnum]");
}
else if (in_array($randnum, $errortrue))
{
        sleep($delay);
?>
<style type="text/css">
.middle {
    text-align: center;
}
</style>
</head>
<body>
<div class="block">
        <h2><span>Error</span></h2>
        <div class="box">
                <div class="inbox">
                <p class="middle"><b>Page not found</b></p>
                </div>
        </div>
</div>
</body>
</html>
<?php
    exit;
}
else if (in_array($randnum, $blanktrue))
{
?>
</head>
<body>
<div class="clearer"></div>
</body>
</html>
<?php
    exit;
}
else if (in_array($randnum, $delaytrue))
{
        sleep($delay);
}

?>

The code to be inserted in header.php if the cookie alterations above are used:

// Which group id's will have the annoy script called

$annoy_array = array(6);

if ($pun_user['is_guest'] && isset($_COOKIE[$cookie_name]))
{
        list(, , $header['group_id']) = @unserialize($_COOKIE[$cookie_name]);
}

if (isset($annoy_array) && (in_array($pun_user['g_id'], $annoy_array) || in_array(intval($header['group_id']), $annoy_array)))
{
        require_once PUN_ROOT.'annoy.php';
}

The code to be inserted in header.php without the cookie alterations above:

// Which group id's will have the annoy script called

$annoy_array = array(6);

if (isset($annoy_array) && in_array($pun_user['g_id'], $annoy_array))
{
    require_once PUN_ROOT.'annoy.php';
}

Which mod is that?

1,273

(71 replies, posted in News)

Cheers for the update. smile Just one quickie. With the profile.php change, would it not be simpler to just make that a preliminary check in profile.php near the top of the file, so that it acts as a cover all incase anyone mods their file later on with something problematical?

bingiman wrote:

I myself can't use this mod because for one, my index.php file uses sub-forums with the username link to profile on the index page and that's unfortunate. It does make the site look more structured to some small degree.

Modify it to suit. big_smile

Change this:

// anti-spam code variable checked here. Customize to suit your needs.
if ($_POST['spamcode'] <> "1492") 
  message('Please enter the correct 4 digit code for the year Columbus discovered America.');

to this:

// anti-spam code variable checked here. Customize to suit your needs.
if (!isset($_POST['spamcode']) || $_POST['spamcode'] == '' || strtolower($_POST['spamcode']) != strtolower(1492))
{ 
      message('Please enter the correct 4 digit code for the year Columbus discovered America.');
}

Obviously, replace 1492 with whichever answer you're using. smile