"> >
"; echo ""; if ($handle) { while (($line = fgets($handle)) !== false) { echo ""; } fclose($handle); } else { echo ""; } echo "
Clear notifications
" . $line . "
No notifications

"; } if(isset($_GET['forms'])) { $forms = $_GET['forms']; $id = $_GET['pid']; if($forms=="register") { registerForm(); } else if($forms=="login") { loginForm(); } else if($forms=="friendreq") { friendReqForm(); } else if($forms=="changepass") { changePassForm(); } else if($forms=="deleteacct") { deleteAcctForm(); } else if($forms=="avatarupload") { uploadAvatarForm(); } else if($forms=="post") { postForm(); } else if($forms=="clean") { cleanForm(); } else { echo "ERROR: Unknown form-name
"; } } 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 { 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 (isset($_SESSION['ssb-user']) || isset($_SESSION['ssb-pass'])) { $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; include $postfile; for($x = 1; $x <= $friendcount; $x++) { if($postowner == ${"friend" . $x}) { echo "

$postowner$postdate
 reply

"; echo "" . bbcode_format($postcontent) . ""; echo "

\n"; } } if($postowner == $username) { echo "

$postowner$postdate
 replydelete post

"; echo "" . bbcode_format($postcontent) . ""; echo "

\n"; } } echo ""; } } else { echo "

User information

"; echo "
"; // Get user avatar if set if(isset($user_avatar)) { 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) { //echo $postfile; include $postfile; echo "

$postowner$postdate
 reply

"; echo "" . bbcode_format($postcontent) . ""; echo "

\n"; } } } 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

