Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

user.admin.php

Go to the documentation of this file.
00001 <?php 00002 if(!isset($_GET['action'])) 00003 { 00004 $users = $atom->getAllUsersData(); 00005 00006 ?> 00007 <table summary="list of users"><caption>list of <em>aBlog</em>’s users</caption> 00008 <thead> 00009 <tr> 00010 <th>login</th> 00011 <th>password</th> 00012 <th>lang</th> 00013 <th>name</th> 00014 <th>url</th> 00015 <th>email</th> 00016 <th>action</th> 00017 </tr> 00018 </thead> 00019 <tbody> 00020 <?php 00021 foreach($users as $key => $user) 00022 { 00023 ?> 00024 <tr> 00025 <td><a href="/atom/<?php echo $key?>"><?php echo $key;?></a></td> 00026 <td><?php echo pwdDecode($key,$user['password'],$SALT);?></td> 00027 <td><?php echo $user['name']?></td> 00028 <td><?php echo $user['lang']?></td> 00029 <td><?php if(!empty($user['url'])){echo '<a href="'.$user['url'].'">'.$user['url'].'</a>';}else{echo '-';}?></td> 00030 <td><?php if(!empty($user['email'])){echo emailformat($user['email']);}else{echo '-';}?></td> 00031 <td> 00032 <ul> 00033 <li><a href="?page=user&amp;action=edit&amp;user=<?php echo $key; ?>">edit</a>, </li> 00034 <li><a href="?page=user&amp;action=del&amp;user=<?php echo $key; ?>" onclick="return confirm('Delete : <?php echo $key; ?> ?\n\n(There is no way to undo this)');">delete</a>, </li> 00035 <li><a href="?page=feed&amp;user=<?php echo $key;?>">feed</a>.</li> 00036 </ul> 00037 </td> 00038 </tr> 00039 <?php 00040 } 00041 ?> 00042 </tbody></table> 00043 <p><a href="?page=user&amp;action=new">add an user to list</a></p> 00044 <?php 00045 } 00046 elseif($_GET['action']=='edit' && !empty($_GET['user'])) 00047 { 00048 $login = $_GET['user']; 00049 $user = $atom->getUserData($login); 00050 ?> 00051 <form method="post" action="?page=user&amp;action=update&amp;user=<?php echo $login;?>"> 00052 <fieldset> 00053 <legend>Edit user "<?php echo $login;?>"</legend> 00054 <label> 00055 name : <input type="text" name="name" value="<?php echo $user['name']?>" /> 00056 </label> 00057 <label> 00058 password : <input type="text" name="password" value="<?php echo pwdDecode($login,$user['password'],$SALT);?>" /> 00059 </label> 00060 <label> 00061 lang : 00062 <select name="lang"> 00063 <option value="en"<?php if($user['lang'] == 'en'){echo ' selected=selected';}?>>en</option> 00064 <option value="fr"<?php if($user['lang'] == 'fr'){echo ' selected=selected';}?>>fr</option> 00065 </select> 00066 </label> 00067 <label> 00068 url : <input type="text" name="url" value="<?php echo $user['url']?>" /> 00069 </label> 00070 <label> 00071 email : <input type="text" name="email" value="<?php echo $user['email']?>" /> 00072 </label> 00073 <input type="submit" class="submit" value="update user" /> 00074 </fieldset> 00075 </form> 00076 <?php 00077 } 00078 elseif($_GET['action']=='update' && !empty($_GET['user'])) 00079 { 00080 $login = $_GET['user']; 00081 $_POST['password'] = pwdEncode($login,$_POST['password'],$SALT); 00082 00083 $uservalue = array('password','url','lang','email','name'); 00084 $data = array('login'=>$login); 00085 00086 foreach($_POST as $key => $value) 00087 { 00088 if(in_array($key,$uservalue)) 00089 { 00090 $data[$key] = $_POST[$key]; 00091 } 00092 } 00093 00094 $atom->setUserData($data); 00095 ?> 00096 <p><strong>"<?php echo $login;?>" updated</strong>. <a href="/admin.php">Click here to continue</a>.</p> 00097 <?php 00098 } 00099 elseif($_GET['action']=='del' && !empty($_GET['user'])) 00100 { 00101 $login = $_GET['user']; 00102 $atom->delUser($login); 00103 ?> 00104 <p><strong>"<?php echo $login;?>" deleted</strong>. <a href="/admin.php">Click here to continue</a>.</p> 00105 <?php 00106 } 00107 elseif($_GET['action'] == 'new') 00108 { 00109 ?> 00110 <form method="post" action="?page=user&amp;action=add"> 00111 <fieldset> 00112 <legend>Add user</legend> 00113 <label> 00114 name : <input type="text" name="name" /> 00115 </label> 00116 <label> 00117 login : <input type="text" name="login" /> 00118 </label> 00119 <label> 00120 password : <input type="text" name="password" /> 00121 </label> 00122 <label> 00123 lang : 00124 <select name="lang"> 00125 <option value="en">en</option> 00126 <option value="fr">fr</option> 00127 </select> 00128 </label> 00129 <label> 00130 url : <input type="text" name="url" value="http://" /> 00131 </label> 00132 <label> 00133 email : <input type="text" name="email" /> 00134 </label> 00135 <input type="submit" class="submit" value="add user" /> 00136 </fieldset> 00137 </form> 00138 <?php 00139 } 00140 elseif($_GET['action'] == 'add') 00141 { 00142 $login = $_POST['login']; 00143 $_POST['password'] = pwdEncode($login,$_POST['password'],$SALT); 00144 00145 $uservalue = array('login','password','lang','url','email','name'); 00146 00147 foreach($_POST as $key => $value) 00148 { 00149 if(in_array($key,$uservalue)) 00150 { 00151 $data[$key] = $_POST[$key]; 00152 } 00153 } 00154 00155 if($atom->addUser($data)) 00156 { 00157 ?> 00158 <p><strong>"<?php echo $data['login'];?>" added</strong>. <a href="/admin.php">Click here to continue</a>.</p> 00159 <?php 00160 } 00161 else 00162 { 00163 ?> 00164 <p><strong>error with "<?php echo $data['login'];?>"</strong>, try another login. <a href="/admin.php?page=user&amp;action=new">Click here to go back</a>.</p> 00165 <?php 00166 } 00167 } 00168 else 00169 { 00170 ?> 00171 <p><em>lost ?</em> <a href="/admin.php">Click here to go back</a>.</p> 00172 <?php 00173 } 00174 ?>

Generated on Fri Jun 25 00:00:22 2004 for a(tom)Blog by doxygen 1.3.7