<?php
if(!defined('AUTHACCESS')){echo "Not Allowed";exit();}
//camspower_update
$xmlmodels = array();
$xml=simplexml_load_string($xmlfile);
$p_end = count($xml->webcam);
$t_ndx = 0;
$mnndx = 0;
$npt = $p_end;
$npt--;
$ordinator = get_ordinator($npt);
global $camspower_id;
for($x=0;$x<$p_end;$x++) {

	$rsindx = (int)$ordinator[$x];
	

				$model_info = array();
				$model_info['sponsor'] = 'camspower';


				$url1 = "http://www.xcams.com/chatfs/" . clean_basic($xml->webcam[$rsindx]->nickname) . "?dsclr=false&comfrom=" . $camspower_id . "&cf2=&cfsa2=&cf0=pc2";

				$xtemp_mlink = base64_encode($url1);
				$xtemp_mlink = urlencode($xtemp_mlink);

				$iframe_src = "https://jygotubvpyguak.com/cp/text_link/index.php?ur=" . $xtemp_mlink . "&promo=xcams&subid1=&subid2=&brand=xcams";

				$model_info['iframe_src'] = $iframe_src;


				$model_info['display_name'] = clean_basic($xml->webcam[$rsindx]->nickname);
				if (ctype_space($model_info['display_name'])) {
					unset($model_info['display_name']);
				}




				$model_info['username'] = cleanname($xml->webcam[$rsindx]->nickname);
				$model_info['username'] = preg_replace("/ /", "_", $model_info['username']);
				
				$model_info['username'] = strtolower($model_info['username']);

				$model_info['thumb'] = "http://cams.images-dnxlive.com/snapshots/" . $xml->webcam[$rsindx]['account'] . "_webcam_200x150.jpg";



				$model_info['thumb'] = cleanthumb($model_info['thumb']);
				$thm = $model_info['thumb'];
				$model_info['thumb'] = $thm;
				$model_info['topic'] = cleansub($xml->webcam[$rsindx]->nickname);



				$model_info['turns_on'] = "";
				$model_info['turns_off'] = "";



				if(in_array($model_info['username'], $used_modelnames)) {
					$model_info['username'] = $model_info['username'] . "_camsp";
				}
				$used_modelnames[] = $model_info['username'];
				$xmlmodels[] = $model_info;
				$allmodel_array[] = $model_info;
				$xmlmodels_allcams[] = $model_info;
			
			$t_ndx++;
			if($t_ndx>9000){echo "overflow! 9000 ";exit();}

			 


		}//camspower

$total_item_count += count($xmlmodels);
$out_file = __DIR__ . "/../feeds/feed_camspower.txt";
$filedata = serialize($xmlmodels);
writetxtfile($out_file, $filedata);
$out_file = __DIR__ . "/../feeds/modelndx_camspower.txt";
$filedata = serialize($xmlmodels_names);
writetxtfile($out_file, $filedata);	


?>
