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


PHP setvar函数代码示例

本文整理汇总了PHP中setvar函数的典型用法代码示例。如果您正苦于以下问题:PHP setvar函数的具体用法?PHP setvar怎么用?PHP setvar使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: adminLogin

function adminLogin()
{
    $reservename = getvar('username', 'post');
    $pass = getvar('pass', 'post');
    if (strlen($reservename) >= 5 && strlen($pass) > 5) {
        $admin = new Admin();
        $row = $admin->findOne($reservename, md5($pass));
        if ($row) {
            setvar('admin', $row['username']);
            //session
            if (getvar('rememberme', 'post')) {
                setcookie('username', $reservename, time() + 3600 * 24 * 7);
            }
            //账号默认保存七天
            setHint('欢迎管理员');
            redirect('usershow');
        } else {
            setHint('账号或密码有误');
            redirect('login');
        }
    } else {
        setHint('账号或密码不符合要求');
        redirect('login');
    }
}
开发者ID:jinghuizhai,项目名称:weixin,代码行数:25,代码来源:handle.php

示例2: index

 function index()
 {
     global $smarty, $viewhelper, $tpl_dir;
     $this->loadModel("userpage");
     $smarty->setTemplateDir(PHPB2B_ROOT . $tpl_dir . DS, 'pages');
     $conditions = array();
     $tpl_file = "pages/default";
     !empty($_GET) && ($_GET = clear_html($_GET));
     if (isset($_GET['id'])) {
         $id = intval($_GET['id']);
         $conditions[] = "id=" . $id;
     } elseif (!empty($_GET['name'])) {
         $conditions[] = "name='" . trim($_GET['name']) . "' OR title='" . trim($_GET['name']) . "'";
     } elseif (!empty($_GET['title'])) {
         $conditions[] = "title='" . trim($_GET['title']) . "' OR name='" . trim($_GET['title']) . "'";
     }
     $this->userpage->setCondition($conditions);
     $result = $this->userpage->dbstuff->GetRow("SELECT * FROM {$this->userpage->table_prefix}userpages " . $this->userpage->getCondition());
     if (!empty($result)) {
         $title = $result['title'];
         $viewhelper->setTitle($title);
         $viewhelper->setPosition($title);
         if (!empty($result['templet_name'])) {
             $tpl_file = "pages/" . $result['templet_name'];
         } elseif ($viewhelper->tpl_exists($smarty->template_dir . "pages/" . $result['name'] . $smarty->tpl_ext)) {
             $tpl_file = "pages/" . $result['name'];
         }
         setvar("item", pb_lang_split_recursive($result));
     } else {
         setvar("item", array());
     }
     $smarty->assign('position', $viewhelper->getPosition());
     $smarty->assign('page_title', $viewhelper->getTitle());
     $smarty->display($tpl_file . $smarty->tpl_ext);
 }
开发者ID:reboxhost,项目名称:phpb2b,代码行数:35,代码来源:page_controller.php

示例3: detail

 function detail()
 {
     global $G;
     using("area", "industry");
     $area = new Areas();
     $industry = new Industries();
     $tpl_file = "company/detail";
     $this->viewhelper->setTitle(L("yellow_page", "tpl"));
     $this->viewhelper->setPosition(L("yellow_page", "tpl"), "index.php?do=company");
     if (isset($_GET['id'])) {
         $id = intval($_GET['id']);
         $result = $area->dbstuff->GetRow("SELECT * FROM {$area->table_prefix}companies WHERE id='" . $id . "'");
         if (!empty($result)) {
             $login_check = 1;
             //default open
             if (isset($G['setting']['company_logincheck'])) {
                 $login_check = $G['setting']['company_logincheck'];
             }
             $this->viewhelper->setTitle($result['name']);
             $this->viewhelper->setPosition($result['name']);
             $result['tel'] = pb_hidestr(preg_replace('/\\((.+?)\\)/i', '', $result['tel']));
             $result['fax'] = pb_hidestr(preg_replace('/\\((.+?)\\)/i', '', $result['fax']));
             $result['mobile'] = pb_hidestr($result['mobile']);
             $result['industry_names'] = $industry->disSubNames($result['industry_id'], null, true, "company");
             $result['area_names'] = $area->disSubNames($result['area_id'], null, true, "company");
             setvar("item", $result);
             setvar("LoginCheck", $login_check);
         }
     }
     render($tpl_file, 1);
 }
