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


PHP dbi_query函数代码示例

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


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

示例1: delete_palm_events

function delete_palm_events($login)
{
    $res = dbi_query("SELECT cal_id FROM webcal_import_data " . "WHERE cal_login = '{$login}'");
    if ($res) {
        while ($row = dbi_fetch_row($res)) {
            dbi_query("DELETE FROM webcal_entry_user WHERE cal_id = {$row['0']}");
            dbi_query("DELETE FROM webcal_entry_repeats WHERE cal_id = {$row['0']}");
            dbi_query("DELETE FROM webcal_entry_repeats_not WHERE cal_id = {$row['0']}");
            dbi_query("DELETE FROM webcal_entry_log WHERE cal_entry_id = {$row['0']}");
            dbi_query("DELETE FROM webcal_site_extras WHERE cal_id = {$row['0']}");
            dbi_query("DELETE FROM webcal_reminder_log WHERE cal_id = {$row['0']}");
            dbi_query("DELETE FROM webcal_import_data WHERE cal_id = {$row['0']}");
            dbi_query("DELETE FROM webcal_entry WHERE cal_id = {$row['0']}");
        }
    }
    dbi_free_result($res);
    return 1;
}
开发者ID:BackupTheBerlios,项目名称:fhnreposit,代码行数:18,代码来源:import_palmdesktop.php

示例2: doDbSanityCheck

function doDbSanityCheck()
{
    global $db_login, $db_host, $db_database;
    $res = @dbi_query("SELECT COUNT(cal_value) FROM webcal_config", false, false);
    if ($res) {
        if ($row = dbi_fetch_row($res)) {
            // Found database.  All is peachy.
            dbi_free_result($res);
        } else {
            // Error accessing table.
            // User has wrong db name or has not created tables.
            // Note: cannot translate this since we have not included
            // translate.php yet.
            dbi_free_result($res);
            die_miserable_death("Error finding WebCalendar tables in database '{$db_database}' " . "using db login '{$db_login}' on db server '{$db_host}'.<br/><br/>\n" . "Have you created the database tables as specified in the " . "<a href=\"docs/WebCalendar-SysAdmin.html\" target=\"other\">WebCalendar " . "System Administrator's Guide</a>?");
        }
    } else {
        // Error accessing table.
        // User has wrong db name or has not created tables.
        // Note: cannot translate this since we have not included translate.php yet.
        die_miserable_death("Error finding WebCalendar tables in database '{$db_database}' " . "using db login '{$db_login}' on db server '{$db_host}'.<br/><br/>\n" . "Have you created the database tables as specified in the " . "<a href=\"docs/WebCalendar-SysAdmin.html\" target=\"other\">WebCalendar " . "System Administrator's Guide</a>?");
    }
}
开发者ID:noikiy,项目名称:owaspbwa,代码行数:23,代码来源:validate.php

