Posts by Costamilam • 9,556 points
509 posts
-
0
votes1
answer65
viewsA: Is exposing the PRIMARY KEY of an entity considered a serious security problem?
Not, if the server-side actions are not validated, the failure is there, exposing a primary key may be easier, but it is not a failure As for that facility... As you are talking about primary key, I…
-
1
votes1
answer58
viewsQ: Is it possible, in a function, to return the reference to an array index?
The idea is to have a function that receives a array and return the reference to an index of the same, for example: $list = ['a', 'b', 'c', 'd', 'e']; function ref(&list) { return &$list[3]…
-
0
votes2
answers295
viewsA: Nesting a flat PHP array to generate an HTML menu and submenus
I suggest first arrange the array... $menu = [ 38 => [ 'name' => 'Categoria Raiz 1', 'link' => 'https://...', 'id_parent' => 0 ], 205 => [ 'name' => 'Subcategoria 1', 'link' =>…
-
1
votes2
answers89
viewsA: Field search loses value by clicking on another page
Sessions solve the problem but are not necessary In jQuery trade for $.get('pesquisaAcesso.php?busca='+busca, function(data){ ... }) It’s more semantic to make a GET request In PHP, take the search…
-
1
votes1
answer19
viewsA: Set a Material Design Lite select value
To preselect an option you need to use the attribute data-selected, you can add it directly to HTML: <li class="mdl-menu__item" data-val="RUS" data-selected="true">Russia</li> Or by the…
material-designanswered Costamilam 9,556 -
0
votes1
answer244
viewsQ: bcrypt character limit in PHP
In the PHP documentation for the function password_hash has the notice: Care Using PASSWORD_BCRYPT as algorithm, will result in the parameter password truncated to a maximum length of 72 characters.…
-
10
votes4
answers401
viewsQ: Skipping route due to poorly formatted parameter is a syntax error?
For example, I have the route GET: /user/{id}, id passes a regular expression validation of type [0-9]+. When performing requests with the verb GET for the following Urls: /user/17, returns user…
-
0
votes1
answer61
viewsA: Problems with the Composer
The problem is that the root folder name is not considered when defining "App\\": "App/" he will try to find the folder [...]/App/App the first being the project root folder and the second the…
commiserateanswered Costamilam 9,556 -
0
votes2
answers535
viewsA: How to access child node in Firebase?
What happens is, in the loop for, every iteration it takes a property of the object, then the value of ds.getValue is the value of the property alvoFuro, i.e., "alv" Try removing the last call to…
-
0
votes1
answer115
viewsA: Doubt with php redirect from a dialog box
This should be done by JS not PHP You can do: if($ret == 1){ ?> <script> confirm('colaborador excluído com sucesso!'); window.location = 'https://example.com/lista.php'; </script>…
-
2
votes2
answers470
viewsQ: How to use namespaces without classes with autoload from Composer?
I’m trying to use the classless namespaces with the Poser autoload, but I believe it is failing, for example: /Foo/Bar.php namespace Foo\Bar { function baz() { echo 'Funcionou'; } } /index php.…
-
2
votes1
answer90
viewsQ: Create recycle bin table
I have the database tables to store the data, but I want to add one to save the data of deleted rows from the other tables, I thought of four ways to do this: Create a table lixeira that will save…
-
0
votes1
answer87
viewsA: How to change a state in the following scenario with the Onchange event
When you run the line copyState.form[name] = value; what happens is copyState.form['address.street'] = 'value of input'; and not copyState.form['address']['street'] = 'value of input'; You can use a…
-
0
votes2
answers143
viewsA: I want to Take the Result of a Select to use in Javascript
The simplest way is to use the two way data Binding, which would be two-way communication, i.e., HTML changes the variable in Javascript, and changes in the Javascript variable also changes HTML In…
-
0
votes2
answers89
viewsA: Access child node in Firebase
It is necessary to configure the business rules: { "projeto": { //Acessa o nó onde será feita a validação "$chave": { //$chave representa, nesse caso, os ids criados pelo próprio Firebase ao…
-
2
votes1
answer185
viewsA: Pass variable in Mongodb query (JAVASCRIPT)
To create a regular expression object with variables you need to use the Regexp class: let reString = 'exemplo'; let re = new RegExp(`${reString}[0-9]?`, 'i'); console.log(re);…
-
2
votes2
answers222
viewsA: How to take out the commas and insert spaces between the numbers in this array?
To join an array into a string use the function join passing the character that will be used between the elements: [1, 2, 3].join(' ');
javascriptanswered Costamilam 9,556 -
1
votes1
answer44
viewsA: How to access the values of a private object in PHP?
If the object property is private, it is not possible to access it directly, add a method to the class that returns that id: class Exemplo { // ... public function getId() { return $this->id; } }…
phpanswered Costamilam 9,556 -
3
votes1
answer4177
viewsA: How to create a list and put other lists inside?
Just create a variable of type list and pass a list in the method append: lista = [] lista.append([1,2,3]) lista.append([1,2,3]) lista.append([1,2,3]) print lista #[[1, 2, 3], [1, 2, 3], [1, 2, 3]]…
-
2
votes5
answers459
viewsA: Concatenate id by description into an array in javascript
Two loops will do. The first traverses the variable with the repeated fields, inside makes a new loop to check if that object already exists in the new variable, if it exists, updates the id, if…
-
0
votes1
answer165
viewsQ: How to create components from another base component
The idea is to create a component for each type of input, for example, InputPassword for <input type="password">, however, in order to reuse code, most of these components have an equal basis,…
-
1
votes2
answers75
viewsA: How to compare the CSS path of an element using JS?
There is a function for this, matchesSelector Syntax: element.matchesSelector(selectorString) Where element is any HTML element and selectorString is a string representing a valid CSS selector. The…
javascriptanswered Costamilam 9,556 -
-2
votes2
answers50
viewsQ: What is the Google Mobile First Index?
Some time ago Google announced a change in the form of indexing that will do, but what change is that? What will change in the life of the programmer? How this transition will be made?
seoasked Costamilam 9,556 -
1
votes2
answers50
viewsA: What is the Google Mobile First Index?
In relation to web design, there is already a long time the idea of mobile first to create the layout and design, this because, today, the pages are accessed mostly by mobile devices, so first…
seoanswered Costamilam 9,556 -
-1
votes2
answers76
viewsA: Problem with PHP Search Engine
Your result is blank because you are not writing the data on echo while ($rows_sql = mysqli_fetch_array($resultado_cemiterio)) { //Aqui você escrever apenas um HTML fixo, não tem os dados do banco…
-
0
votes2
answers697
viewsA: How to put ALT in a Background-Image? How to make a Background-Image more accessible and semantic?
A visual alternative with only HTML and CSS is to use two elements, with background-image above and below, the latter will appear if the top does not load .imagem { position: absolute; width: 150px;…
-
2
votes1
answer1437
viewsA: NODE.JS - Error: Route.get() requires a callback Function but got a [Object Undefined]
Change exports.login exports.register For module.exports.login module.exports.register
-
10
votes2
answers1618
viewsA: How to go through string and replace ** with <b></b>
Using regex: var str = "*Visit* jsduflsd \\*fjkdsufdsjlkfds\\* djfuldsifjdlsk *jflusdlkfjdsds* jfdisufkljds!"; var res = (" "+str).replace(/([^\\])\*([^\*]*)([^\\])\*/g,…
-
2
votes3
answers572
viewsA: Is it possible to animate text-Decoration with CSS?
I got a movement effect (very red), the idea is to create a pseudo element that will have the same content and it will have the underline. This element will stretch, giving this slight effect of…
-
10
votes3
answers2779
viewsA: What are React Hooks?
There are 4 types of hooks: State Hook Effect Hook Custom Hook Other Hook (Native hooks with specific functions) In short: "When would I use a Hook? If you write a Function Component and realize you…
-
0
votes1
answer215
viewsQ: Can I get the text from the HTTP request?
HTTP/HTTPS requests are sent as text with the format: In order: The initial line with the HTTP method and the version The headers in the format chave: valor A blank line The body of the request Is…
-
12
votes2
answers4482
viewsQ: What are refresh token, access tokens and Grant type?
I was researching security in REST Apis and found the terms refresh tokens, access tokens and Grant type referring to how tokens work and how the customer requests the features What they are and…
-
0
votes2
answers954
viewsA: How to load a page into a div with Angular
Trade this div for the tag <router-outlet></router-outlet>, is where your components will be loaded In your module, configure routes and import const appRoutes: Routes = [ { path:…
-
12
votes1
answer261
viewsQ: What should the server return in an OPTIONS request?
Before sending any request to the server, browsers automatically send a request of the type OPTIONS to know some server information What information does the server need to send? Only CORS headers?…
-
0
votes2
answers390
viewsA: Is that a bug in the PHP SWITCH?
It has already been explained the reason for the mistake, and that what you want is not with switch, but that doesn’t mean a lot of if else be the best option An example with array and loop: //Crie…
-
2
votes2
answers673
viewsA: With CSS is it possible to fill in the "eyes" of the Font? Is it possible to fill in the "holes" of the letters A, O, P, etc?
The best solution would be to use a font that is as you want, however ... A gambiarrenta shape that resembles what it wants is to use several text-shadow to create the filled phrase, use…
-
9
votes1
answer205
viewsA: How to make the button outline follow the curvature of the elements?
firefox has the property -moz-outline-radius, but will not work in most browsers One solution would be to disable the outline and create a :focus button { width: 100px; height: 50px; border: 0;…
-
0
votes2
answers267
viewsA: How to know if a person has clicked on a DIV or not
A solution without PHP and cookie, only with JS and Localstorage: //Elemento do anuncio const anuncio = document.querySelector('#anuncio'); //Se houver o anuncio salvo if (localStorage.anuncio) {…
-
1
votes1
answer295
viewsA: Show value in a datetime-local type input
Trade for this: date("Y-m-d\TH:i:s") In HTML you must have a T between date and time. The \ is to escape it
-
0
votes4
answers701
viewsA: How to create and use custom events
I managed to do something similar, maybe not the best way, but it works: //Cria um evento de clique personalizado const myClick = new Event('myClick'); //Salva a função em um lugar qualquer, no…
-
0
votes2
answers55
viewsA: How do I add a prefix before my table in php?
Splits an array into parts and traverses the elements by adding the prefix: $table = 'news AS N, news_category AS NC'; $prefixed = ""; if (strpos($table, ', ') !== false) { //O explode divide a…
phpanswered Costamilam 9,556 -
3
votes1
answer419
viewsA: How to rename a Constraint in mysql?
Unable to rename a CONSTRAINT, but you can delete and create a new: ALTER TABLE report_course DROP PRIMARY KEY, ADD CONSTRAINT `fk_report_course` PRIMARY KEY (`id`) In relation to other databases,…
-
11
votes3
answers645
viewsA: With CSS to cut text? Type a cut text effect or broken font?
Very limited, but still, only with CSS, just use two titles and position a little more to one side, it is important that one of them is on top with a smaller height and white background h2[cortado],…
-
1
votes1
answer60
viewsA: How to use function parameter as object attribute?
The use of square brackets ([ ]) to access variables had already been answered here on the site (if I am not mistaken I answered myself), but I did not find the question to link, as for your code,…
-
3
votes4
answers324
viewsA: Interpretation of loop of repetition
As stated in the comments: "The variable $b is already stated" The traditional format of the loop for is: for ( $i=0; //Declaração de variável $i < 10; //Condição para que o loop continue $i++…
-
2
votes1
answer176
viewsA: Sum the values of each item equal, stored in one object and store in another array
Transform months in an object with 12 properties, one for each month, traverse the array outflow adding the value of the item in the months correspondent const outflow = { '-LNpeDWzApnfSjHEJdh': {…
-
1
votes2
answers133
viewsA: Error inserting PHP + Mysqli data
All date lines are 'd/m/Y'( the correct would be 'd/m/Y', ( The error was attention even, without passing the comma, it would be like trying to invoke the function d/m/Y, I believe I’m not what you…
-
3
votes3
answers593
viewsA: How to get all $_POST information
You thought well, just wanted to add the keys: $_POST = [ "gabarito" => "4", "resposta1" => "A", "resposta2" => "B", "resposta3" => "A" ]; $into = ""; $values = ""; foreach ($_POST as…
-
6
votes3
answers320
viewsQ: On fixed footer position only at the bottom of the page
I have a layout with menu fixed to the left, the page content occupying the rest of the space and a footer also fixed: * { margin: 0; padding: 0; text-align: center; } nav { z-index: 2; width: 25%;…
-
3
votes1
answer219
viewsQ: Validation of string size
I was creating a function to validate large text fields (description, observation, ...), which in SQL will be saved as TEXT, so I basically did this: function($valor, $min = 0, $max = 65000) { if…