本文整理汇总了PHP中redir函数的典型用法代码示例。如果您正苦于以下问题:PHP redir函数的具体用法?PHP redir怎么用?PHP redir使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了redir函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: main
protected function main()
{
// Seuls les membres peuvent créer des brouillons
if (!is_logged_in()) {
redir(Nw::$lang['common']['need_login'], false, 'users-10.html');
}
// Si le paramètre ID manque
if (empty($_GET['id']) || !is_numeric($_GET['id'])) {
header('Location: ./');
}
// Le commentaire n'existe pas
inc_lib('news/cmt_news_exists');
if (cmt_news_exists($_GET['id']) == false) {
redir(Nw::$lang['news']['cmt_not_exist'], false, './');
}
inc_lib('news/get_info_cmt_news');
inc_lib('news/add_vote_cmt');
$donnees_cmt = get_info_cmt_news($_GET['id']);
$response = add_vote_cmt($_GET['id']);
inc_lib('news/get_info_news');
$donnees_news = get_info_news($donnees_cmt['c_id_news']);
$rewrite_news = $donnees_news['c_rewrite'] . '/' . rewrite($donnees_news['n_titre']) . '-' . $donnees_news['n_id'] . '/';
// Pour rediriger le visiteur d'où il est venu
if (!empty($_SERVER['HTTP_REFERER']) && strpos($_SERVER['HTTP_REFERER'], Nw::$site_url) !== false && strpos($_SERVER['HTTP_REFERER'], Nw::$site_url . $rewrite_news) === false) {
$_SESSION['nw_referer_edit'] = $_SERVER['HTTP_REFERER'];
}
// Vote bien ajouté
if ($response) {
$text_redir = Nw::$lang['news']['vote_cmt_ok'];
} else {
$text_redir = Nw::$lang['news']['vote_cmt_pasok'];
}
$link_redir = !empty($_SESSION['nw_referer_edit']) ? $_SESSION['nw_referer_edit'] : $rewrite_news;
redir($text_redir, true, $link_redir);
}
示例2: main
protected function main()
{
inc_lib('news/news_exists');
$count_news_existe = news_exists($_GET['id']);
if ($count_news_existe == false && (is_logged_in() && !check_auth('view_histo_all_news'))) {
redir(Nw::$lang['news']['news_not_exist'], false, './');
}
inc_lib('news/get_info_news');
$donnees_news = get_info_news($_GET['id']);
$this->set_title(Nw::$lang['news']['historique_news'] . ' | ' . $donnees_news['n_titre']);
$this->set_tpl('news/log_news.html');
$this->add_css('code.css');
// Fil ariane
if ($count_news_existe) {
$this->set_filAriane(array(Nw::$lang['news']['news_section'] => array('news-70.html'), $donnees_news['c_nom'] => array($donnees_news['c_rewrite'] . '/'), $donnees_news['n_titre'] => array($donnees_news['c_rewrite'] . '/' . rewrite($donnees_news['n_titre']) . '-' . $_GET['id'] . '/'), Nw::$lang['news']['historique_news'] => array('')));
} else {
$this->set_filAriane(array(Nw::$lang['news']['news_section'] => array('news-70.html'), Nw::$lang['news']['historique_news'] => array('')));
}
/**
* Affichage du logo
**/
inc_lib('news/get_news_logs');
$donnees_logs = get_news_logs('l_id_news = ' . intval($_GET['id']), 'l_date DESC');
foreach ($donnees_logs as $donnees) {
Nw::$tpl->setBlock('log', array('ACTION' => $donnees['l_action'], 'ACTION_LOG' => isset(Nw::$lang['news']['log_news_' . $donnees['l_action']]) ? Nw::$lang['news']['log_news_' . $donnees['l_action']] : '', 'TEXTE' => nl2br($donnees['l_texte']), 'TITRE' => $donnees['l_titre'], 'DATE' => date_sql($donnees['date'], $donnees['heures_date'], $donnees['jours_date']), 'AUTEUR' => $donnees['u_pseudo'], 'AUTEUR_ID' => $donnees['u_id'], 'AUTEUR_AVATAR' => $donnees['u_avatar'], 'AUTEUR_ALIAS' => $donnees['u_alias'], 'IP' => long2ip($donnees['l_ip'])));
}
Nw::$tpl->set(array('ID' => $_GET['id'], 'TITRE' => $donnees_news['n_titre']));
}
示例3: digestCookieData
public function digestCookieData()
{
global $whmcs;
$sortdata = WHMCS_Cookie::get("SD", true);
$name = $this->name;
if (array_key_exists($name, $sortdata)) {
$orderby = $sortdata[$name]['orderby'];
if ($orderby) {
$this->setOrderBy($orderby);
}
$orderbysort = $sortdata[$name]['sort'];
if ($orderbysort) {
$this->setSortDirection($orderbysort);
}
}
if ($orderby = $whmcs->get_req_var("orderby")) {
$this->setOrderBy($orderby);
$sortdata[$name] = array("orderby" => $this->orderby, "sort" => $this->sort);
WHMCS_Cookie::set("SD", $sortdata);
redir("filter=1");
}
if ($page = $whmcs->get_req_var("page")) {
$this->setPage($page);
}
$this->setRecordLimit($whmcs->get_config("NumRecordstoDisplay"));
}
示例4: del
function del($id)
{
onlyadmin();
$id = protect($id);
mysql_query("DELETE FROM shoutbox WHERE `id`='{$id}'");
redir("shoutbox");
}
示例5: main
protected function main()
{
//Si on a bien envoyé un article à éditer
if (!empty($_GET['id']) && is_numeric($_GET['id'])) {
inc_lib('press/get_info_article');
$dn_article = get_info_article($_GET['id']);
if (empty($dn_article)) {
redir(Nw::$lang['press']['error_dont_exist'], false, 'press.html');
}
//Si on a soumis le formulaire
if (isset($_POST['submit'])) {
inc_lib('press/edit_article');
edit_article($dn_article['p_id'], $_POST['paper'], $_POST['link'], $_POST['numero'], $_POST['country'], $_POST['contenu'], $_POST['date_pub']);
redir(Nw::$lang['press']['redir_article_edited'], true, 'press.html?article=' . $dn_article['p_id']);
}
$this->set_title($dn_article['p_ressource_name']);
$this->set_tpl('press/edit.html');
$this->add_css('code.css');
$this->add_css('forms.css');
// Fil ariane
$this->set_filAriane(array(Nw::$lang['press']['mod_title'] => array('press.html'), $dn_article['p_ressource_name'] => array('press.html?article=' . $dn_article['p_id']), Nw::$lang['press']['art_edit'] => array('')));
inc_lib('bbcode/unparse');
Nw::$tpl->set(array('ID' => $dn_article['p_id'], 'RESSOURCE' => $dn_article['p_ressource_name'], 'DATE' => $dn_article['date'], 'LIEN' => $dn_article['p_link'], 'CONTENU' => unparse($dn_article['p_description']), 'PAYS' => $dn_article['p_lang'], 'NUMERO' => $dn_article['p_num']));
} else {
redir(Nw::$lang['press']['error_dont_exist'], false, 'press.html');
}
}
示例6: main
protected function main()
{
if (!is_logged_in()) {
redir(Nw::$lang['common']['need_login'], false, 'users-10.html');
}
// Si le paramètre ID manque
if (empty($_GET['id']) || !is_numeric($_GET['id']) || empty($_GET['id2']) || !is_numeric($_GET['id2'])) {
header('Location: ./');
}
// Cette news existe vraiment ?
inc_lib('news/news_exists');
if (news_exists($_GET['id']) == false) {
redir(Nw::$lang['news']['news_not_exist'], false, './');
}
inc_lib('news/vrs_exists');
if (vrs_exists($_GET['id'], $_GET['id2']) == false) {
redir(Nw::$lang['news']['version_not_exist'], false, 'news-16-' . $_GET['id'] . '.html');
}
inc_lib('news/get_info_news');
$donnees_news = get_info_news($_GET['id']);
// Le membre a le droit de restaurer une version de news
if (Nw::$droits['can_change_version_my_news'] && $donnees_news['n_id_auteur'] == Nw::$dn_mbr['u_id'] || Nw::$droits['can_change_version_all_news']) {
// La version actuelle n'est pas la même que celle que l'on veut restaurer..
if ($donnees_news['n_last_version'] != $_GET['id2']) {
inc_lib('news/restore_vrs');
restore_vrs($_GET['id'], $_GET['id2']);
redir(Nw::$lang['news']['vrs_restored'], true, 'news-16-' . $_GET['id'] . '.html');
} else {
redir(Nw::$lang['news']['error_already_restored'], false, 'news-16-' . $_GET['id'] . '.html');
}
} else {
redir(Nw::$lang['news']['error_restore_vrs'], false, 'news-16-' . $_GET['id'] . '.html');
}
}
示例7: checkPermission
function checkPermission($action, $noredirect = "")
{
static $AdminRoleID = 0;
static $AdminRolePerms = array();
$permid = array_search($action, getAdminPermsArray());
if (isset($_SESSION['adminid'])) {
if (!$AdminRoleID) {
$result = select_query("tbladmins", "roleid", array("id" => $_SESSION['adminid']));
$data = mysql_fetch_array($result);
$roleid = $data['roleid'];
$AdminRoleID = $roleid;
}
if (!count($AdminRolePerms)) {
$result = select_query("tbladminperms", "permid", array("roleid" => $AdminRoleID));
while ($data = mysql_fetch_array($result)) {
$AdminRolePerms[] = $data[0];
}
}
}
$match = in_array($permid, $AdminRolePerms) ? true : false;
if ($noredirect) {
if ($match) {
return true;
}
return false;
}
if (!$match) {
redir("permid=" . $permid, "accessdenied.php");
}
}
示例8: main
/**
* Déconnexion de l'utilisateur
* @author Cam
* @return void
*/
protected function main()
{
// L'ID membre n'est pas renseigné, direction l'index
if (empty($_GET['id'])) {
header('Location: ./');
}
// Pour rediriger le visiteur d'où il est venu
if (!empty($_SERVER['HTTP_REFERER']) && strpos($_SERVER['HTTP_REFERER'], Nw::$site_url) !== false && strpos($_SERVER['HTTP_REFERER'], Nw::$site_url . 'membres-10.html') === false) {
$_SESSION['nw_referer_deco'] = $_SERVER['HTTP_REFERER'];
}
$link_redir = !empty($_SESSION['nw_referer_deco']) ? $_SESSION['nw_referer_deco'] : './';
// Le membre est bien connecté
if (is_logged_in() && $_GET['id'] == Nw::$dn_mbr['u_id']) {
$_SESSION = array();
session_destroy();
// Si les cookies existent, on les supprime
if (isset($_COOKIE['nw_ident']) && isset($_COOKIE['nw_pass'])) {
setcookie('nw_ident', null, time() - 3600);
setcookie('nw_pass', null, time() - 3600);
}
// On affiche le message de confirmation et le redirige
redir(Nw::$lang['users']['disconnect_msg'], true, $link_redir);
} else {
header('Location: ./');
}
}
示例9: page_admin_images
function page_admin_images($act = "", $id = "")
{
requires_admin();
use_template("admin");
if ($act == "add") {
if (form_file_uploaded("file")) {
$fname = $_FILES["file"]['name'];
db_query("INSERT INTO images (link) VALUES ('')");
$id = db_last_id();
$fname = $id . "." . fileext($fname);
form_file_uploaded_move("file", "img/" . $fname);
db_query("UPDATE images SET link='img/{$fname}' WHERE id=%d", $id);
redir("admin/images");
}
form_start("", "post", " enctype='multipart/form-data' ");
form_file("Файл", "file");
form_submit("Загрузить", "submit");
form_end();
$o = form();
return $o;
}
if ($act == "del") {
$im = db_object_get("images", $id);
@unlink("../{$im->link}");
}
$o = table_edit("images", "admin/images", $act, $id, "", "", "", "image_func");
return $o;
}
示例10: main
/**
* Mot de passe oublié (partie 1)
* @author Cam
* @return tpl
*/
protected function main()
{
// Si le membre est déjà connecté
if (is_logged_in()) {
redir(Nw::$lang['common']['already_connected'], false, './');
}
$this->set_title(Nw::$lang['users']['title_lost_pwd']);
$this->set_tpl('membres/oubli_mdp.html');
$this->add_css('forms.css');
// Fil ariane
$this->set_filAriane(Nw::$lang['users']['title_lost_pwd']);
//Si le formulaire a été validé
if (isset($_POST['submit'])) {
// Cette adresse email existe bien sur le site
inc_lib('users/email_exists');
if (email_exists($_POST['mail'])) {
//On récupère les infos du membre
inc_lib('users/get_info_mbr');
$membre_mail = get_info_mbr($_POST['mail'], 'mail');
$lien_password = Nw::$site_url . 'users-13.html?idm=' . $membre_mail['u_id'] . '&ca=' . $membre_mail['u_code_act'];
//On prépare le texte de l'email
$txt_mail = sprintf(Nw::$lang['users']['mail_oubli_pwd'], $membre_mail['u_pseudo'], $lien_password, $lien_password, $lien_password);
@envoi_mail(trim($_POST['mail']), sprintf(Nw::$lang['users']['title_mail_lost_pwd'], Nw::$site_name), $txt_mail);
redir(Nw::$lang['users']['send_mail_lost'], true, './');
} else {
redir(Nw::$lang['users']['email_aucun_mbr'], false, 'users-12.html');
}
}
}
示例11: main
/**
* Activation du compte.
* @author Cam
* @return tpl
*/
protected function main()
{
if (empty($_GET['mid']) || empty($_GET['ca'])) {
header('Location: ./');
}
if (is_logged_in()) {
redir(Nw::$lang['common']['already_connected'], false, './');
}
$return_valid = false;
inc_lib('users/mbr_act_exists');
if (mbr_act_exists($_GET['mid'], $_GET['ca'])) {
inc_lib('users/get_info_mbr');
$donnees_compte = get_info_mbr($_GET['mid']);
if ($donnees_compte['u_active'] == 0) {
inc_lib('users/valid_account');
inc_lib('admin/gen_cachefile_nb_members');
valid_account($_GET['mid']);
gen_cachefile_nb_members();
generate_members_sitemap();
redir(Nw::$lang['users']['compte_valide'], true, './');
$return_valid = true;
}
}
if (!$return_valid) {
redir(Nw::$lang['users']['compte_valid_error'], false, './');
}
}
示例12: main
protected function main()
{
$this->set_title(Nw::$site_slogan);
$this->set_tpl('mobile/users/login.html');
$this->load_lang_file('users');
// Si le membre est déjà connecté
if (is_logged_in()) {
redir(Nw::$lang['common']['already_connected'], false, 'mobile-2.html');
}
//Si on a soumis le formulaire
if (!multi_empty(trim($_POST['nw_nickname']), trim($_POST['nw_password']))) {
$array_post = array('pseudo' => $_POST['nw_nickname'], 'remember' => isset($_POST['nw_remember']));
//On vérifie que la paire pseudo/mot de passe existe
inc_lib('users/get_info_account');
if ($dn_info_account = get_info_account($_POST['nw_nickname'], $_POST['nw_password'])) {
//Si le compte est actif
if ($dn_info_account['u_active'] == 1) {
$link_redir = 'mobile-2.html';
$connex_auto = 1;
inc_lib('users/connect_auto_user');
connect_auto_user($dn_info_account['u_id'], $_POST['nw_password'], $connex_auto);
// On redirige le membre
redir(sprintf(Nw::$lang['users']['welcome_user'], $_POST['nw_nickname']), true, $link_redir);
} else {
display_form($array_post, Nw::$lang['users']['not_active']);
}
return;
} else {
display_form($array_post, Nw::$lang['users']['account_no_exist']);
}
return;
}
display_form(array('pseudo' => '', 'remember' => true));
Nw::$tpl->set('INC_HEAD', empty($_SERVER['HTTP_AJAX']));
}
示例13: main
protected function main()
{
if (!is_logged_in()) {
header('Location: mobile.html');
}
$this->set_tpl('mobile/categories/list_news.html');
$this->load_lang_file('news');
// On compte le nbr de news en rédaction
inc_lib('news/count_news');
$nombre_news = count_news('n_etat = 1');
// Pagination
$page = (!empty($_GET['page']) and is_numeric($_GET['page']) and $_GET['page'] > 0) ? (int) $_GET['page'] : 1;
$nombreDePages = ceil($nombre_news / Nw::$pref['nb_news_redac']);
// On vérifie bien que la page existe
if ($nombreDePages > 0 && $page > $nombreDePages) {
redir(Nw::$lang['common']['pg_not_exist'], false, './mobile.html');
}
// On recherche toutes les news en rédaction
inc_lib('news/get_list_news');
$list_dn_news = get_list_news('n_etat = 1', 'n_date DESC', $page, Nw::$pref['nb_news_redac']);
// On affiche toutes les news en rédaction
foreach ($list_dn_news as $donnees_news) {
Nw::$tpl->setBlock('news', array('ID' => $donnees_news['n_id'], 'CAT_ID' => $donnees_news['c_id'], 'CAT_TITRE' => $donnees_news['c_nom'], 'IMAGE_ID' => $donnees_news['i_id'], 'IMAGE_NOM' => $donnees_news['i_nom'], 'TITRE' => $donnees_news['n_titre'], 'RESUME' => $donnees_news['n_resume'], 'REWRITE' => rewrite($donnees_news['n_titre']), 'AUTEUR' => $donnees_news['u_pseudo'], 'AUTEUR_ID' => $donnees_news['u_id'], 'AUTEUR_ALIAS' => $donnees_news['u_alias'], 'AUTEUR_AVATAR' => $donnees_news['u_avatar'], 'DATE' => date_sql($donnees_news['date_news'], $donnees_news['heures_date_news'], $donnees_news['jours_date_news']), 'NBR_COMS' => sprintf(Nw::$lang['news']['nbr_comments_news'], $donnees_news['n_nbr_coms'], $donnees_news['n_nbr_coms'] > 1 ? Nw::$lang['news']['add_s_comments'] : ''), 'VOTES' => $donnees_news['n_nb_votes'], 'VOTES_NEG' => $donnees_news['n_nb_votes_neg'], 'HAS_VOTED' => is_logged_in() ? $donnees_news['v_id_membre'] : 0));
}
Nw::$tpl->set(array('LIST_PG' => list_pg($nombreDePages, $page, 'mobile-2%s.html'), 'NB_NEWS' => $nombre_news, 'TITLE' => Nw::$lang['news']['en_attente_title'], 'TITLE_REWRITE' => 'news_en_attente', 'INC_HEAD' => empty($_SERVER['HTTP_AJAX'])));
}
示例14: main
protected function main()
{
// Seuls les membres peuvent créer des brouillons
if (!is_logged_in()) {
redir(Nw::$lang['common']['need_login'], false, 'users-10.html');
}
// Si le paramètre ID manque
if (empty($_GET['id']) || !is_numeric($_GET['id'])) {
header('Location: ./');
}
// Cette news existe vraiment ?
inc_lib('news/news_exists');
if (news_exists($_GET['id']) == false) {
redir(Nw::$lang['news']['news_not_exist'], false, './');
}
// Pour rediriger le visiteur d'où il est venu
if (!empty($_SERVER['HTTP_REFERER']) && strpos($_SERVER['HTTP_REFERER'], Nw::$site_url) !== false && strpos($_SERVER['HTTP_REFERER'], Nw::$site_url . 'news-25-' . $_GET['id'] . '.html') === false) {
$_SESSION['nw_referer_edit'] = $_SERVER['HTTP_REFERER'];
}
$link_redir = !empty($_SESSION['nw_referer_edit']) ? $_SESSION['nw_referer_edit'] : 'news-10-' . intval($_GET['id']) . '.html';
inc_lib('news/get_info_news');
inc_lib('news/manage_fav');
$donnees_news = get_info_news($_GET['id']);
$response = manage_fav($_GET['id']);
// Nouveau favoris
if ($response == 1) {
$text_redir = Nw::$lang['news']['news_favorite_ok'];
} elseif ($response == 2) {
$text_redir = Nw::$lang['news']['news_defavorite_ok'];
}
redir($text_redir, true, $link_redir);
}
示例15: main
protected function main()
{
// Si le paramètre ID manque
if (empty($_GET['id']) || !is_numeric($_GET['id'])) {
header('Location: news-70.html');
}
inc_lib('news/news_exists');
if (news_exists($_GET['id']) == false) {
redir(Nw::$lang['news']['news_not_exist'], false, 'news-70.html');
}
inc_lib('news/get_info_news');
$info_news = get_info_news($_GET['id']);
if (!is_logged_in()) {
redir(Nw::$lang['news']['error_cant_alert'], false, './');
}
//Si on a envoyé des erreurs
if (!empty($_POST['contenu'])) {
inc_lib('news/add_alert_news');
add_alert_news(Nw::$dn_mbr['u_id'], $_GET['id'], $_POST['contenu'], $_POST['motif']);
redir(Nw::$lang['news']['confirm_alert'], true, $info_news['c_rewrite'] . '/' . rewrite($info_news['n_titre']) . '-' . $_GET['id'] . '/');
}
$this->set_title($info_news['n_titre'] . ' | ' . $info_news['c_nom']);
$this->set_tpl('news/alert.html');
$this->add_css('forms.css');
$this->add_css('code.css');
$this->add_js('write.js');
$this->add_js('forms.js');
$this->add_form('contenu');
Nw::$tpl->set('ID', $info_news['n_id']);
inc_lib('bbcode/clearer');
Nw::$tpl->set(array('ID' => $_GET['id'], 'BAL_CHAMP' => 'contenu', 'NEWS' => $info_news['n_titre'], 'RESUME' => CoupeChar(clearer($info_news['v_texte'])), 'CAT_REWRITE' => $info_news['c_rewrite'], 'REWRITE' => rewrite($info_news['n_titre'])));
// Fil ariane
$this->set_filAriane(array(Nw::$lang['news']['news_section'] => array('news-70.html'), $info_news['c_nom'] => array($info_news['c_rewrite'] . '/'), $info_news['n_titre'] => array($info_news['c_rewrite'] . '/' . rewrite($info_news['n_titre']) . '-' . $_GET['id'] . '/'), Nw::$lang['news']['alert'] => array('')));
}