//-------------------------------------------------// // // // ASTANDA DIRECTORY PROJECT [ADP] // // Version 1.3b // // License: SHAREWARE // // http://www.astanda.com // // © Copyright 2005, 2006, Pavel Golovko // // // //-------------------------------------------------// // // // Any attempt to remove or alter "Powered by ADP" // // recip link will automatically wave your rights // // to any use of ADP software! // // // // Reverse engineering and redistribution of // // ADP code or any part of its code is strictly // // prohibited! // // // //-------------------------------------------------// // // // ADP 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. // // // //-------------------------------------------------// require_once("./admin/database.php"); require_once("./admin/functions.php"); require('./admin/smarty/Smarty.class.php'); $smarty = new Smarty(); $smarty->template_dir = './admin/templates'; $smarty->compile_dir = './admin/smarty/templates_c'; $smarty->cache_dir = './admin/smarty/cache'; $smarty->config_dir = './admin/smarty/configs'; session_start(); $smarty->assign('dir_title', cfg("title")); $error = ""; if(isset($_REQUEST['url'])){ $url = $_REQUEST['url']; } else{ $url = ""; } if(isset($_REQUEST['title'])){ $title = $_REQUEST['title']; } else{ $title = ""; } if(isset($_REQUEST['description'])){ $description = $_REQUEST['description']; } else{ $description = ""; } if(isset($_REQUEST['category'])){ $category = $_REQUEST['category']; } else{ $category = ""; } if(isset($_REQUEST['email'])){ $email = $_REQUEST['email']; } else{ $email = ""; } if(isset($_REQUEST['captcha'])){ $captcha = $_REQUEST['captcha']; } else{ $captcha = ""; } if(isset($_REQUEST['add'])){ if(cfg("captcha") == "1"){ if(md5($captcha) != $_SESSION['image_value']){ $error = "Visual validation string not valid. Please try again.

"; } } if($url == ""){ $error = "You need to enter URL

"; } else{ $url = addslashes(htmlspecialchars($url)); } if($title == ""){ $error = "You need to enter title

"; } else{ $title = addslashes(htmlspecialchars($title)); } if($description == ""){ $error = "You need to enter description

"; } else{ $description = addslashes(htmlspecialchars($description)); } if($category == ""){ $error = "You need to select at least one category

"; } if($email == ""){ $error = "You need to enter email address

"; } if(!$error){ if(cfg("addurl_gpr") != "0"){ include('./admin/pagerank.php'); $oPR=new ADPPageRank(); $gpr=$oPR->getRank($url); if($gpr < cfg("addurl_gpr")){ $error = "The URL you're suggesting has low Google PR of $gpr. At this time we can not accept such URLs. Please contact administration if you have any questions:

".cfg("email")."

"; } } } if(!$error){ $Bresult = mysql_query("SELECT `domain` FROM `banned`"); echo mysql_error(); if(mysql_num_rows($Bresult)){ while($Brow = mysql_fetch_array($Bresult)){ if(eregi($Brow['domain'],$url)){ $error = "This domain was banned from our directory, please contact administration to resolve this issue:

".cfg("email")."

"; } } } $Bresult = mysql_query("SELECT `keyword` FROM `bad_keywords`"); echo mysql_error(); if(mysql_num_rows($Bresult)){ while($Brow = mysql_fetch_array($Bresult)){ if(eregi($Brow['keyword'],$title)){ $error = "Your title contains banned keywords, please contact administration to resolve this issue:

".cfg("email")."

"; } if(eregi($Brow['keyword'],$description)){ $error = "Your description contains banned keywords, please contact administration to resolve this issue:

".cfg("email")."

"; } } } if(!$error){ if(!eregi("http://",$url)){ $error = "Please add \"http://\" in front of your URL."; } } if(!$error){ $Nresult = mysql_query("SELECT * FROM `new_links`"); echo mysql_error(); if(mysql_num_rows($Nresult)){ while ($Nrow = mysql_fetch_array($Nresult)) { if($url == $Nrow['url']){ $error = "This URL was already submitted. We will check it as soon as possible."; } } } if(!$error){ $result = mysql_query("SELECT `url` FROM `links`"); echo mysql_error(); if(mysql_num_rows($result)){ while ($row = mysql_fetch_array($result)) { if($url == $row['url']){ $error = "This URL is already listed in our directory. Please contact administration if you have any questions: ".cfg("email"); } } } if(!$error){ if(cfg("recip_required") == "1"){ $res = eregi(cfg("recip_regex"),fetchURL($url))?1:0; if($res == 0){ $error = "There is no recip link found back to ".cfg("title")."!"; } } if(!$error){ mysql_query("INSERT INTO `new_links` (url, title, description, email, category) VALUES ('$url', '$title', '$description', '$email', '$category')"); $error = "Your URL was sucessfully submitted for editor review!

Feel free to submit another URL.

 

"; } } } } } } function list_catz($parent,$categories,$lev) { $space = ""; for ($x = 0; $x < $lev; $x++) { $space .= "   · "; } $query = "SELECT `id`,`title` FROM `categories` WHERE `parent`='$parent' ORDER BY `title` ASC"; $result = mysql_query($query); echo mysql_error(); if (mysql_num_rows($result) != 0){ while ($row = mysql_fetch_array($result)) { $result_num = mysql_query("SELECT `id` FROM `links` WHERE `category_id` = '".$row['id']."'"); echo mysql_error(); $links_num = mysql_num_rows($result_num); $id = intval($row['id']); $title = $row['title']; $categories .= "\n"; $categories .= list_catz($id,"",$lev+1); } return $categories; } } $smarty->assign('categories',list_catz(0,"",0)); $smarty->register_prefilter('a'); $smarty->assign('error',$error); $smarty->assign('url',$url); $smarty->assign('title',$title); $smarty->assign('description',$description); $smarty->assign('email',$email); $smarty->display('addurl.html'); ?>