Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- // xampp code fix
- ini_set("display_errors", "0");
- $cf_register_moreip = true;
- include_once "mysql.php";
- include_once "uuid.php";
- include_once "class/Utilities.php";
- include_once "config.php";
- function get_money_player($connect, $id_playerpoint, $mysql)
- {
- $fetch = mysqli_fetch_array(
- mysqli_query($connect, "SELECT * FROM {$mysql['database_playerpoints']}.playerpoints WHERE id='{$id_playerpoint}'")
- );
- if (mysqli_num_rows(mysqli_query($connect, "SELECT * FROM {$mysql['database_playerpoints']}.playerpoints WHERE id='{$id_playerpoint}'")) < 0)
- {
- echo "Không có tài khoản này!";
- return null;
- }
- return $fetch['points'];
- }
- function get_id_playerpoint($connect, $auth_id, $mysql)
- {
- $s = get_uuid_from_authme($connect, $auth_id, $mysql);
- $fetch = mysqli_fetch_array(
- mysqli_query($connect, "SELECT * FROM {$mysql['database_playerpoints']}.playerpoints WHERE playername='{$s}'")
- );
- return $fetch['id'];
- }
- function get_uuid_from_authme($connect, $id, $mysql)
- {
- $real_name = get_real_name_authme($connect, $id, $mysql);
- $uuid = uuidConvert($real_name);
- return $uuid;
- }
- function get_real_name_authme($connect, $id, $mysql)
- {
- $querys = mysqli_query($connect, "SELECT * FROM {$mysql["database_authme"]}.authme WHERE authme.id='{$id}'");
- $fetch = mysqli_fetch_array($querys);
- return $fetch['realname'];
- }
- function ping($ip, $port, $timeout)
- {
- $socket = fsockopen($ip, $port, $errno, $errstr, $timeout);
- if ($socket)
- {
- return true;
- } else {
- return false;
- }
- }
- function transfer($connect, $database_playerpoint, $transferer_id, $revicer_id, $amount)
- {
- }
- function changepassword($connect, $id, $oldPass, $newPass, $mysql)
- {
- $query1 = mysqli_fetch_array(mysqli_query($connect, "SELECT * FROM {$mysql["database_authme"]}.authme WHERE id='{$id}'"));
- $oldpassword = $query1["password"];
- if ($oldPass != $oldpassword)
- {
- alert("'Mật khẩu cũ bị sai! Hãy thử lại");
- exit();
- }
- if (strlen($newPass) <= 6 && $newPass == md5("123456"))
- {
- alert("Mật khẩu của bạn phải lớn hơn 6 chữ số và không được là mật khẩu đơn giản như 123456, abcxyz,..");
- exit();
- }
- $query2 = mysqli_query($connect, "UPDATE {$mysql["database_authme"]}.authme SET password='{$newPass}' WHERE id='{$id}'");
- if ($query2)
- {
- alert("Thay đổi mật khẩu thành công! Mọi thứ trong server và trong trang web này sẽ đăng xuất ra!");
- navigation("../");
- session_destroy();
- } else {
- echo"<script>alert('Đã có lỗi xảy ra trong lúc thay đổi mật khẩu!');</script>";
- }
- }
- function email_to_username($connect, $email, $mysql)
- {
- $query = mysqli_fetch_array(mysqli_query($connect, "SELECT * FROM {$mysql["database_authme"]}.authme WHERE email='{$email}'"));
- return $query['realname'];
- }
- function login($connect, $username, $password, $mysql)
- {
- $query = mysqli_query($connect, "SELECT * FROM {$mysql["database_authme"]}.authme WHERE username='{$username}' OR realname='{$username}' OR email='{$username}'");
- $return_query = mysqli_fetch_array($query);
- $money_user_id = get_id_playerpoint($connect, $return_query['id'], $mysql);
- if (mysqli_num_rows($query) <= 0)
- {
- alert("Rất tiếc. Tài khoản này không tồn tại trong máy chủ.");
- navigation("../");
- exit();
- }
- if ($return_query["password"] != $password)
- {
- alert("Mật khẩu của bạn không đúng. Hãy thử lại");
- navigation("../");
- exit;
- }
- $_SESSION["user_id_authme"] = $return_query['id'];
- $_SESSION["user_id_playerpoint"] = $money_user_id;
- $_SESSION["user_login"] = true;
- alert("Đăng nhập thành công!");
- navigation("../");
- }
- function login_popup($connect, $username, $password, $mysql)
- {
- $query = mysqli_query($connect, "SELECT * FROM {$mysql["database_authme"]}.authme WHERE username='{$username}' OR realname='{$username}' OR email='{$username}'");
- $return_query = mysqli_fetch_array($query);
- $money_user_id = get_id_playerpoint($connect, $return_query['id'], $mysql);
- if (mysqli_num_rows($query) <= 0)
- {
- message("Rất tiếc. Tài khoản này không tồn tại trong máy chủ.");
- navigation("../");
- exit();
- }
- if ($return_query["password"] != $password)
- {
- message("Mật khẩu của bạn không đúng. Hãy thử lại");
- navigation("../");
- exit;
- }
- $_SESSION["user_id_authme"] = $return_query['id'];
- $_SESSION["user_id_playerpoint"] = $money_user_id;
- $_SESSION["user_login"] = true;
- message("Đăng nhập thành công!");
- navigation("../");
- }
- function check_player($connect, $mysql, $authme_id)
- {
- $q = mysqli_query($connect, "SELECT * FROM {$mysql['database_authme']}.authme WHERE id='$authme_id'");
- if (mysqli_num_rows($q) <= 0)
- return false;
- else return true;
- }
- function sendmail_recovery($connect, $mysql, $username, $default_url)
- {
- $username = strtolower($username);
- $realname = ucfirst($username);
- $get_email_query = mysqli_query($connect, "SELECT * FROM {$mysql['database_authme']}.authme WHERE email='{$username}' OR username='{$username}' OR realname='{$realname}'");
- $fetch = mysqli_fetch_array($get_email_query);
- if (mysqli_num_rows($get_email_query) <= 0)
- {
- echo '<script>alert("Dữ liệu của tài khoản này không tồn tại!");</script>';
- }
- echo $fetch['password'];
- // Always set content-type when sending HTML email
- $headers = "MIME-Version: 1.0" . "\r\n";
- $headers .= "Content-type:text/html;charset=UTF-8" . "\r\n";
- // More headers
- $headers .= 'Cc:'. $default_url . "\r\n";
- // Thêm md5 (10*code)
- $codes_ = $default_url . "/forget.php?verify=".md5(10*$fetch['password']);
- $body = "
- <body>
- Chào bạn. Nghe nói bạn quên mật khẩu đúng không =3=. Để được lấy lại mật khẩu :3 làm ơn nhấn vào link bên dưới nhé. Và nhớ giữ mật khẩu đừng quên nhé.<br>
- <b>---------</b>
- <br>
- Tài khoản: <b>{$username}</b>
- <br>
- <b>---------</b>
- Link lấy lại mật khẩu: <a href='{$default_url}'>{$default_url}</a>
- </body>
- ";
- mail($fetch['email'], "ss", $body, $headers);
- }
- function register($connect, $mysql, $realname, $password, $email)
- {
- $usernamedefault = addslashes(strtolower($realname));
- $real_name = addslashes($realname);
- $password = addslashes(md5($password));
- $ip = Utilities::get_client_ip();
- $email = addslashes($email);
- if (mysqli_num_rows(mysqli_query($connect, "SELECT * FROM {$mysql['database_authme']}.authme WHERE ip='{$ip}'")) > 2)
- {
- message("IP của bạn đã hết lượt đăng ký! Nếu bạn đang chơi bằng net thì liên hệ ngay với admin để được mở thêm IP nhé");
- navigation("../dang-ky");
- exit;
- }
- $query = mysqli_query($connect, "SELECT * FROM {$mysql['database_authme']}.authme WHERE username='{$usernamedefault}' OR realname='{$real_name}' OR email='{$email}'");
- if ($query->num_rows > 0)
- {
- message("Tài khoản này đã có trên máy chủ. Hãy đăng nhập!");
- navigation("../dang-ky");
- exit;
- }
- $query1 = mysqli_query($connect, "INSERT INTO {$mysql['database_authme']}.authme (username, realname, password, ip, email)
- VALUES ('{$usernamedefault}', '{$real_name}', '{$password}', '{$ip}', '{$email}')");
- if ($query1)
- {
- message("Đăng ký thành công. Hãy đăng nhập! Bạn có thể vào server bằng tài khoản này ngay bây giờ.");
- navigation("../dang-ky");
- exit;
- } else {
- alert("Đã có lỗi xảy ra trong lúc đăng ký. Hãy liên hệ admin");
- exit;
- }
- }
- function register_popup($connect, $mysql, $realname, $password, $email)
- {
- $usernamedefault = addslashes(strtolower($realname));
- $real_name = addslashes($realname);
- $password = addslashes(md5($password));
- $ip = Utilities::get_client_ip();
- $email = addslashes($email);
- if (mysqli_num_rows(mysqli_query($connect, "SELECT * FROM {$mysql['database_authme']}.authme WHERE ip='{$ip}'")) > 2)
- {
- message("IP của bạn đã hết lượt đăng ký! Nếu bạn đang chơi bằng net thì liên hệ ngay với admin để được mở thêm IP nhé");
- exit;
- }
- $query = mysqli_query($connect, "SELECT * FROM {$mysql['database_authme']}.authme WHERE username='{$usernamedefault}' OR realname='{$real_name}' OR email='{$email}'");
- if ($query->num_rows > 0)
- {
- message("Tài khoản này đã có trên máy chủ. Hãy đăng nhập!");
- exit;
- }
- $query1 = mysqli_query($connect, "INSERT INTO {$mysql['database_authme']}.authme (username, realname, password, ip, email)
- VALUES ('{$usernamedefault}', '{$real_name}', '{$password}', '{$ip}', '{$email}')");
- if ($query1)
- {
- message("Đăng ký thành công. Hãy đăng nhập! Bạn có thể vào server bằng tài khoản này ngay bây giờ.");
- navigation("../index");
- exit;
- } else {
- message("Đã có lỗi xảy ra trong lúc đăng ký. Hãy liên hệ admin");
- exit;
- }
- }
- function add_money( $connect, $mysql, $playerpoint_id, $amount )
- {
- $amount = intval($amount);
- $r = mysqli_query($connect, "UPDATE {$mysql['database_playerpoints']}.playerpoints SET points= points + {$amount} WHERE id='{$playerpoint_id}'");
- if ($r)
- {
- alert("Đã thêm " . $amount . " vào tài khoản.");
- } else {
- alert("Đã có lỗi xảy ra khi thêm tiền!");
- }
- }
- function take_money( $connect, $mysql, $playerpoint_id, $amount )
- {
- $amount = intval($amount);
- $r = mysqli_query($connect, "UPDATE {$mysql}.playerpoints SET points= points - {$amount} WHERE id='{$playerpoint_id}'");
- if ($r)
- {
- alert("Đã lấy " . $amount . " từ tài khoản.");
- } else {
- alert("Đã có lỗi xảy ra khi lấy tiền!");
- }
- }
- function message($msg)
- {
- echo "<script>alert('{$msg}');</script>";
- }
- function navigation($where)
- {
- echo "<script>location.href='".$where."'</script>";
- }
- function backtohistory()
- {
- echo "<script>
- for(i = 0;i <= 3;i++)
- {
- history.back();
- }
- </script>";
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement