1) & !$current_category["name"]){ mysql_close(); header("Location: {$dir}"); exit(); }; if (!$current_category["name"]) $current_category["name"] = "Free PHP Directory Script"; if (!$current_category["description"]) $current_category["description"] = $current_category["name"]." ".$current_category["title"]; $replace = array("[CATEGORY_NAME]" => $current_category["name"], "[CATEGORY_TITLE]" => $current_category["title"], "[CATEGORY_DESCRIPTION]" => $current_category["description"]); echo strtr($TEMPLATE["HEADING"],$replace); flush(); $last_category = false; $ref = $c; while(!$last_category){ $n_parent_categories += 1; $sql = mysql_query("SELECT id, name, ref FROM {$prefix}categories WHERE id = $ref"); $parent_categories[$n_parent_categories-1] = mysql_fetch_array($sql, MYSQL_ASSOC); if ($parent_categories[$n_parent_categories-1]["ref"] == 0){ $last_category = true; }else{ $ref = $parent_categories[$n_parent_categories-1]["ref"]; }; }; echo $TEMPLATE["PATH"]["HEADING"]; for ($x = $n_parent_categories-1; $x >= 0; $x--){ if ($x != $n_parent_categories-1) echo $TEMPLATE["PATH"]["SEPARATOR"]; if ($parent_categories[$x]["id"] > 1){ $category_url = $dir.parse_navi($parent_categories[$x]["name"]) .'-'. $parent_categories[$x]["id"].'.htm'; }else{ $category_url = $dir; }; $replace = array("[CATEGORY_NAME]" => $parent_categories[$x]["name"], "[CATEGORY_URL]" => $category_url); echo strtr($TEMPLATE["PATH"]["CATEGORY"],$replace); }; echo $TEMPLATE["PATH"]["FOOTER"]; flush(); if (getenv("REQUEST_METHOD") == "POST"){ $url = convert_url($url); $keywords = convert_keywords($keywords); $url = parse_input($url); $title = parse_input($title); $description = parse_input($description); $keywords = parse_input($keywords); $sql = mysql_query("SELECT * FROM {$prefix}pages WHERE url = '$url'"); if (mysql_num_rows($sql) > 0){ $error_duplication = true; }else{ if (strlen($title) < 5 || strlen($title) > 100) { $error_variables = true; $errors["title"] = true; }; if (strlen($description) < 50 || strlen($description) > 200) { $error_variables = true; $errors["description"] = true; }; if (strlen($keywords) < 20 || strlen($keywords) > 200) { $error_variables = true; $errors["keywords"] = true; }; if (strlen($url) < 10) { $error_variables = true; $errors["url"] = true; }; if (!$error_variables){ mysql_query("INSERT INTO {$prefix}pages (url,title,description,keywords,accepted,ip,category) VALUES ('$url','$title','$description','$keywords','n','".getenv("REMOTE_ADDR")."',$c)"); }; }; }; mysql_close(); if (getenv("REQUEST_METHOD") == "POST"){ if ($error_duplication){ echo $TEMPLATE["DUPLICATED_SUBMISSION"]; }elseif ($error_variables){ echo $TEMPLATE["ERROR_FORM"]["HEADING"]; $field = ($errors["url"])? $TEMPLATE["ERROR_FORM"]["ERROR_FIELD"] : $TEMPLATE["ERROR_FORM"]["FIELD"]; $replace = array("[FIELD_NAME]" => "url", "[FIELD_VALUE]" => $url, "[FIELD_MAXLENGTH]" => 100, "[FIELD_DESCRIPTION]" => $TEMPLATE["FORM"]["FIELDS"]["URL"]); echo strtr($field,$replace); $field = ($errors["title"])? $TEMPLATE["ERROR_FORM"]["ERROR_FIELD"] : $TEMPLATE["ERROR_FORM"]["FIELD"]; $replace = array("[FIELD_NAME]" => "title", "[FIELD_VALUE]" => $title, "[FIELD_MAXLENGTH]" => 100, "[FIELD_DESCRIPTION]" => $TEMPLATE["FORM"]["FIELDS"]["TITLE"]); echo strtr($field,$replace); $field = ($errors["description"])? $TEMPLATE["ERROR_FORM"]["ERROR_FIELD"] : $TEMPLATE["ERROR_FORM"]["FIELD"]; $replace = array("[FIELD_NAME]" => "description", "[FIELD_VALUE]" => $description, "[FIELD_MAXLENGTH]" => 200, "[FIELD_DESCRIPTION]" => $TEMPLATE["FORM"]["FIELDS"]["DESCRIPTION"]); echo strtr($field,$replace); $field = ($errors["keywords"])? $TEMPLATE["ERROR_FORM"]["ERROR_FIELD"] : $TEMPLATE["ERROR_FORM"]["FIELD"]; $replace = array("[FIELD_NAME]" => "keywords", "[FIELD_VALUE]" => $keywords, "[FIELD_MAXLENGTH]" => 200, "[FIELD_DESCRIPTION]" => $TEMPLATE["FORM"]["FIELDS"]["KEYWORDS"]); echo strtr($field,$replace); echo ''."\r\n"; echo $TEMPLATE["ERROR_FORM"]["FOOTER"]; }else{ echo $TEMPLATE["CORRECT_SUBMISSION"]; }; }else{ echo $TEMPLATE["FORM"]["HEADING"]; $replace = array("[FIELD_NAME]" => "url", "[FIELD_VALUE]" => "http://", "[FIELD_MAXLENGTH]" => 100, "[FIELD_DESCRIPTION]" => $TEMPLATE["FORM"]["FIELDS"]["URL"]); echo strtr($TEMPLATE["FORM"]["FIELD"],$replace); $replace = array("[FIELD_NAME]" => "title", "[FIELD_VALUE]" => "", "[FIELD_MAXLENGTH]" => 100, "[FIELD_DESCRIPTION]" => $TEMPLATE["FORM"]["FIELDS"]["TITLE"]); echo strtr($TEMPLATE["FORM"]["FIELD"],$replace); $replace = array("[FIELD_NAME]" => "description", "[FIELD_VALUE]" => "", "[FIELD_MAXLENGTH]" => 200, "[FIELD_DESCRIPTION]" => $TEMPLATE["FORM"]["FIELDS"]["DESCRIPTION"]); echo strtr($TEMPLATE["FORM"]["FIELD"],$replace); $replace = array("[FIELD_NAME]" => "keywords", "[FIELD_VALUE]" => "", "[FIELD_MAXLENGTH]" => 200, "[FIELD_DESCRIPTION]" => $TEMPLATE["FORM"]["FIELDS"]["KEYWORDS"]); echo strtr($TEMPLATE["FORM"]["FIELD"],$replace); echo ''."\r\n"; echo $TEMPLATE["FORM"]["FOOTER"]; }; echo $TEMPLATE["FOOTER"]; ?>