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


PHP grr_sql_error函数代码示例

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


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

示例1: delete_user

function delete_user($login)
{
    $sql = "SELECT source FROM " . TABLE_PREFIX . "_utilisateurs\n\t    WHERE login LIKE '{$login}'";
    $res = grr_sql_query($sql);
    $row = grr_sql_row($res, 0);
    $source = $row[0];
    if ($source == 'ext') {
        // Si l'utilisateur avait été créé automatiquement, on le
        // supprime
        // Cf. admin_user.php l99 et l203
        $sql = "DELETE FROM " . TABLE_PREFIX . "_utilisateurs WHERE login='{$login}'";
        if (grr_sql_command($sql) < 0) {
            fatal_error(1, "<p>" . grr_sql_error());
        } else {
            grr_sql_command("DELETE FROM " . TABLE_PREFIX . "_j_mailuser_room  WHERE login='{$login}'");
            grr_sql_command("DELETE FROM " . TABLE_PREFIX . "_j_user_area      WHERE login='{$login}'");
            grr_sql_command("DELETE FROM " . TABLE_PREFIX . "_j_user_room      WHERE login='{$login}'");
            grr_sql_command("DELETE FROM " . TABLE_PREFIX . "_j_useradmin_area WHERE login='{$login}'");
            grr_sql_command("DELETE FROM " . TABLE_PREFIX . "_j_useradmin_site WHERE login='{$login}'");
        }
        // Fin de la session
        grr_closeSession($_GET['auto']);
    }
    // sinon c'est source="local": on le garde et il y a toujours accès
    // classique login/mot de passe).
}
开发者ID:nicolas-san,项目名称:GRRV4,代码行数:26,代码来源:delete_user.php

示例2: jQuery_DatePicker

function jQuery_DatePicker($typeDate)
{
    if (@file_exists('../include/connect.inc.php')) {
        $racine = "../";
    } else {
        $racine = "./";
    }
    if ($typeDate == 'rep_end' && isset($_GET['id'])) {
        $res = grr_sql_query("SELECT repeat_id FROM " . TABLE_PREFIX . "_entry WHERE id=" . $_GET['id'] . ";");
        if (!$res) {
            fatal_error(0, grr_sql_error());
        }
        $repeat_id = implode('', grr_sql_row($res, 0));
        $res = grr_sql_query("SELECT rep_type, end_date, rep_opt, rep_num_weeks, start_time, end_time FROM " . TABLE_PREFIX . "_repeat WHERE id={$repeat_id}");
        if (!$res) {
            fatal_error(0, grr_sql_error());
        }
        if (grr_sql_count($res) == 1) {
            $row6 = grr_sql_row($res, 0);
            $date = date_parse(date("Y-m-d H:i:s", $row6[1]));
            $day = $date['day'];
            $month = $date['month'];
            $year = $date['year'];
        } else {
            if (isset($_GET['day'])) {
                $day = $_GET['day'];
            } else {
                $day = date("d");
            }
            if (isset($_GET['month'])) {
                $month = $_GET['month'];
            } else {
                $month = date("m");
            }
            if (isset($_GET['year'])) {
                $year = $_GET['year'];
            } else {
                $year = date("Y");
            }
        }
    } else {
        global $start_day, $start_month, $start_year, $end_day, $end_month, $end_year;
        if (isset($_GET['day'])) {
            $day = $_GET['day'];
        } else {
            $day = date("d");
        }
        if (isset($start_day) && $typeDate == 'start') {
            $day = $start_day;
        } elseif (isset($end_day) && $typeDate == 'end') {
            $day = $end_day;
        }
        if (isset($_GET['month'])) {
            $month = $_GET['month'];
        } else {
            $month = date("m");
        }
        if (isset($start_month) && $typeDate == 'start') {
            $month = $start_month;
        } elseif (isset($end_month) && $typeDate == 'end') {
            $month = $end_month;
        }
        if (isset($_GET['year'])) {
            $year = $_GET['year'];
        } else {
            $year = date("Y");
        }
        if (isset($start_year) && $typeDate == 'start') {
            $year = $start_year;
        } elseif (isset($end_year) && $typeDate == 'end') {
            $year = $end_year;
        }
    }
    genDateSelector("" . $typeDate . "_", "{$day}", "{$month}", "{$year}", "");
    echo '<input type="hidden" disabled="disabled" id="mydate_' . $typeDate . '">' . PHP_EOL;
    echo '<script>' . PHP_EOL;
    echo '	$(function() {' . PHP_EOL;
    echo '$.datepicker.setDefaults( $.datepicker.regional[\'fr\'] );' . PHP_EOL;
    echo '	$(\'#mydate_' . $typeDate . '\').datepicker({' . PHP_EOL;
    echo '		beforeShow: readSelected, onSelect: updateSelected,' . PHP_EOL;
    echo '		showOn: \'both\', buttonImageOnly: true, buttonImage: \'images/calendar.png\',buttonText: "Choisir la date"});' . PHP_EOL;
    echo '		function readSelected()' . PHP_EOL;
    echo '		{' . PHP_EOL;
    echo '			$(\'#mydate_' . $typeDate . '\').val($(\'#' . $typeDate . '_day\').val() + \'/\' +' . PHP_EOL;
    echo '			$(\'#' . $typeDate . '_month\').val() + \'/\' + $(\'#' . $typeDate . '_year\').val());' . PHP_EOL;
    echo '			return {};' . PHP_EOL;
    echo '		}' . PHP_EOL;
    echo '		function updateSelected(date)' . PHP_EOL;
    echo '		{' . PHP_EOL;
    echo '			$(\'#' . $typeDate . '_day\').val(date.substring(0, 2));' . PHP_EOL;
    echo '			$(\'#' . $typeDate . '_month\').val(date.substring(3, 5));' . PHP_EOL;
    echo '			$(\'#' . $typeDate . '_year\').val(date.substring(6, 10));' . PHP_EOL;
    echo '		}' . PHP_EOL;
    echo '	});' . PHP_EOL;
    echo '</script>' . PHP_EOL;
}
开发者ID:JeromeDevome,项目名称:GRR,代码行数:96,代码来源:functions.inc.php

