-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathfunciones.php
More file actions
162 lines (132 loc) · 5.36 KB
/
Copy pathfunciones.php
File metadata and controls
162 lines (132 loc) · 5.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
<?php
function existeUsuario($usuario, $firstname, $userId, $messageId){
include 'config/conexion.php';
if(is_numeric($usuario)){
$usuario=mysqli_real_escape_string($conexion,$usuario);
$consulta="SELECT * FROM `jugadores` WHERE idUsuario='$usuario';";
}else{
$usuario=mysqli_real_escape_string($conexion,$usuario);
$consulta="SELECT * FROM `jugadores` WHERE nombre='$usuario';";
}
$datos=mysqli_query($conexion,$consulta);
if(mysqli_num_rows($datos) > 0){
}else{
$response = "⛔ $firstname no existe ningún jugador con ese nombre, intentálo más tarde cuándo lo sepas.";
sendDeleteMessage($userId, $messageId, $response, FALSE);
mysqli_close($conexion);
exit;
}
}
function revisarComandos($firstname, $userId, $messageId){
$response = "⛔ ¡$firstname utiliza /comandos para más información!";
sendDeleteMessage($userId, $messageId, $response, FALSE);
exit;
}
function comprobarRaza($message){
if($message == 'Informático' || $message == 'Informatico' || $message == 'informático' || $message == 'informatico'){
return TRUE;
}else if($message == 'Teleco' || $message == 'teleco'){
return TRUE;
}else if($message == 'Intruso' || $message == 'intruso'){
return TRUE;
}else{
return FALSE;
}
}
function confirmacion($userId, $peleasPosibles, $estado, $firstname){
if(($peleasPosibles == 15) && $estado == 0){
$numeroUno = rand(1,20);
$numeroDos = rand(1,20);
$suma = $numeroUno + $numeroDos;
$aleatorio = rand(0,1);
if($aleatorio == 1){
$numeroUno = numToText($numeroUno);
$numeroDos = numToText($numeroDos);
}
include 'config/conexion.php';
$usuario=mysqli_real_escape_string($conexion,$userId);
$consulta="UPDATE jugadores SET verificacion='$suma', estado=8 WHERE idUsuario='$usuario';";
mysqli_query($conexion,$consulta);
mysqli_close($conexion);
include 'config/conexion2.php';
$usuario2=mysqli_real_escape_string($conexion2,$userId);
$consulta2="UPDATE jugadores SET estado='0' WHERE idUsuario='$usuario2';";
mysqli_query($conexion2,$consulta2);
mysqli_close($conexion2);
$response = "❓ ¿$firstname serás capaz de pasar la prueba anti-bot? ¿Cuánto es $numeroUno + $numeroDos? Escribe la respuesta a continuación en números.";
sendMessage($userId, $response, FALSE);
exit;
}else if($estado == 8){
include 'config/conexion.php';
$usuario=mysqli_real_escape_string($conexion,$userId);
$consulta="UPDATE jugadores SET estado='0', estado_pelea='1', peleas_posibles='0', verificacion=0 WHERE idUsuario='$usuario';";
mysqli_query($conexion,$consulta);
include 'config/conexion2.php';
$usuario2=mysqli_real_escape_string($conexion2,$userId);
$consulta2="UPDATE jugadores SET estado='0' WHERE idUsuario='$usuario2';";
mysqli_query($conexion2,$consulta2);
mysqli_close($conexion2);
$response = "⛔ ¡Lo siento, $firstname! No has conseguido pasar la prueba anti-bot. ¡Te quedas sin luchas hasta la siguiente renovación.";
sendMessage($userId, $response, FALSE);
exit;
}else if($estado == 9){
include 'config/conexion.php';
$usuario=mysqli_real_escape_string($conexion,$userId);
$consulta="UPDATE jugadores SET estado='0' WHERE idUsuario='$usuario';";
mysqli_query($conexion,$consulta);
}
}
function numToText($numero){
switch($numero){
case '1': $texto='uno'; break;
case '2': $texto='dos'; break;
case '3': $texto='tres'; break;
case '4': $texto='cuatro'; break;
case '5': $texto='cinco'; break;
case '6': $texto='seis'; break;
case '7': $texto='siete'; break;
case '8': $texto='ocho'; break;
case '9': $texto='nueve'; break;
case '10': $texto='diez'; break;
case '11': $texto='once'; break;
case '12': $texto='doce'; break;
case '13': $texto='trece'; break;
case '14': $texto='catorce'; break;
case '15': $texto='quince'; break;
case '16': $texto='dieciseis'; break;
case '17': $texto='diecisiete'; break;
case '18': $texto='dieciocho'; break;
case '19': $texto='diecinueve'; break;
case '20': $texto='veinte'; break;
}
return $texto;
}
function sendDeleteMessage($chatId, $messageId, $response, $links){
sendMessage($chatId, $response, $links);
deleteMessage($chatId, $messageId);
}
function sendMessage($chatId, $response, $links){
if($links){
$url = $GLOBALS[website].'/sendMessage?chat_id='.$chatId.'&parse_mode=HTML&text='.urlencode($response).'&disable_notification=true&disable_web_page_preview=true';
}else{
$url = $GLOBALS[website].'/sendMessage?chat_id='.$chatId.'&parse_mode=HTML&text='.urlencode($response).'&disable_notification=true';
}
file_get_contents($url);
}
function deleteMessage($chatId, $messageId){
$url = $GLOBALS[website].'/deleteMessage?chat_id='.$chatId.'&message_id='.$messageId;
file_get_contents($url);
}
function sendPhoto($chatId,$urlphoto,$response){
if($response == ""){
$url = $GLOBALS[website].'/sendPhoto?chat_id='.$chatId.'&photo='.$urlphoto.'&disable_notification=true';
}else{
$url = $GLOBALS[website].'/sendPhoto?chat_id='.$chatId.'&photo='.$urlphoto.'&caption='.$response.'&disable_notification=true';
}
file_get_contents($url);
}
function sendSticker($chatId, $urlsticker){
$url = $GLOBALS[website].'/sendSticker?chat_id='.$chatId.'&sticker='.$urlsticker.'&disable_notification=true';
file_get_contents($url);
}
?>