-
Create your poll and embed on any website for voting
-
Support loads multiple polls on the same page.
-
Create unlimited polls, unlimited answers.
-
Support choosing multiple answers when voting.
-
Support sharing your poll to popular social networks like Facebook, Twitter, Google Plus, Pinterest.
-
Support admin panel, you can manage polls (create, update, delete, view, search, statistic polls) , manage users (create, update ,delete ,view, search)
-
Secure poll with IP restriction or User's account restriction (User can only vote one time based on his/her IP address or his/her account on website run this poll script).
-
Support multiple browsers like Firefox, Chrome, Safari, Opera and IE6+
-
Support embedded Youtube video link when create a poll.
XEM THÊM ==> Hướng dẫn cài đặt chi tiết
Nguồn: Sharecode.vn
http://hungnguyenvina.com/poll/help.html
Step 1: Upload folder poll to your host
Step 2: Open file poll.sql in database folder
Step 3: Run all scripts in poll.sql to create database poll and all related needed tables
Step 4: Open file config.php in poll folder, enter your databse's information like below:
Step 5: Run home.php, http://yourdomain.com:yourport/poll/home.php
Note: if you run this script on localhost, please run http://localhost:yourport/poll/home.php
In home.php you must have following scripts to ensure this app run properly
Between <head> and </head> tags put the following scripts:
To access admin page,use the link: http://yourdomain.com:yourport/poll/admin/pollmanagement.php
You must enter user and password to access this page, user is "admin" and password is "admin"
<script type="text/javascript" src="js/jquery-1.11.0.js"></script>
<script type="text/javascript" src="js/poll.js"></script>
<link href="css/main.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src='http://platform.twitter.com/widgets.js'></script>
<script>
$(document).ready(function() {
//start : load facebook share button for each poll
$('body').on('click', '[class^="sharer"]', function (e){
e.preventDefault();
var url = window.location.origin + "/poll/" + $(this).attr('href');
var fbSharerUrl = 'http://www.facebook.com/sharer.php?';
var params = { u: url, t: "vote poll" };
var fbSharerConfig = 'toolbar=0,status=0,width=600,height=400';
window.open(fbSharerUrl + $.param(params), 'sharer', fbSharerConfig);
}); //end : load facebook share button for each poll
//load multiple polls you want on one page with idPoll gotton from value of "id" attribute of div which its class is ".divPoll"
//view source code of loadPoll function in js/poll.js
$(".divPoll").loadPoll(); --> this function is very important to load all polls by idPoll values saved in attribute "id" of div with class .divPoll
//view result click
$('body').on('click', '[id^="btnViewResult_"]', function (){
var thisButton = $(this).attr('id');
$('[id^="btnViewResult_"]').parents('.divPoll').each(function(){
var idPoll = $(this).attr('id');
if("btnViewResult_"+idPoll == thisButton)
{ //load result here
$.loadPollResult(idPoll,"empty","empty","false");
}//if("btnViewResult_"+idPoll == thisButton)
});//$('[id^="btnViewResult_"]').parents('.divPoll').each(function(){
});//$('body').on('click', '[id^="btnViewResult_"]', function (){
//vote click
$('body').on('click', '[id^="btnVote_"]', function (){
var thisButton = $(this).attr('id');
var answersOfUser = "";
var answersOfUser_ID = "";
$('[id^="btnVote_"]').parents('.divPoll').each(function(){
var idPoll = $(this).attr('id');
if("btnVote_"+idPoll == thisButton)
{
$( "input[id$='_"+ idPoll +"']").each(function(){
var typeOfObject = $(this).attr('type');
if(typeOfObject == "checkbox")
{
if(($(this).prop('checked'))==true)
{ if(answersOfUser=="")
{
answersOfUser = $(this).attr('value');
answersOfUser_ID = $(this).attr('lang');
}
else
{
answersOfUser = answersOfUser + ";" + $(this).attr('value');
answersOfUser_ID = answersOfUser_ID + ";" + $(this).attr('lang');
}
}
}
else if(typeOfObject == "radio")
{
if(($(this).prop('checked'))==true)
{
if(answersOfUser=="")
{
answersOfUser = $(this).attr('value');
answersOfUser_ID = $(this).attr('lang');
}
else
{
answersOfUser = answersOfUser + ";" + $(this).attr('value');
answersOfUser_ID = answersOfUser_ID + ";" + $(this).attr('lang');
}
}
}
});
if(answersOfUser == '')
{
alert('You must choose at least one answer');
}
else
{
//load result here
$.loadPollResult(idPoll,answersOfUser,answersOfUser_ID,"false");
}//else
}//if("btnViewResult_"+idPoll == thisButton)
});//$('[id^="btnVote_"]').parents('.divPoll').each(function(){
});//$('body').on('click', '[id^="btnVote_"]', function (){
});//$(document).ready(function()
</script>
Step 6: Load any polls by idPoll from your database by using below syntax:
<div class="divPoll" id="idPollgetFromDatabase">
</div>
You can change style of poll area like width, height, color....
<div class="divPoll" style="width:500px;height:300px;background-color:Blue;" id="idPollgetFromDatabase">
</div>