, 2003-2007 // Raul Mateos , 2005-2007 // Load global vars if (comprueba_login() == 0) $id_user = $_SESSION["id_usuario"]; if (give_acl($id_user, 0, "PM")==1) { if (isset($_POST["create"])){ // If create $name = entrada_limpia($_POST["name"]); $link = entrada_limpia($_POST["link"]); $sql_insert="INSERT INTO tlink (name,link) VALUES ('$name','$link') "; $result=mysql_query($sql_insert); if (! $result) echo "

".$lang_label["create_link_no"]."

"; else { echo "

".$lang_label["create_link_ok"]."

"; $id_link = mysql_insert_id(); } } if (isset($_POST["update"])){ // if update $id_link = entrada_limpia($_POST["id_link"]); $name = entrada_limpia($_POST["name"]); $link = entrada_limpia($_POST["link"]); $sql_update ="UPDATE tlink SET name = '".$name."', link ='".$link."' WHERE id_link = '".$id_link."'"; $result=mysql_query($sql_update); if (! $result) echo "

".$lang_label["modify_link_no"]."

"; else echo "

".$lang_label["modify_link_ok"]."

"; } if (isset($_GET["borrar"])){ // if delete $id_link = entrada_limpia($_GET["borrar"]); $sql_delete= "DELETE FROM tlink WHERE id_link = ".$id_link; $result=mysql_query($sql_delete); if (! $result) echo "

".$lang_label["delete_link_no"]."

"; else echo "

".$lang_label["delete_link_ok"]."

"; } // Main form view for Links edit if ((isset($_GET["form_add"])) or (isset($_GET["form_edit"]))){ if (isset($_GET["form_edit"])){ $creation_mode = 0; $id_link = entrada_limpia($_GET["id_link"]); $sql1='SELECT * FROM tlink WHERE id_link = '.$id_link; $result=mysql_query($sql1); if ($row=mysql_fetch_array($result)){ $nombre = $row["name"]; $link = $row["link"]; } else echo "

".$lang_label["name_error"]."

"; } else { // form_add $creation_mode =1; $nombre = ""; $link = ""; } // Create link echo "

".$lang_label["setup_screen"]." > "; echo $lang_label["link_management"]." ".$lang_label["help"]."

"; echo ''; echo ''; if ($creation_mode == 1) echo ""; else echo ""; echo ""; echo ''; echo "
'.$lang_label["link_name"].''; echo '
'.$lang_label["link"].''; echo '
"; echo '
'; } else { // Main list view for Links editor echo "

".$lang_label["setup_screen"]." > "; echo $lang_label["link_management"]." ".$lang_label["help"]."

"; echo ""; echo ""; echo "
".$lang_label["link_name"]; echo "".$lang_label["delete"]; $sql1='SELECT * FROM tlink ORDER BY name'; $result=mysql_query($sql1); $color=1; while ($row=mysql_fetch_array($result)){ if ($color == 1){ $tdcolor = "datos"; $color = 0; } else { $tdcolor = "datos2"; $color = 1; } echo "
".$row["name"].""; echo ''; } echo "
"; echo "
"; echo ""; echo "
"; } // Fin bloque else } else { audit_db($id_user,$REMOTE_ADDR, "ACL Violation","Trying to access Link Management"); require ("general/noaccess.php"); } ?>