This tut will show how to make a simple hidden page in PHP, its useful for things like proxy websites.
First of all you need to start a session. The amount of times the page has been refreshed will be stored in a session so it doesn't get lost when the page is refresh.
Now you need to set how many times you want the page to be refreshed before the content appears.PHP Code:<?php
session_start(); //starting the session
?>
I've added comments to the rest of the code so you know what it doesPHP Code:<?php
session_start(); //starting the session
$refresh = 3; //amount of times the page should be refreshed
?>
Now once you have done that save it as a .php file (EG: hidden.php). For all the pages you want hidden add this code to the top of the page.PHP Code:<?php
session_start(); //starts the session
$refresh = 3; //amount of times the page should be refreshed
if( $_SESSION['hidden'] != $refresh ) { //checks if the data in the session is the same as the $refresh var
if( isset( $_SESSION['hidden'] ) ) { //checks if the session to store the page refreshes has been made
$_SESSION['hidden']++; //adds 1 to the number in the session
}
else { //if the session to store the page refreshes is not set
$_SESSION['hidden'] = 1; //makes $_SESSION['hidden']
}
exit( "This is a maths site" ); //if $_SESSION['hidden'] was not the same as $refresh this will be displayed
}
?>
EnjoyPHP Code:<?php
include( "hidden.php" );
?>
Can a mod move this to the tuts forum please






Reply With Quote








