123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596 |
- <?php
- $servername = "localhost";
- $username = "put_username";
- $password = "put_password";
- $dbname = "db_ifractions";
- $tablename = "ifractions";
- function remove_accents ($stripAccents) {
-
- return $stripAccents;
- }
- function clientIP () {
- if (getenv("HTTP_CLIENT_IP"))
- $ip = getenv("HTTP_CLIENT_IP");
- elseif (getenv("HTTP_X_FORWARDED_FOR"))
- $ip = getenv("HTTP_X_FORWARDED_FOR");
- elseif (getenv("REMOTE_ADDR"))
- $ip = getenv("REMOTE_ADDR");
- $strIP = $ip;
- $resp = gethostbyaddr($ip);
- if (isset($resp) && strlen($resp)>0) {
- $strIP .= "; " . $resp;
- }
- return $strIP;
- }
- $conn = new mysqli($servername, $username, $password, $dbname);
- if ($conn->connect_error) {
- die("Connection failed: " . $conn->connect_error);
- }
- $ip = clientIP();
- $name = $_REQUEST["line_name"];
- $date = date("Y-m-d H:i:s");
- $lang = $_REQUEST["line_lang"];
- $game = $_REQUEST["line_game"];
- $mode = $_REQUEST["line_mode"];
- $oper = $_REQUEST["line_oper"];
- $leve = $_REQUEST["line_leve"];
- $posi = $_REQUEST["line_posi"];
- $resu = $_REQUEST["line_resu"];
- $time = $_REQUEST["line_time"];
- $deta = $_REQUEST["line_deta"];
- $nameUnchanged = $name;
- $name = remove_accents($name);
- if (is_object($lang))
- $lang = json_decode($lang);
- $sql = "INSERT INTO $tablename
- (line_hostip, line_playername, line_datetime, line_lang, line_game, line_mode, line_operator, line_level, line_mappos, line_result, line_time, line_details)
- VALUES
- ('$ip', '$name', '$date', '$lang', '$game', '$mode', '$oper', $leve, $posi, '$resu', $time, '$deta')";
- if ($conn->query($sql) === TRUE) {
- print "Saved.";
- $result = "OK";
- } else {
- print "Error: " . $sql . "<br>" . $conn->error;
- $result = "Error: " . $conn->error;
- }
- $date = date('Y_m_d_H_i_s');
- $fp = fopen('../temp/file_' . $date . ".txt", 'w');
- fwrite($fp, "name_unchanged=" . $nameUnchanged . ", name=" . $name . "\n" . $sql . "\nResultado: " . $result);
- fclose($fp);
- $conn->close();
- ?>
|