Questions tagged as 'php'

5
answers

Is it safe to use $ _GET in PHP? (URL parameter)

In the past it was very common to visit web pages and see the URL parameters being passed right there, on the # My question is: Is it still safe to use parameters in the url? If not then why is it still used on "famous" sites? Exam...
asked by 30.06.2015 / 14:55
3
answers

What is the integer argument in exit?

In PHP, when we want to terminate a script, we usually use the exit function. When we use strings, it terminates the script and prints this string . Example: exit('Stack Overflow'); // Stack Overflow However, if we use a val...
asked by 31.07.2015 / 17:22
5
answers

When is it necessary to use ISSET?

I would like to know when it is really imperative to use isset in PHP variables, especially in the case of forms. What happens is that I'm creating a large form, with some 200+ fields, that will perform calculations and other functions...
asked by 14.04.2015 / 17:26
4
answers

Array of SQL conditions - PHP

Good afternoon, I am sending a search filter for my DB, and I want to make these conditions within an array, for example: $condicoes = array(); $nome = $_GET['nome']; if (!empty($nome)) { $condicoes = ("nome" => $nome); } $tipoAnimal =...
asked by 04.09.2014 / 21:23
3
answers

What is the advantage of using array include vs configuration file?

I have observed some codes where the programmer does the following: /** Arquivo A.php */ return array('databaseName' => 'bancoTeste', 'port' => 5208); /** Arquivo B.php */ $configs = include("A.php"); // Acesso as $configs echo $confi...
asked by 11.02.2015 / 12:15
3
answers

How to create a function to validate time in PHP

I'm trying to validate a time field in PHP, and with the help this topic on an external site I came across this script: function validaHoras($campo){ if (preg_match('/^[0-9]{2}:[0-9]{2}$/', $campo)) { $horas = substr($campo, 0, 2...
asked by 21.04.2017 / 21:43
4
answers

Some way to get the price of the dollar

Do you know of any api or other php way to get the price of the dollar? I just need the price of the dollar for the real thing. I've tried these two api's, but the two are off the air. link link Thank you!     
asked by 06.03.2017 / 15:30
1
answer

How to get only the domain of a URL?

The domain is not the localhost . If the user types a link, for example, http://exemplo.com/pasta/pasta2/past/ficheiro.php , I want PHP to return only this part of url exemplo.com     
asked by 22.01.2017 / 23:57
4
answers

Decrease field value span with preg_replace

I'm trying to change all the values of fields containing span class . Example the site looks like this: <div id="isOffered"> <a class="price addBetButton footballBetButton" id="bk_82285689_mk_sel1" href=""> <span...
asked by 23.02.2015 / 01:56
4
answers

Upload with Ajax and formData does not send data

I have a problem and I can not solve it, I'm trying to upload via ajax and php , I already got some tips here for SO , but I still have problems and I know the big chance of doing something bullshit is great. I'll try to show....
asked by 01.02.2017 / 13:06