hightech and business

在广州待了三年多,发现广州人也不都是个个有钱。

很多人从事的都是技术含量不太高的行业,在未来很有可能会被大环境所冲击,所以还是要做一些有高技术水平的东西才能保持自己具有更高的竞争力。当然高科技也是离不开商业,没有商业化,高科技可能也是会太超前而没有什么好处。所以高科技和商业结合才是最好。

前段时间看了《舌尖上的中国》第一集,里面好像有说一些偏远地区做鱼类买卖的、笋、菌菇等。很多人都是朴素艰苦的生活着,依靠着自然的资源生存着,在竞争的压力下,每个人脸上的笑容都不是太多。

Openssl signature

$clientCrtFname = dirname(__FILE__)."/mobileconfig/ios_cert/clientCert.pem";
$clientKeyFname = dirname(__FILE__)."/mobileconfig/ios_cert/clientKey.pem";
$caCrtFname = dirname(__FILE__)."/mobileconfig/ios_cert/caCert.pem";
 
$filename = dirname(__FILE__).'/mobileconfig/cache/'.$tmp_name;
$signed_filename = dirname(__FILE__).'/mobileconfig/cache/signed_'.$tmp_name;
$cmd = "openssl smime -sign -signer ".$clientCrtFname." -inkey ".$clientKeyFname." -certfile ".$caCrtFname.
 
                		" -nodetach -outform der -in ".$filename.
 
                		" -out ".$signed_filename;
 
                	system($cmd);

粗略的过滤掉不正确的邮箱 php

在实际项目或网站中,除了通过简单明了的提示来帮助用户更加快捷的输入邮箱,可以打开百度的注册页面,输入xxx@ 后,自动会提示常用邮箱后缀,帮助用户
那么在后台也需要做一些拦截,常用的是一个IP在一天之内只能注册多少次这样。然后还需要拦截一些随便输入的用户,下面的class可以帮助你粗略的过滤掉无效用户。

<?php
/*
require_once 'aaaaaa.php';
$email_detect       =   new email_detect();
foreach($k_users as $v){
    $email          =   $v['user_name'];
	$re             =   $email_detect->check($email);
    if($re!==true){
        echo $email.' - '.$re.'<br />';
    }
}
*/
 
 
//粗略的过滤掉不正确的邮箱
class email_detect{
	private $email;
	private $error_msg	    =	'';
	private $allow_postfix	=	array(
 
	'com',
	'net',
	'org',
	'edu',
	'gov',
	'int',
	'mil',
	'cn',
	'tel',
	'mobi',
	'asia',
	'cd',
	'travel',
	'pro',
	'museum',
	'coop',
	'aero',
 
	'ad','ae','af','ag','ai','al','am','an','ao','aq','ar','as','at','au','aw','az',
	'ba','bb','bd','be','bf','bg','bh','bi','biz','bj','bm','bn','bo','br','bs','bt','bv','bw','by','bz',
	'ca','cc','cf','cg','ch','ci','ck','cl','cm','cn','co','cq','cr','cu','cv','cx','cy','cz',
	'de','dj','dk','dm','do','dz',
	'ec','edu','ee','eg','eh','es','et','ev',
	'fi','fj','fk','fm','fo','fr',
	'ga','gb','gd','ge','gf','gh','gi','gl','gm','gn','gp','gr','gt','gu','gw','gy','hk','hm','hn','hr','ht','hu',
	'id','ie','il','im','in','info','io','iq','ir','is','it',
	'jm','jo','jp',
	'ke','kg','kh','ki','km','kn','kp','kr','kw','ky','kz',
	'la','lb','lc','li','lk','lr','ls','lt','lu','lv','ly',
	'ma','mc','md','me','mg','mh','ml','mm','mn','mo','mp','mq','mr','ms','mt','mv','mw','mx','my','mz',
	'na','name','nc','ne','net','nf','ng','ni','nl','no','np','nr','nt','nu','nz',
	'om','org',
	'pa','pe','pf','pg','ph','pk','pl','pm','pn','pr','pt','pw','py',
	'qa',
	're','ro','ru','rw',
	'sa','sb','sc','sd','se','sg','sh','si','sj','sk','sl','sm','sn','so','sr','st','su','sy','sz',
	'tc','td','tf','tg','th','tj','tk','tl','tm','tn','to','tp','tr','tt','tv','tw','tz','ua','ug','uk','us','uy',
	'va','vc','ve','vg','vn','vu','wf','ws',
	'ye','yu',
	'za','zm','zr','zw');
	private $black_domain   =   array('123.com','qq.co','qq.cn','163.co','126.co','test.com');
	function check($email){
		$this->email	 =	$email;
        $this->error_msg =  '';   
		$this->filter_email();
		$this->check_postfix();
        $this->check_qqmail();
        $this->check_domain();
		if(!empty($this->error_msg))
		{
			return $this->error_msg;
		}else{
			return true;
		}
	}
    //1、检测格式是否正确
	private function filter_email(){
		$is_email   =   filter_var($this->email, FILTER_VALIDATE_EMAIL);
		if($is_email==false){
			$this->error_msg	=	'邮箱格式不正确';
		}
	}
    //2、检测域名后缀是否正确
	private function check_postfix(){
		$email_arr		=	explode('.',$this->email);
		$postfix		=	strtolower(end($email_arr));
        //var_dump($postfix);
		if(!in_array($postfix,$this->allow_postfix)){
			$this->error_msg	=	'邮箱后缀不允许,请联系客服';
		}
	}
    //3、检测是否为非法的qq邮箱,163
    private function check_qqmail(){
        $email_arr		=	explode('@',$this->email);
        $prefix         =   $email_arr[0];
        $postfix		=	strtolower(end($email_arr));
 
        if($postfix=='qq.com'){
            //var_dump($prefix);
            if(is_numeric($prefix)){
                if(!preg_match('/^[1-9]\d{4,10}$/',$prefix)){
                    $this->error_msg	=	'错误的邮箱,请确认';
                }
            }
        }
 
        //qq 163这些除非是纯数字邮箱,否则是不允许以数字开头的
        if($postfix=='qq.com' || $postfix=='163.com' || $postfix=='126.com' || $postfix=='yeah.net'){
            if(preg_match('/^[1-9]/',$prefix)){
                if(!is_numeric($prefix)){
                    $this->error_msg	=	'错误的邮箱,请确认';
                }
            }
        }
 
    } 
    //4、检测非法域名
    private function check_domain(){
        $email_arr		=	explode('@',$this->email);
        $domain         =   end($email_arr);
        if(in_array($domain,$this->black_domain)){
			$this->error_msg	=	'邮箱域名不允许,请确认';
		}
    }
 
 
    //4、反向解析DNS检测域名是否可达
}