예제 #1
0
 function load($file)
 {
     try {
         execSQL($file, $this->db, PRE);
     } catch (PDOException $e) {
         throw new Exception($e->getMessage() . '<pre>' . $e . '</pre>');
     }
 }
예제 #2
0
function chgPwdphpBBuser($nick, $pwd)
{
    $cryptpass = phpbb_hash($pwd);
    $sql = "UPDATE `" . $_SESSION['Application_host'] . "`.`forum_users` ";
    $sql .= "SET `user_password` = '" . $cryptpass . "' ";
    $sql .= "WHERE `username` = '" . $nick . "'";
    echo "<!--" . $sql . "-->";
    $req = execSQL($sql, "function", __FILE__, __FUNCTION__);
}
예제 #3
0
function getVersionForModule($dbh, $name)
{
    $stmt = execSQL($dbh, "SELECT version FROM updates WHERE modulename='{$name}'");
    $row = $stmt->fetch();
    if ($row) {
        return $row["version"];
    } else {
        return 0;
    }
}
예제 #4
0
function runMatching($contacts)
{
    // Read data from jva_contacts table and store it in a object
    $jva_data = array();
    $jvaQuery = "SELECT * FROM jva_contacts";
    $DBResource = getDBConnection();
    $jva_resultSet = $resultSet = execSQL($DBResource, $jvaQuery);
    if (mysqli_num_rows($jva_resultSet) > 0) {
        while ($jva_r = mysqli_fetch_row($jva_resultSet)) {
            $jva_row = new TempContact();
            $jva_row->jva_id = $jva_r[0];
            $jva_row->jva_first_name = $jva_r[1];
            $jva_row->jva_middle_name = $jva_r[2];
            $jva_row->jva_last_name = $jva_r[3];
            $jva_row->jva_salutation = $jva_r[4];
            $jva_row->jva_phone_no = $jva_r[5];
            $jva_row->jva_fax_no = $jva_r[6];
            $jva_row->jva_country = $jva_r[7];
            $jva_row->jva_zipcode = $jva_r[8];
            $jva_row->jva_email = $jva_r[9];
            array_push($jva_data, $jva_row);
        }
        closeDBConnection($DBResource);
        // To compare each record in jva_contacts with all records in the file
        foreach ($jva_data as $jva_row) {
            foreach ($contacts as $contacts_row) {
                $c_last = $contacts_row->con_last_name;
                $j_last = $jva_row->jva_last_name;
                $DBResource = getDBConnection();
                if ($jva_row->jva_last_name == $contacts_row->con_last_name && $jva_row->jva_country == $contacts_row->con_country && $jva_row->jva_email == $contacts_row->con_email) {
                    $nQuery = "INSERT INTO notifications(src_id,src_con_id,jva_id,match_case,pending_notification) values('" . $contacts_row->src_id . "','" . $contacts_row->src_con_id . "'," . $jva_row->jva_id . ",'Perfect',1)";
                    $resultSet = execSQL($DBResource, $nQuery);
                } else {
                    if ($jva_row->jva_country == $contacts_row->con_country && $jva_row->jva_email == $contacts_row->con_email) {
                        if (strpos($j_last, $c_last) !== FALSE || strpos($c_last, $j_last) !== FALSE) {
                            $nQuery = "INSERT INTO notifications(src_id,src_con_id,jva_id,match_case,pending_notification) values('" . $contacts_row->src_id . "','" . $contacts_row->src_con_id . "'," . $jva_row->jva_id . ",'Partial',1)";
                            $resultSet = execSQL($DBResource, $nQuery);
                        }
                    } else {
                        $nQuery = "INSERT INTO notifications(src_id,src_con_id,jva_id,match_case,pending_notification) values('" . $contacts_row->src_id . "','" . $contacts_row->src_con_id . "',0,'New',1)";
                        $resultSet = execSQL($DBResource, $nQuery);
                    }
                }
                closeDBConnection($DBResource);
            }
            // end of inner for each loop
        }
        // end of outer for each loop
    } else {
        foreach ($contacts as $contacts_row) {
            $nQuery = "INSERT INTO notifications(src_id,src_con_id,jva_id,match_case,pending_notification) values('" . $contacts_row->src_id . "','" . $contacts_row->src_con_id . "',0,'New',1)";
            execSQL($DBResource, $nQuery);
        }
    }
}
예제 #5
0
 function db_page_delete($page_id)
 {
     $param_arr = _init_db_params();
     LOG_MSG('INFO', "db_page_delete(): START { page_id=[{$page_id}]");
     // For the where clause
     $where_clause = " WHERE page_id=? AND shop_id=" . SHOP_ID;
     $param_arr = _db_prepare_param($param_arr, "i", "page_id", $page_id, true);
     $resp = execSQL("DELETE FROM  \n\t\t\t\t\t\t\ttPage" . $where_clause, $param_arr['params'], true);
     LOG_MSG('INFO', "db_page_delete(): END");
     return $resp;
 }
예제 #6
0
파일: header.php 프로젝트: jaflo/hackme
function getUser($username)
{
    $result = execSQL("SELECT * FROM users WHERE username='******'");
    $user = array("id" => 0, "username" => "", "about" => "", "profileimage" => "");
    if ($result->num_rows > 0) {
        while ($row = $result->fetch_assoc()) {
            $user = array("id" => $row["id"], "username" => $row["username"], "about" => $row["about"], "profileimage" => $row["profileimage"]);
        }
    }
    return $user;
}
예제 #7
0
파일: db.php 프로젝트: teju/Android
function db_room_select($room_id = "", $room_name = "")
{
    LOG_MSG('INFO', "db_wallet_select: START { \n\t\t\t\t\t\t\troom_id=[{$room_id}],\n\t\t\t\t\t\t\troom_name=[{$room_name}] \n}");
    $param_arr = _init_db_params();
    $where_clause = "WHERE room_name={$room_name} AND room_id = {$room_id}";
    $param_arr['params'] = array();
    LOG_MSG('INFO', "db_room_select(): WHERE CLAUSE = [{$where_clause}]");
    $resp = execSQL("SELECT \n\t\t\t\t\t\troom_name,\n\t\t\t\t\t\troom_id,\n\t\t\t\t\t\tis_booked\n\t\t\t\t\tFROM \n\t\t\t\t\t\tbookrooms\n\t\t\t\t\t" . $where_clause, $param_arr['params'], false);
    LOG_MSG('INFO', "db_room_select(): END");
    return $resp;
}
예제 #8
0
파일: db.php 프로젝트: teju/Android
function db_do_login($email_id, $password)
{
    LOG_MSG('INFO', "db_do_login(): START {\n\t\t\t\t\t\t\t\t\t\temail_id=[{$email_id}],\n\t\t\t\t\t\t\t\t\t\tpassword=[{$password}]\n}");
    $param_arr = _init_db_params();
    $param_arr = _db_prepare_param($param_arr, "s", "email_id", $email_id, true);
    $param_arr = _db_prepare_param($param_arr, "s", "password", $password, true);
    // Create Query
    $resp = execSQL("SELECT \n\t\t\t\t\t\tu.user_id,\n\t\t\t\t\t\tu.name,\n\t\t\t\t\t\tu.email_id,\n\t\t\t\t\t\tu.password,\n\t\t\t\t\t\tu.phone_no,\n\t\t\t\t\t\tu.address,\n\t\t\t\t\t\tu.type,\n\t\t\t\t\t\tu.is_active,\n\t\t\t\t\t\tu.created_dt,\n\t\t\t\t\t\ts.supervisor_id,\n\t\t\t\t\t\tt.travel_id,\n\t\t\t\t\t\tt.name travel_name,\n\t\t\t\t\t\tt.domain\n\t\t\t\t\tFROM\n\t\t\t\t\t\ttUser u\n\t\t\t\t\t\tLEFT OUTER JOIN tSupervisor s ON(s.user_id=u.user_id)\n\t\t\t\t\t\tLEFT OUTER JOIN tTravel t ON(u.travel_id=t.travel_id)\n\t\t\t\t\tWHERE \n\t\t\t\t\t\tu.email_id=? \n\t\t\t\t\t\tAND u.password=? AND\n\t\t\t\t\t\tt.travel_id=" . TRAVEL_ID, $param_arr['params'], false);
    LOG_MSG('INFO', "db_do_login(): END");
    return $resp;
}
예제 #9
0
function login()
{
    if (empty($_POST['username'])) {
        echo "Username is empty";
        return false;
    }
    if (empty($_POST['password'])) {
        echo "Password is empty";
        return false;
    }
    $username = trim($_POST['username']);
    $password = trim($_POST['password']);
    $conn = getDBConnection();
    $query = "select password from login_details where username = '******'";
    $res = execSQL($conn, $query);
    while ($row = $res->fetch_assoc()) {
        $pwdhash = $row['password'];
    }
    return password_verify($password, $pwdhash);
}
예제 #10
0
파일: db.php 프로젝트: teju/Android
function get_unique_field($table)
{
    LOG_MSG("INFO", "####### GETTING UNIQUE KEY COLUMN NAME : for " . DB_NAME . $table);
    $row = execSQL("\n\t\t\t\tSELECT \n\t\t\t\t\tcolumn_name\n\t\t\t\tFROM \n\t\t\t\t\tinformation_schema.COLUMNS\n\t\t\t\tWHERE \n\t\t\t\t\ttable_name = '" . $table . "' AND\n\t\t\t\t\ttable_schema = '" . DB_NAME . "' AND\n\t\t\t\t\tcolumn_key='UNI';", array(), false);
    // If no unique key was found above
    if (!isset($row[0]['column_name'])) {
        LOG_MSG("INFO", "####### GETTING PRIMARY KEY COLUMN NAME : for " . DB_NAME . $table);
        $row = execSQL("\n\t\t\t\tSELECT \n\t\t\t\t\tcolumn_name\n\t\t\t\tFROM \n\t\t\t\t\tinformation_schema.COLUMNS\n\t\t\t\tWHERE \n\t\t\t\t\ttable_name = '" . $table . "' AND\n\t\t\t\t\ttable_schema = '" . DB_NAME . "' AND\n\t\t\t\t\tcolumn_key='PRI';", array(), false);
    }
    return $row[0]['column_name'];
}
예제 #11
0
/**
 * splitExec
 */
