[Openfirst-cvscommit] members links.php,NONE,1.1
Brought to you by:
xtimg
From: <xt...@us...> - 2003-08-13 12:20:04
|
Update of /cvsroot/openfirst/members In directory sc8-pr-cvs1:/tmp/cvs-serv12285 Added Files: links.php Log Message: Add links page to members area (complete with file icons, categories, members being able to add links) Requirements in future: allow modification of existing links --- NEW FILE: links.php --- <?php /* * openFIRST.members - links.php * * Copyright (C) 2003, * openFIRST Project * Original Author: Tim Ginn <tim...@po...> * * 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("../config/globals.php"); include($header); if (isset($_POST["ncategory"]) == true && isset($user->user) == true && $_POST["ncategory"] != "") { $q = mysql_query("INSERT INTO ofirst_resources_categories (category) VALUES ('" . $_POST["ncategory"] . "');"); $_POST["category"] = $_POST["ncategory"]; } if (isset($_POST["address"]) == true && isset($user->user) == true) { $q = mysql_query("INSERT INTO ofirst_resources_links (address, name, category, type, creator, date) VALUES ('" . $_POST["address"] . "', '" . $_POST["name"] . "', '" . $_POST["category"] . "', '" . $_POST["type"] . "', '$user->user', '" . date("D M d Y") . "');"); } ?> <h1>Link Listing</h1> <?php $cats = mysql_query("SELECT category FROM ofirst_resources_categories;"); while($c = mysql_fetch_object($cats)) { echo("<h2>$c->category</h2>"); echo("<table> <tr><th>Type</th><th>Link</th><th>Creator</th><th>Date</th></tr>"); $links = mysql_query("SELECT * FROM ofirst_resources_links WHERE category='$c->category';"); while($l = mysql_fetch_object($links)) { echo("<tr><td><img src='$l->type' alt=''></td><td><a href='$l->address'>$l->name</a></td><td>$l->creator</td><td>$l->date</td></tr>"); } echo("</table>"); } ?> <?php if(isset($user->user)) { echo("<h2>Add A Link</h2> <form method='post' action='links.php'> <table> <tr><th>Link Name</th><td><input type='text' name='name' value=''></td></tr> <tr><th>Link Address</th><td><input type='text' name='address' value='http://'></td></tr> <tr><th>Category</th><td> <select name='category'>"); $cats = mysql_query("SELECT category FROM ofirst_resources_categories;"); while($c = mysql_fetch_object($cats)) { echo("<option value='$c->category'>$c->category</option>"); } echo(" </select> or new category: <input type='text' name='ncategory'></td></tr> <tr><th>Type of Document</th><td> <select name='type'>"); $types = mysql_query("SELECT image, description FROM ofirst_workspace_filetypes GROUP BY description ORDER BY description;"); while ($type = mysql_fetch_object($types)) { if($type->description == "HTML Page") { echo("<option value='$type->image' selected='selected'>$type->description</option>"); } else { echo("<option value='$type->image'>$type->description</option>"); } } echo(" </select> </td></tr> <tr><th>Add Link</th><td><input type='submit' value='Add Link'></td></tr> </table> </form>"); } else { echo("<h2>Login to Add A Link</h2>"); showlogin(); } include($footer); ?> |