开发者ID:reboxhost,项目名称:phpb2b,代码行数:31,代码来源:company_controller.php

示例4: lists

 function lists()
 {
     global $viewhelper, $pos;
     using("industry", "area");
     $area = new Areas();
     $industry = new Industries();
     $conditions[] = "Job.status=1";
     $viewhelper->setTitle(L("hr_information", "tpl"));
     $viewhelper->setPosition(L("hr_information", "tpl"), "index.php?do=job&action=" . __FUNCTION__);
     if (!empty($_GET['q'])) {
         $title = trim($_GET['q']);
         $conditions[] = "Job.name like '%" . $title . "%'";
     }
     if (!empty($_GET['data']['salary_id'])) {
         $conditions[] = "Job.salary_id=" . intval($_GET['data']['salary_id']);
     }
     if (!empty($_GET['data']['area_id'])) {
         $conditions[] = "Job.area_id=" . intval($_GET['data']['area_id']);
     }
     if (isset($_GET['industryid'])) {
         $industry_id = intval($_GET['industryid']);
         $tmp_info = $industry->setInfo($industry_id);
         if (!empty($tmp_info)) {
             $conditions[] = "Job.industry_id=" . $tmp_info['id'];
             $viewhelper->setTitle($tmp_info['name']);
             $viewhelper->setPosition($tmp_info['name'], "index.php?do=job&action=" . __FUNCTION__ . "&industryid=" . $tmp_info['id']);
         }
     }
     if (isset($_GET['areaid'])) {
         $area_id = intval($_GET['areaid']);
         $tmp_info = $area->setInfo($area_id);
         if (!empty($tmp_info)) {
             $conditions[] = "Job.area_id=" . $tmp_info['id'];
             $viewhelper->setTitle($tmp_info['name']);
             $viewhelper->setPosition($tmp_info['name'], "index.php?do=job&action=" . __FUNCTION__ . "&areaid=" . $tmp_info['id']);
         }
     }
     $amount = $this->job->findCount(null, $conditions, "Job.id");
     $result = $this->job->findAll("Job.*,Job.cache_spacename AS userid,Job.created AS pubdate,(select Company.name from " . $this->job->table_prefix . "companies Company where Company.id=Job.id) AS companyname", null, $conditions, "Job.id DESC", $pos, $this->displaypg);
     $viewhelper->setTitle(L("search", "tpl"));
     $viewhelper->setPosition(L("search", "tpl"));
     setvar("items", $result);
     setvar("paging", array('total' => $amount));
     render("job/list", 1);
 }
开发者ID:reboxhost,项目名称:phpb2b,代码行数:45,代码来源:job_controller.php

示例5: detail

 function detail()
 {
     global $viewhelper;
     $tpl_file = "help/detail";
     $viewhelper->setTitle(L("help_center", "tpl"));
     $viewhelper->setPosition(L("help_center", "tpl"), "index.php?do=help");
     if (isset($_GET['id'])) {
         $id = intval($_GET['id']);
         $help_result = $this->help->dbstuff->GetRow("SELECT * FROM {$this->help->table_prefix}helps WHERE id=" . $id);
         if (!empty($help_result)) {
             $title = pb_lang_split($help_result['title']);
             $viewhelper->setTitle($title);
             $viewhelper->setPosition($title);
             setvar("item", $help_result);
         }
     }
     render($tpl_file);
 }
