Esempio n. 1
0
function get_category_label()
{
    $single = querystring('category', "");
    $multiple = querystring('categories', "");
    $label = "";
    if ($multiple) {
        $multiple = explode(',', $multiple);
        if (!array_search($single, $multiple) && $single != "") {
            array_push($multiple, $single);
        }
        foreach ($multiple as $k => $v) {
            $multiple[$k] = str_replace('-', ' ', ucfirst($v));
        }
        $label = implode(' + ', $multiple);
        return $label;
    }
    if ($single) {
        return ucfirst($single);
    }
    return "";
}
<?php

$querystring = querystring();
$querystringadded = str_replace("?", "&", $querystring);
$querykeywords = querykeywords();
//returns string of referring query without page number
function querystring()
{
    $querystring = "";
    foreach ($_GET as $param_name => $param_val) {
        if ($param_val != "" && $param_name != "page") {
            if ($querystring == "") {
                $querystring = "?{$param_name}={$param_val}";
            } else {
                $querystring = $querystring . "&{$param_name}={$param_val}";
            }
        }
    }
    return $querystring;
}
//creates string of all query keywords separated by spaces
function querykeywords()
{
    $querykeywords = "";
    foreach ($_GET as $param_name => $param_val) {
        if ($param_val != "" && $param_name != "page") {
            $querykeywords .= $param_val . " ";
        }
    }
    return $querykeywords;
}
Esempio n. 3
0
*/
// Open database connection
$host = "host";
$username = "******";
$password = "******";
$dbname = "db";
if ($db = new mysqli($host, $username, $password, $dbname)) {
}
$db->set_charset("utf8");
// Fetch parameters form querystring
$type = querystring("t");
$timeToJoin = querystring('ttj');
$score = querystring('l');
$gameId = querystring('gid');
$playerId = querystring('pid');
$playerName = querystring('pname');
$jsonp = $_GET['callback'];
switch ($type) {
    case 'create':
        global $db;
        // Create random 5 char ID for new game
        $gameId = createGame();
        // New player object
        $id = 1;
        // ID is set to 1 for the player who creates the game
        $player = new Player($gameId, $playerName, $score, $id);
        // Save player object as JSON to database
        $playerJsonId = 'player_1';
        $playerJson = json_encode($player, JSON_UNESCAPED_UNICODE);
        $sql = "UPDATE game SET {$playerJsonId} = '{$playerJson}' WHERE id = '{$gameId}'";
        $db->query($sql);
Esempio n. 4
0
leaveline();
write(currentcgiversion());
leaveline();
write(serverip());
leaveline();
write(servername());
leaveline();
write(serversoftware());
leaveline();
write(serverprotocol());
leaveline();
write(requestmethod());
leaveline();
write(requesttime());
leaveline();
write(querystring());
leaveline();
write(acceptheader());
leaveline();
write(hostheader());
leaveline();
write(currentpageurl());
leaveline();
write(userip());
leaveline();
write(userport());
leaveline();
write(currentfilenamea());
leaveline();
write(serveradmin());
leaveline();
Esempio n. 5
0
<?php

/* 
loggar villur
*/
// Fyrir íslenzku stafina
header('Content-type: text/plain; charset=iso-8859-1');
$error = $_GET['error'];
$site = "not_set";
$site = isset($_GET["site"]) ? querystring("site") : "not_set";
$theDB = "";
$theAction = "";
$errorstring = urldecode($error);
// Lykilorð sem er notað til að læsa/opna MD5 lyklinum
//$strMD5Hash = md5($errorstring ."MamiyaRZ67ProIIULD");
$strMD5Hash = md5("MamiyaRZ67ProIIULD");
$url = "http://geoserver.loftmyndir.is/kortasja/errors_map_is.php?error=" . urlencode($errorstring) . "&site=" . $site . "&page=not_set&md5=" . $strMD5Hash . "&DB=LM_postgis";
$fp = fopen($url, 'r');
$response = '';
while ($l = fread($fp, 1024)) {
    $response .= $l;
}
fclose($fp);
echo $response;
function querystring($parameter)
{
    if ($temp = $_GET[$parameter]) {
        return $temp;
    } else {
        debug("Error, missing parameter " . $parameter . ".");
        echo 3;