Responsive Vote — Anti-Fraud Polls
Polls with anti-fraud voting, animated live results, vote changes and withdrawals. October CMS 4.4/3.5.
Responsive Vote — Anti-Fraud Polls
Polls with anti-fraud voting, animated live results, vote changes and withdrawals. October CMS 4.4/3.5.
Live demo: Vote in the demo poll · Backend: demo / demo · Weather demo. Demo data resets daily at 04:00 Asia/Shanghai. Pre-sales: <alex@web4theme.com>.
Polls that survive a public audience.
Most poll plugins count clicks. This one protects the vote, shows the result as it changes, and lets a visitor correct a mistake.
Anti-fraud by default
- A random 256-bit visitor token in an encrypted HttpOnly cookie and the session.
- Only an HMAC of the token is stored — never the raw cookie or IP address.
- A unique
(poll_id, voter_key)index makes duplicate votes impossible under concurrent requests. - Per-network limits for new votes, AJAX rate limiting and a hidden honeypot field.
- CSRF protection, option ownership checks and open/close window validation on every vote.
Live results that feel alive
Bars grow on load and after each vote. Counts animate. When live refresh is enabled, results update every 10 seconds while the tab is visible. prefers-reduced-motion turns movement off.
Change or withdraw a vote
Visitors can update their choice or withdraw it and vote again. Neither action consumes new-vote quota, so a mistake is not a lockout.
Backend that a site owner can use
- Poll list and form with anonymous/change/results/live switches and open/close dates.
- Options tab: add, edit, delete, reorder, upload images, use text or custom HTML.
- Votes tab: inspect and remove individual votes.
- Permission:
baba.poll.access_polls.
Compatibility
October CMS 4.4 (primary) and 3.5+. PHP 8.0+. No Composer dependencies, no jQuery, no build step. Dark mode, reduced motion and responsive layout are included. All CSS is scoped to .baba-poll and .bp-*.
Installation via Command Line
php artisan plugin:install BABA.Poll
Responsive Vote — Documentation
Live demo: <https://october.web4theme.com/poll> · Backend: <https://october.web4theme.com/admin> (
demo/demo). Data resets daily at 04:00 Asia/Shanghai. Pre-sales: <alex@web4theme.com>.
Developer documentation for Responsive Vote (BABA.Poll). Written for the person installing and extending the plugin.
1. Requirements
| October CMS | 4.4.x (primary) · 3.5+ |
| PHP | 8.0+ |
| Database | MySQL / MariaDB (primary) · SQLite |
| Dependencies | None |
Member-only polls use Auth::getUser(). Install RainLab.User or another frontend auth plugin only if you need that mode.
2. Installation
Marketplace: System → Updates & Plugins → search “Responsive Vote” → Install.
Manual:
# copy the folder to plugins/baba/poll, then php artisan october:migrate php artisan october:util purge manifest
The migration creates baba_poll_list, baba_poll_detail and baba_poll_answer, and upgrades 1.x tables in place. Old options and vote totals are preserved.
3. Frontend component
[poll]
poll_id = 1
refreshInterval = 10
==
{% component 'poll' %}
The layout needs:
{% styles %}
{% framework %}
{% scripts %}
Properties
| Property | Default | Description |
|---|---|---|
poll_id |
— | Poll to display. |
slug |
empty | Optional fallback when no id is set. |
refreshInterval |
10 |
Live refresh seconds, clamped to 5–60. |
Twig variables
The default partial provides poll, poll_progress (total, options), poll_voted, poll_show_results, poll_can_change, poll_is_open, poll_requires_login, poll_live, poll_instance, poll_csrf, poll_message, poll_error and handler names.
4. Anti-fraud model
VoteGuard::voterToken()stores a 256-bit token in an encrypted HttpOnly cookie and the session.voter_key = HMAC-SHA256(user id or token, APP_KEY)is stored inbaba_poll_answer. Raw cookies and IPs are not stored.- A unique index on
(poll_id, voter_key)rejects duplicates even if two requests race. - A separate HMAC of the IP is used for limits: 8 new votes per poll per network per hour, and 60 AJAX requests per minute.
- A hidden
websitefield must stay empty; filled honeypots are rejected. - Every vote checks CSRF, the poll window, the option belongs to the poll, and anonymous/member policy.
- Changing or withdrawing an existing vote does not consume new-vote quota.
Tune VoteGuard::NEW_VOTES_PER_HOUR for shared networks (schools, offices, NAT).
5. Backend
Polls menu:
- Polls — create/edit, anonymous/change/results/live switches, open/close dates.
- Options tab — add/edit/delete/reorder options; image, text or custom HTML.
- Votes tab — inspect/delete individual votes.
- Permission
baba.poll.access_polls.
Deleting a poll removes its options, votes and attached images.
6. Live results
The result partial is rendered server-side. assets/js/poll.js:
- animates bar widths and vote counts;
- sends votes with the October AJAX handler protocol (
X-AJAX-HANDLERfor 4.x,X-OCTOBER-REQUEST-HANDLERfor 3.x); - handles both response formats (
__ajax.ops[].patchDomand legacy{ "#selector": html }); - refreshes results every
refreshIntervalseconds while the tab is visible; - respects
prefers-reduced-motion.
The JavaScript is vanilla, with no jQuery or build step.
7. Styling
Every selector is scoped to .baba-poll or .bp-*. Override CSS variables on .baba-poll:
.my-poll .baba-poll {
--bp-accent: #2563eb;
--bp-ink: #0f172a;
--bp-radius: 12px;
}
A partial override is supported at themes/<theme>/partials/poll/*.htm.
8. Upgrade from 1.x
- Update the plugin.
- Run
php artisan october:migrate. - Old options and totals remain.
- Old visitors may need to vote once more: the old
babapoll-{id}answer-id cookie is not the new signed voter token. - Remove any hard dependency on
Alxy.Captcha; 2.0 no longer uses it.
9. Support
Use the Marketplace support forum or email <alex@web4theme.com>. Include October CMS version, PHP version and the browser console/network error. Never post a voter cookie or APP_KEY.
-
This plugin has not been reviewed yet.
-
| 2.0.0 |
Responsive Vote 2.0: anti-fraud voting, live animated results, vote changes and withdrawals. Nov 14, 2026 |
|---|---|
| 1.0.18 |
add chart and poll records Jul 30, 2018 |
| 1.0.17 |
add sort order to poll answers Jul 30, 2018 |
| 1.0.16 |
Updated table baba_poll_list Jul 22, 2018 |
| 1.0.15 |
Updated table baba_poll_list Jul 22, 2018 |
| 1.0.14 |
Updated table baba_poll_list Jul 22, 2018 |
| 1.0.13 |
Updated table baba_poll_detail Jul 22, 2018 |
| 1.0.12 |
Updated table baba_poll_detail Jul 22, 2018 |
| 1.0.11 |
Updated table baba_poll_list Jul 22, 2018 |
| 1.0.10 |
Updated table baba_poll_list Jul 22, 2018 |
| 1.0.9 |
Updated table baba_poll_list Jul 22, 2018 |
| 1.0.8 |
Updated table baba_poll_detail Jul 22, 2018 |
| 1.0.7 |
Updated table baba_poll_detail Jul 22, 2018 |
| 1.0.6 |
Updated table baba_poll_list Jul 22, 2018 |
| 1.0.5 |
Created table baba_poll_answer Jul 22, 2018 |
| 1.0.4 |
Updated table baba_poll_list Jul 22, 2018 |
| 1.0.3 |
Created table baba_poll_detail Jul 22, 2018 |
| 1.0.2 |
Created table baba_poll_list Jul 22, 2018 |
| 1.0.1 |
Initialize plugin. Jul 22, 2018 |
Upgrade Guide — Responsive Vote 2.0
Who should upgrade
Everyone on 1.0.x. Version 2.0 replaces the old AJAX flow, removes the RainLab.User + Alxy.Captcha hard dependencies, and adds anti-fraud voting, live animated results and vote changes.
Breaking changes
- The plugin now requires October CMS 3.5+ or 4.x and PHP 8.0+.
- Backend controller URLs changed from
baba/poll/pollctltobaba/poll/polls. - The old
pollcomponent alias is unchanged. - The old
babapoll-{poll_id}answer-id cookie is not used; a signed voter token replaces it. Alxy.CaptchaandRainLab.Userare no longer required. Member-only polls useAuth::getUser().- IP addresses are no longer stored raw; only keyed hashes.
Upgrade steps
-
Backup the database.
-
Update the plugin from the Marketplace or replace the files.
-
Grant the new permission
baba.poll.access_pollsto any backend role that used the oldbaba.poll.poll_managerpermission. -
Run:
php artisan october:migrate php artisan october:util purge manifest php artisan cache:clear
-
Check Polls in the backend. Existing polls and options are listed.
-
Open the frontend poll page. Vote once. Confirm the result animates.
-
Change the vote; confirm the total does not increase.
-
Withdraw; confirm the form returns.
Data compatibility
Polls with allow_revote = 0 in 1.x are migrated to allow_change = 0, so upgrading does not silently enable vote changes on old polls.
baba_poll_list,baba_poll_detailandbaba_poll_answerare upgraded in place.- Existing options, vote totals and images remain.
- Older votes have no
voter_key; they remain counted but cannot be changed by the old cookie.
Rollback
Restore the database backup and the previous plugin files. 2.0 adds columns and indexes; rolling back without the database backup may leave unused columns but does not delete data.