开发者ID:reboxhost,项目名称:phpb2b,代码行数:18,代码来源:help_controller.php

示例6: redirect

 function redirect($code = null)
 {
     global $smarty, $theme_name;
     $codes = array(100 => "Continue", 101 => "Switching Protocols", 200 => "OK", 201 => "Created", 202 => "Accepted", 203 => "Non-Authoritative Information", 204 => "No Content", 205 => "Reset Content", 206 => "Partial Content", 300 => "Multiple Choices", 301 => "Moved Permanently", 302 => "Found", 303 => "See Other", 304 => "Not Modified", 305 => "Use Proxy", 307 => "Temporary Redirect", 400 => "Bad Request", 401 => "Unauthorized", 402 => "Payment Required", 403 => "Forbidden", 404 => "Not Found", 405 => "Method Not Allowed", 406 => "Not Acceptable", 407 => "Proxy Authentication Required", 408 => "Request Time-out", 409 => "Conflict", 410 => "Gone", 411 => "Length Required", 412 => "Precondition Failed", 413 => "Request Entity Too Large", 414 => "Request-URI Too Large", 415 => "Unsupported Media Type", 416 => "Requested range not satisfiable", 417 => "Expectation Failed", 500 => "Internal Server Error", 501 => "Not Implemented", 502 => "Bad Gateway", 503 => "Service Unavailable", 504 => "Gateway Time-out");
     $dir = $smarty->template_dir . $theme_name . DS;
     $msg = !empty($this->message) ? $this->message : $codes[$this->code];
     @header("HTTP/1.1 " . $this->code . " " . $msg);
     $qs = !empty($_SERVER['REDIRECT_URL']) ? $_SERVER['REDIRECT_URL'] : $_SERVER['QUERY_STRING'];
     if (strpos($qs, '404;') !== false) {
         $qs = str_replace('404;', '', $qs);
         $qs = substr($qs, strpos($qs, ':80') + 3);
     }
     setvar("url", $qs);
     setvar("msg", $code . " " . urldecode($msg));
     if (file_exists($dir . $this->code . $smarty->tpl_ext)) {
         render($code, true);
     } else {
         render("error", true);
     }
 }
开发者ID:reboxhost,项目名称:phpb2b,代码行数:20,代码来源:url_controller.php

示例7: updateBreathe

 function updateBreathe($id)
 {
     global $smarty;
     $result = $this->read("*", $id);
     if (!empty($result) && $result['style'] == 1) {
         $tmp_arr = array();
         $xml_template = DATA_PATH . "examples" . DS . "breathe.xml";
         $cache_datafile = DATA_PATH . "appcache/breathe-" . $id . ".xml";
         $ad_result = $this->dbstuff->GetArray("SELECT * FROM " . $this->table_prefix . "adses WHERE status='1' AND state='1' AND adzone_id=" . $id . " ORDER BY priority ASC");
         if (!empty($ad_result)) {
             for ($i = 0; $i < count($ad_result); $i++) {
                 $tmp_arr[$i]['link'] = !empty($ad_result[$i]['target_url']) ? $ad_result[$i]['target_url'] : URL;
                 $tmp_arr[$i]['image'] = $ad_result[$i]['source_url'];
             }
         }
         $data = $tmp_arr;
         setvar("Items", $data);
         $xml_data = $smarty->fetch("file:" . $xml_template);
         file_put_contents($cache_datafile, $xml_data);
     }
 }
开发者ID:renduples,项目名称:alibtob,代码行数:21,代码来源:adzone.php

