This is really just a minor efficiency "bug", limited to modified tpl files.

index.php ~= line 260 to 369 there's a bunch of stuff going down to find out number of users, etc... Nothing to resource intensive. Anywho, in my main.tpl I've removed the "<!-- forum_info -->" tag. Now that 100+ lines of code still get's run.

If you add this

  // START SUBST - <!-- forum_info -->
+ if (strpos($tpl_main, '<!-- forum_info -->'))
+ {
  ob_start();

  ($hook = get_hook('in_info_output_start')) ? eval($hook) : null;

and this

  $tpl_temp = forum_trim(ob_get_contents());
  $tpl_main = str_replace('<!-- forum_info -->', $tpl_temp, $tpl_main);
  ob_end_clean();
+ }
// END SUBST - <!-- forum_info -->

then your not running that code that will never get displayed (depending on the .tpl text).

I'm guessing the same can apply to many other tpl tags. With extensions it might be a safer policy to add this at the end of the if:

else {
    ($hook = get_hook('in_info_output_start')) ? eval($hook) : null;
    ($hook = get_hook('in_stats_qr_get_user_count')) ? eval($hook) : null;
    // ... for each addition extention hook within the scope of the if statement
}
// or just make a new hook
//
//else {
//    ($hook = get_hook('in_info_output_skipped')) ? eval($hook) : null;
//}

Of course some extensions or other pieces of code may depend or expect the code to run. Particularly with tpl tags like "<!-- forum_main -->". I'll let someone else make the decision on what tpl tags should have conditional execution. It's been a while since I've played with PunBB (and a major version change; Which I love wink), I don't know the code well enough to comment on which tpl tags are safe to silently "skip".

Also, strpos may not be as efficient as another php function, or should be tested on a "pure" $tpl_main and other tpl variables, with results stored to be used later.

Sorry for reviving an old post, but my searches only reviled this topic as the closest to my inquiry smile

In this case, the modified punbb need to retain it's GPL licence in the code, but could the creator of the modification never release the code to the public and simply use it?

I'm considering using punBB for a website I've gots tah makes work all nice and perty. Punbb would be great base code to start from.

I'll be placing a link somewhere appropriate to PunBB, and hopefully many of my mods can be added to "vanilla" punbb, so released publically. I'm not looking to be a total jerk here tongue Just want to know how jerky I'm legally entitled to be roll

Hummm...

I've been getting spammed with a bot masquerading as google webcrawler... It's IP is always from a ISP or internet host (and never owned by google). Funny thing is it never gets to the forums, since I use https (and any http request is forwarded to https). The bot requests http://robshouse.no-ip.info, gets forwarded to https://robshouse.no-ip.info and then requests http://robshouse.no-ip.info, etc... for about 1 to 3 hours.

Might be a good idea for yous to switch your entire site over to https, doesn't look like many bots support that protocal. That being said, any search engine bot works fine with https (including google adsense), at least the ones that have crawled my site that is.

Check punres.org, I think there's a mod or two to make the process of adding smiles easy as pi smile

http://help.securepaynet.net/article.ph … dogdomains

If only people would use the support tools they paid for... tongue

If your host does offer any more conclusive help, try opening your ftp program and looking around for a "error.log" file. It's usually not in the "public_html" or "wwwroot" etc... folder. It's usually in something like /var/log or /tmp/awstats.

6

(18 replies, posted in PunBB 1.2 discussion)

You can have "public" and "private" forums. If you create a new user group, and call it, say "approved_users". Then you set-up the approved_users group with permissions to view and post to all your private forums, and the regular "user" or "guest" groups with no view permissions. New users would not be able to view any forums, but once you move them to the approved_users group they can.

have cpanel? if not is this a windows or linux server? do you have shell access?

Well my cpanel doesn't look like that

if not is this a windows or linux server? do you have shell access? Do you know anything about your web server or it's configuration? What software is the web server running? Have a link to the site? Have any information about your web server at all?

if you can get myphpadmin access to your database, you should be able to rename "à bas!". to something like "abas". Might just be a problem with encoding, and not knowing that "à bas!" in the input field is the same as "à bas!" in the database.

