/** * getlevel() * * @param mixed $pid * @param mixed $array_cat * @param integer $numxtitle * @param string $xkey * @return */ function getlevel($pid, $array_cat, $numxtitle = 5, $xkey = " ") { $html = ""; for ($i = 0; $i < $numxtitle; ++$i) { $html .= $xkey; } if ($array_cat[$pid]['parentid'] != 0) { $html .= getlevel($array_cat[$pid]['parentid'], $array_cat); } return $html; }
<?php require "../../lib/lib_teamcalendar.php"; if (!islogin() || !isset($_GET['id']) || !isjoined($_GET['id']) || getlevel($_GET['id']) != 1) { header('Location: ../../index.php'); } $pdo = pdoconnect(); ?> <img id="loadimg" src="calendar/ajax-loader.gif" alt="Loading.." class="hide"/> <button onclick="prev();" class="btn btn-info btn-xs">돌아가기</button> <h2>멤버</h2> <table class="table table-sm"> <tr> <th>이름</th> <th></th> </tr> <?php $stmt = $pdo->prepare("SELECT `user`.`name`,`user`.`userid` FROM `joined` LEFT JOIN `user` ON `joined`.`userid`=`user`.`userid` WHERE `joined`.`groupid`=:groupid AND `joined`.`level`=0"); $stmt->bindParam(':groupid', $_GET['id']); $stmt->execute(); $data = $stmt->fetchAll(PDO::FETCH_ASSOC); for ($i = 0; $i < count($data); $i++) { echo "<tr><td>{$data[$i]['name']}</td><td><button onclick=\"member_out({$data[$i]['userid']});\" class=\"btn btn-info btn-xs\">추방</button></td></tr>"; } ?> </table> <h2>가입 신청</h2> <table class="table table-sm"> <tr> <th>이름</th> <th></th>
public function cscms_skins($field, $str, $label, $row, $sorti = 1, $autoarr = array()) { preg_match_all('/\\[' . $field . ':\\s*([0-9a-zA-Z\\_\\-]+)([\\s]*[link|ulink|dir|level|zd|len|style]*)[=]??([\\d0-9a-zA-Z\\,\\{\\}\\/\\-\\\\:\\s]*)\\]/', $str, $field_arr); if (!empty($field_arr)) { //判断是否嵌套二级 preg_match('/{cscmstype:([\\S]+)\\s+(.*?)}([\\s\\S]+?){\\/cscmstype:\\1}/', $label, $type_arr); if (!empty($type_arr)) { $label = $this->cscms_sql_to($type_arr[1], $type_arr[2], $type_arr[0], $type_arr[3], $label, $row['id']); } unset($type_arr); for ($i = 0; $i < count($field_arr[0]); $i++) { $type = $field_arr[1][$i]; if (array_key_exists($type, $row) && trim($field_arr[2][$i]) != 'zd') { if ($type == 'addtime') { $label = str_replace('[' . $field . ':' . $type . ']', date('Y-m-d H:i:s', $row[$type]), $label); } else { $label = str_replace('[' . $field . ':' . $type . ']', $row[$type], $label); } //判断自定义标签 if (!empty($field_arr[2][$i]) && !empty($field_arr[3][$i])) { //格式化时间 if (trim($field_arr[2][$i]) == 'style' && trim($field_arr[3][$i]) == 'time') { $label = str_replace($field_arr[0][$i], datetime($row[$type]), $label); //获取IP地区 } elseif (trim($field_arr[2][$i]) == 'style' && trim($field_arr[3][$i]) == 'city') { $ci =& get_instance(); $ci->load->library('ip'); $label = str_replace($field_arr[0][$i], $ci->ip->address($row[$type]), $label); //自定义时间 } elseif (trim($field_arr[2][$i]) == 'style') { $label = str_replace($field_arr[0][$i], date(str_replace('f', 'i', $field_arr[3][$i]), $row[$type]), $label); //图片地址 } elseif (trim($field_arr[2][$i]) == 'dir') { $lall = explode(",", $field_arr[3][$i]); $lass = count($lall) > 1 ? $lall[1] : ''; $pic = piclink($lall[0], $row[$type], $lass); $label = str_replace($field_arr[0][$i], $pic, $label); } //字符截取 if (trim($field_arr[2][$i]) == 'len') { $label = str_replace($field_arr[0][$i], sub_str(str_checkhtml($row[$type]), $field_arr[3][$i]), $label); } } } else { //外部字段 switch ($type) { //序 case 'i': $label = str_replace($field_arr[0][$i], $sorti, $label); break; //序 //序 case 'addres': if (trim($field_arr[2][$i]) == 'zd' && !empty($field_arr[3][$i]) && array_key_exists($field_arr[3][$i], $row)) { $zd = $field_arr[3][$i]; $ci =& get_instance(); $ci->load->library('ip'); $label = str_replace($field_arr[0][$i], $ci->ip->address($row[$zd]), $label); } break; //数据统计 //数据统计 case 'count': if (trim($field_arr[2][$i]) == 'zdy' && !empty($field_arr[3][$i])) { $count = 0; $arr = explode(',', $field_arr[3][$i]); $table = $arr[0]; $czd = empty($arr[1]) ? 'id' : $arr[1]; $szd = empty($arr[2]) ? 'id' : $arr[2]; if (array_key_exists($szd, $row)) { $ci =& get_instance(); if (!isset($ci->db)) { $ci->load->database(); } $uid = !empty($row[$szd]) ? $row[$szd] : (!empty($row['uid']) ? $row['uid'] : 0); if (!empty($table) && $ci->db->table_exists(CS_SqlPrefix . $table) && $ci->db->field_exists($czd, CS_SqlPrefix . $table)) { if (!empty($arr[3]) && (!empty($arr[4]) || (int) $arr[4] == 0)) { if ($ci->db->field_exists($arr[3], CS_SqlPrefix . $table)) { $count = $ci->db->query("SELECT id FROM " . CS_SqlPrefix . $table . " where " . $czd . "='" . $uid . "' and " . $arr[3] . "='" . $arr[4] . "'")->num_rows(); } } else { $count = $ci->db->query("SELECT id FROM " . CS_SqlPrefix . $table . " where " . $czd . "='" . $uid . "'")->num_rows(); } } } $label = str_replace($field_arr[0][$i], $count, $label); } break; //会员信息 //会员信息 case 'user': if (($field == 'user' or array_key_exists('uid', $row) or array_key_exists('uidb', $row)) && trim($field_arr[2][$i]) == 'zd' && !empty($field_arr[3][$i])) { $ci =& get_instance(); if (!isset($ci->db)) { $ci->load->database(); } $ziduan = $field_arr[3][$i]; $zdneir = ($field == 'gbook' or $field == 'pl') ? '游客' : 'null'; if ($field == 'user') { $uid = $row['id']; } else { $lall = explode(",", $ziduan); if (!empty($lall[1])) { $uid = !empty($lall[1]) ? $lall[1] : 0; $ziduan = $lall[1]; } else { if (!empty($row['uid'])) { $uid = $row['uid']; } else { $uid = !empty($row['uidb']) ? $row['uidb'] : 0; } } } $czd = $ziduan == 'nichen' ? $ziduan . ',name' : $ziduan; if ($ci->db->field_exists($ziduan, CS_SqlPrefix . 'user')) { $rowu = $ci->db->query("SELECT " . $czd . " FROM " . CS_SqlPrefix . "user where id='" . $uid . "'")->row(); if ($rowu) { $zdneir = $field_arr[3][$i] == 'nichen' && empty($rowu->{$ziduan}) ? $rowu->name : $rowu->{$ziduan}; } } if ($ziduan == 'logo') { if ($uid == 0) { $zdneir = ''; } $zdneir = piclink('logo', $zdneir); } if ($ziduan == 'zid') { if ($zdneir == 0) { $zdneir = 1; } $zdneir = getzd('userzu', 'name', $zdneir); } if ($ziduan == 'qianm') { if (empty($zdneir)) { $zdneir = '暂时没有签名...'; } } if ($ziduan == 'city') { if (empty($zdneir)) { $zdneir = '保密'; } } $label = str_replace($field_arr[0][$i], $zdneir, $label); //会员等级 } elseif (($field == 'user' or array_key_exists('uid', $row) or array_key_exists('uidb', $row)) && trim($field_arr[2][$i]) == 'level' && !empty($field_arr[3][$i])) { $zdneir = ''; if ($field == 'user') { $uid = $row['id']; } else { $uid = !empty($row['uid']) ? $row['uid'] : (!empty($row['uidb']) ? $row['uidb'] : 0); } $jinyan = getzd('user', 'jinyan', $uid); if ($field_arr[3][$i] == '1') { //星星数 $zdneir = getlevel($jinyan, 1); } if ($field_arr[3][$i] == '2') { //下个级别需要经验 $zdneir = getlevel($jinyan, 2); } if ($field_arr[3][$i] == '3') { //下个级别剩余经验 $zdneir = getlevel($jinyan, 3); } if ($field_arr[3][$i] == '4') { //剩余百分比 $zdneir = getlevel($jinyan, 4); } if ($field_arr[3][$i] == '5') { //名称 $zdneir = getlevel($jinyan, 5); } $label = str_replace($field_arr[0][$i], $zdneir, $label); } break; //歌手信息 //歌手信息 case 'singer': if (array_key_exists('singerid', $row) && trim($field_arr[2][$i]) == 'zd' && !empty($field_arr[3][$i])) { $ci =& get_instance(); if (!isset($ci->db)) { $ci->load->database(); } $zdneir = 'null'; if ($ci->db->table_exists(CS_SqlPrefix . 'singer')) { //歌手表存在 $ziduan = $field_arr[3][$i]; if ($ci->db->field_exists($ziduan, CS_SqlPrefix . 'singer')) { $rows = $ci->db->query("SELECT " . $ziduan . " FROM " . CS_SqlPrefix . "singer where id='" . $row['singerid'] . "'")->row(); if ($rows) { $zdneir = $rows->{$ziduan}; } } if ($ziduan == 'pic') { if ($row['singerid'] == 0) { $zdneir = ''; } $zdneir = piclink('singer', $zdneir); } } $label = str_replace($field_arr[0][$i], $zdneir, $label); } break; //版块链接 //版块链接 case 'murl': if (array_key_exists('dir', $row)) { $link = cscmslink($row['dir']); $label = str_replace($field_arr[0][$i], $link, $label); } break; //网站链接 //网站链接 case 'url': //全局 if (array_key_exists('id', $row) && trim($field_arr[2][$i]) == 'link' && !empty($field_arr[3][$i])) { $lall = explode(",", $field_arr[3][$i]); $lass = count($lall) > 1 ? $lall[1] : ''; $link = linkurl($lall[0], $lass, $row['id']); $label = str_replace($field_arr[0][$i], $link, $label); } //会员 if ((array_key_exists('uid', $row) || array_key_exists('uidb', $row) || $field == 'user') && trim($field_arr[2][$i]) == 'ulink' && !empty($field_arr[3][$i])) { $ci =& get_instance(); if (!isset($ci->db)) { $ci->load->database(); } $link = ''; if ($field == 'user') { if (array_key_exists('id', $row) && array_key_exists('name', $row)) { $lall = explode(",", $field_arr[3][$i]); $lass = count($lall) > 1 ? $lall[1] : ''; $link = userlink($lall[0], $row['id'], $row['name'], $lass); } } else { $uid = !empty($row['uid']) ? $row['uid'] : (!empty($row['uidb']) ? $row['uidb'] : 0); $rowu = $ci->db->query("SELECT id,name FROM " . CS_SqlPrefix . "user where id='" . $uid . "'")->row(); if (!$rowu) { $link = 'http://' . Web_Url . Web_Path; } else { $lall = explode(",", $field_arr[3][$i]); $lass = count($lall) > 1 ? $lall[1] : ''; $link = userlink($lall[0], $rowu->id, $rowu->name, $lass); } } $label = str_replace($field_arr[0][$i], $link, $label); } //会员中心... if (trim($field_arr[2][$i]) == 'userlink' && !empty($field_arr[3][$i])) { $link = spacelink($field_arr[3][$i]); $label = str_replace($field_arr[0][$i], $link, $label); } //自定义URL,板块,字段,参数,参数... if (trim($field_arr[2][$i]) == 'zdy' && !empty($field_arr[3][$i])) { $lall = explode(",", $field_arr[3][$i]); if (!array_key_exists($lall[1], $row) || $row[$lall[1]] == 0) { $link = 'http://' . Web_Url . Web_Path; } else { $lass = count($lall) > 3 ? $lall[3] : ''; $link = linkurl($lall[2], $lass, $row[$lall[1]], 1, $lall[0]); } $label = str_replace($field_arr[0][$i], $link, $label); } break; } } } } unset($field_arr); return $label; }
function User_Login($cid = 0, $key = '') { if (!empty($key)) { $key = unserialize(stripslashes(sys_auth($key, 'D'))); $id = isset($key['id']) ? intval($key['id']) : 0; $logstr = isset($key['login']) ? $key['login'] : ''; } else { $id = isset($_SESSION['cscms__id']) ? intval($_SESSION['cscms__id']) : 0; $logstr = isset($_SESSION['cscms__login']) ? $_SESSION['cscms__login'] : ''; } $user_id = intval($this->cookie->get_cookie('user_id')); $user_login = $this->cookie->get_cookie('user_login'); $login = FALSE; if ($id == 0 || empty($logstr)) { if ($user_id > 0 && !empty($user_login)) { //判断非法COOKIE if (!preg_match('/^[0-9a-zA-Z]*$/', $user_login)) { $userlogin = ''; } $row = $this->db->query("SELECT id,name,code,pass,lognum,level,jinyan,cion,vip,logtime,viptime FROM " . CS_SqlPrefix . "user where id=" . $user_id . "")->row(); if ($row) { //判断账号密码是否正确 if (md5($row->name . $row->pass . $row->code) == $user_login) { //每天登陆加积分 if (User_Cion_Log > 0 && date("Y-m-d", $row->logtime) != date('Y-m-d')) { $updata['cion'] = $row->cion + User_Cion_Log; } //判断VIP if ($row->vip > 0 && $viptime < time()) { $updata['vip'] = 0; $updata['viptime'] = 0; } //判断等级 $level = getlevel($row->jinyan); if ($level > $row->level) { $updata['level'] = $level; //发送等级通知 $add['uida'] = $row->id; $add['uidb'] = 0; $add['name'] = '用户等级升级通知'; $add['neir'] = '恭喜您,您的用户等级升级到Lv' . $level; $add['addtime'] = time(); $this->CsdjDB->get_insert('msg', $add); } //修改登录时间 $updata['zx'] = 1; $updata['lognum'] = $row->lognum + 1; $updata['logtime'] = time(); $updata['logip'] = getip(); $updata['logms'] = time(); $this->CsdjDB->get_update('user', $user_id, $updata); //登录日志 if (date("Y-m-d", $row->logtime) != date('Y-m-d')) { $this->load->library('user_agent'); $agent = ($this->agent->is_mobile() ? $this->agent->mobile() : $this->agent->platform()) . ' / ' . $this->agent->browser() . ' v' . $this->agent->version(); $add['uid'] = $row->id; $add['loginip'] = getip(); $add['logintime'] = time(); $add['useragent'] = $agent; $this->CsdjDB->get_insert('user_log', $add); } $_SESSION['cscms__id'] = $row->id; $_SESSION['cscms__name'] = $row->name; $_SESSION['cscms__login'] = md5($row->name . $row->pass); $login = TRUE; } } } } else { $row = $this->db->query("SELECT id,name,pass,level,jinyan FROM " . CS_SqlPrefix . "user where id='{$id}'")->row(); if ($row) { if (md5($row->name . $row->pass) == $logstr) { $login = TRUE; //判断等级 $level = getlevel($row->jinyan); if ($level > $row->level) { $updata['level'] = $level; //发送等级通知 $add['uida'] = $row->id; $add['uidb'] = 0; $add['name'] = '用户等级升级通知'; $add['neir'] = '恭喜您,您的用户等级升级到Lv' . $level; $add['addtime'] = time(); $this->CsdjDB->get_insert('msg', $add); } //改变在线秒数 $updata['zx'] = 1; $updata['logms'] = time(); $this->CsdjDB->get_update('user', $id, $updata); } } } if (!$login) { //清除非法登录 unset($_SESSION['cscms__id'], $_SESSION['cscms__name'], $_SESSION['cscms__login']); //清除记住登录 $this->cookie->set_cookie("user_id"); $this->cookie->set_cookie("user_login"); if ($cid == 0) { msg_url('您还没有登录或者登录已超时~!', userurl(site_url('user/login'))); } } else { //判断每天会员要删除的数据 $day = @file_get_contents(FCPATH . "cache/cscms_time/day.txt"); if (date('d') != $day) { //清空每天分享,发布 $uedit['addhits'] = 0; $this->CsdjDB->get_update('user', $_SESSION['cscms__id'], $uedit); write_file(FCPATH . "cache/cscms_time/day.txt", date('d')); } } return $login; }
<?php require "../../lib/lib_teamcalendar.php"; $pdo = pdoconnect(); $stmt = $pdo->prepare("SELECT `userid` FROM `board` WHERE boardid=:boardid"); $stmt->bindParam(':boardid', $_REQUEST['tar_boardid']); $stmt->execute(); $data = $stmt->fetch(PDO::FETCH_ASSOC); $chk = false; if ($data['userid'] == $_SESSION['userid'] || getlevel($_REQUEST['gid']) == 1) { $chk = true; } if ($chk) { $stmt = $pdo->prepare("DELETE FROM `board` WHERE `boardid` = :boardid"); $stmt->bindParam(':boardid', $_REQUEST['tar_boardid']); $stmt->execute(); $_SESSION['delmemo'] = 1; } else { $_SESSION['wrongcont'] = 1; }
<?php require "../../lib/lib_teamcalendar.php"; $pdo = pdoconnect(); if (getlevel($_POST['gid']) == 1) { $stmt = $pdo->prepare("DELETE FROM `joined` WHERE `groupid` = :groupid"); $stmt->bindParam(':groupid', $_POST['gid']); $stmt->execute(); $stmt = $pdo->prepare("DELETE FROM `event` WHERE `groupid` = :groupid"); $stmt->bindParam(':groupid', $_POST['gid']); $stmt->execute(); $stmt = $pdo->prepare("DELETE FROM `board` WHERE `groupid` = :groupid"); $stmt->bindParam(':groupid', $_POST['gid']); $stmt->execute(); $stmt = $pdo->prepare("DELETE FROM `group` WHERE `groupid` = :groupid"); $stmt->bindParam(':groupid', $_POST['gid']); $stmt->execute(); $_SESSION['delgroup'] = 1; } else { $stmt = $pdo->prepare("DELETE FROM `joined` WHERE `userid` = :userid AND `groupid` = :groupid"); $stmt->bindParam(':userid', $_SESSION['userid']); $stmt->bindParam(':groupid', $_POST['gid']); $stmt->execute(); $_SESSION['delgroup'] = 2; } header('Location: teamcalendaredit.php');
<?php /** * Created by PhpStorm. * User: jim * Date: 2015/11/5 * Time: 20:15 */ function getlevel($score) { // if($score>90){ // return '优秀'; // }elseif($score>80){ // return '良好'; // }else{ // return "work harder"; // } switch ($score / 10) { case 10: case 9: return "good"; case 7: return "not bad"; default: return 'not cool'; } } echo getlevel(85); ?> </body> </html>
} // Get template $xtpl = new XTemplate("content.tpl", NV_ROOTDIR . "/themes/" . $global_config['module_theme'] . "/modules/" . $module_file); $xtpl->assign('LANG', $lang_module); $xtpl->assign('DATA', $data_content); $xtpl->assign('NV_BASE_ADMINURL', NV_BASE_ADMINURL); $xtpl->assign('NV_NAME_VARIABLE', NV_NAME_VARIABLE); $xtpl->assign('NV_OP_VARIABLE', NV_OP_VARIABLE); $xtpl->assign('module_name', $module_name); $xtpl->assign('NV_EDITOR', $edits); // Get catid if (!empty($array_cat)) { foreach ($array_cat as $cat) { $xtitle = ""; if ($cat['parentid'] != 0) { $xtitle = getlevel($cat['parentid'], $array_cat); } $cat['title'] = $xtitle . $cat['title']; $cat['sl'] = $cat['catid'] == $data_content['catid'] ? "selected=\"selected\"" : ""; $xtpl->assign('CAT', $cat); $xtpl->parse('main.loopcat'); } } $xtpl->assign('PATH', NV_UPLOADS_DIR . '/' . $module_name); $xtpl->assign('id', $data_content['id']); $xtpl->assign('DATA', $data_content); if (!empty($error)) { $xtpl->assign('error', $error); $xtpl->parse('main.error'); } $xtpl->parse('main');
?> </td> <td class=""><?php echo $vo['password']; ?> </td> <td class=" "><?php echo $vo['nickname']; ?> </td> <td class=" "><?php echo $vo['email']; ?> </td> <td class=" "><?php echo getlevel($vo['level']); ?> </td> <td> <a class="btn btn-small" href="<?php echo U('Useradmin/edit', array('id' => $vo['id'])); ?> "><i class="icon-pencil"></i></a> <a class="btn btn-small" href="<?php echo U('Useradmin/delete', array('id' => $vo['id'])); ?> "><i class="icon-trash"></i></a></td> </tr><?php }