示例8: lists

 function lists()
 {
     global $viewhelper, $pos;
     $conditions = array();
     $viewhelper->setPosition(L("dictionary", "tpl"), "index.php?do=dict");
     $viewhelper->setTitle(L("dictionary", "tpl"));
     if (!empty($_GET['q'])) {
         $conditions[] = "word like '%" . $_GET['q'] . "%'";
     }
     if (isset($_GET['typeid'])) {
         $type_id = intval($_GET['typeid']);
         $conditions[] = "dicttype_id='" . $type_id . "'";
     }
     $amount = $this->dict->findCount(null, $conditions);
     $result = $this->dict->findAll("Dict.*,dp.name AS typename", array("LEFT JOIN {$this->dict->table_prefix}dicttypes dp ON dp.id=Dict.dicttype_id"), $conditions, "Dict.id DESC", $pos, $this->displaypg);
     if (!empty($result)) {
         setvar("items", $result);
         setvar("paging", array('total' => $amount));
     }
     render("dict/list", true);
 }
开发者ID:reboxhost,项目名称:phpb2b,代码行数:21,代码来源:dict_controller.php

示例9: reactive

 function reactive()
 {
     global $G;
     if (!empty($_GET['em'])) {
         //check em
         $email = $_GET['em'];
         $result = $this->member->checkUserExistsByEmail($email);
         if (!$result) {
             flash("member_not_exists", null, 0);
         } else {
             $member_reg_auth = $G['setting']['new_userauth'];
             $id = $this->member->field("id", "email='" . $email . "'");
             $member_info = $this->member->getInfoById($id);
             require LIB_PATH . "sendmail.inc.php";
             require CACHE_LANG_PATH . "lang_emails.php";
             if ($member_reg_auth == 1) {
                 $if_need_check = true;
                 $exp_time = $this->member->timestamp + 86400;
                 $tmp_username = $member_info['username'];
                 $hash = authcode("{$tmp_username}\t" . $exp_time, "ENCODE");
                 //$hash = str_replace(array("+", "|"), array("|", "_"), $hash);
                 $hash = rawurlencode($hash);
                 setvar("hash", $hash);
                 setvar("expire_date", date("Y-m-d H:i", strtotime("+1 day")));
                 $sended = pb_sendmail(array($email, $member_info['username']), $member_info['username'] . "," . $arrTemplate["_pls_active_your_account"], "activite");
                 if (empty($G['setting']['reg_filename'])) {
                     $gopage = URL . 'register.php?action=done&em=' . urlencode($email);
                 } else {
                     $gopage = URL . $G['setting']['reg_filename'] . '?action=done&em=' . urlencode($email);
                 }
                 pheader("location:" . $gopage);
             }
         }
     } else {
         flash("invalid_request", null, 0);
     }
 }
开发者ID:reboxhost,项目名称:phpb2b,代码行数:37,代码来源:member_controller.php

示例10: flash

    if (!$result) {
        flash();
    }
}
if (isset($_POST['del']) && !empty($_POST['id'])) {
    $result = $goods->del($_POST['id']);
}
if (isset($_GET['do'])) {
    $do = trim($_GET['do']);
    if (!empty($_GET['id'])) {
        $id = intval($_GET['id']);
    }
    if ($do == "del" && !empty($id)) {
        $result = $goods->del($_GET['id']);
    }
    if ($do == "edit") {
        if (!empty($id)) {
            $result = $goods->read("*", $id);
            setvar("item", $result);
        }
        $tpl_file = "goods.edit";
        template($tpl_file);
        exit;
    }
}
$amount = $goods->findCount();
$page->setPagenav($amount);
$result = $goods->findAll("*", null, $conditions, "id desc", $page->firstcount, $page->displaypg);
setvar("Items", $result);
setvar("ByPages", $page->pagenav);
template($tpl_file);
开发者ID:reboxhost,项目名称:phpb2b,代码行数:31,代码来源:goods.php

