Exemple #1
0
function user_register($userName, $userPassword, $checkbox)
{
    $db = new MyDB();
    if (!$db) {
        echo $db->lastErrorMsg();
    } else {
        echo "Opened database successfully</br>";
    }
    $sql = <<<EOF
    SELECT * FROM User WHERE name = '{$userName}';
EOF;
    $ret = $db->query($sql);
    if (!$ret) {
        echo $db->lastErrorMsg();
    } else {
        if ($row = $ret->fetchArray(SQLITE3_ASSOC)) {
            header("Location: http://www.kmoving.com/user/register.php?Error=userExist");
        } else {
            $sql = <<<EOF
            INSERT INTO User (name, password, last, doctor, gender, height, weight, country, city, address)
            VALUES ('{$userName}', '{$userPassword}', '{$userName}', '{$checkbox}', '--', '--', '--', '--', '--', '--');
EOF;
            $ret = $db->exec($sql);
            if (!$ret) {
                echo $db->lastErrorMsg();
            } else {
                $db->close();
                setcookie("username", $userName, null, "/");
                header("Location: http://www.kmoving.com/server/user/user_details.php");
            }
        }
    }
    $db->close();
}
 public static function isIn($username, $id)
 {
     $db = new MyDB();
     $sql = "SELECT * FROM `JOIN` WHERE USERNAME = '******' AND ACTIVITY={$id}";
     $res = $db->query($sql);
     return $res;
 }
