PDA

View Full Version : [TUT] Hidden page with PHP



Decode
06-01-2009, 04:13 PM
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.


<?php
session_start(); //starting the session
?>


Now you need to set how many times you want the page to be refreshed before the content appears.


<?php
session_start(); //starting the session
$refresh = 3; //amount of times the page should be refreshed

?>


I've added comments to the rest of the code so you know what it does


<?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
}
?>


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
include( "hidden.php" );
?>


Enjoy :)


Can a mod move this to the tuts forum please

Jahova
06-01-2009, 04:25 PM
Excellent tutorial, and very useful. Thanks.

Protege
06-01-2009, 05:55 PM
May I ask what use this is for exactly? A real life example please. Not being a **** or anything sorry.

Decode
06-01-2009, 06:04 PM
Excellent tutorial, and very useful. Thanks.
Thanks :)

May I ask what use this is for exactly? A real life example please. Not being a **** or anything sorry.

You could use it to hide a proxy (so like you see a maths site, then you refresh the page and it turns into a proxy.) I use a similar script to hide a page with lists of games on which are unblocked in my school. So its mainly for hiding things.

Protege
06-01-2009, 06:41 PM
Ahh good idea, nice script well done

timROGERS
06-01-2009, 08:02 PM
This idea was originally from Luckyrare (Danny) for the Uploadz Proxy. By saying that, I am not having a go at you, you have just as much of a right to post it as anyone else.

DeejayMachoo$
07-01-2009, 12:40 PM
mhmm, I see where the usage of this could come in handy but wouldn't it be easier to put a text box and a submit button and just if

if ($_POST['boxname'] == 'roflfjfjgjgutjfjr') {
echo("gamessite");
} else {
echo("maths site");
}

Pazza
07-01-2009, 05:46 PM
is there a way to make the exit( have an include in it ?

Source
07-01-2009, 05:51 PM
<?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']
}
include( "includ" ); //shows an include if not refreshed 3 times
} else {
include( "" ); //the thing to incude after 3 times
}
?>


Thats waht you would do pazza....

Pazza
07-01-2009, 05:53 PM
<?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']
}
include( "includ" ); //shows an include if not refreshed 3 times
} else {
include( "" ); //the thing to incude after 3 times
}
?>
Thats waht you would do pazza....

Oh thanks :D

+rep to you and decode

Want to hide these adverts? Register an account for free!