1,226

(16 replies, posted in General discussion)

It's just using a straight HTTP_ACCEPT check for application/xhtml+xml. I know the W3C validator bots don't identify that they accept that, but I have no knowledge whatsoever of any other bots workings, so I'm not sure what would happen with them.

If they don't identify that they accept it, it's hard to know whether they would display correctly or not, hence the slightly awkward situation as to which choice is best.

The mod is available over on PunRes.

1,228

(16 replies, posted in General discussion)

Jérémie wrote:

Yup, paranoia is good, but you should see some of the forum people out there smile

I know what you mean. That's why I've never added any of those flashing/scrolling text mods. I know they'd be annoying as hell with those. big_smile

1,229

(16 replies, posted in General discussion)

Revision two. big_smile It is now on/off selectable at admin and individual user level. (No allowed groups defined yet, but a simple array could sort that, rather than using the db).

Straight url's in posts are now parsed as normal again, and this mod now uses [frame] bbcode tags. If the browser acknowledges that it accepts xhtm/xml, an object frame is used. If not, an iframe is used, so it should work across the Mozilla/IE range.

The only thing that still needs sorting is the quote nesting, to work in the same manner as the img tag in quotes where the uri rather than the image is shown. (I haven't figured out where that bit is done yet). big_smile

Edit: I've enabled the frame option for guest users on the test forum, so the frames should display okay. smile

1,230

(16 replies, posted in General discussion)

StevenBullen wrote:

Off topic: when I read the title I thought it was about the itouch. tongue

big_smile big_smile My wording choices can be somewhat archaic on occasion. big_smile This is one of those ideas I had, implemented it for testing, and then thought, is it really such a good idea? big_smile

When I get the code polished, (I still need to add a user as well as admin toggle option), I'll post the code up.

One thing I'm trying to decide at the moment, (as Jeremie's post raises a very good point), is whether to leave it as a global and user specific toggleable effect for any posted uri link, or whether to make it only available via code tags.

1,231

(16 replies, posted in General discussion)

StevenBullen wrote:

Does it work on old ie? I am guessing not as I am at work and dont work. But! What does it do?

Open up links... in the post inline?

Not tried it with IE yet, so I'll ashamedly say I can't answer that truthfully. smile

It just shows the link in an inline frame in the post, (with a link underneath to open the site in a new tab/window if required). It uses <object> rather than <embed>, (for xhmtl validity), so that's most likely why it doesn't work in IE, I assume.

Edit: Adding to that though, I would think it should be easy enough to use the browser detection type script that I use for the xml or html switching to automatically toggle between embed/iframe or object, dependent upon the browser.

1,232

(21 replies, posted in PunBB 1.2 discussion)

Have a read of this section of the Wiki regarding the miniportal. It should give you a good idea of all that you need to do to get it up and running. smile

http://wiki.punres.org/Miniportal

1,233

(16 replies, posted in General discussion)

Have added a toggleable option for making links in posts show in an object frame as well as just being a clickable link. Does it seem okay, or a touch too much?

http://forums.bauchan.org/testforum/viewtopic.php?id=3

Edit: Btw, hope no-one minds me using this forum as the test link? big_smile

1,234

(21 replies, posted in PunBB 1.2 discussion)

Post your complete code.

If you want flatfile support, you'll need to find another forum software.

Without MySQL specifically, yes.

1,237

(21 replies, posted in PunBB 1.2 discussion)

Just put that at the very top of your portal.tpl file, i.e:

<style type="text/css">
#main
{
margin-left: 190px;
margin-right: 190px;
}
#left
{
float: left;
width: 180px;
}
#right
{
float: right;
width: 180px;
}
</style>
<pun_head>
</head>
<body>
<div id="punwrap">

1,238

(13 replies, posted in Programming)

Cheers for that info. smile I'm now a lot clearer on the requirements/consequences.

Thanks. smile

1,239

(13 replies, posted in Programming)

Smartys wrote:

It is not about inserting or selecting. It is about escaping input in a query. If you're surrounding something with a " or a ' and the input could potentially have a " or a ' in it, you need to escape it so that it can't "break out," which would be an SQL inject.

Thanks. smile That's one point where I've usually tried to err on the side of caution, but never knew the exact specifics. It's now a lot clearer. Cheers. smile

1,240

(13 replies, posted in Programming)

I've updated that code above with those two. Is that correct as it is now?

Just on a side note with the db->escape, when exactly should that be used? I've never been 100% sure whether it's only needed when inserting info into the db, or whether it should also be used in queries too, for escaping unknown input in a lookup? Or is it better to simply err on the side of caution and always use it for anything other than integer values when working with the db?


Thanks again,

Matt

1,241

(13 replies, posted in Programming)

Cheers. smile smile

1,242

(13 replies, posted in Programming)

