Código PHP:
<?
include ("config.php");
include ("include.php");
include ("lang.php");
include ("include_banned.php");
if ($c == 0){
header("Location: {$dir}index.php");
exit();
};
$sql = mysql_query("SELECT name, title, description, pages, ref FROM {$prefix}categories WHERE id = $c");
$current_category = mysql_fetch_array($sql, MYSQL_ASSOC);
if (($c > 1) & !$current_category["name"]){
header("Location: {$dir}index.php");
};
if (!$current_category["name"]) { $current_category["name"] = "Directory Search"; };
if (!$current_category["title"]) { $current_category["title"] = $current_category["name"]; };
if (!$current_category["description"]) { $current_category["description"] = $current_category["name"]." ".$current_category["title"]; };
if (getenv("REQUEST_METHOD") == "POST"){
include ("include_protection.php");
$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)");
};
};
};
$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"];
};
};
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//ES">
<HTML>
<HEAD>
<TITLE><? echo $current_category["name"]?> - <? echo $t03?></TITLE>
<SCRIPT TYPE="text/javascript" SRC="style.js"></SCRIPT>
</HEAD>
<BODY>
<?
include ("starting_html.php");
?>
<DIV CLASS="main">
<DIV CLASS="logo"><A HREF="<? echo $dir?>index.php"></A></DIV>
<?
if (getenv("REQUEST_METHOD") == "POST"){
if ($error_duplication){
?>
<DIV CLASS="heading">
<H1><? echo $t18?></H1>
<DIV CLASS="heading_path">
<?
for ($x = $n_parent_categories-1; $x >= 0; $x--){
if ($x != $n_parent_categories-1) { echo " > "; };
if ($parent_categories[$x]["id"] == 1){
echo '<A HREF="'.$dir.'index.php">'.$parent_categories[$x]["name"].'</A>';
}else{
echo '<A HREF="'.$dir.'index.php?c='.$parent_categories[$x]["id"].'">'.$parent_categories[$x]["name"].'</A>';
};
};
?>
> <A HREF="add_url.php?c=<?echo $c?>"><? echo $t03?></A>
</DIV>
</DIV>
<DIV CLASS="form">
<DIV CLASS="form_text"><? echo $t19a?> (<? echo $url?>) <? echo $t19b?></DIV>
</DIV>
<?
}elseif ($error_variables){
?>
<DIV CLASS="heading">
<H1><? echo $t18?></H1>
<DIV CLASS="heading_path">
<?
for ($x = $n_parent_categories-1; $x >= 0; $x--){
if ($x != $n_parent_categories-1) { echo " > "; };
if ($parent_categories[$x]["id"] == 1){
echo '<A HREF="'.$dir.'index.php">'.$parent_categories[$x]["name"].'</A>';
}else{
echo '<A HREF="'.$dir.'index.php?c='.$parent_categories[$x]["id"].'">'.$parent_categories[$x]["name"].'</A>';
};
};
?>
> <A HREF="add_url.php?c=<?echo $c?>"><? echo $t03?></A>
</DIV>
</DIV>
<DIV CLASS="form">
<DIV CLASS="form_text"><? echo $t20?></DIV>
<DIV CLASS="form_controls">
<FORM METHOD="post" ACTION="add_url.php">
<INPUT TYPE="text" NAME="url" VALUE="<? echo parse_output($url)?>" MAXLENGTH=100 CLASS="form_controls_text">
<?
if ($errors["url"]){
echo '<DIV CLASS="alert">'.$t13.'</DIV>';
}else{
echo $t13;
};
?>
<BR>
<INPUT TYPE="text" NAME="title" VALUE="<? echo parse_output($title)?>" MAXLENGTH=100 CLASS="form_controls_text">
<?
if ($errors["title"]){
echo '<DIV CLASS="alert">'.$t14.'</DIV>';
}else{
echo $t14;
};
?>
<BR>
<INPUT TYPE="text" NAME="description" VALUE="<? echo parse_output($description)?>" MAXLENGTH=200 CLASS="form_controls_text">
<?
if ($errors["description"]){
echo '<DIV CLASS="alert">'.$t15.'</DIV>';
}else{
echo $t15;
};
?>
<BR>
<INPUT TYPE="text" NAME="keywords" VALUE="<? echo parse_output($keywords)?>" MAXLENGTH=200 CLASS="form_controls_text">
<?
if ($errors["keywords"]){
echo '<DIV CLASS="alert">'.$t16.'</DIV>';
}else{
echo $t16;
};
?>
<BR>
<INPUT TYPE="submit" VALUE="<? echo $t17?>" CLASS="form_controls_button">
<INPUT TYPE="hidden" NAME="c" VALUE="<? echo $c?>">
</FORM>
</DIV>
</DIV>
<?
}else{
?>
<DIV CLASS="heading">
<H1><? echo $t21?></H1>
<DIV CLASS="heading_path">
<?
for ($x = $n_parent_categories-1; $x >= 0; $x--){
if ($x != $n_parent_categories-1) { echo " > "; };
if ($parent_categories[$x]["id"] == 1){
echo '<A HREF="'.$dir.'index.php">'.$parent_categories[$x]["name"].'</A>';
}else{
echo '<A HREF="'.$dir.'index.php?c='.$parent_categories[$x]["id"].'">'.$parent_categories[$x]["name"].'</A>';
};
};
?>
> <A HREF="add_url.php?c=<?echo $c?>"><? echo $t03?></A>
</DIV>
</DIV>
<DIV CLASS="form">
<DIV CLASS="form_text"><? echo $t22a?> (<?echo $url?>) <? echo $t22b?></DIV>
</DIV>
<?
};
}else{
?>
<DIV CLASS="heading">
<H1><? echo $t03?></H1>
<DIV CLASS="heading_path">
<?
for ($x = $n_parent_categories-1; $x >= 0; $x--){
if ($x != $n_parent_categories-1) { echo " > "; };
if ($parent_categories[$x]["id"] == 1){
echo '<A HREF="'.$dir.'index.php">'.$parent_categories[$x]["name"].'</A>';
}else{
echo '<A HREF="'.$dir.'index.php?c='.$parent_categories[$x]["id"].'">'.$parent_categories[$x]["name"].'</A>';
};
};
?>
</DIV>
</DIV>
<FORM METHOD="post" ACTION="add_url.php">
<DIV CLASS="text">
<DIV CLASS="text_text"><B><? echo $t09?></B><P>
» <? echo $t10?><BR>
» <? echo $t11?></DIV>
</DIV>
<DIV CLASS="form">
<DIV CLASS="form_text"><? echo $t12?></DIV>
<DIV CLASS="form_controls">
<INPUT TYPE="text" NAME="url" VALUE="http://" MAXLENGTH=100 CLASS="form_controls_text"> <? echo $t13?><BR>
<INPUT TYPE="text" NAME="title" MAXLENGTH=100 CLASS="form_controls_text"> <? echo $t14?><BR>
<INPUT TYPE="text" NAME="description" MAXLENGTH=200 CLASS="form_controls_text"> <? echo $t15?><BR>
<INPUT TYPE="text" NAME="keywords" MAXLENGTH=200 CLASS="form_controls_text"> <? echo $t16?><BR>
<INPUT TYPE="submit" VALUE="<? echo $t17?>" CLASS="form_controls_button">
<INPUT TYPE="hidden" NAME="c" VALUE="<? echo $c?>">
</FORM>
</DIV>
</DIV>
<?
};
include ("links.php");
?>
</DIV>
<?
include ("ending_html.php");
?>
</BODY>
</HTML>
Para más datos pueden verlo en www.margaritaweb.net/directorio