<?php
session_start();
//header("Content-Type: text/html; charset=UTF-8",true);
include "../classes/db.class.php";
include "../classes/fc.class.php";

   if(isset($_POST['email']) && isset($_POST['nome'])){
        $email= $_POST['email'];
        $nome= strtoupper($_POST['nome']);
        $senha= sha1($_POST['senha']);
       
    }else{
        echo "erro";
        exit;
    }
    
    $opt=FC::cademail($nome,$email,$senha);
    if($opt==null){
        echo "erro";
        exit;
    }
    ///gravar o opt no txt para teste
    $fp = fopen("../opt.txt", "a+");
    fwrite($fp, $opt."\n");
    fclose($fp);

    $_SESSION['vem']=$email;
    $_SESSION['vnm']=$nome;

    echo "ok";
    exit;
  
