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


PHP header函数代码示例

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


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

示例1: get

 public function get($limit = 1024)
 {
     header('Content-Type: application/json');
     $dates = json_decode(file_get_contents('hoa://Application/Database/Dates.json'), true);
     echo json_encode(array_slice($dates, 0, $limit));
     return;
 }
开发者ID:Hywan,项目名称:Amine_and_Hamza,代码行数:7,代码来源:Dates.php

示例2: automacuser

function automacuser($json = false)
{
    global $Settings;
    // TODO MAC is passed in via uam
    $mac = DatabaseFunctions::getInstance()->latestMacFromIP(remoteip());
    $autoUsername = mactoautousername($mac);
    // Attempt to create user
    //
    $autoCreateGroup = $Settings->getSetting('autocreategroup');
    $autoCreatePassword = $Settings->getSetting('autocreatepassword');
    $groupSettings = $Settings->getGroup($autoCreateGroup);
    /* TODO Set at the group level and not in the radcheck table,
     * requires changes to how DB class works
     */
    if ($autoCreateGroup && strlen($autoUsername) > 0) {
        // Create user
        DatabaseFunctions::getInstance()->createUser($autoUsername, $autoCreatePassword, false, false, '--', $groupSettings[$autoCreateGroup]['ExpireAfter'], $autoCreateGroup, "Auto created account for {$mac} at " . date('Ymd H:i:s'));
        // Users password may not match the autocreatepassword if it's changed.
        // Should we update the users password or get the users password?
        DatabaseFunctions::getInstance()->setUserPassword($autoUsername, $autoCreatePassword);
        // Create CHAP Challenge/Response token
        $challenge = $_GET['challenge'];
        $response = chapchallengeresponse($challenge, $autoCreatePassword);
        $loginURL = uamloginurl($autoUsername, $response);
        if ($json) {
            return json_encode(array('username' => $autoUsername, 'challenge' => $challenge, 'response' => $response));
        } else {
            header("Location: {$loginURL}");
            return false;
        }
    }
    return false;
}
开发者ID:KuberKode,项目名称:grase-www-portal,代码行数:33,代码来源:automacusers.php

示例3: permisos

function permisos($rol, $ruta)
{
    session_start();
    //Si no hay una sesion iniciada, redirige al login
    if (!$_SESSION) {
        header('Location:' . $ruta . 'vistas/login.php');
    } else {
        //Si no existe la variable de sesion del usuario logueado, redirige al login
        if (!isset($_SESSION["rol"])) {
            header('Location:' . $ruta . 'vistas/login.php');
        } else {
            if ($_SESSION["rol"] != $rol && $_SESSION["login_usuario"] != 'test') {
                header('location:' . $ruta . 'vistas/menu.php');
            } else {
                include_once '' . $ruta . 'vistas/headers.php';
                //Escoge el idioma por defecto si no tiene uno el usuario
                if (!$_SESSION["idioma"]) {
                    $includeIdioma = $ruta . "modelo/esp.php";
                    return $includeIdioma;
                } else {
                    $includeIdioma = $ruta . "modelo/" . $_SESSION['idioma'] . ".php";
                    return $includeIdioma;
                }
            }
        }
    }
}
开发者ID:developergate,项目名称:ET1v2,代码行数:27,代码来源:ctrl_permisos.php

示例4: indexAction

 public function indexAction()
 {
     //echo 'Hello Index!';
     header('Content-Type: text/plain');
     echo $config = Mage::getConfig()->loadModulesConfiguration('system.xml')->getNode()->asXML();
     exit;
 }
开发者ID:xiaoguizhidao,项目名称:ecommerce,代码行数:7,代码来源:IndexController.php

示例5: afficherMessage

/**
 * Affiche un message puis redirige le visiteur vers une URL spécifiée
 * @param   string  $message    Message à afficher
 * @param   string  $url        URL vers laquelle rediriger le visiteur
 * @param   bool    $erreur     S'agit-il d'une erreur
 * @return  void
 */
function afficherMessage($message, $url, $erreur = false)
{
    $_SESSION['flash']['message'] = $message;
    $_SESSION['flash']['erreur'] = $erreur;
    header('Location: ' . $url);
    exit;
}
开发者ID:fferriere,项目名称:web,代码行数:14,代码来源:fonctions.php

