Web-interface for ...
http://freebsd-r16.narod.ru/freebsd/proftpd_mysql.html
----------------
replace
< -> <
----------------
<?php
$host = "localhost";
$user = "proftpd";
$pass = "dptforp";
$db = "proftpd";
$tb = "accounts";
$_id = "1111";
mysql_connect($host,$user,$pass);
mysql_select_db($db);
echo '<html><head><style type="text/css">';
//echo 'td { font-size: 14px; text-align: center; font-family: Courier New; }';
echo 'td { font-size: 14px; font-family: Courier New; }';
echo 'body { font-size: 14px; background-color: #CCFFFF; font-family: Courier New; }';
echo 'font { font-size: 26px; font-family: Tahoma; }';
echo '.x { font-size: 16px; font-family: Tahoma; }';
echo '</style></head><body>';
echo '<div align="right">ProFTPd Web-Admin. v.0.1</div>';
echo '<div align="right">make in JSC Fort Dialog</div><br>';
echo '<div align="center"><font>+ / - & Modify accounts</font></div>';
echo '<table align="center" border="1" width="50%">';
echo '<tr><td width="50%">';
//--- CREATE USER BEGIN ------------------------------------------------------------------------------------------->
//echo '<hr>';
echo '<b><br><center><font class="x">_Create!</font></center></b><br>';
echo '<form metod="GET" action="index.php">';
echo ' <b>user:</b> <input type="text" name="_user_add" value="_" size="0"><br>';
echo ' <b>pass:</b> <input type="text" name="_pass_add" value="_" size="0"><br>';
echo ' <b>descr: </b><input type="text" name="_descr_add" value="_" size="0"><br><br>';
echo '<center><input type="submit" name="_but_add" size="30" value="enter">';
echo '</form>';
if ($_GET['_but_add'])
{
if (isset($_GET['_user_add']) and !empty($_GET['_user_add']))
{
if (isset($_GET['_pass_add']) and !empty($_GET['_pass_add'])) {
// SELECT MAX(`id`) FROM accounts
// INSERT INTO proftpd.accounts VALUES('','test',ENCRYPT('123'),'1111','1111','/work/test','/usr/sbin/nologin','_empty_');
$qMax="SELECT MAX(id) FROM accounts";
$res=mysql_query($qMax);
while ($mas=mysql_fetch_array($res)) {
$id=$mas['MAX(id)'] + $_id;
}
// echo $id;
$qAdd="INSERT INTO proftpd.accounts VALUES('','".$_GET['_user_add']."',ENCRYPT('".$_GET['_pass_add']."'),'".$id."','".$id."','/work/".$_GET['_user_add']."','/usr/sbin/nologin','".$_GET['_descr_add']."');";
mysql_query($qAdd);
echo '<script>document.location.href = \'index.php\';</script>';
}
// else { echo '<script>alert(\'Empty password!\');</script>'; }
}
// else { echo '<script>alert(\'Empty username!\');</script>'; }
}
//--- CREATE USER END --------------------------------------------------------------------------------------------->
echo '</td><td width="50%">';
//--- DELETE USER BEGIN ------------------------------------------------------------------------------------------->
//echo '<hr>';
echo '<b><center><font class="x">_Delete!</font></b><br><br>';
echo '<form metod="GET" action="index.php">';
echo '<b>id:</b><input type="text" name="_id_del" value="_" size="3"><br><br>';
echo '<input type="submit" name="_but_del" value="enter">';
echo '</form>';
if ($_GET['_but_del'])
{
if (isset($_GET['_id_del']) and !empty($_GET['_id_del']))
{
// DELETE FROM proftpd.accounts WHERE id = '2'
$qDel="DELETE FROM proftpd.accounts WHERE id = '".$_GET['_id_del']."'";
mysql_query($qDel);
echo '<script>document.location.href = \'index.php\';</script>';
}
// else { echo '<script>alert(\'Empty id!\');</script>'; }
}
//--- DELETE USER END --------------------------------------------------------------------------------------------->
echo '</td><tr><td>';
//--- CHANGE PASS BEGIN ------------------------------------------------------------------------------------------->
//echo '<hr>';
echo '<br><b><center><font class="x">_Modify password!</font></b><br><br>';
echo '<form metod="GET" action="index.php">';
echo '<b>pass:</b><input type="text" name="_pass_pass" value="_" size="0"><br>';
echo '<b>id:</b><input type="text" name="_id_pass" value="_" size="3"><br><br>';
echo '<center><input type="submit" name="_but_pass" value="enter">';
echo '</form>';
if ($_GET['_but_pass'])
{
if (isset($_GET['_id_pass']) and !empty($_GET['_id_pass']))
{
if (isset($_GET['_pass_pass']) and !empty($_GET['_pass_pass'])) {
// UPDATE proftpd.accounts SET pass = ENCRYPT('123') WHERE id = '1'
$qPass="UPDATE proftpd.accounts SET pass = ENCRYPT('".$_GET['_pass_pass']."') WHERE id = '".$_GET['_id_pass']."'";
mysql_query($qPass);
echo '<script>document.location.href = \'index.php\';</script>';
}
// else { echo '<script>alert(\'Empty password!\');</script>'; }
}
// else { echo '<script>alert(\'Empty id!\');</script>'; }
}
//--- CHANGE PASS END --------------------------------------------------------------------------------------------->
echo '</td><td>';
//--- CHANGE DESCR BEGIN ------------------------------------------------------------------------------------------->
//echo '<hr>';
echo '<br><b><center><font class="x">_Modify description!</font></b><br><br>';
echo '<form metod="GET" action="index.php">';
echo '<b>descr:</b><input type="text" name="_descr_descr" value="_" size="0"><br>';
echo '<b>id:</b><input type="text" name="_id_descr" value="_" size="3"><br><br>';
echo '<center><input type="submit" name="_but_descr" value="enter">';
echo '</form>';
if ($_GET['_but_descr'])
{
if (isset($_GET['_id_descr']) and !empty($_GET['_id_descr']))
{
if (isset($_GET['_descr_descr']) and !empty($_GET['_descr_descr'])) {
// UPDATE proftpd.accounts SET descr = 'user for test's...' WHERE id = '1'
$qDescr="UPDATE proftpd.accounts SET descr = '".$_GET['_descr_descr']."' WHERE id = '".$_GET['_id_descr']."'";
mysql_query($qDescr);
echo '<script>document.location.href = \'index.php\';</script>';
}
// else { echo '<script>alert(\'Empty description!\');</script>'; }
}
// else { echo '<script>alert(\'Empty id!\');</script>'; }
}
//--- CHANGE DESCR END --------------------------------------------------------------------------------------------->
echo '</td></tr></table><br><br>';
//--- CAT in DOCUMENT -------------------------------------------------------------------------->
echo '<div align="center"><font>Table users from mysql</font></div>';
echo '<table align="center" border="1" width="60%">';
echo '<tr><td width="5%" align="center"><b>id</td><td width="20%" align="center"><b>user</td><td width="*" align="center"><b>descr</td></tr>';
$qAll="SELECT id,user,home,descr FROM accounts";
$res=mysql_query($qAll);
while ($mas=mysql_fetch_array($res)) {
echo '<tr><td align="center">'.$mas['id'].'</td><td align="center">'.$mas['user'].'</td><td align="center">'.$mas['descr'].'</td></tr>';
}
echo '</table>';
//--- CAT in DOCUMENT -------------------------------------------------------------------------->
echo '</body></html>';
mysql_close();
?>