4, ); /** * PHP Console * * A web-based php debug console * * Copyright (C) 2010, Jordi Boggiano * http://seld.be/ - j.boggiano@seld.be * * Licensed under the new BSD License * See the LICENSE file for details * * Source on Github http://github.com/Seldaek/php-console */ if (!in_array($_SERVER['REMOTE_ADDR'], array('127.0.0.1', '::1'), true)) { header('HTTP/1.1 401 Access unauthorized'); die('ERR/401 Go Away'); } define('PHP_CONSOLE_VERSION', '1.3.0-dev'); require 'krumo/class.krumo.php'; ini_set('log_errors', 0); ini_set('display_errors', 1); error_reporting(E_ALL | E_STRICT); $debugOutput = ''; if (isset($_POST['code'])) { if (get_magic_quotes_gpc()) { $code = stripslashes($code); } $code = trim(preg_replace('{^\s*<\?(php)?}i', '', $_POST['code'])); // if there's only one line wrap it into a krumo() call if (preg_match('#^(?!var_dump|echo|print|< )([^\r\n]+?);?\s*$#is', $code, $m) && trim($m[1])) { $code = 'krumo('.$m[1].');'; } // replace '< foo' by krumo(foo) $code = preg_replace('#^<\s+(.+?);?[\r\n]?$#m', 'krumo($1);', $code); // replace newlines in the entire code block by the new specified one // i.e. put #\r\n on the first line to emulate a file with windows line // endings if you're on a unix box if (preg_match('{#((?:\\\\[rn]){1,2})}', $code, $m)) { $newLineBreak = str_replace(array('\\n', '\\r'), array("\n", "\r"), $m[1]); $code = preg_replace('#(\r?\n|\r\n?)#', $newLineBreak, $code); } ob_start(); eval($code); $debugOutput = ob_get_clean(); if (isset($_GET['js'])) { header('Content-Type: text/plain'); echo $debugOutput; die('#end-php-console-output#'); } } ?> Debug Console
Line: 1, Column: 1 Copy selection:
debug: < foo() krumo(foo());
commands: krumo::backtrace(); krumo::includes(); krumo::functions(); krumo::classes(); krumo::defines();
misc: press ctrl-enter to submit put '#\n' on the first line to enforce \n line breaks (\r\n etc work too)