Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Jan 7th, 2005, 9:23 AM   #1
sam1
Newbie
 
Join Date: Nov 2004
Posts: 9
Rep Power: 0 sam1 is on a distinguished road
hi everyone

i have a html website that allows the user to vote for their favourite website, using radiobox, but i want the users to see how others voted in precentage and i want to store their votes in a file. also i want restrict the vote by using the cookies so user can only vote once!!!!!!!! :unsure: :unsure: :unsure: :unsure:
sam1 is offline   Reply With Quote
Old Jan 7th, 2005, 9:50 AM   #2
Pizentios
Programming Guru
 
Pizentios's Avatar
 
Join Date: May 2004
Location: Brandon, Manitoba, Canada
Posts: 2,023
Rep Power: 7 Pizentios is on a distinguished road
Send a message via ICQ to Pizentios Send a message via MSN to Pizentios
Do you have any code to show us? Your more likly to get help if you have some code to post.
__________________
Profanity is the one language that all programmers understand.

Check out my Blog <---updated Nov 30 2007!
Pizentios is offline   Reply With Quote
Old Jan 7th, 2005, 10:27 AM   #3
Infinite Recursion
Programming Guru
 
Infinite Recursion's Avatar
 
Join Date: Jul 2004
Location: United States
Posts: 3,473
Rep Power: 8 Infinite Recursion is on a distinguished road
Send a message via MSN to Infinite Recursion Send a message via Yahoo to Infinite Recursion
I agree with Pizentios, we can help you more if we know what errors you are getting.
__________________
http://jasonpowers.net

"There are a thousand hacking at the branches of evil to one who is striking at the root."
Infinite Recursion is offline   Reply With Quote
Old Jan 7th, 2005, 8:47 PM   #4
scorpiosage
Programmer
 
scorpiosage's Avatar
 
Join Date: Aug 2004
Location: Austin, Tx
Posts: 55
Rep Power: 5 scorpiosage is on a distinguished road
Send a message via AIM to scorpiosage Send a message via Yahoo to scorpiosage
I do agree, code is helpful here, but, I do have some thoughts for you.

First off you mention that you have an HTML site, wich says to me that you are looking to just add a little php code into your html and get the results, but you really can't do it that way. You are going to have to use some sort of databse MySQL or even a text file will work. These work in a similar way that .ini files work on your hard drive.
Using cookies won't be that accurate, because if someone wants to vote more then once, they can just delete cookies.

My recommendation on this is not to use cookies, rather to record the user ip address. The only way to use this method is if you are actually using a database or a txt file to validate this.

But, if you are actually creating something where your users will need to log into a site you can simply add a field to your database that adds weather they voted or not into that user's record.

I am just not too sure what the functionality of your host has, but, I we will be more then happy to give you a hand with this.
Mike
__________________
Here's my latest project still in the works, and I need to get rid of this &quot;frame&quot; situation for real. www.prideofaustin.com
scorpiosage is offline   Reply With Quote
Old Jan 8th, 2005, 6:08 AM   #5
Ooble
I eat cake for breakfast.
 
Ooble's Avatar
 
Join Date: Jul 2004
Location: In my box.
Posts: 4,434
Rep Power: 9 Ooble is on a distinguished road
Quote:
Originally posted by scorpiosage@Jan 8 2005, 01:47 AM
My recommendation on this is not to use cookies, rather to record the user ip address. The only way to use this method is if you are actually using a database or a txt file to validate this.

But, if you are actually creating something where your users will need to log into a site you can simply add a field to your database that adds weather they voted or not into that user's record.
Don't forget people with dynamic IPs. I would suggest having people log in to vote, as you said, and recording whether they've voted on that poll or not. When you create a new poll, you can reset everyone to FALSE.

If you just have a poll and nothing else that requires login, though, this could be considered overkill. In this case, the IP address solution is probably the best option.
__________________
Me :: You :: Them
Ooble is offline   Reply With Quote
Old Jan 8th, 2005, 7:19 AM   #6
sam1
Newbie
 
Join Date: Nov 2004
Posts: 9
Rep Power: 0 sam1 is on a distinguished road
i will use txt file to record the votes so i will use cookies and also i dont want to use mysql i only want html and php!!!!!!!!!!!!!
sam1 is offline   Reply With Quote
Old Jan 8th, 2005, 8:46 AM   #7
Ooble
I eat cake for breakfast.
 
Ooble's Avatar
 
Join Date: Jul 2004
Location: In my box.
Posts: 4,434
Rep Power: 9 Ooble is on a distinguished road
What have text files and cookies got to do with each other?
__________________
Me :: You :: Them
Ooble is offline   Reply With Quote
Old Jan 8th, 2005, 9:02 AM   #8
sam1
Newbie
 
Join Date: Nov 2004
Posts: 9
Rep Power: 0 sam1 is on a distinguished road
ok forget cookies. can u show me plz how to use text files to store my votes by just using php and html?
sam1 is offline   Reply With Quote
Old Jan 8th, 2005, 9:02 AM   #9
Dizzutch
Professional Programmer
 
Dizzutch's Avatar
 
Join Date: Dec 2004
Location: Worcester, MA
Posts: 441
Rep Power: 4 Dizzutch is on a distinguished road
Send a message via ICQ to Dizzutch Send a message via AIM to Dizzutch Send a message via MSN to Dizzutch Send a message via Yahoo to Dizzutch
[lame'well you know, when you take the icing, and write on the cookie...hmm cookies.[/lame]
alright, so no interest in MySQL, I suggest running a google search on "php tutorial" and see what shows up. [plug]or read the PHP tutorials in the tutorial section of this site[/php]
__________________
naked pictures of you | PFO F@H stats
Dizzutch is offline   Reply With Quote
Old Jan 8th, 2005, 3:08 PM   #10
Infinite Recursion
Programming Guru
 
Infinite Recursion's Avatar
 
Join Date: Jul 2004
Location: United States
Posts: 3,473
Rep Power: 8 Infinite Recursion is on a distinguished road
Send a message via MSN to Infinite Recursion Send a message via Yahoo to Infinite Recursion
So you will know we are serious about helping if we see a bit of code, here is some PHP code that will
allow you to write to a file...

function WriteToFile ($filename, $data)
{
  // open file
  $fd = fopen($filename, "a");

  // write string
  fwrite($fd, $data . "\n");

  // close file
  fclose($fd);
}
__________________
http://jasonpowers.net

"There are a thousand hacking at the branches of evil to one who is striking at the root."
Infinite Recursion is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 12:41 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC