У меня есть хороший скрипт комментариев,но вот установил его,а в скрипте ошибка,неможете сказать где?? :rolleyes:
ВОТ СКРИПТ.
#!/usr/bin/perl
#########################################################
# (c) 2001 by Developers.com.ua
#########################################################
use CGI;
use Fcntl \':flock\';
$query = new CGI;
$file_url="";
#
# Change variable file_local he must contain local path to your www directory
#
$file_local="/public_html/";
$file_db="comments/comments.db";
$template="comments/comments.tmpl";
$editor="comments/editor.tmpl";
$lt="<";
$gt=">";
$br="
";
$start="";
$nick = $query->param(\'NICK\');
$text = $query->param(\'COMMENT\');
$id = $query->param(\'ID\');
$cmd = $query->param(\'cmd\');
$id=~s/[^\\d]//ge;
$nick=~s/[^A-Z,a-z,\\d,-,_,.]//ge;
$text=~s/\\x3C/$lt/ge;
$text=~s/\\x3E/$gt/ge;
$text=~s/\\x0D//ge;
$text=~s/\\x0A/$br/ge;
$text=~s/[\\x00-\\x1F]//ge;
if($cmd eq "edit")
{ print "Content-type: text/html;charset=windows-1251\\n\\n";
$a=get_template("$editor");
$a=~s/_ID_/$id/ge;
print "$a";
return;
}
open(FILE,"< $file_db") || die "cannt open file!";
$file="";
while(
)
{ ($iid,$ffile) = split("\\t",$_);
$iid=~s/[^\\d]//ge;
if($iid eq $id) { $file=$ffile;}
};
close(FILE);
$file=~s/\\0x0-\\x1F//ge;
if(length($file)==0) { die "Incorrect id";}
$file_url="$file_url$file";
$file_local="$file_local$file";
($sec,$min,$hour,$day,$month,$year) = localtime(time());
$year=$year+1900;
$month++;
if(length("$month")==1) { $month="0$month";}
if(length("$day")==1) { $day="0$day";}
$mdate="$day/$month/$year";
$news=get_template($template);
$news=~s/_NICK_/$nick/ge;
$news=~s/_DATE_/$mdate/ge;
$news=~s/_COMMENT_/$text/ge;
open(FILE,"+< $file_local") || die "cannt open file!";
flock(FILE, 2);
@tmpl=;
$SIZE=$#tmpl;
seek(FILE,0,SEEK_SET);
truncate(FILE, 0);
$a="";
for($i=0;$i<=$SIZE;$i++)
{ $b=$tmpl[$i];
$_=$b;
if (/$start/)
{ $b="$news$b\\n";
}
$a="$a$b";
}
print FILE "$a";
flock(FILE, ;
close(FILE);
print "Location: $file_url\\n\\n";
return;
sub get_template()
{ my(@body,$a);
open(FILE,"< $_[0]") || die "cannt open file!";
@body=;
close(FILE);
$a=join("",@body);
return($a);
}