1,776

(8 replies, posted in PunBB 1.2 discussion)

So when you login, the ident becomes the username, and your IP address is stored as what/where? Once you've logged in, if your IP address is changing every page or two, that old IP then becomes seen as a guest connection, and your recent/actual IP is listed/correlated with you. Is that correct?


Cheers,

Matt

1,777

(8 replies, posted in PunBB 1.2 discussion)

The online ident bit. smile Wanting to try and adapt it so that the IP of the logged in user is updated as and when the IP changes and the previous IP is removed. I may be wrong in how I think it works at the moment, but it would appear the IP to username info is updated, but the old IP is left in state until the online timeout expires?

1,778

(8 replies, posted in PunBB 1.2 discussion)

Just a quickie. big_smile Which script sees to updating the user/IP pair?


Cheers,

Matt

1,779

(114 replies, posted in Programming)

And just incase that page tickled your fancy, big_smile the full vi manpage on the FreeBSD site:

http://www.freebsd.org/cgi/man.cgi?quer … ormat=html

1,780

(12 replies, posted in Programming)

Just to rule out one possible cause, I've compiled the latest 4 version, (4.4.7), of php and popped that on. No difference. So at least it ain't due to a bug/quirk in that specific version of php. big_smile

1,781

(114 replies, posted in Programming)

pogenwurst wrote:
MattF wrote:

I still prefer vi myself

I hear an awful lot about vi being great for programming, but I've never heard why. Care to enlighten me (I'm not denying that it's good; I simply don't know either way)?

There's just so much you can do with it, if you're inclined to do so. I know most of the Linux distro's tend to set it so that it colourises the text, and highlights errors on the fly, but personally, I detest that bit. I have a Fedora machine that does it, and I personally think it's damned annoying. The thing is, the amount of functionality it has, one would be at it for hours trying to describe it. This page, (the first one I picked from Google), big_smile will give you a good idea of the appeal:

http://drumlin.thehutt.org/vi/

1,782

(12 replies, posted in Programming)

elbekko wrote:

The best option would be to track down the bug and fix it tongue But error supression works too I guess.

big_smile big_smile

