What are the potential pitfalls of not securely storing a user's IP address during login in PHP?

If a user's IP address is not securely stored during login in PHP, it can lead to security vulnerabilities such as session hijacking or unauthorized access. To mitigate this risk, it is important to store the user's IP address in a secure manner, such as hashing it before storing it in the database.

// Store hashed IP address during login
$ip_address = hash('sha256', $_SERVER['REMOTE_ADDR']);