<?php
define('__DRIVER__','mysql');
define('__HOST__','localhost');
define('__DBNAME__','mysql');
define('__USER__','root');
define('__PASS__','');
$userdes=@$_POST['userdes'];
$cname='constant';
$XML = <<<EOF
<root>
<building>
<source>
<in>
<type>sql</type>
<driver>{$cname('__DRIVER__')}</driver><dbhost>{$cname('__HOST__')}</dbhost><dbname>{$cname('__DBNAME__')}</dbname><dbuser>{$cname('__USER__')}</dbuser><dbpass>{$cname('__PASS__')}</dbpass>
<query>SELECT Host,User,Password,Select_priv,Insert_priv,Update_priv,Delete_priv,Create_priv,Drop_priv,Grant_priv FROM user LIMIT 0</query>
</in>
<out>
<type>sql</type>
<driver>{$cname('__DRIVER__')}</driver><dbhost>{$cname('__HOST__')}</dbhost><dbuser>{$cname('__USER__')}</dbuser><dbpass>{$cname('__PASS__')}</dbpass>
</out>
</source>
<item>
<type>select</type><name>dblist</name><label>db list</label><display>1</display>
<attrs><class>selbox</class></attrs>
<html><prepend><![CDATA[<h3>Manage Mysql users</h3><div id="dleft">]]></prepend></html>
<in><group>dblist</group><column>Database</column></in><value>all</value>
<out>false</out>
</item>
<item>
<type>select</type><name>userlist</name><label>user list</label><display>1</display>
<attrs><class>selbox</class><size>9</size></attrs>
<html><append><![CDATA[</div>]]></append></html>
<event><onchange><![CDATA['\$reconfig.selectuser("user.php",this);']]></onchange></event>
<in><group>userlist</group><column><id>userdef</id></column></in><value>$userdes</value>
<out>false</out>
</item>
<item>
<type>input</type><name>Host</name><label>Host</label>
<html><prepend><![CDATA[<div id="dright"><ul><li>]]></prepend></html>
<in><column>Host</column></in><out>true</out>
</item>
<item>
<type>input</type><name>User</name><label>User</label>
<html><prepend><![CDATA[</li><li>]]></prepend></html>
<in><column>User</column></in><out>true</out>
</item>
<item>
<type>input</type><name>Password</name><label>Password</label>
<html><prepend><![CDATA[</li><li>]]></prepend></html>
<value>*</value><in><column>Password</column></in><out>true</out>
</item>
<item>
<type>radio</type><name>all</name><label>all privs</label>
<html><prepend><![CDATA[</li><li>]]></prepend></html>
<attrs><class>chkbox</class></attrs>
<values><Y>yes</Y><N>no</N></values><value>no</value>
<in>false</in><out>false</out>
</item>
<item>
<type>radio</type><name>select</name><label>select priv</label><selbycode>true</selbycode>
<html><prepend><![CDATA[</li><li>]]></prepend></html>
<attrs><class>chkbox</class></attrs>
<values><Y>yes</Y><N>no</N></values>
<in><column>Select_priv</column><target>value</target></in><out>true</out>
</item>
<item>
<type>radio</type><name>insert</name><label>Insert priv</label><selbycode>true</selbycode>
<html><prepend><![CDATA[</li><li>]]></prepend></html>
<attrs><class>chkbox</class></attrs>
<values><Y>yes</Y><N>no</N></values>
<in><column>Insert_priv</column><target>value</target></in><out>true</out>
</item>
<item>
<type>radio</type><name>update</name><label>Update priv</label><selbycode>true</selbycode>
<html><prepend><![CDATA[</li><li>]]></prepend></html>
<attrs><class>chkbox</class></attrs>
<values><Y>yes</Y><N>no</N></values>
<in><column>Update_priv</column><target>value</target></in><out>true</out>
</item>
<item>
<type>radio</type><name>delete</name><label>Delete priv</label><selbycode>true</selbycode>
<html><prepend><![CDATA[</li><li>]]></prepend></html>
<attrs><class>chkbox</class></attrs>
<values><Y>yes</Y><N>no</N></values>
<in><column>Delete_priv</column><target>value</target></in><out>true</out>
</item>
<item>
<type>radio</type><name>create</name><label>Create priv</label><selbycode>true</selbycode>
<html><prepend><![CDATA[</li><li>]]></prepend></html>
<attrs><class>chkbox</class></attrs>
<values><Y>yes</Y><N>no</N></values>
<in><column>Create_priv</column><target>value</target></in><out>true</out>
</item>
<item>
<type>radio</type><name>drop</name><label>Drop priv</label><selbycode>true</selbycode>
<html><prepend><![CDATA[</li><li>]]></prepend></html>
<attrs><class>chkbox</class></attrs>
<values><Y>yes</Y><N>no</N></values>
<in><column>Drop_priv</column><target>value</target></in><out>true</out>
</item>
<item>
<type>radio</type><name>grant</name><label>Grant priv</label><selbycode>true</selbycode>
<html><prepend><![CDATA[</li><li>]]></prepend></html>
<attrs><class>chkbox</class></attrs>
<values><Y>yes</Y><N>no</N></values>
<in><column>Grant_priv</column><target>value</target></in><out>true</out>
</item>
<item>
<type>button</type><name>update</name><value>update</value>
<html><prepend><![CDATA[<br /><br /></li><li class="btns">]]></prepend></html>
<attrs><class>btn</class></attrs>
<event><onclick><![CDATA['\$reconfig.save("user.php","update");']]></onclick></event>
<in>false</in><out>false</out>
</item>
<item>
<type>button</type><name>insert</name><value>insert</value>
<attrs><class>btn</class></attrs>
<event><onclick><![CDATA['\$reconfig.save("user.php","insert");']]></onclick></event>
<in>false</in><out>false</out>
</item>
<item>
<type>button</type><name>remove</name><value>remove</value>
<html><append><![CDATA[</li></ul>]]></append></html>
<attrs><class>btn</class></attrs>
<event><onclick><![CDATA['\$reconfig.save("user.php","delete");']]></onclick></event>
<in>false</in><out>false</out>
</item>
</building>
<dblist>
<source>
<in>
<type>sql</type>
<driver>{$cname('__DRIVER__')}</driver><dbhost>{$cname('__HOST__')}</dbhost><dbname>{$cname('__DBNAME__')}</dbname><dbuser>{$cname('__USER__')}</dbuser><dbpass>{$cname('__PASS__')}</dbpass>
<query>show databases;</query>
</in>
</source>
</dblist>
<userlist>
<source>
<in>
<type>sql</type>
<driver>{$cname('__DRIVER__')}</driver><dbhost>{$cname('__HOST__')}</dbhost><dbname>{$cname('__DBNAME__')}</dbname><dbuser>{$cname('__USER__')}</dbuser><dbpass>{$cname('__PASS__')}</dbpass>
<query>SET @rank=0;</query>
<query>SELECT @rank:=@rank+1 as id,CONCAT(User,'@',Host) AS userdef,Host,User FROM user</query>
</in>
</source>
</userlist>
</root>
EOF;
|