function execSplit()
{
    $EXEC_SQL = <<<SQL

DROP TABLE IF EXISTS iidxsd_origin cascade;
CREATE TABLE iidxsd_origin as (
SELECT no,msc,(CASE WHEN ver < 50 THEN ver ELSE (ver - 50) END) as ver_no,(CASE WHEN ver < 50 THEN 1 ELSE 2 END) as ver_type,bpm,bpmn,bpmx,(CASE WHEN bpmd = '' OR bpmd IS NULL THEN '\\N' ELSE bpmd END) as bpmd,artist,genre,spn as dif, n7 as notes,japan,abs(11) as dif_type FROM temp 
UNION
SELECT no,msc,(CASE WHEN ver < 50 THEN ver ELSE (ver - 50) END) as ver_no,(CASE WHEN ver < 50 THEN 1 ELSE 2 END) as ver_type,bpm,bpmn,bpmx,(CASE WHEN bpmd = '' OR bpmd IS NULL THEN '\\N' ELSE bpmd END) as bpmd,artist,genre,dpn as dif, n14 as notes,japan,abs(21) as dif_type FROM temp 
UNION
SELECT no,msc,(CASE WHEN ver < 50 THEN ver ELSE (ver - 50) END) as ver_no,(CASE WHEN ver < 50 THEN 1 ELSE 2 END) as ver_type,bpm,bpmn,bpmx,(CASE WHEN bpmd = '' OR bpmd IS NULL THEN '\\N' ELSE bpmd END) as bpmd,artist,genre,sph as dif, h7 as notes,japan,abs(12) as dif_type FROM temp 
UNION
SELECT no,msc,(CASE WHEN ver < 50 THEN ver ELSE (ver - 50) END) as ver_no,(CASE WHEN ver < 50 THEN 1 ELSE 2 END) as ver_type,bpm,bpmn,bpmx,(CASE WHEN bpmd = '' OR bpmd IS NULL THEN '\\N' ELSE bpmd END) as bpmd,artist,genre,dph as dif, h14 as notes,japan,abs(22) as dif_type FROM temp 
UNION
SELECT no,msc,(CASE WHEN ver < 50 THEN ver ELSE (ver - 50) END) as ver_no,(CASE WHEN ver < 50 THEN 1 ELSE 2 END) as ver_type,bpm,bpmn,bpmx,(CASE WHEN bpmd = '' OR bpmd IS NULL THEN '\\N' ELSE bpmd END) as bpmd,artist,genre,spa as dif, a7 as notes,japan,abs(13) as dif_type FROM temp 
UNION
SELECT no,msc,(CASE WHEN ver < 50 THEN ver ELSE (ver - 50) END) as ver_no,(CASE WHEN ver < 50 THEN 1 ELSE 2 END) as ver_type,bpm,bpmn,bpmx,(CASE WHEN bpmd = '' OR bpmd IS NULL THEN '\\N' ELSE bpmd END) as bpmd,artist,genre,dpa as dif, a14 as notes,japan,abs(23) as dif_type FROM temp 
UNION
SELECT no,msc,(CASE WHEN ver < 50 THEN ver ELSE (ver - 50) END) as ver_no,(CASE WHEN ver < 50 THEN 1 ELSE 2 END) as ver_type,bpm,bpmn,bpmx,(CASE WHEN bpmd = '' OR bpmd IS NULL THEN '\\N' ELSE bpmd END) as bpmd,artist,genre,spd as dif, d7 as notes,japan,abs(14) as dif_type FROM temp 
UNION
SELECT no,msc,(CASE WHEN ver < 50 THEN ver ELSE (ver - 50) END) as ver_no,(CASE WHEN ver < 50 THEN 1 ELSE 2 END) as ver_type,bpm,bpmn,bpmx,(CASE WHEN bpmd = '' OR bpmd IS NULL THEN '\\N' ELSE bpmd END) as bpmd,artist,genre,dpd as dif, d14 as notes,japan,abs(24) as dif_type FROM temp 
ORDER BY dif,japan,msc,dif_type);














-- 譜面詳細データ
DROP TABLE IF EXISTS  data_detail cascade;

create table data_detail (
  data_detail_id serial not null
  , playtime integer
  , bpm_detail text
  , constraint data_detail_PKC primary key (data_detail_id)
) ;

-- 収録状況テーブル
DROP TABLE IF EXISTS  list cascade;

create table list (
  list_id serial not null
  , ver_id integer
  , data_id integer
  , secret_id integer
  , info text
  , constraint list_PKC primary key (list_id,ver_id,data_id,secret_id)
) ;

-- 譜面データテーブル
drop table notesdata cascade;

create table notesdata (
  data_id serial not null
  , music_id integer
  , dif_id integer
  , genre_id integer
  , artist_id integer
  , data_detail_id integer
  , dif integer
  , bpm_min integer
  , bpm_max integer
  , notes integer
  , scratch integer
  , chargenotes integer
  , bss integer
  , data_date date
  , constraint notesdata_PKC primary key (data_id,music_id,dif_id,genre_id,artist_id,data_detail_id)
) ;


-- バージョンテーブル
DROP TABLE IF EXISTS  version cascade;

create table version (
  ver_id serial not null
  , ver_no integer
  , ver_type integer
  , ver_disc integer
  , ver_name text
  , ver_name_short text
  , ver_date date
  , constraint version_PKC primary key (ver_id)
) ;

-- 難易度名テーブル
DROP TABLE IF EXISTS  diftype cascade;

create table diftype (
  dif_id serial not null
  , dif_type text
  , constraint diftype_PKC primary key (dif_id)
) ;

-- ジャンル名テーブル
DROP TABLE IF EXISTS  genre cascade;

create table genre (
  genre_id serial not null
  , genre_name text
  , constraint genre_PKC primary key (genre_id)
) ;

-- アーティスト名義テーブル
DROP TABLE IF EXISTS  artist cascade;

create table artist (
  artist_id serial not null
  , artist_name text
  , constraint artist_PKC primary key (artist_id)
) ;

-- 曲情報テーブル
DROP TABLE IF EXISTS  music cascade;

create table music (
  music_id serial not null
  , music_no integer
  , music_name text
  , music_name_sort text
  , music_read text
  , music_battle integer
  , music_first_ver integer
  , music_folder_ver integer
  , constraint music_PKC primary key (music_id)
) ;

comment on table data_detail is '譜面詳細データ';
comment on column data_detail.data_detail_id is '譜面詳細ID';
comment on column data_detail.playtime is '演奏時間';
comment on column data_detail.bpm_detail is '詳細BPM';

comment on table list is '収録状況テーブル';
comment on column list.list_id is 'リストID';
comment on column list.ver_id is 'バージョンID';
comment on column list.data_id is 'データID';
comment on column list.secret_id is 'シークレット';
comment on column list.info is '情報';

comment on table notesdata is '譜面データテーブル';
comment on column notesdata.data_id is 'データID';
comment on column notesdata.music_id is '曲ID';
comment on column notesdata.dif_id is '難度タイプID';
comment on column notesdata.genre_id is 'ジャンルID';
comment on column notesdata.artist_id is 'アーティスト名義ID';
comment on column notesdata.data_detail_id is '譜面詳細ID';
comment on column notesdata.dif is '難易度';
comment on column notesdata.bpm_min is '最小BPM';
comment on column notesdata.bpm_max is '最大BPM';
comment on column notesdata.notes is 'ノート数';
comment on column notesdata.scratch is 'スクラッチ';
comment on column notesdata.chargenotes is 'チャージノート';
comment on column notesdata.bss is 'バックスピンスクラッチ';
comment on column notesdata.data_date is 'データ日付';

comment on table version is 'バージョンテーブル';
comment on column version.ver_id is 'バージョンID';
comment on column version.ver_no is 'バージョンno';
comment on column version.ver_type is 'バージョンタイプ';
comment on column version.ver_disc is 'ディスク';
comment on column version.ver_name is '名前';
comment on column version.ver_name_short is '短縮名';
comment on column version.ver_date is '日付';

comment on table diftype is '難易度名テーブル';
comment on column diftype.dif_id is '難易度タイプID';
comment on column diftype.dif_type is '難易度名';

comment on table genre is 'ジャンル名テーブル';
comment on column genre.genre_id is 'ジャンル名ID';
comment on column genre.genre_name is 'ジャンル名';

comment on table artist is 'アーティスト名義テーブル';
comment on column artist.artist_id is 'アーティスト名義ID';
comment on column artist.artist_name is 'アーティスト名';

comment on table music is '曲情報テーブル';
comment on column music.music_id is '曲ID';
comment on column music.music_no is '曲no';
comment on column music.music_name is '曲名';
comment on column music.music_name_sort is 'ソート用曲名';
comment on column music.music_read is '読み方';
comment on column music.music_battle is '別難度Battle可否';
comment on column music.music_first_ver is '初登場version';
comment on column music.music_folder_ver is '収録フォルダ';




INSERT INTO genre 
SELECT nextval('genre_genre_id_seq') as genre_id,iidxsd_origin.genre as genre_name 
FROM iidxsd_origin GROUP BY iidxsd_origin.genre ORDER BY iidxsd_origin.genre;


INSERT INTO artist 
SELECT nextval('artist_artist_id_seq') as artist_id,iidxsd_origin.artist as artist_name 
FROM iidxsd_origin GROUP BY iidxsd_origin.artist ORDER BY iidxsd_origin.artist;



INSERT INTO data_detail 
SELECT nextval('data_detail_data_detail_id_seq') as data_detail_id,0 as time, 
iidxsd_origin.bpmd
FROM iidxsd_origin GROUP BY iidxsd_origin.bpmd ORDER BY iidxsd_origin.bpmd;


INSERT INTO music 
SELECT nextval('music_music_id_seq') as music_id,
currval('music_music_id_seq') as music_no,
msc as music_name,
UPPER(msc) as music_name_sort,
'' as music_read,
1 as music_battle,
MIN(ver_no) as music_first_ver,
MIN(
  CASE WHEN ver_type = 2 THEN (ver_no + 50) ELSE ver_no END
) as music_folder_ver 
FROM iidxsd_origin 
GROUP BY msc ORDER BY msc;


-- バージョンテーブル
DROP TABLE IF EXISTS  version cascade;

create table version (
  ver_id serial not null
  , ver_no integer
  , ver_type integer
  , ver_disc integer
  , ver_name text
  , ver_name_short text
  , ver_date date
  , constraint version_PKC primary key (ver_id)
) ;

-- 難易度名テーブル
DROP TABLE IF EXISTS  diftype cascade;

create table diftype (
  dif_id serial not null
  , dif_type text
  , constraint diftype_PKC primary key (dif_id)
) ;

comment on table version is 'バージョンテーブル';
comment on column version.ver_id is 'バージョンID';
comment on column version.ver_no is 'バージョンno';
comment on column version.ver_type is 'バージョンタイプ';
comment on column version.ver_disc is 'ディスク';
comment on column version.ver_name is '名前';
comment on column version.ver_name_short is '短縮名';
comment on column version.ver_date is '日付';

comment on table diftype is '難易度名テーブル';
comment on column diftype.dif_id is '難易度タイプID';
comment on column diftype.dif_type is '難易度名';



--難易度テーブル挿入

INSERT INTO diftype VALUES (11,'SINGLE PLAY NORMAL');
INSERT INTO diftype VALUES (12,'SINGLE PLAY HYPER');
INSERT INTO diftype VALUES (13,'SINGLE PLAY ANOTHER');
INSERT INTO diftype VALUES (14,'SINGLE PLAY DARK ANOTHER');
INSERT INTO diftype VALUES (21,'DOUBLE PLAY NORMAL');
INSERT INTO diftype VALUES (22,'DOUBLE PLAY HYPER');
INSERT INTO diftype VALUES (23,'DOUBLE PLAY ANOTHER');
INSERT INTO diftype VALUES (24,'DOUBLE PLAY DARK ANOTHER');


--バージョンテーブル挿入

INSERT INTO version VALUES (nextval('version_ver_id_seq'),0,1,1,'1st style','1st','1999/02/26');
INSERT INTO version VALUES (nextval('version_ver_id_seq'),1,1,1,'substream','ss','1999/07/27');
INSERT INTO version VALUES (nextval('version_ver_id_seq'),2,1,1,'2nd style','2nd','1999/09/30');
INSERT INTO version VALUES (nextval('version_ver_id_seq'),3,1,1,'3rd style','3rd','2000/02/25');
INSERT INTO version VALUES (nextval('version_ver_id_seq'),4,1,1,'4th style','4th','2000/09/28');
INSERT INTO version VALUES (nextval('version_ver_id_seq'),3,2,1,'3rd style','3rd','2000/11/02');
INSERT INTO version VALUES (nextval('version_ver_id_seq'),5,1,1,'5th style','5th','2001/03/27');
INSERT INTO version VALUES (nextval('version_ver_id_seq'),4,2,1,'4th style','4th','2001/03/29');
INSERT INTO version VALUES (nextval('version_ver_id_seq'),5,2,1,'5th style','5th','2001/08/30');
INSERT INTO version VALUES (nextval('version_ver_id_seq'),6,1,1,'6th style','6th','2001/09/28');
INSERT INTO version VALUES (nextval('version_ver_id_seq'),7,1,1,'7th style','7th','2002/03/27');
INSERT INTO version VALUES (nextval('version_ver_id_seq'),6,2,1,'6th style','6th','2002/07/18');
INSERT INTO version VALUES (nextval('version_ver_id_seq'),8,1,1,'8th style','8th','2002/09/27');
INSERT INTO version VALUES (nextval('version_ver_id_seq'),9,1,1,'9th style','9th','2003/06/25');
INSERT INTO version VALUES (nextval('version_ver_id_seq'),10,1,1,'10th style','10th','2004/02/18');
INSERT INTO version VALUES (nextval('version_ver_id_seq'),7,2,1,'7th style','7th','2004/05/13');
INSERT INTO version VALUES (nextval('version_ver_id_seq'),11,1,1,'11 IIDX RED','RED','2004/10/28');
INSERT INTO version VALUES (nextval('version_ver_id_seq'),8,2,1,'8th style','8th','2004/11/18');
INSERT INTO version VALUES (nextval('version_ver_id_seq'),9,2,1,'9th style','9th','2005/03/24');
INSERT INTO version VALUES (nextval('version_ver_id_seq'),12,1,1,'12 HAPPY SKY','HSK','2005/07/13');
INSERT INTO version VALUES (nextval('version_ver_id_seq'),10,2,1,'10th style','10th','2005/11/17');
INSERT INTO version VALUES (nextval('version_ver_id_seq'),13,1,1,'13 DistorteD','DD','2006/03/15');
INSERT INTO version VALUES (nextval('version_ver_id_seq'),11,2,1,'11 IIDX RED','RED','2006/05/18');
INSERT INTO version VALUES (nextval('version_ver_id_seq'),12,2,1,'12 HAPPY SKY','HSK','2006/12/14');
INSERT INTO version VALUES (nextval('version_ver_id_seq'),14,1,1,'14 GOLD','GOLD','2007/02/21');
INSERT INTO version VALUES (nextval('version_ver_id_seq'),13,2,1,'13 DistorteD','DD','2007/08/30');
INSERT INTO version VALUES (nextval('version_ver_id_seq'),15,1,1,'15 DJ TROOPERS','DJT','2007/12/19');
INSERT INTO version VALUES (nextval('version_ver_id_seq'),14,2,1,'14 GOLD','GOLD','2008/05/29');
INSERT INTO version VALUES (nextval('version_ver_id_seq'),16,1,1,'16 EMPRESS','EMP','2008/11/19');
INSERT INTO version VALUES (nextval('version_ver_id_seq'),15,2,1,'15 DJ TROOPERS','DJT','2008/12/18');
INSERT INTO version VALUES (nextval('version_ver_id_seq'),16,2,1,'16 EMPRESS','EMP','2009/10/15');
INSERT INTO version VALUES (nextval('version_ver_id_seq'),16,2,2,'PREMIUM BEST','PB','2009/10/15');
INSERT INTO version VALUES (nextval('version_ver_id_seq'),17,1,1,'17 SIRIUS','SIR','2009/10/21');
INSERT INTO version VALUES (nextval('version_ver_id_seq'),18,1,1,'18 Resort Anthem','RA','2010/09/15');
INSERT INTO version VALUES (nextval('version_ver_id_seq'),19,1,1,'19 Lincle','LC','2011/09/15');
INSERT INTO version VALUES (nextval('version_ver_id_seq'),20,1,1,'20 tricoro','TCR','2012/09/19');
INSERT INTO version VALUES (nextval('version_ver_id_seq'),21,1,1,'21 SPADA','SPA','2013/11/13');


INSERT INTO notesdata (SELECT nextval('notesdata_data_id_seq') as data_id, music_id, dif_type as dif_id, genre_id, artist_id, data_detail_id, dif, bpmn as bpm_min, bpmx as bpm_max, notes, 0 as scratch, 0 as chargenotes, 0 as bss, MIN(ver_date) as data_date
FROM 
(((((iidxsd_origin JOIN music ON iidxsd_origin.msc = music_name) 
 JOIN genre ON iidxsd_origin.genre = genre_name)
 JOIN artist ON iidxsd_origin.artist = artist.artist_name)
 JOIN version ON iidxsd_origin.ver_no = version.ver_no AND iidxsd_origin.ver_type = version.ver_type)
 JOIN data_detail ON iidxsd_origin.bpmd = data_detail.bpm_detail AND data_detail.bpm_detail IS NOT NULL)
GROUP BY 
  music_id
  , dif_id
  , genre_id
  , artist_id
  , data_detail_id
  , dif
  , dif_type
  , bpm_min
  , bpm_max
  , notes
HAVING notes > 0);

DROP TABLE IF EXISTS iidxsd_origin_x;
CREATE TABLE iidxsd_origin_x  AS SELECT ver_no, ver_type, music_id, dif_type as dif_id, genre_id, artist_id, data_detail_id, dif, bpmn as bpm_min, bpmx as bpm_max, notes, 0 as chargenotes, 0 as bss
FROM 
((((iidxsd_origin JOIN music ON iidxsd_origin.msc = music_name) 
 JOIN genre ON iidxsd_origin.genre = genre_name)
 JOIN artist ON iidxsd_origin.artist = artist.artist_name)
 JOIN data_detail ON iidxsd_origin.bpmd = data_detail.bpm_detail)
;


INSERT INTO list (
SELECT nextval('list_list_id_seq') as list_id, 
ver_id, data_id, 0 as secret_id, '' as info 
FROM 
((iidxsd_origin_x
 JOIN version
USING(ver_no, ver_type) )
 JOIN notesdata
USING(dif, notes, bpm_min, bpm_max, music_id, genre_id, artist_id, data_detail_id))
GROUP BY ver_id, data_id
);


DROP VIEW IF EXISTS ac0_core; DROP VIEW IF EXISTS ac0;
CREATE VIEW ac0 AS SELECT list.info, ver_id, music.music_id, music.music_no, music.music_name, music.music_name_sort, music.music_battle, music.music_first_ver, music.music_folder_ver, genre.genre_id, genre.genre_name, artist.artist_id, artist.artist_name, notesdata.data_id, notesdata.dif, notesdata.dif_id, notesdata.bpm_min, notesdata.bpm_max, notesdata.notes, notesdata.scratch, notesdata.chargenotes, notesdata.bss FROM list JOIN notesdata USING(data_id) JOIN music USING(music_id) JOIN artist USING(artist_id) JOIN genre USING(genre_id) WHERE list.ver_id = 1;

DROP VIEW IF EXISTS ac1_core; DROP VIEW IF EXISTS ac1;
CREATE VIEW ac1 AS SELECT list.info, ver_id, music.music_id, music.music_no, music.music_name, music.music_name_sort, music.music_battle, music.music_first_ver, music.music_folder_ver, genre.genre_id, genre.genre_name, artist.artist_id, artist.artist_name, notesdata.data_id, notesdata.dif, notesdata.dif_id, notesdata.bpm_min, notesdata.bpm_max, notesdata.notes, notesdata.scratch, notesdata.chargenotes, notesdata.bss FROM list JOIN notesdata USING(data_id) JOIN music USING(music_id) JOIN artist USING(artist_id) JOIN genre USING(genre_id) WHERE list.ver_id = 2;

DROP VIEW IF EXISTS ac2_core; DROP VIEW IF EXISTS ac2;
CREATE VIEW ac2 AS SELECT list.info, ver_id, music.music_id, music.music_no, music.music_name, music.music_name_sort, music.music_battle, music.music_first_ver, music.music_folder_ver, genre.genre_id, genre.genre_name, artist.artist_id, artist.artist_name, notesdata.data_id, notesdata.dif, notesdata.dif_id, notesdata.bpm_min, notesdata.bpm_max, notesdata.notes, notesdata.scratch, notesdata.chargenotes, notesdata.bss FROM list JOIN notesdata USING(data_id) JOIN music USING(music_id) JOIN artist USING(artist_id) JOIN genre USING(genre_id) WHERE list.ver_id = 3;

DROP VIEW IF EXISTS ac3_core; DROP VIEW IF EXISTS ac3;
CREATE VIEW ac3 AS SELECT list.info, ver_id, music.music_id, music.music_no, music.music_name, music.music_name_sort, music.music_battle, music.music_first_ver, music.music_folder_ver, genre.genre_id, genre.genre_name, artist.artist_id, artist.artist_name, notesdata.data_id, notesdata.dif, notesdata.dif_id, notesdata.bpm_min, notesdata.bpm_max, notesdata.notes, notesdata.scratch, notesdata.chargenotes, notesdata.bss FROM list JOIN notesdata USING(data_id) JOIN music USING(music_id) JOIN artist USING(artist_id) JOIN genre USING(genre_id) WHERE list.ver_id = 4;

DROP VIEW IF EXISTS ac4_core; DROP VIEW IF EXISTS ac4;
CREATE VIEW ac4 AS SELECT list.info, ver_id, music.music_id, music.music_no, music.music_name, music.music_name_sort, music.music_battle, music.music_first_ver, music.music_folder_ver, genre.genre_id, genre.genre_name, artist.artist_id, artist.artist_name, notesdata.data_id, notesdata.dif, notesdata.dif_id, notesdata.bpm_min, notesdata.bpm_max, notesdata.notes, notesdata.scratch, notesdata.chargenotes, notesdata.bss FROM list JOIN notesdata USING(data_id) JOIN music USING(music_id) JOIN artist USING(artist_id) JOIN genre USING(genre_id) WHERE list.ver_id = 5;

DROP VIEW IF EXISTS cs3_core; DROP VIEW IF EXISTS cs3;
CREATE VIEW cs3 AS SELECT list.info, ver_id, music.music_id, music.music_no, music.music_name, music.music_name_sort, music.music_battle, music.music_first_ver, music.music_folder_ver, genre.genre_id, genre.genre_name, artist.artist_id, artist.artist_name, notesdata.data_id, notesdata.dif, notesdata.dif_id, notesdata.bpm_min, notesdata.bpm_max, notesdata.notes, notesdata.scratch, notesdata.chargenotes, notesdata.bss FROM list JOIN notesdata USING(data_id) JOIN music USING(music_id) JOIN artist USING(artist_id) JOIN genre USING(genre_id) WHERE list.ver_id = 6;

DROP VIEW IF EXISTS ac5_core; DROP VIEW IF EXISTS ac5;
CREATE VIEW ac5 AS SELECT list.info, ver_id, music.music_id, music.music_no, music.music_name, music.music_name_sort, music.music_battle, music.music_first_ver, music.music_folder_ver, genre.genre_id, genre.genre_name, artist.artist_id, artist.artist_name, notesdata.data_id, notesdata.dif, notesdata.dif_id, notesdata.bpm_min, notesdata.bpm_max, notesdata.notes, notesdata.scratch, notesdata.chargenotes, notesdata.bss FROM list JOIN notesdata USING(data_id) JOIN music USING(music_id) JOIN artist USING(artist_id) JOIN genre USING(genre_id) WHERE list.ver_id = 7;

DROP VIEW IF EXISTS cs4_core; DROP VIEW IF EXISTS cs4;
CREATE VIEW cs4 AS SELECT list.info, ver_id, music.music_id, music.music_no, music.music_name, music.music_name_sort, music.music_battle, music.music_first_ver, music.music_folder_ver, genre.genre_id, genre.genre_name, artist.artist_id, artist.artist_name, notesdata.data_id, notesdata.dif, notesdata.dif_id, notesdata.bpm_min, notesdata.bpm_max, notesdata.notes, notesdata.scratch, notesdata.chargenotes, notesdata.bss FROM list JOIN notesdata USING(data_id) JOIN music USING(music_id) JOIN artist USING(artist_id) JOIN genre USING(genre_id) WHERE list.ver_id = 8;

DROP VIEW IF EXISTS cs5_core; DROP VIEW IF EXISTS cs5;
CREATE VIEW cs5 AS SELECT list.info, ver_id, music.music_id, music.music_no, music.music_name, music.music_name_sort, music.music_battle, music.music_first_ver, music.music_folder_ver, genre.genre_id, genre.genre_name, artist.artist_id, artist.artist_name, notesdata.data_id, notesdata.dif, notesdata.dif_id, notesdata.bpm_min, notesdata.bpm_max, notesdata.notes, notesdata.scratch, notesdata.chargenotes, notesdata.bss FROM list JOIN notesdata USING(data_id) JOIN music USING(music_id) JOIN artist USING(artist_id) JOIN genre USING(genre_id) WHERE list.ver_id = 9;

DROP VIEW IF EXISTS ac6_core; DROP VIEW IF EXISTS ac6;
CREATE VIEW ac6 AS SELECT list.info, ver_id, music.music_id, music.music_no, music.music_name, music.music_name_sort, music.music_battle, music.music_first_ver, music.music_folder_ver, genre.genre_id, genre.genre_name, artist.artist_id, artist.artist_name, notesdata.data_id, notesdata.dif, notesdata.dif_id, notesdata.bpm_min, notesdata.bpm_max, notesdata.notes, notesdata.scratch, notesdata.chargenotes, notesdata.bss FROM list JOIN notesdata USING(data_id) JOIN music USING(music_id) JOIN artist USING(artist_id) JOIN genre USING(genre_id) WHERE list.ver_id = 10;

DROP VIEW IF EXISTS ac7_core; DROP VIEW IF EXISTS ac7;
CREATE VIEW ac7 AS SELECT list.info, ver_id, music.music_id, music.music_no, music.music_name, music.music_name_sort, music.music_battle, music.music_first_ver, music.music_folder_ver, genre.genre_id, genre.genre_name, artist.artist_id, artist.artist_name, notesdata.data_id, notesdata.dif, notesdata.dif_id, notesdata.bpm_min, notesdata.bpm_max, notesdata.notes, notesdata.scratch, notesdata.chargenotes, notesdata.bss FROM list JOIN notesdata USING(data_id) JOIN music USING(music_id) JOIN artist USING(artist_id) JOIN genre USING(genre_id) WHERE list.ver_id = 11;

DROP VIEW IF EXISTS cs6_core; DROP VIEW IF EXISTS cs6;
CREATE VIEW cs6 AS SELECT list.info, ver_id, music.music_id, music.music_no, music.music_name, music.music_name_sort, music.music_battle, music.music_first_ver, music.music_folder_ver, genre.genre_id, genre.genre_name, artist.artist_id, artist.artist_name, notesdata.data_id, notesdata.dif, notesdata.dif_id, notesdata.bpm_min, notesdata.bpm_max, notesdata.notes, notesdata.scratch, notesdata.chargenotes, notesdata.bss FROM list JOIN notesdata USING(data_id) JOIN music USING(music_id) JOIN artist USING(artist_id) JOIN genre USING(genre_id) WHERE list.ver_id = 12;

DROP VIEW IF EXISTS ac8_core; DROP VIEW IF EXISTS ac8;
CREATE VIEW ac8 AS SELECT list.info, ver_id, music.music_id, music.music_no, music.music_name, music.music_name_sort, music.music_battle, music.music_first_ver, music.music_folder_ver, genre.genre_id, genre.genre_name, artist.artist_id, artist.artist_name, notesdata.data_id, notesdata.dif, notesdata.dif_id, notesdata.bpm_min, notesdata.bpm_max, notesdata.notes, notesdata.scratch, notesdata.chargenotes, notesdata.bss FROM list JOIN notesdata USING(data_id) JOIN music USING(music_id) JOIN artist USING(artist_id) JOIN genre USING(genre_id) WHERE list.ver_id = 13;

DROP VIEW IF EXISTS ac9_core; DROP VIEW IF EXISTS ac9;
CREATE VIEW ac9 AS SELECT list.info, ver_id, music.music_id, music.music_no, music.music_name, music.music_name_sort, music.music_battle, music.music_first_ver, music.music_folder_ver, genre.genre_id, genre.genre_name, artist.artist_id, artist.artist_name, notesdata.data_id, notesdata.dif, notesdata.dif_id, notesdata.bpm_min, notesdata.bpm_max, notesdata.notes, notesdata.scratch, notesdata.chargenotes, notesdata.bss FROM list JOIN notesdata USING(data_id) JOIN music USING(music_id) JOIN artist USING(artist_id) JOIN genre USING(genre_id) WHERE list.ver_id = 14;

DROP VIEW IF EXISTS ac10_core; DROP VIEW IF EXISTS ac10;
CREATE VIEW ac10 AS SELECT list.info, ver_id, music.music_id, music.music_no, music.music_name, music.music_name_sort, music.music_battle, music.music_first_ver, music.music_folder_ver, genre.genre_id, genre.genre_name, artist.artist_id, artist.artist_name, notesdata.data_id, notesdata.dif, notesdata.dif_id, notesdata.bpm_min, notesdata.bpm_max, notesdata.notes, notesdata.scratch, notesdata.chargenotes, notesdata.bss FROM list JOIN notesdata USING(data_id) JOIN music USING(music_id) JOIN artist USING(artist_id) JOIN genre USING(genre_id) WHERE list.ver_id = 15;

DROP VIEW IF EXISTS cs7_core; DROP VIEW IF EXISTS cs7;
CREATE VIEW cs7 AS SELECT list.info, ver_id, music.music_id, music.music_no, music.music_name, music.music_name_sort, music.music_battle, music.music_first_ver, music.music_folder_ver, genre.genre_id, genre.genre_name, artist.artist_id, artist.artist_name, notesdata.data_id, notesdata.dif, notesdata.dif_id, notesdata.bpm_min, notesdata.bpm_max, notesdata.notes, notesdata.scratch, notesdata.chargenotes, notesdata.bss FROM list JOIN notesdata USING(data_id) JOIN music USING(music_id) JOIN artist USING(artist_id) JOIN genre USING(genre_id) WHERE list.ver_id = 16;

DROP VIEW IF EXISTS ac11_core; DROP VIEW IF EXISTS ac11;
CREATE VIEW ac11 AS SELECT list.info, ver_id, music.music_id, music.music_no, music.music_name, music.music_name_sort, music.music_battle, music.music_first_ver, music.music_folder_ver, genre.genre_id, genre.genre_name, artist.artist_id, artist.artist_name, notesdata.data_id, notesdata.dif, notesdata.dif_id, notesdata.bpm_min, notesdata.bpm_max, notesdata.notes, notesdata.scratch, notesdata.chargenotes, notesdata.bss FROM list JOIN notesdata USING(data_id) JOIN music USING(music_id) JOIN artist USING(artist_id) JOIN genre USING(genre_id) WHERE list.ver_id = 17;

DROP VIEW IF EXISTS cs8_core; DROP VIEW IF EXISTS cs8;
CREATE VIEW cs8 AS SELECT list.info, ver_id, music.music_id, music.music_no, music.music_name, music.music_name_sort, music.music_battle, music.music_first_ver, music.music_folder_ver, genre.genre_id, genre.genre_name, artist.artist_id, artist.artist_name, notesdata.data_id, notesdata.dif, notesdata.dif_id, notesdata.bpm_min, notesdata.bpm_max, notesdata.notes, notesdata.scratch, notesdata.chargenotes, notesdata.bss FROM list JOIN notesdata USING(data_id) JOIN music USING(music_id) JOIN artist USING(artist_id) JOIN genre USING(genre_id) WHERE list.ver_id = 18;

DROP VIEW IF EXISTS cs9_core; DROP VIEW IF EXISTS cs9;
CREATE VIEW cs9 AS SELECT list.info, ver_id, music.music_id, music.music_no, music.music_name, music.music_name_sort, music.music_battle, music.music_first_ver, music.music_folder_ver, genre.genre_id, genre.genre_name, artist.artist_id, artist.artist_name, notesdata.data_id, notesdata.dif, notesdata.dif_id, notesdata.bpm_min, notesdata.bpm_max, notesdata.notes, notesdata.scratch, notesdata.chargenotes, notesdata.bss FROM list JOIN notesdata USING(data_id) JOIN music USING(music_id) JOIN artist USING(artist_id) JOIN genre USING(genre_id) WHERE list.ver_id = 19;

DROP VIEW IF EXISTS ac12_core; DROP VIEW IF EXISTS ac12;
CREATE VIEW ac12 AS SELECT list.info, ver_id, music.music_id, music.music_no, music.music_name, music.music_name_sort, music.music_battle, music.music_first_ver, music.music_folder_ver, genre.genre_id, genre.genre_name, artist.artist_id, artist.artist_name, notesdata.data_id, notesdata.dif, notesdata.dif_id, notesdata.bpm_min, notesdata.bpm_max, notesdata.notes, notesdata.scratch, notesdata.chargenotes, notesdata.bss FROM list JOIN notesdata USING(data_id) JOIN music USING(music_id) JOIN artist USING(artist_id) JOIN genre USING(genre_id) WHERE list.ver_id = 20;

DROP VIEW IF EXISTS cs10_core; DROP VIEW IF EXISTS cs10;
CREATE VIEW cs10 AS SELECT list.info, ver_id, music.music_id, music.music_no, music.music_name, music.music_name_sort, music.music_battle, music.music_first_ver, music.music_folder_ver, genre.genre_id, genre.genre_name, artist.artist_id, artist.artist_name, notesdata.data_id, notesdata.dif, notesdata.dif_id, notesdata.bpm_min, notesdata.bpm_max, notesdata.notes, notesdata.scratch, notesdata.chargenotes, notesdata.bss FROM list JOIN notesdata USING(data_id) JOIN music USING(music_id) JOIN artist USING(artist_id) JOIN genre USING(genre_id) WHERE list.ver_id = 21;

DROP VIEW IF EXISTS ac13_core; DROP VIEW IF EXISTS ac13;
CREATE VIEW ac13 AS SELECT list.info, ver_id, music.music_id, music.music_no, music.music_name, music.music_name_sort, music.music_battle, music.music_first_ver, music.music_folder_ver, genre.genre_id, genre.genre_name, artist.artist_id, artist.artist_name, notesdata.data_id, notesdata.dif, notesdata.dif_id, notesdata.bpm_min, notesdata.bpm_max, notesdata.notes, notesdata.scratch, notesdata.chargenotes, notesdata.bss FROM list JOIN notesdata USING(data_id) JOIN music USING(music_id) JOIN artist USING(artist_id) JOIN genre USING(genre_id) WHERE list.ver_id = 22;

DROP VIEW IF EXISTS cs11_core; DROP VIEW IF EXISTS cs11;
CREATE VIEW cs11 AS SELECT list.info, ver_id, music.music_id, music.music_no, music.music_name, music.music_name_sort, music.music_battle, music.music_first_ver, music.music_folder_ver, genre.genre_id, genre.genre_name, artist.artist_id, artist.artist_name, notesdata.data_id, notesdata.dif, notesdata.dif_id, notesdata.bpm_min, notesdata.bpm_max, notesdata.notes, notesdata.scratch, notesdata.chargenotes, notesdata.bss FROM list JOIN notesdata USING(data_id) JOIN music USING(music_id) JOIN artist USING(artist_id) JOIN genre USING(genre_id) WHERE list.ver_id = 23;

DROP VIEW IF EXISTS cs12_core; DROP VIEW IF EXISTS cs12;
CREATE VIEW cs12 AS SELECT list.info, ver_id, music.music_id, music.music_no, music.music_name, music.music_name_sort, music.music_battle, music.music_first_ver, music.music_folder_ver, genre.genre_id, genre.genre_name, artist.artist_id, artist.artist_name, notesdata.data_id, notesdata.dif, notesdata.dif_id, notesdata.bpm_min, notesdata.bpm_max, notesdata.notes, notesdata.scratch, notesdata.chargenotes, notesdata.bss FROM list JOIN notesdata USING(data_id) JOIN music USING(music_id) JOIN artist USING(artist_id) JOIN genre USING(genre_id) WHERE list.ver_id = 24;

DROP VIEW IF EXISTS ac14_core; DROP VIEW IF EXISTS ac14;
CREATE VIEW ac14 AS SELECT list.info, ver_id, music.music_id, music.music_no, music.music_name, music.music_name_sort, music.music_battle, music.music_first_ver, music.music_folder_ver, genre.genre_id, genre.genre_name, artist.artist_id, artist.artist_name, notesdata.data_id, notesdata.dif, notesdata.dif_id, notesdata.bpm_min, notesdata.bpm_max, notesdata.notes, notesdata.scratch, notesdata.chargenotes, notesdata.bss FROM list JOIN notesdata USING(data_id) JOIN music USING(music_id) JOIN artist USING(artist_id) JOIN genre USING(genre_id) WHERE list.ver_id = 25;

DROP VIEW IF EXISTS cs13_core; DROP VIEW IF EXISTS cs13;
CREATE VIEW cs13 AS SELECT list.info, ver_id, music.music_id, music.music_no, music.music_name, music.music_name_sort, music.music_battle, music.music_first_ver, music.music_folder_ver, genre.genre_id, genre.genre_name, artist.artist_id, artist.artist_name, notesdata.data_id, notesdata.dif, notesdata.dif_id, notesdata.bpm_min, notesdata.bpm_max, notesdata.notes, notesdata.scratch, notesdata.chargenotes, notesdata.bss FROM list JOIN notesdata USING(data_id) JOIN music USING(music_id) JOIN artist USING(artist_id) JOIN genre USING(genre_id) WHERE list.ver_id = 26;

DROP VIEW IF EXISTS ac15_core; DROP VIEW IF EXISTS ac15;
CREATE VIEW ac15 AS SELECT list.info, ver_id, music.music_id, music.music_no, music.music_name, music.music_name_sort, music.music_battle, music.music_first_ver, music.music_folder_ver, genre.genre_id, genre.genre_name, artist.artist_id, artist.artist_name, notesdata.data_id, notesdata.dif, notesdata.dif_id, notesdata.bpm_min, notesdata.bpm_max, notesdata.notes, notesdata.scratch, notesdata.chargenotes, notesdata.bss FROM list JOIN notesdata USING(data_id) JOIN music USING(music_id) JOIN artist USING(artist_id) JOIN genre USING(genre_id) WHERE list.ver_id = 27;

DROP VIEW IF EXISTS cs14_core; DROP VIEW IF EXISTS cs14;
CREATE VIEW cs14 AS SELECT list.info, ver_id, music.music_id, music.music_no, music.music_name, music.music_name_sort, music.music_battle, music.music_first_ver, music.music_folder_ver, genre.genre_id, genre.genre_name, artist.artist_id, artist.artist_name, notesdata.data_id, notesdata.dif, notesdata.dif_id, notesdata.bpm_min, notesdata.bpm_max, notesdata.notes, notesdata.scratch, notesdata.chargenotes, notesdata.bss FROM list JOIN notesdata USING(data_id) JOIN music USING(music_id) JOIN artist USING(artist_id) JOIN genre USING(genre_id) WHERE list.ver_id = 28;

DROP VIEW IF EXISTS ac16_core; DROP VIEW IF EXISTS ac16;
CREATE VIEW ac16 AS SELECT list.info, ver_id, music.music_id, music.music_no, music.music_name, music.music_name_sort, music.music_battle, music.music_first_ver, music.music_folder_ver, genre.genre_id, genre.genre_name, artist.artist_id, artist.artist_name, notesdata.data_id, notesdata.dif, notesdata.dif_id, notesdata.bpm_min, notesdata.bpm_max, notesdata.notes, notesdata.scratch, notesdata.chargenotes, notesdata.bss FROM list JOIN notesdata USING(data_id) JOIN music USING(music_id) JOIN artist USING(artist_id) JOIN genre USING(genre_id) WHERE list.ver_id = 29;

DROP VIEW IF EXISTS cs15_core; DROP VIEW IF EXISTS cs15;
CREATE VIEW cs15 AS SELECT list.info, ver_id, music.music_id, music.music_no, music.music_name, music.music_name_sort, music.music_battle, music.music_first_ver, music.music_folder_ver, genre.genre_id, genre.genre_name, artist.artist_id, artist.artist_name, notesdata.data_id, notesdata.dif, notesdata.dif_id, notesdata.bpm_min, notesdata.bpm_max, notesdata.notes, notesdata.scratch, notesdata.chargenotes, notesdata.bss FROM list JOIN notesdata USING(data_id) JOIN music USING(music_id) JOIN artist USING(artist_id) JOIN genre USING(genre_id) WHERE list.ver_id = 30;

DROP VIEW IF EXISTS cs16_core; DROP VIEW IF EXISTS cs16;
CREATE VIEW cs16 AS SELECT list.info, ver_id, music.music_id, music.music_no, music.music_name, music.music_name_sort, music.music_battle, music.music_first_ver, music.music_folder_ver, genre.genre_id, genre.genre_name, artist.artist_id, artist.artist_name, notesdata.data_id, notesdata.dif, notesdata.dif_id, notesdata.bpm_min, notesdata.bpm_max, notesdata.notes, notesdata.scratch, notesdata.chargenotes, notesdata.bss FROM list JOIN notesdata USING(data_id) JOIN music USING(music_id) JOIN artist USING(artist_id) JOIN genre USING(genre_id) WHERE list.ver_id = 31;

DROP VIEW IF EXISTS cs16_2_core; DROP VIEW IF EXISTS cs16_2;
CREATE VIEW cs16_2 AS SELECT list.info, ver_id, music.music_id, music.music_no, music.music_name, music.music_name_sort, music.music_battle, music.music_first_ver, music.music_folder_ver, genre.genre_id, genre.genre_name, artist.artist_id, artist.artist_name, notesdata.data_id, notesdata.dif, notesdata.dif_id, notesdata.bpm_min, notesdata.bpm_max, notesdata.notes, notesdata.scratch, notesdata.chargenotes, notesdata.bss FROM list JOIN notesdata USING(data_id) JOIN music USING(music_id) JOIN artist USING(artist_id) JOIN genre USING(genre_id) WHERE list.ver_id = 32;

DROP VIEW IF EXISTS ac17_core; DROP VIEW IF EXISTS ac17;
CREATE VIEW ac17 AS SELECT list.info, ver_id, music.music_id, music.music_no, music.music_name, music.music_name_sort, music.music_battle, music.music_first_ver, music.music_folder_ver, genre.genre_id, genre.genre_name, artist.artist_id, artist.artist_name, notesdata.data_id, notesdata.dif, notesdata.dif_id, notesdata.bpm_min, notesdata.bpm_max, notesdata.notes, notesdata.scratch, notesdata.chargenotes, notesdata.bss FROM list JOIN notesdata USING(data_id) JOIN music USING(music_id) JOIN artist USING(artist_id) JOIN genre USING(genre_id) WHERE list.ver_id = 33;

DROP VIEW IF EXISTS ac18_core; DROP VIEW IF EXISTS ac18;
CREATE VIEW ac18 AS SELECT list.info, ver_id, music.music_id, music.music_no, music.music_name, music.music_name_sort, music.music_battle, music.music_first_ver, music.music_folder_ver, genre.genre_id, genre.genre_name, artist.artist_id, artist.artist_name, notesdata.data_id, notesdata.dif, notesdata.dif_id, notesdata.bpm_min, notesdata.bpm_max, notesdata.notes, notesdata.scratch, notesdata.chargenotes, notesdata.bss FROM list JOIN notesdata USING(data_id) JOIN music USING(music_id) JOIN artist USING(artist_id) JOIN genre USING(genre_id) WHERE list.ver_id = 34;

DROP VIEW IF EXISTS ac19_core; DROP VIEW IF EXISTS ac19;
CREATE VIEW ac19 AS SELECT list.info, ver_id, music.music_id, music.music_no, music.music_name, music.music_name_sort, music.music_battle, music.music_first_ver, music.music_folder_ver, genre.genre_id, genre.genre_name, artist.artist_id, artist.artist_name, notesdata.data_id, notesdata.dif, notesdata.dif_id, notesdata.bpm_min, notesdata.bpm_max, notesdata.notes, notesdata.scratch, notesdata.chargenotes, notesdata.bss FROM list JOIN notesdata USING(data_id) JOIN music USING(music_id) JOIN artist USING(artist_id) JOIN genre USING(genre_id) WHERE list.ver_id = 35;

DROP VIEW IF EXISTS ac20_core; DROP VIEW IF EXISTS ac20;
CREATE VIEW ac20 AS SELECT list.info, ver_id, music.music_id, music.music_no, music.music_name, music.music_name_sort, music.music_battle, music.music_first_ver, music.music_folder_ver, genre.genre_id, genre.genre_name, artist.artist_id, artist.artist_name, notesdata.data_id, notesdata.dif, notesdata.dif_id, notesdata.bpm_min, notesdata.bpm_max, notesdata.notes, notesdata.scratch, notesdata.chargenotes, notesdata.bss FROM list JOIN notesdata USING(data_id) JOIN music USING(music_id) JOIN artist USING(artist_id) JOIN genre USING(genre_id) WHERE list.ver_id = 36;

DROP VIEW IF EXISTS ac21_core; DROP VIEW IF EXISTS ac21;
CREATE VIEW ac21 AS SELECT list.info, ver_id, music.music_id, music.music_no, music.music_name, music.music_name_sort, music.music_battle, music.music_first_ver, music.music_folder_ver, genre.genre_id, genre.genre_name, artist.artist_id, artist.artist_name, notesdata.data_id, notesdata.dif, notesdata.dif_id, notesdata.bpm_min, notesdata.bpm_max, notesdata.notes, notesdata.scratch, notesdata.chargenotes, notesdata.bss FROM list JOIN notesdata USING(data_id) JOIN music USING(music_id) JOIN artist USING(artist_id) JOIN genre USING(genre_id) WHERE list.ver_id = 37;


DROP VIEW IF EXISTS alldata;
CREATE VIEW alldata AS 
SELECT music_id, music_no, music_name, music_name_sort, music_battle, music_folder_ver, 
genre_id, genre_name, artist_id, artist_name, data_id, dif, dif_id, bpm_min, bpm_max, 
notes, scratch, chargenotes, bss, data_date
FROM (notesdata JOIN music USING(music_id) JOIN artist USING(artist_id) JOIN genre USING(genre_id))  
SQL;
    execSQL($EXEC_SQL);
    echo "data splited";
}
예제 #12
0
파일: settings.php 프로젝트: teju/Android
function modulesetting_db_get($name, $category = '')
{
    LOG_MSG('INFO', "modulesetting_db_get(): START { name=[{$name}] category=[{$category}] \n}");
    $param_arr = _init_db_params();
    // Where Clause
    $where_clause = "WHERE name = ? AND travel_id=" . TRAVEL_ID;
    $param_arr = _db_prepare_param($param_arr, "s", "name", $name, true);
    if ($category != '') {
        $where_clause .= " AND category=? ";
        $param_arr = _db_prepare_param($param_arr, "s", "category", $category, true);
    }
    $resp = execSQL("SELECT \n\t\t\t\t\t\tvalue\n\t\t\t\t\tFROM \n\t\t\t\t\t\ttSetting \n\t\t\t\t\t{$where_clause} ", $param_arr['params'], false);
    LOG_MSG('INFO', "modulesetting_db_get(): END");
    if ($resp[0]['STATUS'] != 'OK') {
        LOG_MSG('ERROR', "modulesetting_db_get(): There was an error loading name=[{$name}]");
        return false;
    }
    if ($resp[0]['NROWS'] != 1) {
        LOG_MSG('INFO', "modulesetting_get(): No value found for [{$name}]");
        return false;
    }
    return $resp[0]['value'];
}
예제 #13
0
if (isset($_POST['send_pwd'])) {
    $login = isset($_POST['f_caver_login']) ? $_POST['f_caver_login'] : '';
    $contact = isset($_POST['f_caver_contact']) ? $_POST['f_caver_contact'] : '';
    $password = generatePassword(10, 8);
    $string = isset($_POST['f_caver_check']) ? $_POST['f_caver_check'] : '';
    $user_check = isset($_SESSION['userCheck']) ? $_SESSION['userCheck'] : '';
    if (!$_SESSION['do_check'] || md5(getIp() . strtolower($string)) == $user_check) {
        $sql = "SELECT * FROM `" . $_SESSION['Application_host'] . "`.`T_caver`";
        $sql .= " WHERE Login = '******' AND Contact ='" . $contact . "'";
        $data = getDataFromSQL($sql, __FILE__, $frame, __FUNCTION__);
        if ($data['Count'] > 0) {
            if ($data[0]['Activated'] == 'YES') {
                $sql = "UPDATE `" . $_SESSION['Application_host'] . "`.`T_caver`";
                $sql .= " SET Password ='******'";
                $sql .= " WHERE Id = " . $data[0]['Id'];
                $req = execSQL($sql, $frame, __FILE__, __FUNCTION__);
                if (!defined('NO_PHPBB_INSTALLED')) {
                    chgPwdphpBBuser($login, $password);
                }
                sendNewPwdMail($data[0], $password);
                //echo $password;
                trackAction("pwd_user", $data[0]['Id'], "T_caver");
                $_SESSION['user_pwd_sent'] = true;
            } else {
                $activated = false;
                $_SESSION['user_pwd_sent'] = false;
            }
        } else {
            $_SESSION['user_pwd_sent'] = false;
            $_SESSION['send_retry'] += 1;
        }
예제 #14
0
/**
 *
 *
 * @param mixed $colNames
 * @param mixed $recID
 * @param mixed $rt
 */
function updateReportSchedule($colNames, $recID, $values)
{
    global $db, $sys_usrReportSchedule_ColumnNames;
    $ret = null;
    if (count($colNames) && count($values)) {
        $db = mysqli_connection_overwrite(DATABASE);
        $isInsert = $recID < 0;
        $query = "";
        $fieldNames = "";
        $parameters = array("");
        $fieldNames = join(",", $colNames);
        foreach ($colNames as $colName) {
            $val = array_shift($values);
            if (array_key_exists($colName, $sys_usrReportSchedule_ColumnNames)) {
                if ($query != "") {
                    $query = $query . ",";
                }
                if ($isInsert) {
                    $query = $query . "?";
                } else {
                    $query = $query . "{$colName} = ?";
                }
                $parameters[0] = $parameters[0] . $sys_usrReportSchedule_ColumnNames[$colName];
                //take datatype from array
                array_push($parameters, $val);
            }
        }
        //for columns
        if ($query != "") {
            if ($isInsert) {
                $query = "insert into usrReportSchedule (" . $fieldNames . ") values (" . $query . ")";
            } else {
                $query = "update usrReportSchedule set " . $query . " where rps_ID = {$recID}";
            }
            $rows = execSQL($db, $query, $parameters, true);
            if ($rows == 0 || is_string($rows)) {
                $oper = $isInsert ? "inserting" : "updating";
                $ret = "error {$oper} in updateReportSchedule - " . $rows;
                //$msqli->error;
            } else {
                if ($isInsert) {
                    $recID = $db->insert_id;
                    $ret = -$recID;
                } else {
                    $ret = $recID;
                }
            }
        }
        $db->close();
    }
    //if column names
    if ($ret == null) {
        $ret = "no data supplied for updating report - {$recID}";
    }
    return $ret;
}
예제 #15
0
/** Run the module install/uninstall scripts
 * @param string  The name of the module
 * @param string  The action to perform, either 'install' or 'uninstall'
 * @return boolean  If the action was succesful
 */
function _module_runscripts($modulename, $type)
{
    global $amp_conf;
    $db_engine = $amp_conf["AMPDBENGINE"];
    $moduledir = $amp_conf["AMPWEBROOT"] . "/admin/modules/" . $modulename;
    if (!is_dir($moduledir)) {
        return false;
    }
    switch ($type) {
        case 'install':
            // install sql files
            $sqlfilename = "install.sql";
            $rc = true;
            if (is_file($moduledir . '/' . $sqlfilename)) {
                $rc = execSQL($moduledir . '/' . $sqlfilename);
            }
            // then run .php scripts
            return _modules_doinclude($moduledir . '/install.php', $modulename) && $rc;
            break;
        case 'uninstall':
            // run uninstall .php scripts first
            $rc = _modules_doinclude($moduledir . '/uninstall.php', $modulename);
            $sqlfilename = "uninstall.sql";
            // then uninstall sql files
            if (is_file($moduledir . '/' . $sqlfilename)) {
                return $rc && execSQL($moduledir . '/' . $sqlfilename);
            } else {
                return $rc;
            }
            break;
        default:
            return false;
    }
    return true;
}
예제 #16
0
         `pabrik02`, `pabrik03`, `pabrik04`, `pabrik05`, `satuan_kirim`, `jenis_obat`, `kategori_obat`, `golongan`, 
         `kode_guna`, `kode_persediaan`, `kode_pendapatan`, `kode_reduksi`, `kode_biaya`, `kode_ppn_k`, `kode_ppn_m`, 
         `expire_date`, `ex_date`, `ex_month`, `ex_year`, `tipe_obat`, `obat_tunai`, `hna`, `harga_dosp`, `discount`, 
         `ppn`, `averange_sale`, `stok_max`, `stok_min`, `stok`, `isi`, `kemasan`, `status`, `flags`, 
         `created_datetime`, `created_user`, `update_datetime`, `update_user`, `no_batch`, `no_rak`, `fld01`, `fld02`, 
         `fld03`) SELECT a.group_barang, a.kd_barang, a.nama, a.satuan, $suppID, 
         a.pabrik02, a.pabrik03, a.pabrik04, a.pabrik05, b.satuan_po, a.jenis_obat, a.kategori_obat, a.golongan, 
         a.kode_guna, a.kode_persediaan, a.kode_pendapatan, a.kode_reduksi, a.kode_biaya, a.kode_ppn_k, a.kode_ppn_m,
         b.fld05, day(b.fld05), month(b.fld05), year(b.fld05), a.tipe_obat, a.obat_tunai, a.hna, b.harga_po, b.discount,
         (b.harga_po *0.1), a.averange_sale, a.stok_max, a.stok_min, b.qty_po, a.isi, a.kemasan, 'Aktif', 1, 
         now(), '$userLoged', now(), '$userLoged', a.fld06, a.no_rak, b.no_po, b.no_spb, b.id FROM ms_barang a 
         INNER JOIN purchase_orderdetail b on a.id = b.barang_id WHERE b.id =$val  ";
         execSQL($strSQLUpMs);
         //print $strSQLUpMs; 
         $strSQLUpFlags = "UPDATE ms_barang set flags = 1 where id = $val";
         execSQL ($strSQLUpFlags);
         }
     }
     die("<meta http-equiv='refresh' content='0;url=home.php?hal=content/list_po'>");
 break;
 case 3:
     //die(print "$noPO   ::   $noReq    ::    $lastNO   ::   $items   ::   $dbPO  ::   $flags   :: $suppID  :: 3");
     /* CHANGED PO STATUS TO (APPROVED) */
     /* IF IT's ALREADY ON (APPROVED) STATUS THEN CHANGED TO (RECEIVING) */
     $items  = $_POST['param'];
     if(empty($noPO)){$noPO              = $_POST['pono'];}
     if(empty($noReq)){$noReq            = $_POST['no_req'];}
     if(empty($suppID)){$suppID          = $_POST['posupplier'];}
     if(empty($poID)){$poID              = $_POST['idPO'];}
     /*for($i=0;$i<=$items;$i++){
         $toDBDetSatuan      = $_POST['txtSat'.$i];
예제 #17
0
<?php

include "header.php";
if ($loggedin) {
    if (isset($_POST["username"]) && isset($_POST["about"])) {
        // Modify existing profile
        $result = execSQL("UPDATE users SET about='" . $_POST["about"] . "', profileimage='" . $_POST["profileimage"] . "' WHERE username='******'");
        redirect("profile.php?u=" . $_POST["username"]);
    } else {
        redirect("");
    }
}
include "footer.php";
예제 #18
0
/**
 * put your comment there...
 *
 * @param mixed $rcons - array that contains data for on record in defRelationshipConstraints
 */
