Posts by Inkeliz • 20,671 points
671 posts
-
0
votes1
answer77
viewsA: How to send parameter in array using Curl in php
According to the documentation, is a "QUERY PARAMETERS". I believe this referred to query strings that are part of the URL. Then just do: $query_param = "dimensions=200x140,1024x1024" $curl =…
-
1
votes1
answer77
viewsA: How to compare numbers using PHP?
If you have $valores = [0,1,3,4,5,30], you have an array, you can use the in_array: $valores = [0,1,3,4,5,30]; $temTrinta = in_array(30, $valores, true); if ($temTrinta) { echo "Tem o valor 30 no…
-
1
votes1
answer128
viewsA: how to do Curl -X POST -d in PHP
The data is in x-www-form-urlencoded, and not in JSON. -d "client_id=1234&client_secret=abcd&grant_type=client_credentials" This is a urlencoded, and not a JSON. To have exactly the same…
-
1
votes1
answer57
viewsA: Problems with displaying data from an array
The mysqli_fetch_assoc creates an array where the key is the column name. Your queries are different, at first use as 'valorTotal', no longer in PHP. Assuming you use the as 'valorTotal': $sql =…
-
3
votes2
answers40
viewsA: How to use "for" to work with data in an array whose amount of varied data is unknown?
You can always use the count() to get the array size. So if you’re using $value->products[($row)], can use the count($value->products) to get how many there are. for ($row = 0; $row <…
-
0
votes1
answer188
viewsA: How to change media-query using JS?
I found a solution, that would be using cssRules, that the @Augusto Vasques mentioned in a comment. This isn’t exactly how I wanted it, it won’t work with more complex media queries (example:…
-
1
votes1
answer188
viewsQ: How to change media-query using JS?
I’m using CSS with media queries, for example: html { --color: #OOOOOO; } @media (prefers-color-scheme: dark) { html { --color: #FFFFFF; } } Considering the code above, who has the…
-
0
votes1
answer132
viewsA: Remote image received by CURL and reduced in PHP
I believe this is because you are saving JPEG and not PNG. In theory JPEG does not support transparency, I say "in thesis" because it seems to support, but it is not so common to use such a…
-
0
votes2
answers28
viewsA: Play an audio starting in 10 seconds
In the documentation of <audio> (Htmlmediaelement) exists the currentTime,: audio.currentTime = 10 For example: audio = window.document.querySelector("audio"); if (!(audio instanceof…
-
0
votes1
answer40
viewsA: String to time conversion. Time
There is the function Parse for this purpose (convert a human date value to the team. Time). It is important that you are familiar with the format used, this can be visualized here. The format of…
-
1
votes1
answer21
viewsA: Find the next key of an array
The list will always be sorted, if you have: $Lista = ['a','b','c','d']; IS exactly same as having: $Lista = [0 => 'a', 1 => 'b', 2 => 'c', 3 =>'d']; That is, even if removing the c, the…
-
1
votes1
answer29
viewsA: Mount screen with array data
If JSON is already decoded there is no reason to decode it again. Just use $ckl['children'][{index}]['tipo']. For example, if you want to always take the first tipo of each one it would be enough to…
-
2
votes3
answers177
viewsA: How to initialize a constant with the value of time. Now() in Golang?
To have the same behavior you should use var and not const: package app import "time" var startedAt = time.Now() When the variable is inside a function it is also possible to use the := to create…
-
1
votes2
answers423
viewsA: Take an input value by name
I think the ideal is to use your own Xpath, native to PHP. In this case it uses the //input[@name="texto"] that to get the input which contains the attribute of name of texto. That way I’d be like:…
-
1
votes2
answers215
viewsA: What are the alternatives for mcrypt_* functions?
First there are some problems in the original code, such as the use of ECB mode. Second, it depends on the version you are using, I am considering that you are using PHP 7.2. Unfortunately, there is…
-
0
votes1
answer160
viewsA: Compare duplicate records in the database with PHP and Mysql
I am trying to make a condition that prevents you from saving the same login name of another already registered user. Your question has no relation to the problem itself, because its solution is…
-
2
votes1
answer56
viewsA: How to identify the customer by the public key of a certificate
Only with the public key is this impossible. In fact it is possible, but anyone can claim to be "Customer Y", even if it is not. Such a customer sends me the key uy2395734asdfas, how do I know that…
-
0
votes2
answers63
viewsA: Allow only typing 123456 jquery
This can be achieved basically without the need for JS, you can use the attribute pattern: <form action="#"> <input pattern="[1-6]+" type="text" required> <input type="submit">…
-
0
votes1
answer329
viewsA: How to select and validate encrypted password in PHP
The salt should be unique for each password, do $salt = 'Cf1f11ePArKlBJomM0F6aJ'; is somewhat useless, this would no longer be a salt and would become a pepper. So, to answer the first question: It…
-
0
votes2
answers476
viewsA: Download API request file into server folder (localhost) with PHP
Your question is a little confused, there are two interpretations: If you want the client (who accesses the page) to download the content. If this is the case, the @Leonardo Ferreira reply is…
-
4
votes1
answer85
viewsA: Difference in true and false in header('Location: ') function in PHP
The true and false, that is changing, is the Replace, according to the documentation: header ( string $header [, bool $replace = TRUE [, int $http_response_code ]] ) : void What matters to us is the…
-
0
votes1
answer62
viewsA: What can make the texture disappear in Opengl?
I don’t know if this should be an answer, or an issue to the question. Among several attempts to solve the problem, the problem was actually mitigated using "power of 2", if that makes any sense to…
-
2
votes1
answer510
viewsA: Login with digital certificate with PHP
WARNING: I don’t have a Certisign record, I’ve never been a client of theirs and I don’t have any ties. In addition, this reply is only intended to be "compatible", using native PHP features, with…
-
0
votes1
answer62
viewsQ: What can make the texture disappear in Opengl?
I’m using a flame engine Engo, and made a Fork and I’m adding some things and at the same time trying to learn more about Opengl. As it is a graphic question there is how to put an image of what is…
-
1
votes3
answers588
viewsA: Recover $_SESSION with Ajax
On the session, there is no security problem per se, only the problems inherent in the system itself SESSION (as Man-in-the-Middle, Session Prediction, Session Fixation and problems related to…
-
3
votes0
answers111
viewsQ: What does "out" do in C# and what is the difference of the pointer?
I was playing Space Engineers and it is possible to add custom codes, called in-game script, in C#. Finally, I came across the need to use such a out, but I didn’t understand what he does and why he…
-
1
votes1
answer43
viewsA: How not to allow recording if dynamically created radios are not marked
The problem is the getElementsByName("Status[]") since none of the inputs will have the name Status[], assuming that the <?php echo $IdItemCheckList; ?> does not return empty. Simply create a…
-
1
votes1
answer206
viewsA: Connection refused when I do Curl to a service
This can probably be a firewall lock, preventing you to use the port 1500. The Cpanel comes with a lot of features, one of them is the firewall, you can see how to open the doors in the…
-
0
votes1
answer820
viewsA: I am unable to send a parameter to a GET method of an API using the PHP Curl
The problem is that your request is not a valid JSON. You are trying to use JSON, as set in: curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json')); Then you should use the…
-
0
votes1
answer42
viewsA: Login: Mysql search returns only one object
The explanation is in the break;, reducing your code we have: $Conn = new mysqli("localhost", "root", "", "prism"); $result = $conn->query("SELECT * FROM tb_users ORDER BY iduser"); $data =…
-
1
votes2
answers185
viewsA: How to take data from an array and distribute within a method?
Ignoring security issues, you could use the implode normally. $tabela = 'produtos'; $camposTB = ['Nome','Descricao','Valor','ValorDesconto']; // Cada coluna é um item $valores =…
-
1
votes1
answer357
viewsA: How to receive headers from Curl?
To submit a request to Curl using headers you need to use: curl_setopt($ch, CURLOPT_HTTPHEADER, [ 'Terceiro: 42', 'Quarto: 404' ]); Meanwhile, the $headers must follow a pattern of: Nome: Valor. At…
-
1
votes1
answer60
viewsA: Take data from two tables at the same time, just when you log in
Ignoring other possible problems. What you probably want to do is LEFT JOIN and not a INNER JOIN. Try using the LEFT JOIN, instead of INNER JOIN: SELECT * FROM usuarios LEFT JOIN orders ON…
-
1
votes1
answer64
viewsA: Add data in Session array
If that’s what I understand, I’d just use the array_merge, something like: public static function setData($type, $data){ r = array($type=>$data); if (!empty($_SESSION[Data::DATA])) { r =…
-
1
votes2
answers81
viewsA: What is it, Farmhash?
It behaves in the same way as the most common hashes, such as md5 or sha? No, the answer is in the link itself as "The functions mix the input bits thoroughly but are not suitable for…
-
1
votes0
answers22
viewsQ: How to identify queries that do not use Dexes?
After a long time I decided to check the state of the database, even with everything working normal. I used the mysqltuner.pl to verify. At one point there is the following information: [!!] Joins…
-
0
votes3
answers81
viewsA: How to remove the login button after starting Session in php Pdo?
According to your own code: //guardar alguns dados na sessao $_SESSION["tcc"] = array( "id"=>$dados->id, "email"=>$dados->email ); This implicitly indicates that this session will only…
-
0
votes2
answers35
viewsA: Problem with array_merge and WHILE - PHP Codeigniter
I think the problem is that you’re merging $arrayRetorno and $teste, but the result is being in $arrayFinal, thus the $arrayFinal will just be the $teste. I think that would solve the problem:…
-
4
votes2
answers234
viewsA: Is it possible for a domain to block a query via Curl?
Hardly a service will block only the cURL, this will probably occur if you are using incorrect header/body, so the receiver can distinguish between your requests via Curl and via non-Curl. Most…
-
0
votes1
answer27
viewsA: Selective return of an array in php with Curl
The codigo is inside estoque that is inside the array that is inside the cadastroUnico. You need to go "accessing" each array. foreach($retorno['cadastroUnico'] as $k => $v) { print_r ('Código: '…
-
0
votes1
answer824
viewsA: Curl Error #:SSL Certificate problem: Unable to get local Issuer Certificate
The curl.cainfo "/etc/pki/tls/ssl/cacert.pem" must contain a =: curl.cainfo="/etc/pki/tls/ssl/cacert.pem" Another solution is using the CA_INFO: curl_setopt($ch, CURLOPT_CAINFO,…
-
0
votes1
answer53
viewsA: Problem feeding database via php form
Your table seems to have four columns, not only three (there is the id, which is not filled by you). So it seems to me that you have to specify which of them you want to fill in. $empresa =…
-
0
votes1
answer55
viewsA: How can I check if the image already exists in the mysql database and directory?
Instead of a "random name" (your code does not achieve this goal either!) you could use a "deterministic and unique name" for each file. For such cases there are hashing algorithms. I could use the…
-
3
votes1
answer198
viewsA: Displaying date a cookie expires in php
There is no way to get this information because it is not sent to the server. When the server sends a cookie to the user (SERVER -> CLIENT) the header of Set-Cookie, it has some parameters like…
-
11
votes1
answer153
viewsA: Will HTTP/2 still need a security certificate or is it already encrypted by default?
The fact that it is "encrypted by default" would not remove the need for certificates. The encritation and the certificate play a completely different role. What’s more, HTTP/2 has H2C (http2…
-
3
votes1
answer2470
viewsQ: What is the difference between PWA and TWA (Trusted Web Activities)?
I happened to be watching the Chrome novelty, and I saw a post Using Trusted Web Activities, it says: Trusted Web Activities are a new way to Integrate your web-app content such as your PWA with…
-
1
votes1
answer45
viewsA: How can I compare a password of my DB with that of php
I would never recommend using the PASSWORD, just as I don’t recommend using any cryptographic Mysql function, almost all of them are extremely problematic (such as AES_ENCRYPT, DES_ENCRYPT,…
-
4
votes1
answer577
viewsA: How to implement Feature Policy Header by htaccess?
Feature-Policy (not to be confused with Referrer-Policy or Content-Security-Policy) is intended to turn off browser features, which are typically enabled by default. It works like: Feature-Policy:…
-
0
votes2
answers109
viewsA: How to hide short words with PHP
Once it says as "of", "with", etc Apparently you want to remove prepositions, not just "short words", so you could create an array with the most common prepositions (...): $lista = ["a", "o", "as",…
-
0
votes1
answer294
viewsA: Date +1 Month increment (considering days, month and year)
This occurs at every turn of the year, the reason is its comparison: if($mesAtual == $mesProximo-1){ The $mesAtual will be 11 and the next month would be 0. A correction would be to compare the…