NamePros
Welcome, Guest! Ready to make a name for yourself in the domain business? We welcome both the hobbyist and professional domainer to join the discussion as part of the NamePros community.

Click here to create your profile to start earning reputation for posting, and trader ratings for buying & selling in our free e-marketplace. Build your trader rating with each successful sale. Our system has tracked over 100,000 sales and counting!
FAQ & TOS Register Search Today's Posts Mark Forums Read

Go Back   NamePros.com > Website Development Discussion Forums > Programming
Reload this Page eh?

Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics.

Advanced Search
5 members in live chat ~  


Closed Thread
 
LinkBack Thread Tools
Old 10-03-2003, 11:53 AM THREAD STARTER               #1 (permalink)
Senior Member
Join Date: May 2003
Posts: 2,187
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");
????: NamePros.com http://www.namepros.com/programming/15333-eh.html

$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
adam_uk is offline  
Old 10-03-2003, 03:18 PM   #2 (permalink)
NamePros Member
Join Date: Jul 2003
Posts: 118
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:

????: NamePros.com http://www.namepros.com/showthread.php?t=15333
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" 
????: NamePros.com http://www.namepros.com/showthread.php?t=15333
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  
Old 10-04-2003, 02:29 AM THREAD STARTER               #3 (permalink)
Senior Member
Join Date: May 2003
Posts: 2,187
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  
Closed Thread


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


 
All times are GMT -7. The time now is 02:05 PM.

Domain name forum recommended by Domaining.com Powered by: vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.6.0 Ad Management plugin by RedTyger