示例#1
0
 public static function init()
 {
     if ((!isset($_SESSION['base_login_audit']) || !isset($_SESSION['base_login_audit_user']) || $_SESSION['base_login_audit_user'] != Acl::get_user()) && Acl::is_user()) {
         $now = time();
         $remote_address = get_client_ip_address();
         $remote_host = gethostbyaddr($remote_address);
         DB::Execute('INSERT INTO base_login_audit(user_login_id,start_time,end_time,ip_address,host_name) VALUES(%d,%T,%T,%s,%s)', array(Acl::get_user(), $now, $now, $remote_address, $remote_host));
         $_SESSION['base_login_audit'] = DB::Insert_ID('base_login_audit', 'id');
         $_SESSION['base_login_audit_user'] = Acl::get_user();
     }
 }
示例#2
0
 public function applet()
 {
     $query = 'SELECT b.user_login_id, b.start_time, b.end_time, b.ip_address, b.host_name FROM base_login_audit b WHERE b.user_login_id=' . Acl::get_user() . ' ORDER BY b.start_time DESC';
     $ret = DB::SelectLimit($query, 1, 1);
     if ($row = $ret->FetchRow()) {
         $ok1 = $row['ip_address'] == get_client_ip_address();
         $ok2 = DB::GetOne('SELECT 1 FROM base_login_audit b WHERE (SELECT MIN(b2.start_time) FROM base_login_audit b2 WHERE b2.ip_address=%s)<b.start_time AND (SELECT MAX(b3.start_time) FROM base_login_audit b3 WHERE b3.ip_address=%s)>b.start_time AND b.ip_address!=%s', array($row['ip_address'], $row['ip_address'], $row['ip_address']));
         $ok = $ok1 || $ok2;
         print ($ok ? '<div style="padding:7px;">' : '<div style="padding:7px;background-color: red; color:white; font-weight:bold;">') . __('On: %s', array($row['start_time'])) . '<br />' . __('Host name: %s', array($row['host_name'])) . '<br />' . __('IP address: %s', array($row['ip_address'])) . '</div>';
     }
 }
示例#3
0
文件: get.php 项目: cretzu89/EPESI
}
$original = $file['original'];
$local = $rec['id'];
$fsid = $file['filestorage_id'];
$crypted = $rec['crypted'];
$meta = Utils_FileStorageCommon::meta($fsid);
require_once 'mime.php';
if (headers_sent()) {
    die('Some data has already been output to browser, can\'t send file');
}
$password = '';
if ($crypted) {
    $password = $_SESSION['client']['cp' . $rec['id']];
}
$t = time();
$remote_address = get_client_ip_address();
$remote_host = gethostbyaddr($remote_address);
DB::Execute('INSERT INTO utils_attachment_download(attach_file_id,created_by,created_on,download_on,description,ip_address,host_name) VALUES (%d,%d,%T,%T,%s,%s,%s)', array($id, Acl::get_user(), $t, $t, $disposition, $remote_address, $remote_host));
if (isset($_REQUEST['thumbnail'])) {
    $o_filename = $meta['file'];
    $f_filename = $o_filename . '_thumbnail';
    if (!file_exists($f_filename)) {
        if (!file_exists($o_filename)) {
            die('File doesn\'t exists');
        }
        $image_info = getimagesize($o_filename);
        $image_type = $image_info[2];
        $image = false;
        switch ($image_type) {
            case IMAGETYPE_JPEG:
                $image = imagecreatefromjpeg($o_filename);
示例#4
0
 public static function mobile_login()
 {
     $t = Variable::get('host_ban_time');
     if ($t > 0) {
         $fails = DB::GetOne('SELECT count(*) FROM user_login_ban WHERE failed_on>%d AND from_addr=%s', array(time() - $t, get_client_ip_address()));
         if ($fails >= 3) {
             print __('You have exceeded the number of allowed login attempts.') . '<br>';
             print '<a href="' . get_epesi_url() . '">' . __('Host banned. Click here to refresh.') . '</a>';
             return;
         }
     }
     $qf = new HTML_QuickForm('login', 'post', 'mobile.php?' . http_build_query($_GET));
     $qf->addElement('text', 'username', __('Login'));
     $qf->addElement('password', 'password', __('Password'));
     $qf->addElement('submit', 'submit_button', __('Login'));
     $qf->registerRule('check_login', 'callback', 'submit_login', 'Base_User_LoginCommon');
     $qf->addRule(array('username', 'password'), __('Login or password incorrect'), 'check_login');
     $qf->addRule('username', __('Field required'), 'required');
     $qf->addRule('password', __('Field required'), 'required');
     if ($qf->validate()) {
         self::set_logged($qf->exportValue('username'));
         self::new_autologin_id();
         return false;
     }
     $qf->display();
 }
示例#5
0
    }
}
$requestData = file_get_contents('php://input');
//$requestData = $HTTP_RAW_POST_DATA;
//$GLOBALS['HTTP_RAW_POST_DATA']
//system( "echo '$request_xml' > /home/www/saas/lastreq-".date("H-i-s-u")."-".md5($request_xml).".xml" );
global $config;
if (isset($config['lastreq'])) {
    $lastreq = $config['lastreq'];
    system("echo '{$requestData}' > {$lastreq}");
}
try {
    $proto = new DVRPCProto();
    $dvservice = new DVService();
    $dvrpc = new DVRPC();
    $dvrpc->setProto($proto);
    $dvrpc->registerService($dvservice);
    $dvrpc->callService($requestData, get_client_ip_address());
} catch (DBException $ex) {
    //echo "aaaaaaaaaaaaaaaaaaa\n";
    //echo $ex->getTraceAsString();
    //$ret['result'] = 'notdb';
    $ret['result'] = '->' . $ex->getValue() . '<- ' . $ex->getTraceAsString();
    echo $proto->hashMapCode($ret) . "\n";
}
/*$headers = apache_request_headers();

system( "echo \"\" > /home/www/saas/lastreq.xml" );
foreach ($headers as $header => $value) {
	system( "echo \"$header: $value\n\" >> /home/www/saas/lastreq.xml" );
}*/