Weapon
December 6th, 2001, 23:40
covert this script to php for meh please?
#!/usr/bin/perl
@okaysites = ("http://www.myacen.net/otashki", "http://myacen.net/otashki");
$reffer = $ENV{'HTTP_REFERER'};
$headfile = '/home/myacen2/public_html/otashki/header.txt';
$footfile = '/home/myacen2/public_html/otashki/footer.txt';
$File = $ENV{'QUERY_STRING'};
unless (open (DATA,"$headfile")) {die (&error);}
if ($uselock eq '1') {
flock DATA, 2;
seek DATA, 0, 0;
}
@headinfo = <DATA>;
if ($uselock eq '1') {
flock DATA, 8;
}
close (DATA);
foreach $headline (@headinfo){
$heading = $heading.$headline;
}
unless (open (DATA,"$footfile")) {die (&error);}
if ($uselock eq '1') {
flock DATA, 2;
seek DATA, 0, 0;
}
@footinfo = <DATA>;
if ($uselock eq '1') {
flock DATA, 8;
}
close (DATA);
foreach $footline (@footinfo){
$footer = $footer.$footline;
}
foreach $domain (@okaysites) {
if ($reffer =~ /$domain/) {
print "Content-type:text/html\n\n";
print "$heading";
print "<CENTER><IMG SRC=\"$File\"></CENTER>";
print "$footer";
exit;
}
}
sub error {
print "Content-type:text/html\n\n";
print "Error!";
exit;
}
#!/usr/bin/perl
@okaysites = ("http://www.myacen.net/otashki", "http://myacen.net/otashki");
$reffer = $ENV{'HTTP_REFERER'};
$headfile = '/home/myacen2/public_html/otashki/header.txt';
$footfile = '/home/myacen2/public_html/otashki/footer.txt';
$File = $ENV{'QUERY_STRING'};
unless (open (DATA,"$headfile")) {die (&error);}
if ($uselock eq '1') {
flock DATA, 2;
seek DATA, 0, 0;
}
@headinfo = <DATA>;
if ($uselock eq '1') {
flock DATA, 8;
}
close (DATA);
foreach $headline (@headinfo){
$heading = $heading.$headline;
}
unless (open (DATA,"$footfile")) {die (&error);}
if ($uselock eq '1') {
flock DATA, 2;
seek DATA, 0, 0;
}
@footinfo = <DATA>;
if ($uselock eq '1') {
flock DATA, 8;
}
close (DATA);
foreach $footline (@footinfo){
$footer = $footer.$footline;
}
foreach $domain (@okaysites) {
if ($reffer =~ /$domain/) {
print "Content-type:text/html\n\n";
print "$heading";
print "<CENTER><IMG SRC=\"$File\"></CENTER>";
print "$footer";
exit;
}
}
sub error {
print "Content-type:text/html\n\n";
print "Error!";
exit;
}