Hi
I use a script for my pages on my site
Basically if a user was to click a link for e.g. page 3 then he/she would be taken to index.php?page=3
Now, I read the guide and it said that this is unsafe.
But thats not the case with mine... unless i'm wrong.
At the end I tried putting index.php?page=
http://www.xoopiter.com/forums/index
I didn't put the extension on because the script adds it automatically.
Now when I run that it just gives a PHP error and doesn't do anything.
So this script is safe if you are a person that wants to use this nice little script.
Here's the code:
Code:
<? if($page) { include("pages/$page.php"); } else { include("pages/pagenumber.php"); } ?>
So here's how you use it:
You put the code in your index file ON ITS OWN.
Then when you load the page then it will look in the file pages/pagenumber.php and display it on the index page, so you set the bit pages/pagenumber.php to point to where your index file is.
e.g.
files/index.php
Now that you have done that your index page will display on the page with that coding in it.
Now you see the directory/$page.php bit - that tells it where to be looking for the file you specify.
So this would basically read from /directory and then display the page:
e.g.
index.php?page=news
That URL would then display the file news.php from /directory.
Okay, now to change the 'page' bit you have to change these:
Code:
<? if($file) { include("directory/$file.php"); } else { include("pages/pagenumber.php"); } ?>
See how I have changed the $page at the start and the $page.php in the middle.
Now the code just above would allow you to access the file directory/filefile.php by typing in index.php?file=filefile
_________________________________________________________
So basically, based on the first code i provided, you would just need to change the $page bit and the $page.php bit to have something else other than index.php?page=
The { include("pages/$page.php"); } bit just tells the php code where to look for the file you type in after the equals
for example:
index.php?page=file1
That would load file1.php from the 'pages' directory.
I hope you can understand what to do for this script.
If you need any further help then please contact me through one of these:
MSN:
[email protected] (signed in 24/7 unless im in game)
Yahoo: nykampcw (signed in most of the time)
Email:
[email protected] (checked daily)
Cheers
Craig.