Location: PHPKode > scripts > Create Your Own Directory > cms/admin/ajax1.php
<?php
require_once "../auth/config.php";
$link = mysql_connect($hostname, $username,$password);
$res=mysql_select_db($dbname,$link);
$ref=$_SERVER[HTTP_REFERER];
$rip = $_SERVER['REMOTE_ADDR'];
//$domain = strstr($ref, 'codingcoding.com');
//if(($domain)){
$duplicate="no";
$pro=$_GET['process'];
$fname = $_GET['fname'];
$catid=$_GET['catid'];
$ftype = $_GET['ftype'];
$oldval = $_GET['oldval'];
$i=$_GET['sno'];
if($pro=="update"){
	$str="select fname from cntfields where fname='$fname'";
	$res = mysql_query($str,$link);
	if($res)
	{
		$duplicate="present";
	}
	if($duplicate=="no"){
		$str1="update cntfields set fname='$fname',ftype='$ftype' where catid=$catid and fname='$oldval'";
		$result = mysql_query($str1,$link);
		if($result){
			echo"update--$i";
		}else{
			echo"error--$i";
		}
	}else{
		echo"duplicate--$i";
	}
}else if($pro=="delete")
{
$str="delete from cntfields where catid=$catid and fname='$fname' and ftype='$ftype'";
		$res = mysql_query($str,$link);
		if($res){
			echo"deleted--$i";
		}else{
			echo"error--$i";
		}


}
//}
?>
Return current item: Create Your Own Directory