This tutorial will go over how to view password protected directories with Microsoft Expression Web SuperPreview!
1. Download the Script. Use the Download Link or copy/paste the code and put into your own php file.
Download:
Link<?php
// This script allows you to view password protected directories/pages
// NOTE: Make sure to change the username and password for your directory right below
$username = "username";
$password = "password";
// Change this access password so that an unwanted visitor doesnt view what you are trying to hide in the first place.
$access_password = "access_password";
// Example use below:
// http://www.example.com/pw_viewer.php?pass=password&url=http://www.pw-protected.com/
// Change "password" to whatever you want(this is just an extra precaution if you do not want strangers viewing what you are trying to hide)
if($_GET['pass'] == $access_password)
{
$url = $_GET['url'];
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_AUTOREFERER, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_MAXREDIRS, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
// This is to log in to your password protected directory/page
curl_setopt($ch, CURLOPT_USERPWD, "$username:$password");
// Grab Content
$output = curl_exec($ch);
// Close handle
curl_close($ch);
// Print out what is on that page
echo $output;
}
?>
2. Edit the pw_viewer.php file
(if you downloaded) $username, $password, and $access_password (only three edits - see pic for more details). They are all at the top(lines 5,6, and 9).
- $username: The username for the password protected directory/page
- $password: The password for the password protected directory/page
- $access_password: This is what you will use to make sure no one can view your link without knowing this keyword. Remember this!
3. Upload to your server in a NON-PASSWORD-PROTECTED directory. There is a access password on the file so you do not have to worry about an unwanted visitor seeing what you are trying to hide.
4. You are now all set up and ready to use the script in Microsoft Expression Web SuperPreview.
This script could be used on other applications that do not allow password protected links, etc.5.
For use: Location of pw_viewer.php + Access Password + The URL you want to view
ex. http://www.example.com/pw_viewer.php?pass=password&url=http://www.pw-protected.com/
6. With that url just put it into the location field at the top of the application and submit.
Happy Viewing!