\n"; echo "\n"; echo " \n"; echo " \n"; echo " \n"; echo "
\n"; } if ($public_add == "yes" && $action != "add_link") { echo "
  • Add a link
  • \n"; } if ($mode == "flat" && $action == "add_link") { echo "
  • English-Zone.Com: TEACHER'S ZONE MENU
  • \n"; } if ($mode == "leveled" && $QUERY_STRING) { echo "
  • English-Zone.Com: TEACHER'S ZONE MENU
  • \n"; } if ($public_add == "yes" || $QUERY_STRING) { echo "
    \n"; echo "

    \n"; } ######### FLAT MODE ######### if ($mode == "flat" && !$QUERY_STRING) { $query = "SELECT $link_table.ID AS LID, Clicks, Website, URL, $link_table.Description AS LDescription, $cat_table.ID AS CID, Category, $cat_table.Description AS CDescription FROM $cat_table, $link_table WHERE ($cat_table.ID = $link_table.Cat_ID OR $cat_table.ID = $link_table.Cat_ID_Extra1 OR $cat_table.ID = $link_table.Cat_ID_Extra2 OR $cat_table.ID = $link_table.Cat_ID_Extra3) ORDER BY $cat_order, $links_order"; print_table ($query, $PHP_SELF, $tbl_border, $tbl_cellpadding, $tbl_cellspacing, $tbl_width, $tbl_align, $row1_color, $row2_color, $row3_color, $Category, $CDescription, $LID, $URL, $Website, $LDescription, $Clicks, $show_clicks, $show_credit, $credit_html, $new_window, $cat_table, $link_table); } ######### LEVELED MODE ######### if ($mode == "leveled" && !$LID && !$URL) { // print categories if (!$QUERY_STRING) { $query = "SELECT * FROM $cat_table ORDER BY $cat_order"; $result = mysql_query($query) or die("

    Error: No data exists.

    \n\n\n\n"); echo "

    \n"; echo "\n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; while (list($CID, $Count, $Category, $Description) = mysql_fetch_array($result)) { if ($Count > 0) { $Category = "$Category"; } if ($Description) { $Description = "
    $Description"; } echo " \n"; echo " \n"; echo " \n"; echo " \n"; } if ($show_credit == "yes") { echo " \n"; echo " \n"; echo " \n"; } echo "
    English-Zone.Com: Teacher's Zone
    COPYRIGHT NOTICE: These copyrighted materials may be printed for personal or classroom use ONLY. Do NOT change the content. Do NOT remove the author credit. Do NOT publish these materials on any other website.# of Pages
    $Category $Description

    $Count

    $credit_html
    \n"; echo "

    \n"; } // print links for specific category if ($CID) { $query = "SELECT $link_table.ID AS LID, Clicks, Website, URL, $link_table.Description AS LDescription, $cat_table.ID AS CID, Category, $cat_table.Description AS CDescription"; $query .= " FROM $cat_table, $link_table"; $query .= " WHERE ( ($cat_table.ID = $link_table.Cat_ID AND $cat_table.ID = '$CID') OR ($cat_table.ID = $link_table.Cat_ID_Extra1 AND $cat_table.ID = '$CID') OR ($cat_table.ID = $link_table.Cat_ID_Extra2 AND $cat_table.ID = '$CID') OR ($cat_table.ID = $link_table.Cat_ID_Extra3 AND $cat_table.ID = '$CID') )"; $query .= " ORDER BY $links_order"; print_table ($query, $PHP_SELF, $tbl_border, $tbl_cellpadding, $tbl_cellspacing, $tbl_width, $tbl_align, $row1_color, $row2_color, $row3_color, $Category, $CDescription, $LID, $URL, $Website, $LDescription, $Clicks, $show_clicks, $show_credit, $credit_html, $new_window, $cat_table, $link_table); } } ######### ADD LINK (PUBLIC) ######### if ($action == "add_link" && $public_add == "yes") { // process form if ($submit) { // check for errors if (!$Website) { $error = "
  • Website Name cannot be left blank
  • \n"; } if (!$URL) { $error .= "
  • Website URL cannot be left blank
  • \n"; } if (eregi("http://", $URL) && eregi("\.", $URL)) { // URL must contain http:// and . to be valid $validURL = 1; } if ($URL && !$validURL) { $error .= "
  • Website URL is invalid
  • \n"; } if (strlen($Description) > 255) { $error .= "
  • Description cannot exceed 255 characters (length: " . strlen($Description) . ")
  • \n"; } // add link to database if (!$error) { $Website = escape_quotes($Website); $URL = escape_quotes($URL); $Description = escape_quotes($Description); mysql_query("INSERT INTO $link_table (Cat_ID, Cat_ID_Extra1, Cat_ID_Extra2, Cat_ID_Extra3, Website, URL, Description) VALUES ('$CID', '$Cat_ID_Extra1', '$Cat_ID_Extra2', '$Cat_ID_Extra3', '$Website','$URL','$Description')"); UpdateCatCounts(); } else { $Website = strip_quotes($Website); $URL = strip_quotes($URL); $Description = strip_quotes($Description); } } // print title and message $title = "Add a Link"; $message = "Fill out the form below to add a link."; if ($error) { $title = "Error Adding Link"; $message = "The following error(s) occured:\n Please correct any errors and try again."; } if ($submit && !$error) { $title = "Link Added"; $message = "Your link has been added."; } print_title_message($title, $message); // print form if (!$submit) { // sets URL before user touches it $URL = "http://"; } if (!$submit || $error) { echo "
    \n"; link_form($db, $Cat_ID, $CID, $Website, $URL, $Description, $cat_table, $link_table, $Cat_ID_Extra1, $Cat_ID_Extra2, $Cat_ID_Extra3); echo "\n"; echo "
    \n"; } } ########### FOOTER/CLOSE DB ########### require("$footer_html"); mysql_close($db); // close db connection ?>