function updateRelConstraint($srcID, $trgID, $terms)
{
    global $mysqli, $rcsColumnNames;
    $ret = null;
    if ($terms == null) {
        $terms = array("null", '', "null", '');
    }
    if (intval($terms[2]) < 1) {
        //if($terms[2]==null || $terms[2]=="" || $terms[2]=="0"){
        $terms[2] = "null";
    }
    $where = " where ";
    if (intval($srcID) < 1) {
        $srcID = "null";
        $where = $where . " rcs_SourceRectypeID is null";
    } else {
        $where = $where . " rcs_SourceRectypeID=" . $srcID;
    }
    if (intval($trgID) < 1) {
        $trgID = "null";
        $where = $where . " and rcs_TargetRectypeID is null";
    } else {
        $where = $where . " and rcs_TargetRectypeID=" . $trgID;
    }
    if (intval($terms[0]) < 1) {
        // $terms[0]==null || $terms[0]==""){
        $terms[0] == "null";
        $where = $where . " and rcs_TermID is null";
    } else {
        $where = $where . " and rcs_TermID=" . $terms[0];
    }
    $query = "select rcs_ID from defRelationshipConstraints " . $where;
    $res = $mysqli->query($query);
    $parameters = array("s", $terms[3]);
    //notes will be parameter
    $query = "";
    if ($res == null || $res->num_rows < 1) {
        //$mysqli->affected_rows<1){
        //insert
        $query = "insert into defRelationshipConstraints(rcs_SourceRectypeID, rcs_TargetRectypeID, rcs_Description, rcs_TermID, rcs_TermLimit) values (" . $srcID . "," . $trgID . ",?," . $terms[0] . "," . $terms[2] . ")";
    } else {
        //update
        $query = "update defRelationshipConstraints set rcs_Description=?, rcs_TermID=" . $terms[0] . ", rcs_TermLimit=" . $terms[2] . $where;
    }
    $rows = execSQL($mysqli, $query, $parameters, true);
    if ($rows == 0 || is_string($rows)) {
        $ret = "SQL error in updateRelConstraint: " . $query;
        //$mysqli->error;
    } else {
        $ret = array($srcID, $trgID, $terms);
    }
    return $ret;
}
예제 #19
0
파일: interact.php 프로젝트: 121mhz/naboor
function uploadNewPics($overRideThumb = false)
{
    global $config;
    $thumbOnly = $config->uploadThumbOnly;
    $PicIDs = array();
    if ($thumbOnly && !$overRideThumb) {
        $query = "select MID,FileName,ThumbUpload,FullUpload,UNIX_TIMESTAMP(MotionTime) MotionTime from Motion where ThumbUpload=0";
        $result = getSQLResult("uploadNewPics 1", $query);
        for ($row = $result->fetch_object(); $row; $row = $result->fetch_object()) {
            $PicIDs[$row->MID] = array('Filename' => $row->FileName, 'PictureTime' => $row->MotionTime);
        }
        foreach ($PicIDs as $PicID => $values) {
            $filename = $values["Filename"];
            make_thumb($filename, "/dev/shm/upload/thumb.jpg", 240);
            $pic = file_get_contents("/dev/shm/upload/thumb.jpg");
            $upload = uploadPic($pic, $values['PictureTime'], true, $PicID);
            if ($upload) {
                $query = "update Motion set ThumbUpload=1 where MID=?";
                $result = execSQL("interact,uploadNewPics {$PicID}", $query, "i", $PicID);
            }
        }
    } else {
        $query = "select MID,FileName,ThumbUpload,FullUpload,UNIX_TIMESTAMP(MotionTime) MotionTime from Motion where FullUpload=0";
        $result = getSQLResult("uploadNewPics 2", $query);
        for ($row = $result->fetch_object(); $row; $row = $result->fetch_object()) {
            $PicIDs[$row->MID] = array('Filename' => $row->FileName, 'PictureTime' => $row->MotionTime);
        }
        foreach ($PicIDs as $PicID => $values) {
            $filename = $values["Filename"];
            $pic = file_get_contents($filename);
            logMessage("Found pic to upload PicID={$PicID} filename={$filename}, size=" . strlen($pic));
            $upload = uploadPic($pic, $values['PictureTime'], false, $PicID);
            if ($upload) {
                $query = "update Motion set ThumbUpload=1,FullUpload=1 where MID=?";
                $result = execSQL("interact,uploadNewPics {$PicID}", $query, "i", $PicID);
            }
        }
    }
}
예제 #20
0
파일: home.php 프로젝트: jaflo/hackme
loadView("start");
?>
<h2>Home</h2>
<form method="post" action="<?php 
url("post.php");
?>
" id="share">
	<textarea name="content" placeholder="Share something!"></textarea>
	<input name="color" type="text" />
	<button type="submit">Share</button>
