Пример #1
1
 public static function getTweetsPostedBy($idUser)
 {
     $connection = new dbconnection();
     $sql = "select * from jabaianb.tweet where emetteur='" . $idUser . "'";
     $res = $connection->doQueryObject($sql, "tweet");
     return $res === false ? false : $res;
 }
Пример #2
0
 public static function getPostbyId($id)
 {
     $connection = new dbconnection();
     $sql = "select * from jabaianb.post where id='" . $id . "'";
     $res = $connection->doQueryObject($sql, "post");
     return $res === false ? false : $res;
 }
Пример #3
0
 public function save()
 {
     $connection = new dbconnection();
     if ($this->id) {
         $sql = "update jabaianb." . get_class($this) . " set ";
         $set = array();
         foreach ($this->data as $att => $value) {
             if ($att != 'id' && $value) {
                 $set[] = "{$att} = '" . $value . "'";
             }
         }
         $sql .= implode(",", $set);
         $sql .= " where id=" . $this->id;
     } else {
         $sql = "insert into jabaianb." . get_class($this) . " ";
         $sql .= "(" . implode(",", array_keys($this->data)) . ") ";
         $sql .= "values ('" . implode("','", array_values($this->data)) . "')";
     }
     $connection->doExec($sql);
     /*
      *  Sans cette modiffication, on recevait une erreur après un UPDATE:
      *      Object not in prerequisite state: 7 ERROR: currval of sequence "post_id_seq" is not yet defined in this session
      */
     if (!$this->id) {
         $this->id = $connection->getLastInsertId("jabaianb." . get_class($this));
     }
     return $this->id == false ? NULL : $this->id;
 }
Пример #4
0
 public static function getLike($id)
 {
     $connection = new dbconnection();
     $sql = "select count(*) from jabaianb.vote where tweet='" . $id . "'";
     $res = $connection->doQuery($sql);
     return $res === false ? false : $res;
 }
 public static function getUsers()
 {
     $connection = new dbconnection();
     $sql = "select * from jabaianb.utilisateur";
     $res = $connection->doQueryObject($sql, "utilisateurTable");
     return $res === false ? false : $res;
 }
Пример #6
0
 public static function getCountLastTweets($startDate)
 {
     $connection = new dbconnection();
     $sql = "SELECT COUNT(*) FROM jabaianb.tweet T\n\t\t            INNER JOIN jabaianb.post P ON (T.post = P.id)\n\t\t        WHERE P.date > '" . $startDate . "'";
     $res = $connection->doQuery($sql);
     if ($res === false) {
         return null;
     }
     return $res[0]["count"];
 }
Пример #7
0
 public static function getCountLikesById($tweetId)
 {
     $connection = new dbconnection();
     $sql = "SELECT COUNT(*) FROM jabaianb.vote WHERE message = " . $tweetId;
     $res = $connection->doQuery($sql);
     if ($res === false) {
         return 0;
     }
     return $res[0]["count"];
 }
 public static function getUsersWhoLikeTweetById($tweetId)
 {
     $connection = new dbconnection();
     $sql = "SELECT U.* FROM jabaianb.utilisateur U\r\n\t\t\t\t\tINNER JOIN jabaianb.vote V ON (U.id = V.utilisateur)\r\n\t\t\t\tWHERE V.message = " . $tweetId;
     $res = $connection->doQueryObject($sql, "utilisateur");
     if ($res === false) {
         return null;
     }
     return $res;
 }
Пример #9
0
function preload_lists()
{
    $db = new dbconnection();
    $db->dbconnect();
    $db->query = "select listid,listname from " . TABLE_LISTS . " where active=1";
    $db->execute();
    $rowcount = $db->rowcount();
    if ($rowcount > 0) {
        for ($x = 0; $x < $rowcount; $x++) {
            $row = $db->fetchrow($x);
            $list[$x] = $row;
        }
    }
    return $list;
}
Пример #10
0
 public static function getColors($pack)
 {
     $sql_colors = dbconnection::queryObject("SELECT * FROM colors WHERE colors_id = '{$pack->colors_id}' LIMIT 1");
     if (!$sql_colors) {
         return new return_package(2, NULL, "The colors you've requested do not exist");
     }
     return new return_package(0, colors::colorsObjectFromSQL($sql_colors));
 }
