本文整理汇总了PHP中Kill函数的典型用法代码示例。如果您正苦于以下问题:PHP Kill函数的具体用法?PHP Kill怎么用?PHP Kill使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Kill函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: actionLink
function actionLink($action, $id = "", $args = "", $urlname = "")
{
global $boardroot, $mainPage;
if ($boardroot == "") {
$boardroot = "./";
}
$bucket = "linkMangler";
include 'lib/pluginloader.php';
$res = "";
if ($action != $mainPage) {
$res .= "&page={$action}";
}
if ($id != "") {
$res .= "&id=" . urlencode($id);
}
if ($args) {
$res .= "&{$args}";
}
if (strpos($res, "&")) {
debug_print_backtrace();
Kill("Found & in link");
}
if ($res == "") {
return $boardroot;
} else {
return $boardroot . "?" . substr($res, 1);
}
}
示例2: AssertForbidden
function AssertForbidden($to, $specifically = 0)
{
global $loguser, $forbidden;
if (!isset($forbidden)) {
$forbidden = explode(" ", $loguser['forbiddens']);
}
$caught = 0;
if (in_array($to, $forbidden)) {
$caught = 1;
} else {
$specific = $to . "[" . $specifically . "]";
if (in_array($specific, $forbidden)) {
$caught = 2;
}
}
if ($caught) {
$not = __("You are not allowed to {0}.");
$messages = array("addRanks" => __("add new ranks"), "blockLayouts" => __("block layouts"), "deleteComments" => __("delete usercomments"), "editCats" => __("edit the forum categories"), "editForum" => __("edit the forum list"), "editIPBans" => __("edit the IP ban list"), "editMods" => __("edit Local Moderator assignments"), "editMoods" => __("edit your mood avatars"), "editPoRA" => __("edit the PoRA box"), "editPost" => __("edit posts"), "editProfile" => __("edit your profile"), "editSettings" => __("edit the board settings"), "editSmilies" => __("edit the smiley list"), "editThread" => __("edit threads"), "editUser" => __("edit users"), "haveCookie" => __("have a cookie"), "listPosts" => __("see all posts by a given user"), "makeComments" => __("post usercomments"), "makeReply" => __("reply to threads"), "makeThread" => __("start new threads"), "optimize" => __("optimize the tables"), "purgeRevs" => __("purge old revisions"), "recalculate" => __("recalculate the board counters"), "search" => __("use the search function"), "sendPM" => __("send private messages"), "snoopPM" => __("view other users' private messages"), "useUploader" => __("upload files"), "viewAdminRoom" => __("see the admin room"), "viewAvatars" => __("see the avatar library"), "viewCalendar" => __("see the calendar"), "viewForum" => __("view fora"), "viewLKB" => __("see the Last Known Browser table"), "viewMembers" => __("see the memberlist"), "viewOnline" => __("see who's online"), "viewPM" => __("view private messages"), "viewProfile" => __("view user profiles"), "viewRanks" => __("see the rank lists"), "viewRecords" => __("see the top scores and DB usage"), "viewThread" => __("read threads"), "viewUploader" => __("see the uploader"), "vote" => __("vote"));
$messages2 = array("viewForum" => __("see this forum"), "viewThread" => __("read this thread"), "makeReply" => __("reply in this thread"), "editUser" => __("edit this user"));
$bucket = "forbiddens";
include "./lib/pluginloader.php";
if ($caught == 2 && array_key_exists($to, $messages2)) {
Kill(format($not, $messages2[$to]), __("Permission denied."));
}
Kill(format($not, $messages[$to]), __("Permission denied."));
}
}
示例3: actionLink
function actionLink($action, $id = "", $args = "", $urlname = "")
{
global $boardroot, $mainPage, $urlNameCache;
if ($urlname == "_") {
$urlname = "";
} else {
if (isset($urlNameCache[$action . "_" . $id]) && $urlname == "") {
$urlname = $urlNameCache[$action . "_" . $id];
}
}
$bucket = "linkMangler";
include 'lib/pluginloader.php';
$res = $boardroot;
if ($action != $mainPage) {
$res .= "{$action}/";
}
if ($id != "") {
$res .= $id;
if ($urlname) {
$res .= "-" . urlNamify($urlname);
}
$res .= "/";
}
if ($args) {
$res .= "?{$args}";
}
if (strpos($res, "&")) {
debug_print_backtrace();
Kill("Found & in link");
}
return $res;
//Possible URL Rewriting :D
// return "$boardroot/$action/$id?$args";
}
示例4: MakeCrumbs
MakeCrumbs(array("Main" => "./", "Private messages" => "private.php", $pmtitle => ""), $links);
$pm['num'] = "preview";
$pm['posts'] = $user['posts'];
$pm['id'] = "???";
$pm['uid'] = $user['id'];
$copies = explode(",", "title,name,displayname,picture,sex,powerlevel,avatar,postheader,signature,signsep,regdate,lastactivity,lastposttime");
foreach ($copies as $toCopy) {
$pm[$toCopy] = $user[$toCopy];
}
if ($draftEditor) {
write("\n\t<script type=\"text/javascript\">\n\t\t\twindow.addEventListener(\"load\", hookUpControls, false);\n\t</script>\n");
$qUser = "select name from users where id=" . $pm['userto'];
$rUser = Query($qUser);
if (!NumRows($rUser)) {
if ($_POST['action'] == __("Send")) {
Kill(__("Unknown user."));
}
}
$user = Fetch($rUser);
if ($_POST['action'] == __("Preview")) {
$pm['text'] = $_POST['text'];
$pmtitle = $_POST['title'];
}
if ($_POST['action'] == __("Discard Draft")) {
Query("delete from pmsgs where id = " . $pmid);
Query("delete from pmsgs_text where pid = " . $pmid);
Redirect(__("PM draft discarded."), "private.php", __("your PM box"));
exit;
}
if (substr($pm['text'], 0, 17) == "<!-- ###MULTIREP:") {
$to = substr($pm['text'], 17, strpos($pm['text'], "### -->") - 18);
示例5: getCategory
function getCategory($cat)
{
if (!is_numeric($cat)) {
Kill('Invalid category');
}
if ($cat >= 0) {
$rCategory = Query("select * from {uploader_categories} where id={0}", $cat);
if (NumRows($rCategory) == 0) {
Kill("Invalid category");
}
$rcat = Fetch($rCategory);
} else {
if ($cat == -1) {
$rcat = array("id" => -1, "name" => "Private files");
} else {
if ($cat == -2) {
$rcat = array("id" => -2, "name" => "All private files");
} else {
Kill('Invalid category');
}
}
}
return $rcat;
}
示例6: Kill
<?php
if (!$loguser['root']) {
Kill(__("You're not an administrator. There is nothing for you here."));
}
MakeCrumbs(array(actionLink("admin") => __("Admin"), actionLink("optimize") => __("Optimize tables")));
$rStats = Query("show table status");
while ($stat = Fetch($rStats)) {
$tables[$stat['Name']] = $stat;
}
$tablelist = "";
$total = 0;
foreach ($tables as $table) {
$cellClass = ($cellClass + 1) % 2;
$overhead = $table['Data_free'];
$total += $overhead;
$status = __("OK");
if ($overhead > 0) {
Query("OPTIMIZE TABLE `{" . $table['Name'] . "}`");
$status = "<strong>" . __("Optimized") . "</strong>";
}
$tablelist .= format("\n\t<tr class=\"cell{0}\">\n\t\t<td class=\"cell2\">{1}</td>\n\t\t<td>\n\t\t\t{2}\n\t\t</td>\n\t\t<td>\n\t\t\t{3}\n\t\t</td>\n\t\t<td>\n\t\t\t{4}\n\t\t</td>\n\t</tr>\n", $cellClass, $table['Name'], $table['Rows'], $overhead, $status);
}
write("\n<table class=\"outline margin\">\n\t<tr class=\"header0\">\n\t\t<th colspan=\"7\">\n\t\t\t" . __("Table Status") . "\n\t\t</th>\n\t</tr>\n\t<tr class=\"header1\">\n\t\t<th>\n\t\t\t" . __("Name") . "\n\t\t</th>\n\t\t<th>\n\t\t\t" . __("Rows") . "\n\t\t</th>\n\t\t<th>\n\t\t\t" . __("Overhead") . "\n\t\t</th>\n\t\t<th>\n\t\t\t" . __("Final Status") . "\n\t\t</th>\n\t</tr>\n\t{0}\n\t<tr class=\"header0\">\n\t\t<th colspan=\"7\" style=\"font-size: 130%;\">\n\t\t\t" . __("Excess trimmed: {1} bytes") . "\n\t\t</th>\n\t</tr>\n</table>\n\n", $tablelist, $total);
示例7: Kill
$filename = $_FILES['file']['name'];
$tmpfile = $_FILES['file']['tmp_name'];
if (!file_exists($tmpfile)) {
Kill("File upload failed.");
}
$ext = substr($filename, strlen($filename) - 3);
$allowed_ext = array('zip', 'rar');
if (!in_array($ext, $allowed_ext)) {
Kill("Invalid filetype.");
}
$file = fopen($tmpfile, 'rb');
$tag = fread($file, 4);
fclose($file);
$allowed_tag = array("PK", "Rar!");
if (!in_array($tag, $allowed_tag)) {
Kill("Invalid filetype.");
}
copy($tmpfile, 'downloads/' . $filename);
$thedl = array('file' => 'downloads/' . $filename, 'name' => $_POST['name'], 'desc' => $_POST['desc']);
$downloads = array_merge(array($thedl), $downloads);
file_put_contents('downloads/listing.dat', serialize($downloads));
Alert("Upload successful.", "Notice");
}
$c = 0;
$hl = ' highlightedPost';
foreach ($downloads as $dl) {
echo "\n\t<table class=\"outline margin width100{$hl}\">\n\t\t<tr class=\"cell{$c}\">\n\t\t\t<td>\n\t\t\t\t<span style=\"font-size: 120%; text-decoration: underline;\"><a href=\"{$dl['file']}\">" . htmlspecialchars($dl['name']) . "</a></span><br>\n\t\t\t\tFile size: " . ceil(filesize($dl['file']) / 1024) . " KB<br>\n\t\t\t\tMD5: " . md5_file($dl['file']) . "\n\t\t\t\t" . ($dl['desc'] ? '<br><br>' . nl2br(htmlspecialchars($dl['desc'])) : '') . "\n\t\t\t</td>\n\t\t</tr>\n\t</table>\n";
$c = !$c ? 1 : 0;
$hl = '';
}
if ($loguser['powerlevel'] > 2) {
示例8: unset
}
$bb .= ']';
if ($bbcode['text'] != BB_NULL) {
$bb .= "{$examples[$bbcode['text']]}[/{$bbcode['name']}]";
}
return $bb;
}
$cell = 1;
if (isset($_GET['delete'])) {
unset($bbcodes[(int) $_GET['id']]);
Alert(__('BBCode was removed correctly'));
file_put_contents(BB_FILE, serialize($bbcodes));
}
if (isset($_POST['name'])) {
if (in_array($_POST['name'], $hardcodedbb)) {
Kill(__('This BBCode is hardcoded into board. Sorry...'));
}
$prepare = array('name' => $_POST['name'], 'value' => $_POST['value'], 'text' => $_POST['text'], 'category' => $_POST['category'], 'description' => $_POST['description'], 'html' => $_POST['html']);
if ($_GET['id']) {
$bbcodes[$_GET['id'] - 1] = $prepare;
} else {
$bbcodes[] = $prepare;
}
file_put_contents(BB_FILE, serialize($bbcodes));
}
?>
<script>
$(document).ready(function(){
function makeDisabled(){
$('#description').attr('disabled', !$('#category').val())
}
示例9: WriteCategoryEditContents
function WriteCategoryEditContents($cid)
{
global $loguser, $forumBoards;
$boardlist = '';
if ($cid != -1) {
$rCategory = Query("SELECT * FROM {categories} WHERE id={0}", $cid);
if (!NumRows($rCategory)) {
Kill("Category not found.");
}
$cat = Fetch($rCategory);
$candelete = FetchResult("SELECT COUNT(*) FROM {forums} WHERE catid={0}", $cid) == 0;
$name = htmlspecialchars($cat['name']);
$corder = $cat['corder'];
if (count($forumBoards) > 1) {
foreach ($forumBoards as $bid => $bname) {
$boardlist .= '<label><input type="radio" name="board" value="' . htmlspecialchars($bid) . '"' . ($cat['board'] == $bid ? ' checked="checked"' : '') . '> ' . htmlspecialchars($bname) . '</label>';
}
}
$boxtitle = __("Editing category ") . $name;
$fields = array('name' => '<input type="text" name="name" value="' . $name . '" size=64>', 'order' => '<input type="text" name="corder" value="' . $corder . '" size=3>', 'board' => $boardlist, 'btnSave' => '<button onclick="changeCategoryInfo(' . $cid . '); return false;">Save</button>', 'btnDelete' => '<button ' . ($candelete ? 'onclick="deleteCategory(); return false;"' : 'disabled="disabled"') . '>Delete</button>');
$delMessage = $candelete ? '' : __('Before deleting a category, remove all forums from it.');
} else {
if (count($forumBoards) > 1) {
foreach ($forumBoards as $bid => $bname) {
$boardlist .= '<label><input type="radio" name="board" value="' . htmlspecialchars($bid) . '"' . ($bid == '' ? ' checked="checked"' : '') . '> ' . htmlspecialchars($bname) . '</label>';
}
}
$boxtitle = __("New category");
$fields = array('name' => '<input type="text" name="name" value="" size=64>', 'order' => '<input type="text" name="corder" value="0" size=3>', 'board' => $boardlist, 'btnSave' => '<button onclick="addCategory(); return false;">Save</button>', 'btnDelete' => '');
$delMessage = '';
}
echo "\n\t<form method=\"post\" id=\"forumform\" action=\"" . htmlentities(actionLink("editfora")) . "\">\n\t<input type=\"hidden\" name=\"key\" value=\"" . $loguser["token"] . "\">\n\t<input type=\"hidden\" name=\"id\" value=\"{$cid}\">";
RenderTemplate('form_editcategory', array('formtitle' => $boxtitle, 'fields' => $fields, 'delMessage' => $delMessage));
echo "\n\t</form>";
}
示例10: Kill
$mod .= ", closed = 1";
} else {
if ($_POST['unlock']) {
$mod .= ", closed = 0";
}
}
if ($_POST['stick']) {
$mod .= ", sticky = 1";
} else {
if ($_POST['unstick']) {
$mod .= ", sticky = 0";
}
}
}
if ($thread['lastposter'] == $postingAs && $thread['lastpostdate'] >= time() - 86400 && $postingAsUser['powerlevel'] < 3) {
Kill(__("You can't double post until it's been at least one day."));
}
$qUsers = "update users set posts=" . ($postingAsUser['posts'] + 1) . ", lastposttime=" . time() . " where id=" . $postingAs . " limit 1";
$rUsers = Query($qUsers);
//$pid = FetchResult("SELECT id+1 FROM posts WHERE (SELECT COUNT(*) FROM posts p2 WHERE p2.id=posts.id+1)=0 ORDER BY id ASC LIMIT 1");
//if($pid < 1) $pid = 1;
$qPosts = "insert into posts (thread, user, date, ip, num, options, mood) values (" . $tid . "," . $postingAs . "," . time() . ",'" . $_SERVER['REMOTE_ADDR'] . "'," . ($postingAsUser['posts'] + 1) . ", " . $options . ", " . (int) $_POST['mood'] . ")";
$rPosts = Query($qPosts);
$pid = mysql_insert_id();
$qPostsText = "insert into posts_text (pid,text) values (" . $pid . ",'" . $post . "')";
$rPostsText = Query($qPostsText);
$qFora = "update forums set numposts=" . ($forum['numposts'] + 1) . ", lastpostdate=" . time() . ", lastpostuser=" . $postingAs . ", lastpostid=" . $pid . " where id=" . $fid . " limit 1";
$rFora = Query($qFora);
$qThreads = "update threads set lastposter=" . $postingAs . ", lastpostdate=" . time() . ", replies=" . ($thread['replies'] + 1) . ", lastpostid=" . $pid . $mod . " where id=" . $tid . " limit 1";
$rThreads = Query($qThreads);
Report("New reply by [b]" . $postingAsUser['name'] . "[/] in [b]" . $thread['title'] . "[/] (" . $forum['title'] . ") -> [g]#HERE#?pid=" . $pid, $isHidden);
示例11: Query
$newVal = $pm['deleted'] | $val;
if ($newVal == 3) {
Query("delete from {pmsgs} where id = {0}", $pid);
Query("delete from {pmsgs_text} where pid = {0}", $pid);
} else {
Query("update {pmsgs} set deleted = {0} where id = {1}", $newVal, $pid);
}
$deleted++;
}
}
Alert(format(__("{0} deleted."), Plural($deleted, __("private message"))));
}
}
if (isset($_GET['del'])) {
if ($_GET['token'] !== $loguser['token']) {
Kill('No.');
}
$pid = (int) $_GET['del'];
$rPM = Query("select * from {pmsgs} where id = {0} and (userto = {1} or userfrom = {1})", $pid, $loguserid);
if (NumRows($rPM)) {
$pm = Fetch($rPM);
$val = $pm['userto'] == $loguserid ? 2 : 1;
$newVal = $pm['deleted'] | $val;
if ($newVal == 3) {
Query("delete from {pmsgs} where id = {0}", $pid);
Query("delete from {pmsgs_text} where pid = {0}", $pid);
} else {
Query("update {pmsgs} set deleted = {0} where id = {1}", $newVal, $pid);
}
Alert(__("Private message deleted."));
}
示例12: Query
} else {
if (isset($_GET['tid']) && isset($_GET['time'])) {
$rPost = Query("select id,date,thread from {posts} where thread={0} AND date>{1} ORDER BY date LIMIT 1", $_GET['tid'], $_GET['time']);
} else {
Kill('blarg');
}
}
if (NumRows($rPost)) {
$post = Fetch($rPost);
} else {
Kill(__("Unknown post ID."));
}
$pid = $post['id'];
$tid = $post['thread'];
$rThread = Query("select id,title,forum from {threads} where id={0}", $tid);
if (NumRows($rThread)) {
$thread = Fetch($rThread);
} else {
Kill(__("Unknown thread ID."));
}
$tags = ParseThreadTags($thread['title']);
$ppp = $loguser['postsperpage'];
if (!$ppp) {
$ppp = 20;
}
$from = floor(FetchResult("SELECT COUNT(*) FROM {posts} WHERE thread={1} AND date<={2} AND id!={0}", $pid, $tid, $post['date']) / $ppp) * $ppp;
$url = actionLink("thread", $thread['id'], $from ? "from={$from}" : "", HasPermission('forum.viewforum', $thread['forum'], true) ? $tags[0] : '') . "#post" . $pid;
header("HTTP/1.1 301 Moved Permanently");
header("Status: 301 Moved Permanently");
header("Location: " . $url);
die;
示例13: Query
if ($_GET['action'] == "markasread") {
Query("\tREPLACE INTO \n\t\t\t\t{threadsread} (id,thread,date) \n\t\t\tSELECT \n\t\t\t\t{0}, t.id, {1} \n\t\t\tFROM \n\t\t\t\t{threads} t\n\t\t\t\tINNER JOIN {favorites} fav ON fav.user={0} AND fav.thread=t.id", $loguserid, time());
die(header("Location: " . actionLink("board")));
} else {
if ($_GET['action'] == 'add' || $_GET['action'] == 'remove') {
if ($_GET['token'] !== $loguser['token']) {
Kill(__('No.'));
}
$tid = (int) $_GET['id'];
$thread = Query("SELECT t.forum FROM {threads} t WHERE t.id={0}", $tid);
if (!NumRows($thread)) {
Kill(__("Invalid thread ID."));
}
$thread = Fetch($thread);
if (!HasPermission('forum.viewforum', $thread['forum'])) {
Kill(__("Nice try, hacker kid, but no."));
}
if ($_GET['action'] == 'add') {
Query("INSERT IGNORE INTO {favorites} (user,thread) VALUES ({0},{1})", $loguserid, $tid);
} else {
Query("DELETE FROM {favorites} WHERE user={0} AND thread={1}", $loguserid, $tid);
}
die(header('Location: ' . $_SERVER['HTTP_REFERER']));
}
}
$title = 'Favorites';
$links = array(actionLinkTag(__("Mark threads read"), 'favorites', 0, 'action=markasread'));
MakeCrumbs(array(actionLink('favorites') => 'Favorites'), $links);
$viewableforums = ForumsWithPermission('forum.viewforum');
$total = FetchResult("SELECT COUNT(*) FROM {threads} t INNER JOIN {favorites} fav ON fav.user={0} AND fav.thread=t.id WHERE t.forum IN ({1c})", $loguserid, $viewableforums);
$tpp = $loguser['threadsperpage'];
示例14: CheckPermission
<?php
$title = "Plugin Manager";
CheckPermission('admin.editsettings');
MakeCrumbs(array(actionLink("admin") => __("Admin"), actionLink("pluginmanager") => __("Plugin Manager")));
if ($_REQUEST['action'] == "enable") {
if ($_REQUEST['key'] != $loguser['token']) {
Kill("No.");
}
Query("insert into {enabledplugins} values ({0})", $_REQUEST['id']);
Upgrade();
die(header("location: " . actionLink("pluginmanager")));
}
if ($_REQUEST['action'] == "disable") {
if ($_REQUEST['key'] != $loguser['token']) {
Kill("No.");
}
Query("delete from {enabledplugins} where plugin={0}", $_REQUEST['id']);
die(header("location: " . actionLink("pluginmanager")));
}
$cell = 0;
$pluginsDir = @opendir("plugins");
$enabledplugins = array();
$disabledplugins = array();
$pluginDatas = array();
if ($pluginsDir !== FALSE) {
while (($plugin = readdir($pluginsDir)) !== FALSE) {
if ($plugin == "." || $plugin == "..") {
continue;
}
if (is_dir("./plugins/" . $plugin)) {
示例15: getCategory
$cat = getCategory($_POST["cat"]);
if ($cat['minpower']) {
CheckPermission('uploader.uploadrestricted');
}
$targetdir = $rootdir;
$quot = $quota;
$privateFlag = 0;
if ($_POST['cat'] == -1) {
$quot = $pQuota;
$targetdir = $rootdir . "/" . $loguserid;
$privateFlag = 1;
}
$totalsize = foldersize($targetdir);
$c = FetchResult("SELECT COUNT(*) FROM {uploader} WHERE filename={0} AND deldate=0", $_FILES['newfile']['name']);
if ($c > 0) {
Kill("The file '{$_FILES['newfile']['name']}' already exists. Please delete the old copy before uploading a new one.");
}
if ($_FILES['newfile']['size'] == 0) {
if ($_FILES['newfile']['tmp_name'] == "") {
Alert(__("No file given."));
} else {
Alert(__("File is empty."));
}
} else {
if ($_FILES['newfile']['size'] > Settings::pluginGet('uploaderMaxFileSize') * 1024 * 1024) {
Alert(format(__("File is too large. Maximum size is {0}."), BytesToSize(Settings::pluginGet('uploaderMaxFileSize') * 1024 * 1024)));
} else {
$randomid = Shake();
$pname = $randomid . '_' . Shake();
$fname = $_FILES['newfile']['name'];
$temp = $_FILES['newfile']['tmp_name'];