commit a31a8e7fddd1b2e4bc5dad988ae111681016f223 Author: Sewmina (server) Date: Fri Apr 11 05:02:06 2025 +0800 init diff --git a/add_feedback.php b/add_feedback.php new file mode 100644 index 0000000..83159e1 --- /dev/null +++ b/add_feedback.php @@ -0,0 +1,17 @@ + \ No newline at end of file diff --git a/add_game_history.php b/add_game_history.php new file mode 100644 index 0000000..b464af5 --- /dev/null +++ b/add_game_history.php @@ -0,0 +1,24 @@ + \ No newline at end of file diff --git a/connection.php b/connection.php new file mode 100644 index 0000000..edfabd9 --- /dev/null +++ b/connection.php @@ -0,0 +1,38 @@ + error); + + + + return $conn; + + } + + + + function CloseCon($conn) + + { + + $conn -> close(); + + } + + + +?> diff --git a/get_game_completed.php b/get_game_completed.php new file mode 100644 index 0000000..cb38c0e --- /dev/null +++ b/get_game_completed.php @@ -0,0 +1,19 @@ + 0){ + echo "1"; +}else{ + echo "0"; +} + + + +?> \ No newline at end of file diff --git a/get_game_history.php b/get_game_history.php new file mode 100644 index 0000000..72bd9cb --- /dev/null +++ b/get_game_history.php @@ -0,0 +1,19 @@ + \ No newline at end of file diff --git a/get_rematch_address.php b/get_rematch_address.php new file mode 100644 index 0000000..8b30418 --- /dev/null +++ b/get_rematch_address.php @@ -0,0 +1,19 @@ + 0){ + echo mysqli_fetch_assoc($selectQuery)['rematch_address']; +}else{ + echo "0"; +} + +CloseCon($conn); + +?> \ No newline at end of file diff --git a/get_user_by_id.php b/get_user_by_id.php new file mode 100644 index 0000000..a481d2d --- /dev/null +++ b/get_user_by_id.php @@ -0,0 +1,16 @@ + 0){ + echo json_encode(mysqli_fetch_assoc($selectQuery)); + }else{ + echo "0"; + } +?> \ No newline at end of file diff --git a/get_user_by_username.php b/get_user_by_username.php new file mode 100644 index 0000000..1218181 --- /dev/null +++ b/get_user_by_username.php @@ -0,0 +1,17 @@ + 0){ + echo json_encode(mysqli_fetch_assoc($selectQuery)); + }else{ + echo "0"; + } +?> \ No newline at end of file diff --git a/register.php b/register.php new file mode 100644 index 0000000..1ae0ec7 --- /dev/null +++ b/register.php @@ -0,0 +1,24 @@ + 0){ + echo "5. Failed! id exists"; + die(); + } + + + $insertQuery = "INSERT INTO Users (id, username) VALUES ('$id','$username');"; + if(mysqli_query($conn, $insertQuery)){ + echo "0"; + }else{ + echo "1. Error creating new player"; + } +?> \ No newline at end of file diff --git a/set_rematch_address.php b/set_rematch_address.php new file mode 100644 index 0000000..7c7326d --- /dev/null +++ b/set_rematch_address.php @@ -0,0 +1,23 @@ + \ No newline at end of file diff --git a/test.php b/test.php new file mode 100644 index 0000000..8579549 --- /dev/null +++ b/test.php @@ -0,0 +1,3 @@ + \ No newline at end of file diff --git a/update_profile.php b/update_profile.php new file mode 100644 index 0000000..437e798 --- /dev/null +++ b/update_profile.php @@ -0,0 +1,21 @@ + \ No newline at end of file diff --git a/update_x_pic_url.php b/update_x_pic_url.php new file mode 100644 index 0000000..dc7347d --- /dev/null +++ b/update_x_pic_url.php @@ -0,0 +1,21 @@ + \ No newline at end of file diff --git a/upload_profile_picture.php b/upload_profile_picture.php new file mode 100644 index 0000000..207c56a --- /dev/null +++ b/upload_profile_picture.php @@ -0,0 +1,44 @@ + false, 'message' => 'Invalid file type']); + exit; + } + + // Define the target file path using privy_id + $uploadFile = $uploadDir . $privy_id . '.jpg'; // File will be saved as {privy_id}.jpg + + // Ensure the directory exists and has proper permissions + if (!is_dir($uploadDir)) { + mkdir($uploadDir, 0755, true); // Create directory if it doesn't exist + } + + // Check if the file already exists and remove it before uploading the new file + if (file_exists($uploadFile)) { + unlink($uploadFile); // Delete the existing file + } + + // Move the uploaded file to the target directory + if (move_uploaded_file($_FILES['file']['tmp_name'], $uploadFile)) { + // The image URL for the uploaded file (publicly accessible) + $imageUrl = 'https://vps.playpoolstudios.com/duelfi/profile_pics/' . $privy_id . '.jpg'; + echo json_encode(['success' => true, 'imageUrl' => $imageUrl]); + } else { + echo json_encode(['success' => false, 'message' => 'Failed to move uploaded file']); + } +} else { + // Handle cases where no file is uploaded or privy_id is missing + echo json_encode(['success' => false, 'message' => 'No file uploaded or missing privy_id']); +} +?>