Пример #11
0
 public function getCategoryHints($q)
 {
     $query = "select categoryid,name from couponcategories where name LIKE '" . htmlspecialchars($q) . "%'" . " limit 1";
     $dbinstance = dbconnection::getinstance();
     $connhandle = $dbinstance->connhandle;
     $result = $connhandle->query($query);
     return $result;
 }
Пример #12
0
 public static function getinstance()
 {
     if (!isset(self::$instance)) {
         self::$instance = new dbconnection();
     } else {
         //echo "singleton construct not called";
     }
     return self::$instance;
 }
Пример #13
0
 public static function removeEditorFromGame($pack)
 {
     $pack->auth->game_id = $pack->game_id;
     $pack->auth->permission = "read_write";
     if (!editors::authenticateGameEditor($pack->auth)) {
         return new return_package(6, NULL, "Failed Authentication");
     }
     //note $pack->user_id is DIFFERENT than $pack->auth->user_id
     dbconnection::query("DELETE FROM user_games WHERE user_id = '{$pack->user_id}' AND game_id = '{$pack->game_id}'");
     games::bumpGameVersion($pack);
     return new return_package(0);
 }
Пример #14
0
 function changepassword($userid, $oldpass, $newpass, $newpassrepeat)
 {
     if ($newpass == $newpassrepeat) {
         $enc = new Encryption();
         $db = new dbconnection();
         $db->dbconnect();
         //check oldpass, update password if ok, send message if not
         $password = $enc->oneway_encode($oldpass);
         $db->query = "select userid from " . TABLE_USERS . " where userid={$userid} and password='******'";
         $db->execute();
         if ($db->rowcount() > 0) {
             $newpass = $enc->oneway_encode($newpass);
             $db->query = "update " . TABLE_USERS . " set password='******' where userid={$userid}";
             $db->execute();
             $msg = 'Password updated.';
         } else {
             $msg = 'Incorrect old password.';
         }
     } else {
         $msg = 'New password does not match.';
     }
     return $msg;
 }
Пример #15
0
 public static function deleteGroup($pack)
 {
     $group = dbconnection::queryObject("SELECT * FROM groups WHERE group_id = '{$pack->group_id}'");
     $pack->auth->game_id = $group->game_id;
     $pack->auth->permission = "read_write";
     if (!editors::authenticateGameEditor($pack->auth)) {
         return new return_package(6, NULL, "Failed Authentication");
     }
     dbconnection::query("DELETE FROM groups WHERE group_id = '{$pack->group_id}' LIMIT 1");
     //cleanup
     dbconnection::query("UPDATE game_user_groups SET group_id = 0 WHERE game_id = '{$group->game_id}' AND group_id = '{$group->group_id}';");
     games::bumpGameVersion($pack);
     return new return_package(0);
 }
Пример #16
0
 public function save()
 {
     $connection = new dbconnection();
     if (isset($this->id)) {
         $sql = "update jabaianb." . get_class($this) . " set ";
         $set = array();
         foreach ($this->data as $att => $value) {
             if ($att != 'id' && $value) {
                 $set[] = "{$att} = '" . $value . "'";
             }
         }
         $sql .= implode(",", $set);
         $sql .= " where id=" . $this->id;
     } else {
         $sql = "insert into jabaianb." . get_class($this) . " ";
         $sql .= "(" . implode(",", array_keys($this->data)) . ") ";
         $sql .= "values ('" . implode("','", array_values($this->data)) . "')";
     }
     //print_r($sql);
     $connection->doExec($sql);
     $id = $connection->getLastInsertId("jabaianb." . get_class($this));
     //print_r($id);
     return $id == false ? NULL : $id;
 }
