jswan Posted June 15, 2004 Share Posted June 15, 2004 Hi folks: I'm really scratching my head here. I think my php skills may be insufficient to figure this out. I am using the Pollbooth contribution to find out how customers find the site. I want the pollbooth box to display for a new customer, but not for someone who already has voted. I know Pollbooth has a function that determines if a user has an IP address that matches the ones in the DB, but I can't figure out how to make it work from my index page (if the IP doesn't match the ones in the DB, display Pollbooth box, else display the rest of the page). So, every time someone votes in Pollbooth, the IP address is stored in a table called phesis_poll_check. I need to know how to get the array of stored addresses and how to compare the curent user's address getenv("REMOTE_ADDR") with the array so that I can set up my if statement. Can someone show me an example of the code that compares on value with an array of values? Thanks in advance, Jason Link to comment Share on other sites More sharing options...
vasttech Posted June 15, 2004 Share Posted June 15, 2004 Just to give you a heads up you may run into problems where people change IP addresses everytime they make a connection, i.e. AOL. Just a thought... B) osCommerce Knowledge Base osCommerce Documentation Contributions Link to comment Share on other sites More sharing options...
vasttech Posted June 15, 2004 Share Posted June 15, 2004 I lost the rest of my post... :o You could do something like this: $sql = mysql_db_query('select ips from iptable where ip=getenv['remote_addr']); if (mysql_num_rows($sql) > 0) do not display survey else display survey of course you would have to correct the syntax but generally it should work for what you are looking for. osCommerce Knowledge Base osCommerce Documentation Contributions Link to comment Share on other sites More sharing options...
user99999999 Posted June 15, 2004 Share Posted June 15, 2004 The pollboth already has this. Look in admin. Link to comment Share on other sites More sharing options...
jswan Posted July 5, 2004 Author Share Posted July 5, 2004 Thanks for responding to this question. Pollboth does have an option that checks the user IP. But then it still displays the poll results. I wanted to set it up so that the box doesn't display at all if the poll has been taken. I ended up using a variety of the solution that vasttech suggested. I selected the IP from the table that matches the users IP. Then, if there is no match, I displayed the box. Thanks again, Jason Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.