示例6: throwErrorPage

function throwErrorPage($code)
{
    if ($code == "404") {
        $header = $_SERVER['SERVER_PROTOCOL'] . ' 404 Not Found';
    } else {
        if ($code == "403") {
            $header = $_SERVER['SERVER_PROTOCOL'] . ' 403 Forbidden';
        } else {
            $header = $_SERVER['SERVER_PROTOCOL'] . ' ' . $code;
        }
    }
    header($header);
    $errorPage = sConfig()->getVar('CONFIG/ERRORPAGES/ERROR_' . $code);
    if ($errorPage && $errorPage != '') {
        $request_path_string = getRequestPathString(explode('/', 'page' . $errorPage));
        $request_path = getRequestPathArray($request_path_string);
        $psite = $request_path[1];
        if ((int) $psite > 0) {
            $sinfo = sSites()->get($psite);
            $siteID = (int) $psite;
        } else {
            $sinfo = sSites()->getByPName($psite);
            $siteID = $sinfo['ID'];
        }
        $pageMgr = new PageMgr($siteID);
        $pageID = $pageMgr->getPageIdByPname($request_path[count($request_path) - 1]);
        $page = $pageMgr->getPage($pageID);
        $pageInfo = $page->get();
        $version = $page->getLatestVersion();
        renderPage($page, $version, $pageInfo, $pageMgr, $sinfo);
    } else {
        echo $header;
    }
    die;
}
开发者ID:nrueckmann,项目名称:yeager,代码行数:35,代码来源:error.php

示例7: indexOp

 /**
  * 登录
  */
 public function indexOp()
 {
     if (!$this->isQQLogin()) {
         if (empty($_POST['username']) || empty($_POST['password']) || !in_array($_POST['client'], $this->client_type_array)) {
             output_error('登录失败');
         }
     }
     $model_member = Model('member');
     $array = array();
     if ($this->isQQLogin()) {
         $array['member_qqopenid'] = $_SESSION['openid'];
     } else {
         $array['member_name'] = $_POST['username'];
         $array['member_passwd'] = md5($_POST['password']);
     }
     $member_info = $model_member->getMemberInfo($array);
     if (!empty($member_info)) {
         $token = $this->_get_token($member_info['member_id'], $member_info['member_name'], $_POST['client']);
         if ($token) {
             if ($this->isQQLogin()) {
                 setNc2Cookie('username', $member_info['member_name']);
                 setNc2Cookie('key', $token);
                 header("location:" . WAP_SITE_URL . '/tmpl/member/member.html?act=member');
             } else {
                 output_data(array('username' => $member_info['member_name'], 'key' => $token));
             }
         } else {
             output_error('登录失败');
         }
     } else {
         output_error('用户名密码错误');
     }
 }
开发者ID:dotku,项目名称:shopnc_cnnewyork,代码行数:36,代码来源:login.php

示例8: aint_connected

function aint_connected()
{
    if (!isset($_SESSION['auth'])) {
        header('Location:index.php?page=connexion');
        exit;
    }
}
开发者ID:jenaye,项目名称:ttcnam,代码行数:7,代码来源:main-functions.php

示例9: throwError

 /**
  * Throw file upload error, return true if error has been thrown, false if error has been catched
  *
  * @param int $number
  * @param string $text
  * @access public
  */
 public function throwError($number, $text = false, $exit = true)
 {
     if ($this->_catchAllErrors || in_array($number, $this->_skipErrorsArray)) {
         return false;
     }
     switch ($number) {
         case CKFINDER_CONNECTOR_ERROR_INVALID_REQUEST:
         case CKFINDER_CONNECTOR_ERROR_INVALID_NAME:
         case CKFINDER_CONNECTOR_ERROR_THUMBNAILS_DISABLED:
         case CKFINDER_CONNECTOR_ERROR_UNAUTHORIZED:
             header("HTTP/1.0 403 Forbidden");
             header("X-CKFinder-Error: " . $number);
             break;
         case CKFINDER_CONNECTOR_ERROR_ACCESS_DENIED:
             header("HTTP/1.0 500 Internal Server Error");
             header("X-CKFinder-Error: " . $number);
             break;
         default:
             header("HTTP/1.0 404 Not Found");
             header("X-CKFinder-Error: " . $number);
             break;
     }
     if ($exit) {
         exit;
     }
 }
