javascript, cookie, php and many more with ecommerce
I'm working on a website which is e commerce website I've done all but i'm not good with cookies so my client says that he want to know that the person who buy products from it how many times visited before by date , by time its open site so anyone can visit no session use, I'm totally confused with开发者_StackOverflow社区 it huh
you def need a cookie, maybe store the user's ip address and current date on that cookie:
//user details
$ip = $_SERVER['REMOTE_ADDR'];
$date = date("Y-m-d H:i:s");
//set a cookie for 1 month
setcookie("users", $ip.','.$date, time() + 60 * 60 * 24 * 30);
then every time the user logs in read that cookie, if it doesn't exist then set the cookie if it does exist add another value for the date. When you want to know how many times a user visited your site just get all the date values from that cookie.
精彩评论