• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP pclose函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中pclose函数的典型用法代码示例。如果您正苦于以下问题:PHP pclose函数的具体用法?PHP pclose怎么用?PHP pclose使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了pclose函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: hook_post_auth_update_zonep_config

function hook_post_auth_update_zonep_config($login = null, $password = null) {
    global $ad_server, $ad_base_dn, $ad_bind_dn, $ad_bind_pw;
    global $ldap_server, $ldap_base_dn, $adminRdn, $adminPw, $se3Ip;

    // Check arguments
    if(!is_string($login) or !is_string($password))
	return false;

    // Ensure we have an ActiveDirectory server or LDAP server to contact
    if (empty($ad_server) && empty($ldap_server))
	return false;
	
	// Connect to AD or LDAP
	if (!empty($ad_server))    
		$ds = ldap_connect($ad_server);
	else
		$ds = ldap_connect($ldap_server);	

    if(!$ds)
	return false;
	
    // admin Bind on AD or LDAP
	if (!empty($ad_server))    
    	$r = ldap_bind($ds, $ad_bind_dn, $ad_bind_pw);
    else
    	$r = ldap_bind($ds, $adminRddn.$ldap_base_dn, $adminPw);    

    if(!$r)
	return false;

    // Fetch UNC from Active Directory
    $attributes = array('homeDirectory');

	if (!empty($ad_server))
    	$sr = ldap_search($ds, $ad_base_dn, "(sAMAccountName=$login)", $attributes);
    else 	
    	$sr = ldap_search($ds, $ldap_base_dn, "(uid=$login)", $attributes);

    if (! $sr)
	return false;

    $entries = ldap_get_entries($ds, $sr);

    if(empty($entries[0]['homedirectory'][0]))
	return false;

    if (!empty($ad_server))
    	$smb_share = str_replace('\\', '/', $entries[0]['homedirectory'][0]);
    else
    	$smb_share = "//$se3Ip/$login";

    // Call sudo wrapper to create autofs configuration file
    $handle = popen('sudo lcs-zonep-update-credentials', 'w');
    fwrite($handle, "$login\n$password\n$smb_share\n");
    $status = pclose($handle) >> 8;
    if ($status != 0)
	return false;

    return true;
}
开发者ID:rhertzog,项目名称:lcs,代码行数:60,代码来源:update_zonep_config.php


示例2: SendMail

 function SendMail($to, $subject, $body, $headers)
 {
     $command = $this->sendmail_path . " -t";
     if (isset($this->delivery["Headers"])) {
         $headers_values = $this->delivery["Headers"];
         for ($return_path = "", $header = 0, Reset($headers_values); $header < count($headers_values); $header++, Next($headers_values)) {
             if (strtolower(Key($headers_values)) == "return-path") {
                 $return_path = $headers_values[Key($headers_values)];
                 break;
             }
         }
         if (strlen($return_path)) {
             $command .= " -f {$return_path}";
         }
     }
     if (strlen($this->sendmail_arguments)) {
         $command .= " " . $this->sendmail_arguments;
     }
     if (!($pipe = popen($command, "w"))) {
         return $this->OutputError("it was not possible to open sendmail input pipe");
     }
     if (!fputs($pipe, "To: {$to}\n") || !fputs($pipe, "Subject: {$subject}\n") || $headers != "" && !fputs($pipe, "{$headers}\n") || !fputs($pipe, "\n{$body}")) {
         return $this->OutputError("it was not possible to write sendmail input pipe");
     }
     pclose($pipe);
     return "";
 }
开发者ID:BackupTheBerlios,项目名称:aligilo-svn,代码行数:27,代码来源:sendmail_message.php


示例3: Merge

