A Flash Developer Resource Site

Results 1 to 6 of 6

Thread: use PHP to edit txt

  1. #1
    the cheesy child bounceboy's Avatar
    Join Date
    Dec 2008
    Location
    Australia
    Posts
    323

    Exclamation use PHP to edit txt

    Hi guys, i have found a solution to making a chatroom...

    i have a PHP script right? it says:

    PHP Code:
    <?php
    //Reading the file
    $file fopen("count.txt""r");
    $count fread($file1024);
    fclose($file);
    //Increasing the count
    $count explode("="$count);
    $count[1] = $count[1]+1;
    //Writing to file
    $file fopen("count.txt""w+");
    fwrite($file"count=".$count[1]);
    fclose($file);
    //Returning the count
    print "count=".$count[1];
    ?>
    that is PHP 3 code and what it does is it makes a textfile's variable called 'count' go up one. i use loadVariables to load this script into flash.

    i don't have a proper understanding of PHP so i would like somebody to change this so that:

    there is a variable inside called "mes". what i want to do is make it so that the variable mes is the message that somebody sends. i want to write this variable into the txt file, replacing the previous one.


    please help, this solved will let me make a chatroom thank you to anybody who helps

  2. #2
    FK'n_dog a_modified_dog's Avatar
    Join Date
    Apr 2003
    Location
    "aaarf"
    Posts
    9,176
    http://www.jackleaman.co.uk/test/wri..._autoLoad.html

    see if you can make use of the logic in this file

    in a nutshell -
    type your message
    send to php
    overwrite the text file
    reload text to Flash and display

  3. #3
    the cheesy child bounceboy's Avatar
    Join Date
    Dec 2008
    Location
    Australia
    Posts
    323
    i am trying to find out the exact PHP script, i thought somebody could use the script i posted to change it...

    but that link is great...
    it'll help me make a guestbook!

    i still want to make a chatroom though!!!


    that link isn't so great after all... it won't even let me download it!
    Last edited by bounceboy; 04-10-2009 at 09:46 PM.

  4. #4
    |-'|-'|
    Join Date
    Jan 2006
    Posts
    273
    it's the same idea. I made a shoutbox using guestbook based php and a text file years ago. I just add a secondary variable for last post time. so if previous reload time is less than last post time, reload. So it kind of looks like a chatroom. When posting, rather than taking straight from flash += last post, you load the text file and write it in one go so you don't overwrite someone else's post at last second. One problem is when the text file gets really long, it will start to slow down. just be creative with them code.

  5. #5
    the cheesy child bounceboy's Avatar
    Join Date
    Dec 2008
    Location
    Australia
    Posts
    323
    i am only passing one variable and its the last message sent.

    unfortunately it isn't working as planned, so i am going to check out a_modified_dog's zip!

  6. #6
    the cheesy child bounceboy's Avatar
    Join Date
    Dec 2008
    Location
    Australia
    Posts
    323
    hmmm.... this chatroom seems to not work. i think i will need somebody to help me write the php and flash script.
    sorry people!
    i am still getting the hang of php
    and its hard for flash to work with php!
    i looked at the zip but it isn't seeming to work???

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center