当前位置: 首页>>代码示例>>PHP>>正文


PHP exec_query函数代码示例

本文整理汇总了PHP中exec_query函数的典型用法代码示例。如果您正苦于以下问题:PHP exec_query函数的具体用法?PHP exec_query怎么用?PHP exec_query使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了exec_query函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: gen_page_dynamic_data

function gen_page_dynamic_data(&$tpl, &$sql, $mail_id)
{
    global $cfg;
    if (isset($_POST['uaction']) && $_POST['uaction'] === 'enable_arsp') {
        if ($_POST['arsp_message'] === '') {
            $tpl->assign('ARSP_MESSAGE', '');
            set_page_message(tr('Please type your mail autorespond message!'));
            return;
        }
        $arsp_message = $_POST['arsp_message'];
        $item_change_status = $cfg['ITEM_CHANGE_STATUS'];
        check_for_lock_file();
        $query = <<<SQL_QUERY
            update
                mail_users
            set
                status = ?,
                mail_auto_respond = ?
            where
                mail_id = ?
SQL_QUERY;
        $rs = exec_query($sql, $query, array($item_change_status, $arsp_message, $mail_id));
        send_request();
        write_log($_SESSION['user_logged'] . " : add mail autorsponder");
        set_page_message(tr('Mail account scheduler for modification!'));
        header("Location: email_accounts.php");
        exit(0);
    } else {
        $tpl->assign('ARSP_MESSAGE', '');
    }
}
开发者ID:BackupTheBerlios,项目名称:vhcs-svn,代码行数:31,代码来源:enable_mail_arsp.php

示例2: get_user_gui_props

function get_user_gui_props(&$sql, $user_id)
{
    global $cfg;
    $query = <<<SQL_QUERY
        select
            lang, layout
        from
            user_gui_props
        where
            user_id = ?
SQL_QUERY;
    $rs = exec_query($sql, $query, array($user_id));
    if ($rs->RecordCount() == 0) {
        // values for user id
        // some default staff
        return array($cfg['USER_INITIAL_LANG'], $cfg['USER_INITIAL_THEME_COLOR']);
    } else {
        if ($rs->fields['lang'] === '' && $rs->fields['layout'] === '') {
            return array($cfg['USER_INITIAL_LANG'], $cfg['USER_INITIAL_THEME_COLOR']);
        } else {
            if ($rs->fields['lang'] === '') {
                return array($cfg['USER_INITIAL_LANG'], $rs->fields['layout']);
            } else {
                if ($rs->fields['layout'] === '') {
                    return array($rs->fields['lang'], $cfg['USER_INITIAL_THEME_COLOR']);
                } else {
                    if ($rs->fields['layout'] === 'blue' || $rs->fields['layout'] === 'green' || $rs->fields['layout'] === 'red' || $rs->fields['layout'] === 'yellow') {
                        return array($rs->fields['lang'], $rs->fields['layout']);
                    }
                }
            }
        }
    }
    return array($rs->fields['lang'], $cfg['USER_INITIAL_THEME_COLOR']);
}
开发者ID:BackupTheBerlios,项目名称:vhcs-svn,代码行数:35,代码来源:layout-functions.php

示例3: update_server_settings

/**
 * @todo What's about the outcommented code?
 */
function update_server_settings()
{
    $sql = EasySCP_Registry::get('Db');
    if (!isset($_POST['uaction']) && !isset($_POST['uaction'])) {
        return;
    }
    /*global $data;
    	$match = array();
    	preg_match("/^(-1|0|[1-9][0-9]*)$/D", $data, $match);*/
    $max_traffic = clean_input($_POST['max_traffic']);
    $traffic_warning = $_POST['traffic_warning'];
    if (!is_numeric($max_traffic) || !is_numeric($traffic_warning)) {
        set_page_message(tr('Wrong data input!'), 'warning');
    }
    if ($traffic_warning > $max_traffic) {
        set_page_message(tr('Warning traffic is bigger than max traffic!'), 'warning');
        return;
    }
    if ($max_traffic < 0) {
        $max_traffic = 0;
    }
    if ($traffic_warning < 0) {
        $traffic_warning = 0;
    }
    $query = "\n\t\tUPDATE\n\t\t\t`straff_settings`\n\t\tSET\n\t\t\t`straff_max` = ?,\n\t\t\t`straff_warn` = ?\n\t";
    exec_query($sql, $query, array($max_traffic, $traffic_warning));
    set_page_message(tr('Server traffic settings updated successfully!'), 'success');
}
开发者ID:gOOvER,项目名称:EasySCP,代码行数:31,代码来源:settings_server_traffic.php