function Merge($newtext,$oldtext,$pagetext) {
  global $WorkDir,$SysMergeCmd, $SysMergePassthru;
  SDV($SysMergeCmd,"/usr/bin/diff3 -L '' -L '' -L '' -m -E");
  if (substr($newtext,-1,1)!="\n") $newtext.="\n";
  if (substr($oldtext,-1,1)!="\n") $oldtext.="\n";
  if (substr($pagetext,-1,1)!="\n") $pagetext.="\n";
  $tempnew = tempnam($WorkDir,"new");
  $tempold = tempnam($WorkDir,"old");
  $temppag = tempnam($WorkDir,"page");
  if ($newfp=fopen($tempnew,'w')) { fputs($newfp,$newtext); fclose($newfp); }
  if ($oldfp=fopen($tempold,'w')) { fputs($oldfp,$oldtext); fclose($oldfp); }
  if ($pagfp=fopen($temppag,'w')) { fputs($pagfp,$pagetext); fclose($pagfp); }
  $mergetext = '';
  if (IsEnabled($SysMergePassthru, 0)) {
    ob_start();
    passthru("$SysMergeCmd $tempnew $tempold $temppag");
    $mergetext = ob_get_clean();
  }
  else {
    $merge_handle = popen("$SysMergeCmd $tempnew $tempold $temppag",'r');
    if ($merge_handle) {
      while (!feof($merge_handle)) $mergetext .= fread($merge_handle,4096);
      pclose($merge_handle);
    }
  }
  @unlink($tempnew); @unlink($tempold); @unlink($temppag);
  return $mergetext;
}
开发者ID:BogusCurry,项目名称:pmwiki,代码行数:28,代码来源:simuledit.php


示例4: SendMail

 function SendMail($to, $subject, $body, $headers, $return_path)
 {
     $command = $this->sendmail_path . " -t";
     switch ($this->delivery_mode) {
         case SENDMAIL_DELIVERY_DEFAULT:
         case SENDMAIL_DELIVERY_INTERACTIVE:
         case SENDMAIL_DELIVERY_BACKGROUND:
         case SENDMAIL_DELIVERY_QUEUE:
         case SENDMAIL_DELIVERY_DEFERRED:
             break;
         default:
             return $this->OutputError("it was specified an unknown sendmail delivery mode");
     }
     if ($this->delivery_mode != SENDMAIL_DELIVERY_DEFAULT) {
         $command .= " -O DeliveryMode=" . $this->delivery_mode;
     }
     if (strlen($return_path)) {
         $command .= " -f '" . ereg_replace("'", "'\\''", $return_path) . "'";
     }
     if (strlen($this->sendmail_arguments)) {
         $command .= " " . $this->sendmail_arguments;
     }
     if (!($pipe = popen($command, "w"))) {
         return $this->OutputError("it was not possible to open sendmail input pipe");
     }
     if (!fputs($pipe, "To: {$to}\n") || !fputs($pipe, "Subject: {$subject}\n") || $headers != "" && !fputs($pipe, "{$headers}\n") || !fputs($pipe, "\n{$body}")) {
         return $this->OutputError("it was not possible to write sendmail input pipe");
     }
     pclose($pipe);
     return "";
 }
开发者ID:ranakhurram,项目名称:playSMS,代码行数:31,代码来源:sendmail_message.php


示例5: processor_man

