<html>
<head>
<title> hello </title>
</head>
<body>
<a href="index.php?page=contact">Contact us</a>
<a href="index.php?page=news">News</a>
<?php
// the anchor tags are gonna stay. Now with PHP we can check if in the browser there is soemthing filled in as page.
if(isset($_GET['page'])) {
$page = $_GET['page'];
include_once $page . '.php'; // It will include the php page with the name in the browser. So for index.php?page=contact it is gonna include contact.php
} else {
include_once 'news.php'; // put your homepage here ( This is gonna be your total content shit ).
}
?>
</body>
</html>
The lines to note are
if(isset($_GET['page'])) {
$page = $_GET['page'];
include_once $page . '.php';
If you pass http%3A%2F%2Fwww.google.com%2F%3F in the URL query as the value of page then you will see it includes the Google homepage. Imagine the destructive force when including Javascript code!

New Topic/Question
Reply




MultiQuote




|