示例3: translate

        if ($nlastname) {
            $sql .= " cal_lastname = '{$nlastname}', ";
        }
        if ($nfirstname) {
            $sql .= " cal_firstname = '{$nfirstname}', ";
        }
        $sql .= "cal_admin = '{$nadmin}' WHERE cal_login = '{$nid}'";
        if (!dbi_query($sql)) {
            $error = translate("Database error") . ": " . dbi_error();
        }
    } else {
        // Adding
        if (preg_match("/^[\\w]+\$/", $nid)) {
            $nid = $NONUSER_PREFIX . $nid;
            $sql = "INSERT INTO webcal_nonuser_cals " . "( cal_login, cal_firstname, cal_lastname, cal_admin ) " . "VALUES ( '{$nid}', '{$nfirstname}', '{$nlastname}', '{$nadmin}' )";
            if (!dbi_query($sql)) {
                $error = translate("Database error") . ": " . dbi_error();
            }
        } else {
            $error = translate("Calendar ID") . " " . translate("word characters only") . ".";
        }
    }
}
if (!empty($error)) {
    print_header('', '', '', true);
    ?>

<h2><?php 
    etranslate("Error");
    ?>
</h2>
开发者ID:neymanna,项目名称:fusionforge,代码行数:31,代码来源:edit_nonusers_handler.php

示例4: list_unapproved

function list_unapproved($user)
{
    global $temp_fullname, $key, $login;
    //echo "Listing events for $user <BR>";
    echo "<UL>\n";
    $sql = "SELECT webcal_entry.cal_id, webcal_entry.cal_name, " . "webcal_entry.cal_description, " . "webcal_entry.cal_priority, webcal_entry.cal_date, " . "webcal_entry.cal_time, webcal_entry.cal_duration, " . "webcal_entry_user.cal_status " . "FROM webcal_entry, webcal_entry_user " . "WHERE webcal_entry.cal_id = webcal_entry_user.cal_id " . "AND ( webcal_entry.cal_ext_for_id IS NULL " . "OR webcal_entry.cal_ext_for_id = 0 ) AND " . "webcal_entry_user.cal_login = '{$user}' AND " . "webcal_entry_user.cal_status = 'W' " . "ORDER BY webcal_entry.cal_date";
    $res = dbi_query($sql);
    $count = 0;
    $eventinfo = "";
    if ($res) {
        while ($row = dbi_fetch_row($res)) {
            $key++;
            $id = $row[0];
            $name = $row[1];
            $description = $row[2];
            $pri = $row[3];
            $date = $row[4];
            $time = $row[5];
            $duration = $row[6];
            $status = $row[7];
            $divname = "eventinfo-{$id}-{$key}";
            echo "<LI><A CLASS=\"entry\" HREF=\"view_entry.php?id={$id}";
            echo "\" onMouseOver=\"window.status='" . translate("View this entry") . "'; show(event, '{$divname}'); return true;\" onMouseOut=\"hide('{$divname}'); return true;\">";
            $timestr = "";
            if ($time > 0) {
                $timestr = display_time($time);
                if ($duration > 0) {
                    // calc end time
                    $h = (int) ($time / 10000);
                    $m = $time / 100 % 100;
                    $m += $duration;
                    $d = $duration;
                    while ($m >= 60) {
                        $h++;
                        $m -= 60;
                    }
                    $end_time = sprintf("%02d%02d00", $h, $m);
                    $timestr .= " - " . display_time($end_time);
                }
            }
            echo htmlspecialchars($name);
            echo "</A>";
            echo " (" . date_to_str($date) . ")\n";
            echo ": <A HREF=\"approve_entry.php?id={$id}&ret=list";
            if ($user == "__public__") {
                echo "&public=1";
            }
            echo "\" CLASS=\"navlinks\" onClick=\"return confirm('" . translate("Approve this entry?") . "');\">" . translate("Approve/Confirm") . "</A>, ";
            echo "<A HREF=\"reject_entry.php?id={$id}&ret=list";
            if ($user == "__public__") {
                echo "&public=1";
            }
            echo "\" CLASS=\"navlinks\" onClick=\"return confirm('" . translate("Reject this entry?") . "');\">" . translate("Reject") . "</A>";
            $eventinfo .= build_event_popup($divname, $user, $description, $timestr, $time);
            $count++;
        }
        dbi_free_result($res);
    }
    echo "</UL><P>\n";
    if ($count == 0) {
        user_load_variables($user, "temp_");
        echo translate("No unapproved events for") . " " . $temp_fullname . ".";
    } else {
        echo $eventinfo;
    }
}
开发者ID:neuroidss,项目名称:virtuoso-opensource,代码行数:66,代码来源:list_unapproved.php

示例5: dbi_free_result

                    $id++;
                    dbi_free_result($res);
                    $sql = "INSERT INTO webcal_group " . "( cal_group_id, cal_owner, cal_name, cal_last_update ) VALUES ( " . "{$id}, '{$login}', '{$groupname}', {$date} )";
                    if (!dbi_query($sql)) {
                        $error = translate("Database error") . ": " . dbi_error();
                    }
                } else {
                    $error = translate("Database error") . ": " . dbi_error();
                }
            }
        }
        # update user list
        if ($error == "" && !empty($users)) {
            dbi_query("DELETE FROM webcal_group_user WHERE cal_group_id = {$id}");
            for ($i = 0; $i < count($users); $i++) {
                dbi_query("INSERT INTO webcal_group_user ( cal_group_id, cal_login ) " . "VALUES ( {$id}, '{$users[$i]}' )");
            }
        }
    }
}
if (!empty($error)) {
    print_header('', '', '', true);
    ?>
<h2><?php 
    etranslate("Error");
    ?>
</h2>

<blockquote>
<?php 
    echo $error;
开发者ID:neymanna,项目名称:fusionforge,代码行数:31,代码来源:group_edit_handler.php

示例6: dbi_fetch_row

        if ($res) {
            $row = dbi_fetch_row($res);
            if ($row[0] > 0) {
                $error = translate("You can only create one layer for each user") . ".";
            }
            dbi_free_result($res);
        }
        if ($error == "") {
            $res = dbi_query("SELECT MAX(cal_layerid) FROM webcal_user_layers");
            if ($res) {
                $row = dbi_fetch_row($res);
                $layerid = $row[0] + 1;
            } else {
                $layerid = 1;
            }
            dbi_query("INSERT INTO webcal_user_layers ( " . "cal_layerid, cal_login, cal_layeruser, cal_color, cal_dups ) " . "VALUES ('{$layerid}', '{$layer_user}', '{$layeruser}', " . "'{$layercolor}', '{$dups}')");
        }
    }
}
if ($error == "") {
    if ($updating_public) {
        do_redirect("layers.php?public=1");
    } else {
        do_redirect("layers.php");
    }
    exit;
}
print_header();
?>

