refresh


"; } function addLink($title="",$url=""){ global $listId; if (!($title && $url)){ return; } /* $sql = "select max(linkClass) as class from linkList_links"; $st = mysql_query($sql); $row = mysql_fetch_array($st); $class = $row["class"]; if (!$class){ $class = "0"; } $sql = "select max(linkRank) as rank from linkList_links"; $st = mysql_query($sql); $row = mysql_fetch_array($st); $rank = $row["rank"]; if (!$rank){ $rank = "0"; } */ $class="0"; $rank="0"; mysql_query("insert into linkList_links (linkTitle, linkURL, linkClass, linkRank,listId) values ('$title','$url', $class, $rank,'$listId')"); } function deleteLink(){ global $deleteID; if ($deleteID){ mysql_query("delete from linkList_links where linkID = " . $deleteID); } } function addForm() { global $PHP_SELF; global $lls,$pswd,$listId; ?>
Title:
URL:  
title:
">

url:
"> ">






link"; if ($lls == $pswd){ print "classrank"; } print ""; foreach ($list as $link){ print ""; if ($lastClass != $link["linkClass"]){ print "---"; $lastClass = $link["linkClass"]; } ?> " TARGET="_blank"> - &classUp=1">+/&classDown=1">- &rankUp=1">+/&rankDown=1">- ">d-">e "; } print ""; } function linkList ($toClass=0,$toRank=0){ global $listId; $ret = Array(); $sql = "select * from linkList_links where listId='$listId'"; if ($toRank){ $where = "linkRank < $toRank"; } if ($toClass){ if ($where){ $where .= " and "; } $where .= "linkClass < $toClass"; } if ($where){ $sql .= " where $where"; } $sql .= " order by linkClass, linkRank, linkTitle"; $st = mysql_query($sql); while($row = mysql_fetch_array($st)){ array_push($ret,$row); } return $ret; } if ($createTable){ print "Creating table:
"; mysql_query(" create table linkList_links ( linkID int auto_increment, primary key (linkID), listId char(250), linkTitle char(250), linkURL char(250), linkRank int, linkClass int, visitTime timestamp ) ") or print "could not create table, might it exist?"; } /* Installation: 1. Edit the database connection info at the top of the file. 2. Edit the password at the top of the file 3. Place the file on your webserver. 4. To create the database table, visit the URL: http://yourdomain.com/path_to_lib/linkListLib.php?createTable=1 5. Anyone can add a link to the list by visiting: http://yourdomain.com/path_to_lib/linkListLib.php 6. To add/edit/re-arrange links, use the password you defined in step 2 in the following URL: http://yourdomain.com/path_to_lib/linkListLib.php?lls=your_password Usage: Example code for a short list of links in any page: include("linkListLib.php"); //the "1" below will give only top level (rank "0") sites. $list = linkList(1); if ($list){ foreach ($list as $link){ ?> " target="_blank">