<?php
include "stuff.php";
$con = mysqli_connect($server,$user,$password,$db);
$name = $_POST['name'];
$email = $_POST['email'];
$pwd = $_POST['pwd1'];
if(is_unique_str($con,$email,'email','users')){
  mysqli_query($con,"INSERT INTO users(name,email,password) VALUES('{$name}','{$email}','{$pwd}')");
  $res = mysqli_query($con,"SELECT MAX(id) FROM users");
  $row = mysqli_fetch_array($res);
  log_user_in($row[0],$con);
  header("location: ../index.php");
}else{
  echo ("<h1>email is already in use</h1>");
}
?>
