By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,775 Members | 1,306 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,775 IT Pros & Developers. It's quick & easy.

Session...

P: n/a
Sa
Hi, all

i must say that i'm new in using sessions and i though i understood the
meaning work of them..
but i have such script that don't do properly what i want.

Its really a simple store of a variable counter...

i firstly use:

session_start();

$f=fopen("count","rb");
$count = fread($f,5000);
fclose($f);

if(session_is_registered($count)){
$count = $count + 1;
}
session_register("count");
but it never jump the if...meaning that is always registered...
some help?
thank you

Jul 17 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
*** Sa wrote/escribió (Mon, 09 May 2005 21:51:46 GMT):
session_start();

$f=fopen("count","rb");
$count = fread($f,5000);
fclose($f);

if(session_is_registered($count)){
$count = $count + 1;
}
session_register("count");


You are using deprecated functions. You'd better read and write session
data using the $_SESSION associative array.

<?

session_start();

.....

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

?>
--
-- Álvaro G. Vicario - Burgos, Spain
-- http://bits.demogracia.com - Mi sitio sobre programación web
-- Don't e-mail me your questions, post them to the group
--
Jul 17 '05 #2

P: n/a
*** Alvaro G Vicario wrote/escribió (Tue, 10 May 2005 12:47:34 +0200):
}else{
$_SESSION['count']=0;
}


Sorry, I didn't really check what your script does. I guess this doesn't
make sense xD
--
-- Álvaro G. Vicario - Burgos, Spain
-- http://bits.demogracia.com - Mi sitio sobre programación web
-- Don't e-mail me your questions, post them to the group
--
Jul 17 '05 #3

P: n/a
Sa
Yes, it was right this the trouble.
Deprecated functions.
Now all is working.
My script is a simple counter.
Thank you for the hint.

cheers
Jul 17 '05 #4

P: n/a
Sa
Yes, it was right this the trouble.
Deprecated functions.
Now all is working.
My script is a simple counter.
Thank you for the hint.

cheers
Jul 17 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.