I wrote a script. It works clear in console while i am in as root user.
browser:
http://localhost/cgi-bin/firstcgi.pl
can write to a file but can not creat.
is there administration problem?
is it possible to give extra grants to a script? or apache?
if you need i can write the script.
code here :
###########################start{}
#!/usr/bin/perl
$method=$ENV{'REQUEST_METHOD'};
if ($method eq "GET"){
$form_data=$ENV{'QUERY_STRING'};
}
else{
read(STDIN, $form_data, $ENV{'CONTENT_LENGTH'});
}
$form_data=~s/%(..)/pack("c", hex($1))/eg;
$form_data=~tr/+/ /;
@pairs=split("&", $form_data);
foreach $pair(@pairs){
($name, $value)=split(/=/, $pair);
$frm{$name}=$value;
}
&html_bashlat;
#open(FIN,">>makefilein.txt") or die "Fayl in acilmadi\n ";
open(FIL,"<makefilen.txt") or die "Fayl in acilmadi\n ";
#flock(FIN, 2) or die "Fayl ekskluziv olaraq baglanila bilinmedi\n ($!)";
#open(FIL,"+>makefilen.txt") or die "Fayl n acilmadi\n ";
#print FIN "salam ala nuppala \n";
$a=<FIL>+1;
close(FIL);
open(FIL,">makefilen.txt") or die "Fayl n acilmadi\n ";;
print FIL "$a";
close(FIL);
$F='eth'.$a;
open(NEWF, ">".$F);
print NEWF "$frm{'ip'}";
#print "$c $frm{'ip'}";
#print NEWF ($frm{'zirt'})."\n";
#print NEWF ($frm{'pirt'})."\n";
close(NEWF);
#$a=7;
#$a=$a+<FIL>;
#print "$a"."\n";
#print (<FIL>."\n");
#flock(FIN, 8) or die "Fayl ekskluzivlikden azad oluna bilinmedi\n ";
#close(FIN);
#print "$frm{'ip'}";
&html_kapat;
#system("chmod 0777 *");
exit;
sub baglanti_kurulamadi{
&html_bashlat;
print "<p><h2>";
print "$sunucu veri tabani sunucusuna baglanti kurulamadi!";
print "</h2>";
&html_kapat;
exit;
}
sub html_bashlat{
print "Content-type:text/html\n\n";
print "<html>\n";
#turkce karakterler sorunsuz gorunsun diye..
print "<meta http-equiv='Content-Type' ";
print " content='text/html; charset=iso-8859-9'>\n";
print "<meta http-equiv='Content-Type' ";
print " content='text/html; charset=windows-1254'>\n";
print "<body>\n";
}
sub html_kapat{
print "</body></html>\n";
}
#####################end;
thanks in advance.