![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Newbie
Join Date: Nov 2004
Posts: 9
Rep Power: 0
![]() |
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: |
|
|
|
|
|
#2 |
|
Programming Guru
![]() ![]() |
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! |
|
|
|
|
|
#3 |
|
Programming Guru
![]() ![]() ![]() |
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." |
|
|
|
|
|
#4 |
|
Programmer
|
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 "frame" situation for real. www.prideofaustin.com |
|
|
|
|
|
#5 | |
|
I eat cake for breakfast.
![]() ![]() ![]() ![]() Join Date: Jul 2004
Location: In my box.
Posts: 4,434
Rep Power: 9
![]() |
Quote:
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. |
|
|
|
|
|
|
#6 |
|
Newbie
Join Date: Nov 2004
Posts: 9
Rep Power: 0
![]() |
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!!!!!!!!!!!!!
|
|
|
|
|
|
#7 |
|
I eat cake for breakfast.
![]() ![]() ![]() ![]() Join Date: Jul 2004
Location: In my box.
Posts: 4,434
Rep Power: 9
![]() |
What have text files and cookies got to do with each other?
|
|
|
|
|
|
#8 |
|
Newbie
Join Date: Nov 2004
Posts: 9
Rep Power: 0
![]() |
ok forget cookies. can u show me plz how to use text files to store my votes by just using php and html?
|
|
|
|
|
|
#9 |
|
Professional Programmer
|
[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] |
|
|
|
|
|
#10 |
|
Programming Guru
![]() ![]() ![]() |
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." |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|