love you too :sQuote:
Originally Posted by Anderman
:O:O:O:O 2 Tutorials pinned OMG!
Printable View
love you too :sQuote:
Originally Posted by Anderman
:O:O:O:O 2 Tutorials pinned OMG!
No need to thank me :p i only wanted help and still didnt get it xD
The tutorial has been updated with an easier way of using include :D ive added it underneath the old tut
Yay!
I finnaly added includes to The-Pit
;D
Thanks for the tut man
That new way i put is so much easier isnt it, ross strangely finds that one harder?
I used the old one
That onePHP Code:<?php
$_GET['page'];
switch($page)
{
case "home":
include('home.php');
break;
case "news":
include('news.php');
break;
case "tutorials":
include('tutorials.php');
break;
case "contact":
include('contact.php');
break;
case "sitemap":
include('sitemap.php');
break;
case "admin":
include('admin.php');
break;
default:
include('home.php');
break;
}
?>
:O the other ones easier >:~D
No it's not . . . Maybe it's just the way you explained it? I don't know. But it doesn't look easier.
Quote:
PHP includes are sometimes used instead of iframes it makes another page appear as though it is actually on the page similar to iframes without all of the scrollbars right making a php include is pretty basic
Sorry for asking this really stupid question but acording to this quote if ever my english got better it is saying that the php navigation took out the '' Iframes '' and place is content where it is but without having any code, its just simply adding the text were u want it? So if i am right u place the code like a simply text like cutenews thing (were u want it to be appear) and then where u place ur navigation u put the link that will activate the php page?
But yeah it would be fun to clarifie this for me if u understand what i said, quite tired today, and yeah nice tutorial throught even if i dont get to much the difference between a php navigation and html navigation unless the coding is really different :P.
Bad way to go about it... A user could simply request ?page=../../etc/passwd and they could view it (UNIX)!
Make sure you putasPHP Code:include('news.php');
otherwise expect your box to be exploited!PHP Code:include('./path/to/news.php');
Heres the code I use on all of my websites, you should use it too (remember to change the array $pages).
If you have 50odd PHP pages you'll have a big *** PHP code, so heres a loop that will go through an array of pages and include them, also exploit safe.
'name' => './path/to/file', etc.
http://somesite.com/?i=name would load up path/to/file
You can change $GET['x'] accordingly ?x=name
PHP Code:<?php
$default = './i/news.php';
$pages = array('about' => './i/about.php','servers' => './i/servers.php','services' => './i/services.php');
if(array_key_exists($_GET['i'], $pages))
{
foreach($pages as $pageid => $pagename) {
if($_GET['i'] == $pageid && file_exists($pagename))
{
include $pagename;
}
}
} else {
include $default;
}
?>