Location: PHPKode > projects > Prsaar Social Networking Platform > PrsaarColour-0.7.alpha.6.3/pr-admin/profile-edit-update.php
<?php
	require_once('./admin.php');
	$Action = $_GET['action'];
	
		
	//Edit already published profile elements-------------------------------------
	if($Action === 'edit')
	{
		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 element name';
		if(empty($_POST['value']))
			$Error['value'] = 'Please enter the discription';
		if(isset($Error))
		{
			$Type = $_POST['type'];
			$Name = $_POST['name'];
			$Value = $_POST['value'];
			require('profile-edit.php');
			exit();
		}
		else
		{
			$ID = $_GET['id'];
			$Type = trim(str_replace("'", "\'", $_POST['type']));
			$Name = str_replace("'", "\'", $_POST['name']);
			$Value = str_replace("'", "\'", $_POST['value']);
			$DC->Result("UPDATE ".PR_DATABASE_PREFIX."profile SET profile_name = '{$Name}', profile_category = '{$Type}', profile_value = '{$Value}', profile_status = 'show' WHERE profile_id = $ID ");
			header("Location: profile.php?highlight=New_item_added_<a_href='profile.php?page=type==category={$Type}'>View</a>");
			exit();
		}
	}
	
	//confirm deleting of profile element ----------------------------------------------------
	elseif($Action === 'delete')
	{
		$ID = $_GET['id'];
		die("Are you sure to delete this profile element. <a href='profile-edit-update.php?action=deletenow&id=$ID'>Delete Now</a> <a href='profile.php'>Cancel</a>");
	}
	
	//delete profile element ----------------------------------------------------
	elseif($Action === 'deletenow')
	{
		$ID = $_GET['id'];
		$DC->Result("DELETE FROM ".PR_DATABASE_PREFIX."profile WHERE profile_id = $ID");
		header("Location: profile.php?highlight=Prfile_element_deleted");
		exit();
	}
?>
Return current item: Prsaar Social Networking Platform