function processor_man($formatter, $value = "")
{
    global $DBInfo;
    if ($value[0] == '#' and $value[1] == '!') {
        list($line, $value) = explode("\n", $value, 2);
    }
    if ($line) {
        list($tag, $args) = explode(' ', $line, 2);
    }
    $vartmp_dir =& $DBInfo->vartmp_dir;
    $tmpf = tempnam($vartmp_dir, "MAN");
    $fp = fopen($tmpf, "w");
    fwrite($fp, $value);
    fclose($fp);
    if (!empty($DBInfo->man_man2html) and $DBInfo->man_man2html == 'groff') {
        $man2html = "groff -Thtml -mman {$tmpf}";
    } else {
        $man2html = "man2html {$tmpf}";
    }
    $html = '';
    $fp = popen($man2html . $formatter->NULL, 'r');
    while ($s = fgets($fp, 1024)) {
        $html .= $s;
    }
    pclose($fp);
    unlink($tmpf);
    $html = preg_replace('@^Content-type: text/html@', '', $html);
    $html = preg_replace('/<\\/?META[^>]*>|<\\/?HTML>|<\\/?HEAD>|<\\/?BODY>|<TITLE>[^>]+<\\/TITLE>/i', '', $html);
    $html = preg_replace('/http:\\/\\/localhost\\/cgi\\-bin\\/man\\/man2html\\?.\\+/', '?action=man_get&man=', $html);
    $html = preg_replace('/http:\\/\\/localhost\\/cgi\\-bin\\/man\\/man2html/', '?goto=ManPage', $html);
    return $html;
}
开发者ID:ahastudio,项目名称:moniwiki,代码行数:32,代码来源:man.php


示例6: shellexec

 function shellexec($cmd)
 {
     global $disablefunc;
     $result = "";
     if (!empty($cmd)) {
         if (is_callable("exec") and !in_array("exec", $disablefunc)) {
             exec($cmd, $result);
             $result = join("\n", $result);
         } elseif (($result = `{$cmd}`) !== FALSE) {
         } elseif (is_callable("system") and !in_array("system", $disablefunc)) {
             $v = ob_get_contents();
             ob_clean();
             system($cmd);
             $result = ob_get_contents();
             ob_clean();
             echo $v;
         } elseif (is_resource($fp = popen($cmd, "r"))) {
             $result = "";
             while (!feof($fp)) {
                 $result .= fread($fp, 1024);
             }
             pclose($fp);
         }
     }
     return $result;
 }
开发者ID:ASDAFF,项目名称:Shells-Database,代码行数:26,代码来源:lostdc_shell.php


示例7: flush_log

function flush_log()
{
    $handle = popen("env NOCOLOR=1 /usr/local/bin/sudo /usr/local/bin/cbsd task mode=flushall", "r");
    $read = fgets($handle, 4096);
    pclose($handle);
    header('Location: taskls.php');
}
开发者ID:mergar,项目名称:cw,代码行数:7,代码来源:taskls.php


示例8: ReadData

 function ReadData($targetstring, &$map, &$item)
 {
     $data[IN] = NULL;
     $data[OUT] = NULL;
     $data_time = 0;
     if (preg_match("/^!(.*)\$/", $targetstring, $matches)) {
         $command = $matches[1];
         debug("ExternalScript ReadData: Running {$command}\n");
         // run the command here
         if (($pipe = popen($command, "r")) === false) {
             warn("ExternalScript ReadData: Failed to run external script. [WMEXT01]\n");
         } else {
             $i = 0;
             while ($i < 5 && !feof($pipe)) {
                 $lines[$i++] = fgets($pipe, 1024);
             }
             pclose($pipe);
             if ($i == 5) {
                 $data[IN] = floatval($lines[0]);
                 $data[OUT] = floatval($lines[1]);
                 $item->add_hint("external_line1", $lines[0]);
                 $item->add_hint("external_line2", $lines[1]);
                 $item->add_hint("external_line3", $lines[2]);
                 $item->add_hint("external_line4", $lines[3]);
                 $data_time = time();
             } else {
                 warn("ExternalScript ReadData: Not enough lines read from external script ({$i} read, 4 expected) [WMEXT02]\n");
             }
         }
     }
     debug("ExternalScript ReadData: Returning (" . ($data[IN] === NULL ? 'NULL' : $data[IN]) . "," . ($data[OUT] === NULL ? 'NULL' : $data[OUT]) . ",{$data_time})\n");
     return array($data[IN], $data[OUT], $data_time);
 }
开发者ID:geldarr,项目名称:hack-space,代码行数:33,代码来源:WeatherMapDataSource_external.php


