PHP not working? - Page 3
A Flash Developer Resource Site

Page 3 of 7 FirstFirst 1234567 LastLast
Results 41 to 60 of 126

Thread: PHP not working?

  1. #41
    Registered User
    Join Date
    Jan 2003
    Location
    england
    Posts
    131
    Sybersnake: many thanks but I have in fact tried that too and it doesnt work.
    I did contact my hosting site to ask why i had an existing php/flash emailing system working fine on the site and suspected that the register_globals were on and not off like it was on my machine. I had developed the emailing php/flash thing a while ago ona nother machine and as this is a new machine i had to install apache and php etc anew and had my suspicions....

    Guess what. I was right.

    "register_globals are On , many scripts including oscommerce require them to be on, there are many features in php that are more secure set to off, but we have to compromise for usability
    "

    so, I am happy.
    i can set my register_globals to on also on my machine and check out if the thing works now, which I highly suspect
    -will.

    Please note other developers and fustrated hair yanking gurus, check with your hosting site first to see if they have their settings as mentioned, set to on and then set your own the same.

    Mind you its only by using all help given here and (falling on your face a thousand times!) does anyone finally get the right answer. having said that. i hope this is. LOL!

    "..and thats the way the cookie crumbles.."
    cheers!
    Shaf

  2. #42
    imagination through stupidity
    Join Date
    Apr 2001
    Location
    P3X-3113
    Posts
    1,238
    Originally posted by shafak cangil
    Sybersnake: many thanks but I have in fact tried that too and it doesnt work.
    I did contact my hosting site to ask why i had an existing php/flash emailing system working fine on the site and suspected that the register_globals were on and not off like it was on my machine. I had developed the emailing php/flash thing a while ago ona nother machine and as this is a new machine i had to install apache and php etc anew and had my suspicions....

    Guess what. I was right.

    "register_globals are On , many scripts including oscommerce require them to be on, there are many features in php that are more secure set to off, but we have to compromise for usability
    "

    so, I am happy.
    i can set my register_globals to on also on my machine and check out if the thing works now, which I highly suspect
    -will.

    Please note other developers and fustrated hair yanking gurus, check with your hosting site first to see if they have their settings as mentioned, set to on and then set your own the same.

    Mind you its only by using all help given here and (falling on your face a thousand times!) does anyone finally get the right answer. having said that. i hope this is. LOL!

    "..and thats the way the cookie crumbles.."
    cheers!
    Shaf
    It could be many things, it does work tho. I do such things often.

    Try posting your AS and PHP Code
    Nothing to see here, move along.

  3. #43
    Registered User
    Join Date
    Jan 2003
    Location
    england
    Posts
    131
    I have managed to get the flash/php combo working now on my hosting site. It takes up variables and plops them into the database just fine.
    I am now having trouble getting the php file to return variables to the flash thou.

    If I use:
    Sreturnmessage = "1";
    -it doesnt work.
    if I use:
    print"_root.returnmessage = 1";
    -it doesnt work,
    if I use:
    print "test = 1";
    any clues as to what it SHOULD be in order for the flash to see it?
    also i have an if statement like:
    if(returnmessage ==1)
    {
    gotoAndPlay(2); //there is an affirmative message there.
    }
    else
    {
    gotoAndPLay(3);//there is a no message there.
    }

    This is because the flash is all in one frame and I didn't know if I needed to loop it in order for 'returnmessage' to be seen again by flash or not.

    thanks:
    Shaf
    (but going really well otherwise)

  4. #44
    yet another non-working php.
    http://www.humanwine.com
    if you go to the muzik section and then click on of the song titles at the bottom to get the lyrics the page dims and just sits.

    iam am almost certain that my php is valid.

  5. #45
    Junior Member
    Join Date
    Jul 2004
    Posts
    9
    miscellaneum :
    Your page works fine for me on IE PC 6.0. The lysics show up as I click on the individual song titles.

  6. #46
    Senior Member
    Join Date
    Oct 2003
    Posts
    102

    PHP Version 4.3.8

    Yup this is the place to post this. My Flash to PHP to MySQL was working great with our old hosting company but now we need to move it. UGH

    So I started reading this chat and I made my phpinfo file and found out that its running php4.3.8. Yes my variables are not making it into the table. So can someone please recap what to do. Here is my PHP code (the one that used to work)

    <?
    include ('include.inc');

    mysql_connect($DBhost,$DBuser,$DBpass);
    @mysql_select_db("$DBName") or $results="mysql_error()";

    print "&results=" .$results;

    $fname=mysql_escape_string($fname);
    $lname=mysql_escape_string($lname);
    $email=mysql_escape_string($email);
    $address=mysql_escape_string($address);
    $city=mysql_escape_string($city);
    $state=mysql_escape_string($state);
    $zip=mysql_escape_string($zip);
    $age=mysql_escape_string($age);


    $query = "INSERT INTO freemusic (fname, lname, email, address, city, state, zip, age) VALUES ('$fname','$lname','$email','$address','$city','$s tate','$zip','$age')";


    $result = mysql_query($query) or $results="mysql_error()";
    echo $results;
    print "&results=" .$results;

    $results= "entered";
    echo $results;
    print "&results=" .$results;

    print "&loading=NO";

    print "&status=DONE.";

    ?>

    So that and where do I add this extra security code stuff that I need?
    Mark Gooodman
    www.markcgoodman.com

  7. #47
    Moderator
    Join Date
    Feb 2001
    Posts
    13,044
    Hi,

    I usually put something like this near the top of the file (or if there are multiple sections using different variables, near the top of each section)

    PHP Code:
    $vars = array("fname","lname","email",address",..."age");
    foreach(
    $vars as $var)
      if(isset(
    $_POST[$var]))
         $
    $var = $_POST[$var]
    BTW: once working, please try with a name like O'Connor - it is well possible that your new server has magic_quotes on and the mysql_escape_string do escape the ' a second time

    Musicman

  8. #48
    Senior Member
    Join Date
    Oct 2003
    Posts
    102

    WORKED LIKE A CHARM

    I don't know how many times you helped me out MusicMan or even FlashKit. What a resource. I don't really understand that php code but it worked. I did try O'conner and that seemed to work fine.

    THANKS A MILLION
    Mark Gooodman
    www.markcgoodman.com

  9. #49
    Member
    Join Date
    May 2003
    Posts
    80
    Help! I have hooked up all of this new .php, it sends mail and everything, BUT it fills out some information incorrectly in the email. Message says "message" Email says "message" Fax number says "message" Help, its weird. Here is the .php


    <?

    // Enter your contact email address here
    $adminaddress = "cixecixe@yahoo.com";

    // Enter the address of your website here include http://www.
    $siteaddress ="http://www.company.com/";

    // Enter your company name or site name here
    $sitename = "Site Name";

    /************************************************** *****

    No need to change anything below ...

    ************************************************** *****/

    foreach($HTTP_GET_VARS as $name => $value) { $$name = $value;}
    foreach($HTTP_POST_VARS as $name => $value) { $$name = $value;}

    foreach($HTTP_GET_VARS as $title => $value) { $$title = $value;}
    foreach($HTTP_POST_VARS as $title => $value) { $$title = $value;}

    foreach($HTTP_GET_VARS as $company => $value) { $$company = $value;}
    foreach($HTTP_POST_VARS as $company => $value) { $$company = $value;}

    foreach($HTTP_GET_VARS as $address => $value) { $$address = $value;}
    foreach($HTTP_POST_VARS as $address => $value) { $$address = $value;}

    foreach($HTTP_GET_VARS as $city => $value) { $$city = $value;}
    foreach($HTTP_POST_VARS as $city => $value) { $$city = $value;}

    foreach($HTTP_GET_VARS as $state => $value) { $$state = $value;}
    foreach($HTTP_POST_VARS as $state => $value) { $$state = $value;}

    foreach($HTTP_GET_VARS as $zip => $value) { $$zip = $value;}
    foreach($HTTP_POST_VARS as $zip => $value) { $$zip = $value;}

    foreach($HTTP_GET_VARS as $country => $value) { $$country = $value;}
    foreach($HTTP_POST_VARS as $country => $value) { $$country = $value;}

    foreach($HTTP_GET_VARS as $telno1 => $value) { $$telno1 = $value;}
    foreach($HTTP_POST_VARS as $telno1 => $value) { $$telno1 = $value;}

    foreach($HTTP_GET_VARS as $telno => $value) { $$telno = $value;}
    foreach($HTTP_POST_VARS as $telno => $value) { $$telno = $value;}

    foreach($HTTP_GET_VARS as $faxno1 => $value) { $$faxno1 = $value;}
    foreach($HTTP_POST_VARS as $faxno1 => $value) { $$faxno1 = $value;}

    foreach($HTTP_GET_VARS as $faxno => $value) { $$faxno = $value;}
    foreach($HTTP_POST_VARS as $faxno => $value) { $$faxno = $value;}

    foreach($HTTP_GET_VARS as $message => $value) { $$message = $value;}
    foreach($HTTP_POST_VARS as $message => $value) { $$message = $value;}

    foreach($HTTP_GET_VARS as $email => $value) { $$email = $value;}
    foreach($HTTP_POST_VARS as $email => $value) { $$email = $value;}

    // Gets the date and time from your server
    $date = date("m/d/Y H:i:s");

    // Gets the IP Address
    if ($REMOTE_ADDR == "") $ip = "no ip";
    else $ip = getHostByAddr($REMOTE_ADDR);

    //Process the form data!
    // and send the information collected in the Flash form to Your nominated email address
    if ($action != ""):
    mail("$adminaddress","Message from $company",
    "A visitor to $sitename has left the following information\n
    Name: $name
    Title: $title
    Company: $company
    Address: $address
    $city
    $state
    $zip
    Country: $country
    Phone: ($telno1) $telno
    Fax: ($faxno1) $faxno\n
    Email: $email\n
    Message:
    $message

    Logged Info :
    ------------------------------
    Using: $HTTP_USER_AGENT
    Hostname: $ip
    IP address: $REMOTE_ADDR
    Date/Time: $date","FROM:$adminaddress");

    //This sends a confirmation to your visitor
    mail("$email","Thank You for the message to $sitename",
    "Hello $name,\n
    ------------------------------
    This is an automated message from $sitename, we will respond
    to your message as quickly as possible.\n
    $sitename
    $siteaddress","FROM:$adminaddress");

    //Confirmation is sent back to the Flash form that the process is complete
    $sendresult = "Thank you for your message.";
    $send_answer = "answer=";
    $send_answer .= rawurlencode($sendresult);
    echo "$send_answer";

    endif;

    ?>

    Now here is the email it sends to me :

    Name: cixe
    Title: ms
    Company: spinaroonie
    Address: po box
    town
    ca
    90210
    Country: usa
    Phone: (555) 555-5555
    Fax: (555) message

    Email: message

    Message:
    message

    Logged Info :
    ------------------------------
    Using:
    Hostname: no ip
    IP address:
    Date/Time: 10/20/2004 11:12:29


    I also noticed the no ip thing... It does that sometimes, but not others. Can someone tell me what I'm doing wrong?

    Thank you all so much, this post is a huge help!

  10. #50
    imagination through stupidity
    Join Date
    Apr 2001
    Location
    P3X-3113
    Posts
    1,238
    That coding is weird.
    Last edited by Sybersnake; 10-20-2004 at 01:14 PM.
    Nothing to see here, move along.

  11. #51
    imagination through stupidity
    Join Date
    Apr 2001
    Location
    P3X-3113
    Posts
    1,238
    try this

    Code:
    <? 
    
    // Enter your contact email address here
    $adminaddress = "cixecixe@yahoo.com"; 
    
    // Enter the address of your website here include http://www. 
    $siteaddress ="http://www.company.com/"; 
    
    // Enter your company name or site name here 
    $sitename = "Site Name"; 
    
    / **************************************************
    *****
    
    No need to change anything below ... 
    
    **************************************************
    *****/
    
    
    // Gets the date and time from your server
    $date = date("m/d/Y H:i:s");
    
    // Gets the IP Address
    if ($REMOTE_ADDR == "") $ip = "no ip";
    else $ip = getHostByAddr($REMOTE_ADDR);
    
    //Process the form data!
    // and send the information collected in the Flash form to Your nominated email address
    if ($action != ""): 
    mail("$adminaddress","Message from $company", 
    "A visitor to $sitename has left the following information\n
    Name: $HTTP_POST_VARS["name"]
    Title: $HTTP_POST_VARS["title"]
    Company: $HTTP_POST_VARS["company"]
    Address: $HTTP_POST_VARS["address"]
    $HTTP_POST_VARS["city"], $HTTP_POST_VARS["state"] $HTTP_POST_VARS["zip"]
    Country: $HTTP_POST_VARS["country"]
    Phone: ($HTTP_POST_VARS["telno1"]) $HTTP_POST_VARS["telno"]
    Fax: ($HTTP_POST_VARS["faxno1"]) $HTTP_POST_VARS["faxno"] \n
    Email: $HTTP_POST_VARS["email"] \n
    Message:
    $HTTP_POST_VARS["message"]
    
    Logged Info :
    ------------------------------
    Using: $HTTP_USER_AGENT
    Hostname: $ip
    IP address: $REMOTE_ADDR
    Date/Time: $date","FROM:$adminaddress"); 
    
    //This sends a confirmation to your visitor
    mail("$email","Thank You for the message to $sitename", 
    "Hello $name,\n
    ------------------------------
    This is an automated message from $sitename, we will respond
    to your message as quickly as possible.\n
    $sitename
    $siteaddress","FROM:$adminaddress"); 
    
    //Confirmation is sent back to the Flash form that the process is complete
    $sendresult = "Thank you for your message.";
    $send_answer = "answer=";
    $send_answer .= rawurlencode($sendresult);
    echo "$send_answer";
    
    endif;
    
    ?>
    Make sure your flash form is using the POST Method.
    Nothing to see here, move along.

  12. #52
    Member
    Join Date
    May 2003
    Posts
    80
    Hate to say this, but the .php you gave me didn't work, due to that whole new PHP 4.1 thing that we are all here posting about. The only way I can get the code to work with the PHP 4.1 is that weird looking code I posted where everything is doubled over. And yes my Flash form does call for POST, its like every other flashform here at the flashkit.com

    Thank you for your help.

  13. #53
    imagination through stupidity
    Join Date
    Apr 2001
    Location
    P3X-3113
    Posts
    1,238
    HTTP POST variables: $_POST
    Note: Introduced in 4.1.0. In earlier versions, use $HTTP_POST_VARS.

    An associative array of variables passed to the current script via the HTTP POST method. Automatically global in any scope.

    This is a 'superglobal', or automatic global, variable. This simply means that it is available in all scopes throughout a script. You don't need to do a global $_POST; to access it within functions or methods, as you do with $HTTP_POST_VARS.

    $HTTP_POST_VARS contains the same initial information, but is not an autoglobal. (Note that $HTTP_POST_VARS and $_POST are different variables and that PHP handles them as such)

    If the register_globals directive is set, then these variables will also be made available in the global scope of the script; i.e., separate from the $_POST and $HTTP_POST_VARS arrays. For related information, see the security chapter titled Using Register Globals. These individual globals are not autoglobals.

    http://us2.php.net/reserved.variables
    Nothing to see here, move along.

  14. #54
    Senior Member
    Join Date
    Jul 2000
    Posts
    180

    Musicman to the rescue? :)

    Hi Musicman,
    I hate to bother you but I've been following alot of your sound advice on this board (no pun intended) and have been unsuccesful in accomplishing what I am trying to do.
    I bought a magazine that has a tutorial and a .fla for a php driven flash player. The problem is that the entire code is setup for a dynamic playlist, and in my situation I will only have one song per page. I am sending the variables to Flash like this:
    ...<param name="movie" value="player.swf<?php echo "?mp3_path=$mp3&stitle=$stitle" ?>">...
    and
    ...<embed src="player.swf<?php echo "?mp3_path=$mp3&stitle=$stitle" ?>"...

    What I need to know is how would I change the following code to reflect that? Their code is chuck full of functions for changing to the next track and prev track, etc and it's way over my head. I would like to keep the normal id3 and play type functions but lose all of the multiple track info. If anybody could help on this I would really appreciate it. I got in trouble right from the start because this code tries to call the mp3 path variable from a php file but it doesnt need to because I am assigning it with the above code. The nunomira page says that I can access the variables in Flash with this:

    trace(_level0.mp3_path);

    Do I need to trace the variable or can I just use
    mp3=(_level0.mp3_path); ?

    Here is the raw code that I need to somehow strip down to just a one song script. Thank you VERY MUCH for any advice or help.

    lv = new LoadVars();
    lv.onLoad = function()
    {
    mp3list = new Array();
    var i = 0;
    while (this["file" + i] != undefined)
    {
    mp3list[i] = this["file" + i];
    i++;
    }
    }
    lv.load("getmp3s.php");

    volumeB.stop();

    volumeB.onPress = function()
    {
    this.gotoAndStop(3);
    this.startDrag(false, this._x, 29, this._x, 144);

    volumeB.onMouseMove = function()
    {
    mp3Sound.setVolume(100 - ((this._y - 29) / 115) * 100);
    }
    }

    volumeB.onRelease = volumeB.onReleaseOutside = function()
    {
    this.gotoAndStop(1);
    this.stopDrag();
    }

    function loadTrack(fname)
    {
    mp3Sound = new Sound();
    mp3Sound.loadSound(fname, true);

    mp3Sound.onID3 = function()
    {
    textString = this.id3.track + ". " + this.id3.songname + " (c)" + this.id3.year + " - " + this.id3.artist + " - " + this.id3.album + " ";
    tracktitle.text = textString;
    }

    mp3Sound.onSoundComplete = nextTrack;

    tracktitle.text = fname;
    tracktime.text = "0:00";
    }

    currentTrack = -1;
    function nextTrack()
    {
    clearInterval(playback);
    playback = setInterval(refreshDisplay, 250);

    wrap = 0;
    currentTrack++;
    currentTrack%=mp3list.length;
    loadTrack(mp3list[currentTrack]);
    }

    function prevTrack()
    {
    clearInterval(playback);
    playback = setInterval(refreshDisplay, 250);

    wrap = 0;
    currentTrack--;
    if (currentTrack < 0) currentTrack = mp3list.length-1;
    loadTrack(mp3list[currentTrack]);
    }

    function stopTrack()
    {
    stoppos = mp3Sound.position;
    mp3Sound.stop();
    }

    function resumeTrack()
    {
    if (stoppos == undefined)
    {
    nextTrack();
    }
    else
    mp3Sound.start(stoppos / 1000);
    }

    function rewindTrack()
    {
    pos = mp3Sound.position;
    pos -= 2000;
    if (pos < 0) pos = 0;
    mp3Sound.start(pos / 1000);
    }

    //nextTrack();

    nextTrackButton.onRelease = nextTrack;
    prevTrackButton.onRelease = prevTrack;
    stopButton.onRelease = stopTrack;
    playButton.onRelease = resumeTrack;
    rewindButton.onRelease = rewindTrack;

    progressb.inner._width = 0;

    refreshDisplay = function()
    {
    tracktitle.text = textString.substr(wrap, textString.length) + textString;
    wrap++;
    wrap %= textString.length;

    var pos = Math.floor(mp3Sound.position / 1000);
    sec = (pos % 60).toString();
    min = Math.floor(pos / 60).toString();
    if (sec.length == 1) sec = "0" + sec;

    tracktime.text = min + ":" + sec;
    progressb.inner._width = (mp3Sound.position / mp3Sound.duration) * 250;
    }

  15. #55
    Moderator
    Join Date
    Feb 2001
    Posts
    13,044
    Hi,

    replacing this code

    lv = new LoadVars();
    lv.onLoad = function()
    {
    mp3list = new Array();
    var i = 0;
    while (this["file" + i] != undefined)
    {
    mp3list[i] = this["file" + i];
    i++;
    }
    }
    lv.load("getmp3s.php");

    by

    mp3list = [_level0.mp3_path];

    should populate the playlist with one song, and hopefully disable next track, randomize, or anything else that makes sense only with multiple songs

    Musicman

  16. #56
    Senior Member
    Join Date
    Jul 2000
    Posts
    180
    Before I even try it I want to say thanks alot.
    I'll let you know how it goes.
    Thanks again, hope I can repay the favor someday.

  17. #57
    Senior Member
    Join Date
    Jul 2000
    Posts
    180
    You are the man!!
    Holy cow, what a great idea, I was pulverizing the thing. Its working like a champ except for one tiny thing. When I first loaded the song the id3 info scrolled across the screen. When I go back to the page it just says NAN and doesnt scroll. ?
    I am completely grateful for you getting me this far and wont be crushed if you cant help with that minor bug.

    Hats off, Musicman!

  18. #58
    Junior Member
    Join Date
    Aug 2000
    Location
    Jacksonville Florida
    Posts
    28

    php form

    I just have a simple PHP form and using Flash 5. It submits the info except for the last field - email address. I guess its this different syntax I have seen that causes a problem with just the last part of the script? Any PHP gurus tell me why it submits the info ok but not the email address box on the form inside the flash file?

    PHP -


    <?

    $to = "youremail@domain.com";
    $msg = "$name\n\n";
    $msg .= "$message\n\n";

    mail($to, $subject, $msg, "From: Yourdomain.com\nReply-To: $email\n");

    ?>

    FLASH FILE

    on (release) {
    if (name eq "" or subject eq "" or message eq "" or email eq "") {
    stop ();
    } else {
    loadVariablesNum ("form.php", 0, "POST");
    gotoAndStop (2);
    }
    }

  19. #59
    Moderator
    Join Date
    Feb 2001
    Posts
    13,044
    Hi,

    if you post the url of your movie, I could check whether it is actually sending an email variable

    Musicman

  20. #60
    Junior Member
    Join Date
    Aug 2000
    Location
    Jacksonville Florida
    Posts
    28
    I decided to go with formmail and everything submits.

    Only problem is one of the hidden values in formmail is "redirect"

    Is it possible for the redirect value to specify it to stay in the flash file instead of getting another url after it submits the form?

    such as goto a certain frame and stop.
    Flash Aces Design
    http://www.flashaces.com

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

Poll by Flashkit.com