Webmaster Forum

Sponsored Reviews   Advertise Here   V7N Directory
Go Back   Webmaster Forum > Web Development > Web Design Lobby > Coding Forum
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Coding Forum Problems with your code? Let's hear about it.

Reply
 
LinkBack Thread Tools Display Modes
Old 08-18-2006, 11:21 AM   #1 (permalink)
Contributing Member
 
I like pie's Avatar
 
Join Date: 10-12-03
Location: California
Posts: 254
iTrader: 0 / 0%
Latest Blog:
None

I like pie is a jewel in the roughI like pie is a jewel in the roughI like pie is a jewel in the roughI like pie is a jewel in the roughI like pie is a jewel in the roughI like pie is a jewel in the roughI like pie is a jewel in the roughI like pie is a jewel in the rough
Send a message via ICQ to I like pie Send a message via AIM to I like pie Send a message via MSN to I like pie Send a message via Yahoo to I like pie
session problem with redirect

A friend of mine is making a game and has it set up like one of mine (which works) but he's stuck on a problem with sessions. Our code is almost identical, but using redirect causes his problems and not mine.

Anyway, we've got 3 files. login.php, account.php, and _include_session.php

The way it's supposed to work is that login.php starts a session with the right data upon successful login, sends the user to account.php, which then includes session.php (as every page will) to check the access levels of the user among other things.

We've narrowed it down to the redirect in login.php:

<META HTTP-EQUIV="Refresh" CONTENT="0; URL=account.php">

The data is there right before that line, but when we try retreiving it in account.php we get nothing. We've tried scrapping the include and starting the session in the file itself, and still nothing. My guess is that he/we shouldn't be redirecting in that way but it's been working fine for me on many things I've done.

Any ideas on what the heck is going on?
__________________
Foohon Pie Productions
I like pie is offline  
Add Post to del.icio.us
Reply With Quote
Sponsored Links
SEO Hosting by HostGator  Advertise Here  Buy Blog Links
Old 08-18-2006, 11:41 AM   #2 (permalink)
Inactive
 
Join Date: 08-02-06
Location: Sweden
Posts: 34
iTrader: 0 / 0%
Latest Blog:
None

Litewebsite is liked by many
Send a message via Yahoo to Litewebsite
Just an idea, I'm not 100% sure but maybe the PHP function session_write_close() can help you. Use this function right after you have set the $_SESSION values.
Litewebsite is offline  
Add Post to del.icio.us
Reply With Quote
Old 08-18-2006, 01:13 PM   #3 (permalink)
Inactive
 
Join Date: 08-18-06
Location: Netherlands
Posts: 6
iTrader: 0 / 0%
Latest Blog:
None

frank9999 is liked by many
Send a message via MSN to frank9999
hi, i'm I like pie's friend. i tryed that PHP function session_write_close(), but this isn't work.
frank9999 is offline  
Add Post to del.icio.us
Reply With Quote
Old 08-19-2006, 02:26 PM   #4 (permalink)
Inactive
 
Join Date: 08-02-06
Location: Sweden
Posts: 34
iTrader: 0 / 0%
Latest Blog:
None

Litewebsite is liked by many
Send a message via Yahoo to Litewebsite
Another try

If you are ok with session cookies I think this will solve the lost session. Notice the ini_set().

Page 1
PHP Code:
ini_set('session.use_cookies'1);
session_start();
$_SESSION['TEST'] = 'Redirect';
session_write_close(); 
Page 2
PHP Code:
ini_set('session.use_cookies'1);
session_start();
print_r($_SESSION); // print session 
Hope this will help you.
Litewebsite is offline  
Add Post to del.icio.us
Reply With Quote
Old 08-20-2006, 12:58 PM   #5 (permalink)
Inactive
 
Join Date: 08-18-06
Location: Netherlands
Posts: 6
iTrader: 0 / 0%
Latest Blog:
None

frank9999 is liked by many
Send a message via MSN to frank9999
session cookie is stored in temporary memory of your computer, is there no way to do it with sessions only?
frank9999 is offline  
Add Post to del.icio.us
Reply With Quote
Old 08-21-2006, 03:51 AM   #6 (permalink)
Inactive
 
Join Date: 08-02-06
Location: Sweden
Posts: 34
iTrader: 0 / 0%
Latest Blog:
None

Litewebsite is liked by many
Send a message via Yahoo to Litewebsite
You could place the session id (SID) in the redirect url.

PHP Code:
<?php
echo '<meta http-equiv="refresh" content="0; url=sessionLost2.php?'.SID.'">';
?>
Litewebsite is offline  
Add Post to del.icio.us
Reply With Quote
Old 08-21-2006, 08:10 AM   #7 (permalink)
Inactive
 
Mrblogs's Avatar
 
Join Date: 03-29-06
Posts: 548
iTrader: 0 / 0%
Mrblogs is just really niceMrblogs is just really niceMrblogs is just really niceMrblogs is just really niceMrblogs is just really niceMrblogs is just really niceMrblogs is just really niceMrblogs is just really niceMrblogs is just really niceMrblogs is just really niceMrblogs is just really nice
Send a message via MSN to Mrblogs Send a message via Yahoo to Mrblogs
It isn't something silly like forgetting to use session_start() is it?
Mrblogs is offline  
Add Post to del.icio.us
Reply With Quote
Old 08-23-2006, 04:38 AM   #8 (permalink)
Inactive
 
