本文整理汇总了PHP中sec_input函数的典型用法代码示例。如果您正苦于以下问题:PHP sec_input函数的具体用法?PHP sec_input怎么用?PHP sec_input使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了sec_input函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: edit
function edit($table, $vyber, $id)
{
$error_msg = array();
if ($_POST[submit]) {
$meno = sec_sql(sec_input($_POST["meno"]));
$hodnota = sec_sql(sec_input($_POST["hodnota"]));
if (strlen($meno) > 30 or strlen($meno) < 3) {
$error_msg[] = "Meno môže mať od 4 do 30 znakov";
}
if (strlen($hodnota) > 30 or strlen($hodnota) < 3) {
$error_msg[] = "Hodnota môže mať od 4 do 30 znakov";
}
//var_dump($error_msg);
if (empty($error_msg)) {
echo "ok";
} else {
echo "<div id=error_message>" . implode("<br>", $error_msg) . "</div>";
}
}
$id = sec_sql($id);
$query = "Select id, hodnota, meno from " . PREFIX . "{$table} WHERE id={$id}";
$value = sql_query($query);
$value = $value[0];
echo "<form method=\"POST\">";
hidden("id", $value[id]);
textfield("meno", $value[meno], "Meno", 50, 20);
textfield("hodnota", $value[hodnota], "Hodnota", 40, 20);
submit("submit", "Odoslať");
echo "</form>";
}
示例2: session_start
session_start();
$safe = "U,,5Enc!";
$root = $_SERVER['DOCUMENT_ROOT'];
include_once "config/datab.php";
// subor s nastaveniami databaz
include_once "config/fnc.php";
// vloženie hlavičky stránky
if (isset($_GET["select_product_type"])) {
$skryt_zakaznikom = "AND skryt_zakaznikom=0";
if ($_SESSION["logged"] == 1) {
$skryt_zakaznikom = "";
}
$product_atribute = sec_sql(sec_input($_GET["select_product_type"]));
$product = sec_sql(sec_input($_GET["product"]));
$query = "SELECT pa.id, pa.meno FROM `product_atribute` pa INNER JOIN product_atribute_product_types pt ON pt.id_product_atribute = pa.id\r\n WHERE pa.vymaz=0 AND id_product_type=" . (empty($product_atribute) ? def_value("default_product_type", "hodnota") : $product_atribute) . "\r\n ORDER BY pa.def DESC, pa.meno";
$atributes = sql_query($query);
$key = sec_sql(sec_input($_GET["key"]));
$query = "SELECT id FROM product \r\n WHERE id = {$product} AND skryt_atributy = \"1\" \r\n ";
$producter = sql_query($query);
//print_r($query);
if (empty($producter)) {
foreach ($atributes as $atribute) {
echo "<div class=\"atribute-row\">";
echo hidden("product_atribute[]", $atribute[id]);
echo select("product_atribute_option[{$key}][{$atribute['id']}]", $atribute[meno], "SELECT id, meno FROM product_atribute_option WHERE id_product_atribute=" . $atribute[id] . " AND vymaz=0 ORDER BY def DESC, def DESC, meno ASC", $product_type_all[$i], "-vyberte si-", "product_atribute_option_v", "", "NO");
echo "</div>";
}
}
//var_dump($_SESSION);
}
示例3: sec_sql
<?php
$safe = "U,,5Enc!";
$root = $_SERVER['DOCUMENT_ROOT'];
include_once "config/datab.php";
// subor s nastaveniami databaz
include_once "config/fnc.php";
// vloženie hlavičky stránky
if (isset($_GET["select_material"])) {
$material = sec_sql(sec_input($_GET["select_material"]));
$def_hrana_duplak = def_value("default_duplak_hrana_value", "hodnota");
echo select("hrana", "Hrúbka", "SELECT id, hodnota, meno FROM hrana WHERE vymaz=0 {$where} ORDER BY hodnota", def_value("default_hrubka", "hodnota"), "", "hrubka", "", "NO");
}
示例4: sec_sql
// subor s nastaveniami databaz
include_once "config/fnc.php";
// vloženie hlavičky stránky
include_once "config/config.php";
$minimized = "minimized";
$tasker = "ghost";
//var_dump($vyber);
if (!empty($_POST["dodavatel"]) and !empty($_POST["text"]) and !empty($_POST["zakaznik"])) {
$dodavatel = sec_sql(sec_input($_POST["dodavatel"]));
$ks = str_replace(',', '.', sec_sql(sec_input($_POST["ks"])));
$ks = floatval($ks);
$text = sec_sql(sec_input($_POST["text"]));
$jednotka = sec_sql(sec_input($_POST["jednotky"]));
$zakaznik = sec_sql(sec_input($_POST["zakaznik"]));
$objednavka = sec_sql(sec_input($_POST["order"]));
$from = sec_sql(sec_input($_POST["from"]));
mysql_query("BEGIN");
$produkt = sql_query("Select id from do_produkt\r\n WHERE meno = \"{$text}\" ");
if (count($produkt) == 0) {
$sql_obj = sql_insert("INSERT INTO do_produkt (meno)\r\n VALUES (\"{$text}\") ");
$produkt = $sql_obj["inserted_id"];
} else {
$produkt = $produkt[0]["id"];
}
//dd($produkt);
$sql_obj = sql_insert("INSERT INTO do_objednavka (datum_zmeny, id_dodavatel, objednavka)\r\n VALUES (now(), \"{$dodavatel}\", \"{$objednavka}\" )\r\n ");
$obj_id = $sql_obj["inserted_id"];
sql_insert("INSERT INTO do_objednavka_row (id_do_objednavka, datum, ks, jednotka, text, id_do_produkt, objednavka, zakaznik, vytvoril, zadal)\r\n VALUES (\"{$obj_id}\", now(), \"{$ks}\", \"{$jednotka}\", \"{$text}\", \"{$produkt}\", \"{$objednavka}\", \"{$zakaznik}\", {$_SESSION["username"]}, {$from} )\r\n ");
sql_insert("INSERT INTO do_objednavka_row_search (id_obj, zakaznik, text)\r\n VALUES (\"{$obj_id}\", \"{$zakaznik}\", \"{$text}\" )\r\n ");
mysql_query("COMMIT");
}
示例5: sec_sql
<?php
if ($_POST["filter"]) {
//var_dump($_POST);
$_SESSION["filter_vyroba_od"] = sec_sql(sec_input($_POST["filter_vyroba_od"]));
$_SESSION["filter_vyroba_do"] = sec_sql(sec_input($_POST["filter_vyroba_do"]));
$_SESSION["filter_vyroba_zakaznik"] = sec_sql(sec_input($_POST["filter_vyroba_zakaznik"]));
$_SESSION["filter_vyroba_zakaznik_no"] = sec_sql(sec_input($_POST["filter_vyroba_zakaznik_no"]));
$_SESSION["filter_vyroba_product_type"] = sec_sql(sec_input($_POST["filter_vyroba_product_type"]));
$_SESSION["filter_vyroba_product"] = sec_sql(sec_input($_POST["filter_vyroba_product"]));
$_SESSION["filter_vyroba_dl"] = sec_sql(sec_input($_POST["filter_vyroba_dl"]));
$_SESSION["filter_vyroba_matrac_rozmer"] = sec_sql(sec_input($_POST["filter_vyroba_matrac_rozmer"]));
}
$day_limit = 30;
$where = array();
$where[] = "vp.vymaz=0";
$where[] = "vp.status=5";
if (!empty($_SESSION["filter_vyroba_od"])) {
$where[] = "datum_vyroby >= \"{$_SESSION["filter_vyroba_od"]} 00:00:00\"";
} else {
$where[] = "datum_vyroby >= DATE_SUB(CURDATE(), INTERVAL {$day_limit} DAY)";
}
if (!empty($_SESSION["filter_vyroba_do"])) {
$where[] = "datum_vyroby <= \"{$_SESSION["filter_vyroba_do"]} 23:59:59\"";
}
echo "<h1>Výroba</h1>";
echo "<form method=\"POST\">";
echo "<div class=\"filter_vyroba clearfix\">";
echo textfield("filter_vyroba_od", $_SESSION["filter_vyroba_od"], "od:", 15, 10, "filter_vyroba_od datetime");
echo textfield("filter_vyroba_do", $_SESSION["filter_vyroba_do"], "do:", 15, 10, "filter_vyroba_do datetime");
echo select("filter_vyroba_zakaznik", "Filtruj zákazníkov:", "SELECT id, CONCAT(meno, ', ', doruc_mesto) meno FROM uzivatel WHERE skupina=2 AND vymaz=0 ORDER BY meno", $_SESSION["filter_vyroba_zakaznik"], "", "", "");
示例6: implode
echo "<div id=error_message>" . implode("<br>", $error_msg) . "</div>";
}
}
// zobrazenie pridaných súborov
echo "<div id=\"added_files\">\r\n <h2>Nahraté súbory</h2>";
$directory = "files/obj-{$order}/rev-{$revision}";
$files = sql_query("SELECT meno, meno_old, pripona \r\n FROM subor\r\n WHERE id_obj=\"{$order}\" AND id_revizia=\"{$revision}\"");
//var_dump($files);
for ($i = 0; $i < count($files); $i++) {
echo "<a href=\"{$directory}/" . $files[$i]["meno"] . "." . $files[$i]["pripona"] . "\" target=\"_blank\">" . substr($files[$i]["meno_old"], 0, 20) . "</a><br>";
}
echo "</div>";
// tlačítko na generovanie csv súboru
echo "<div id=\"revision_buttons\">";
$directory = "files/csv_new/obj-{$order}/rev-{$revision}";
$meno_csv = sec_input(rep_dia($form_data[meno]));
$meno_csv = str_replace(" ", "", $meno_csv);
$meno_csv = str_replace('/', "", $meno_csv);
$meno_csv = str_replace('.', "", $meno_csv);
if (strlen($meno_csv) > 10) {
$meno_csv = substr($meno_csv, 0, 10);
}
$file = "{$c_obj}-{$meno_csv}.csv";
$file_pasy = "{$c_obj}-{$meno_csv}-pasy.csv";
echo "<div id=\"add_csv_button\">";
//var_dump("subor ".$directory."/".$file);
if (!file_exists($directory . "/" . $file)) {
echo "<a href=\"?vyber=objednavky&order={$order}&revision={$revision}&action=generate_csv_new\" class=\"download_csv\" data-url=\"?vyber=objednavky&order={$order}&revision={$revision}\">Vytvor .csv</a>";
} else {
echo "<a href=\"{$directory}/{$file}\" data-url=\"?vyber=objednavky&order={$order}&revision={$revision}\">Stiahni .csv</a><br>";
echo "<a href=\"?vyber=objednavky&order={$order}&revision={$revision}&action=generate_csv_new\">Pregeneruj .csv</a>";
示例7: print_revision_cp_vyrobny_plan
function print_revision_cp_vyrobny_plan($cp, $revision)
{
$data = sql_query("SELECT id_vyrobny_plan, DATE_FORMAT(datum, '%d. %m. %Y, %H:%i') AS datum\r\n FROM revizia_vyrobny_plan \r\n WHERE id={$revision} \r\n LIMIT 1")[0];
$data_row = sql_query("SELECT vyr.*, obr.*, rev.meno, rev.mesto, rev.doruc_mesto, rev.email, \r\n rev.komentar, rev.komentar_private, rev.vlastne_cislo_obj, obj.id_zakaznik, obj.c_obj, obj.datum \r\n FROM vyrobny_plan_row vyr\r\n INNER JOIN objednavka_row obr\r\n ON vyr.id_objednavka_row = obr.id\r\n INNER JOIN revizia rev\r\n ON obr.id_revizia = rev.id\r\n INNER JOIN objednavka obj\r\n ON rev.id_obj = obj.id\r\n WHERE id_revizia_vyrobny_plan = " . $revision . "\r\n AND vyr.vymaz = 0;\r\n ");
foreach ($data_row as $key => $row) {
$data_row_option = sql_query("SELECT id_product_atribute, id_product_atribute_option \r\n FROM objednavka_row_atribute \r\n WHERE id_revizia=\"{$row['id_revizia']}\" AND id_objednavka_row=\"{$row[id]}\"");
//var_dump($data_row_option);
foreach ($data_row_option as $option) {
$data_row[$key]["product_atribute_options_all"][$option["id_product_atribute"]] = $option["id_product_atribute_option"];
}
if ($row["id_zakaznik"] == 0) {
$data_zak[$row["id_zakaznik"]][$row["id_revizia"]][] = $data_row[$key];
} else {
$data_zak[$row["id_zakaznik"]][] = $data_row[$key];
}
}
//var_dump($data_zak);
$data_obj = sql_query("SELECT id, meno, popis, DATE_FORMAT(datum_vyvozu, '%d. %m. %Y') AS datum, \r\n DATE_FORMAT(datum, '%Y') AS rok\r\n FROM vyrobny_plan \r\n WHERE id=" . $data["id_vyrobny_plan"] . " LIMIT 1");
$data_obj = $data_obj[0];
$message = "";
$message .= "<h1>Cenová ponuka <br> Výrobný Plán č. " . $data_obj["id"] . "/" . $data_obj["rok"] . " - " . $data_obj["meno"] . " </h1>";
$message .= "<h5>Dátum vývozu: " . $data_obj["datum"] . "</h5>";
$message .= !empty($data_obj["popis"]) ? "<h5>Popis: " . $data_obj["popis"] . "</h5>" : "";
/*
$data_row = sql_query("SELECT *
FROM vyrobny_plan_row vyr
INNER JOIN objednavka_row obr
ON vyr.id_objednavka_row = obr.id
WHERE id_revizia_vyrobny_plan = ".$revision."
");
*/
$message .= "<div class=\"print_hlavicka3\">\r\n <table>\r\n <tr>\r\n \r\n <th style=\"width: 460px;\">produkt</th> \r\n <th style=\"width: 90px;\">j.cena</th> \r\n <th style=\"width: 100px;\">zľava % / j.cena po</th>\r\n <th style=\"width: 80px;\">Spolu</th>\r\n <th style=\"width: 80px;\"></th>\r\n <th style=\"width: 100px;\">komentár</th>\r\n </tr>";
foreach ($data_zak as $key => $zakaznik) {
//var_dump($key);
$data_z = array();
if ($key > 0) {
if ($sum_zakaznik > 0) {
$message .= "<tr>";
$message .= "<td colspan=3 class=\"right\">Spolu pre zákazníka / objednávku</td>";
$message .= "<td colspan=3 class=\"bold\">{$sum_zakaznik} €</td>";
$message .= "</tr>";
}
$sum_zakaznik = 0;
$message .= "<tr class=\"silver\">";
$query = "SELECT meno, mesto, doruc_mesto, email FROM uzivatel WHERE id=" . $key . " LIMIT 1";
$zakaz = sql_query($query)[0];
//dd($zakaz);
$data_z["meno"] = $zakaz["meno"];
$data_z["doruc_mesto"] = $zakaz["doruc_mesto"];
$data_z["mesto"] = $zakaz["mesto"];
$data_z["email"] = $zakaz["email"];
$odberatel = $data_z["meno"];
if (empty($data_z["doruc_mesto"])) {
$odberatel .= empty($data_z["mesto"]) ? "" : ", " . $data_z["mesto"];
} else {
$odberatel .= ", " . $data_z["doruc_mesto"];
}
$odberatel = "<span class=\"bold\">" . $odberatel . "</span>" . (!empty($data_z["email"]) ? " (" . $data_z["email"] . ")" : "") . "";
$message .= "<td colspan=6>{$odberatel}</td>";
$message .= "</tr>";
}
//var_dump($zakaznik);
foreach ($zakaznik as $keyer => $riadok) {
//var_dump($riadok);
//var_dump($sum_zakaznik);
if ($key > 0) {
$message .= "<tr>";
$product_type = sql_query("SELECT meno FROM product_type WHERE id=" . sec_sql(sec_input($riadok["id_product_type"])) . " LIMIT 1");
$product_type = $product_type[0];
$product = sql_query("SELECT id, meno FROM product WHERE id=" . sec_sql(sec_input($riadok["id_product"])) . " LIMIT 1")[0];
$options_str = array();
//var_dump($data);
if (!isset($riadok["product_atribute_options_all"]) or empty($riadok["product_atribute_options_all"])) {
$riadok["product_atribute_options_all"] = array();
}
foreach ($riadok["product_atribute_options_all"] as $option) {
//var_dump($option);
$options_str[] = sql_query("SELECT meno FROM product_atribute_option WHERE id=" . sec_sql(sec_input($option)) . " LIMIT 1")[0]["meno"];
}
$vlastne_cislo_obj = "";
if (!empty($riadok["vlastne_cislo_obj"])) {
$vlastne_cislo_obj = " (" . $riadok["vlastne_cislo_obj"] . ") ";
}
$options_str = empty($options_str) ? "" : " (" . join(", ", $options_str) . ")";
//var_dump($options_str);
$message .= "<td class=\"form_nazov_siroky\"><span class=\"bold\">" . sec_input($riadok["ks"]) . "x</span> " . $product_type["meno"] . " <span class=\"bold\">" . $product["meno"] . "</span>\r\n " . $options_str . "\r\n <span class=\"smaller\"><br>obj. č. {$riadok["c_obj"]}/" . dateYear($riadok["datum"]) . " {$vlastne_cislo_obj} z " . dateDate($riadok["datum"]) . "</span>\r\n " . (empty($riadok["atyp_text"]) ? "" : "<br>Atyp: " . sec_input($riadok["atyp_text"])) . "\r\n " . (empty($riadok["komentar"]) ? "" : "<br>- " . sec_input($riadok["komentar"])) . "\r\n " . (empty($riadok["komentar_private"]) ? "" : "<br>- " . sec_input($riadok["komentar_private"])) . "</td>";
$ks_sum = $ks_sum + $riadok["ks"];
$query = "SELECT * from cp_vyrobny_plan_row WHERE id_cp_vyrobny_plan=" . sec_input(sec_sql($_GET["cp"])) . " AND id_objednavka_row=" . $riadok[id] . "";
$cp_row = sql_query($query)[0];
//var_dump($cp_row);
$cena = $cp_row[cena];
$zlava = $cp_row[zlava];
$black = $cp_row[black];
$ppd = $cp_row[ppd];
$komis = $cp_row[komis];
$koment = $cp_row[koment];
$id_cp_product = $cp_row[id_cp_product];
if (!isset($riadok["product_atribute_options_all"]) or empty($riadok["product_atribute_options_all"])) {
$riadok["product_atribute_options_all"] = array();
}
//.........这里部分代码省略.........
示例8: display_form_data
function display_form_data($fieldsets_c, $secure_key = "")
{
$data = $_SESSION["posted_form"];
$fieldsets_c = count($data["ks_all"]);
//var_dump($data);
//var_dump($_SESSION["csrf_key"]);
if ($_SESSION["csrf_key"] != $data["secure_csrf"]) {
echo "ACCESS_dennied!!";
header("location: ?vyber={$vyber}&page=1");
die;
}
//var_dump($data);
echo "<table id=\"form_data_objednavatel\" class=\"form_data_objednavatel\">\r\n <tr>\r\n <td class=\"hlavicka\">Meno / Firma</td><td class=\"objednavatel obj_meno\">" . sec_input($data["meno"]) . "</td>\r\n </tr>\r\n <tr>\r\n <td class=\"hlavicka\">Adresa</td><td class=\"objednavatel\">" . sec_input($data["adresa"]) . "</td>\r\n </tr>\r\n <tr>\r\n <td class=\"hlavicka\">Mesto</td><td class=\"objednavatel\">" . sec_input($data["psc"]) . " " . sec_input($data["mesto"]) . "</td>\r\n </tr>\r\n \r\n <tr>\r\n <td class=\"hlavicka\">IČO</td><td class=\"objednavatel\">" . sec_input($data["ico"]) . "</td>\r\n </tr>\r\n <tr>\r\n <td class=\"hlavicka\">DIČ</td><td class=\"objednavatel\">" . sec_input($data["dic"]) . "</td>\r\n </tr>\r\n <tr>\r\n <td class=\"hlavicka\">telefon</td><td class=\"objednavatel\">" . sec_input($data["telefon"]) . "</td>\r\n </tr>\r\n <tr>\r\n <td class=\"hlavicka\">email</td><td class=\"objednavatel\">" . sec_input($data["email"]) . "</td>\r\n </tr>\r\n <tr>\r\n <td class=\"hlavicka\">Vaše číslo obj.</td><td class=\"objednavatel\">" . sec_input($data["vlastne_cislo_obj"]) . "</td>\r\n </tr>\r\n <tr>\r\n <td class=\"hlavicka\">Vystavil</td><td class=\"objednavatel\">" . sec_input($data["vystavil"]) . "</td>\r\n </tr>";
echo "</table>";
echo "<table id=\"form_data_doruc\" class=\"form_data_objednavatel\">\r\n <tr>\r\n <td class=\"hlavicka\"></td><td class=\"objednavatel obj_meno\">Adresa doručenia</td>\r\n </tr>\r\n <tr>\r\n <td class=\"hlavicka\">Meno / Firma</td><td class=\"objednavatel obj_meno\">" . sec_input($data["doruc_meno"]) . "</td>\r\n </tr>\r\n <tr>\r\n <td class=\"hlavicka\">Adresa</td><td class=\"objednavatel\">" . sec_input($data["doruc_adresa"]) . "</td>\r\n </tr>\r\n <tr>\r\n <td class=\"hlavicka\">Mesto</td><td class=\"objednavatel\">" . sec_input($data["doruc_psc"]) . " " . sec_input($data["doruc_mesto"]) . "</td>\r\n </tr>\r\n <tr>\r\n <td class=\"hlavicka\">Telefón</td><td class=\"objednavatel\">" . sec_input($data["doruc_telefon"]) . "</td>\r\n </tr>\r\n \r\n ";
echo "</table>";
//dd($data);
echo "<table id=\"form_data_table\">\r\n <tr>\r\n <th></th> \r\n <th>produkt</th>\r\n <th>množstvo</th>\r\n <th>doprava</th>\r\n <th>atyp text</th> \r\n <th></th>\r\n </tr>";
for ($i = 0; $i < $fieldsets_c; $i++) {
$poradie = 0;
$poradie = $i + 1;
echo "<tr>\r\n <td class=\"form_poradie\">{$poradie}. </td>\r\n ";
$product_type = sql_query("SELECT meno FROM product_type WHERE id=" . sec_sql(sec_input($data["product_type_all"][$i])) . " LIMIT 1");
$product_type = $product_type[0];
$product = sql_query("SELECT meno FROM product WHERE id=" . sec_sql(sec_input($data["product_all"][$i])) . " LIMIT 1")[0];
$options_str = array();
//dd($data);
if (!isset($data["product_atribute_options_all"][$i]) or empty($data["product_atribute_options_all"][$i])) {
$data["product_atribute_options_all"][$i] = array();
}
foreach ($data["product_atribute_options_all"][$i] as $option) {
//var_dump($option);
$options_str[] = sql_query("SELECT meno FROM product_atribute_option WHERE id=" . sec_sql(sec_input($option)) . " LIMIT 1")[0]["meno"];
}
//var_dump($options_str);
$options_str = empty($options_str) ? "" : " (" . join(" / ", $options_str) . ")";
echo "<td class=\"form_nazov_siroky\">" . $product_type["meno"] . " " . $product["meno"] . "" . $options_str . "</td>";
$product_delivery = sql_query("SELECT meno FROM product_delivery WHERE id=" . sec_sql(sec_input($data["product_delivery_all"][$i])) . " LIMIT 1");
$product_delivery = $product_delivery[0];
echo "<td class=\"form_ks\">" . sec_input($data["ks_all"][$i]) . " ks</td>";
echo "<td class=\"form_nazov ali-center\">" . $product_delivery["meno"] . "</td>";
echo "<td class=\"form_nazov\">" . sec_input($data["atyp_text_all"][$i]) . "</td>";
echo "<td class=\"td_vypocet\">" . ($vypocet > 0 ? $vypocet_final : "") . "</td>";
echo "</tr>";
}
echo "</table>";
echo "<div id=\"form_komentar\">\r\n " . sec_input($data["komentar"]) . " \r\n </div>";
echo "<div id=\"form_komentar\">\r\n " . sec_input($data["komentar_private"]) . " \r\n </div>";
echo "<form method=\"POST\" id=\"formular\" enctype=\"multipart/form-data\">";
echo "<div class=\"formular_buttons clearfix\">";
echo submit("submit_confirm", "Odoslať objednávku");
echo submit("submit_save", "Uložiť objednávku");
echo "<div class=\"confirm_order_another\"><a href=\"?vyber=formular&page=1\">Vrátiť sa Späť k úprave</a></div>";
echo "</div>";
echo "</form>\r\n \r\n ";
echo "<div class=\"help_text clearfix\">";
echo "<ul>";
echo "<li>Po odoslaní objednávky Vám bude doručený potvrdzujúci email</li>";
echo "<li>Ak si prajete objednávku ešte opraviť použite tlačítko <strong>Vrátiť sa Späť</strong></li>";
echo "<li>Ak Vaša objednávka ešte nie je v tejto chvíli kompletná a v jej dokončení chcete pokračovať neskôr, použite tlačítko <strong>Uložiť objednávku</strong>.<br>\r\n Po uložení Vám bude na Vašu adresu doručený email s potvrdením a inštukciami, ako pokračovať vo vypĺňaní uloženej objednávky.\r\n </li>";
echo "</ul>";
echo "</div>";
}
示例9: send_email_revision_velkoobchod
function send_email_revision_velkoobchod($revision)
{
//var_dump($revision);
//die();
require_once 'include/PHPMailer/PHPMailerAutoload.php';
$email_to_kraf = def_value("default_email", "hodnota");
mysql_query("BEGIN");
$data = sql_query("SELECT id_velkoobchod, komentar, sum,\r\n DATE_FORMAT(datum_vlastny, '%d. %m. %Y') AS datum\r\n FROM revizia_velkoobchod \r\n WHERE id={$revision} \r\n LIMIT 1");
$data_narez = sql_query("SELECT id_revizia as revizia, id_material as material, id_vyrobca as vyrobca, \r\n id_dekor as dekor, id_dekor_cena as dekor_cena, m2, m3, sum\r\n FROM porez_velkoobchod \r\n WHERE id_revizia={$revision}");
$data = $data[0];
$fieldsets_c = count($data_narez);
for ($i = 0; $i < $fieldsets_c; $i++) {
$m2[$i] = $data_narez[$i][m2];
$m3[$i] = $data_narez[$i][m3];
$material[$i] = $data_narez[$i][material];
$vyrobca[$i] = $data_narez[$i][vyrobca];
$dekor[$i] = $data_narez[$i][dekor];
$dekor_cena[$i] = $data_narez[$i][dekor_cena];
$sum[$i] = $data_narez[$i][sum];
}
$data[m2_all] = $m2;
$data[m3_all] = $m3;
$data[material_all] = $material;
$data[vyrobca_all] = $vyrobca;
$data[dekor_all] = $dekor;
$data[dekor_cena_all] = $dekor_cena;
$data[sum_all] = $sum;
//var_dump($data);
$data_obj = sql_query("SELECT id, DATE_FORMAT(datum_vlastny, '%d. %m. %Y') AS datum,\r\n DATE_FORMAT(datum, '%Y') AS rok\r\n FROM velkoobchod \r\n WHERE id=" . $data["id_velkoobchod"] . " LIMIT 1");
$data_obj = $data_obj[0];
//var_dump($data_obj); die();
$message = "<html><body>";
$message .= "<img src=\"http://" . def_value("default_url", "hodnota") . "/assets/images/logo.jpg\">";
$message .= "<h1>Objednávka č. " . $data_obj["id"] . "/" . $data_obj["rok"] . "</h1>";
$message .= "zo dňa: " . $data_obj["datum"] . "<br><br>";
$message .= "<table style=\"font-size: 10pt;\">\r\n <tr style=\"border-bottom: solid 1px darkslategrey ;\">\r\n <th style=\"background-color: lightsteelblue; color: white; padding:5px; font-size: 90%; width: 20px;\"></th>\r\n <th style=\"background-color: lightsteelblue; color: white; padding:5px; font-size: 90%; width: 130px;\">materiál</th>\r\n <th style=\"background-color: lightsteelblue; color: white; padding:5px; font-size: 90%; width: 150px;\">výrobca</th>\r\n <th style=\"background-color: lightsteelblue; color: white; padding:5px; font-size: 90%; width: 200px;\">dekor</th>\r\n <th style=\"background-color: lightsteelblue; color: white; padding:5px; font-size: 90%; width: 40px;\">ks</th>\r\n <th style=\"background-color: lightsteelblue; color: white; padding:5px; font-size: 90%; width: 40px;\">m3</th>\r\n <th style=\"background-color: lightsteelblue; color: white; padding:5px; font-size: 90%; width: 60px;\">j.cena</th>\r\n <th style=\"background-color: lightsteelblue; color: white; padding:5px; font-size: 90%; width: 50px;\">spolu</th>\r\n \r\n </tr>";
for ($i = 0; $i < $fieldsets_c; $i++) {
$poradie = 0;
$poradie = $i + 1;
$message .= "<tr>\r\n <td class=\"form_poradie\">{$poradie}. </td>";
$material = sql_query("SELECT meno FROM material WHERE id=" . sec_sql(sec_input($data["material_all"][$i])) . " LIMIT 1");
$material = $material[0];
$message .= "\r\n <td class=\"form_nazov\">" . $material["meno"] . "</td>";
$vyrobca = sql_query("SELECT meno FROM vyrobca WHERE id=" . sec_sql(sec_input($data["vyrobca_all"][$i])) . " LIMIT 1");
$vyrobca = $vyrobca[0];
$message .= "\r\n <td class=\"form_nazov\">" . $vyrobca["meno"] . "</td>";
$dekor = sql_query("SELECT meno FROM dekor WHERE id=" . sec_sql(sec_input($data["dekor_all"][$i])) . " LIMIT 1");
$dekor = $dekor[0];
$message .= "<td class=\"form_nazov\">" . $dekor[meno] . "</td>";
$message .= "\r\n <td class=\"form_hrana\">" . sec_input($data["m2_all"][$i]) . "</td>\r\n <td class=\"form_hrana\">" . sec_input($data["m3_all"][$i]) . "</td>";
$dekor_cena = sql_query("SELECT cena FROM cp_dekor_ks WHERE id=" . sec_sql(sec_input($data["dekor_cena_all"][$i])) . " LIMIT 1");
$dekor_cena = $dekor_cena[0];
$message .= "<td class=\"form_hrana\">" . round($dekor_cena[cena], 2) . "</td>";
$message .= "<td class=\"form_data_material\">" . round(sec_input($data["sum_all"][$i]), 2) . "</td>";
//var_dump($vypocet_paska_sum);
//$message .= "<td class=\"td_vypocet\">".($vypocet>0 ? $vypocet_final : "" )."</td>";
$message .= "</tr>";
}
$message .= "</table><br>";
$message .= "<div class=\"form_vypocet_sum\">Spolu: " . round($data["sum"], 2) . " </div>";
$message .= "<br>" . $data["komentar"] . "<br><br>";
$message .= "email vytvorený: " . date("j. n. Y - H:i") . "<br>";
$message .= "</body></html>";
mysql_query("COMMIT");
$headers = "From: \"KRaF - Veľkoobchod\" <" . $email_to_kraf . ">\r\n";
$headers .= "Reply-To: " . $email_to_kraf . "\r\n";
//$headers .= "CC: scooti@stonline.sk\r\n";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: text/html; charset=UTF-8\r\n";
//print_r($message);
//exit();
$mail = new PHPMailer();
$mail->IsSMTP();
$mail->CharSet = "UTF-8";
$mail->SMTPDebug = 0;
$mail->SMTPAuth = true;
//$mail->SMTPSecure = 'ssl';
$mail->Host = def_value("default_email_host", "hodnota");
$mail->Port = def_value("default_email_port", "hodnota");
$mail->Username = def_value("default_email_username", "hodnota");
$mail->Password = def_value("default_email_password", "hodnota");
$mail->isHTML(true);
$mail->setLanguage('sk', 'language/');
$mail->SetFrom(def_value("default_email", "hodnota"), def_value("default_firma", "hodnota"));
$email_to = $email_to_kraf;
$email_subject = "Velkoobchod č. " . $data_obj["id"] . "/" . $data_obj["rok"] . " zo dňa " . $data_obj["datum"] . "";
$mail->Subject = $email_subject;
$mail->Body = $message;
$mail->AddAddress($email_to);
$mail->Send();
//mail($email_to, $email_subject, $message, $headers);
//var_dump($email_to);
//var_dump($data["email"]);
//echo "Email bol úspešne odoslaný na adresu: $email_to";
}
示例10: delete
function delete($table, $vyber, $id, $sub)
{
$id = sec_sql(sec_input($id));
$query = "Select vymaz from {$table} WHERE id={$id}";
$value = sql_query($query);
if ($value[0][vymaz] == 0) {
$vymaz = 1;
} else {
$vymaz = 0;
}
if (!is_numeric($id) or empty($id)) {
$error_msg[] = "ID ma nesprávnu hodnotu";
}
//var_dump($error_msg);
if (empty($error_msg)) {
$query = "UPDATE {$table}\r\n SET vymaz = {$vymaz}\r\n WHERE id = {$id}";
sql_update($query);
header("location: index.php?vyber={$vyber}&sub={$table}");
} else {
echo "<div id=error_message>" . implode("<br>", $error_msg) . "</div>";
}
echo "<h2>Skutočne chcete vymazať položku " . $value[0][meno] . "?</h2>";
echo "<form method=\"POST\">";
echo hidden("id", $value[id]);
echo submit("submit", "Vymazať");
echo "</form>";
}
示例11: sec_input
}
if (isset($_GET["id"])) {
$id = sec_input($_GET["id"]);
}
if (isset($_GET["rok"])) {
$rok = sec_input($_GET["rok"]);
}
if (isset($_GET["mesiac"])) {
$mesiac = sec_input($_GET["mesiac"]);
}
if (isset($_GET["message"])) {
$message = sec_input($_GET["message"]);
}
if (isset($_POST["meno"])) {
$meno = sec_input($_POST["meno"]);
}
if (isset($_POST["adresa"])) {
$adresa = sec_input($_POST["adresa"]);
}
if (isset($_POST["ico_icdph"])) {
$ico_icdph = sec_input($_POST["ico_icdph"]);
}
if (isset($_POST["telefon"])) {
$telefon = sec_input($_POST["telefon"]);
}
if (isset($_POST["email"])) {
$email = sec_input($_POST["email"]);
}
if (isset($_POST["vyrobca"])) {
$vyrobca = sec_input(sec_sql($_POST["vyrobca"]));
}
示例12: microtime
$mtime = microtime();
$mtime = explode(" ", $mtime);
$mtime = $mtime[1] + $mtime[0];
$starttime = $mtime;
//var_dump($_SESSION);
if (isset($_GET["search_text"])) {
$search_text = sec_input($_GET["search_text"]);
}
if (isset($_GET["search_dodavatel"])) {
$search_dodavatel = sec_input($_GET["search_dodavatel"]);
}
if (isset($_GET["search_date_od"])) {
$search_date_od = sec_input($_GET["search_date_od"]);
}
if (isset($_GET["search_date_do"])) {
$search_date_do = sec_input($_GET["search_date_do"]);
}
//var_dump($search_date_od);
if ($search_text == "undefined") {
$search_text = "";
}
if ($search_zakaznik == "undefined") {
$search_zakaznik = "";
}
if (!isset($search_status)) {
$search_status = $_SESSION["search_status_do_objednavka"];
} else {
$_SESSION["search_status_do_objednavka"] = $search_status;
}
if (!isset($search_date_od)) {
$search_date_od = $_SESSION["search_date_od_do_objednavka"];
示例13: mysql_query
if (empty($error_msg)) {
//var_dump($_POST);
$_SESSION["posted_form_edit_rev"] = $form_data;
$data = $_SESSION["posted_form_edit_rev"];
//var_dump($data);
// vlozenie do revizii
mysql_query("BEGIN");
$query = "INSERT INTO revizia \n (id_obj, meno, adresa, mesto, psc, ico, dic, telefon, email, komentar, komentar_private,\n vystavil, vlastne_cislo_obj, doruc_meno, doruc_adresa, doruc_mesto, \n doruc_psc, doruc_telefon, datum, upravil)\n VALUES \n ({$order},\n \"" . sec_input(sec_sql($data["meno"])) . "\",\n \"" . sec_input(sec_sql($data["adresa"])) . "\",\n \"" . sec_input(sec_sql($data["mesto"])) . "\",\n \"" . sec_input(sec_sql($data["psc"])) . "\",\n \"" . sec_input(sec_sql($data["ico"])) . "\",\n \"" . sec_input(sec_sql($data["dic"])) . "\",\n \"" . sec_input(sec_sql($data["telefon"])) . "\",\n \"" . sec_input(sec_sql($data["email"])) . "\", \n \"" . sec_input(sec_sql($data["komentar"])) . "\",\n \"" . sec_input(sec_sql($data["komentar_private"])) . "\",\n \"" . sec_input(sec_sql($data["vystavil"])) . "\",\n \"" . sec_input(sec_sql($data["vlastne_cislo_obj"])) . "\",\n \"" . sec_input(sec_sql($data["doruc_meno"])) . "\",\n \"" . sec_input(sec_sql($data["doruc_adresa"])) . "\",\n \"" . sec_input(sec_sql($data["doruc_mesto"])) . "\",\n \"" . sec_input(sec_sql($data["doruc_psc"])) . "\",\n \"" . sec_input(sec_sql($data["doruc_telefon"])) . "\",\n now(), {$_SESSION['username']})";
$sql_revizia = sql_insert($query);
$revizia_id = $sql_revizia["inserted_id"];
$fieldsets_c = count($data["ks_all"]);
// vlozenie do porezu
$obj_delivery = 1;
for ($i = 0; $i < $fieldsets_c; $i++) {
$data_for_count = array("ks_all" => $data["ks_all"][$i], "product_type_all" => $data["product_type_all"][$i], "product_all" => $data["product_all"][$i], "product_delivery_all" => $data["product_delivery_all"][$i], "atyp_text_all" => $data["atyp_text_all"][$i], "vlastna_cena_all" => $data["vlastna_cena_all"][$i], "vyrobny_plan_all" => $data["vyrobny_plan_all"][$i]);
$query = "INSERT INTO objednavka_row \n (id_revizia, ks, id_product_type, id_product, id_product_delivery, atyp_text, vlastna_cena, vyrobny_plan)\n VALUES \n ({$revizia_id},\n " . sec_input(sec_sql($data["ks_all"][$i])) . ",\n " . sec_input(sec_sql($data["product_type_all"][$i])) . ",\n " . sec_input(sec_sql($data["product_all"][$i])) . ", \n \"" . sec_input(sec_sql($data["product_delivery_all"][$i])) . "\",\n \"" . sec_input(sec_sql($data["atyp_text_all"][$i])) . "\",\n \"" . sec_input(sec_sql($data["vlastna_cena_all"][$i])) . "\",\n \"" . sec_input(sec_sql($data["vyrobny_plan_all"][$i])) . "\"\n )";
$sql_porez = sql_insert($query);
$porez_id = $sql_porez["inserted_id"];
if ($data["product_delivery_all"][$i] == 4) {
$obj_delivery = $data["product_delivery_all"][$i];
}
if (!isset($data[product_atribute_options_all][$i]) or empty($data[product_atribute_options_all][$i])) {
$data[product_atribute_options_all][$i] = array();
}
foreach ($data[product_atribute_options_all][$i] as $key => $option) {
$query = "INSERT INTO objednavka_row_atribute \n (id_revizia, id_objednavka_row, id_product_atribute, id_product_atribute_option)\n VALUES ({$revizia_id}, {$porez_id}, {$key}, {$option})";
//var_dump($query);
$sql_porez_hrana = sql_insert($query);
}
}
sql_update("UPDATE objednavka SET delivery=\"{$obj_delivery}\"\n WHERE id=\"{$order}\"");
示例14: display_form_data
function display_form_data($fieldsets_c, $secure_key = "")
{
$data = $_SESSION["posted_form"];
$fieldsets_c = count($data["ks_all"]);
//dd($data);
//var_dump($_SESSION["csrf_key"]);
//df($data["secure_csrf"]);
//df($_SESSION["csrf_key"]);
if ($_SESSION["csrf_key"] != $data["secure_csrf"]) {
echo "ACCESS_dennied!!";
header("location: ?vyber={$vyber}&page=1");
die;
}
//var_dump($data);
echo "<table id=\"form_data_objednavatel\">\r\n <tr>\r\n <td class=\"hlavicka\">Meno / Firma</td><td class=\"objednavatel obj_meno\">" . sec_input($data["meno"]) . "</td>\r\n </tr>\r\n <tr>\r\n <td class=\"hlavicka\">Adresa</td><td class=\"objednavatel\">" . sec_input($data["adresa"]) . "</td>\r\n </tr>\r\n <tr>\r\n <td class=\"hlavicka\">IČO / IČ DPH</td><td class=\"objednavatel\">" . sec_input($data["ico_icdph"]) . "</td>\r\n </tr>\r\n <tr>\r\n <td class=\"hlavicka\">telefon</td><td class=\"objednavatel\">" . sec_input($data["telefon"]) . "</td>\r\n </tr>\r\n <tr>\r\n <td class=\"hlavicka\">email</td><td class=\"objednavatel\">" . sec_input($data["email"]) . "</td>\r\n </tr>";
echo "</table>";
echo "<table id=\"form_data_material\">\r\n <tr>\r\n <td class=\"hlavicka\">Rozmer</td>";
echo "<td class=\"objednavatel obj_meno\">\r\n " . sec_input($data["sirka"]) . " x " . sec_input($data["vyska"]) . " mm \r\n ";
echo "</td>\r\n </tr>\r\n <tr>\r\n <td class=\"hlavicka\">Počet dverí</td>";
echo "<td class=\"objednavatel\">\r\n " . sec_input($data["dvere_ks"]) . "";
echo "</td>\r\n </tr>\r\n <tr>\r\n <td class=\"hlavicka\">Madlo</td>";
$madlo = sql_query("SELECT meno, dvere, orez FROM madlo WHERE id=" . sec_sql(sec_input($data["madlo"])) . " LIMIT 1")[0];
$farba = sql_query("SELECT meno FROM farba WHERE id=" . sec_sql(sec_input($data["farba"])) . " LIMIT 1")[0];
echo "<td class=\"objednavatel\">" . $madlo["meno"] . "";
echo "</td>\r\n </tr>\r\n <tr>\r\n <td class=\"hlavicka\">Farba</td>";
echo "<td class=\"objednavatel\">" . $farba["meno"] . "";
echo "</td>\r\n </tr>\r\n <tr>\r\n <td class=\"hlavicka\">Hrúbka</td>";
echo "<td class=\"objednavatel\">" . sec_input($data["hrubka_skrine"]) . "";
echo "</td>\r\n </tr>\r\n ";
echo "</table>";
echo "\r\n <script src=\"assets/addons/Snapsvg/dist/snap.svg-min.js\" type=\"text/javascript\"></script>\r\n <script src=\"assets/script/script_skrine.js?" . filemtime("assets/script/script_skrine.js") . "\" type=\"text/javascript\"></script>\r\n \r\n <div id=\"snap_skrine_display\">\r\n " . $data["svg"] . "\r\n </div>";
echo "<table id=\"form_data_table\">\r\n ";
for ($i = 1; $i <= $data["dvere_ks"]; $i++) {
//var_dump($data["dvere".$i]);
if (empty($data["hrana1_all"][$i])) {
$data["hrana1_all"][$i] = "0";
}
echo "<tr>\r\n <td class=\"skrine_middle\">{$i}. dvere </td> \r\n <td class=\"form_rozmer\">" . (!empty($data["dvere" . $i]["sirka"]) ? round(sec_input($data["dvere" . $i]["sirka"]), 2) . "mm" : $data["sirka"] / $data["dvere_ks"] . "") . "</td>\r\n <td class=\"form_dvere\">";
echo "<table class=\"predel\">";
echo "<tr><th></th><th></th><th></th></tr>";
foreach ($data["dvere" . $i]["predel"] as $key => $predel) {
//var_dump($predel);
echo "<tr>";
echo "<td class=\"predel_ks\">{$key}. </td>";
echo "<td class=\"predel_middle\">výška: <span class=\"bold\">" . $predel["vyska"] . "mm</span> </td>";
echo "<td class=\"\">";
if (!empty($predel["zrkadlo"])) {
echo "zrkadlo";
}
if (!empty($predel["lakobel"])) {
echo "lakobel";
}
$dekor_text = array();
if (!empty($predel["vyrobca"])) {
$vyrobca = sql_query("SELECT meno FROM vyrobca WHERE id=\"" . sec_sql(sec_input($predel["vyrobca"])) . "\" LIMIT 1")[0];
$dekor_text[] = $vyrobca["meno"];
}
if (!empty($predel["dekor"])) {
$dekor = sql_query("SELECT meno FROM dekor WHERE id=" . sec_sql(sec_input($predel["dekor"])) . " LIMIT 1")[0];
$dekor_text[] = $dekor["meno"];
}
if (!empty($predel["iny_dekor"])) {
$dekor_text[] = $predel["iny_dekor"];
}
echo implode(",", $dekor_text);
if (!empty($predel["vertikalne"])) {
echo ", vertikálne";
}
echo "</td>";
echo "</tr>";
}
echo "</table>";
echo "</td>";
echo "</tr>";
}
echo "</table>";
echo "<div class=\"form_vypocet_sum\"></div>";
echo "<div id=\"form_komentar\">\r\n " . sec_input($data["komentar"]) . " \r\n </div>";
echo "<form method=\"POST\" id=\"formular\">";
echo "<div class=\"formular_buttons clearfix\">";
echo submit("submit_confirm", "Odoslať objednávku");
echo submit("submit_save", "Uložiť objednávku");
echo "<div class=\"confirm_order_another\"><a href=\"?vyber=formular_skrine&page=1\">Vrátiť sa Späť k úprave</a></div>";
echo "</div>";
echo "</form>\r\n \r\n ";
echo "<div class=\"help_text clearfix\">";
echo "<ul>";
echo "<li>Po odoslaní objednávky Vám bude doručený potvrdzujúci email</li>";
echo "<li>Ak si prajete objednávku ešte opraviť použite tlačítko <strong>Vrátiť sa Späť</strong></li>";
echo "<li>Ak Vaša objednávka ešte nie je v tejto chvíli kompletná a v jej dokončení chcete pokračovať neskôr, použite tlačítko <strong>Uložiť objednávku</strong>.<br>\r\n Po uložení Vám bude na Vašu adresu doručený email s potvrdením a inštukciami, ako pokračovať vo vypĺňaní uloženej objednávky.\r\n </li>";
echo "</ul>";
echo "</div>";
}
示例15: generate_csv_new
function generate_csv_new($order, $revision, $sub = "")
{
mysql_query("BEGIN");
$rev = empty($revision) ? 0 : $revision;
sql_insert("INSERT INTO revizia_aktivita (uzivatel_id, revizia, status) \r\n VALUES ({$_SESSION[username]}, {$rev}, \"vytvorenie CSV\")");
$obj = sql_query("SELECT id, DATE_FORMAT(datum, '%d. %m. %Y, %H:%i') AS datum, status, c_obj\r\n FROM objednavka \r\n WHERE id=\"{$order}\"\r\n LIMIT 1");
$obj = $obj[0];
$rev = sql_query("SELECT DATE_FORMAT(datum, '%d. %m. %Y, %H:%i') AS datum,\r\n meno, adresa, ico_icdph, telefon, email, id_material, id_vyrobca, id_hrubka, id_dekor,\r\n dekor_vlastny, komentar\r\n FROM revizia \r\n WHERE id_obj=\"{$order}\" AND id=\"{$revision}\"\r\n LIMIT 1");
$rev = $rev[0];
$c_obj = $obj["c_obj"];
$material = sql_query("SELECT meno, max_dlzka, max_sirka\r\n FROM material \r\n WHERE id=\"" . $rev["id_material"] . "\" \r\n LIMIT 1")[0];
$hrubka = sql_query("SELECT id, hodnota\r\n FROM hrubka \r\n WHERE id=\"" . $rev["id_hrubka"] . "\" \r\n LIMIT 1")[0];
if (is_duplak($hrubka["id"])) {
$hrubka["hodnota"] = "18";
}
$meno_csv = sec_input(rep_dia($rev[meno]));
$meno_csv = str_replace('/', "", $meno_csv);
$meno_csv = str_replace(" ", "", $meno_csv);
$meno_csv = str_replace(".", "", $meno_csv);
//$material[meno] = str_replace(" ", "", $material[meno]);
$vyrobca[meno] = str_replace(" ", "", $vyrobca[meno]);
if (strlen($meno_csv) > 10) {
$meno_csv = substr($meno_csv, 0, 10);
}
$directory = "files/csv_new/obj-{$order}/rev-{$revision}";
if (!file_exists($directory)) {
mkdir($directory, 0777, true);
}
if (!empty($sub) && $sub == "pasy") {
$meno_csv = $meno_csv . "-pasy";
}
$fp = fopen("{$directory}/{$c_obj}-{$meno_csv}.csv", "w+");
$rev[meno] = rep_dia($rev[meno]);
$rev[meno] = str_replace(" ", "_", $rev[meno]);
$meno_suboru = $rev[meno] . "" . (strlen($dekor[hodnota]) > 1 ? "_{$dekor['hodnota']}" : "") . "";
$meno_suboru = mb_substr($meno_suboru, 0, 20, "UTF-8");
//$rev[meno] = str_replace("/", "", $rev[meno]);
/*
$hlavicka = "0;".rep_dia($material["meno"]).";2800;2070;18;*;10;10;10;10;1
"; */
$hlavicka = "";
$hlavicka2 = "";
$nar = sql_query("SELECT ks, dlzka, sirka, nazov, poznamka, duplak, hrubka, orientacia,\r\n hrana1, hrana2, hrana3, hrana4, duplak_paska\r\n FROM porez \r\n WHERE id_revizia=\"{$revision}\"\r\n ");
$hrana = sql_query("SELECT id, hodnota, hodnota_csv, meno\r\n FROM hrana \r\n ");
if (empty($material["max_dlzka"])) {
$max_dlzka = def_value("max_dlzka", "hodnota");
} else {
$max_dlzka = $material["max_dlzka"];
}
if (empty($material["max_sirka"])) {
$max_sirka = def_value("max_sirka", "hodnota");
} else {
$max_sirka = $material["max_sirka"];
}
//dd($material);
foreach ($nar as $value) {
//var_dump($value);
$value[nazov] = str_replace(" ", "_", rep_dia($value[nazov]));
$value[poznamka] = str_replace(" ", "_", rep_dia($value[poznamka]));
$value[nazov] = preg_replace("/[^A-Z0-9a-z\\w ]/u", '', $value[nazov]);
$value[poznamka] = preg_replace("/[^A-Z0-9a-z\\w ]/u", '', $value[poznamka]);
//if ($value[orientacia]==0) $value[orientacia] = "";
/*
if (!empty($value[nazov])) {
$value[nazov] = $value[nazov];
} else {
$value[nazov] = $rev[meno];
}
if (!empty($value[poznamka])) {
$value[poznamka] = $value[poznamka];
} else {
$value[poznamka] = $rev[meno];
}
*/
if (strlen($value[nazov]) > 30) {
$value[nazov] = substr($value[nazov], 0, 30);
}
if (strlen($value[poznamka]) > 40) {
$value[poznamka] = substr($value[poznamka], 0, 40);
}
//var_dump($value[nazov]);
foreach ($hrana as $value_hrana) {
//var_dump($value_hrana);
for ($i = 1; $i < 5; $i++) {
if ($value_hrana[id] == $value["hrana" . $i]) {
$value["hrana" . $i] = $value_hrana[meno];
$value["hrana" . $i . "_hodnota"] = $value_hrana[hodnota];
}
if ($value["hrana" . $i] == "0") {
$value["hrana" . $i] = "";
}
if ($value["hrana" . $i] != "" and is_duplak($value[hrubka]) or $value["hrana" . $i] != "" and $value[duplak_paska] == 1) {
$value["hrana" . $i] = "42/2";
}
}
}
/*
$orientacia = sql_query("SELECT meno, hodnota FROM orientacia WHERE id=\"$value[orientacia]\" LIMIT 1");
//.........这里部分代码省略.........