$postowner$postdate ";
if(file_exists("ssb_db/posts/$postid.reactcount")) {
$reacts = file_get_contents("ssb_db/posts/$postid.reactcount");
echo "";
// Pull up users who reacted, and generate dropdown list.
$reactlist = fopen("ssb_db/posts/$postid.reacted", "r");
if($reactlist) {
while (($reactor = fgets($reactlist)) !== false) {
echo "$reactor";
}
fclose($reactlist);
}
echo " |
Notifications: Clear |
" . $line . " |
No notifications |
";
echo " "; // DONE echo " | ";
echo "User information"; echo "Username: " . $userid . "@" . $domain . ""; echo "Full name: " . $user_fullname . " "; echo " User posts"; echo " |
";
// Get user avatar if set
echo " "; // DONE echo " | ";
echo "User information"; echo "Username: " . $userid . "@" . $domain . ""; echo "Full name: " . $user_fullname . " "; echo " User posts"; echo " |
\n"; } } if($postowner == $username) { echo "
$postowner$postdate ";
if(file_exists("ssb_db/posts/$postid.reactcount")) {
$reacts = file_get_contents("ssb_db/posts/$postid.reactcount");
echo "";
// Pull up users who reacted, and generate dropdown list.
$reactlist = fopen("ssb_db/posts/$postid.reacted", "r");
if($reactlist) {
while (($reactor = fgets($reactlist)) !== false) {
echo "$reactor";
}
fclose($reactlist);
}
echo " |
\n"; } } echo ""; } } else { echo "
User information
"; echo ""; echo ""; // DONE echo " | ";
// If not friend, allow to send friend request from right here!
$friend = 0;
$friendcount = file_get_contents("ssb_db/friends/" . $username . ".count");
include "ssb_db/friends/" . $username . ".php";
for($x = 1; $x <= $friendcount; $x++)
{
// If private, and user is following. Allow
if($userid == ${"friend" . $x}) {
$friend = 1;
}
}
if($friend!=1) {
echo "Send friend request "; } echo "Username: " . $userid . "@" . $domain . " "; echo "Full name: " . $user_fullname; echo " |
$postowner$postdate ";
if(file_exists("ssb_db/posts/$postid.reactcount")) {
$reacts = file_get_contents("ssb_db/posts/$postid.reactcount");
echo "";
// Pull up users who reacted, and generate dropdown list.
$reactlist = fopen("ssb_db/posts/$postid.reacted", "r");
if($reactlist) {
while (($reactor = fgets($reactlist)) !== false) {
echo "$reactor";
}
fclose($reactlist);
}
echo " |
\n"; } echo ""; } } else if(isset($_GET['view']) && isset($_GET['user'])) { $puser = $_GET['user']; $id = $_GET['view']; $postc = file_get_contents("ssb_db/posts/reply_" . $puser . "_" . $id . ".count"); include "ssb_db/posts/post_" . $puser . "_" . $id . ".php"; echo "
$postowner$postdate ";
if(file_exists("ssb_db/posts/$postid.reactcount")) {
$reacts = file_get_contents("ssb_db/posts/$postid.reactcount");
echo "";
// Pull up users who reacted, and generate dropdown list.
$reactlist = fopen("ssb_db/posts/$postid.reacted", "r");
if($reactlist) {
while (($reactor = fgets($reactlist)) !== false) {
echo "$reactor";
}
fclose($reactlist);
}
echo " |
\n"; for($x = 1; $x <= $postc; $x++) { $reply_content = ${"reply" . $x}; $reply_user = ${"reply" . $x . "_user"}; $reply_date = ${"reply" . $x . "_date"}; echo "\n"; } echo "
"; if ($loginCheck != true) { echo "Login to reply..."; } else { $friendcount = file_get_contents("ssb_db/friends/" . $username . ".count"); include "ssb_db/friends/" . $username . ".php"; for($x = 1; $x <= $friendcount; $x++) { if($puser == ${"friend" . $x}) { $z = "1"; replyForm($id, $puser); } } // Its you dummy if($puser == $username) { $z = "1"; replyForm($id, $puser); } if(!isset($z)) { echo "Not following! Follow to reply...
"; } } } else if(isset($_GET['do'])) { $do = $_GET['do']; if($do=="post") { if ($loginCheck != true) { loginForm(); } else { $date = date("YmdHis"); // timestamp in year, month, date, hour, minute, and second. $titledate = date("m-d-Y h:i:sa"); // time stamp for people to read xD if(isset($_FILES["file"]["name"]) && isset($username)) { $uploaded = array(); // empty array for upload file names $uploaded_name = array(); // empty array for upload names // File selected, upload! for($i=0; $i
"; } else { if(file_exists("ssb_db/uploads/" . $_FILES["file"]["name"][$i])) { echo "Error: " . $_FILES["file"]["name"][$i] . " exists.
"; } else { $randstring = getRandString("32"); move_uploaded_file($_FILES["file"]["tmp_name"][$i], "ssb_db/uploads/" . $randstring . "." . $extension); array_push($uploaded, $randstring . "." . $extension); array_push($uploaded_name, pathinfo($_FILES["file"]["name"][$i], PATHINFO_FILENAME)); echo "Success: " . $_FILES["file"]["name"][$i] . " (" . tomb($_FILES["file"]["size"][$i]) . ") uploaded...
"; //rename("ssb_db/uploads/" . $FILES["file"]["name"][$i], "ssb_db/uploads/" . $username . "_" . $date . $extension); } } } else { // Check if there was actually an issue if($_FILES["file"]["size"] == "0") { echo "Error: " . $_FILES["file"]["name"][$i] . " is too large, or is a invalid filetype"; } } } // end of for loop $srchcont = stripslashes(htmlentities($_POST['body'])); $srchcont .= " "; // doesn't find tag if there's not a fucking whitespace $checkForUserTag = searchForUserTag($srchcont); $taggedUser = substr($checkForUserTag, 1, -1); if(file_exists("ssb_db/users/" . $taggedUser . ".name")) { if($taggedUser!=$postowner) { $tagged_notifications = file_get_contents("ssb_db/friends/" . $taggedUser . ".notifications"); file_put_contents("ssb_db/friends/" . $taggedUser . ".notifications", "$username tagged you in a post\n" . $tagged_notifications); } } $body = nl2br(htmlentities(stripcslashes($_POST['body']))); //$username = stripcslashes(htmlentities($username)); include "ssb_db/users/" . $username . ".php"; $post_file = "ssb_db/posts/post_" . $username . "_" . $date . ".php"; $post_attachments = "
"; $post_string = ""; $attachments = array(); $fileCount = 0; foreach($uploaded as &$upload) { if(file_exists("ssb_db/uploads/" . $upload)) { $ext = pathinfo("ssb_db/uploads/ . $upload", PATHINFO_EXTENSION); if($ext == "mp4" || $ext == "MP4") { array_push($attachments, " "); } else { array_push($attachments, " "); } } $fileCount++; // Add it up } foreach($attachments as &$attachvar) { $post_attachments .= $attachvar; } $post_string_end = "\";\n?>\n"; file_put_contents($post_file, $post_string . $post_attachments . $post_string_end); file_put_contents("ssb_db/posts/" . $date . ".post", "post_" . $username . "_" . $date . ".php"); file_put_contents("ssb_db/posts/reply_" . $username . "_" . $date . ".count", "0"); echo "Post processed... if redirection fails, Click Here
"; header("Location: index.php?view=$date&user=$username"); } else { echo "ERROR: Missing post data! Select an image to upload or let us know whats up!
"; } } } if($do=="avatarupload") { if(isset($_FILES["file"]["name"]) && ($loginCheck == true)) { $date = date("YmdHis"); // timestamp in year, month, date, hour, minute, and second. for($i=0; $i
"; } else { if(file_exists("ssb_db/uploads/" . $_FILES["file"]["name"][$i])) { echo "Error: " . $_FILES["file"]["name"][$i] . " exists.
"; } else { move_uploaded_file($_FILES["file"]["tmp_name"][$i], "ssb_db/uploads/" . $username . "_" . $date . "." . $extension); $oldcontent = file_get_contents("ssb_db/users/" . $username . ".php"); file_put_contents("ssb_db/users/" . $username . ".php", $oldcontent . "\n"); echo "Avatar uploaded and set! Redirecting in 3 seconds..."; header("refresh: 3;url=index.php"); } } } else { echo "Error: " . $_FILES["file"]["name"][$i] . " is too large, or is a invalid filetype"; } } } } if($do=="reply") { if ($loginCheck != true) { loginForm(); } else { if(!isset($_GET['pid']) or !file_exists("ssb_db/posts/" . $_GET['pid'] . ".post")) { echo "ERROR: Post ID is not set, or invalid"; } else { if(isset($_POST['reply']) && isset($username) && $_POST['body']!="") { $pid = $_GET['pid']; $post_file_name = file_get_contents("ssb_db/posts/$pid.post"); include "ssb_db/posts/" . $post_file_name; $srchcont = stripslashes(htmlentities($_POST['body'])); $srchcont .= " "; $checkForUserTag = searchForUserTag($srchcont); $taggedUser = substr($checkForUserTag, 1, -1); if(file_exists("ssb_db/users/" . $taggedUser . ".name")) { if($taggedUser!=$postowner) { $tagged_notifications = file_get_contents("ssb_db/friends/" . $taggedUser . ".notifications"); file_put_contents("ssb_db/friends/" . $taggedUser . ".notifications", "$username tagged you in a comment\n" . $tagged_notifications); } } $replydate = date("m-d-Y h:i:sa"); // time stamp for people to read xD $body = nl2br(htmlentities(stripcslashes($_POST['body']))); //$username = stripcslashes(htmlentities($username)); $old_content = file_get_contents("ssb_db/posts/" . $post_file_name); $reply_count = file_get_contents("ssb_db/posts/reply_" . $postowner . "_" . $pid . ".count"); $reply_count = $reply_count+1; $post_string = "\n"; file_put_contents("ssb_db/posts/" . $post_file_name, $old_content . $post_string); file_put_contents("ssb_db/posts/reply_" . $postowner . "_" . $pid . ".count", $reply_count); if($username!=$postowner) { $owner_notifications = file_get_contents("ssb_db/friends/" . $postowner . ".notifications"); file_put_contents("ssb_db/friends/" . $postowner . ".notifications", "$username replied to your post\n" . $owner_notifications); } echo "If you're seeing this; redirection failed: Click Here
"; header("Location:index.php?view=$pid&user=$postowner"); } else { echo "ERROR: Missing form data
"; } } } } if($do=="delpost") { if ($loginCheck != true) { loginForm(); } else { if(isset($_GET['user']) && $_GET['user']!="" && isset($_GET['pid']) && $_GET['pid']!="") { if(file_exists("ssb_db/posts/post_" . stripslashes($_GET['user']) . "_" . stripslashes($_GET['pid']) . ".php") && $username == stripslashes($_GET['user'])) { $postuser = $_GET['user']; $pid = $_GET['pid']; unlink("ssb_db/posts/" . $pid . ".post"); unlink("ssb_db/posts/post_" . $postuser . "_" . $pid . ".php"); unlink("ssb_db/posts/reply_" . $postuser . "_" . $pid . ".count"); flush(); header("refresh: 0;url=index.php"); exit; } else { echo "ERROR: post doesn't exist or YOU ARE NOT THE OWNER OF SAID POST... THIS incident has been recorded!"; file_put_contents("ssb_db/log.txt", "Post deletion error: IP <" . $_SERVER['REMOTE_ADDR'] . "> post not found or not users post: post_" . $postuser . "_" . $pid . ".php\n"); } } else { echo "ERROR: USER and PID variables not set!"; } } } if($do=="share") { if ($loginCheck != true) { loginForm(); } else { if(isset($_GET['user']) && $_GET['user']!="" && isset($_GET['pid']) && $_GET['pid']!="") { if(file_exists("ssb_db/posts/post_" . stripslashes($_GET['user']) . "_" . stripslashes($_GET['pid']) . ".php")) { $postuser = stripslashes($_GET['user']); $pid = stripslashes($_GET['pid']); $date = date("YmdHis"); // timestamp in year, month, date, hour, minute, and second. $titledate = date("m-d-Y h:i:sa"); // time stamp for people to read xD include("ssb_db/friends/" . $username . ".php"); include("ssb_db/posts/post_" . $postuser . "_" . $pid . ".php"); if($accttype == "public") { $post_file = "ssb_db/posts/post_" . $username . "_" . $date . ".php"; $post_attachments = "
"; $post_string = "\n"; $notification = file_get_contents("ssb_db/friends/" . $postuser . ".notifications"); file_put_contents("ssb_db/friends/" . $postuser . ".notifications", "$username shared your post\n" . $notification); file_put_contents($post_file, $post_string . $post_attachments . $post_string_end); file_put_contents("ssb_db/posts/" . $date . ".post", "post_" . $username . "_" . $date . ".php"); file_put_contents("ssb_db/posts/reply_" . $username . "_" . $date . ".count", "0"); flush(); header("refresh: 0;url=index.php"); exit; } else { $friendcount = file_get_contents("ssb_db/friends/" . $username . ".count"); for($x = 1; $x <= $friendcount; $x++) { if($postowner == ${"friend" . $x}) { $foundfriend = 1; $post_file = "ssb_db/posts/post_" . $username . "_" . $date . ".php"; $post_attachments = "
"; $post_string = "\n"; $notification = file_get_contents("ssb_db/friends/" . $postuser . ".notifications"); file_put_contents("ssb_db/friends/" . $postuser . ".notifications", "$username shared your post\n" . $notification); file_put_contents($post_file, $post_string . $post_attachments . $post_string_end); file_put_contents("ssb_db/posts/" . $date . ".post", "post_" . $username . "_" . $date . ".php"); file_put_contents("ssb_db/posts/reply_" . $username . "_" . $date . ".count", "0"); flush(); header("refresh: 0;url=index.php"); exit; } } } } else { echo "ERROR: post doesn't exist or YOU ARE NOT THE OWNER OF SAID POST... THIS incident has been recorded!"; file_put_contents("ssb_db/log.txt", "Post deletion error: IP <" . $_SERVER['REMOTE_ADDR'] . "> post not found or not users post: post_" . $postuser . "_" . $pid . ".php\n"); } } else { echo "ERROR: USER and PID variables not set!"; } } } if($do=="react") { if ($loginCheck != true) { loginForm(); } else { if(isset($_GET['user']) && $_GET['user']!="" && isset($_GET['pid']) && $_GET['pid']!="") { if(file_exists("ssb_db/posts/post_" . stripslashes($_GET['user']) . "_" . stripslashes($_GET['pid']) . ".php")) { $postuser = $_GET['user']; $pid = $_GET['pid']; $handle = fopen("ssb_db/posts/$pid.reacted", "r"); if ($handle) { while (($line = fgets($handle)) !== false) { $line = str_replace(array("\n", "\r"), '', $line); if($line == $username) { echo "You've already reacted to this post... redirecting"; header("refresh: 3;url=index.php?view=$pid&user=$postuser"); exit; } } fclose($handle); } else { echo ""; } if(file_exists("ssb_db/posts/$pid.reacted")) { $reactedPrev = file_get_contents("ssb_db/posts/$pid.reacted"); file_put_contents("ssb_db/posts/$pid.reacted", $reactedPrev . $username . "\n"); // You reacted } else { file_put_contents("ssb_db/posts/$pid.reacted", $username . "\n"); // First react } if(file_exists("ssb_db/posts/$pid.reactcount")) { $reactCount = file_get_contents("ssb_db/posts/$pid.reactcount"); $reactCurrent = $reactCount + 1; file_put_contents("ssb_db/posts/$pid.reactcount", $reactCurrent); // You reacted } else { file_put_contents("ssb_db/posts/$pid.reactcount", "1"); // First react } // Don't send yourself a notification, you know you liked your own post ;) if($postuser != $username) { $owner_notifications = file_get_contents("ssb_db/friends/" . $postuser . ".notifications"); file_put_contents("ssb_db/friends/" . $postuser . ".notifications", "$username loved your post\n" . $owner_notifications); } echo "Reacted! Redirecting in 1 second..."; header("Location:index.php"); exit; } else { echo "ERROR: post doesn't exist..."; } } else { echo "ERROR: USER and PID variables not set!"; } } } if($do=="clrnote") { if ($loginCheck != true) { loginForm(); } else { unlink("ssb_db/friends/" . $username . ".notifications"); header("Location: index.php"); exit; } } if($do=="clrpending") { if ($loginCheck != true) { loginForm(); } else { unlink("ssb_db/friends/" . $username . ".pending"); header("Location: index.php?do=friends"); exit; } } // Server admin can just delete ssb_db /*if($do=="clean") { if($_POST['password']!="" && $_POST['password']==$pw) { $db_content = glob("ssb_db/" . '*', GLOB_MARK); foreach($db_content as $file) { unlink($file); } rmdir("ssb_db"); echo "Database Cleaned
"; } else { echo "ERROR: Wrong Password
"; } }*/ // grab session values and send friend request functions. if($do=="sendfr") { if ($loginCheck != true) { loginForm(); } else { if(isset($_POST['user']) || isset($_GET['user'])) { //check if user exists first lol if(isset($_POST['user'])) { $givenUser = htmlentities(stripcslashes($_POST['user'])); } else { $givenUser = htmlentities(stripcslashes($_GET['user'])); } //check if user exists first lol if(file_exists("ssb_db/users/" . $givenUser . ".php")) { include "ssb_db/users/" . $givenUser . ".php"; if($accttype == "private") { sendFriendRequest($_SESSION['ssb-user'], $givenUser); echo "Follow request sent to " . $givenUser . " redirecting in 3 seconds"; header("refresh: 3;url=?do=friends"); } else if($accttype == "public") { acceptPublicFriendRequest($username, $givenUser); header("Location: ?do=friends"); } else { echo "ERROR: Issues parsing account type..."; } } else { echo "Error: Provided username does not exist in the database!"; } } else { echo "Error: users not set in GET value..."; } } } if($do=="accfr") { if ($loginCheck != true) { loginForm(); } else { if(isset($_GET['user']) && isset($_GET['friend'])) { acceptFriendRequest(stripslashes($_GET['user']), stripslashes($_GET['friend'])); echo "Accepted friend request from " . htmlentities(stripslashes($_GET['friend'])) . " redirecting in 3 seconds"; header("refresh: 3;url=?do=friends"); } else { echo "Error: users not set in GET & SESSION value..."; } } } if($do=="userctrl") { if ($loginCheck != true) { loginForm(); } else { // Beginning of user control panel echo "
User control panel
"; echo "Change password"; echo "Upload avatar
"; } } if($do=="changepass") { if ($loginCheck != true) { loginForm(); } else { // Beginning password change // inputs $oldPassInput = htmlentities(stripslashes($_POST['oldpass'])); $newPassInput = htmlentities(stripslashes($_POST['password'])); $passwordAgainInput = htmlentities(stripslashes($_POST['password_again'])); include "ssb_db/users/" . $username . ".php"; if(sha1(md5($oldPassInput)) == $user_password) { if($newPassInput == $passwordAgainInput) { $oldcontent = file_get_contents("ssb_db/users/" . $username . ".php"); $passString = "\n"; file_put_contents("ssb_db/users/" . $username . ".php", $oldcontent . $passString); echo "Password changed, redirecting in 3 seconds"; $_SESSION['ssb-user'] = null; $_SESSION['ssb-pass'] = null; header("refresh: 3;url=index.php"); } } else { echo "ERROR: password incorrect! IP recorded for constant monitoring of possible bots!"; file_put_contents("ssb_db/log.txt", "PASS MISMATCH: IP <" . $_SERVER['REMOTE_ADDR'] . "> Cookie spoofing detected from remote client!!!\n"); } } } if($do=="privmsg") { if ($loginCheck != true) { loginForm(); } else { //check if friend is set if(!isset($_GET['friend'])) { echo "ERROR: No username defined!"; exit(1); } else { // set friend username $friendNick = htmlentities(stripslashes($_GET['friend'])); $friendcount = file_get_contents("ssb_db/friends/" . $username . ".count"); include "ssb_db/friends/" . $username . ".php"; for($x = 1; $x <= $friendcount; $x++) { if($friendNick == ${"friend" . $x}) { ?>
" . $friendNick . ": " . $user_fullname . "";
?>
";
echo "
";
?>
" . $friendNick . ": Message history";
?>
About";
echo "";
echo "
";
echo "
";
?>
" . $desc;
echo "
";
echo "$ssbtitle statistics: ";
getUserCount();
echo "; ";
getPostCount();
echo "; ";
getUploadFileCount();
echo "
Community
"; foreach(array_reverse(glob("ssb_db/users/"."*.name")) as $userfile) { $userhandle = file_get_contents($userfile); include "ssb_db/users/" . $userhandle . ".php"; if($accttype == "public") { echo ""; echo " | $userhandle ~ $user_fullname | "; echo "
Friends
Public users Send friend request"; // Friends list if you have any. echo ""; $friendc = file_get_contents("ssb_db/friends/" . $username . ".count"); if($friendc == "0") { echo "We're sorry... no friends found on your user account..."; } else { $friendcount = file_get_contents("ssb_db/friends/" . $username . ".count"); include "ssb_db/friends/" . $username . ".php"; echo "
" . ${"friend" . $x} . " | Private message Message history |
$postowner$postdate ";
if(file_exists("ssb_db/posts/$postid.reactcount")) {
$reacts = file_get_contents("ssb_db/posts/$postid.reactcount");
echo "";
// Pull up users who reacted, and generate dropdown list.
$reactlist = fopen("ssb_db/posts/$postid.reacted", "r");
if($reactlist) {
while (($reactor = fgets($reactlist)) !== false) {
echo "$reactor";
}
fclose($reactlist);
}
echo " |
\n"; } if($poststart > "1" && $postcount > $poststart && $postcount < ($poststart + 15)) { echo "
$postowner$postdate ";
if(file_exists("ssb_db/posts/$postid.reactcount")) {
$reacts = file_get_contents("ssb_db/posts/$postid.reactcount");
echo "";
// Pull up users who reacted, and generate dropdown list.
$reactlist = fopen("ssb_db/posts/$postid.reacted", "r");
if($reactlist) {
while (($reactor = fgets($reactlist)) !== false) {
echo "$reactor";
}
fclose($reactlist);
}
echo " |
\n"; } } } if($postowner == $username) { // Found a post, post count goes up! $postcount++; if($poststart == "1" && $postcount < ($poststart + 15)) { echo "
$postowner$postdate ";
if(file_exists("ssb_db/posts/$postid.reactcount")) {
$reacts = file_get_contents("ssb_db/posts/$postid.reactcount");
echo "";
// Pull up users who reacted, and generate dropdown list.
$reactlist = fopen("ssb_db/posts/$postid.reacted", "r");
if($reactlist) {
while (($reactor = fgets($reactlist)) !== false) {
echo "$reactor";
}
fclose($reactlist);
}
echo " |
\n"; } if($poststart > "1" && $postcount > $poststart && $postcount < ($poststart + 15)) { echo "
$postowner$postdate ";
if(file_exists("ssb_db/posts/$postid.reactcount")) {
$reacts = file_get_contents("ssb_db/posts/$postid.reactcount");
echo "";
// Pull up users who reacted, and generate dropdown list.
$reactlist = fopen("ssb_db/posts/$postid.reacted", "r");
if($reactlist) {
while (($reactor = fgets($reactlist)) !== false) {
echo "$reactor";
}
fclose($reactlist);
}
echo " |
\n"; } } } // Page button generation echo ""; } ?>