Пример #17
0
 private static function applyUpgrade($user_id, $maj, $min)
 {
     $file = "db/upgrades/" . $maj . "." . $min . ".sql";
     $upgrade = fopen($file, "r");
     while (!feof($upgrade)) {
         $query = fgets($upgrade);
         if (preg_match("@^\\s*\$@is", $query)) {
             continue;
         }
         //ignore whitespace
         dbconnection::query($query);
     }
     fclose($upgrade);
     dbconnection::queryInsert("INSERT INTO db_upgrades (user_id, version_major, version_minor, timestamp) VALUES ('{$user_id}', '{$maj}', '{$min}', CURRENT_TIMESTAMP)");
 }
Пример #18
0
 public static function deleteOverlay($pack)
 {
     $overlay = dbconnection::queryObject("SELECT * FROM overlays WHERE overlay_id = '{$pack->overlay_id}'");
     $pack->auth->game_id = $overlay->game_id;
     $pack->auth->permission = "read_write";
     if (!editors::authenticateGameEditor($pack->auth)) {
         return new return_package(6, NULL, "Failed Authentication");
     }
     dbconnection::query("DELETE FROM overlays WHERE overlay_id = '{$pack->overlay_id}' LIMIT 1");
     //cleanup
     $reqPack = dbconnection::queryObject("SELECT * FROM requirement_root_packages WHERE requirement_root_package_id = '{$overlay->requirement_root_package_id}'");
     if ($reqPack) {
         $pack->requirement_root_package_id = $reqPack->requirement_root_package_id;
         requirements::deleteRequirementPackage($pack);
     }
     games::bumpGameVersion($pack);
     return new return_package(0);
 }
Пример #19
0
 public static function getConnection()
 {
     if (dbconnection::$dbconnection === NULL) {
         // database access credentials stored in variables
         $host = "localhost";
         $database = "n00143888playground";
         //            $username = "******";
         //            $password = "******";
         $username = "******";
         $password = "";
         $dsn = "mysql:host=" . $host . ";dbname=" . $database;
         dbconnection::$dbconnection = new PDO($dsn, $username, $password);
         if (!dbconnection::$dbconnection) {
             die("Database connection failed");
         }
     }
     return dbconnection::$dbconnection;
 }
Пример #20
0
 public static function getLeaderboard($pack)
 {
     $insts = dbconnection::queryArray("SELECT * FROM instances WHERE game_id = '{$pack->game_id}' AND object_type = 'ITEM' AND object_id = '{$pack->item_id}' AND owner_type = 'USER' ORDER BY qty DESC LIMIT 10;");
     $entries = array();
     for ($i = 0; $i < count($insts); $i++) {
         $inst = $insts[$i];
         $user = dbconnection::queryObject("SELECT * FROM users WHERE user_id = '{$inst->owner_id}';");
         $entries[$i] = new stdClass();
         $entries[$i]->qty = $inst->qty;
         if ($user) {
             $entries[$i]->user_id = $user->user_id;
             $entries[$i]->user_name = $user->user_name;
             $entries[$i]->display_name = $user->display_name;
         } else {
             $entries[$i]->user_id = 0;
             $entries[$i]->user_name = "(user not found)";
             $entries[$i]->display_name = "(user not found)";
         }
     }
     return new return_package(0, $entries);
 }
