Code Newbie
News     Forums     Search     Members     Sign Up    

My Code Newbie
Username

Password

Articles/Snippets
ASP Classic
ASP.NET
C
C#
C++
HTML / CSS
Java
Javascript
Linux / BSD
Perl
PHP
Python
Ruby
SQL
VB 6
VB.NET

C.N. Friends
  Planet Rome

Link to Us!
Code Newbie
  Code Newbie
    forums
Old 11-28-2006, 11:23 PM   #1 (permalink)
grimpirate
Recruit
 
grimpirate's Avatar
 
Join Date: Nov 2006
Posts: 6
grimpirate is on a distinguished road
Send a message via Yahoo to grimpirate
Question Session Question

Here's an example which I tested on my home computer (which works) and on my webserver (which fails).
test1.php
PHP Code:
<?php
session_start
();
$_SESSION['test'] = 'haha';
?>
<html>
<head>
<meta http-equiv="refresh" content="1;test2.php">
</head>
<body>
</body>
</html>
test2.php
PHP Code:
<?php
session_start
();
?>
<html>
<head>
</head>
<body>
<?php
if(IsSet($_SESSION['test'])){
    echo 
'SET';
}
?>
</body>
</html>
The string SET is not echoed onto the browser in test2.php on my web browser.
grimpirate is offline   Reply With Quote
Old 11-29-2006, 12:05 AM   #2 (permalink)
DJMaze
Senior Contributor
 
DJMaze's Avatar
 
Join Date: Mar 2005
Posts: 651
DJMaze is on a distinguished road
PHP Code:
<?php
error_reporting
(E_ALL);

if (
session_id()) {
    echo 
'session already started';
} else {
    
session_start();
    
$_SESSION['test'] = 'haha';
    echo 
'session started';
}
__________________

UT: Ultra-kill... God like!
DJMaze is offline   Reply With Quote
Old 11-29-2006, 02:49 PM   #3 (permalink)
grimpirate
Recruit
 
grimpirate's Avatar
 
Join Date: Nov 2006
Posts: 6
grimpirate is on a distinguished road
Send a message via Yahoo to grimpirate
I gave up on getting that session stuff to work. It was working before and just suddenly stopped and rather than dealing with it I just gave up. Rather than using sessions I'll just store cookies on my server which recognize people by their IP. Already been done and the code I had working with sessions previously now works that way. Not necessarily an effective workaround, but I think it will prove pretty useful in its own right. I needed to get something done so that the forum I was coding would still be functional. I think this will be more compatible with PHP servers rather than using sessions as a lot of them restrict this option.
grimpirate is offline   Reply With Quote
Old 11-29-2006, 07:47 PM   #4 (permalink)
sde
Moderator
 
sde's Avatar
 
Join Date: May 2002
Location: us.ca
Posts: 4,444
sde is on a distinguished road
who restricts sessions? they are built into php. what could be easier?
__________________
Mike
sde is offline   Reply With Quote
Old 11-29-2006, 09:35 PM   #5 (permalink)
grimpirate
Recruit
 
grimpirate's Avatar
 
Join Date: Nov 2006
Posts: 6
grimpirate is on a distinguished road
Send a message via Yahoo to grimpirate
A place where I used to post would prevent you from messing with the header data of a page. Even if it's built in you can disengage its functionality.
grimpirate is offline   Reply With Quote
Old 11-29-2006, 10:32 PM   #6 (permalink)
sde
Moderator
 
sde's Avatar
 
Join Date: May 2002
Location: us.ca
Posts: 4,444
sde is on a distinguished road
was it a free host? anyone would be a fool to be paying for web hosting that doesn't enable session use.
__________________
Mike
sde is offline   Reply With Quote
Old 11-30-2006, 10:53 AM   #7 (permalink)
grimpirate
Recruit
 
grimpirate's Avatar
 
Join Date: Nov 2006
Posts: 6
grimpirate is on a distinguished road
Send a message via Yahoo to grimpirate
Yes it's a free host. The only means of the poor. Check out my other post about a PHP Forum that's what I'm talking about.
grimpirate is offline   Reply With Quote
Old 11-30-2006, 12:03 PM   #8 (permalink)
sde
Moderator
 
sde's Avatar
 
Join Date: May 2002
Location: us.ca
Posts: 4,444
sde is on a distinguished road
good hosting accounts can be had for less than five bucks a month. how much do 'poor' people pay for computers and their monthly internet fees?

cookieing people by IP isn't going to do the site owners much good since there could be multiple people visiting your site from their sites from the same ip. (offices, schools, proxies, etc..)
__________________
Mike
sde is offline   Reply With Quote
Old 12-01-2006, 12:07 AM   #9 (permalink)
grimpirate
Recruit
 
grimpirate's Avatar
 
Join Date: Nov 2006
Posts: 6
grimpirate is on a distinguished road
Send a message via Yahoo to grimpirate
Us pirates don't pay for internet service, we pirate it off the airwaves ^_^. It doesn't just cookie by IP it creates a cookie which contains the following information
username RECORD SEPARATOR CHARACTER ip
with a unique filename computed by taking the crc32 value of a the username the cookie can only be activated if you enter the username and pass at the login screen. It's unlikely (though possible) that two people using the same IP would know one another's screenname and at what exact times they've signed on.
grimpirate is offline   Reply With Quote
Reply

Bookmarks

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

BB 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
anyone know a lot? question concerns php also. Rotkiv HTML, XML, Javascript, AJAX 7 01-12-2006 12:09 PM
check if session variable is null? sde Java 3 07-07-2004 12:27 PM
session_start(): Cannot send session cookie learntophp PHP 2 06-18-2004 07:51 AM
DB Design Question Part II sde Program Design and Methods 3 05-10-2003 12:24 PM


All times are GMT -8. The time now is 07:40 PM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.0.0 RC8





Copyright © 2000-2008, Milano Interactive
Web Hosting provided by Portal 360 Web Hosting