Posts by gustavox • 4,004 points
143 posts
-
3
votes1
answer181
viewsQ: How to configure the GTAG User Id in external JS file by picking PHP variable?
As PHP use in the backend, to configure the inline user id just give a echo of the variable $userId, for ex: if (isset($userId)) { $gacode = "ga('create', 'xxx', 'auto', {'userId': $userId});"; echo…
-
5
votes2
answers151
viewsQ: Does HTTP/2 need something other than server configuration to work?
I already have HTTP/2 configured on the server, testing by https://tools.keycdn.com/http2-test the result is: HTTP/2 Protocol is supported. ALPN Extension is supported. But looking through the…
-
3
votes1
answer105
viewsA: PHP Javascript - IF error
Basically the problem is that it is not possible to determine the value of the PHP variable $minhavar with the if javascript. When I went to check the page’s view-souce it already runs all the…
-
3
votes2
answers196
viewsA: Create plot fields
Surely there are better ways to do that, I’m no expert on JS, far from it. Actually I’m taking a JS course currently, and I stayed yesterday and today a good time breaking my head on this question…
-
1
votes0
answers92
viewsQ: How to generate a nonce with mod unique_id for Content Security Police?
I’m trying to generate a nonce to the CSP, I have already enabled the mod unique_id of the Apache, and .htaccess is already generating correctly. Header set Content-Security-Policy-Report-Only…
-
1
votes1
answer70
views -
10
votes2
answers785
viewsQ: How to check if an XML file is valid with PHP?
As I understand the answers of this question from the OS, the XMLReader::isValid() checks "only the current node, not the whole document". What does that mean? In case I want to validate if xml is…
-
5
votes1
answer577
viewsQ: How to implement Feature Policy Header by htaccess?
For which I understood, this response header controls access to the content of the application, and in conjunction with other headers such as the Referrer Policy approached in this question,…
-
1
votes0
answers105
viewsQ: How to enable events in mysql 5.7?
I’m trying to activate the events of mysql 5.7, but I get an error. To: SET GLOBAL event_scheduler = ON; I get: 01:16:06 SET GLOBAL event_scheduler = ON Error Code: 1227. Access denied; you need (at…
-
5
votes1
answer4714
viewsQ: What are the possible causes of "Connection reset by peer: Fastcgi: Comm with server aborted" error and how to fix it?
According to some responses in the OS, such as this and this, it seems that the error occurs because it ends the max_execution_time, but it was not clear to me what are the possible causes and how…
-
4
votes1
answer102
views -
15
votes2
answers1586
viewsQ: Is it good practice to have all sizes of favicons, and include all rel links in HTML?
I’ve always used only the favicon.ico on the pages HTML, with it at the root and with its link rel in the HEAD: <link rel='shortcut icon' href='https://site/favicon.ico'> But recently,…
-
4
votes4
answers231
viewsA: How many times should I use the Strong element to highlight a word as important?
For SEO purposes, the answer is 0. You should not apply <b>, <strong> or any kind of highlight in any word of text thinking only of SEO. There are some variables known to be observed by…
-
10
votes2
answers1614
viewsQ: How to calculate the time of each year between two dates?
I need to take two dates and calculate the time period each year in isolation. For example: between dates 12/06/2012 and 12/06/2017 the correct exit would be: 2012 = 5 meses e 12 dias 2013 = 12…
-
1
votes1
answer922
viewsQ: How to hide button element using CSS only?
I’m trying to use the property display: none in the element button, but it doesn’t work. If I put it in the class it works, e.g.: .btn { display: none; } But I put myself in the element button…
-
8
votes5
answers1493
viewsQ: How to create a function to validate time in PHP
I am trying to validate a time field in PHP, and with the help of this topic on an external site I came to this script: function validaHoras($campo){ if (preg_match('/^[0-9]{2}:[0-9]{2}$/', $campo))…
-
2
votes2
answers1809
viewsQ: How to reset all data from a form if the user goes back to page?
I have a form that after being submitted presents the result on a second page, like: <form method="post" id="form" action="form.php"> <input name='nome' id='nome'> <input…
-
5
votes3
answers741
viewsA: On which pages should I put the code of google Analytics?
The answer to the 3 questions is yes. We need to put the tracking code on every page you want to track. Even if the page has authentication, the Analytics can "see" the relevant data, and provide…
google-analyticsanswered gustavox 4,004 -
4
votes1
answer1504
viewsQ: How to resolve memory size error for large files generated with Dompdf?
What happens is that when the HTML (dynamically generated) gets too large, the pdf is not created, and returns this error: Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to…
-
1
votes3
answers741
viewsQ: On which pages should I put the code of google Analytics?
The manual says to put on all pages, but this includes the pages that can only be accessed after login? There’s a way google Analytics can see these pages? For example, if my only page with…
google-analyticsasked gustavox 4,004 -
11
votes3
answers2099
viewsQ: Is it safe and feasible to minify PHP files?
I was left with this question after reading an answer of this question on HTML. I have only minified with PHP, only with HTML, with PHP and HTML... and I didn’t notice any problems... Can it become…
-
3
votes3
answers833
viewsA: Jquery modal does not open
It is not working because the jQueryUI you are using is very old, and incompatible with jQuery2.0~. See below under "Run code snippet" your code working: $(document).ready(function () { function…
-
5
votes1
answer1358
viewsA: How to activate the modal through the option in a select?
You need to put a value in options, and create the div with the modal. In the example below I used the modal of documentation adapted to your code (see below by clicking on "Execute code snippet").…
-
3
votes1
answer45
viewsQ: Is it possible to select all elements with a certain class with CSS only?
I was taking a look at the selectors, and I couldn’t find a way to select all the elements that have a certain class. I tried for example: select[form-control] { } Trying to catch all the selects…
-
3
votes3
answers1212
viewsA: PHP - Comparing information
The problem is with the original code, which is certainly not the same as the question, since the question code works perfectly the way it is. You probably have === in condition (but of course it…
-
6
votes2
answers162
viewsQ: How to count state changes in fields with a certain class within a function?
How do I count how many changes occur in all fields of a form with a certain class? Update: What I want to know is if there has been any change in each field (one), and not how many times there was…
-
12
votes1
answer11265
viewsQ: How to create a dynamic progress bar considering all fields of a form?
I’m trying to create a progress bar a little different from the ones I found around. This for example, take the values of the fields and plays in the aria-valuenow from the progress bar. In my case,…
-
1
votes2
answers5843
viewsA: Modal opens superimposed by black background
Translation of the main answer of this question soen: This behavior occurs when the modal has a fixed or relative position, or is inside an element with a fixed or relative position. Make sure that…
-
3
votes1
answer443
viewsQ: How to create function to automate a dynamic progress bar?
I have a form with some "modules" (module = a set of questions - I do not know if it is the appropriate technical term...), so depending on which module is chosen, a certain amount of questions will…
-
4
votes3
answers4462
viewsA: How to display the result of a form on the same page?
You can use the method PHP_SELF, but you need to change some more details in your code: 1 - I used the method post, (but you can use the GET) and checked with isset if the variable $_POST was not…
-
2
votes2
answers136
viewsA: Is it possible to make the optgroup label selectable?
I’ve been doing some research, and following a "clue" I found in a comment of one of the answers to the question I posted in the comment above (in the question), I think the reason this is…
-
5
votes2
answers1215
viewsA: Doubt about the Apache version 2.0 license
The Apache 2.0 license is in the category of permissive licenses, so you can commercially use a code under this license, but must comply with some requirements. Basically, this image from the site…
-
26
votes5
answers7637
viewsQ: Is Excel a programming language?
No, I’m not asking for an opinion. I’m asking this question here because today I found this unlikely question: HTML is a programming language? And, I confess, I voted in favour of the second comment…
-
13
votes1
answer10939
viewsQ: What is parse, and how the parse of DOM works in HTML5
I started to study more CSS3 in depth, and I ended up wanting to better understand how the HTML rendering works in the Document Object Model (DOM), and how this HTML and CSS (and JS) markup is made…
-
3
votes3
answers596
viewsA: How to arrange the date order?
You can use strtotime, thus: $data = "2010-01-02"; echo date("d-m-Y",strtotime($data)); // Saída: 02-01-2010 See on IDEONE.…
-
1
votes1
answer965
viewsA: Condition to add and remove attributes from an element?
You just put the Javascript tag, but as I see you are using jQuery, then you can add and remove attributes from an element using the functions attr and removeAttr, for example: $('#svg-map…
javascriptanswered gustavox 4,004 -
3
votes3
answers4136
viewsA: How to subtract a date from the current system date
According to the clarification in the comments of the question, I see two problems in your code: 1 - You are getting the date of the bank in format ('Y/m/d'), and comparing to a date in format…
-
5
votes4
answers4258
viewsA: How to prevent direct access to my PHP code?
Having developed my project in a procedural way, without using any framework (just a miniframework for session authentication that only works for archives at the root :/) or standard structure…
-
2
votes2
answers871
viewsA: Listing images within a directory
As @Willian said in his reply, you can use the function DirectoryIterator to view the contents of directories and files with PHP. This function will return an object with multiple data, which can be…
-
13
votes4
answers1938
viewsA: Show age in years in php
To compare these dates with the current date use new DateTime() (to get the current date) with the function diff: $data1 = new DateTime('19910906'); $data2 = new DateTime('19981205'); $idadeData1 =…
-
2
votes3
answers99
viewsA: Conditions do not return expected values
It took me a while to finish the answer, and I haven’t looked at the others. I did more because for me it represented an "achievable challenge", and even knowing that there are people much better…
-
2
votes3
answers7154
viewsQ: How to hide directory paths in htaccess url?
How to make all site urls shortened by hiding all directory paths? For example: www.meusite.com/models/scripts/arquivo.php www.meusite.com/view/templates/arquivo.php…
-
2
votes0
answers81
viewsQ: How to restrict external file access by htaccess url?
I’m studying htacess, and found this article (that helped in a lot of things), where it says the following: Let’s say you wish prevent third parties from accessing certain files and folders on your…
-
10
votes4
answers732
viewsQ: How to create a function to scroll through a dynamically created PHP page and change certain text
I have a PHP page that is mounted dynamically, and I need to change certain texts, according to the user being male and female. I was wearing it like this: function mudasexocaps($sexo) { if ($sexo…
-
2
votes3
answers717
viewsQ: How to add a PHP variable only if it is set?
I have some scripts that do some calculations with data coming from a form, and to do the sum of all they created another file where I do the sum: include "varios.php"; $total = $var1 + $var2 +…
-
6
votes1
answer360
viewsQ: What are the risks of saving files to the Apache server with PHP and how to avoid them?
I’m recording an HTML file with part of a page, to be used later by HTMLDocX in the generation of a file .docx (vine this question related). To record use ob_start and ob_get_clean to put the…
-
3
votes1
answer3453
viewsQ: Doubt about the error "Strict standards: Only variables should be passed by Reference in"
To record some dates in the database in the desired format I am doing so: mysqli_stmt_bind_param ( $stmt, 's', date("Y-m-d", strtotime($data)) ); Or, to catch the present day, simply:…
-
2
votes1
answer300
viewsQ: How to change the display of a select options on mobile devices?
Before you start cleaning my CSS and JS files, when you open one select on my mobile device (Windows Phone with IE) it opened the options on a black screen that overlapped the page, and only…
-
18
votes2
answers4788
viewsQ: Is it possible to use masks on mobile devices satisfactorily?
So after a true pilgrimage that yielded about 10 questions, I discovered that the masks I was wearing didn’t work properly on mobile devices. The main ones are (were?): Maskmoney inputMask What…
-
3
votes1
answer1156
viewsQ: How to know which CSS is being used by a page?
By the inspector of google-Chrome it is possible to know which CSS's nay are being used, as shown in the image below: The question is: How to know which CSS is being used by a given page?…