ExpandController.php 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585
  1. <?php
  2. /**
  3. * @author darkredz
  4. */
  5. class ExpandController extends DooController {
  6. public $staff;
  7. public static $NEW = 0;
  8. public $nature=array('1'=>'设计',
  9. '2'=>'造价管理',
  10. '3'=>'业主',
  11. '4'=>'交通局',
  12. '5'=>'公路局',
  13. '6'=>'审计',
  14. '7'=>'财政',
  15. '8'=>'审核',
  16. '9'=>'施工',
  17. '10'=>'咨询',
  18. '11'=>'招标代理',
  19. '12'=>'监理',
  20. '13'=>'学校',
  21. '14'=>'个人',
  22. '15'=>'合作伙伴',
  23. );
  24. public $tooltip=array('1'=>array('L','点击筛选标签'),
  25. '2'=>array('M','点击筛选标签'),
  26. '3'=>array('N','点击筛选标签'),
  27. '4'=>array('O','点击筛选标签'),
  28. '5'=>array('P','点击筛选标签'),
  29. '6'=>array('Q','点击筛选标签'),
  30. '7'=>array('R','点击筛选标签'),
  31. );
  32. public $webPath="http://cld.smartcost.com.cn/upload/emailAnnex/";
  33. function __construct() {
  34. //include './protected/config/common.conf.php';
  35. //include $config['BASE_PATH'].'diagnostic/debug.php';
  36. if(isset($_COOKIE["staff"])){
  37. if(!empty($_COOKIE["staff"])){
  38. Doo::loadModel ( 'staff' );
  39. $staff = new staff ();
  40. $this->staff=$staff->getUserByIdList($_COOKIE["staff"]);
  41. self::$NEW= $this->getReceiptCount();
  42. include './protected/controller/ReceiptController.php';
  43. include './protected/controller/MainController.php';
  44. ReceiptController::$NEW=self::$NEW;
  45. MainController::$NEW=self::$NEW;
  46. return "/";
  47. }
  48. }
  49. Doo::loadCore ( 'uri/DooUriRouter' );
  50. $router = new DooUriRouter ();
  51. $routeRs = $router->execute ( Doo::app ()->route, Doo::conf ()->SUBFOLDER );
  52. if($routeRs['1']!="login"){
  53. header ( 'Content-Type:text/html;charset=utf-8' );
  54. @header ( "Location: /login" );
  55. }
  56. }
  57. function sms(){
  58. Doo::loadModel('tag');
  59. $tag=new tag();
  60. Doo::loadModel('district');
  61. $district= new district();
  62. $tagList=$tag->getAllBySid($this->staff[0]['sid']);
  63. $districtList=$district->get_lv(1);
  64. $data['tagList']=$tagList;
  65. $data['districtList']=$districtList;
  66. $data['memu']="eMailTask";
  67. $data['staff']=$this->staff;
  68. $data['mailMemu']='sms';
  69. $this->render ( "/sms_create", $data );
  70. }
  71. function createSms(){
  72. $title=$this->get_args('title')?$this->get_args('title'):"";
  73. $content=isset($_POST['content'])?$_POST['content']:"";
  74. $tagId=$this->get_args('tagId')?$this->get_args('tagId'):array();
  75. $did=$this->get_args('did')?$this->get_args('did'):"";
  76. $stype=$this->get_args('stype')?$this->get_args('stype'):"";
  77. $kind=$this->get_args('kind')?$this->get_args('kind'):1;
  78. if (!empty($content)&&(!empty($tagId)||!empty($did))){
  79. Doo::loadModel('sms');
  80. $sms=new sms();
  81. Doo::loadModel('tag_client');
  82. $tagClient=new tag_client();
  83. Doo::loadModel('client');
  84. $client=new client();
  85. $tagCondition="";$tagArray=array();
  86. foreach ($tagId as $value){
  87. array_push($tagArray, " tag like '%".$value."%' ");
  88. }
  89. if(!empty($tagArray))
  90. $tagCondition=' and ('.implode(" or ", $tagArray).')';
  91. $clientList=$tagClient->find(array('select'=>'client','where'=>'sid='.$this->staff[0]['sid'].$tagCondition,'asArray'=>true));
  92. $clientArray=array();
  93. foreach ($clientList as $value){
  94. array_push($clientArray, $value['client']);
  95. }
  96. $clientEmailList=array();
  97. if (!empty($clientArray))
  98. $clientEmailList=$client->find(array('select'=>'nicename as clientname,companyname,telephone','where'=>'cid in ('.implode(",", $clientArray).')','asArray'=>true));
  99. if ($stype==2)
  100. $clientEmailList=$client->find(array('select'=>'nicename as clientname,companyname,telephone','where'=>'district like "'.$did.',%" ','asArray'=>true));
  101. $list=array();$illegal=array();
  102. foreach ($clientEmailList as $value){
  103. if (preg_match("/^13[0-9]{1}[0-9]{8}$|15[0-9]{1}[0-9]{8}$|18[0-9]{1}[0-9]{8}$/",$value['telephone']))
  104. array_push($list, $value);
  105. else
  106. array_push($illegal, $value);
  107. }
  108. if ($stype==1){
  109. $sms->tag=implode(",", $tagId);
  110. $sms->districtId=0;
  111. }
  112. if ($stype==2){
  113. $sms->tag="";
  114. $sms->districtId=$did;
  115. }
  116. $sms->date=date("Y-m-d");
  117. $sms->content=$content;//base64_encode(gzcompress(json_encode($emailArray)));
  118. $sms->title=$title;
  119. $sms->client=base64_encode(gzcompress(json_encode($list)));
  120. $sms->illegal=json_encode(array_slice($illegal,0,100));
  121. $sms->signature=1;
  122. $sms->status=1;
  123. $sms->kind=$kind;
  124. $sms->date=date("Y-m-d");
  125. //$sms->tag=implode(",", $tagId);
  126. //$sms->districtId=$did;
  127. $sms->category=$this->staff[0]['category'];
  128. $sms->staffId=$this->staff[0]['sid'];
  129. $sms->staffName=$this->staff[0]['username'];
  130. $sms->insert();
  131. return '/smsList';
  132. }
  133. return '/createSms';
  134. }
  135. function editSmsView(){
  136. $sid=isset($this->params['sid'])?$this->params['sid']:0;
  137. //$sid=$this->get_args('sid')?$this->get_args('sid'):0;
  138. Doo::loadModel('tag');
  139. $tag=new tag();
  140. Doo::loadModel('district');
  141. $district= new district();
  142. $smsInfo=array();
  143. if(!empty($sid)){
  144. Doo::loadModel('sms');
  145. $sms=new sms();
  146. $smsInfo=$sms->getOne(array('where'=>'sid = '.$sid,'asArray'=>true));
  147. $smsInfo['tagList']=explode(",", $smsInfo['tag']);
  148. }else
  149. return "/smsList";
  150. $tagList=$tag->getAllBySid($this->staff[0]['sid']);
  151. $districtList=$district->get_lv(1);
  152. $tagHtml='';
  153. foreach ($tagList as $key=>$value){
  154. $tagHtml.='<label><span data-original-title="'.$value['name'].'" data-toggle="ctooltip" data-placement="right" class="contactsTag tagCol-0'.$value['colorid'].'">
  155. <input type="checkbox" name="tagId[]"';
  156. foreach ($smsInfo['tagList'] as $k=>$v){
  157. if ($value['tid']==$v){
  158. $tagHtml.=' checked ';break;
  159. }
  160. }
  161. $tagHtml.=' value="'.$value['tid'].'"></span></label>';
  162. }
  163. $districtHtml='';
  164. foreach ($districtList as $key=>$value){
  165. $districtHtml.='<option value="'.$value['id'].'"';
  166. if($value['id']==$smsInfo['districtId'])
  167. $districtHtml.='selected';
  168. $districtHtml.='>'.$value['name'].'</option>';
  169. }
  170. $data['districtHtml']=$districtHtml;
  171. $data['tagHtml']=$tagHtml;
  172. $data['smsInfo']=$smsInfo;
  173. $data['tagList']=$tagList;
  174. $data['districtList']=$districtList;
  175. $data['memu']="eMailTask";
  176. $data['staff']=$this->staff;
  177. $data['mailMemu']='smsList';
  178. $this->render ( "/sms_edit", $data );
  179. }
  180. function editSms(){
  181. $sid=$this->get_args('sid')?$this->get_args('sid'):0;
  182. $title=$this->get_args('title')?$this->get_args('title'):"";
  183. $content=isset($_POST['content'])?$_POST['content']:"";
  184. $tagId=$this->get_args('tagId')?$this->get_args('tagId'):array();
  185. $did=$this->get_args('did')?$this->get_args('did'):"";
  186. $stype=$this->get_args('stype')?$this->get_args('stype'):"";
  187. $kind=$this->get_args('kind')?$this->get_args('kind'):1;
  188. if (!empty($content)&&!empty($sid)&&(!empty($tagId)||!empty($did))){
  189. Doo::loadModel('sms');
  190. $sms=new sms();
  191. Doo::loadModel('tag_client');
  192. $tagClient=new tag_client();
  193. Doo::loadModel('client');
  194. $client=new client();
  195. $tagCondition="";$tagArray=array();
  196. foreach ($tagId as $value){
  197. array_push($tagArray, " tag like '%".$value."%' ");
  198. }
  199. if(!empty($tagArray))
  200. $tagCondition=' and ('.implode(" or ", $tagArray).')';
  201. $clientList=$tagClient->find(array('select'=>'client','where'=>'sid='.$this->staff[0]['sid'].$tagCondition,'asArray'=>true));
  202. $clientArray=array();
  203. foreach ($clientList as $value){
  204. array_push($clientArray, $value['client']);
  205. }
  206. $clientEmailList=array();
  207. if (!empty($clientArray))
  208. $clientEmailList=$client->find(array('select'=>'nicename as clientname,companyname,telephone','where'=>'cid in ('.implode(",", $clientArray).')','asArray'=>true));
  209. if ($stype==2)
  210. $clientEmailList=$client->find(array('select'=>'nicename as clientname,companyname,telephone','where'=>'district like "'.$did.',%" ','asArray'=>true));
  211. $list=array();$illegal=array();
  212. foreach ($clientEmailList as $value){
  213. if (preg_match("/^13[0-9]{1}[0-9]{8}$|15[0-9]{1}[0-9]{8}$|18[0-9]{1}[0-9]{8}$/",$value['telephone'])){
  214. array_push($list, $value);
  215. }else{
  216. array_push($illegal, $value);
  217. }
  218. }
  219. $sms->date=date("Y-m-d");
  220. $sms->content=$content;//base64_encode(gzcompress(json_encode($emailArray)));
  221. $sms->title=$title;
  222. $sms->client=base64_encode(gzcompress(json_encode($list)));
  223. $sms->illegal=json_encode(array_slice($illegal,0,100));
  224. $sms->signature=1;
  225. $sms->status=1;
  226. $sms->kind=$kind;
  227. $sms->date=date("Y-m-d");
  228. if ($stype==1){
  229. $sms->tag=implode(",", $tagId);
  230. $sms->districtId=0;
  231. }
  232. if ($stype==2){
  233. $sms->tag="";
  234. $sms->districtId=$did;
  235. }
  236. $sms->staffId=$this->staff[0]['sid'];
  237. $sms->staffName=$this->staff[0]['username'];
  238. $sms->update(array('where'=>'sid='.$sid,'asArray'=>true));
  239. return '/smsList';
  240. }
  241. return '/smsList';
  242. }
  243. function smsList(){
  244. Doo::loadModel('sms');
  245. $sms=new sms();
  246. Doo::loadModel('tag');
  247. $tag=new tag();
  248. $mailList=$sms->find(array('where'=>'staffId='.$this->staff[0]['sid'],'asc'=>'status','asArray'=>true));
  249. foreach ($mailList as $key=>$value){
  250. $mailList[$key]['clientName']=json_decode(gzuncompress(base64_decode($value['client'])),true);
  251. $mailList[$key]['illegalEmail']=json_decode($value['illegal'],true);
  252. $mailList[$key]['clientCount']=count($mailList[$key]['client']);
  253. $mailList[$key]['tag']=array();
  254. if($value['kind']==1)
  255. $mailList[$key]['kindName']='营销';
  256. else
  257. $mailList[$key]['kindName']='通知';
  258. if (!empty($value['tag']))
  259. $mailList[$key]['tag']=$tag->find(array('where'=>'tid in ( '.$value['tag'].') ','asArray'=>true));
  260. }
  261. $data['mailList']=$mailList;
  262. $data['memu']="eMailTask";
  263. $data['staff']=$this->staff;
  264. $data['mailMemu']='smsList';
  265. $this->render ( "/sms_list", $data );
  266. }
  267. function smsCenter(){
  268. $year=$this->get_args('year')?$this->get_args('year'):date("Y");
  269. $month=$this->get_args('month')?$this->get_args('month'):0;
  270. Doo::loadModel('sms');
  271. $sms=new sms();
  272. Doo::loadModel('tag');
  273. $tag=new tag();
  274. $dateCondition="Year(date) =".$year;
  275. if(!empty($month))
  276. $dateCondition="Year(date) =".$year." and Month(date) = ".$month;
  277. $mailList=$sms->find(array('where'=>$dateCondition,'asc'=>'status','asArray'=>true));
  278. foreach ($mailList as $key=>$value){
  279. $mailList[$key]['clientName']=json_decode(gzuncompress(base64_decode($value['client'])),true);
  280. $mailList[$key]['illegalEmail']=json_decode($value['illegal'],true);
  281. $mailList[$key]['clientCount']=count($mailList[$key]['client']);
  282. if($value['kind']==1)
  283. $mailList[$key]['kindName']='营销';
  284. else
  285. $mailList[$key]['kindName']='通知';
  286. $mailList[$key]['tag']=array();
  287. if (!empty($value['tag']))
  288. $mailList[$key]['tag']=$tag->find(array('where'=>'tid in ( '.$value['tag'].') ','asArray'=>true));
  289. }
  290. $dateHtml="";$now=date("Y");
  291. for ($YEARD=2014;$YEARD<=2050;$YEARD++){
  292. if ($YEARD<=$now){
  293. $dateHtml.='<option ';
  294. if ($year==$YEARD )
  295. $dateHtml.=' selected ';
  296. $dateHtml.=' value="'.$YEARD.'">'.$YEARD.'</option>';
  297. }
  298. }
  299. $monthHtml='<option value="0">所有月份</option>';
  300. for ($i=1;$i<=12;$i++){
  301. $monthHtml.='<option ';
  302. if ($i==$month )
  303. $monthHtml.=' selected ';
  304. $monthHtml.=' value="'.$i.'">'.$i.'</option>';
  305. }
  306. $data['monthHtml']=$monthHtml;
  307. $data['dateHtml']=$dateHtml;
  308. $data['mailList']=$mailList;
  309. $data['memu']="eMailTask";
  310. $data['staff']=$this->staff;
  311. $data['mailMemu']='smsCenter';
  312. $this->render ( "/sms_center", $data );
  313. }
  314. function authOrize(){
  315. $kind=isset($this->params['kind'])?$this->params['kind']:0;
  316. $sid=isset($this->params['sid'])?$this->params['sid']:0;
  317. if (!empty($kind)&&!empty($sid)){
  318. Doo::loadModel('sms');
  319. $sms=new sms();
  320. if ($kind==1)
  321. $sms->status=3;
  322. else
  323. $sms->status=2;
  324. $sms->mark=$this->staff[0]['username']."已同意";
  325. $sms->update(array('where'=>'sid='.$sid,'asArray'=>true));
  326. }
  327. return '/smsCenter';
  328. }
  329. function delete(){
  330. $sid=isset($this->params['sid'])?$this->params['sid']:0;
  331. if (!empty($sid)){
  332. Doo::loadModel('sms');
  333. $sms=new sms();
  334. $sms->delete(array('where'=>'sid='.$sid));
  335. }
  336. return '/smsList';
  337. }
  338. function sendSms(){
  339. $sid=isset($this->params['sid'])?$this->params['sid']:0;
  340. Doo::loadModel('sms');
  341. $sms=new sms();
  342. if(!empty($sid)){
  343. $smsInfo=$sms->getOne(array('where'=>'sid='.$sid,'asArray'=>true));
  344. if(!empty($smsInfo)&&$smsInfo['kind']==2&&$smsInfo['status']==2){
  345. $smsPhone=json_decode(gzuncompress(base64_decode($smsInfo['client'])),true);
  346. $telephoneMun=array();$clientName=array();
  347. foreach ($smsPhone as $key=>$value){
  348. array_push($telephoneMun, $value['telephone']);
  349. array_push($clientName, $value['clientname']);
  350. }
  351. $telephoneMun=implode(",", $telephoneMun);
  352. $clientName=implode("{|}", $clientName);
  353. $url='http://smsapi.c123.cn/OpenPlatform/OpenApi?';
  354. $ac='1001@501046820001';
  355. $authkey = 'DD59699A324759EACB0ECECE564D1256';
  356. $csid='4496'; //签名编号
  357. $cgid='2733'; //通道组编号
  358. $t=date('YmdGis',strtotime(" +10 seconds ")); //发送时间
  359. $c = '{p1}您好!'.$smsInfo['content'];
  360. $m= $telephoneMun; //号码
  361. $p1=$clientName;
  362. $data = array('action'=>'sendParam', //发送类型 ,可以有sendOnce短信发送,sendBatch一对一发送,sendParam 动态参数短信接口
  363. 'ac'=>$ac,'authkey'=>$authkey,'cgid'=>$cgid,
  364. 'm'=>$m, //号码
  365. 'c'=>$c, //如果页面是gbk编码,则转成utf-8编码,如果是页面是utf-8编码,则不需要转码,内容用{|},如测试一{|}测试二
  366. 'csid'=>$csid, //签名编号 ,可以为空,为空时使用系统默认的签名编号
  367. 't'=>$t, //定时发送,为空时表示立即发送,yyyyMMddHHmmss 如:20130721182038
  368. 'p1'=>$p1
  369. );
  370. $re= $this->postSMS($url,$data);
  371. preg_match_all('/result="(.*?)"/',$re,$res);
  372. if(trim($res[1][0]) == '1' ){
  373. $sms->status=3;
  374. $sms->errorInfo="";
  375. $sms->update(array('where'=>'sid='.$sid));
  376. }else{
  377. switch(trim($res[1][0])){
  378. case 0: $sms->errorInfo="帐户格式不正确(正确的格式为:员工编号@企业编号)";break;
  379. case -1: $sms->errorInfo="服务器拒绝(速度过快、限时或绑定IP不对等)如遇速度过快可延时再发";break;
  380. case -2: $sms->errorInfo=" 密钥不正确";break;
  381. case -3: $sms->errorInfo="密钥已锁定";break;
  382. case -4: $sms->errorInfo="参数不正确(内容和号码不能为空,手机号码数过多,发送时间错误等)";break;
  383. case -5: $sms->errorInfo="无此帐户";break;
  384. case -6: $sms->errorInfo="帐户已锁定或已过期";break;
  385. case -7: $sms->errorInfo="帐户未开启接口发送";break;
  386. case -8: $sms->errorInfo="不可使用该通道组";break;
  387. case -9: $sms->errorInfo="帐户余额不足";break;
  388. case -10: $sms->errorInfo="内部错误";break;
  389. case -11: $sms->errorInfo="扣费失败";break;
  390. default:break;
  391. }
  392. $sms->update(array('where'=>'sid='.$sid));
  393. }
  394. }
  395. }
  396. return "/smsList";
  397. }
  398. function downLoadSms(){
  399. //include Doo::conf()->BASE_PATH.'diagnostic/debug.php';
  400. $sid=isset($this->params['sid'])?$this->params['sid']:0;
  401. Doo::loadModel('sms');
  402. $sms=new sms();
  403. if(!empty($sid)){
  404. $smsInfo=$sms->getOne(array('where'=>'sid='.$sid,'asArray'=>true));
  405. $smsPhone=json_decode(gzuncompress(base64_decode($smsInfo['client'])),true);
  406. $fileContent="";
  407. $filepath=DOO::conf()->SITE_PATH."upload/sms/telephone.txt";
  408. foreach ($smsPhone as $key=>$value){
  409. $fileContent.=$value['telephone'].','.$value['clientname'].',您好!'.$smsInfo['content'].PHP_EOL;
  410. }
  411. file_put_contents($filepath, $fileContent);
  412. header('Content-Description: File Transfer');
  413. header('Content-Type: application/octet-stream');
  414. header('Content-Disposition: attachment; filename='.basename($filepath));
  415. header('Content-Transfer-Encoding: binary');
  416. header('Expires: 0');
  417. header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
  418. header('Pragma: public');
  419. header('Content-Length: ' . filesize($filepath));
  420. readfile($filepath);
  421. }
  422. }
  423. private function postSMS($url,$data=''){
  424. $row = parse_url($url);
  425. $host = $row['host'];
  426. $port = $row['port'] ? $row['port']:80;
  427. $file = $row['path'];
  428. while (list($k,$v) = each($data)) {
  429. //$post .= rawurlencode($k)."=".rawurlencode($v)."&"; //转URL标准码
  430. $post .= $k."=".$v."&";
  431. }
  432. $post = substr( $post , 0 , -1 );
  433. $len = strlen($post);
  434. $fp = @fsockopen( $host ,$port, $errno, $errstr, 10);
  435. if (!$fp) {
  436. return "$errstr ($errno)\n";
  437. } else {
  438. $receive = '';
  439. $out = "POST $file HTTP/1.0\r\n";
  440. $out .= "Host: $host\r\n";
  441. $out .= "Content-type: application/x-www-form-urlencoded\r\n";
  442. $out .= "Connection: Close\r\n";
  443. $out .= "Content-Length: $len\r\n\r\n";
  444. $out .= $post;
  445. fwrite($fp, $out);
  446. while (!feof($fp)) {
  447. $receive .= fgets($fp, 128);
  448. }
  449. fclose($fp);
  450. $receive = explode("\r\n\r\n",$receive);
  451. unset($receive[0]);
  452. return implode("",$receive);
  453. }
  454. }
  455. private function getReceiptCount(){
  456. $status=2;
  457. $year=date('Y');
  458. Doo::loadModel('receipt');
  459. $receipt=new receipt();
  460. Doo::loadModel('verify');
  461. $verify=new verify();
  462. //user verify ID
  463. $vidList=array();
  464. $verifyDetail=$verify->find(array('where'=>'staff like "%\"'.$this->staff[0]['sid'].'\"%"','asArray'=>true));
  465. foreach ($verifyDetail as $key=>$value){
  466. array_push($vidList, $value['vid']);
  467. }
  468. $vid=implode(",", $vidList);
  469. if(empty($verifyDetail))
  470. $vid=0;
  471. $dateCondition=" and Year(date) =".$year;
  472. $approvalCondition=' and verifyStaff not like "%\"'.$this->staff[0]['sid'].'\":{%" ';
  473. $receiptList=$receipt->find(array('where'=>'verify in('.$vid.') and status='.$status.$dateCondition.$approvalCondition,'desc'=>'rid','asArray'=>true));
  474. return count($receiptList);
  475. }
  476. private function _GetFileEXT($filename) {
  477. $pics = explode ( '.', $filename );
  478. $num = count ( $pics );
  479. return $pics [$num - 1];
  480. }
  481. /**
  482. * 获取get或者POST值
  483. * @param string $name 属性名称
  484. * @return fixed 值
  485. */
  486. private function get_args($name) {
  487. if (isset ( $_GET [$name] )) {
  488. if (is_array ( $_GET [$name] ))
  489. return $_GET [$name];
  490. else {
  491. return addslashes ( $_GET [$name] );
  492. //return $_GET [$name] ;
  493. }
  494. } elseif (isset ( $_POST [$name] )) {
  495. if (is_array ( $_POST [$name] ))
  496. return $_POST [$name];
  497. else {
  498. return addslashes ( $_POST [$name] );
  499. //return $_POST [$name];
  500. }
  501. } else
  502. return false;
  503. }
  504. }
  505. ?>