code for propper log out in idex.php and a bug solved in purchase