本文整理汇总了PHP中unique函数的典型用法代码示例。如果您正苦于以下问题:PHP unique函数的具体用法?PHP unique怎么用?PHP unique使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了unique函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: submit_form
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;
}
示例2: up
/**
* 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();
});
}
示例3: trier_rss
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;
}
示例4: salt
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;
}
示例5: BOUCLE_langueshtml_9491858aea5af6033788aa1936ebca8d
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;
}
示例6: create_thread
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;
}
}
示例7: dump_afficher_progres
/**
* 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();
}
示例8: auditoria_sistema
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') {
}
}
}
}
示例9: library_material
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');
}
}
示例10: _unique
/**
* @param $string
* @return bool
*/
function _unique($string)
{
return !unique($string);
}
示例11: migrer_vers_afficher_progres
/**
* 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();
}
示例12: conectarse
<?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 . "'";
示例13: translate
}
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)) {
示例14: translate
}
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);
示例15: explode
$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);
////////////
}