当前位置: 首页>>代码示例>>PHP>>正文


PHP DB::size方法代码示例

本文整理汇总了PHP中DB::size方法的典型用法代码示例。如果您正苦于以下问题:PHP DB::size方法的具体用法?PHP DB::size怎么用?PHP DB::size使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DB的用法示例。


在下文中一共展示了DB::size方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: main

function main()
{
    $body .= '
	<script><!--
	$(document).ready(function(){
	$("#visit").datepicker({
		firstDay: 1
});
  });
-->
	</script>
<fieldset><legend>Add a new visit</legend><form method="post">
		<label>Restaurant <select name="restaurant">';
    foreach (getRestaurantList() as $id => $name) {
        $body .= '<option value="' . $id . '">' . $name . '</option>';
    }
    $body .= '</select></label>
		<label>Date <input type="text" name="date"  id="visit" value="' . date("m/d/Y") . '"/></label>
		<label>Duration (minutes)<input type="text" name="duration"/></label>
		<button type="submit" name="action" value="new">Save New Visit</button>
		</form></fieldset>';
    $db = new DB();
    $db->query("SELECT h.RestaurantID,r.Name,h.Date,h.Duration\n\t\t    FROM history h\n\t\t    \tJOIN restaurants r ON h.RestaurantID = r.ID\n\t\t    ORDER BY h.Date DESC");
    if ($db->size() == 0) {
        return "<span class=\"error\">No history found.</span>";
    }
    $body .= "<h2 style='margin-top:20px;'>Past Visits</h2><table><thead><tr><td>Restaurant Name</td><td>Date of Visit</td><td>Duration</td></tr></thead><tbody>";
    while (list($rid, $rName, $date, $duration) = $db->fetchrow()) {
        $body .= "<tr class=\"" . ($q++ % 2 == 0 ? "even" : "odd") . "\" id=\"hist{$rid}\"><td>{$rName}</td><td>{$date}</td><td>{$duration} minutes</td><td><a href=\"?action=delete&id={$rid}&date={$date}\"><img src=\"delete.png\" alt=\"Delete this entry\" style=\"width:50%\" /></a></td></tr>";
        // Undesireable slide animation:
        //onclick=\"$('#hist$rid').hide('slide',{direction:'up'},'slow');\"
    }
    $body .= "</tbody></table>";
    return $body;
}
开发者ID:guodman,项目名称:lpas,代码行数:35,代码来源:history.php

示例2: _HCM_linkuser

function _HCM_linkuser($jmeno = "")
{
    $name = DB::esc(_anchorStr($jmeno, false));
    $query = DB::query("SELECT id FROM `" . _mysql_prefix . "-users` WHERE username='" . $name . "'");
    if (DB::size($query) != 0) {
        $query = DB::row($query);
        return _linkUser($query['id']);
    }
}
开发者ID:sunlight-cms,项目名称:sunlight-cms-7,代码行数:9,代码来源:linkuser.php

示例3: _HCM_linkroot

function _HCM_linkroot($id = null, $text = null, $nove_okno = false)
{
    $is_id = is_numeric($id);
    if ($is_id) {
        $id = intval($id);
    } else {
        $id = DB::val($id);
    }
    $query = DB::query("SELECT title,title_seo FROM `" . _mysql_prefix . "-root` WHERE " . ($is_id ? 'id' : 'title_seo') . "=" . $id);
    if (isset($nove_okno) and _boolean($nove_okno)) {
        $target = " target='_blank'";
    } else {
        $target = "";
    }
    if (DB::size($query) != 0) {
        $query = DB::row($query);
        if (isset($text) and $text != "") {
            $query['title'] = $text;
        }
        return "<a href='" . _linkRoot($id, $query['title_seo']) . "'" . $target . ">" . $query['title'] . "</a>";
    }
}
开发者ID:sunlight-cms,项目名称:sunlight-cms-7,代码行数:22,代码来源:linkroot.php