Пример #21
0
 public static function deleteWebHook($pack)
 {
     $webhook = dbconnection::queryObject("SELECT * FROM web_hooks WHERE web_hook_id = '{$pack->web_hook_id}'");
     $pack->auth->game_id = $webhook->game_id;
     $pack->auth->permission = "read_write";
     if (!editors::authenticateGameEditor($pack->auth)) {
         return new return_package(6, NULL, "Failed Authentication");
     }
     dbconnection::query("DELETE FROM web_hooks WHERE web_hook_id = '{$pack->web_hook_id}' LIMIT 1");
     //cleanup
     $reqPack = dbconnection::queryObject("SELECT * FROM requirement_root_packages WHERE requirement_root_package_id = '{$webhook->requirement_root_package_id}'");
     if ($reqPack) {
         $pack->requirement_root_package_id = $reqPack->requirement_root_package_id;
         requirements::deleteRequirementPackage($pack);
     }
     $reqAtoms = dbconnection::queryArray("SELECT * FROM requirement_atoms WHERE requirement = 'PLAYER_HAS_RECEIVED_INCOMING_WEB_HOOK' AND content_id = '{$pack->web_hook_id}'");
     for ($i = 0; $i < count($reqAtoms); $i++) {
         $pack->requirement_atom_id = $reqAtoms[$i]->requirement_atom_id;
         requirements::deleteRequirementAtom($pack);
     }
     games::bumpGameVersion($pack);
     return new return_package(0);
 }
Пример #22
0
.declaration {font-size:13px;font-weight:bold;margin-top:5px;}
.col2_declarationwaiver {font-size:9px;text-align:justify;}
.col3_forbankonly {font-size:13px;font-weight:bold;margin-top:2px;}
.col3txt_forbank {border:0px;border-bottom:1px solid black;margin-left:5px;}
.col3_mbclient_yes{margin-left:15px;}
.col3_mbclient_no{margin-left:5px;}
.col3txt_branchremarks {border:0px;border-bottom:1px solid black;margin-left:5px;}
				</style>
		<title>Metrobank Application Form</title>
    </head>
<?php 
if (isset($_REQUEST['leadid'])) {
    $leadid = $_REQUEST['leadid'];
    require_once '../../includes/dbase.php';
    require_once '../../includes/settings.php';
    $db = new dbconnection();
    $db->dbconnect();
    $db->query = "select * from " . TABLE_CLIENTS . " a left join " . TABLE_CLIENTINFO . " b on (a.leadid=b.leadid) where a.leadid={$leadid}";
    $db->execute();
    if ($db->rowcount() > 0) {
        $row = $db->fetchrow(0);
    }
}
?>
<body>
    
    <div id="main">
	
        <div class="column1">
            <h3>ALL FIELDS ARE MANDATORY AND MUST BE FILLED UP.</h3><br>
			
Пример #23
0
<?php

