Beispiel #1
0
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 * Public License for more details.
 *
 * You should have received a copy of the GNU General Public License along
 * with this program; if not, write to the Free Software Foundation, Inc.,
 * 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */
?>
 
<div id="subnav">
  <div id="users">
    <h4>Users Online</h4>
    <ul id="userlist">
    <?php 
echo userList();
?>
    </ul>
  </div>
</div>

<h4 id="windowTitle"><?php 
echo LACE_SITE_NAME;
?>
 <?php 
echo LACE_SITE_DESCRIPTION ? ' - ' . LACE_SITE_DESCRIPTION : '';
?>
</h4>
<div id="main">
  <div id="laceoutput">
    <?php 
function mongoHandler($input)
{
    /*Here's how it works. The parameters are only used if they are present.
    	If they are not present, they are not used as a part of the query and they are therefore equivalent to an sql "*".*/
    //find
    $qWhere = array();
    if (!isset($input) || $input == NULL || empty($input)) {
        echo "No data submitted<br>";
        break;
    }
    if (in_array(1, $input['defindex']) || empty($input['defindex'])) {
        $defVal = array('$exists' => true);
    } else {
        arrayToNumeric($input['defindex']);
        $defVal = reset($input['defindex']);
    }
    //use the defindex array as a parameter.
    if (in_array(1, $input['effect']) || empty($input['effect'])) {
        $effVal = array('$exists' => true);
        //search type is any effect
    } else {
        arrayToNumeric($input['effect']);
        $effVal = reset($input['effect']);
    }
    $outdate_reserve = time() - 432000;
    if (isset($defVal) && isset($effVal)) {
        $match = array('$elemMatch' => array('defindex' => $defVal, '_particleEffect' => $effVal));
        $query = array('unusual' => array('$all' => array($match)), 'date_reserved' => array('$not' => array('$gt' => $outdate_reserve)));
        //{ price: { $not: { $gt: 1.99 } } }
        //{ "price": { "$not": { "gt": 1.99 } } }
        //'date_reserved' => array( '$not' => array( 'gt' => $outdate_reserve ) )
        //echo '<br><br>' . json_encode( $query ) . '<br><br><br>';
        if ($input['pg'] != 0) {
            $skip = (int) $input['pg'] * 100;
        } else {
            $skip = 0;
        }
        $m = new MongoClient();
        $db = $m->items;
        $collection = $db->unusual;
        $cursor = $collection->find($query)->sort(array("hrs.440" => 1))->limit(100)->skip($skip);
        $resultCount = 0;
        $resultCount = $cursor->count();
        if ($resultCount > 0) {
            echo $resultCount . ' Users found.<br>';
            userList($cursor, $input);
            if (is_array($defVal)) {
                $defVal = 1;
            }
            if (is_array($effVal)) {
                $effVal = 1;
            }
            $page = $input['pg'] + 1;
            echo '<form action="' . $_SERVER['PHP_SELF'] . '" method="GET"><br><br>Next Page: <input type="hidden" name="def" value="' . $defVal . '"><input type="hidden" name="eff" value="' . $effVal . '"><input type="submit" name="pg" value="' . $page . '"></form>';
        } else {
            echo 'No matches found.';
        }
    }
}
Beispiel #3
0
<?php

/*
 * This program is free software; you can redistribute it and/or modify it
 * under the terms of the GNU General Public License as published by the
 * Free Software Foundation; either version 2 of the License, or (at your
 * option) any later version.
 *
 * This program is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 * Public License for more details.
 *
 * You should have received a copy of the GNU General Public License along
 * with this program; if not, write to the Free Software Foundation, Inc.,
 * 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */
/*
 * XMLHttpRequest hook
 */
require_once 'config.php';
if ($_SERVER['REQUEST_METHOD'] !== 'POST') {
    header('Location: ' . LACE_URL_ABS);
    exit;
}
require_once 'common.php';
header('Content-type: text/html; charset=utf-8');
exit('{"response":{' . laceListener() . ',' . userList(true) . '}}');
        case "insert":
            insertNewUser();
            break;
        case "update":
            updateExistingUser();
            break;
        case "delete":
            $id = (int) $_GET['id'];
            if (!empty($id)) {
                deleteUser($id);
            } else {
                $lang['accesswarning'];
            }
            break;
        default:
            userList();
    }
} elseif ($auth == 1) {
    switch ($flag) {
        case "changepw":
            changePW($flag);
            break;
        case "updatepw":
            updatePassword();
            changePW($flag);
            break;
        default:
            header("location:events.php");
    }
} else {
    echo $lang['accessdenied'];