title: XML request MySQL by PHP
body: <p>Actually i'm working in a flash web page using XML. I want to make a sing up page with XML that uses PHP to insert data into de MySQL database, but I'm stuck... and i my XML-PHP knowledge are not enough for this duty.</p>
  
  <p>This is the XML file:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;data&gt;
  &lt;title&gt;Sing up&lt;/title&gt;
  &lt;request field1="user" field2="email" field3="password" field4="other"&gt;reg.php&lt;/request&gt;
  &lt;description&gt;&lt;![CDATA[Please sing up!]]&gt;&lt;/description&gt;
  &lt;/data&gt;
  </code></pre>
  
  <p>The  reg PHP file:</p>
  
  <pre><code>        &lt;?php
  
          function Reg()
          {
              if (isset($_POST['reg'])==true) {
                       require_once('db_conf.php'); 
                  $user = $_POST['username'];
                  $pass = sha1(strtoupper($user.':'.$_POST['password'])); 
                  $email = $_POST['email'];
  
                  $con = mysql_connect($dbhost, $dbuser, $dbpassword);
  
                  if (!$con) 
                  { 
                      die('Could not connect!'); 
                  } else {
                      mysql_select_db("$logondb", $con); 
  
                      $sql="INSERT INTO accounts (username, sha_pass_hash, email) VALUES ('$user','$pass','$email')"; 
  
                      if (!mysql_query($sql,$con)) 
                      { 
                          die('Error creating account.'); 
                      } 
  
                      echo $succesmsg; 
  
                      mysql_close($con);
  
                  } 
  
  
              } else {
  ?&gt;
  </code></pre>
  
  <p>And PHP conf for database:</p>
  
  <pre><code>    &lt;?php
  $dbhost = 'localhost';
  
  $dbuser = 'user';
  
  $dbpassword = 'password';
  
  // Accounts Database
  $logondb = 'accounts';
  
  $errormsg="Error creating account..";
  
  $succesmsg="Account created!";
  ?&gt;
  </code></pre>