The problem exist here:- $query = mysqli_query("select * from login where password='$password' AND username='$username'", $connection); You need make $connection as first parameter like this:- $query = mysqli_query($connection,"select * from login where password='$password' AND username='$username'"); Note:- try always to use mysql error reporting so that you will get rid of the...
If you pay attention to the names of the files that I mentioned, I was saying that I was directing my browser to example.org/login/submit.php and then forwarding that to www.example.org/welcome/index.php. In Google Chrome and Mozilla Firefox, they care about the difference between having a www before the website or not,...
As per my comment, when you do session_start(), php will check if you set a session name via session_name(), otherwise it'll use its default. Session startup is basically like this, in php-ish pseudocode: if (custom_session_name_was_set()) { $session_name = get_custom_session_name(); } else { $session_name = ini_get('session.name'); } if (isset($_COOKIE[$session_name])) { $id...
django,session,session-variables,django-rest-framework,jwt
request.session is managed through Django's session framework which requires the use of session cookies and is what powers SessionAuthentication. JWT is completely separate from session authentication, and does not provide a way to store arbitrary data on the token....
The way that the Java EE designers intended you to do this is that you configure your javax.mail.Session object in your server. This is described in the Tomcat 7 JavaMail Sessions documentation. Your managed beans should then be able to access the session via @Resource: class MyManagedBean { @Resource(name="mail/Session") //...
You're going to need better state management than that in order to track user going forward and backward or skipping to a different question. My suggestion is to include the intended question number in the url query string (or to make it more SEO friendly just include the question number...
ruby-on-rails,forms,twitter-bootstrap,session,railstutorial.org
Remove the name attribute from every field in the form. Rails handles it for you and the way you are naming it is not creating the param that you expect.
You can have multiple cookies with the same name. This happens when you set cookie with different Path or Domain attributes. They are all send to the server. The RFC 6265 specific if the Cookie header contains two cookies with the same name (e.g., that were set with different Path...
Found a working solution : Add a function in my global controller which check if session is still active and responds with "ok" if yes, "ko" if not. public function pingAction() { $securityContext = $this->container->get('security.context'); if ($securityContext->isGranted('IS_AUTHENTICATED_REMEMBERED') || $securityContext->isGranted('IS_AUTHENTICATED_FULLY')) { return new Response("ok"); } return new Response("ko"); } and i...
javascript,jquery,asp.net-mvc,session
Your approach would work with some hackery and workarounds but it is not in the spirit of MVC. Here is how you could accomplish it in the MVC way. Basically you move all the heavy lifting (parsing the item from the session) 0 to the controller and store the results...
php,database,codeigniter,session
Model function get_user_info() { $user_email = $this->input->post('signin-email'); $this->db->select('acct_id, acct_fname, acct_lname, acct_mname'); $this->db->where('email', $user_email); $query = $this->db->get('account'); return $query->row_array(); // changed to row array } In Controller $user_info = $this->users_model->get_user_info(); // method does not have any arg $data = array( 'email' => $this->input->post('signin-email'), 'is_logged_in' => 1, 'user_info' => $user_info );...
You need to set $session : $session = $this->request->session(); $session->write('Config.language', 'eng'); $session->read('Config.language'); And then you'll be able to read and write in your session Or you can direclty read and write : $this->request->session()->write('Config.language', 'eng'); $this->request->session()->read('Config.language'); ...
As we discussed in chat: in your train_selector_result.php page change to this foreach ($_POST['train_id'] as $selectedOption){ //if has selected selector, then add to session $test = $database->testingSelector($selectedOption); $_SESSION["selector"][] = $test; } foreach ($_SESSION["selector"] as $result){ $lol = $result[0]; ?> <tr> <td name="train_name"><?= $lol['train_name']?></td> <td><?= $lol['number_of_bogies']?></td> <td><?= $lol['number_of_axles']?></td> <td><a...
In the foreach loop syntax you've made a logical mistake, the contents of the $_SESSION['cart_items'] is an array having some keys and values, the keys are in the $id-$size format, and the values are arrays containing more information. So the "keys" are what you should to check against, Change your...
asp.net,session,redis,stateless
You could use Redis as a cache to hold various pieces of state about the user. The idea is that when the user logs in, you probably need to load a bunch of information about them from your database (name, address, etc...) at that point, you know the user will...
The content of {{ flash }} is escaped by Twig automatically. You need to use the raw filter like {{ flash|raw }} ...
What you can do is the following: $errors = array(); // List all session parameters and error messages you want to check here $valuesToCheck = array( 'fiat' => 'Please enter valid amount', 'contact' => 'Please enter valid contact' // and so on... ); // Loop through all values you want...
Well, yes, at least on the server side. That' in fact, is kind of the point of REST: REpresentational State Transfer. By making sure that all needed state information is contained in the state being transfered over HTTP, and eliminating server-side session state, it makes it possible to build easily...
To store an object in a session two things must happen: 1) The class must be defined before the session is started. 2) The class must implement serializable....
If you don't use framework session mechanism, please ensure that you have session_start() call before using $_SESSION, otherwise this data will be lost.
Rick, I'll wite here so you will understand better. For debugging purposes do the next thing: instead of $_SESSION['phone_of_user'] = $row['phone']; put this: $_SESSION['phone_of_user'] = $row; //This will put an entire array in your variable instead of: <p id="mobilechiiieckby" align="center"> Willkommen <? echo $fgmembersite->UserPhone(); ?>! </br> write this: <p id="mobilechiiieckby"...
php,codeigniter,session,browser-cache
Include these headers in the constructor function of the controller to prevent the caching of previous page If you want the Code Igniter's way of doing it include the below code $this->output->set_header('Last-Modified:'.gmdate('D, d M Y H:i:s').'GMT'); $this->output->set_header('Cache-Control: no-store, no-cache, must-revalidate'); $this->output->set_header('Cache-Control: post-check=0, pre-check=0',false); $this->output->set_header('Pragma: no-cache'); PHP's way of doing it...
routes.php Route::get('/', '[email protected]'); Route::post('languagechooser', [ 'as' => 'languagechooser', 'uses' => '[email protected]' ]); view - welcome.blade.php <!-- I think this bit should help you out! --> <p> @if( Session::has('locale') ) Locale: {{ Session::get('locale') }} <br> Message: {{ Lang::get('test.message') }} @else no session locale set @endif </p> <form action="{!! route('languagechooser') !!}" method...
The problem was not caused by the session itself exactly, but because I hadn't included my class autoloader before calling the session, and so my custom classes were not surviving the deserialize process (even though it's a javascript file and I don't use any of said classes!) I changed my...
Try this logic: if(isset($_GET["removep"]) && isset($_GET["return_url"]) && isset($_SESSION["products"])) { $product_code = $_GET["removep"]; //get the product code to remove $product_size = filter_var($_GET["size"], FILTER_SANITIZE_NUMBER_INT); //product size $return_url = base64_decode($_GET["return_url"]); //get return url $product = array(); foreach ($_SESSION["products"] as $cart_itm) { if ($cart_itm["code"] == $product_code && $cart_itm["size"] == $product_size) { // skip this...
javascript,node.js,session,meteor
I don't really understand your need. Why do you want to share Session with Server ? Session is client-side only, but you can send value if your session with Meteor Methods, or in your subscription. In the second case, your sbscription can be reactive with the Session dependancy. Could you...
In Global.asax.cs is an event handler protected void Session_End(object sender, EventArgs e) { } Which should get fired on session end....
You can use this function: function mergeQuantities($array) { $result = []; foreach ($array as $item) { if (!isset($result[$item['item']])) { $result[$item['item']] = $item; } else { $result[$item['item']]['kolicina'] = $result[$item['item']]['kolicina'] + $item['kolicina']; } } return $result; } $result = mergeQuantities($_SESSION['korpa']); Edit note: In the example I used $result = []; for setting...
You want the script to react different on ajax and on simple post request? I think in this case the best solution is just to pass any variable, which indicates, that data is being sent by ajax. Like this: postparams['ajax']=1; $.post(... And then in php make check like this: if...
You need to use Javascript to make the div show after 3 tries. PHP is executed on the server, not in the browser. Your "conditional" is only run when the page is served, not everytime you do an XHR.
session,authentication,oauth,authorization,openid-connect
By requiring that the access token is a JWT, agreeing on the user claims that go in to the JWT, putting expiration/issuance timestamps in there and making sure that you cryptographically verify the issuer of the token you're actually doing the very same thing that OpenID Connect is doing: "profiling"...
I think, luthando-loot is right. The Location is case-sensitive. Try to replace: header('location: dashboard/index.php'); with: header('Location: dashboard/index.php'); And, for better comprehension, use absolute path, like explained in this document. Else, it could be that something is already sent to the user, so you cannot modify the header anymore. Remember that...
internet-explorer,session,cookies,p3p
There shouldn't be any issue with the cookie domain being .mydomain.com instead of www.mydomain.com because cookies set on the root domain should work properly on any "subdomain" such as www, though it wouldn't hurt to try because it's simple to change. Depending on the cookie privacy settings in IE, it...
foreach($db->query("SELECT country FROM uyeler WHERE mail ='{$_SESSION['kullanici']}'") as $row) { echo $row['country']; } It works thank you :) ...
You can easily see for yourself in the source code that it does.
Try something like below: $params = array('next' => 'http://something.com/logout.php'); $logout = $facebook -> getLogoutUrl($params); $_SESSION['logout'] = $logout; ` ...
I actually tried something which seems to be working, I'm not sure if it is good practice but that's all I understand for now. The code below is only for one drop down list to show the principle : HttpSession session = request.getSession(true); // get the current session or create...
This happens when redirects circles around. for example: in index.php the user gets redirected to login.php in login.php the user gets redirected to register.php and finaly in register.php the user gets redirected to index.php again so that the circle is closed. ...
php,session,fosuserbundle,symfony-2.3
You probably should configure both projects to use different place where session files are stored. In Symfony2 you can do that with save_path param in framework configuration More info: http://symfony.com/doc/current/cookbook/session/sessions_directory.html Also it can be done strictly in PHP with session_save_path function. Edit. Also changing just session name could work too....
session,java-ee,ejb,rmi,java-ee-6
Easiest way would be to store the user in a @RequestScoped CDI bean and inject that as required: @RequestScoped public class RequestUser { private User user; //getter and setter for user } @Remote @Statless public class MyRemoteInterface { @Inject private RequestUser requestUser; ... public void foo(User user, Bar bar) {...
ruby-on-rails,ajax,session,devise,registration
My apologies, I did not really understand the sign_up function of devise. I thought this method was finalizing the creation of a new user record, but instead it just tries to sign_in as the newly created user. So it was enough to comment the line sign_up I'm not a native...
jsf,session,cdi,wildfly,jboss-weld
It seems we did encounter a Wildfly 8.2 bug, located in Weld. See this jira for more information : https://issues.jboss.org/browse/WFLY-4753 The fix has been to patch Wildfly with this patch : http://sourceforge.net/projects/jboss/files/Weld/2.2.12.Final Thank you all...
java,session,nginx,proxy,glassfish
It helps if you post your NGINX proxy config. A basic reverse proxy config looks like this: ... http { .... server { listen 80; server_name www.yourdomain.com; location / { access_log off; proxy_pass http://127.0.0.1:8080; proxy_set_header Host $host; proxy_redirect off; proxy_set_header X-Real-IP $remote_addr; ... } .... } } ...
session,powershell,user,server,disconnect
Powershell can use normal commands, this one should (according to manual) disconnect a given session: tsdiscon <ID> [/server:PC] [/V] [/VM] Pretty much the same as you use, just the executable is sifferent....
I'm guessing it's because you've got the attribute of the object within the string that identifies the key of the object you want to get. I.e. move ->time as so: {{ Session::get('bookingConfirmed')->time }} You may also want to check it exists firstly too: @if(Session::has('bookingConfirmed')) {{ Session::get('bookingConfirmed')->time }} @endif ...
You could try unset($this->session->userdata('user_id')); unset($this->session->userdata('logged_in')); unset($this->session->userdata('username')); Or Just Have $this->session->sess_destroy(); Make sure your session library auto loaded and have configured your settings depending on version of codeigniter...
Session cookie parameters can be set in two ways: in php.ini file (http://php.net/manual/en/session.configuration.php#ini.session.cookie-domain); via session_set_cookie_params function (http://php.net/manual/en/function.session-set-cookie-params.php). Your current setup propably provides no cookie_domain setting which causes hostname usage. If you choose to use the function, please remember to call it BEFORE session is started (eg. before session_start). If you...
php,session,laravel,twitter,oauth
Issue was in config/session 'driver' => env('SESSION_DRIVER', 'file') env 'SESSION_DRIVER' was empty, changing the line to: 'driver' => 'file' Solves the problem and now session variables persist on redirects....
osx,session,vim,configuration-files,tmux
Explicitly inserting a space should do it: send -t 1 vim space ~/Path/to/my/file enter or you can quote command arguments (I prefer this one): send -t 1 'vim ~/Path/to/my/file' 'enter' ...
Sessions A simpler solution is to keep using the files session save handler, but have it use a directory that is not a Vagrant "synced folder". In other words, set session.save_path to /tmp for example. This could be any directory, as long as it's not a synced folder (like /vagrant)....
Since 1.8 you won't be able to add a product to the cart from a GET request alone, as you need to provide the form_key. You should be able to add a product to the cart using the following: form_key is the main thing to get right here. $params //should...
android,session,retrofit,rx-java
Use OkHttp's extremely powerful Interceptor. public class RecoverInterceptor implements Interceptor { String getAuth() { // check if we have auth, if not, authorize return "Bearer ..."; } void clearAuth() { // clear everything } @Override public Response intercept(Chain chain) throws IOException { final Request request = chain.request(); if (request.urlString().startsWith("MY ENDPOINT"))...
c#,asp.net,session,cookies,web-config
pseudo code: Code to ADD cookie HttpCookie e = new HttpCookie("d"); e.Value = "set-Email-Id"; e.Expires = DateTime.Now.AddDays(30); // expires after 30 days HttpContext.Current.Response.Cookies.Add(e); Code to Read ( get ) cookie by it name HttpCookie ck_d = Request.Cookies["d"]; if(ck_d!=null) { // logic here } ...
php,session,e-commerce,checkout
Create an Class that uses $_SESSION to store the data so you can use something simple like this: // start checkout $checkout = new checkout(); // to add data $checkout->AddName = $_REQUEST['name_name']; // retrieve name $name_name = $checkout->Name; // empty checkout session on success $checkout->reset(); ...
As you have stated in your Post the /tmp directory is full. However, you can redirect where your temp directory is writing to. Go into your my.cnf file and look for something like this line: tmpdir = /tmp/ If it is not there then add: tmpdir = /whatevr/dir/you/want Just be...
Remove the ; after$session->user_name;
Sockets are really only for CLI programming, and there you don't have a $_SESSION object available. Additionally, it doesn't make sense that you will want to share the socket in the first place, because the socket is a means of IPC. If you pass the socket handle between scripts, then...
asp.net,session,iis,asp-classic,iis-6
According to this MSDN article (which is ancient, but certainly makes sense in my experience): Session ID values are 32-bit long integers. Each time the Web server is restarted, a random Session ID starting value is selected. For each ASP session that is created, this Session ID value is incremented....
php,codeigniter,session,session-state
When Session expires, session variables also becomes undefined. So always check your session like below if (isset ($_SESSION['username'])) { // Its active } else { // Session expired } ...
You've got a quotes problem, fix it like this: <% Session["path"] = "'" + vr_ + "'"; %> EDIT 1: Javascript and ASP.NET are not the same, so you cannot access the variables, so you can't do it on the client side. You must send something to the server like...
javascript,node.js,session,curl,cookies
You can use the http module that comes with Node.js var http = require('http'); http.get('http://www.google.ca', function(res) { console.log(res.headers['set-cookie']); }); will give you all the cookies that google.ca would try to set on you when you visit....
python,django,session,cookies,python-requests
The following code is working perfectly fine for me - import requests from bs4 import BeautifulSoup s = requests.session() r = s.get('http://www.jstor.org/stable/pdf/10.1086/512825.pdf') soup = BeautifulSoup(r.content) pdfurl = 'http://www.jstor.org' + soup.find('a', id='acptTC')['href'] with open('export.pdf', 'wb') as handle: response = s.get(pdfurl, stream=True) for block in response.iter_content(1024): if not block: break handle.write(block) ...
php,apache,symfony2,session,iis
Apparently setting session cookie domains does not work for top level domains (TLD), like .dev Changed my code to: ini_set('session.cookie_domain', '.local.dev'); and now I am able to set session variables on .local.dev website and read them in new.local.dev Both apps are physically in separate folders, operate from two IIS entries...
I finally got it. As I posted in the question, the problem was that the session_handler was writing the sess file with different encoding. So both scripts where trying to read the file and none of them could read the variables correctly. I had a php.ini file that was used...
For older PHPs, you have to fiddle with the GC probability settings: session.gc_probability 1 session.gc_divisor 1 giving a 100% chance of the GC being run on every request. Of course, this would be a major performance hit, so you might want to put those overrides into a conditional block in...
This is just a logical error because of how you coded the if condition in your admin.php file !isset($_SESSION['authorized']) && $_SESSION['authorized'] == false The isset() method in PHP returns false if the index does not exist in the array. So in your case when !isset($_SESSION['authorized']) evaluates to true the other...
I've faced this issue for me the problem was I was using https://server:1234/somecontroller while i was requesting from ajax as http://server:3344/somecontroller and session was not shared between https and http so double check if this apply for you. ...
SQL Server is a very stubborn (reliable) product. If something is session bound what gives you the impression that using StateServer (a non MS product that looks very interesting but it is not a MS product) that it will give you access to change accessibility of SQL Server session objects....
i figured it out. by starting the Session in the foreach loop and calling it outside the loop. it works fine. Thanks foreach($_POST['gm'] as $key => $answer){ if($answer != ''){ $var=explode("|",$key); $gamecode=trim($var[0]); $gc[]= trim($var[0]); $_SESSION['gamecode']=$gc; } var_dump($_SESSION['gamecode']); ...
php,session,redis,cluster-computing,predis
IIUC you're debating internally between using Predis' client-side sharding vs. having it leverage Redis v3's clustering abilities. Client-side sharding is a great to have clustering when a database doesn't support it and this approach is usually the easiest implement initially. However, when a database does provide native clustering functionality -...
php,arrays,session,initialization
As every on suggested above, try this:- <?php session_start(); $_SESSION['yans'] = array('A','B','C','D','E'); echo "<pre/>";print_r($_SESSION);die; ?> Output:- http://prntscr.com/7btkxv Note:- it's a simple example given for your understanding. thanks....
c#,asp.net,asp.net-mvc,session,serialization
Using InProc sessions, the data is not "stored" anywhere, it just stays in memory. This way no serialization is needed. For the other methods the data does need to be written to somewhere (state server, sql server) and needs to be converted to a stream of bytes (and back again)....
asp.net,vb.net,multithreading,session
No, that doesn't work. The second thread doesn't have a HTTP context, only threads that run to handle requests have a HTTP context. Youcan make a class for the method to run in the second thread, and add any input and output data as members in the class: Public Class...
Javascript is a client-side language. Session are server-side component. If you want to update session when user does something on your page, you should create a ajax request to the server. Or maybe use some client side variables that, for some aspects, are similar to session (they will be forever...
.htaccess,session,url,redirect
It seems to look ok but one thing you should do is always put your other rules before the wordpress rules as a habit. When using wordpress it should generally be the last set of rules since it does all the routing. Now for the redirect, you should probably use...
Replace $_SESSION['c'] = $_SESSION['c'] -1; by $_SESSION['c'] = array_values($_SESSION['c']); "-1" will throw error since you are trying to subtract numeric value from a N-dimensional array. array_values will return you updated $_SESSION['c'] after unset/delete operation is done. P.S. Update your code accordingly for $_SESSION['cart'] as well....
I found the culprit. The problem is I did not set cookies, so I was basically using newly generated ID for every request to load session data. Restify-session is doing what it suppose to do - generate sid for every request. My newbie mistake.
You can use javascript do detect inactivity. If you're using JQuery, there's a plugin called JQuery.idle Probably you'll need something like this. $(document).idle({ onIdle: function(){ // TODO: redirect to logout page. }, onActive: function(){ // TODO: maybe you don't need it. }, idle: 300000 // 5 minutes then onIndle function...
There is a syntactical error. Should be - if(!isset($_SESSION['userid'])) { isset is a function. It should be called by isset() not isset[]....
asp.net-mvc,session,azure,stackexchange.redis
OK, well, figures that after posting this I'd find the answer! So there is this very small note at the bottom of one of the articles I could find on Redis Session State Provider: https://msdn.microsoft.com/en-us/library/azure/dn690522.aspx "Note that data stored in the cache must be serializable, unlike the data that can...
I am, myself, a webpy newbie. Nevertheless, after doing some "research", it seems that webpy cannot pickle the subprocess.Popen object[1]. So, lets try the following approach -- that is, creating it in the end response and printing its output. In other words: import web import subprocess web.config.debug = False urls...
javascript,node.js,function,session,express
1) You don't need to recall and reinstantiate the API since you already define it once. 2) you need to pass in the req object simply. In your route.js var express = require('express'); var https = require('https'); var passport = require('passport'); var router = express.Router(); var User = require('../models/User.js'); var...
The problem is most probably the fact that you have header('location: ../public_html/index.php'); instead of: header('Location: ../public_html/index.php'); in login.php. It should have a capital L. It doesn't and you get no redirection, thus the blank page ... UPDATE So you redirect ok but your script dies for some reason. It is...
You dont need to return request object to keep the session data. Use Ajax In django from django.http import JsonResponse def addtolist(request): var1 = request.session.get('session_pmids', False) pmids = request.POST.get('pmids', '') pmids = pmids.split(",") if var1: pmids = pmids + var1 request.session["session_pmids"] = pmids if not var1: request.session["session_pmids"] = pmids return...
I have modified my SessionExtensions class to include the following: public static T GetDataFromSession<T>(this HttpSessionStateBase session, string key) { return (T)session[key]; } Then on the view reference it like this: @Session.GetDataFromSession("UserID") It's not strongly typed , but this fits more naturaly...
Yes, session state assumes that provider deserializes/serializes whole state and hence more data is stored more time it takes to start/end request. As an option if you need to store a lot of data - store infrequently needed pieces outside of session state and keep information on location of the...
From a scalability perspective, it is definitely better to produce a token containing the information, sign it on the server, then pass it back to the client to store and return with each request. By signing it on the server, you make it immune to the user tampering with the...
put this content into your constructor function because when the controller run constructor will execute first. function __construct() { parent::__construct(); if(empty($this->session->userdata("login_session_user"))) redirect(site_url(),'refresh'); } ...
php,arrays,symfony2,session,symfony-forms
I have not tested the code. But it will help. public function addAction(Request $request){ $aBasket = $request->request->all(); // Get Value from session $sessionVal = $this->get('session')->get('aBasket'); // Append value to retrieved array. $sessionVal[] = $aBasket; // Set value back to session $this->get('session')->set('aBasket', $sessionVal); return $this->redirect($this->generateUrl('shop_desktop_homepage')); } I have wrote comment. I...
Set them as a session attributes: public void doGet(HttpServletRequest request, HttpServletResponse response) { HttpSession session = request.getSession(); session.setAttribute("myVariable", variableValue); } Use some tag library like JSTL to access attributes sent from servlet instead of using scriptlets. In case of JSTL use out to print value of your variable: <c:out value="${myVariable}"...
$_SESSION is saved in the server, so the user cannot modify it ( Except the case of session hijacking)
php,arrays,session,yii,session-variables
I think problem in next row: Yii::app()->session['cart_items'] = $id; After this code cart_items will be NOT array, but integer or string. Clear session and try to change: Yii::app()->session['cart_items'][] = $id; And better use CHtml for generation html. It is cleaner. Like this: echo CHtml::tag('li', array(/*attrs*/), 'content_here'); //your code echo '<li><strong>'...
java,spring,session,junit,spring-junit
I don't think Spring can automatically link a MockHttpSession (I also don't know where you're autowiring it from). You can add it manually. RequestBuilder requestBuilder = MockMvcRequestBuilders.post("/setSomeType") .param("someType", "ACCESS_ONLY") .accept(MediaType.parseMediaType("application/json;charset=UTF-8")) .session(session); Alternatively, you can use sessionAttr(String, Object) to add session attributes individually....