Jump to content

Hide a page?


ItsWesYo

Recommended Posts

Is there anyway to hide a page in php?

 

Example:

I make a page called test.php

It is public (on a navigation menu, etc)

I don't want the real content to show up

Instead, maybe a message, like "This page is currently getting a revamp" or "This page is down due to [reason here]"

Link to comment
Share on other sites

There are a few things you could do...

 

If you have a User System, you could have it so only Administrators could view it.

 

OR

 

Do you know your IP address?

<?php
if ($_SERVER['REMOTE_ADDR'] == "Your IP address here") {
?>
All content within'
<?php
} else {
echo "This page is getting a revamp";
?>

OR

You could hide it with CSS and but then you wouldn't be able to view it. But that should be alright if you just want to display a message.

Link to comment
Share on other sites

not the smartest idea if your ISP uses DDNS or some sort of IP pool leasing system

 

True, but it can really depend on what kind of site it is and who has access to it... If it's only for a short amount of time then I think it would be alright... but you can try something else.

Link to comment
Share on other sites

this is a better idea,

make a page that sets a session like this

sessioner.php

<?php
session_start();
$_SESSION['access'] = "full";
?>

then on test.php

<?php
session_start();
if($_SESSION['access'] != "full"){
exit("Opps Not done yet");
}
?>

Just open up sessioner.php for your needs via chmod then simply lock it down after wards.

Link to comment
Share on other sites

What if you did this...

 

<?php
$_SESSION['ip'] = $_SERVER['REMOTE_ADDR'];

if ($_SESSION['ip'] = "Your IP Address") {
?>
All content
<?php
} else {
echo "This part of the site is getting a revamp.";
}
?>

 

Or is that pretty much the same thing?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.