示例4: cli_getMailData

/**
 * Get mail data
 *
 * @throws iMSCP_Exception in case data are not found
 * @param string $domainName Domain name
 * @return array Array which contains mail data
 */
function cli_getMailData($domainName)
{
    static $data = array();
    if (!array_key_exists($domainName, $data)) {
        $stmt = exec_query('SELECT domain_id FROM domain WHERE domain_name = ?', $domainName);
        if ($stmt->rowCount()) {
            $row = $stmt->fetchRow(PDO::FETCH_ASSOC);
            $data[$domainName] = array('domain_id' => $row['domain_id'], 'sub_id' => '0', 'mail_type' => MT_NORMAL_MAIL);
        } else {
            $stmt = exec_query("\n\t\t\t\t\tSELECT\n\t\t\t\t\t\tdomain_id, subdomain_id\n\t\t\t\t\tFROM\n\t\t\t\t\t\tsubdomain\n\t\t\t\t\tINNER JOIN\n\t\t\t\t\t\tdomain USING(domain_id)\n\t\t\t\t\tWHERE\n\t\t\t\t\t\tCONCAT(subdomain_name, '.', domain_name) = ?\n\t\t\t\t", $domainName);
            if ($stmt->rowCount()) {
                $row = $stmt->fetchRow(PDO::FETCH_ASSOC);
                $data[$domainName] = array('domain_id' => $row['domain_id'], 'sub_id' => $row['subdomain_id'], 'mail_type' => MT_SUBDOM_MAIL);
            } else {
                $stmt = exec_query('SELECT domain_id FROM domain_aliasses WHERE alias_name = ?', $domainName);
                if ($stmt->rowCount()) {
                    $row = $stmt->fetchRow(PDO::FETCH_ASSOC);
                    $data[$domainName] = array('domain_id' => $row['domain_id'], 'sub_id' => '0', 'mail_type' => MT_ALIAS_MAIL);
                } else {
                    $stmt = exec_query("\n\t\t\t\t\t\t\tSELECT\n\t\t\t\t\t\t\t\tdomain_id, subdomain_alias_id\n\t\t\t\t\t\t\tFROM\n\t\t\t\t\t\t\t\tsubdomain_alias\n\t\t\t\t\t\t\tINNER JOIN\n\t\t\t\t\t\t\t\tdomain_aliasses USING(alias_id)\n\t\t\t\t\t\t\tINNER JOIN\n\t\t\t\t\t\t\t\tdomain USING(domain_id)\n\t\t\t\t\t\t\tWHERE\n\t\t\t\t\t\t\t\tCONCAT(subdomain_alias_name, '.', alias_name) = ?\n\t\t\t\t\t\t", $domainName);
                    if ($stmt->rowCount()) {
                        $row = $stmt->fetchRow(PDO::FETCH_ASSOC);
                        $data[$domainName] = array('domain_id' => $row['domain_id'], 'sub_id' => $row['subdomain_alias_id'], 'mail_type' => MT_ALSSUB_MAIL);
                    } else {
                        $data[$domainName] = null;
                    }
                }
            }
        }
    }
    if ($data[$domainName] !== null) {
        return $data[$domainName];
    }
    throw new iMSCP_Exception('This script can only add mail accounts for domains which are already managed by i-MSCP.');
}
开发者ID:svenjantzen,项目名称:imscp,代码行数:42,代码来源:imscp_mail_from_csv.php

