Example #1
1
function sql_query($sql)
{
    sql_connect();
    $res = mysql_query($sql);
    $array = array();
    while ($row = mysql_fetch_assoc($res)) {
        $array[] = $row;
    }
    return $array;
}
Example #2
0
 function __construct($pagename)
 {
     set_error_handler("debug_handler");
     if (ini_get("magic_quotes_gpc") !== false and get_magic_quotes_gpc()) {
         modify::stripslashes($_REQUEST);
     }
     if (ini_get("register_globals")) {
         modify::dropglobals();
     }
     @ignore_user_abort(0);
     self::$time_start = sys_get_microtime();
     if (!sql_connect(SETUP_DB_HOST, SETUP_DB_USER, sys_decrypt(SETUP_DB_PW, sha1(SETUP_ADMIN_USER)), SETUP_DB_NAME)) {
         $err = sprintf("{t}Cannot connect to database %s on %s.{/t}\n", SETUP_DB_NAME, SETUP_DB_HOST) . sql_error();
         trigger_error($err, E_USER_ERROR);
         sys_die($err);
     }
     session_set_cookie_params(2592000);
     // 1 month
     session_name(SESSION_NAME);
     session_set_save_handler("_login_session_none", "_login_session_none", "_login_session_read", "_login_session_none", "_login_session_destroy", "_login_session_none");
     session_start();
     header("Cache-Control: private, max-age=1, must-revalidate");
     header("Pragma: private");
     $this->template = new template();
     $this->pagename = $pagename;
     class_exists("modify");
     // load class
 }
Example #3
0
 function db($sql, $callback = '', $callbackNoResults = '')
 {
     //SQL CONNECT
     $conn = sql_connect();
     //SQL QUERY
     $query = sql_query($conn, $sql);
     //SQL CLOSE
     $conn->close();
     //CHECK CALLBACKS
     if ($callback == '') {
         return $query;
     } else {
         if ($query->num_rows > 0) {
             if (sql_is_callback($callback) == true) {
                 return $callback;
             } else {
                 while ($row = $query->fetch_assoc()) {
                     $callback($row);
                 }
             }
         } else {
             if (sql_is_callback($callbackNoResults) == true) {
                 return $callbackNoResults;
             } else {
                 $callbackNoResults();
             }
         }
     }
 }
