topical media & game development
[] readme course(s) preface I 1 2 II 3 4 III 5 6 7 IV 8 9 10 V 11 12 afterthought(s) appendix reference(s) example(s) resource(s) _

talk show tell print

portal-cms-user_management.php



  <?php
  
          if (isset(_COOKIE['admin_Id'])) {
          } else {
          header('Location: index.php');
          }
          
  include(<config.php>);
  
  add = _POST['add'];
  del = _GET['del'];
  new = _GET['new'];
  
  if(del) {
  query2 = "DELETE from admins where admin_id=del";
  result2 = mysql_query(query2);
          if(!result2) {
                  die('Invalid query: ' . mysql_error());
          }
  }
  
  if(add) {
  user = _POST['user'];
  pass = _POST['pass'];
  email = _POST['email'];
  query = "INSERT INTO admins(admin_id, admin_username, admin_password, admin_email) values ('', 'user', MD5('pass'), 'email')";
  result = mysql_query(query);
          if(!result) {
                  die('Invalid query: ' . mysql_error());
          }
  echo "<meta http-equiv=\"refresh\" content=\"0;url=user_management.php\">";
  }
  
  ?>
  <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  <html xmlns="http://www.w3.org/1999/xhtml">
  <!-- DW6 -->
  <head>
  <!-- Copyright 2005 Macromedia, Inc. All rights reserved. -->
  <title>Climate Portal Content Management System</title>
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  <link rel="stylesheet" href="cms.css" type="text/css" />
  <style type="text/css">
  <!--
  .style1 {color: #FFFFFF}
  .style3 {color: #CCFFCC}
  .style5 {font-size: 24px}
  .style6 {color: #D4D0C8}
  -->
  </style>
  </head>
  <body bgcolor="#cccccc">
  <table width="100%" border="0" cellspacing="0" cellpadding="0">
          <tr>
          <td width="15" nowrap="nowrap"><img src="file: 
D|/Program%20Files/%5Bwebdesign%5D/dreamweaver%208/Dreamweaver%208/Configuration/BuiltIn/StarterPages/mm_spacer.gif" alt="" width="15" height="1" border="0" /></td>

<td height="74" colspan="3" class="logo" nowrap="nowrap"><br /> <span class="style1"> CLIMATE<span class="style3">PORTAL</span> <span class="style5">CMS</span></span> </td> <td width="4">&nbsp;</td> <td width="574">&nbsp;</td> </tr> <tr bgcolor="#ffffff"> <td colspan="6"></td> </tr> <tr bgcolor="#a4c2c2"> <td width="15" nowrap="nowrap">&nbsp;</td> <td height="36" colspan="3" id="navigation" class="navText"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span class="style6">ADD ITEM </a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; EDIT ITEM </a>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; CATEGORIES </a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; USER MANAGEMENT</a></span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; RSS ADMIN</a></span></td> <td width="4">&nbsp;</td> <td width="574">&nbsp;</td> </tr> <tr bgcolor="#ffffff"> <td colspan="6"><img src="file:
D|/Program%20Files/%5Bwebdesign%5D/dreamweaver%208/Dreamweaver%208/Configuration/BuiltIn/StarterPages/mm_spacer.gif" alt="" width="1" height="1" border="0" /></td>

</tr> <tr bgcolor="#ffffff"> <td colspan="2" valign="top" bgcolor="#a4c2c2">&nbsp;</td> <td width="50" valign="top"><img src="file:
D|/Program%20Files/%5Bwebdesign%5D/dreamweaver%208/Dreamweaver%208/Configuration/BuiltIn/StarterPages/mm_spacer.gif" alt="" width="50" height="1" border="0" /></td>

<td width="536" valign="top"><br /> <br /> <table border="0" cellspacing="0" cellpadding="0" width="600"> <tr> <td width="600" class="pageName"><p>User Management </p></td> </tr> <?php if(new) { ?> <form method="post" action=""> <table border="0" cellspacing="0" cellpadding="0" width="600"> <tr> <td> Username: <input type="text" name="user" size="30" value=""/></td> </tr> <tr> <td> Password: <input type="text" name="pass" size="30" value=""/></td> </tr> <tr> <td> Email:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="text" name="email" size="30" value=""/></td> </tr> <tr> <td><input type="submit" value="Submit" name="add" /></td> </tr> </table> </form> <?php } else { ?> <?php query = "SELECT * FROM admins"; res = mysql_query(query); while(row = mysql_fetch_array(res)) { ?> <tr> <td> <?php echo row['admin_username']; ?></td> <td>
</td>
</tr> <?php } } ?> <tr> <td>&nbsp;</td> </tr> <tr> <td>Add New User</a></td> </tr> <tr> <td>&nbsp;</td> </tr> </table> </td> <td width="4">&nbsp;</td> <td width="574">&nbsp;</td> </tr> <tr> <td colspan="6"><img src="file:
D|/Program%20Files/%5Bwebdesign%5D/dreamweaver%208/Dreamweaver%208/Configuration/BuiltIn/StarterPages/mm_spacer.gif" alt="" width="1" height="1" border="0" /></td>

</tr> <tr> <td width="15">&nbsp;</td> <td width="4">&nbsp;</td> <td width="50">&nbsp;</td> <td width="536">&nbsp;</td> <td width="4">&nbsp;</td> <td width="574">&nbsp;</td> </tr> </table> </body> </html>


(C) A. Eliëns 2/9/2007

You may not copy or print any of this material without explicit permission of the author or the publisher.
In case of other copyright issues, contact the author.