Posts by Inkeliz • 20,671 points
671 posts
-
2
votes2
answers196
viewsA: Field 'Hash' doesn’t have a default value
You need to set a default value for the Hash, for example: ALTER TABLE Tabela MODIFY COLUMN Hash VARCHAR(255) DEFAULT NULL; If you use NOT NULL use '' instead of NULL: ALTER TABLE Tabela MODIFY…
-
3
votes1
answer2187
viewsA: consultation of mobile operators
The site in question (consultanumero.info/consulta) implemented a Recaptcha, which makes the code below not currently working. You can just make one foreach of the kind` $numeros = [ '11999999999',…
-
19
votes1
answer13920
viewsA: How does the "Referrer Policy" header work?
You can easily know that 100 people from Twitter have accessed your website, simply by seeing the Referer sent by the customer, note that Twitter does not use Referrer-Policy nor the…
-
4
votes3
answers155
viewsA: How can I stop systems from incorporating my website?
"I also found that the tool prevents Javascrips from running together with the page and simulate version of Internet Explorer 6." There is even software that is not browsers that send/receive data…
-
1
votes3
answers327
viewsA: Query to get 1024 sum in maximum 3 transactions
As said by @Motta, use the HAVING COUNT(recipient) <= 3 AND SUM(amount) >= 1024, this will make it mandatory to have less than four transactions/lines and that the sum of all amount is greater…
-
8
votes1
answer202
viewsA: Problem Doing JSON to a Site
You must use the index of AWP | Dragon Lore (Field-Tested), containing a -, if you use (space) will not find, basically will have to do: $json['AWP | Dragon Lore…
-
21
votes3
answers14534
viewsA: What is the INDEX index in Mysql for?
An easy way to think about right is to think of a book summary, it exists to facilitate the localization of book contents, so you find content easier than searching page by page, for this depends on…
-
1
votes3
answers115
viewsA: Checkbox with PHP
I will demonstrate two ways to improve this, one easier to understand (using explicit loops) and another using array manipulation functions, in the end both achieve the same goal. Both allow you to…
-
3
votes1
answer193
viewsA: JSON in PHP with existing fields printing as Null, how to resolve?
You need to be using the same format, UTF-8 in the database and logically do the UPDATE/INSERT using the same formatting. For this first use, for example, back up first: ALTER TABLE `tabela`…
-
4
votes1
answer41
viewsA: Problems in implode when bringing database results
You need reset to array $visualiza each while to achieve this objective. Create a $visualiza = array() within the while, so each time will go reset the values previously obtained.…
-
1
votes1
answer260
viewsA: Problem with php url
You are using simple quotes in the wrong place, see information here, right here: header("Location: projeto-detalhado.php?id='$projeto->getId()'"); Is inserting two ' link, it has the code %27,…
-
8
votes1
answer1448
viewsA: How to enable Flash Player in Javascript browser?
There is no official way to enable Flash using Javascript only, if you figure out how to do this will possibly be treated as a security issue. About the play.spotify.com/browse, it clearly asks the…
-
0
votes3
answers1436
viewsA: Mysql - merge results from multiple columns
Only using Mysql! You can use the CONCAT_WS to pick up all columns separated by comma and shape will result in: Joaquim, Sérgio, Ricardo Ricardo, Maria, César Rafael, Solange, Joaquim Then use the…
-
0
votes2
answers49
viewsA: Data not saved in php database
There is a syntax problem in: (`nome` , `cidade` , `estado` , `email` , `assunto` , `mensagem`,'' ) ^^^^ The '' at the end of both, it makes no sense and probably in the first will give syntax…
-
2
votes1
answer164
viewsA: problem with integration with affinityassistencia (Curl + php + xml)
There are several errors in the code, but I believe it must have been his attempts to find a correction. Your question is very vague, no exact documentation, but let’s go in pieces, as Jack used to…
-
1
votes1
answer707
viewsA: if () syntax in a Trigger
There is an error in this which is exactly in END. The END is to close the BEGIN, if you want to close the IF use the END IF in his stead. In a final way it would look like this: CREATE TRIGGER…
-
1
votes1
answer66
viewsA: IF Mariadb phpmyadmin
I believe that the correct one, keeping this logic, would be: BEGIN DECLARE total BIGINT; SELECT COUNT(*) INTO @total FROM cliente C WHERE C.NR_CPF = NEW.NR_CPF; IF @total > 0 THEN SIGNAL…
-
24
votes1
answer298
viewsQ: How do distributed applications (bitcoin, torrents...) find each other?
How distributed/decentralized software is able to establish connection and find other machines running the same software? In Bitcoin, for example, how do the "Full Nodes" meet each other? How does…
software-architectureasked Inkeliz 20,671 -
3
votes1
answer1385
viewsA: Authenticate a Json API with PHP
If you only need these two headings use the -H of Curl. ;) That way it would be: curl -H "Authorization: {String}" -H "Content-Type: application/json;charset=UTF-8" https://site-alvo.com In PHP,…
-
5
votes2
answers579
viewsA: Reliability and Security of Sessions
To session (PHP standard) is based on the following way: The client has an identifier based on cookies (or URL parameter). The server has a file in the temporary folder, this file has "the contents"…
-
3
votes1
answer24
viewsA: Trasnformar array in Divs?
Just make a foreach and then add the tr: foreach($column as $value){ echo '<tr>' . $value . '</tr>'; } Test it out here This will display the value between tr. However if you want an…
-
-1
votes4
answers196
viewsA: Get the id of where max(value) was found
You can use a subquery or use an INNER JOIN. One option is to use INNER JOIN: SELECT id, data, valor FROM teste INNER JOIN (SELECT MAX(valor) AS valor FROM teste WHERE data BETWEEN '2017-03-01…
-
7
votes2
answers9138
viewsA: How to make a request with Curl
curl -X GET https://jsonodds.com/api/odds/nfl -H "JsonOdds-API-Key: yourapikey" Translation: The -X (uppercase) indicates a custom request, in this case GET, there was no reason for this. Out of…
-
1
votes1
answer242
views -
1
votes1
answer279
viewsA: Break php text limit
The problem is in: $limita_str = substr($str, 0, $limita); $ultimo = strrpos($limita_str, ' '); return substr($str, $ultimo).'...'; Let’s translate what you’re doing: The $limita_str is limiting the…
-
5
votes2
answers1809
viewsA: How to reset all data from a form if the user goes back to page?
Another option is to use autocomplete for off, for example: <input type="text" autocomplete="off" value="" name="nome_do_input"> Using autocomplete="on", pattern: Using autocomplete="off":…
-
1
votes2
answers1134
viewsA: Hide Link for download
One of the facial forms would be using HMAC, it has the purpose of verify the integrity of the information, thus preventing it from being changed, as you say in " it may by changing the name of the…
-
1
votes3
answers3702
viewsA: Notice : Array to String Conversion in
The reason for the mistake is because $tipoSemEspaco is a new array, which is independent of the $tipos. An easy fix: Add the index in the foreach: foreach($tipos as $index => $tipo){ /... } Then…
-
2
votes1
answer44
viewsA: Error in Where with variable
This can be done without the need for PHP, if you are Mysql you can simply use: SELECT * FROM noticias WHERE status='ativo' AND cat_id='Notícias' AND fixo != 's' AND comentarios != 's' AND id NOT IN…
-
2
votes3
answers1764
viewsA: PHP + Mysql - Quote syntax error in String
The mysqli has a resource that is precisely for this purpose, the mysqli_real_escape_string. $name = mysqli_real_escape_string($conexao, "Michael"); $store = mysqli_real_escape_string($conexao,…
-
2
votes2
answers1008
viewsA: How to transform this text into an array with name and description?
You can use the file(): $arquivo = file('arquivo.txt'); foreach($arquivo as $index => $linha){ list($info[$index]['imagem'], $info[$index]['descricao']) = explode(':', trim($linha)); } That way…
-
0
votes1
answer40
viewsA: how to open only one field
You must use the this, will not apply for all resposta, the same way you were able to do in the variables. $(document).ready(function(){ $('.resposta').on('click', function(){ var id =…
-
1
votes1
answer180
viewsA: I’m using Captcha but there are still robot attacks
I don’t know what class you’re using for this, so I’m going to recreate this using the CURL, although there are other ways to do this. I created a very simple function to do the service, without…
-
1
votes1
answer266
viewsA: how to perform a SELECT COUNT faster!
There’s not much you can do, but you can try to find out what the problem is, with the EXPLAIN. First, Mysql always uses right, your table has no indexing of this column because it does not create?…
-
3
votes2
answers578
viewsA: Function to create hash in SRI pattern
You have the hash_file() in PHP, that the variation of hash() for archives, which is similar to dead md5_file(). $algoritmo = 'SHA512'; $arquivo = 'arquivo.js'; $hash = hash_file($algoritmo,…
-
3
votes3
answers715
viewsA: Calculation of incorrect multiplication
One of the easy ways to get around this is to use the BC Math. Thus the ((33 * 0.8) - 26.4) would be: bcscale(2); echo bcsub(bcmul('33', '0.8'), '26.4'); // O resultado será de `0.00`. Test this.…
-
2
votes2
answers666
viewsA: Problems with Bcrypt password
In recent versions of PHP there is a password_hash and the password_verify which is safer than this class and both use Bcrypt. To use the password_hash just do this: $email = '[email protected]';…
-
5
votes5
answers7965
viewsA: Some way to get the price of the dollar
You can use the Yahoo YQL, through the Query: select Rate from yahoo.finance.xchange where pair in ("USDBRL"), for example, the USDBRL must be set by what you want, this case will be returned…
-
3
votes3
answers391
viewsA: php doubts how to generate ten random password
If you really care "exaggeratedly" safely use the Libsodium, it possesses both resources, to generate and to convert to hexadecimal, I am responding this based on what I answered here. for($gerar =…
-
2
votes4
answers4937
viewsA: Generate string securely random in PHP
PHP 7 or higher. You can use the random_bytes(), it is cryptographically secure and uses the /dev/urandom: $numero_de_bytes = 12; $random = random_bytes($numero_de_bytes); To have a given in…
-
1
votes4
answers135
viewsA: Remove items an array containing only 1 character
If you’re worried about performance ("I’m looking for something also in performance.") should not use the strlen(), use the empty() or isset(), in its place, the difference is minute, but there is.…
-
6
votes3
answers292
viewsA: Remove only numeric elements from an array
You can use the array_filter(), for example: $arr = array('prolongar-se', 'durante', 4, 'a', 7, 'dias', 'dependendo', 'da', 'dose', 'administrada', 'e', 'do', 'pH', 'da', 'água', 'sendo', 7.5, 'ml',…
-
0
votes2
answers441
viewsA: Use the result of an array as value of an Insert - PHP
/!\ This publication TAKES NO ACCOUNT OF ANY SECURITY ASPECT! That VALUES ( '".$array[$i]."' ") does not exist, at least not in this context, beyond the error that exists in its query who doesn’t…
-
0
votes1
answer52
viewsA: How to change the class of one element by clicking on another using Jquery
You can use the closest, siblings, parent (what determines their use is the hierarchy of the elements, that is how the HTML is, what is not in your question), for example:…
-
0
votes2
answers3555
viewsA: Delete record by ID in PHP
The $id = $linha["id_game"]; is based on the current line, which comes from the select * from tblgames, selects all columns of all rows of table tblgames. So when there is the $_POST['excluir'] it…
-
1
votes1
answer1082
viewsA: Select the previous 3 months
You can use the GROUP BY to group by MONTH() and YEAR() and also use the WHERE to only get what’s bigger than the last three months. SELECT downloads, data, SUM(downloads) AS soma FROM tabela GROUP…
-
0
votes2
answers1310
viewsA: how to check the time of a select in mysql with php
You can use the max_statement_time to prevent the query from taking longer than 3 seconds to run, for example: Mariadb 10.1: SET STATEMENT MAX_STATEMENT_TIME = 3000 FOR SELECT * FROM tabela WHERE…
-
2
votes2
answers1196
viewsA: Curl, SSL and Security
Assuming you are connecting with an HTTPS server and define the CURLOPT_SSL_VERIFYPEER for false you become vulnerable to attacks from MITM, even some libraries have had problems with this in the…
-
1
votes1
answer2051
viewsA: How to use ssl with php?
In Apache, just add (create a new VirtualHost): SSLEngine on SSLCertificateFile /caminho/para/seu_site_certificado.crt SSLCertificateKeyFile /caminho/para/sua_chave_privada.key…
-
4
votes2
answers2142
viewsA: Difference between /dev/urandom and /dev/Random
Source Both the /dev/urandom as to the /dev/random are able to generate pseudo-random bits with the difference that one is always available and the other is not. If the entropy level (from the…