Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Password Protected Proxy
12-07-2009, 11:13 PM
Post: #1
Password Protected Proxy
I have setup a password protected proxy

For the address, user, and pass please pm

This is to prevent schools from blocking it
Find all posts by this user
Quote this message in a reply
12-24-2009, 01:40 AM
Post: #2
RE: Password Protected Proxy
Is this a public mod your going to release?

CPALead - Earn $ on your Proxified!
Find all posts by this user
Quote this message in a reply
01-11-2010, 05:54 PM
Post: #3
RE: Password Protected Proxy
thats cool dude! can we also use this at the office..

Free webmaster stuff
SSS Software solutions
Find all posts by this user
Quote this message in a reply
02-16-2010, 12:57 PM
Post: #4
RE: Password Protected Proxy
So is a proxy which requires username and passwrord to access and use it??

Chalet Estate
Charlotte Ranchettes
Find all posts by this user
Quote this message in a reply
03-24-2010, 11:23 AM (This post was last modified: 03-24-2010 11:24 AM by saud101f.)
Post: #5
RE: Password Protected Proxy
I already did that with my proxy

the way to do it is to create a file called password_protect.php, add the following code

<?php

###############################################################
# Page Password Protect
###############################################################
###############################################################
#
# Usage:
# Set usernames / passwords below between SETTINGS START and SETTINGS END.
# Open it in browser with "help" parameter to get the code
# to add to all files being protected.
# Example: password_protect.php?help
# Include protection string which it gave you into every file that needs to be protected
#
# Add following HTML code to your page where you want to have logout link
# <a href="http://www.example.com/path/to/protected/page.php?logout=1">Logout</a>
#
###############################################################

/*
-------------------------------------------------------------------
SAMPLE if you only want to request login and password on login form.
Each row represents different user.

$LOGIN_INFORMATION = array(
'test' => 'testpass',
'admin' => 'passwd'
);

--------------------------------------------------------------------
SAMPLE if you only want to request only password on login form.
Note: only passwords are listed

$LOGIN_INFORMATION = array(
'testpass',
'passwd'
);

--------------------------------------------------------------------
*/

##################################################################
# SETTINGS START
##################################################################

// Add login/password pairs below, like described above
// NOTE: all rows except last must have comma "," at the end of line
$LOGIN_INFORMATION = array(
'test' => 'testpass',
'admin' => 'adminpass'
);

// request login? true - show login and password boxes, false - password box only
define('USE_USERNAME', true);

// User will be redirected to this page after logout
define('LOGOUT_URL', 'http://www.example.com/');

// time out after NN minutes of inactivity. Set to 0 to not timeout
define('TIMEOUT_MINUTES', 0);

// This parameter is only useful when TIMEOUT_MINUTES is not zero
// true - timeout time from last activity, false - timeout time from login
define('TIMEOUT_CHECK_ACTIVITY', true);

##################################################################
# SETTINGS END
##################################################################


///////////////////////////////////////////////////////
// do not change code below
///////////////////////////////////////////////////////

// show usage example
if(isset($_GET['help'])) {
die('Include following code into every page you would like to protect, at the very beginning (first line):<br>&lt;?php include("' . str_replace('\\','\\\\',__FILE__) . '"); ?&gt;');
}

// timeout in seconds
$timeout = (TIMEOUT_MINUTES == 0 ? 0 : time() + TIMEOUT_MINUTES * 60);

// logout?
if(isset($_GET['logout'])) {
setcookie("verify", '', $timeout, '/'); // clear password;
header('Location: ' . LOGOUT_URL);
exit();
}

