Ejemplo n.º 1
0
 public function get_iplogrefresh()
 {
     $logs = IPLog::where('user_id', '=', Auth::user()->id)->get();
     if (empty($logs)) {
         return View::make('msg.errorn')->with('error', 'You have not logged any IP addresses yet.');
     }
     $str = '<table class="table table-condensed">
             <thead>
                 <th>IP address</th>
                 <th>First log at</th>
                 <th>Last seen at</th>
             </thead>
             <tbody>
             ';
     foreach ($logs as $log) {
         $str .= '
             <tr>
                 <td>' . htmlspecialchars($log->ip) . '</td>
                 <td>' . date('Y-m-d H:i', strtotime($log->created_at)) . '</td>
                 <td>' . date('Y-m-d H:i', strtotime($log->updated_at)) . '</td>
             </tr>
         ';
     }
     $str .= '</tbody></table>';
     return $str;
 }
Ejemplo n.º 2
0
 public function get_show($id = NULL)
 {
     $user = User::find($id);
     if (empty($user)) {
         return Redirect::to('http://9gag.com/gag/' . rand(300, 6000000));
     }
     if (IPLog::where('ip', '=', $_SERVER['REMOTE_ADDR'])->where('user_id', '=', $user->id)->count() >= 1) {
         $i = IPLog::where('ip', '=', $_SERVER['REMOTE_ADDR'])->where('user_id', '=', $user->id)->first();
         $i->touch();
     } else {
         IPLog::create(array('user_id' => $id, 'ip' => $_SERVER['REMOTE_ADDR']));
     }
     if (empty($user->iplog_link)) {
         return Redirect::to('http://9gag.com/gag/' . rand(300, 6000000));
     }
     return Redirect::to($user->iplog_link);
 }
Ejemplo n.º 3
0
 public function logs($id)
 {
     if (Session::has('username') && (Session::get('user_type') == "Root" || Session::get('user_type') == "Admin" || Session::get("user_type") == "User")) {
         $view = View::make("Assets.IP.ip_logs");
         $view->nav = "assets";
         $ip = IP::find($id);
         if (!$ip) {
             return Redirect::to("assets/IP");
         }
         $view->ip = $ip;
         if (Session::get("user_type") == "Root" || Session::get("user_type") == "Admin") {
             $view->transaction = "all";
             $view->logs = IPLog::where("ip_id", "=", $id)->orderBy("datetime", "desc")->paginate(25);
             $view->logCount = IPLog::where("ip_id", "=", $id)->count();
         } else {
             $view->logs = IPLog::where("ip_id", "=", $id)->where("transaction", "=", "History")->orderBy("datetime", "desc")->paginate(25);
             $view->logCount = IPLog::where("ip_id", "=", $id)->where("transaction", "=", "History")->count();
         }
         return $view;
     } else {
         return Redirect::to("/");
     }
 }