Exemple #3
0
function get_user_settings()
{
    $db = new MyDB();
    if (!$db) {
        echo $db->lastErrorMsg();
    } else {
        echo "Opened database successfully</br>";
    }
    $userName = $_COOKIE["username"];
    $sql = <<<EOF
    SELECT * FROM User WHERE name = '{$userName}';
EOF;
    $ret = $db->query($sql);
    if (!$ret) {
        echo $db->lastErrorMsg();
    } else {
        if ($row = $ret->fetchArray(SQLITE3_ASSOC)) {
            $name = $row["name"];
            $gender = $row["gender"];
            $height = $row["height"];
            $weight = $row["weight"];
            $birth = $row["birth"];
            $country = $row["country"];
            $city = $row["city"];
            $address = $row["address"];
            $url = "http://www.kmoving.com/user/info/settings.php?name={$name}&gender={$gender}&height={$height}&weight={$weight}&birth={$birth}&country={$country}&city={$city}&address={$address}";
            header("Location: {$url}");
        }
    }
    $db->close();
}
function add_member($activityId)
{
    $db = new MyDB();
    if (!$db) {
        echo $db->lastErrorMsg();
    } else {
    }
    $userId = get_userId();
    $sql = <<<EOF
    SELECT * FROM ActivityMember WHERE userId={$userId} and activityId={$activityId};
EOF;
    $ret = $db->query($sql);
    if ($row = $ret->fetchArray(SQLITE3_ASSOC)) {
        $db->close();
        header("Location: http://www.kmoving.com/user/groups/activity.php?msg=memberExist");
    } else {
        $data = $_COOKIE['date'];
        $sql = <<<EOF
            INSERT INTO ActivityMember (userId, activityId, createAt)
            VALUES ('{$userId}', '{$activityId}', '{$data}');
EOF;
        $ret = $db->exec($sql);
        if (!$ret) {
            echo $db->lastErrorMsg();
        } else {
            $db->close();
            header("Location: http://www.kmoving.com/user/groups/activity.php");
        }
    }
}
Exemple #5
0
function go_digital_panel()
{
    $db = new MyDB();
    if (!$db) {
        echo $db->lastErrorMsg();
    } else {
        echo "Opened database successfully</br>";
    }
    $userName = $_COOKIE["username"];
    $sql = <<<EOF
    SELECT * FROM User WHERE name = '{$userName}';
EOF;
    $ret = $db->query($sql);
    if (!$ret) {
        echo $db->lastErrorMsg();
    } else {
        if ($row = $ret->fetchArray(SQLITE3_ASSOC)) {
            $name = $row["name"];
            $gender = $row["gender"];
            $height = $row["height"];
            $weight = $row["weight"];
            $date = date("Y-m-d");
            setcookie("date", $date, null, "/");
            $url = "http://www.kmoving.com/home.php?name={$name}&gender={$gender}&height={$height}&weight={$weight}";
            header("Location: {$url}");
        }
    }
    $db->close();
}
Exemple #6
0
function update_meals($title, $calories, $fat, $protein, $calcium, $carbohydrate, $sugar, $cholesterol, $vitamin_c, $vitamin_a)
{
    $db = new MyDB();
    if (!$db) {
        echo $db->lastErrorMsg();
    } else {
    }
    $userName = $_COOKIE['username'];
    $date = $_COOKIE['date'];
    $sql = <<<EOF
    SELECT * FROM User,Meals WHERE User.name='{$userName}' and User.id=Meals.userId and Meals.createAt='{$date}';
EOF;
    $ret = $db->query($sql);
    if (!$ret) {
        echo $db->lastErrorMsg();
    } else {
        if ($row = $ret->fetchArray(SQLITE3_ASSOC)) {
            $userId = $row['userId'];
            $sql = <<<EOF
            UPDATE Meals
            SET title='{$title}',calories='{$calories}',fat='{$fat}',
            protein='{$protein}',calcium='{$calcium}',carbohydrate='{$carbohydrate}',
            vitamin_c='{$vitamin_c}',vitamin_a='{$vitamin_a}'
            where userId={$userId} and createAt={$date};
EOF;
            $ret = $db->exec($sql);
            if (!$ret) {
                echo $db->lastErrorMsg();
            } else {
            }
        } else {
            $userId = get_userId($userName);
            $sql = <<<EOF
            INSERT INTO Meals (userId, title, calories, fat, protein, calcium, carbohydrate, sugar, cholesterol, vitamin_c, vitamin_a, createAt)
            VALUES ('{$userId}', '{$title}', '{$calories}', '{$fat}', '{$protein}', '{$calcium}', '{$carbohydrate}', '{$sugar}', '{$cholesterol}', '{$vitamin_c}', '{$vitamin_a}', '{$date}');
EOF;
            $ret = $db->exec($sql);
            if (!$ret) {
                echo $db->lastErrorMsg();
            } else {
            }
        }
    }
    $db->close();
}
Exemple #7
0
function update_moves($active_time, $inactive_time, $calories, $wo_calories, $bg_calories, $bmr_day, $steps, $km)
{
    $db = new MyDB();
    if (!$db) {
        echo $db->lastErrorMsg();
    } else {
    }
    $userName = $_COOKIE['username'];
    $date = $_COOKIE['date'];
    $sql = <<<EOF
    SELECT * FROM User,Moves WHERE User.name='{$userName}' and User.id=Moves.userId and Moves.createAt='{$date}';
EOF;
    $ret = $db->query($sql);
    if (!$ret) {
        echo $db->lastErrorMsg();
    } else {
        if ($row = $ret->fetchArray(SQLITE3_ASSOC)) {
            $userId = $row['userId'];
            $sql = <<<EOF
            UPDATE Moves
            SET active='{$active_time}',free='{$inactive_time}',
            total_calories='{$calories}',workouts_calories='{$wo_calories}',
            static_calories='{$bg_calories}',daixie='{$bmr_day}',steps='{$steps}',distance='{$km}'
            where userId={$userId} and createAt={$date};
EOF;
            $ret = $db->exec($sql);
            if (!$ret) {
                echo $db->lastErrorMsg();
            } else {
            }
        } else {
            $userId = get_userId($userName);
            $sql = <<<EOF
            INSERT INTO Moves (userId, active, free, total_calories, workouts_calories, static_calories, daixie, steps, distance, createAt)
            VALUES ('{$userId}', '{$active_time}', '{$inactive_time}', '{$calories}', '{$wo_calories}', '{$bg_calories}', '{$bmr_day}', '{$steps}', '{$km}' , '{$date}');
EOF;
            $ret = $db->exec($sql);
            if (!$ret) {
                echo $db->lastErrorMsg();
            } else {
            }
        }
    }
    $db->close();
}
Exemple #8
0
function get_total_len()
{
    $db = new MyDB();
    if (!$db) {
        echo $db->lastErrorMsg();
    } else {
    }
    $sql = <<<EOF
    SELECT count(*) AS length FROM Activity;
EOF;
    $ret = $db->query($sql);
    if ($row = $ret->fetchArray(SQLITE3_ASSOC)) {
        $db->close();
        return $row['length'];
    }
    $db->close();
    return null;
}
Exemple #9
0
function update_sleeps($asleep_time, $awakenings, $awake, $light, $deep, $duration)
{
    $db = new MyDB();
    if (!$db) {
        echo $db->lastErrorMsg();
    } else {
    }
    $userName = $_COOKIE['username'];
    $date = $_COOKIE['date'];
    $sql = <<<EOF
    SELECT * FROM User,Sleeps WHERE User.name='{$userName}' and User.id=Sleeps.userId and Sleeps.createAt='{$date}';
EOF;
    $ret = $db->query($sql);
    if (!$ret) {
        echo $db->lastErrorMsg();
    } else {
        if ($row = $ret->fetchArray(SQLITE3_ASSOC)) {
            $userId = $row['userId'];
            $sql = <<<EOF
            UPDATE Sleeps
            SET asleep='{$asleep_time}',wake_up_time='{$awakenings}',
            sober='{$awake}',light='{$light}',deep='{$deep}',total='{$duration}'
            where userId={$userId} and createAt={$date};
EOF;
            $ret = $db->exec($sql);
            if (!$ret) {
                echo $db->lastErrorMsg();
            } else {
            }
        } else {
            $userId = get_userId($userName);
            $sql = <<<EOF
            INSERT INTO Sleeps (userId, asleep, wake_up_time, sober, light, deep, total, createAt)
            VALUES ('{$userId}', '{$asleep_time}', '{$awakenings}', '{$awake}', '{$light}', '{$deep}', '{$duration}', '{$date}');
EOF;
            $ret = $db->exec($sql);
            if (!$ret) {
                echo $db->lastErrorMsg();
            } else {
            }
        }
    }
    $db->close();
}
Exemple #10
0
function update_workouts($title, $steps, $km, $calories, $time)
{
    $db = new MyDB();
    if (!$db) {
        echo $db->lastErrorMsg();
    } else {
    }
    $userName = $_COOKIE['username'];
    $date = $_COOKIE['date'];
    $sql = <<<EOF
    SELECT * FROM User,Workouts WHERE User.name='{$userName}' and User.id=Workouts.userId and Workouts.createAt='{$date}';
EOF;
    $ret = $db->query($sql);
    if (!$ret) {
        echo $db->lastErrorMsg();
    } else {
        if ($row = $ret->fetchArray(SQLITE3_ASSOC)) {
            $userId = $row['userId'];
            $sql = <<<EOF
            UPDATE Workouts SET title='{$title}',steps='{$steps}',
            distance='{$km}',calories='{$calories}',time='{$time}'
            where userId={$userId} and createAt={$date};
EOF;
            $ret = $db->exec($sql);
            if (!$ret) {
                echo $db->lastErrorMsg();
            } else {
            }
        } else {
            $userId = get_userId($userName);
            $sql = <<<EOF
            INSERT INTO Workouts (userId, title, steps, distance, calories, time, createAt)
            VALUES ('{$userId}', '{$title}', '{$steps}', '{$km}', '{$calories}', '{$time}', '{$date}');
EOF;
            $ret = $db->exec($sql);
            if (!$ret) {
                echo $db->lastErrorMsg();
            } else {
            }
        }
    }
    $db->close();
}
Exemple #11
0
function update_mood($mood_image)
{
    $db = new MyDB();
    if (!$db) {
        echo $db->lastErrorMsg();
    } else {
    }
    $userName = $_COOKIE['username'];
    $date = $_COOKIE['date'];
    $sql = <<<EOF
    SELECT * FROM User,Mood WHERE User.name='{$userName}' and User.id=Mood.userId and Mood.createAt='{$date}';
EOF;
    $ret = $db->query($sql);
    if (!$ret) {
        echo $db->lastErrorMsg();
    } else {
        if ($row = $ret->fetchArray(SQLITE3_ASSOC)) {
            $userId = $row['userId'];
            $sql = <<<EOF
            UPDATE Mood
            SET mood='{$mood_image}'
            where userId={$userId} and createAt={$date};
EOF;
            $ret = $db->exec($sql);
            if (!$ret) {
                echo $db->lastErrorMsg();
            } else {
            }
        } else {
            $userId = get_userId($userName);
            $sql = <<<EOF
            INSERT INTO Mood (userId, mood, createAt)
            VALUES ('{$userId}', '{$mood_image}', '{$date}');
EOF;
            $ret = $db->exec($sql);
            if (!$ret) {
                echo $db->lastErrorMsg();
            } else {
            }
        }
    }
    $db->close();
}
Exemple #12
0
function get_authorId()
{
    $db = new MyDB();
    if (!$db) {
        echo $db->lastErrorMsg();
    } else {
        echo "Opened database successfully</br>";
    }
    $userName = $_COOKIE["username"];
    $sql = <<<EOF
    SELECT * FROM User WHERE name = '{$userName}' and doctor='on';
EOF;
    $ret = $db->query($sql);
    if ($row = $ret->fetchArray(SQLITE3_ASSOC)) {
        $authorId = $row['id'];
        $db->close();
        return $authorId;
    }
    $db->close();
}
Exemple #13
0
function is_Author($delete_ID)
{
    $db = new MyDB();
    if (!$db) {
        echo $db->lastErrorMsg();
    } else {
    }
    $userName = $_COOKIE["username"];
    $sql = <<<EOF
      SELECT * from Activity,User where User.id=Activity.authorId and User.name='{$userName}' and Activity.id={$delete_ID};
EOF;
    $ret = $db->query($sql);
    if ($row = $ret->fetchArray(SQLITE3_ASSOC)) {
        $db->close();
        return true;
    } else {
        $db->close();
        return false;
    }
}
Exemple #14
0
 /**
  * get short url from db
  *
  * @param unknown_type $url
  * @return unknown
  */
 public function dbGetUrl($url)
 {
     $this->debug(sprintf('GETTING: %s FROM DB', $url));
     require_once dirname(__FILE__) . '/MyDb.php';
     $dbh = new MyDB();
     $sql = "SELECT `short_url` FROM `short_urls` WHERE `long_url` = '%s' LIMIT 1 ";
     $select_sql = sprintf($sql, $url);
     $result = $dbh->query($select_sql);
     $data = $result->fetch();
     return $data['short_url'];
 }
