Beispiel #1
0
 function update()
 {
     if ($this->enabled == 1) {
         if (isset($_COOKIE['hfh_disable_counter'])) {
             return;
         }
         global $db;
         global $login;
         $ip = getRemoteAdr();
         $dur = $this->duration;
         /* Update usage stat */
         $sql = "SELECT * FROM `" . $this->table . "` WHERE `userid`=" . $login->currentUserID() . " OR `ipadress`='" . $ip . "' ORDER BY `timestamp` DESC LIMIT 1;";
         $res = $db->query($sql);
         $r = mysql_fetch_assoc($res);
         if ($r['last_action'] + $dur < time()) {
             $sql = "INSERT INTO `" . $this->table . "`\r\n\t\t\t\t\t\t\t(`userid`, `timestamp`, `last_action`, `ipadress`, `referer`, `browseragent`, `os`)\r\n\t\t\t\t\t\t\tVALUES\r\n\t\t\t\t\t\t\t(" . $login->currentUserID() . ", " . time() . ", " . time() . ", '" . $ip . "', '" . $this->getUserReferer() . "', '" . $this->getUserAgent() . "', '" . $this->getUserOS() . "');";
         } else {
             $sql = "UPDATE `" . $this->table . "` SET `duration`=" . (time() - $r['timestamp']) . ", `last_action`=" . time() . ", `userid`=" . $login->currentUserID() . " WHERE `timestamp`=" . $r['timestamp'] . " AND `ipadress`='" . $ip . "';";
         }
         $db->query($sql);
     }
 }