Example #4
0
function article_add_to_db($title, $content)
{
    sql_connect();
    $query = "INSERT INTO articles (article_title, article_content) VALUES ('" . $title . "', '" . $content . "')";
    $temp = sql_query($query);
    return $temp;
    // return true if article succesfuly added to db, or false if not
}
Example #5
0
function sql_query($qry, &$conn = 0)
{
    global $db;
    // If no database connection is supplied use default
    if (!$conn) {
        $conn =& $db;
    }
    if (!$conn) {
        print "NO DATABASE\n";
        exit;
    }
    // check if connection was opened too long
    if (isset($conn['date']) && time() - $conn['date'] > 3600) {
        debug("connection {$conn['connection']} opened too long, closing", "sql");
        $conn['date'] = null;
        pg_close($conn['connection']);
        unset($conn['connection']);
    }
    // check for database connection
    sql_connect($conn);
    // Rewrite SQL query
    call_hooks("pg_sql_query", $qry, $conn);
    // Do we want debug information?
    if (isset($conn['debug']) && $conn['debug']) {
        debug("CONN {$conn['title']}: " . $qry, "sql");
    }
    // Query
    $res = pg_query($conn['connection'], $qry);
    // There was an error - call hooks to inform about error
    if ($res === false) {
        // if postgresql connection died ...
        if (pg_connection_status($conn['connection']) == PGSQL_CONNECTION_BAD) {
            debug("sql connection died", "sql");
            pg_close($conn['connection']);
            unset($conn['connection']);
            call_hooks("sql_connection_failed", $conn);
            // if connection is back, retry query
            if (isset($conn['connection']) && pg_connection_status($conn['connection']) == PGSQL_CONNECTION_OK) {
                $res = pg_query($conn['connection'], $qry);
                if ($res !== false) {
                    debug("sql retry successful", "sql");
                    return $res;
                }
            } else {
                print "sql connection died\n";
                exit;
            }
        }
        $error = pg_last_error();
        call_hooks("sql_error", $db, $qry, $error);
        // If we want debug information AND we have an error, tell about it
        if (isset($conn['debug']) && $conn['debug']) {
            debug("CONN {$conn['title']}: " . pg_last_error(), "sql");
        }
    }
    return $res;
}
Example #6
0
function sql_wrap()
{
    global $g;
    //if ($g["sql"]["connected"] == "true") return;
    //$g["sql"]["connected"] = "true";
    sql_connect();
    sql_select();
    return 0;
}
Example #7
0
function Sql_query($sql)
{
    sql_connect();
    $res = mysql_query($sql);
    $ret = [];
    while (false !== ($row = mysql_fetch_assoc($res))) {
        $ret[] = $row;
    }
    return $ret;
}
Example #8
0
function flogin($a, $b)
{
    sql_connect();
    // Forming the sentence/string of query for qury function
    $result = "SELECT * FROM users WHERE user_name='" . $a . "' AND user_password='******'";
    $temp = sql_query($result);
    $arr = mysql_fetch_assoc($temp);
    if ($arr !== false) {
        return true;
    } else {
        return false;
    }
}
Example #9
0
function note_post_to_db($a, $b, $c)
{
    sql_connect();
    // geting string from entered by user post where \n is marked with full stop '.'
    $post_arr = post_to_array($c);
    $time = date('H:i:s', time()) . ' : ' . date('d-m-Y');
    $temp = "INSERT INTO " . $a . " (user_note, user_note_title, user_note_time) " . "VALUES ('" . $post_arr . "', '" . $b . "', '" . $time . "')";
    $temp2 = sql_query($temp);
    //as a result mysql query with query INSERT returns true or false
    if ($temp2) {
        return true;
    } else {
        return false;
    }
}
Example #10
0
function comment_write_to_db($a, $b, $c)
{
    sql_connect();
    // geting string from entered by user post where \n is marked with full stop '.'
    $post_arr = comment_to_array($c);
    //$time = date('H:i:s', time()) . ' : ' .date('d-m-Y');// БД ставит автоматически там TIMESTAMP
    $temp = "INSERT INTO comments_articles (article_name, article_comment_title, article_comment_content) " . "VALUES ('" . $a . "', '" . $b . "', '" . $post_arr . "')";
    $temp2 = sql_query($temp);
    //as a result mysql query with query INSERT returns true or false
    if ($temp2) {
        return true;
    } else {
        return false;
    }
}
Example #11
0
function Mysql_Connexion()
{
    $ret_p = sql_connect();
    if (!$ret_p) {
        $Titlesitename = "NPDS";
        if (file_exists("meta/meta.php")) {
            include "meta/meta.php";
        }
        if (file_exists("static/database.txt")) {
            include "static/database.txt";
        }
        die;
    }
    return $ret_p;
}
Example #12
0
function initSoapFunction()
{
    global $opt, $db;
    // init faults
    if (($opt['debug'] & DEBUG_OUTOFSERVICE) == DEBUG_OUTOFSERVICE) {
        return new nusoap_fault(WS_ERR_OUTOFSERVICE_ID, '', WS_ERR_OUTOFSERVICE_STR);
    }
    if ($opt['page']['nusoap_require_https'] == true) {
        if (!isset($_REQUEST['HTTPS'])) {
            return new nusoap_fault(WS_ERR_REQUIRE_HTTPS_ID, '', WS_ERR_REQUIRE_HTTPS_STR);
        }
    }
    if ($db['dblink'] == false) {
        // try connect
        sql_connect(null, null, false);
        if ($db['dblink'] == false) {
            return new nusoap_fault(WS_ERR_DATABASE_CONNECT_ID, '', WS_ERR_DATABASE_CONNECT_STR);
        }
    }
    return false;
}
Example #13
0
/**
 * 执行一行代码(无结果集)
 * @param $sql
 */
