SQLValue() public static method

[STATIC] Formats any value into a string suitable for SQL statements (NOTE: Also supports data types returned from the gettype function)
public static SQLValue ( mixed $value, string $datatype = self::SQLVALUE_TEXT ) : string
$value mixed Any value of any type to be formatted to SQL
$datatype string Use SQLVALUE constants or the strings: string, text, varchar, char, boolean, bool, Y-N, T-F, bit, date, datetime, time, integer, int, number, double, float
return string
コード例 #1
1
function insertKiiconnect()
{
    global $databaseKiiconnect;
    $data = json_decode(stripslashes($_POST["data"]));
    $update["nombre"] = MySQL::SQLValue($data->nombre);
    $update["tag"] = MySQL::SQLValue($data->tag);
    $update["descripcion"] = MySQL::SQLValue($data->descripcion);
    $update["icono"] = MySQL::SQLValue($data->icono);
    $update["link"] = MySQL::SQLValue($data->link);
    $update["orden"] = MySQL::SQLValue($data->orden);
    $update["id_categoria"] = MySQL::SQLValue($data->id_categoria);
    $update["activo"] = MySQL::SQLValue($data->activo, MySQL::SQLVALUE_NUMBER);
    $databaseKiiconnect->InsertRow("kiiconnect_setting", $update);
    echo json_encode(array("success" => $databaseKiiconnect->ErrorNumber() == 0, "msg" => $databaseKiiconnect->ErrorNumber() == 0 ? "Parametro insertado exitosamente" : $databaseKiiconnect->ErrorNumber(), "data" => array(array("id" => $databaseKiiconnect->GetLastInsertID(), "nombre" => $data->nombre, "tag" => $data->tag, "descripcion" => $data->descripcion, "icono" => $data->icono, "link" => $data->link, "orden" => $data->orden, "id_categoria" => $data->id_categoria, "activo" => $data->activo))));
    //inserto como blob la imagen
    $file = __DIR__ . '/../../../../' . $data->icono;
    if ($fp = fopen($file, "rb", 0)) {
        $picture = fread($fp, filesize($file));
        fclose($fp);
        // base64 encode the binary data, then break it
        // into chunks according to RFC 2045 semantics
        $base64 = chunk_split(base64_encode($picture));
        $tag = 'data:image/png;base64,' . $base64;
    }
    $lastId = $databaseKiiconnect->GetLastInsertID();
    $databaseKiiconnect->Query("update kiiconnect_setting set file='{$tag}'  where `id`='{$lastId}'");
}
コード例 #2
0
ファイル: token.class.php プロジェクト: ATS001/MRN
 public static function creat()
 {
     global $db;
     $values["token"] = MySQL::SQLValue(md5(uniqid(rand(), true)));
     $result = $db->InsertRow("token", $values);
     return TRUE;
 }
