php - Multiple sessions depending on type of login? -


what i've attempted make when log in website reference type of account in database , depending on type set session variable link appropriate page work session login. issue i'm having no matter sends me login page should occur else condition when user type not detected. i'm using oracle apex database , i'm not sure why happening @ appreciated.

<?php   //include connection titan include 'oci_connect.php'; session_start();   $query_str = "select type_of_account user_account user_name = '".$_post["username"]."' , password = ('".$_post["password"]."')";  $stid =oci_parse($connection, $query_str); oci_execute($stid);  $type =$info['type_of_account'];  if($type == "customer") {     $_session['type']=1;     //redirect user page found through matching user id , display details, can accessed if logged in     echo '<script>window.location="user.php"</script>';  } elseif($type == "trader") {     $_session['type']=2;     //redirect traders page display traders details , theirs, accessed if logged in specific account type echo '<script>window.location="trader.php"</script>';  } elseif($type == "admin") {     $_session['type']=3;     //redirect admin page can view , edit details, 1 account type acceptable     echo '<script>window.location="admin.php"</script>';   } else {     //return login page login details invalid     echo '<script>window.location="login.html"</script>';  }  ?> 

this user page meant session 1:

<?php session_start(); if($_session['type']!=1){     echo '<script>window.location="login.html"</script>'; } ?> 

this traders page meant session 2:

<?php session_start(); if($_session['type']!=2){     echo '<script>window.location="login.html"</script>'; } ?> 

this admin page meant session 3:

<?php session_start(); if($_session['type']!=3){     echo '<script>window.location="login.html"</script>'; } ?> 


Comments

Popular posts from this blog

apache - PHP Soap issue while content length is larger -

asynchronous - Python asyncio task got bad yield -

javascript - Complete OpenIDConnect auth when requesting via Ajax -