hi there I read a lot about secure 'remeber me' php login
I want use this algorithm:
1- create a database for coockei like this:
$sql = "CREATE TABLE IF NOT EXISTS Cookie
(
id INT(10) UNSIGNED AUTO_INCREMENT PRIMARY KEY,
pid INT(10) UNSIGNED NOT NULL, #user id
token VARCHAR(254) COLLATE utf8_persian_ci NOT NULL,
expires INT(11) NOT NULL,
UNIQUE (token),
FOREIGN KEY (pid) REFERENCES Profile (id)
) DEFAULT COLLATE utf8_persian_ci";
2- when a user login successfully, the system create a cookie with a random token with md5(uniqid(rand(), true)) and date of last login and user id
3- also md5(uniqid(rand(), true)) and date of last login and user id will store in MYSQL DB.
4- for second time, when user login,The system read cookie info and check with Cookie table. If it was ok the user will be login! and regenerate new token.
Dose this method is secure?
Dose a hacker can steal that token (form an user computer) and login with a fake cookie?