Go Back   PCMech Forums > Help & Discussion > Web Design / Development

Need Some Help? Type Your Keywords Here:

Reply
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
Old 04-19-2005, 08:28 AM   #1
Member (5 bit)
 
Join Date: Nov 2002
Posts: 24
signup script with .htaccess and .htpasswd

Hey, I'm looking for a simple php script for having users sign up and being added to the .htpasswd file and therefor getting access to the directory that the .htaccess file is in. I found this script but it doesn't work, it gives me lots of errors, you can check it here.

http://eurostylemusic.com/signup.php,

the script is below can some tell me what is wrong with it or knows one
that actually works.




if ($submit) //if the form has been submitted
{
if (!$nick || !$email || !$password || !$password2)
//if any of the fields were not filled in
{
$error = "All fields are required. Check input and try again"; //set error
} else {
if ($password != $password2) //if the passwords do not match
{
$error = "Passwords do not match."; //set error
} else //if everything went smoothly
{ //process form
$fp = fopen("/home/yournick/.htpasswd", "a");
//open file, chage this to the path
//to your .htpasswd. The a says to
//"append" to the end of the file.
fwrite($fp, "$nick:" . crypt($password) . "
"); //write to the htpasswd file
fclose($fp);

?>
Information successfully entered. You are now registered.
}
}
}

if (!$submit || $error)
//if the form has NOT been submitted or if there is an error
{
//display form

?>


%s
", $error); } ?>

Nick:

E-mail:

Password:

Password again:



} //end if statement

?>
salchipapi is offline   Reply With Quote
Old 04-24-2005, 05:11 PM   #2
Member (8 bit)
 
neouser99's Avatar
 
Join Date: Jun 2004
Location: Kansas City, MO
Posts: 157
Send a message via AIM to neouser99
why in the world would you want to do it this way...

anyway, if they dont' have a user name on your server, which is likely since you are linking to /home/{nick}/.htpasswd , that won't exist unless you have created the user, which doesn't make sense why you are doing it htat way, unless there is very low access to your sight. most user registrations and logins are done through a database, more error checking and stuff like that, not through htaccess.

if that doesn't help, post the errors.

-neo
neouser99 is offline   Reply With Quote
Reply

Bookmarks

Still Need Help? Type Your Keywords Here:


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -5. The time now is 07:21 AM.
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2012, vBulletin Solutions, Inc.
SEO by vBSEO 3.6.0 PL2