• Howdy! Welcome to our community of more than 130.000 members devoted to web hosting. This is a great place to get special offers from web hosts and post your own requests or ads. To start posting sign up here. Cheers! /Peo, FreeWebSpace.net
managed wordpress hosting

php login/password script NEEDED

Mekhu

New Member
Hey guys.

Does anyone know where I can get a php script or cgi, whatever works... where I can assign my clients a login name and pass and when they enter that in, they are directed to an html page with some info on it?

Aside from the redirection, I need to make sure that others can't just link directly to the page I will be forwarding too.

I searched for this type of thing, but couldn't find it.
 
if you really want it in php it really isn´t that difficult and there should be something available at hotscripts.com, but the easiest way to do that is probably with .htaccess and just restrict acces to a whole folder and require a username and password... name a file .htaccess and put it in the directory you want to protect, change the path of AuthUserFile to what it is at your host... make a directory in that named something that won´t be easy to guess (in this case k5e2) and place a file named .htpasswd there and simply add usernames and passwors to it separated by ":"s...

.htaccess

AuthName "restricted access"
AuthType Basic
AuthUserFile /var/www/subdomain/protecteddir/k5e2/.htpasswd
require valid-user

.htpasswd

username1:password
name2:eek:therpw
ding:dong

you can encrypt the passwords too but it probably won´t be necessary... heres a script in perl to crypt passwords, just name it crypt.cgi and run it...

PHP:
#!/usr/bin/perl
# crypt.cgi  by David Efflandt, last updated 9/04/99
# Crypts a password for use with web authentication

use CGI qw/:standard :netscape/;
srand( time() ^ ($$ + ($$ << 15)));

print header,start_html('Crypt a Password'),"\n","\n";
if(param()) {
	$word = param('word');
	@range = ('0'..'9','a'..'z','A'..'Z','.','/');
	$salt = $range[rand(int($#range)+1)] . $range[rand(int($#range)+1)];
	$pass = crypt($word, $salt);

	print h1("Result of crypt $word"),hr,'A crypted version of ',
		em($word),' is: ',em($pass),p,
		'Example of a line in a password file for web authentication '.
		'(colon separated):',p,pre("username:$pass"),hr;
}

print b("Note: "),a({href=>'crypt.txt'},'This Script'),
	' works best when run on the system you need passords for because some
	systems use a more secure ',em('crypt'),' that ends up with more than the
	usual 13 character crypted password.';

print start_form,center(table({border=>1,cellpadding=>10},
	Tr([th([("Crypt a Plain Text Password").br.textfield('word').br.submit])
	]))),end_form,p,end_html;
 
Back
Top