/[drupal]/contributions/modules/arcade/gameserver.php
ViewVC logotype

Contents of /contributions/modules/arcade/gameserver.php

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.3 - (show annotations) (download) (as text)
Thu Apr 9 07:22:34 2009 UTC (7 months, 2 weeks ago) by matt2000
Branch: MAIN
CVS Tags: DRUPAL-6--0-9-BETA1, HEAD
Changes since 1.2: +5 -2 lines
File MIME type: text/x-php
numerous fixes and code clean-up
1 <?php
2
3 /**
4 * @file FlashGames
5 * Server script to talk to games
6 */
7
8
9 //define security function
10 function arcade_check_secure($nid, $uid) {
11 //make sure we got back the checksum and key that we stored
12 $key = db_fetch_object(db_query("SELECT `token`, `key` FROM {arcade_keys} WHERE nid = %d AND uid = %d", $nid, $uid));
13 if (isset($key) && $_POST['arcade'] == $key->key &&
14 isset($_POST[$key->token])) {
15 return TRUE;
16 } else {
17 watchdog('arcade', 'Cheating attempt detected by '. l('user #'.$uid, 'user/'. $uid));
18 drupal_set_message('Cheating attempt detected. If you have recieved this message in error, please inform a site administrator.');
19 return FALSE;
20 }
21 }
22
23 // If we're accessing this file directly, bootstrap Drupal
24 if (!function_exists('drupal_get_path')) {
25 $prefix = "";
26 while(!file_exists($prefix ."includes/bootstrap.inc")) {
27 $prefix .= "../";
28 }
29 if ($prefix != "") chdir($prefix);
30 include_once("./includes/bootstrap.inc");
31 drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
32 }
33 chdir(drupal_get_path('module','arcade'));
34
35 //watchdog('arcade','triggered: '. var_export($_POST, TRUE));
36
37 //cover for older pnFlashGames that may not use the pn_mods variable
38 if (isset($_POST['module']) && $_POST['module']=='pnFlashGames') $_POST['game_protocol'] = 'pnFlashGames';
39
40 //Check if we've been sent any requests from a game.
41 if ($_POST['game_protocol']) {
42 include_once("protocols/{$_POST['game_protocol']}.inc");
43 } elseif ($_POST) {
44 include_once("protocols/default.inc");
45 }

  ViewVC Help
Powered by ViewVC 1.1.2