С PERL на PHP
Код:
#!/usr/bin/perl -w
use strict;
use 5.014;
use CGI qw(:all);
print "Content-Type: text/plain; charset=utf-8\n\n";
open FILE, "example.txt" or die "Cen't open file: $!";
my @fl = <FILE>;
close FILE;
if (@fl[0] >= 10) {
say "10 clicks!!!!!";
exit;
}
unless (param('i') == 1) {
say @fl[0];
} else {
open FL, ">example.txt" or die "Cen't open file: $!";
print FL @fl[0]+1;
close FL;
say @fl[0]+1;
}
use strict;
use 5.014;
use CGI qw(:all);
print "Content-Type: text/plain; charset=utf-8\n\n";
open FILE, "example.txt" or die "Cen't open file: $!";
my @fl = <FILE>;
close FILE;
if (@fl[0] >= 10) {
say "10 clicks!!!!!";
exit;
}
unless (param('i') == 1) {
say @fl[0];
} else {
open FL, ">example.txt" or die "Cen't open file: $!";
print FL @fl[0]+1;
close FL;
say @fl[0]+1;
}
Код:
#!/usr/bin/perl -w
use strict;
print "Content-Type: text/plain; charset=utf-8\n\n";
open FILE, ">example.txt" or die "Cen't open file: $!";
close FILE;
print "Done!";
use strict;
print "Content-Type: text/plain; charset=utf-8\n\n";
open FILE, ">example.txt" or die "Cen't open file: $!";
close FILE;
print "Done!";
Код:
<?php
print "Content-Type: text/plain; charset=utf-8\n\n";
$fl=file("example.txt");
if (intval($fl[0]) >= 10) {
print "10 clicks!!!!!\n";
exit;
}
if ($_REQUEST('i') != 1) {
print $fl[0]."\n";
}
else {
$fw=fopen("example.txt","w");
fputs($fw,($fl[0]+1)."\n");
fclose($fw);
print $fl[0]+1;
}
?>
print "Content-Type: text/plain; charset=utf-8\n\n";
$fl=file("example.txt");
if (intval($fl[0]) >= 10) {
print "10 clicks!!!!!\n";
exit;
}
if ($_REQUEST('i') != 1) {
print $fl[0]."\n";
}
else {
$fw=fopen("example.txt","w");
fputs($fw,($fl[0]+1)."\n");
fclose($fw);
print $fl[0]+1;
}
?>
Код:
<?php
print "Content-Type: text/plain; charset=utf-8\n\n";
$fw=fopen("example.txt","w");
if ($fw) close($fw); else die "Cen't open file!";
print "Done!";
?>
print "Content-Type: text/plain; charset=utf-8\n\n";
$fw=fopen("example.txt","w");
if ($fw) close($fw); else die "Cen't open file!";
print "Done!";
?>