Exemplo n.º 1
0
function insert_zmonitor_data($server_cfg, $game_cfg, $time_slots = '*')
{
    $game_name = $game_cfg["name"];
    $table = $game_cfg['zmonitor_table'];
    $array_name = null;
    // Check if passed game is an array game. If yes change parameters for get_eu accordingly
    if (isset($game_cfg['id'])) {
        $array_id = $game_cfg['id'];
        $rsObj = new RightScale($server_cfg, $game_cfg);
        $array_id_name = $rsObj->get_array_id_name();
        $game_name = $game_cfg['parent'];
        if (!empty($array_id_name)) {
            $array_name = $array_id_name[$array_id];
        }
    }
    // Fetch curent eu from eu database
    $euObj = new EUAdapter($server_cfg);
    $data_array = $euObj->get_current_eu($game_name, $array_name);
    $query = createQuery($table, $data_array);
    echo "{$query}\n";
    $query_res = execute_queries($server_cfg, $game_cfg, array($query));
    if ($query_res == 0) {
        $game_cfg['logger']->log("insert_zmonitor_data", "zmonitor data for " . $game_cfg['name'] . " successfully inserted", Logger::INFO);
    } else {
        $game_cfg['logger']->log("insert_zmonitor_data", "zmonitor data for " . $game_cfg['name'] . " not inserted", Logger::ERR);
    }
}
Exemplo n.º 2
0
function run12sml()
{
    // 1.) creates query
    // 2.) creates meeting array from querty
    // 3. ) creates meeting list from meeting array
    createMeetingList(createMeetingArray(createQuery()));
}
Exemplo n.º 3
0
function getResults($arr){
	$q = createQuery($arr);
	//echo $q ."<br>";
	$result = mysql_query($q);
	if (!$result) {
    	//	$message  = 'Invalid query: ' . mysql_error() . "\n";
    	//	$message .= 'Whole query: ' . $query;
    	//	die($message);
	}
	return $result;
}
Exemplo n.º 4
0
function getList($start, $amount, $sortValue, $sortOrder)
{
    global $servername, $username, $password, $dbname;
    $valueFromCache = getFromCache("K{$start}.{$amount}.{$sortValue}.{$sortOrder}");
    if ($valueFromCache) {
        return $valueFromCache;
    }
    $conn = mysqli_connect($servername, $username, $password, $dbname);
    if (!$conn) {
        die("Connection failed: " . mysql_error());
    }
    $sql = createQuery($start, $amount, $sortValue, $sortOrder);
    $result = mysqli_query($conn, $sql);
    $products = array();
    if (mysqli_num_rows($result) > 0) {
        while ($row = mysqli_fetch_assoc($result)) {
            array_push($products, array('id' => $row['Id'], 'name' => $row['Name'], 'description' => $row['Description'], 'price' => $row['Price'], 'url' => $row['Url']));
        }
    }
    mysqli_close($conn);
    $jsonResult = json_encode($products);
    addToCache("K{$start}.{$amount}.{$sortValue}.{$sortOrder}", $jsonResult);
    return $jsonResult;
}
Exemplo n.º 5
0
/*$conn = mysqli_connect($servername,"root","");
if (!$conn) {
    die(json_encode("connection error"));
}
mysqli_select_db($conn,'dhp');*/
$sql = "SELECT `user_type` FROM `users` WHERE username = '******'";
$teacher = createQuery($sql);
$row = $teacher->fetch_assoc();
echo json_encode($row['user_type']);
//if($teacher=="student") {
$sql = "SELECT `destination`,`teacher_id`, `date`  FROM `passes` WHERE student_id = '" . $student . "'";
//}
//else {
//$sql = "SELECT `destination`,`student_id`, `date`  FROM `passes` WHERE teacher_id = '" . $student . "'";
//}
$ret = createQuery($sql);
//$row=mysqli_fetch_array($ret,MYSQLI_ASSOC);
$i = 0;
while ($row = $ret->fetch_assoc()) {
    //echo $row['date'];
    //echo json_encode($ret->fetch_fields());
    $array[$i]['destination'] = $row['destination'];
    $array[$i]['date'] = $row['date'];
    $sql = "SELECT `first`,`last` FROM `users` WHERE username ='******'teacher_id'] . "'";
    $ret2 = createQuery($sql);
    $row2 = mysqli_fetch_array($ret2, MYSQLI_ASSOC);
    $array[$i]['teacher'] = $row2['first'] . " " . $row2['last'];
    $i++;
}
echo json_encode($array);
//mysqli_close($conn);
Exemplo n.º 6
0
Arquivo: db.php Projeto: sd-studio/sh
function query2var($query, $params = array())
{
    $val = false;
    $q = null;
    if (is_string($query)) {
        $q = createQuery($query, $params);
    } else {
        $q = $query;
        $q->setParams($params);
    }
    if ($q->execute()->fetch(DB_FETCH_NUM)) {
        $val = $q->at(0);
    }
    $q->close();
    return $val;
}
Exemplo n.º 7
0
<?php

