function ResetPoll($x = null) { global $db; if (!is_numeric($x) && !($x = GetID(true))) { return false; } $db->exec('UPDATE ' . PRE . 'answers SET num=0 WHERE IDP IN (' . $x . ')'); $db->exec('UPDATE ' . PRE . 'polls SET num=0 WHERE ID IN (' . $x . ')'); $db->exec('DELETE FROM ' . PRE . 'pollvotes WHERE ID IN (' . $x . ')'); RebuildPoll(); }
function ModSmarty($mod, $code) { $this->config(); $id = GetID('id'); $this->ID = $id; $this->code = $code; $this->mod = $mod; $this->assign('mod', $this->mod); $this->assign('code', $this->code); $this->Execute(); }
$chars = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'; for ($i = 0, $count = strlen($chars); $i < $count; $i++) { $arr[$i] = $chars[$i]; } mt_srand((double) microtime() * 1000000); shuffle($arr); $code = substr(implode('', $arr), 5, $len); return $code; } function GetID($prefix) { //第一步:初始化种子 //microtime(); 是个数组 /*$seedstr =split(" ",microtime(),5); $seed =$seedstr[0]*10000; //第二步:使用种子初始化随机数发生器 srand($seed); */ //第三步:生成指定范围内的随机数 $random = rand(1000, 10000); $random .= generate_code(); $filename = date("Ymd", time()) . $random . $prefix; return $filename; } $path = "api_images/"; $name_orgin = $_FILES['Filedata']['name']; $name = GetID("." . strtolower(substr($_FILES['Filedata']['name'], strrpos($_FILES['Filedata']['name'], '.') + 1))); $path = $path . $name; move_uploaded_file($_FILES['Filedata']["tmp_name"], $path); $data = array('fileUrl' => "/" . $path, 'fileName' => $name_orgin, 'fileSize' => ceil(filesize($path) / 1000) . 'k'); echo json_encode($data);
<?php include "../../config.php"; //设置默认服务端文件名 $filename = "orderdetail" . GetID(".csv"); $s = new SaeStorage(); if (isset($_FILES["Filedata"]) && is_uploaded_file($_FILES["Filedata"]["tmp_name"]) && $_FILES["Filedata"]["error"] == 0) { //上传文件赋值给$upload_file $upload_file = $_FILES["Filedata"]; $ret = $s->upload('upload', $filename, $upload_file["tmp_name"]); if ($ret == false) { echo 'error'; } else { echo $filename; } } else { echo ''; // I have to return something or SWFUpload won't fire uploadSuccess } // 生成随机文件名 function GetID($prefix) { //第一步:初始化种子 //microtime(); 是个数组 $seedstr = @split(" ", microtime(), 5); $seed = $seedstr[0] * 10000; //第二步:使用种子初始化随机数发生器 srand($seed); //第三步:生成指定范围内的随机数 $random = rand(1000, 10000); $filename = date("YmdHis", time()) . $random . $prefix;
<?php include_once '../../config.php'; //设置默认服务端文件名 global $tmp_dir, $root_directory; $filename = "orderlist_" . GetID(".csv"); $upload_file_name = $root_directory . "cache/upload/" . $filename; if (isset($_FILES["Filedata"]) && is_uploaded_file($_FILES["Filedata"]["tmp_name"]) && $_FILES["Filedata"]["error"] == 0) { //上传文件赋值给$upload_file $upload_file = $_FILES["Filedata"]; if (move_uploaded_file($upload_file["tmp_name"], $upload_file_name)) { echo $filename; } else { echo ''; } } else { echo ' '; // I have to return something or SWFUpload won't fire uploadSuccess } // 生成随机文件名 function GetID($prefix) { //第一步:初始化种子 //microtime(); 是个数组 $seedstr = split(" ", microtime(), 5); $seed = $seedstr[0] * 10000; //第二步:使用种子初始化随机数发生器 srand($seed); //第三步:生成指定范围内的随机数 $random = rand(1000, 10000); $filename = date("YmdHis", time()) . $random . $prefix;
<?php if (iCMSa != 1) { exit; } #Action: save mass changes if ($_POST && ($x = GetID(true))) { if (isset($_POST['del'])) { $db->exec('DELETE FROM ' . PRE . 'bugcats WHERE ID IN(' . $x . ')'); } else { $s = $b = array(); if ($_POST['sect'] != 'N') { $s[] = 'sect=?'; $b[] = (int) $_POST['sect']; } if ($_POST['acc'] != 'N') { $s[] = 'see=?'; $b[] = clean($_POST['ch_a']); } if ($s) { $db->exec('UPDATE ' . PRE . 'bugcats SET ' . join(', ', $s) . ' WHERE ID IN(' . $x . ')')->execute($b); } } unset($_POST, $s, $b); } #Get categories $res = $db->query('SELECT c.ID,c.name,c.see,c.num,s.title FROM ' . PRE . 'bugcats c LEFT JOIN ' . PRE . 'bugsect s ON c.sect = s.ID ORDER BY s.seq,c.name'); $cat = array(); $sect = ''; $show = 0; $num = 0;
if (isset($_GET['madface'])) { $using_face = 'angry'; } if (!isset($avatar_faces[$using_face])) { $using_face = 'default'; } $char_stance = isset($_GET['stance']) ? $_GET['stance'] : GetCharacterOption($internal_id, 'avatar_stance', CURRENT_LOCALE, 'stand'); $char_stance_frame = isset($_GET['stance_frame']) ? $_GET['stance_frame'] : '0'; $stand = 1; $weapongroup = -1; $shown_items = array(); // Get character equipment $character_equipment = $__char_db->query("\nSELECT \n\titemid, slot, display_id \nFROM \n\t`items` \nWHERE \n\t`character_id` = " . $internal_id . "\nAND \n\t`inventory` = 0 \nAND \n\t`slot` < 0 \nAND \n\t`slot` > -200 \n/*\n# If you want to hide expired items... uncomment\nAND\n\tTO_FILETIME(NOW()) < `expires` \n*/\nORDER BY \n\t`slot` DESC\n"); while ($row2 = $character_equipment->fetch_assoc()) { $slot = abs($row2['slot']) % 100; $itemid = GetID($row2); $iscash = floor(abs($row2['slot']) / 100) == 1; if (DEBUGGING) { echo 'Slot: ' . $row2['slot'] . ' (' . $slot . ') : ' . $itemid . "\r\n"; } if (!$iscash) { if (isset($shown_items[$slot])) { continue; } else { $shown_items[$slot] = $itemid; } } else { $shown_items[$slot] = $itemid; } if ($row2['slot'] == -11) { // Prepare item type for cash item
// Shield // Shield case -110: // NX Shield if (floor($row2['itemid'] / 100) != 13527) { // Bullet for Mech $shield = GetID($row2); } break; case -11: // Weapon $wep = GetID($row2); break; case -111: // NX Weapon $nxwep = GetID($row2); break; } } $character_equipment->free(); if (isset($_GET['bg'])) { $bgid = intval($_GET['bg']); $bgname = ''; switch ($bgid) { case 0: $bgname = 'fm'; break; case 1: $bgname = 'kerning'; break; case 2:
<?php if (iCMSa != 1 || !admit('R')) { exit; } require LANG_DIR . 'admAll.php'; #Aktualizuj lub usun if ($_POST && isset($_POST['del']) && ($x = GetID(true))) { $db->exec('DELETE FROM ' . PRE . 'rss WHERE ID IN (' . $x . ')'); } #Pobierz kanaly RSS $res = $db->query('SELECT ID,auto,name,lang FROM ' . PRE . 'rss ORDER BY lang,name'); $all = array(); foreach ($res as $x) { $all[] = array('id' => $x['ID'], 'title' => $x['name'], 'land' => $x['lang'], 'auto' => $x['auto'] ? $lang['yes'] : $lang['no'], 'edit' => url('editRss/' . $x['ID'], '', 'admin'), 'file' => file_exists('rss/' . $x['ID'] . '.xml') ? 'rss/' . $x['ID'] . '.xml' : null); } #Szablon $view->add('rss', array('channel' => &$all)); #Zapisz tytuly w opcjach if ($_POST || isset($URL[1])) { $cfg['RSS'] = array(); foreach ($all as $x) { if ($x['auto']) { $cfg['RSS'][$x['land']][$x['id']] = $x['title']; } } include_once './lib/config.php'; $o = new Config('main'); $o->add('cfg', $cfg); $o->save(); }
<?php if (iCMSa != 1 || !admit('B')) { exit; } require LANG_DIR . 'admAll.php'; #Action: delete if ($_POST and $x = GetID(true) and isset($_POST['del'])) { $db->exec('DELETE FROM ' . PRE . 'banners WHERE ID IN (' . $x . ')'); } #Info $view->info($lang['adInfo'], array(url('editAd', '', 'admin') => $lang['addAd'])); #Get ads $res = $db->query('SELECT ID,gen,name,ison FROM ' . PRE . 'banners ORDER BY gen,name'); $res->setFetchMode(3); $ad = array(); $num = 0; foreach ($res as $x) { $ad[] = array('num' => ++$num, 'id' => $x[0], 'gen' => $x[1], 'title' => $x[2], 'on' => $x[3] == 1 ? $lang['on2'] : $lang['off2'], 'edit' => url('editAd/' . $x[0], '', 'admin')); } #Redirect to editing if empty if (empty($ad)) { header('Location: ' . URL . url('editAd', '', 'admin')); exit; } else { $view->add('ads', array('ad' => &$ad)); }
<?php if (iCMSa != 1 || !admit('U')) { exit; } require LANG_DIR . 'admAll.php'; require LANG_DIR . 'profile.php'; #Delete + 2 triggers if (isset($_POST['del']) && !isset($_POST['x'][1]) && ($x = GetID(true))) { $res = $db->query('SELECT ID FROM ' . PRE . 'users WHERE ID IN(' . $x . ')' . (UID != 1 ? ' AND lv<' . LEVEL : '')); if ($all = join(',', $res->fetchAll(7))) { $db->beginTransaction(); $db->exec('DELETE FROM ' . PRE . 'users WHERE ID IN (' . $all . ')'); $db->exec('DELETE FROM ' . PRE . 'pollvotes WHERE user IN (' . $all . ')'); $db->exec('DELETE FROM ' . PRE . 'groupuser WHERE u IN (' . $all . ')'); $db->exec('UPDATE ' . PRE . 'groups SET num=(SELECT COUNT(*) FROM ' . PRE . 'groupuser WHERE g=ID)'); $db->exec('DELETE FROM ' . PRE . 'comms WHERE (guest!=1 AND author IN(' . $all . ')) OR (type=10 AND CID IN(' . $all . '))'); $db->commit(); } } #Page number if (isset($_GET['page']) && $_GET['page'] > 1) { $page = $_GET['page']; $st = ($page - 1) * 30; } else { $page = 1; $st = 0; } #Search users if (isset($_REQUEST['s']) && $_REQUEST['s']) {
<?php if (iCMSa != 1 || !admit('G')) { exit; } require LANG_DIR . 'admAll.php'; #Delete groups if ($_POST) { $x = GetID(true); if (isset($_POST['del'])) { $db->beginTransaction(); $db->exec('DELETE FROM ' . PRE . 'groups WHERE ID IN (' . $x . ')'); $db->exec('DELETE FROM ' . PRE . 'groupuser WHERE g IN (' . $x . ')'); $db->commit(); } } #Get groups - FETCH_NUM $res = $db->query('SELECT ID,name,opened FROM ' . PRE . 'groups'); $res->setFetchMode(3); #Initialize vars $group = array(); $num = 0; foreach ($res as $g) { $group[] = array('id' => $g[0], 'num' => ++$num, 'url' => url('group/' . $g[0]), 'edit' => url('editGroup/' . $g[0], '', 'admin'), 'title' => $g[1], 'opened' => $g[2] ? $lang['yes'] : $lang['no']); } $res = null; $view->add('groups', array('group' => &$group));
function del_inven($serial, $num) { if ($num > 100) { redirect(base_url()); } $numeric = (int) office_secure($num); if (!is_numeric($serial)) { redirect('main'); } if (!secure_serial_check($serial)) { redirect('#warn'); } $this->table->set_template(tpl_table()); $world = get_world(); $query = $this->MSSQL->query("SELECT K{$num},D{$num},U{$num} FROM {$world}.dbo.tbl_inven WHERE Serial = '{$serial}'"); if ($query->num_rows() > 0) { $row = $query->row_array(); $this->table->add_row(lang('off_inven_items'), GetID($row['K' . $num], false)); $this->table->add_row(lang('off_inven_count'), $row['D' . $num]); $this->table->add_row(lang('off_inven_update'), show_talic(bindechex($row['U' . $num], 3))); $this->table->add_row(form_open('main/acceptdelitem') . form_hidden('num', $num) . form_hidden('serial', $serial) . form_submit('accept', lang('off_accept_del')) . form_close(), go_back('', true)); } $this->data['title'] = lang('off_acceptdelitemtitle'); $this->data['content'] = $this->table->generate(); compile(); }
<?php if (iCMSa != 1 || !admit('C')) { exit; } require LANG_DIR . 'admAll.php'; require './lib/categories.php'; require './cfg/content.php'; try { #Delete cats if (isset($_POST['del']) && ($x = GetID(1))) { $res = $db->query('SELECT ID,name,access,type,lft,rgt FROM ' . PRE . 'cats WHERE ID IN (' . $x . ')'); #Do the job if ($_POST['del'] == 'OK') { $type = parse_ini_file('cfg/types.ini', 1); $db->beginTransaction(); foreach ($res as $cat) { $id = $cat['ID']; $t = $type[$cat['type']]['table']; $t2 = isset($type[$cat['type']]['table2']) ? $type[$cat['type']]['table2'] : false; $sub = (int) $_POST['x'][$id]; $new = (int) $_POST['items'][$id]; $del = 'ID=' . $id; #CONTENT if ($new > 0) { $db->exec('UPDATE ' . PRE . $t . ' SET cat=' . $new . ' WHERE cat=' . $id); } elseif ($new < 0) { $db->exec('DELETE FROM ' . PRE . $t . ' WHERE cat=' . $id); if ($t2) { $db->exec('DELETE FROM ' . PRE . $t . ' WHERE cat=' . $id); }