Help Please.
Posted: 31. March 2006 18:53
Hi all.
I'm corrently running a linux server on redhat linux 9.0+lampp.1.5.0
I whant to put a script for free hosting.
This is my apache configuration
ScriptAlias /cgi-bin/ "/opt/lampp/cgi-bin/"
<IfModule mod_cgid.c>
#
# Additional to mod_cgid.c settings, mod_cgid has Scriptsock <path>
# for setting UNIX socket for communicating with cgid.
#
#Scriptsock logs/cgisock
</IfModule>
#
# "/opt/lampp/cgi-bin" should be changed to whatever your ScriptAliased
# CGI directory exists, if you have that configured.
#
<Directory "/opt/lampp/cgi-bin/">
AllowOverride None
Options None
Order allow,deny
Allow from all
</Directory>
------------------------------------------------------------
So i whant this script to work
!/opt/lampp/bin/perl
####################################################################################################
# AUTOUSERADD Version 2.0
# Copyright Psybercore, Inc. info@superscripts.com
####################################################################################################
# COPYRIGHT NOTICE
# Copyright Psybercore, Inc. - All Rights Reserved.
# http://www.superscripts.com
# Selling the code for this program, modifying or redistributing this software over the Internet or
# in any other medium is forbidden. Copyright and header may not be modified
#
# My name is DREW STAR... AND I AM FUNNNNNNKYYYYY http://www.mp3.com/drewstar/
#
####################################################################################################
$ENV{PATH} = "/home/public_html/cgi-bin/autouseradd";
delete @ENV{'IFS', 'CDPATH', 'ENV', 'BASH_ENV'};
$| = 1;
require "cgi-lib.pl";
use Expect;
&ReadParse;
## REMOVE THE TAINT -- usernames MUST be letters or numbers ONLY
print "Content-type: text/html\n\n";
if($in{username} =~ /^([a-z0-9]+)$/) {
$username = $1;
system("/usr/sbin/useradd $1");
} else {
print "Unacceptable username!\n";
exit;
}
if($in{password} =~ /^([a-z0-9]+)$/) {
$password = $1;
} else {
print "Unacceptable password!\n";
exit;
}
print "<PRE>";
print "user $username added.";
print "Setting password. This may take a while. Do NOT click 'Stop'.\n";
$passwd_prog = Expect->spawn("/bin/su -") || die ("Couldn't spawn passwd, $!\n");
unless ($passwd_prog->expect(10,"word:")) {
die "Never got password prompt, " .$passwd_prog->exp_error()."\n";
}
sleep 1;
print $passwd_prog "mame883910\r";
sleep 2;
unless ($passwd_prog->expect(10,"#")) {
die "Never got prompt, " .$passwd_prog->exp_error()."\n";
}
print $passwd_prog "/usr/bin/passwd $username\n";
sleep 2;
unless ($passwd_prog->expect(10,"New UNIX password: ")) {
die "Never got password prompt, " .$passwd_prog->exp_error()."\n";
}
sleep 2;
print $passwd_prog "$password\r";
#sleep 5;
unless ($passwd_prog->expect(20,"Retype new UNIX password: ")) {
$value = $passwd_prog->exp_before();
$value = $passwd_prog->exp_match();
$value = $passwd_prog->exp_after();
print "VALUE is $vaue\n";
die "Never got retype password prompt," .$passwd_prog->exp_error()."\n";
}
sleep 5;
print $passwd_prog "$password\r";
sleep 5;
print "\n\n<B>DONE!</B>\n\n";
exit;
----------------
And when im trying to make it work it says:
Premature end of script headers: mkacct.cgi
My script is chmod 755
Could somebody help me?
I'm corrently running a linux server on redhat linux 9.0+lampp.1.5.0
I whant to put a script for free hosting.
This is my apache configuration
ScriptAlias /cgi-bin/ "/opt/lampp/cgi-bin/"
<IfModule mod_cgid.c>
#
# Additional to mod_cgid.c settings, mod_cgid has Scriptsock <path>
# for setting UNIX socket for communicating with cgid.
#
#Scriptsock logs/cgisock
</IfModule>
#
# "/opt/lampp/cgi-bin" should be changed to whatever your ScriptAliased
# CGI directory exists, if you have that configured.
#
<Directory "/opt/lampp/cgi-bin/">
AllowOverride None
Options None
Order allow,deny
Allow from all
</Directory>
------------------------------------------------------------
So i whant this script to work
!/opt/lampp/bin/perl
####################################################################################################
# AUTOUSERADD Version 2.0
# Copyright Psybercore, Inc. info@superscripts.com
####################################################################################################
# COPYRIGHT NOTICE
# Copyright Psybercore, Inc. - All Rights Reserved.
# http://www.superscripts.com
# Selling the code for this program, modifying or redistributing this software over the Internet or
# in any other medium is forbidden. Copyright and header may not be modified
#
# My name is DREW STAR... AND I AM FUNNNNNNKYYYYY http://www.mp3.com/drewstar/
#
####################################################################################################
$ENV{PATH} = "/home/public_html/cgi-bin/autouseradd";
delete @ENV{'IFS', 'CDPATH', 'ENV', 'BASH_ENV'};
$| = 1;
require "cgi-lib.pl";
use Expect;
&ReadParse;
## REMOVE THE TAINT -- usernames MUST be letters or numbers ONLY
print "Content-type: text/html\n\n";
if($in{username} =~ /^([a-z0-9]+)$/) {
$username = $1;
system("/usr/sbin/useradd $1");
} else {
print "Unacceptable username!\n";
exit;
}
if($in{password} =~ /^([a-z0-9]+)$/) {
$password = $1;
} else {
print "Unacceptable password!\n";
exit;
}
print "<PRE>";
print "user $username added.";
print "Setting password. This may take a while. Do NOT click 'Stop'.\n";
$passwd_prog = Expect->spawn("/bin/su -") || die ("Couldn't spawn passwd, $!\n");
unless ($passwd_prog->expect(10,"word:")) {
die "Never got password prompt, " .$passwd_prog->exp_error()."\n";
}
sleep 1;
print $passwd_prog "mame883910\r";
sleep 2;
unless ($passwd_prog->expect(10,"#")) {
die "Never got prompt, " .$passwd_prog->exp_error()."\n";
}
print $passwd_prog "/usr/bin/passwd $username\n";
sleep 2;
unless ($passwd_prog->expect(10,"New UNIX password: ")) {
die "Never got password prompt, " .$passwd_prog->exp_error()."\n";
}
sleep 2;
print $passwd_prog "$password\r";
#sleep 5;
unless ($passwd_prog->expect(20,"Retype new UNIX password: ")) {
$value = $passwd_prog->exp_before();
$value = $passwd_prog->exp_match();
$value = $passwd_prog->exp_after();
print "VALUE is $vaue\n";
die "Never got retype password prompt," .$passwd_prog->exp_error()."\n";
}
sleep 5;
print $passwd_prog "$password\r";
sleep 5;
print "\n\n<B>DONE!</B>\n\n";
exit;
----------------
And when im trying to make it work it says:
Premature end of script headers: mkacct.cgi
My script is chmod 755
Could somebody help me?