<?php
    $xmlFile = simplexml_load_file("AccountInfo.xml");
    $xmlLocalCopy = new SimpleXMLElement($xmlFile->asXML());
    $password = md5($_POST["password"]);
    $firstname = $_POST['firstname'];
    $lastname = $_POST['lastname'];
    $password = $_POST['password'];
    $gender = $_POST['gender'];
    $email = $_POST['email'];
    foreach ($xmlFile->children() as $child) {
        if ($child->email == $_POST["email"]) {
            $exit = true;
            $newError = "Email already exists";
            if ($exit) {
                include("view/index.html");
            }
        }
    }
    if(!$exit) {
       $ids = $newAcct = $xmlLocalCopy->addChild->xpath("user");
        $newAcct->addChild("firstname", $firstname);
        $newAcct->addChild("lastname", $lastname);
        $newAcct->addChild("email", $email);
        $newAcct->addChild("password", $password);
        $newAcct->addChild("gender", $gender);
        $dom = new DOMDocument('1.0');
        $dom->preserveWhiteSpace = false;
        $dom->formatOutput = true;
        $dom->loadXML($xmlLocalCopy->asXML());
        $dom->save("AccountInfo.xml");
    }  
      
      - 
        
          Вопрос задан
          
                  
      
- 
          
            
            175             просмотров