示例3: grr_sql_query

    echo "</pre>\n";
}

echo "<table cellspacing=\"0\" border=\"1\" width=\"100%\"><tr>";

# We need to know what all the rooms area called, so we can show them all
# pull the data from the db and store it. Convienently we can print the room
# headings and capacities at the same time

$sql = "select room_name, capacity, id, description, statut_room from ".TABLE_PREFIX."_room where area_id='".$area."' order by order_display, room_name";
$res = grr_sql_query($sql);

# It might be that there are no rooms defined for this area.
# If there are none then show an error and dont bother doing anything
# else
if (! $res) fatal_error(0, grr_sql_error());
if (grr_sql_count($res) == 0)
{
    echo "<h1>".get_vocab("no_rooms_for_area")."</h1>";
    grr_sql_free($res);
} else {
    // Affichage de la première ligne contenant le nom des jours (lundi, mardi, ...) et les dates ("10 juil", "11 juil", ...)
    echo "<th style=\"width:10%;\">&nbsp;</th>\n"; // Première cellule vide
    $t = $time;
    $num_week_day = $weekstarts; // Pour le calcul des jours à afficher
    for ($weekcol = 0; $weekcol < 7; $weekcol++)
    {
        $num_day = strftime("%d", $t);
        $temp_month = strftime("%m", $t);
        $temp_month2 = strftime("%b", $t);
        $temp_year = strftime("%Y", $t);
开发者ID:rhertzog,项目名称:lcs,代码行数:31,代码来源:week_all.php

示例4: mktime

                $starttime = mktime($morningstarts, 0, 0, $month, $day, $year);
                $endtime = mktime($eveningends, 0, $resolution, $month, $day, $year);
                // Pour toutes les dates bon précédement enregistrées, on efface toutes les résa en conflit
                if (!in_array($n, $day_old)) {
                    $sql = "select id from " . TABLE_PREFIX . "_room";
                    $res = grr_sql_query($sql);
                    if ($res) {
                        for ($i = 0; $row = grr_sql_row($res, $i); $i++) {
                            $result += grrDelEntryInConflict($row[0], $starttime, $endtime, 0, 0, 1);
                        }
                    }
                }
                // On enregistre la valeur dans ".TABLE_PREFIX."_calendar
                $sql = "INSERT INTO " . TABLE_PREFIX . "_calendar set DAY='" . $n . "'";
                if (grr_sql_command($sql) < 0) {
                    fatal_error(0, "<p>" . grr_sql_error());
                }
            }
            $day++;
        }
        $month++;
        if ($month == 13) {
            $year++;
            $month = 1;
        }
    }
}
echo '<p>', get_vocab("les_journees_cochees_sont_ignorees"), '</p>', PHP_EOL;
echo '<table class="table table-bordered">', PHP_EOL;
$basetime = mktime(12, 0, 0, 6, 11 + $weekstarts, 2000);
for ($i = 0; $i < 7; $i++) {
开发者ID:Sirlefou1,项目名称:GRR2,代码行数:31,代码来源:admin_calend_ignore.php

示例5: protect_data_sql

    $duration = $row[4] - $row[3];
    $etype = $row[5];
    $room_id = $row[6];
    $entry_type = $row[7];
    $rep_id = $row[8];
    $option_reservation = $row[9];
    $jours_c = $row[10];
    $clef = $row[14];
    $courrier = $row[15];
    $modif_option_reservation = 'n';
    if ($entry_type >= 1) {
        $sql = 'SELECT rep_type, start_time, end_date, rep_opt, rep_num_weeks, end_time, type, name, beneficiaire, description
		FROM ' . TABLE_PREFIX . "_repeat WHERE id='" . protect_data_sql($rep_id) . "'";
        $res = grr_sql_query($sql);
        if (!$res) {
            fatal_error(1, grr_sql_error());
        }
        if (grr_sql_count($res) != 1) {
            fatal_error(1, get_vocab('repeat_id') . $rep_id . get_vocab('not_found'));
        }
        $row = grr_sql_row($res, 0);
        grr_sql_free($res);
        $rep_type = $row[0];
        if ($rep_type == 2) {
            $rep_num_weeks = $row[4];
        }
        if ($edit_type == 'series') {
            $start_day = (int) strftime('%d', $row[1]);
            $start_month = (int) strftime('%m', $row[1]);
            $start_year = (int) strftime('%Y', $row[1]);
            $start_hour = (int) strftime('%H', $row[1]);
开发者ID:nicolas-san,项目名称:GRRV4,代码行数:31,代码来源:edit_entry.php

示例6: interest

# On construit alors un tableau de la forme :
# d[weekday][slot][x], où x = id, color, data.
# [slot] is based at 0 for midnight, but only slots within the hours of
# interest (morningstarts : eveningends) are filled in.
# [id] and [data] are only filled in when the meeting should be labeled,
# which is once for each meeting on each weekday.
# Note: weekday here is relative to the $weekstarts configuration variable.
# If 0, then weekday=0 means Sunday. If 1, weekday=0 means Monday.

$first_slot = $morningstarts * 3600 / $resolution;
$last_slot = ($eveningends * 3600 + $eveningends_minutes * 60) / $resolution;

if ($debug_flag) echo "<br />DEBUG: query=$sql <br />first_slot=$first_slot - last_slot=$last_slot\n";

$res = grr_sql_query($sql);
if (! $res) echo grr_sql_error();
else for ($i = 0; ($row = grr_sql_row($res, $i)); $i++)
{
    if ($debug_flag)
        echo "<br />DEBUG: result $i, id $row[4], starts $row[0] (".affiche_date($row[0])."), ends $row[1] (".affiche_date($row[1]).")\n";

    # Fill in slots for the meeting. Start at the meeting start time or
    # week start (which ever is later), and end one slot before the meeting
    # end time or week end (which ever is earlier).
    # Note: int casts on database rows for min and max is needed for PHP3.

    // Pour la réservation en cours, on détermine le début de la journée $debut_jour
    $month_current = date("m",$row[0]);
    $day_current = date("d",$row[0]);
    $year_current  = date("Y",$row[0]);
    $debut_jour=mktime($morningstarts,0,0,$month_current,$day_current,$year_current);
开发者ID:rhertzog,项目名称:lcs,代码行数:31,代码来源:week.php

示例7: grr_opensession


//.........这里部分代码省略.........
        if ($num_row == 1) {  // L'utilisateur est présent dans la base locale
            if ($sso == "lcs") { // Mise à jour des données
                $nom_user = $tab_login["nom"];
                $email_user = $tab_login["email"];
                $prenom_user = $tab_login["fullname"];
                // On met à jour
                $sql = "UPDATE ".TABLE_PREFIX."_utilisateurs SET
                nom='".protect_data_sql($nom_user)."',
                prenom='".protect_data_sql($prenom_user)."',
                email='".protect_data_sql($email_user)."'
                where login='".protect_data_sql($_login)."'";
            } else if ($_user_ext_authentifie == "cas") {
                $nom_user = $tab_login["user_nom"];
                $email_user = $tab_login["user_email"];
                $prenom_user = $tab_login["user_prenom"];
                if ($nom_user != '') {
                   //  On détecte si Nom, Prénom ou Email ont changé,
                   // Si c'est le cas, on met à jour les champs
                   $req = grr_sql_query("select nom, prenom, email from ".TABLE_PREFIX."_utilisateurs where login ='".protect_data_sql($_login)."'");
                   $res = mysql_fetch_array($req);
                   $nom_en_base = $res[0];
                   $prenom_en_base = $res[1];
                   $email_en_base = $res[2];
                   if(  (strcmp($nom_en_base, $nom_user) != 0)
                    ||  (strcmp($prenom_en_base, $prenom_user) != 0)
                    ||  (strcmp($email_en_base, $email_user) != 0)  ) {
                      // Si l'un des champs est différent, on met à jour les champs
                      $sql = "UPDATE ".TABLE_PREFIX."_utilisateurs SET
                      nom='".protect_data_sql($nom_user)."',
                      prenom='".protect_data_sql($prenom_user)."',
                      email='".protect_data_sql($email_user)."'
                      where login='".protect_data_sql($_login)."'";
                      if (grr_sql_command($sql) < 0) {
                        fatal_error(0, get_vocab("msg_login_created_error") . grr_sql_error());
                        return "2";
                        die();
                      }
                      /* Comme les données de la base on été changés, on doit remettre à jour la variable $row,
                      Pour que les données mises en sessions soient les bonnes
                      on récupère les données de l'utilisateur
                      */
                      $sql = "select upper(login) login, password, prenom, nom, statut, now() start, default_area, default_room, default_style, default_list_type, default_language, source, etat, default_site
                      from ".TABLE_PREFIX."_utilisateurs
                      where login = '" . protect_data_sql($_login) . "' and
                      source = 'ext' and
                      etat != 'inactif'";
                      $res_user = grr_sql_query($sql);
                      $num_row = grr_sql_count($res_user);
                      if ($num_row == 1) {
                          // on récupère les données de l'utilisateur dans $row
                          $row = grr_sql_row($res_user,0);
                      } else {
                          return "2";
                          die();
                      }
                   }
               }
            }
            if (grr_sql_command($sql) < 0)
                {fatal_error(0, get_vocab("msg_login_created_error") . grr_sql_error());
                return "2";
                die();
            }
            // on récupère les données de l'utilisateur dans $row
            $row = grr_sql_row($res_user,0);
        } else {
开发者ID:rhertzog,项目名称:lcs,代码行数:67,代码来源:session.inc.php

示例8: unset

unset($user_login);
$user_login = isset($_POST["user_login"]) ? $_POST["user_login"] : ($user_login = isset($_GET["user_login"]) ? $_GET["user_login"] : NULL);
$valid = isset($_POST["valid"]) ? $_POST["valid"] : NULL;
$msg = '';
if ($valid == "yes") {
    unset($reg_password1);
    $reg_password1 = unslashes($_POST["reg_password1"]);
    unset($reg_password2);
    $reg_password2 = unslashes($_POST["reg_password2"]);
    $reg_password_c = md5($reg_password1);
    if ($reg_password1 != $reg_password2 || strlen($reg_password1) < $pass_leng) {
        $msg = get_vocab("passwd_error");
    } else {
        $sql = "UPDATE " . TABLE_PREFIX . "_utilisateurs SET password='" . protect_data_sql($reg_password_c) . "' WHERE login='{$user_login}'";
        if (grr_sql_command($sql) < 0) {
            fatal_error(0, get_vocab('update_pwd_failed') . grr_sql_error());
        } else {
            $msg = get_vocab('update_pwd_succeed');
        }
    }
}
$user_nom = '';
$user_prenom = '';
$user_source = '';
// On appelle les informations de l'utilisateur
if (isset($user_login) && $user_login != '') {
    $sql = "SELECT nom,prenom, source FROM " . TABLE_PREFIX . "_utilisateurs WHERE login='{$user_login}'";
    $res = grr_sql_query($sql);
    if ($res) {
        for ($i = 0; $row = grr_sql_row($res, $i); $i++) {
            $user_nom = $row[0];
开发者ID:nicolas-san,项目名称:GRRV4,代码行数:31,代码来源:admin_change_pwd.php

示例9: grr_resumeSession

/**
 * Resume a session
 *
 * Check that all the expected data is present
 * Check login / password against database
 * Update the timeout in the ".TABLE_PREFIX."_log table
 *
 * Returns true if session resumes, false otherwise
 *
 *
 * @return boolean
 */
function grr_resumeSession()
{
    // Resuming session
    session_name(SESSION_NAME);
    @session_start();
    if (Settings::get('sso_statut') == 'lcs' and !isset($_SESSION['est_authentifie_sso']) and $_SESSION['source_login'] == "ext") {
        return false;
    }
    // La session est-elle expirée
    if (isset($_SESSION['login'])) {
        $test_session = grr_sql_query1("SELECT count(LOGIN) from " . TABLE_PREFIX . "_log where END > now() and LOGIN = '" . protect_data_sql($_SESSION['login']) . "'");
        if ($test_session == 0) {
            $_SESSION = array();
        }
    }
    if (!isset($_SESSION) or !isset($_SESSION['login'])) {
        return false;
    }
    if (Settings::get("disable_login") == 'yes' and $_SESSION['statut'] != "administrateur") {
        return false;
    }
    // To be removed
    // Validating session data
    $sql = "SELECT password = '" . $_SESSION['password'] . "' PASSWORD, login = '" . protect_data_sql($_SESSION['login']) . "' LOGIN, statut = '" . $_SESSION['statut'] . "' STATUT\n\tfrom " . TABLE_PREFIX . "_utilisateurs where login = '" . protect_data_sql($_SESSION['login']) . "'";
    $res = grr_sql_query($sql);
    $row = grr_sql_row($res, 0);
    // Checking for a timeout
    $sql2 = "SELECT now() > END TIMEOUT from " . TABLE_PREFIX . "_log where SESSION_ID = '" . session_id() . "' and START = '" . $_SESSION['start'] . "'";
    if ($row[0] != "1" || $row[1] != "1" || $row[2] != "1") {
        return false;
    } else {
        if (grr_sql_query1($sql2)) {
            // Le temps d'inactivité est supérieur à la limite fixée.
            // cas d'une authentification LCS
            if (Settings::get('sso_statut') == 'lcs') {
                // l'utilisateur est authentifié par LCS, on renouvelle la session
                if ($is_authentified_lcs == 'yes') {
                    $sql = "UPDATE " . TABLE_PREFIX . "_log set END = now() + interval " . $_SESSION['maxLength'] . " minute where SESSION_ID = '" . session_id() . "' and START = '" . $_SESSION['start'] . "'";
                    $res = grr_sql_query($sql);
                    if (!$res) {
                        fatal_error(0, 'erreur mysql' . grr_sql_error());
                    }
                    return true;
                } else {
                    return false;
                }
            } else {
                return false;
            }
        } else {
            $sql = "UPDATE " . TABLE_PREFIX . "_log set END = now() + interval " . $_SESSION['maxLength'] . " minute where SESSION_ID = '" . session_id() . "' and START = '" . $_SESSION['start'] . "'";
            $res = grr_sql_query($sql);
            if (!$res) {
                fatal_error(0, 'erreur mysql' . grr_sql_error());
            }
            return true;
        }
    }
}
开发者ID:JeromeDevome,项目名称:GRR,代码行数:71,代码来源:session.inc.php

示例10: fatal_error

                if (grr_sql_command($sql) < 0) {
                    fatal_error(0, '<p>' . grr_sql_error() . '</p>');
                }
                $id_site = mysqli_insert_id($GLOBALS['db_c']);
            }
            // On affecte tous les domaines à un site.
            $sql = "SELECT id FROM " . TABLE_PREFIX . "_area";
            $res = grr_sql_query($sql);
            if ($res) {
                for ($i = 0; $row = grr_sql_row($res, $i); $i++) {
                    // l'area est-elle déjà affectée à un site ?
                    $test_site = grr_sql_query1("SELECT count(id_area) FROM " . TABLE_PREFIX . "_j_site_area WHERE id_area='" . $row[0] . "'");
                    if ($test_site == 0) {
                        $sql = "INSERT INTO " . TABLE_PREFIX . "_j_site_area SET id_site='" . $id_site . "', id_area='" . $row[0] . "'";
                        if (grr_sql_command($sql) < 0) {
                            fatal_error(0, '<p>' . grr_sql_error() . '</p>');
                        }
                    }
                }
            }
        }
    }
}
if (isset($_GET['use_fckeditor'])) {
    if (!Settings::set("use_fckeditor", $_GET['use_fckeditor'])) {
        echo "Erreur lors de l'enregistrement de use_fckeditor !<br />";
        die;
    }
}
print_header("", "", "", $type = "with_session");
if (isset($_GET['ok'])) {
开发者ID:Sirlefou1,项目名称:GRR2,代码行数:31,代码来源:admin_config5.php

示例11: moderate_entry_do

 function moderate_entry_do($_id,$_moderate,$_description,$send_mail="yes")
 {
global $dformat;

// On vérifie que l'utilisateur a bien le droit d'être ici
$room_id = grr_sql_query1("select room_id from ".TABLE_PREFIX."_entry where id='".$_id."'");
if (authGetUserLevel(getUserName(),$room_id) < 3)
{
    fatal_error(0,"Opération interdite");
    exit();
}


// j'ai besoin de $repeat_id '
$sql = "select repeat_id from ".TABLE_PREFIX."_entry where id =".$_id;
$res = grr_sql_query($sql);
if (! $res) fatal_error(0, grr_sql_error());
$row = grr_sql_row($res, 0);
$repeat_id = $row['0'];

// Initialisation
$series = 0;
if ($_moderate == "S1") {
     $_moderate = "1";
     $series = 1;
}
if ($_moderate == "S0") {
     $_moderate = "0";
     $series = 1;
}

if ($series==0) {
    //moderation de la ressource
    if ($_moderate == 1) {
        $sql = "update ".TABLE_PREFIX."_entry set moderate = 2 where id = ".$_id;
    } else {
        $sql = "update ".TABLE_PREFIX."_entry set moderate = 3 where id = ".$_id;
    }
    $res = grr_sql_query($sql);
    if (! $res) fatal_error(0, grr_sql_error());

    if (!(grr_backup($_id,$_SESSION['login'],$_description))) fatal_error(0, grr_sql_error());
    $tab_id_moderes = array();
} else { // cas d'une série
    // on constitue le tableau des id de la périodicité
    $sql = "select id from ".TABLE_PREFIX."_entry where repeat_id=".$repeat_id;
    $res = grr_sql_query($sql);
    if (! $res) fatal_error(0, grr_sql_error());
    $tab_entry = array();
    for ($i = 0; ($row = grr_sql_row($res, $i)); $i++) {
        $tab_entry[] = $row['0'];
    }
    $tab_id_moderes = array();
    // Boucle sur les résas
    foreach ($tab_entry as $entry_tom) {
        $test = grr_sql_query1("select count(id) from ".TABLE_PREFIX."_entry_moderate where id = '".$entry_tom."'");
        // Si il existe déjà une entrée dans ".TABLE_PREFIX."_entry_moderate, cela signifie que la réservation a déjà été modérée.
        // Sinon :
        if ($test == 0) {
            //moderation de la ressource
            if ($_moderate == 1) {
                $sql = "update ".TABLE_PREFIX."_entry set moderate = 2 where id = '".$entry_tom."'";
            } else {
                $sql = "update ".TABLE_PREFIX."_entry set moderate = 3 where id = '".$entry_tom."'";
           }
           $res = grr_sql_query($sql);
           if (! $res) fatal_error(0, grr_sql_error());

           if (!(grr_backup($entry_tom,$_SESSION['login'],$_description))) fatal_error(0, grr_sql_error());           // Backup : on enregistre les infos dans ".TABLE_PREFIX."_entry_moderate
           // On constitue un tableau des réservations modérées
           $tab_id_moderes[] = $entry_tom;
        }
    }
}

// Avant d'effacer la réservation, on procède à la notification par mail, uniquement si la salle n'a pas déjà été modérée.
if ($send_mail=="yes")
   send_mail($_id,6,$dformat,$tab_id_moderes);

//moderation de la ressource
if ($_moderate != 1) {
    // on efface l'entrée de la base
    if ($series==0) {
        $sql = "delete from ".TABLE_PREFIX."_entry where id = ".$_id;
        $res = grr_sql_query($sql);
        if (! $res) fatal_error(0, grr_sql_error());
    } else {
        // On sélectionne toutes les réservation de la périodicité
        $res = grr_sql_query("select id from ".TABLE_PREFIX."_entry where repeat_id='".$repeat_id."'");
        if (! $res) fatal_error(0, grr_sql_error());
        for ($i = 0; ($row = grr_sql_row($res, $i)); $i++) {
            $entry_tom = $row['0'];
            // Pour chaque réservation, on teste si celle-ci a été refusée
            $test = grr_sql_query1("select count(id) from ".TABLE_PREFIX."_entry_moderate where id = '".$entry_tom."' and moderate='3'");
            // Si oui, on supprime la réservation
            if ($test > 0)
                $del = grr_sql_query("delete from ".TABLE_PREFIX."_entry where id = '".$entry_tom."'");
        }
        // On supprime l'info de périodicité
        $del_repeat = grr_sql_query("delete from ".TABLE_PREFIX."_repeat where id='".$repeat_id."'");
//.........这里部分代码省略.........
开发者ID:rhertzog,项目名称:lcs,代码行数:101,代码来源:mrbs_sql.inc.php

示例12: cree_calendrier_date_valide

function cree_calendrier_date_valide($n,$i) {
        if ($i <= getSettingValue("nombre_jours_Jours/Cycles")) {
            $sql = "INSERT INTO ".TABLE_PREFIX."_calendrier_jours_cycle set DAY='".$n."', Jours = $i";
            if (grr_sql_command($sql) < 0) {
                fatal_error(1, "<p>" . grr_sql_error());
            }
            $i++;
        }
        else {
            $i = 1;
            $sql = "INSERT INTO ".TABLE_PREFIX."_calendrier_jours_cycle set DAY='".$n."', Jours = $i";
            if (grr_sql_command($sql) < 0) {
                fatal_error(1, "<p>" . grr_sql_error());
            }
            $i++;
        }
        return $i;
    }
开发者ID:rhertzog,项目名称:lcs,代码行数:18,代码来源:functions.inc.php

示例13: grr_sql_query1

//
// Suppression d'un type de réservation
//
if ((isset($_GET['action_del'])) and ($_GET['js_confirmed'] ==1) and ($_GET['action_del']='yes')) {
    // faire le test si il existe une réservation en cours avec ce type de réservation
    $type_id = grr_sql_query1("select type_letter from ".TABLE_PREFIX."_type_area where id = '".$_GET['type_del']."'");
    $test1 = grr_sql_query1("select count(id) from ".TABLE_PREFIX."_entry where type= '".$type_id."'");
    $test2 = grr_sql_query1("select count(id) from ".TABLE_PREFIX."_repeat where type= '".$type_id."'");
    if (($test1 != 0) or ($test2 != 0)) {
        $msg =  "Suppression impossible : des réservations ont été enregistrées avec ce type.";
    } else {
        $sql = "DELETE FROM ".TABLE_PREFIX."_type_area WHERE id='".$_GET['type_del']."'";
        if (grr_sql_command($sql) < 0) {fatal_error(1, "<p>" . grr_sql_error());}
        $sql = "DELETE FROM ".TABLE_PREFIX."_j_type_area WHERE id_type='".$_GET['type_del']."'";
        if (grr_sql_command($sql) < 0) {fatal_error(1, "<p>" . grr_sql_error());}

    }
}
affiche_pop_up($msg,"admin");

echo "<h2>".get_vocab('admin_type.php')."</h2>";
echo get_vocab('admin_type_explications');
echo "<br />\n";
echo "<br />\n";
echo "| <a href=\"admin_type_modify.php?id=0\">".get_vocab("display_add_type")."</a> |\n";
echo "<br />\n";
echo "<br />\n";
$sql = "SELECT id, type_name, order_display, couleur, type_letter, disponible FROM ".TABLE_PREFIX."_type_area
ORDER BY order_display,type_letter";
$res = grr_sql_query($sql);
开发者ID:rhertzog,项目名称:lcs,代码行数:30,代码来源:admin_type.php

示例14: update_site

 function update_site($id)
 {
   if ((isset($_POST['back']) or isset($_GET['back']))) {
     // On affiche le tableau des sites
     read_sites();
     exit();
   }
   // On affiche le formulaire de saisie quand l'appel de la fonction ne provient pas de la validation de ce même formulaire
   if (! (isset($_POST['save']) or isset($_GET['save'])))
   {
     // Initialisation
     $res = grr_sql_query("SELECT * FROM ".TABLE_PREFIX."_site WHERE id='".$id."'");
     if (! $res) fatal_error(0,'<p>'.grr_sql_error().'</p>');
     $row = grr_sql_row_keyed($res, 0);
     grr_sql_free($res);
     $sitecode = $row['sitecode'];
     $sitename = $row['sitename'];
     $adresse_ligne1 = $row['adresse_ligne1'];
     $adresse_ligne2 = $row['adresse_ligne2'];
     $adresse_ligne3 = $row['adresse_ligne3'];
     $cp = $row['cp'];
     $ville = $row['ville'];
     $pays = $row['pays'];
     $tel = $row['tel'];
     $fax = $row['fax'];

     // Affichage des titres de la page
     echo '      <h2>'.get_vocab('modifier site').'</h2>';
     echo '
      <form action="admin_site.php?action=update" method="post">
        <table>
          <tr><td>'.get_vocab('site_code').'&nbsp;*</td><td><input type="text" name="sitecode" value="'.$sitecode.'" size="10" title="'.get_vocab('site_code').'" /></td></tr>
          <tr><td>'.get_vocab('site_name').'&nbsp;*</td><td><input type="text" name="sitename" value="'.$sitename.'" size="50" title="'.get_vocab('site_name').'" /></td></tr>
          <tr><td>'.get_vocab('site_adresse_ligne1').'</td><td><input type="text" name="adresse_ligne1" value="'.$adresse_ligne1.'" size="38" title="'.get_vocab('site_adresse_ligne1').'" /></td></tr>
          <tr><td>'.get_vocab('site_adresse_ligne2').'</td><td><input type="text" name="adresse_ligne2" value="'.$adresse_ligne2.'" size="38" title="'.get_vocab('site_adresse_ligne2').'" /></td></tr>
          <tr><td>'.get_vocab('site_adresse_ligne3').'</td><td><input type="text" name="adresse_ligne3" value="'.$adresse_ligne3.'" size="38" title="'.get_vocab('site_adresse_ligne3').'" /></td></tr>
          <tr><td>'.get_vocab('site_cp').'</td><td><input type="text" name="cp" value="'.$cp.'" size="5" title="'.get_vocab('site_cp').'" /></td></tr>
          <tr><td>'.get_vocab('site_ville').'</td><td><input type="text" name="ville" value="'.$ville.'" size="50" title="'.get_vocab('site_ville').'" /></td></tr>
          <tr><td>'.get_vocab('site_pays').'</td><td><input type="text" name="pays" value="'.$pays.'" size="50" title="'.get_vocab('site_pays').'" /></td></tr>
          <tr><td>'.get_vocab('site_tel').'</td><td><input type="text" name="tel" value="'.$tel.'" size="25" title="'.get_vocab('site_tel').'" /></td></tr>
          <tr><td>'.get_vocab('site_fax').'</td><td><input type="text" name="fax" value="'.$fax.'" size="25" title="'.get_vocab('site_fax').'" /></td></tr>
        </table>
        <div>
        <input type="hidden" name="valid" value="yes" />
        <input type="hidden" name="id" value="'.$id.'" />
        <input type="submit" name="save" value="'.get_vocab('save').'" />
        <input type="submit" name="back" value="'.get_vocab('back').'" /></div>
        </form>';
      echo get_vocab("required");
   // Sinon, il faut valider le formulaire
   } else {
     $msg ='';
     if (!isset($id)) $id = isset($_POST['id']) ? $_POST['id'] :  NULL;
     if (!isset($sitecode)) $sitecode = isset($_POST['sitecode']) ? $_POST['sitecode'] : NULL;
     if (!isset($sitename)) $sitename = isset($_POST['sitename']) ? $_POST['sitename'] :  NULL;
     if (!isset($adresse_ligne1)) $adresse_ligne1 = isset($_POST['adresse_ligne1']) ? $_POST['adresse_ligne1'] :  NULL;
     if (!isset($adresse_ligne2)) $adresse_ligne2 = isset($_POST['adresse_ligne2']) ? $_POST['adresse_ligne2'] :  NULL;
     if (!isset($adresse_ligne3)) $adresse_ligne3 = isset($_POST['adresse_ligne3']) ? $_POST['adresse_ligne3'] :  NULL;
     if (!isset($cp)) $cp = isset($_POST['cp']) ? $_POST['cp'] :  NULL;
     if (!isset($ville)) $ville = isset($_POST['ville']) ? $_POST['ville'] :  NULL;
     if (!isset($pays)) $pays = isset($_POST['pays']) ? $_POST['pays'] :  NULL;
     if (!isset($tel)) $tel = isset($_POST['tel']) ? $_POST['tel'] :  NULL;
     if (!isset($fax)) $fax = isset($_POST['fax']) ? $_POST['fax'] :  NULL;

     // On vérifie que le code et le nom du site ont été renseignés
     if ($sitecode=='' or $sitecode==NULL or $sitename=='' or $sitename==NULL)
     {
       $_POST['save'] = 'no';
       $_GET['save'] = 'no';
       echo '<span class="avertissement">'.get_vocab('required').'</span>';
     }

     // Sauvegarde du record
     if ((isset($_POST['save']) and ($_POST['save']!='no')) or ((isset($_GET['save'])) and ($_GET['save']!='no')))
     {
         $sql="update ".TABLE_PREFIX."_site
       		SET sitecode='".strtoupper(protect_data_sql($sitecode))."',
       			sitename='".protect_data_sql($sitename)."',
       			adresse_ligne1='".protect_data_sql($adresse_ligne1)."',
       			adresse_ligne2='".protect_data_sql($adresse_ligne2)."',
       			adresse_ligne3='".protect_data_sql($adresse_ligne3)."',
       			cp='".protect_data_sql($cp)."',
       			ville='".strtoupper(protect_data_sql($ville))."',
       			pays='".strtoupper(protect_data_sql($pays))."',
       			tel='".protect_data_sql($tel)."',
       			fax='".protect_data_sql($fax)."'
          where id='".$id."'";
         if (grr_sql_command($sql) < 0)
           fatal_error(0,'<p>'.grr_sql_error().'</p>');
           $site = mysql_insert_id();
     }
     // On affiche le tableau des sites
     read_sites();
   }

 }
开发者ID:rhertzog,项目名称:lcs,代码行数:96,代码来源:admin_site.php

示例15: grr_sql_query1

		$res = grr_sql_query1($sql);
		if ($res == -1) {
			$sql = "insert into ".TABLE_PREFIX."_j_useradmin_area (login, id_area) values ('$reg_admin_login',$id_area)";
			if (grr_sql_command($sql) < 0) {fatal_error(1, "<p>" . grr_sql_error());}  else {$msg=get_vocab("add_user_succeed");}
		} else {
           $msg = get_vocab("warning_exist");
		}
	}

}

if ($action) {
    if ($action == "del_admin") {
        unset($login_admin); $login_admin = $_GET["login_admin"];
        $sql = "DELETE FROM ".TABLE_PREFIX."_j_useradmin_area WHERE (login='$login_admin' and id_area = '$id_area')";
        if (grr_sql_command($sql) < 0) {fatal_error(1, "<p>" . grr_sql_error());} else {$msg=get_vocab("del_user_succeed");}
    }
}

echo "<h2>".get_vocab('admin_right_admin.php').grr_help("aide_grr_administateur_restreint")."</h2>\n";
echo "<p><i>".get_vocab("admin_right_admin_explain")."</i></p>\n";

// Affichage d'un pop-up
affiche_pop_up($msg,"admin");

# Table with areas.
echo "<table><tr>\n";
$this_area_name = "";
# Show all areas
echo "<td ><p><b>".get_vocab("areas")."</b></p>\n";
$out_html = "<form id=\"area\" action=\"admin_right_admin.php\" method=\"post\"><div><select name=\"area\" onchange=\"area_go()\">\n";
开发者ID:rhertzog,项目名称:lcs,代码行数:31,代码来源:admin_right_admin.php


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