开发者ID:denglitong,项目名称:mvc,代码行数:33,代码来源:Http.php

示例10: mytheme_add_admin

function mytheme_add_admin()
{
    global $themename, $shortname, $options;
    if ($_GET['page'] == basename(__FILE__)) {
        if ('save' == $_REQUEST['action']) {
            foreach ($options as $value) {
                if ($value['type'] != 'header') {
                    update_option($value['id'], $_REQUEST[$value['id']]);
                }
            }
            foreach ($options as $value) {
                if (isset($_REQUEST[$value['id']])) {
                    update_option($value['id'], $_REQUEST[$value['id']]);
                } else {
                    delete_option($value['id']);
                }
            }
            header("Location: themes.php?page=settings.php&saved=true");
            die;
        } else {
            if ('reset' == $_REQUEST['action']) {
                foreach ($options as $value) {
                    delete_option($value['id']);
                }
                header("Location: themes.php?page=settings.php&reset=true");
                die;
            }
        }
    }
    add_theme_page($themename . " Settings", "Theme Settings", 'edit_themes', basename(__FILE__), 'mytheme_admin');
}
开发者ID:erka,项目名称:wp-blog,代码行数:31,代码来源:settings.php

示例11: buildjs

function buildjs()
{
    $t = $_GET["t"];
    $time = time();
    $MEPOST = 0;
    header("content-type: application/x-javascript");
    $tpl = new templates();
    $page = CurrentPageName();
    $array = unserialize(@file_get_contents($GLOBALS["CACHEFILE"]));
    $prc = intval($array["POURC"]);
    $title = $tpl->javascript_parse_text($array["TEXT"]);
    $md5file = trim(md5_file($GLOBALS["LOGSFILES"]));
    echo "// CACHE FILE: {$GLOBALS["CACHEFILE"]} {$prc}%\n";
    echo "// LOGS FILE: {$GLOBALS["LOGSFILES"]} - {$md5file} " . strlen($md5file) . "\n";
    if ($prc == 0) {
        if (strlen($md5file) < 32) {
            echo "\n\t// PRC = {$prc} ; md5file={$md5file}\n\tfunction Start{$time}(){\n\t\t\tif(!RTMMailOpen()){return;}\n\t\t\tLoadjs('{$page}?build-js=yes&t={$t}&md5file={$_GET["md5file"]}');\n\t}\n\tsetTimeout(\"Start{$time}()\",1000);";
            return;
        }
    }
    if ($md5file != $_GET["md5file"]) {
        echo "\n\tvar xStart{$time}= function (obj) {\n\t\tif(!document.getElementById('text-{$t}')){return;}\n\t\tvar res=obj.responseText;\n\t\tif (res.length>3){\n\t\t\tdocument.getElementById('text-{$t}').value=res;\n\t\t}\t\t\n\t\tLoadjs('{$page}?build-js=yes&t={$t}&md5file={$md5file}');\n\t}\t\t\n\t\n\tfunction Start{$time}(){\n\t\tif(!RTMMailOpen()){return;}\n\t\tdocument.getElementById('title-{$t}').innerHTML='{$title}';\n\t\t\$('#progress-{$t}').progressbar({ value: {$prc} });\n\t\tvar XHR = new XHRConnection();\n\t\tXHR.appendData('Filllogs', 'yes');\n\t\tXHR.appendData('t', '{$t}');\n\t\tXHR.setLockOff();\n\t\tXHR.sendAndLoad('{$page}', 'POST',xStart{$time},false); \n\t}\n\tsetTimeout(\"Start{$time}()\",1000);";
        return;
    }
    if ($prc > 100) {
        echo "\n\tfunction Start{$time}(){\n\t\tif(!RTMMailOpen()){return;}\n\t\tdocument.getElementById('title-{$t}').innerHTML='{$title}';\n\t\tdocument.getElementById('title-{$t}').style.border='1px solid #C60000';\n\t\tdocument.getElementById('title-{$t}').style.color='#C60000';\n\t\t\$('#progress-{$t}').progressbar({ value: 100 });\n\t}\n\tsetTimeout(\"Start{$time}()\",1000);\n\t";
        return;
    }
    if ($prc == 100) {
        echo "\n\tfunction Start{$time}(){\n\t\tif(!RTMMailOpen()){return;}\n\t\tdocument.getElementById('title-{$t}').innerHTML='{$title}';\n\t\t\$('#progress-{$t}').progressbar({ value: {$prc} });\n\t\t\$('#SQUID_ARTICA_QUOTA_RULES').flexReload();\n\t\tRTMMailHide();\n\t}\n\tsetTimeout(\"Start{$time}()\",1000);\n\t";
        return;
    }
    echo "\t\nfunction Start{$time}(){\n\t\tif(!RTMMailOpen()){return;}\n\t\tdocument.getElementById('title-{$t}').innerHTML='{$title}';\n\t\t\$('#progress-{$t}').progressbar({ value: {$prc} });\n\t\tLoadjs('{$page}?build-js=yes&t={$t}&md5file={$_GET["md5file"]}');\n\t}\n\tsetTimeout(\"Start{$time}()\",1500);\n";
}
开发者ID:articatech,项目名称:artica,代码行数:34,代码来源:squid.global.wl.center.progress.php

