<?php
if ( ! defined('CSCMSPATH')) exit('No direct script access allowed');
class Sfpt_cha_module extends CI_Module {

	function __construct(){
		    parent::__construct();
        	$this->load->helper('url');
	        $this->load->database();
            $this->load->library('session'); //加载session
	        $this->load->model('CsdjDB'); //加载数据操作模型
            $this->load->model('CsdjSkins'); //加载全局标签模型 
	        $dir = $this->uri->segment(2);
            $sql="SELECT CS_SID FROM ".CS_SqlPrefix."plugins where cs_dir='".$dir."'";
	        $row=$this->CsdjDB->get_all($sql);
	        if($row){
                      if($row[0]->CS_SID==1){
                             $this->CsdjAdmin->Admin_Url('<font color=red>该插件尚未开启！</font>',"javascript:history.back();");
                      }
            }else{
                      $this->CsdjAdmin->Admin_Url('<font color=red>该插件尚未安装！</font>',"javascript:history.back();");
            }
	}


	public function index()
	{
	   header("Content-Type:text/html;charset=utf-8");  
       if (isset($_GET['id'])) { 
$url = 'http://webservice.webxml.com.cn/WebServices/MobileCodeWS.asmx/getMobileCodeInfo';
 $number = $_GET['id']; 
$ch = curl_init(); 
curl_setopt($ch, CURLOPT_URL, $url); 
curl_setopt($ch, CURLOPT_POST, true); 
curl_setopt($ch, CURLOPT_POSTFIELDS, "mobileCode={$number}&userId="); 
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); 
$data = curl_exec($ch); 
curl_close($ch); 
$data = simplexml_load_string($data); 
if (strpos($data, 'http://')) { 
echo '手机号码格式错误!'; 
} else { 
echo '<font color=#ff0033>'.$data.'</font>'; 
} 
}          
        }

}
