A unf. social network done poorly.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

68 lines
1.8KB

  1. <?php // Handles all the data for the user.
  2. ini_set('display_errors', '1');
  3. if(isset($_SESSION['Authenticated']) && $_SESSION['Authenticated']){
  4. if($_SESSION['Expires'] < time()){
  5. // Log out here.
  6. exit();
  7. header("Location: logout.php");
  8. }
  9. $_SESSION['Expires'] = time() + 86400; // if logged in, set to 24 hours.
  10. }
  11. require_once($_SERVER['DOCUMENT_ROOT'] . '/socialtune/includes/session.php');
  12. require_once($_SERVER['DOCUMENT_ROOT'] . '/socialtune/includes/config.php');
  13. /* sets session variables. */
  14. $email = $_SESSION['username'];
  15. $connection = mysqli_connect($dbHost, $dbUser, $dbPass, $dbName);
  16. $data = mysqli_query($connection, "SELECT * FROM users WHERE email='$email'");
  17. if($data){
  18. $row = mysqli_fetch_array($data, MYSQLI_NUM);
  19. $user_id = $row[0];
  20. $user_email = $row[1];
  21. //$user_password = $row[2]; // WHY WOULD YOU EVEN WANT THIS TO BE AVAILABLE>?!?!?!?!?!?!?! LOL Ashton PLS
  22. $user_First_Name = $row[3];
  23. $user_Last_Name = $row[4];
  24. $user_birthdate = $row[5];
  25. $user_country = $row[6];
  26. $user_state = $row[7];
  27. $user_town = $row[8];
  28. $user_signup = $row[9];
  29. $user_bio = $row[10];
  30. $user_image_ext = $row[11];
  31. $user_isOnline = $row[13];
  32. }else{
  33. echo "The data didn't go through.";
  34. }
  35. /*-- Notification Check --*/
  36. $pending_notification = 0;
  37. $query = "SELECT * FROM friends WHERE user_two='$user_id' AND pending='1'";
  38. $requests = mysqli_query($connection, $query);
  39. if(mysqli_num_rows($requests) > 0){
  40. $pending_notification = 1;
  41. }else{
  42. $pending_notification = 0;
  43. }
  44. /* old... This fucking breaks.
  45. if($requests){
  46. $request = mysqli_fetch_array($requests, MYSQLI_NUM);
  47. $request_user_one = $row[1];
  48. $request_pending = $row[3];
  49. if($request_pending == 1){
  50. $pending_notification = 1;
  51. }
  52. }
  53. */
  54. ?>