<? //session_start();?>
<?php

require_once("../../comun/conexion3.php");

require_once("../../comun/actions.php");

require_once("../../comun/funciones.php");

$action = new actions();

$idalias = $_POST['idalias'];
$alias = $_POST['alias'];
$idcliente = $_POST['idcliente'];
$nickname = $_POST['nickname'];
$operacion = $_POST['operacion'];
//$action->alert($idalias);

if($nickname!='' and $idcliente!='' and $alias!=''){
	if($operacion=='ALTA'){
		$buscar=busquedaB("select id from alias where idcliente='$idcliente' and
		nickname='$nickname' and alias ='$alias'","id");
	}elseif($operacion=='CAMBIO') {
		$buscar=busquedaB("select id from alias where idcliente='$idcliente' and
		nickname='$nickname' and alias ='$alias' and id<>'$idalias'","id");
	}
	
	if($buscar!=''){
		$action->alert("Esta sucursal ya esta registrada, no podra continuar");
		$action->text("idalias",'');
		$action->text("alias",'');
		$action->text("nickname",'');
	}
}
$action->send_response();

return;

?>