Location: PHPKode > projects > Kwalbum > kwalbum/ajax/editTagValue.php
<?php
/* 2.0.3: 2008-10-03
 * 2.0 created: 2008-09-04
 */
require_once pathinfo(__FILE__, PATHINFO_DIRNAME).'/../include/verifyLogin.php';
require_once pathinfo(__FILE__, PATHINFO_DIRNAME).'/../include/DBConnection.php';
$DB = new DBConnection();
$errorMsg = '<span class="error">Change Not Saved!</span>';

$id = (int)$P['id'];
if (empty($P['tag']))
	$tag = '';
else
	$tag = trim($DB->FilterString($P['tag']));

if (USER_IS_ADMIN and 0 < $id)
{
	if (!empty($tag))
	{
		if ('-----' != $tag)
			$DB->UpdateSingle(TAG_TABLE, 'Tag', "'$tag'", "TagId='$id'");
		else
		{
			$DB->Delete(TAG_TABLE, "TagId='$id'");
			$DB->Delete(TAG_MAP_TABLE, "TagIdFk='$id'");
			echo '';
			exit();
		}
	}
	else
	{
		$row = $DB->Query('SELECT Tag FROM '.TAG_TABLE.' WHERE TagId='.$id)->fetch_array();
		$tag = $row[0];
	}
	echo $tag;
}
else
	if (TEST_MODE)
		echo '<span class="error">Invalid Permissions.</span>';
	else
		echo $errorMsg;

Return current item: Kwalbum