Posts by Inkeliz • 20,671 points
671 posts
-
0
votes2
answers597
viewsA: Curl is not working on my localhost
The [http_code] => 0 indicates that it is an internal Curl error, it is probably related: Problem with TLS/SSL: No Openssl installed (or outdated); Did not define the Certificate Authorities…
-
1
votes1
answer118
viewsA: Return of JSON column from the bank in Golang
This looks like a []byte, not "several numbers any". It is shown as "several numbers" because the []byte is a []uint8. A []byte can use directly on json.Unmarshal. Maybe, if you specify the type…
-
0
votes1
answer42
viewsA: How to convert two separate field values of a JSON into a Go map?
Simply decode and iterate to create the map. func newEstadosMap() (estados map[string]string) { raw := []byte(`{"estados":[{"sigla":"SP","nome":"São Paulo"},{"sigla":"RJ","nome":"Rio de…
-
1
votes2
answers61
viewsA: How to cut a PHP string in <H2> tags
I believe you can use Xpath, something like: // Inicia o DOMDocument $html = new DOMDocument(); // Importa o HTML (do $ingrediente) $html->loadHTML($ingredientes); // Inicia o XPath e busca por…
-
0
votes4
answers239
viewsA: Problems with paging on the search page
I don’t know if I understood it correctly, but trying to understand, I noticed this: <a href="./busca?pagina=<?php echo $i; ?>"> This is your pagination, simply ?pagina={n}, but does not…
-
7
votes2
answers1074
viewsA: Generate random time within a range
No, I couldn’t use it right +12 hours? $dataGerada = date('d/m/Y H:i:s', strtotime('+' . random_int(720, 1440) . ' minutes', time())); If you only want an hour, without changing the minutes (keeping…
-
0
votes1
answer317
viewsA: How to find the largest and smallest element of an Array/Slice in Go?
If you want to get the biggest and smallest element, not its value, you could just do the for. func MinMax(v []int) (posMin int, posMax int) { max, min := 0, int((^uint(0)) >> 1) for i, e :=…
-
5
votes1
answer301
viewsA: Why is the id ambiguous even creating an alias?
The error already tells the origin, which is em 'where clause'. The alias, does not change anything in this case, since the WHERE remains as id = 3. You did right in the select and wrong in the…
-
3
votes4
answers84
viewsA: Show the output of a custom vector
I believe I could simply do an array with the numbers (range) and divide it (array_chunk): <?php $divisor = 4; $maximo = 16; foreach(array_chunk(range(1, $maximo), $divisor) as $k) { echo "A" .…
-
1
votes2
answers84
viewsA: How to get the name of a variable as a string in Go?
No way to get variable name (maybe with unsafe? but I don’t think so). However, it is possible to get the name of an element of a struct. Whereas: type MeuStruct struct { progzila int } Could use…
-
0
votes2
answers48
viewsA: Movable Href in Navbar (PHP)
Apparently it’s enough to use the /, so it will start from the source and not from the current directory. That is, change this: <li><a href="CatalogoSis.php">Catálogo…
-
3
votes4
answers109
viewsA: Using the existing key_exists array
This is the expected behavior, there is no "Volvo" key in the initial array. If you have one array within the other (multidimensional array) you should check each array, just make a loop. When you…
-
7
votes1
answer211
viewsA: use user ip as proxy to request
That’s not possible for an obvious reason. If this were possible the practice of IP-Spoofing would be extremely easy, after all you could pass by any IP (and still get the answer on behalf of that…
-
1
votes1
answer672
viewsA: Print JSON formatted using PHP
You can use the JSON_PRETTY_PRINT from PHP to this or send a suitable Content-Type, so that in the browser it interprets JSON and can "format" it. But remember that both Jsons (with or without "line…
-
0
votes2
answers465
viewsA: Which method to use to log a user (JWT cookie vs SESSION)
There are several problems with JOSE (JWT, JWS, JWE...), but I will mention external topics (like this article and this other) since this was not the initial question. I will focus only on your…
-
0
votes1
answer34
viewsA: Adjust div to display the center of the image on smaller screens without changing the image size
Apparently what you want is for the height to be constant, while the width does not. I think this can be solved with: background: url(...); background-repeat: no-repeat; background-position: center;…
-
4
votes2
answers172
viewsA: Is it worth 'shuffle' ID that will be passed via URL?
I think you have to define what your concerns are, so you know whether it’s worth it or not. There are use cases and cases. Youtube is an example, it does not use sequential identifiers. That is: a…
-
3
votes1
answer126
viewsA: Doubt about openssl_encrypt security
In short I will list the "problems" you have in your code: Its maximum entropy decreased from 128 to 96 because of the base64, without any advantage. Your chosen cipher (AES-CBC) does not protect…
-
0
votes1
answer40
viewsA: How to modify this programming to accept letters and numbers?
The KeyAscii is decimal representation of ASCII. You can consult an ASCII table and make the necessary changes. I believe this would suffice, in theory, I don’t even know what language that is, so…
-
5
votes1
answer247
viewsQ: Display "emoji keyboard" using Javascript, is it possible?
In the latest versions of Google Chrome/Opera has a feature to select emoji, native browser. This can be done by the user right-clicking and clicking on "Emoji" in some typing field…
javascriptasked Inkeliz 20,671 -
1
votes1
answer61
viewsA: How to read the html of a page that only loads when opening in GOLANG browser
You already answer your question yourself. You say "by entering it and pressing Ctrl+U you will notice that there is only javascript that loads the products". Golang by default has no Javascript…
-
5
votes1
answer123
viewsA: Calculate value (R$) based on PHP time
I believe this is purely mathematical, merely: Hora ----- Valor 1 ----- 100 X ----- 550 If the 1 hour costs 100, then it will simply make 550/100, which will result in 5.5 hours, if you want to…
-
0
votes2
answers129
viewsA: How to delete specific contents of a . txt with php
The txt is actually the result of serialize of an array, so you can simply make an unset(). $news = unserialize(file_get_contents('news.txt')); unset($news[0]); file_put_contents('news.txt',…
-
1
votes1
answer244
viewsA: bcrypt character limit in PHP
The limit is 72 bytes, not 51. The limit of 51 is wrong, or is a mess, or recent implementations do not follow the original. In fact, it seems to me that this limit originates from the Blowfish…
-
1
votes2
answers136
viewsA: How to group array that has the same value
Just add something like that into the for: $resultado[$materia][] = ['pergunta' => $pergunta, 'resposta' => $resposta]; In the end it would look like: //VALOR PADRÃO DO RESULTADO AGRUPADO…
-
1
votes1
answer35
viewsA: How do I make a URL open when the person presses a certain key?
If you want to use only HTML it is possible using accesskey, but in this case it is necessary to tighten the alt, as alt+s would be: <a href="https://google.com" rel="noopener noreferer"…
-
0
votes1
answer2104
viewsA: CURL using PHP
You can see in the documentation what is equivalent for each command: Curl -k -u username:password https://analysiscenter.veracode.com/api/3.0/generateflawreport.do -F "app_id_list=000000" -F…
-
2
votes1
answer34
viewsA: Is PHP-specific string array possible?
Until PHP 7 there was no way to specify the type of array, I also wish I could. However, I don’t know if in recent versions such a resource has been added. But, your first code works, just by adding…
-
0
votes2
answers2314
viewsA: Translation of static website content into 4 languages
I think one of the best ways is to use the link, as: <link rel="alternate" hreflang="en-gb" href="http://en-gb.site.com" /> <link rel="alternate" hreflang="pt-br"…
-
3
votes1
answer81
viewsA: JAVASCRIPT ARRAY (map and reduce)
I don’t know if this is the best way, but you can do it like this: array = [{dia:2,turno: 'turno1',M:1,T:0,N:0}, {dia:2,turno: 'turno2',M:0,T:2,N:0}, {dia:2,turno: 'turno3',M:0,T:0,N:1},…
-
0
votes1
answer140
viewsA: Problem to use user IP instead of server in CURL
There is no fixing. Whereas Curl runs on the server, so the request will have the server IP. What you are you want, basically: forging an IP using TCP. There is no way you can use the client’s IP.…
-
2
votes3
answers659
views -
0
votes1
answer66
viewsA: How to remove PHP Randomization encryption
The encryption key is fixed on your code, it is exactly what is set in: $gKey = 'welcometoapicodesdotcomthisiskey'; With this key you can encrypt and decrypt the texts, as well as anyone else who…
-
3
votes1
answer124
viewsQ: Why does Illegal Invocation occur in JS?
I’m using Gopherjs, and in it there are two ways to perform a function, via Call() or via Invoke(). Initially it was using a code similar to this:…
-
1
votes2
answers258
viewsA: Is it possible to manipulate SESSION variables to perform SQL Injection?
If the session stores some value that is informed by the user: yes. A common case would be: The user enters the name of "or"1"="1 You make a INSERT tabela(name) VALUES ("\"or"1"="1") In this case no…
-
1
votes3
answers118
viewsA: Divide value with random numbers
The reason is because the loop is infinite, what you can do is simply subtract the value until it reaches zero. <?php function separate($val) { if ($val == 1) { return "1"; } $list = []; while…
-
1
votes1
answer950
viewsA: Encryption BASE64
First of all, Base64 is not an encryption, but an encryption of some kind. It is not intended to protect information, much less make it unrecoverable or create other information indistinguishable…
-
1
votes1
answer282
views -
2
votes1
answer522
viewsA: Assign values to a struct array in Golang
You must use &p[i].burst and not &p[1].burst[i]: for i := 0; i < n_processo; i++ { fmt.Printf("Burst Processo P%d: ", i) fmt.Scanf("%d\n", &p[i].burst) fmt.Printf("Tempo de Chegada…
-
1
votes1
answer55
viewsA: Pass sql.DB pointer as method parameter
I think the problem is the locally created variable. You’re doing something like this: package main import "fmt" var variavel *int func init() { variavel, _ := new(int), new(int)…
-
4
votes2
answers1125
viewsA: Should I encrypt the password before sending it to the server?
There is a difference between encrypting (protecting the communication between the client-server; example of algorithms: AES, Chacha20, Salsa20, DES, 3DES...) and deriving (prevent the discovery of…
-
3
votes2
answers75
viewsQ: How to compare the CSS path of an element using JS?
I don’t know if "path" is the best definition. But using the QuerySelector it is possible to obtain an element by specifying a "path", for example: main section.sobre .view-more But how can I do the…
javascriptasked Inkeliz 20,671 -
3
votes1
answer190
viewsA: PHP script for counting comma-separated records
The format ["87","12","67"] is a valid JSON format, so you can use the json_decode. $conexao = mysqli_connect('localhost','root',''); $banco = mysqli_select_db($conexao,'bd');…
-
1
votes1
answer145
viewsA: Error in Count()
To resolve the error could scan is countable using is_contable (or is_array, if not in PHP 7.3)( before using count(), then it would be something like: if (is_countable($redes) &&…
-
1
votes2
answers163
viewsQ: Is there a way to "link" specific content from one repository to another?
I have a program that needs some DDLs, those DDLs are available in another Git, also on Github. Therefore, it would be possible for my library link such a file to such a repository? To be more…
-
3
votes2
answers211
viewsA: Php Numeric Format of 000 000 0
Because your tag is PHP, you could do: $text = "1234567890"; echo implode(" ", str_split($text, 3)); whereas the $text the source of the information, such as a $_POST... The str_split() will return…
-
1
votes2
answers295
viewsA: Migrate PHP function from mcrypt to Openssl
There is no port to Openssl. This is because the MCRYPT_RIJNDAEL_256 is not equal to AES-256, He uses a non-standard version. AES always operates with 128-byte blocks, even in AES-256, this does not…
-
1
votes2
answers173
viewsA: How to validate data securely in the frontend?
You should never believe a customer’s information, this is the basic rule. You can include client-side filters and validations in order to provide a better user experience, as errors will be…
-
1
votes3
answers374
viewsA: "== true" is useful for something? Is it better "!" or "== false"?
I believe this is quite useful in dynamic typing languages, where a 0 and false are also treated. Just for an example effect, PHP, there is a function of strpos. It returns the position where the…
-
1
votes3
answers106
viewsA: How to create unmanaged variables?
The operating system typically handles restricting access to memory for each application. Windows, as far as you know, requires administrator permissions to access the memory of other applications,…