Guest User

Untitled

a guest
Oct 23rd, 2017
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.72 KB | None | 0 0
  1. class controller_defaultact extends controller_base {
  2.     function __construct($sms){
  3.         parent::__construct();
  4.         $this->sms = $sms;
  5.     }
  6.     public function defaultact(){
  7.         return "Уточните код запроса. Пользуйтесь только нашими сервисами!";
  8.     }
  9.     public function defaultout($control_array,$sms){
  10.         echo $sms->get_AnswerText();
  11.     }
  12.     public function get_TextbyId($parametrs){
  13.         $id = unserialize($paramerts);
  14.         $sql = "SELECT `answer`
  15.                 FROM `service_answer_text`
  16.                 WHERE `id`='$id'
  17.                 LIMIT 1";
  18.         if ($this->db->num_rows($sql)){
  19.             $result = $this->db->fetch_rows();
  20.             $answer = $result[0]['answer'];
  21.         } else {
  22.             $answer = $this->defaultact();
  23.         }
  24.         return $answer;
  25.     }
  26.     public function get_SmsKey($parametrs){
  27.         $smskey = $this->generate_password(10);
  28.         $IdServiceMain = $this->sms->get_Service();
  29.         $id_user = $this->getUserId($IdServiceMain,$this->sms->get_PrefixId(),$this->sms->get_SourseNumber());
  30.         $sql = "INSERT INTO `key_keys`(`datetime`, `user_id`, `project_id`, `key`, `count`)
  31.                 VALUE (UNIX_TIMESTAMP(),$id_user,$IdServiceMain,$smskey,0)";
  32.         return "Спасибо! Ваш ключ: $smskey";
  33.     }
  34.     public function return_SmsKey($parametrs){
  35.         echo "ENTER";
  36.         $parametrs = array(
  37.             "body"=>array(
  38.                 "child"=>array(
  39.                     "sms"=>array("attr"=>array("id"=>1),
  40.                         "child"=>array(
  41.                             "param"=>array("attr"=>array("type"=>"phone","value"=>"987")),//{$this->sms->get_PhoneNumber()}")),
  42.                             "param"=>array("attr"=>array("type"=>"text","value"=>"text"))//{$this->sms->get_AnswerText()}"))
  43.                         )
  44.                     )
  45.                 )
  46.             )
  47.         );
  48.         $xml = $this->arr2xml('windows-1251',$parametrs);
  49.         print($xml);// 'xml='.$xml;
  50.         var_dump($xml);
  51.         return $xml;
  52.     }
  53. }
Add Comment
Please, Sign In to add comment