Exemple #15
0
<?php

include "database/MyDB.php";
if (!isset($_POST['submit'])) {
    exit('非法访问!');
}
$id = $_POST['del_id'];
//auth access info
$appauthname = $_POST['appauthname'];
$appauthpwd = $_POST['appauthpwd'];
if ($appauthname != "yarlung") {
    die("授权帐号出错! <br/>");
}
if ($appauthpwd != "yarlung01") {
    die("授权密码不正确! <br/>");
}
if (empty($id)) {
    die("没有选中要删除的应用!<br/>");
}
$dblink = new MyDB();
foreach ($id as $ide) {
    echo "删除UID为 " . $ide . " 的应用!<br/>";
    $qry = "DELETE FROM appinfo WHERE uid ={$ide}";
    $dblink->query($qry);
}
$dblink->close();
    }
    $v = "'" . $value . "'";
    $str_versions .= $v;
    $count++;
}
$where = " where version in ({$str_versions}) ";
//起止日期
if (isset($_GET['date_start'])) {
    $where .= "and analysisdate >= '{$_GET['date_start']}' ";
}
if (isset($_GET['date_end'])) {
    $where .= "and analysisdate <= '{$_GET['date_end']}' ";
}
$db = new MyDB();
$sql = "select analysisdate,version,{$col} from danalysis {$where} order by analysisdate asc";
$res = $db->query($sql);
//对结果集进行处理,将同一天的数据封装在一条记录中
//记录格式如下:{"2013-04-12":{v1:xx,v2:xx,v3:xx}}
$temp = array();
$yesterday = null;
while ($result = $db->fetch_row($res)) {
    $thisday = $result[0];
    //每处理完一天的记录,作为一行数据放到数组中
    if ($yesterday != null && $thisday != $yesterday) {
        $temp[$yesterday] = $row;
    }
    $row[$result[1]] = $result[2];
    $yesterday = $thisday;
}
$temp[$yesterday] = $row;
$firstRow = array();
Exemple #17
0
<?php

