Beispiel #1
0
 function update()
 {
     $idu = isset($_SESSION['idu']) ? $_SESSION['idu'] : 0;
     $this->stat->saveStat($idu, "profile/update");
     $nick = $_POST['nick'];
     $sex = $_POST['my_sex'];
     $bday = $_POST['bday'];
     $bmonth = $_POST['bmonth'];
     $byear = $_POST['byear'];
     $idcity = $_POST['idcity'];
     $desc = $_POST['description'];
     $birthday = date($byear . '-' . $bmonth . '-' . $bday);
     $model = new Model_Profile();
     $profiles = $model->getProfile($idu);
     if (count($profiles) > 0) {
         $profile = $profiles[0];
         $profile['nickname'] = $nick;
         $profile['sex'] = $sex;
         $profile['birthday'] = $birthday;
         $profile['idcity'] = $idcity;
         $profile['description'] = $desc;
         $model->updateProfile($profile);
     }
     header('Location:' . WEB_APP . '/profile/');
 }
Beispiel #2
0
 function index()
 {
     $idu = isset($_SESSION['idu']) ? $_SESSION['idu'] : 0;
     $msisdn = empty($_POST['msisdn']) ? '' : $_POST['msisdn'];
     unset($_POST['msisdn']);
     $telco = isset($_GET['o']) ? htmlspecialchars($_GET['o']) : "";
     unset($_GET['o']);
     $this->stat->saveStat($idu, "unsubscribe/index [{$msisdn}, {$telco}]");
     if (!empty($msisdn)) {
         $telco = isset($_POST['o']) ? htmlspecialchars($_POST['o']) : "";
         unset($_POST['o']);
         if (!empty($telco)) {
             $model = new Model_Profile();
             $utilz = new Utilz();
             $result = $utilz->unsubscribe($msisdn, $telco);
             if ($result === '1') {
                 $model->removeProfile($msisdn);
             }
             unset($_SESSION['idu']);
             header('Location:' . WEB_APP);
         } else {
             $this->template->view('error', $idu > 0);
         }
     } else {
         $model = new Model_Profile();
         $profiles = $model->getProfile($idu);
         if (count($profiles) > 0) {
             $profile = $profiles[0];
             if (!empty($profile)) {
                 $msisdn = $profile['msisdn'];
             }
         }
         $this->template->vars('msisdn', $msisdn);
         $this->template->vars('telco', $telco);
         $this->template->view('index', $idu > 0);
     }
 }