ebchost Posted December 6, 2011 Share Posted December 6, 2011 a brief description of what I want to do 1. I made a login session, and works without any problems. 2. Any user who logs on to the site, after logging, see the list of programs that create and use the site. 3. Choosing one of the program, which belong to login user, the user can view a list of: payments, invoices, statements, statements that belong only to him within a given program Problem in 3: I do not want to give for users of applications the ability to see in the link (for examle "index.php?option=programs&userid=1&programs=2") with data such as id, username, or something similar. So I try to do all over the session as in the code below: list of program for active session - programs.php <?php session_start(); //takes on a value for the logged in user id in the session $indentifikacija = $_SESSION['id']; $path = $_SERVER['DOCUMENT_ROOT']; $path .= "/knjige/resources/init.php"; include_once($path); $programi = mysql_query("SELECT * FROM `tbl_programi` WHERE `user_id`='$indentifikacija'") or die(mysql_error()); while($row = mysql_fetch_assoc($programi)) { $idprg = $row['idprg']; $program = $row['program']; $user_id = $row['user_id']; $datum = $row['datum']; echo " $idprg"; ?> <a href='/knjige/modules/mod_izvodi/'> <?php echo " $program" ; //taking the value of a variable that contains the session id of program $_SESSION['idprg']=$idprg ?> </a> <?php echo " $user_id"; echo " $datum"; } ?> //taking the value of a variable that contains the session id of program $_SESSION['idprg']=$idprg When I in this application click on a program in the list, for the list of documents in selected programe, code always open a list of documents for the last program (the value of the last variable $idprg) Q1: Is it possible to do something like this Q2: If it is possible, where I am wrong, and how to perform thanks Quote Link to comment https://forums.phpfreaks.com/topic/252608-multy-session-in-php/ Share on other sites More sharing options...
xyph Posted December 6, 2011 Share Posted December 6, 2011 You should only store the user-specific data in the session. You shouldn't use sessions to carry dynamic information - that's not what they were designed for. Quote Link to comment https://forums.phpfreaks.com/topic/252608-multy-session-in-php/#findComment-1295044 Share on other sites More sharing options...
ebchost Posted December 6, 2011 Author Share Posted December 6, 2011 You should only store the user-specific data in the session. You shouldn't use sessions to carry dynamic information - that's not what they were designed for. ok, thanks What you recomand for this? (because they secretly want to keep inforamicije such as id, etc.) Quote Link to comment https://forums.phpfreaks.com/topic/252608-multy-session-in-php/#findComment-1295048 Share on other sites More sharing options...
xyph Posted December 6, 2011 Share Posted December 6, 2011 ID is user-specific information. You want that in the session. Things like navigation variables shouldn't be in the session though. Quote Link to comment https://forums.phpfreaks.com/topic/252608-multy-session-in-php/#findComment-1295050 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.