Jump to content

tivadarsubotica

Members
  • Posts

    17
  • Joined

  • Last visited

Everything posted by tivadarsubotica

  1. In My post "Bilingual mod_rewrite" You explained me in a great way how can I use bilingual (or multilingual) pages in htaccess, so thats the right way how I understand the scripts...
  2. Yes, I know that I must to learn, the problem is time, time to do something that asking to me. Usual I ask for example, and then I see, how its work, than I can (step by step) learn and search for other solutions of my problems. If I had a solution to my question I know what are do up to now and adding a solution will see how can I go on if I had another problem. So, this is the way how I thinking...
  3. This is the problem, how can I do this, to click on submit and reload data without reload page and to page stay on same place where is it. Im wery "weak" with javascript aor Ajax... 😭
  4. I don’t know if it can be solved with Ajax or any other way Jus to see You should see how looks when is OFF and when is ON the button... The most important to page stay on the same place after submit to dont scrolling up or down... As You see I have in Form: index.php?c=listing_vesti#kajron_<?php echo $vesti_id; ?> what give me back the "clicked" on the top of the page, not on the same place where is clicked.
  5. Hi, I have a part of script, this is the form submitted with php and after submit, that reload the page. How can I do submit query without reload page (to page stay on same place where is it). <form action="index.php?c=listing_vesti#kajron_<?php echo $vesti_id; ?>" method="post"> <button type="submit" id="SubmitBTN" class="btn <?php echo $kajron_btn; ?>" name="kajronbtn"><input class="form-check-input" type="checkbox" id="kajron" name="kajron" value="<?php echo $vesti_kajron; ?>" <?php echo $kajron_checked; ?>>Kajron</button> <input type="hidden" id="vesti_id" name="vesti_id" value="<?php echo $vesti_id; ?>"> <input type="hidden" id="kajron" name="kajron" value="<?php echo $vesti_kajron; ?>"> </form> Thanks in advanced, T
  6. Hi, I have in column "keywords" comma separated keywords in one row/news. Example in ID "1" in column "keywords" have: "Šport, Fudbal, Četvrta Liga". I want to make a tag-s from those words to be like: http://site.com/tag/sport, http://site.com/tag/fudbal, http://site.com/tag/cetvrta-liga. At first I separate those words by: $input = $vest_keywords; $removed_spaces = preg_replace('/\s*,\s*/', ',', $input); $output = explode(',', $removed_spaces); foreach($output as $tags) { echo $tags; } This give me: Šport | Fudbal | Četvrta liga But I have a "slug-maker", and I have a problem with redeclare. /* SLUG */ $string = $output; function my_str_split($string) { $slen = strlen($string); for ($i = 0; $i < $slen; $i++) { $sArray[$i] = $string{$i}; } return $sArray; } function noDiacritics($string) { //cyrylic transcription $cyrylicFrom = array('А', 'Б', 'В', 'Г', 'Д', 'Е', 'Ё', 'Ж', 'З', 'И', 'Й', 'К', 'Л', 'М', 'Н', 'О', 'П', 'Р', 'С', 'Т', 'У', 'Ф', 'Х', 'Ц', 'Ч', 'Ш', 'Щ', 'Ъ', 'Ы', 'Ь', 'Э', 'Ю', 'Я', 'а', 'б', 'в', 'г', 'д', 'е', 'ё', 'ж', 'з', 'и', 'й', 'к', 'л', 'м', 'н', 'о', 'п', 'р', 'с', 'т', 'у', 'ф', 'х', 'ц', 'ч', 'ш', 'щ', 'ъ', 'ы', 'ь', 'э', 'ю', 'я'); $cyrylicTo = array('A', 'B', 'W', 'G', 'D', 'Ie', 'Io', 'Z', 'Z', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'R', 'S', 'T', 'U', 'F', 'Ch', 'C', 'Tch', 'Sh', 'Shtch', '', 'Y', '', 'E', 'Iu', 'Ia', 'a', 'b', 'w', 'g', 'd', 'ie', 'io', 'z', 'z', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'r', 's', 't', 'u', 'f', 'ch', 'c', 'tch', 'sh', 'shtch', '', 'y', '', 'e', 'iu', 'ia'); $from = array("Á", "À", "Â", "Ä", "Ă", "Ā", "Ã", "Å", "Ą", "Æ", "Ć", "Ċ", "Ĉ", "Č", "Ç", "Ď", "Đ", "Ð", "É", "È", "Ė", "Ê", "Ë", "Ě", "Ē", "Ę", "Ə", "Ġ", "Ĝ", "Ğ", "Ģ", "á", "à", "â", "ä", "ă", "ā", "ã", "å", "ą", "æ", "ć", "ċ", "ĉ", "č", "ç", "ď", "đ", "ð", "é", "è", "ė", "ê", "ë", "ě", "ē", "ę", "ə", "ġ", "ĝ", "ğ", "ģ", "Ĥ", "Ħ", "I", "Í", "Ì", "İ", "Î", "Ï", "Ī", "Į", "IJ", "Ĵ", "Ķ", "Ļ", "Ł", "Ń", "Ň", "Ñ", "Ņ", "Ó", "Ò", "Ô", "Ö", "Õ", "Ő", "Ø", "Ơ", "Œ", "ĥ", "ħ", "ı", "í", "ì", "i", "î", "ï", "ī", "į", "ij", "ĵ", "ķ", "ļ", "ł", "ń", "ň", "ñ", "ņ", "ó", "ò", "ô", "ö", "õ", "ő", "ø", "ơ", "œ", "Ŕ", "Ř", "Ś", "Ŝ", "Š", "Ş", "Ť", "Ţ", "Þ", "Ú", "Ù", "Û", "Ü", "Ŭ", "Ū", "Ů", "Ų", "Ű", "Ư", "Ŵ", "Ý", "Ŷ", "Ÿ", "Ź", "Ż", "Ž", "ŕ", "ř", "ś", "ŝ", "š", "ş", "ß", "ť", "ţ", "þ", "ú", "ù", "û", "ü", "ŭ", "ū", "ů", "ų", "ű", "ư", "ŵ", "ý", "ŷ", "ÿ", "ź", "ż", "ž"); $to = array("A", "A", "A", "AE", "A", "A", "A", "A", "A", "AE", "C", "C", "C", "C", "C", "D", "D", "D", "E", "E", "E", "E", "E", "E", "E", "E", "G", "G", "G", "G", "G", "a", "a", "a", "ae", "ae", "a", "a", "a", "a", "ae", "c", "c", "c", "c", "c", "d", "d", "d", "e", "e", "e", "e", "e", "e", "e", "e", "g", "g", "g", "g", "g", "H", "H", "I", "I", "I", "I", "I", "I", "I", "I", "IJ", "J", "K", "L", "L", "N", "N", "N", "N", "O", "O", "O", "OE", "O", "O", "O", "O", "CE", "h", "h", "i", "i", "i", "i", "i", "i", "i", "i", "ij", "j", "k", "l", "l", "n", "n", "n", "n", "o", "o", "o", "oe", "o", "o", "o", "o", "o", "R", "R", "S", "S", "S", "S", "T", "T", "T", "U", "U", "U", "UE", "U", "U", "U", "U", "U", "U", "W", "Y", "Y", "Y", "Z", "Z", "Z", "r", "r", "s", "s", "s", "s", "ss", "t", "t", "b", "u", "u", "u", "ue", "u", "u", "u", "u", "u", "u", "w", "y", "y", "y", "z", "z", "z"); $from = array_merge($from, $cyrylicFrom); $to = array_merge($to, $cyrylicTo); $newstring = str_replace($from, $to, $string); return $newstring; } function makeSlugs($string, $maxlen = 0) { $newStringTab = array(); $string = strtolower(noDiacritics($string)); if (function_exists('str_split')) { $stringTab = str_split($string); } else { $stringTab = my_str_split($string); } $numbers = array("0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "-"); //$numbers=array("0","1","2","3","4","5","6","7","8","9"); foreach ($stringTab as $letter) { if (in_array($letter, range("a", "z")) || in_array($letter, $numbers)) { $newStringTab[] = $letter; } elseif ($letter == " ") { $newStringTab[] = "-"; } } if (count($newStringTab)) { $newString = implode($newStringTab); if ($maxlen > 0) { $newString = substr($newString, 0, $maxlen); } $newString = removeDuplicates('--', '-', $newString); } else { $newString = ''; } return $newString; } function checkSlug($sSlug) { if (preg_match("/^[a-zA-Z0-9]+[a-zA-Z0-9\-]*$/", $sSlug) == 1) { return true; } return false; } function removeDuplicates($sSearch, $sReplace, $sSubject) { $i = 0; do { $sSubject = str_replace($sSearch, $sReplace, $sSubject); $pos = strpos($sSubject, $sSearch); $i++; if ($i > 100) { die('removeDuplicates() loop error'); } } while ($pos !== false); return $sSubject; } $vesti_tag_slug = makeSlugs($string, $maxlen = '0'); /* /. SLUG */ So I want to have tags like: sport | fudbal | cetvrta-liga Can You help how can I get the links that You se above? Thanks in advanced! T
  7. Thank You, its working. I just worry about "admin login", because that have a "timer" for login, and if the cookie is expire in mean time (after submit), than the user must to log in again in Admin pane.
  8. Hi, I have an admin folder where I need to push the scrapping button to do query (scraping some pages). The file for scarping is in root. In the Admin pane have a listing of news and in navbar have a "Scraping button". <!-- bootstrap navbar part --> <li class="nav-item"> <a class="nav-link active border text-yellow-100p" aria-current="page" href="../scraping/index.php">LOAD NEWS</a> </li> So, I want to push the "LOAD NEWS" button and after the scraping query is finished to reload page with news list in same place in Admin. If possible I want a simpliest way to do this... Thanks in adwanced, T
  9. Hi, I want to get a latest video from Youtube Playlist. I look it on Google API, and the other solutions, but I think dont undestand quit good what I need to do. For example a have a playlist: https://www.youtube.com/playlist?list=PLW8l7rX2YaXkaSI8GGbmqPjOEmfzd2hz3 And I want to see always only a latest uploaded video, so I need a link (embed - watch, or "youtu.be/xy"): https://www.youtube.com/watch?v=LyzziLETNUw&list=PLW8l7rX2YaXkaSI8GGbmqPjOEmfzd2hz3 Thanks in advanced, T
  10. The explanation for adding the language is very good and it works, and thak You very much. However, I have trouble leaving .html. Here's how to I use it: index.php?c=vojvodjanski (not vojvodjanski.html) The complete usage is here: (index.php?c=vojvodjanski) RewriteRule ^([^/]*)\.html$ /index.php?c=$1 [L] (index.php?c=vojvodjanski&kategorija=drustvo) RewriteRule ^([^/]*)/([^/]*)\.html$ /index.php?c=$1&kategorija=$2 [L] (index.php?c=vojvodjanski&kategorija=drustvo&y=2021&m=03&d=01&vest=gradona-elnik-luka-sa-saradnicima-obi-ao-romska-naselja) RewriteRule ^([^/]*)/([^/]*)/([^/]*)/([^/]*)/([^/]*)/([^/]*)\.html$ /index.php?c=$1&kategorija=$2&y=$3&m=$4&d=$5&vest=$6 [L] --------------- The first Rule is: https://vojvodjanski.com/vojvodjanski.html The second Rule is: https://vojvodjanski.com/vojvodjanski/drustvo.html The last Rule: https://vojvodjanski.com/vojvodjanski/drustvo/2021/04/08/gradona-elnik-luka-sa-saradnicima-obi-ao-romska-naselja.html --------------- So I want to remove all .html-s like below: The first Rule is: https://vojvodjanski.com/vojvodjanski The second Rule is: https://vojvodjanski.com/vojvodjanski/drustvo The last Rule: https://vojvodjanski.com/vojvodjanski/drustvo/2021/04/08/gradona-elnik-luka-sa-saradnicima-obi-ao-romska-naselja Sorry for a too many questions, but this is the first time that I use the mod_rewrite.
  11. And I have another "problem", I want to remove the .html at end of every rule... I remove the RewriteRule ^([^/]*)\.html$ /index.php?c=$1 [L] but dont work... and I want to remove from all Rules.
  12. /hu/vojvodjanski.html -> /index.php?lg=hu&c=vojvodjanski
  13. What do You mean index.php version? Here is the full htaccess rules: RewriteRule ^([^/]*)\.html$ /index.php?c=$1 [L] RewriteRule ^([^/]*)/([^/]*)\.html$ /index.php?c=$1&kategorija=$2 [L] RewriteRule ^([^/]*)/([^/]*)/([^/]*)\.html$ /index.php?c=$1&kategorija=$2&vest=$3 [L] RewriteRule ^([^/]*)/([^/]*)/([^/]*)/([^/]*)/([^/]*)/([^/]*)\.html$ /index.php?c=$1&kategorija=$2&y=$3&m=$4&d=$5&vest=$6 [L] The full (example) link is like: https://vojvodjanski.com/tvbecej/drustvo/2021/04/08/gradona-elnik-luka-sa-saradnicima-obi-ao-romska-naselja.html For (Hungarian) language I will put the "hu", like this: https://vojvodjanski.com/hu/tvbecej/kozjo/2021/04/08/a-polarmester-meglatogatta-a-roma-telepuleseket.html
  14. Hello, I'm pretty weak in mod_rewrite (too), trying to create a bilingual page. The base link looks something like this: 1. http://site.com/vojvodjanski.html htaccess rule: RewriteRule ^([^/]*)\.html$ /index.php?c=$1 [L] 2. http://site.com/vojvodjanski/drustvo.html htaccess rule: RewriteRule ^([^/]*)/([^/]*)\.html$ /index.php?c=$1&kategorija=$2 [L] The problem is that I should add an "hu" to each e.g: http://site.com/hu/vojvodjanski.html http://site.com/hu/vojvodjanski/drustvo.html ... I haven't done this with mod rewrite yet, I need help with this, h how to solve it? Thanks in advance, T
  15. At the moment, for some reason, I can't download a single file with this script, but my problem is that I don't know how to solve it by downloading only one file for one file, zipping it for multiple files (with one submitt). I’m not very familiar with PHP programming language, and especially never downloading (plus zipped). I searched the internet for opportunities but couldn’t figure out how to solve it.
  16. Hi, I want to download more than one file at a time. But now I can't download any of them that way. I want to solve it the way it is in gmail, i.e. I download either 1 file separately or if there are two or more, it is zipped. Thanks in advanced, T <!-- images --> <section class="card shadow mb-3"> <form action="index.php?lg=<?php echo $lng; ?>&c=text" method="post" enctype="multipart/form-data"> <header class="card-header navbar-custom"><h3 class="text-center"><?php echo $new_document_h3_images; ?></h3></header> <div class="row"> <?php $files = glob('./tekstovi/' . $user_txt_year . '/' . $user_txt_nr . '/' . $text_page . '/' . $user_txt_year . '_' . $user_txt_nr . '_' . $text_nr . '_' . $text_page . '_img_' . '*.{doc,docx,odt,pdf,jpg,JPG,jpeg,png,gif,psd,eps,ai,tiff,tif}', GLOB_BRACE); $dir = './tekstovi/' . $user_txt_year . '/' . $user_txt_nr . '/' . $text_page . '/'; //$index = '0'; for ($i = 0; $i < count($files); $i++) { $image = $files[$i]; ?> <div class="col-sm-4 py-2"> <div class="card h-100"> <input type='checkbox' style="position: absolute; left: 10px; top: 10px;" name='boxes[]' value='<?php echo basename($image); ?>' /> <?php echo '<img class="img-fluid" src="' . $image . '" alt="" />'; ?> <div class="card-body"> <p class="card-title"><?php echo basename($image); ?></p> </div> <div class="card-footer"><?php $stmt_captionreload = $pdo->prepare('SELECT * FROM `sn_images` WHERE sn_images_text_id = :sn_images_text_id AND CONCAT(`sn_images_filename`,`sn_images_basename`) = "' . basename($image) . '" '); $stmt_captionreload->bindValue(':sn_images_text_id', $text_id); $stmt_captionreload->execute(); $row_captionreload = $stmt_captionreload->fetch(PDO::FETCH_ASSOC); $one_caption = stripslashes($row_captionreload['sn_images_caption']); ?> <small class="text-muted"><?php echo $one_caption; ?></small></div> </div> </div> <?php }?> </div><!-- row--> <button type="submit" name="download" value="1" class="btn btn-success float-right">Download selected</button> <input type = 'hidden' name="sn_text_nr" value="<?php echo $text_nr; ?>"> </form> <?php if ($_POST['download'] == '1') { $index = '0'; echo 'Total count: ' . count($_POST['boxes']) . ''; while ($index < count($_POST['boxes'])) { if (isset($_POST['boxes'][$index])) { $file = $_POST['boxes'][$index]; $path = $dir . $file; header('Content-Description: File Transfer'); header('Content-Type: application/octet-stream'); header('Content-Disposition: attachment; filename=' . basename($path)); header('Content-Transfer-Encoding: binary'); header('Expires: 600'); header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); header('Pragma: public'); header('Content-Length: ' . filesize($path)); flush(); readfile($path); } else { } $index++; } } ?> </section> <!-- /. images -->
  17. Greeting, I tried to simplify the script as much as possible to make it understandable and here is my question. <?php // DELETE FILES $submit_file = $_POST['submit_file']; echo $filename = $_POST['filename']; if ($submit_file == '1') { unlink($filename); } else { } if($reload == 2) { INSERT INTO.. } else if ($reload > 2) { UPDATE ... } else {} ?> // BEGIN OF THE FORM <form action="index.php?lg=<?php echo $lng; ?>&c=new_document" method="post" enctype="multipart/form-data"> // INPUT TEKST AND OTHERS <input type="text" class="form-control form-control-lg" style="width: 40%;" id="sn_text_page" name="sn_text_page" value="<?php echo $text_page; ?>"> <textarea id="sn_text_lead" name="sn_text_lead" class="form-control font-weight-bold" rows="3"><?php echo $text_lead; ?></textarea> // SELECT FILES (MORE THAS ONE) <input type="file" name="file[]" id="file" multiple> // SUBMITTING BUTTON INSERT (UPDATE) DATABASE <button type="submit" name="submit_usertype" value="1" class="btn btn-primary"><?php echo $submit_button; ?></button> <input type="hidden" name="sn_text_id" value="<?php echo $text_id; ?>"> <input type="hidden" name="reload" value="<?php echo $reload; ?>"> // LOADING FILES (IMAGES) <?php $files = glob('./tekstovi/' . $user_txt_year . '/' . $user_txt_nr . '/' . $text_page . '/' . $user_txt_year . '_' . $user_txt_nr . '_' . $text_nr . '_' . $text_page . '_img_' . '*.{doc,docx,odt,pdf,jpg,JPG,jpeg,png,gif,psd,eps,ai,tiff,tif}', GLOB_BRACE); for ($i = 0; $i < count($files); $i++) { $image = $files[$i]; ?> <div class="col p-3"> <?php if ($reload == '1') { } else if ($reload > '1') { echo '<img class="img-fluid img-thumbnail shadow" src="' . $image . '" alt="" />' . '<small class="font-weight-bold">' . basename($image) . '</small><br /><br />'; ?> // DELETE ONE SELECTED FILE <button type="submit" name="submit_file" value="1" class="btn btn-danger"><?php echo $list_document_button_title_delete; ?></button> <input type="hidden" name="filename" value="<?php echo $image; ?>"> <input type="hidden" name="sn_text_id" value="<?php echo $text_id; ?>"> </div> <?php }}?> </div> </form> // END OF FORM I would like to delete the file I selected with "submit_file" and at the same time input the texts with UPDATE. Thanks in advance, T (If I wasn't clear, ask. Thanks again.)
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.