include "config.php";
#No longer used
//$servername = "localhost";
//$database = "dhp";
$student = mysqli_real_escape_string($_POST["STUDENTID"]);
#Make this equal 1st input
/*$conn = mysqli_connect($servername,"root","");
if (!$conn) {
    die(json_encode("connection error"));
}
mysqli_select_db($conn,'dhp');*/
$date = date("y-m-d");
$time = date("h:i:sa");
//echo $date." ".$time;
$sql = "SELECT `destination`,`teacher_id` FROM `passes` WHERE student_id = '" . $student . "' AND date > '20" . $date . " " . $time . "'";
$ret = createQuery($sql);
$row = mysqli_fetch_array($ret, MYSQLI_ASSOC);
if ($row == null) {
    echo "no pass";
} else {
    echo "Destination: " . json_encode($row['destination']) . "\nTeacher:" . json_encode($row['teacher_id']);
}
//mysqli_close($conn);
Exemplo n.º 8
0
<?php

include "config.php";
$username = mysqli_real_escape_string($_POST["username"]);
$password = mysqli_real_escape_string($_POST["password"]);
createQuery("SELECT FROM person WHERE username = "******" AND password ="******";");
 public function findByusername($username)
 {
     $query = createQuery("SELECT u FROM WebVLWebVillasBundle:Users u WHERE u.username = :username")->setParameter('username', $username);
     return $query->getSingleResult();
 }
Exemplo n.º 10
0
<?php