It won't do naff all for me. big_smile Just checked it on the test forum on the production server too, and still the same. Zilch.

Btw, is this code correct for the username only lookup? I'm just going to post the code on that other thread and give it up as a bad job getting it working here. big_smile

<?php

define('PUN_ROOT', './');
require PUN_ROOT.'include/common.php';
$topic_array = array(1);

$result = $db->query('SELECT poster FROM '.$db->prefix.'topics WHERE forum_id IN ('.implode(', ', $topic_array).')') or error('Unable to fetch topic info', __FILE__, __LINE__, $db->error());

if (!$db->num_rows($result))
{
        message('No topic info');
}
else
{
        require PUN_ROOT.'header.php';
?>
<div class="block">
        <h2><span>OUTPUT</span></h2>
        <div class="box">
                <div class="inbox">
                        <table>
<?php

        while ($topic = $db->fetch_assoc($result))
        {
                $db->query('UPDATE '.$db->prefix.'users SET num_topics=num_topics+1 WHERE username=\''.$db->escape($topic['poster']).'\'') or error('Unable to update topic counts', __FILE__, __LINE__, $db->error());
                echo '<tr><td>Topic poster: '.$topic['poster'].' - Topic count incremented.</td></tr>'."\n";
        }

?>
                        </table>
                </div>
        </div>
</div>
<?php

        require PUN_ROOT.'footer.php';

}

?>

Cheers ever so much for your help on this one. smile It's got me hellishly stumped why it won't work here though. big_smile


Thanks,

Matt

That looks fine. smile

1,244

(13 replies, posted in Programming)

This is the original db lookup, without the uid lookup:

$result = $db->query('SELECT poster FROM '.$db->prefix.'topics WHERE forum_id IN ('.implode(', ', $topic_array).')') or error('Unable to fetch topic info', __FILE__, __LINE__, $db->error());

Then

username=\''.$topic['poster'].'\'

is used for the WHERE statement in the UPDATE query. I'm terrible at doing the join statements, so just thought this might be a nice easy statement with which to practice joins whilst I was trying to eliminate possible cockups on my part for this script not working. big_smile

I've managed to get a very basic grasp of join statements now, but still ain't got the script working as expected. big_smile

1,245

(13 replies, posted in Programming)

It's an extra column that's been added to the users table for this modification:

http://www.punres.org/viewtopic.php?pid=21292#p21292

This is a run once script I just knocked up to pull all the topic counts for those designated forums to update that count in the new column. But......... it just won't work. big_smile I've triple checked everything. I've even made sure I'm checking the correct db and everything, but those counts just won't update via the while loop, yet both those vars are echoed to the screen correctly, and no db error is logged/printed. To say I'm at a loss as to why it's not working would be an understatement. big_smile

1,246

(13 replies, posted in Programming)

Another of my infamous quick jobs. big_smile Can anyone tell me why this isn't incrementing the topic count by 1 on each loop? I honestly can't spot where the problem is with this.

<?php

define('PUN_ROOT', './');
require PUN_ROOT.'include/common.php';
$topic_array = array(1, 2);

$result = $db->query('SELECT u.id AS uid, t.poster FROM '.$db->prefix.'topics AS t INNER JOIN '.$db->prefix.'users AS u ON u.username=t.poster WHERE t.forum_id IN ('.implode(', ', $topic_array).')') or error('Unable to fetch topic info', __FILE__, __LINE__, $db->error());

if (!$db->num_rows($result))
{
        message('No topic info');
}
else
{
        while($topic = $db->fetch_assoc($result))
        {
                $db->query('UPDATE '.$db->prefix.'users SET num_topics=num_topics+1 WHERE id='.$topic['uid']) or error('Unable to update topic counts', __FILE__, __LINE__, $db->error());
                echo 'Topic poster: '.$topic['poster'].' Uid: '.$topic['uid']."\n";
        }
}

?>

The echo is outputting the username and uid fine, but the count is not incrementing. Btw, that db lookup is only like that because I've been playing around. big_smile I've tried it using both just the username and then with the above using uid and/or username, so I know that lookup is excessive. big_smile

I'm at a total loss as to where the problem is with this one.


Cheers,

Matt

Nope.

Don't use short tags. They will bite you in the backside one day. Secondly, this line:

<img src="<?echo $url ;?><? echo $urlf; ?>" height="60" width="60" />

could be done with a single echo.


Edit: Just looking at that code, what are the $url and $urlf vars supposed to be?

new morning wrote:

phpMyAdmin 2.7.0-pl1

PHP, not the PHP admin programme.


new morning wrote:

What is GD ?

Graphics library.

bingiman wrote:

how can I contact you to give you the site URL?

Smartys at this domain. big_smile

Did note a slight bit of slugginshness on the page load, but nothing too extreme. Have you tried that forum dir from one of your other hosts?