ip storage "fixes"
This commit is contained in:
parent
3413efd825
commit
3eeca9767b
2 changed files with 21 additions and 3 deletions
|
@ -190,6 +190,12 @@ class Post
|
|||
// Create a topic object
|
||||
$topic = new Topic($this->topic);
|
||||
|
||||
try {
|
||||
$ip = Net::pton($this->ip);
|
||||
} catch (NetAddressTypeException $e) {
|
||||
$ip = Net::pton("::1");
|
||||
}
|
||||
|
||||
// Update the post
|
||||
DB::table('posts')
|
||||
->where('post_id', $this->id)
|
||||
|
@ -197,7 +203,7 @@ class Post
|
|||
'topic_id' => $topic->id,
|
||||
'forum_id' => $topic->forum,
|
||||
'poster_id' => $this->poster->id,
|
||||
'poster_ip' => Net::pton($this->ip),
|
||||
'poster_ip' => $ip,
|
||||
'post_time' => $this->time,
|
||||
'post_subject' => $this->subject,
|
||||
'post_text' => $this->text,
|
||||
|
|
16
app/User.php
16
app/User.php
|
@ -389,10 +389,16 @@ class User
|
|||
} catch (NetAddressTypeException $e) {
|
||||
$this->registerIp = $userRow->register_ip;
|
||||
|
||||
try {
|
||||
$reg_ip = Net::pton($this->registerIp);
|
||||
} catch (NetAddressTypeException $e) {
|
||||
$reg_ip = Net::pton("::1");
|
||||
}
|
||||
|
||||
DB::table('users')
|
||||
->where('user_id', $this->id)
|
||||
->update([
|
||||
'register_ip' => Net::pton($this->registerIp),
|
||||
'register_ip' => $reg_ip,
|
||||
]);
|
||||
}
|
||||
|
||||
|
@ -401,10 +407,16 @@ class User
|
|||
} catch (NetAddressTypeException $e) {
|
||||
$this->lastIp = $userRow->last_ip;
|
||||
|
||||
try {
|
||||
$last_ip = Net::pton($this->lastIp);
|
||||
} catch (NetAddressTypeException $e) {
|
||||
$last_ip = Net::pton("::1");
|
||||
}
|
||||
|
||||
DB::table('users')
|
||||
->where('user_id', $this->id)
|
||||
->update([
|
||||
'last_ip' => Net::pton($this->lastIp),
|
||||
'last_ip' => $last_ip,
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
|
Reference in a new issue