include_once "protected/mysql.inc";
include_once "commonstuff.php";
$searchcriteria = SearchCriteriaCreateFromPost();
$lang = getGet("lang", getPost("lang", "language1"));
include "top.php";
//echo("start ".microtime_float()."<br/>");
//$starttime = microtime_float();
$query = createQuery($lang, $searchcriteria->group, $searchcriteria->location, $searchcriteria->media, $searchcriteria->searchterm, "true");
//echo $query;
$result = mysql_query($query);
//echo "<br/>".mysql_error();
$num = mysql_numrows($result);
include "form.php";
$i = 0;
echo "<div class=\"listarea\">\n";
while ($i < $num) {
    echo "<div class=\"listelement\">\n";
    $contact = ContactFillAll($result, $i);
    $contact->prepareForHTML();
    echo "<h3 class=\"structuretitle\">" . $contact->m[1] . "</h3>\n";
    //name
    echo "<table class=\"shortlistelement\" width=\"100%\"" . ($num == 1 ? "style=\"display: none\"" : "") . ">\n";
    echo "<tr><td width=\"61.8%\">" . $contact->m[2] . "</td>\n";
    //kurzbeschreibung
    echo "<td style=\"padding-left: 15px\" >" . $contact->m[5] . "<br/><br/></td>\n";
    //BasisAdresse
    echo "<td align=\"right\"><a class=\"showdetaillink\"><img src=\"TEX/down.png\" alt=\"down\" border=\"0\"/></a></td></tr>\n";
    echo "</table>\n";
    echo "<table class=\"longlistelement\" width=\"100%\" " . ($num > 1 ? "style=\"display: none\"" : "") . ">\n";
Exemplo n.º 11
0
                $regulars[] = $article;
            }
        }
        $sorted = $wizards;
        foreach ($regulars as $regular) {
            $sorted[] = $regular;
        }
        $articles = new Requests($sorted, Requests::Articles);
    }
    return $articles;
}
// .../api/v1/help_data?search=blah_blah
if (isset($_GET['search'])) {
    // Format string for search function
    $raw_string = trim(urldecode($_GET['search']));
    $query = createQuery($raw_string);
    if ($query !== null) {
        $result = searchArticles($query);
        if ($result !== null) {
            header('Content-Type: application/json');
            echo json_encode($result);
            exit;
        } else {
            header('Content-Type: application/json');
            echo json_encode(['error' => 'No relevant articles found!']);
            exit;
        }
    } else {
        echo json_encode(['error' => 'Input not descriptive enough, no relevant articles found!']);
    }
}
Exemplo n.º 12
0
}
if (isset($_GET['table']) && !empty($_GET['table'])) {
    if (isset($_GET['written']) && !empty($_GET['written'])) {
        if ($_GET['written'] == "true") {
            if (isset($_GET['query']) && !empty($_GET['query'])) {
                $tableQuery = createQuery($_GET['table'], $_GET['query'], "SELECT * FROM " . $_GET['table'] . " WHERE ", false);
            } else {
                $key = explode("_", $_GET['table']);
                $orderBy = $key[2] == "nullen" ? "nul" : "mentor";
                $tableQuery = $mysqli->query("SELECT * FROM " . $_GET['table'] . " ORDER BY `" . $orderBy . "_naam`");
            }
        }
        if ($_GET['written'] == "false") {
            if (isset($_GET['query']) && !empty($_GET['query'])) {
                $key = explode("_", $_GET['table']);
                $tableQuery = createQuery($_GET['table'], $_GET['query'], "SELECT * FROM " . $_GET['table'] . " WHERE id NOT IN (SELECT id FROM `facie_data_" . $key[2] . "`) AND (", true);
            } else {
                $key = explode("_", $_GET['table']);
                $orderBy = $key[2] == "nullen" ? "nul" : "mentor";
                $tableQuery = $mysqli->query("SELECT * FROM " . $_GET['table'] . " WHERE id NOT IN (SELECT id FROM `facie_data_" . $key[2] . "`) ORDER BY `export_" . $orderBy . "_naam`") or die($mysqli->error);
            }
        }
    }
    $json = '{ "result": [';
    while ($result = $tableQuery->fetch_array(MYSQLI_ASSOC)) {
        $json .= '{';
        foreach ($result as $key => $value) {
            $key = explode("_", $key);
            $json .= '"' . $key[count($key) - 1] . '" : "' . htmlentities($value, ENT_QUOTES) . '",';
        }
        $json = substr($json, 0, -1);
Exemplo n.º 13
0
 private function getRowNumber($productId)
 {
     $productId = Product::toID($productId);
     $q = createQuery("\r\n\t\t\tSELECT @rownum:=@rownum+1 as rownum, id FROM ({$this->buildSQL()}) products, (SELECT @rownum:=0) r\r\n\t\t");
     $q->execute();
     while ($q->fetch()) {
         if ($q->at('id') == $productId) {
             return $q->at('rownum');
         }
     }
     return false;
 }
Exemplo n.º 14
0
 public function testGetCompanySlug()
 {
     $job = $this->em - createQuery('SELECT j FROM IbwJobeetBundle:Job j')->setMaxResults(1)->getSingleResult();
     $this->assertEquals($job->getCompanySlug(), Jobeet::slugify($job->getCompany()));
 }
Exemplo n.º 15
0
<?php

include "config.php";
#No longer used
//$servername = "localhost";
//$database = "dhp";
#values being implemented
$username = mysqli_real_escape_string($_POST["USERNAME"]);
$password = mysqli_real_escape_string($_POST["PASSWORD"]);
$first = mysqli_real_escape_string($_POST["FIRSTNAME"]);
$last = mysqli_real_escape_string($_POST["LASTNAME"]);
$userType = mysqli_real_escape_string($_POST["USERTYPE"]);
$notes = mysqli_real_escape_string($_POST["NOTES"]);
#Check Connection OUTDATED
/*$conn = mysqli_connect($servername,"root","");
if (!$conn) {
    die("connection error");
}
*/
$sql = "INSERT INTO `users` (`username`,`password`,`first`,`last`,`user_type`,`notes`)\r\n       VALUES ('" . $username . "','" . $password . "','" . $first . "','" . $last . "','" . $userType . "','" . $notes . "')";
//mysqli_select_db($conn,'dhp');
//mysqli_query(  $conn,$sql );
createQuery($sql);
echo json_encode(true);
//mysqli_close($conn);
Exemplo n.º 16
0
 public static function setRoles($uid, $roleId = array())
 {
     execQuery('DELETE FROM cf_user_roles WHERE user_id=:uid', array('uid' => $uid));
     $q = createQuery('INSERT INTO cf_user_roles (user_id,role_id) VALUES(:uid,:rid)');
     $roleId = is_array($roleId) ? $roleId : array($roleId);
     foreach ($roleId as $rid) {
         $q->setParam('uid', $uid);
         $q->setParam('rid', $rid);
         $q->execute();
     }
 }
Exemplo n.º 17
0
 private function exportProducts($rootId)
 {
     $groups = new DescendantGroups($rootId);
     $ids = array();
     foreach ($groups as $group) {
         $ids[] = $group->id();
     }
     if ($rootId) {
         $ids[] = $rootId;
     }
     $q = createQuery("\r\n\t\t\tSELECT product_id, group_id\r\n\t\t\tFROM cf_products_in_groups\r\n\t\t\tINNER JOIN cf_groups ON cf_products_in_groups.group_id = cf_groups.id\r\n\t\t\tWHERE group_id IN (" . implode(',', $ids) . ")\r\n\t\t\tGROUP BY product_id\r\n\t\t\tORDER BY cf_groups.sort_order, cf_products_in_groups.sort_order\r\n\t\t");
     $q->execute();
     while ($q->fetch()) {
         $productId = $q->at('product_id');
         $groupId = $q->at('group_id');
         $product = new Product($productId);
         $inGroups = new ProductGroups($productId);
         $manufacturer = new Manufacturer($product->manufacturerId());
         $this->exportProduct($product, $groupId, $manufacturer);
         $options = new ProductOptions($productId);
         foreach ($options as $option) {
             $this->exportProduct($product, $groupId, $manufacturer, $option);
         }
     }
     $q->close();
 }