Hi I'm trying to change the web links feature in phpnuke. Currently it does a sql call for all categories in the database. Then list all the categories. I just want the single category that the user selected add link from. I want it to catch the user id #($cid) and insert this into the addlink() function. I will past the code here incase your not sure what I'm talking about.
/**THIS IS THE SECTION THAT SEARCHES FOR THE CATAGORY**/
function AddLink() {
global $prefix, $dbi, $user, $links_anonaddlinklock;
include("header.php");
$mainlink = 1;
menu(1);
echo "<br>";
OpenTable();
echo "<center><font class=\"title\"><b>".ADDALINK."</b></font></center><br><br>";
if (is_user($user) || $links_anonaddlinklock == 1) { / 06-24-01 Bug fix : changed $links_anonaddlinklock != 1 to $links_anonaddlinklock == 1 /
echo "<b>".INSTRUCTIONS.":</b><br>"
."<strong><big>·</big></strong> ".SUBMITONCE."<br>"
."<strong><big>·</big></strong> ".POSTPENDING."<br>"
."<strong><big>·</big></strong> ".USERANDIP."<br>"
."<form method=\"post\" action=\"modules.php?op=modload&name=Web_Links&file=index&l_op=Add\">"
."".PAGETITLE.": <input type=\"text\" name=\"title\" size=\"50\" maxlength=\"100\"><br>"
.""._PAGEURL.": <input type=\"text\" name=\"url\" size=\"50\" maxlength=\"100\" value=\"http://\"><br>";
/THIS IS THE CAT SECTION */
echo ""._CATEGORY.": <select name=\"cat\">";
$result2=sql_query("select cid, title, parentid from ".$prefix."_links_categories order by parentid,title", $dbi);
while(list($cid2, $ctitle2, $parentid2) = sql_fetch_row($result2, $dbi)) {
if ($parentid2!=0) $ctitle2=getparent($parentid2,$ctitle2);
$cid = $cat;
echo ""._CATEGORY.": cat";
echo "<option value=\"$cid2\">$ctitle2</option>";
}
echo "</select><br><br>"
/THIS IS THE CAT SECTION */
.""._LDESCRIPTION."<br><textarea name=\"description\" cols=\"60\" rows=\"5\"></textarea><br><br><br>"
.""._YOURNAME.": <input type=\"text\" name=\"auth_name\" size=\"30\" maxlength=\"60\"><br>"
.""._YOUREMAIL.": <input type=\"text\" name=\"email\" size=\"30\" maxlength=\"60\"><br><br>"
."<input type=\"hidden\" name=\"l_op\" value=\"Add\">"
."<input type=\"submit\" value=\""._ADDURL."\"> "._GOBACK."<br><br>"
."</form>";
}else {
echo "<center>"._LINKSNOTUSER1."<br>"
.""._LINKSNOTUSER2."<br><br>"
.""._LINKSNOTUSER3."<br>"
.""._LINKSNOTUSER4."<br>"
.""._LINKSNOTUSER5."<br>"
.""._LINKSNOTUSER6."<br>"
.""._LINKSNOTUSER7."<br><br>"
.""._LINKSNOTUSER8."";
}
CloseTable();
include("footer.php");
}
/* This ADDS NEW LINK TO DATABASE */
function Add($title, $url, $auth_name, $cat, $description, $email) {
global $prefix, $dbi, $user;
$result = sql_query("select url from ".$prefix."links_links where url='$url'", $dbi);
$numrows = sql_num_rows($result, $dbi);
if ($numrows>0) {
include("header.php");
menu(1);
echo "<br>";
OpenTable();
echo "<center><b>".LINKALREADYEXT."</b><br><br>"
."".GOBACK."";
CloseTable();
include("footer.php");
} else {
if(is_user($user)) {
$user2 = base64_decode($user);
$cookie = explode(":", $user2);
cookiedecode($user);
$submitter = $cookie[1];
}
// Check if Title exist
if ($title=="") {
include("header.php");
menu(1);
echo "<br>";
OpenTable();
echo "<center><b>".LINKNOTITLE."</b><br><br>"
."".GOBACK."";
CloseTable();
include("footer.php");
}
// Check if URL exist
if ($url=="") {
include("header.php");
menu(1);
echo "<br>";
OpenTable();
echo "<center><b>".LINKNOURL."</b><br><br>"
."".GOBACK."";
CloseTable();
include("footer.php");
}
// Check if Description exist
if ($description=="") {
include("header.php");
menu(1);
echo "<br>";
OpenTable();
echo "<center><b>".LINKNODESC."</b><br><br>"
."".GOBACK."";
CloseTable();
include("footer.php");
}
$cat = explode("-", $cat);
if ($cat[1]=="") {
$cat[1] = 0;
}
$title = stripslashes(FixQuotes($title));
$url = stripslashes(FixQuotes($url));
$description = stripslashes(FixQuotes($description));
$auth_name = stripslashes(FixQuotes($auth_name));
$email = stripslashes(FixQuotes($email));
sql_query("insert into ".$prefix."links_newlink values (NULL, '$cat[0]', '$cat[1]', '$title', '$url', '$description', '$auth_name', '$email', '$submitter')", $dbi);
include("header.php");
menu(1);
echo "<br>";
OpenTable();
echo "<center><b>".LINKRECEIVED."</b><br>";
if ($email != "") {
echo EMAILWHENADD;
} else {
echo _CHECKFORIT;
}
CloseTable();
include("footer.php");
}
}