コード例 #1
0
ファイル: main.php プロジェクト: nicevoice/MapCraft
function myShutdownHandler()
{
    global $logger;
    $a = error_get_last();
    if ($a != null) {
        $logger->emerg("Fatal PHP error " . formatError($a['type'], $a['message'], $a['file'], $a['line']));
    }
}
コード例 #2
0
 /**
  * Connexion
  */
 function login()
 {
     $login = $this->input->post('login');
     $password = $this->input->post('password');
     $user = User_model::connectUser($this->db, $login, $password);
     if ($user == null) {
         $this->session->set_flashdata('message', formatError('Login ou mot de passe incorrect'));
         redirect('welcome/index');
     } else {
         $this->session->set_userdata('user_name', $user->usrlbnom);
         $this->session->set_userdata('user_id', $user->usridusr);
         redirect('listprojects/index');
     }
 }
コード例 #3
0
/**
 * Scan given file for all malware patterns
 * 
 * @global string $fileExt  file extension list to be scanned
 * @global array $patterns array of patterns to search for
 * @param string $path  path of the scanned file
 */
function scan_file($path)
{
    global $ext, $patterns, $count, $total_results;
    if (in_array(pathinfo($path, PATHINFO_EXTENSION), $ext) && filesize($path) && !stripos($path, 'jamss')) {
        if (!($content = file_get_contents($path))) {
            $error = 'Could not check ' . $path;
            echo formatError($error);
        } else {
            // do a search for fingerprints
            foreach ($patterns as $pattern) {
                if (is_array($pattern)) {
                    // it's a pattern
                    // RegEx modifiers: i=case-insensitive; s=dot matches also newlines; S=optimization
                    preg_match_all('#' . $pattern[0] . '#isS', $content, $found, PREG_OFFSET_CAPTURE);
                } else {
                    // it's a string
                    preg_match_all('#' . $pattern . '#isS', $content, $found, PREG_OFFSET_CAPTURE);
                }
                $all_results = $found[0];
                // remove outer array from results
                $results_count = count($all_results);
                // count the number of results
                $total_results += $results_count;
                // total results of all fingerprints
                if (!empty($all_results)) {
                    $count++;
                    if (is_array($pattern)) {
                        // then it has some additional comments
                        echo "<hr><p>In file <span class=\"file\">{$path}</span>", "-> we found {$results_count} occurence(s) of <span class=\"pattern\">Pattern #{$pattern['2']} - {$pattern['1']}</span>", NL, " ---> <strong>Details:</strong> <span class=\"pattern_desc\">\"{$pattern['3']}\"</span></p>\n";
                        foreach ($all_results as $match) {
                            // output the line of malware code, but sanitize it before
                            echo "<span class=\"offset\">@Offset: {$match['1']}</span>:", "<pre>... " . htmlentities(substr($content, $match[1], 200), ENT_QUOTES) . " ...</pre>\n";
                        }
                    } else {
                        // it's a string, no comments available
                        echo "<hr><p>In file <span class=\"file\">{$path}</span>", "-> we found {$results_count} occurence(s) of <span class=\"pattern\">String '{$pattern}'</span>", NL;
                        foreach ($all_results as $match) {
                            // output the line of malware code, but sanitize it before
                            echo "<span class=\"offset\">@Offset: {$match['1']}</span>:", "<pre>... " . htmlentities(substr($content, $match[1], 200), ENT_QUOTES) . " ...</pre>\n";
                        }
                    }
                    echo "--> {$path} is a <b>", filetype($path), '</b>. It was last <b>accessed</b>: ', date(DATE_ATOM, fileatime($path)), ', last <b>changed</b>: ' . date(DATE_ATOM, filectime($path)), ', last <b>modified</b>: ', date(DATE_ATOM, filemtime($path)), '.<br/>';
                    echo 'File permissions:', substr(sprintf('%o', fileperms($path)), -4), '<br/>';
                }
            }
            unset($content);
        }
    }
}
コード例 #4
0
			<?php 
$msg = $this->session->flashdata('msg_info');
if ($msg != "") {
    echo formatInfo($msg);
}
$msg = $this->session->flashdata('msg_confirm');
if ($msg != "") {
    echo formatConfirm($msg);
}
$msg = $this->session->flashdata('msg_warn');
if ($msg != "") {
    echo formatWarn($msg);
}
$msg = $this->session->flashdata('msg_error');
if ($msg != "") {
    echo formatError($msg);
}
?>
		</div>
	</div>
	<!-- end page-heading -->

	<table border="0" width="100%" cellpadding="0" cellspacing="0" id="content-table">
	<tr>
		<th rowspan="3" class="sized"><img src="<?php 
echo base_url();
?>
www/images/shared/side_shadowleft.jpg" width="20" height="300" alt="" /></th>
		<th class="topleft"></th>
		<td id="tbl-border-top">&nbsp;</td>
		<th class="topright"></th>