[advanced search]
Results from the most recent live auction are here.
11 members in the live chat room. Join Chat!
Register Rules & FAQ NP$ Store Active Threads Mark Forums Read
Go Back   NamePros.Com > Design and Development > Programming
User Name
Password

Old 10-03-2003, 11:53 AM   · #1
adam_uk
Senior Member
 
Trader Rating: (17)
Join Date: May 2003
Posts: 2,211
NP$: 6170.25 (Donate)
adam_uk is a jewel in the roughadam_uk is a jewel in the roughadam_uk is a jewel in the rough
Breast Cancer
eh?

hey kinda trying to get to grips with sessions (not getting very far)

i run this script;
PHP Code:
<?php

session_start
();

session_register("count");

$count++;

echo
"$count";


?>


as it says in the book and i get this error

Quote:
Warning: Unknown(): Your script possibly relies on a session side-effect which existed until PHP 4.2.3. Please be advised that the session extension does not consider global variables as a source of data, unless register_globals is enabled. You can disable this functionality and this warning by setting session.bug_compat_42 or session.bug_compat_warn to off, respectively. in Unknown on line 0



ive looked through php.ini and everything seems to be ok i dont really want to turn register.globals on as its bad programming (or so people say) or is it that i have my error reporting to high?

[EDIT] I changed the error reporting as it says in the error but it didnt sort the porblem (as i thought it wouldnt)

also i uploaded the script the my web host and it worked fine

http://adamuk.kicks-ass.org/phpinfo.php is my phpinfo
http://www.bassment.net/phpinfo.php is my hosts phpinfo


[/EDIT]


any ideas to what im doing wrong?

the server is running

apache 1
windows 2000 server
php-4.3.3

cheers
adam


Please register or log-in into NamePros to hide ads
adam_uk is offline   Reply With Quote
Old 10-03-2003, 03:18 PM   · #2
web guru
NamePros Member
 
Trader Rating: (0)
Join Date: Jul 2003
Posts: 120
NP$: 185.00 (Donate)
web guru is an unknown quantity at this point
This is a very delicate area, as of php4. Your local server if running php4 where your online server prob is running php3. Thats why it works onlin and not on your local server.

Try doing sessions this way

PHP Code:
session_start();


if(isset(
$_SESSION['count'] )){
    
$count = $_SESSION['count'];
    
$count++;
    
$_SESSION['count'] = $count;
}
else{
    
$count = 0;
    
$_SESSION['count'] = $count;
}

if(isset(
$_SESSION['count'] )){
    echo
$_SESSION['count'];
}


Instead of using
PHP Code:
session_register("count")
use
PHP Code:
$_SESSION['count']="whatever"


The only way your code will work is if you turn register_globals on, which as you say is bad practic but it also brings up a lot of security issues!!

Let me know if this is of any help at all.
web guru is offline   Reply With Quote
Old 10-04-2003, 02:29 AM   · #3
adam_uk
Senior Member
 
Trader Rating: (17)
Join Date: May 2003
Posts: 2,211
NP$: 6170.25 (Donate)
adam_uk is a jewel in the roughadam_uk is a jewel in the roughadam_uk is a jewel in the rough
Breast Cancer
hehe cheers mate

worked
adam_uk is offline   Reply With Quote
Closed Thread

NamePros is a revenue sharing forum.

Thread Tools

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
Forum Jump


Site Sponsors
Proof is in the Parking NameChatter domainsubway.com
Advertise your business at NamePros
All times are GMT -7. The time now is 05:04 AM.


Powered by: vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 2.4.0