amelierosalyn

Skip navigation

You don't need to ConvertToPHP just to use includes

I have seen countless threads on the various forums from people who are asking for help because their member lists don't show in whatever popular fanlisting script they're currently using. When asked for their code, 9 times out of 10 it looks like this:

<?php
include('header.inc');
if(!$_SERVER['QUERY_STRING']) { ?>

Here are all my members!!!!
[Insert member list code here]

<? } include('footer.inc'); ?>

Can you spot what's wrong with that?

If you can't, here's the answer. Most fanlisting scripts use the query string (that's the bit that comes after a ? in a URL, such as country=USA in a URL like members.php?country=USA) to display members from different countries. The code there includes a line which says if (!$_SERVER['QUERY_STRING']) { which means "if there is no query string, do the following..." ... and the person has stuck their member code in the "do the following" bit (signified by the { and }). The members list WILL fail here, because it relies on the query string. If you tell the members to only show when there is no query string, it will break when you attempt to go to a country.

Now the reason this is happening so often is because it seems that people think "ooh I need a PHP page... How do I do that? Ah, NL-ConvertToPHP." This is wrong, people! All you need to have a "PHP page" is to give it a .php extension. If you want headers and footers (which NL-Convert uses as well), there are millions of tutorials on how to do this online. Don't assume that just because that script is called "ConvertToPHP" it is the be-all and end-all of how to make PHP pages.

Oh yeah, and I have internet again. Just in case anyone was wondering.

Please note: this post is now over 1 decade old.

Older posts are archived for historical reasons and also for those who may find their contents useful. Facts, links or opinions within this article are likely to have changed; the article itself may also no longer represent my own views on the subject. Please bear this in mind when reading these posts.

Comments (3)

  1. To be fair, the description is misleading you know. I haven't tried the script... but the description says "NL-ConvertToPHP allows you to easily convert your site to a PHP site, or optimize your current PHP coding."

    Speaking of which, I'm not too keen on having absolutely EVERY SINGLE page's content in one page... I can think of plenty of example where this is useful, but not in "putting all in one page".

    Also, isn't the query string the easiest to mess with? Shouldn't there be some further security measure?

    Vera's Gravatar Vera on

  2. Most people who use the codegrrl stuff are bloggers, am I right? Well if so, most bloggers don't know PHP, only HTML and CSS. That's what the problem is... They don't know anything about it.

    Jake's Gravatar Jake on

  3. Of course the good bloggers should know to do some research and have some back knowledge on some php. I don't know, people see a script and want to automatically download it because it's fun and makes web making so much easier. Lazy bums! :o

    Polly's Gravatar Polly on

Previous entry: How to change your WordPress username | Next entry: PHPAskIt is insecure!1!1!zomg!11