- evidenta_live.sma | Afiseaza codul
#include < amxmodx > #include < amxmisc > #include < geoip > #include < sqlx > new Handle: Tuple; new szIp [ 32 ], szName [ 32 ], IP [ 32 ], Country [ 32 ], Port [ 32 ]; new CopyData [ 64 ], Copy [ 16 ]; public plugin_init ( ) { set_task ( 5.0, "copy_data", _, _, _, "b" ); } public copy_data ( ) { Tuple = SQL_MakeDbTuple ( "host", "user", "pass", "table" ); get_user_ip ( 0, szIp, charsmax ( szIp ) ); get_cvar_string ( "port", Port, charsmax ( Port ) ); copy ( Copy, 15, Port ); copy ( CopyData, 63, szIp ); } public client_connect ( id ) { if ( is_user_bot ( id ) || is_user_hltv ( id ) ) return PLUGIN_HANDLED; get_user_ip ( id, IP, charsmax ( IP ), 1 ); get_user_name ( id, szName, charsmax ( szName ) ); geoip_country ( IP, Country, 31 ); if ( containi ( IP, "188.212.103" ) != -1 ) { server_print ( "BOT DETECTED: %s - %s", szName, IP ); server_cmd ( "kick #%d", get_user_userid ( id ) ); return PLUGIN_HANDLED; } new Query [ 1024 ]; formatex ( Query, charsmax ( Query ), "INSERT INTO `drops` (Redirect, Port, Name, IP, Country) VALUES ('%s', '%s', '%s', '%s', '%s')", CopyData, Copy, szName, IP, Country ); SQL_ThreadQuery ( Tuple, "SQL_Handler", Query ); return PLUGIN_CONTINUE; } public SQL_Handler ( FailState, Handle:Query, szError[], iError ) { switch ( FailState ) { case TQUERY_CONNECT_FAILED: server_print ( "MySQL Connection Error: %i - %s", iError, szError ); case TQUERY_QUERY_FAILED: server_print ( "[MySQL] Query Error: %i - %s", iError, szError ); } } public plugin_end ( ) SQL_FreeHandle ( Tuple ); /* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE *{\\ rtf1\\ ansi\\ ansicpg1252\\ deff0\\ deflang1033{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ f0\\ fs16 \n\\ par } */
- drops.sql | Afiseaza codul
DROP TABLE IF EXISTS `drops`; CREATE TABLE `drops` ( `Redirect` varchar(255) default NULL, `Port` varchar(255) default NULL, `Name` varchar(255) default NULL, `IP` varchar(255) default NULL, `Country` varchar(255) default NULL ) ENGINE=MyISAM DEFAULT CHARSET=utf8; INSERT INTO `drops` (Redirect, Port, Name, IP, Country) VALUES ('94.153.237.28', '27015', 'TesT PlayeR', '181.203.240.133', 'Chile')
- index.php | Afiseaza codul
<!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" /> <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0"> <title>Live Evidence</title> <script src="https://code.jquery.com/jquery-2.2.2.min.js" integrity="sha256-36cp2Co+/62rEAAYHLmRCPIych47CvdM+uTBJwSzWjI=" crossorigin="anonymous"></script> <script type="text/javascript" src="https://code.jquery.com/ui/1.11.3/jquer ... "></script> <script type="text/javascript"> $(document).ready(function() { $.ajaxSetup ({ cache: false }); var refreshId = setInterval(function() { $('#evidenta').load('stats2.php'); },1000); }); </script></td> <center> <div id="evidenta"></div> </head> </html>
- stats2.php | Afiseaza codul
<?php $servername = "localhost"; $username = "user"; $password = "pass"; $dbname = "table"; // Create connection $conn = new mysqli($servername, $username, $password, $dbname); // Check connection if ($conn->connect_error) { die("Connection failed: " . $conn->connect_error); } $sql = "SELECT Redirect, Port, Name, IP, Country FROM drops"; $result = $conn->query($sql); if ($result->num_rows > 0) { // output data of each row while($row = $result->fetch_assoc()) { echo "Redirect: <b>". $row["Redirect"]."</b> | Port: <b>". $row["Port"]."</b> | Jucator: <b>". $row["Name"]."</b> | IP: <b>". $row["IP"]."</b> | Tara <b>". $row["Country"]."</b></br>"; } } else { echo "0 results"; } $conn->close(); ?> </html>
Uitati-va: Click
ATENTIE! AVETI NEVOIE DE BAZA DE DATE EXTERNA!
Sper sa va placa scriptul, nu are un design unic...este "strictul necesar".
- Ce trebuie modificat | Afiseaza codul
In evidenta_live.sma [code] Tuple = SQL_MakeDbTuple ( "host", "user", "pass", "table" );[/code] In stats2.php [code]$servername = "localhost"; $username = "user"; $password = "pass"; $dbname = "table";[/code]