<?php
////////////////////////////////
ob_start();
session_start(); /// initialize session
include("./inc/pw.php");
check_logged();
include("./inc/dirscan.php");
include("./inc/array_xml.php");
include("./inc/jscript.php");
$finale= xml2ary(file_get_contents('../component/xml/contacts_tr.xml'));
if (isset($_POST['save']))
{
//cambio i dati
$finale['data']['_c']['info']['_c']['company']['_v']= $_POST['company'];
$finale['data']['_c']['info']['_c']['name']['_v']= $_POST['name'];
$finale['data']['_c']['info']['_c']['phone']['_v']= $_POST['phone'];
$finale['data']['_c']['info']['_c']['email']['_v']= $_POST['email'];
$finale['data']['_c']['info']['_c']['request']['_v']= $_POST['request'];
$finale['data']['_c']['info']['_c']['submit']['_v']= $_POST['submit'];
$last= ary2xml($finale);
//write();
$fh = fopen("../component/xml/contacts_tr.xml", "w");
if($fh==false)
die("unable to create file");
fwrite($fh, $last);
fclose($fh);
echo ("<h1>Contact settings edited!<br/><br/><br/><a href='contact.php'>Back to Contact settings</a></h1>");
}
else
{
echo "<table width='700' border='0' cellspacing='0' cellpadding='2'>" ;
echo "<tr><td colspan='2'><h1>Contacts Translation ADMIN PANEL</h1></td><td colspan='2' align='center'></td>";
echo "<form action='contact.php' method='post'>";
echo "<tr>" ;
echo "<td width='200'><p>Name</p></td><td ><input name='name' size='60' value='".$finale['data']['_c']['info']['_c']['name']['_v']."' ></td>" ;
echo "</tr> " ;
echo "<tr>" ;
echo "<td width='200'><p>Company</p></td><td ><input name='company' size='60' value='".$finale['data']['_c']['info']['_c']['company']['_v']."' ></td>" ;
echo "</tr> " ;
echo "<tr>" ;
echo "<td width='200'><p>Phone</p></td><td ><input name='phone' size='60' value='".$finale['data']['_c']['info']['_c']['phone']['_v']."' ></td>" ;
echo "</tr> " ;
echo "<tr>" ;
echo "<td width='200'><p>Email</p></td><td ><input name='email' size='60' value='".$finale['data']['_c']['info']['_c']['email']['_v']."' ></td>" ;
echo "</tr> " ;
echo "<tr>" ;
echo "<td width='200'><p>Request</p></td><td ><input name='request' size='60' value='".$finale['data']['_c']['info']['_c']['request']['_v']."' ></td>" ;
echo "</tr> " ;
echo "<tr>" ;
echo "<td width='200'><p>Submit</p></td><td ><input name='submit' size='60' value='".$finale['data']['_c']['info']['_c']['submit']['_v']."' ></td>" ;
echo "</tr> " ;
echo "<td align='center' colspan='2'><input name='save' type='submit' value='SAVE' /></td>";
echo "</form>";
echo "</table> " ;
}
?>