[Openfirst-cvscommit] members/admin index.php,NONE,1.1 editmember.php,NONE,1.1 editdivisions.php,NON
Brought to you by:
xtimg
From: <dav...@us...> - 2003-12-22 23:10:12
|
Update of /cvsroot/openfirst/members/admin In directory sc8-pr-cvs1:/tmp/cvs-serv2107 Added Files: index.php editmember.php editdivisions.php Log Message: initial upload --- NEW FILE: index.php --- <?php /* * openFIRST.members - admin/index.php * * Copyright (C) 2003, * openFIRST Project * Original Author: David Di Biase <dav...@ea...> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ // Include system globals and headers include_once("../../config/globals.php"); include_once($header); // Check if user is a member if(! isset($user->user)) { die(showlogin() . include($footer)); } if(isset($_GET["delete"])) { $q = ofirst_dbquery("DELETE FROM ofirst_members WHERE member = '" . $_GET["delete"] . "';"); } ?> <h1>Manage Users</h1> <table> <tr> <th>Username</th> <th>Full Name</th> <th>Division Name</th> <th>Options</th> </tr> <?php // List divisions $member_query = ofirst_dbquery("SELECT * FROM ofirst_members;"); while($member = ofirst_dbfetch_object($member_query)) { ?> <tr> <td><?php echo $member->user; ?></td> <td><?php echo $member->firstname; ?> <?php echo $member->lastname; ?></td> <td><a href='/members/divisions.php?division=<?php echo $member->division; ?>'><?php echo $member->division; ?></a></td> <td> <a href='editmember.php?user=<?php echo $member->user; ?>'><img src='<?php echo $home.$basepath; ?>/members/icons/actions/edit.png' border="0"></a> <a href='index.php?delete=<?php echo $member->user; ?>'><img src='<?php echo $home.$basepath; ?>/members/icons/actions/button_cancel.png' border="0"></a> </td> </tr> <?php } ?> </table><br> <?php include_once($footer); ?> --- NEW FILE: editmember.php --- <?php /* * openFIRST.members - admin/editmember.php * * Copyright (C) 2003, * openFIRST Project * Original Author: David Di Biase <dav...@ea...> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ // Include system globals and headers include_once("../../config/globals.php"); include_once($header); // Check if user is a member if(! isset($user->user)) { die(showlogin() . include($footer)); } if (isset($_POST["firstname"]) == true) { if(isset($_POST["ndivision"]) == true && $_POST["ndivision"] != "") { $_POST["division"] = $_POST["ndivision"]; $q = ofirst_dbquery("INSERT INTO ofirst_divisions (division) VALUES ('" . $_POST["division"] . "');"); $q = ofirst_dbquery("UPDATE ofirst_divisions SET description='" . $_POST["divisiondescription"] . "' WHERE division='" . $_POST["division"] . "';"); } if($_POST["cellphonesms"] == "0") { $_POST["cellphonesms"] = true; $user->cellphonesms = "1"; } else { $_POST["cellphonesms"] = false; $user->cellphonesms = "0"; } $query = "UPDATE ofirst_members SET firstname='" . $_POST["firstname"] . "', lastname='" . $_POST["lastname"] . "', division='" . $_POST["division"] . "', year='" . $_POST["year"] . "', email='" . $_POST["email"] ."', icq='" . $_POST["icq"] . "', aim='" . $_POST["aim"] . "', msn='" . $_POST["msn"] . "', yim='" . $_POST["yim"] . "', signature='" . $_POST["signature"] . "', description='" . $_POST["description"] . "', picturelocation='" . $_POST["picturelocation"] . "', cellphonenumber='" . $_POST["cellphonenumber"] . "', cellphonecarrier='" . $_POST["cellphonecarrier"] . "', cellphonesms='" . $_POST["cellphonesms"] . "' WHERE user='".$_GET['user']."';"; $q = ofirst_dbquery($query); if(isset($_POST["password"]) == true && isset($_POST["cpassword"]) == true) { if($_POST["password"] == $_POST["cpassword"] && $_POST["password"] != "") { $query = ofirst_dbquery("UPDATE ofirst_members SET password='" . cryptpassword($_POST["password"], $encryption) ."' WHERE user='$user->user';"); echo("<br><br>Password Changed. "); } elseif ($_POST["password"] != $_POST["cpassword"]) { echo("<br><br>The password and confirm password fields do not match."); } } $user = ofirst_dbfetch_object(ofirst_dbquery("SELECT * FROM ofirst_members WHERE user='".$_GET['user']."';")); echo("<br><font color='green'>Profile updated.</font>"); } ?> <h1>Edit Member Account</h1> <p><a href="<?php echo $basepath; ?>/members/admin/">Back to Member List</a></p> <form action='editmember.php?user=<?php echo $_GET['user']; ?>' onsubmit="return dhtmlEditorPrepareSubmit();" method='post'> <table> <tr> <th> </th> <th>Content</th></tr> <tr><th>Username</th><td><?php echo $user->user; ?></td></tr> <tr><th>First Name</th><td><input type='text' name='firstname' value='<?php echo $user->firstname; ?>' /></td></tr> <tr><th>Last Name</th><td><input type='text' name='lastname' value='<?php echo$user->lastname; ?>' /></td></tr> <tr><th>Password</th><td><input type='password' name='password' value='' /></td></tr> <tr><th>Confirm Password</th><td><input type='password' name='cpassword' value='' /></td></tr> <tr><th>Division</th> <td> Existing: <br><select name='division'> <?php $div = ofirst_dbquery("SELECT division FROM ofirst_divisions;"); while($d = ofirst_dbfetch_object($div)) { echo("<option value='$d->division'"); if($d->division == $user->division) { echo(" selected='selected'"); } echo(">$d->division</option>"); } ?> </select> <br> <br> <table align="left"> <tr> <th>New Division</th> </tr> <tr> <td>Division Name<br> <input type='text' name='ndivision' /> <br> Description of New Division <br> <input type='text' name='divisiondescription' /></td> </tr> </table> </td> </tr> <tr><th>Year</th><td><input type='text' name='year' value='<?php echo $user->year; ?>'></td></tr> <tr><th>E-mail Address</th><td><input type='text' name='email' value='<?php echo $user->email; ?>'></td></tr> <tr><th>Cell Phone/Pager Information</th><td> Number (10 digit)<input type='text' value='<?php echo $user->cellphonenumber; ?>' name='cellphonenumber' maxlength='10'> <br>Carrier <select name='cellphonecarrier'> <?php // Populate cell phone carrier space $query = ofirst_dbquery("SELECT * FROM ofirst_cellphonecarriers ORDER BY fullname;"); while($sms = ofirst_dbfetch_object($query)) { if(isset($user->smsaddress) == true && ($user->smsaddress == "" && $sms->smsaddress == "txt.bellmobility.ca") || ($user->cellphonecarrier == $sms->smsaddress)) { echo("<option value='$sms->smsaddress' selected='selected'>$sms->fullname</option>\n"); } else { echo("<option value='$sms->smsaddress'>$sms->fullname</option>\n"); } } ?> </select> <?php // Check user specified cell info if($user->cellphonesms == "1") { echo("</select><br><input type='checkbox' checked='checked' value='0' name='cellphonesms'>Device is SMS Enabled"); } else { echo("</select><br><input type='checkbox' value='0' name='cellphonesms'>Device is SMS Enabled"); } ?> </td> </tr> <tr> <th>ICQ Number</th><td><input type='text' name='icq' value='<?php echo $user->icq; ?>'></td> </tr> <tr> <th>AIM Screenname</th><td><input type='text' name='aim' value='<?php echo $user->aim; ?>'></td></tr> <tr> <th>MSN Messenger</th> <td><input type='text' name='msn' value='<?php echo $user->msn; ?>'></td></tr> <tr> <th>Yahoo! Instant Messenger</th> <td><input type='text' name='yim' value='<?php echo $user->yim; ?>'></td></tr> <tr> <th>Freeform Description</th><td> <?php if (function_exists("make_wysiwyg")) { make_wysiwyg("description",400,200,$user->description); } else { ?><textarea name="description" cols="40" rows="20">$user->description</textarea> <?php } ?> </td> </tr> <tr> <th>Signature</th> <td><textarea name='signature' cols="40" rows="5"><?php echo $user->signature; ?></textarea></td> </tr> <tr> <th>Picture Location</th> <td><input type='text' name='picturelocation' value='<?php echo $user->picturelocation; ?>'></td> </tr> <tr> <td> </td> <td><input type="submit" value="Update Profile"> <input type="reset" value="Reset Profile"> </tr> </table> </form> <?php include_once($footer); ?> --- NEW FILE: editdivisions.php --- <?php /* * openFIRST.members - admin/editdivisions.php * * Copyright (C) 2003, * openFIRST Project * Original Author: David Di Biase <dav...@ea...> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ // Include system globals and headers include_once("../../config/globals.php"); include_once($header); // Check if user is a member if(! isset($user->user)) { die(showlogin() . include($footer)); } if(isset($_POST["newdivision"])) { $q = ofirst_dbquery("INSERT INTO ofirst_divisions (division, description) VALUES ( '" . $_POST["division"] . "', '" . $_POST["divisiondescription"] . "');"); } if(isset($_GET["delete"])) { $q = ofirst_dbquery("DELETE FROM ofirst_divisions WHERE division = '" . $_GET["delete"] . "';"); } ?> <h1>Edit Divisions</h1> <p> <?php if(isset($_GET['update'])){ if(isset($_POST["update"])) { $q = ofirst_dbquery("UPDATE ofirst_divisions SET division = '".$_POST['updivision']."', description = '".$_POST['updescription']."' WHERE division = '" . $_GET["update"] . "';"); } $division_query = ofirst_dbquery("SELECT * FROM ofirst_divisions WHERE division = '".$_GET['update']."';"); $division = ofirst_dbfetch_object($division_query); ?> </p> <form method="POST" action="editdivisions.php?update=<?php echo $_GET['update']; ?>"> <table width="41%"> <tr> <th> </th> <th><?php echo $_GET['update']; ?> Division Edit</th> </tr> <tr> <td width="32%">Division Name</td> <td width="68%"> <input name="updivision" type="text" id="updivision" value="<?php echo $division->division; ?>" /> </td> </tr> <tr> <td>Description </td> <td><textarea name="updescription" cols="40" rows="10" id="textarea2" value="<?php echo $division->description; ?>"><?php echo $division->description; ?></textarea></td> </tr> <tr> <td> </td> <td><input name="update" type="submit" id="update" value="Update"></td> </tr> </table> </form> <?php } ?> <table width="519"> <tr> <th>Division Name</th> <th>Description</th> <th>Delete</th> </tr> <?php // List divisions $d = ofirst_dbquery("SELECT * FROM ofirst_divisions;"); while ($div = ofirst_dbfetch_object($d)) { ?> <tr> <td width="138"><a href='editdivisions.php?update=<?php echo $div->division; ?>'><?php echo $div->division; ?></a></td> <td width="321"><?php echo $div->description; ?></td> <td width="44"><a href='editdivisions.php?delete=<?php echo $div->division; ?>'><img src='<?php echo $home.$basepath; ?>/members/icons/actions/button_cancel.png' border="0"></a></td> </tr> <?php } ?> </table> <br> Note: Please make sure no one is in a division before you delete it. If you delete<br> a division with users assigned to it, you may receive errors.<br> <form method="POST" action="editdivisions.php"> <table width="41%"> <tr> <th> </th> <th>Add New Division</th> </tr> <tr> <td width="32%">Division Name</td> <td width="68%"> <input name="division" type="text" id="division" /> </td> </tr> <tr> <td>Description </td> <td><textarea name="divisiondescription" id="divisiondescription"></textarea></td> </tr> <tr> <td> </td> <td><input name="newdivision" type="submit" id="newdivision" value="Create Division"></td> </tr> </table> </form> <p> <?php include_once($footer); ?> </p> <p> </p> |