ExpandController.php 18 KB

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