function parse_file($to_use, $verbose = false, $very_verbose = false, $i = NULL, $count = NULL) { global $tokens, $TEXT, $FILENAME, $OCPORTAL_PATH; $FILENAME = $to_use; if ($OCPORTAL_PATH != '' && substr($FILENAME, 0, strlen($OCPORTAL_PATH)) == $OCPORTAL_PATH) { $FILENAME = substr($FILENAME, strlen($OCPORTAL_PATH)); if (substr($FILENAME, 0, 1) == DIRECTORY_SEPARATOR) { $FILENAME = substr($FILENAME, 1); } if (substr($FILENAME, 0, 1) == DIRECTORY_SEPARATOR) { $FILENAME = substr($FILENAME, 1); } } $TEXT = str_replace(chr(13), '', file_get_contents($to_use)); if ($verbose) { echo '<hr /><p>DOING ' . $to_use . '</p>'; } if ($verbose) { echo '<pre>'; } if ($very_verbose) { echo '0000000000111111111122222222223333333333444444444455555555556666666666777777777788888888889999999999' . "\n"; } if ($very_verbose) { echo '0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789' . "\n"; } if ($very_verbose) { echo '<b>Our code...</b>' . "\n"; } if ($very_verbose) { echo htmlentities($TEXT); } if ($verbose) { echo "\n\n" . '<b>Starting lexing...</b>' . "\n"; } $tokens = lex(); if ($very_verbose) { print_r($tokens); } if ($very_verbose) { echo count($tokens) . ' tokens'; } if ($verbose) { echo "\n\n" . '<b>Starting parsing...</b>' . "\n"; } $structure = parse(); if ($very_verbose) { print_r($structure); } if ($verbose) { echo '</pre>'; } echo 'DONE ' . $FILENAME; if (!is_null($i)) { echo ' - ' . $i . ' of ' . $count; } echo cnl(); return $structure; }
$ERROR_FUNCS = array('posix_getuid' => 1, 'ftp_fput' => 1, 'ftp_nlist' => 1, 'ftp_size' => 1, 'ftp_cdup' => 1, 'ftp_pasv' => 1, 'ftp_rawlist' => 1, 'ftp_cdup' => 1, 'ftp_chdir' => 1, 'ftp_pwd' => 1, 'ftp_login' => 1, 'ftp_mkdir' => 1, 'ftp_rmdir' => 1, 'ftp_get' => 1, 'ftp_fget' => 1, 'ftp_put' => 1, 'ftp_rename' => 1, 'ftp_delete' => 1, 'ftp_site' => 1, 'gzopen' => 1, 'imagecreatefromstring' => 1, 'imagecreatefrompng' => 1, 'imagecreatefromjpeg' => 1, 'ldap_bind' => 1, 'ldap_connect' => 1, 'ldap_list' => 1, 'ldap_search' => 1, 'ldap_add' => 1, 'ldap_compare' => 1, 'ldap_delete' => 1, 'ldap_mod_add' => 1, 'ldap_mod_del' => 1, 'ldap_mod_replace' => 1, 'ldap_modify' => 1, 'ldap_read' => 1, 'ldap_rename' => 1, 'mail' => 1, 'move_uploaded_file' => 1, 'mysql_data_seek' => 1, 'mysql_field_name' => 1, 'mysql_field_len' => 1, 'mysql_field_flags' => 1, 'mysql_field_type' => 1, 'mysql_field_seek' => 1, 'mysql_field_table' => 1, 'ob_end_flush' => 1, 'ob_end_clean' => 1, 'parse_url' => 1, 'shell_exec' => 1, 'unserialize' => 1, 'unpack' => 1, 'system' => 1, 'popen' => 1, 'getimagesize' => 1, 'error_log' => 1, 'session_cache_limiter' => 1, 'session_start' => 1, 'imagepng' => 1, 'imagejpeg' => 1, 'imagettfbbox' => 1, 'imagettftext' => 1, 'gethostbyname' => 1, 'imagecreatetruecolor' => 1, 'imagetruecolortopalette' => 1, 'imagesetthickness' => 1, 'imageellipse' => 1, 'imagefilledellipse' => 1, 'imagefilledarc' => 1, 'imagealphablending' => 1, 'imagecolorresolvealpha' => 1, 'imagecolorexactalpha' => 1, 'imagecopyresampled' => 1, 'imagesettile' => 1, 'imagesetbrush' => 1, 'putenv' => 1, 'rmdir' => 1, 'opendir' => 1, 'copy' => 1, 'file' => 1, 'fopen' => 1, 'chmod' => 1, 'chgrp' => 1, 'unlink' => 1, 'mkdir' => 1, 'rename' => 1, 'chdir' => 1, 'filectime' => 1, 'filegroup' => 1, 'filemtime' => 1, 'fileowner' => 1, 'fileperms' => 1, 'filesize' => 1, 'opendir' => 1, 'pathinfo' => 1, 'fileatime' => 1, 'md5_file' => 1, 'readfile' => 1, 'readgzfile' => 1, 'filetype' => 1, 'parse_ini_file' => 1, 'is_executable' => 1, 'disk_free_space' => 1, 'disk_total_space' => 1, 'get_meta_tags' => 1, 'gzfile' => 1, 'tempnam' => 1, 'tmpfile' => 1, 'flock' => 1, 'touch' => 1, 'highlight_file' => 1, 'set_time_limit' => 1, 'exec' => 1, 'passthru' => 1); // Load up function info global $FUNCTION_SIGNATURES; global $OCPORTAL_PATH; if (isset($GLOBALS['API']) || isset($_GET['test'])) { $functions_file = file_get_contents(file_exists($OCPORTAL_PATH . '/data_custom/functions.dat') ? $OCPORTAL_PATH . '/data_custom/functions.dat' : 'functions.dat'); $FUNCTION_SIGNATURES = unserialize($functions_file); } else { $FUNCTION_SIGNATURES = array(); } // To get it started if (isset($_GET['test'])) { $GLOBALS['API'] = 1; $GLOBALS['CHECKS'] = 1; $tests = get_tests(); $parsed = parse(lex('<' . '?php' . "\n" . $tests[$_GET['test']] . "\n")); check($parsed); } elseif (!isset($_GET['to_use']) && !isset($_SERVER['argv'][1])) { $avoid = array(); if (isset($_GET['avoid'])) { $avoid = explode(',', $_GET['avoid']); } $files = do_dir($OCPORTAL_PATH . (isset($_GET['subdir']) ? '/' . $_GET['subdir'] : ''), true, false, $avoid); $start = isset($_GET['start']) ? intval($_GET['start']) : 0; foreach ($files as $i => $to_use) { if ($i <= $start) { continue; } // Set to largest number we know so far work if (strpos(file_get_contents($to_use), '/*CQC: No check*/') !== false) { echo 'SKIP: ' . $to_use;
for ($x = 0; $x < count($digits); $x++) { for ($y = 0; $y < count($digits); $y++) { for ($z = 0; $z < count($digits); $z++) { if ($x != $y && $x != $z && $y != $z) { $nums[] = array($digits[$x], $digits[$y], $digits[$z]); } } } } return $nums[$pos - 1]; } $remainder = 1000000; $digits = array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9); $num = ""; for ($i = 9; $i > 0; $i--) { $fact = bcfact($i); $x = 1; while ($fact * ($x + 1) <= $remainder) { $x++; } $num .= $digits[$x]; unset($digits[$x]); sort($digits); $remainder = $remainder - $fact * $x; if ($remainder < 10) { $final = lex($digits, $remainder); $num .= implode($final); $i = 0; } } result(2783915460, $num);