</form>
<div id="posts">
<?php 
// Get the newest 50 posts
$posts = execSQL("SELECT * FROM posts ORDER BY created DESC LIMIT 50");
if ($posts->num_rows > 0) {
    // Loop through the posts
    while ($post = $posts->fetch_assoc()) {
        ?>
	<div id="<?php 
        echo $post["id"];
        ?>
">
		<div class="sideline" style="border-color:<?php 
        echo $post["color"];
        ?>
"></div>
		<div class="profileimage" style="background-image:url(<?php 
        echo getUser($post["username"])["profileimage"];
        ?>
			execSQL($qp);
			echo "masuk update";
		}
		echo "</script><script language=javascript>window.opener.location.reload();window.close();</script><script runat=server>";
	}
		if ($_POST['in']==1)
	{
		
		$ket=$_POST['ket'];
        if(empty($ket)){$ket=$_GET['ket'];}
		$id=$_POST['id'];		
		$No_SPP=$_GET['No_SPP'];
		$UsrRetur=$_POST['UsrRetur'];
		$tgl=date("d/m/Y");
		$query=("UPDATE permintaan_unitdetail SET No_BTB='$no_BTB', tgl_retur='$tgl', UsrRetur='$UsrRetur', ket_retur='$ket', status_detail='6' WHERE id='$id'");
        execSQL($query);
		
		
		//echo $count;		
		//$rwt=($query);
		//die($query);
		//$result=mysql_fetch_array($query);
		//echo $ket;
		//echo "dapet";
		$hehe=1;
		print "<script>alert('Data Berhasil di Input');location.href='input_buat_retur_rawat_jalan.php?No_SPP=$No_SPP&hehe=$hehe'</script>";
		
	}
