GetDotted Domains

Viewing Thread:
"PHP for incrementing a variable please."

The "Freeola Customer Forum" forum, which includes Retro Game Reviews, has been archived and is now read-only. You cannot post here or create a new thread or review on this forum.

Sat 31/05/03 at 16:07
Regular
Posts: 787
I'd look it up myself, but you people are so much help :D

PS, I'll show you why this afternoon sometime!
Sat 31/05/03 at 16:55
Regular
"Eff, you see, kay?"
Posts: 14,156
You need to make sure the file is world-readable (666), done that?
Sat 31/05/03 at 16:54
Regular
"Pouch Ape"
Posts: 14,499
Looks like the last three lines of the code - is that "w+" meant to be there?
Sat 31/05/03 at 16:53
Regular
"Pouch Ape"
Posts: 14,499
The errors:

Warning: fopen(users.data) [function.fopen]: failed to create stream: Permission denied in /freeola/users/3/1/sr0113/htdocs/check.php on line 50

Warning: fwrite(): supplied argument is not a valid stream resource in /freeola/users/3/1/sr0113/htdocs/check.php on line 51

Warning: fclose(): supplied argument is not a valid stream resource in /freeola/users/3/1/sr0113/htdocs/check.php on line 52

The code (it's in amongst other code that works):

$filename = "users.data";
$fp = fopen($filename,"r");
$counterval = fread($fp, filesize($filename));
fclose($fp);
$counterval = (integer)$counterval + 1;
$fp = fopen($filename,"w+");
fwrite($fp, $counterval, 26);
fclose($fp);
Sat 31/05/03 at 16:50
Regular
"Eff, you see, kay?"
Posts: 14,156
Oh yeah, and if it refers to a line number, make sure you tell us what line :)
Sat 31/05/03 at 16:50
Regular
"Eff, you see, kay?"
Posts: 14,156
Okay, remove all the @s and paste the errors.
Sat 31/05/03 at 16:49
Regular
"Pouch Ape"
Posts: 14,499
Hmmm. I don;t get an error where I was before, but the users.data file hasn't changed from "0" and it's not including either.
Sat 31/05/03 at 16:44
Regular
"Eff, you see, kay?"
Posts: 14,156
@s are for people with skillz.

Or maybe for people without skillz... whatever. Anyway, they supress errors and warnings, which is bloody useful when you have a function that works as you want it to but displays a warning about something or other.
Sat 31/05/03 at 16:43
Regular
"Pouch Ape"
Posts: 14,499
What's with all the @'s?
Sat 31/05/03 at 16:41
Regular
"Eff, you see, kay?"
Posts: 14,156

$filename = ""; // relative path to the hits file (must have 666 perm
issions)

$fp = @fopen($filename,"r");
$counterval = @fread($fp, filesize($filename));
@fclose($fp);
$counterval = (integer)$counterval + 1;
$fp = @fopen($filename,"w+");
@fwrite($fp, $counterval, 26);
@fclose($fp);

?>

Then you can just slap in wherever.
Sat 31/05/03 at 16:37
Regular
"Pouch Ape"
Posts: 14,499
OK, I have a file called "users.data". This needs to be opened, incremented, closed and then it's displayed somewhere. what you've said here all makes sense, but it's just not working!!! My permissions are right and the code is good, but the outcome is bad :(

Freeola & GetDotted are rated 5 Stars

Check out some of our customer reviews below:

Thanks!
Thank you for dealing with this so promptly it's nice having a service provider that offers a good service, rare to find nowadays.
Very pleased
Very pleased with the help given by your staff. They explained technical details in an easy way and were patient when providing information to a non expert like me.

View More Reviews

Need some help? Give us a call on 01376 55 60 60

Go to Support Centre
Feedback Close Feedback

It appears you are using an old browser, as such, some parts of the Freeola and Getdotted site will not work as intended. Using the latest version of your browser, or another browser such as Google Chrome, Mozilla Firefox, or Opera will provide a better, safer browsing experience for you.