示例9: System_Pipe

 function System_Pipe($command)
 {
     $handle = popen($command . ' 2>&1', 'r');
     $read = fread($handle, 2096);
     pclose($handle);
     return $read;
 }
开发者ID:olesmith,项目名称:poops,代码行数:7,代码来源:Hash.php


示例10: output

 /**
  * @param $request_string
  * @return string
  */
 private function output($request_string)
 {
     // 静态 GET /1.html HTTP/1.1 ...
     // 动态 GET /user.cgi?id=1 HTTP/1.1 ...
     $request_array = explode(" ", $request_string);
     if (count($request_array) < 2) {
         return "";
     }
     $uri = $request_array[1];
     echo "request:" . web_config::WEB_ROOT . $uri . "\n";
     $query_string = null;
     if ($uri == "/favicon.ico") {
         return "";
     }
     if (strpos($uri, "?")) {
         $uriArr = explode("?", $uri);
         $uri = $uriArr[0];
         $query_string = isset($uriArr[1]) ? $uriArr[1] : null;
     }
     $filename = web_config::WEB_ROOT . $uri;
     if ($this->cgi_check($uri)) {
         $this->set_env($query_string);
         $handle = popen(web_config::WEB_ROOT . $uri, "r");
         $read = stream_get_contents($handle);
         pclose($handle);
         return $this->add_header($read);
     }
     // 静态文件的处理
     if (file_exists($filename)) {
         return $this->add_header(file_get_contents($filename));
     } else {
         return $this->not_found();
     }
 }
开发者ID:jasper2007111,项目名称:notes,代码行数:38,代码来源:server.php


示例11: cvs_max_rev

function cvs_max_rev($filename, $start, $end)
{
    static $lastfile = "";
    static $array = array();
    if ($filename != $lastfile) {
        $cmd = "/usr/bin/cvs annotate {$filename} 2>/dev/null";
        $fp = popen($cmd, "r");
        if (!$fp) {
            return false;
        }
        $n = 0;
        $array = array();
        $lastfile = $filename;
        while (!feof($fp)) {
            $line = fgets($fp);
            if (empty($line)) {
                continue;
            }
            $tokens = explode(" ", $line);
            $array[++$n] = explode(".", $tokens[0]);
        }
        pclose($fp);
    }
    $max = array();
    for ($n = $start; $n <= $end; $n++) {
        if (rev_cmp($max, $array[$n])) {
            $max = $array[$n];
        }
    }
    return $max;
}
开发者ID:marczych,项目名称:hack-hhvm-docs,代码行数:31,代码来源:reference-split.php


示例12: close

 /**
  * Closes any open pipe handle and sets the exit code.
  *
  * @return  void
  */
 public function close()
 {
     if (is_resource($this->handle)) {
         $this->exitCode = pclose($this->handle);
     }
     $this->handle = null;
 }
开发者ID:kaibosh,项目名称:nZEDb,代码行数:12,代码来源:pipereader.php


示例13: newsletter_start_commandline_sending

/**
 * Start the commandline to send a newsletter
 * This is offloaded because it could take a while and/or resources
 *
 * @param Newsletter $entity Newsletter entity to be processed
 *
 * @return void
 */
