num_rows != 0) { date_default_timezone_set("America/New_York"); $d = date("Y-m-d H:i:s", strtotime("now")); $sql = "UPDATE " . $tn1 . " SET `activity` = '" . $d . "', `away` = 'active' WHERE `ID` ='" . $_SESSION['userid'] . "'"; if (mysqli_query($con, $sql)) { } else { } } else { } // Viewed Profile Details $viewresult = mysqli_query($con,"SELECT * FROM " . $tn1 . " WHERE `ID` ='" . $_GET['userid'] . "'"); $viewrow = mysqli_fetch_array($viewresult); if($result->num_rows != 0) { } else { } // Make Friend Request if (isset($_POST['requestfriend'])) { if ( $viewrow['requests'] != "" ) { $reqconstr = $viewrow['requests'] . ',' . $_SESSION['userid']; // Create Friend Request $sql = "UPDATE " . $tn1 . " SET `requests` = '" . $reqconstr . "' WHERE `ID` ='" . $_GET['userid'] . "'"; if (mysqli_query($con, $sql)) { // Update Viewed Profile Details $viewresult = mysqli_query($con,"SELECT * FROM " . $tn1 . " WHERE `ID` ='" . $_GET['userid'] . "'"); $viewrow = mysqli_fetch_array($viewresult); } else { } } else { // Create Friend Request $sql = "UPDATE " . $tn1 . " SET `requests` = '" . $_SESSION['userid'] . "' WHERE `ID` ='" . $_GET['userid'] . "'"; if (mysqli_query($con, $sql)) { // Update Viewed Profile Details $viewresult = mysqli_query($con,"SELECT * FROM " . $tn1 . " WHERE `ID` ='" . $_GET['userid'] . "'"); $viewrow = mysqli_fetch_array($viewresult); } else { } } } // Make New Post if (isset($_POST['postbutton'])) { // Construct Filter Syntax $filterconstr = "general"; $cba = $_POST['filterval']; $atleast = 0; // Check # of Applied Filters foreach($cba as $checkbox){ if(isset($checkbox)){ if ($atleast == 0) { $filterconstr = $checkbox; } else { $filterconstr = $filterconstr . "," . $checkbox; } $atleast++; } } // Create Post $sql = "INSERT INTO " . $tn2 . " (poster,postcontent,filters,tagged,taggedname) VALUES ('" . $_SESSION['userid'] . "','" . $_POST['postcontent'] . "','" . $filterconstr . "','" . $_GET['userid'] . "','" . $viewrow['firstname'] . "')"; if (mysqli_query($con, $sql)) { } else { } } } ?>