Javascript在会话登录中不起作用

时间:2016-02-23 14:56:30

标签: javascript php jquery

我尝试提醒,谁想要进入成员区但不登录并将其重定向到索引 这是我的会话代码,phpalert是我使用javascript的工具方法 然后我测试它javascript不显示但它重定向到index.php

<?php
// Establishing Connection with Server by passing server_name, user_id and password as a parameter
$connection = mysql_connect("localhost", "root", "");
// Selecting Database
$db = mysql_select_db("project1", $connection);
session_start();// Starting Session
// Storing Session
$user_check=$_SESSION['login_user'];
// SQL Query To Fetch Complete Information Of User
$ses_sql=mysql_query("select user_id from users where user_id='$user_check'", $connection);
$user_std=mysql_query("select status from users where user_id='$user_check'",$connection);
$user_name=mysql_query("select name from users where user_id='$user_check'",$connection);
$row = mysql_fetch_assoc($ses_sql);
$row2 = mysql_fetch_assoc($user_std);
$row3 = mysql_fetch_assoc($user_name);
$login_session =$row['user_id'];
$name =$row3['name'];
$status=$row2['status'];
if(!isset($login_session)){

mysql_close($connection); // Closing Connection

header('Location: index2.php'); // Redirecting To Home Page
phpAlert("login before");
}

&GT;

0 个答案:

没有答案