function newsletter_start_commandline_sending(Newsletter $entity)
{
    if (!elgg_instanceof($entity, 'object', Newsletter::SUBTYPE)) {
        return;
    }
    // prepare commandline settings
    $settings = ['entity_guid' => $entity->getGUID(), 'host' => $_SERVER['HTTP_HOST'], 'memory_limit' => ini_get('memory_limit'), 'secret' => newsletter_generate_commanline_secret($entity->getGUID())];
    if (isset($_SERVER['HTTPS'])) {
        $settings['https'] = $_SERVER['HTTPS'];
    }
    // ini settings
    $ini_param = '';
    $ini_file = php_ini_loaded_file();
    if (!empty($ini_file)) {
        $ini_param = "-c {$ini_file} ";
    }
    // which script to run
    $script_location = dirname(dirname(__FILE__)) . '/procedures/cli.php';
    // convert settings to commandline params
    $query_string = http_build_query($settings, '', ' ');
    // start the correct commandline
    if (PHP_OS === 'WINNT') {
        pclose(popen('start /B php ' . $ini_param . $script_location . ' ' . $query_string, 'r'));
    } else {
        exec('php ' . $ini_param . $script_location . ' ' . $query_string . ' > /dev/null &');
    }
}
开发者ID:coldtrick,项目名称:newsletter,代码行数:35,代码来源:functions.php


示例14: experimentmail__send

function experimentmail__send($recipient, $subject, $message, $headers, $env_sender = "")
{
    global $settings;
    if (isset($settings['bcc_all_outgoing_emails']) && $settings['bcc_all_outgoing_emails'] == 'y' && isset($settings['bcc_all_outgoing_emails__address']) && $settings['bcc_all_outgoing_emails__address']) {
        $headers = $headers . "Bcc: " . $settings['bcc_all_outgoing_emails__address'] . "\r\n";
    }
    if (!$env_sender) {
        $env_sender = $settings['support_mail'];
    }
    if ($settings['email_sendmail_type'] == "indirect") {
        if ($settings['email_sendmail_path']) {
            $sendmail_path = $settings['email_sendmail_path'];
        } else {
            $sendmail_path = "/usr/sbin/sendmail";
        }
        $sendmail = $sendmail_path . " -t -i -f {$env_sender}";
        $fd = popen($sendmail, "w");
        fputs($fd, "To: {$recipient}\r\n");
        fputs($fd, $headers);
        fputs($fd, "Subject: {$subject}\r\n");
        fputs($fd, "X-Mailer: orsee\r\n\r\n");
        fputs($fd, $message);
        pclose($fd);
        $done = true;
    } else {
        $headers = "Errors-To: " . $settings['support_mail'] . "\r\n" . $headers;
        $done = mail($recipient, $subject, $message, $headers, '-f ' . $env_sender);
    }
    return $done;
}
开发者ID:danorama,项目名称:orsee,代码行数:30,代码来源:experimentmail.php


示例15: doRepositoryTest

 function doRepositoryTest($repo)
 {
     if ($repo->accessType != "ssh") {
         return -1;
     }
     $basePath = "../../../plugins/access.ssh/";
     // Check file exists
     if (!file_exists($basePath . "class.sshAccessDriver.php") || !file_exists($basePath . "class.SSHOperations.php") || !file_exists($basePath . "manifest.xml") || !file_exists($basePath . "showPass.php") || !file_exists($basePath . "sshActions.xml")) {
         $this->failedInfo .= "Missing at least one of the plugin files (class.sshDriver.php, class.SSHOperations.php, manifest.xml, showPass.php, sshActions.xml).\nPlease reinstall from lastest release.";
         return FALSE;
     }
     // Check if showPass is executable from ssh
     $stat = stat($basePath . "showPass.php");
     $mode = $stat['mode'] & 0x7fff;
     // We don't care about the type
     if (!is_executable($basePath . 'showPass.php') && ($mode & 0x40 && $stat['uid'] == posix_getuid()) && ($mode & 0x8 && $stat['gid'] == posix_getgid()) && $mode & 0x1) {
         chmod($basePath . 'showPass.php', 0555);
         if (!is_executable($basePath . 'showPass.php')) {
             $this->failedInfo .= "showPass.php must be executable. Please log in on your server and set showPass.php as executable (chmod u+x showPass.php).";
             return FALSE;
         }
     }
     // Check if ssh is accessible
     $handle = popen("ssh 2>&1", "r");
     $usage = fread($handle, 30);
     pclose($handle);
     if (strpos($usage, "usage") === FALSE) {
         $this->failedInfo .= "Couldn't find or execute 'ssh' on your system. Please install latest SSH client.";
         return FALSE;
     }
     return TRUE;
 }
