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.

213 lines
6.8KB

  1. <?php
  2. ini_set('display_errors', '1');
  3. require_once($_SERVER['DOCUMENT_ROOT'] . '/socialtune/includes/session.php');
  4. require_once($_SERVER['DOCUMENT_ROOT'] . '/socialtune/includes/config.php');
  5. require_once($_SERVER['DOCUMENT_ROOT'] . '/socialtune/includes/user-data.php');
  6. if(isset($_SESSION['Authenticated']) && $_SESSION['Authenticated']){
  7. if($_SESSION['Expires'] < time()){
  8. // Log out here.
  9. exit();
  10. header("Location: logout.php");
  11. }
  12. $_SESSION['Expires'] = time() + 86400; // if logged in, set to 24 hours.
  13. //header("Location: Dashboard.php");
  14. }else{
  15. header("Location: index.php");
  16. }
  17. ?>
  18. <!DOCTYPE html>
  19. <html lang="en">
  20. <head>
  21. <meta charset="utf-8">
  22. <meta http-equiv="X-UA-Compatible" content="IE=edge">
  23. <meta name="viewport" content="width=device-width, initial-scale=1">
  24. <title>SocialTune | <?php echo 'profile'; ?></title>
  25. <!--// bootstrap //-->
  26. <link href="css/bootstrap.css" rel="stylesheet">
  27. <link href="css/specialFX.css" rel="stylesheet">
  28. <script type="text/javascript"
  29. src="socialtune-chat/client/js/jquery-1.11.0.js">
  30. </script>
  31. <script type="text/javascript"
  32. src="socialtune-chat/client/js/md5.js">
  33. </script>
  34. <script type="text/javascript"
  35. src="socialtune-chat/client/js/store.js">
  36. </script>
  37. <script type="text/javascript"
  38. src="socialtune-chat/client/js/cookies.js">
  39. </script>
  40. <script type="text/javascript"
  41. src="socialtune-chat/client/js/dateformat.js">
  42. </script>
  43. <script type="text/javascript"
  44. src="socialtune-chat/client/js/im.js">
  45. </script>
  46. <script type="text/javascript">
  47. $(function(){
  48. if (!cookies.get('sessionid')) {
  49. cookies.set('sessionid', uid(40));
  50. }
  51. var u =
  52. window.location.href.split('/');
  53. var p = 8000; // Node.js port
  54. u = u[0]+'//'+u[2]+':'+p;
  55. var im = AjaxIM.init({pollServer: u,
  56. theme: 'themes/default'});
  57. });
  58. </script>
  59. <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
  60. <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
  61. <!--[if lt IE 9]>
  62. <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
  63. <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
  64. <![endif]-->
  65. <style>
  66. html,
  67. body{
  68. height: 100%;
  69. }
  70. #wrap{
  71. min-height: 100%;
  72. height: auto !important;
  73. height: 100%
  74. margin: 0 auto -60px;
  75. }
  76. #push,
  77. #footer{
  78. height: 60px;
  79. }
  80. @media(max-width: 767px){
  81. #footer{
  82. margin-left: -20px;
  83. margin-right: -20px;
  84. padding-left: 20px;
  85. padding-right: 20px;
  86. }
  87. }
  88. </style>
  89. </head>
  90. <body>
  91. <div id="wrap">
  92. <!--// Navigation //-->
  93. <nav class="navbar navbar-default navbar-fixed-top">
  94. <div class="container">
  95. <div class="navbar-header">
  96. <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
  97. <span class="sr-only">Toggle Navigation</span>
  98. <span class="icon-bar"></span>
  99. <span class="icon-bar"></span>
  100. <span class="icon-bar"></span>
  101. </button>
  102. <a class="navbar-brand" href="#">Social.Tune</a>
  103. </div>
  104. <div id="navbar" class="navbar-collapse collapse">
  105. <ul class="nav navbar-nav">
  106. <li><a href="dashboard.php">Home</a></li>
  107. <?php if($pending_notification == 1){
  108. echo '<li><span class="relative_blink"><span class="notification_blink"><span class="online_blink">New</span></span></span><a href="notifications.php">Notifications</a></li>';
  109. }else{ echo '<li><a href="notifications.php">Notifications</a><li>'; } // HOLY SHIT THIS IS A CLUSTERFUCK OF BAD. ~~ Ashton
  110. ?> <li><?php echo'<a href="profile.php?id='.$user_id.'">View Profile</a>'; ?></li>
  111. <li><a href="edit-profile.php">Edit Profile</a></li>
  112. <li><?php echo '<a href="friends.php?id='.$user_id.'">Friends</a></li>'; ?>
  113. <li><a href="about.php">About</a></li>
  114. <li><a href="logout.php">Log out</a></li>
  115. </ul>
  116. </div>
  117. </div>
  118. </nav>
  119. <!--// Content //-->
  120. <div class="container">
  121. <div class="jumbotron">
  122. <div class="row">
  123. <div class="col-md-2">
  124. uhh... dunno.
  125. </div>
  126. <div class="col-md-8">
  127. <table class="table">
  128. <caption><center><h2>Notifications</h2></center></caption>
  129. <?php
  130. $connect = mysqli_connect($dbHost, $dbUser, $dbPass, $dbName);
  131. $query = "SELECT * FROM friends WHERE user_two LIKE '$user_id'";
  132. $requests = mysqli_query($connect, $query);
  133. $checked = 0;
  134. while($row = mysqli_fetch_array($requests, MYSQLI_NUM)){
  135. $request_user_one = $row[1];
  136. $request_pending = $row[3];
  137. $get_user_info = "SELECT * FROM users WHERE id='$request_user_one'";
  138. $getting_it = mysqli_query($connect, $get_user_info);
  139. while($userinfo = mysqli_fetch_array($getting_it)){
  140. $userinfo_id = $userinfo[0];
  141. $userinfo_name = $userinfo[3].' '.$userinfo[4];
  142. $userinfo_img = $userinfo[11];
  143. }
  144. if($request_pending == 1){
  145. echo '<tr><td><img style="width:125px; height:125px;" src="user-images/'.$userinfo_img.'"></td>
  146. <td><a href="profile.php?id='.$userinfo_id.'">'.$userinfo_name.'</a></td>
  147. <td>
  148. <form method="POST" action="addfriend.php">
  149. <input type="hidden" name="requester_id" id="requester_id" value="'.$userinfo_id.'">
  150. <input type="hidden" name="decline" id="decline" value="2">
  151. <button type="submit" class="btn btn-primary">Add Friend</button>
  152. </form>
  153. </td>
  154. <td>
  155. <form method="POST" action="addfriend.php">
  156. <input type="hidden" name="requester_id" id="requester_id" value="'.$userinfo_id.'">
  157. <input type="hidden" name="decline" id="decline" value="1">
  158. <button type="submit" class="btn btn-primary">Decline</button>
  159. </form>
  160. </td>
  161. </tr>';
  162. }
  163. if($pending_notification == 0 && $checked == 0){
  164. echo '<td>No friend requests pending</td>';
  165. $checked = 1;
  166. }
  167. }
  168. ?>
  169. </table>
  170. </div>
  171. </div>
  172. </div>
  173. </div>
  174. <div id="push"></div>
  175. </div> <!--## ending wrap ##-->
  176. <!--// Footer //-->
  177. <div id="footer">
  178. <div class="container">
  179. <div class="row">
  180. <div class="col-md-4">
  181. <p style="font-size: 12px;">Social.Tune &copy; 2015</p>
  182. </div>
  183. <div class="col-md-8">
  184. <p class="text-right" style="font-size: 12px;">
  185. | <a href="">English</a> | <a href="">汉语</a> | <a href="">日本語</a> |
  186. <a href="">français</a> |<br /> | <a href="">Social-Tune</a> |
  187. <a href="">About Us</a> |<a href="">Contact Us</a> | <a href="">Careers</a> |
  188. <a href="">Privacy</a> | <a href="">License</a> | <a href="">Help</a> |
  189. </p>
  190. </div>
  191. </div>
  192. </div>
  193. </div>
  194. </div>
  195. </body>
  196. </html>