function sql_query($sql)
{
    $link = get_connect();
    $r = $link->query($sql);
    if ($r == false) {
        $errno = mysqli_connect_errno();
        if ($errno == 2006) {
            // mysql has gone away, 重新连接一下
            sql_connect();
            $r = $link->query($sql);
            if ($r == false) {
                $GLOBALS['connection'] = null;
                throw new Exception(mysqli_connect_errno . ": " . $errno);
            }
        } else {
            $GLOBALS['connection'] = null;
            throw new Exception(mysqli_connect_errno . ": " . $errno);
        }
    }
    return $r;
}
Example #14
0
/**
 * simplified common.php by wkpark @ gmail.com
 * since 2015/04/29
 */
function g4_get_member()
{
    global $g4, $g5, $g4_root_dir;
    // init
    $member = array();
    if (!defined('G5_VERSION')) {
        include_once "{$g4_root_dir}/lib/constant.php";
        // constants
    }
    include_once "{$g4_root_dir}/lib/common.lib.php";
    // common library
    if (defined('G5_VERSION')) {
        include_once "{$g4_root_dir}/data/dbconfig.php";
        // db configs
    } else {
        include_once "{$g4_root_dir}/dbconfig.php";
        // db configs
    }
    if (defined('G5_VERSION')) {
        $connect_db = sql_connect(G5_MYSQL_HOST, G5_MYSQL_USER, G5_MYSQL_PASSWORD);
        $select_db = sql_select_db(G5_MYSQL_DB, $connect_db);
        $g5['connect_db'] = $connect_db;
        sql_query(" set names utf8 ");
    } else {
        $connect_db = sql_connect($mysql_host, $mysql_user, $mysql_password);
        $select_db = sql_select_db($mysql_db, $connect_db);
    }
    // is it a valid PHPSESSID ?
    if ($_REQUEST['PHPSESSID'] && $_REQUEST['PHPSESSID'] != session_id()) {
        $member['mb_id'] = '';
        return $member;
    }
    // already logged in
    if (!empty($_SESSION['ss_mb_id'])) {
        $member = get_member($_SESSION['ss_mb_id']);
    }
    return $member;
}
Example #15
0
function _saveresult($vlocid, $vlocactive, $vlocname, $vloccity, $vlocplz, $vlocaddress, $vlocphone, $vlocemail, $vlocrealm, $vlcoordinates)
{
    #TODO v5 change to ORM class
    global $dbhost, $dbuname, $dbpass, $dbname;
    if (strlen($vlocid) > 5 && !is_numeric($vlid)) {
        return 0;
    }
    $ad = getdate(time());
    $vfcre_info = $ad[year] . "-" . $ad[mon] . "-" . $ad[mday];
    if (strlen($vlocname) == 0) {
        die("0");
    }
    if (!ereg("([0-9]{1})", $vlocrealm)) {
        die("0");
    }
    $vlocname = strip_tags($vlocname);
    $vloccity = strip_tags($vloccity);
    $vlocplz = strip_tags($vlocplz);
    $vlocaddress = strip_tags($vlocaddress);
    $vlocphone = strip_tags($vlocphone);
    $vlocemail = strip_tags($vlocemail);
    $vlcoordinates = strip_tags($vlcoordinates);
    if (!ereg("([0-1]{1})", $vlocactive)) {
        $vlocactive = 1;
    }
    if ($vlocid > 0) {
        $qry = "update tbllocation set lname=\"{$vlocname}\", lcity=\"{$vloccity}\", lplz=\"{$vlocplz}\", laddress=\"{$vlocaddress}\", lphone=\"{$vlocphone}\",lactive={$vlocactive}, lrealm_id={$vlocrealm},lemail=\"{$vlocemail}\",lcoordinates=\"{$vlcoordinates}\" where id={$vlocid}";
    } else {
        $qry = "insert into tbllocation(id,lname,lcity,lplz,laddress,lphone,lactive,lrealm_id,lemail,lcoordinates) values(0,\"{$vlocname}\",\"{$vloccity}\",\"{$vlocplz}\",\"{$vlocaddress}\",\"{$vlocphone}\",{$vlocactive},{$vlocrealm},\"{$vlocemail}\",\"{$vlcoordinates}\")";
    }
    $dbi = sql_connect($dbhost, $dbuname, $dbpass, $dbname);
    $presult = sql_query("insert into tdsolog values(0,1,'fsaveLocation','{$vfcre_info}','EX: {$qry}')", $dbi);
    echo $qry;
    $presult = sql_query($qry, $dbi);
    //sleep(1);
    echo $presult;
}
Example #16
0
function _saveStatDate($vfid, $vfdate, $vftype, $vfcomment)
{
    global $dbhost, $dbuname, $dbpass, $dbname;
    $ad = getdate(time());
    $vfcre_info = "cre: " . $ad['year'] . "-" . $ad['mon'] . "-" . $ad['mday'];
    $vfdate = strip_tags($vfdate);
    $vfcomment = strip_tags($vfcomment);
    if (strlen($vfdate) < 10) {
        die("0");
    }
    if (!ereg("([0-9]{1,2})", $vftype)) {
        die("0");
    }
    if ($vfid > 0) {
        $qry = "update tbldate set sdate=\"{$vfdate}\", sdesc=\"{$vfcomment}\", scre_info=\"{$vfcre_info}\",sstatcode_id={$vftype} where id={$vfid}";
    } else {
        $qry = "insert into tbldate(id,sdate,sdesc,scre_info,sstatcode_id) values(0,\"{$vfdate}\",\"{$vfcomment}\",\"{$vfcre_info}\",{$vftype})";
    }
    $dbi = sql_connect($dbhost, $dbuname, $dbpass, $dbname);
    $presult = sql_query("insert into tdsolog values(0,1,'fsaveDate','{$vfcre_info}','EX: {$qry}')", $dbi);
    $presult = sql_query($qry, $dbi);
    //sleep(1);
    echo $presult;
}
Example #17
0
# mise a jour de la version 1.0 a 1.1
# -> Traduction du script en anglais "English standard"
# la mise a jour se fait en plusieurs etapes:
# 1. l'utilisateur doit sauvegarder son fichier include/conf.php en local
# 2. suppression des fichiers du serveur
# 3. ajout des nouveaux fichiers
# 4. copie du fichier include/conf.php
# 5. Assistant de mise a jour
# renommage des tables de la base de donnees
$filename = "update_1.0-1.1.txt";
if ($fd = fopen($filename, "r")) {
    $sql_update_database = "";
    $var['nb_table_ok'] = 0;
    $var['nb_table_pbm'] = 0;
    $nb_table = 0;
    $db = sql_connect();
    while (!feof($fd)) {
        $ligne = fgets($fd, 4096);
        $sql_update_database .= $ligne;
        if (eregi(";", $ligne)) {
            $sql_update_database = eregi_replace(";", "", $sql_update_database);
            if (sql_query($sql_update_database)) {
                $var['nb_table_ok']++;
            } else {
                $var['nb_table_pbm']++;
            }
            $sql_update_database = "";
            $nb_table++;
        }
    }
    @fclose($fd);
Example #18
0
$arr_req = get_req();
if (!array_key_exists("Action", $arr_req) || $arr_req["Action"] != "Login") {
    echo "1|错误号:20001,no action!";
} else {
    #req: Action=Login&Account=ggg&Password=jj&Remember=1&_=
    #rsp: 1|错误号:20005,登录名不存在或密码错误!。
    #
    if ($_SESSION["user_name"]) {
        echo "1|OK";
        #header("Location:NewMain.php");
    } else {
        if (!array_key_exists("Account", $arr_req) || !array_key_exists("Password", $arr_req)) {
            echo "1|错误号:20002,没有登录名或密码!";
            exit;
        }
        $mysqli = sql_connect();
        $sql = "select u.id id, user, company_id, comname from user u left join company c on u.company_id=c.id where u.user='******' and u.password='******'";
        $result = $mysqli->query("{$sql}");
        if (!$result) {
            echo "1|错误号:20003,系统异常!";
            exit;
        }
        if ($row = $result->fetch_array()) {
            $_SESSION["user_id"] = $row["id"];
            $_SESSION["user_name"] = $row["user"];
            #$_SESSION["company_id"] = $row["company_id"];
            $_SESSION["user_company"] = $row["comname"];
            #echo $_SESSION["user_id"]." j: ".$_SESSION["user_name"]." ".$_SESSION["user_company"];
            echo "1|OK";
            #header("Location:NewMain.php");
        } else {
Example #19
0
//------------------------------------------------------------------------------//
//  bugs/bugs-og-liste.php                                                      //
//                                                                              //
//  Version 1.00  26/08/12 - DariaNet                                           //
//  Version 1.10  11/10/13 - MaJ liste v2                                       //
//  Version 1.20  10/08/14 - MaJ pgSQL                                          //
//------------------------------------------------------------------------------//
//------------------------------------------------------------------------------ INIT.
include "commun.inc.php";
//------------------------------------------------------------------------------ VAR.
$niveau = $_SESSION['niveau'];
$table = "bug";
$aColumns = array('id_bug', 'cat', 'date_bug', 'auteur', 'id_rubrique', 'b.descr', 'statut', 'statut_descr', 'statut');
$sIndexColumn = "id_bug";
//------------------------------------------------------------------------------ CONNEXION SERVEUR PostgreSQL
$db = sql_connect(SQL_base);
if (!$db) {
    fatal_error("Impossible de se connecter au serveur PostgreSQL.", false);
}
//------------------------------------------------------------------------------ MAIN
$sLimit = "";
// Paging
if (isset($_GET['iDisplayStart']) && $_GET['iDisplayLength'] != '-1') {
    $sLimit = "LIMIT " . pg_escape_string($_GET['iDisplayLength']) . " OFFSET " . pg_escape_string($_GET['iDisplayStart']);
}
$sWhere = "";
// FILTRE
if ($_GET['sSearch'] != "") {
    $sWhere = "AND ( b.descr LIKE '%" . pg_escape_string($_GET['sSearch']) . "%' OR " . "statut_descr LIKE '%" . pg_escape_string($_GET['sSearch']) . "%' )";
}
for ($i = 0; $i < count($aColumns); $i++) {
Example #20
0
    $result['url'] = $http . $_SERVER['SERVER_NAME'] . $port . $user . $root;
    return $result;
}
$g5_path = g5_path();
include_once $g5_path['path'] . '/config.php';
// 설정 파일
unset($g5_path);
//==============================================================================
// 공통
//------------------------------------------------------------------------------
$dbconfig_file = G5_DATA_PATH . '/' . G5_DBCONFIG_FILE;
if (file_exists($dbconfig_file)) {
    include_once $dbconfig_file;
    include_once G5_LIB_PATH . '/common.lib.php';
    // 공통 라이브러리
    $connect_db = sql_connect(G5_MYSQL_HOST, G5_MYSQL_USER, G5_MYSQL_PASSWORD) or die('MySQL Connect Error!!!');
    $select_db = sql_select_db(G5_MYSQL_DB, $connect_db) or die('MySQL DB Error!!!');
    @mysql_query(" set names utf8 ");
    if (defined('G5_MYSQL_SET_MODE') && G5_MYSQL_SET_MODE) {
        @mysql_query("SET SESSION sql_mode = ''");
    }
    if (defined(G5_TIMEZONE)) {
        @mysql_query(" set time_zone = '" . G5_TIMEZONE . "'");
    }
} else {
    ?>

<!doctype html>
<html lang="ko">
<head>
<meta charset="utf-8">
Example #21
0
        $page['first_page'] = "1";
        $page['previous_page'] = $page_num - 1;
    }
    # next page (except on the last one)
    if ($page_num != $nb_page) {
        $page['link_last_page'] = convert_url($url . $nb_page . $end_url);
        $page['link_next_page'] = convert_url($url . ($page_num + 1) . $end_url);
        $page['next_page'] = $page_num + 1;
        $page['last_page'] = $nb_page;
    }
    /******************/
    /* END PAGINATION */
    /******************/
}
$sql_match = sql_replace($sql['match']['select_match_condition'], $var);
$sgbd = sql_connect();
$res_match = sql_query($sql_match);
$nb_ligne = sql_num_rows($res_match);
$page['nb_match'] = $nb_ligne;
if (!$right_user['match_list']) {
    $page['L_message_match'] = $lang['general']['acces_reserve_admin'];
} elseif ($nb_ligne == "0") {
    $page['L_message_match'] = $lang['match']['E_match_not_found'];
} else {
    $i = 0;
    $tmp_date = '';
    while ($ligne = sql_fetch_array($res_match)) {
        $page['match'][$i]['id'] = $ligne['match_id'];
        $page['match'][$i]['club_visitor'] = $ligne['club_visitor_name'];
        $page['match'][$i]['club_home'] = $ligne['club_home_name'];
        $page['match'][$i]['team_visitor'] = "";
Example #22
0
if (!isset($_SESSION['limit'])) {
    @set_pref('limit', false);
}
head('browse');
?>
        <div id="main">
          <h2><?php 
print _("Browse");
?>
</h2>
          <p><?php 
print _("You may browse through the loci and retrieve all related information.");
?>
</p>
<?php 
$sql = sql_connect($config['db']);
$result = sql_query('SELECT a.prefix, a.id, a.name, a.functions, a.status, b.status FROM locus AS a, status AS b WHERE b.lang=\'' . get_pref('language') . '\' AND a.status=b.id' . (get_pref('limit') ? ' AND a.status>0 AND a.status<=' . get_pref('limit') : '') . ' ORDER BY a.name ASC;', $sql);
if (!strlen($r = sql_last_error($sql)) && sql_num_rows($result) > 0) {
    print "          <ul class=\"result locus\">\n";
    while ($row = sql_fetch_row($result)) {
        if (!empty($row[4])) {
            print '            <li><a href="' . $config['server'] . '/locus/L' . decoct($row[0]) . '.' . decoct($row[1]) . '" title="L' . decoct($row[0]) . '.' . decoct($row[1]) . '" class="locus"><span class="name">' . $row[2] . '</span><span class="date"><img src="' . $config['server'] . '/images/status_' . $row[4] . '.png" height="8" width="8" alt="' . $row[5] . '" /></span><span class="description">' . (strlen($row[3]) > 53 ? substr($row[3], 0, 50) . '...' : $row[3]) . "</span></a></li>\n";
        } else {
            print '            <li><span class="name">L' . decoct($row[0]) . '.' . decoct($row[1]) . '</span><span class="description"><em>' . _("Waiting for analyse, GeneID:") . ' ' . $row[2] . "</em></span></li>\n";
        }
    }
    print "          </ul>\n";
} else {
    print '          <p>' . _("no result.") . "</p>\n";
}
?>
Example #23
0
function sql_connect_maintenance()
{
    global $tpl, $db, $opt;
    sql_connect($opt['db']['maintenance_user'], $opt['db']['maintenance_password'], false);
    if ($db['dblink'] === false) {
        sql_disconnect();
        sql_connect();
        if ($db['connected'] == false) {
            $tpl->error(ERROR_DB_COULD_NOT_RECONNECT);
        }
        return false;
    }
    return true;
}
Example #24
0
$mysql_host = $_POST['mysql_host'];
$mysql_user = $_POST['mysql_user'];
$mysql_pass = $_POST['mysql_pass'];
$mysql_db = $_POST['mysql_db'];
$table_prefix = $_POST['table_prefix'];
$admin_id = $_POST['admin_id'];
$admin_pass = $_POST['admin_pass'];
$admin_name = $_POST['admin_name'];
$admin_email = $_POST['admin_email'];
$g5_install = 0;
if (isset($_POST['g5_install'])) {
    $g5_install = $_POST['g5_install'];
}
$g5_shop_prefix = $_POST['g5_shop_prefix'];
$g5_shop_install = $_POST['g5_shop_install'];
$dblink = sql_connect($mysql_host, $mysql_user, $mysql_pass, $mysql_db);
if (!$dblink) {
    ?>

<div class="ins_inner">
    <p>MySQL Host, User, Password 를 확인해 주십시오.</p>
    <div class="inner_btn"><a href="./install_config.php">뒤로가기</a></div>
</div>

<?php 
    include_once './install.inc2.php';
    exit;
}
$select_db = sql_select_db($mysql_db, $dblink);
if (!$select_db) {
    ?>
        return implode(",", $db_supported);
    }
}
if (isset($p['dbGetSupported'])) {
    $res = sql_get_supported();
    if (empty($res)) {
        $res = "error";
    }
    output($res);
} elseif (isset($p['dbType']) && isset($p['dbHost']) && isset($p['dbUser']) && isset($p['dbPass']) && isset($p['dbPort'])) {
    $type = $p['dbType'];
    $host = $p['dbHost'];
    $user = $p['dbUser'];
    $pass = $p['dbPass'];
    $port = $p['dbPort'];
    $con = sql_connect($type, $host, $user, $pass);
    $res = "";
    if ($con !== false) {
        if (isset($p['dbQuery'])) {
            $query = $p['dbQuery'];
            $pagination = "";
            if (isset($p['dbDB']) && isset($p['dbTable'])) {
                $db = trim($p['dbDB']);
                $table = trim($p['dbTable']);
                $start = (int) isset($p['dbStart']) ? trim($p['dbStart']) : 0;
                $limit = (int) isset($p['dbLimit']) ? trim($p['dbLimit']) : 100;
                if ($type == 'mysql') {
                    $query = "SELECT * FROM " . $db . "." . $table . " LIMIT " . $start . "," . $limit . ";";
                } elseif ($type == 'mssql') {
                    $query = "SELECT TOP " . $limit . " * FROM " . $db . ".." . $table . ";";
                } elseif ($type == 'pgsql') {
Example #26
0
<?php

/*
// file fretAllDates
// returns: 	all defined statistic Dates for a simple browse list
// format: 		fid;fdate;fcomment;fcre_info	=> as HttpTextRequest
// syntax: 		fretAllDates.php (no params)
*/
foreach ($HTTP_GET_VARS as $secvalue) {
    if (eregi("<[^>]*script*\"?[^>]*>", $secvalue) or eregi("\\([^>]*.*\"?[^>]*\\)", $secvalue)) {
        die("I don't like you...");
    }
}
require_once "code/config.php";
require_once "includes/sql_layer.php";
$dbi = sql_connect($dbhost, $dbuname, $dbpass, $dbname);
$qry = "select D.id,D.sdate,D.sdesc,D.scre_info,D.sstatcode_id,S.statdesc from tbldate D left join ttypestat S on D.sstatcode_id=S.id order by sdate desc";
$presult = sql_query($qry, $dbi);
$strRET = "";
while ($row = sql_fetch_row($presult, $dbi)) {
    foreach ($row as $v) {
        $strRET = $strRET . "{$v};";
    }
    $strRET = $strRET . "<br>";
}
header('Content-Type: application/xhtml+xml; charset=ISO-8859-1');
echo $strRET;
require_once realpath(__DIR__ . '/../includes/helper/session_helper.php');
require_once realpath(__DIR__ . '/../includes/mailer/shifts_mailer.php');
require_once realpath(__DIR__ . '/../config/config.default.php');
if (file_exists(realpath(__DIR__ . '/../config/config.php'))) {
    require_once realpath(__DIR__ . '/../config/config.php');
}
require_once realpath(__DIR__ . '/../includes/pages/admin_active.php');
require_once realpath(__DIR__ . '/../includes/pages/admin_arrive.php');
require_once realpath(__DIR__ . '/../includes/pages/admin_free.php');
require_once realpath(__DIR__ . '/../includes/pages/admin_groups.php');
require_once realpath(__DIR__ . '/../includes/pages/admin_import.php');
require_once realpath(__DIR__ . '/../includes/pages/admin_log.php');
require_once realpath(__DIR__ . '/../includes/pages/admin_questions.php');
require_once realpath(__DIR__ . '/../includes/pages/admin_rooms.php');
require_once realpath(__DIR__ . '/../includes/pages/admin_shifts.php');
require_once realpath(__DIR__ . '/../includes/pages/admin_user.php');
require_once realpath(__DIR__ . '/../includes/pages/guest_login.php');
require_once realpath(__DIR__ . '/../includes/pages/user_messages.php');
require_once realpath(__DIR__ . '/../includes/pages/user_myshifts.php');
require_once realpath(__DIR__ . '/../includes/pages/user_news.php');
require_once realpath(__DIR__ . '/../includes/pages/user_questions.php');
require_once realpath(__DIR__ . '/../includes/pages/user_settings.php');
require_once realpath(__DIR__ . '/../includes/pages/user_shifts.php');
require_once realpath(__DIR__ . '/../vendor/parsedown/Parsedown.php');
if (!defined('PHPUNIT_TESTSUITE')) {
    session_lifetime(24 * 60, preg_replace("/[^a-z0-9-]/", '', md5(__DIR__)));
}
session_start();
gettext_init();
sql_connect($config['host'], $config['user'], $config['pw'], $config['db']);
load_auth();
Example #28
0
function pDataConnect()
{
    $connection = sql_connect("127.0.0.1", $_SESSION["localUser"], $_SESSION["localPass"]);
    sql_select_db($_SESSION["pDatabase"], $connection);
    return $connection;
}
function db_update($table, $fields, $pk = '', $show_query = 0)
{
    // ej: $err=db_update('users',array('pass','user_name'),('id','id2'),1);
    // include("conexion.php");
    if ($pk != '') {
        $query = 'update ' . $table . ' set ';
        $total_fields_pk = count($pk);
        $cant_fields_pk = 1;
    } else {
        $query = 'insert ignore into ' . $table . ' set ';
    }
    $total_fields = count($fields);
    $cant_fields = 1;
    foreach ($fields as $field => $field_value) {
        if ($field == 'pass' || $field == 'password') {
            $query .= $field . " = '" . md5(cleanQuery($field_value)) . "' ";
        } else {
            $query .= $field . " = '" . cleanQuery($field_value) . "' ";
        }
        if ($total_fields != $cant_fields) {
            $query .= ' , ';
        }
        $cant_fields++;
    }
    if ($pk != '') {
        $query .= ' where ';
        foreach ($pk as $field => $field_value) {
            $query .= $field . " = '" . cleanQuery($field_value) . "' ";
            if ($total_fields_pk != $cant_fields_pk) {
                $query .= ' and ';
            }
            $cant_fields_pk++;
        }
    }
    if ($show_query != 0) {
        echo $query . '<br />';
    }
    //file_put_contents('request.txt', $query, FILE_APPEND);
    sql_connect();
    if (mysql_query($query)) {
        return mysql_insert_id();
        sql_disconnect();
    } else {
        return mysql_insert_id();
        sql_disconnect();
    }
}
                    unlink($apathtmp);
                }
            }
            if (file_exists($apath)) {
                # Update the database with the new file details.
                $file_size = filesize_unlimited($apath);
                # SQL Connection may have hit a timeout
                sql_connect();
                sql_query("update resource_alt_files set file_name='" . escape_check($ffmpeg_alternatives[$n]["filename"] . "." . $ffmpeg_alternatives[$n]["extension"]) . "',file_extension='" . escape_check($ffmpeg_alternatives[$n]["extension"]) . "',file_size='" . $file_size . "',creation_date=now() where ref='{$aref}'");
                // add this filename to be added to resource.ffmpeg_alt_previews
                if (isset($ffmpeg_alternatives[$n]['alt_preview']) && $ffmpeg_alternatives[$n]['alt_preview'] == true) {
                    $ffmpeg_alt_previews[] = basename($apath);
                }
            }
        }
        /*// update the resource table with any ffmpeg_alt_previews	
        		if (count($ffmpeg_alt_previews)>0){
        			$ffmpeg_alternative_previews=implode(",",$ffmpeg_alt_previews);
        			sql_query("update resource set ffmpeg_alt_previews='".escape_check($ffmpeg_alternative_previews)."' where ref='$ref'");
        		}
        		*/
    }
}
if (RUNNING_ASYNC) {
    # SQL Connection may have hit a timeout
    sql_connect();
    sql_query("UPDATE resource SET is_transcoding = 0 WHERE ref = '" . escape_check($ref) . "'");
    if ($previewonly) {
        unlink($file);
    }
}