/**
 * Created by PhpStorm.
 * User: Gennadiy
 * Date: 07.12.2015
 * Time: 13:06
 */
namespace ajax;

class MyDB extends SQLite3
{
    function __construct()
    {
        $this->open('squro.db');
    }
}
$db = new MyDB();
$db->exec('DROP TABLE IF EXISTS `foo`;');
$db->exec('CREATE TABLE foo (bar STRING)');
$db->exec("INSERT INTO foo (bar) VALUES ('kkkkkkkkkkkkkkkk')");
$result = $db->query('SELECT bar FROM foo');
echo $result->fetchArray()[0];
}
$res = $booksdb->query("\n\t\t\tSELECT\n\t\t\t\tZASSETID,\n\t\t\t\tZTITLE AS Title,\n\t\t\t\tZAUTHOR AS Author\n\t\t\tFROM ZBKLIBRARYASSET\n\t\t\tWHERE ZTITLE IS NOT NULL");
while ($row = $res->fetchArray(SQLITE3_ASSOC)) {
    $books[$row['ZASSETID']] = $row;
}
$booksdb->close();
if (count($books) == 0) {
    die("No books found in your library. Have you added any to iBooks?\n");
}
// Retrieve the notes.
$notesdb = new MyDB(NOTES_DATABASE_FILE);
if (!$notesdb) {
    echo $notesdb->lastErrorMsg();
}
$notes = array();
$res = $notesdb->query("\n\t\t\tSELECT\n\t\t\t\tZANNOTATIONREPRESENTATIVETEXT as BroaderText,\n\t\t\t\tZANNOTATIONSELECTEDTEXT as SelectedText,\n\t\t\t\tZANNOTATIONNOTE as Note,\n\t\t\t\tZFUTUREPROOFING5 as Chapter,\n\t\t\t\tZANNOTATIONCREATIONDATE as Created,\n\t\t\t\tZANNOTATIONMODIFICATIONDATE as Modified,\n\t\t\t\tZANNOTATIONASSETID\n\t\t\tFROM ZAEANNOTATION\n\t\t\tWHERE ZANNOTATIONSELECTEDTEXT IS NOT NULL\n\t\t\tORDER BY ZANNOTATIONASSETID ASC,Created ASC");
while ($row = $res->fetchArray(SQLITE3_ASSOC)) {
    $notes[$row['ZANNOTATIONASSETID']][] = $row;
}
$notesdb->close();
if (count($notes) == 0) {
    die("No notes found in your library. Have you added any to iBooks?\n\nIf you did on other devices than this Mac, make sure to enable iBooks notes/bookmarks syncing on all devices.");
}
// Create a new directory and cd into it
mkdir(RESULT_DIRECTORY_NAME);
chdir(RESULT_DIRECTORY_NAME);
$i = 0;
$j = 0;
$b = 0;
foreach ($notes as $AssetID => $booknotes) {
    $Body = '<?xml version="1.0" encoding="UTF-8"?>
         }
         //will save all artist IDs in DB for caching
         $db->exec('insert into artist ("Artist_name","Artist_spotify_id") values (' . "'" . SQLite3::escapeString($artist_name) . "','" . $artist_spotify_id_tmp . "')");
     }
 }
 //HERE I MUST HAVE ARTIST ID. EITHER FROM DATABASE OR SPOTIFY
 // NOW DO THE SAME PROCESS FOR ARTIST ALBUMS.
 //you dont  need it here. You must have artist spotify ID here from upper portion of source code block.
 //$artist_id = $db->querySingle("select Artist_spotify_id from artist where Artist_name='" . SQLite3::escapeString($artist) . "'");
 if ($artist_spotify_id) {
     //changed to artist spotify ID we found in upper code block.
     $artist_albums = new stdClass();
     //What is STD class? It's a class without a methods. You can give him yours.
     $artist_albums->items = array();
     //Creating dictionary.
     $artist_albums_result = $db->query("select * from album where Artist_Spotify_id='" . SQLite3::escapeString($artist_spotify_id) . "'");
     //Getting album dictionary using spotify id.
     while ($album = $artist_albums_result->fetchArray()) {
         //Loop in this array to check if album in database.
         //here you have database fetched artist albums. saved during last run. use it
         $item = new stdClass();
         //Declaring item class.
         $item->name = $album['Album_name'];
         //Creating dictionary.
         $item->id = $album['Album_id'];
         $artist_albums->items[] = $item;
         //Seting dictionary inside to database.
     }
     if (count($artist_albums->items) == 0) {
         // search spotify for artist albums only if database does not contain any albums.
         $artist_albums = $api->getArtistAlbums($artist_spotify_id);
Exemple #20
0
<?php

class MyDB extends SQLite3
{
    function __construct()
    {
        $this->open('../../fitdayDB.db');
    }
}
$db = new MyDB();
if (!$db) {
    echo $db->lastErrorMsg();
}
$id = $_POST['userid'];
$password = $_POST['password'];
$checksql = "Select * from user where userid = '{$id}'";
$result = $db->query($checksql);
if ($row = $result->fetchArray(SQLITE3_ASSOC)) {
    if ($row['password'] != $password) {
        echo "密码错误";
    } else {
        session_start();
        // store session data
        $_SESSION['users'] = $id;
        echo true;
    }
} else {
    echo "该用户不存在";
}
$db->close();
class MyDB extends SQLite3
{
    function __construct()
    {
        $this->open('measurements.db');
    }
}
header('Content-Type: text/csv; charset=utf-8');
$type = $_GET["type"];
$offset = $_GET["offset"];
$filename = "/tmp/" . $type . "_" . $offset . ".csv";
$filename = str_replace('-', '', $filename);
$filename = str_replace(' ', '', $filename);
// create a file pointer connected to the output stream
$output = fopen('php://output', 'w');
if (file_exists($filename) && filemtime($filename) > time() - 60 * 5) {
    // Our cache is fresh, return file
    fwrite($output, file_get_contents($filename));
} else {
    $db = new MyDB();
    $query = "SELECT * FROM measurements WHERE date > '" . date("Y-m-d H:i:s", strtotime($offset, time())) . "'";
    $result = $db->query($query);
    // Create new file
    $file = fopen($filename, 'w');
    while ($row = $result->fetchArray(SQLITE3_ASSOC)) {
        fwrite($file, $row["date"] . ";" . $row[$type] . "\n");
    }
    fclose($file);
    // Update cached file
    fwrite($output, file_get_contents($filename));
}
Exemple #22
0
class MyDB extends SQLite3
{
    function __construct()
    {
        $this->open('/var/www/db/smarthome.sqlite3');
        $this->busyTimeout(3000);
        // set timeout to 3000ms
    }
}
$db = new MyDB();
//$db->exec('CREATE TABLE foo (bar STRING)');
//$db->exec("INSERT INTO foo (bar) VALUES ('This is a test')");
//$result = $db->query('SELECT bar FROM foo');
//var_dump($result->fetchArray());
$query = "select * from tabDataToNode order by fldNodeID";
$results = $db->query($query);
echo "<b>DataToNode</b><br>";
echo "<table border='1'>";
echo "<tr><td>NodeID</td><td>DispOrder</td><td>Channel</td><td>RFPower</td><td>MaxRetry</td><td>A.Len</td><td>A1</td><td>A2</td><td>A3</td><td>A4</td><td>A5</td><td>D.Len</td><td>D1</td><td>D2</td><td>D3</td><td>D4</td><td>D5</td><td>D6</td><td>D7</td><td>D8</td><td>D9</td><td>D10</td><td>LastResult</td><td>Updated By</td><td>Updated On</td><td>Remarks</td></tr>";
while ($row = $results->fetchArray()) {
    //var_dump($row);
    //echo( $row[0] );
    //echo( "<br>");
    printf("<tr><td>%d</td><td>%d</td><td>%d</td><td>%d</td><td>%d</td><td>%d</td><td>%d</td><td>%d</td><td>%d</td><td>%d</td><td>%d</td><td>%d</td><td>%d</td><td>%d</td><td>%d</td><td>%d</td><td>%d</td><td>%d</td><td>%d</td><td>%d</td><td>%d</td><td>%d</td><td>%d</td><td>%s</td><td>%s</td><td>%s</td></tr>", $row["fldNodeID"], $row["fldDisplayOrder"], $row["fldRFChannel"], $row["fldRFPower"], $row["fldMaxRetry"], $row["fldAddrLength"], $row["fldAddr1"], $row["fldAddr2"], $row["fldAddr3"], $row["fldAddr4"], $row["fldAddr5"], $row["fldDataLength"], $row["fldData1"], $row["fldData2"], $row["fldData3"], $row["fldData4"], $row["fldData5"], $row["fldData6"], $row["fldData7"], $row["fldData8"], $row["fldData9"], $row["fldData10"], $row["fldLastSentResult"], $row["fldUpdatedBy"], $row["fldUpdatedOn"], $row["fldNodeRemarks"]);
}
echo "</table><br>";
echo "<table><tr><td>";
$query = "select * from tabDataRecved order by fldID desc limit 40";
$results = $db->query($query);
echo "<b>DataRecved</b><br>";
echo "<table border='1'>";
 function GetSearchCardName($message)
 {
     $attribute = array("0" => "", "1" => "Earth", "2" => "Water", "4" => "Fire", "8" => "Wind", "16" => "Light", "32" => "Dark", "64" => "Divine");
     $race = array("1" => "Warrior", "2" => "Spellcaster", "4" => "Fairy", "16" => "Zombie", "8" => "Unterweltler", "32" => "Maschine", "64" => "Aqua", "128" => "Pyro", "256" => "Rock", "512" => "Winged Beast", "1024" => "Plant", "2048" => "Insect", "4096" => "Thunder", "8192" => "Dragon", "16384" => "Beast", "32768" => "Beast-Warrior", "65536" => "Dinosaur", "131072" => "Fish", "262144" => "Sea Searpent", "524288" => "Reptile", "1048576" => "Psychic", "2097152" => "flying Beast");
     $message = substr($message, 1);
     $db = new MyDB();
     $abfrage = "\n                  SELECT\n                    texts.id, name, desc, datas.type, datas.attribute, datas.race, datas.level, datas.atk, datas.def\n                  FROM\n                    texts\n                  LEFT JOIN\n                    datas\n                  ON\n                    texts.id = datas.id\n                  WHERE\n                    texts.name LIKE '%{$message}%'\n                  LIMIT\n                    1\n                ";
     $ergebnis = $db->query($abfrage) or die("Error in query: <span style='color:red;'>{$abfrage}</span>");
     // Counter fuer array setzen
     $result = '';
     while ($row = $ergebnis->fetchArray()) {
         //$result .= $row['id'];
         //$result  .= utf8_decode($row['name']);
         $result .= 'attr: ' . $attribute[$row['attribute']] . '  |  ';
         $result .= 'race: ' . $race[$row['race']] . '  |  ';
         $result .= 'level: ' . $row['level'] . '  |  ';
         $result .= 'atk' . $row['atk'] . '  |  ';
         $result .= 'def: ' . $row['def'];
     }
     $db->close();
     // $res = implode($result);
     return $result;
 }
Exemple #24
0

<?php 
class MyDB extends SQLite3
{
    function __construct()
    {
        $this->open('db/images.db');
    }
}
$db = new MyDB();
if (!$db) {
    echo $db->lastErrorMsg();
}
$tags = $db->query("SELECT DISTINCT tag FROM images");
echo "<div class='small-10 small-centered columns'>";
while ($tag = $tags->fetchArray()) {
    error_log('loop');
    echo "<a href='#/' id='tagButton{$tag['0']}' style='margin-left:10px; margin-left:10px;' onClick='toggleTagButton(\"{$tag['0']}\", this);' class='button round secondary'>{$tag['0']}</a>";
}
echo "</div>";
Exemple #25
0
<?php

define('AJAX_REQUEST', isset($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest');
if (!AJAX_REQUEST) {
    die;
}
class MyDB extends SQLite3
{
    function __construct()
    {
        $this->open('physique.db');
    }
}
$db = new MyDB();
if (!$db) {
    echo $db->lastErrorMsg();
}
$query = $db->query('select number from booth');
$result = array();
while ($row = $query->fetchArray(SQLITE3_ASSOC)) {
    $result[] = $row['number'];
}
echo json_encode($result);
$db->close();
Exemple #26
0
<div id="container">
<div id="header"><h1><a href="../index.html">Discovery</a></h1></div>
  <div id="wrapper">
    <div id="content">
<?php 
//get the q parameter from URL
$q = $_GET["COMPANY_ID"];
include 'db_connect.php';
$db = new MyDB();
if (!$db) {
    echo $db->lastErrorMsg();
} else {
    //echo "Opened database successfully". "\n";
}
$sql = "SELECT m.COMPANY_NAME from COMPANY_MASTER as m where m.COMPANY_ID=" . $q;
$result = $db->query($sql);
while ($row = $result->fetchArray(SQLITE3_ASSOC)) {
    echo "<p><strong> Company Name : " . $row['COMPANY_NAME'] . "</strong></p>" . "\n";
}
$sql = "SELECT * from EQM_BALANCE_SHEET_DATA as ebsd where ebsd.COMPANY_ID=" . $q;
$result = $db->query($sql);
echo "<p><strong>Balance Sheet Data</strong></p>" . "\n";
echo "<table><tr><th></th><th>No. of Months</th><th>12</th><th>12</th><th>12</th><th>12</th><th>12</th></tr>" . "\n";
echo "<tr><th>Balance Sheet Data</th><th>Year Ending</th><th>Mar-10</th><th>Mar-11</th><th>Mar-12</th><th>Mar-13</th><th>Mar-14</th></tr>" . "\n";
$row1 = $result->fetchArray(SQLITE3_ASSOC);
$row2 = $result->fetchArray(SQLITE3_ASSOC);
$row3 = $result->fetchArray(SQLITE3_ASSOC);
$row4 = $result->fetchArray(SQLITE3_ASSOC);
$row5 = $result->fetchArray(SQLITE3_ASSOC);
echo "<tr><td>Current assets</td><td>Rs m</td><td>" . $row1['CURRENT_ASSETS'] . "</td><td>" . $row2['CURRENT_ASSETS'] . "</td><td>" . $row3['CURRENT_ASSETS'] . "</td><td>" . $row4['CURRENT_ASSETS'] . "</td><td>" . $row5['CURRENT_ASSETS'] . "</td></tr>" . "\n";
echo "<tr><td>Current liabilities</td><td>Rs m</td><td>" . $row1['CURRENT_LIABILITIES'] . "</td><td>" . $row2['CURRENT_LIABILITIES'] . "</td><td>" . $row3['CURRENT_LIABILITIES'] . "</td><td>" . $row4['CURRENT_LIABILITIES'] . "</td><td>" . $row5['CURRENT_LIABILITIES'] . "</td></tr>" . "\n";
Exemple #27
0
<?php

require_once "../classes/sqlite.php";
$db = new MyDB("../Countries.db");
$array = array();
$result = $db->query("select country_code,country from CountryRedirect") or die('Select Query failed 1');
while (list($iso3, $country) = $result->fetchArray()) {
    if (array_key_exists($iso3, $array)) {
        $array[$iso3][] = $country;
    } else {
        $array[$iso3] = array($country);
    }
}
echo json_encode($array);
Exemple #28
0
<?php

header("Content-type:text/html; Charset=utf-8");
class MyDB extends SQLite3
{
    function __construct()
    {
        $this->open('data.db');
    }
}
$db = new MyDB();
$sql = <<<EOF
\t\tSELECT * FROM MSG;
EOF;
$ret = $db->query($sql);
while ($row = $ret->fetchArray(SQLITE3_ASSOC)) {
    echo "ID = " . $row['ID'] . "\n<br />";
    echo "TEXT = " . $row['TEXT'] . "\n<br />";
    echo "TOP = " . $row['TOP'] . "\n<br />";
    echo "LEFT =  " . $row['LEFT'] . "\n<br /><br />";
}
echo "Operation done successfully\n";
$db->close();
Exemple #29
0
<?php

class MyDB extends SQLite3
{
    function __construct()
    {
        $this->open('/var/www/powerlog.db');
    }
}
$dbname = new MyDB();
$query = "select * FROM powers ORDER BY timestamp DESC LIMIT 1";
echo "<p>POWER NOW: </p>";
$result = $dbname->query($query);
while ($row = $result->fetchArray()) {
    print "<h1>" . $row["power"] . "W" . "</h1>";
}
Exemple #30
0
<?php

require_once "../classes/sqlite.php";
$db = new MyDB("../Countries.db");
$c = SQLite3::escapeString($_GET['country']);
$result = $db->query("select latitude,longitude from Countries\n\t\t\t\t\t\t\tjoin CountryRedirect on (CountryRedirect.country_code = Countries.country_code)\n\t\t\t\t\t\t\twhere country = '{$c}' limit 1") or die('Query failed 1');
while (list($lat, $lon) = $result->fetchArray()) {
    $arr = array('lat' => $lat, 'lon' => $lon);
}
echo json_encode($arr);