Permanently Changing a Page
- Snubby
-
Snubby
- Member since: Dec. 4, 2004
- Offline.
-
- Forum Stats
- Member
- Level 21
- Game Developer
I feel like an idiot with all these questions... really, I'm more of an actionscripter. Anyway, say more example I had a shoutbox like that of NG. Where the user could just input a line and it would appear on the main page or whatever.
I can do that using POST, but that just changes it for the person who just did it. How can I permanently change the page, so that it is there until the next person shouts?
- DFox
-
DFox
- Member since: Aug. 9, 2003
- Offline.
-
- Forum Stats
- Member
- Level 30
- Blank Slate
At 11/11/06 10:40 PM, Snubby wrote: I can do that using POST, but that just changes it for the person who just did it. How can I permanently change the page, so that it is there until the next person shouts?
You'll need to either use a database (like MySQL), or a flat file. If you have no experience with MySQL, a flat file would probably be the easiest.
If you're running PHP 5, you can just use these two functions:
http://us2.php.net/manual/en/function.file-ge t-contents.php
http://us2.php.net/manual/en/function.file-pu t-contents.php
And if you don't have PHP 5, you can use this:
http://us2.php.net/manual/en/function.fwrite. php
If you're going to have a lot of traffic, the better option would probably be MySQL, but for something as simple as what you're doing, a text file would work.
- Snubby
-
Snubby
- Member since: Dec. 4, 2004
- Offline.
-
- Forum Stats
- Member
- Level 21
- Game Developer
I don't understand how to use the fwrite, still. I open the file, and have it writable and readable, and then how do I write to it? What is that $handle they were using?
- Snubby
-
Snubby
- Member since: Dec. 4, 2004
- Offline.
-
- Forum Stats
- Member
- Level 21
- Game Developer
I really would prefer to do it myself.
- Jessii
-
Jessii
- Member since: Feb. 10, 2005
- Offline.
-
- Forum Stats
- Member
- Level 36
- Movie Buff
http://www.newgrounds.com/bbs/topic.php?id=41 5283 Shoutbox for MySQL, there's also a flat file shoutbox tutorial in PHP: Main too.
- Jordan
-
Jordan
- Member since: Apr. 23, 2006
- Offline.
-
- Forum Stats
- Member
- Level 14
- Blank Slate
At 11/12/06 08:29 AM, Jessii wrote: there's also a flat file shoutbox tutorial in PHP: Main too.
That tutorial got deleted.
- rmbrstrongbad18
-
rmbrstrongbad18
- Member since: Dec. 23, 2005
- Offline.
-
- Forum Stats
- Member
- Level 06
- Blank Slate
Use a string to fwrite something. First, you put the variable for the file to open and which method to open it, and then you put the string. For example:
<?php
$file = fopen("file.htm", "a");
$input = "Hey";
fwrite($file, $input);
?>
Anyone need a voice actor?
http://www.newgrounds.com/audio/lis ten/251414
- Jessii
-
Jessii
- Member since: Feb. 10, 2005
- Offline.
-
- Forum Stats
- Member
- Level 36
- Movie Buff
At 11/12/06 09:01 AM, Jordan wrote: That tutorial got deleted.
Wow! It was still in the link update and I didn't check to see if it was still there. Oh well! Just use the SQL tutorial then Snubby :)
- Snubby
-
Snubby
- Member since: Dec. 4, 2004
- Offline.
-
- Forum Stats
- Member
- Level 21
- Game Developer
At 11/12/06 10:12 AM, rmbrstrongbad18 wrote: Use a string to fwrite something. First, you put the variable for the file to open and which method to open it, and then you put the string. For example:
<?php
$file = fopen("file.htm", "a");
$input = "Hey";
fwrite($file, $input);
?>
wow... that clears things up! Thanks!
- Snubby
-
Snubby
- Member since: Dec. 4, 2004
- Offline.
-
- Forum Stats
- Member
- Level 21
- Game Developer
Thanks guys, I got it workin! Now people can review my content on my website: http://www.snubbyland.com/content/content.php
thanks yall.
- DFox
-
DFox
- Member since: Aug. 9, 2003
- Offline.
-
- Forum Stats
- Member
- Level 30
- Blank Slate
At 11/12/06 11:10 AM, Jessii wrote:At 11/12/06 09:01 AM, Jordan wrote: That tutorial got deleted.Wow! It was still in the link update and I didn't check to see if it was still there. Oh well! Just use the SQL tutorial then Snubby :)
Yeah, it was brought to my attention a few weeks ago, but there's been no update since then. It'll be gone in next update, although I'd like to know why it was deleted.
- Jessii
-
Jessii
- Member since: Feb. 10, 2005
- Offline.
-
- Forum Stats
- Member
- Level 36
- Movie Buff
At 11/12/06 11:02 PM, DFox wrote: although I'd like to know why it was deleted.
That would be nice.


