You are here: Re: [PHP] Dynamic PHP links « PHP « IT news, forums, messages
Re: [PHP] Dynamic PHP links

Posted by Richard Lynch on 10/21/94 11:08

Eduard Grigoryan wrote:
> Hi,
>
> I'm new to PHP and I'd appreciate your advice a lot.
> I'm trying to use dynamic PHP links instead of plain HTML and I'm gonna
> use something like
> this:
> File "index.php":
> <?
> <a href=index.php?content=story.htm>story</a><br>
> <a href=index.php?content=about.htm>about</a><br>
> <?
> if(isset($content)):
> include $content;
> else:
> include "about.htm";
> endif;
> ?>
>
> But a guy told me it is not preferable to use this method because of
> security considerations.
> I'm sure there is a common way of building dynamic links; am I on wrong
> way?

Now that you (hopefully) understand the problem, here's a solution for
THIS case:

<?php
if (!isset($content)) $content = 'about.htm';
switch($content){
case 'about.htm':
case 'story.htm':
include $content;
break;
default:
die("Page not found");
break;
}

You'll need to add one line for each page, but you will never accidentally
try to include a file you didn't mean to include.


--
Like Music?
http://l-i-e.com/artists.htm

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация