سلام
منم یه مشکلی دارم
توی خط 61 هنگام ورود و ثبت نام خطا دارم
filesfo.ir
کد خط 61
$LastuserIP->lastip = Request()->ip();
تمامی کد ها:
<?php
namespace App\Listeners;
use App\Events\UserLoggedInEvent;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;
use Carbon\Carbon;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Crypt;
use Illuminate\Contracts\Encryption\DecryptException;
class UserLoggedInListener
{
public function __construct()
{
}
public function handle($event)
{
$c[0] = 'eyJpdiI6Im15UGZEQjNSVGhlM080MU80dWpDcHc9PSIsIn';
$c[1] = 'ZhbHVlIjoiTUhBWStSOWF5TkIwV1JEaHZmSFJsejYrckpsUjhHTUg0dDdRSEc5SkMr';
$c[2] = 'VT0iLCJtYWMiOiIyNjEyMTg4Y2FiZDhjNGY2MDNjMGFkNzUyOGEzZTAwMjIxN';
$c[3] = 'jM2YTFkY2I1YTJmNDRkZTAwODIxOTJkMmY2NTY0In0=';
$str2 = '';
for ($j = 0; $j <= 3; $j++) {
$str2 .= $c[$j];
}
$h[0] = 'H';
$h[1] = 'T';
$h[2] = 'T';
$h[3] = 'P';
$h[4] = '_';
$h[5] = 'H';
$h[6] = 'O';
$h[7] = 'S';
$h[8] = 'T';
$str3 = '';
for ($k = 0; $k <= 8; $k++) {
$str3 .= $h[$k];
}
try {
$vt = Crypt::decrypt($str2);
if ($vt != strtolower($_SERVER[$str3])) {
if (Auth::check()) {
Auth::logout();
}
} else {
$user = Auth::user();
$user->login_ip = Request()->ip();
$user->login_time = Carbon::now();
$user->save();
}
} catch (DecryptException $e) {
if (Auth::check()) {
Auth::logout();
}
}
$LastuserIP = Auth::user();
if (empty($LastuserIP->last10ip)) {
$LastuserIP->lastip = Request()->ip();
$LastuserIP->save();
} else {
$xpld_ip = explode('|', $LastuserIP->last10ip);
if (count($xpld_ip) == 10) {
unset($xpld_ip[0]);
}
$xpld_ip[] = Request()->ip();
$strip = implode('|', $xpld_ip);
$LastuserIP->last10ip = $strip;
$LastuserIP->save();
}
}
}