Posts by Wesley • 203 points
32 posts
-
0
votes1
answer25
viewsA: Problem handling foreach in a PHP array
I was able to solve by changing the parameter false for true in the array conversion. $array = json_decode($json,true); Instead of using foreach, I started using the for as follows: for ($i = 0; $i…
-
-2
votes1
answer25
viewsQ: Problem handling foreach in a PHP array
I’m trying to go through the transaction of the following array but without success: Array ( [date] => 2021-08-07T20:48:14.000-03:00 [transactions] => Array ( [transaction] => Array (…
-
2
votes2
answers38
viewsA: Add user filter in a function
You can search the CPF registered in the request to be processed and execute the function only if the CPF is different from yours, for example: function issue_automatic_invoice( $order_id, $from,…
-
1
votes1
answer213
viewsQ: Does anyone know how to use php’s flush(); function on a Wordpress site?
Some time ago I posted this question because needed to run a script that pulled a lot of information (multiple requests) in Wordpress, searching a little found the function flush(); to be able to…
-
1
votes1
answer213
viewsQ: What is the correct way to use flush(); and Sleep(); in a foreach?
I made a page in php to generate a sales report in the format . csv through Woocommerce on the Wordpress system. <?php //incluir as funções principais do WordPress…
-
0
votes2
answers40
viewsQ: How to use "for" to work with data in an array whose amount of varied data is unknown?
I have the following JSON variable resulting from a php query: $json_string = '[ { "id": 1, "name": "Jogos para PC", "products": [ { "id": 34, "name": "Grand Theft Auto V" }, { "id": 59, "name":…
-
2
votes1
answer724
viewsQ: Replace space with new powershell line
How is it possible to run a file . bat that runs powershell to replace spaces with a new line? I currently have this scenario in the file run.bat: set id=1 powershell "(gc %id%_01.txt) -replace…
-
2
votes2
answers130
viewsQ: Set variable with highest existing number in file
I have a file named "list.txt" with the content below: 1 10 1000 333 46 4611116 498 I need to create another file, called "Lista2.txt" ordered from the largest to the smallest using a batch file. I…
-
1
votes1
answer37
viewsQ: Replace random text between two known strings
I need to replace a random text between two fixed strings in a database created by Wordpress. Database: "database" Table: "wordpress_posts" Field: "post_content" ID: "6450" For example, I have the…
-
1
votes1
answer113
viewsA: Use call only in batch files containing expressions from another file
Try this: set "File2Read=falhou.txt" set "File3Read=call.txt" If Not Exist "%File2Read%" (Goto :Error) rem This will read a file into an array of variables and populate it setlocal EnableExtensions…
-
3
votes3
answers808
viewsA: How to calculate the difference between the server time and the user’s computer?
It may not be the best solution, but the simplest way I could find to use PHP within Javascript as the goal of your question, would be that way: <?php…
-
0
votes1
answer322
viewsQ: 301 conditional forwarding by IP to another domain
I would like to redirect all users who access a particular page from one domain to the same page from another domain, except myself, I thought of using conditional IP forwarding from next way…
-
0
votes1
answer1271
viewsQ: Rename files in a directory using names already defined through PHP
I need to rename over a thousand files with the . bmp extension located in a "screen" directory". The files to be renamed follow this logic "2017-08-06 19-29-58.bmp", "2017-08-06 19-29-59.bmp",…
-
2
votes1
answer1360
viewsQ: Start command with special characters (CMD)
I am creating a batch file that executes this command: start jogo.exe user:USUARIO pwd:SENHA The above command causes a character to automatically enter a given game. The command works perfectly if…
-
2
votes1
answer759
viewsQ: How to add a value to the current in each row of a mysql table?
I have the following table in a mysql database: I would like a command to run in phpmyadmin, which sums the current value of the rating_sum column with 5, and rating_count with 1, thus leaving: I…
-
0
votes0
answers329
viewsQ: Javascript function is not loaded with onload, but is with onclick
On the page I’m developing I have this code that starts the menu of the site <section id="yt_menu" class="block" style="visibility:hidden"> I’m using visibility:Hidden to leave the menu hidden…
-
1
votes2
answers1048
viewsA: SQL Replace when some variable contains semicolons
I managed using command below: UPDATE `tabela` SET `estilo` = 'class="text3"' WHERE `estilo` LIKE 'class="text3" style="width:120px;text-align:center;"' The error only appears if you click on…
-
1
votes2
answers1048
viewsQ: SQL Replace when some variable contains semicolons
I am using this command smoothly to replace class="texto1" for class="texto2": UPDATE tabela SET estilo = REPLACE (estilo,'class="texto1"','class="texto2"') WHERE estilo LIKE 'class="texto1"'; It…
-
0
votes1
answer946
viewsQ: Update a PHP variable within a Javascript function
I am using the following code to display the current server time: <p id="demo"></p> <script> function segundoAtual() { var n = <?php…
-
0
votes1
answer62
viewsQ: Javascript function is only working with 1 or 2 variables
I am using the following code to check if a radio is selected, if you are, to perform such a function: <script language="javascript"> document.onclick = function setFries() { var apc =…
javascriptasked Wesley 203 -
3
votes2
answers206
viewsQ: Is it possible to optimize this javascript code?
I’m making a page that works as a GPS for a character in a given game. The content of the page is nothing more than a map with a marked path, and 240 images superimposing this map to "mark" the…
javascriptasked Wesley 203 -
1
votes1
answer520
viewsQ: Display image according to time by repeating javascript function
I am using this code to display two images on a given page: <!DOCTYPE html> <!DOCTYPE html> <html> <head> <style> #mapinha { position: relative; top: 0; left: 0; }…
-
0
votes2
answers597
viewsQ: Rename files with random names using php
I need to rename, randomly, all files with the extension . gif in a directory. I managed, using the following code: $nome = substr(hash('md5',time()),0,10); foreach (glob("*.gif") as $arquivo) {…
-
0
votes1
answer543
viewsA: Display contents of the <title> tag of the current page using PHP
Hello, I was able to solve the problem of slowness by changing the request made by the above mentioned codes as follows: <?php $option = JRequest::getCmd('option'); $view =…
-
-1
votes1
answer543
viewsQ: Display contents of the <title> tag of the current page using PHP
Hello, I would like a help to modify the code below: <?php function page_title($url) { $fp = file_get_contents($url); if (!$fp) return null; $res =…
-
-1
votes2
answers2243
viewsA: Google Maps does not load correctly
Good night. On the page that is working found in the code, the div that displays the map: Already on the pages that are showing the error, I did not find this part in the code. Have you checked if…
-
2
votes2
answers498
viewsA: Add text to input (virtual keyboard)
I was able to use javascript to add the value of the button to the field set to id="user_password": function moveNumbers(num) { var txt=document.getElementById("user_password").value; txt=txt + num;…
-
1
votes1
answer724
views -
1
votes1
answer5235
viewsA: read pdf files with php directly in the browser
<?php $file = './path/to/the.pdf'; $filename = 'Custom file name for the.pdf'; /* Note: Always use .pdf at the end. */ header('Content-type: application/pdf'); header('Content-Disposition:…
-
1
votes1
answer69
viewsQ: Select something that contains brackets in the name in a Javascript function
Good night. I am trying to use this javascript code to display the "value" of a "radio" in a form: document.userForm.onclick = function(){ var radVal = document.userForm.[rads].value;…
-
0
votes2
answers229
viewsQ: Unlink command is not working if enabled via include
I am using a file in the main directory of the site, with the following code: <?php $diretorioFuncoes = $_SERVER['DOCUMENT_ROOT']."/buscar"; // Dir dos arquivos $arrayExcecoes = array(); // *…
-
1
votes1
answer157
viewsQ: Insert the result of a query into a php file
I need to create a . php file with the results that appear accessing another . php file, for example: I access http://localhost/.php files and this page results me to lists of existing files on a…