HTML;
msg("options", "Edit Category", $msg);
}
}
}
// ********************************************************************************
// DO Edit Category
// ********************************************************************************
elseif($action == "doedit")
{
$cat_name = htmlspecialchars(stripslashes($cat_name));
if(!$catid){ msg("error","Error !!!","No category ID", "$PHP_SELF?mod=categories"); }
if($cat_name == ""){ msg("error", "Error !!!", "Category name can not be blank", "javascript:history.go(-1)"); }
$old_cats = file("./data/category.db.php");
$new_cats = fopen("./data/category.db.php", "w");
foreach($old_cats as $cat_line){
$cat_arr = explode("|", $cat_line);
if($cat_arr[0] == $catid){
fwrite($new_cats, "$catid|$cat_name|$cat_icon|||\n");
}else{
fwrite($new_cats, "$cat_line");
}
}
fclose($new_cats);
}
// ********************************************************************************
// List all Categories
// ********************************************************************************
echoheader("options", "Categories");
echo<<