示例11: array

            $header_style = array('bold' => 1, 'size' => '10', 'color' => '#FFFFFF', 'bgcolor' => '#4F81BD');
            $excel->add_style('header', $header_style);
            $table_name = PbController::pluralize($_POST['tb_name']);
            $record_amount = intval($_POST['record_amount']);
            if (empty($record_amount)) {
                $record_amount = 1000;
            }
            $result = $pdb->GetArray("SELECT * FROM " . $tb_prefix . $table_name . " ORDER BY id DESC LIMIT {$record_amount};");
            $xml = simplexml_to_array(simplexml_load_file(DATA_PATH . "exchange" . DS . $_POST['tb_name'] . ".xml", "SimpleXMLElement", LIBXML_NOCDATA));
            $rows = array_keys($xml['items']);
            $excel->add_row($xml['items'], 'header');
            foreach ($result as $key => $val) {
                foreach ($rows as $key1 => $val1) {
                    $cols[$val1] = htmlspecialchars($val[$val1]);
                }
                $excel->add_row($cols);
            }
            $excel->create_worksheet($_POST['tb_name']);
            $excel->download($_POST['tb_name'] . date("YmdH") . '.xls');
            break;
        default:
            break;
    }
}
if (!empty($_PB_CACHE['companytype'])) {
    setvar("sorts", implode("\r\n", $_PB_CACHE['companytype']));
}
if (!empty($items)) {
    setvar("FileItems", array_map_recursive("pb_lang_split", $items));
}
template($tpl_file);
开发者ID:reboxhost,项目名称:phpb2b,代码行数:31,代码来源:data_exchange.php

示例12: array

        case "query":
            $tpl_file = "db.query";
            break;
        case "restore":
            $smarty->register_modifier('get_custom_size', 'size_info');
            $narray = array();
            $dir = DATA_PATH . "backup_" . $backupdir . DS;
            if (is_dir($dir)) {
                $backed_dir = dir($dir);
                $i = -1;
                while ($entry = $backed_dir->read()) {
                    if (!in_array($entry, array('.', '..', '.svn'))) {
                        $narray[] = array('name' => $entry, 'directory' => DATA_PATH . "backup_" . $backupdir . DS . $entry, 'filemtime' => date("Y-m-d H:i:s", @filemtime($dir . DS . $entry)), 'filesize' => @filesize($dir . DS . $entry));
                    }
                }
            }
            uasort($narray, 'filemtimesort');
            if (!empty($narray)) {
                setvar("Items", $narray);
            }
            $tpl_file = "db.restore";
            break;
        default:
            break;
    }
}
$lastbackup_time = $pdb->GetOne("SELECT valued FROM {$tb_prefix}settings WHERE variable='last_backup'");
if ($lastbackup_time) {
    setvar("LastbackupTime", date("Y-m-d H:i", $lastbackup_time));
}
template($tpl_file);
开发者ID:renduples,项目名称:alibtob,代码行数:31,代码来源:db.php

示例13: explode

        $member->Delete($id);
    }
}
$fields = "id,username,CONCAT(mf.first_name,mf.last_name) AS NickName,mf.reg_ip,last_ip,points,credits,membergroup_id,status,created AS pubdate,last_login,trusttype_ids";
$amount = $member->findCount(null, $conditions);
$page->setPagenav($amount);
$joins[] = "LEFT JOIN {$tb_prefix}memberfields mf ON Member.id=mf.member_id";
$result = $member->findAll($fields, $joins, $conditions, "Member.id DESC ", $page->firstcount, $page->displaypg);
if (!empty($result)) {
    for ($i = 0; $i < count($result); $i++) {
        $tmp_img = null;
        if ($result[$i]['id'] != $administrator_id) {
            $result[$i]['candelete'] = 1;
        } else {
            $result[$i]['candelete'] = 0;
        }
        if (!empty($result[$i]['trusttype_ids'])) {
            $tmp_str = explode(",", $result[$i]['trusttype_ids']);
            foreach ($tmp_str as $key => $val) {
                $tmp_img .= "<img src='" . URL . STATICURL . "images/icon/" . $G['trusttype'][$val]['avatar'] . "' alt='" . $G['trusttype'][$val]['name'] . "' />";
            }
            $result[$i]['trust_image'] = $tmp_img;
        }
        if (!empty($result[$i]['membergroup_id'])) {
            $result[$i]['group_image'] = URL . STATICURL . "images/group/" . $member_groups[$result[$i]['membergroup_id']]['avatar'];
        }
    }
    setvar("Items", $result);
}
uaAssign(array("MemberStatus" => $typeoption->get_cache_type("check_status"), "ByPages" => $page->pagenav));
template($tpl_file);
开发者ID:reboxhost,项目名称:phpb2b,代码行数:31,代码来源:member.php