I'd backup the database before you do anything though, since I may be wrong, and there probably is an easier way to do this.

9

(4 replies, posted in Programming)

lie2815 wrote:

I want to execute some php comments in a .js file. Is that possible?

You mean commands?

rename your .js file to .php, you probably also have to send the right header information, I think it's "header('Content-Type: text/javascript');" but don't take my word for it tongue

<?php
header('Content-Type: text/javascript');
// do php stuff
?>
function doJavascriptStuff(x)
{
  x = '<?php echo $somePhpVariable ?>';
  // do javascript stuff
  return x;
}

Easy stuff eh? smile

I'll iliteerate. Whit oot speel cheke i cane't rite.

<?php
@chdir(../)
?>

Is that what your looking for?

if your not a php coder, move everything to the root directory. If you're willing to spend some time learning, then you won't have to.

I think that is still applicable, If you just want easy integration, move the /forum stuff to the root directory. Rename index.php to forum.php (and any links to index.php to forum.php). No need to touch the code, no need to think, no need to read. Now even your websites php files can use punbb's login and session related data and functions.

If you are not willing to learn a little, you won't be able to do a little. If your not willing to learn alot, you won't be able to do alot. That applies to anything, and is not specific to punbb, php, computers, or even "scientific stuffs".

13

(3 replies, posted in PunBB 1.2 show off)

Grats jeckyl, so you finially got everything in the DB converted and backed-up properly? wll done smile

I plan to actually re-write my modded punbb into extensions so that all the mods I did and haven't had the time to release will be easy to install plugins smile

if your not a php coder, move everything to the root directory. If you're willing to spend some time learning, then you won't have to.

I just quickly grep'ed HTTP_REF:

because

But in some cases I got Bad HTTP_REFERER errors, so I'm forced to move more and more PunBB files to the root, including all those admin_ files.

. Clearly, the text HTTP_REFERER had something to do with the error you were getting.

$redirect_url = (isset($_SERVER['HTTP_REFERER']) && preg_match('#^'.preg_quote($pun_config['o_base_url']).'/(.*?)\.php#i', $_SERVER['HTTP_REFERER'])) ? htmlspecialchars($_SERVER['HTTP_REFERER']) : 'index.php';

This line shows some of the logic HTTP_REFERER is used for. It would look clearer like this:

// If $_SERVER['HTTP_REFERER'] exists, and is within the $pun_config['o_base_url']
if ( isset($_SERVER['HTTP_REFERER']) && preg_match('#^'.preg_quote($pun_config['o_base_url']).'/(.*?)\.php#i', $_SERVER['HTTP_REFERER'])) )
{
    $redirect_url = htmlspecialchars($_SERVER['HTTP_REFERER']);
}

// Else if "Bad HTTP_REFERER, just use index.php for our redirect
else
{
    $redirect_url = 'index.php';
}

Clearly that line is not giving you "Bad HTTP_REFERER error"'s it does show you the logic to have one though. $redirect_url is used to send your browser back to whatever page you came from, wqhen you click on login (if i remeber correctly). When your configured $pun_config['o_base_dir'] doesn't contain $_SERVER['HTTP_REFERER'] you get an error. $_SERVER is a php variable that contains all kinds of information. google it for more information.

http://img162.imageshack.us/img162/6442/untitleddz6.th.jpg
If you have cpanel, you can't miss it.

have cpanel? if not is this a windows or linux server? do you have shell access?

for cpanel... if you look in the main icon area, you'll find some icon that says "raw error logs" or something to that effect tongue

You check your "server error log." tongue
It will probably say what was happening when the error occured, and what file and line number it happend on tongue

You did read the error message before posting it, right? 0.o

Peter wrote:

What do you mean "I just quickly grep'ed HTTP_REF"? What's that line of code?

"grep -r HTTP_REF ./" - a *nix command to search recursively in directory "./" and find the text string HTTP_REF and then print the file name and the line in that file that contains said text. google it for more info. the line was from login.php if I remeber correctly.

