"; if(isset($_REQUEST["act"])) $act = $_REQUEST["act"]; else $act = ""; if(isset($_REQUEST["mat_id"]) && is_numeric($_REQUEST["mat_id"]) && $_REQUEST["mat_id"] != 0) $mat_id = $_REQUEST["mat_id"]; else $mat_id = ""; if($act == ""){ $page_content .= "

Edit the Home Page

Edit Recycling Information

"; $get_info = "select * from recycle_info where status='active' order by mat_title"; $get_info_qry = mysql_query ($get_info) or die (mysql_error() . $sql ); $mat_num = mysql_numrows($get_info_qry); while ($row = mysql_fetch_array($get_info_qry, MYSQL_ASSOC)) { $info_id = $row["info_id"]; $mat_title = $row["mat_title"]; $mat_desc = $row["mat_desc"]; $date_updated = $row["date_updated"]; if($date_updated == 0) $date_updated = "NA"; else $date_updated = date("n/j/y",$date_updated); $page_content .= << END; } $page_content .= "
Material Last Updated Action
$mat_title
$mat_desc
$date_updated edit
"; $get_home_info = "select * from site_pages where page_id=9"; $get_home_info_qry = mysql_query ($get_home_info) or die (mysql_error() . $sql ); while ($row = mysql_fetch_array($get_home_info_qry, MYSQL_ASSOC)) { $home_title = $row["page_title"]; $meta_keyword = $row["meta_keyword"]; $meta_description = $row["meta_description"]; $home_sidebar = $row["sidebar"]; } $page_content .= "

Other Home Page Information

Page Title:
Sidebar Note: "; $oFCKeditor = new FCKeditor('home_sidebar'); $oFCKeditor->ToolbarSet = 'Very_Basic'; $oFCKeditor->BasePath = '../php_inc/fckeditor/'; $oFCKeditor->Config["EditorAreaCSS"] = '/php_inc/fckeditor/editor_styles-recycle2.css'; $oFCKeditor->Value = "$home_sidebar"; $oFCKeditor->Width = "400"; $oFCKeditor->Height = "200"; $oFCKeditor->Create(); $page_content .= "
Keywords:
Page Description:
 
"; }elseif($act == "edit" && $mat_id != ""){ $get_info = "select * from recycle_info where info_id = $mat_id"; $get_info_qry = mysql_query ($get_info) or die (mysql_error() . $sql ); $mat_num = mysql_numrows($get_info_qry); while ($row = mysql_fetch_array($get_info_qry, MYSQL_ASSOC)) { $mat_title = $row["mat_title"]; $mat_desc = $row["mat_desc"]; $title_img = str_replace("","",$title_img); $mat_details = str_replace("\"images/","\"/images/",$row["mat_details"]); } $page_content .= <<Edit the Home Page
Title
Title Image Link
Short Description
Details END; $oFCKeditor = new FCKeditor('mat_details'); $oFCKeditor->ToolbarSet = 'Basic'; $oFCKeditor->BasePath = '../php_inc/fckeditor/'; $oFCKeditor->Config["EditorAreaCSS"] = '/php_inc/fckeditor/editor_styles-recycle2.css'; $oFCKeditor->Value = "$mat_details"; $oFCKeditor->Width = "400"; $oFCKeditor->Height = "500"; $oFCKeditor->Create(); $page_content .= "
 
"; /* $oFCKeditor = new FCKeditor('summary'); $oFCKeditor->ToolbarSet = 'Basic'; $oFCKeditor->BasePath = '/bin/fckeditor/'; $oFCKeditor->Config["EditorAreaCSS"] = '../bin/editor_styles.css'; $oFCKeditor->Value = "$summary"; $oFCKeditor->Width = "400"; $oFCKeditor->Height = "500"; $oFCKeditor->Create(); */ $page_content .= ""; }elseif($act == "update"){ $err_mess = ""; if(isset($_REQUEST["mat_title"])){ $mat_title = mysql_escape_string(stripslashes(trim($_REQUEST["mat_title"]))); }else{ $mat_title = ""; $err_mess .= "
  • Please enter a title for this Material
  • "; } if(isset($_REQUEST["mat_desc"])){ $mat_desc = mysql_escape_string(htmlentities(stripslashes(trim($_REQUEST["mat_desc"])))); }else{ $mat_desc = ""; $err_mess .= "
  • Please enter a short description for this Material
  • "; } if(isset($_REQUEST["title_img"])){ $title_img = $_REQUEST["title_img"]; }else{ $title_img = ""; $err_mess .= "
  • Please enter the address of an icon image for this Material
  • "; } if(isset($_REQUEST["mat_details"])){ $mat_details = mysql_escape_string(stripslashes(trim($_REQUEST["mat_details"]))); }else{ $mat_details = ""; $err_mess .= "
  • Please enter the details for this Material
  • "; } if($err_mess != ""){ $page_content .= "

    Oops.

    Some required information was incorrect or missing.

    Please return to the previous page and double-check your entries

    "; }else{ $page_content .= "

    Updating Home Page...

    "; $now = time(); $mat_details = str_replace("/images","images",$mat_details); $update_mat = "update recycle_info set mat_title = '$mat_title',mat_desc='$mat_desc',title_img = '$title_img',mat_details='$mat_details',date_updated = $now where info_id=$mat_id"; $update_mat_qry = mysql_query ($update_mat) or die (mysql_error() . $sql ); $page_content .= "

    The information has been updated.

    View the home page

    Select another material to edit

    Return to the admin home page

    "; } }elseif($act == "update_home"){ $err_mess = ""; if(isset($_REQUEST["home_title"])){ $home_title = mysql_escape_string(stripslashes(trim($_REQUEST["home_title"]))); }else{ $home_title = ""; $err_mess .= "
  • Please enter a title for the home page
  • "; } if(isset($_REQUEST["meta_description"])){ $meta_description = mysql_escape_string(htmlentities(stripslashes(trim($_REQUEST["meta_description"])))); }else{ $meta_description = ""; } if(isset($_REQUEST["meta_keyword"])){ $meta_keyword = mysql_escape_string(stripslashes(trim($_REQUEST["meta_keyword"]))); }else{ $meta_keyword = ""; } if(isset($_REQUEST["home_sidebar"])){ $home_sidebar = mysql_escape_string(stripslashes(trim($_REQUEST["home_sidebar"]))); }else{ $home_sidebar = ""; } if($err_mess != ""){ $page_content .= "

    Oops.

    Some required information was incorrect or missing.

    Please return to the previous page and double-check your entries

    "; }else{ $page_content .= "

    Updating Home Page...

    "; $now = time(); $update_home = "update site_pages set page_title = '$home_title',meta_description='$meta_description',meta_keyword='$meta_keyword',sidebar='$home_sidebar' where page_id=9"; $update_home_qry = mysql_query ($update_home) or die (mysql_error() . $sql ); $page_content .= "

    The information has been updated.

    View the home page

    Update other home page information

    Return to the admin home page

    "; } } $page_content .= ""; display_admin(); ?>