?>

</head>
예제 #22
0
                case 'ORTHOLOGY':
                    $table = 'orthologies';
                    break;
            }
            preg_match("/^(.*?)(?:\\s+\\[(.*?):(.*)\\])?\$/", $match[4], $matchParts);
            if (strpos($matchParts[1], "[" !== FALSE)) {
                die("[DIE] More than one external datasource on line {$lineNo}: {$line}\n");
            }
            if (count($matchParts) > 2) {
                foreach (explode(" ", $matchParts[3]) as $externalId) {
                    execSQL("INSERT INTO `{$table}_dblinks` (id, db, external_id) VALUES ('{$match[3]}','{$matchParts[2]}','{$externalId}');");
                }
            }
            execSQL("INSERT INTO `{$table}` (id, name) VALUES ('{$match[3]}','{$matchParts[1]}');");
            execSQL("INSERT INTO `genes_{$table}` (genes_id, {$table}_id) VALUES ('{$gene}','{$match[3]}');");
            break;
        case 'PATHWAY':
            execSQL("INSERT INTO `pathways` (id, name) VALUES ('{$match[3]}','{$match[4]}');");
            execSQL("INSERT INTO `genes_pathways` (genes_id, pathways_id) VALUES ('{$gene}','{$match[3]}');");
            break;
        case 'DISEASE':
            execSQL("INSERT INTO `diseases` (id, name) VALUES ('{$match[3]}','{$match[4]}');");
            execSQL("INSERT INTO `genes_diseases` (genes_id, diseases_id) VALUES ('{$gene}','{$match[3]}');");
            break;
        default:
            if (trim($line) != "") {
                die("[DIE] Unrecognized line {$lineNo}: " . $line . "\n");
            }
    }
}
fclose($file_handle);
예제 #23
0
파일: register.php 프로젝트: jaflo/hackme
<?php

