Пример #1
0
 /**
  * error Handler.
  * @param string $msg 
  */
 private function halt($msg = null)
 {
     if (!$this->configs['system']['live'] && !$this->announce_debug) {
         $error_message = null;
         $error_message .= "MYSQL_ERROR - " . $this->db_name . "<br />\n";
         $error_message .= "<b>Database error:</b> " . $msg . "<br />\n";
         $error_message .= "<b>MYSQL Error</b>: " . $this->errno . " (" . $this->error . ")<br />\n";
         echo $error_message;
     }
     if (!$this->announce_debug) {
         die("This page is unavailable at the moment. Please try again.");
     } else {
         Bcode::benc_resp(array('failure reason' => array('type' => 'string', 'value' => "MYSQL Error: {$msg} in " . $this->table)));
         die;
     }
 }
Пример #2
0
            $db->ip = $data['ip'];
            $db->port = $data['port'];
            $db->uploaded = 0;
            $db->downloaded = 0;
            $db->to_go = $data['left'];
            $db->seeder = $data['seeder'];
            $db->started = time();
            $db->last_action = time();
            $db->passkey = $data['passkey'];
            $db->connectable = $data['connectable'];
            $db->insert();
            if ($data['seeder']) {
                $torrent_query[] = "torrent_seeders = torrent_seeders + 1";
            } else {
                $torrent_query[] = "torrent_leechers = torrent_leechers + 1";
            }
        }
    }
    if ($data['seeder']) {
        $torrent_query[] = "torrent_visible = 1";
        $torrent_query[] = "torrent_last_action = '" . time() . "'";
    }
    $db = new DB();
    if (count($torrent_query)) {
        $db->query("UPDATE {PREFIX}torrents SET " . implode(", ", $torrent_query) . " WHERE torrent_id = '{$torrent_id}'");
    }
    Bcode::benc_resp_raw(implode("", $callback));
} catch (Exception $e) {
    Bcode::benc_resp(array('failure reason' => array('type' => 'string', 'value' => $e->getMessage())));
    exit;
}