ListField.php 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. <?php
  2. define('EmpireCMSAdmin','1');
  3. require("../../class/connect.php");
  4. require("../../class/db_sql.php");
  5. require("../../class/functions.php");
  6. require("class/functions.php");
  7. $link=db_connect();
  8. $empire=new mysqlquery();
  9. //验证用户
  10. $lur=is_login();
  11. $logininid=$lur['userid'];
  12. $loginin=$lur['username'];
  13. $loginrnd=$lur['rnd'];
  14. $loginlevel=$lur['groupid'];
  15. $loginadminstyleid=$lur['adminstyleid'];
  16. //ehash
  17. $ecms_hashur=hReturnEcmsHashStrAll();
  18. //验证权限
  19. CheckLevel($logininid,$loginin,$classid,"dbdata");
  20. //数据库
  21. $mydbname=RepPostVar($_GET['mydbname']);
  22. $mytbname=RepPostVar($_GET['mytbname']);
  23. if(empty($mydbname)||empty($mytbname))
  24. {
  25. printerror("NotChangeBakTable","history.go(-1)");
  26. }
  27. $form=RepPostVar($_GET['form']);
  28. if(empty($form))
  29. {
  30. $form='ebakchangetb';
  31. }
  32. $usql=$empire->usequery("use `$mydbname`");
  33. $sql=$empire->query("SHOW FIELDS FROM `".$mytbname."`");
  34. ?>
  35. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
  36. <html>
  37. <head>
  38. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  39. <title>表字段列表</title>
  40. <link href="../adminstyle/<?=$loginadminstyleid?>/adminstyle.css" rel="stylesheet" type="text/css">
  41. <script>
  42. function ChangeAutoField(f)
  43. {
  44. var tbname="<?=$mytbname?>";
  45. var chstr=tbname+"."+f;
  46. var r;
  47. var dh=",";
  48. var a;
  49. a=opener.document.<?=$form?>.autofield.value;
  50. r=a.split(chstr);
  51. if(r.length!=1)
  52. {return true;}
  53. if(a=="")
  54. {
  55. dh="";
  56. }
  57. opener.document.<?=$form?>.autofield.value+=dh+chstr;
  58. window.close();
  59. }
  60. </script>
  61. </head>
  62. <body>
  63. <table width="100%" border="0" align="center" cellpadding="3" cellspacing="1">
  64. <tr>
  65. <td>位置:<b><?=$mydbname?>.<?=$mytbname?></b> 字段列表</td>
  66. </tr>
  67. </table>
  68. <br>
  69. <table width="100%" border="0" cellpadding="3" cellspacing="1" class="tableborder">
  70. <tr class="header">
  71. <td height="27"> <div align="center">字段名</div></td>
  72. <td><div align="center">字段类型</div></td>
  73. <td><div align="center">字段属性</div></td>
  74. <td><div align="center">默认值</div></td>
  75. <td><div align="center">附加属性</div></td>
  76. </tr>
  77. <?
  78. while($r=$empire->fetch($sql))
  79. {
  80. $r[Field]="<a href='#ebak' onclick=\"ChangeAutoField('".$r[Field]."');\" title='加入去除自增值字段列表'>$r[Field]</a>";
  81. ?>
  82. <tr bgcolor="#FFFFFF">
  83. <td height="27"> <div align="center">
  84. <?=$r[Field]?>
  85. </div></td>
  86. <td> <div align="center">
  87. <?=$r[Type]?>
  88. </div></td>
  89. <td> <div align="center">
  90. <?=$r[Key]?>
  91. </div></td>
  92. <td> <div align="center">
  93. <?=$r['Default']?>
  94. </div></td>
  95. <td> <div align="center">
  96. <?=$r[Extra]?>
  97. </div></td>
  98. </tr>
  99. <?
  100. }
  101. db_close();
  102. $empire=null;
  103. ?>
  104. </table>
  105. <br>
  106. </body>
  107. </html>