Be a Supporter!

Permanently Changing a Page

  • 450 Views
  • 11 Replies
New Topic Respond to this Topic
Snubby
Snubby
  • Member since: Dec. 4, 2004
  • Offline.
Forum Stats
Member
Level 21
Game Developer
Permanently Changing a Page 2006-11-11 22:40:49 Reply

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
Response to Permanently Changing a Page 2006-11-11 22:43:51 Reply

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.


BBS Signature
Snubby
Snubby
  • Member since: Dec. 4, 2004
  • Offline.
Forum Stats
Member
Level 21
Game Developer
Response to Permanently Changing a Page 2006-11-11 22:49:37 Reply

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
Response to Permanently Changing a Page 2006-11-11 22:57:22 Reply

I really would prefer to do it myself.

Jessii
Jessii
  • Member since: Feb. 10, 2005
  • Offline.
Forum Stats
Member
Level 36
Movie Buff
Response to Permanently Changing a Page 2006-11-12 08:29:07 Reply

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
Response to Permanently Changing a Page 2006-11-12 09:01:29 Reply

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
Response to Permanently Changing a Page 2006-11-12 10:12:15 Reply

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);
?>

Jessii
Jessii
  • Member since: Feb. 10, 2005
  • Offline.
Forum Stats
Member
Level 36
Movie Buff
Response to Permanently Changing a Page 2006-11-12 11:10:08 Reply

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
Response to Permanently Changing a Page 2006-11-12 21:29:14 Reply

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
Response to Permanently Changing a Page 2006-11-12 22:24:29 Reply

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
Response to Permanently Changing a Page 2006-11-12 23:02:47 Reply

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.


BBS Signature
Jessii
Jessii
  • Member since: Feb. 10, 2005
  • Offline.
Forum Stats
Member
Level 36
Movie Buff
Response to Permanently Changing a Page 2006-11-13 07:29:59 Reply

At 11/12/06 11:02 PM, DFox wrote: although I'd like to know why it was deleted.

That would be nice.