示例5: gen_db_list

function gen_db_list(&$tpl, &$sql, $user_id)
{
    $dmn_id = get_user_domain_id($sql, $user_id);
    $query = <<<SQL_QUERY
        select
            sqld_id, sqld_name
        from
            sql_database
        where
            domain_id = ?
        order by
            sqld_name
SQL_QUERY;
    $rs = exec_query($sql, $query, array($dmn_id));
    if ($rs->RecordCount() == 0) {
        set_page_message(tr('Database list is empty!'));
        $tpl->assign('DB_LIST', '');
    } else {
        while (!$rs->EOF) {
            $db_id = $rs->fields['sqld_id'];
            $db_name = $rs->fields['sqld_name'];
            gen_db_user_list($tpl, $sql, $db_id);
            $tpl->assign(array('DB_ID' => "{$db_id}", 'DB_NAME' => "{$db_name}"));
            $tpl->parse('DB_LIST', '.db_list');
            $rs->MoveNext();
        }
    }
}
开发者ID:BackupTheBerlios,项目名称:vhcs-svn,代码行数:28,代码来源:manage_sql.php

示例6: construire_tableau

function construire_tableau($theme = 0, $pertinence = 0, $diff = 0, $nbQuestions)
{
    $connexion = connect($host, $port, $user, $password, $database);
    //On récupère un recordset correspondant aux critères
    $query = "SELECT Q.noq, Q.question, Q.reponse " . "FROM questions Q";
    /* ", sujets S, themes T, pertinences P, difficultes D ".
    	"WHERE Q.noq = S.noq AND S.theme = T.theme AND ".
    	"S.pertinence = P.pertinence AND S.difficulte = D.difficulte".
    	"AND S.theme = ". $theme ." AND S.pertinence = ". $pertinence ." AND S.difficulte = ". $diff .";";
    */
    $result = exec_query($connexion, $query);
    $Nbr = numrows($result);
    echo "Nombre d'enregistrements : " . $Nbr . "<BR>";
    //Organisation aléatoire des questions
    $ints = range(0, $Nbr - 1);
    srand(time());
    shuffle($ints);
    if ($Nbr < $nbQuestions) {
        $nbQuestions = $Nbr;
    }
    // On construit le tableau permettant de trier aléatoirement
    for ($i = 0; $i < $nbQuestions && ($row = fetch_array($result, $ints[$i])); $i++) {
        echo "libelle Q : " . $row[1] . "<BR>";
        $tabQ[$i][0] = $row[0];
        // recuperation du numero,
        $tabQ[$i][1] = $row[1];
        // du libelle,
        $tabQ[$i][2] = $row[2];
        // de la reponse a la question
    }
    close($connexion);
    return $tabQ;
}
开发者ID:pierrechtux,项目名称:QCV,代码行数:33,代码来源:script_qcm.php

示例7: gen_htaccess_entries

function gen_htaccess_entries(&$tpl, &$sql, &$dmn_id)
{
    $query = <<<SQL_QUERY
        select
            *
        from
            htaccess
        where
             dmn_id = ?
SQL_QUERY;
    $rs = exec_query($sql, $query, array($dmn_id));
    if ($rs->RecordCount() == 0) {
        $tpl->assign('PROTECTED_AREAS', '');
        set_page_message(tr('You do not have protected areas'));
    } else {
        $counter = 0;
        while (!$rs->EOF) {
            if ($counter % 2 == 0) {
                $tpl->assign('CLASS', 'content');
            } else {
                $tpl->assign('CLASS', 'content2');
            }
            $id = $rs->fields['id'];
            $user_id = $rs->fields['user_id'];
            $group_id = $rs->fields['group_id'];
            $status = $rs->fields['status'];
            $path = $rs->fields['path'];
            $auth_name = $rs->fields['auth_name'];
            $tpl->assign(array('AREA_NAME' => $auth_name, 'AREA_PATH' => $path, 'PID' => $id, 'STATUS' => translate_dmn_status($status)));
            $tpl->parse('DIR_ITEM', '.dir_item');
            $rs->MoveNext();
            $counter++;
        }
    }
}
开发者ID:BackupTheBerlios,项目名称:vhcs-svn,代码行数:35,代码来源:protected_areas.php