<h2><?php 
开发者ID:neymanna,项目名称:fusionforge,代码行数:31,代码来源:edit_layer_handler.php

示例7: user_has_boss

function user_has_boss($assistant)
{
    $ret = false;
    $res = dbi_query("SELECT * FROM webcal_asst as b " . "WHERE b.cal_assistant = '{$assistant}'");
    if ($res) {
        if (dbi_fetch_row($res)) {
            $ret = true;
        }
        dbi_free_result($res);
    }
    return $ret;
}
开发者ID:neuroidss,项目名称:virtuoso-opensource,代码行数:12,代码来源:functions.php

示例8: etranslate

?>
</a><br /><br />

<table style="border-width:0px;">
<tr><td style="vertical-align:top;">
	<label for="users"><?php 
etranslate("Assistants");
?>
:</label></td><td>
	<select name="users[]" id="users" size="10" multiple="multiple">
<?php 
// get list of all users
$users = get_my_users();
// get list of users for this view
$sql = "SELECT cal_boss, cal_assistant FROM webcal_asst WHERE cal_boss = '{$user}'";
$res = dbi_query($sql);
if ($res) {
    while ($row = dbi_fetch_row($res)) {
        $assistantuser[$row[1]] = 1;
    }
    dbi_free_result($res);
}
for ($i = 0; $i < count($users); $i++) {
    $u = $users[$i]['cal_login'];
    if ($u == $login) {
        continue;
    }
    if ($u == '__public__') {
        continue;
    }
    echo "<option value=\"{$u}\"";
开发者ID:neymanna,项目名称:fusionforge,代码行数:31,代码来源:assistant_edit.php

示例9: import_data

function import_data($data, $overwrite, $type)
{
    global $login, $count_con, $count_suc, $error_num, $ImportType, $LOG_CREATE;
    global $single_user, $single_user_login, $allow_conflicts;
    global $numDeleted, $errormsg;
    global $calUser, $H2COLOR, $sqlLog;
    $oldUIDs = array();
    $oldIds = array();
    $firstEventId = 0;
    $importId = 1;
    // Generate a unique import id
    $res = dbi_query("SELECT MAX(cal_import_id) FROM webcal_import");
    if ($res) {
        if ($row = dbi_fetch_row($res)) {
            $importId = $row[0] + 1;
        }
        dbi_free_result($res);
    }
    $sql = "INSERT INTO webcal_import ( cal_import_id, cal_name, " . "cal_date, cal_type, cal_login ) VALUES ( {$importId}, NULL, " . date("Ymd") . ", '{$type}', '{$login}' )";
    if (!dbi_query($sql)) {
        $errormsg = translate("Database error") . ": " . dbi_error();
        return;
    }
    foreach ($data as $Entry) {
        $priority = 2;
        $participants[0] = $calUser;
        // Some additional date/time info
        $START = $Entry['StartTime'] > 0 ? localtime($Entry['StartTime']) : 0;
        $END = $Entry['EndTime'] > 0 ? localtime($Entry['EndTime']) : 0;
        $Entry['StartMinute'] = sprintf("%02d", $START[1]);
        $Entry['StartHour'] = sprintf("%02d", $START[2]);
        $Entry['StartDay'] = sprintf("%02d", $START[3]);
        $Entry['StartMonth'] = sprintf("%02d", $START[4] + 1);
        $Entry['StartYear'] = sprintf("%04d", $START[5] + 1900);
        $Entry['EndMinute'] = sprintf("%02d", $END[1]);
        $Entry['EndHour'] = sprintf("%02d", $END[2]);
        $Entry['EndDay'] = sprintf("%02d", $END[3]);
        $Entry['EndMonth'] = sprintf("%02d", $END[4] + 1);
        $Entry['EndYear'] = sprintf("%04d", $END[5] + 1900);
        if ($overwrite && !empty($Entry['UID'])) {
            $oldUIDs[$Entry['UID']]++;
        }
        // Check for untimed
        if ($Entry['Untimed'] == 1) {
            $Entry['StartMinute'] = '';
            $Entry['StartHour'] = '';
            $Entry['EndMinute'] = '';
            $Entry['EndHour'] = '';
        }
        // first check for any schedule conflicts
        if (empty($allow_conflicts) && $Entry['Duration'] != 0) {
            $date = mktime(0, 0, 0, $Entry['StartMonth'], $Entry['StartDay'], $Entry['StartYear']);
            $endt = !empty($Entry['Repeat']['EndTime']) ? $Entry['Repeat']['EndTime'] : 'NULL';
            $dayst = !empty($Entry['Repeat']['RepeatDays']) ? $Entry['Repeat']['RepeatDays'] : "nnnnnnn";
            $ex_days = array();
            if (!empty($Entry['Repeat']['Exceptions'])) {
                foreach ($Entry['Repeat']['Exceptions'] as $ex_date) {
                    $ex_days[] = date("Ymd", $ex_date);
                }
            }
            $dates = get_all_dates($date, RepeatType($Entry['Repeat']['Interval']), $endt, $dayst, $ex_days, $Entry['Repeat']['Frequency']);
            $overlap = overlap($dates, $Entry['Duration'], $Entry['StartHour'], $Entry['StartMinute'], $participants, $login, 0);
        }
        if (empty($error) && !empty($overlap)) {
            $error = translate("The following conflicts with the suggested time") . ":<ul>{$overlap}</ul>\n";
        }
        if (empty($error)) {
            $updateMode = false;
            // See if event already is there from prior import.
            // The same UID is used for all events imported at once with iCal.
            // So, we still don't have enough info to find the exact
            // event we want to replace.  We could just delete all
            // existing events that correspond to the UID.
            /************************************************************************
              Not sure what to do with this code since I don't know how Palm and vCal
              use the UID stuff yet...
              
                  if ( ! empty ( $Entry['UID'] ) ) {
                    $res = dbi_query ( "SELECT webcal_import_data.cal_id " .
                      "FROM webcal_import_data, webcal_entry_user " .
                      "WHERE cal_import_type = 'ical' AND " .
                      "webcal_import_data.cal_id = webcal_entry_user.cal_id AND " .
                      "webcal_entry_user.cal_login = '$login' AND " .
                      "cal_external_id = '$Entry[UID]'" );
                    if ( $res ) {
                      if ( $row = dbi_fetch_row ( $res ) ) {
                        if ( ! empty ( $row[0] ) ) {
                          $id = $row[0];
                          $updateMode = true;
                          // update rather than add a new event
                        }
                      }
                    }
                  }
            ************************************************************************/
            // Add the Event
            $res = dbi_query("SELECT MAX(cal_id) FROM webcal_entry");
            if ($res) {
                $row = dbi_fetch_row($res);
                $id = $row[0] + 1;
//.........这里部分代码省略.........
开发者ID:BackupTheBerlios,项目名称:fhnreposit,代码行数:101,代码来源:import_handler.php

示例10: etranslate

<br /><br /><br />
<span style="font-size:13px;">
<?php 
etranslate("cookies-note");
?>
</span>
<br />
<hr /><br /><br />
<a href="<?php 
echo $PROGRAM_URL;
?>
" class="aboutinfo"><?php 
echo $PROGRAM_NAME;
?>
</a>

<?php 
// Print custom trailer (since we do not call print_trailer function)
if (!empty($CUSTOM_TRAILER) && $CUSTOM_TRAILER == 'Y') {
    $res = dbi_query("SELECT cal_template_text FROM webcal_report_template " . "WHERE cal_template_type = 'T' and cal_report_id = 0");
    if ($res) {
        if ($row = dbi_fetch_row($res)) {
            echo $row[0];
        }
        dbi_free_result($res);
    }
}
?>
</body>
</html>
开发者ID:BackupTheBerlios,项目名称:fhnreposit,代码行数:30,代码来源:login_new.php

示例11: array

$updating_public = false;
$prefarray = array();
$prefarray['EMAIL_ASSISTANT_EVENTS'] = $prefarray['APPROVE_ASSISTANT_EVENT'] = '';
// no undefined vars message
$res = dbi_query("SELECT cal_setting, cal_value FROM webcal_config ");
if ($res) {
    while ($row = dbi_fetch_row($res)) {
        $prefarray[$row[0]] = $row[1];
    }
    dbi_free_result($res);
}
if ($is_admin && !empty($public) && $public_access == "Y") {
    $updating_public = true;
    $res = dbi_query("SELECT cal_setting, cal_value FROM webcal_user_pref " . "WHERE cal_login = '__public__'");
} else {
    $res = dbi_query("SELECT cal_setting, cal_value FROM webcal_user_pref " . "WHERE cal_login = '{$user}'");
}
if ($res) {
    while ($row = dbi_fetch_row($res)) {
        $prefarray[$row[0]] = $row[1];
    }
    dbi_free_result($res);
}
$INC = array('js/pref.php');
print_header($INC);
?>

<h2><?php 
if ($updating_public) {
    echo translate($PUBLIC_ACCESS_FULLNAME) . "&nbsp;";
}
开发者ID:rohcehlam,项目名称:rflow,代码行数:31,代码来源:pref.php

示例12: list_unapproved

function list_unapproved($user)
{
    global $temp_fullname, $key, $login;
    //echo "Listing events for $user <br>";
    $sql = "SELECT webcal_entry.cal_id, webcal_entry.cal_name, " . "webcal_entry.cal_description, " . "webcal_entry.cal_priority, webcal_entry.cal_date, " . "webcal_entry.cal_time, webcal_entry.cal_duration, " . "webcal_entry_user.cal_status " . "FROM webcal_entry, webcal_entry_user " . "WHERE webcal_entry.cal_id = webcal_entry_user.cal_id " . "AND ( webcal_entry.cal_ext_for_id IS NULL " . "OR webcal_entry.cal_ext_for_id = 0 ) AND " . "webcal_entry_user.cal_login = '{$user}' AND " . "webcal_entry_user.cal_status = 'W' " . "ORDER BY webcal_entry.cal_date";
    $res = dbi_query($sql);
    $count = 0;
    $eventinfo = "";
    if ($res) {
        while ($row = dbi_fetch_row($res)) {
            if ($count == 0) {
                echo "<ul>\n";
            }
            $key++;
            $id = $row[0];
            $name = $row[1];
            $description = $row[2];
            $pri = $row[3];
            $date = $row[4];
            $time = $row[5];
            $duration = $row[6];
            $status = $row[7];
            $divname = "eventinfo-{$id}-{$key}";
            echo "<li><a title=\"" . translate("View this entry") . "\" class=\"entry\" href=\"view_entry.php?id={$id}&amp;user={$user}";
            echo "\" onmouseover=\"window.status='" . translate("View this entry") . "'; show(event, '{$divname}'); return true;\" onmouseout=\"hide('{$divname}'); return true;\">";
            $timestr = "";
            if ($time > 0) {
                $timestr = display_time($time);
                if ($duration > 0) {
                    // calc end time
                    $h = (int) ($time / 10000);
                    $m = $time / 100 % 100;
                    $m += $duration;
                    $d = $duration;
                    while ($m >= 60) {
                        $h++;
                        $m -= 60;
                    }
                    $end_time = sprintf("%02d%02d00", $h, $m);
                    $timestr .= " - " . display_time($end_time);
                }
            }
            echo htmlspecialchars($name);
            echo "</a>";
            echo " (" . date_to_str($date) . ")\n";
            //approve
            echo ": <a title=\"" . translate("Approve/Confirm") . "\"  href=\"approve_entry.php?id={$id}&amp;ret=list&amp;user={$user}";
            if ($user == "__public__") {
                echo "&amp;public=1";
            }
            echo "\" class=\"nav\" onclick=\"return confirm('" . translate("Approve this entry?") . "');\">" . translate("Approve/Confirm") . "</a>, ";
            //reject
            echo "<a title=\"" . translate("Reject") . "\" href=\"reject_entry.php?id={$id}&amp;ret=list&amp;user={$user}";
            if ($user == "__public__") {
                echo "&amp;public=1";
            }
            echo "\" class=\"nav\" onclick=\"return confirm('" . translate("Reject this entry?") . "');\">" . translate("Reject") . "</a>";
            //delete
            echo ", <a title=\"" . translate("Delete") . "\" href=\"del_entry.php?id={$id}&amp;ret=list";
            if ($user != $login) {
                echo "&amp;user={$user}";
            }
            echo "\" class=\"nav\" onclick=\"return confirm('" . translate("Are you sure you want to delete this entry?") . "');\">" . translate("Delete") . "</a>";
            echo "\n</li>\n";
            $eventinfo .= build_event_popup($divname, $user, $description, $timestr, site_extras_for_popup($id));
            $count++;
        }
        dbi_free_result($res);
        if ($count > 0) {
            echo "</ul>\n";
        }
    }
    if ($count == 0) {
        user_load_variables($user, "temp_");
        echo "<span class=\"nounapproved\">" . translate("No unapproved events for") . "&nbsp;" . $temp_fullname . ".</span>\n";
    } else {
        if (!empty($eventinfo)) {
            echo $eventinfo;
        }
    }
}
开发者ID:noikiy,项目名称:owaspbwa,代码行数:81,代码来源:list_unapproved.php

示例13: translate

if ($is_admin) {
    if (empty($log)) {
        echo "<a title=\"" . translate("Show activity log") . "\" class=\"nav\" href=\"view_entry.php?id={$id}&amp;log=1\">" . translate("Show activity log") . "</a><br />\n";
    } else {
        echo "<a title=\"" . translate("Hide activity log") . "\" class=\"nav\" href=\"view_entry.php?id={$id}\">" . translate("Hide activity log") . "</a><br />\n";
        $show_log = true;
    }
}
if ($show_log) {
    echo "<h3>" . translate("Activity Log") . "</h3>\n";
    echo "<table class=\"embactlog\">\n";
    echo "<tr><th class=\"usr\">\n" . translate("User") . "</th><th class=\"cal\">\n";
    echo translate("Calendar") . "</th><th class=\"date\">\n";
    echo translate("Date") . "/" . translate("Time") . "</th><th class=\"action\">\n";
    echo translate("Action") . "\n</th></tr>\n";
    $res = dbi_query("SELECT cal_login, cal_user_cal, cal_type, " . "cal_date, cal_time " . "FROM webcal_entry_log WHERE cal_entry_id = {$id} " . "ORDER BY cal_log_id DESC");
    if ($res) {
        while ($row = dbi_fetch_row($res)) {
            echo "<tr><td>\n";
            echo $row[0] . "</td><td>\n";
            echo $row[1] . "</td><td>\n" . date_to_str($row[3]) . "&nbsp;" . display_time($row[4]) . "</td><td>\n";
            if ($row[2] == $LOG_CREATE) {
                etranslate("Event created");
            } else {
                if ($row[2] == $LOG_APPROVE) {
                    etranslate("Event approved");
                } else {
                    if ($row[2] == $LOG_REJECT) {
                        etranslate("Event rejected");
                    } else {
                        if ($row[2] == $LOG_UPDATE) {
开发者ID:BackupTheBerlios,项目名称:fhnreposit,代码行数:31,代码来源:view_entry.php

示例14: dbi_free_result

        if ($row[0] == $id) {
            $is_my_event = true;
            echo "Event # " . $id . " is already on your calendar.";
            exit;
        }
        dbi_free_result($res);
    }
    // Now lets make sure the user is allowed to add the event (not private)
    $sql = "SELECT cal_access FROM webcal_entry WHERE cal_id = " . $id;
    $res = dbi_query($sql);
    if (!$res) {
        echo translate("Invalid entry id") . ": {$id}";
        exit;
    }
    $row = dbi_fetch_row($res);
    if ($row[0] == "R" && !$is_my_event) {
        $is_private = true;
        etranslate("This is a private event and may not be added to your calendar.");
        exit;
    } else {
        $is_private = false;
    }
    // add the event
    if ($readonly == "N" && !$is_my_event && !$is_private) {
        if (!dbi_query("INSERT INTO webcal_entry_user ( cal_id, cal_login, cal_status ) VALUES ( {$id}, '{$login}', 'A' )")) {
            $error = translate("Error adding event") . ": " . dbi_error();
        }
    }
}
send_to_preferred_view();
exit;
开发者ID:noikiy,项目名称:owaspbwa,代码行数:31,代码来源:add_entry.php

示例15: dbi_query

<?php

include_once 'includes/init.php';
$error = "";
if ($user != $login) {
    $user = ($is_admin || $is_nonuser_admin) && $user ? $user : $login;
}
# update user list
dbi_query("DELETE FROM webcal_asst WHERE cal_boss = '{$user}'");
if (!empty($users)) {
    for ($i = 0; $i < count($users); $i++) {
        dbi_query("INSERT INTO webcal_asst ( cal_boss, cal_assistant ) " . "VALUES ( '{$user}', '{$users[$i]}' )");
    }
}
$url = "assistant_edit.php";
if (($is_admin || $is_nonuser_admin) && $login != $user) {
    $url = $url . (strpos($url, "?") === false ? "?" : "&amp;") . "user={$user}";
}
do_redirect($url);
print_header();
?>
<h2><?php 
etranslate("Error");
?>
</h2>

<blockquote>
<?php 
echo $error;
//if ( $sql != "" )
//  echo "<br /><br /><span style=\"font-weight:bold;\">SQL:</span> $sql";
开发者ID:noikiy,项目名称:owaspbwa,代码行数:31,代码来源:assistant_edit_handler.php


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