Code Duplication    Length = 5-6 lines in 4 locations

web_interface/astpp/application/modules/accounts/controllers/accounts.php 2 locations

@@ 403-407 (lines=5) @@
400
		if ($action == "add") {
401
			if ($add_array['ip'] != "") {
402
				$ip = $add_array['ip'];
403
				if (strpos($ip, '/') !== false) {
404
					$add_array['ip'] = $add_array['ip'];
405
				} else {
406
					$add_array['ip'] = $add_array['ip'] . '/32';
407
				}
408
				$where = array("ip" => trim($add_array['ip']), "prefix" => trim($add_array['prefix']));
409
				$getdata = $this->db_model->countQuery("*", "ip_map", $where);
410
				if ($getdata > 0) {
@@ 2389-2393 (lines=5) @@
2386
	 $add_array=$this->input->post();
2387
	 if(!empty($add_array)){
2388
	   $ip = $add_array['ip'];
2389
	   if (strpos($ip, '/') !== false) {
2390
		 $add_array['ip'] = $add_array['ip'];
2391
	   } else {
2392
		 $add_array['ip'] = $add_array['ip'] . '/32';
2393
	   }
2394
	   $this->db->where('ip',$add_array['ip']);
2395
	   $this->db->where('prefix',$add_array['prefix']);
2396
	   $this->db->select('count(ip) as count');

web_interface/astpp/application/modules/ipmap/controllers/ipmap.php 1 location

@@ 67-72 (lines=6) @@
64
	function ipmap_save() {
65
		$add_array = $this->input->post();
66
		$ip = $add_array['ip'];
67
		if (strpos($ip,'/') !== false) {
68
		   $add_array['ip']=$add_array['ip'];
69
		}
70
		else{
71
		   $add_array['ip']=$add_array['ip'].'/32';
72
		}
73
		$data['form'] = $this->form->build_form($this->ipmap_form->get_ipmap_form_fields(), $add_array);
74
		if ($add_array['id'] != '') {
75
			$data['page_title'] = 'Add IP Map';

web_interface/astpp/application/modules/user/controllers/user.php 1 location

@@ 1218-1222 (lines=5) @@
1215
		$accountinfo=$this->session->userdata('accountinfo');
1216
		if($action == 'add'){
1217
			  $ip = $add_array['ip'];
1218
			  if (strpos($ip, '/') !== false) {
1219
				 $add_array['ip'] = $add_array['ip'];
1220
			  } else {
1221
				$add_array['ip'] = $add_array['ip'] . '/32';
1222
			  }
1223
			  $where = array("ip" => trim($add_array['ip']), "prefix" => trim($add_array['prefix']));
1224
			  $getdata = $this->db_model->countQuery("*", "ip_map", $where);
1225
			  if ($getdata > 0) {