u_c_iv
Apr 25 2006, 07:51 PM
Hi. I am part of a development team working in PHP and MySQL. The site is using SSL, and users have to log to use the site. When users log in, their important details are retrieved from the database and stored in session variables (functionality in the site is permissions specific). Lately, sessions are "disappearing" for no apparent reason. Users will log in, and at some point (the length of time will vary unpredicatably) the sessions will lose their value (the variables are empty) and this causes the site to evict the user. This is very frustrating for the user but moreso for the development team who is struggling to understand why this happens. The STRANGEST part is that the site is hosted in a city in Australia, the users a predominantly in another city in Australia, and I am in Charlotte. I have NEVER been able to replicate the problem on the live server or my localhost test machine. I had some friends in the same city in Australia try to access the site, and they aren't able to replicate the error... ?!?!? Those of you who debug will appreciate the hopelessness of trying to solve an error when you can't even get it to trip up! This is all I know - sessions are losing their value and I have no idea why. I've coded a work around for the PHP garbage collection function and that was working well for some time. I have checekd the code, and it isn't the problem (I think). Can ANYONE help me?
Reply
WindAndWater
Apr 25 2006, 08:51 PM
I can't think of any reason why the session variables would loose scope unless they were overwritten/overloaded. If you can't find any evidence of that in your code you might consider temorarily switching to using session cookies until you resolve the problem.
Reply
Spectre
Apr 26 2006, 05:25 AM
Unless you explicitly destroy the session (eg. by prematurely calling session_destroy()) or PHP is unable to determine the session's owner, this shouldn't happen. Generally speaking, PHP will either use a cookie to indicate a session's owner or append the session ID to all links within the page (eg. a link to '/page.html' may become '/page.html?PHPSESID={32-byte MD5 hash}'). If it using the second method, perhaps it is losing track of session owners if the link is unable to be modified - are you using irregular HTML or can you think of some other problem that may affect it in this way? Anyway, try setting and/or checking when the session is set to expire with the session_cache_expire() function. It probably wouldn't hurt to further explore PHP sessions either; perhaps it's your server configuration or a problem within your code that you aren't aware of.
Reply
u_c_iv
Apr 27 2006, 04:38 AM
Hi guys. Thanks for your input. I just had a very interesting accident... What was really bothering me was that code doesn't morph, right? So if there is faulty code on one server, it will be faulty on another server. The code was working exactly as intended on my local machine, and certain users (in certain locations) never had the error, and yet a lot of people were consistently having the error! No matter how I tried to replicate what the error-prone users were doing, I just didn't get the error. Then. I bought a laptop, and I was setting it up with a development environment, and all the usual stuff you need on a computer. The thing I didn't have was firewall/virus protection. So I bought CA eTrust Internet Security Suite and installed it. Because I want my two machines to share resources (see my OTHER post where I'm having no luck in THAT arena) I set my home network to be a trusted zone. It all installed fine and I restarted the machine to do some work. Then when I opened up my localhost site, I had the EXACT SAME ERROR as the users were having in Australia!! I couldn't believe it. I uninstalled the Security Suite, restarted the machine, and the error was gone. Re-installed the Security Suite - you guessed it. Errors. Bottom line... my signal chain is ISP -> Modem -> Wireless Router -> PCs. So in setting my home network (including the router) as a trusted zone, it prevented the sessions holding their value. If I set the home network as a Internet Zone, then it works fine - therein is my home network problem... shared resources need to eb in a trusted zone!! I did an online help-chat with someone from CA, and they said that the reason for this problem is that trusted zones are treated with more caution (?! I thought they were TRUSTED?!?!) and that was the interference with the session values. They confirmed that the problem my users in Australia were experiencing are not related to the code. I have temporarily incorporated cookies as a backup plan (as suggested) and so far so good. I'll let you all know if it keeps up...
Reply
u_c_iv
May 1 2006, 05:16 AM
Hi again, I'm sorry to report that the cookie-solution that I tried to implement was of no effect. The cookies are created (as are the session variables), but for some STRANGE reason, they are getting deleted. I'm almost 100% positive that it is outside of the control of the PHP code, so I have to leave it alone for now and try to find out what sorts of measures ISPs use to stay secure. Thanks again for your help. I will let you know if I find anything interesting.
Reply
Recent Queries:--
session variable interference asp - 684.45 hr back. (1)
Similar Topics
Keywords : session, variables, sessions, php, behaving, strangely
- Help Me _ Error Message: "could Not Retrieve Session Record"
IPB-Forum error message (2)
Get User Info True Sessions Or Cookies
need help on this (0) i have mysql databse with user info what i want to to do is if a user klicks on view my profile he
has to see his profile (if he is logged in)so that he kan change some info like email etc. and when
a user kliks on: view all profiles he has to see a list of users which are links and when he kliks
on it he goes to the profile of that user. i searched the web but didn't find an snippet or
tutorial. sooooo does anyone has a code snippet or tutorial ??? thx in advance ....
Counting Variables?
(4) Write a php script that will accept a positive integer, if it is even, divide it by 2 and if it is
odd, multiply it by 3 and add 1. Repeat the process until the value is 1, printing out each value.
Finally print out how many of these operations you performed. If the input value is less than 1,
print error and perform an exit(); For example: Initial value: 9 Next value: 28 Next value: 14
Next value: 7 Next value: 22 Next value: 11 Next value: 34 Next value: 17 Next value: 52 Next
value: 26 Next value: 13 Next value: 40 Next value: 20 Next value: 10 Next value: 5 Nex....
Something I Discovered With Sessions [php]
(4) Hello All, I've been doing a lot of PHP programming since I last posted here. I've run
across two security related things with sessions that you may or may not know about. The first one
pertains to the session id, or the id that PHP assigns each computer when a session is created.
This id is either stored in a cookie (search for PHPSESSID) or through the URL as GET data.
Remember that all session data is stored server side; this ID is the only thing that PHP will use to
differentiate your computer from someone else's. While I was programming for Plug ....
Php Sessions And Post Variables Issues
My script dosent seem to work as intended (1) You can test it out for yourself at http://sonesay.trap17.com/application.php I've been
working on this page locally and it seems to be working fine but when I upload it to my trap17
account the post variables dont get saved properly. Fill in some fields and submit it, the form
will come up as a empty field yet when you resubmit it without any modifications and the data you
entered in orginally will now magically appear, resubmit it again and it will be gone. This is
really annoying as I have no clue why it would be doing this when it seems to work fine locally.....
C++ Lesson 2: Variables
Tutorial for C++ (0) As i said on other tutorial. This are tutorials from Gaianlurker on the New Engin3 forum. Alright,
this tutorial was going to be Variables and Functions, but that would just be massive so I broke it
down. Let's start with a basic program; CODE #include <iostream.h> //cin and cout
functions are here int main() { int a, b; cout<<"Welcome to
GaianLurker's basic math thingy."<<endl; cout<<"Please enter a
number."<<endl; cin>>a; cout<<".. and
another?"<<en....
Ti-basic: Solving Equations With Variables
Useful for Algebra (0) In this tutorial I will show you how to create a program that will solve a equation with variables
for you. There are some requirements though. Requirements A Ti-83 or better calculator
Knowledge of how to use the calculator Knowledge of where to find the functions A little Ti-BASIC
knowledge will be helpful Well lets get into it. Creating the Program First, we need to create
the program. Open up your program screen and create a new program. Name it something like EQSOLV.
Ok let's get started with the coding. WARNING: This program will use the followi....
Tricks With Php Variables
(10) You probably are thinking at this moment why I am posting some tricks with variables. Well, there
are many useful things a variable can do for us. For one they can actually be used to create simple
games. They also can be used to produce a random result in a page. Another great use is shoutboxes.
Well here are some cool variable effects. Adding Multiple Strings We can use strings to create
great effects. Example: CODE <?php $var1="Hello person.";
$var2=str_replace("person","world",$var1); echo $var1."
&....
<?php ?> Unique Visitors Script
Flat file unique visitors script (no sessions) (2) This is really simple script. Well at least this part is, but it could be extendable. Only problem
is that it's not really for massive websites with hundread of visitors a day, but rather for
small ones. But it is a good script to figure out how to make a visitor counter script. Anyway
here's the snippet. CODE <?php function getVisits($variable) {
$visits = array(); if ($handle =
opendir('stats/')) { while (false !== ($file =
readdir($handle))) { ....
Php Session
(6) Okay, I just got all my site stuff transferred over to Trap17, so I'm ready to resume coding.
I'm currently working on my members' pages, and wish to use the PHP Session tags and include
it in a function so that on every page, I just include the function to check and see if that user is
still logged in and is allowed to view that page. Somebody told me I need to use the isset( blah
blah blah and check to see if they were logged in from the login page (not sure how to do that),
then query the $_SESSION so I can check the 'userlevel' to check if ....
How Do I
define variables in flash (3) were doing a course in ICT called multimedia, but i dont know how to define variables and whenever i
ask my teacher he always goes "were not that far yet" he doesn't even look at what i have
done, assumes I'm not finished, when i am, the only thing i need now is a scoring system....
Php-fusion Cms
No session_start() used? (3) A while back i was looking for free hosting and a forumn suite for my own comunity. I ended up using
hostingdirect.co.nz and php-fusion from http://php-fusion.co.uk It was pretty easy to setup and
run. But my site required more specific functions other then generic CMS could offer and I wanted to
learn PHP so I start reading tutorials and such to learn. I was working on them locally and they
seem to run fine on my own server. When i upload my own site to the hostingdirect site I find they
do not have safe_mode off. I got an error in my index.php file when i try and ru....
Sending $_get[] Variables To An Application
(3) I'm trying to work out if it is possible to send variables to a application on server. E.g
send the variable of id which is equal to 10 to an application - test.exe?id=10 Any ideas to see if
this is possible?....
Sessions And Our First Project
Seventh PHP Tutorial (0) Intro To PHP Tutorial 7 - Sessions and Our First Project Released 4/27/07 By Chris Feilbach aka
GhostRider Contact Info: E-mail: assembler7@gmail.com AIM: emptybinder78Yahoo: drunkonmarshmellows
Website: http://www.ghostrider.trap17.com Today, I am going to give us a project to work on
together. I originally had planned that at the end of tutorial that we were going to write Solitare
in PHP, but that seems hard and complex and way beyond of the intended scope of this tutorial.
Perhaps for another tutorial. My friend Laurie reccomended that we write Tic Tac Toe bec....
Second Php Tutorial - Variables
(8) If you haven't read the first one, read it by clicking here . I got a lot of positive
comments about my last tutorial. Do you guys think I should keep writitng these? Intro To PHP
Tutorial 2 - Variables Released 4/06/07 By Chris Feilbach aka GhostRider Contact Info: E-mail:
assembler7@gmail.com AIM: emptybinder78 Yahoo: drunkonmarshmellows Website:
http://www.ghostrider.trap17.com It has been a very long time since I have released a tutorial.
I've been quite busy working on my newest script for handling news (GAMES), and redesigning my
webpage. This tu....
How Do I Pass Php Variables From A Url To A Form?
I'm about read to tear my hair out with this one (5) Ok, what I need is for users to be able to select what address they want (e.g. mydomain + .com),
click submit that then sends the variables 'domain' and 'ext' through the URL e.g.
mywebsite.com/example.php?domain=mydomain&ext=com (the variables being mydomain and com) where they
are displayed in a form mail as "Domain Selected: mydomain.com" that can then be submitted and sent
to an email. In my form so far I have CODE <input name="domainname"
type="text" id="domainname" value ="<?php echo "$domain"; ?....
Destroying Variables In Javascript
Destroying variables in javascript (7) how do you delete the contents of a variable in javascript? Any ideas?....
Storing Session Variables Generated Dynamically
(3) i have many pool (quiz) modules on my site with the information taken from a database. The modules
are processed by the same function with different parameters and i need to save the pool's
status to prevent a user vote several times. I do this setting $_SESSION to 1 , variable
being the name of the quiz, which is taken from the database. So i get to having a code like this:
.................... $name= $row->quiz_name; $_SESSION =1 The problem is that if
i call $_SESSION from another part of the site (another page) the variable is al....
Php - Can Anyone Tell Me What "session" Actually Do?
(5) php - can anyone tell me what "session" actually do? I was looking at this page
http://www.w3schools.com/php/php_sessions.asp this paragraph here: A PHP session solves this
problem by allowing you to store user information on the server for later use (i.e. username,
shopping items, etc). However, session information is temporary and will be deleted after the user
has left the website. If you need a permanent storage you may want to store the data in a database.
Especially this part below: QUOTE A PHP session solves this problem by allowing you to store
user in....
Using Sessions Instead Of Cookies, Help Please
(1) This is a simple code to register and login.. this uses cookies.. i want to use sessions instead..
can someone tell how i can do it ? config.php CODE <? ob_start(); // allows you
to use cookies $conn =
mysql_connect("localhost","USER","PASSWORD");
mysql_select_db(DATEBASE) or die(mysql_error()); //fill in the above
lines where there are capital letters. $logged = MYSQL_QUERY("SELECT * from users
WHERE id='$_COOKIE[id]' AND password = '$....
Php Application - Form Variables Not Being Passed
Tech Support did something to fix this problem. Very quick. (3) I'm trying to install an application, and it's not working. The programmer says that form
variables are not being passed between forms. This is a login application, so it has input like:
username: admin password: password The test (debug) program should return... LOGIN: Login
USERNAME: admin PASSWORD: password That will mean that variable are passed between forms. Since
right now it is not happening all you get is this: LOGIN: USERNAME: PASSWORD: Has anybody else
seen this? According to my programmer, this is a Server Admin (maybe configuration) problem ....
Sessions And Login
Without Cookies (5) Hi, I have a login script i made using PHP sessions and MySQL. It works fine but there is a
problem. As you know Sessions are stored in Cookies by PHP. So if someone has switched Cookies off
then no sessions will work. How to solve this problem ? Please help me. Thanks and have a good
day. ....
Php Variables And Url Forwarding
Tutorial -> PHP/URL forwarding (2) hi all this tutorial is about php get variable and url forwarding you can move variable in url with
php with out html form make one page with this code : CODE <?php $what =
$_GET['what']; $trap17 = $_POST['trap17']; echo
"Your name is : " . "$what" . "and Your Trap username is : " .
"$trap17"; ?> save this file with name "name.php" then upload name.php at
your hosting , then turn your browser at this url : http://yoursite.trap17.com/name.php?what=....
Converting Characters In A Variable To Individual Values In An Array
turning variables into arrays (2) Say I have a variable such as $nav_item and it had to contents Home . IE: CODE
$nav_item = 'Home'; How would I make so that $nav_item was an array and
had the following contents? CODE $nav_item = array ('h', 'o',
'm', 'e'); With the case changing (ie H would become h and U
would become u ) EDIT: Okay found out that I could change the case with
array_change_key_case ($nav_item, CASE_LOWER); ....
Session_start()
whats going on with it (8) Hi im using my page in php coding and the session_start() code is messing something up. This is
the error: Warning: session_start(): Cannot send session cookie - headers already sent by (output
started at /home/idimm/public_html/index.html:2) in /home/idimm/public_html/index.html on line 103
Warning: session_start(): Cannot send session cache limiter - headers already sent (output started
at /home/idimm/public_html/index.html:2) in /home/idimm/public_html/index.html on line 103: Does
anyone know how to fix this? It does do the command but it gives this annoying error....
Session Lifespan
(2) Hey all, I am having trouble keeping session variables. If a visitor comes to our website, has a
session variable set, then leaves our website and comes back, without closing their browser, should
they lose their session variables? This is what's happening to me, and I was under the
impression that session variables lasted until the expiration/inactivity timeout, or until the
browser was closed. Am I wrong? ....
Passing Variables Through A Page?
(4) I have a form that people fill out. Depending on what they fill out on that form, they get different
things on the page they're taken to after hitting "submit". Information from both pages goes
into a database. However, I don't want to create a new row until the second page has been
filled out and submitted (taking the user to a third page). Is there any easy way to pass all the
variables from the first page through the second and to the third? I know I can stick it all in
hidden inputs, but I have more than 60 form items to process, and I'd like to not have....
The Difference In Variables?
(3) Hi y have a cuestion what is the diference or INT.VAR AND CHAR.VAR thanks /wink.gif' border='0'
style='vertical-align:middle' alt='wink.gif' /> ....
Transfer Variables To Another Php Script
(8) Hello, I've one registration page where the users fills in their information, is it possible to
trasnfer the things the fill in on the registration page to another script that does someting and
returnes something to the first page like true/false and then the registration gives an error
messange if the other php script returned false? Something like the script "activates" another
script that does something and returnes the result back to the original script. Best Regards ....
Sessions
-tutorial- (7) Why Session when I can use Cookies? Because cookies are about 30% unreliable, and that % is rising.
Plus more and more browsers are coming with security and privacy settings that do not allow storing
of cookies on computers. PHP has a great function(s) that have the same results as cookies and more,
plus they are invisible and store information on web server. Session have great capabillity. For
example if you want to have a member system on your website, with session you could identify a
user, user's level and other. Session start function: session_start() Fir....
Looking for session, variables, sessions, php, behaving, strangely
|
*RANDOM STUFF*
*SIMILAR VIDEOS*
Searching Video's for session, variables, sessions, php, behaving, strangely
*MORE FROM TRAP17.COM*
|
advertisement
|
|