Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/local/bin/php
- <?php
- echo "Hello Squid";
- echo "\n";
- function readline($prompt = null) {
- if($prompt) {
- echo $prompt;
- }
- $fp = fopen("php://stdin","r");
- $line = rtrim(fgets($fp, 1024));
- fclose($fp);
- return $line;
- }
- function shutoff() {
- echo "Shutting down.\n";
- file_put_contents("/home/basel/Desktop/php/h.txt","----end----\n\n", FILE_APPEND);
- exit;
- }
- //register_shutdown_function('shutoff');
- $cur = 0;
- foreach ($argv as $ffffff) {
- $cur += 1;
- file_put_contents("/home/basel/Desktop/php/h.txt","arg" . $cur . ": " . $ffffff."\n", FILE_APPEND);
- }
- file_put_contents("/home/basel/Desktop/php/h.txt","\n", FILE_APPEND);
- $shut = 0;
- while ($shut != 1) {
- //$gg = readline("Command:");
- $gg = readline();
- if (!is_null($gg)) {
- if ($gg === "shutdown") {
- file_put_contents("/home/basel/Desktop/php/ht.txt",":" . $gg."\n",FILE_APPEND);
- file_put_contents("/home/basel/Desktop/php/ht.txt","----end----\n\n",FILE_APPEND);
- break;
- $shut = 1;
- } else {
- file_put_contents("/home/basel/Desktop/php/ht.txt",":" . $gg."\n",FILE_APPEND);
- }
- }
- }
- shutoff();
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement