'; } ?> "> >
"; if ($handle) { while (($line = fgets($handle)) !== false) { echo ""; } fclose($handle); } else { echo ""; } echo "
Notifications: Clear
" . $line . "
No notifications
"; } else { echo ""; } ?> "; } } else if(isset($_GET['notify'])) { $notify = $_GET['notify']; if($notify=="1") { echo "Error: User not found"; } else if($notify=="2") { echo "Error: Incorrect password provided"; } else if($notify=="3") { echo "Error: Please fill out all the text boxes"; } else if($notify=="4") { echo "Error: The provided passwords did not match"; } else if($notify=="5") { echo "Error: Special characters cannot be used in your username"; } else if($notify=="6") { echo "Error: This username is already in use"; } else if($notify=="7") { echo "Error: Current password incorrect!"; } else if($notify=="8") { echo "Success! Current password changed!"; } else { echo "Error: unknown error... this is quite unusual..."; } } else if(isset($_GET['userfeed'])) { $userid = $_GET['userfeed']; // Make sure we're friends or is my account. include "ssb_db/users/" . $userid . ".php"; if ($accttype == "private") { if ($loginCheck == true) { $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}) { echo "
"; echo "

"; // DONE echo "
"; echo "

User information

"; echo "Username: " . $userid . "@" . $domain . "
"; echo "Full name: " . $user_fullname . "
"; echo "

User posts

"; echo "
"; } } // Check if viewing your own profile if($userid == $username) { 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 "
"; } // Lets generate the users feed now. foreach(array_reverse(glob("ssb_db/posts/post_" . $userid . "_" . "*.php")) as $postfile) { //echo $postfile; unset($shared); // Keep clean variables include $postfile; for($x = 1; $x <= $friendcount; $x++) { if($postowner == ${"friend" . $x}) { echo "

$postowner$postdate   "; if(file_exists("ssb_db/posts/$postid.reactcount")) { $reacts = file_get_contents("ssb_db/posts/$postid.reactcount"); echo "
$reacts
"; // 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 "
"; } if(isset($shared) && $shared == "1") { echo "
Originally posted by $origowner"; } echo "

"; echo "" . bbcode_format($postcontent) . ""; // Footer 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 "
$reacts
"; // 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 "
"; } if(isset($shared) && $shared == "1") { echo "
Originally posted by $origowner"; } echo "

"; echo "" . bbcode_format($postcontent) . ""; // Footer 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 "
"; foreach(array_reverse(glob("ssb_db/posts/post_" . $userid . "_" . "*.php")) as $postfile) { include $postfile; unset($shared); echo "

$postowner$postdate   "; if(file_exists("ssb_db/posts/$postid.reactcount")) { $reacts = file_get_contents("ssb_db/posts/$postid.reactcount"); echo "
$reacts
"; // 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 "
"; } if(isset($shared) && $shared == "1") { echo "
Originally posted by $origowner"; } echo "

"; echo "" . bbcode_format($postcontent) . ""; // Footer 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 "
$reacts
"; // 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 "
"; } if(isset($shared) && $shared == "1") { echo "
Originally posted by $origowner"; } echo "

"; echo "" . bbcode_format($postcontent) . ""; // Footer echo " React"; echo " Share"; echo "

\n"; for($x = 1; $x <= $postc; $x++) { $reply_content = ${"reply" . $x}; $reply_user = ${"reply" . $x . "_user"}; $reply_date = ${"reply" . $x . "_date"}; echo "
"; echo "

$reply_user $reply_date

"; echo "
" . bbcode_format($reply_content) . "
"; 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 0) { echo $_FILES["file"]["name"][$i] . " - Return Code: " . $_FILES["file"]["error"][$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, "
" . $uploaded_name[$fileCount] . "
"); } 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 0) { echo $_FILES["file"]["name"][$i] . " - Return Code: " . $_FILES["file"]["error"][$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 . ": Message history"; ?>
"; echo "
"; ?>
About"; echo ""; echo "

" . $desc; echo "

"; echo "$ssbtitle statistics: "; getUserCount(); echo "; "; getPostCount(); echo "; "; getUploadFileCount(); echo "

"; } if($do=="users") { if ($loginCheck != true) { loginForm(); } else { 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 ""; echo "
$userhandle ~ $user_fullname
"; } } } } if($do=="friends") { if ($loginCheck != true) { loginForm(); } else { // Friends panel 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 ""; for($x = 1; $x <= $friendcount; $x++) { if(isset(${"friend" . $x}) && file_exists("ssb_db/users/" . ${"friend" . $x} . ".php")) { echo ""; } } echo "
" . ${"friend" . $x} . "Private message  Message history
"; } } } if($do=="login") { $username = $_POST['username']; if(file_exists("ssb_db/users/$username.php")) { include_once("ssb_db/users/$username.php"); if($user_password==sha1(md5($_POST['password']))) { $pass = $user_password; $user = $username; $color = $user_color; $_SESSION['ssb-user'] = $user; $_SESSION['ssb-pass'] = $pass; $_SESSION['ssb-color'] = $color; header("Location: index.php"); } else { echo "Wrong password!"; } } else { echo "User $username not found!"; } } if($do=="logout") { $_SESSION['ssb-user'] = null; $_SESSION['ssb-pass'] = null; header("Location: index.php?forms=login"); } if($do=="register") { if($_POST['username']!="" && $_POST['password']!="" && $_POST['password-again']!="" && $_POST['fullname']!="" && isset($_POST['acct'])) { if($_POST['password']==$_POST['password-again']) { if(!preg_match('/[^a-z0-9]/i', $_POST['username'])) { if(!file_exists("ssb_db/users/" . $_POST['username'] . ".php")) { $colors = array("0000ff", "9900cc", "0080ff", "008000", "ededed"); $acct = $_POST['acct']; file_put_contents("ssb_db/users/" . stripslashes(htmlentities($_POST['username'])) . ".php", ""); file_put_contents("ssb_db/users/" . stripslashes(htmlentities($_POST['username'])) . ".name", stripslashes(htmlentities($_POST['username']))); file_put_contents("ssb_db/users/" . stripslashes(htmlentities($_POST['username'])) . ".postnumber", "0"); file_put_contents("ssb_db/friends/" . stripslashes(htmlentities($_POST['username'])) . ".count", "0"); file_put_contents("ssb_db/friends/" . stripslashes(htmlentities($_POST['username'])) . ".php", "\n"); header("Location: index.php"); } else { header("Location: index.php?notify=6"); } } else { header("Location: index.php?notify=5"); } } else { header("Location: index.php?notify=4"); } } else { header("Location: index.php?notify=3"); } echo "ERROR!: Something weird just happened... please try registering again!!!..."; //header("Location: index.php"); } } else if ($loginCheck != true) { loginForm(); } else { // Watch feed, lets generate pages while we're at it $pagecall = $_GET['page']; $postcount = 1; if(isset($pagecall) && $pagecall!="") { if($pagecall == "1") { $poststart = $postcount; } else { $poststart = ($pagecall - 1) * 15; // 15 posts per page } } else { $poststart = $postcount; } // Lets actually generate some feed now. foreach(array_reverse(glob("ssb_db/posts/*.post")) as $postfile) { unset($shared); // make sure its not being carried over after loop. $postphp = file_get_contents($postfile); include "ssb_db/posts/$postphp"; $friendcount = file_get_contents("ssb_db/friends/" . $username . ".count"); include "ssb_db/friends/" . $username . ".php"; for($x = 1; $x <= $friendcount; $x++) { if($postowner == ${"friend" . $x}) { // 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 "
$reacts
"; // 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 "
"; } if(isset($shared) && $shared == "1") { echo "
Originally posted by $origowner"; } echo "

"; echo "" . bbcode_format($postcontent) . ""; // Footer echo "
"; echo " React"; echo " Comment"; echo " Share"; echo "
"; // line break if(file_exists("ssb_db/posts/reply_" . $postowner . "_" . $postid . ".count")) { $pcount = file_get_contents("ssb_db/posts/reply_" . $postowner . "_" . $postid . ".count"); // If there's a reply, show them. if($pcount == 0) { echo "no replies"; } else if($pcount == 1) { echo "$pcount reply"; } else if ($pcount > 0) { echo "$pcount replies"; } } echo " • "; // Show reaction count in footer as well. if(file_exists("ssb_db/posts/" . $postid . ".reactcount")) { $reactcount = file_get_contents("ssb_db/posts/" . $postid . ".reactcount"); if($reactcount == 1) { echo "$reactcount reaction"; } else if ($reactcount > 0) { echo "$reactcount reactions"; } } else { echo "no reactions"; } 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 "
$reacts
"; // 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 "
"; } if(isset($shared) && $shared == "1") { echo "
Originally posted by $origowner"; } echo "

"; echo "" . bbcode_format($postcontent) . ""; // Footer echo "
"; echo " React"; echo " Comment"; echo " Share"; echo "
"; // line break if(file_exists("ssb_db/posts/reply_" . $postowner . "_" . $postid . ".count")) { $pcount = file_get_contents("ssb_db/posts/reply_" . $postowner . "_" . $postid . ".count"); // If there's a reply, show them. if($pcount == 0) { echo "no replies"; } else if($pcount == 1) { echo "$pcount reply"; } else if ($pcount > 0) { echo "$pcount replies"; } } echo " • "; // Show reaction count in footer as well. if(file_exists("ssb_db/posts/" . $postid . ".reactcount")) { $reactcount = file_get_contents("ssb_db/posts/" . $postid . ".reactcount"); if($reactcount == 1) { echo "$reactcount reaction"; } else if ($reactcount > 0) { echo "$reactcount reactions"; } } else { echo "no reactions"; } 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 "
$reacts
"; // 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 "
"; } if(isset($shared) && $shared == "1") { echo "
Originally posted by $origowner"; } echo "

"; echo "" . bbcode_format($postcontent) . ""; // Footer echo "
"; echo " React"; echo " Comment"; echo " Delete"; echo "
"; // line break if(file_exists("ssb_db/posts/reply_" . $postowner . "_" . $postid . ".count")) { $pcount = file_get_contents("ssb_db/posts/reply_" . $postowner . "_" . $postid . ".count"); // If there's a reply, show them. if($pcount == 0) { echo "no replies"; } else if($pcount == 1) { echo "$pcount reply"; } else if ($pcount > 0) { echo "$pcount replies"; } } echo " • "; // Show reaction count in footer as well. if(file_exists("ssb_db/posts/" . $postid . ".reactcount")) { $reactcount = file_get_contents("ssb_db/posts/" . $postid . ".reactcount"); if($reactcount == 1) { echo "$reactcount reaction"; } else if ($reactcount > 0) { echo "$reactcount reactions"; } } else { echo "no reactions"; } 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 "
$reacts
"; // 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 "
"; } echo "

"; echo "" . bbcode_format($postcontent) . ""; // Footer echo "
"; echo " React"; echo " Comment"; echo " Delete"; echo "
"; // line break if(file_exists("ssb_db/posts/reply_" . $postowner . "_" . $postid . ".count")) { $pcount = file_get_contents("ssb_db/posts/reply_" . $postowner . "_" . $postid . ".count"); // If there's a reply, show them. if($pcount == 0) { echo "no replies"; } else if($pcount == 1) { echo "$pcount reply"; } else if ($pcount > 0) { echo "$pcount replies"; } } echo " • "; // Show reaction count in footer as well. if(file_exists("ssb_db/posts/" . $postid . ".reactcount")) { $reactcount = file_get_contents("ssb_db/posts/" . $postid . ".reactcount"); if($reactcount == 1) { echo "$reactcount reaction"; } else if ($reactcount > 0) { echo "$reactcount reactions"; } } else { echo "no reactions"; } echo "

\n"; } } } // Page button generation echo "
"; if($poststart > "1") { $prevpage = $poststart / 15; echo "   Prev page"; } echo "   "; if($poststart == "1" && $postcount > ($poststart + 15)) { echo "Next page   "; } if($poststart > "1" && $postcount > ($poststart + 15)) { $nextpage = ($poststart / 15) + 2; echo "Next page   "; } echo "
"; } ?>