hide development wordpress site behind another site

Post Reply
User avatar
hiccup
Site Admin
Posts: 19
Joined: Sat Aug 01, 2015 8:44 pm

hide development wordpress site behind another site

Post by hiccup » Mon Aug 31, 2015 8:12 am

wordpress under Construction page:
rename index.php of wordpress to index_wp.php.
Then create a new file named index.php and put the following:

Code: php Select all

<?php
session_start();

if (isset($_POST['uc']) && $_POST['clientKey'] == 'password'){
$_SESSION['bypass_under_construction'] = true;
}elseif(isset($_GET['stop'])){
$_SESSION['bypass_under_construction'] = null;
}

//check if current session is bypassing under construction page
if (isset($_SESSION['bypass_under_construction'])){
//pull index_wp.php. This allows normal execution of your WordPress Installation
include('index_wp.php');
?>
<div style="background-color:#454545;margin:0px;padding:2px;color:#FFFFFF;font-family:trebuchet ms;font-size:12px;">
You are currently bypassing your WordPress under construction page. -
<a href="index.php?stop=true" style="color:#FFFFFF;">Log Out</a>
</div>
<?php
}else{
header('Location: http://www.example.com/landing_site/'&#41;;
?>
<div onclick="ucShowForm();" style="background-color:#454545;margin:0px;padding:0px;color:#FFFFFF;font-family:trebuchet ms;font-size:12px;">
<a href="#" style="color:#FFFFFF;" id="ucShowFormLink" onclick="ucShowForm();" >&nbsp;&nbsp;*</a>
<form method="POST" action="index.php" id="clientLoginForm" style="display:none;margin:3px;padding:3px;">
<input type="hidden" name="uc" value="true" />
<label for="clientKey">Client Key:</label>
<input type="password" name="clientKey" id="clientKey" />
<input type="submit" value="Enter" />
</form>
<script type="text/javascript">
function ucShowForm(){
javascript:document.getElementById('ucShowFormLink').style.display = "none";
javascript:document.getElementById('clientLoginForm').style.display = "block";
}
</script>
</div>
<?php
}
?>
on the landing page, include,:

Code: html Select all

<div onclick="ucShowForm();" style="background-color:#ffffff;margin:0px;padding:0px;color:#686859;font-family:trebuchet ms;font-size:12px;float:right">
<a href="#" style="color:#666666;" id="ucShowFormLink" onclick="ucShowForm();" >Login</a>
<form method="POST" action="../" id="clientLoginForm" style="display:none;margin:3px;padding:3px;">
<input type="hidden" name="uc" value="true" />
<label for="clientKey">Client Key:</label>
<input type="password" name="clientKey" id="clientKey" />
<input type="submit" value="Enter" />
</form>
<script type="text/javascript">
function ucShowForm(){
javascript:document.getElementById('ucShowFormLink').style.display = "none";
javascript:document.getElementById('clientLoginForm').style.display = "block";
}
</script>
</div>
Alternate index.php

Code: php Select all

<?php
session_start();

if (isset($_POST['uc']) && $_POST['clientKey'] == 'q5pqE533ageierydlIVs'){
$_SESSION['bypass_under_construction'] = true;
}elseif(isset($_GET['stop'])){
$_SESSION['bypass_under_construction'] = null;
}

/*check if current session is bypassing under construction page*/
if (isset($_SESSION['bypass_under_construction'])){
/*pull index_wp.php. This allows normal execution of your WordPress Installation*/
include('index_wp.php');
?>
<div style="background-color:#454545;margin:0px;padding:2px;color:#FFFFFF;font-family:trebuchet ms;font-size:12px;">
You are currently logged in. -
<a href="index.php?stop=true" style="color:#FFFFFF;">Log Out</a>
</div>
<?php
}else{
?>
<div onclick="ucShowForm();" style="background-color:#454545;margin:0px;padding:0px;color:#FFFFFF;font-family:trebuchet ms;font-size:12px;">
<form method="POST" action="index.php" id="clientLoginForm" style="display:block;margin:3px;padding:3px; width:100%">
<input type="hidden" name="uc" value="true" />
<label for="clientKey">Client Key:</label>
<input type="password" name="clientKey" id="clientKey" />
<input type="submit" value="Enter" />
</form>
</div>
<?php
}
?>

Post Reply