view showajax.php @ 136:aeebfedb5709

Add some copyright headers.
author Matti Hamalainen <ccr@tnsp.org>
date Tue, 22 Oct 2013 22:04:22 +0300
parents 71c35d5302c2
children 75cf14ee99a7
line wrap: on
line source

<?
//
// FAPWeb Simple Demoparty System
// Party information display system AJAX backend module
// (C) Copyright 2012-2013 Tecnic Software productions (TNSP)
//
require "mconfig.inc.php";
require "msite.inc.php";

stSetupCacheControl();

// Initiate SQL database connection
if (!stConnectSQLDB())
  die("Could not connect to SQL database.");

// Fetch non-"hardcoded" settings from SQL database
stReloadSettings();


// XMLHttp responses
$action = "ERROR";
if (stChkRequestItem("action") && stChkRequestItem("type"))
{
  $action = $_REQUEST["action"];
  $type = $_REQUEST["type"];
}

switch ($action)
{
  case "get":
    //
    // Get specific data
    //
    switch ($type)
    {
      case "votes":
        $sql = "SELECT * FROM votes ORDER BY utime DESC";
        break;
    }
    
    //
    // Perform query if we need to, output results
    //
    if (isset($sql) && ($res = stExecSQLCond($sql, "")) !== FALSE)
    {
      if ($type == "votes")
      {
      }
    }
    break;

  case "set":
    //
    // Set vote
    //
    if ($type == "votes" && stChkRequestItem("voter_id") &&
      stChkRequestItem("entry_id") && stChkRequestItem("vote"))
    {
      stGetCompoList(FALSE);
      
      stSubmitOneVote(stGetRequestItem("voter_id"), stGetRequestItem("entry_id"), stGetRequestItem("vote"));
    }
    else
      stSetStatus(902, "No data.");
    break;

  default:
    stSetStatus(404, "Not Found");
    break;
}

?>