<?php
require_once 'sql.php';
require_once 'config.php';
require 'sessao.php';
require_once "PagSeguroLibrary/PagSeguroLibrary.php";
?>
<title>Painel DNS | Pedido</title>

<style type="text/css">

@import url(https://fonts.googleapis.com/css?family=PT+Sans:400,700,400italic,700italic);
* {
margin: 0;
padding: 0;
box-sizing: border-box;
-moz-box-sizing: border-box;
}

html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, big, cite, code, del, dfn, em, img, ins, kbd, q, s, samp, small, strike, strong, sub, sup, tt, var, b, u, i, center, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td, article, aside, canvas, details, figcaption, figure, footer, header, hgroup, menu, nav, section, summary, time, mark, audio, video {
margin: 0;
padding: 0;
border: 0;
outline: 0;
font-size: 100%;
font: inherit;
vertical-align: top;
box-sizing: border-box;
-moz-box-sizing: border-box;
}

body {
font-family: "Source Sans Pro", "helvetica", sans-serif;
font-style: normal;
font-weight: normal;
text-align: center;
font-size: 16px;
color: rgba(39,65,90,1);
}

h4 {
margin-bottom: 12px;
font-size: 1.25em;
font-weight: 400;
text-transform: uppercase;
}

h5 {
font-size: 1.75em;
}

p {
margin-top: 1em;
margin-bottom: 1em;
color: rgba(39,65,90,.9);
font-size: 1.25em;
line-height: 1.625em;
}


ol, ul {
list-style: none;
}

body {
line-height: 1;
}

strong {
color: rgba(39,65,90,1);
font-weight: 600;
}

.plans {
background: #e7f2f0;
}

.layer {
clear: both;
width: 100%;
height: auto;
padding: 60px 7.5% 60px;
display: block;
}

.layer > section, .layer > article {
clear: both;
width: 100%;
height: auto;
max-width: 1092px;
margin: 0 auto;
display: block;
}

.third {
width: 27.95%;
margin: 0 30px 0 0;
display: inline-block;
}

.plan-tier {
background: white;
vertical-align: baseline;
border-radius: 3px;
-moz-border-radius: 3px;
cursor: pointer;
overflow: hidden;
}

.lift {
position: relative;
-webkit-transition: all .075s ease-out;
-moz-transition: all .075s ease-out;
-o-transition: all .075s ease-out;
transition: all .075s ease-out;
}

.lift:hover {
top: -3px;
-webkit-box-shadow: 0 2px 6px rgba(39,65,90,.15);
-moz-box-shadow: 0 2px 6px rgba(39,65,90,.15);
box-shadow: 0 2px 6px rgba(39,65,90,.15);
}

.plan-tier h4 {
padding: 18px 0 15px;
margin: 0 0 30px;
background: #00a1ff;
color: white;
}

.plan-tier {
cursor: pointer;
}

.plan-tier sup {
position: relative;
right: -9px;
}

.plan-tier ul {
margin: 30px 0 0;
border-top: 2px solid #e7f2f0;
}

.plan-tier ul li {
font-size: 1.25em;
padding: 18px 0;
color: rgba(39,65,90,.9);
border-bottom: 2px solid #e7f2f0;
}

sup {
vertical-align: top;
}

.plan-tier .plan-price {
font-size: 5em;
font-weight: 300;
letter-spacing: -3px;
}

.plan-tier sub {
vertical-align: bottom;
position: relative;
bottom: .875em;
}

.plan-tier .early-adopter-price {
color: #0091e5;
}
p:first-of-type {
margin-top: 0;
}

small, del {
color: rgba(39,65,90,.5);
font-size: 1em;
line-height: 1.5em;
}

s, strike, del {
text-decoration: line-through;
}


.layer {
padding-top: 96px;
padding-bottom: 96px;
}

.plan-tier.callout h6 {
width: 100%;
padding: 15px 0 14px;
background: #8dcf3f;
color: rgba(39,65,90,.5);
font-size: 1.25em;
}

.plan-tier.callout h4 {
background-color: #78b336;
}
</style>

<section class="layer plans">
  <section>

    
    <section class="third lift plan-tier" onclick="location.href='pedido.php?plano=1';">

      
      <h4>Premium</h4>
      <h5><sup class="superscript">R$</sup><span class="plan-price">10</span><sub> /mês</sub></h5>

      
      <del>R$15/mês</del>
      

      <ul>
<li><strong>30</strong> Redirecionamentos</li>
<li><strong></strong> Domínios Adicionais</li>
<li><strong></strong> Suporte via TeamSpeak</li>
<li><strong>Suporte 24/7</strong></li>
</ul>

    </section>
    
    <section class="third lift plan-tier callout" onclick="location.href='pedido.php?plano=2';">

      <h6>Mais Popular</h6>
      <h4>Ultimate</h4>
      <h5><sup class="superscript">R$</sup><span class="plan-price">15</span><sub> /mês</sub></h5>

      
      <del>R$25/mês</del>
      

      <ul>
<li><strong>50</strong> Redirecionamentos</li>
<li><strong></strong> Domínios Adicionais</li>
<li><strong></strong> Suporte via TeamSpeak</li>
<li><strong>Suporte 24/7</strong></li>
</ul>

    </section>
    
    <section class="third lift plan-tier" onclick="location.href='pedido.php?plano=3';">

      
      <h4>Enterprise</h4>
      <h5><sup class="superscript">R$</sup><span class="plan-price">30</span><sub> /mês</sub></h5>

      
      <del>R$35/mês</del>
      

      <ul>
<li><strong>Ilimitado</strong></li>
<li><strong></strong> Domínios Adicionais</li>
<li><strong></strong> Suporte via TeamSpeak</li>
<li><strong>Suporte 24/7</strong></li>
</ul>

    </section>
    
    
    <div style="clear: both"></div>
  </section>
</section>
<script type="text/javascript" src="https://stc.pagseguro.uol.com.br/pagseguro/api/v2/checkout/pagseguro.lightbox.js"></script>
<?php

function add($nome, $preco, $ip_perso, $id_user){
    $sqlFETCH = "SHOW TABLE STATUS LIKE 'planos_b'";
    $query = mysql_query($sqlFETCH);
    $fetch = mysql_fetch_assoc($query);
    $id = $fetch['Auto_increment'];

    $postdata = http_build_query(array(
    	'email' => 'financeiro@paineldns.com',
    	'token' => '222126AFB1F44ED7B4BA70CB3ACA4B36',
    	'currency' => 'BRL',
   		'itemId1' => $id,
   		'itemDescription1' => $nome,
   		'itemAmount1' => $preco,
   		'itemWeight1' => '1',
   		'itemQuantity1' => '1',
    	'reference' => $id_user,
    	'shippingType' => '1',
    	'notificationURL' => 'www.paineldns.com/retorno_pagseguro.php',
    ));
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL,"https://ws.pagseguro.uol.com.br/v2/checkout");
    curl_setopt($ch, CURLOPT_POST, 1);
    curl_setopt($ch, CURLOPT_POSTFIELDS, $postdata);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    $server_output = curl_exec ($ch);
    curl_close ($ch);


    //$xml = simplexml_load_string($server_output);
    //$code = $xml->code;

    $sql = "INSERT INTO planos_b (ip_perso,id_user,code) VALUES ('$ip_perso', '$id_user', '$code')";
    mysql_query($sql);
    echo '<script type="text/javascript">window.onload = function(){PagSeguroLightbox("'.$code.'"");}</script>';
 }
if(isset($_GET['plano'])){
  switch ($_GET['plano']) {
    case '1':
      add('Plano DNS - 1', '9.90', '30', $id_user);
      break;
    case '2':
      add('Plano DNS - 2', '14.90', '50', $id_user);
      break;
    case '3':
      add('Plano DNS - 3', '29.90', '9999', $id_user);
      break;
  }
}