The baseurl is set in the admin options and probably stored in the database (I'd have to check). I've already changed the baseurl to the root (to fix one referrer error) and strangely enough viewing the forum in '/forum' seems unaffected so far.

Bad idea, sooner or later you'll probably run into problems. Set it seperatly for the "root-directory minimal pun" and the "forum-directory punbb". or you could just not have a forum directory 0.o tongue

And what about the admin_ files? Is it possible to put them in their own '/admin' folder? Why aren't they? Has anyone tried that?

I havn't tried, but assuming you still have a PUN_ROOT define, you should be able to. search each admin file for admin_ though and switch it to ./ and in the admin folder the PUN_ROOT is "../" not "./".

I just quickly grep'ed HTTP_REF:

$redirect_url = (isset($_SERVER['HTTP_REFERER']) && preg_match('#^'.preg_quote($pun_config['o_base_url']).'/(.*?)\.php#i', $_SERVER['HTTP_REFERER'])) ? htmlspecialchars($_SERVER['HTTP_REFERER']) : 'index.php';

See that $pun_config['o_base_url']? I think it's either set in the database, or in config.php, either way, just cheat. copy register.php login.php include/functions.php and at the top of functions put $pun_config['o_base_url'] = 'http://mybaseurl'. It's the base url from your forum, minus the forum directory.

  This isn't a "OOP is worse then procedural" benchmarks. It messures time spent creating an object with a single function, time spent calling an object's function, time spent calling a function, and time spent without either. It offers nothing conclusive for all senarios, but does hint at places where one might improve speed. Each program/script is different, and each programmer's (or clients) needs are different.

  I'm not really using my object period, or my function. I'm timing the underlying system. No matter how neat and inovative my OOP code may be, it won't outperform 18 seconds for 10000000 creations on my box+config+version of php. I'm also willing to bet that regardless of box+config the ratio of 18:9:8:4 will remain constant, and regardless of version (ignoring other majors though, php6 for example tongue) the ratio will remain fairly simular. I don't think I mentioned anything about what oop could or couldn't do... I simply mentioned how fast it could execute under 2 different senarios.

  I think it's important to keep in mind that no benchmark will ever tell the whole story, short of writing the app twice, but who really has time for that tongue PS: Appologies for the spelling, don't have firefox atm, and opera doesn't have spellcheck installed by default? 0.o

Just a guess, but maybe if you e-mail gmail support they may fix it, or tell you what the problem is? I did that once, when my text-mode browser wasn't auto-logging into the text-mode version of gmail and got a reply fairly fast. I have a feeling they just googled my e-mail and spit out the first 10 sentences of the first result though XD Dirty google pigeons 0.o

lol fixed, your as crazy as I am (when i decide to care about something at least smile).

You try sending a mail from punbb, but modifying the subject and anything that ends up injected into the body of the e-mail? If it's some text in the e-mail that would at least point out where the problem is. Then try to remove any extra header data from punbb e-mails, see if that does it? Finally add an extra header, i forget the exact syntax but it's something like "X-Emailer: Outlook Express". If gmail thinks it's a user's program sending the e-mail they may be silly enough to pass it through on just that.

Rickard wrote:

It should be noted that this is the first time I've seen gmail tag a PunBB generated e-mail as spam.

I use a DDNS server with MX records and all. Even have optional SSL (advertised via TSL) on my smtp server. Gmail will mark as spam any mail (punbb or otherwise) until I send a reply to a user in that domain (ie: joe at robshouse dot no dask ip dot info). At that point only that single gmail account has that single email address in a "white list". I haven't bothered trying to figure out why, or testing other e-mail servers yet, but I'm guessing it's more to do with the DDNS (with TTL probably very low), then with anything else.

fixed, can you get normal e-mail from that domain+smtp server to gmail without being marked as spam?

@elbekko Nah, needed to weight the cost of procedural vs OOP in php and perl. One of my side projects needs efficient code, but will end up being a large project (so needs good self documenting code). I've ended up going with perl "singleton" objects. php lost out for lack of efficient regex support and lack of scope control. Might kick myself in the butt in a few years when php becomes a little more mature though.

@Smartys aww crap, stupid "I'm feeling lucky" hits when searching php doc's smile