public function submit_form() { $subject = $_POST["subject"]; $topic = $_POST["topic"]; $question = $_POST["question"]; $file = $_FILES["file"]; $key = 0; $data = array(); $data["file_path"] = ""; if ($file["size"] != 0) { $this->load->helper('common_function'); $uniquename = unique(); $config['upload_path'] = $this->gallery_path; $config['allowed_types'] = 'jpeg|jpg|bmp|png|pdf|docx'; $config['file_name'] = $uniquename; $config['max_size'] = '3000'; $config['overwrite'] = false; $this->load->library('upload', $config); if ($this->upload->do_upload('file')) { $data["upload_data"] = $this->upload->data(); $data["file_path"] = base_url() . 'vidhyasanidhi/files/' . $data["upload_data"]["file_name"]; } } if ($subject == "") { $data["error"][$key]["type"] = "subject"; $data["error"][$key]["msg"] = "You should select a subject"; $key++; } if ($topic == "") { $data["error"][$key]["type"] = "topic"; $data["error"][$key]["msg"] = "Topic can not be blank"; $key++; } if ($question == "") { $data["error"][$key]["type"] = "question"; $data["error"][$key]["msg"] = "Question can not be blank"; $key++; } if ($key == 0) { $data["success"] = 1; $session = $this->session->userdata("user_data"); $user_id = $session["user_id"]; $data_to = array(); $data_to["user_id"] = $user_id; $data_to["subject"] = $subject; $data_to["topic"] = $topic; $data_to["question"] = $question; $data_to["post"] = 0; $data_to["course"] = $_POST["course"]; $data_to["unique_id"] = uniqid(); $data_to["file_url"] = $data["file_path"]; $this->db->insert("tbl_ask_question", $data_to); $question_id = $this->db->insert_id(); $this->session->set_flashdata("ask_question", 2); } else { $data["success"] = 0; } return $data; }
/** * Run the migrations. * * @return void */ public function up() { Schema::create('categories', function (Blueprint $table) { $table->increments('id'); $table->string('name') - unique(); $table->string('description'); $table->timestamps(); }); }
function trier_rss($texte) { if (preg_match_all(",<item.*</item>\\s*?,Uims", $texte, $matches, PREG_SET_ORDER)) { $placeholder = "<!--REINSERT-->"; $items = array(); foreach ($matches as $match) { if (preg_match(',<dc:date>(.*)</dc:date>,Uims', $match[0], $r)) { $items[strtotime($r[1])] = trim($match[0]); $texte = str_replace($match[0], unique($placeholder), $texte); } } krsort($items); $texte = str_replace($placeholder, implode("\n\t", $items) . "\n", $texte); } return $texte; }
public function salt($count = 10, $table_name = '', $field_name = '', $find = FALSE) { function unique($count) { return substr(strtoupper(sha1(uniqid() . $_SERVER['REMOTE_ADDR'] . microtime())), 0, $count); } if ($this->CI->db->table_exists($table_name) && $this->CI->db->field_exists($field_name, $table_name)) { while (!$find) { $salt = unique($count); if ($this->CI->db->select('h.' . $field_name)->from($table_name . ' h')->where('h.' . $field_name, $salt)->get()->num_rows() == 0) { $find = TRUE; } } } return $salt; }
function BOUCLE_langueshtml_9491858aea5af6033788aa1936ebca8d(&$Cache, &$Pile, &$doublons, &$Numrows, $SP) { static $command = array(); static $connect; $command['connect'] = $connect = ''; if (!isset($command['table'])) { $command['table'] = 'rubriques'; $command['id'] = '_langues'; $command['from'] = array('rubriques' => 'spip_rubriques'); $command['type'] = array(); $command['groupby'] = array(); $command['select'] = array("rubriques.lang", "rubriques.titre"); $command['orderby'] = array('rubriques.lang'); $command['join'] = array(); $command['limit'] = ''; $command['having'] = array(); } $command['where'] = array(quete_condition_statut('rubriques.statut', '!', 'publie', ''), array('=', 'rubriques.id_parent', 0), array('NOT', array('=', 'rubriques.lang', sql_quote(interdire_scripts(entites_html(table_valeur(@$Pile[0], (string) 'lang', null), true)), '', 'varchar(10) NOT NULL DEFAULT \'\'')))); if (defined("_BOUCLE_PROFILER")) { $timer = time() + microtime(); } $t0 = ""; // REQUETE $iter = IterFactory::create("SQL", $command, array('squelettes/inc/inc-bas_menu-lang.html', 'html_9491858aea5af6033788aa1936ebca8d', '_langues', 18, $GLOBALS['spip_lang'])); if (!$iter->err()) { lang_select($GLOBALS['spip_lang']); $SP++; // RESULTATS while ($Pile[$SP] = $iter->fetch()) { lang_select_public($Pile[$SP]['lang'], '', $Pile[$SP]['titre']); $t0 .= ($t1 = strval(traduire_nom_langue(unique(spip_htmlentities($Pile[$SP]['lang'] ? $Pile[$SP]['lang'] : $GLOBALS['spip_lang']))))) !== '' ? ' <span lang="' . spip_htmlentities($Pile[$SP]['lang'] ? $Pile[$SP]['lang'] : $GLOBALS['spip_lang']) . '" xml:lang="' . spip_htmlentities($Pile[$SP]['lang'] ? $Pile[$SP]['lang'] : $GLOBALS['spip_lang']) . '">| <a href="spip.php?action=converser&var_lang=' . spip_htmlentities($Pile[$SP]['lang'] ? $Pile[$SP]['lang'] : $GLOBALS['spip_lang']) . '&redirect=/" rel="alternate" title="' . _T('public|spip|ecrire:accueil_site') . ' : ' . traduire_nom_langue(spip_htmlentities($Pile[$SP]['lang'] ? $Pile[$SP]['lang'] : $GLOBALS['spip_lang'])) . '" dir="' . lang_dir($Pile[$SP]['lang'], 'ltr', 'rtl') . '">' . $t1 . '</a> </span> ' : ''; lang_select(); } lang_select(); $iter->free(); } if (defined("_BOUCLE_PROFILER") and 1000 * ($timer = time() + microtime() - $timer) > _BOUCLE_PROFILER) { spip_log(intval(1000 * $timer) . "ms BOUCLE_langues @ squelettes/inc/inc-bas_menu-lang.html", "profiler" . _LOG_AVERTISSEMENT); } return $t0; }
public function create_thread($uid, $id) { //thread check if already created or not $thraedQuery = $this->db->query("select * from tbl_message_thread where (`sender_id`='{$uid}' and `receiver_id`='{$id}') or (`sender_id`='{$id}' and `receiver_id`='{$uid}')"); if ($thraedQuery->num_rows() < 1) { $threadFields = array('thread_id' => unique(), 'sender_id' => $uid, 'receiver_id' => $id, 'created_time' => date('Y-m-d H:i:s')); $threadResponse = $this->db->insert('tbl_message_thread', $threadFields); } else { return true; } }
/** * Afficher l'avancement de la copie * * @staticvar int $etape Nombre de fois ou on est passe dans cette foncion * @param <type> $courant Flag pour indiquer si c'est la table sur laquelle on travaille actuellement * @param <type> $total Nombre total de tables * @param <type> $table Nom de la table */ function dump_afficher_progres($courant, $total, $table) { static $etape = 1; if (unique($table)) { if ($total < 0 or !is_numeric($total)) { echo "<br /><strong>" . $etape . '. ' . "</strong>{$table} "; } else { echo "<br /><strong>" . $etape . '. ' . "{$table}</strong> " . ($courant ? " <i>({$courant})</i> " : ""); } $etape++; } if (is_numeric($total) and $total >= 0) { echo ". "; } else { echo "(" . -intval($total) . ")"; } flush(); }
function auditoria_sistema($conexion, $tabla, $id_user, $proceso, $id_registro, $fecha_larga, $fecha, $sql_nuevo, $sql_anterior) { $cliente = $_SERVER['REMOTE_ADDR']; $server = $_SERVER['SERVER_ADDR']; $id = unique($fecha_larga); if ($proceso == 'Insert') { $consulta = "insert into auditoria values ('{$id}','{$tabla}','{$id_registro}',array[''],{$sql_nuevo}::text[],'{$proceso}','{$id_user}','{$cliente}','{$server}','0','{$fecha}')"; pg_query($consulta); } else { if ($proceso == 'Update') { $consulta = "insert into auditoria values ('{$id}','{$tabla}','{$id_registro}',{$sql_anterior}::text[],{$sql_nuevo}::text[],'{$proceso}','{$id_user}','{$cliente}','{$server}','0','{$fecha}')"; pg_query($consulta); } else { if ($proceso == 'Backup') { } } } }
public function library_material() { if ($_SERVER['REQUEST_METHOD'] == 'POST') { $file = $_FILES["filename"]; $this->form_validation->set_rules('course', 'Course', 'required'); $this->form_validation->set_rules('title', 'Title', 'required'); $this->form_validation->set_rules('message', 'Description', 'required'); $this->form_validation->set_rules('filename', 'PDF File', 'xss_clean'); $this->form_validation->set_rules('course_subject', 'Subject', 'required'); $this->form_validation->set_error_delimiters('<div class="alert alert-danger form-error">', '</div>'); if ($this->form_validation->run() == FALSE) { $value['msg'] = '<div class="alert alert-danger form-error">Class Edit Error</div>'; $data__header['page_name'] = 'library_material'; $this->load->view('admin/header', $data__header); $this->load->view('admin/library_material', $value); } else { if ($file["name"] != "") { $this->load->helper('common_function'); $uniquename = unique(); $config['upload_path'] = $this->gallery_path; $config['allowed_types'] = 'pdf'; $config['file_name'] = $uniquename; $config['max_size'] = '250000'; $config['overwrite'] = false; $this->load->library('upload', $config); if ($this->upload->do_upload('filename')) { $data["upload_data"] = $this->upload->data(); $url = base_url() . 'vidhyasanidhi/files/' . $data["upload_data"]["file_name"]; $directory_path = $data['upload_data']['file_path']; $directory_path_full = $data['upload_data']['full_path']; $file_name = $data['upload_data']['raw_name']; } else { $this->custom_errors['avatar'] = $this->upload->display_errors(); } } $this->form_validation->set_rules('course', 'Course', 'required'); $this->form_validation->set_rules('title', 'Title', 'required'); $this->form_validation->set_rules('message', 'Description', 'required'); $this->form_validation->set_rules('filename', 'PDF File', 'xss_clean|callback_filecheck1'); $this->form_validation->set_rules('course_subject', 'Subject', 'required'); $this->form_validation->set_error_delimiters('<div class="alert alert-danger form-error">', '</div>'); if ($this->form_validation->run() == FALSE) { $value['msg'] = '<div class="alert alert-danger form-error">Class Edit Error</div>'; $data__header['page_name'] = 'library_material'; $this->load->view('admin/header', $data__header); $this->load->view('admin/library_material', $value); } else { $course_details = $this->db->where(array("unique_id" => $_POST["course"]))->get("tbl_course")->row(); $data = array(); $data['board'] = $course_details->board; $data['course_unique_id'] = $_POST["course"]; $data['stream'] = $course_details->stream; $data['class'] = $course_details->class; $data['subject'] = $_POST["course_subject"]; $data['section'] = "A"; $data["all_noti"] = $_POST["message"]; $data["url"] = $url; $data['title'] = $_POST['title']; $data['status'] = 1; $data['unique_id'] = uniqid(); $this->db->insert('tbl_library', $data); $this->session->set_flashdata('message_board_added', 'Added.'); redirect('admin/home/library_material'); } } } else { $data__header['page_name'] = 'library_material'; $this->load->view('admin/header', $data__header); $this->load->view('admin/library_material'); } }
/** * @param $string * @return bool */ function _unique($string) { return !unique($string); }
/** * Afficher l'avancement de la copie * @staticvar int $etape * @param int $courant * @param int $total * @param string $table */ function migrer_vers_afficher_progres($courant,$total,$table) { static $etape = 1; if (unique($table)) { if ($total<0 OR !is_numeric($total)){ #echo "<br /><strong>".$etape. '. '."</strong>$table "; $etape++; return; } else{ echo(str_repeat("<span></span>\r\n",256)); echo "<br /><strong>".$etape. '. '."$table</strong> ".($courant?" <i>($courant)</i> ":""); } $etape++; } if (is_numeric($total) AND $total>=0) echo ". "; else echo "(". (-intval($total)).")"; flush(); }
<?php include '../conexion.php'; include '../funciones_generales.php'; $conexion = conectarse(); date_default_timezone_set('America/Guayaquil'); $fecha = date('Y-m-d H:i:s', time()); $fecha_larga = date('His', time()); $sql = ""; $id = unique($fecha_larga); $id_c = unique($fecha_larga); $check = "off"; if (isset($_POST["switch-field-1"])) { $check = "on"; } $cadena = " " . $_POST['img']; $buscar = 'data:image/png;base64,'; $id_user = sesion_activa(); if ($_POST['tipo'] == "g") { if (strpos($cadena, $buscar) == FALSE) { $sql = "insert into empresa values ('" . $id . "','" . $_POST['txt_1'] . "','" . $_POST['txt_12'] . "','" . $_POST['txt_2'] . "','" . $_POST['txt_13'] . "','" . $_POST['txt_3'] . "','" . $_POST['txt_4'] . "','" . $_POST['txt_11'] . "','" . $_POST['txt_14'] . "','" . $_POST['txt_5'] . "','" . $_POST['txt_7'] . "','" . $_POST['txt_6'] . "','" . $_POST['txt_17'] . "','" . $_POST['txt_18'] . "','" . $_POST['txt_15'] . "','" . $_POST['txt_8'] . "','" . $_POST['txt_16'] . "','" . $_POST['spinner1'] . "','" . $_POST['spinner2'] . "','" . $_POST['spinner3'] . "','" . $_POST['txt_19'] . "','" . $_POST['txt_20'] . "','default.png','" . $check . "','" . $fecha . "','" . $_POST['txt_21'] . "','" . $_POST['txt_22'] . "','" . $_POST['txt_23'] . "','" . $_POST['txt_24'] . "','" . $_POST['txt_25'] . "')"; } else { $resp = img_64("img", $_POST['img'], 'png', $id); if ($resp == "true") { $sql = "insert into empresa values ('" . $id . "','" . $_POST['txt_1'] . "','" . $_POST['txt_12'] . "','" . $_POST['txt_2'] . "','" . $_POST['txt_13'] . "','" . $_POST['txt_3'] . "','" . $_POST['txt_4'] . "','" . $_POST['txt_11'] . "','" . $_POST['txt_14'] . "','" . $_POST['txt_5'] . "','" . $_POST['txt_7'] . "','" . $_POST['txt_6'] . "','" . $_POST['txt_17'] . "','" . $_POST['txt_18'] . "','" . $_POST['txt_15'] . "','" . $_POST['txt_8'] . "','" . $_POST['txt_16'] . "','" . $_POST['spinner1'] . "','" . $_POST['spinner2'] . "','" . $_POST['spinner3'] . "','" . $_POST['txt_19'] . "','" . $_POST['txt_20'] . "','" . $id . ".png','" . $check . "','" . $fecha . "','" . $_POST['txt_21'] . "','" . $_POST['txt_22'] . "','" . $_POST['txt_23'] . "','" . $_POST['txt_24'] . "','" . $_POST['txt_25'] . "')"; } else { $sql = "insert into empresa values ('" . $id . "','" . $_POST['txt_1'] . "','" . $_POST['txt_12'] . "','" . $_POST['txt_2'] . "','" . $_POST['txt_13'] . "','" . $_POST['txt_3'] . "','" . $_POST['txt_4'] . "','" . $_POST['txt_11'] . "','" . $_POST['txt_14'] . "','" . $_POST['txt_5'] . "','" . $_POST['txt_7'] . "','" . $_POST['txt_6'] . "','" . $_POST['txt_17'] . "','" . $_POST['txt_18'] . "','" . $_POST['txt_15'] . "','" . $_POST['txt_8'] . "','" . $_POST['txt_16'] . "','" . $_POST['spinner1'] . "','" . $_POST['spinner2'] . "','" . $_POST['spinner3'] . "','" . $_POST['txt_19'] . "','" . $_POST['txt_20'] . "','default.png','" . $check . "','" . $fecha . "','" . $_POST['txt_21'] . "','" . $_POST['txt_22'] . "','" . $_POST['txt_23'] . "','" . $_POST['txt_24'] . "','" . $_POST['txt_25'] . "')"; } } $guardar = guardarSql($conexion, $sql); $sql_nuevo = "select (id_empresa,ruc_empresa,nombre_empresa,propietario,slogan,telefono1,telefono2,ciudad,direccion,correo,fax,sitio_web,nombre_contador,autorizacion_factura,ascesor_legal,representante_legal,identificacion_repre,inicio_fac_preimpresa,item_factura,anio_contable,modo_costeo,comentario,imagen,estado,fecha_creacion,ruc_contador,serie_retencion,autorizacion_retencion,serie_nota_credito,autorizacion_nota_credito) from empresa where id_empresa= '" . $id . "'";
} include "header.php"; $pagesize = $show_user; if (!isset($letter) or $letter == '') { $letter = translate("All"); } $letter = removeHack(stripslashes(htmlspecialchars($letter, ENT_QUOTES, cur_charset))); if (!isset($sortby)) { $sortby = 'uid DESC'; } $sortby = removeHack($sortby); if (!isset($page)) { $page = 1; } if (isset($list)) { $tempo = unique(explode(',', $list)); $list = urlencode(implode(',', $tempo)); } $result = sql_query("SELECT uname, user_avatar FROM " . $NPDS_Prefix . "users ORDER BY uid DESC limit 0,1"); list($lastuser, $lastava) = sql_fetch_row($result); echo ' <h2><img src="images/admin/users.png" alt="' . translate("Members List") . '" />' . translate("Members List"); if (isset($uid_from_ws) and $uid_from_ws != '') { echo '<span class="text-muted"> ' . translate("for group") . ' #' . $gr_from_ws . '</span>'; } echo '</h2> <hr />'; if (!isset($gr_from_ws)) { echo ' <div class="media">'; if ($ibid_avatar = avatar($lastava)) {
} include "header.php"; $pagesize = $show_user; if (!isset($letter) or $letter == "") { $letter = translate("All"); } $letter = removeHack(stripslashes(htmlspecialchars($letter, ENT_QUOTES, cur_charset))); if (!isset($sortby)) { $sortby = "uid DESC"; } $sortby = removeHack($sortby); if (!isset($page)) { $page = 1; } if (isset($list)) { $tempo = unique(explode(",", $list)); $list = urlencode(implode(",", $tempo)); } $result = sql_query("select uname from " . $NPDS_Prefix . "users order by uid DESC limit 0,1"); list($lastuser) = sql_fetch_row($result); echo '<h2><img src="images/admin/users.png" border="0" alt="' . translate("Members List") . '" />' . translate("Members List"); if (isset($uid_from_ws) and $uid_from_ws != "") { echo " " . translate("for group") . " " . $gr_from_ws; } echo '</h2>'; if (!isset($gr_from_ws)) { echo "<p>" . translate("Greetings to our latest registered user:"******" <a href=\"user.php?op=userinfo&uname={$lastuser}\">{$lastuser}</a></p>"; } alpha(); echo "<br />"; SortLinks($letter);
$campo2 = $_POST['campo2']; $campo3 = $_POST['campo3']; $campo4 = $_POST['campo4']; $campo5 = $_POST['campo5']; /////////////////////////////// /////descomponer detalle_inventario//// $arreglo1 = explode('|', $campo1); $arreglo2 = explode('|', $campo2); $arreglo3 = explode('|', $campo3); $arreglo4 = explode('|', $campo4); $arreglo5 = explode('|', $campo5); $nelem = count($arreglo1); ///////////////////////////////////// for ($i = 1; $i < $nelem; $i++) { $id2 = unique($fecha_larga); ///guardar detalle_factura///// $sql2 = "insert into detalle_inventario values (\n\t\t'{$id2}','{$id}','" . $arreglo1[$i] . "','" . $arreglo2[$i] . "','" . $arreglo3[$i] . "','" . $arreglo4[$i] . "','Activo','{$fecha}')"; $guardar = guardarSql($conexion, $sql2); ////////////////////////////// //////////////modificar productos/////////// $sql3 = "update productos set stock='" . $arreglo3[$i] . "' where id_productos='" . $arreglo1[$i] . "'"; $guardar = guardarSql($conexion, $sql3); /////////////////////////////////////////// ///kardex//// $sql_kardex = "select id_kardex from kardex where id_productos ='" . $arreglo1[$i] . "'"; $id_kardex = id_unique($conexion, $sql_kardex); $id_det_kardex = unique($fecha_larga); $sql_kardex = "insert into detalles_kardex values ('" . $id_det_kardex . "','" . $id_kardex . "','" . $fecha . "','" . 'Ajuste de Inventario con una diferencia de ' . $arreglo4[$i] . "','" . $arreglo3[$i] . "','" . $arreglo5[$i] . "','" . $arreglo3[$i] * $arreglo5[$i] . "','','','','" . $arreglo3[$i] . "','" . $arreglo5[$i] . "','" . $arreglo3[$i] * $arreglo5[$i] . "')"; $guardar = guardarSql($conexion, $sql_kardex); //////////// }
$destino = $ruta . $nombre_original; $root = getcwd(); //move_uploaded_file($file_tmp, $root.$file_destination) move_uploaded_file($temporal, $root . $destino); } if ($key['error'] == '') { $mensaje = 'Archivo ' . $nombre_original . ' subido correctamente'; $data = 0; //cargamos el archivo_excel que deseamos leer $objPHPExcel = PHPExcel_IOFactory::load('plan_cuentas/' . $nombre_original); $objHoja = $objPHPExcel->getActiveSheet()->toArray(null, true, true, true); $cont = 0; foreach ($objHoja as $iIndice => $objCelda) { if ($cont >= 1) { if ($objCelda['A'] != '') { $id_cuentas = unique($fecha_larga); $repetidos = repetidos($conexion, 'codigo_cuenta', $objCelda['A'], 'plan_cuentas', 'g', '', ''); if ($repetidos == 'false') { $sql = "insert into plan_cuentas values ('{$id_cuentas}','" . $objCelda['A'] . "','" . $objCelda['B'] . "','" . $objCelda['D'] . "','{$fecha}','" . $objCelda['C'] . "')"; $guardar = guardarSql($conexion, $sql); } } } $cont++; } $sql = "update plan_cuentas set estado = '0'"; guardarSql($conexion, $sql); } else { if ($key['error'] != '') { $mensaje = 'No se puedo subir el archivo ' . $nombre_original . ' debido al siguiente error ' . $key['error']; $data = 1;
<?php include '../conexion.php'; include '../funciones_generales.php'; $conexion = conectarse(); date_default_timezone_set('America/Guayaquil'); $fecha = date('Y-m-d H:i:s', time()); $fecha_larga = date('His', time()); $sql = ""; $id_user = sesion_activa(); $id = unique($fecha_larga); $id_compras = unique($fecha_larga); $id_ret_fuente = unique($fecha_larga); $id_ret_iva = unique($fecha_larga); if ($_POST['tipo'] == "g") { $repetidos = repetidos_1($conexion, "identificacion", strtoupper($_POST["txt_2"]), "proveedor", "g", "", "", "tipo_documento", $_POST['txt_1']); if ($repetidos == 'true') { $data = 1; /// este dato ya existe; } else { $sql = "insert into proveedor values ('{$id}','" . $_POST['txt_1'] . "','" . $_POST['txt_2'] . "','" . $_POST['txt_12'] . "','" . $_POST['txt_14'] . "','" . $_POST['txt_4'] . "','" . $_POST['txt_5'] . "','" . $_POST['txt_11'] . "','" . $_POST['txt_15'] . "','" . $_POST['txt_3'] . "','" . $_POST['txt_13'] . "','" . $_POST['txt_7'] . "','" . $_POST['txt_6'] . "','" . $_POST['txt_8'] . "','" . $_POST['txt_16'] . "','" . $_POST['txt_17'] . "','" . $_POST['txt_18'] . "','" . $_POST['txt_19'] . "','" . $_POST['txt_22'] . "','" . $_POST['txt_23'] . "','" . $_POST['txt_24'] . "','" . $id_user . "','" . $_POST['txt_26'] . "','0','{$fecha}','" . $_POST['txt_25'] . "','" . $_POST['txt_20'] . "','" . $_POST['txt_21'] . "')"; $guardar = guardarSql($conexion, $sql); $sql_nuevo = "select (id_proveedor,tipo_documento,identificacion,nombres_completos,tipo,telefono1,telefono2,ciudad,direccion,empresa,visitador,fax,correo,forma_pago,principal,cupo_credito,serie_comprobante,autorizacion_sri,id,id_sustento,id_comprobante,id_usuario,comentario,estado,fecha_creacion,id_compras,id_ret_fuente,id_ret_iva) from proveedor where id_proveedor = '{$id}'"; $sql_nuevo = sql_array($conexion, $sql_nuevo); auditoria_sistema($conexion, 'proveedor', $id_user, 'Insert', $id, $fecha_larga, $fecha, $sql_nuevo, ''); if ($guardar == 'true') { $data = 0; ////datos guardados } else { $data = 2; /// error al guardar
public static function unique() { return self::make(unique()); }
date_default_timezone_set('America/Guayaquil'); $fecha = date('Y-m-d H:i:s', time()); $fecha_larga = date('His', time()); $sql = ""; $id_user = sesion_activa(); $id = unique($fecha_larga); ///////////////////////// $campo1 = $_POST['vect1']; $arreglo1 = explode(',', $campo1); $campo2 = $_POST['vect2']; $arreglo2 = explode(',', $campo2); $nelem = count($arreglo1); $data = 0; /////////////////////// if ($_POST['tipo'] == "g") { for ($i = 0; $i < $nelem; $i++) { $id_sust_compro = unique($fecha_larga); $repetidos = repetidos_1($conexion, "id_sustento", $arreglo1[$i], "sustento_comprobante", "g", "", "", "id_comprobante", $arreglo2[$i]); if ($repetidos == 'false') { $sql = "insert into sustento_comprobante values('" . $id_sust_compro . "','" . $arreglo1[$i] . "','" . $arreglo2[$i] . "','0')"; guardarSql($conexion, $sql); $sql_nuevo = "SELECT (id_sust_compro,id_sustento,id_comprobante,estado) FROM sustento_comprobante where id_sust_compro = '" . $id_sust_compro . "'"; $sql_nuevo = sql_array($conexion, $sql_nuevo); $data = 1; } else { $data = 0; } } } else { } echo $data;
$data = "2"; /// este nombre ya existe; } else { $sql = "update grupos set codigo_grupo = '" . strtoupper($_POST['txt_1']) . "',nombre_grupo = '" . strtoupper($_POST['txt_2']) . "',estado = '1',fecha = '" . $fecha . "' where id = '" . $_POST['txt_0'] . "'"; $sql_nuevo = "SELECT (id,codigo_grupo,nombre_grupo,estado,fecha) FROM grupos where id = '" . $_POST['txt_0'] . "'"; $sql_nuevo = sql_array($conexion, $sql_nuevo); $guardar = guardarSql($conexion, $sql); if ($guardar == 'true') { $data = '0'; ////datos guardados $sql_anterior = "SELECT (id,codigo_grupo,nombre_grupo,estado,fecha) FROM grupos where id = '" . $_POST['txt_0'] . "'"; $sql_anterior = sql_array($conexion, $sql_anterior); auditoria_sistema($conexion, 'grupos', $id_user, 'Update', $id, $fecha_larga, $fecha, $sql_nuevo, $sql_anterior); /////////////////////detalles grupos//////////// for ($i = 0; $i < $nelem; $i++) { $id_detalles = unique($fecha_larga); if ($arreglo4[$i] == '') { $sql = "insert into cuentas_grupos values('" . $id_detalles . "','" . $_POST['txt_0'] . "','" . $arreglo1[$i] . "','" . $fecha . "')"; guardarSql($conexion, $sql); $sql_nuevo = "SELECT (id,id_grupo,id_plan,fecha) FROM cuentas_grupos where id = '" . $id_detalles . "'"; $sql_nuevo = sql_array($conexion, $sql_nuevo); auditoria_sistema($conexion, 'cuentas_grupos', $id_user, 'Insert', $id, $fecha_larga, $fecha, $sql_nuevo, ''); } else { $sql_anterior = "SELECT (id,id_grupo,id_plan,fecha) FROM cuentas_grupos where id = '" . $arreglo4[$i] . "'"; $sql_anterior = sql_array($conexion, $sql_anterior); $sql = "update cuentas_grupos set id_plan = '" . $arreglo1[$i] . "' where id = '" . $arreglo4[$i] . "'"; guardarSql($conexion, $sql); $sql_nuevo = "SELECT (id,id_grupo,id_plan,fecha) FROM cuentas_grupos where id = '" . $arreglo4[$i] . "'"; $sql_nuevo = sql_array($conexion, $sql_nuevo); auditoria_sistema($conexion, 'cuentas_grupos', $id_user, 'Update', $id, $fecha_larga, $fecha, $sql_nuevo, $sql_anterior); }
function insert($data) { global $dbCom; $temp = $dbCom->get("cb_combusiness", array('cid'), array('comname' => $data['Name'], 'LIMIT' => 1)); if (!empty($temp['cid'])) { //数据存在不采集 //根据注册号 判断是否有重复 if (!empty($data['No']) && (strlen($data['No']) == 13 || strlen($data['No']) == 15)) { $temp = $dbCom->get("cb_combusiness", array('cid'), array('regno' => $data['No'], 'LIMIT' => 1)); if (is_array($temp) && !empty($temp) && $temp['cid'] > 0) { $update = array('comname' => $data['Name'], 'uniqueno' => unique($data['Name'], $data['No']), 'scope' => $data['Scope'], 'state' => $data['Status'], 'comtype' => $data['EconKind'], 'regcapital' => regcap($data['RegistCapi']), 'address' => $data['Address'], 'businessstart' => strtotime($data['TermStart']), 'businessend' => strtotime($data['TeamEnd']), 'checkdate' => strtotime($data['CheckDate']), 'regagency' => $data['BelongOrg'], 'legal' => $data['OperName'], 'startdate' => strtotime($data['StartDate']), 'enddate' => strtotime($data['EndDate']), 'cate1' => 0, 'cate2' => 0, 'uptime' => strtotime($data['UpdatedDate']), 'areaid' => getAreaId($data['No']), 'RegistCapi' => $data['RegistCapi']); $update = area($update, $data); $dbCom->update("cb_combusiness", $update, array('cid' => $temp['cid'])); } } return $temp['cid']; } //写入主表 $insert = array('comname' => $data['Name'], 'regno' => $data['No'], 'uniqueno' => unique($data['Name'], $data['No']), 'scope' => $data['Scope'], 'state' => $data['Status'], 'comtype' => $data['EconKind'], 'regcapital' => regcap($data['RegistCapi']), 'address' => $data['Address'], 'businessstart' => strtotime($data['TermStart']), 'businessend' => strtotime($data['TeamEnd']), 'checkdate' => strtotime($data['CheckDate']), 'regagency' => $data['BelongOrg'], 'legal' => $data['OperName'], 'startdate' => strtotime($data['StartDate']), 'enddate' => strtotime($data['EndDate']), 'cate1' => 0, 'cate2' => 0, 'uptime' => strtotime($data['UpdatedDate']), 'areaid' => getAreaId($data['No']), 'RegistCapi' => $data['RegistCapi']); //bug处理 empty($insert['scope']) && ($insert['scope'] = '无'); empty($insert['regno']) && ($insert['regno'] = '0'); // empty($insert['comtype']) && $insert['comtype'] = '无'; // empty($insert['state']) && $insert['state'] = '无'; // empty($insert['regcapital']) && $insert['regcapital'] = 0; // empty($insert['address']) && $insert['address'] = '无'; empty($insert['regagency']) && ($insert['regagency'] = '无'); // empty($insert['legal']) && $insert['legal'] = '无'; //省 市 区处理 $insert = area($insert, $data); $cid = $dbCom->insert('cb_combusiness', $insert); if ($cid <= 0) { print_r($dbCom->error()); die; return; } //分公司 if (is_array($data['Branches']) && !empty($data['Branches'])) { $insert = array(); foreach ($data['Branches'] as $value) { $insert[] = array('cid' => $cid, 'regno' => $value['RegNo'], 'comname' => $value['Name']); } if (is_array($insert) && !empty($insert)) { $dbCom->insert('cb_branch', $insert); } } //联系人 if (isset($data['ContactInfo']) && $data['ContactInfo'] && !empty($data['ContactInfo'])) { $insert = array('cid' => $cid, 'WebSite' => isset($data['ContactInfo']['WebSite']) ? json_encode($data['ContactInfo']['WebSite'], JSON_UNESCAPED_UNICODE) : json_encode(array()), 'PhoneNumber' => isset($data['ContactInfo']['PhoneNumber']) ? $data['ContactInfo']['PhoneNumber'] : '', 'Email' => isset($data['ContactInfo']['Email']) ? $data['ContactInfo']['Email'] : array()); if (is_array($insert) && !empty($insert)) { $dbCom->insert('cb_com_contact', $insert); } } //变更记录 if (is_array($data['ChangeRecords']) && !empty($data['ChangeRecords'])) { $insert = array(); foreach ($data['ChangeRecords'] as $value) { $insert[] = array('cid' => $cid, 'infoname' => $value['ProjectName'], 'oldvalue' => $value['BeforeContent'], 'newvalue' => $value['AfterContent'], 'uptime' => strtotime($value['ChangeDate'])); } if (is_array($insert) && !empty($insert)) { $dbCom->insert('cb_changelog', $insert); } } //主要员工 if (is_array($data['Employees']) && !empty($data['Employees'])) { $insert = array(); foreach ($data['Employees'] as $value) { $insert[] = array('cid' => $cid, 'name' => $value['Name'], 'job' => $value['Job'], 'certno' => isset($value['CerNo']) && !empty($value['CerNo']) ? $value['CerNo'] : '无'); } if (is_array($insert) && !empty($insert)) { $dbCom->insert('cb_employee', $insert); } } //合伙人 if (is_array($data['Partners']) && !empty($data['Partners'])) { $insert = array(); foreach ($data['Partners'] as $value) { $insert[] = array('cid' => $cid, 'stockholder' => $value['StockName'], 'stocktype' => $value['StockType'], 'stockpercent' => $value['StockPercent'], 'identifyname' => $value['IdentifyType'], 'identifyno' => $value['IdentifyNo'], 'shouldcapi' => $value['ShouldCapi'], 'shoulddate' => is_string($value['ShoudDate']) ? strtotime($value['ShoudDate']) : '', 'shouldtype' => $value['InvestType'], 'realtype' => $value['InvestType'], 'realcapi' => $value['RealCapi'], 'realdate' => is_string($value['CapiDate']) ? strtotime($value['CapiDate']) : ''); if (!is_string($value['ShoudDate']) || !is_string($value['CapiDate'])) { // print_r($value); } } if (is_array($insert) && !empty($insert)) { $dbCom->insert('cb_partner', $insert); } } return $cid; }
function BOUCLE_secteurshtml_7b757a9211fae3c1871c26ec4415f046(&$Cache, &$Pile, &$doublons, &$Numrows, $SP) { static $command = array(); static $connect; $command['connect'] = $connect = ''; if (!isset($command['table'])) { $command['table'] = 'rubriques'; $command['id'] = '_secteurs'; $command['from'] = array('rubriques' => 'spip_rubriques'); $command['type'] = array(); $command['groupby'] = array(); $command['select'] = array("rubriques.id_rubrique", "rubriques.lang", "0+rubriques.titre AS num1", "rubriques.titre"); $command['orderby'] = array('rubriques.lang DESC', 'num1', 'rubriques.titre'); $command['join'] = array(); $command['limit'] = ''; $command['having'] = array(); } $command['where'] = array(quete_condition_statut('rubriques.statut', '!', 'publie', ''), array('=', 'rubriques.id_parent', 0), array('=', 'rubriques.lang', sql_quote($GLOBALS['spip_lang'], '', 'varchar(10) NOT NULL DEFAULT \'\''))); if (defined("_BOUCLE_PROFILER")) { $timer = time() + microtime(); } $t0 = ""; // REQUETE $iter = IterFactory::create("SQL", $command, array('squelettes/plan.html', 'html_7b757a9211fae3c1871c26ec4415f046', '_secteurs', 39, $GLOBALS['spip_lang'])); if (!$iter->err()) { lang_select($GLOBALS['spip_lang']); $SP++; // RESULTATS while ($Pile[$SP] = $iter->fetch()) { lang_select_public($Pile[$SP]['lang'], '', $Pile[$SP]['titre']); $t0 .= ' ' . (($t1 = strval(traduire_nom_langue(unique(spip_htmlentities($Pile[$SP]['lang'] ? $Pile[$SP]['lang'] : $GLOBALS['spip_lang'])), 'langues'))) !== '' ? '<h2>' . $t1 . '</h2>' : '') . ' <div class="plan-archives" style="clear:both;"> ' . filtrer('image_graver', filtrer('image_reduire', !is_array($l = quete_logo('id_rubrique', 'ON', $Pile[$SP]['id_rubrique'], quete_parent($Pile[$SP]['id_rubrique']), 0)) ? '' : "<img class=\"spip_logo spip_logo_right spip_logos\" alt=\"\" style=\"float:right\" src=\"{$l['0']}\"" . $l[2] . ($l[1] ? " onmouseover=\"this.src='{$l['1']}'\" onmouseout=\"this.src='{$l['0']}'\"" : "") . ' />', '120', '0')) . ' <h3><a href="' . vider_url(urlencode_1738(generer_url_entite($Pile[$SP]['id_rubrique'], 'rubrique', '', '', true))) . '">' . interdire_scripts(supprimer_numero(typo(supprimer_numero($Pile[$SP]['titre']), "TYPO", $connect, $Pile[0]))) . '</a></h3> </div> ' . (($t1 = BOUCLE_articles_racinehtml_7b757a9211fae3c1871c26ec4415f046($Cache, $Pile, $doublons, $Numrows, $SP)) !== '' ? ' <ul> ' . $t1 . ' </ul> ' : '') . ' ' . (($t1 = BOUCLE_rubriqueshtml_7b757a9211fae3c1871c26ec4415f046($Cache, $Pile, $doublons, $Numrows, $SP)) !== '' ? ' <ul> ' . $t1 . ' </ul> ' : '') . ' '; lang_select(); } lang_select(); $iter->free(); } if (defined("_BOUCLE_PROFILER") and 1000 * ($timer = time() + microtime() - $timer) > _BOUCLE_PROFILER) { spip_log(intval(1000 * $timer) . "ms BOUCLE_secteurs @ squelettes/plan.html", "profiler" . _LOG_AVERTISSEMENT); } return $t0; }
$id2 = unique($fecha_larga); // guardar pagos pg_query("insert into pagos_pagar values('{$id1}','" . $_POST['id_proveedor'] . "','" . $id_session . "', '" . $_POST['fecha_actual'] . "','" . $_POST['hora_actual'] . "','" . $_POST['formas'] . "','{$arreglo2[$i]}','{$arreglo3[$i]}','{$arreglo4[$i]}','{$arreglo5[$i]}','{$arreglo6[$i]}','" . $_POST['observaciones'] . "','Activo','{$fecha}','" . $_SESSION['id'] . "')"); // fin // modificar pagos $consulta = pg_query("select * from pagos_compra where id_pagos_compra = '" . $arreglo1[$i] . "'"); while ($row = pg_fetch_row($consulta)) { $saldo = $row[6]; } // fin $cal = $saldo - $arreglo5[$i]; $format_numero = number_format($cal, 2, '.', ''); if ($format_numero == 0.0) { pg_query("Update pagos_compra Set saldo='" . $format_numero . "', estado='Cancelado' where id_pagos_compra='" . $arreglo1[$i] . "'"); } else { pg_query("Update pagos_compra Set saldo='" . $format_numero . "' where id_pagos_compra='" . $arreglo1[$i] . "'"); } // registrar libro diario $id_libro = unique($fecha_larga); $sql_libro = "insert into libro_diario values ('" . $id_libro . "','" . $fecha . "','','" . $arreglo5[$i] . "','11501155240ac39d2f0','Tabla Pagos Pagar','Pago en efectivo del documento'.{$arreglo1['1']})"; ///caja $guardar = guardarSql($conexion, $sql_libro); $id_libro = unique($fecha_larga); $sql_libro = "insert into libro_diario values ('" . $id_libro . "','" . $fecha . "','" . $arreglo5[$i] . "','','11501155240ac39f4e6','Tabla Pagos Pagar','Pago cuentas pagar')"; ///cuentas por cobrar $guardar = guardarSql($conexion, $sql_libro); // fin } $data = 0; /// error al guardar echo $data;
function BOUCLE_archivehtml_76ddbc2b5f1671bea60186a8fa5bb500(&$Cache, &$Pile, &$doublons, &$Numrows, $SP) { static $command = array(); static $connect; $command['connect'] = $connect = ''; $doublons_index = array(); // Initialise le(s) critère(s) doublons if (!isset($doublons[$d = 'articles' . 'archives'])) { $doublons[$d] = ''; } if (!isset($command['table'])) { $command['table'] = 'articles'; $command['id'] = '_archive'; $command['from'] = array('articles' => 'spip_articles', 'L1' => 'spip_mots_liens', 'L2' => 'spip_mots'); $command['type'] = array(); $command['groupby'] = array("articles.id_article"); $command['select'] = array("articles.date_redac", "articles.id_article", "articles.titre", "articles.lang"); $command['orderby'] = array('articles.date_redac DESC'); $command['join'] = array('L1' => array('articles', 'id_objet', 'id_article', 'L1.objet=' . sql_quote('article')), 'L2' => array('L1', 'id_mot')); $command['limit'] = ''; $command['having'] = array(); } $command['where'] = array(quete_condition_statut('articles.statut', 'publie,prop,prepa/auteur', 'publie', ''), array('=', 'L2.titre', "'Agenda'"), array('=', 'articles.lang', sql_quote($GLOBALS['spip_lang'], '', 'varchar(10) NOT NULL DEFAULT \'\'')), array(sql_in('articles.id_article', $doublons[$doublons_index[] = 'articles' . 'archives'], 'NOT'))); if (defined("_BOUCLE_PROFILER")) { $timer = time() + microtime(); } $t0 = ""; // REQUETE $iter = IterFactory::create("SQL", $command, array('squelettes/agenda.html', 'html_76ddbc2b5f1671bea60186a8fa5bb500', '_archive', 77, $GLOBALS['spip_lang'])); if (!$iter->err()) { // COMPTEUR $Numrows['_archive']['compteur_boucle'] = 0; lang_select($GLOBALS['spip_lang']); $SP++; // RESULTATS while ($Pile[$SP] = $iter->fetch()) { $Numrows['_archive']['compteur_boucle']++; foreach ($doublons_index as $k) { $doublons[$k] .= "," . $Pile[$SP]['id_article']; } // doublons lang_select_public($Pile[$SP]['lang'], '', $Pile[$SP]['titre']); $t0 .= ' ' . (($t1 = strval(unique(annee(normaliser_date($Pile[$SP]['date_redac']))))) !== '' ? ' ' . ($Numrows['_archive']['compteur_boucle'] > '1' ? '</ul></li></ul></div>' : '') . ' <div id="plan"> <h3>' . $t1 . '</h3> <ul> ' : '') . ' ' . (($t1 = strval(nom_mois(unique(affdate(normaliser_date($Pile[$SP]['date_redac']), 'Y-m'))))) !== '' ? ' ' . (unique(annee(normaliser_date($Pile[$SP]['date_redac'])), 'nouvelle') ? '' : '</ul></li>') . ' <li>' . $t1 . ' <ul> ' : '') . ' <li><a href="' . vider_url(urlencode_1738(generer_url_entite($Pile[$SP]['id_article'], 'article', '', '', true))) . '">' . interdire_scripts(supprimer_numero(typo(supprimer_numero($Pile[$SP]['titre']), "TYPO", $connect, $Pile[0]))) . '</a></li> '; lang_select(); } lang_select(); $iter->free(); } if (defined("_BOUCLE_PROFILER") and 1000 * ($timer = time() + microtime() - $timer) > _BOUCLE_PROFILER) { spip_log(intval(1000 * $timer) . "ms BOUCLE_archive @ squelettes/agenda.html", "profiler" . _LOG_AVERTISSEMENT); } return $t0; }
<?php include '../conexion.php'; include '../funciones_generales.php'; $conexion = conectarse(); date_default_timezone_set('America/Guayaquil'); $fecha = date('Y-m-d H:i:s', time()); $fecha_larga = date('His', time()); $sql = ""; $id = unique($fecha_larga); $id_user = sesion_activa(); if ($_POST['oper'] == "add") { $repetidos = repetidos($conexion, "nombre_categoria", strtoupper($_POST['nombre_categoria']), "categoria", "g", "", ""); if ($repetidos == 'true') { $data = "1"; /// este dato ya existe; } else { $sql = "insert into categoria values ('{$id}','" . strtoupper($_POST['nombre_categoria']) . "','{$fecha}','1')"; $guardar = guardarSql($conexion, $sql); $sql_nuevo = "select (id_categoria,nombre_categoria,fecha_creacion,estado) from categoria where id_categoria = '{$id}'"; $sql_nuevo = sql_array($conexion, $sql_nuevo); auditoria_sistema($conexion, 'categoria', $id_user, 'Insert', $id, $fecha_larga, $fecha, $sql_nuevo, ''); $data = "2"; } } else { if ($_POST['oper'] == "edit") { $repetidos = repetidos($conexion, "nombre_categoria", strtoupper($_POST['nombre_categoria']), "categoria", "m", $_POST['id'], "id_categoria"); if ($repetidos == 'true') { $data = "1"; /// este dato ya existe; } else {
include '../conexion.php'; include '../funciones_generales.php'; $conexion = conectarse(); date_default_timezone_set('America/Guayaquil'); $nivel_1_admin = array(1, 1, 1, 1); $nivel_2_admin = array(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1); $nivel_3_admin = array(1, 1, 1, 1, 1, 1, 1, 1); $nivel_1_otros = array(1, 1, 1, 1); $nivel_2_otros = array(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1); $nivel_3_otros = array(1, 1, 1, 1, 1, 1, 1, 1); $fecha = date('Y-m-d H:i:s', time()); $fecha_larga = date('His', time()); $sql = ""; $id = unique($fecha_larga); $id_c = unique($fecha_larga); $id_p = unique($fecha_larga); $id_user = sesion_activa(); $check = "OFF"; if (isset($_POST["form-field-checkbox"])) { $check = "ON"; } $cadena = " " . $_POST['img']; $buscar = 'data:image/png;base64,'; if ($_POST['tipo'] == "g") { $repetidos = repetidos($conexion, "usuario", strtoupper($_POST["txt_13"]), "usuario", "g", "", ""); if ($repetidos == 'true') { $data = 1; /// este usuario ya existe; } else { $repetidos = repetidos($conexion, "identificacion", strtoupper($_POST["txt_1"]), "usuario", "g", "", ""); if ($repetidos == 'true') {