开发者ID:bloveing,项目名称:openulteo,代码行数:32,代码来源:test.sshAccess.php


示例16: tagger

function tagger()
{
    if (func_num_args()) {
        $arg_list = func_get_args();
        $string = $arg_list[0];
    } else {
        return false;
    }
    if (file_exists("medpost")) {
        $commandstring = "./medpost -token";
    } elseif (defined(MEDPOST_DIR)) {
        if (file_exists(MEDPOST_DIR . "medpost")) {
            $commandstring = MEDPOST_DIR . "medpost -token";
        } else {
            print "Medpost could not be found. Please check MEDPOST_DIR value.";
            return false;
        }
    } else {
        print "Medpost could not be found.";
        return false;
    }
    $handle = popen("echo \"{$string}\" | {$commandstring} ", "r");
    $read = fread($handle, 2096);
    echo $read;
    pclose($handle);
    $split = preg_split("/\\s/", $read);
    print_r($split);
}
开发者ID:BackupTheBerlios,项目名称:aefitools-svn,代码行数:28,代码来源:medpost.php


示例17: num_cpus

function num_cpus()
{
    $numCpus = 1;
    if (is_file('/proc/cpuinfo')) {
        $cpuinfo = file_get_contents('/proc/cpuinfo');
        preg_match_all('/^processor/m', $cpuinfo, $matches);
        $numCpus = count($matches[0]);
    } elseif ('WIN' == strtoupper(substr(PHP_OS, 0, 3))) {
        $process = @popen('wmic cpu get NumberOfCores', 'rb');
        if (false !== $process) {
            fgets($process);
            $numCpus = intval(fgets($process));
            pclose($process);
        }
    } else {
        $process = @popen('sysctl -a', 'rb');
        if (false !== $process) {
            $output = stream_get_contents($process);
            preg_match('/hw.ncpu: (\\d+)/', $output, $matches);
            if ($matches) {
                $numCpus = intval($matches[1][0]);
            }
            pclose($process);
        }
    }
    return $numCpus;
}
开发者ID:vik0803,项目名称:SystemStatus,代码行数:27,代码来源:remote.php


示例18: doAction

 public function doAction()
 {
     //check if id file and job is a number
     //if (is_numeric($this->id_file) && is_numeric($this->id_job))
     //convert id_file and id_job into a numbers
     $id_file = (int) $this->id_file;
     $id_job = (int) $this->id_job;
     ini_set('max_execution_time', 6000);
     $ret = -1;
     if (substr(php_uname(), 0, 7) == "Windows") {
         log::doLog("windows");
         $ret = pclose(popen("start C:\\wamp\\bin\\php\\php5.4.3\\php " . INIT::$MODEL_ROOT . "/exportLog.php " . $id_file . " " . $id_job . " 1", "r"));
     } else {
         $ret = pclose(popen("nohup php " . INIT::$MODEL_ROOT . "/exportLog.php " . $id_file . " " . $id_job . " 1 &", "r"));
     }
     log::doLog("CASMACAT: return exportLog: " . $ret);
     ini_set('max_execution_time', 30);
     //        $this->filename ="log_id".$this->id_file."_".$this->file_name.".xml";
     //        header('Content-Type: text/xml; charset=UTF-8');
     //        header('Content-Disposition: attachment; filename="' . $this->file_name . '.xml"');
     //
     //        //log::doLog("CASMACAT: file: ".INIT::$LOG_DOWNLOAD . "/" .$this->filename);
     //
     //        $this->content = file_get_contents(INIT::$LOG_DOWNLOAD . "/" . $this->filename);
     if ($ret == "END") {
         $this->result['code'] = 0;
         $this->result['data'] = "OK";
     } else {
         $this->result['errors'] = "It is not possible to get the log file";
         $this->result['code'] = -1;
     }
 }