include "header.php";
if (isset($_POST["username"]) && $_POST["password"] == $_POST["password2"]) {
    // Add new profile to databse
    execSQL("INSERT INTO users (username, password) " . "VALUES ('" . strtolower($_POST["username"]) . "', '" . sha1($_POST["password"]) . "')");
}
redirect("");
include "footer.php";
예제 #24
0
/**
 * put your comment there...
 *
 * @param mixed $grpID - group ID
 * @param mixed $recIds - comma separated list of affected user IDs
 * @param mixed $newRole - new role
 */
function changeRole($grpID, $recIds, $newRole, $oldRole, $needCheck, $updateSession)
{
    global $db;
    $ret = array();
    /*****DEBUG****/
    //error_log(">>>>> grpId=".$grpID.", recIds=".$recIds.", newrole=".$newRole.", oldrole=".$oldRole);
    if ($needCheck) {
        $ret2 = checkPermission('group', $grpID);
        if ($ret2 != null) {
            $ret['error'] = $ret2;
            return $ret;
        }
    }
    if (is_numeric($recIds)) {
        $arrUsers = array();
        $arrUsers[0] = $recIds;
    } else {
        $arrUsers = split(",", $recIds);
    }
    $is_myself_affected = false;
    $current_user_id = get_user_id();
    //remove from group
    if ($newRole == "delete") {
        $ret['results'] = array();
        $ret['errors'] = array();
        foreach ($arrUsers as $userID) {
            $is_myself_affected = $is_myself_affected || $userID == $current_user_id;
            if ($userID == 2) {
                $error = "Not possible to delete database owner";
            } else {
                $error = checkLastAdmin($userID, $grpID);
            }
            if ($error == null) {
                /*****DEBUG****/
                //error_log("DELETED DELETED DELETED DELETED DELETED DELETED DELETED DELETED ");
                $query = "delete from sysUsrGrpLinks where ugl_UserID={$userID} and ugl_GroupID={$grpID}";
                $rows = execSQL($db, $query, null, true);
                if ($rows == 0 || is_string($rows)) {
                    // error delete reference for this user
                    array_push($ret['errors'], "db error deleting relations for user# {$userID}");
                } else {
                    array_push($ret['results'], $userID);
                }
            } else {
                array_push($ret['errors'], $error);
            }
        }
    } else {
        if ($oldRole != null) {
            //modification of role
            $ret['errors'] = array();
            $ret['results'] = array();
            foreach ($arrUsers as $userID) {
                $is_myself_affected = $is_myself_affected || $userID == $current_user_id;
                $error = null;
                if ($userID == 2 && $grpID == 1) {
                    $error = "Not possible to change role for database owner";
                    array_push($ret['errors'], $error);
                } else {
                    if ($oldRole == "admin" && $newRole == "member") {
                        $error = checkLastAdmin($userID, $grpID);
                        if ($error) {
                            array_push($ret['errors'], $error);
                        }
                    }
                }
                if ($error == null) {
                    $query = "UPDATE sysUsrGrpLinks set ugl_Role='{$newRole}' where ugl_GroupID={$grpID} and ugl_UserID={$userID}";
                    $rows = execSQL($db, $query, null, true);
                    if ($rows == 0 || is_string($rows)) {
                        array_push($ret['errors'], "DB error changing roles in sysUsrGrpLinks for group {$grpID}, user {$userID} - " . $rows);
                    } else {
                        array_push($ret['results'], $userID);
                    }
                }
            }
            //for
        } else {
            //insert new roles for non-existing entries
            $query = "INSERT INTO sysUsrGrpLinks (ugl_GroupID, ugl_UserID, ugl_Role) VALUES ";
            $nofirst = false;
            $resIDs = "";
            foreach ($arrUsers as $userID) {
                $is_myself_affected = $is_myself_affected || $userID == $current_user_id;
                if ($nofirst) {
                    $query = $query . ", ";
                    $resIDs = $resIDs . ", ";
                }
                $query = $query . "({$grpID}, {$userID}, '{$newRole}')";
                $resIDs = $resIDs . "{$userID}";
                $nofirst = true;
            }
            /* DEBUG
            			if($nofirst){
            /*****DEBUG****/
            //error_log("DOWN TO DOWN TO DOWN TO DOWN TO DOWN TO DOWN TO DOWN TO DOWN TO  $newRole");
            /*			//$nofirst = false;
            			//$ret['result'] = $resIDs;
            			}
            			*/
            if ($nofirst) {
                $query = $query . " ON DUPLICATE KEY UPDATE ugl_Role='{$newRole}'";
                $rows = execSQL($db, $query, null, true);
                if ($rows == 0 || is_string($rows)) {
                    $ret['error'] = "DB error setting role in sysUsrGrpLinks - " . $rows;
                } else {
                    $ret['result'] = $resIDs;
                }
            }
        }
    }
    //update group info for affected users
    if ($updateSession) {
        foreach ($arrUsers as $userID) {
            $groups = reloadUserGroups($userID);
            updateSessionForUser($userID, 'user_access', $groups);
        }
    }
    //if($is_myself_affected){
    //	updateSessionInfo();
    //}
    return $ret;
}
예제 #25
0
파일: post.php 프로젝트: jaflo/hackme
<?php

