Actually add the server files
This commit is contained in:
parent
83d03ffc97
commit
d7059a6ed4
17 changed files with 741 additions and 0 deletions
4
clientflags.php
Normal file
4
clientflags.php
Normal file
|
|
@ -0,0 +1,4 @@
|
||||||
|
<?php
|
||||||
|
header('Content-Type: application/json');
|
||||||
|
?>
|
||||||
|
{"code": "", "data": {"guestId": "c24a5876-0ee9-4081-b909-2a711632aaeb", "scribeEnabled": 1, "sectionedSearch": 0, "wideFoVEnabled": 1}, "success": true, "error": ""}
|
||||||
7
config.php
Normal file
7
config.php
Normal file
|
|
@ -0,0 +1,7 @@
|
||||||
|
<?php
|
||||||
|
// MySQL Config
|
||||||
|
$servername = "";
|
||||||
|
$username = "";
|
||||||
|
$password = "";
|
||||||
|
$dbname = "";
|
||||||
|
?>
|
||||||
4
jot.php
Normal file
4
jot.php
Normal file
|
|
@ -0,0 +1,4 @@
|
||||||
|
<?php
|
||||||
|
header('Content-Type: application/json');
|
||||||
|
?>
|
||||||
|
{"code": "", "data": {}, "success": true, "error": ""}
|
||||||
37
search/profiles.php
Normal file
37
search/profiles.php
Normal file
|
|
@ -0,0 +1,37 @@
|
||||||
|
<?php
|
||||||
|
header('Content-Type: application/json');
|
||||||
|
?>
|
||||||
|
<?php
|
||||||
|
// Attach Config
|
||||||
|
include('../config.php');
|
||||||
|
|
||||||
|
$conn = new mysqli($servername, $username, $password, $dbname);
|
||||||
|
|
||||||
|
// Check connection
|
||||||
|
if ($conn->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();
|
||||||
|
?>
|
||||||
37
search/tags.php
Normal file
37
search/tags.php
Normal file
|
|
@ -0,0 +1,37 @@
|
||||||
|
<?php
|
||||||
|
header('Content-Type: application/json');
|
||||||
|
?>
|
||||||
|
<?php
|
||||||
|
// Attach Config
|
||||||
|
include('../config.php');
|
||||||
|
|
||||||
|
$conn = new mysqli($servername, $username, $password, $dbname);
|
||||||
|
|
||||||
|
// Check connection
|
||||||
|
if ($conn->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();
|
||||||
|
?>
|
||||||
68
timeline/graph.php
Normal file
68
timeline/graph.php
Normal file
|
|
@ -0,0 +1,68 @@
|
||||||
|
<?php
|
||||||
|
// Attach Config
|
||||||
|
include('../config.php');
|
||||||
|
|
||||||
|
// Create connection
|
||||||
|
$conn = new mysqli($servername, $username, $password, $dbname);
|
||||||
|
|
||||||
|
// Check connection
|
||||||
|
if ($conn->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("");
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
<?php
|
||||||
|
header('Content-Type: application/json');
|
||||||
|
?>
|
||||||
|
<?php
|
||||||
|
// SQL query to select rows
|
||||||
|
$sql = "SELECT * FROM vines";
|
||||||
|
$result = $conn->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();
|
||||||
|
?>
|
||||||
75
timeline/user.php
Normal file
75
timeline/user.php
Normal file
|
|
@ -0,0 +1,75 @@
|
||||||
|
<?php
|
||||||
|
// Attach Config
|
||||||
|
include('../config.php');
|
||||||
|
|
||||||
|
// Create connection
|
||||||
|
$conn = new mysqli($servername, $username, $password, $dbname);
|
||||||
|
|
||||||
|
// Check connection
|
||||||
|
if ($conn->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("");
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
<?php
|
||||||
|
// The vine-session-id you want to search for
|
||||||
|
$headers = getallheaders();
|
||||||
|
|
||||||
|
$vine_id = $_GET['id'];
|
||||||
|
|
||||||
|
// Prepare the SQL query
|
||||||
|
$sql = "SELECT * FROM accounts WHERE ID = ?";
|
||||||
|
|
||||||
|
// Prepare and bind
|
||||||
|
$stmt = $conn->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();
|
||||||
|
?>
|
||||||
|
<?php
|
||||||
|
header('Content-Type: application/json');
|
||||||
|
?>
|
||||||
|
<?php
|
||||||
|
// SQL query to select rows containing the searched word
|
||||||
|
$cid = $_GET['id'];
|
||||||
|
$sql = "SELECT * FROM vines WHERE uploaderId = '$cid'";
|
||||||
|
$result = $conn->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();
|
||||||
|
?>
|
||||||
32
upload/avatar.php
Normal file
32
upload/avatar.php
Normal file
|
|
@ -0,0 +1,32 @@
|
||||||
|
<?php
|
||||||
|
// Get the SID from the request header
|
||||||
|
$headers = getallheaders();
|
||||||
|
$sid = isset($headers['vine-session-id']) ? $headers['vine-session-id'] : null;
|
||||||
|
|
||||||
|
if ($_SERVER['REQUEST_METHOD'] == "PUT") {
|
||||||
|
if (isset($sid)) {
|
||||||
|
// Set headers
|
||||||
|
header('Content-Type: application/json');
|
||||||
|
header('X-Upload-Key: http://192.168.50.154/upload/avatars/' . $_GET['name']);
|
||||||
|
|
||||||
|
// Read the raw POST data from php://input
|
||||||
|
$inputData = file_get_contents('php://input');
|
||||||
|
|
||||||
|
// Define the static part of the filename
|
||||||
|
$staticPart = './avatars/';
|
||||||
|
|
||||||
|
// Define the variable part of the filename (e.g., a timestamp or a unique ID)
|
||||||
|
$variablePart = $_GET['name'];
|
||||||
|
|
||||||
|
// Combine the static and variable parts to create the filename
|
||||||
|
$filename = $staticPart . $variablePart;
|
||||||
|
|
||||||
|
// Save the input data to the file
|
||||||
|
file_put_contents($filename, $inputData);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
header('Content-Type: image/jpeg');
|
||||||
|
$avatar = file_get_contents('./avatars/' . $_GET['name']);
|
||||||
|
echo $avatar;
|
||||||
|
}
|
||||||
|
?>
|
||||||
32
upload/thumb.php
Normal file
32
upload/thumb.php
Normal file
|
|
@ -0,0 +1,32 @@
|
||||||
|
<?php
|
||||||
|
// Get the SID from the request header
|
||||||
|
$headers = getallheaders();
|
||||||
|
$sid = isset($headers['vine-session-id']) ? $headers['vine-session-id'] : null;
|
||||||
|
|
||||||
|
if ($_SERVER['REQUEST_METHOD'] == "PUT") {
|
||||||
|
if (isset($sid)) {
|
||||||
|
// Set headers
|
||||||
|
header('Content-Type: application/json');
|
||||||
|
header('X-Upload-Key: http://192.168.50.154/upload/thumbs/' . $_GET['name']);
|
||||||
|
|
||||||
|
// Read the raw POST data from php://input
|
||||||
|
$inputData = file_get_contents('php://input');
|
||||||
|
|
||||||
|
// Define the static part of the filename
|
||||||
|
$staticPart = './thumbs/';
|
||||||
|
|
||||||
|
// Define the variable part of the filename (e.g., a timestamp or a unique ID)
|
||||||
|
$variablePart = $_GET['name'];
|
||||||
|
|
||||||
|
// Combine the static and variable parts to create the filename
|
||||||
|
$filename = $staticPart . $variablePart;
|
||||||
|
|
||||||
|
// Save the input data to the file
|
||||||
|
file_put_contents($filename, $inputData);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
header('Content-Type: image/jpeg');
|
||||||
|
$avatar = file_get_contents('./thumbs/' . $_GET['name']);
|
||||||
|
echo $avatar;
|
||||||
|
}
|
||||||
|
?>
|
||||||
32
upload/video.php
Normal file
32
upload/video.php
Normal file
|
|
@ -0,0 +1,32 @@
|
||||||
|
<?php
|
||||||
|
// Get the SID from the request header
|
||||||
|
$headers = getallheaders();
|
||||||
|
$sid = isset($headers['vine-session-id']) ? $headers['vine-session-id'] : null;
|
||||||
|
|
||||||
|
if ($_SERVER['REQUEST_METHOD'] == "PUT") {
|
||||||
|
if (isset($sid)) {
|
||||||
|
// Set headers
|
||||||
|
header('Content-Type: application/json');
|
||||||
|
header('X-Upload-Key: http://192.168.50.154/upload/videos/' . $_GET['name']);
|
||||||
|
|
||||||
|
// Read the raw POST data from php://input
|
||||||
|
$inputData = file_get_contents('php://input');
|
||||||
|
|
||||||
|
// Define the static part of the filename
|
||||||
|
$staticPart = './videos/';
|
||||||
|
|
||||||
|
// Define the variable part of the filename (e.g., a timestamp or a unique ID)
|
||||||
|
$variablePart = $_GET['name'];
|
||||||
|
|
||||||
|
// Combine the static and variable parts to create the filename
|
||||||
|
$filename = $staticPart . $variablePart;
|
||||||
|
|
||||||
|
// Save the input data to the file
|
||||||
|
file_put_contents($filename, $inputData);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
header('Content-Type: video/webm');
|
||||||
|
$avatar = file_get_contents('./videos/' . $_GET['name']);
|
||||||
|
echo $avatar;
|
||||||
|
}
|
||||||
|
?>
|
||||||
59
uploadvine.php
Normal file
59
uploadvine.php
Normal file
|
|
@ -0,0 +1,59 @@
|
||||||
|
<?php
|
||||||
|
// Attach Config
|
||||||
|
include('config.php');
|
||||||
|
|
||||||
|
// Read JSON from php://input
|
||||||
|
$json = file_get_contents('php://input');
|
||||||
|
$data = json_decode($json, true);
|
||||||
|
|
||||||
|
$conn = new mysqli($servername, $username, $password, $dbname);
|
||||||
|
|
||||||
|
if ($conn->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();
|
||||||
|
?>
|
||||||
|
<?php
|
||||||
|
header('Content-Type: application/json');
|
||||||
|
?>
|
||||||
|
{"code": "", "data": {}, "success": true, "error": ""}
|
||||||
101
user/aboutown.php
Normal file
101
user/aboutown.php
Normal file
|
|
@ -0,0 +1,101 @@
|
||||||
|
<?php
|
||||||
|
// Attach Config
|
||||||
|
include('../config.php');
|
||||||
|
|
||||||
|
// Create connection
|
||||||
|
$conn = new mysqli($servername, $username, $password, $dbname);
|
||||||
|
|
||||||
|
// Check connection
|
||||||
|
if ($conn->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("");
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
<?php
|
||||||
|
// The vine-session-id you want to search for
|
||||||
|
$headers = getallheaders();
|
||||||
|
|
||||||
|
$vine_session_id = $headers['vine-session-id'];
|
||||||
|
|
||||||
|
// Prepare the SQL query
|
||||||
|
$sql = "SELECT * FROM accounts WHERE SID = ?";
|
||||||
|
|
||||||
|
// Prepare and bind
|
||||||
|
$stmt = $conn->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();
|
||||||
|
?>
|
||||||
89
user/authenticate.php
Normal file
89
user/authenticate.php
Normal file
|
|
@ -0,0 +1,89 @@
|
||||||
|
<?php
|
||||||
|
// Attach Config
|
||||||
|
include('../config.php');
|
||||||
|
|
||||||
|
// Create connection
|
||||||
|
$conn = new mysqli($servername, $username, $password, $dbname);
|
||||||
|
|
||||||
|
// Check connection
|
||||||
|
if ($conn->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("");
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
<?php
|
||||||
|
$chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789,-";
|
||||||
|
|
||||||
|
// Get the request method
|
||||||
|
$method = $_SERVER['REQUEST_METHOD'];
|
||||||
|
|
||||||
|
// Get the SID from the request header
|
||||||
|
$headers = getallheaders();
|
||||||
|
$sid = isset($headers['vine-session-id']) ? $headers['vine-session-id'] : null;
|
||||||
|
|
||||||
|
if ($method == 'DELETE' && $sid) {
|
||||||
|
// Prepare the SQL query to set SID to NULL
|
||||||
|
$sql = "UPDATE accounts SET SID = NULL WHERE SID = ?";
|
||||||
|
$stmt = $conn->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();
|
||||||
|
?>
|
||||||
4
user/profile/activityCounts.php
Normal file
4
user/profile/activityCounts.php
Normal file
|
|
@ -0,0 +1,4 @@
|
||||||
|
<?php
|
||||||
|
header('Content-Type: application/json');
|
||||||
|
?>
|
||||||
|
{"code": "", "data": {}, "success": true, "error": ""}
|
||||||
87
user/profile/index.php
Normal file
87
user/profile/index.php
Normal file
|
|
@ -0,0 +1,87 @@
|
||||||
|
<?php
|
||||||
|
header('Content-Type: application/json');
|
||||||
|
|
||||||
|
// Include config
|
||||||
|
include('../../config.php');
|
||||||
|
|
||||||
|
// Create connection
|
||||||
|
$conn = new mysqli($servername, $username, $password, $dbname);
|
||||||
|
|
||||||
|
// Check connection
|
||||||
|
if ($conn->connect_error) {
|
||||||
|
die("Connection failed: " . $conn->connect_error);
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
<?php
|
||||||
|
// Get the request method
|
||||||
|
$method = $_SERVER['REQUEST_METHOD'];
|
||||||
|
|
||||||
|
// Get the SID from the request header
|
||||||
|
$headers = getallheaders();
|
||||||
|
$sid = isset($headers['vine-session-id']) ? $headers['vine-session-id'] : null;
|
||||||
|
|
||||||
|
if ($method == 'PUT' && $sid) {
|
||||||
|
// Read the raw data from the request body
|
||||||
|
$putData = file_get_contents('php://input');
|
||||||
|
|
||||||
|
// Decode HTML entities
|
||||||
|
$putData = html_entity_decode($putData);
|
||||||
|
|
||||||
|
// Parse the URL-encoded string into an associative array
|
||||||
|
parse_str($putData, $put);
|
||||||
|
|
||||||
|
if (isset($put['email'])) {
|
||||||
|
// extract data that is savable from the put request
|
||||||
|
$username = $put['username'];
|
||||||
|
$description = $put['description'];
|
||||||
|
$location = $put['location'];
|
||||||
|
$email = $put['email'];
|
||||||
|
|
||||||
|
if (isset($put['phoneNumber'])) {
|
||||||
|
$phone = $put['phoneNumber'];
|
||||||
|
} else {
|
||||||
|
$phone = "";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isset($put['profileBackground'])) {
|
||||||
|
$vineColorCode = $put['profileBackground'];
|
||||||
|
} else {
|
||||||
|
$vineColorCode = "3355443";
|
||||||
|
}
|
||||||
|
$hexColorCode = dechex($vineColorCode);
|
||||||
|
|
||||||
|
// Ensure the hexadecimal code is in the correct format
|
||||||
|
$hexColorCode = str_pad($hexColorCode, 6, '0', STR_PAD_LEFT);
|
||||||
|
|
||||||
|
// Adjust the hexadecimal code to the desired format
|
||||||
|
$adjustedHexColorCode = '0x' . substr($hexColorCode, 0, 6);
|
||||||
|
|
||||||
|
if (isset($put['avatarUrl'])) {
|
||||||
|
$avatarUrl = $put['avatarUrl'];
|
||||||
|
// Prepare the SQL query to update account
|
||||||
|
$sql = "UPDATE accounts SET username = ?, description = ?, location = ?, email = ?, phone = ?, color = ?, picture = ? WHERE SID = ?";
|
||||||
|
$stmt = $conn->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();
|
||||||
|
?>
|
||||||
15
user/profile/notificationsgrouped.php
Normal file
15
user/profile/notificationsgrouped.php
Normal file
|
|
@ -0,0 +1,15 @@
|
||||||
|
<?php
|
||||||
|
header('Content-Type: application/json');
|
||||||
|
?>
|
||||||
|
{
|
||||||
|
"code": "",
|
||||||
|
"data": {
|
||||||
|
"count": 0,
|
||||||
|
"records": [],
|
||||||
|
"nextPage": null,
|
||||||
|
"previousPage": null,
|
||||||
|
"size": 0
|
||||||
|
},
|
||||||
|
"success": true,
|
||||||
|
"error": ""
|
||||||
|
}
|
||||||
58
user/register.php
Normal file
58
user/register.php
Normal file
|
|
@ -0,0 +1,58 @@
|
||||||
|
<?php
|
||||||
|
// Attach Config
|
||||||
|
include('../config.php');
|
||||||
|
|
||||||
|
// Create connection
|
||||||
|
$conn = new mysqli($servername, $username, $password, $dbname);
|
||||||
|
|
||||||
|
// Check connection
|
||||||
|
if ($conn->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("");
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
<?php
|
||||||
|
$chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789,-";
|
||||||
|
$username = htmlspecialchars($_POST['username']);
|
||||||
|
|
||||||
|
if (!isset($_POST['phone'])) {
|
||||||
|
$phone = NULL;
|
||||||
|
} else {
|
||||||
|
$phone = $_POST['phone'];
|
||||||
|
}
|
||||||
|
|
||||||
|
$email = htmlspecialchars($_POST['email']);
|
||||||
|
$passwordPlain = $_POST['password'];
|
||||||
|
$passwordHash = password_hash($passwordPlain, PASSWORD_DEFAULT);
|
||||||
|
$sessionId = rand() . strlen($chars) . rand() . strlen($chars);
|
||||||
|
|
||||||
|
// Prepare and bind
|
||||||
|
$stmt = $conn->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();
|
||||||
|
?>
|
||||||
Loading…
Add table
Reference in a new issue