<?php
if (!isset($code)){
	echo "<script>window.location='index.php';</script>";	
} else {
	require_once('../adodb/adodb.inc.php');
	require_once('../Amfphp/Services/conexao.php');
	require_once('../Amfphp/Services/funcoes.php');
	$con = new conexao();
	$code = anti_injection($code);
	$sql = "select csp_user.*, profile.profile, profile.host, profile.portaprofile, profile.des from csp_user, profile where csp_user.code='$code' and csp_user.idprofile = profile.idprofile";
	$resultado = $con->banco->Execute($sql);
	$registro = $resultado->FetchNextObject();
	$dataativacao = $registro->DATAATIVACAO;
	$dataativacao2 = dmy($dataativacao);
	$csp_login = $registro->NAME;
	$csp_senha = $registro->PASSWORD;
	$csp_expiredate = dmy($registro->EXPIREDATE);
	$csp_expirehora = $registro->EXPIREHORA;
	$csp_profile = $registro->PROFILE;
	$profile_host = $registro->HOST;
	$profile_porta = $registro->PORTAPROFILE;
	$profile_des = $registro->DES;
	$idempresa = $registro->IDEMPRESA;
	$sql = "select linkboleto from empresa where idempresa='$idempresa'";
	$resultado = $con->banco->Execute($sql);
	$registro = $resultado->FetchNextObject();
	$url = $registro->LINKBOLETO;
	if ($dataativacao == "0000-00-00"){
		echo "<script>window.alert('ERRO. CODE ainda não foi ativado');</script>";
		echo "<script>window.location='index.php';</script>";
	}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Codigo Ativado.</title>
<link href="netplus.css" rel="stylesheet" type="text/css" />
</head>

<body>
<table width="476" border="0" align="center">
  <tr>
    <td width="375" align="center"><p><img src="../imagens/clientes.jpg" width="197" height="175" /></p>
    <p><span class="txtBOX2">Code ativado em <?php echo $dataativacao2;?></span></p></td>
  </tr>
</table>
<br />
<table width="343" border="1" align="center">
    <tr bgcolor="#FFFF99" class="txtBOX">
      <td colspan="2">Dados da Ativacao:</td>
  </tr>
    <tr class="txtBOX">
      <td width="135" align="right">Login:</td>
      <td width="192"><strong><?php echo $csp_login;?></strong></td>
    </tr>
    <tr class="txtBOX">
      <td align="right">Senha</td>
      <td><strong><?php echo $csp_senha;?></strong></td>
    </tr>
    <tr class="txtBOX">
      <td align="right">Operadora</td>
      <td><?php echo $csp_profile;?></td>
    </tr>
    <tr class="txtBOX">
      <td align="right">URL Servidor</td>
      <td><?php echo $profile_host;?></td>
    </tr>
    <tr class="txtBOX">
      <td align="right">Porta Conexao:</td>
      <td><?php echo $profile_porta;?></td>
    </tr>
    <tr class="txtBOX">
      <td align="right">Chave DES:</td>
      <td><?php echo $profile_des;?></td>
    </tr>


    <tr class="txtBOX">
      <td align="right">Valido ATE:</td>
      <td><?php echo $csp_expiredate;?> as <?php echo $csp_expirehora;?></td>
    </tr>
  </table>
<br />
<table width="591" border="0" align="center">
  <tr>
      <td width="585" align="center" class="relatorio1"><p class="txtBOX2">Obrigado por utilizar nossos servicos. Para futuras renovacoes entre em contato com seu vendedor.</p></td>
    </tr>
  </table>
  <p>&nbsp;</p>
</body>
</html>
<?php }
?>