What's new

Welcome to the forum 👋, Visitor

To access the forum content and all our services, you must register or log in to the forum. Becoming a member of the forum is completely free.

Could I make this voting system with PHP?

tinfoil

Junior Member
Joined
Jun 18, 2013
Messages
3
Reaction score
0
HTML Coins
0
I want to make a voting system that look a little something like this:
Each user gets 10 votes a day they use to vote for various people.
Every 24 hours it gets refilled up to 10 again.
Users dont need to register to vote, I just want to let different IP address vote
A top 5 list of people that were voted on the most that updates every 24 hours.
I also want to have a top 5 list of the week, month, and all time
A line graph of each person's point fluctuation over time (just like companies stock price) in their profiles.

I was thinking I could do the top 5 list with arrays & for loops or something, but I got no idea how to detect IP addresses & let people vote. Would it be easy to make something like this w/ PHP?
 
Wow thanks, that's just what I need. I'm going have to look into PHP a little more though
 
You'll probably want to use a database (MySQL) to keep track of things, too, anything that needs to be stored for any length of time. If you want to show real-time votes, then you'll want to look into Javascript and employ some AJAX techniques. You could definitely do this with PHP, just keep in mind there's other stuff you'll need, too.
 
Yeah you will definitely need a database. Depending on how you set it up, you might want IP addresses to one table and votes to the other. You could set a field in both tabled which would match with the IP table, and based on the query you used, you can determine how many times a user has voted and decide weather or not to add the vote to the votes column.

I hope this is helpful in your development of this project.
 
The front-end would be a piece of cake to do with PHP. The back-end should be database driven. Two options for the votes tracking thing, either keep a tally on the user table (or whereever you will store your user's vital data, I always call it a user table) that gets incremented every time a vote is used, then run a job every night that resets these values to 0 (less resource intensive overall I think) or you could just do a query on how many votes for that user have been added to some sort of voting table, and not allow more when there are at least ten (this is a little more resource intensive). You might be able to build in a database constraint, but communicating that to the front end might get tricky.

Of course, you could also have a mix of both, have a flag on the user table that says whether you can vote or not, and have a job that runs constantly that queries the voting table for all users can sees if they have more than ten votes, updating their flag if they do. Downside to this is that it is much more resource intensive and would allow users to quickly cast as many votes as possible before the script can run (basically, makes you vulnerable to bots).
 
Yes. PHP is ideal for such a project. I can't think of anything else you could use for such a web app, to be honest.
 

Theme customization system

You can customize some areas of the forum theme from this menu.

  • Wide/Narrow view

    You can control a structure that you can use to use your theme wide or narrow.

    Grid view forum list

    You can control the layout of the forum list in a grid or ordinary listing style structure.

    Picture grid mode

    You can control the structure where you can open/close images in the grid forum list.

    Close sidebar

    You can get rid of the crowded view in the forum by closing the sidebar.

    Fixed sidebar

    You can make it more useful and easier to access by pinning the sidebar.

    Close radius

    You can use the radius at the corners of the blocks according to your taste by closing/opening it.

  • Choose the color combination that reflects your taste
    Background images
    Color gradient backgrounds
Back