How to connect the form to Donat on the minecraft server?

Hi all. I do the front, but not back.
The situation is this: There is the usual form, Nick + choice of donation. The server is preinstalled Donat, I need to bind this form with a minecraft server, and the actual enrollment Donati, php and Mysql know on a basic level, can tell me what to read or any info about it? Thank you.
April 18th 20 at 13:09
1 answer
April 18th 20 at 13:11
Solution
Hello.
He was engaged in this topic not so long ago.
Firstly, you have not specified what plugin you use for the rights.
Personally, I'm for this type prefer to use LuckyPerms. It is for this purpose more suitable.
Of his cons - no ability to edit the file in PermissionEX. In any case, you need a DB connection. It is possible for the database in the file (so the default) and MySQL (Our option).
After connecting to database, reboot the server. MySQL will automatically appear in the right table. On the complete configuration of this plugin very a lot of articles on the Internet.
Then you get the data from the form. For this purpose it is preferable to use AJAX.
Your main file and shape:
var nickname = document.getElementById(" ID of the input field nick ").value;
var permission = document.getElementById(" ID of the input field privileges ").value;

$.get('get_donate.php', {nick: nickname, perm: permission}).done(function(data)) {
 if (data=="ok") {
 alert("Payment successful");
 } else {
 alert("an error Occurred");
}
});

File get_donate.php:
$nick = $_GET['nick'];
$perm = $_GET['perm'];

// Here you get the user's balance
if ($balance >= /* Value */) {
 // Make the purchase
 // Write off balance
 // Give the privilege
 echo 'ok';
} else {
 echo 'error';
}


Explain a little more about the issue of privilege. All user privileges are stored in a separate MySQL table.

The structure of the table (names are approximate, can't remember exactly):
- UserID - UserName - Parent -

UserName - the player's name, always lowercase. I.e. if the user's nick UsER123, in this table it will be recorded as user123. I hope it is clear.
And, since all the privileges are stored in one table, you can change the privileges of a regular UPDATE query.

If something is not clear - write. I will try to answer all your questions.
Hi, very helpful your answer is, you are a genius! I spent the whole day killed on search of the necessary information, and then in the same article found almost everything needed, thank you very much. But I have a little question for how to write a command in php that it automatically performed the UPDATE query in the database after a certain amount of time? Suppose a man buys the privilege of a month, and I need a month from him to pick up. I apologize in advance if my question is stupid or ill-defined, only began to engage in such - Nikki91 commented on April 18th 20 at 13:14
@Nikki91, hi to contact you? - yolanda_Hoeger35 commented on April 18th 20 at 13:17
@yolanda_Hoeger35, of course, where it will be easier? Mail or some messenger? - Nikki91 commented on April 18th 20 at 13:20
@Nikki91, Glad I could help)
I think the best solution will be crowns. Every day, for example, in 12 days, Kron will take place for all users.
When the original results, you need to write the date when the donation is withdrawn. The script called Kron will see today at that time and date to set the privilege on default. - janelle.Schoen23 commented on April 18th 20 at 13:23

Find more questions by tags BackendMySQLPHP