The question, then, would be where? I assume this has to be within php itself? How would one start on the path of finding the glitch? (Pointers to documentation are fine if it's an indepth path I take). big_smile

1,783

(114 replies, posted in Programming)

Bluefish is apparently quite a good one for *nix systems. Don't think they have a M$ port of it. (I still prefer vi myself). big_smile

1,784

(12 replies, posted in Programming)

Is the best option to just suppress the error, so it doesn't keep appearing in the logs? At least I'm glad to hear it ain't due to a cockup in my scripting. big_smile

1,785

(1 replies, posted in Programming)

Quick question on this one. Been thinking about it, and is this, (the fact that supposed guests can theoretically be seen as viewing areas which are restricted to logged in users), due to the IP of the logged in user only been checked and updated after the timeout period, or upon logout? If so, in which script is the IP/username pair updated?


Thanks again,

Matt

1,786

(12 replies, posted in Programming)

elbekko wrote:

Try doing a print_r($clock_array);

Just given that a try, worked perfectly. Put the print_r just above the in_array line in footer.php, and got the output:

Array ( [0] => http://forums.bauchan.org/toyota/forums.php [1] => http://forums.bauchan.org/toyota/index.php )

Those are the two pages that are defined. Could this just be a php version thing? I've got 4.4.4 running on this server.


Cheers,

Matt

mindlessoath wrote:

you fixed it, what did you do?

He changed the perms on the index.php file. big_smile big_smile

Are there any error messages in the logs?

Stupid question I know, but you have set the perms correctly on the new index.php file? big_smile

1,790

(12 replies, posted in Programming)

Mediator wrote:

I would assume that your include file is not getting included. In the footer try adding an isset for $clock_array and verifying that the data is actually there.

I thought initially something like that may be happening, but it would appear to be receiving the values correctly as the clock does only display on the two pages defined by the array. But, just to be on the safe side, I've added an isset as you suggested. smile The error message is no longer popping up in the logs, (but that is due to the layout of the new construct, is it not?), and the clock is still appearing where it should. I've altered the in_array line to:

if (isset ($clock_array) && in_array ($page, $clock_array)) {

That's why it's bugging me. I know it's functioning as it should, but it throws that warning.


Cheers,

Matt

1,791

(6 replies, posted in PunBB 1.2 troubleshooting)

Best thing to do initially if you ever get this problem is to flush your browser cache first. Opera has a bad habit of doing this when I switch between a test forum and the normal forum. It will login, then logout immediately. Not saying that is *the* problem, but definitely a good starting point. big_smile

1,792

(12 replies, posted in Programming)

Smartys wrote:

Could we see the full script?

No probs. big_smile I'll start with the arrays file. This is the one I was enquiring over yesterday as to whether I could include the lang files in include/common.php.

<?php


// Which pages the clock will be displayed on

$clock_array = array();
$clock_array[] = $pun_config['o_base_url'].'/forums.php';
$clock_array[] = $pun_config['o_base_url'].'/index.php';


// Language files that will be included in each script

$lang_dir = PUN_ROOT.'lang/'.$pun_user['language'].'/';

$lang_array = array();

$lang_array[] = $lang_dir.'common.php';
$lang_array[] = $lang_dir.'delete.php';
$lang_array[] = $lang_dir.'forum.php';
$lang_array[] = $lang_dir.'fus.php';
$lang_array[] = $lang_dir.'gus.php';
$lang_array[] = $lang_dir.'help.php';
$lang_array[] = $lang_dir.'index.php';
$lang_array[] = $lang_dir.'login.php';
$lang_array[] = $lang_dir.'misc.php';
$lang_array[] = $lang_dir.'online.php';
$lang_array[] = $lang_dir.'pms.php';
$lang_array[] = $lang_dir.'portal.php';
$lang_array[] = $lang_dir.'post.php';
$lang_array[] = $lang_dir.'prof_reg.php';
$lang_array[] = $lang_dir.'profile.php';
$lang_array[] = $lang_dir.'register.php';
$lang_array[] = $lang_dir.'search.php';
$lang_array[] = $lang_dir.'topic.php';
$lang_array[] = $lang_dir.'userlist.php';

        foreach ($lang_array as $langfile)
        {
                require $langfile;
        }


?>

This is how the above script is included in common.php, (with relevant snippet above for placement identification):

// Attempt to load the common language file
@include PUN_ROOT.'lang/'.$pun_user['language'].'/common.php';
if (!isset($lang_common))
        exit('There is no valid language pack \''.pun_htmlspecialchars($pun_user['language']).'\' installed. Please reinstall a language of that name.');

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

require_once PUN_ROOT.'include/arrays.php';

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

This is the code which is included in footer.php, (with relevant snippet above for placement identification):

// START SUBST - <pun_footer>
ob_start();

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

$domain = $_SERVER['SERVER_NAME'];
$script_path = $_SERVER['SCRIPT_NAME'];
$page = 'http://'.$domain.$script_path;

if (@in_array($page, $clock_array)) {

?>

<div id="clockfooter" class="block">
        <div class="box">
                <div class="inbox">
                <div align="center"><embed menu="false" width="150" height="35" src="<?php echo $pun_config['o_base_url'] ?>/mod-addons/clock.swf"/>
                </div>
                </div>
        </div>
</div>

<?php

}

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

Cheers,

Matt

1,793

(12 replies, posted in Programming)

Just wanting to check on what I'm missing here. Everything works as expected, but I'm getting this php warning:

PHP Warning:  in_array() [<a href='function.in-array'>function.in-array</a>]: Wrong datatype for second argument

The relevant parts that it refers to are:

the array:

$clock_array = array();
$clock_array[] = $pun_config['o_base_url'].'/forums.php';
$clock_array[] = $pun_config['o_base_url'].'/index.php';

the in_array check and variables:

$domain = $_SERVER['SERVER_NAME'];
$script_path = $_SERVER['SCRIPT_NAME'];
$page = 'http://'.$domain.$script_path;

if (@in_array($page, $clock_array)) {

I've put the @ in to suppress the warnings temporarily, but I'd prefer to get it working correctly if possible. I haven't been able to find any relevant info on the php docs site.


Cheers,

Matt

1,794

(4 replies, posted in PunBB 1.2 discussion)

Cheers. smile smile

1,795

(4 replies, posted in PunBB 1.2 discussion)

So it is mainly for optimisation why they're included when needed then? Would it, in real world terms, make much of an impact doing it the other way?


Cheers,

Matt

1,796

(4 replies, posted in PunBB 1.2 discussion)

Is there any valid reason, other than possibly load, for not doing a require/include for all the lang files for the default language in include/common.php?

Usename wrote:

I'm not asking you to write this function for me, but maybe explain abit more to me how this is done(since I'm new to PHP).

As was mentioned previously, having a ganders at the post.php script is a good place to start. It obviously contains the code that's already used for inserting topics/posts into the DB. This page describes what all the default db fields are:

http://punbb.org/docs/dev.html#dbtables

The way I personally would do it is to try and get a basic script running from the above, and if you have problems ask a question about the problem(s) encountered. That's the way I've been doing it since my first dip into php. big_smile

1,798

(29 replies, posted in Programming)

Just out of curiosity, does the stunned silence made I've made a major cockup in my design of that script, big_smile or is the implementation of the session, in theory, sound?


Cheers,

Matt

1,799

(1 replies, posted in Programming)

Apologies if this ought to be posted in the actual mod specific thread.

Trying to figure a way to counter the effect that the AOL proxying has on the online.php script. The relevant part of the script:

// Grab the users
$result = $db->query('SELECT * FROM '.$db->prefix.'online WHERE user_id > 0 AND idle=0 ORDER BY ident') or error('Unable to fetch online list', __FILE__, __LINE__, $db->error());

        $num_users_page = $db->num_rows($result);

if ($num_users_page) {
        while ($num_users_page--) {
                $user_data = $db->fetch_assoc($result);
                if ($user_data['current_page']) {
                        echo"\t\t\t\t".'<tr>'."\n";

                        if ($user_data['user_id'] > 1) {
                                echo "\t\t\t\t\t".'<td><a href="'.PUN_ROOT.'profile.php?id='.$user_data['user_id'].'">'.$user_data['ident'].'</a></td>'."\n";

does exactly what it's supposed to, but the side effect is that when an AOL user is logged in, their IP is constantly appearing to change, so there are a lot of supposed guest connections, which don't theoretically exist. So, the question being, could the DB lookup or while loop above be adapted to drop the ghost connections from it's listing?

Again, my apologies if this is in the wrong forum, but I thought with this one not actually being a mod fault, but an unusual(ish) ISP setup that could affect any such adaptations, this might be the better place to post. big_smile

mindlessoath wrote:

i myself dont see any sense to that, cause you have to pick which forum and thread topic you want to post in first.

Actually, (and it will probably be a rarity that I say this), this is one request I can actually see a valid point for. big_smile For example, an info/update/announce forum could have a message parsed from some other source and inserted into the forum, (one or more predefined in the script), as the latest topic in that/those forum(s).