コード例 #3
0
ファイル: editcompteuser_m.php プロジェクト: ATS001/MRN
function edituser($id, $fnom, $lnom, $pass, $pseudo, $service, $agence, $tel, $email)
{
    global $db;
    if ($pass != NULL) {
        $values["pass"] = MySQL::SQLValue(md5($pass));
    }
    $values["fnom"] = MySQL::SQLValue($fnom);
    $values["nom"] = MySQL::SQLValue($pseudo);
    $values["servic"] = MySQL::SQLValue($service);
    $values["agence"] = MySQL::SQLValue($agence);
    $values["fnom"] = MySQL::SQLValue($fnom);
    $values["lnom"] = MySQL::SQLValue($lnom);
    $values["mail"] = MySQL::SQLValue($email);
    $values["tel"] = MySQL::SQLValue($tel);
    $where["id"] = MySQL::SQLValue($id);
    // Execute the insert
    $result = $db->UpdateRows("users_sys", $values, $where);
    // ajout champs table synchrone
    $sql = $db->BuildSQLUpdate("users_sys", $values, $where);
    $valuesf["req"] = MySQL::SQLValue($sql);
    $r = $db->InsertRow("temprequet", $valuesf);
    // If we have an error
    if (!$result) {
        // Show the error and kill the script
        $db->Kill($result);
        return false;
    } else {
        return true;
    }
}
コード例 #4
0
/** Lấy dữ liệu */
function get_option($args = array())
{
    if (!is_array($args)) {
        parse_str($args, $args);
    }
    global $hmdb;
    if (isset($args['section'])) {
        $section = $args['section'];
    } else {
        $section = '';
    }
    if (isset($args['key'])) {
        $key = $args['key'];
    } else {
        $key = '';
    }
    if (isset($args['default_value'])) {
        $default_value = $args['default_value'];
    } else {
        $default_value = '';
    }
    if ($section != '' and $key != '') {
        $tableName = DB_PREFIX . 'option';
        $whereArray = array('section' => MySQL::SQLValue($section), 'key' => MySQL::SQLValue($key));
        $hmdb->SelectRows($tableName, $whereArray);
        if ($hmdb->HasRecords()) {
            $row = $hmdb->Row();
            return $row->value;
        } else {
            return $default_value;
        }
    } else {
        return FALSE;
    }
}
コード例 #5
0
ファイル: paiementlocat_m.php プロジェクト: ATS001/MRN_ERP
function setcollecte($id, $mode_paiement, $pj, $date_paiement)
{
    global $db;
    //$nextid=getnextidtable('collecte');
    $date = date('Y-m-d-', strtotime($date_paiement));
    $values["mode_paiement"] = MySQL::SQLValue($mode_paiement);
    $values["date_paiement"] = MySQL::SQLValue($date);
    $values["etat_paiement"] = MySQL::SQLValue("Payé");
    $where["id"] = MySQL::SQLValue($id);
    if (!$db->UpdateRows("collecte", $values, $where)) {
        $db->Kill($db->Error());
        return false;
    } else {
        $sql = $db->BuildSQLInsert("collecte", $values);
        logg('Enregistrement collecte ', 195, $id, $_SESSION['userid']);
        if ($pj != "") {
            $basedir = "upload/collecte";
            if (!file_exists($basedir)) {
                mkdir($basedir, 0, true);
            }
            $newdir = $basedir . "/";
            copyfile($pj, $id, $newdir, "Attachement_collecte_");
            autoarchive($newdir . changnom($pj, $id, 'Attachement_collecte_'), "Fichier joint collecte  {$id}", 195, $id, "collecte", "piece_jointe", $_SESSION['userid'], cryptage(session::get('service'), 0));
        }
        return true;
    }
}
コード例 #6
0
ファイル: addaemploi_m.php プロジェクト: ATS001/MRN_ERP
function addaemploi($id_aemploi, $montant, $date_paiement, $mode_paiement, $ref_pj, $pj)
{
    global $db;
    $nextid = getnextidtable('autorisation_emploi');
    $usrid = $_SESSION['userid'];
    $date = date('Y-m-d-', strtotime($date_paiement));
    $values["pj"] = MySQL::SQLValue($pj);
    $values["ref_pj"] = MySQL::SQLValue($ref_pj);
    $values["id_aemploi"] = MySQL::SQLValue($id_aemploi);
    $values["mode_paiement"] = MySQL::SQLValue($mode_paiement);
    $values["date_paiement"] = MySQL::SQLValue($date);
    $values["montant"] = MySQL::SQLValue($montant);
    $values["addby"] = MySQL::SQLValue($usrid);
    if (!$db->InsertRow("autorisation_emploi", $values)) {
        $db->Kill($db->Error());
        return false;
    } else {
        $sql = $db->BuildSQLInsert("autorisation_emploi", $values);
        logg('Enregistrement Autorisation Emploi ', 246, $nextid, $_SESSION['userid']);
        if ($pj != "") {
            $basedir = "upload/Autorisation";
            if (!file_exists($basedir)) {
                mkdir($basedir, 0, true);
            }
            $newdir = $basedir . "/";
            copyfile($pj, $nextid, $newdir, "Attachement_autorisation_");
            autoarchive($newdir . changnom($pj, $nextid, 'Attachement_autorisation_'), "Fichier joint autorisation emploi {$nextid}", 246, $nextid, "autorisation_emploi", "pj", $_SESSION['userid'], cryptage(session::get('service'), 0));
        }
    }
    return true;
}
コード例 #7
0
        return FALSE;
    }
}
function get_uri_data($args)
{
    $hmdb = new MySQL(true, DB_NAME, DB_HOST, DB_USER, DB_PASSWORD, DB_CHARSET);
    if (!is_array($args)) {
        parse_str($args, $args);
    }
    if (isset($args['uri'])) {
        $uri = $args['uri'];
    } else {
        $uri = FALSE;
    }
    if (isset($args['id'])) {
        $id_uri = $args['id'];
    } else {
        $id_uri = FALSE;
    }
    $tableName = DB_PREFIX . "request_uri";
    if (is_numeric($id_uri)) {
        $whereArray = array('id' => MySQL::SQLValue($id_uri));
    } else {
        $whereArray = array('uri' => MySQL::SQLValue($uri));
    }
    $hmdb->SelectRows($tableName, $whereArray);
    if ($hmdb->HasRecords()) {
        $row = $hmdb->Row();
        return $row;
    } else {
コード例 #8
0
ファイル: editnote_m.php プロジェクト: ATS001/MRN_ERP
function editnote($objet, $note, $id, $dat)
{
    global $db;
    $date = date('Y-m-d', strtotime($dat));
    $getan = date('Y', strtotime($dat));
    $usrid = $_SESSION['userid'];
    $values["objet"] = MySQL::SQLValue($objet);
    $values["dat"] = MySQL::SQLValue($date);
    $where["id"] = MySQL::SQLValue($id);
    // Execute the insert
    $result = $db->UpdateRows("noteservice", $values, $where);
    // ajout champs table synchrone
    $sql = $db->BuildSQLUpdate("noteservice", $values, $where);
    $valuesf["req"] = MySQL::SQLValue($sql);
    $r = $db->InsertRow("temprequet", $valuesf);
    // If we have an error
    if (!$result) {
        // Show the error and kill the script
        $db->Kill('Error Update');
        return false;
    } else {
        logg('Modification Note de service', 12, $id, $_SESSION['userid']);
        $basedir = "upload/noteservice/{$getan}";
        // save file
        if (!file_exists($basedir)) {
            mkdir($basedir, 0, true);
        }
        $newdir = $basedir . "/";
        if ($note != "") {
            copyfile($note, $id, $newdir, "note_");
            //autoarchive($newdir.changnom($note,$id,'note_'),"Note de service N° $id ",12,$id,"noteservice", "file", $_SESSION['userid'],cryptage(session::get('service'),0));
        }
        return true;
    }
}
コード例 #9
0
ファイル: addevent_m.php プロジェクト: ATS001/PRSIT
function addevent($titrfr, $titren, $titrar, $contfr, $conten, $contar, $img, $id, $autfr, $auten, $autar, $dat)
{
    global $db;
    $date = date('Y-m-d-', strtotime($dat));
    $values["titrfr"] = MySQL::SQLValue($titrfr);
    $values["titren"] = MySQL::SQLValue($titren);
    $values["titrar"] = MySQL::SQLValue($titrar);
    $values["contfr"] = MySQL::SQLValue($contfr);
    $values["conten"] = MySQL::SQLValue($conten);
    $values["contar"] = MySQL::SQLValue($contar);
    $values["autfr"] = MySQL::SQLValue($autfr);
    $values["auten"] = MySQL::SQLValue($auten);
    $values["autar"] = MySQL::SQLValue($autar);
    $values["app"] = MySQL::SQLValue('?_tsk=event&id=' . $id);
    $values["dat"] = MySQL::SQLValue($date);
    // Execute the insert
    $result = $db->InsertRow("event", $values);
    // If we have an error
    if (!$result) {
        // Show the error and kill the script
        $db->Kill('Error Insert');
        return false;
    } else {
        if ($img != "") {
            $basedir = "upload/event";
            if (!file_exists($basedir)) {
                mkdir($basedir, 0, true);
            }
            $newdir = "../upload/event/";
            copyfile($img, $id, $newdir, "event_");
            autoarchive($newdir . changnom($img, $id, 'event_'), "Image Evénement {$id} ", 12, $id, "event", "img", $_SESSION['userid'], cryptage(session::get('service'), 0));
        }
        return true;
    }
}
コード例 #10
0
ファイル: addcontratf_m.php プロジェクト: ATS001/MRN_ERP
function add_contrat($nextid, $titre, $fournisseur, $date, $montant_global, $article, $paragraphe, $chapitre, $pj)
{
    global $db;
    $usrid = $_SESSION['userid'];
    $date = date('Y-m-d-', strtotime($date));
    $values["titre"] = MySQL::SQLValue($titre);
    $values["date"] = MySQL::SQLValue($date);
    $values["id_fournisseur"] = MySQL::SQLValue($fournisseur);
    $values["id_chapitre"] = MySQL::SQLValue($chapitre);
    $values["id_article"] = MySQL::SQLValue($article);
    $values["id_paragraphe"] = MySQL::SQLValue($paragraphe);
    $values["montant_global"] = MySQL::SQLValue($montant_global);
    $values["montant_paye"] = MySQL::SQLValue(0);
    $values["pourcentage"] = MySQL::SQLValue(0);
    $values["montant_rest"] = MySQL::SQLValue($montant_global);
    $values["addby"] = MySQL::SQLValue($usrid);
    if (!$db->InsertRow("contrat", $values)) {
        $db->Kill($db->Error());
        return false;
    } else {
        logg('Enregistrement Contrat Fournisseur ', 254, $nextid, $_SESSION['userid']);
        // Save PJ to archive
        if ($pj != "") {
            $basedir = "upload/contrat";
            if (!file_exists($basedir)) {
                mkdir($basedir, 0, true);
            }
            $newdir = $basedir . "/";
            copyfile($pj, $nextid, $newdir, "Attachement_contrat_");
            autoarchive($newdir . changnom($pj, $nextid, 'Attachement_contrat_'), "Fichier joint contrat fournisseur {$nextid}", 254, $nextid, "contrat", "pj", $_SESSION['userid'], cryptage(session::get('service'), 0));
        }
    }
    return true;
}
コード例 #11
0
ファイル: editdoc_m.php プロジェクト: ATS001/PRSIT
function editdoc($titrfr, $titren, $titrar, $img, $id, $art, $typ)
{
    global $db;
    $values["titrfr"] = MySQL::SQLValue($titrfr);
    $values["titren"] = MySQL::SQLValue($titren);
    $values["titrar"] = MySQL::SQLValue($titrar);
    $values["article"] = MySQL::SQLValue($art);
    $values["typ"] = MySQL::SQLValue($typ);
    if ($img != "") {
        $values["img"] = MySQL::SQLValue(changnom($img, $id, 'doc_'));
    }
    $where["id"] = MySQL::SQLValue($id);
    // Execute the insert
    $result = $db->UpdateRows("document", $values, $where);
    // If we have an error
    if (!$result) {
        // Show the error and kill the script
        $db->Kill('Error Update');
        return false;
    } else {
        if ($img != "") {
            $olddir = "upload/doc/";
            $newdir = "../upload/doc/";
            copyfile($img, $id, $newdir, "doc_");
            autoarchive($newdir . changnom($img, $id, 'doc_'), "Document page {$id} ", 12, $id, "document", "img", $_SESSION['userid'], cryptage(session::get('service'), 0));
        }
        return true;
    }
}
コード例 #12
0
ファイル: editalbum_m.php プロジェクト: ATS001/PRSIT
function editalbum($titrfr, $titren, $titrar, $img, $id)
{
    global $db;
    $values["titrfr"] = MySQL::SQLValue($titrfr);
    $values["titren"] = MySQL::SQLValue($titren);
    $values["titrar"] = MySQL::SQLValue($titrar);
    if ($img != "") {
        $values["album"] = MySQL::SQLValue(changnom($img, $id, "album_"));
    }
    $where["id"] = MySQL::SQLValue($id);
    // Execute the insert
    $result = $db->UpdateRows("album", $values, $where);
    // If we have an error
    if (!$result) {
        // Show the error and kill the script
        $db->Kill($result);
        return false;
    } else {
        if ($img != "") {
            $olddir = "upload/album/";
            $newdir = "../upload/album/" . $id . "/";
            copyfile($img, $id, $olddir, "album_");
            clearDir($newdir);
            extractzip($olddir, "album_" . $id . ".zip", $id, $newdir);
        }
        return true;
    }
}
コード例 #13
0
ファイル: editcollecte_m.php プロジェクト: ATS001/MRN_ERP
function editcollecte($idcontrat, $paiement, $date, $pj)
{
    global $db;
    $usrid = $_SESSION['userid'];
    $nextid = getnextidtable('collecte');
    //$date1=date_create($date);
    //$datep=date_format($date1,"Y-m-d");
    $date_paiement = date('Y-m-d-', strtotime($date));
    $values["mode_paiement"] = MySQL::SQLValue($paiement);
    $values["date_paiement"] = MySQL::SQLValue($date_paiement);
    $where["id"] = MySQL::SQLValue($idcontrat);
    if (!$db->UpdateRows("collecte", $values, $where)) {
        $db->Kill($db->Error());
        return false;
    } else {
        $sql = $db->BuildSQLInsert("collecte", $values);
        logg('Enregistrement collecte ', 201, $nextid, $_SESSION['userid']);
        if ($pj != "") {
            $basedir = "upload/collecte";
            if (!file_exists($basedir)) {
                mkdir($basedir, 0, true);
            }
            $newdir = $basedir . "/";
            copyfile($pj, $nextid, $newdir, "collecte");
            autoarchive($newdir . changnom($pj, $nextid, 'collecte'), "Fichier joint collecte {$nextid}", 201, $nextid, "collecte", "piece_jointe", $_SESSION['userid'], cryptage(session::get('service'), 0));
        }
        return true;
    }
}
コード例 #14
0
ファイル: resiliercontrat_m.php プロジェクト: ATS001/MRN_ERP
function setcontrat($id, $date, $pj)
{
    global $db;
    $etat = "Résilié";
    $nextid = getnextidtable('contrat_location_villa');
    $date = date('Y-m-d-', strtotime($date));
    $values["date_resiliation"] = MySQL::SQLValue($date);
    $values["etat"] = MySQL::SQLValue($etat);
    $where["id"] = MySQL::SQLValue($id);
    if (!$db->UpdateRows("contrat_location_villa", $values, $where)) {
        $db->Kill($db->Error());
        return false;
    } else {
        $sql = $db->BuildSQLInsert("contrat_location_villa", $values);
        logg('Enregistrement Location Villa ', 233, $id, $_SESSION['userid']);
        if ($pj != "") {
            $basedir = "upload/location";
            if (!file_exists($basedir)) {
                mkdir($basedir, 0, true);
            }
            $newdir = $basedir . "/";
            copyfile($pj, $id, $newdir, "Attachement_location_");
            autoarchive($newdir . changnom($pj, $id, 'Attachement_location_'), "Fichier joint location ville {$id}", 233, $id, "contrat_location_villa", "pj_resiliation", $_SESSION['userid'], cryptage(session::get('service'), 0));
        }
        return true;
    }
}
コード例 #15
0
ファイル: addsalarie_m.php プロジェクト: ATS001/MRN_ERP
function addsalarie2($nextid, $salarie, $nom_banque, $num_compte, $taux_anc, $iden_eau_elec, $indem_domec, $nouveau_salaire, $idem_log, $indem_caisse, $indem_risque, $indem_resp, $indem_tel)
{
    global $db2;
    $usrid = $_SESSION['userid'];
    $indem_total = $idem_log + $indem_caisse + $indem_risque + $indem_resp + $indem_tel + $indem_domec + $iden_eau_elec;
    $indem_total = $idem_log + $indem_caisse + $indem_risque + $indem_resp + $indem_tel + $indem_domec + $iden_eau_elec;
    $values["nom_banque"] = MySQL::SQLValue($nom_banque);
    $values["numero_compte"] = MySQL::SQLValue($num_compte);
    $values["taux_anciennete"] = MySQL::SQLValue($taux_anc);
    $values["salaire_de_base"] = MySQL::SQLValue($salarie);
    $values["nouveau_salaire"] = MySQL::SQLValue($nouveau_salaire);
    $values["indem_logement"] = MySQL::SQLValue($idem_log);
    $values["indem_caisse"] = MySQL::SQLValue($indem_caisse);
    $values["indem_risque"] = MySQL::SQLValue($indem_risque);
    $values["indem_responsabilite"] = MySQL::SQLValue($indem_resp);
    $values["idem_telephone"] = MySQL::SQLValue($indem_tel);
    $values["indem_domisticite"] = MySQL::SQLValue($indem_domec);
    $values["idem_eau_electrique"] = MySQL::SQLValue($iden_eau_elec);
    $values["id_salarie"] = MySQL::SQLValue($nextid);
    $values["INDEM"] = MySQL::SQLValue($indem_total);
    $values["addby"] = MySQL::SQLValue($usrid);
    if (!$db2->InsertRow("info_personnel_budgetaire", $values)) {
        $db2->Kill($db2->Error());
        return false;
    } else {
        $sql = $db2->BuildSQLInsert("info_personnel_budgetaire", $values);
        return true;
    }
}
コード例 #16
0
ファイル: addsecteur_m.php プロジェクト: ATS001/MRN_ERP
function addsecteur($id, $secteur, $groupe, $idgrp)
{
    global $db;
    $values["secteur"] = MySQL::SQLValue($secteur);
    if ($groupe == true) {
        $values["groupe"] = MySQL::SQLValue(1);
        $values["idgroupe"] = MySQL::SQLValue($id);
    } else {
        $values["groupe"] = MySQL::SQLValue(0);
        $values["idgroupe"] = MySQL::SQLValue($idgrp);
    }
    // Execute the insert
    //$result = $db->InsertRow("offre", $values);
    // If we have an error
    if (!$db->InsertRow("secteur", $values)) {
        // Show the error and kill the script
        $db->Kill($db->Error());
        return false;
    } else {
        $sql = $db->BuildSQLInsert("secteur", $values);
        $valuesf["req"] = MySQL::SQLValue($sql);
        $r = $db->InsertRow("temprequet", $valuesf);
        return true;
    }
}
コード例 #17
0
ファイル: admin_atividade.php プロジェクト: marcosyyz/self
 public function gravar($titulo, $descricao, $serie, $tipo, $ordem, $nivel, $verificaacento, $criador, $revisor, $materia, $assunto)
 {
     // valores a serem inseridos
     $valores["ATIVIDADE_NOME"] = MySQL::SQLValue($titulo, MySQL::SQLVALUE_TEXT);
     $valores["ATIVIDADE_DESC"] = MySQL::SQLValue($descricao, MySQL::SQLVALUE_TEXT);
     $valores["ATIVIDADE_SERIE"] = MySQL::SQLValue($serie, MySQL::SQLVALUE_NUMBER);
     $valores["ATIVIDADE_TIPO"] = MySQL::SQLValue($tipo, MySQL::SQLVALUE_NUMBER);
     $valores["ATIVIDADE_ORDEM"] = MySQL::SQLValue($ordem, MySQL::SQLVALUE_NUMBER);
     $valores["ATIVIDADE_NIVEL"] = MySQL::SQLValue($nivel, MySQL::SQLVALUE_NUMBER);
     $valores["ATIVIDADE_VERIFICAACENTO"] = MySQL::SQLValue($verificaacento, MySQL::SQLVALUE_NUMBER);
     //consultar se ja existe
     $this->db->Query(" SELECT * FROM ATIVIDADE WHERE ATIVIDADE_CDG = " . $this->atividade_cdg);
     $this->db->MoveFirst();
     // se  ja existe
     if ($this->db->RowCount() > 0) {
         // update
         $where["ATIVIDADE_CDG"] = MySQL::SQLValue($this->atividade_cdg, MySQL::SQLVALUE_NUMBER);
         $this->db->UpdateRows("ATIVIDADE", $valores, $where);
         return -1;
     } else {
         // se nao, executa insert
         $valores["ATIVIDADE_CRIADOR"] = MySQL::SQLValue($criador, MySQL::SQLVALUE_TEXT);
         $this->db->InsertRow("ATIVIDADE", $valores);
         return $this->db->GetLastInsertID();
     }
 }
コード例 #18
0
ファイル: adddoc_m.php プロジェクト: ATS001/PRSIT
function addnews($titrfr, $titren, $titrar, $img, $id, $art, $typ)
{
    global $db;
    $values["titrfr"] = MySQL::SQLValue($titrfr);
    $values["titren"] = MySQL::SQLValue($titren);
    $values["titrar"] = MySQL::SQLValue($titrar);
    $values["article"] = MySQL::SQLValue($art);
    $values["typ"] = MySQL::SQLValue($typ);
    // Execute the insert
    $result = $db->InsertRow("document", $values);
    // If we have an error
    if (!$result) {
        // Show the error and kill the script
        $db->Kill($result);
        return false;
    } else {
        if ($img != "") {
            $basedir = "upload/doc";
            if (!file_exists($basedir)) {
                mkdir($basedir, 0, true);
            }
            $newdir = "../upload/doc/";
            if (!file_exists($newdir)) {
                mkdir($newdir, 0, true);
            }
            $file = "./upload/doc/" . changnom($img, $id, 'doc_');
            copyfile($img, $id, $newdir, "doc_");
            autoarchive($file, "Document page {$id} ", 12, $id, "document", "img", $_SESSION['userid'], cryptage(session::get('service'), 0));
        }
        return true;
    }
}
コード例 #19
0
ファイル: user_m.php プロジェクト: ATS001/MRN_ERP
function adduser($nom, $fnom, $lnom, $pass, $mail, $service, $signe, $id, $agence, $tel, $img)
{
    // $arrayVariable["column name"] = formatted SQL value
    global $db;
    $values["nom"] = MySQL::SQLValue($nom);
    $values["mail"] = MySQL::SQLValue($mail);
    $values["pass"] = MySQL::SQLValue(md5($pass));
    $values["servic"] = MySQL::SQLValue($service);
    $values["fnom"] = MySQL::SQLValue($fnom);
    $values["lnom"] = MySQL::SQLValue($lnom);
    $values["tel"] = MySQL::SQLValue($tel);
    $values["active"] = MySQL::SQLValue(1);
    $values["defapp"] = MySQL::SQLValue(3);
    $values["agence"] = MySQL::SQLValue($agence);
    $values["signature"] = MySQL::SQLValue(changnom($signe, $id, 'signature_'));
    $values["photo"] = MySQL::SQLValue(changnom($img, $id, 'photo_'));
    // Execute the insert
    $result = $db->InsertRow("users_sys", $values);
    // If we have an error
    if (!$result) {
        // Show the error and kill the script
        $db->Kill($db->Error());
        return false;
    } else {
        addrules($id, $service);
        $newdir = "upload/signature/";
        if ($signe != "") {
            copyfile($signe, $id, $newdir, "signature_");
        }
        if ($img != "") {
            copyfile($img, $id, $newdir, "signature_");
        }
        return true;
    }
}
コード例 #20
0
ファイル: editsalarie_m.php プロジェクト: ATS001/MRN_ERP
function editsalarie2($id, $salaire, $nom_banque, $num_compte, $taux_anc, $iden_eau_elec, $indem_domec, $nouveau_salaire, $idem_log, $indem_caisse, $indem_risque, $indem_resp, $indem_tel)
{
    $indem_total = $idem_log + $indem_caisse + $indem_risque + $indem_resp + $indem_tel + $indem_domec + $iden_eau_elec;
    global $db;
    $values["nom_banque"] = MySQL::SQLValue($nom_banque);
    $values["numero_compte"] = MySQL::SQLValue($num_compte);
    $values["taux_anciennete"] = MySQL::SQLValue($taux_anc);
    $values["salaire_de_base"] = MySQL::SQLValue($salaire);
    $values["nouveau_salaire"] = MySQL::SQLValue($nouveau_salaire);
    $values["indem_logement"] = MySQL::SQLValue($idem_log);
    $values["indem_caisse"] = MySQL::SQLValue($indem_caisse);
    $values["indem_risque"] = MySQL::SQLValue($indem_risque);
    $values["indem_responsabilite"] = MySQL::SQLValue($indem_resp);
    $values["idem_telephone"] = MySQL::SQLValue($indem_tel);
    $values["indem_domisticite"] = MySQL::SQLValue($indem_domec);
    $values["idem_eau_electrique"] = MySQL::SQLValue($iden_eau_elec);
    $values["INDEM"] = MySQL::SQLValue($indem_total);
    $where["id_salarie"] = MySQL::SQLValue($id);
    if (!$db->UpdateRows("info_personnel_budgetaire", $values, $where)) {
        $db->Kill($db->Error());
        return false;
    } else {
        $sql = $db->BuildSQLInsert("info_personnel_budgetaire", $values);
        return true;
    }
}
コード例 #21
0
ファイル: addmail_m.php プロジェクト: ATS001/PRSIT
function addmail($nom, $fnom, $lnom, $tel, $mail, $service)
{
    // $arrayVariable["column name"] = formatted SQL value
    global $db;
    $mdp = ChaineAleatoire(8);
    $values["pseudo"] = MySQL::SQLValue($nom);
    $values["mail"] = MySQL::SQLValue($mail);
    $values["tel"] = MySQL::SQLValue($tel);
    $values["fonction"] = MySQL::SQLValue($service);
    $values["nom"] = MySQL::SQLValue($fnom);
    $values["prenom"] = MySQL::SQLValue($lnom);
    $values["mdp"] = MySQL::SQLValue($mdp);
    // Execute the insert
    $result = $db->InsertRow("mail", $values);
    // If we have an error
    if (createmail($nom, $mdp)) {
        if (!$result) {
            $db->Kill($result);
            return false;
        } else {
            // createmail($nom,$mdp);
            sendmail($fnom, $mail, $nom, $mdp, $lnom);
            return true;
        }
    } else {
        return false;
    }
}
コード例 #22
0
function insertXmltv()
{
    global $databaseXmltv;
    $data = json_decode(stripslashes($_POST["data"]));
    $update["title"] = MySQL::SQLValue($data->title);
    $update["date_end"] = MySQL::SQLValue($data->date_end);
    $update["date_start"] = MySQL::SQLValue($data->date_start);
    $update["hora"] = MySQL::SQLValue($data->hora);
    $update["duration"] = MySQL::SQLValue($data->duration);
    $update["description"] = MySQL::SQLValue($data->description);
    $update["activo"] = MySQL::SQLValue($data->activo);
    $update["imagen"] = MySQL::SQLValue($data->imagen);
    $update["category"] = MySQL::SQLValue($data->category);
    $update["id_channel"] = MySQL::SQLValue($data->id_channel);
    $update["id_frecuencia"] = MySQL::SQLValue($data->id_frecuencia);
    $databaseXmltv->InsertRow("xmltv_programme", $update);
    echo json_encode(array("success" => $databaseXmltv->ErrorNumber() == 0, "msg" => $databaseXmltv->ErrorNumber() == 0 ? "Parametro insertado exitosamente" : $databaseXmltv->ErrorNumber(), "data" => array(array("id" => $databaseXmltv->GetLastInsertID(), "title" => $data->title, "date_end" => $data->date_end, "date_start" => $data->date_start, "hora" => $data->hora, "duration" => $data->duration, "description" => $data->description, "activo" => $data->activo, "imagen" => $data->imagen, "category" => $data->category, "id_channel" => $data->id_channel, "id_frecuencia" => $data->id_frecuencia))));
    //inserto como blob la imagen
    $file = __DIR__ . '/../../../../' . $data->imagen;
    if ($fp = fopen($file, "rb", 0)) {
        $picture = fread($fp, filesize($file));
        fclose($fp);
        // base64 encode the binary data, then break it
        // into chunks according to RFC 2045 semantics
        //$base64 = chunk_split(base64_encode($picture));
        $base64 = base64_encode($picture);
        $imagen = 'data:image/png;base64,' . $base64;
    } else {
        $imagen = "";
    }
    $lastId = $databaseXmltv->GetLastInsertID();
    $databaseXmltv->Query("update xmltv_programme set file= '{$imagen}'   where `id`='{$lastId}'");
}
コード例 #23
0
ファイル: editlocation_m.php プロジェクト: ATS001/MRN_ERP
function editlocation($nextid, $nom, $adresse, $pj, $tel, $mail, $villa, $date_debut, $date_fin, $type_paiement, $montant_location, $agarantie_location)
{
    global $db;
    $usrid = $_SESSION['userid'];
    $datedebut = date('Y-m-d-', strtotime($date_debut));
    $datefin = date('Y-m-d-', strtotime($date_fin));
    $values["nomlocataire"] = MySQL::SQLValue($nom);
    $values["adresse"] = MySQL::SQLValue($adresse);
    $values["tel"] = MySQL::SQLValue($tel);
    $values["mail"] = MySQL::SQLValue($mail);
    $values["idvilla"] = MySQL::SQLValue($villa);
    $values["date_debut"] = MySQL::SQLValue($datedebut);
    $values["date_fin"] = MySQL::SQLValue($datefin);
    $values["montant"] = MySQL::SQLValue($montant_location);
    $values["depot_garantie"] = MySQL::SQLValue($agarantie_location);
    $values["type_paiement"] = MySQL::SQLValue($type_paiement);
    $where["id"] = MySQL::SQLValue($nextid);
    if (!$db->UpdateRows("contrat_location_villa", $values, $where)) {
        $db->Kill($db->Error());
        return false;
    } else {
        $sql = $db->BuildSQLInsert("contrat_location_villa", $values);
        logg('Enregistrement Location Villa ', 100, $nextid, $_SESSION['userid']);
        if ($pj != "") {
            $basedir = "upload/location";
            if (!file_exists($basedir)) {
                mkdir($basedir, 0, true);
            }
            $newdir = $basedir . "/";
            copyfile($pj, $nextid, $newdir, "Attachement_location_");
            autoarchive($newdir . changnom($pj, $nextid, 'Attachement_location_'), "Fichier joint location ville {$nextid}", 100, $nextid, "location_villa", "pj", $_SESSION['userid'], cryptage(session::get('service'), 0));
        }
        return true;
    }
}
コード例 #24
0
ファイル: usuario.php プロジェクト: marcosyyz/self
 function gravar($usuario_cdg, $nome, $login, $senha, $cargo, $escola)
 {
     // valores a serem inseridos
     $valores["USUARIO_NOME"] = MySQL::SQLValue($nome, MySQL::SQLVALUE_TEXT);
     $valores["USUARIO_LOGIN"] = MySQL::SQLValue($login, MySQL::SQLVALUE_TEXT);
     $valores["USUARIO_CARGO"] = MySQL::SQLValue($cargo, MySQL::SQLVALUE_TEXT);
     //consultar se ja existe
     $this->db->Query(" SELECT * FROM USUARIO WHERE USUARIO_CDG = " . $usuario_cdg);
     $this->db->MoveFirst();
     // se  ja existe
     if ($this->db->RowCount() > 0) {
         // update
         $where["USUARIO_CDG"] = MySQL::SQLValue($usuario_cdg, MySQL::SQLVALUE_NUMBER);
         $this->db->UpdateRows("USUARIO", $valores, $where);
         $retorno = -1;
     } else {
         // se nao, executa insert
         $this->db->InsertRow("USUARIO", $valores);
         $retorno = $this->db->GetLastInsertID();
     }
     $usuario_cdg = $usuario_cdg == -1 ? $retorno : $usuario_cdg;
     if ($usuario_cdg != -1) {
         $this->gravar_usuarioEscola($usuario_cdg, $escola);
     }
     $this->db->Query(" UPDATE USUARIO SET USUARIO_SENHA = '" . base64_encode($senha) . "' \n                          WHERE USUARIO_CDG = " . $usuario_cdg);
     return $retorno;
 }
コード例 #25
0
function insertKiiconnect()
{
    global $databaseKiiconnect;
    $data = json_decode(stripslashes($_POST["data"]));
    $update["nombre"] = MySQL::SQLValue($data->nombre);
    $databaseKiiconnect->InsertRow("kiiconnect_categoria", $update);
    echo json_encode(array("success" => $databaseKiiconnect->ErrorNumber() == 0, "msg" => $databaseKiiconnect->ErrorNumber() == 0 ? "Parametro insertado exitosamente" : $databaseKiiconnect->ErrorNumber(), "data" => array(array("id" => $databaseKiiconnect->GetLastInsertID(), "nombre" => $data->nombre, "icono" => $data->icono, "iconodev" => $data->iconodev, "activo" => $data->iconodev, "orden2" => $data->orden2))));
    $lastId = $databaseKiiconnect->GetLastInsertID();
    //inserto como blob la imagen
    $file = __DIR__ . '/../../../../' . $data->icono;
    if ($fp = fopen($file, "rb", 0)) {
        $picture = fread($fp, filesize($file));
        fclose($fp);
        // base64 encode the binary data, then break it
        // into chunks according to RFC 2045 semantics
        //$base64 = chunk_split(base64_encode($picture));
        $base64 = base64_encode($picture);
        $tag = 'data:image/png;base64,' . $base64;
    }
    //$databaseKiiconnect->Query("update kiiconnect_categoria set filecategoria= '$tag'   where `id`='$lastId'");
    $databaseKiiconnect->Query("update kiiconnect_categoria set filecategoria2= '{$tag}'   where `id`='{$lastId}'");
    //inserto como blob la imagen dev
    $filedev = __DIR__ . '/../../../../' . $data->iconodev;
    if ($fpdev = fopen($filedev, "rb", 0)) {
        $picturedev = fread($fpdev, filesize($filedev));
        fclose($fpdev);
        $base64dev = base64_encode($picturedev);
        $tagdev = 'data:image/png;base64,' . $base64dev;
    }
    $databaseKiiconnect->Query("update kiiconnect_categoria set filecategoriadev= '{$tagdev}'   where `id`='{$lastId}'");
}
コード例 #26
0
ファイル: recovery_m.php プロジェクト: ATS001/MRN_ERP
function recovery_pass($psw1, $token)
{
    //vèrifier si le lien valid
    global $db;
    //Get user ID
    $user_id = $db->QuerySingleValue("SELECT user FROM forgot where token='{$token}' and etat =0");
    $value["pass"] = MySQL::SQLValue(md5($psw1));
    $where["id"] = MySQL::SQLValue($user_id);
    // Execute the insert
    $result = $db->UpdateRows("users_sys", $value, $where);
    if (!$result) {
        // Show the error and kill the script
        $db->Kill('Error Update users_sys');
        return false;
    } else {
        $values["etat"] = MySQL::SQLValue(1);
        $wheres["token"] = MySQL::SQLValue($token);
        // Execute the insert
        $results = $db->UpdateRows("forgot", $values, $wheres);
        if (!$results) {
            // Show the error and kill the script
            $db->Kill('Error Update forgot' . $db->Error());
            return false;
        } else {
            return true;
        }
        return true;
    }
}
コード例 #27
0
ファイル: Comentario.php プロジェクト: marcosyyz/dm
 function inserir_comentario($texto, $usuario, $data, $noticia, $item, $rating)
 {
     // valores a serem inseridos
     $retorno = false;
     $valores_coment["COMENTARIO_TEXTO"] = MySQL::SQLValue($texto, MySQL::SQLVALUE_TEXT);
     $valores_coment["COMENTARIO_DATA"] = MySQL::SQLValue($data != -1 ? $data : date("d-m-Y G:i"), MySQL::SQLVALUE_DATETIME);
     $valores_coment["COMENTARIO_USUARIO"] = MySQL::SQLValue($usuario, MySQL::SQLVALUE_NUMBER);
     $valores_coment["COMENTARIO_RATING"] = MySQL::SQLValue($rating, MySQL::SQLVALUE_NUMBER);
     $this->db->InsertRow("COMENTARIO", $valores_coment);
     $comentario_inserido = $this->db->GetLastInsertID();
     if ($noticia != -1 && $comentario_inserido != -1) {
         $valores_relacaocoment["NOTCOMENTARIO_NOTICIA"] = MySQL::SQLValue($noticia, MySQL::SQLVALUE_NUMBER);
         $valores_relacaocoment["NOTCOMENTARIO_COMENTARIO"] = MySQL::SQLValue($comentario_inserido, MySQL::SQLVALUE_NUMBER);
         $valores_relacaocoment["NOTCOMENTARIO_USUARIO"] = MySQL::SQLValue($usuario, MySQL::SQLVALUE_NUMBER);
         $this->db->InsertRow("NOTICIA_COMENTARIO", $valores_relacaocoment);
         $retorno = true;
     }
     if ($item != -1 && $comentario_inserido != -1) {
         $valores_relacaocoment["ITEMCOMENTARIO_ITEM"] = MySQL::SQLValue($item, MySQL::SQLVALUE_NUMBER);
         $valores_relacaocoment["ITEMCOMENTARIO_COMENTARIO"] = MySQL::SQLValue($comentario_inserido, MySQL::SQLVALUE_NUMBER);
         $valores_relacaocoment["ITEMCOMENTARIO_USUARIO"] = MySQL::SQLValue($usuario, MySQL::SQLVALUE_NUMBER);
         $this->db->InsertRow("ITEM_COMENTARIO", $valores_relacaocoment);
         $retorno = true;
     }
     return $retorno;
 }
コード例 #28
0
ファイル: edituser_m.php プロジェクト: ATS001/MRN
function edituser($fnom, $lnom, $service, $tel, $id, $signe, $agence)
{
    global $db;
    if ($service != NULL) {
        $values["servic"] = MySQL::SQLValue($service);
    }
    $values["fnom"] = MySQL::SQLValue($fnom);
    $values["lnom"] = MySQL::SQLValue($lnom);
    $values["active"] = MySQL::SQLValue(1);
    $values["tel"] = MySQL::SQLValue($tel);
    $values["agence"] = MySQL::SQLValue($agence);
    $where["id"] = MySQL::SQLValue($id);
    if ($signe != NULL) {
        $values["signature"] = MySQL::SQLValue(changnom($signe, $id, 'signature_'));
    }
    // Execute the insert
    $result = $db->UpdateRows("users_sys", $values, $where);
    // ajout champs table synchrone
    $sql = $db->BuildSQLUpdate("users_sys", $values, $where);
    $valuesf["req"] = MySQL::SQLValue($sql);
    $r = $db->InsertRow("temprequet", $valuesf);
    // If we have an error
    if (!$result) {
        // Show the error and kill the script
        $db->Kill($result);
        return false;
    } else {
        $newdir = "upload/signature/";
        if ($signe != NULL) {
            copyfile($signe, $id, $newdir, "signature_");
        }
        return true;
    }
}
コード例 #29
0
ファイル: editreform_m.php プロジェクト: ATS001/MRN_ERP
function editreform($nextid, $titre, $desc, $montant, $pj, $date)
{
    global $db;
    $usrid = $_SESSION['userid'];
    $date_operation = date('Y-m-d-', strtotime($date));
    $values["titre"] = MySQL::SQLValue($titre);
    $values["description"] = MySQL::SQLValue($desc);
    $values["montant"] = MySQL::SQLValue($montant);
    $values["date_operation"] = MySQL::SQLValue($date_operation);
    $where["id"] = MySQL::SQLValue($nextid);
    if (!$db->UpdateRows("produit_reform", $values, $where)) {
        $db->Kill($db->Error());
        return false;
    } else {
        $sql = $db->BuildSQLInsert("produit_reform", $values);
        logg('Enregistrement Produit Reform ', 167, $nextid, $_SESSION['userid']);
        if ($pj != "") {
            $basedir = "upload/produit";
            if (!file_exists($basedir)) {
                mkdir($basedir, 0, true);
            }
            $newdir = $basedir . "/";
            copyfile($pj, $nextid, $newdir, "Attachement_produit_reform");
            autoarchive($newdir . changnom($pj, $nextid, 'Attachement_produit_reform'), "Fichier joint produit Reform  {$nextid}", 100, $nextid, "produit_reform", "pj", $_SESSION['userid'], cryptage(session::get('service'), 0));
        }
        return true;
    }
}
コード例 #30
0
ファイル: SampleModel.php プロジェクト: arielcr/mvc-framework
 public function modificar($datos)
 {
     $datos["columna1"] = MySQL::SQLValue($datos['columna1']);
     $datos["columna2"] = MySQL::SQLValue($datos['columna2']);
     $filtro["id"] = $datos['id'];
     $this->db->UpdateRows("tabla", $datos, $filtro);
 }