Posts by Inkeliz • 20,671 points
671 posts
-
5
votes4
answers2820
viewsA: What is the difference between "notice" and "Warning" in PHP?
In PHP there are four types of errors "common": Parse Error/Syntax Error Fatal Error Warning Error Notice Error Parse Error: The Parse Error is triggered when a code is literally broken, with syntax…
-
1
votes3
answers588
viewsA: How do I redirect the user to the address they are visiting after logging in?
With the $_SERVER['HTTP_REFERER'], you will get the referrer which was defined by the sent header, this is unreliable, but may reasonably believe in it for that purpose. You can also use a parameter…
-
2
votes2
answers2535
viewsA: Request in the Cielo API in PHP using Curl
I am ONLY basing myself on the documentation provided on http://developercielo.github.io/Webservice-3.0/? shell#creating-a-sale-with-authentication, because it uses the SAME endpoint, but this was…
-
3
votes2
answers239
viewsA: Web Scraping how to insert the result into the <img src=
You can use the XPath for this and use the getAttribute. // Inicia o DOM: $html = $retorno_do_seu_curl; $dom = new DOMDocument; $dom->loadHTML($html); // Inicia XPath: $xpath = new…
-
4
votes1
answer98
viewsA: Error while trying to insert with PHP
Apparently is using Mysqli, nay PDO, not separate things and that can confuse who comes to answer, since they have great differences. If you mean using object-oriented programming it would be POO or…
-
1
votes3
answers2105
viewsA: Use external file function without giving include
No, but you can hide. There is no way not to include the other file, however there is how to hide it, so not requiring adding the include(...) always in your code. An example is using the…
-
3
votes1
answer1661
viewsA: How do I make an http request with php with authentication and waiting for a file to respond?
Let’s translate the CURL: curl : Starts the CURL. -k : Set to unsafe mode, not checking SSL. -H "Authorization: Bearer TOKEN_DE_ACESSO" Sets the header of Authorization with the value of Bearer…
-
1
votes1
answer48
viewsA: SQL with PHP - SELECT problem
You must use the WHERE. SELECT fotos.*, albuns.album_name FROM fotos INNER JOIN albuns ON fotos.foto_album = albuns.album_id WHERE albuns.album_id = 123456 In this case 123456 is the $album_id, for…
-
4
votes2
answers2030
viewsA: How does a birthday attack work?
"Birthday Attack" is used solely to measure how secure (or not) the cryptographic algorithm is by brute force techniques. The "birthday attack" is nothing more than a brute force. The encryption…
-
5
votes2
answers115
viewsQ: Because Chr() is vulnerable to "cache-timing" attack and pack() is not?
Out of curiosity I am looking for and slow many things about cryptography and also looking for some libraries in pure PHP, such as Sodium_compat, for the sole reason that I understand much more of…
-
1
votes1
answer61
viewsA: Chat does not appear
This will occur because it is not including the other file and precisely because it is hiding the error message makes it difficult to know the reason for the problem. Avoid using the @, in fact…
-
2
votes1
answer77
viewsA: Images with PHP
Unofficial: Any Facebook website has the parameter ?__a=1, this is very curious and do not ask me why it exists, but it exists. Many resources using this parameter returns everything in JSON, or…
-
1
votes1
answer49
viewsA: Char* value is shown even where it was not called using Arduino
The reason and the explanation of why it occurred I do not know yet, honestly, what in fact is a problem, after all this may happen again and I won’t know why. Meanwhile the solution was to use…
-
1
votes1
answer49
viewsQ: Char* value is shown even where it was not called using Arduino
This is exactly what I’m wearing: #include <SPI.h> #include <Ethernet.h> byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED }; // Tentativa frustada, possui o mesmo problema: //uint32_t…
-
2
votes2
answers79
viewsA: Question about array in php
Just change the $var_selecionada = '$'.$var; for $var_selecionada = $$var;. You must use $$var instead of '$'.$var, this way will create a variable, see this here. The way you’re currently doing $…
-
1
votes1
answer138
viewsA: Image Generator Does Not Work
There is no error in the code, as I commented above. However I assume, in pure achism, that the problem is because the source file is not in the specified location, when it says that "Barcode source…
-
5
votes1
answer204
viewsA: How do I make a rollback or "undo" button in my application?
The DELETE cannot be undone directly unless it is in a TRANSACTION, in this case could use the ROLLBACK (using the mysqli_rollback($conexao)); However that’s not what you want, you want to delete…
-
4
votes1
answer275
viewsA: Performance of file_get_contents()
This is only because you are downloading an external content. Whenever you run this it will connect with the http://blog.exal.com.br/feed, will search the IP address and connect, then will wait for…
-
6
votes3
answers304
viewsA: How to get the highest numerical value supported by php?
PHP has the predefined constant of PHP_INT_MAX, since 5.0.5, and also the PHP_INT_MIN, since PHP 7.0. The first will return the highest possible value and the second the lowest possible value.…
-
6
votes1
answer2454
viewsA: What is cloud computing data redundancy?
Redundancy is not something unique to computing, let alone the cloud computing, in fact it has exactly the same feature even in Portuguese. In the Portuguese language, saying "go outside", "go up",…
-
0
votes2
answers189
viewsA: How can I not let the session expire in Joomla when it closes? (or last longer)
This is the default PHP behavior, see here. There are two different things that should be noticed in the sessions, being him: session.cookie_lifetime defines the time when the cookie session will be…
-
1
votes2
answers1157
viewsA: exceeded the 'max_user_connections' Resource
If you want to expand the connection limit, as mentioned, the limit should be expanded directly on my.cnf, if you have access to this file. Actually there are two parameters to be changed:…
-
0
votes1
answer200
viewsA: Curl, how to change the country of origin
The only way to do this is by using PROXY, IP is the only thing that identifies the location of the access. The CURL has support for PROXY in several ways, you can use for example: curl_setopt($ch,…
-
3
votes1
answer2336
viewsA: Sending a file via CURL using PHP
In PHP 5.6 and above you have the curl_file_create, you can use it. curl -F file=@/home/user/picture.jpg https://api.dominio.com/pictures This indicates exactly: -F indicates that it is a…
-
3
votes2
answers1867
viewsA: How to create installer for offline web system PHP + Mysql
If it is for Windows, there is an alternative which is to use the ExeOutput for PHP, is a paid software and aims to create a .exe containing an internal browser, based on Trident (Internet Explorer)…
-
1
votes2
answers644
viewsA: Active class in the include menu
This is another PHP-free option! Once is something visual I believe can be treated on the client side, using Javascript/Jquery. For example: var pagina = window.location.pathname.split('/')[…
-
1
votes1
answer121
viewsA: PHP Display only the nearest result
You must replace the LIKE and use the Full-Text Search, in this case it should be used as an example: mysqli_query($con, ' SELECT *, MATCH(recebido) AGAINST ("'.$busca.'") AS relevancia FROM…
-
2
votes1
answer155
viewsA: How not to repeat the same Input request
The requisition of AJAX enter the data in the respective tr, otherwise a change in one of the Planos will affect all classes of Parcelas. $(document).ready(function(){ $(document).on("change",…
-
2
votes3
answers761
viewsA: Abort AJAX request
Let’s go by step of the problem, your solution to the problem (abort the ajax on the client side) is not the actual solution, the problem is on the server-side. How do I stop PHP from running? PHP…
-
6
votes1
answer817
viewsA: How do I change the class of a button according to its id and value?
You can use selector [value=X]: var value = (Math.floor(Math.random() * 4) + 1); // << Para explicar gera um número qualquer, clique em "Executar" para selecionar um diferente. $("#month…
-
3
votes2
answers1096
viewsQ: How to set custom name in Javascript array index?
In PHP we can use: $validation = [ 200 => ['icon-check', 'The key match with the message!'], 400 => ['icon-close', 'The key doesn\'t match with the message!'], 403 => ['icon-close',…
-
10
votes1
answer1535
viewsQ: What is the difference between parseint() and Number()?
What is the difference between the parseInt() and Number()? If you use: console.log(parseInt('100')); console.log(parseInt('1')); console.log(parseInt('a')); console.log(Number('100'));…
javascriptasked Inkeliz 20,671 -
13
votes3
answers21853
viewsA: How to select an option in <select> via text using jQuery?
You can use the selector :contains() and then take his value. $("#animal").val( $('option:contains("Bezerro")').val() ); <script…
-
2
votes2
answers947
viewsA: How to expand an image with Hover without other elements moving
One of the ways to do this would be to define a margin equivalent to width/height when the element is expanded. For example: /* Padrão */ img { float: left; display: block; margin: 25px; width:…
-
1
votes2
answers188
viewsA: How to Stop the Write On-Screen Effect with jQuery
To stop it in the last text just add a condition to not apply the setTimeout, for this some changes were made. The first one was to create a variable with a name die. die = false; So we need to know…
-
4
votes4
answers2028
viewsA: Side by side in Bootstrap, jumping line
/!\ This is a gambit! You can use the matchHeight so that all elements stay the same size. Get in http://brm.io/jquery-match-height/, can use: <script…
twitter-bootstrapanswered Inkeliz 20,671 -
4
votes5
answers590
viewsA: Remove chunk from a string
If you have any preference for REGEX, what I find difficult, could use this: $string = '32137hyb8bhbhu837218nhbuhuh&3298j19j2n39'; preg_match('/(.*)&/', $string, $match); echo $match[1];…
-
0
votes1
answer359
viewsA: Generate a Row after 2 columns in bootstrap
If you need one Row every two elements just count the amount of element. In this case, if it is only every 2 elements you can use the comparator using the $X % 2 === 0. The operator % get the rest…
-
0
votes2
answers75
viewsA: div 11 does not receive styling in css
As much as it might work, it shouldn’t. The id are made to be unique, only one element should have a single id, duplicate them is a mistake. Your code, as it is, will not be valid on W3C test. In…
-
3
votes2
answers159
viewsA: Query mysql problem, what would be the best way to solve
You can use the comparator IF, see here. SELECT tables.id as `TableID`, IF(orders.status = 0, orders.id, null) as `OrderID` FROM tables LEFT JOIN orders ON tables.id = orders.table_id That way will…
-
5
votes2
answers483
viewsA: Why was password_hash’s "salt" option discontinued in PHP 7?
Because the salt should be unique for each password, allow define a salt could cause you to define a salt constant. For example: password_hash('senha_legal', PASSWORD_DEFAULT, ['salt' =>…
-
1
votes2
answers597
viewsA: Rename files with random names using php
In the version of PHP 7 there is the random_byte that theoretically is safer than relying on time. foreach (glob("*.gif") as $arquivo) { $nome = bin2hex( random_bytes(12) ); rename($arquivo, $nome .…
-
0
votes3
answers3285
viewsA: Search word in Php text
This is because all lines ($line) possess <ID> (originating from the $search). If you just want to get what contain the 490901 you can use: $search = '490901'; Making only this change would…
-
5
votes4
answers9132
viewsA: How to change the color of a select when selecting an option
When the :has supported in browsers could use, I believe it would work: select:has(option[value=""]) { color: red; } However, so far no browser supports and maybe it won’t even come off the paper.…
-
0
votes1
answer223
viewsA: View image ( from web api ) without extension in php
WARNING (2020-03-20): The call to the Spotify API went to require an authentication, crashing publicly. The code demonstrated here is no longer "functional by default" and requires changes. There is…
-
15
votes2
answers44856
viewsA: How to get ip from a user using php?
If you are not using services such as Cloudflare, Incapsula and neither Sucuri, among others, you can use: $_SERVER['REMOTE_ADDR']; This will return the IP of the user, if he is using proxy will…
-
4
votes1
answer92
viewsA: How to make a "link format" (a system that reads the content of other Webs sites)?
You can use a Curl for this and then use Domdocument (or REGEX) to get the page data. Facebook uses the Open Graph Markup, since many websites support it you can also read such data. I’m using as an…
-
0
votes2
answers1021
viewsA: Problem with Json_encode
Because one is only a string while the other is an array. When you do that: echo json_encode([4 => 2, 12 => 1, 7 => 2]); It’s the same as doing it: $array = array(4 => 2, 12 => 1, 7…
-
3
votes2
answers973
viewsA: How to make this slideshow infinite?
My idea was this, remembering that maybe it’s not the best: If the controller is greater than the number of slide he plays the first slide to the last: $('.carrossel…
-
3
votes2
answers129
viewsA: How to display id as form counter
The mistake is in: echo '<span>'.["id_pedido"].'</span>'; There is no such thing as. When you use the code: while($row = mysqli_fetch_array($resultado_id)){ } Are you saying that as long…