RE: [PHP] PHP - Internal linking in a page
| From: | John W. Holmes | Date: | Fri, 01 Nov 2002 01:51:36 +0000 |
| Subject: | RE: [PHP] PHP - Internal linking in a page | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-122369@lists.php.net to get a copy of this message | ||
You need to come up with a completely different method of doing this.
Your site, if using this method, is horribly unsecure. How are you
checking $page to make sure it's something that should be included??
---John Holmes...
> -----Original Message-----
> From: Paul Ottar Tornes [mailto:critical@tiscali.no]
> Sent: Thursday, October 31, 2002 5:28 PM
> To: php-general@lists.php.net
> Subject: [PHP] PHP - Internal linking in a page
>
> Hi!
>
> I started to learn PHP yesterday, and I have just entered a little
> problem.
> In my index.php file. I have this line:
>
> <? if ($page== '') { $page="main.php" ; } else {
> $page=$page.""; }
include
> ($page); ?>
>
> wich controles the main page locaton, just like frames. It makes the
files
> appear in the middle of the site.
>
> Now over to the problem:
>
> I am making a newsscript with PHP and PostgreSQL. I have now gotten
PHP to
> extract the news from the database.
> I am using numbers as ID for each post. 1, 2 ,3, 4, 5, 6 and so on.
> I use them to make a READ MORE link on the news posts.
> I am calling my "READ MORE"-page for main2.php, this contains PHP code
> that finds the story thats connected to the given number. and I use
this
> to make it appear: <a href="main2.php?id=row['id']> sort of speak..
>
> The problem:
>
> This link gives me the story:
>
> http://maloyportalen.no/~critical/maloy/main2.php?id=7
>
> But that makes it go on a seperate page.
> And this link does not work at all:
>
> http://maloyportalen.no/~critical/maloy/index.php?page=main2.php?id=7
> It returns this error:
>
> Warning: Failed opening 'main2.php?id=7' for inclusion
> (include_path='.:/usr/share/pear') in
> /home/critical/public_html/maloy/index.php on line 21
>
>
> Line 21 is the following:
> <? if ($page== '') { $page="main.php" ; } else {
> $page=$page.""; }
include
> ($page); ?>
>
> How can I write it so I can use:
>
> http://maloyportalen.no/~critical/maloy/index.php?page=main2.php?id=7
>
> Regards
> Paul Ottar Tornes.
>