Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,8 @@
# page-access-script
example
#Page-Access-Script

Script generujúci automatické zobrazenia nastaveným stránkam -> script je spúšťaný pomocou serverového cron-a

Hosting musí podporovať: - php
- cron

-> podpora ping príkazu bude pridaná čoskoro
22 changes: 19 additions & 3 deletions page_acces_script.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
<?php
// napis stranky do zoznamu -premenna-
// napis stranky do zoznamu -premennej-$stranky
$stranky = array(
'http://www.youtube.com/`,
'http://www.google.com/`,
'http://www.youtube.com`,
'http://www.google.com`,
'http://www.github.com`,
);

// uloz si pocet stranok
Expand All @@ -14,4 +15,19 @@
// do premennej $homepage nacitaj obsah stranky
$homepage = file_get_contents( $stranky[$nahodne_cislo] );
echo $homepage;

// ping funkcia
function pingAddress($ip) {
$pingresult = exec("/bin/ping -n 3 $ip", $outcome, $status);
if (0 == $status) {
$status = "alive";
} else {
$status = "dead";
}
echo "The IP address, $ip, is ".$status;
}

//http://stackoverflow.com/questions/8030789/pinging-an-ip-address-using-php-and-echoing-the-result
pingAddress("127.0.0.1");

?>