Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- # Dati del database [Mysql]
- $db = [
- 'status' => true,
- 'user' => "USER",
- 'password' => "Password dell'utente",
- 'host' => "localhost",
- 'db_name' => "DB assegnato all'user"
- ];
- if ($db['status']) {
- try {
- $PDO = new PDO("mysql:host=".$db['host'].";dbname=".$db['db_name'], $db['user'], $db['password']);
- }
- catch(PDOException $e) {
- echo "Connection failed: " . $e->getMessage();
- }
- $fetch = $PDO->prepare("SELECT * FROM users WHERE user_id = ?");
- $fetch->execute([$Bot->user_id]);
- $f = $fetch->fetch(\PDO::FETCH_ASSOC);
- if($Bot->chat_id > 0 or $Bot->chat_id == $group) {
- if ($f['user_id'] != $Bot->user_id) {
- if (!$Bot->cognome) {
- $last_name = "";
- } else {
- $last_name = $Bot->cognome;
- }
- if (!$Bot->username) {
- $username = "";
- } else {
- $username = $Bot->username;
- }
- $insert = $PDO->prepare("INSERT INTO users (user_id, first_name, last_name, username, status) VALUES (?,?,?,?,?)");
- $insert->execute([$Bot->user_id, $Bot->nome, $last_name, $username, '0']);
- }
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement