Flash Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsWeb DesignFlash Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old March 1st, 2003, 01:45 AM
cSean cSean is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2003
Posts: 12 cSean User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via AIM to cSean
Flash +php News?

I'm pretty effecient when it comes to flash and AS, but I really don't know anything about php or perl, or mySQL, and such. What I'd really like to be able to do is have users login to a secure section of a flash site, and then be able to append (or even better, add to the top) of a txt or xml file, so I could read that into flash and display its data (I know how to do that part) What I have no clue whatsoever about is sending the info and retrieving the data, using php, or perl, or any of those scripting languages.

Does anyone have an example they could show me? Or even better, explain to me how to build one, I'd really appreciate the help. Thanks everyone.

(my server has php, perl, mysql, all that good stuff )

Reply With Quote
  #2  
Old March 1st, 2003, 02:29 AM
JCMerlin JCMerlin is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2003
Posts: 126 JCMerlin User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 14 m 29 sec
Reputation Power: 6
Im gonna assume you are using flash MX.... to send and load variables out of flash to a php script or perl script, you need to do the following....

Code:
var1 = "text to send";
var2 = "more text to send";
URL = "http://yourdomain.com/yourphpscript.php";
varObject = new LoadVars();
varObject.username = var1;
varObject.password = var2;
varObject.sendAndLoad(URL,this,"POST");
varObject.onLoad = function(){
     //do stuff with loaded variables here.... ill explain how to get them here in just a second. 
}

Make a php or perl script to parse the info and check it against a text file or an sql database (depending on how many people you expect to visit) and send the info back to the browser... in php its done like this......

PHP Code:
echo "&username=$username&passCorrect=$passCorrect"


in perl
PHP Code:
print "&username=$username&passCorrect=$passCorrect"


Those should be the responses to your browser after the flash movie makes a query to that file. in both cases '$username' is equal to the username passed to the file and '$passCorrect' is a boolean to wether or not the user supplied a valid password. Once this data is back into flash access it like so...

Code:
// continue from where we left off.....
varObject.onLoad = function(){
    if (varObject.passCorrect){
          gotoAndPlay("loggedIn");
 }
}


Let me know if you have any further questions.. id love to help you out if ya need anything.

JCMerlin@sbcglobal.net

Reply With Quote
  #3  
Old March 1st, 2003, 03:30 AM
cSean cSean is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2003
Posts: 12 cSean User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via AIM to cSean
Thanks for the info JC, but the main part of my question was after logging in, I want a person to be able to enter text into an input text field, and then have that text sent as a string to a php or perl script that would then append (or even better, place at the top) that data to an xml or txt file. The problem is, I don't know how to write php or perl, so if anyone could help me with that part or direct me to a working open source code so I could view and learn from that, I'd really appreciate it. Thanks again

Reply With Quote
  #4  
Old March 1st, 2003, 04:29 AM
JCMerlin JCMerlin is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2003
Posts: 126 JCMerlin User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 14 m 29 sec
Reputation Power: 6
sorry, lost track :\ ...
create a file for the text and name it whatever... for the sake of it ill call it news.txt and it will be placed in the same directory as the perl file. Also, the name of the text field that your users will type in i called 'textField'.
Code:
#!/usr/bin/perl -wT 
use strict;
use CGI;
use Fcntl qw(:DEFAULT :flock);
my ($str,@lines);
$str = param('textField');
open(F,"+<news.txt") || die "Couldnt open news.txt. $!";
flock(F,LOCK_EX);
@lines = <F>;
print F ($str . @lines);
truncate(F, tell(F));
close <F>;
   


Try that...... :\ btw, dont let the stupid smily thing up there confuse ya... its a : followed by a D

Reply With Quote
  #5  
Old March 1st, 2003, 04:35 AM
cSean cSean is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2003
Posts: 12 cSean User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via AIM to cSean
Ah that looks great, I'll give it a shot and let ya know, thanks!

Reply With Quote
  #6  
Old March 1st, 2003, 04:38 AM
JCMerlin JCMerlin is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2003
Posts: 126 JCMerlin User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 14 m 29 sec
Reputation Power: 6
crap, one change......

Code:
print F ($str . "/n" . @lines);

Reply With Quote
  #7  
Old December 8th, 2003, 02:24 PM
dessau dessau is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2003
Posts: 30 dessau User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 5
php alternative?

Is there a php alternative to this perl script?

I've been trying to find a way of outputting a flash readable text file using php, and a pared down html front end, a simple cms thing.

I basically want to be able to go to an htaccess directory with a simple html form in, with input boxes for title and news content, and when the form is submitted it boots out the correctly formatted text file news.txt which i can then move to the directory running my flash movie.

The only other way I can think of this is thru a complex mod of one of those flash guestbook tutorials, but that seems a bit extreme for what I'm after.

thanks in advance

d.

Reply With Quote
Reply

Viewing: Dev Shed ForumsWeb DesignFlash Help > Flash +php News?


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway
Stay green...Green IT