Example #1
0
 /**
  * выдача бонусов
  *
  * @param string $num 
  * @return bool
  * @author NetSoul
  */
 function _paybonus($num)
 {
     $this->config->load('rf_settings', FALSE, TRUE);
     $this->session->set_userdata('voted', 'true');
     if ($this->_get_last_vote() == 0) {
         $this->MYSQL->query("UPDATE vote_logip\n            SET ip='" . $this->session->userdata('ip_address') . "', realtime=" . time() . " WHERE accname='" . get_login() . "'");
         $bonus = config('VOTE_BONUS') * (premium_bonus() / 100);
         bonus_add(Get_AccountSerial(), config('VOTE_BONUS') + $bonus);
         $this->cache->remove('total_money', get_login());
         $this->BPAY = (int) config('VOTE_BONUS') + $bonus;
         return true;
     } else {
         return false;
     }
 }
Example #2
0
 function getbonus()
 {
     // проверка авторизации
     if (!is_logged()) {
         redirect(base_url());
     }
     include APPPATH . "config/mmotop.php";
     $this->data['title'] = lang('off_vote');
     $text = icon('64x64/chart_up.png') . '<p>ќбработка голосов длитс¤ от 30 минут до 2 часов, только по прошествию этого времени вы можете получить свой бонус.</p>';
     $text .= '<a href="' . $config['votelink'] . '" target="_blank">√олосовать</a>' . icon('32x32/comment.png') . br(1);
     $text .= anchor('mmotop/getbonus/', 'получить бонус') . icon('32x32/note_accept.png');
     //  скачивание лога
     if (!($all_data = $this->cache->load('mmotop', 'file', 60 * 30))) {
         $all_data = @file_get_contents($config['logfile']);
         $this->cache->save($all_data, 'mmotop', 'file');
     }
     if (date('Ymd') == date('Ym') . '01') {
         $this->data['content'] = '—егодн¤ нельз¤ получить бонус, идЄт обработка логов. ѕопробуйте завтра.';
         compile();
     }
     //fix
     $aChars = $this->_chararray(get_login());
     $rows = explode("\n", $all_data);
     $find = 0;
     // обработка строк
     for ($i = 0; $i < count($rows); $i++) {
         $rows[$i] = @iconv('UTF-8', 'CP1251', $rows[$i]);
         $row = explode("\t", $rows[$i]);
         if (count($row) != 5) {
             continue;
         }
         if ($row[3] == '') {
             continue;
         }
         // нет ника
         //check time
         $unix_time = strtotime($row[1]);
         $time_left = time() - $unix_time;
         $days = round($time_left / 60 / 60 / 24);
         if ($days > 20) {
             continue;
         }
         //check time
         if ($row[3] == preg_name(get_login())) {
             // найден логин
             if (!$this->_id_exits($row[0], 0)) {
                 // просмотр записи в базе
                 $find++;
                 $text .= br(1) . icon('32x32/accept.png') . 'бонус выдан';
                 if ($row[4] == 1) {
                     $summ = $config['normal'];
                 } else {
                     $summ = $config['sms'];
                 }
                 $bonus = $summ * (premium_bonus() / 100);
                 $bold = bonus_show(Get_AccountSerial());
                 bonus_add(Get_AccountSerial(), $summ + $bonus);
                 $bnow = bonus_show(Get_AccountSerial());
                 file_put_contents(APPPATH . 'mmotop.log', "add bonus for {$row['3']}, have {$bold} now have {$bnow}\r\n", FILE_APPEND);
                 $this->_accepted($row, 0);
             } else {
                 $text .= br(1) . icon('32x32/block.png') . 'бонус был выдан раньше ' . $row[1];
             }
         } elseif (is_array($aChars) && @in_array($row[3], $aChars)) {
             if (!$this->_id_exits($row[0], 0) && $this->_checkname(office_secure($row[3]))) {
                 $find++;
                 $text .= br(1) . icon('32x32/accept.png') . 'бонус выдан';
                 if ($row[4] == 1) {
                     $summ = $config['normal'];
                 } else {
                     $summ = $config['sms'];
                 }
                 $bonus = $summ * (premium_bonus() / 100);
                 $bold = bonus_show(Get_AccountSerial());
                 bonus_add(Get_AccountSerial(), $summ + $bonus);
                 $bnow = bonus_show(Get_AccountSerial());
                 file_put_contents(APPPATH . 'mmotop.log', "add bonus for {$row['3']}, have {$bold} now have {$bnow}\r\n", FILE_APPEND);
                 $this->_accepted($row, 0);
             }
         }
     }
     //for
     if ($find == 0) {
         $text .= br(1) . icon('32x32/delete.png') . '√олос не найден';
     }
     $this->data['content'] = $text;
     //.br(2).icon('32x32/sms.png').anchor('vote/sms',lang('off_vote_sms'));;
     compile();
 }