Criei um pequeno brinquedo para aqueles que estão a aprender php e não têm onde executar as funções php e para aqueles que querem simplesmente testar um codigo php ou algo assim.
Aqui vai o codigo:
<?php
set_time_limit(3);
header("Content-Type: text/html");
$Comando = $_GET['Comando']; $executar = $_GET['executar'];
/* Por favor não apaque os creditos do criador */
?>
<title>Terminal PHP - Criado Por Kingless - blastelf@hotmail.com</title>
<style type="text/css">
body {background-color:#FFFFFF; font-family:arial,sans-serif; font-size: 13px; }
form { margin: 0px; padding: 0px; border: 0px; }
textarea {
background-color: #FFFFFF;
color : #000000;
border-style : none;
font-size : 13px;
width: 90%;
height: 200;
}
</style>
<!-- Terminal PHP - Criado Por Kingless - blastelf@hotmail.com -->
<hr color="gray">
<form action="<?__FILE__?>" method="get">
<input type="hidden" name="user_ip" value="<?=$_SERVER['REMOTE_ADDR']?>">
<textarea size="80%" name="Comando"></textarea><br/>
<input type="submit" name="executar" value="Executar!">
<hr color="gray">
<?php
$funcs = array("exec", "set_time_limit", "system","PHP_DATADIR", "PHP_SYSCONFDIR", "PHP_CONFIG_FILE_PATH", "PHP_EXTENSION_DIR", "PHP_EOL", "PATHINFO_", "mysql", '$PHP_SELF', '$_COOKIE','$_SESSION','$_FILES', '$SERVER_NAME', '$SERVER_SOFTWARE', '$DOCUMENT_ROOT', '$SERVER_ADMIN', '$SERVER_SIGNATURE', '$SERVER_SCRIPTNAME','$PHP_AUTH_USER', '$SCRIPT_FILENAME', "realpath","shell_exec", "PHP_VERSION", "PHP_OS", "fopen", "fsockopen", "file_get_contents", "file", "fwrite", "fgets", "ftp", "opendir", "fgetss", '$_GET', '$_POST', '$_ENV', '$_REQUEST', '$_SERVER', '$HTTP_', "file_put_contents", "fileowner", "mkdir", "DOCUMENT_ROOT", "readfile", "rmdir", "popen", "pathinfo", "fscanf", "fread", "flock", "disk_free_space", "fputs", "disk_total_space", "copy", "dirname", "delete", "chmod", "chown", "file_exists", "rewinddir", "readdir", "chdir", "dir", "getcwd", "scandir", "chroot", "ftp_connect", "ftp_put");
if(isset($executar) AND isset($Comando)) {
unset($executar);
$executar['strip'] = stripslashes($Comando);
while(list(,$func) = each($funcs)) {
if(strpos($executar['strip'], $func)) {
echo("<b>Warning:</b> A função <b>\"$func\"</b> foi desactivada por razões de segurança.<br /><br /><br />");
if($executar['strip'] != "") {
echo("<b>[Codigo]:</b><br /><br />\n");
$executar['cor'] = highlight_string($executar['strip']);
$executar['cor'] = explode("1", $executar['cor']);
echo($executar['cor'][0]."\n");
}
unset($executar);
die(0);
}
}
if(preg_match("/(system|exec|shell_exec|`|passthru|proc_open|proc_nice|proc_close|file_get_contents|fput|fgets|fsockopen|fopen|file|fwrite)+/i", $executar['strip'])) {
echo("<b>Warning:</b> Esta função foi desactivada por razões de segurança.<br /><br /><br />");
unset($executar);
die(0);
}
$executar['CMD'] = exec("php -r '{$executar['strip']}'");
if($executar['CMD']) {
echo "<b>[Codigo]:</b><br /><br />";
$executar['cor'] = highlight_string($executar['strip']);
$executar['cor'] = explode("1", $executar['cor']);
echo "{$executar['cor'][0]}\n<br /><br />";
unset($executar['cor'][0]);
print("<b>[Resultado]:</b><br /><br />");
print($executar['CMD']."\n");
unset($executar);
} else {
echo("O processo terminou inesperadamente, verifique o seu codigo!<br /><br /><br />");
if($executar['strip'] != "") {
echo("<b>[Codigo]:</b><br /><br />\n");
$executar['cor'] = highlight_string($executar['strip']);
$executar['cor'] = explode("1", $executar['cor']);
echo($executar['cor'][0]."\n");
}
unset($executar);
die(0);
}
}
?>
Tenho aqui o codigo ja pronto a testar:
http://213.22.96.78/php.phpPara executar as funções php é so digitar exemplo:
echo "aeiou";
Sem <?php ou ?>
Tutorial de php:
http://pt.php.net/manual/pt_BR/language.basic-syntax.phpEspero que isso seje útil !!
PS: O codigo não funciona em windows e em certos servidores.