Добавлено: 09/03/02 в 16:59
|
.htaccess, htpassword нихрена невыходит, помогите плиз!!! Все, намучился и заебался. Стыдно писать и вас отвликать, но другого выхода нет, помогите ради Бога. Уже 2 месяца мучаюс! Купил себе платный хост (Прохостеры) Закачал контент, все зделал. Поставил биллинг, мне дали скрипты. Ставлю как там написано, сервер выдает ошибку 500 и нихрена не работает. STEP 1 Please check your site meets password assist script requirements:
Apache or compatible Web-server running on Unix/Linux Ability to run CGI scripts Perl interpreter installed STEP 2 1. Using Telnet or FTP create directory with name "passes" somewhere on your server. Set the permissions of the directory to 777. (To do that, type: 'chmod 777 passes' in command prompt or 'SITE CHMOD 777 passes' if you are using FTP). This is where passwordlist file will be created. Note: for security reasons don't create directory where it can be accessed through web server. 2. Modify password assist script in concordance with instructions inside (Это означает, создай папку: passes и дай атрибуты 777 -зделал папка создана)
2 А вот и сам скрипт, а что тут делать, переименовал скрипт в myscript.cgi, выгрузил ее в паку cgi-bin, поставил атрибуты 755, вставил секюрити код, а вот? # (e.g. /home/myusername/somedir/mypasses.dat)Нихрена не понимаю, что дальше и как, помогите!!!!!!! #!/usr/bin/perl ######## iHasp Password Assist Script v1.1 ########## ############# INSTALATION INSTRUCTIONS ############## # # 1. Replace SECURITY_CODE with your oun security code # Warning: It's VERY IMPORTANT for security reasons
$script_code = "SECURITY_CODE"; # 2. Replace PASSWORDS_FILE with full path to your password file # (e.g. /home/myusername/somedir/mypasses.dat) $pass_file_path = "PASSWORDS_FILE"; # 3. Rename this file. (e.g. mypscript.cgi) # # 4. Upload this file to your server's cgi-bin by FTP. # Warning: Be sure you upload script in ASCII MODE. # # 5. CHMOD script to 755 # (e.g. chmod /home/myusername/cgi-bin/mypscript.cgi 0755) # ######## PLEASE DON'T MODIFY BELOW THIS LINE ########## $ps_ver="1.1"; print "Content-type: text/plain\n\n"; ####################################################### read(STDIN,$temp,$ENV{'CONTENT_LENGTH'}); @pairs=split(/&/,$temp); foreach $item(@pairs) { ($key,$content)=split (/=/,$item,2); $content=~tr/+/ /; $content=~ s/%(..)/pack("c",hex($1))/ge; $fields{$key}=$content; } $action=$fields{'action'}; $delivered_code=$fields{'code'}; $login=$fields{'login'}; $password=$fields{'password'}; ####################################################### &check_recieved($action, $delivered_code, $login, $password); if($action eq 'TEST') { &action_test(); report_ok("Self-test ok."); } &check_password_file($pass_file_path); if ($action eq "ADD") { &action_add($login,$password) ? &report_ok("ADD ok.") : &report_error("ADD failed."); } if ($action eq "DELETE") { &action_delete($login) ? &report_ok("DELETE ok.") : &report_error("DELETE failed."); } if ($action eq "EXIST") { &action_exist($login) ? &report_ok("EXIST ok.") : &report_error("EXIST failed."); } if ($action eq "UPDATE") { &action_update($login,$password) ? &report_ok("UPDATE ok.") : &report_error("UPDATE failed."); } if ($action eq "DELALL") { &action_delall() ? &report_ok("DELALL ok.") : &report_error("DELALL failed."); } &report_error("Unknown action"); ###################### Actions ########################
sub action_add { local($login,$password)=@_; if(&action_exist($login)) { &report_error("Can't add: Login already exists"); return 0; } else { open (PASSFILE,">>$pass_file_path") || &report_error("Can't open password file for adding: $!"); local($crypted)=crypt ($password, "Md"); print PASSFILE "$login:$crypted\n"; close(PASSFILE) || &report_error("Can't close password file: $!"); return 1; } } sub action_delete { local($login)=@_; local($deleted)=0; local($all_data,$cur_login); open (PASSFILE,"<$pass_file_path") || &report_error("Can't open password file for reading: $!"); while (<PASSFILE>) { ($cur_login)=split(/:/); if($cur_login ne $login) { $all_data.=$_; } else { $deleted=1; } } close(PASSFILE) || &report_error("Can't close password file: $!"); open (PASSFILE,">$pass_file_path") || &report_error("Can't open password file for writing: $!"); print PASSFILE "$all_data"; close(PASSFILE) || &report_error("Can't close password file: $!"); return $deleted; } sub action_exist { local($login)=@_; local($exist)=0; local($cur_login); open(PASSFILE,"<$pass_file_path") || &report_error("Can't open password file for reading: $!"); while(<PASSFILE>) { ($cur_login)=split(/:/); if ($cur_login eq $login) {$exist=1;} } close(PASSFILE) || &report_error("Can't close password file: $!"); return $exist; } sub action_update { local($login,$password)=@_; local($crypted)=crypt($password, "Md"); local($updated)=0; local($all_data,$cur_login); open(PASSFILE,"<$pass_file_path") || &report_error("Can't open password file for reading: $!"); while(<PASSFILE>) { ($cur_login)=split(/:/); if($cur_login eq $login) { if(!$updated) { $all_data.="$login:$crypted\n"; $updated=1; } } else { $all_data.=$_; } } close(PASSFILE) || &report_error("Can't close password file: $!"); if(!$updated) { $all_data.="$login:$crypted\n"; $updated=1; } open(PASSFILE,">$pass_file_path") || &report_error("Can't open password file for writing: $!"); print PASSFILE "$all_data"; close(PASSFILE) || &report_error("Can't close password file: $!"); return $updated; } sub action_test { &check_password_file($pass_file_path); &action_add("ihtstlg","ihtstlgpass"); unless(&action_exist("ihtstlg")) { &report_error("Self-test faild."); } &action_update("ihtstlg2","ihtstlgpass2"); unless(&action_exist("ihtstlg2")) { &report_error("Self-test faild."); } &action_update("ihtstlg2","ihtstlgpass3"); unless(&action_exist("ihtstlg2")) { &report_error("Self-test faild."); } &action_delete("ihtstlg"); if(&action_exist("ihtstlg")) { &report_error("Self-test faild."); } &action_delete("ihtstlg2"); if(&action_exist("ihtstlg2")) { &report_error("Self-test faild."); } } sub action_delall { unlink($pass_file_path) || &report_error("Can't unlink password file: $!");; return 1; } ###################### Misc ######################## sub check_password_file { local($pass_file_path)=@_; unless(-e $pass_file_path) { open(PASSFILE,">>$pass_file_path") || report_error("Can't create passwords file: $!"); print PASSFILE ""; close(PASSFILE); } } sub check_recieved { local($action, $delivered_code, $login, $password)=@_; if($delivered_code ne $script_code) { report_error("Security code does not match."); } if(($action eq 'ADD' || $action eq 'UPDATE') && $password eq '') { report_error("Can't do $action without password specified"); } if(($action eq 'ADD' || $action eq 'UPDATE' || $action eq 'DELETE' || $action eq 'EXIST') && $login eq '') { report_error("Can't do $action without login specified"); } } sub report_error { local($error_text)=@_; print("iHasp Error\n$error_text\niHasp Password Assist Script v$ps_ver"); exit(); } sub report_ok { local($ok_text)=@_; print("iHasp Ok\n$ok_text\niHasp Password Assist Script v$ps_ver"); exit(); } 3. Cut & Paste password assist script to new file (e.g. myscript.cgi). 2. Upload it to cgi-bin directory of your site. 3. Set script permissions to 755. 4. Your Security code is: 5. Your Password assist script URL is: Если кто понимает в этом помогите, буду очень благодарным!!!
|