<?php 
require("common_begin.php");

$result = array();

// this isn't terribly pretty or debuggable
if ( !isset($_POST["user"])   || 
     !isset($_POST["pass"])   ||
     !isset($_POST["foo"])    ||
     !isset($_POST["email"])
     //!isset($_POST["messageMail"]) ||
     //!isset($_POST["adminMail"]) 
     )
{
  $result['result'] = "Something broke.";
}
else
{
  if ($_POST["pass"] == "pagemoss")
    $result['result'] = "Failed to register new user (error 0x05000001).";
  else
  {
    $result = Listopia::getInstance()->authAttemptToCreateNewUser(
      $_POST["user"],
      $_POST["pass"],
      $_POST["email"]);
  }
}

echo json_encode($result);

require("common_end.php");

