prepare("select * from vpnuser where vuser=:username and vpass=:password"); $data->bindParam(':username', $username); $data->bindParam(':password', $password); $data->execute(); $row = $data->fetch(PDO::FETCH_ASSOC); if (empty($row)){ echo json_encode([ "status" => 401, "message" => "Email and password are not matched with our record!", ]); return; } else{ $notice_sql = $db->prepare("select * from sv_notice where status = 0 order by id desc"); $notice_sql->execute(); $notice=$notice_sql->fetch(PDO::FETCH_ASSOC); if(isset($notice)) $row['notice'] = $notice; if($force == 0 || $force == "0") { if($row['forcestop'] == 1) { $data = $db->prepare("update vpnuser set forcestop = 0 where id=:id"); $data->bindParam(':id', $row['id']); $data->execute(); } } else { $row['forcestop'] = 0; } $status = 200; if($row['onlines'] == 0 ) { // onlines=0 ÀÎ °æ¿ì vpn_off.php ½ÇÇà $status = 200; $disconnect_params = [ 'username' => $username, 'password' => $password ]; $query_string = http_build_query($disconnect_params); $url = 'http://localhost/' . basename(__DIR__) . '/vpn_off.php?' . $query_string; // Using file_get_contents $response = file_get_contents($url); // ·Î±× ÆÄÀÏ °æ·Î $log_file = __DIR__ . '/vpn_off.log'; // ·Î±× ¸Þ½ÃÁö $log_message = "[" . date("Y-m-d H:i:s") . "] vpn_off.php called for user: " . $username . ". Response: " . $response . "\n"; // ·Î±× ÆÄÀÏ¿¡ ±â·Ï file_put_contents($log_file, $log_message, FILE_APPEND); // Using cURL /* $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $response = curl_exec($ch); curl_close($ch); // ·Î±× ÆÄÀÏ °æ·Î $log_file = __DIR__ . '/vpn_off.log'; // ·Î±× ¸Þ½ÃÁö $log_message = "[" . date("Y-m-d H:i:s") . "] vpn_off.php called for user: " . $username . ". Response: " . $response . "\n"; // ·Î±× ÆÄÀÏ¿¡ ±â·Ï file_put_contents($log_file, $log_message, FILE_APPEND); */ } else { if(date("Y-m-d H:i:s", strtotime($row['lastdate'])) < date("Y-m-d H:i:s")) $status = 404; else $status = 200; } echo json_encode([ "status" => $status, "data" => $row ]); } } else { echo json_encode([ "status" => 401, "message" => "Email, password are required!", ]); return; } ?>