Posts by Daniel Omine • 19,666 points
581 posts
-
1
votes2
answers89
viewsA: How to simulate click only one button and not both?
Set a specific ID for each. <input type='button' id='foo' class='bo.. With this, just apply the click Trigger $('#foo').trigger('click');…
-
2
votes1
answer359
viewsA: Query sql separated by space
In function GROUP_CONCAT(), define the delimiter with the keyword SEPARATOR. Scope GROUP_CONCAT(string SEPARATOR 'delimitador') Full example: $sql= mysql_query("SELECT dia, GROUP_CONCAT(hora,…
mysqlanswered Daniel Omine 19,666 -
1
votes2
answers117
viewsA: Should I validate data in javascript and php?
Always validate a user’s data entry on the server side, in your case, with PHP. Do not rely only on the client-side part, with Javascript. This part is merely visual and aid for navigation and…
-
4
votes2
answers2639
viewsA: How to hide source code from PHP file?
A complement to the existing answer, try to observe as an "offender". If I were you instead of the person who wants to "steal/copy" the system and modify it to reuse or resell without authorization.…
phpanswered Daniel Omine 19,666 -
3
votes1
answer84
viewsA: error comparing sha1 in php
In this Techo $senhasession = sha1(sha1($_SESSION['senha'])); modify to $senhasession = $_SESSION['senha']; The reason is that in a previous line is already applying the "double sha1"…
-
3
votes3
answers807
viewsA: Force url forwarding with htaccess password
Create a file called ". htpasswd". The name can be anyone that suits you, not necessarily ". htpasswd". Paste this into the ". htpasswd": login:$apr1$pfIh.j7l$Zlqiecx1ZoYfEoUn1QVA50 "login" is the…
-
1
votes2
answers367
viewsA: ASP - Printing JSON without last comma and double quotation marks
I will show only the Techo of the loop, because it is only in this section that I modified: c2 = 0; Do If c2 > 0 Then response.write(",") End If response.write("{") c = 0; for each x in rs.fields…
-
6
votes7
answers21565
viewsA: Why is the use of frames and iframes considered bad practice?
It has always been wrong to say that search engines do not index iframes. The problem is how this information has been passed on in a sloppy manner over the years. Since framesets are actually…
-
2
votes2
answers110
viewsA: WHM - Monitor Mysql by site
There is a free plugin called "Watchmysql": https://www.ndchost.com/cpanel-whm/addons/watchmysql/ Configure connection limit per user, package/package or globally Triggers alert emails when some…
-
31
votes3
answers25273
viewsA: Table and column nomenclature
Short and direct response In short, you can create the standard you want as long as it is well documented and internationalized. So you can say you’re wrong when: - Does not have adequate…
-
1
votes1
answer811
viewsA: Shopping cart sql, php and ajax
This depends a lot on your business policy, especially when it comes to whether or not to exclude data periodically. There are business models that do not exclude and there are others that exclude…
-
7
votes4
answers1231
viewsA: Very interesting switch/case on Swift - What other languages support this?
Complementing, as a matter of curiosity. Comparing to the examples of the question, I demonstrate what it would look like in a language like PHP. Note that almost the same syntax applies in…
-
1
votes1
answer39
viewsA: txt file inserted in bd
A simple example for you to have a better idea of how to do: $data = file('tmp.txt'); // aqui vc coloca o caminho completo do arquivo txt. // A função file() faz a leitura do arquivo e retorna cada…
-
2
votes2
answers1465
viewsA: How do I locate the right origin of an event in a complex object via Javascript?
Responding in an objective way, In that code: document.getElementById("btn").onclick = function(e){ console.log("Quem clicou "+e.target.value) }; Exchange for: document.getElementById("btn").onclick…
-
7
votes3
answers1771
viewsA: What is the purpose of the magical __clone method?
Summary Basically the magic method __clone() serves as a "callback" after a cloning. When an object is cloned the compiler searches for the magic method __clone() and, if it exists, is invoked.…
-
13
votes3
answers5277
viewsA: What does "Dim" mean in Basic?
Briefly, it is a term that was originally created to declare the dimension of arrays and over time was used for other objects. The oldest reference I know comes from BASIC where DIM means…
-
3
votes1
answer591
viewsA: PHP says file doesn’t exist even if it exists
Quick Fix! It’s copy and paste that funnel! In this passage: include (dirname(__FILE__) . '/dao/usuario_dao.php'); Trade for this: include (__DIR__.'/../dao/usuario_dao.php'); Detailed solution.…
phpanswered Daniel Omine 19,666 -
4
votes1
answer166
viewsA: How to escape a key/braces on Blade?
Add a @ to write keys (Curly Brackets) literally @{{ $var }} will display literally @{{ $var }} If I’m not mistaken, in Laravel smaller than 5.1, I didn’t have this feature so we did it with…
-
1
votes2
answers55
viewsA: How to adapt this function to work without needing the element ID?
Without id, one option is to search for the class property. document.getElementsByClassName("nome_da_class");. Note that this returns an array, independent of finding a single element. Example var e…
-
1
votes1
answer296
viewsA: Is comparing similarity of values of two arrays possible?
The question lacks more details. Regardless of that I made a simple repetition loop where it checks if the value of one array exists in the other: $arr_prim = array('1','2','3'); $arr_sec =…
phpanswered Daniel Omine 19,666 -
3
votes2
answers578
viewsA: Magento: what’s the best version?
Avoid starting a new business under an old version of a platform as they are usually outdated, without warranties and support. You will also have a relatively high cost of time and money with…
-
0
votes1
answer96
viewsA: CURL returns code 303
To send by GET method: curl_setopt($ch, CURLOPT_POST, 0); Alternatively you can use CURLOPT_CUSTOMREQUEST curl_setopt($curl_handle, CURLOPT_CUSTOMREQUEST, 'GET'); I remember having answered…
-
4
votes7
answers68940
viewsA: How to make SELECT with ORDER BY and different criteria?
Add a new column in the table called "position". Anyway, the name can be any other you want. For ID 100, save the "position" column as 1, the others leave as 0 or null. Then at the time of…
mysqlanswered Daniel Omine 19,666 -
1
votes1
answer93
viewsA: MYSQL primary key is it possible to create an AUTO_INCREMENT fill mask?
Apply the mask when displaying. $db = [conexao e leitura do banco]; foreach ($db as $v) { //iterando os dados extraídos do banco echo 'aaa-'.str_pad($v['id'], 4, '0', STR_PAD_LEFT).PHP_EOL; } (the…
mysqlanswered Daniel Omine 19,666 -
1
votes1
answer46
viewsA: How do I pick a line from a field that has no bounds and break into an array?
In the string you entered there is a delimiter, the space. Just "blow up" the spaces. $arr = explode(' ', $string);
-
2
votes2
answers177
viewsA: Detect if URL is a URL shortener
A suggestion is to request the URL. If it detects redirect, it may be a "shortener", but it may also not be and would then be preventing legitimate Urls. From this point, compare with the number of…
-
16
votes3
answers2808
viewsA: How to block Adblock?
There is no 100% technique, but there are some recommended: Checking the size of an element function detectAddNotLoaded() { if ($('.foo_dd').height() == 0) { // Aqui vc toma a decisão. Mostrar um…
-
3
votes1
answer1342
viewsA: How do I pass parameters through Curl?
Step 1 In this passage $campos = array("login"=>$jmUsuario->email,"classroom_id"=>$jmUsuario->email,"sign"=>$sign); $parametros = json_encode($campos); Remove that line $parametros =…
phpanswered Daniel Omine 19,666 -
1
votes4
answers16229
viewsA: How to add entries to a dictionary?
The most practical way to attach a new index with a defined value dicionario['abcde'] = 1 But I don’t understand what’s stopping him from using. You commented: I say this because as entries will be…
-
-1
votes3
answers1218
viewsA: How does Laravel "guard" the routes?
Laravel uses autoloader to identify routes. You can also opt for predefined routes. For cases where there are no pre-defined routes and Laravel automatically identifies them, it is most likely…
-
2
votes2
answers464
viewsA: How to replace a specific query string value of a url through PHP using an array?
Specific option function transforma_query_string($str, $parameters) { // considerando que a url será sempre size=500 e que outros parâmetros nunca terão o valor 500: return str_replace('500',…
phpanswered Daniel Omine 19,666 -
0
votes1
answer28
viewsA: Old directory still remains
In the settings, app/config/app.default.php You’ll have something like 'App' => [ 'namespace' => 'App', 'encoding' => env('APP_ENCODING', 'UTF-8'), 'defaultLocale' =>…
-
1
votes3
answers1589
viewsA: Insert data into a multidimensional array
The question is very similar to that: Pre-program parameters to be removed from an object The difference is that in the other question the problem is to get access and the most complicated is that…
-
0
votes1
answer54
viewsA: PHP - website e-commerce, generate UUID for each shopping cart
Something simple and functional is to use timestamp information $token = microtime(); Something like this will come back 0.13287600 1460718460 If you do not want the space character you can generate…
-
2
votes3
answers2160
viewsA: What is the logic of a shopping cart?
In a virtual store, for example, the focus is to sell. A user places things in the cart and for some reason closed the browser. When it return on this site will have to redo the entire purchase,…
-
1
votes1
answer65
viewsA: Communication/Authentication . net for PHP
In the . Net application, create a button, for example, where the user will click to access the PHP application on the other server. By clicking this button, a token is generated (unique encrypted…
-
0
votes2
answers1208
viewsA: Foreach in Post PHP return
/* O id_usuario é uma string. Pegue-o dessa forma direta: */ if (isset($_POST['id_usuario'])) { $data['usuario']['id'] = $_POST['id_usuario']; /* Presupõe-se que o array depende da existência do id…
phpanswered Daniel Omine 19,666 -
1
votes1
answer1280
viewsA: How to Post a method by clicking a button type=button
The problem is that you are trying to call an ASP function in the event OnClick() Javascript. One does not see the other because ASP runs on the server and Javascript runs on the user’s browser.…
-
2
votes2
answers2958
viewsA: How to find the origin of the request in PHP?
The trickiest part is getting the right IP address. I suggest you check the following parameters to get the IP: $_SERVER['REMOTE_ADDR'] $_SERVER['REMOTE_PROXY'] $_SERVER['HTTP_CF_CONNECTING_IP']…
-
3
votes1
answer598
viewsA: Increase image size
The code presented does not validate the dimensions (width, height). Probably the problem may be in weight validation or to mime type. Upload weight limit in PHP In PHP settings, set the value in…
phpanswered Daniel Omine 19,666 -
0
votes3
answers993
viewsA: Error using $_SESSION[] with unserialize: "expects Parameter 1 to be string"
I assume that to solve it would be enough to remove the function unserialize(): $adminLogado = $_SESSION["admin"]; But anyway, I don’t know what’s inside $_SESSION["admin"]. It is therefore…
-
1
votes2
answers692
viewsA: Because "PHP and MYSQL"
First, PHP is a programming language and Mysql is a SGDB (database). Both are distinct and independent from each other. The fact that you find many materials addressing both of them is because they…
phpanswered Daniel Omine 19,666 -
2
votes2
answers56
viewsA: Help with $this and self in php
You can solve this by simply keeping it the way you’re already doing $u = new User(); $u->find([]); The $this cannot be statically accessed. So it will not work to do User::find([]); It is…
-
1
votes1
answer39
viewsA: Pre-program parameters to be removed from an object
The way you’re doing it doesn’t look good. Always think that when you fall into complicated situations where you’re going to have to solve with coarse whims, it’s because there’s something wrong…
phpanswered Daniel Omine 19,666 -
1
votes3
answers1905
viewsA: What are the layers of a web application?
It’s basically the same. What you described above is MVC. Model Control View. The presentation layer would be the View. The business rule is MOdel (Business Model, Business Logic). The data access…
-
2
votes1
answer583
viewsA: How to run a php socket
CLI stands for Command Line Interface. To run a PHP script written for CLI, simply access the terminal (console, ssh, cmd, shell console, etc). By the Linux shell, run the command: >/usr/bin/php…
-
0
votes3
answers5600
viewsA: Remove input letters using Javascript and regular expression
/* Converte caracteres full width (zenkaku) para o half width (hankaku) O zenkaku são caracteres disponíveis nos conjuntos de caracteres japoneses. Exemplo, 1234567890 são números, porém, a…
-
3
votes3
answers14735
viewsA: How to break a line of a Mysql field into an HTML page
It is impossible to say what the appropriate solution is for the specific case of the questioner, but the original data are usually kept in the database as presented in the question. In the database…
-
0
votes2
answers1318
viewsA: Parameters in form action are not sent by GET method
Two simple examples to solve: Button with onclick event Can resolve simply with an event button "onclick" <input type="button" onclick="location.href='pagina.php?foo=1&bar=ok';"…
-
2
votes2
answers1072
viewsA: Fatal error: Call to Undefined Function http_response_code() php 5.2
Change the use of the function http_response_code() by function header(), by typing the headers directly: if ($_FILES["arquivo"]["error"] > 0) { // Bad Request //http_response_code(400);…