示例8: client_updateHtaccessUser

/**
 * Updates htaccess user.
 *
 * @param int $dmn_id Domain unique identifier
 * @param int $uuser_id Htaccess user unique identifier
 * @return
 */
function client_updateHtaccessUser(&$dmn_id, &$uuser_id)
{
    if (isset($_POST['uaction']) && $_POST['uaction'] == 'modify_user') {
        // we have to add the user
        if (isset($_POST['pass']) && isset($_POST['pass_rep'])) {
            if (!checkPasswordSyntax($_POST['pass'])) {
                return;
            }
            if ($_POST['pass'] !== $_POST['pass_rep']) {
                set_page_message(tr("Passwords do not match."), 'error');
                return;
            }
            $nadmin_password = cryptPasswordWithSalt($_POST['pass'], generateRandomSalt(true));
            $change_status = 'tochange';
            $query = "\n\t\t\t\tUPDATE\n\t\t\t\t\t`htaccess_users`\n\t\t\t\tSET\n\t\t\t\t\t`upass` = ?, `status` = ?\n\t\t\t\tWHERE\n\t\t\t\t\t`dmn_id` = ?\n\t\t\t\tAND\n\t\t\t\t\t`id` = ?\n\t\t\t";
            exec_query($query, array($nadmin_password, $change_status, $dmn_id, $uuser_id));
            send_request();
            $query = "\n\t\t\t\tSELECT\n\t\t\t\t\t`uname`\n\t\t\t\tFROM\n\t\t\t\t\t`htaccess_users`\n\t\t\t\tWHERE\n\t\t\t\t\t`dmn_id` = ?\n\t\t\t\tAND\n\t\t\t\t\t`id` = ?\n\t\t\t";
            $rs = exec_query($query, array($dmn_id, $uuser_id));
            $uname = $rs->fields['uname'];
            $admin_login = $_SESSION['user_logged'];
            write_log("{$admin_login}: updated htaccess user ID: {$uname}", E_USER_NOTICE);
            redirectTo('protected_user_manage.php');
        }
    } else {
        return;
    }
}
开发者ID:svenjantzen,项目名称:imscp,代码行数:35,代码来源:protected_user_edit.php

示例9: padd_group

function padd_group($tpl, $sql, $dmn_id)
{
    $cfg = EasySCP_Registry::get('Config');
    if (isset($_POST['uaction']) && $_POST['uaction'] == 'add_group') {
        // we have to add the group
        if (isset($_POST['groupname'])) {
            if (!validates_username($_POST['groupname'])) {
                set_page_message(tr('Invalid group name!'), 'warning');
                return;
            }
            $groupname = $_POST['groupname'];
            $query = "\n\t\t\t\tSELECT\n\t\t\t\t\t`id`\n\t\t\t\tFROM\n\t\t\t\t\t`htaccess_groups`\n\t\t\t\tWHERE\n\t\t\t\t\t`ugroup` = ?\n\t\t\t\tAND\n\t\t\t\t\t`dmn_id` = ?\n\t\t\t";
            $rs = exec_query($sql, $query, array($groupname, $dmn_id));
            if ($rs->recordCount() == 0) {
                $change_status = $cfg->ITEM_ADD_STATUS;
                $query = "\n\t\t\t\t\tINSERT INTO `htaccess_groups`\n\t\t\t\t\t\t(`dmn_id`, `ugroup`, `status`)\n\t\t\t\t\tVALUES\n\t\t\t\t\t\t(?, ?, ?)\n\t\t\t\t";
                exec_query($sql, $query, array($dmn_id, $groupname, $change_status));
                send_request();
                $admin_login = $_SESSION['user_logged'];
                write_log("{$admin_login}: add group (protected areas): {$groupname}");
                user_goto('protected_user_manage.php');
            } else {
                set_page_message(tr('Group already exists!'), 'error');
                return;
            }
        } else {
            set_page_message(tr('Invalid group name!'), 'error');
            return;
        }
    } else {
        return;
    }
}
开发者ID:gOOvER,项目名称:EasySCP,代码行数:33,代码来源:protected_group_add.php