if(!function_exists('showLoginPasswordProtect')) {

// show login form
function showLoginPasswordProtect($error_msg) {
?>
<html>
<head>
<title>Please enter password to access this page</title>
<META HTTP-EQUIV="CACHE-CONTROL" CONTENT="NO-CACHE">
<META HTTP-EQUIV="PRAGMA" CONTENT="NO-CACHE">
</head>
<body>
<style>
input { border: 1px solid black; }
</style>
<div style="width:500px; margin-left:auto; margin-right:auto; text-align:center">
<form method="post">
<h3>Please enter password to access this page</h3>
<font color="red"><?php echo $error_msg; ?></font><br />
<?php if (USE_USERNAME) echo 'Login:<br /><input type="input" name="access_login" /><br />Password:<br />'; ?>
<input type="password" name="access_password" /><p></p><input type="submit" name="Submit" value="Submit" />
</form>
<br />
<a style="font-size:9px; color: #B0B0B0; font-family: Verdana, Arial;" href="http://www.zubrag.com/scripts/password-protect.php" title="Download Password Protector">Powered by Password Protect</a>
</div>
</body>
</html>

<?php
// stop at this point
die();
}
}

// user provided password
if (isset($_POST['access_password'])) {

$login = isset($_POST['access_login']) ? $_POST['access_login'] : '';
$pass = $_POST['access_password'];
if (!USE_USERNAME && !in_array($pass, $LOGIN_INFORMATION)
|| (USE_USERNAME && ( !array_key_exists($login, $LOGIN_INFORMATION) || $LOGIN_INFORMATION[$login] != $pass ) )
) {
showLoginPasswordProtect("Incorrect password.");
}
else {
// set cookie if password was validated
setcookie("verify", md5($login.'%'.$pass), $timeout, '/');

// Some programs (like Form1 Bilder) check $_POST array to see if parameters passed
// So need to clear password protector variables
unset($_POST['access_login']);
unset($_POST['access_password']);
unset($_POST['Submit']);
}

}

else {

// check if password cookie is set
if (!isset($_COOKIE['verify'])) {
showLoginPasswordProtect("");
}

// check if cookie is good
$found = false;
foreach($LOGIN_INFORMATION as $key=>$val) {
$lp = (USE_USERNAME ? $key : '') .'%'.$val;
if ($_COOKIE['verify'] == md5($lp)) {
$found = true;
// prolong timeout
if (TIMEOUT_CHECK_ACTIVITY) {
setcookie("verify", md5($lp), $timeout, '/');
}
break;
}
}
if (!$found) {
showLoginPasswordProtect("");
}

}

?>


Update SETTINGS START section according to your needs. You can add/delete users in this section.
By default it is setup to grant access for one user:

User: admin
Password: adminpass

After you updated settings, save password_protect.php somewhere on your hosting server.
Lets say your website address is http://www.haveahobby.com, and you saved password_protect.php in /htdocs/protector/ folder

Open your browser, and type your site URL + path to the password_protect.php?help
In our example it would be: http://www.haveahobby.com/protector/pass...t.php?help

It will output something like
<?php include("/home/haveahobby/htdocs/protector/password_protect.php"); ?>
This output is a protection code which needs to be added to every php file you want to protect.

Lets say you want to protect your existing file named index.php.

You open index.php in your favorite editor, and add protection code at the very beginning of the file.

Lets say before update your index.php was:

Code:
<?php
echo "This information needs to be secured. Members area. Only members should be able to access it";
....
?>
After update it would look like (we added protection code at the beginning):

Code:
<?php include("/home/haveahobby/htdocs/protector/password_protect.php"); ?>
<?php
echo "This information needs to be secured. Members area. Only members should be able to access it";
....
?>
We secured index.php.

Now open your index.php file in browser. It should show login/password prompt.


Hope this will be of your interest
Find all posts by this user
Quote this message in a reply
04-13-2010, 01:42 AM
Post: #6
RE: Password Protected Proxy
Any ways they will block it, all they need is the URL Sad. Using a password is better to protect the proxy site from unwanted leechers Big Grin

Flexible server colocation makes your life easier. 1u colocation is the most suitable rack space.Smile
Find all posts by this user
Quote this message in a reply
Post Reply 


Forum Jump:

Contact UsProxy-Talk.comReturn to TopReturn to ContentLite (Archive) ModeRSS Syndication