示例#1
0
文件: Login.php 项目: poppen/p2
 /**
  * md5_encrypt, md5_decrypt のための password(salt) を得る
  * (クッキーのcidの生成に利用している)
  *
  * @static
  * @access  private
  * @return  string
  */
 function getMd5CryptPassForCid()
 {
     //return md5($_SERVER['SERVER_NAME'] . $_SERVER['HTTP_USER_AGENT'] . $_SERVER['SERVER_SOFTWARE']);
     //$seed = $_SERVER['SERVER_NAME'] . $_SERVER['SERVER_SOFTWARE'];
     $seed = $_SERVER['SERVER_SOFTWARE'];
     require_once P2_LIB_DIR . '/HostCheck.php';
     // ローカルチェックをして、HostCheck::isAddrDocomo() などでホスト名を引く機会を減らす
     $notK = (bool) (HostCheck::isAddrLocal() || HostCheck::isAddrPrivate());
     // 携帯判定された場合は、 IPチェックなし
     if (!$notK and UA::isK(geti($_SERVER['HTTP_USER_AGENT'])) || HostCheck::isAddrDocomo() || HostCheck::isAddrAu() || HostCheck::isAddrSoftBank() || HostCheck::isAddrWillcom() || HostCheck::isAddrJigWeb() || HostCheck::isAddrJig() || HostCheck::isAddrIbis()) {
     } elseif (!empty($_COOKIE['ignore_cip'])) {
     } else {
         $now_ips = explode('.', $_SERVER['REMOTE_ADDR']);
         $seed .= $now_ips[0];
     }
     return md5($seed);
 }
示例#2
0
文件: HostCheck.php 项目: poppen/p2
 /**
  * アクセスが許可されたIPアドレス帯域なら true を返す
  * (false = アク禁)
  *
  * @return  boolean
  * @access  public
  * @static
  */
 function getHostAuth()
 {
     global $_conf, $_HOSTCHKCONF;
     switch ($_conf['secure']['auth_host']) {
         case 1:
             $flag = 1;
             $ret = true;
             $custom = $_HOSTCHKCONF['custom_allowed_host'];
             break;
         case 2:
             $flag = 0;
             $ret = false;
             $custom = $_HOSTCHKCONF['custom_denied_host'];
             break;
         default:
             return true;
     }
     if ($flag == $_HOSTCHKCONF['host_type']['localhost'] && HostCheck::isAddrLocal() || $flag == $_HOSTCHKCONF['host_type']['private'] && HostCheck::isAddrPrivate() || $flag == $_HOSTCHKCONF['host_type']['custom'] && $custom && HostCheck::isAddrInBand($custom) || $flag == $_HOSTCHKCONF['host_type']['docomo'] && HostCheck::isAddrDocomo() || $flag == $_HOSTCHKCONF['host_type']['au'] && HostCheck::isAddrAu() || $flag == $_HOSTCHKCONF['host_type']['SoftBank'] && HostCheck::isAddrSoftBank() || $flag == $_HOSTCHKCONF['host_type']['AirH'] && HostCheck::isAddrWillcom() || $flag == $_HOSTCHKCONF['host_type']['iPhone'] && HostCheck::isAddrIPhone()) {
         return $ret;
     }
     return !$ret;
 }