include "header.php";
if ($loggedin) {
    if (isset($_POST["color"]) && isset($_POST["content"])) {
        // Save post to database
        $result = execSQL("INSERT INTO posts (username, content, color) " . "VALUES ('" . strtolower($user["username"]) . "', '" . $_POST["content"] . "', '" . $_POST["color"] . "')");
    }
    redirect("");
}
include "footer.php";
예제 #26
0
파일: po_man.php 프로젝트: reekoheek/srmis
	function loadPO($poNo){
		$strSQLLoad= "SELECT * FROM `purchase_order` where `po_no`  = '". $poNo . "' ";
		$execGo = execSQL($strSQLLoad);
		$retCreate = array ($execGo['po_no'], $execGo['request_no'], $execGo['tgl_po'], $execGo['id_supplier'], $execGo['created_user']);
		return($retCreate);
	}
예제 #27
0
파일: index.php 프로젝트: jaflo/hackme
include "header.php";
if ($loggedin) {
    if (isset($_GET["logout"])) {
        // Delete session, remove cookies to logout
        // http://php.net/manual/en/function.session-destroy.php
        setcookie("id", "", time() - 42000);
        setcookie("username", "", time() - 42000);
        setcookie(session_name(), "", time() - 42000);
        session_destroy();
        redirect("");
    }
    loadView("home");
} else {
    if (isset($_POST["username"]) && isset($_POST["password"])) {
        // Check if user with given credentials exists
        $result = execSQL("SELECT * FROM users WHERE username='******' AND password='******'");
        if ($result->num_rows > 0) {
            // Correct username and password
            while ($row = $result->fetch_assoc()) {
                $expire = 60 * 60 * 12;
                // Cookies expire in 12 hours
                setcookie("id", $row["id"], time() + $expire);
                setcookie("username", $row["username"], time() + $expire);
            }
            redirect("");
        } else {
            redirect("?wrong");
        }
    } else {
        loadView("welcome");
    }
예제 #28
0
파일: db.php 프로젝트: teju/Android
function db_is_sync_supervisor_update($is_sync)
{
    $param_arr = _init_db_params();
    LOG_MSG('INFO', "db_is_sync_supervisor_update(): START {\n\t\t\t\t\t\t\tis_sync=[{$is_sync}]\n}");
    // Add params to params_arr
    $param_arr = _db_prepare_param($param_arr, "i", "is_sync", $is_sync);
    // For the where clause
    $where_clause = " WHERE travel_id= " . TRAVEL_ID;
    $resp = execSQL("UPDATE  \n\t\t\t\t\t\ttSupervisor\n\t\t\t\t\tSET " . $param_arr['update_fields'] . $where_clause, $param_arr['params'], true);
    LOG_MSG('INFO', "db_is_sync_supervisor_update(): END");
    return $resp;
}
예제 #29
0
 /** Run the module install/uninstall scripts
  * @param string  The name of the module
  * @param string  The action to perform, either 'install' or 'uninstall'
  * @param array	  The modulexml array
  * @return boolean  If the action was succesful
  */
 function _runscripts($modulename, $type, $modulexml = false)
 {
     global $amp_conf;
     $db_engine = $amp_conf["AMPDBENGINE"];
     $moduledir = $amp_conf["AMPWEBROOT"] . "/admin/modules/" . $modulename;
     if (!is_dir($moduledir)) {
         return false;
     }
     switch ($type) {
         case 'install':
             // install sql files
             $sqlfilename = "install.sql";
             $rc = true;
             if (is_file($moduledir . '/' . $sqlfilename)) {
                 $rc = execSQL($moduledir . '/' . $sqlfilename);
             }
             //include additional files developer requested
             if ($modulexml !== false) {
                 $this->_runscripts_include($modulexml, $type);
             }
             // If it's a BMO module, manually include the file.
             $mn = ucfirst($modulename);
             $bmofile = "{$moduledir}/{$mn}.class.php";
             if (file_exists($bmofile)) {
                 try {
                     FreePBX::create()->injectClass($mn, $bmofile);
                     $o = FreePBX::create()->{$mn}->install();
                     if ($o === false) {
                         return false;
                     }
                 } catch (Exception $e) {
                     dbug("Error Returned was: " . $e->getMessage());
                     return false;
                 }
             }
             // then run .php scripts
             return $this->_doinclude($moduledir . '/install.php', $modulename) && $rc;
             break;
         case 'uninstall':
             //include additional files developer requested
             if ($modulexml !== false) {
                 $this->_runscripts_include($modulexml, $type);
             }
             // run uninstall .php scripts first
             $rc = $this->_doinclude($moduledir . '/uninstall.php', $modulename);
             $sqlfilename = "uninstall.sql";
             // If it's a BMO module, run uninstall.
             $mn = ucfirst($modulename);
             $bmofile = "{$moduledir}/{$mn}.class.php";
             if (file_exists($bmofile)) {
                 try {
                     $o = FreePBX::create()->{$mn}->uninstall();
                     if ($o === false) {
                         return false;
                     }
                 } catch (Exception $e) {
                     dbug("Error Returned was: " . $e->getMessage());
                     return false;
                 }
             }
             // then uninstall sql files
             if (is_file($moduledir . '/' . $sqlfilename)) {
                 return $rc && execSQL($moduledir . '/' . $sqlfilename);
             } else {
                 return $rc;
             }
             break;
         default:
             return false;
     }
     return true;
 }
예제 #30
0
<?php

ini_set('display_errors', 1);
$_SERVER['SERVER_NAME'] = 'SERVER';
$_SERVER['REMOTE_ADDR'] = true;
error_reporting(E_ERROR | E_PARSE);
define("IGNORE_SWIFT", "true");
$DOMAIN = "script";
require_once '../../lib/swiftmailer/swift_required.php';
include "../../lib/utils.php";
include "../../tConf.php";
include "../../lib/db.php";
db_connect();
// Select vehicle
$vehicle_report_select = execSQL("SELECT\n\t\t\t\t\t\t\t\t\t\treg_no,\n\t\t\t\t\t\t\t\t\t\timei,\n\t\t\t\t\t\t\t\t\t\tclient_name,\n\t\t\t\t\t\t\t\t\t\todometer_reading,\n\t\t\t\t\t\t\t\t\t\tfuel_filled,\n\t\t\t\t\t\t\t\t\t\tDATE_FORMAT(created_dt,'%Y-%m-%d %h:%i %p')\n\t\t\t\t\t\t\t\t\tFROM\n\t\t\t\t\t\t\t\t\t\ttSearch\n\t\t\t\t\t\t\t\t\tWHERE\n\t\t\t\t\t\t\t\t\t\ttravel_id=4 AND\n\t\t\t\t\t\t\t\t\t\tcreated_dt like '" . date("Y-m-d") . "%' AND\n\t\t\t\t\t\t\t\t\t\tfuel_filled <> 0", array(), false);
if ($vehicle_report_select[0]['STATUS'] !== 'OK') {
    echo "Error fetching vehicle ";
    echo print_arr($vehicle_report_select);
    exit;
}
$fp = fopen("megha_report.csv", "w");
$nrows = $vehicle_report_select[0]['NROWS'];
unset($vehicle_report_select[0]['NROWS']);
unset($vehicle_report_select[0]['STATUS']);
$report = "REG NO, IMEI, CLIENT, ODOMETER READING, FUEL FILLED, DATE" . "\r\n";
for ($i = 0; $i < $nrows; $i++) {
    //echo implode( ',' ,$vehicle_report_select[$i])."\r\n";
    $report = $report . implode(',', $vehicle_report_select[$i]) . "\r\n";
}
$fp = fwrite($fp, $report);
rewind($fp);