473,785 Members | 2,789 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

i am going nuts = new session id just will not work

Hi

I have the following file:

--myfile.php
<?php
if($s) {
echo $s;
session_id($s);
session_start;
echo 'your account has been loaded, <a
href="index.php ?PHPSESSID='.se ssion_id().'">c ontinue</a>.';
}
?>

I run it like this: myfile.php?s=ab c

It does not matter how many times I load it, whenever I load my test file:

---test.php
<?php
session_start() ;
echo session_id()
?>

The same old session ID comes back (definitely not abc or any other
parameter that I pass using s). Having said that, in the link to index.php,
it provides the new session ID, but as soon as I reload the page, we are
back to normal.

The ONLY way to delete this old session ID is to delete the cookie from my
computer.

What am I doing wrong. It is driving me nuts!

TIA

- Nicolaas

Jan 8 '06 #1
1 1567
Message-ID: <hV************ ********@news.x tra.co.nz> from windandwaves
contained the following:
The same old session ID comes back (definitely not abc or any other
parameter that I pass using s). Having said that, in the link to index.php,
it provides the new session ID, but as soon as I reload the page, we are
back to normal.


What are you trying to do?

The session id will stay the same as long as the browser is open (within
the garbage collection time)

The session id serves as a reference to session variables which are
stored on the server. Therefore it is vitally important that it does
stay the same.

As you've found out the session id is stored in a cookie. You only have
to pass it by URL if you expect cookies to be turned off. Since the
cookie is only a memory cookie, most of the time you will be ok. If in
doubt you have to pass the session id or have it automatically enabled
on the server. The session id is available as a constant SID

If you want to store 'abc' by doing myfile.php?s=ab c

<?php
session_start() ;

if(isset($_GET['s'])) {
echo $_GET['s']."<br>";
$_SESSION['s']=$_GET['s'];

echo "your account has been loaded, <a
href='index.php ?".strip_tags(S ID)."'>continue </a>.";
}
?>
You will find that the session id will not show unless cookies are
disabled

index.php must have session_start() as the first line
$_SESSION['s'] will contain your variable 'abc'
--
Geoff Berrow 011000100110110 0010000000110
001101101011011 001000110111101 100111001011
100110001101101 111001011100111 010101101011
Jan 8 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
1874
by: Jim Davidson | last post by:
Here's what I'm trying to do: I have a string with 30 numbers in it. I want to generate a random number between 0 an 30, go to that position in the string and get that number. Here is the code you can run it and see it doesn't work. I'm new at this (only about a week) but I thought this should work. Please help. It's probably something simple, but I don't see it.
14
3240
by: Paul Yanzick | last post by:
Hello, I am trying to develop a book tracking application for my capstone in school, and am running into a problem. The application is an ASP.Net application written in C#. The first page you go to is a login form, which will set several session variables with the name used to log in, appropriate security level and some other misc variables, and then will go to a main menu for each particular security level using Server.Transfer. ...
12
1615
by: Marty | last post by:
It seems all of the sudden that user controls that contain images are referencing image sources relative to the document that I drop the control on. This obviously does not work beacuase the image source is relative to the user control, not necessarily the form. Can anyone tell me why this would be the case?
8
1264
by: Lloyd Sheen | last post by:
I have a problem with persisting the state of a control. It has several properties that can be determined but there is no event to indicate when the property changes. A postback occurs when one of a array of buttons is clicked. On the click new information will be displayed but I need to save information from the control (which I cannot change) and reset it when the new information is displayed. Is there an article I can reference (I...
9
2386
by: Greg Linwood | last post by:
I'm having difficulty understanding Session state in ASP.Net. It's almost embarrassing asking this as I've been using ASP since it was first released & it really shouldn't be this hard to use - perhaps I'm just not very smart or perhaps MS is making this too hard for us sql bunnies to understand - I dunno, but I'd really appreciate someone explaining what I'm doing wrong here & perhaps suggest a better approach.. I'm familiar with use of...
10
3517
by: tshad | last post by:
I have been using the default session state (InProc) and have found that I have been loosing my information after a period of time (normally 20 minutes). Is there anyway to find out how much more time I have on a session? If I do a refresh, does reset the session clock? Do you have have to go to another page to reset the session timeout or will a postback also do it? This is important as we have a few pages that a user
43
3438
by: davidkoree | last post by:
I mean not about cookie. Does it have something to do with operating system or browser plugin? I appreciate any help.
5
1419
by: Shelly | last post by:
This ASPX/SqlServer stuff is driving me nuts. 1 - In a previous post I said I had four tables and all were showing up in Object Explorer (MS SQL Server Management Studio Express), but when I went to do a query using the query text editor, only two of the tables showed up. Then, mysteriously, the problem went away. Now, it is back. 2 - My insert into a table failed from the debug version in Web Developer, so I copied that SQL call and...
28
2178
BezerkRogue
by: BezerkRogue | last post by:
I have gotten my pages to work up to the final edit page. The code executes on load. Variables are passed by session but I get an SQL syntax error. I've tested the sp I'm calling and it works correctly. Here's the code" Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load Dim strSelDate Dim strShift Dim strAbsent Dim strTO Dim strHeadCount Dim...
0
9480
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10327
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10151
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9950
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7499
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6740
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5381
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
3647
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2879
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.