Location: PHPKode > projects > phpMyPrepaid > phpmyprepaid/www/include/location/add_location_process.php
<?php
	if(!isset($_POST['location'])){ $error="Location not set.<br>"; $count=$count+1;}
	if($_POST['location'] == ""){ $error="$error Location not filled in<br>"; $count=$count+1;}
	if(!isset($_POST['domain'])){ $error="Domain not set.<br>"; $count=$count+1;}
	if($_POST['domain'] == ""){ $error="$error Domain not filled in<br>"; $count=$count+1;}
	if(!isset($_POST['city'])){ $error="$error City not set.<br>"; $count=$count+1;}
	if($_POST['city'] == ""){ $error="$error City not Filled in<br>"; $count=$count+1;}
	if(!isset($_POST['country'])){ $error="$error Country not set.<br>"; $count=$count+1;}
	if($_POST['country'] == ""){ $error="$error Country not filled in<br>"; $count=$count+1;}
	
	// check to make sure the location name does not have ilegal chars
	// NO SPACES as this will be a table name!!!
	// $LocID=($_POST['location']);
	// getLoc($LocID);
	$input=($_POST['location']);
	//echo"$input"; //DEBUG
	if (hasSpace($input)){
		$error=$error." No spaces allowed location name.<br>"; $count=$count+1;
	}
	if (hasPeriod($input)){
		$error=$error." No periods allowed location name.<br>"; $count=$count+1;
	}
	// check to make sure that the Location Name does not exist yet
	$location = $_POST['location'];
	$domain = $_POST['domain'];
	$area_code = $_POST['area_code'];
	$city = $_POST['city'];
	$country = $_POST['country'];
	if ($debug) {
		echo $location  ."<br>";;
		echo "DOMAIN".$domain  ."<br>";;
		echo "AREA CODE ".$area_code ."<br>";
		echo "CITY ".$city ."<br>";
		echo "COUNT ".$country."<br>";
		
	}
	if($numrows > 0){ $error=$error." This Location already exists.<br>";$count=$count+1;}
	if(!isset($error)){
		if (getLocationID($_POST['location'])=='')
	        {
			add_loc($_POST['location'], $_POST['domain'], $_POST['area_code'], $_POST['city'], $_POST['country'],$oreon->user->get_id());			
			
		echo "<p class=\"information\">New location <b>".$location."</b> was successfully added.</p>";
		}else
		echo "<p class=\"error\">Can add location with same name</p>";
			unset($_POST['buttonID']);
		unset($_SESSION['button']);
		$_SESSION['button']='showLoc';
		$_POST['buttonID']='showLoc';
		//echo '<script language="JavaScript">window.location.reload();</script>';
	}
	if(isset($error)){
		if($count>1){
			$msg="$count errors were encountered while processing the form.";
			$tailmsg="Please fix the above errors and resubmit.";
		}
		if($count==1){
			$msg="An error was encountered while processing the form.";
			$tailmsg="Please fix the above error and resubmit.";
		}
		unset($_POST['buttonID']);
		unset($_SESSION['button']);
		echo("<p class=\"error\">$msg<br>$error $tailmsg</p>");
		include('include/location/add_location_form.php');
	}
	
	
?>
Return current item: phpMyPrepaid