|
|||||||
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
#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); } ?> } //end if statement ?> |
|
|
|
|
|
#2 |
|
Member (8 bit)
|
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 |
|
|
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|