示例10: update_password

function update_password()
{
    global $sql;
    if (isset($_POST['uaction']) && $_POST['uaction'] === 'updt_pass') {
        if (!vhcs_password_check($_POST['pass'], 20)) {
            set_page_message(tr('Incorrect password range or syntax!'));
        } else {
            if ($_POST['pass'] === '' || $_POST['pass_rep'] === '') {
                set_page_message(tr('Please fill up both data fields!'));
            } else {
                if ($_POST['pass'] !== $_POST['pass_rep']) {
                    set_page_message(tr('Passwords does not match!'));
                } else {
                    $upass = crypt_user_pass($_POST['pass']);
                    $user_id = $_SESSION['user_id'];
                    $query = <<<SQL_QUERY
                update
                    admin
                set
                    admin_pass = ?
                where
                    admin_id = ?
SQL_QUERY;
                    $rs = exec_query($sql, $query, array($upass, $user_id));
                    set_page_message(tr('User password updated successfully!'));
                }
            }
        }
    }
}
开发者ID:BackupTheBerlios,项目名称:vhcs-svn,代码行数:30,代码来源:change_password.php

示例11: gen_user_sessions

function gen_user_sessions(&$tpl, &$sql)
{
    $query = <<<SQL_QUERY
                select
                    *
                from
                    login
SQL_QUERY;
    $rs = exec_query($sql, $query, array());
    $row = 1;
    while (!$rs->EOF) {
        if ($row++ % 2 == 0) {
            $tpl->assign(array('ADMIN_CLASS' => 'content2'));
        } else {
            $tpl->assign(array('ADMIN_CLASS' => 'content'));
        }
        $tpl->assign(array('ADMIN_USERNAME' => $rs->fields['session_id'], 'LOGIN_TIME' => date("G:i:s", $rs->fields['lastaccess'])));
        if ($_SESSION['user_logged'] === $rs->fields['session_id']) {
            $tpl->assign('KILL_LINK', 'manage_sessions.php');
        } else {
            $tpl->assign('KILL_LINK', 'manage_sessions.php?kill=' . $rs->fields['session_id']);
        }
        $tpl->parse('USER_SESSION', '.user_session');
        $rs->MoveNext();
    }
}
开发者ID:BackupTheBerlios,项目名称:vhcs-svn,代码行数:26,代码来源:manage_sessions.php

示例12: client_generatePageLists

/**
 * client_generatePageLists.
 *
 * @param iMSCP_pTemplate $tpl Template engine instance
 * @return void
 */
function client_generatePageLists($tpl)
{
    $domainProperties = get_domain_default_props($_SESSION['user_id']);
    $stmt = exec_query('SELECT created_by FROM admin WHERE admin_id = ?', $_SESSION['user_id']);
    $software_poss = gen_software_list($tpl, $domainProperties['domain_id'], $stmt->fields['created_by']);
    $tpl->assign('TOTAL_SOFTWARE_AVAILABLE', $software_poss);
}
开发者ID:svenjantzen,项目名称:imscp,代码行数:13,代码来源:software.php

示例13: getListOfBuyClicks

