session-variables

Flask client-side sessions

蹲街弑〆低调 提交于 2019-12-02 14:08:28
问题 Starting to learn Python's Flask web app framework, still on the learning curve, so please bear with me. I am wondering how appropriate are the client-side sessions for secure web application purposes. From what it seems, there are some serious concerns: Since all the session variables are serialized and encoded in a cookie one should be careful with how much data they store there, in order to keep the size of http data travelling back and forth in reasonable size. I'm not sure if identical

echo user in view from sessions code igniter

半城伤御伤魂 提交于 2019-12-02 12:43:38
I am new in codeigniter. I have implemented a simple login system. I want to print out a username on my view page which is stored in sessions. here is my controller class LoginController extends CI_Controller { function index(){ $new['main_content'] = 'loginView'; $this->load->view('loginTemplate/template', $new); } function verifyUser(){ //getting parameters from view $data = array( 'username' => $this->input->post('username'), 'password' => $this->input->post('password') ); $this->load->model('loginModel'); $query = $this->loginModel->validate($data); if ($query){ //if the user c validated /

$_SESSION variable not passing and no clue why? it sets then doesn't pass

孤街醉人 提交于 2019-12-02 11:35:25
I have a login script coded in php and mysqli. upon submission and successful authentication it redirects to success.php to write sessions. my success page looks like this. <?php /** * Set cookies here if/as needed. * Set session data as needed. DO NOT store user's password in * cookies or sessions! * Redirect the user if/as required. */ $id = $_GET['id']; $_SESSION['partner_id'] = $id; $_SESSION['authenticated'] = TRUE; if (isset($_SESSION['partner_id'])) { echo("<script> <!-- location.replace(index.php); --> </script>"); } else { print "Session partner id not set"; } ?> This page effectively

Insert multiple rows from array saved in a session into table?

南楼画角 提交于 2019-12-02 11:35:00
I'm passing multiple state values that are stored in a session variable, into a MySQL table via php using one insert command and I'm wondering if its possible to insert each state value into a different row. I also have an ID saved in a variable that I would like to insert with each state. $campaign_id Each state is stored in this session variable. print_r($_SESSION['stateslist']); Assuming I have two states saved in the $_SESSION['stateslist'] (NY, CA) and campaign ID 5, I would like my database to look like this campaign_id state 5 NY 5 CA I know it is something similar to this insert

How to assign JavaScript variable to PHP session variable?

北战南征 提交于 2019-12-02 11:06:52
Here's javascript code that i have var randomnum = 30; and here's PHP code <?php $_SESSION['numbertoguess'] = '<script>document.write(randomnum)</script>';?> But this is not passing the value But when i am trying this code below, it works. It gives session variable that the value 'a sample thing'. <?php $_SESSION['numbertoguess'] = 'a sample thing';?> Look at the following code. The PHP session is assigned to 30 from the Javascript value. however am not sure if this is good way for implementation. <?php // Start the session session_start(); ?> <!DOCTYPE html> <html> <head> <meta http-equiv=

grails session creation, on how to prevent it

末鹿安然 提交于 2019-12-02 10:28:35
in the last line in the following bug report https://github.com/grails/grails-core/issues/5296 it is stated that; In an ideal world, it would be possible to turn off HttpSession creation for a whole Controller (all actions) and also turn them off for a particular set of actions. This is however, a quite old bugreport, so my question is: is this possible in an upcoming or todays version (1.3.7) of grails? If not, shouldn't it be? The reason i seek this kind of behavior is due to development of RESTful API's in grails, where the very nature of REST is stateless . Grails does not create a session

PHP Sessions shopping cart: update product if it's already id the session

谁说我不能喝 提交于 2019-12-02 09:37:14
I have struggled to find a solution to a simple shopping cart with $_SESSION . I kept it very simple and this is my code right now if ( Input::isPost('add') ) { $id = Input::get('id'); $qta = Input::post('qta'); $size = Input::post('size'); if ( !isset($_SESSION['cart']) ) { $_SESSION['cart'] = array(); } if ( array_key_exists($id, $_SESSION['cart']) ) { if ( $_SESSION['cart'][$id][0] == $size ) { $_SESSION['cart'][$id][1]+=$qta; } else { $_SESSION['cart'][$id] = array( $size, $qta ); } } else { $_SESSION['cart'][$id] = array( $size, $qta ); } } So, what this code does ? 1) If the $_SESSION[

PHP $_SESSION Implementation

纵然是瞬间 提交于 2019-12-02 09:36:18
问题 Does anyone know how PHP maps session IDs to $_SESSION arrays? In other words, given session ID x, where does PHP pull the values from to populate the $_SESSION array? And given a session ID and the url it came from, is there any possibility of someone being able to gain access to the values in the $_SESSION array? 回答1: By default, PHP uses the files session handler. These files are stored based on the session.save_path setting, but defaults to the system's temp directory (a highly insecure

Why PHP session is deleted on page reload?

戏子无情 提交于 2019-12-02 09:32:07
问题 So I've this problem that, when I'm on the page not doing anything for some time, after I reload the page $_SESSION is cleared. I checked the code and it does not have any unset() functions or anything else what could clear the $_SESSION variable. Any ideas why is it happening? Edit: In case if I want to make the session live till the browser is closed what should I do? I don't understand it as the gc checks if session is expired on session_start , but I can't modify the session data before

Passing PHP Variable From One Dynamic Page to Another

一世执手 提交于 2019-12-02 09:29:56
I am trying to pass on some variables using SESSION from one PHP page to the next. The first page contains this code and after the user clicks submit, it goes to Page 2: <!--SESSIONS TO PASS ON VARIABLES--> <?php $_SESSION['file'] = $file; ?> <?php $_SESSION['linecount'] = $linecount; ?> <?php $_SESSION['priceperpost'] = $priceperpost; ?> <?php $_SESSION['totalcost'] = $totalcost; ?> <!--//SESSIONS TO PASS ON VARIABLES--> And this is what I have on the next page, Page 2, after the form is submitted: <!--VARIABLES FROM PREVIOUS PAGE--> <?php $file = $_SESSION['file']; ?> <?php $linecount = $