php - Redirect page when user is verified -


I have this code to verify if there is an administrator account to backoffice the user's website, but if the user Do not redirect the user to .. index.php . He lives in this page but no content is shown.

The verification code

  & lt ;? php $ user = isset ($ _ session ["Usuario"])? $ _SESSION ["Usuario"]: ''; $ Rank = release ($ _ session ['rank'])? $ _SESSION ['Rank']: ''; If ($ US! = '' & Amp; Rank == 'Administrator') {} else {resonates <  

In this page, (header) I call this file to verify the session

  & lt ;? php session_start (); need_once "../config.php"; "verificar.php" is required;? & Gt; & lt; div id = "header" & gt; & lt; a href = "index_logged.php? Page = index "& lt; img src =" img / logo.png "& gt; & lt; / a & gt; & lt; / div & gt;    

header ("location: ../index.php"); Stopping - if you want to redirect it, you die (); or exit; location header

alert part before location because the browser will first redirect the user, able to see the alert And it is also forbidden to call the header function after you send something for the output (for example, as you did with echo ]

One more thing is that you should consider - these are security issues that raised the user from justifying the values ​​of $ _ session / $ _ session has a better way of keeping some tokens and saving the user's position in the database - in this way, you can change your position directly with DB depending on session / changing code Without doing

Comments

Popular posts from this blog

Verilog Error: output or inout port "Q" must be connected to a structural net expression -

jasper reports - How to center align barcode using jasperreports and barcode4j -

c# - ASP.NET MVC - Attaching an entity of type 'MODELNAME' failed because another entity of the same type already has the same primary key value -