access variables without using $ _GET or $ _POST

0

Good people:

Well to see if I can explain myself. I'm trying to develop a multi-client web app. The app consists of two common directories, let's call them;

  • app_admin.
  • app_users.

And then for each of the clients you will have your personal folder. Which will have symbolic links to the common files of app_users, and each client folder will have a file "user.php" that will save a variable $ user_id = user number.

Well my problem comes when I access from the login of app_usuarios the variable $ user_id is loaded with the value of that client that accesses. There is some way to do this action without using $ _GET or $ _POST.

I hope I was clear explaining myself. Thanks.

    
asked by Novatillo 01.12.2017 в 13:06
source

1 answer

-1

You must use Session, if you never used it you should keep in mind that session_start () must be located at the beginning of the file before any HTML code, because if you do not do it, it will give you an error.

Elemplo of use in the 1st line of the file

<?php session_start(); //Iniciamos o Continuamos la sesion ?>

add as session, to load the variable for example we call it language and it takes the value of the variable $ idio:

$_SESSION['idioma']  = $idio;

Then to recover the value on the next page, it does it in the following way:

if ($_SESSION['idioma'])
{
    $idio   =   $_SESSION['idioma'] ;
}

this is used to protect the data from one page to another

    
answered by 01.12.2017 в 13:44