'; $GLOBALS['MY_HTPASSWD_FILE'] = getcwd() . "/.htpasswd"; $GLOBALS['MY_HTACCESS_FILE'] = getcwd() . "/.htaccess"; $GLOBALS['MY_HTACCESS_DATA'] = "AuthType Basic\n"."AuthName \"Password Protected Directory.\"\n"."AuthUserFile " . $GLOBALS['MY_HTPASSWD_FILE']."\n"."require valid-user\n"; $GLOBALS['MY_LINKTO_ME'] = '

Login to this script. | .htpasswd Manager Lite: Powered by Pimpsoft.Com | Upgrade to the Pro Version Now!

'; echo $GLOBALS['MY_LINKTO_ME']; if(!isset($_POST['login_username']) || !isset($_POST['login_password']) ){ echo '
Login:
Password:
'; echo_die('

You MUST login to this script with the username and password you configured it with in order to use it.

'); }/* End if */ if($GLOBALS['MY_LOGIN_USERNAME'] != $_POST['login_username'] || $GLOBALS['MY_LOGIN_PASSWORD'] != $_POST['login_password']){ echo '

Welcome to the .htaccess/.htpasswd manager powered by PimpSoft.com.

In addition to this directories .htaccess protections this script contains an additional correct username and password login required for it\'s use. All failed login attempts are logged to a remote email address for security.

You are getting this page because you FAILED to login with the correct username and password required for this script to grant access to you. If you are the site owner please try to login correctly again.

'; exit; }/* End if */ /* Everything is fine. Do our duty. */ echo '
'; function array_trim_func(&$value, $key){ $value = trim($value); } function trim_array($arr){ @array_walk($arr, 'array_trim_func'); return $arr; } function echo_red_font($d){ echo ''. $d . '
'; } function echo_die($d){ echo $d . '

Copyright 2005 PimpSoft.Com
All Rights Reserved

'; exit; } function echo_green_font($d){ echo ''. $d . '
'; } function echo_delete_file($local_file){ if(unlink( getcwd() . '/' . $local_file)){ echo_green_font("$local_file file deleted."); }else{ echo_red_font("The file $local_file could not be deleted!"); }/* End if..else */ } function put_data_in_file($file,$data){ $fd = fopen($file,"w"); /* Check for fopen error. */ if(empty($fd)){ echo_red_font("File Discriptor for $file is empty: $php_errormsg"); return false; }/* End if */ /* Write out file here replacing original file. */ if(@fwrite($fd, $data) === FALSE) { echo_red_font("fwrite on file $file failed: $php_errormsg"); fclose($fd); return false; }/* End if */ fclose($fd); return true; } function write_htaccess(){ global $GLOBALS; $hta = $GLOBALS['MY_HTACCESS_DATA']; if(!put_data_in_file($GLOBALS['MY_HTACCESS_FILE'],$hta)){ echo_red_font("Writing of .htaccess failed!"); return false; }/* End if */ echo_green_font("Wrote new .htaccess correctly."); return true; } function get_users(){ if(!filesize($GLOBALS['MY_HTPASSWD_FILE'])){ clearstatcache(); return array(); }/* End if */ clearstatcache(); $htpass_array = trim_array(file($GLOBALS['MY_HTPASSWD_FILE'])); $r_count = 0; for($count=0;$countPlease fix this before continuing.

'); }/* End if */ list($user,$pass) = split(":",trim($htpass_array[$count])); if(($user != "") and ($pass != "") and ($pass != "\n")){ $htpass_pairs[$r_count]["user"] = $user; $htpass_pairs[$r_count]["pass"] = $pass; $r_count = ($r_count + 1); }/* End if */ }/* End for */ if(count($htpass_pairs) > 0){ return $htpass_pairs; }/* End if*/ return array(); } /* WARNING: Resets password if username exists in $users already! */ function add_user($users,$user, $password){ $ret_users = array(); $count=0; $found = 0; for($count=0;$count
Action:
Username:
Password:
Password again: