0

i try to alert, who want enter to member zone but not login and redirect them to index this is my session code and phpalert is my implement method using javascript then i test it javascript not display but it redirect to 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");
}

?>

Slatan-ko
  • 256
  • 3
  • 7
  • 18
  • *"Javascript not work in session login"* - JS, what JS? You mean whatever `phpAlert()` this is supposed to do? Firstly, you're doing a header and wanting to alert. Not going to work here. It's one or the other or use a JS method or meta refresh. – Funk Forty Niner Feb 23 '16 at 14:57
  • how can i alert after herder to inder2.php – Slatan-ko Feb 23 '16 at 15:01
  • use a JS or meta refresh for redirection. Tell you what: Add error reporting to the top of your file(s) right after your opening PHP tag for example ` – Funk Forty Niner Feb 23 '16 at 15:02
  • please show me some code i am confuse – Slatan-ko Feb 23 '16 at 15:39

0 Answers0