General Programming Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingGeneral Programming Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old May 5th, 2003, 09:51 AM
craigtaylor74 craigtaylor74 is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: May 2003
Posts: 13 craigtaylor74 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
validate right to vote

I'm trying to use cookies to check if the user is logged in but I'm totally confused about how to do this.
Where should I put the setcookie code?
on the vote validation page or earlier (on the login validation page)?
Basically i really need to see an example cos I've looked at the tutorials but can't figure out how to adapt it to what i need.
WHat I want to do is check if they are logged in by looking for a cookie then check if they have already voted or not. I think I'm ok with reading cookies but where and how to set them is another matter.
Thanks,
Craig.

Reply With Quote
  #2  
Old May 5th, 2003, 12:08 PM
Taelo Taelo is offline
5B's
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Oct 2002
Location: PC, FL
Posts: 366 Taelo User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 30 m 59 sec
Reputation Power: 7
well,.....it depends on your datamodel.

are you allowing only registered members the right to vote? or are you allowing everyone?

If you are allowing everyone then yes you must set a cookie after the user has voted. Normally what I do is set a cookie with the poll_id value. then check against that value if they try to vote again.
__________________
-- Jason

Reply With Quote
  #3  
Old May 5th, 2003, 12:19 PM
craigtaylor74 craigtaylor74 is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: May 2003
Posts: 13 craigtaylor74 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
OK I understand what you say (in my case I'm using an "already voted" field in the database) but i just don't know how to set the cookie.
I have 3 pages to validate different forms
registration
login
vote
I suspect i have to start my cookies when they hit submit and pass all the validation for login. Is that right and if so how? I know the basic formula
setcookie("username", "$username");
setcookie("vote_completed", "$vote_completed");
Is that right? and where exactly on my validation does it go?
Sorry to ask so many questions but I've been going around in circles for ages.
My current main hurdle is how can I check if the username exists and therefore if the user is eligible to vote or not.
Ta,
Craig.

Reply With Quote
  #4  
Old May 5th, 2003, 02:29 PM
Taelo Taelo is offline
5B's
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Oct 2002
Location: PC, FL
Posts: 366 Taelo User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 30 m 59 sec
Reputation Power: 7
well,...set the cookie when they process the form the first time,...

then the next that poll loads,...you can check to see if a cookie exists,..

PHP Code:
if(!$_COOKIE['poll_id'] == $poll_id

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingGeneral Programming Help > validate right to vote


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway
Stay green...Green IT