diff --git a/clientflags.php b/clientflags.php new file mode 100644 index 0000000..788e7af --- /dev/null +++ b/clientflags.php @@ -0,0 +1,4 @@ + +{"code": "", "data": {"guestId": "c24a5876-0ee9-4081-b909-2a711632aaeb", "scribeEnabled": 1, "sectionedSearch": 0, "wideFoVEnabled": 1}, "success": true, "error": ""} \ No newline at end of file diff --git a/config.php b/config.php new file mode 100644 index 0000000..d1a0c90 --- /dev/null +++ b/config.php @@ -0,0 +1,7 @@ + \ No newline at end of file diff --git a/jot.php b/jot.php new file mode 100644 index 0000000..7cbee3b --- /dev/null +++ b/jot.php @@ -0,0 +1,4 @@ + +{"code": "", "data": {}, "success": true, "error": ""} \ No newline at end of file diff --git a/search/profiles.php b/search/profiles.php new file mode 100644 index 0000000..bd20e22 --- /dev/null +++ b/search/profiles.php @@ -0,0 +1,37 @@ + +connect_error) { +die("Connection failed: " . $conn->connect_error); +} + +// SQL query to select rows containing the searched word +$search = $_GET['query']; +$sql = "SELECT * FROM accounts WHERE username LIKE '%$search%'"; +$result = $conn->query($sql); + +if ($result->num_rows > 0) { +// Output data of each row +echo '{"code": "", "data": {"count": ' . $result->num_rows . ', "records": ['; +$numbered = 1; +while($row = $result->fetch_assoc()) { +if ($numbered == $result->num_rows) { +echo '{"username": "' . $row['username'] . '", "verified": ' . $row['verified'] . ', "vanityUrls": [], "loopCount": ' . $row['loopc'] . ', "avatarUrl": "' . $row['picture'] . '", "userId": ' . $row['id'] . ', "profileBackground": "' . $row['color'] . '", "user": {"private": 0}, "location": "' . $row['location'] . '"}'; +} else { +echo '{"username": "' . $row['username'] . '", "verified": ' . $row['verified'] . ', "vanityUrls": [], "loopCount": ' . $row['loopc'] . ', "avatarUrl": "' . $row['picture'] . '", "userId": ' . $row['id'] . ', "profileBackground": "' . $row['color'] . '", "user": {"private": 0}, "location": "' . $row['location'] . '"},'; +$numbered++; +} +} +echo '], "nextPage": null, "anchor": "3", "previousPage": null, "size": 35}, "success": true, "error": ""}'; +} else { +echo '{"code": "", "data": {"count": 0, "records": [], "nextPage": null, "anchor": null, "previousPage": null, "size": 35}, "success": true, "error": ""}'; +} +$conn->close(); +?> \ No newline at end of file diff --git a/search/tags.php b/search/tags.php new file mode 100644 index 0000000..5d07832 --- /dev/null +++ b/search/tags.php @@ -0,0 +1,37 @@ + +connect_error) { +die("Connection failed: " . $conn->connect_error); +} + +// SQL query to select rows containing the searched word +$search = $_GET['query']; +$sql = "SELECT * FROM tags WHERE name LIKE '%$search%'"; +$result = $conn->query($sql); + +if ($result->num_rows > 0) { +// Output data of each row +echo '{"code": "", "data": {"count": ' . $result->num_rows . ', "records": ['; +$numbered = 1; +while($row = $result->fetch_assoc()) { +if ($numbered == $result->num_rows) { +echo '{"tagId": ' . $row['id'] . ', "tag": "' . $row['name'] . '", "postCount": ' . $row['postc'] . '}'; +} else { +echo '{"tagId": ' . $row['id'] . ', "tag": "' . $row['name'] . '", "postCount": ' . $row['postc'] . '},'; +$numbered++; +} +} +echo '], "nextPage": null, "anchor": null, "previousPage": null, "size": 35}, "success": true, "error": ""}'; +} else { +echo '{"code": "", "data": {"count": 0, "records": [], "nextPage": null, "anchor": null, "previousPage": null, "size": 35}, "success": true, "error": ""}'; +} +$conn->close(); +?> \ No newline at end of file diff --git a/timeline/graph.php b/timeline/graph.php new file mode 100644 index 0000000..08c30c3 --- /dev/null +++ b/timeline/graph.php @@ -0,0 +1,68 @@ +connect_error) { +header('HTTP/1.1 500 Internal Server Error'); +header('Content-Type: application/json'); +echo '{"code": 420, "data": "", "success": false, "error": "Please try again later."}'; +die(""); +} +?> + +query($sql); + +if ($result->num_rows > 0) { +// Output data of each row +echo '{"code": "", "data": {"count": ' . $result->num_rows . ', "anchorStr": "1430063523815403520", "records": ['; +$numbered = 1; +while ($row = $result->fetch_assoc()) { +$vine_id = $row['uploaderId']; + +// Prepare the SQL query +$sql = "SELECT * FROM accounts WHERE id = ?"; +$stmt = $conn->prepare($sql); +$stmt->bind_param("s", $vine_id); + +// Execute the statement +$stmt->execute(); + +// Get the result +$account_result = $stmt->get_result(); + +// Check if any rows were returned +if ($account_result->num_rows > 0) { +// Output data of each row +while ($account_row = $account_result->fetch_assoc()) { +$username = $account_row['username']; +$color = $account_row['color']; +$verified = $account_row['verified']; +$avatarUrl = $account_row['picture']; +} +} + +// Close the statement +$stmt->close(); + +if ($numbered == $result->num_rows) { +echo '{"liked": 0, "videoDashUrl": null, "foursquareVenueId": "", "remixDisabled": 0, "userId": ' . $row['uploaderId'] . ', "private": 0, "foursquareVenueIdStr": "", "postIdStr": "' . $row['id'] . '", "videoWebmUrl": null, "loops": {"count": ' . $row['loopc'] . '.0, "velocity": ' . $row['loopvelo'] . ', "onFire": ' . $row['loopfire'] . '}, "thumbnailUrl": "' . $row['thumbnailUrl'] . '", "explicitContent": 0, "myRepostId": 0, "blocked": 0, "verified": ' . $verified . ', "entities": [], "avatarUrl": "' . $avatarUrl . '", "description": "' . $row['description'] . '", "comments": {"count": ' . $row['commentc'] . ', "anchorStr": "", "records": [], "nextPage": null, "backAnchor": "", "anchor": null, "previousPage": null, "size": 0}, "videoLowURL": null, "videoUrls": [{"videoUrl": "' . $row['videodef'] . '", "format": "h264", "default": 1, "idStr": "original", "rate": 200, "id": "original"}, {"rate": 0, "format": "h264", "videoUrl": "' . $row['videor2'] . '", "id": "r2", "idStr": "r2"}, {"videoUrl": "' . $row['videoh264'] . '", "format": "dash", "default": 1, "idStr": "h264dash", "rate": 0, "id": "h264dash"}, {"videoUrl": "' . $row['videoh264'] . '", "format": "h264c", "default": 1, "idStr": "r2", "rate": 0, "id": "r2"}], "username": "' . $username . '", "userIdStr": "' . $row['uploaderId'] . '", "vanityUrls": [], "tags": [], "permalinkUrl": "https://vine.co/v/' . $row['id'] . '", "following": 0, "myRepostIdStr": "", "postId": ' . $row['id'] . ', "likes": {"count": ' . $row['likec'] . ', "anchorStr": "1430771454466744320", "records": [], "nextPage": null, "backAnchor": "", "anchor": 1430771454466744320, "previousPage": null, "size": 6}, "videoUrl": null, "followRequested": 0, "created": "' . $row['created'] . '", "hasSimilarPosts": 0, "shareUrl": "https://vine.co/v/' . $row['id'] . '", "profileBackground": "' . $color . '", "promoted": 0, "reposts": {"count": ' . $row['revinec'] . ', "anchorStr": "", "records": [], "nextPage": null, "backAnchor": "", "anchor": null, "previousPage": null, "size": 0}}'; +} else { +echo '{"liked": 0, "videoDashUrl": null, "foursquareVenueId": "", "remixDisabled": 0, "userId": ' . $row['uploaderId'] . ', "private": 0, "foursquareVenueIdStr": "", "postIdStr": "' . $row['id'] . '", "videoWebmUrl": null, "loops": {"count": ' . $row['loopc'] . '.0, "velocity": ' . $row['loopvelo'] . ', "onFire": ' . $row['loopfire'] . '}, "thumbnailUrl": "' . $row['thumbnailUrl'] . '", "explicitContent": 0, "myRepostId": 0, "blocked": 0, "verified": ' . $verified . ', "entities": [], "avatarUrl": "' . $avatarUrl . '", "description": "' . $row['description'] . '", "comments": {"count": ' . $row['commentc'] . ', "anchorStr": "", "records": [], "nextPage": null, "backAnchor": "", "anchor": null, "previousPage": null, "size": 0}, "videoLowURL": null, "videoUrls": [{"videoUrl": "' . $row['videodef'] . '", "format": "h264", "default": 1, "idStr": "original", "rate": 200, "id": "original"}, {"rate": 0, "format": "h264", "videoUrl": "' . $row['videor2'] . '", "id": "r2", "idStr": "r2"}, {"videoUrl": "' . $row['videoh264'] . '", "format": "dash", "default": 1, "idStr": "h264dash", "rate": 0, "id": "h264dash"}, {"videoUrl": "' . $row['videoh264'] . '", "format": "h264c", "default": 1, "idStr": "r2", "rate": 0, "id": "r2"}], "username": "' . $username . '", "userIdStr": "' . $row['uploaderId'] . '", "vanityUrls": [], "tags": [], "permalinkUrl": "https://vine.co/v/' . $row['id'] . '", "following": 0, "myRepostIdStr": "", "postId": ' . $row['id'] . ', "likes": {"count": ' . $row['likec'] . ', "anchorStr": "1430771454466744320", "records": [], "nextPage": null, "backAnchor": "", "anchor": 1430771454466744320, "previousPage": null, "size": 6}, "videoUrl": null, "followRequested": 0, "created": "' . $row['created'] . '", "hasSimilarPosts": 0, "shareUrl": "https://vine.co/v/' . $row['id'] . '", "profileBackground": "' . $color . '", "promoted": 0, "reposts": {"count": ' . $row['revinec'] . ', "anchorStr": "", "records": [], "nextPage": null, "backAnchor": "", "anchor": null, "previousPage": null, "size": 0}},'; +} +$numbered++; +} +echo '], "nextPage": null, "backAnchor": "1430767489536634880", "anchor": 1430063523815403520, "previousPage": null, "size": 20}, "success": true, "error": ""}'; +} else { +echo '{"code": "", "data": {"count": 0, "records": [], "nextPage": null, "anchor": null, "previousPage": null, "size": 35}, "success": true, "error": ""}'; +} +$conn->close(); +?> \ No newline at end of file diff --git a/timeline/user.php b/timeline/user.php new file mode 100644 index 0000000..3092d95 --- /dev/null +++ b/timeline/user.php @@ -0,0 +1,75 @@ +connect_error) { +header('HTTP/1.1 500 Internal Server Error'); +header('Content-Type: application/json'); +echo '{"code": 420, "data": "", "success": false, "error": "Please try again later."}'; +die(""); +} +?> +prepare($sql); +$stmt->bind_param("s", $vine_id); + +// Execute the statement +$stmt->execute(); + +// Get the result +$result = $stmt->get_result(); + +// Check if any rows were returned +if ($result->num_rows > 0) { +// Output data of each row +while($row = $result->fetch_assoc()) { +$username = $row['username']; +$color = $row['color']; +$verified = $row['verified']; +$avatarUrl = $row['picture']; +} +} + +// Close the statement and connection +$stmt->close(); +?> + +query($sql); + +if ($result->num_rows > 0) { +// Output data of each row +echo '{"code": "", "data": {"count": ' . $result->num_rows . ', "anchorStr": "1430063523815403520", "records": ['; +$numbered = 1; +while($row = $result->fetch_assoc()) { +if ($numbered == $result->num_rows) { +echo '{"liked": 0, "videoDashUrl": null, "foursquareVenueId": "", "remixDisabled": 0, "userId": ' . $row['uploaderId'] . ', "private": 0, "foursquareVenueIdStr": "", "postIdStr": "' . $row['id'] . '", "videoWebmUrl": null, "loops": {"count": ' . $row['loopc'] . '.0, "velocity": ' . $row['loopvelo'] . ', "onFire": ' . $row['loopfire'] . '}, "thumbnailUrl": "' . $row['thumbnailUrl'] . '", "explicitContent": 0, "myRepostId": 0, "blocked": 0, "verified": ' . $verified . ', "entities": [], "avatarUrl": "' . $avatarUrl . '", "description": "' . $row['description'] . '", "comments": {"count": ' . $row['commentc'] . ', "anchorStr": "", "records": [], "nextPage": null, "backAnchor": "", "anchor": null, "previousPage": null, "size": 0}, "videoLowURL": null, "videoUrls": [{"videoUrl": "' . $row['videodef'] . '", "format": "h264", "default": 1, "idStr": "original", "rate": 200, "id": "original"}, {"rate": 0, "format": "h264", "videoUrl": "' . $row['videor2'] . '", "id": "r2", "idStr": "r2"}, {"videoUrl": "' . $row['videoh264'] . '", "format": "dash", "default": 1, "idStr": "h264dash", "rate": 0, "id": "h264dash"}, {"videoUrl": "' . $row['videoh264'] . '", "format": "h264c", "default": 1, "idStr": "r2", "rate": 0, "id": "r2"}], "username": "' . $username . '", "userIdStr": "' . $row['uploaderId'] . '", "vanityUrls": [], "tags": [], "permalinkUrl": "https://vine.co/v/' . $row['id'] . '", "following": 0, "myRepostIdStr": "", "postId": ' . $row['id'] . ', "likes": {"count": ' . $row['likec'] . ', "anchorStr": "1430771454466744320", "records": [], "nextPage": null, "backAnchor": "", "anchor": 1430771454466744320, "previousPage": null, "size": 6}, "videoUrl": null, "followRequested": 0, "created": "' . $row['created'] . '", "hasSimilarPosts": 0, "shareUrl": "https://vine.co/v/' . $row['id'] . '", "profileBackground": "' . $color . '", "promoted": 0, "reposts": {"count": ' . $row['revinec'] . ', "anchorStr": "", "records": [], "nextPage": null, "backAnchor": "", "anchor": null, "previousPage": null, "size": 0}}'; +} else { +echo '{"liked": 0, "videoDashUrl": null, "foursquareVenueId": "", "remixDisabled": 0, "userId": ' . $row['uploaderId'] . ', "private": 0, "foursquareVenueIdStr": "", "postIdStr": "' . $row['id'] . '", "videoWebmUrl": null, "loops": {"count": ' . $row['loopc'] . '.0, "velocity": ' . $row['loopvelo'] . ', "onFire": ' . $row['loopfire'] . '}, "thumbnailUrl": "' . $row['thumbnailUrl'] . '", "explicitContent": 0, "myRepostId": 0, "blocked": 0, "verified": ' . $verified . ', "entities": [], "avatarUrl": "' . $avatarUrl . '", "description": "' . $row['description'] . '", "comments": {"count": ' . $row['commentc'] . ', "anchorStr": "", "records": [], "nextPage": null, "backAnchor": "", "anchor": null, "previousPage": null, "size": 0}, "videoLowURL": null, "videoUrls": [{"videoUrl": "' . $row['videodef'] . '", "format": "h264", "default": 1, "idStr": "original", "rate": 200, "id": "original"}, {"rate": 0, "format": "h264", "videoUrl": "' . $row['videor2'] . '", "id": "r2", "idStr": "r2"}, {"videoUrl": "' . $row['videoh264'] . '", "format": "dash", "default": 1, "idStr": "h264dash", "rate": 0, "id": "h264dash"}, {"videoUrl": "' . $row['videoh264'] . '", "format": "h264c", "default": 1, "idStr": "r2", "rate": 0, "id": "r2"}], "username": "' . $username . '", "userIdStr": "' . $row['uploaderId'] . '", "vanityUrls": [], "tags": [], "permalinkUrl": "https://vine.co/v/' . $row['id'] . '", "following": 0, "myRepostIdStr": "", "postId": ' . $row['id'] . ', "likes": {"count": ' . $row['likec'] . ', "anchorStr": "1430771454466744320", "records": [], "nextPage": null, "backAnchor": "", "anchor": 1430771454466744320, "previousPage": null, "size": 6}, "videoUrl": null, "followRequested": 0, "created": "' . $row['created'] . '", "hasSimilarPosts": 0, "shareUrl": "https://vine.co/v/' . $row['id'] . '", "profileBackground": "' . $color . '", "promoted": 0, "reposts": {"count": ' . $row['revinec'] . ', "anchorStr": "", "records": [], "nextPage": null, "backAnchor": "", "anchor": null, "previousPage": null, "size": 0}},'; +$numbered++; +} +} +echo '], "nextPage": null, "backAnchor": "1430767489536634880", "anchor": 1430063523815403520, "previousPage": null, "size": 20}, "success": true, "error": ""}'; +} else { +echo '{"code": "", "data": {"count": 0, "records": [], "nextPage": null, "anchor": null, "previousPage": null, "size": 35}, "success": true, "error": ""}'; +} +$conn->close(); +?> \ No newline at end of file diff --git a/upload/avatar.php b/upload/avatar.php new file mode 100644 index 0000000..201d9a8 --- /dev/null +++ b/upload/avatar.php @@ -0,0 +1,32 @@ + \ No newline at end of file diff --git a/upload/thumb.php b/upload/thumb.php new file mode 100644 index 0000000..57ea631 --- /dev/null +++ b/upload/thumb.php @@ -0,0 +1,32 @@ + \ No newline at end of file diff --git a/upload/video.php b/upload/video.php new file mode 100644 index 0000000..707bad3 --- /dev/null +++ b/upload/video.php @@ -0,0 +1,32 @@ + \ No newline at end of file diff --git a/uploadvine.php b/uploadvine.php new file mode 100644 index 0000000..e7aef99 --- /dev/null +++ b/uploadvine.php @@ -0,0 +1,59 @@ +connect_error) { +die("Connection failed: " . $conn->connect_error); +} + +// The vine-session-id you want to search for +$headers = getallheaders(); + +$vine_session_id = $headers['vine-session-id']; + +$sql = "SELECT id, postc FROM accounts WHERE sid = ?"; +$stmt = $conn->prepare($sql); +$stmt->bind_param("s", $vine_session_id); +$stmt->execute(); +$result = $stmt->get_result(); +$user = $result->fetch_assoc(); +$uploadId = $user['id']; +$thumbnailUrl = $data['thumbnailUrl']; +$created = date("Y-m-d\TH:i:s") . ".000000"; + +// Increase the postc row by 1 +$new_postc = $user['postc'] + 1; +$sql_update = "UPDATE accounts SET postc = ? WHERE id = ?"; +$stmt_update = $conn->prepare($sql_update); +$stmt_update->bind_param("ii", $new_postc, $uploadId); +$stmt_update->execute(); + +if (isset($data['description'])) { +// Save JSON contents to MySQL +$sql = "INSERT INTO vines (description, uploaderId, thumbnailUrl, videodef, videoh264, videor2, created) VALUES (?, ?, ?, ?, ?, ?, ?)"; +$stmt = $conn->prepare($sql); +$stmt->bind_param("sssssss", $data['description'], $uploadId, $thumbnailUrl, $data['videoWebmUrl'], $data['videoWebmUrl'], $data['videoWebmUrl'], $created); +} else { +// Save JSON contents to MySQL +// Save JSON contents to MySQL +$sql = "INSERT INTO vines (uploaderId, thumbnailUrl, videodef, videoh264, videor2, created) VALUES (?, ?, ?, ?, ?, ?)"; +$stmt = $conn->prepare($sql); +$stmt->bind_param("ssssss", $uploadId, $thumbnailUrl, $data['videoWebmUrl'], $data['videoWebmUrl'], $data['videoWebmUrl'], $created); +} +$stmt->execute(); + +// Close the statement and connection +$stmt_update->close(); +$stmt->close(); +$conn->close(); +?> + +{"code": "", "data": {}, "success": true, "error": ""} \ No newline at end of file diff --git a/user/aboutown.php b/user/aboutown.php new file mode 100644 index 0000000..669ef82 --- /dev/null +++ b/user/aboutown.php @@ -0,0 +1,101 @@ +connect_error) { +header('HTTP/1.1 500 Internal Server Error'); +header('Content-Type: application/json'); +echo '{"code": 420, "data": "", "success": false, "error": "Please try again later."}'; +die(""); +} +?> +prepare($sql); +$stmt->bind_param("s", $vine_session_id); + +// Execute the statement +$stmt->execute(); + +// Get the result +$result = $stmt->get_result(); + +// Check if any rows were returned +if ($result->num_rows > 0) { +// Output data of each row +while($row = $result->fetch_assoc()) { +if ($row["description"] == NULL) { +$description = "null"; +} else { +$description = '"' . $row["description"] . '"'; +} + +if ($row["phone"] == NULL) { +$phone = "null"; +} else { +$phone = '"' . $row["phone"] . '"'; +} + +if ($row["location"] == NULL) { +$location = "null"; +} else { +$location = '"' . $row["location"] . '"'; +} + +if ($row["picture"] == NULL) { +$picture = "null"; +} else { +$picture = '"' . $row["picture"] . '"'; +} +header('Content-Type: application/json'); +echo '{ + "code": "", + "data": { + "username": "' . $row["username"]. '", + "profileBackground": "' . $row["color"]. '", + "following": ' . $row["following"] . ', + "followerCount": ' . $row["followersc"] . ', + "verified": ' . $row["verified"]. ', + "description": ' . $description . ', + "avatarUrl": ' . $picture . ', + "twitterId": null, + "facebookId": null, + "userId": ' . $row["id"] . ', + "twitterConnected": 0, + "likeCount": ' . $row["likec"] . ', + "facebookConnected": 0, + "postCount": ' . $row["postc"] . ', + "phoneNumber": ' . $phone . ', + "verifiedPhoneNumber": ' . $row["vphone"] . ', + "location": ' . $location . ', + "followingCount": ' . $row["followingc"] . ', + "email": "' . $row["email"] . '", + "verifiedEmail": ' . $row["vemail"] . ', + "loopCount": ' . $row["loopc"] . ' + }, + "success": true, + "error": "" +}'; +} +} else { +header('HTTP/1.1 403 Forbidden'); +header('Content-Type: application/json'); +echo '{"code": 103, "data": "", "success": false, "error": "Authenticate First."}'; +} + +// Close the statement and connection +$stmt->close(); +$conn->close(); +?> \ No newline at end of file diff --git a/user/authenticate.php b/user/authenticate.php new file mode 100644 index 0000000..7dc0b37 --- /dev/null +++ b/user/authenticate.php @@ -0,0 +1,89 @@ +connect_error) { +header('HTTP/1.1 500 Internal Server Error'); +header('Content-Type: application/json'); +echo '{"code": 112, "data": "", "success": false, "error": "Please try again later."}'; +die(""); +} +?> +prepare($sql); +$stmt->bind_param("s", $sid); + +if ($stmt->execute() === TRUE) { +header('Content-Type: application/json'); +echo '{"code": "", "data": {}, "success": true, "error": ""}'; +} else { +header('Content-Type: application/json'); +echo "Error: " . $stmt->error; +} + +$stmt->close(); +} else if ($_SERVER["REQUEST_METHOD"] == "POST") { +$email = $_POST['username']; +$password = $_POST['password']; + +// Prepare the SQL query to fetch the user +$sql = "SELECT id, passwordHash, username FROM accounts WHERE email = ?"; +$stmt = $conn->prepare($sql); +$stmt->bind_param("s", $email); +$stmt->execute(); +$result = $stmt->get_result(); + +if ($result->num_rows > 0) { +$row = $result->fetch_assoc(); +if (password_verify($password, $row['passwordHash'])) { +header('Content-Type: application/json'); +$sessionId = $sessionId = rand() . strlen($chars) . rand() . strlen($chars); +echo '{ + "code": "", + "data": { + "username": "' . $row['username'] . '", + "userId": ' . $row['id'] . ', + "key": "' . $sessionId . '" + }, + "success": true, + "error": "" +}'; + +// Update session ID for authentication purposes +$sql = "UPDATE accounts SET SID = ? WHERE email = ?"; +$stmt = $conn->prepare($sql); +$stmt->bind_param("ss", $sessionId, $email); +$stmt->execute(); + +} else { +header('HTTP/1.1 403 Forbidden'); +header('Content-Type: application/json'); +echo '{"code": 101, "data": "", "success": false, "error": "That username or password is incorrect."}'; +} +} else { +header('HTTP/1.1 403 Forbidden'); +header('Content-Type: application/json'); +echo '{"code": 101, "data": "", "success": false, "error": "That username or password is incorrect."}'; +} + +$stmt->close(); +} +// Close the connection +$conn->close(); +?> \ No newline at end of file diff --git a/user/profile/activityCounts.php b/user/profile/activityCounts.php new file mode 100644 index 0000000..7cbee3b --- /dev/null +++ b/user/profile/activityCounts.php @@ -0,0 +1,4 @@ + +{"code": "", "data": {}, "success": true, "error": ""} \ No newline at end of file diff --git a/user/profile/index.php b/user/profile/index.php new file mode 100644 index 0000000..29f542f --- /dev/null +++ b/user/profile/index.php @@ -0,0 +1,87 @@ +connect_error) { +die("Connection failed: " . $conn->connect_error); +} +?> +prepare($sql); +$stmt->bind_param("ssssssss", $username, $description, $location, $email, $phone, $adjustedHexColorCode, $avatarUrl, $sid); +} else { +// Prepare the SQL query to update account +$sql = "UPDATE accounts SET username = ?, description = ?, location = ?, email = ?, phone = ?, color = ? WHERE SID = ?"; +$stmt = $conn->prepare($sql); +$stmt->bind_param("sssssss", $username, $description, $location, $email, $phone, $adjustedHexColorCode, $sid); +} + +if ($stmt->execute() === TRUE) { +echo '{"code": "", "data": {}, "success": true, "error": ""}'; +} else { +header('HTTP/1.1 500 Internal Server Error'); +header('Content-Type: application/json'); +echo '{"code": 420, "data": "", "success": false, "error": "Please try again later."}'; +} + +$stmt->close(); +} else { +echo '{"code": "", "data": {}, "success": true, "error": ""}'; +} +} +// Close the connection +$conn->close(); +?> \ No newline at end of file diff --git a/user/profile/notificationsgrouped.php b/user/profile/notificationsgrouped.php new file mode 100644 index 0000000..e0f7942 --- /dev/null +++ b/user/profile/notificationsgrouped.php @@ -0,0 +1,15 @@ + +{ + "code": "", + "data": { + "count": 0, + "records": [], + "nextPage": null, + "previousPage": null, + "size": 0 + }, + "success": true, + "error": "" +} \ No newline at end of file diff --git a/user/register.php b/user/register.php new file mode 100644 index 0000000..5768d9d --- /dev/null +++ b/user/register.php @@ -0,0 +1,58 @@ +connect_error) { +header('HTTP/1.1 500 Internal Server Error'); +header('Content-Type: application/json'); +echo '{"code": 420, "data": "", "success": false, "error": "Please try again later."}'; +die(""); +} +?> +prepare("INSERT INTO accounts (sid, username, phone, email, passwordHash) VALUES (?, ?, ?, ?, ?)"); +$stmt->bind_param("issss", $sessionId, $username, $phone, $email, $passwordHash); + +// Execute the statement +if ($stmt->execute() === TRUE) { +$last_id = $conn->insert_id; +echo '{ + "code": "", + "data": { + "username": "' . $username . '", + "userId": ' . $last_id . ', + "key": "' . $sessionId . '" + }, + "success": true, + "error": "" +}'; +} else { +header('HTTP/1.1 500 Internal Server Error'); +header('Content-Type: application/json'); +echo '{"code": 420, "data": "", "success": false, "error": "Please try again later."}'; +die(""); +} + +// Close the statement and connection +$stmt->close(); +$conn->close(); +?> \ No newline at end of file