Join Date: 08-18-06
Location: Netherlands
Posts: 6
iTrader: 0 / 0%
Latest Blog:
None

frank9999 is liked by many
Send a message via MSN to frank9999
the session id (SID) in the redirect url isn't working too

and i didn't forget the session_start()
frank9999 is offline  
Add Post to del.icio.us
Reply With Quote
Old 08-23-2006, 05:30 AM   #9 (permalink)
Inactive
 
Mrblogs's Avatar
 
Join Date: 03-29-06
Posts: 548
iTrader: 0 / 0%
Mrblogs is just really niceMrblogs is just really niceMrblogs is just really niceMrblogs is just really niceMrblogs is just really niceMrblogs is just really niceMrblogs is just really niceMrblogs is just really niceMrblogs is just really niceMrblogs is just really niceMrblogs is just really nice
Send a message via MSN to Mrblogs Send a message via Yahoo to Mrblogs
try using header("location:")

instead of meta redirect?
Mrblogs is offline  
Add Post to del.icio.us
Reply With Quote
Old 08-27-2006, 08:59 AM   #10 (permalink)
Inactive
 
Join Date: 08-18-06
Location: Netherlands
Posts: 6
iTrader: 0 / 0%
Latest Blog:
None

frank9999 is liked by many
Send a message via MSN to frank9999
i tryed that, but still nothing
frank9999 is offline  
Add Post to del.icio.us
Reply With Quote
Old 08-27-2006, 06:53 PM   #11 (permalink)
Contributing Member
 
helloworld's Avatar
 
Join Date: 06-29-06
Posts: 72
iTrader: 0 / 0%
Latest Blog:
None

helloworld is liked by somebodyhelloworld is liked by somebodyhelloworld is liked by somebodyhelloworld is liked by somebodyhelloworld is liked by somebody
$_SESSION['name'] = true;

session_write_close ();

header ( 'location: webpage.php' );

exit ();
helloworld is offline  
Add Post to del.icio.us
Reply With Quote
Old 08-28-2006, 03:39 AM   #12 (permalink)
Inactive
 
Join Date: 08-18-06
Location: Netherlands
Posts: 6
iTrader: 0 / 0%
Latest Blog:
None

frank9999 is liked by many
Send a message via MSN to frank9999
that header ( 'location: account.php' ); isn't working here. i get a white empty login.php after i logged in
frank9999 is offline  
Add Post to del.icio.us
Reply With Quote
Old 08-28-2006, 04:59 AM   #13 (permalink)
Inactive
 
Join Date: 08-02-06
Location: Sweden
Posts: 34
iTrader: 0 / 0%
Latest Blog:
None

Litewebsite is liked by many
Send a message via Yahoo to Litewebsite
The "empty page" could hold some valueable header information (http status codes) but the browser or firewall may prevent redirection(?). To check what headers are sent out you could use http://livehttpheaders.mozdev.org/ which works with Firefox.

If we go back to sessions can you see if the sessions are being stored in session.save_path ?

We must solve this problem for you! :-)
Litewebsite is offline  
Add Post to del.icio.us
Reply With Quote
Old 08-29-2006, 08:20 AM   #14 (permalink)
Inactive
 
Mrblogs's Avatar
 
Join Date: 03-29-06
Posts: 548
iTrader: 0 / 0%
Mrblogs is just really niceMrblogs is just really niceMrblogs is just really niceMrblogs is just really niceMrblogs is just really niceMrblogs is just really niceMrblogs is just really niceMrblogs is just really niceMrblogs is just really niceMrblogs is just really niceMrblogs is just really nice
Send a message via MSN to Mrblogs Send a message via Yahoo to Mrblogs
Failing that...

create a database table.. with 2 fields, an ID and a Data field.

on the page that you want to store the info on..

INSERT the data into that database table, and obtain the ID back.

Then just appnd the ID to the url (ie ?thisID=4)

then re-read the data back from the database on the next page, delete the entry and re-store the session?
Mrblogs is offline  
Add Post to del.icio.us
Reply With Quote
Old 08-29-2006, 08:25 AM   #15 (permalink)
Inactive
 
Join Date: 08-18-06
Location: Netherlands
Posts: 6
iTrader: 0 / 0%
Latest Blog:
None

frank9999 is liked by many
Send a message via MSN to frank9999
thanks guys for all your help, it's working now
frank9999 is offline  
Add Post to del.icio.us
Reply With Quote
Go Back   Webmaster Forum > Web Development > Web Design Lobby > Coding Forum

Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
.htaccess redirect problem..! Immo Coding Forum 16 08-03-2006 04:02 AM
Coding Problem URL redirect Chris1974 Coding Forum 5 04-04-2006 07:49 AM
Small Apache redirect problem waqqas31 Dedicated Servers 4 05-31-2004 05:41 PM
**edit** now a problem with redirect ** space in page url jacksdad Web Design Lobby 13 05-21-2004 09:01 PM
Redirect Problem Cibok Web Design Lobby 1 11-29-2003 03:29 PM


Sponsor Links
Get exposure! Get exposure! Find Scripts Web Hosting Directory Get exposure! SEO Blog


All times are GMT -7. The time now is 05:29 AM.
© Copyright 2008 V7 Inc