示例12: search_ac_init

function search_ac_init(&$a)
{
    if (!local_channel()) {
        killme();
    }
    $start = x($_REQUEST, 'start') ? $_REQUEST['start'] : 0;
    $count = x($_REQUEST, 'count') ? $_REQUEST['count'] : 100;
    $search = x($_REQUEST, 'search') ? $_REQUEST['search'] : "";
    if (x($_REQUEST, 'query') && strlen($_REQUEST['query'])) {
        $search = $_REQUEST['query'];
    }
    // Priority to people searches
    if ($search) {
        $people_sql_extra = protect_sprintf(" AND `xchan_name` LIKE '%" . dbesc($search) . "%' ");
        $tag_sql_extra = protect_sprintf(" AND term LIKE '%" . dbesc($search) . "%' ");
    }
    $r = q("SELECT `abook_id`, `xchan_name`, `xchan_photo_s`, `xchan_url`, `xchan_addr` FROM `abook` left join xchan on abook_xchan = xchan_hash WHERE abook_channel = %d \n\t\t{$people_sql_extra}\n\t\tORDER BY `xchan_name` ASC ", intval(local_channel()));
    $results = array();
    if ($r) {
        foreach ($r as $g) {
            $results[] = array("photo" => $g['xchan_photo_s'], "name" => '@' . $g['xchan_name'], "id" => $g['abook_id'], "link" => $g['xchan_url'], "label" => '', "nick" => '');
        }
    }
    $r = q("select distinct term, tid, url from term where type in ( %d, %d ) {$tag_sql_extra} group by term order by term asc", intval(TERM_HASHTAG), intval(TERM_COMMUNITYTAG));
    if (count($r)) {
        foreach ($r as $g) {
            $results[] = array("photo" => $a->get_baseurl() . '/images/hashtag.png', "name" => '#' . $g['term'], "id" => $g['tid'], "link" => $g['url'], "label" => '', "nick" => '');
        }
    }
    header("content-type: application/json");
    $o = array('start' => $start, 'count' => $count, 'items' => $results);
    echo json_encode($o);
    logger('search_ac: ' . print_r($x, true));
    killme();
}
开发者ID:TamirAl,项目名称:hubzilla,代码行数:35,代码来源:search_ac.php

示例13: form_add_admin