"; echo "" . bbcode_format($postcontent) . ""; 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 (!isset($_SESSION['ssb-user']) || !isset($_SESSION['ssb-pass'])) { 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 (!isset($_SESSION['ssb-user']) || !isset($_SESSION['ssb-pass'])) { 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 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); 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 comment\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(); foreach($uploaded as &$upload) { if(file_exists("ssb_db/uploads/" . $upload)) { array_push($attachments, "
"); } } 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... Redirecting in 3 seconds, if redirection fails, Click Here
"; //header( "refresh: 3; url=?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"]) && isset($username)) { $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=minimum.php"); } } } else { echo "Error: " . $_FILES["file"]["name"][$i] . " is too large, or is a invalid filetype"; } } } } if($do=="users") { if (!isset($_SESSION['ssb-user']) || !isset($_SESSION['ssb-pass'])) { loginForm(); } else { include "ssb_db/users/" . $username . ".php"; 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"; echo "
"; } } } } if($do=="reply") { if (!isset($_SESSION['ssb-user']) || !isset($_SESSION['ssb-pass'])) { 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: minimum.php?view=$pid&user=$postowner" ); } else { echo "ERROR: Missing form data
"; } } } } if($do=="delpost") { if (!isset($_SESSION['ssb-user']) || !isset($_SESSION['ssb-pass'])) { loginForm(); } else { include "ssb_db/users/" . $username . ".php"; if($user_password === $_SESSION['ssb-pass']) { 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"); echo "Post successfully deleted! redirecting in 3 seconds...
"; header("refresh: 3;url=minimum.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!"; } } else { echo "ERROR: PASSWORD FOR USER INCORRECT! IP LOGGED!"; file_put_contents("ssb_db/log.txt", "PASS MISMATCH: IP <" . $_SERVER['REMOTE_ADDR'] . "> Cookie spoofing detected from remote client!!!\n"); } } } if($do=="clrnote") { if (!isset($_SESSION['ssb-user']) || !isset($_SESSION['ssb-pass'])) { loginForm(); } else { include "ssb_db/users/" . $username . ".php"; if($user_password === $_SESSION['ssb-pass']) { unlink("ssb_db/friends/" . $username . ".notifications"); header("Location: minimum.php"); exit; } else { echo "ERROR: PASSWORD FROM COOKIE INCORRECT! IP RECORDED!"; file_put_contents("ssb_db/log.txt", "PASS MISMATCH: IP <" . $_SERVER['REMOTE_ADDR'] . "> Cookie spoofing detected from remote client!!!\n"); } } } if($do=="clrpending") { if (!isset($_SESSION['ssb-user']) || !isset($_SESSION['ssb-pass'])) { loginForm(); } else { include "ssb_db/users/" . $username . ".php"; if($user_password === $_SESSION['ssb-pass']) { unlink("ssb_db/friends/" . $username . ".pending"); header("Location: minimum.php?do=friends"); exit; } else { echo "ERROR: PASSWORD FROM COOKIE INCORRECT! IP RECORDED!"; file_put_contents("ssb_db/log.txt", "PASS MISMATCH: IP <" . $_SERVER['REMOTE_ADDR'] . "> Cookie spoofing detected from remote client!!!\n"); } } } // 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 (!isset($_SESSION['ssb-user']) || !isset($_SESSION['ssb-pass'])) { 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=minimum.php?do=friends"); } else if($accttype == "public") { acceptPublicFriendRequest($username, $givenUser); header("Location: minimum.php?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 (!isset($_SESSION['ssb-user']) || !isset($_SESSION['ssb-pass'])) { 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=minimum.php?do=friends"); } else { echo "Error: users not set in GET & SESSION value..."; } } } if($do=="userctrl") { if (!isset($_SESSION['ssb-user']) || !isset($_SESSION['ssb-pass'])) { loginForm(); } else { // Beginning of user control panel echo "

User control panel

"; echo "Change password
"; echo "Upload avatar
"; } } if($do=="changepass") { if (!isset($_SESSION['ssb-user']) || !isset($_SESSION['ssb-pass'])) { 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=minimum.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 (!isset($_SESSION['ssb-user']) || !isset($_SESSION['ssb-pass'])) { 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}) { ?>

About"; echo ""; echo $desc; echo "

"; echo "$ssbtitle statistics: "; getUserCount(); echo "; "; getPostCount(); echo "; "; getUploadFileCount(); } if($do=="friends") { if (!isset($_SESSION['ssb-user']) || !isset($_SESSION['ssb-pass'])) { loginForm(); } else { $friendpend = "ssb_db/friends/" . $username . ".pending"; $handle = fopen($friendpend, "r"); echo "

Friend requests

Clear history Send friend request"; echo "
"; if ($handle) { while (($line = fgets($handle)) !== false) { echo "Pending friend request from " . $line . "! Accept
"; } fclose($handle); } else { echo "No pending friend requests
"; } echo "
"; // Friends list if you have any. echo "

Friends list


"; $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})) { echo ""; } } echo "
" . ${"friend" . $x} . "View user profilePrivate message
"; } } } 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: minimum.php"); } else { echo "Wrong password!"; } } else { echo "User $username not found!"; } } // Push user avatar to specific avatar image location if($do=="avatarlocation") { if(isset($_GET['user'])) { $user = htmlentities(stripslashes($_GET['user'])); include "ssb_db/users/" . $user . ".php"; if(file_exists("ssb_db/uploads/" . $user_avatar)) { echo "Direct to: ssb_db/uploads/" . $user_avatar; header("Location: ssb_db/uploads/" . $user_avatar . ""); exit; } else { echo "Direct to: data/defaultprofile.png"; header("Location: data/defaultprofile.png"); exit; } } else { echo "User is NOT set!"; } } if($do=="logout") { $_SESSION['ssb-user'] = null; $_SESSION['ssb-pass'] = null; header("Location: minimum.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: minimum.php"); } else { header("Location: minimum.php?notify=6"); } } else { header("Location: minimum.php?notify=5"); } } else { header("Location: minimum.php?notify=4"); } } else { header("Location: minimum.php?notify=3"); } header("Location: minimum.php"); } } else if (!isset($_SESSION['ssb-user']) || !isset($_SESSION['ssb-pass'])) { 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) { $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
reply

"; echo "" . bbcode_format($postcontent) . ""; echo "

\n"; } if($poststart > "1" && $postcount > $poststart && $postcount < ($poststart + 15)) { echo "

$postowner$postdate
reply

"; echo "" . bbcode_format($postcontent) . ""; echo "

\n"; } } } if($postowner == $username) { // Found a post, post count goes up! $postcount++; if($poststart == "1" && $postcount < ($poststart + 15)) { echo "

$postowner$postdate
replydelete post

"; echo "" . bbcode_format($postcontent) . ""; echo "

\n"; } if($poststart > "1" && $postcount > $poststart && $postcount < ($poststart + 15)) { echo "

$postowner$postdate
replydelete post

"; echo "" . bbcode_format($postcontent) . ""; echo "

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

Powered By SSB