require_once '../../includes/dbase.php';
require_once '../../includes/settings.php';
$db = new dbconnection();
$db->dbconnect();
isset($_REQUEST['agent']) ? $agent = $_REQUEST['agent'] : exit;
isset($_REQUEST['leadid']) ? $leadid = $_REQUEST['leadid'] : exit;
$total = count($_FILES['upload']['name']);
// Loop through each file
for ($i = 0; $i < $total; $i++) {
    $tmpFilePath = $_FILES['upload']['tmp_name'][$i];
    if ($tmpFilePath != "") {
        $filename = $leadid . ' - ' . $_FILES["upload"]['name'][$i];
        $newFilePath = "../../uploads/{$filename}";
        //Upload the file into the temp dir
        if (move_uploaded_file($tmpFilePath, $newFilePath)) {
            $db->query = "\n        insert into " . TABLE_FILES . "\n        (leadid,filename,dateuploaded,agent)\n        values\n        ({$leadid},'{$filename}',now(),{$agent})\n        ";
            $db->execute();
            echo 'File <a href="uploads/' . $filename . '" target="_blank">' . $filename . ' uploaded.</a><br>';
        } else {
            echo 'Failed to upload file ' . $filename;
        }
    }
}
Пример #24
0
<?php 
error_reporting(E_ALL);
ini_set('display_errors', 1);
// require_once("dbconnection.php");
// $dbobj = new dbconnection();
// $UID = 6;
// //$res = $dbobj->Select("select * from user");
// $res = $dbobj->SelectColumn("content","comment","UID",1);
// foreach($res as $row)
// 	echo $row."<br>";
require_once "Validation.php";
// deconnection already included in Validation
$vobj = new Validation();
$dbobj = new dbconnection();
echo "sdasd";
// $susersid = $this->dbobj->SelectColumn('uid','user','admin','true');
$arr = array();
$arr['0'] = 1;
$arr['1'] = 2;
$arr['2'] = 3;
echo $arr[0];
print_r($arr);
$uid = 14;
$susersid = $dbobj->SelectColumn('uid', 'user', 'admin', 1);
print_r($susersid);
if ($flag = $vobj->ifSuperUserId(14)) {
    echo "true";
}
if ($flag = $vobj->ifSuperUserId(20)) {
    echo "true<br>";
Пример #25
0
 function catalogclass()
 {
     parent::__construct();
 }
Пример #26
0
 public static function deleteWebPage($pack)
 {
     $webpage = dbconnection::queryObject("SELECT * FROM web_pages WHERE web_page_id = '{$pack->web_page_id}'");
     $pack->auth->game_id = $webpage->game_id;
     $pack->auth->permission = "read_write";
     if (!editors::authenticateGameEditor($pack->auth)) {
         return new return_package(6, NULL, "Failed Authentication");
     }
     dbconnection::query("DELETE FROM web_pages WHERE web_page_id = '{$pack->web_page_id}' LIMIT 1");
     //cleanup
     $options = dbconnection::queryArray("SELECT * FROM dialog_options WHERE link_type = 'EXIT_TO_WEB_PAGE' AND link_id = '{$pack->web_page_id}'");
     for ($i = 0; $i < count($options); $i++) {
         $pack->dialog_option_id = $options[$i]->dialog_option_id;
         dialogs::deleteDialogOption($pack);
     }
     $tabs = dbconnection::queryArray("SELECT * FROM tabs WHERE type = 'WEB_PAGE' AND content_id = '{$pack->web_page_id}'");
     for ($i = 0; $i < count($tabs); $i++) {
         $pack->tab_id = $tabs[$i]->tab_id;
         tabs::deleteTab($pack);
     }
     $tags = dbconnection::queryArray("SELECT * FROM object_tags WHERE object_type = 'WEB_PAGE' AND object_id = '{$pack->web_page_id}'");
     for ($i = 0; $i < count($tags); $i++) {
         $pack->object_tag_id = $tags[$i]->object_tag_id;
         tags::deleteObjectTag($pack);
     }
     $instances = dbconnection::queryArray("SELECT * FROM instances WHERE object_type = 'WEB_PAGE' AND object_id = '{$pack->web_page_id}'");
     for ($i = 0; $i < count($instances); $i++) {
         $pack->instance_id = $instances[$i]->instance_id;
         instances::deleteInstance($pack);
     }
     $factories = dbconnection::queryArray("SELECT * FROM factories WHERE object_type = 'WEB_PAGE' AND object_id = '{$pack->web_page_id}'");
     for ($i = 0; $i < count($factories); $i++) {
         $pack->factory_id = $factories[$i]->factory_id;
         factories::deleteFactory($pack);
     }
     $reqAtoms = dbconnection::queryArray("SELECT * FROM requirement_atoms WHERE requirement = 'PLAYER_VIEWED_WEB_PAGE' AND content_id = '{$pack->web_page_id}'");
     for ($i = 0; $i < count($reqAtoms); $i++) {
         $pack->requirement_atom_id = $reqAtoms[$i]->requirement_atom_id;
         requirements::deleteRequirementAtom($pack);
     }
     games::bumpGameVersion($pack);
     return new return_package(0);
 }
Пример #27
0
<?php

require_once "../include/Validation.php";
session_start();
$dbobj = new dbconnection();
$password = $_POST['password'];
$confirmPassword = $_POST['confirmPassword'];
if ($password == $confirmPassword) {
    $dbobj->Update("update user set password = '******' where uname='" . $_SESSION['username'] . "'");
    header('location: ../layout/index.php');
} else {
    echo "password and confirm don't match";
}
Пример #28
0
 public static function deleteQuest($pack)
 {
     $quest = dbconnection::queryObject("SELECT * FROM quests WHERE quest_id = '{$pack->quest_id}'");
     $pack->auth->game_id = $quest->game_id;
     $pack->auth->permission = "read_write";
     if (!editors::authenticateGameEditor($pack->auth)) {
         return new return_package(6, NULL, "Failed Authentication");
     }
     dbconnection::query("DELETE FROM quests WHERE quest_id = '{$pack->quest_id}' LIMIT 1");
     //cleanup
     $reqAtoms = dbconnection::queryArray("SELECT * FROM requirement_atoms WHERE requirement = 'PLAYER_HAS_COMPLETED_QUEST' AND content_id = '{$pack->quest_id}'");
     for ($i = 0; $i < count($reqAtoms); $i++) {
         $pack->requirement_atom_id = $reqAtoms[$i]->requirement_atom_id;
         requirements::deleteRequirementAtom($pack);
     }
     /* Comment out until we've decided on desired behavior...
        $eventpack = dbconnection::queryObject("SELECT * FROM event_packages WHERE event_package_id = '{$quest->active_event_package_id}'");
        if($eventpack)
        {
            $pack->event_package_id = $eventpack->event_package_id;
            events::deleteEventPackage($pack);
        }
        $eventpack = dbconnection::queryObject("SELECT * FROM event_packages WHERE event_package_id = '{$quest->complete_event_package_id}'");
        if($eventpack)
        {
            $pack->event_package_id = $eventpack->event_package_id;
            events::deleteEventPackage($pack);
        }
        */
     $reqPack = dbconnection::queryObject("SELECT * FROM requirement_root_packages WHERE requirement_root_package_id = '{$quest->active_requirement_root_package_id}'");
     if ($reqPack) {
         $pack->requirement_root_package_id = $reqPack->requirement_root_package_id;
         requirements::deleteRequirementPackage($pack);
     }
     $reqPack = dbconnection::queryObject("SELECT * FROM requirement_root_packages WHERE requirement_root_package_id = '{$quest->complete_requirement_root_package_id}'");
     if ($reqPack) {
         $pack->requirement_root_package_id = $reqPack->requirement_root_package_id;
         requirements::deleteRequirementPackage($pack);
     }
     games::bumpGameVersion($pack);
     return new return_package(0);
 }
Пример #29
0
<?php

error_reporting(E_ALL);
ini_set('display_errors', 1);
require_once "../include/Validation.php";
// deconnection already included in Validation
$dbobj = new dbconnection();
$vobj = new Validation();
$_product = "../../layout/products.php";
session_start();
if (!isset($_SESSION['uid'])) {
    echo "You are not authoriezed to enter this page. You have to login first";
    exit;
}
$uid = $_SESSION['uid'];
if (!$vobj->ifSuperUserId($uid)) {
    echo "You are not authoriezed to enter this page. Only for admins.";
    exit;
}
$pid = $_GET['pid'];
$dbobj->Update("update product set `active`=false where `pid`='{$pid}'");
header("location:" . $_product . "?uid=" . $uid);
Пример #30
0
<?php

require "../include/dbconnection.php";
error_reporting(E_ALL);
$dbobj = new dbconnection();
$oid = isset($_GET['oid']) ? $_GET['oid'] : 0;
//if($oid != -1)
$upd_stm = "update orders set alive=0 where oid='{$oid}';";
$dbobj->Update($upd_stm);
$response = "done";
echo json_encode($response);