<?php
require_once('./admin.php');
require_once('../pr-inside/validate.php');
$Action = $_GET['action'];
//create new profile element-------------------------------------------------
if($Action === 'new')
{
if(empty($_POST['type']))
$Error['type'] = 'Please enter a category';
elseif(trim(strtolower($_POST['type'])) === 'identity')
$Error['type'] = '\'<strong>identity</strong>\' is a reserved category, please choose another name';
if(empty($_POST['name']))
$Error['name'] = 'Please enter the item name';
if(empty($_POST['value']))
$Error['value'] = 'Please enter the discription';
if(isset($Error))
{
$Type = $_POST['type'];
$Name = $_POST['name'];
$Value = $_POST['value'];
die(require('profile-new.php'));
}
else
{
$Type = trim(str_replace("'", "\'", $_POST['type']));
$Name = str_replace("'", "\'", $_POST['name']);
$Value = str_replace("'", "\'", $_POST['value']);
$DC->Result("INSERT INTO ".PR_DATABASE_PREFIX."profile SET profile_name = '{$Name}', profile_category = '{$Type}', profile_value = '{$Value}', profile_status = 'show'");
header("Location: profile.php?highlight=New_item_added_<a_href='profile.php?page=type==category={$Type}'>View</a>");
exit();
}
}
?>