Jump to content

need help making my code secure (only 9 lines)


runnerjp

Recommended Posts

                <?
                    $page = $_GET['page'];
                    if (ereg('[A-Za-z0-9]',$page) ) {
                        if (file_exists('pages/'.$page.'.php')) {
                            include('pages/'.$page.'.php');
                        } else {
                            include('pages/main.php');
                        }
                    } else {
                            include('pages/main.php');
                    }
                ?>

no.. For example:

You have folder "pages". In this folder you have several PHP files:

pages/main.php

pages/news.php

pages/compare.php

 

To call this files you have to call it thru URL : index.php?page=main or index.php?page=news or index.php?page=compare

 

All files should have *.php extension.

The name of file should consists only from A-Z a-z 0-9

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.