示例4: COUNT

 case 1:
     if ($item['var1'] == 1) {
         $iteminfo .= "<span>" . $_lang['article.comments'] . ":</span> " . DB::result(DB::query("SELECT COUNT(id) FROM `" . _mysql_prefix . "-posts` WHERE type=1 AND home=" . $item['id']), 0);
     }
     break;
     // kategorie
 // kategorie
 case 2:
     $iteminfo .= "<span>" . $_lang['global.articlesnum'] . ":</span> " . DB::result(DB::query("SELECT COUNT(id) FROM `" . _mysql_prefix . "-articles` AS art WHERE (home1=" . $item['id'] . " OR home2=" . $item['id'] . " OR home3=" . $item['id'] . ") AND " . _sqlArticleFilter()), 0);
     break;
     // kniha
 // kniha
 case 3:
     // nacteni jmena autora posledniho prispevku
     $lastpost = DB::query("SELECT author,guest FROM `" . _mysql_prefix . "-posts` WHERE home=" . $item['id'] . " ORDER BY id DESC LIMIT 1");
     if (DB::size($lastpost) != 0) {
         $lastpost = DB::row($lastpost);
         if ($lastpost['author'] != -1) {
             $lastpost = _linkUser($lastpost['author'], null, true, true);
         } else {
             $lastpost = $lastpost['guest'];
         }
     } else {
         $lastpost = "-";
     }
     $iteminfo .= "<span>" . $_lang['global.postsnum'] . ":</span> " . DB::result(DB::query("SELECT COUNT(id) FROM `" . _mysql_prefix . "-posts` WHERE type=3 AND home=" . $item['id']), 0) . _template_listinfoseparator . "<span>" . $_lang['global.lastpost'] . ":</span> " . $lastpost;
     break;
     // galerie
 // galerie
 case 5:
     $iteminfo .= "<span>" . $_lang['global.imgsnum'] . ":</span> " . DB::result(DB::query("SELECT COUNT(id) FROM `" . _mysql_prefix . "-images` WHERE home=" . $item['id']), 0);
开发者ID:sunlight-cms,项目名称:sunlight-cms-7,代码行数:31,代码来源:intersection.php

示例5: _iplogUpdate

         } else {
             // neplatna cookie - zaznam v ip logu
             _iplogUpdate(1);
         }
     }
 }
 // kontroly
 $continue = false;
 if (!$persistent_cookie_bad) {
     $id = intval($_SESSION[_sessionprefix . "user"]);
     $pass = $_SESSION[_sessionprefix . "password"];
     $ip = $_SESSION[_sessionprefix . "ip"];
     if (!$persistent_cookie_used) {
         $uquery = DB::query("SELECT * FROM `" . _mysql_prefix . "-users` WHERE id=" . $id);
     }
     if ($persistent_cookie_used or DB::size($uquery) != 0) {
         if (!$persistent_cookie_used) {
             $uquery = DB::row($uquery);
         }
         $gquery = DB::query_row("SELECT * FROM `" . _mysql_prefix . "-groups` WHERE id=" . $uquery['group']);
         if ($uquery['password'] == $pass and $uquery['blocked'] == 0 and $gquery['blocked'] == 0 and (!$_SESSION[_sessionprefix . 'ipbound'] or $ip == _userip)) {
             $continue = true;
         }
         // vse ok
     }
 }
 // zabiti neplatne session
 if ($continue != true) {
     _userLogout(false);
 }
 // definovani konstant
开发者ID:sunlight-cms,项目名称:sunlight-cms-7,代码行数:31,代码来源:session.php

示例6: _extend

