Posts by Leonardo • 9,130 points
332 posts
-
2
votes2
answers635
viewsA: How to know the key of the 3 greatest results array?
You can do it like this: <?php $qtd = array( 'acao' => 10, 'aventura' => 15, 'comedia' => 20, 'drama' => 15, 'faroeste' => 18, 'ficcao' => 10, 'suspense' => 14, 'terror'…
-
0
votes1
answer111
viewsQ: Mysql Connector sending null value
I have the following code: MySqlConnection mysql = new MySqlConnection(CONEXAO); mysql.Open(); try { MySqlCommand dbcmd = mysql.CreateCommand(); dbcmd.CommandText = "INSERT INTO robos…
-
1
votes1
answer491
viewsQ: Tools and tests to improve a system’s security?
Hello, researching a little on the subject of security, I was in doubt if there is a tool that tests the security of a PHP system, trying to apply various forms of invasion in the system. 'Cause I…
-
1
votes3
answers996
views -
3
votes3
answers996
views -
0
votes1
answer496
viewsQ: Open www with Apache2
Use the Elementary OS, and I have a virtual machine Windows, I want the Windows can access the websites of Apache2 installed on Linux, my local network is already configured, from Windows can give…
-
6
votes7
answers65838
viewsA: How to run a C program in Visual Studio Code
Visual Studio Code is a text editor, not an IDE, without a compiler. You can compile from the terminal (whether you use Linux or Mac): gcc -o executavel main.c
-
0
votes1
answer1005
viewsA: No data was sent by server
After trying so hard, I was blacked out the class Migration and created only one __construct, so it worked, then I came back with the contents of the whole class and added a __construct empty in…
-
0
votes1
answer1005
viewsQ: No data was sent by server
When trying to access my route default in the browser is shown the error of the browser itself, in the case of Opera: The dev.local page is not working No data was sent by dev.local In the case,…
-
0
votes1
answer161
viewsA: Count lines with PHP and JS (Different)
From what I understand, in Javascript would be like this: $(function() { var quantidade1 = document.getElementById('reprovados').children.length; var quantidade2 =…
-
1
votes1
answer134
viewsA: Check if there is value of an array element
Change: if (empty($array_v_p[1]) !== (string) null) For: if ( isset($array_v_p[1]) and !empty($array_v_p[1]) ) That is, if the element exists AND if it is not empty.…
-
0
votes2
answers495
viewsA: How to add multiple items in $paymentRequest->addItem?
The only way I see is to have a class for Pay Insurance, because each item must have its own addItem. I will illustrate with a generic class, other than the Insurance Payment: <?php class…
-
0
votes2
answers400
viewsA: I need my php function to be recursive
The only way I could find to do something recursive was this: <?php function mostraArray($array) { $string = ''; foreach($array as $value) { $string .= "{$value}, "; } return mb_substr($string,…
-
0
votes1
answer695
viewsA: Run Java program with PHP and return Console Output
Basically it would be like this: <html> <head> <meta charset="utf-8" /> <title>Java Execute</title> </head> <body> <form action="#" method="post">…
-
3
votes2
answers480
viewsA: Single vs. Double Quotes in PHP Regex
Using single or double quotes comes from the PHP language, usually their characteristics are: Double quotes: a little slower as it tries to process data reads variables enter it, example: "hi $name"…
-
1
votes1
answer113
viewsA: Link friendly with htacess
Normally I separate the URL into two parts, the first being the site url and the second all parameters, after that I use a file dispenser, whose function is to separate the parameters received by…
-
1
votes1
answer589
viewsA: Editable line with PHP and Javascript
I could not understand very well, the question seems broad. But from what I understand, you have a line, when you click on it it looks like an input to change or save the item in the database. The…
-
2
votes1
answer28
views -
3
votes1
answer101
viewsQ: Identify if and endif with regex?
In an example of the OS found: <?php $a = 22; $b = 33; $template = ' [if $b>0 ] B > 0 [/if]'; // IF - ENDIF preg_match_all('/\[if(.*?)\][\s]*?(.*)[\s]*?\[\/if\]/i', $template, $regs,…
-
0
votes1
answer133
viewsQ: Autoload controllers using namespace
I’m trying to give a restructured in a personal microframework, before not used much standard in the structure of the project, now I played all my back-end in the folder source, and I’m using…
-
3
votes2
answers4904
viewsA: Video call / video conference in PHP
With the reply of @Lauromoraes I had a broader field of research and I ended up discovering the Peerjs, which is their own Javascript library. On their website they have a simple video example…
-
0
votes1
answer901
viewsQ: Check if dictionary is null or empty?
In a return of a method I have a resulting dictionary, sometimes it may come empty, hence I’m having trouble identifying when it is empty or not. for(var i = 1; i <= this.last; i++) {…
-
-2
votes2
answers4904
viewsQ: Video call / video conference in PHP
I am searching on the subject to use in my TCC, as I perform videos called using PHP or similar language? I’ve searched through a number of terms and I haven’t been able to find any relevant…
-
0
votes2
answers112
viewsQ: Does the back-end language change the way an application is developed?
I have a project where I need to build a hybrid application using a back-end in Delphi. But before embarking on the project I need to ask some questions, because I never worked with Delphi. Normally…
-
-1
votes1
answer934
viewsQ: System with URL friendly get return in query string
I’m having a problem with the return url of Paypal, my system has the concept of URL friendly for example: http://outros.local/vendas/carrinhos/finalizada But with the return of Paypal the URL is…
-
1
votes3
answers1027
viewsA: How to find out how long an audio is in PHP?
I found a class in the Github specified for this, is one of the lightest I found. An example for using: <?php // passa arquivo mp3 para classe $mp3file = new MP3File("path_do_mp3"); // Pega…
-
0
votes2
answers207
viewsA: Error when instantiating two or more PDO in different classes
The error was not in the instantiation of PDO as I found (because in the searches all results spoke this same problem), and yes because it was storing a array of objects in a session variable, even…
-
0
votes2
answers207
viewsQ: Error when instantiating two or more PDO in different classes
I will start with the error displayed: Fatal error: Uncaught Pdoexception: You cannot serialize or unserialize PDO instances in [no active file] on line 0 In the project I have the class Carts and…
-
2
votes1
answer1627
viewsQ: Working with Windows Forms as designer on Linux?
On Linux (Ubuntu) it is possible to create applications with Windows Forms in the Mono or similar, using a designer such as the Visual Studio? I am facing problem because I need to develop with…
-
0
votes1
answer700
viewsQ: Use Ionic 2 for Windows Phone/Windows Universal apps?
It is a recent doubt that I have, I intend to start development with the Ionic, but as my main platform is the Windows Phone, I want to know if the framework gives compilation support for the…
-
4
votes2
answers3495
views -
1
votes2
answers621
viewsA: Pick up all hours that are between start time and end time with PHP
I have no PC to test, but so it should roll: <?php $start = '08:12'; $end = '15:30'; $st = explode(':', $start); $ed = explode(':', $end); for($hour = $st[0]; $hour <= $ed[0]; $hour++) {…
-
1
votes2
answers1419
viewsA: Place table column value in an input
Follows the answer: <!doctype html> <html> <head> <meta charset='utf-8' /> <title>Example Table Jquery</title> <link rel='stylesheet'…
-
3
votes1
answer1855
viewsA: Submit form to a php script and open a modal as soon as it is submitted
I believe that the expected result can come with AJAX, I did not understand the doubt very well, and it does not have the modal code but I will illustrate. In giving submit in the form you will send…
-
0
votes1
answer413
viewsA: Bootstrap - Class . table-Striped does not work properly within a while
You’re confusing opening tag with closing. To open a tag is used <tag> and to close </tag>. In your code you were closing a tag and then opening, as in the snippet: </tr>…
-
1
votes1
answer435
viewsQ: Route results in 404 Not Found
I was following the Codeigniter startup tutorial when I came across a problem with routes. the route file is with the following routes: $route['404_override'] = ''; $route['translate_uri_dashes'] =…
-
1
votes1
answer415
viewsA: How to run a php file via a Switch Button with html and css?
You must request the file PHP via Ajax when changing the value of switch. You can use: <input id="switch-shadow" name="switch-btn" class="switch switch--shadow" type="checkbox"> And in the…
-
6
votes1
answer7852
viewsA: Automatic PHP friendly URL
Your .htaccess would look like this: DirectoryIndex index.php <IfModule mod_rewrite.c> RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule…
-
-1
votes2
answers1033
viewsA: How to generate pagination links with limits?
As the question is quoted that the answer should provide a solution for beginner users, so I tried to make the simplest example possible, with the simplest calculation I could think of. Step by step…
-
6
votes1
answer1689
viewsQ: Is it recommended to use PHP caching? How to use?
PHP caching is basically a cache created from your site to prevent it from being wasted searching for data with each page request. When a user accesses a page, is saved a copy of it in HTML on the…
-
2
votes1
answer83
viewsQ: Disable Composer require with php
I have an example of JSON: { "name": "xxxxxx", "description": "xxxxx", "type": "beta", "license": "MITS", "authors": [ { "name": "Leonardo Vilarinho", "email": "[email protected]" } ],…
-
3
votes2
answers526
viewsA: Convert php code to reply ajax
I cannot simply 'convert' the code to accept request ajax, because I don’t have all the code. But I will quote a simpler example of a form sending data by the ajax and taking this data in a script…
-
0
votes2
answers155
viewsA: $_post error do not know where I’m going wrong!
The variables $_POST are not defined, check in your form if the action and method are informed. Example: <form method="post" action="cadastro.php"> ... </form>…
-
6
votes1
answer4628
viewsQ: What is the difference between Sanitize and filter in PHP?
Making a safety class for PHP I noticed the existence of two similar constants, like: FILTER_SANITIZE_NUMBER_INT and FILTER_VALIDATE_INT. The standard follows in validations of email, string and…
-
9
votes1
answer315
viewsQ: What is the function of an open-source license? What are the main licenses?
I have researched and found little content in Portuguese on this, I do not know if I am looking for the right term for not knowing much of the subject. I have some questions about software licenses…
-
3
votes2
answers3157
viewsA: No ECHO error? Unexpected 'echo' (T_ECHO)
The correct syntax of if is: if(condição) { //código } And not with parentheses () how is the question.
-
1
votes2
answers849
viewsQ: Catch instance of daughter class
I have a class: class Children extends Database Soon, Children is the daughter class and Database the parent class, in the parent class I have the attribute: protected $object = null; The value of…
-
3
votes1
answer432
viewsA: receive form with var_dump
I didn’t test because mine php is not recognizing the filter_input, but so you must take: <?php // povoando post (para teste) $_POST['nome1'] = "o"; $_POST['nome2'] = "v"; $_POST['nome3'] = "e";…
-
6
votes2
answers3829
viewsQ: Take AUTO_INCREMENT value from a table
I want to take the last record registered in a database table, ie the value of AUTO_INCREMENT from the table, I tried using: SELECT MAX(id) as max FROM people It works, but if I have no record in…
-
9
votes3
answers3574
viewsQ: What are the functions of an ORM?
What actions a ORM should supply? What it should or should not provide to the developer, or what its role within a system?