Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Page 1 of 3 123 LastLast
Results 1 to 15 of 41
  1. #1
    New Coder
    Join Date
    Feb 2011
    Location
    EVERYWHERE ... YOU JUST NEVER KNOW WHEN I WILL POP UP WHERE
    Posts
    27
    Thanks
    8
    Thanked 0 Times in 0 Posts

    Question Flash php - want to add something

    Hi all, everyone was so amazing the last time I was stuck ... thanks again for that help

    I found this really amazing Flash Form Mail / PHP that I want to use ...

    but it is missing the part

    to capture the below info which is important to me and was in my old CGI script


    [CODE] my $REMOTE_ADDR = 1;
    my $HTTP_USER_AGENT = 1;
    my $DATE = 1;
    [ICODE]

    (can the above somehow be added to this .... and do I need to post the flash file also?)


    PHP Code:
    <?
    if(!empty($HTTP_POST_VARS['sender_mail']) || !empty($HTTP_POST_VARS['sender_message']) || !empty($HTTP_POST_VARS['sender_subject']) || !empty($HTTP_POST_VARS['sender_name']))
    {
        
    $to "@.com";
        
    $subject stripslashes($HTTP_POST_VARS['sender_subject']);
        
    $body stripslashes($HTTP_POST_VARS['sender_message']);
        
    $body .= "\n\n---------------------------\n";
        
    $body .= "Mail sent by: " $HTTP_POST_VARS['sender_name'] . " <" $HTTP_POST_VARS['sender_mail']  . ">\n";
        
    $header "From: " $HTTP_POST_VARS['sender_name'] . " <" $HTTP_POST_VARS['sender_mail'] . ">\n";
        
    $header .= "Reply-To: " $HTTP_POST_VARS['sender_name'] . " <" $HTTP_POST_VARS['sender_mail'] . ">\n";
        
    $header .= "X-Mailer: PHP/" phpversion() . "\n";
        
    $header .= "X-Priority: 1";
        if(@
    mail($to$subject$body$header))
        {
            echo 
    "output=sent";
        } else {
            echo 
    "output=error";
        }
    } else {
        echo 
    "output=error";
    }
    ?>


    Thanks again in advance ... to whoever is another angel

  • #2
    New Coder
    Join Date
    Jun 2008
    Posts
    61
    Thanks
    0
    Thanked 12 Times in 12 Posts
    Just modify your Body Var
    PHP Code:
     $body stripslashes($HTTP_POST_VARS['sender_message']).'\n\nIP:'.$_SERVER[''HTTP_USER_AGENT''].'\n\nClient:'.'\n\nDate:'.date('d.m.Y H:i:s'); 

  • Users who have thanked Labrar for this post:

    Ugogrl (03-30-2011)

  • #3
    New Coder
    Join Date
    Feb 2011
    Location
    EVERYWHERE ... YOU JUST NEVER KNOW WHEN I WILL POP UP WHERE
    Posts
    27
    Thanks
    8
    Thanked 0 Times in 0 Posts

    Error message

    Okay, I put it where you said ... but got this error message?

    [CODE]Parse error: syntax error, unexpected T_STRING, expecting ']' in /mnt/r0148/d11/s37/b02bff1d/www/.............com/contact2.php on line 6
    [ICODE]

    any solutions???



    Quote Originally Posted by Labrar View Post
    Just modify your Body Var
    PHP Code:
     $body stripslashes($HTTP_POST_VARS['sender_message']).'\n\nIP:'.$_SERVER[''HTTP_USER_AGENT''].'\n\nClient:'.'\n\nDate:'.date('d.m.Y H:i:s'); 

  • #4
    New Coder
    Join Date
    Jun 2008
    Posts
    61
    Thanks
    0
    Thanked 12 Times in 12 Posts
    Sorry. It was late.
    PHP Code:
     $body stripslashes($HTTP_POST_VARS['sender_message']).'\n\nIP:'.$_SERVER['HTTP_USER_AGENT'].'\n\nClient:\n\nDate:'.date('d.m.Y H:i:s'); 

  • Users who have thanked Labrar for this post:

    Ugogrl (03-30-2011)

  • #5
    New Coder
    Join Date
    Feb 2011
    Location
    EVERYWHERE ... YOU JUST NEVER KNOW WHEN I WILL POP UP WHERE
    Posts
    27
    Thanks
    8
    Thanked 0 Times in 0 Posts

    Smile Great! That works ... except

    Quote Originally Posted by Labrar View Post
    Sorry. It was late.
    PHP Code:
     $body stripslashes($HTTP_POST_VARS['sender_message']).'\n\nIP:'.$_SERVER['HTTP_USER_AGENT'].'\n\nClient:\n\nDate:'.date('d.m.Y H:i:s'); 
    Thanks You!

    It all works great but is not picking up

    the IP / Host ? number

  • #6
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,978
    Thanks
    4
    Thanked 2,659 Times in 2,628 Posts
    This code is ancient.
    There is no guarantee that the registered long arrays have been enabled in PHP. $HTTP_*_VARS are deprecated, and will disappear; use the superglobal equivalents of $_* for each of the $HTTP_*_VARS (except files which is just the $_FILES superglobal, not the same pattern as the long array is $HTTP_POST_FILES).

    Useragent does not provide the ip address, and the simplest variable that may contain it is the 'REMOTE_ADDR' in the $_SERVER superglobal, not the HTTP_USER_AGENT. Anything user provided is not guaranteed to ever exist, and the $_SERVER superglobal has few guaranteed offsets.

    I'd say go find yourself a new mailer script, look particularly for a new version which includes preventative measures for mail injections. All data provided by a client is tainted and should never be trusted.
    PHP Code:
    header('HTTP/1.1 420 Enhance Your Calm'); 

  • #7
    New Coder
    Join Date
    Feb 2011
    Location
    EVERYWHERE ... YOU JUST NEVER KNOW WHEN I WILL POP UP WHERE
    Posts
    27
    Thanks
    8
    Thanked 0 Times in 0 Posts

    Question even more lost than before

    Quote Originally Posted by Fou-Lu View Post
    This code is ancient.
    There is no guarantee that the registered long arrays have been enabled in PHP. $HTTP_*_VARS are deprecated, and will disappear; use the superglobal equivalents of $_* for each of the $HTTP_*_VARS (except files which is just the $_FILES superglobal, not the same pattern as the long array is $HTTP_POST_FILES).

    Useragent does not provide the ip address, and the simplest variable that may contain it is the 'REMOTE_ADDR' in the $_SERVER superglobal, not the HTTP_USER_AGENT. Anything user provided is not guaranteed to ever exist, and the $_SERVER superglobal has few guaranteed offsets.

    I'd say go find yourself a new mailer script, look particularly for a new version which includes preventative measures for mail injections. All data provided by a client is tainted and should never be trusted.



    Sorry, thank moderator ... but I have no idea what you said at all ... but thanks it sounds good just the same

  • #8
    New Coder
    Join Date
    Jun 2008
    Posts
    61
    Thanks
    0
    Thanked 12 Times in 12 Posts
    That means that this code is to old. Nobody uses such scripts since PHP4.
    But indead this is a popular Codesnippet out of google.

    But i guess youre not really in PHP aint ya?
    Leave it like that. Its old, but it works.
    So dont you care about it.

    But in the other hand this is not the way of secure coding.

  • Users who have thanked Labrar for this post:

    Ugogrl (03-30-2011)

  • #9
    New Coder
    Join Date
    Feb 2011
    Location
    EVERYWHERE ... YOU JUST NEVER KNOW WHEN I WILL POP UP WHERE
    Posts
    27
    Thanks
    8
    Thanked 0 Times in 0 Posts

    Thumbs up Thank you !!!!!!!

    Quote Originally Posted by Labrar View Post
    That means that this code is to old. Nobody uses such scripts since PHP4.
    But indead this is a popular Codesnippet out of google.

    But i guess youre not really in PHP aint ya?
    Leave it like that. Its old, but it works.
    So dont you care about it.

    But in the other hand this is not the way of secure coding.
    Really I think I am getting all formats ... just not the lingo? No techie talk for me ... if you get my drift ... NEWBIE

    Thank you for helping me ... like the Newbie I am ((hugs)) ... I do appreciate when someone takes that into consideration ... all I have searched for is the perfect form mail ... I guess without having to pay for it ... I can only expect second best ... right??? I mentioned one time in another forum I would pay for help and I got booted ... so I won't do that ever again ... I guess in the long run ... I can't have the information from my old CGI script which I did so love ... and have the same information gathering in a flash / php or whatever format ... ??? Cause I really like the FLASH FORMAT ???
    But, really still only want .. the best secure method ... Whatever that is???
    You were the only one to really help me and answer me ... I thank you ... be blessed by the Universe ... for your kindness!!!!!!!!

    I wish more were like you!!!!!!!!!

  • #10
    New Coder
    Join Date
    Feb 2011
    Location
    EVERYWHERE ... YOU JUST NEVER KNOW WHEN I WILL POP UP WHERE
    Posts
    27
    Thanks
    8
    Thanked 0 Times in 0 Posts

    Help ... I need some help?

    Quote Originally Posted by Fou-Lu View Post
    This code is ancient.
    There is no guarantee that the registered long arrays have been enabled in PHP. $HTTP_*_VARS are deprecated, and will disappear; use the superglobal equivalents of $_* for each of the $HTTP_*_VARS (except files which is just the $_FILES superglobal, not the same pattern as the long array is $HTTP_POST_FILES).

    Useragent does not provide the ip address, and the simplest variable that may contain it is the 'REMOTE_ADDR' in the $_SERVER superglobal, not the HTTP_USER_AGENT. Anything user provided is not guaranteed to ever exist, and the $_SERVER superglobal has few guaranteed offsets.

    I'd say go find yourself a new mailer script, look particularly for a new version which includes preventative measures for mail injections. All data provided by a client is tainted and should never be trusted.

    You totally had me sooooo lost

    Please, try to understand that most of us who ask for help ... it is because we do not understand what you do ... why forums were created ... was it not?

    You have so much potential ... to help others ... just remember the little guy was also once you too ... before you learnt what you learnt ... you asked a lot of questions also from those who taught you ... I seriously don't want to learn your profession ... I just want to run a cool little site ???

    With as much protection as I can use ... sorry you didn't understand ... I WAS ASKING FOR HELP???

    I did do the Google thing ... for what I wanted ... and it came up ... if it doesn't work ... then tell, show or lead where to go ... don't just leave me hanging ... cause I don't get the lingo

    Have a wonderful ... exploration of thoses who need your help ...
    I did you give you (Thank you points ... just because)



    Definition of HELP

    transitive verb

    1: to give assistance or support to <help a child with homework>

    Last edited by Ugogrl; 03-31-2011 at 12:12 AM.

  • #11
    Senior Coder
    Join Date
    Feb 2011
    Location
    Your Monitor
    Posts
    4,090
    Thanks
    51
    Thanked 506 Times in 493 Posts
    Basically $HTTP_POST_VARS and $HTTP_GET_VARS are no longer in use by default in php.

    PHP now uses this: $_POST and $_GET.

    $_GET is what is sent in the address - EG www.domain.com/index.php?var1=this&var2=that

    $_POST is data sent in the headers - from a form.

    In your case you need to use $_POST['sender_message'] instead of $HTTP_POST_VARS['sender_message'] because the $HTTP_POST_VARS is old, no longer supported and on most servers disabled.

    Similarly to get the users IP you now need to use $_SERVER['REMOTE_ADDR'] instead of the http user agent you were using as that is also deprecated (old).

    Hope that makes it easier for you. Any problems please let us know.
    My helpful sig is on vacation trying to loose some weight. It got a bit fat and caused a few problems but it will be back at some point!

  • #12
    New Coder
    Join Date
    Jun 2008
    Posts
    61
    Thanks
    0
    Thanked 12 Times in 12 Posts
    And it is also easy to understand.
    Short example

    Actionscript:
    PHP Code:
    mylvar=new LoadVars();
    mylvar.onLoad=function(connected){
    if(
    connected){
    trace(this.serveranswer);
    }else{
    trace('Cannot connect to the server. Is your Flasmovie in the same folder than your phpfile??\nOtherwise please use an absolute path to it'); }
    }
    mylvar.mytesttext='Hello im right here';
    mylvar.sendAndLoad('myphpfile.php',mylvar,"POST"); 
    And the php source (save at as myphpfile.php on your server)

    PHP Code:
    <?php
    echo "&serveranswer=Your Flashvar has the value: ".$_POST['mytesttext'];
    ?>
    Just try it.

    Explanation:
    sendAndLoad can be used for both directions. Sending variables to the server, and getting variables from the server. So you can work with them also in your Flashmovie and in your Basescript on the server.

    Going to bed now. Im drunken abit

    Party all the time at Key west
    Last edited by Labrar; 03-31-2011 at 04:50 AM.

  • Users who have thanked Labrar for this post:

    Ugogrl (03-31-2011)

  • #13
    New Coder
    Join Date
    Feb 2011
    Location
    EVERYWHERE ... YOU JUST NEVER KNOW WHEN I WILL POP UP WHERE
    Posts
    27
    Thanks
    8
    Thanked 0 Times in 0 Posts

    Smile Sorry ???

    Quote Originally Posted by Labrar View Post
    And it is also easy to understand.
    Short example

    Actionscript:
    PHP Code:
    mylvar=new LoadVars();
    mylvar.onLoad=function(connected){
    if(
    connected){
    trace(this.serveranswer);
    }else{
    trace('Cannot connect to the server. Is your Flasmovie in the same folder than your phpfile??\nOtherwise please use an absolute path to it'); }
    }
    mylvar.mytesttext='Hello im right here';
    mylvar.sendAndLoad('myphpfile.php',mylvar,"POST"); 
    And the php source (save at as myphpfile.php on your server)

    PHP Code:
    <?php
    echo "&serveranswer=Your Flashvar has the value: ".$_POST['mytesttext'];
    ?>
    Just try it.

    Explanation:
    sendAndLoad can be used for both directions. Sending variables to the server, and getting variables from the server. So you can work with them also in your Flashmovie and in your Basescript on the server.

    Going to bed now. Im drunken abit

    Party all the time at Key west
    lol ... well enjoy the party

    I looked at this and thought maybe if I had a drink I might understand it ... I don't understand coding or where to put any of the things you wrote ... I wish I did ... thanks

  • #14
    Senior Coder
    Join Date
    Feb 2011
    Location
    Your Monitor
    Posts
    4,090
    Thanks
    51
    Thanked 506 Times in 493 Posts
    Ok, here you are:

    PHP Code:
    <?
    if(isset($_POST['sender_mail']) || isset($_POST['sender_message']) || isset($_POST['sender_subject']) || isset($_POST['sender_name']))
       {
       
    $to "@.com";
       
    $subject stripslashes($_POST['sender_subject']);
       
    $body stripslashes($_POST['sender_message']);
       
    $body .= "\n\n---------------------------\n";
       
    $body .= "Mail sent by: " $_POST['sender_name'] . " <" $_POST['sender_mail']  . ">\n";
       
    $body .= "Senders IP: $_SERVER[REMOTE_ADDR]\n";
       
    $body .= "User-Agent: $_SERVER[HTTP_USER_AGENT]\n";
       
    $header "From: " $_POST['sender_name'] . " <" $_POST['sender_mail'] . ">\n";
       
    $header .= "Reply-To: " $_POST['sender_name'] . " <" $_POST['sender_mail'] . ">\n";
       
    $header .= "X-Mailer: PHP/" phpversion() . "\n";
       
    $header .= "X-Priority: 1";

       if(@
    mail($to$subject$body$header))
          {
          echo 
    "output=sent";
          }
       else
          {
          echo 
    "output=error";
          }
       }
    else
       {
       echo 
    "output=error";
       }
    ?>
    As many of us said, it wasn't hard work - I just changed $HTTP_POST_VARS to $_POST. I've no idea why you couldn't do that though as its been clearly explained many times.

    I've also put in your requested IP address and user agent too.

    Usage: Put your email address in where you see @.com and upload.
    My helpful sig is on vacation trying to loose some weight. It got a bit fat and caused a few problems but it will be back at some point!

  • #15
    New Coder
    Join Date
    Jun 2008
    Posts
    61
    Thanks
    0
    Thanked 12 Times in 12 Posts
    Thats not pretty hard to understand.
    Just copy the actionscriptcode and paste it to your first frame in root.
    Save the phpcode as a phpfile to your server.
    Just modify the path in your actionscript that it matches the path to your php file on server and test it

  • Users who have thanked Labrar for this post:

    Ugogrl (04-01-2011)


  •  
    Page 1 of 3 123 LastLast

    Tags for this Thread

    Posting Permissions

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