示例14: trim

        if (isset($_GET['newstype']['name'])) {
            $conditions[] = "Newstype.name like '%" . trim($_GET['newstype']['name']) . "%'";
        }
    }
    if ($do == "del" && !empty($id)) {
        $newstype->del($id);
    }
    if ($do == "edit") {
        setvar("NewstypeOptions", $newstype->getTypeOptions());
        if (!empty($id)) {
            $res = $newstype->read("*", $id);
            setvar("item", $res);
        }
        $tpl_file = "newstype.edit";
        template($tpl_file);
        exit;
    }
}
$amount = $newstype->findCount(null, $conditions);
$page->setPagenav($amount);
$sql = "SELECT nt.*,(SELECT count(n.id)) AS news_amount FROM " . $tb_prefix . "newstypes nt LEFT JOIN " . $tb_prefix . "newses n ON n.type_id=nt.id GROUP BY nt.id ORDER BY nt.id DESC LIMIT {$page->firstcount},{$page->displaypg}";
$newstype_list = $pdb->GetArray($sql);
setvar("Items", $newstype_list);
uaAssign(array("ByPages" => $page->pagenav));
if (isset($_POST['del']) && is_array($_POST['id'])) {
    $deleted = $newstype->del($_POST['id']);
    if (!$deleted) {
        flash();
    }
}
template($tpl_file);
开发者ID:reboxhost,项目名称:phpb2b,代码行数:31,代码来源:newstype.php

示例15: define

define('CURSCRIPT', 'index');
require "../libraries/common.inc.php";
require "../share.inc.php";
require CACHE_PATH . "cache_industry.php";
require CACHE_PATH . 'cache_type.php';
$index_latest_industry_ids = 10;
$data = array();
uses("product", "industry");
$product = new Products();
$industry = new Industries();
$ProductSorts = $_PB_CACHE['productsort'];
$result = $product->GetArray($sql = "SELECT distinct industry_id AS iid FROM {$tb_prefix}products WHERE status=1 ORDER BY id DESC LIMIT 0,{$index_latest_industry_ids}");
if (!empty($result)) {
    foreach ($result as $key => $val) {
        $data[$val['iid']]['id'] = $val['iid'];
        if (isset($_PB_CACHE['industry'][1][$val['iid']])) {
            $data[$val['iid']]['name'] = $_PB_CACHE['industry'][1][$val['iid']];
        }
        $tmp_result = $pdb->GetArray("SELECT id,name,picture,sort_id,industry_id FROM {$tb_prefix}products WHERE status=1 AND industry_id=" . $val['iid'] . " ORDER BY id DESC LIMIT 0,5");
        if (!empty($tmp_result)) {
            foreach ($tmp_result as $key1 => $val1) {
                $data[$val['iid']]['sub'][$val1['id']]['id'] = $val1['id'];
                $data[$val['iid']]['sub'][$val1['id']]['name'] = $val1['name'];
                $data[$val['iid']]['sub'][$val1['id']]['sort'] = $ProductSorts[$val1['sort_id']];
                $data[$val['iid']]['sub'][$val1['id']]['image'] = pb_get_attachmenturl($val1['picture'], '', 'small');
            }
        }
    }
    setvar("IndustryProducts", $data);
}
render("product/index");
开发者ID:renduples,项目名称:alibtob,代码行数:31,代码来源:index.php


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