Beispiel #2
0
             break;
         }
     }
 default:
     if (isVisible($categoryid)) {
         $showcategories = true;
         if ($downloadid > 0) {
             $dl = getDownload($downloadid);
             if (isset($_POST['download'])) {
                 increaseDownloadCounter($downloadid);
                 $dl['counter']++;
                 $addr = trim($config->get('media', 'mail-notification-address'));
                 if ($addr != '') {
                     $text = '<p><strong><a href="' . getSelfURL() . '/' . makeURL($mod, array('categoryid' => $categoryid, 'downloadid' => $downloadid)) . '">' . $dl['name'] . '</a></strong></p>';
                     $text .= '<p>' . $lang->get('timestamp') . ': ' . date('d.m.Y H:i') . '</p>';
                     $text .= '<p>IP: ' . getRemoteAdr() . '</p>';
                     $me = $login->currentUser();
                     if (null != $me) {
                         $text .= '<p>UserID: ' . $me['userid'] . '</p>';
                         $text .= '<p>' . $lang->get('nickname') . ': ' . $me['nickname'] . '</p>';
                         $text .= '<p>' . $lang->get('email') . ': ' . $me['email'] . '</p>';
                     }
                     $eMail->send($lang->get('download_notification'), $text, $addr);
                 }
             }
             if ($login->currentUser() !== false) {
                 $smarty->assign('loggedin', true);
                 if (isset($_POST['add'])) {
                     $comments->add($mod, $login->currentUserID(), $_POST['comment'], $downloadid);
                 }
             }
Beispiel #3
0
         $all_filled = false;
     }
 }
 $smarty->assign('submit', $submit);
 if (!$all_filled) {
     $notify->add($lang->get('form'), $lang->get('required_descr'));
 } else {
     $content = '<p style="size:1.3em;"><strong><u>' . $form['title'] . '</u></strong></p>';
     foreach ($form['elements'] as $element) {
         if ($element['type'] > 1) {
             $content .= '<p><strong>' . $element['title'] . '</strong>:<br />' . $submit[$element['elementid']] . '</p>';
         }
     }
     switch ($form['action']) {
         case 'store':
             $db->insert('formmaker_data', array('formid', 'timestamp', 'ipaddress', 'content'), array($form['formid'], time(), "'" . getRemoteAdr() . "'", "'" . $content . "'"));
             $notify->add($lang->get('form'), $form['submit_message']);
             $smarty->assign('submitted', true);
             break;
         case 'mail':
             $addresses = explode(';', $form['address']);
             $subject = $lang->get('form') . ': ' . $form['title'];
             foreach ($addresses as $addr) {
                 if (trim($addr) != '') {
                     $eMail->send($subject, $content, trim($addr));
                 }
             }
             $notify->add($lang->get('form'), $form['submit_message']);
             $smarty->assign('submitted', true);
             break;
     }
Beispiel #4
0
$smarty->assign('isallowed', $isallowed);
$smarty->assign('path', $template_dir . "/default.tpl");
$usr = $login->currentUser();
if ($usr !== false) {
    $smarty->assign('nickname', $usr['nickname']);
}
if (isset($_POST['delete']) && $isallowed) {
    $db->delete($tbl, "`guestbookid`=" . (int) $_POST['guestbookid']);
    $notify->add($lang->get('guestbook'), $lang->get('deleted'));
}
if (isset($_POST['add']) && $_POST['email'] == '') {
    if (trim($_POST['author']) == '' || trim($_POST['message']) == '') {
        $notify->add($lang->get('guestbook'), $lang->get('fill_all'));
    } else {
        if ($ip_blocker_enabled == 1 && $db->num_rows($tbl, "`ipadress`='" . getRemoteAdr() . "' AND `timestamp`>" . (time() - $ip_blocker_limit)) == 0 || $ip_blocker_enabled == 0) {
            $db->insert($tbl, array('timestamp', 'author', 'message', 'ipadress'), array(time(), "'" . $_POST['author'] . "'", "'" . strip_tags($_POST['message']) . "'", "'" . getRemoteAdr() . "'"));
        } else {
            $notify->add($lang->get('guestbook'), $lang->get('ip-blocker'));
        }
    }
}
$messageCount = $db->num_rows($tbl, "1");
$messagesPerPage = $config->get($mod, 'entries-per-page');
@$pages->setValues((int) $_GET['page'], $messagesPerPage, $messageCount);
$list = $db->selectList($tbl, "*", "1", "`timestamp` DESC", $pages->currentValue() . ", " . (int) $messagesPerPage);
if (count($list) > 0) {
    foreach ($list as $i => $l) {
        $list[$i]['time'] = timeElapsed($l['timestamp']);
        $list[$i]['message'] = $bbcode->parse($l['message']);
    }
}
Beispiel #5
0
$u = $login->currentUser();
$makeMeMaster = false;
$db->delete('tetris_player', "`nickname`='" . $u['nickname'] . "'");
if ($u) {
    $nick = $u['nickname'];
    if ($rights->isAllowed('tetris', 'admin', $u['userid'])) {
        $makeMeMaster = true;
    }
} else {
    $nick = "Player" . rand(0, 999);
}
if ($db->num_rows(MYSQL_TABLE_PREFIX . 'tetris_player', "`master`>0") == 0) {
    $master = 1;
} else {
    $master = 0;
}
if ($makeMeMaster) {
    $master = 2;
}
$uniquid = uniqid();
$db->insert(MYSQL_TABLE_PREFIX . 'tetris_player', array("nickname", "ipadress", "last_action", "last_real_action", "master", "uniquid"), array("'" . $nick . "'", "'" . getRemoteAdr() . "'", time(), time(), $master, "'" . $uniquid . "'"));
$field = array();
for ($y = 0; $y < 19; $y++) {
    for ($x = 0; $x < 10; $x++) {
        $field[$y][$x] = $x . "_" . $y;
    }
}
$smarty->assign('uniquid', $uniquid);
$smarty->assign('nick', urlencode($nick));
$smarty->assign('field', $field);
$smarty->assign('path', $template_dir . "/tetris.tpl");
Beispiel #6
0
 function updateLastSeen()
 {
     $sql = "UPDATE `" . $this->user->table . "`\r\n\t\t\t\t\tSET `lastaction`=" . time() . ", `session_id`='" . session_id() . "', `ipadress`='" . getRemoteAdr() . "'\r\n\t\t\t\t\tWHERE `userid`=" . (int) $this->cUser['userid'] . ";";
     $this->db->query($sql);
 }