Location: PHPKode > projects > ArticleSetup > ArticleSetup-v1-1/upload/admin/distribution.php
<?php
	include ('../config.php');
	$sitequery = 'select * from settings;';
	$siteresult = mysql_query($sitequery,$connection) or die(mysql_error());
	$siteinfo = mysql_fetch_array($siteresult);
	$skipqueue = $siteinfo['skipqueue']; // 0 = yes
	$distribution = $siteinfo['distribution']; // 0 = yes

$articleid = "http://articlesynergy.com/".$_REQUEST['article'];

$curl_handle=curl_init();
curl_setopt($curl_handle,CURLOPT_URL,$articleid);
curl_setopt($curl_handle,CURLOPT_CONNECTTIMEOUT,2);
curl_setopt($curl_handle,CURLOPT_RETURNTRANSFER,1);
$buffer = curl_exec($curl_handle);
curl_close($curl_handle);

$xml = simplexml_load_string($buffer);

	
	if(get_magic_quotes_gpc()) {
		$title = $xml->title;
		$body = $xml->body;
		$resource = $xml->resource;
	} else {
		$title = mysql_real_escape_string($xml->title);
		$body = mysql_real_escape_string($xml->body);
		$resource = mysql_real_escape_string($xml->resource);
	}

	$category = $xml->category;
	$mysqldate = date( 'Y-m-d H:i:s' );

	if($title && $category && $body && $resource) { 

	$mysqldate = date( 'Y-m-d H:i:s' );

//Get the category's id and parentid id	
		$catquery = "select * from categories where name ='".$category."'";
		$catresult = mysql_query($catquery,$connection) or die(mysql_error());
		$catinfo = mysql_fetch_array($catresult);

		if (!mysql_num_rows($catresult)) {
			$catid = 1;
			$parentid = "NULL";
		} else {
			$catid = $catinfo['id'];
			$parentid = $catinfo['parentid'];
			if (!$parentid) {
				$parentid = "NULL";
			}
		}

if ($distribution) { 
} else {

	if ($skipqueue){	
		$sql = "INSERT INTO `articles` VALUES ( NULL, 0, 1, '".$mysqldate."', '".$title."', 
				".$catid.", ".$parentid.", '".$body."', '".$resource."', NULL);";
	} else {
		$sql = "INSERT INTO `articles` VALUES ( NULL, 1, 1, '".$mysqldate."', '".$title."', 
				".$catid.", ".$parentid.", '".$body."', '".$resource."', NULL);";
	}
	
	$query = mysql_query($sql);
	exit();
}
}


?>
Return current item: ArticleSetup