开发者ID:Tucev,项目名称:casmacat-frontend,代码行数:32,代码来源:createLogDownloadController.php


示例19: execute

 public function execute($do = true)
 {
     $cmd = $this->command;
     for ($i = 0; $i < count($this->values); $i++) {
         $cmd .= $this->attributeSeparator . $this->values[$i];
     }
     foreach ($this->attributes as $key => $value) {
         $cmd .= $this->attributeSeparator . $this->attributeInitiator . $key . ($value != "" ? $this->attributeOperator . $value : "");
     }
     $cmd = $cmd . ($this->pipe != null ? " | " . $this->pipe->getPipeCommand() : "");
     if ($do) {
         if ($this->username == "") {
             $this->output = shell_exec($cmd);
         } else {
             $c = '/bin/su ' . $this->username . ' -c "' . $cmd . '" 2>&1';
             $handle = popen($c, "r");
             $read = fread($handle, 2096);
             pclose($handle);
             if (trim($read) == "su: must be run from a terminal") {
                 die("su has been disabled for the user of your webserver. Maybe you want to try sudo...");
             } else {
                 $_SESSION["messages"]->addMessage("System: {$c}", "System");
                 $fp = popen($c, "w");
                 fputs($fp, $this->password);
                 pclose($fp);
             }
             $this->output = "No output available in su-mode";
         }
     } else {
         return $cmd;
     }
 }
开发者ID:nemiah,项目名称:poolPi,代码行数:32,代码来源:SystemCommand.class.php


示例20: initScan

 /**
  * Init scan process.
  * Solution for realtime output find on: http://stackoverflow.com/questions/1281140/run-process-with-realtime-output-in-php
  * Maybe ugly, but sometimes at 3AM it's only what is getting out of head ;-)
  */
 public function initScan()
 {
     $view = new Views('templates/head.tpl.php');
     $view->set('class', 'scanner');
     print $view->render();
     set_time_limit(0);
     $handle = popen(PHP . " scanner.php " . $this->project_id, "r");
     if (ob_get_level() == 0) {
         ob_start();
     }
     while (!feof($handle)) {
         $buffer = fgets($handle);
         $buffer = trim(htmlspecialchars($buffer));
         $data = explode(';', $buffer);
         switch ($data[0]) {
             case 'FOUND':
                 print "<div class=\"infobox\"><h3>Found something</h3><p><strong>Time:</strong> " . $data[1] . "<br><strong>Filter name:</strong> " . $data[2] . "<br><strong>Line:</strong> " . $data[3] . "<br><strong>File:</strong> " . $data[4] . "</p><a href=\"/report/" . $data[5] . "\" target=\"_blank\"><span class=\"button warning_button\" style=\"\">Show report</span></a></div>";
                 break;
             case 'NOT_FOUND':
                 print "<div class=\"infobox\"><h3>WOW!</h3><p>Scanner didn't found anything. So your project is sooo secure. You are security mastah, or the filters are too weak ;-) Anyway, I recommend to do a manual code review, to be 100% sure ;-)</p></div>";
                 break;
             case 'SCANNED':
                 print "<div class=\"infobox\"><h3>Hmmmm...</h3><p>Your project has been scanned before. Please go to project to check your reports. <br><a href=\"/show/" . $this->project_id . "\" target=\"_parent\"><span class=\"button\">Go to project page</span></a></p></div>";
                 break;
         }
         ob_flush();
         flush();
         time_nanosleep(0, 10000000);
     }
     pclose($handle);
     ob_end_flush();
 }
开发者ID:beejhuff,项目名称:sec-scanner,代码行数:37,代码来源:Scanner.php



注:本文中的pclose函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP pcntl_alarm函数代码示例发布时间:2022-05-15
下一篇:
PHP pc_db_connect函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap