PHP Scripting

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • odb69

    #1

    PHP Scripting

    Hi,

    Two things people. Firstly: feed back form, I need the php page to send me
    the reply via email whilst masking the email address and for the feedback
    form to return the user to to the previous page? Secondly: how could one
    create a php script so that it links a flash files' submit to php which in
    turn passes the data to MySQL database?

    Any help will be greatly appericated.


    --
    odb69


  • Erwin Moller

    #2
    Re: PHP Scripting

    odb69 wrote:
    [color=blue]
    > Hi,
    >
    > Two things people. Firstly: feed back form, I need the php page to send me
    > the reply via email whilst masking the email address and for the feedback
    > form to return the user to to the previous page? Secondly: how could one
    > create a php script so that it links a flash files' submit to php which in
    > turn passes the data to MySQL database?
    >
    > Any help will be greatly appericated.
    >
    >[/color]

    Hi,

    That are VERY GENERAL questions.

    Some hints: go to www.php.net and llok up:

    1) mail() for email.
    I don't know what you mean by masking the emailadres, but you can set the
    FROM-field while mailing.

    2) look up header() for redirecting.
    header("Locatio n: http://www.yoursite.co m/somepage.html") ;

    3) Flash files submit button?
    PHP couldn't care less who/what is posting to the script.
    Just make sure you feed the right 'action' to your flashfile, so it points
    to a PHP script.
    You can use querystring to send data. (I don't know if Flash can POST)
    So:
    Find information, resources and relevant links for yoursite.com. This domain may be for sale.


    and let PHP get the values like this:
    $name = $_GET["username"];
    $score = $_GET["score"];

    4) Insert it into a mysql database?
    I suggest you use the INSERT-command....


    Regards,
    Erwin Moller

    Comment

    • Marcin Dobrucki

      #3
      Re: PHP Scripting

      odb69 wrote:
      [color=blue]
      > Two things people. Firstly: feed back form, I need the php page to send me
      > the reply via email whilst masking the email address and for the feedback
      > form to return the user to to the previous page? Secondly: how could one
      > create a php script so that it links a flash files' submit to php which in
      > turn passes the data to MySQL database?[/color]

      Wrote this while trying out PEAR classes:

      <?php

      /**
      * Short script for dumping stuff out of a database
      */

      require_once 'HTML/Page.php';
      require_once 'HTML/QuickForm.php';
      require_once 'HTML/Table.php';
      require_once 'DB.php';

      $p = new HTML_Page();
      $f = new HTML_QuickForm( 'dumper');

      $f->addElement('he ader',NULL,'Sub mit your query');
      $f->addElement('te xt','query_stri ng','SQL Query (SELECT only)',
      array('size' => 80));
      $f->addElement('su bmit',NULL,'Que ry');
      $f->addElement('re set',NULL,'Rese t query');

      $p->addBodyContent ($f);

      if ($_POST['query_string']) {

      $dsn = array('phptype' => 'mysql',
      'hostspec' => 'your.host.here ',
      'username' => 'usr_name_here' ,
      'password' => 'usr_passwd',
      'database' => 'your_db_name') ;

      $db =& DB::connect($ds n);

      if (DB::isError($d b)) { die ($db->getMessage() ); }
      else {

      if (!preg_match("/^(UPDATE|INSERT )/i",$_POST['query_string'])) {

      $query = stripslashes($_ POST['query_string']);

      $sth =& $db->query($query );

      if (DB::isError($s th)) {
      $p->addBodyContent ("<p>ERROR<br>I nvalid SQL query!</p>");
      $p->addBodyContent ("<p>" . $sth->getMessage() . "</p>");
      }
      else {
      $t_attributes = array('rules' => 'all',
      'frame' => 'border');

      $t = new HTML_Table($t_a ttributes);

      $db_header = $db->tableInfo($sth );

      $headers = array();

      foreach ($db_header as $c => $c_name) {
      $headers = array_merge($he aders,array($c_ name['name']));
      }

      $header_attr = array('bgcolor' => 'steelblue');

      $t->addRow($header s,$header_attr, 'TH');

      $align_attr = array ('valign' => 'top');
      for ($row=0; $row < $sth->numRows(); $row++) {
      $t->addRow($sth->fetchRow(), $align_attr);
      }

      $light = array('bgcolor' => '#CCCCCC');
      $dark = array('bgcolor' => '#AAAAAA');
      $t->altRowAttribut es(1,$light,$da rk,TRUE);
      $p->addBodyContent ($t);
      }
      }
      else {
      $p->addBodyContent ("<p>Sorry, only SELECT queries allowed!</p>");
      }
      }
      }

      $p->display();
      ?>

      Comment

      • odb69

        #4
        Re: PHP Scripting

        Thanks for your help.




        --
        odb69









        _______________ _______________ _______________ _______________ ______________
        "Erwin Moller"
        <since_humans_r ead_this_I_am_s pammed_too_much @spamyourself.c om> wrote in
        message news:41ff81b3$0 $28993$e4fe514c @news.xs4all.nl ...[color=blue]
        > odb69 wrote:
        >[color=green]
        >> Hi,
        >>
        >> Two things people. Firstly: feed back form, I need the php page to send
        >> me
        >> the reply via email whilst masking the email address and for the feedback
        >> form to return the user to to the previous page? Secondly: how could one
        >> create a php script so that it links a flash files' submit to php which
        >> in
        >> turn passes the data to MySQL database?
        >>
        >> Any help will be greatly appericated.
        >>
        >>[/color]
        >
        > Hi,
        >
        > That are VERY GENERAL questions.
        >
        > Some hints: go to www.php.net and llok up:
        >
        > 1) mail() for email.
        > I don't know what you mean by masking the emailadres, but you can set the
        > FROM-field while mailing.
        >
        > 2) look up header() for redirecting.
        > header("Locatio n: http://www.yoursite.co m/somepage.html") ;
        >
        > 3) Flash files submit button?
        > PHP couldn't care less who/what is posting to the script.
        > Just make sure you feed the right 'action' to your flashfile, so it points
        > to a PHP script.
        > You can use querystring to send data. (I don't know if Flash can POST)
        > So:
        > http://www.yoursite.com/highscore.ph...=odb&score=340
        >
        > and let PHP get the values like this:
        > $name = $_GET["username"];
        > $score = $_GET["score"];
        >
        > 4) Insert it into a mysql database?
        > I suggest you use the INSERT-command....
        >
        >
        > Regards,
        > Erwin Moller[/color]


        Comment

        • Chung Leong

          #5
          Re: PHP Scripting

          "odb69" <s_sayain@yahoo .co.uk> wrote in message
          news:ctnopl$n93 $1@sparta.btint ernet.com...[color=blue]
          > Hi,
          >
          > Two things people. Firstly: feed back form, I need the php page to send me
          > the reply via email whilst masking the email address and for the feedback
          > form to return the user to to the previous page? Secondly: how could one
          > create a php script so that it links a flash files' submit to php which in
          > turn passes the data to MySQL database?[/color]

          Another way to submit data from Flash to a server running PHP is through
          Flash Remoting. Check out the examples at www.amfphp.org.


          Comment

          • anima

            #6
            Re: PHP Scripting

            I would strongly reccomend trying out the PhpMailer
            (http://phpmailer.sourceforge.net/)
            mail library. it's very easy to use and has good features.

            Comment

            Working...