php – $ .getJSON in JQUERY gives me an empty result. How does JSON really work?

I have recently posted a question regarding this topic. I leave the link LADY CLICK. However, I do not find the way $ .getJSON I generate a result.


WHAT I WANT? to know how to make $ .getJSON show me the result of
a php


Using $ GET does not cause me any problem. It shows me the result of my search that I have in a php file.

My php is the following:

This php is translated by:

{"name_activity": "Programming and development", "status": "Completed", "hours": "160 hours", "date": "march 02", "compliance": "With deadlines", "name": "Jonathan", "pro": "Digital Platform"} {"name_activity": "FEED BACK", "status": "In progress", "hours": "80 hours", "date": "Marz 15 "," compliance ":" Pending "," name ":" Jonathan "," pro ":" Digital Platform "} {" name_activity ":" Publishing "," status ":" Waiting "," hours ":" 80 hours "," date ":" March 30 "," fulfillment ":" standby "," name ":" Jonathan "," pro ":" digital platform "} {" activity_name ":" programming " and development "", "status": "Completed", "hours": "160 Hours", "date": "02 of Marz", "compliance": "With deadlines", "name": "Judith", " pro ":" Digital Platform "} {" name_activity ":" FEED BACK "," status ":" In progress "," hours ":" 80 hours "," date ":" March 15 "," compliance " : "Pending", "name": "Judith", "pro": "Digital Platform"} {"name_activity": "Publication", "st atus ":" Waiting "," hours ":" 80 hours "," date ":" 30 of Marz "," compliance ":" Waiting "," name ":" Judith "," pro ":" Plate " "} {" name_activity ":" Vendor Selection "," status ":" Completed "," hours ":" 48 hours "," date ":" February 02 "," compliance ":" Success ", "name": "Jonathan", "pro": "Opening of a store in Paris"} {"name_activity": "Advertising", "status": "In progress", "hours": "80 hours" , "date": "March 15", "fulfillment": "pending", "name": "Jonathan", "pro": "store opening in Paris"} {"name_activity": "events"; opening "," state ":" Waiting "," hours ":" 80 hours "," date ":" March 30 "," accomplishment ":" Waiting "," name ":" Jonathan "," pro " : "Opening store in Paris"} {"activity_name": "Selection of suppliers", "status": "Completed", "time": "48 hours", "date": "February 02", "conformity": " Successful "," name ":" Judith "," pro ":" Opening of a store in Par is "} {" name_activity ":" Advertisement "," status ":" In progress "," hours ":" 80 hours "," date ":" March 15 "," fulfillment ":" pending "," name " ":" Judith "," pro ":" opening store in Paris "} {" name_activity ":" opening events "," status ":" Waiting "," hours ":" 80 hours ras " , "date": "March 30", "fulfillment": "pending", "name": "Judith", "pro": "store opening in Paris"}

My Get works perfectly.

$ (document) .ready (function () {

$ .get ("pruebauno.php", function (r, xmr) {

$ ("# todo5"). html (r)}

However, using get.JSON does not work for me. It does not give me any value. I put the following code

I want to know how to use getJSON code.

A community person recommended me to modify the php in the following way, but no results are displayed

php – am I missing vulnerabilities in the code

Your code is wide-open SQL Injection, which is the most dangerous Web vulnerability. This occurs when you run SQL queries with unauthenticated user data. By placing the crude $ _POST variable directly in your request, you allow an attacker to inject his own SQL code into your query and execute it. They can do everything from data theft to the removal of your database.

To combat this, you must use parameterized queries. Stack Overflow covers this very well, but here's what your code would want if you use mysqli with prepared statements:

$ stmt = $ dbConnection-> prepare (SELECT * FROM users WHERE email =?);
$ stmt-> bind_param (& # 39; s, $ email); //'s & # 39; s & # 39; s & # 39; specifies the type of variable => & # 39; string & # 39;

$ stmt-> execute ();

$ result = $ stmt-> get_result ();
$ row = $ result-> fetch_assoc ();

You are also very open to cross-site scripting (XSS) attacks, which are the # 7 web vulnerability. This happens because you are taking raw $ _POST data and output directly into your HTML code. An attacker can place malicious code in this value and attack your users and your site once it is rendered by the browser.

When outputting user data, always escape this data. Stack overflow also covers this. In PHP, you can do it using htmlspecialchars ().

You will notice that one $ _POST variable, $ _POST['email'], left your site open to attack. Before even trying to use it, you must validate that it is a valid email address. If this is not the case, you must report an error and not attempt to use it as it is obviously invalid and unnecessary anyway.

PHP offers an easy way to validate an email address. filter_var () with the FILTER_VALIDATE_EMAIL flag will validate if an email address is valid.

$ email = $ _POST['email'];
if (! filter_var ($ email, FILTER_VALIDATE_EMAIL)) {
// The email is invalid. report an error and give up.

On a different note, you start your script by checking if a user is an administrator. If they are not you use on your mind() redirect outside this page. This is usually normal, but you should follow it by calling exit() to make sure the script stops running. If this is not the case, the code below can still run and, associated with other vulnerabilities on the page, expose you to attacks.

if ($ _SESSION['admin'] ! == true) {
header (& # 39; Location: /login.php?');

php – The button link changes when selecting an item from the drop-down list

  1. In the drop-down list, you have your articles
  2. Each element has a function: Change the link of a button
  3. When you select an item from the drop-down list, the button's link changes
  4. For example: Extension 01 -> Link 01, Extension 02 -> Link 02, etc.

The idea is to make a form for the visitor to select an item, see the price of the item and clicking the button is sent to the payment link of the product:


The conditional element that indicates that the value is optional

php – WordPress member notification

I'm trying to implement a function to inform users of changes made to the web page. I've tried using sessions for this, but it did not work very well. For example:

A user can attend an event. To do this, he must register. The status of his registration is therefore "pending" at this time. In the backend, I can accept his registration and change the status to "accepted". Now, I want the user to see a notification on his dashboard that he has been accepted.

For this, I use his last login date. I check if the status modification date was after its last login date. The registration_notifications value is stored in a wp_session variable. It works without problems. If the user opens the page with the list of their entries, this wp_session variable is reset. And here is the problem:

If I now change the status of a second record of the same user, the notification is not displayed.

My codes:

the function to get notifications:

if (! isset (wp_session['event'])) {
wp_session['event']= $ wpdb-> get_var (SELECT COUNT ..... change_date> last_login_date);

Show notifications:

if (wp_session['event']! = - 1) {echo wp_session['event']}

change session on the preview page:

wp_session['event']= -1;

I have to change the code in order to be able to recognize if there has been a change in the amount of notifications while the user was already online. But I could not understand how to do this in the best way.

Thank you in advance.

jQuery – Enable and disable the button in php

I have this edit button that is always available for editing:


I wanted it to be active only when a new record is created in the database table and at midnight on the same day it was again disabled and as soon as it is active, it only allows you to edit the new record inserted, in old records that are still active or hidden.

Migrate the old PHP to modern .NET

With, you can easily migrate existing PHP to the fast, secure and robust .NET Core platform. PeachPie is a compiler and runtime of PHP under .NET and .NET Core.



php – Retrieving Custom Publication Type Data with Custom Toxicity

Battery Exchange Network

The Stack Exchange network includes 174 question and answer communities, including Stack Overflow, the largest and most reliable online community on which developers can learn, share knowledge and build their careers.

Visit Stack Exchange

magento2 – In app / code / User / Customdata / Block / Adminhtml / User / Edit / Tab I have created 3 additional php files in this tab

In app / code / User / Customdata / Block / Adminhtml / User / Edit / Tab, I created 3 additional php files in this tab.

I want to call all the files in the Main.php file as a modification in Admin. but the file is called and the data also appears, but when we submit form data, only one main file data post. I want 2 more post data files with this data.
Note: 3 file data from 3 different tables.

If I put everything in single file then
how to define shape data
$ form-> setValues ​​($ model-> getData ());

                $ form-> setValues ​​($ models-> getData ());

$ this-> setForm ($ form);

here only last ($ form-> setValues ​​($ models-> getData ());) dataset. but I want to settle these two
$ form-> setValues ​​($ model-> getData ());

$ form-> setValues ​​($ models-> getData ());

php – Adds a variable in the URL so that the user is redirected

Hi everybody How are you?

So I develop a prototype for my startup and I end up having some difficulties.

I use WordPress and, basically, the user will have access to a series of offers after registering / logging onto the platform.

By clicking on one of these offers, the user is redirected to the partner site with a tracking link in order to be able to identify that we are the ones who generated this traffic.
Example of a link followed by the partner: ""

The question is: we must also identify to whom the user is redirected. To do this, we need to add a unique parameter and identifier for each user.

O.B.S: This parameter (zpar0 =) is standard, you must always repeat … the identification that must be unique for each user.

I've used PHP to retrieve information from the logged-in user (user name + cpf)

O.B.S: "um_user" is something specific to the member plugin I'm using.

I'd now like to know how to add this variable "$ id_unico" in the URL, when the user clicks on the company's image and is redirected.

I started taking basic web development courses and I study the subject, but I am still very profane. Your help will help me SO MUCH.

thank you so much

php – How to create a social media site like Facebook and Twitter without planting servers?

In order for Twitter and Facebook to send a tweet / message to all members of the subscriber list, whenever someone publishes something, this post must be added to each subscriber's feed. This can be done in PHP with "write" or "put_contents". The problem is that when a person has 1 million followers, the servers must write to 1 million different files / streams each time someone tweets or posts a message.

My question is this: to create a social networking site that works like Twitter and Facebook, do I really have to send the message to every subscriber, even if there are one million subscribers? Is that how Facebook and Twitter do it, or is there a better way I do not know? And if that's how they do it, have they just started their business with the most incredible and inaccessible servers and is there no way for the average person to possibly make as many actions on a base server?

I think I know how to code a site like Twitter and Facebook, I just could not imagine that servers can perform these tasks without crashing. Thoughts?