避免登录用户访问index.php
Avoid Logged in users to access index.php
我有一个票务网站,我想避免用户在登录后打开index.php
。当他们登录时,会自动重定向到dashboard.php
。因为我的登录页面是我的index.php
文件,我想将其自定义为仅用于登录。我想用PHP、jQuery或JavaScript:写一些如下代码
<?php
$call_user = $site_calls->call_user;
if ($call_user <> 0){
//redirect to ("dashboard.php");
}
?>
如果有人已经登录,只要他们想访问index.php
页面,就会重定向到dashboard.php
。
`最简单的代码,如下所示。登录后设置会话变量,在index.php中检查该会话变量,如果已设置,则重定向到dashboard.php `
<?phpsession_start();if(isset($_SESSION["user"])//更改会话变量{header("Location:dashboard.php");}?>
相关文章:
- 我在firebug控制台中得到了index.php.html
- 致命错误:函数名称必须是第 7 行 /home/User/public_html/website/index.php 中
- 代码点火器始终希望 index.php 访问控制器
- index.php中的多个jquery对话框
- 如何忽略所有的pathNames并在我的站点根目录下加载我的index.php
- PHP-没有在index.PHP上设置$_SESSION['var1']
- 当使用AJAX调用API时,网站在打开后重定向到index.php
- 如何删除index.php
- PHP在index.PHP中包含CSS和JS链接的文件
- 在使XMLHttpRequest到服务器头(“location:index.php”)函数不起作用时
- index.php:13 Uncaught SyntaxError: Unexpected token: Ci中的错误消
- 使用PHP 'Include'将多个页面链接到单个index.php页面
- 从javascript中调用url,其中url与index.php不在同一级别
- AJAX请求给出'undefined index'PHP错误
- 页面重新加载回到index.php
- 如何使用jquery从url中删除index.php
- 如何使用index.php?-url与colorbox
- 将所有请求重定向到index.php并在页面上显示URL
- 当页面为index.php时运行html代码
- 避免登录用户访问index.php