function form_add_admin()
{
    global $form_name, $form_shortname, $form;
    $form_options = form_options();
    if (isset($_GET['page']) && $_GET['page'] == "form") {
        if (isset($_REQUEST['action']) && 'install' == $_REQUEST['action']) {
            delete_option('form_log');
            foreach ($form_options as $value) {
                if (isset($_REQUEST[$value['id']])) {
                    update_option($value['id'], $_REQUEST[$value['id']]);
                } else {
                    delete_option($value['id']);
                }
            }
            header("Location: admin.php?page=form&installed=true");
            die;
        }
    }
    add_menu_page($form_name, $form_name, 'manage_options', 'form', 'form_main');
    add_submenu_page('form', $form_name . ' - Setup', 'Setup', 'manage_options', 'form', 'form_main');
    if (get_option("form_version")) {
        if (!isset($form['output']['menus']) && !isset($_SESSION['form']['menus'])) {
            form_output('headers');
        }
        //load menus
        if (isset($form['output']['menus']) && is_array($form['output']['menus']) && count($form['output']['menus']) > 0) {
            $_SESSION['form']['menus'] = $form['output']['menus'];
        }
        if (isset($_SESSION['form']['menus'])) {
            foreach ($_SESSION['form']['menus'] as $menu) {
                add_submenu_page('form', $form_name . ' - ' . $menu[0], $menu[0], 'manage_options', $menu[1], 'form_main');
            }
        }
    }
}
开发者ID:Bakerpedia,项目名称:Developement_WPengine,代码行数:35,代码来源:controlpanel.php

示例14: ajax_carga_capa

 /**
  * 
  */
 public function ajax_carga_capa()
 {
     header('Content-type: application/json');
     $this->load->library("visor/capa/visor_capa_elemento");
     $params = $this->input->post(null, true);
     $data = array("correcto" => true, "capa" => array("zona" => "", "icono" => "", "nombre" => "", "color" => "", "json" => array()));
     /*$regiones_usuario = explode(",",$this->session->userdata('session_regiones'));
             foreach($regiones_usuario as $region){
                 $retorno = $this->visor_capa_elemento->cargaCapasRegion($region);
     
                 $data["capa"]["nombre"] = $retorno["capa"]["nombre"];
                 $data["capa"]["icono"] = $retorno["capa"]["icono"];
                 $data["capa"]["color"] = $retorno["capa"]["color"];
                 $data["capa"]["zona"] = $retorno["capa"]["zona"];
      
                 if(is_array($retorno["capa"]["json"])){
                     $data["capa"]["json"] = array_merge($retorno["capa"]["json"], $data["capa"]["json"]);
                 }
             }*/
     foreach ($params["emergencia"] as $id_emergencia) {
         fb($id_emergencia);
         $this->visor_capa_elemento->setEmergencia($id_emergencia);
         $retorno = $this->visor_capa_elemento->cargaCapa($params["id"]);
         $data["capa"]["nombre"] = $retorno["capa"]["nombre"];
         $data["capa"]["icono"] = $retorno["capa"]["icono"];
         $data["capa"]["color"] = $retorno["capa"]["color"];
         $data["capa"]["zona"] = $retorno["capa"]["zona"];
         if (is_array($retorno["capa"]["json"])) {
             $data["capa"]["json"] = array_merge($retorno["capa"]["json"], $data["capa"]["json"]);
         }
     }
     echo json_encode($data);
 }
开发者ID:CarlosAyala,项目名称:midas-codeigniter-modulo-emergencias,代码行数:36,代码来源:mapa_publico_evento.php

示例15: data_convert

 /**
  * データを自動的に加工して返す。
  *
  * @param mixed $val 加工するデータ
  * @return string 加工されたテキストデータ
  */
 public function data_convert($val)
 {
     $data_type = $this->px->req()->get_param('type');
     if (!is_string($data_type) || !strlen($data_type)) {
         $data_type = 'json';
     }
     if ($data_type == 'json') {
         header('Content-type: application/json; charset=UTF-8');
     } elseif ($data_type == 'jsonp') {
         header('Content-type: application/javascript; charset=UTF-8');
     } elseif ($data_type == 'xml') {
         header('Content-type: application/xml; charset=UTF-8');
     }
     switch ($data_type) {
         case 'jsonp':
             return $this->data2jsonp($val);
             break;
         case 'json':
             return $this->data2json($val);
             break;
         case 'xml':
             return $this->data2xml($val);
             break;
     }
     // return self::data2jssrc($val);
     return $val;
 }
开发者ID:pickles2,项目名称:px2-px2dthelper,代码行数:33,代码来源:std_output.php


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