#!/usr/bin/env perl
use strictures;
use CGI ":standard";
use Date::Calc "Today";
my $pid = fork();
if ( $pid )
{
hold_page();
}
elsif ( $pid == 0 )
{
write_php();
}
else
{
die "Couldn't fork\n";
}
exit 0;
sub hold_page {
print header(),
start_html("OHAI"),
h1("Keep panties unbunched!"),
noscript("It's", (Today())[0] . ", for the love of crabcakes!"
+,
"Enable JS!");
print <<'_HTML_'; # <- single quote matters.
<script src="https://code.jquery.com/jquery-3.4.1.min.js"
integrity="sha256-CSXorXvZcTkaix6Yvo6HppcZGetbYMGWSFlBw8HfCJ
+o="
crossorigin="anonymous"></script>
<script>
function checkPHP() {
$.ajax({ url: "FILL THIS IN"
,timeout: 1000 })
.done( function( data ) {
window.location.href = "FILL THIS IN";
})
.fail( function( jqXHR, textStatus, errorThrown ) {
if ( textStatus === "timeout" )
{
setTimeout(checkPHP, 2000);
return; // Keep trying.
}
else if ( jqXHR.status == 404 )
{
setTimeout(checkPHP, 2000);
return; // Keep trying.
}
else
{
alert("WAT? " + jqXHR.status + " " + errorThrown);
}
});
}
$(function(){ checkPHP() });
</script>
_HTML_
print end_html();
}
sub write_php {
# Execute script that will write page
# found at URL "FILL THIS IN"
}
|