Tech Support banner

Status
Not open for further replies.
1 - 1 of 1 Posts

·
Registered
Joined
·
19 Posts
Discussion Starter #1
I need to edit an XML file using php. What I am trying to do is make a page that allows users to register an account on my FTP server. My FTP server uses XML to store the the user information and settings.
Here is the XML file:
Code:
<FileZillaServer>
<Settings>
<Item name="Serverports" type="string">21</Item>
<Item name="Number of Threads" type="numeric">2</Item>
<Item name="Maximum user count" type="numeric">0</Item>
<Item name="Timeout" type="numeric">120</Item>
<Item name="No Transfer Timeout" type="numeric">120</Item>
<Item name="Allow Incoming FXP" type="numeric">0</Item>
<Item name="Allow outgoing FXP" type="numeric">0</Item>
<Item name="No Strict In FXP" type="numeric">0</Item>
<Item name="No Strict Out FXP" type="numeric">0</Item>
<Item name="Login Timeout" type="numeric">60</Item>
<Item name="Show Pass in Log" type="numeric">0</Item>
<Item name="Custom PASV IP type" type="numeric">0</Item>
<Item name="Custom PASV IP" type="string"/>
<Item name="Custom PASV min port" type="numeric">0</Item>
<Item name="Custom PASV max port" type="numeric">0</Item>
<Item name="Initial Welcome Message" type="string">%v
written by Tim Kosse ([email protected])
Please visit http://sourceforge.net/projects/filezilla/</Item>
<Item name="Admin Password" type="string">********</Item>
<Item name="Admin IP Bindings" type="string"/>
<Item name="Admin IP Addresses" type="string"/>
<Item name="Enable logging" type="numeric">0</Item>
<Item name="Logsize limit" type="numeric">0</Item>
<Item name="Logfile type" type="numeric">0</Item>
<Item name="Logfile delete time" type="numeric">0</Item>
<Item name="Use GSS Support" type="numeric">0</Item>
<Item name="GSS Prompt for Password" type="numeric">0</Item>
<Item name="Download Speedlimit Type" type="numeric">0</Item>
<Item name="Upload Speedlimit Type" type="numeric">0</Item>
<Item name="Download Speedlimit" type="numeric">10</Item>
<Item name="Upload Speedlimit" type="numeric">10</Item>
<Item name="Buffer Size" type="numeric">32768</Item>
<Item name="Custom PASV IP server" type="string">http://ip.filezilla-project.org/ip.php</Item>
<Item name="Use custom PASV ports" type="numeric">0</Item>
<Item name="Mode Z Use" type="numeric">0</Item>
<Item name="Mode Z min level" type="numeric">1</Item>
<Item name="Mode Z max level" type="numeric">9</Item>
<Item name="Mode Z allow local" type="numeric">0</Item>
<Item name="Mode Z disallowed IPs" type="string"/>
<Item name="IP Bindings" type="string">*</Item>
<Item name="IP Filter Allowed" type="string"/>
<Item name="IP Filter Disallowed" type="string"/>
<Item name="Hide Welcome Message" type="numeric">0</Item>
<Item name="Enable SSL" type="numeric">0</Item>
<Item name="Allow explicit SSL" type="numeric">1</Item>
<Item name="SSL Key file" type="string"/>
<Item name="SSL Certificate file" type="string"/>
<Item name="Implicit SSL ports" type="string">990</Item>
<Item name="Force explicit SSL" type="numeric">0</Item>
<Item name="Network Buffer Size" type="numeric">65536</Item>
<Item name="Force PROT P" type="numeric">0</Item>
<Item name="SSL Key Password" type="string"/>
<Item name="Allow shared write" type="numeric">0</Item>
<Item name="No External IP On Local" type="numeric">1</Item>
<Item name="Active ignore local" type="numeric">1</Item>
<Item name="Autoban enable" type="numeric">0</Item>
<Item name="Autoban attempts" type="numeric">5</Item>
<Item name="Autoban type" type="numeric">0</Item>
<Item name="Autoban time" type="numeric">1</Item>
<Item name="Admin port" type="numeric">14147</Item>
<SpeedLimits>
<Download/>
<Upload/>
</SpeedLimits>
</Settings>
<Groups>
<Group Name="students">
<Option Name="Bypass server userlimit">0</Option>
<Option Name="User Limit">0</Option>
<Option Name="IP Limit">0</Option>
<Option Name="Enabled">1</Option>
<Option Name="Comments"/>
<Option Name="ForceSsl">0</Option>
<IpFilter>
<Disallowed/>
<Allowed/>
</IpFilter>
<Permissions/>
<SpeedLimits DlType="1" DlLimit="10" ServerDlLimitBypass="0" UlType="1" UlLimit="10" ServerUlLimitBypass="0">
<Download/>
<Upload/>
</SpeedLimits>
</Group>
</Groups>
<Users>
<User Name="$_POST['username']">
<Option Name="Pass">md5($_POST['password'])</Option>
<Option Name="Group">students</Option>
<Option Name="Bypass server userlimit">2</Option>
<Option Name="User Limit">0</Option>
<Option Name="IP Limit">0</Option>
<Option Name="Enabled">2</Option>
<Option Name="Comments"/>
<Option Name="ForceSsl">2</Option>
<IpFilter>
<Disallowed/>
<Allowed/>
</IpFilter>
<Permissions>
<Permission Dir="C:\wamp\www\test">
<Option Name="FileRead">1</Option>
<Option Name="FileWrite">0</Option>
<Option Name="FileDelete">0</Option>
<Option Name="FileAppend">0</Option>
<Option Name="DirCreate">0</Option>
<Option Name="DirDelete">0</Option>
<Option Name="DirList">1</Option>
<Option Name="DirSubdirs">1</Option>
<Option Name="IsHome">1</Option>
<Option Name="AutoCreate">0</Option>
</Permission>
</Permissions>
<SpeedLimits DlType="0" DlLimit="10" ServerDlLimitBypass="2" UlType="0" UlLimit="10" ServerUlLimitBypass="2">
<Download/>
<Upload/>
</SpeedLimits>
</User>
</Users>
</FileZillaServer>
So what needs to happen is that I need to create a new child (User) under users with the attribute Name and the name is the username that the user typed in the form ($_POST['username]). Then I need to create children in that (Option) each with the attribute name, and name should have the option name. Then each of those children should have the corresponding setting. The only ones that I need to change are the username and password, the others need to stay exactly the same.
I put the variables in the XML just for explainatory reasons, the real username and md5 encrypted password go in the xml file.
I do not need to edit any other part of the XML file except for adding the user.
Any help is greatly appreciated!
-aquabug
 
1 - 1 of 1 Posts
Status
Not open for further replies.
Top