function getListOfBuyClicks($dt)
{
    global $mycatid;
    $str = "";
    $lnk = dbConnect('localhost', 'root', 'lyntik');
    $query = "SELECT b.fdate as fdate,b.ip as cip,b.goodid as gid,b.name as sname,b.source as src,b.price as price  FROM buylog b WHERE b.date='{$dt}' AND b.mycat_id={$mycatid} ORDER BY b.ip,b.fdate";
    $res = exec_query($query);
    $ip = "0.0.0.0";
    $i = 0;
    $str .= "<div class=\"all_clicks\">";
    $str .= "<div class=\"click_row_title\">\n             <div class=\"left click_date title\">Дата</div>\n             <div class=\"left click_id title\">ID товара</div>\n             <div class=\"left click_name title\">Наименование</div>\n             <div class=\"left click_id title\">Цена</div>\n             <div class=\"left click_name title\">Источник</div>\n             " . closeFloat() . "\n            </div>";
    if (mysql_num_rows($res) == 0) {
        $str .= "<div>За выбранную дату нажатий не было</div>";
    } else {
        while ($rows = fetch_array($res)) {
            if ($ip != $rows['cip']) {
                $ip = $rows['cip'];
                if ($i != 0) {
                    $str .= "</div>";
                }
                $str .= "<div class=\"ipclicks\">";
                $str .= "<div class=\"client_ip\">Клики с адреса:<b>" . $rows['cip'] . "</b></div>";
            }
            $str .= "<div class=\"click_row\">\n             <div class=\"left click_date\">" . $rows['fdate'] . "</div>\n             <div class=\"left click_id\">" . $rows['gid'] . "</div>\n             <div class=\"left click_name\">" . $rows['sname'] . "</div>\n             <div class=\"left click_id\">" . $rows['price'] . "</div>\n             <div class=\"left click_name\">" . $rows['src'] . "</div>\n             " . closeFloat() . "\n            </div>";
        }
        $str .= "</div>";
    }
    $str .= "</div></div>";
    mysql_free_result($res);
    dbDisconnect($lnk);
    return $str;
}
开发者ID:xent1986,项目名称:ychebgit,代码行数:32,代码来源:myhist.php

示例14: scheduleBackupRestoration

/**
 * Schedule backup restoration.
 *
 * @param int $userId Customer unique identifier
 * @return void
 */
function scheduleBackupRestoration($userId)
{
    exec_query("UPDATE `domain` SET `domain_status` = ? WHERE `domain_admin_id` = ?", array('torestore', $userId));
    send_request();
    write_log($_SESSION['user_logged'] . ": scheduled backup restoration.", E_USER_NOTICE);
    set_page_message(tr('Backup has been successfully scheduled for restoration.'), 'success');
}
开发者ID:svenjantzen,项目名称:imscp,代码行数:13,代码来源:backup.php

示例15: send_user_message

function send_user_message(&$sql, $user_id, $reseller_id)
{
    if (!isset($_POST['uaction'])) {
        return;
    }
    if ($_POST['subj'] === '') {
        set_page_message(tr('Please specify message subject!'));
        return;
    }
    if ($_POST['user_message'] === '') {
        set_page_message(tr('Please type your message!'));
        return;
    }
    $ticket_date = time();
    $urgency = $_POST['urgency'];
    $subj = $_POST['subj'];
    $user_message = preg_replace("/\n/", "<br>", $_POST["user_message"]);
    $ticket_status = 1;
    $ticket_reply = 0;
    $ticket_level = 1;
    $query = <<<SQL_QUERY
        insert into tickets
            (ticket_level, ticket_from, ticket_to,
             ticket_status, ticket_reply, ticket_urgency,
             ticket_date, ticket_subject, ticket_message)
        values
            (?, ?, ?, ?, ?, ?, ?, ?, ?)
SQL_QUERY;
    $rs = exec_query($sql, $query, array($ticket_level, $user_id, $reseller_id, $ticket_status, $ticket_reply, $urgency, $ticket_date, htmlspecialchars($subj, ENT_QUOTES, "UTF-8"), htmlspecialchars($user_message, ENT_QUOTES, "UTF-8")));
    send_tickets_msg($reseller_id, $user_id, $subj);
    set_page_message(tr('Your message was sent!'));
    header("Location: support_system.php");
    exit(0);
}
开发者ID:BackupTheBerlios,项目名称:vhcs-svn,代码行数:34,代码来源:new_ticket.php


注:本文中的exec_query函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。