// titulek
$title = $query['title'];
if (_template_autoheadings && $query['autotitle']) {
    $content .= "<h1>" . $query['title'] . "</h1>\n";
    _extend('call', 'page.gallery.aftertitle', $extend_args);
}
// obsah
_extend('call', 'page.gallery.content.before', $extend_args);
if ($query['content'] != "") {
    $content .= _parseHCM($query['content']) . "\n\n<div class='hr'><hr /></div>\n\n";
}
_extend('call', 'page.gallery.content.after', $extend_args);
// obrazky
$paging = _resultPaging(_indexOutput_url, $query['var2'], "images", "home=" . $id);
$images = DB::query("SELECT * FROM `" . _mysql_prefix . "-images` WHERE home=" . $id . " ORDER BY ord " . $paging[1]);
$images_number = DB::size($images);
if ($images_number != 0) {
    $usetable = $query['var1'] != -1;
    if (_pagingmode == 1 or _pagingmode == 2) {
        $content .= $paging[0];
    }
    if ($usetable) {
        $content .= "<table class='gallery'>\n";
    } else {
        $content .= "<div class='gallery'>\n";
    }
    // obrazky
    $counter = 0;
    $cell_counter = 0;
    while ($img = DB::row($images)) {
        if ($usetable and $cell_counter == 0) {
开发者ID:sunlight-cms,项目名称:sunlight-cms-7,代码行数:31,代码来源:gallery.php

示例7: _HCM_poll

function _HCM_poll($id = null, $sirka = 150)
{
    // nacteni promennych
    $id = intval($id);
    if (isset($sirka)) {
        $sirka = intval($sirka);
    } else {
        $sirka = 150;
    }
    if ($sirka < 100) {
        $sirka = 100;
    }
    // nacteni dat ankety
    $vpolldata = DB::query("SELECT * FROM `" . _mysql_prefix . "-polls` WHERE id=" . $id);
    if (DB::size($vpolldata) != 0) {
        $vpolldata = DB::row($vpolldata);
        $rcontinue = true;
    } else {
        $rcontinue = false;
    }
    // sestaveni kodu
    if ($rcontinue) {
        // odpovedi
        $ranswers = explode("\n", $vpolldata['answers']);
        $rvotes = explode("-", $vpolldata['votes']);
        $rvotes_sum = array_sum($rvotes);
        if (_loginright_pollvote == 1 and $vpolldata['locked'] != 1 and _iplogCheck(4, $id)) {
            $rallowvote = true;
        } else {
            $rallowvote = false;
        }
        if ($rallowvote) {
            $ranswers_code = "<form action='" . _indexroot . "remote/hcm/pvote.php?_return=" . urlencode(_indexOutput_url . "#hcm_poll_" . SL::$hcmUid) . "' method='post'>\n<input type='hidden' name='pid' value='" . $vpolldata['id'] . "' />";
        } else {
            $ranswers_code = "";
        }
        $ranswer_id = 0;
        foreach ($ranswers as $item) {
            if ($rvotes_sum != 0 and $rvotes[$ranswer_id] != 0) {
                $rpercent = $rvotes[$ranswer_id] / $rvotes_sum;
                $rbarwidth = round($rpercent * ($sirka - _template_votebarwidthreduction));
            } else {
                $rpercent = 0;
                $rbarwidth = 1;
            }
            if ($rallowvote) {
                $item = "<label><input type='radio' name='option' value='" . $ranswer_id . "' /> " . $item . " [" . $rvotes[$ranswer_id] . "/" . round($rpercent * 100) . "%]</label>";
            } else {
                $item .= " [" . $rvotes[$ranswer_id] . "/" . round($rpercent * 100) . "%]";
            }
            $ranswers_code .= "<div class='poll-answer'>" . $item . "<div style='width:" . $rbarwidth . "px;'></div></div>\n";
            $ranswer_id++;
        }
        $ranswers_code .= "<div class='poll-answer'>";
        if ($rallowvote) {
            $ranswers_code .= "<input type='submit' value='" . $GLOBALS['_lang']['hcm.poll.vote'] . "' class='votebutton' />";
        }
        $ranswers_code .= $GLOBALS['_lang']['hcm.poll.votes'] . ":&nbsp;" . $rvotes_sum . "</div>";
        if ($rallowvote) {
            $ranswers_code .= _xsrfProtect() . "</form>\n";
        }
        return "\n<div class='anchor'><a name='hcm_poll_" . SL::$hcmUid . "'></a></div>\n<div class='poll' style='width:" . $sirka . "px;'>\n<div class='poll-content'>\n\n<div class='poll-question'>\n" . $vpolldata['question'] . "\n" . ($vpolldata['locked'] == 1 ? "<div>(" . $GLOBALS['_lang']['hcm.poll.locked'] . ")</div>" : '') . "\n</div>\n\n" . $ranswers_code . "\n\n</div>\n</div>\n\n";
    }
}
开发者ID:sunlight-cms,项目名称:sunlight-cms-7,代码行数:64,代码来源:poll.php

示例8: AND

    // nejnovejsi odpovedi na tema
    case 6:
        $query = DB::query("SELECT subject FROM `" . _mysql_prefix . "-posts` WHERE type=5 AND id=" . $id . " AND (" . _loginindicator . "=1 OR (SELECT public FROM `" . _mysql_prefix . "-root` WHERE id=`" . _mysql_prefix . "-posts`.id)=1)");
        $feedtitle = $_lang['rss.recentanswers'];
        $typelimit = "type=5 AND xhome=" . $id;
        $homelimit = "";
        $pagetitle_column = "subject";
        break;
        // nelegalni typ
    // nelegalni typ
    default:
        exit;
        break;
}
// nacteni polozek
if ($custom_cond and ($donottestsource or DB::size($query) != 0)) {
    $feeditems = array();
    if (!$donottestsource) {
        $query = DB::row($query);
    }
    $pagetitle = $query[$pagetitle_column];
    switch ($type) {
        // komentare/prispevky/temata
        case 1:
        case 2:
        case 3:
        case 5:
        case 6:
            $items = DB::query("SELECT * FROM `" . _mysql_prefix . "-posts` WHERE " . $homelimit . $typelimit . " ORDER BY id DESC LIMIT " . _rsslimit);
            $titlebonus = "";
            while ($item = DB::row($items)) {
开发者ID:sunlight-cms,项目名称:sunlight-cms-7,代码行数:31,代码来源:rss.php

示例9: _HCM_sbox

function _HCM_sbox($id = null)
{
    // priprava
    $result = "";
    $id = intval($id);
    // nacteni dat shoutboxu
    $sboxdata = DB::query("SELECT * FROM `" . _mysql_prefix . "-sboxes` WHERE id=" . $id);
    if (DB::size($sboxdata) != 0) {
        $sboxdata = DB::row($sboxdata);
        $rcontinue = true;
    } else {
        $rcontinue = false;
    }
    // sestaveni kodu
    if ($rcontinue) {
        $result = "\n    <div class='anchor'><a name='hcm_sbox_" . SL::$hcmUid . "'></a></div>\n    <div class='sbox'>\n    <div class='sbox-content'>\n    " . ($sboxdata['title'] != "" ? "<div class='sbox-title'>" . $sboxdata['title'] . "</div>" : '') . "<div class='sbox-item'" . ($sboxdata['title'] == "" ? " style='border-top:none;'" : '') . ">";
        // formular na pridani
        if ($sboxdata['locked'] != 1 and _publicAccess($sboxdata['public'])) {
            // priprava bunek
            // $captcha = _captchaInit();
            if (!_loginindicator) {
                $inputs[] = array($GLOBALS['_lang']['posts.guestname'], "<input type='text' name='guest' class='sbox-input' maxlength='22' />");
            }
            $inputs[] = array($GLOBALS['_lang']['posts.text'], "<input type='text' name='text' class='sbox-input' maxlength='255' /><input type='hidden' name='_posttype' value='4' /><input type='hidden' name='_posttarget' value='" . $id . "' />");
            if (!_loginindicator) {
                $inputs[1][2] = true;
                // $inputs[] = $captcha;
            }
            $result .= _formOutput("hcm_sboxform_" . SL::$hcmUid, _indexroot . "remote/post.php?_return=" . urlencode(_indexOutput_url . "#hcm_sbox_" . SL::$hcmUid), $inputs, null, null);
        } else {
            if ($sboxdata['locked'] != 1) {
                $result .= $GLOBALS['_lang']['posts.loginrequired'];
            } else {
                $result .= "<img src='" . _templateImage("icons/lock.png") . "' alt='locked' class='icon' /> " . $GLOBALS['_lang']['posts.locked2'];
            }
        }
        $result .= "\n</div>\n<div class='sbox-posts'>";
        // vypis prispevku
        $sposts = DB::query("SELECT id,text,author,guest,time,ip FROM `" . _mysql_prefix . "-posts` WHERE home=" . $id . " AND type=4 ORDER BY id DESC");
        if (DB::size($sposts) != 0) {
            while ($spost = DB::row($sposts)) {
                // nacteni autora
                if ($spost['author'] != -1) {
                    $author = _linkUser($spost['author'], "post-author' title='" . _formatTime($spost['time']), false, false, 16, ":");
                } else {
                    $author = "<span class='post-author-guest' title='" . _formatTime($spost['time']) . ", ip=" . _showIP($spost['ip']) . "'>" . $spost['guest'] . ":</span>";
                }
                // odkaz na spravu
                if (_postAccess($spost)) {
                    $alink = " <a href='index.php?m=editpost&amp;id=" . $spost['id'] . "'><img src='" . _templateImage("icons/edit.png") . "' alt='edit' class='icon' /></a>";
                } else {
                    $alink = "";
                }
                // kod polozky
                $result .= "<div class='sbox-item'>" . $author . $alink . " " . _parsePost($spost['text'], true, false, false) . "</div>\n";
            }
        } else {
            $result .= "\n<div class='sbox-item'>" . $GLOBALS['_lang']['posts.noposts'] . "</div>\n";
        }
        $result .= "\n  </div>\n  </div>\n  </div>\n  ";
    }
    return $result;
}
开发者ID:sunlight-cms,项目名称:sunlight-cms-7,代码行数:63,代码来源:sbox.php

示例10: importData

 /**
  * Import data to the database
  * @param  KZipStream|string $stream KZipStream instance or file path
  * @return array             array(true, skipped_tables) on success, array(false, err_msg) on failure
  */
 public function importData($stream)
 {
     // prepare
     global $_lang;
     $err = null;
     $this->_import_tmap = array();
     // rather ugly hack to use existing file path as KZipStream
     if (is_string($stream)) {
         $file = $stream;
         $stream = new KZipStream(null, array(KZip::FILE_TOADD, $file, null));
         unset($file);
     }
     // vars
     $null = chr(0);
     $nullv = chr(1);
     $version = '';
     // import process
     do {
         // read header
         $offset = 0;
         while (true) {
             ++$offset;
             $byte = $stream->read(1);
             if ($byte === $null) {
                 // header read
                 break;
             } else {
                 $version .= $byte;
             }
             if ($offset > 32) {
                 $err = $_lang['dbdump']['dataerror'];
                 break 2;
             }
         }
         // check version
         if (!_checkVersion('database', $version)) {
             $err = $_lang['dbdump']['badversion'];
             break;
         }
         // find local tables
         $tables = array();
         $q = DB::query('SHOW TABLES LIKE \'' . _mysql_prefix . '-%\'');
         while ($r = DB::rown($q)) {
             $tables[$r[0]] = true;
         }
         DB::free($q);
         unset($r);
         // determine maximum query size
         $max_size = DB::query('SHOW VARIABLES LIKE \'max_allowed_packet\'');
         if (DB::size($max_size) !== 1) {
             $err = $_lang['dbdump']['maxpacket'];
             break;
         }
         $max_size = DB::result($max_size, 0, 1);
         $max_size -= 128;
         $max_size = floor(($max_size - 128) * 0.9);
         // adjust maximum query size to available memory
         $memlimit = _phpIniLimit('memory_limit');
         if (isset($memlimit)) {
             $avail_mem = $memlimit - memory_get_usage() - 131072;
             if ($max_size > $avail_mem) {
                 $max_size = $avail_mem;
             }
             unset($avail_mem);
         }
         if ($max_size < 32768) {
             $err = $_lang['dbdump']['memory'];
             break;
         }
         // turn off auto_increment for zero values
         DB::query('SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO"');
         // prepare
         $reset = true;
         $skipped_tables = array();
         $stream_buffer = '';
         $stream_buffer_i = 0;
         // import data
         while (true) {
             // reset?
             if ($reset) {
                 $phase = 0;
                 $table = '';
                 $column = '';
                 $columns = array();
                 $columns_size = 0;
                 $values = array();
                 $value = '';
                 $value_counter = 0;
                 $sql = '';
                 $sql_len = 0;
                 $sql_buffer = '';
                 $sql_buffer_len = 0;
                 $skipping_table = false;
                 $reset = false;
             }
//.........这里部分代码省略.........
开发者ID:sunlight-cms,项目名称:sunlight-cms-7,代码行数:101,代码来源:dbdump.php

示例11: sizeof

             if (_mail('', $subject, $text, "Bcc: " . implode(",", $rec_buffer) . "\n" . $headers)) {
                 $done += sizeof($rec_buffer);
             }
             $rec_buffer = array();
             $rec_buffer_counter = 0;
         }
     }
     // zprava
     if ($done != 0) {
         $output .= _formMessage(1, str_replace(array("*done*", "*total*"), array($done, $item_total), $_lang['admin.other.massemail.send']));
     } else {
         $output .= _formMessage(2, $_lang['admin.other.massemail.noreceiversfound']);
     }
 } else {
     // vypis emailu
     $emails_total = DB::size($query);
     if ($emails_total != 0) {
         $emails = '';
         $email_counter = 0;
         while ($item = DB::row($query)) {
             ++$email_counter;
             $emails .= $item['email'];
             if ($email_counter !== $emails_total) {
                 $emails .= ',';
             }
         }
         $output .= _formMessage(1, "<textarea class='areasmallwide' rows='9' cols='33' name='list'>" . $emails . "</textarea>");
     } else {
         $output .= _formMessage(2, $_lang['admin.other.massemail.noreceiversfound']);
     }
 }
开发者ID:sunlight-cms,项目名称:sunlight-cms-7,代码行数:31,代码来源:other-massemail.php

示例12: _md5Salt

 if ($id == null and $password == "") {
     $errors[] = $_lang['admin.users.edit.passwordneeded'];
 }
 if ($password != "") {
     $passwordchange = true;
     $password = _md5Salt($password);
 }
 // note
 $note = DB::esc(_htmlStr(_wsTrim(mb_substr($_POST['note'], 0, 1024))));
 // blocked
 $blocked = _checkboxLoad("blocked");
 // group
 if (isset($_POST['group'])) {
     $group = intval($_POST['group']);
     $group_test = DB::query("SELECT level FROM `" . _mysql_prefix . "-groups` WHERE id=" . $group . " AND id!=2 AND level<" . _loginright_level);
     if (DB::size($group_test) != 0) {
         $group_test = DB::row($group_test);
         if ($group_test['level'] > _loginright_level) {
             $errors[] = $_lang['global.badinput'];
         }
     } else {
         $errors[] = $_lang['global.badinput'];
     }
 } else {
     $group = $query['group'];
 }
 // levelshift
 if (_loginid == 0) {
     $levelshift = _checkboxLoad("levelshift");
 } else {
     $levelshift = $query['levelshift'];
开发者ID:sunlight-cms,项目名称:sunlight-cms-7,代码行数:31,代码来源:users-edit.php

示例13: _formMessage

    } else {
        $message = _formMessage(2, _eventList($errors, 'errors'));
    }
}
/* ---  modul  --- */
if (_template_autoheadings == 1) {
    $module .= "<h1>" . $_lang['mod.reg'] . "</h1>";
}
switch ($phase) {
    // registracni formular
    case 0:
        // priprava vyberu skupiny
        $groupselect = array(null);
        if (_registration_grouplist) {
            $groupselect_items = DB::query("SELECT id,title FROM `" . _mysql_prefix . "-groups` WHERE `blocked`=0 AND reglist=1 ORDER BY title");
            if (DB::size($groupselect_items) != 0) {
                $groupselect_content = "";
                while ($groupselect_item = DB::row($groupselect_items)) {
                    $groupselect_content .= "<option value='" . $groupselect_item['id'] . "'" . ($groupselect_item['id'] == _defaultgroup ? " selected='selected'" : '') . ">" . $groupselect_item['title'] . "</option>\n";
                }
                $groupselect = array($_lang['global.group'], "<select name='group'>" . $groupselect_content . "</select>");
            }
        }
        // priprava podminek
        if (SL::$settings['rules'] != "") {
            $rules = array("<div class='hr'><hr /></div><h2>" . $_lang['mod.reg.rules'] . "</h2>" . SL::$settings['rules'] . "<br /><label><input type='checkbox' name='agreement' value='1'" . _checkboxActivate(isset($_POST['agreement'])) . " /> " . $_lang['mod.reg.rules.agreement'] . "</label><div class='hr'><hr /></div><br />", "", true);
        } else {
            $rules = array(null);
        }
        // formular
        $captcha = _captchaInit();
开发者ID:sunlight-cms,项目名称:sunlight-cms-7,代码行数:31,代码来源:reg.php

示例14: _iplogUpdate

/**
 * Aktualizace logu IP adres
 * Pro info o argumentech viz {@link _ipLogCheck}
 * @param int $type typ zaznamu
 * @param mixed $var promenny argument dle typu
 */
function _iplogUpdate($type, $var = null)
{
    $querybasic = "SELECT * FROM `" . _mysql_prefix . "-iplog` WHERE ip='" . _userip . "' AND type=" . $type;
    switch ($type) {
        // prihlaseni
        case 1:
            $query = DB::query($querybasic);
            if (DB::size($query) != 0) {
                $query = DB::row($query);
                DB::query("UPDATE `" . _mysql_prefix . "-iplog` SET var=" . ($query['var'] + 1) . " WHERE id=" . $query['id']);
            } else {
                DB::query("INSERT INTO `" . _mysql_prefix . "-iplog` (ip,type,time,var) VALUES ('" . _userip . "',1," . time() . ",1)");
            }
            break;
            // precteni clanku
        // precteni clanku
        case 2:
            DB::query("INSERT INTO `" . _mysql_prefix . "-iplog` (ip,type,time,var) VALUES ('" . _userip . "',2," . time() . "," . $var . ")");
            break;
            // hodnoceni clanku
        // hodnoceni clanku
        case 3:
            DB::query("INSERT INTO `" . _mysql_prefix . "-iplog` (ip,type,time,var) VALUES ('" . _userip . "',3," . time() . "," . $var . ")");
            break;
            // hlasovani v ankete
        // hlasovani v ankete
        case 4:
            DB::query("INSERT INTO `" . _mysql_prefix . "-iplog` (ip,type,time,var) VALUES ('" . _userip . "',4," . time() . "," . $var . ")");
            break;
            // odeslani komentare, prispevku nebo vzkazu; zadost o obnovu hesla
        // odeslani komentare, prispevku nebo vzkazu; zadost o obnovu hesla
        case 5:
        case 7:
            DB::query("INSERT INTO `" . _mysql_prefix . "-iplog` (ip,type,time,var) VALUES ('" . _userip . "'," . $type . "," . time() . ",0)");
            break;
            // pokus o aktivaci uctu
        // pokus o aktivaci uctu
        case 6:
            $query = DB::query($querybasic);
            if (DB::size($query) != 0) {
                $query = DB::row($query);
                DB::query("UPDATE `" . _mysql_prefix . "-iplog` SET var=" . ($query['var'] + 1) . " WHERE id=" . $query['id']);
            } else {
                DB::query("INSERT INTO `" . _mysql_prefix . "-iplog` (ip,type,time,var) VALUES ('" . _userip . "',6," . time() . ",1)");
            }
            break;
    }
}
开发者ID:sunlight-cms,项目名称:sunlight-cms-7,代码行数:54,代码来源:functions.php

示例15: mb_substr

                 break;
         }
     }
     if (!$skip) {
         $cond .= " AND ";
     }
 }
 // vycisteni podminky
 if ($cond == "") {
     $cond = 1;
 } else {
     $cond = mb_substr($cond, 0, mb_strlen($cond) - 5);
 }
 // vyhledani clanku
 $query = DB::query("SELECT art.id,art.title,art.title_seo,cat.title_seo AS cat_title_seo FROM `" . _mysql_prefix . "-articles` AS art JOIN `" . _mysql_prefix . "-root` AS cat ON(cat.id=art.home1) WHERE " . $cond);
 $found = DB::size($query);
 if ($found != 0) {
     if (!_checkboxLoad("_process")) {
         $infopage = true;
     } else {
         $boolparams = array("public", "visible", "comments", "rateon", "showinfo");
         if (_loginright_adminconfirm) {
             $boolparams[] = "confirmed";
         }
         while ($item = DB::row($query)) {
             // smazani komentaru
             if ($new_delcomments or $new_delete) {
                 DB::query("DELETE FROM `" . _mysql_prefix . "-posts` WHERE type=2 AND home=" . $item['id']);
             }
             // smazani clanku
             if ($new_delete) {
开发者ID:sunlight-cms,项目名称:sunlight-cms-7,代码行数:31,代码来源:content-artfilter.php


注:本文中的DB::size方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。