-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathencryption_decriptionof_xml_file.php
40 lines (39 loc) · 1.39 KB
/
encryption_decriptionof_xml_file.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
if($data){
$xml= new XMLWriter();
$xml->openURI('file.txt');
$xml->startDocument();
$xml->setIndent(true);
$xml->startElement('appointments');
$xml->startElement('user');
foreach($user_details as $key=>$value)
{
$xml->writeElement($key,$value);
}
$xml->endElement();
foreach($data as $Data1)
{
$xml->startElement('appointment');
foreach($Data1 as $key=>$value)
{
$xml->writeElement($key,$value);
}
$xml->endElement();
}
$xml->endElement();
$handle=file('file.xml');
$fp=fopen("one.xml","w");
foreach($handle as $name)
{
fwrite($fp,Crypter::encrypt($name).',');
}
fclose($fp);
$two=file('one.xml');
$en=explode(',',$two[0]);
array_pop($en);
$ftwo=fopen('two.xml',"w");
foreach($en as $val)
{
fwrite($ftwo,Crypter::decrypt($val));
}
fclose($ftwo);
}