[PHPPlanner-cvs] phpplanner/admin permissions.php,NONE,1.1
Status: Beta
Brought to you by:
tomsommer
From: Jeppe A. <no...@us...> - 2004-04-27 18:03:21
|
Update of /cvsroot/phpplanner/phpplanner/admin In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27339/admin Added Files: permissions.php Log Message: * Added permissions.php to /admin for changing individual user permissions --- NEW FILE: permissions.php --- <?php ini_set('include_path','../'); require_once('../common.php'); require('../lib/libconfig.php'); function toggle_priv($cell) { $SQL = mysql_query("select * from cal_users where id = " . $_GET['id'] . ""); $RS = mysql_fetch_array($SQL); if( $RS[$cell] == "true" ) { mysql_query("update cal_users set $cell = 'false' WHERE id = '" . $_GET['id'] ."'") or die("Failed to change permission " . mysql_error()); } else { mysql_query("update cal_users set $cell = 'true' WHERE id = '" . $_GET['id'] ."'") or die("Failed to change permission " . mysql_error()); } } if ( isset($_GET['toggle']) ) { switch ( $_GET['toggle'] ) { case "add": toggle_priv("allow_add"); break; case "edit": toggle_priv("allow_edit"); break; case "delete": toggle_priv("allow_delete"); break; case "admin": toggle_priv("is_admin"); break; } } ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd"> <html> <head> <title>Users</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <link href="css.css" rel="stylesheet" type="text/css"> </head> <body> <table border="0" cellspacing="0" cellpadding="0" class="table"> <tr> <td colspan="6" class="headline">Users</td> </tr> <tr> <td width="125"><em><strong>Name</strong></em></td> <td width="117"><em><strong>E-Mail</strong></em></td> <td width="84"><em><strong>Allow add</strong></em></td> <td width="93"><em><strong>Allow edit</strong></em></td> <td width="112"><em><strong>Allow delete</strong></em></td> <td width="67"><em><strong>Admin</strong></em></td> </tr> <?php $sql = mysql_query("SELECT * FROM cal_users WHERE is_validated = 'true'"); while ( $rs = mysql_fetch_assoc($sql) ) { ?> <tr> <td><?= $rs['name'] ?></td> <td><font size="1"> <?= $rs['email'] ?> </font></td> <td><?php if ($rs['allow_add'] == "true") { echo "<font color=\"green\" size=\"1\">"; } else { echo "<font color=\"red\" size=\"1\">"; } ?> <?= $rs['allow_add'] ?> <a href="<?= $_SERVER['PHP_SELF'] ?>?toggle=add&id=<?= $rs['id'] ?>">[T]</a></font></td> <td><?php if ($rs['allow_edit'] == "true") { echo "<font color=\"green\" size=\"1\">"; } else { echo "<font color=\"red\" size=\"1\">"; } ?> <?= $rs['allow_edit'] ?> <a href="<?= $_SERVER['PHP_SELF'] ?>?toggle=edit&id=<?= $rs['id'] ?>">[T]</a></font></td></td> <td><?php if ($rs['allow_delete'] == "true") { echo "<font color=\"green\" size=\"1\">"; } else { echo "<font color=\"red\" size=\"1\">"; } ?> <?= $rs['allow_delete'] ?> <a href="<?= $_SERVER['PHP_SELF'] ?>?toggle=delete&id=<?= $rs['id'] ?>">[T]</a></font></td></td> <td><?php if ($rs['is_admin'] == "true") { echo "<font color=\"green\" size=\"1\">"; } else { echo "<font color=\"red\" size=\"1\">"; } ?> <?= $rs['is_admin'] ?> <a href="<?= $_SERVER['PHP_SELF'] ?>?toggle=admin&id=<?= $rs['id'] ?>">[T]</a></font></td></td> </tr> <? } ?> </table> </body> </html> |