Voting idea

This is a discussion on Voting idea within the alt.comp.lang.php forums, part of the PHP Programming Forums category; Hi I am trying to make voting script I ,BUT for sorry I cant add new question and any number ...


Go Back   Usenet Forums > PHP Programming Forums > alt.comp.lang.php

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 02-07-2006
Beshoo
 
Posts: n/a
Default Voting idea

Hi I am trying to make voting script I ,BUT for sorry I cant add new
question and any number of choices !!!!
pleeeeeeez if you have any way out teel me
thaaaaaaanx in advance

Reply With Quote
  #2 (permalink)  
Old 02-08-2006
Geoff Berrow
 
Posts: n/a
Default Re: Voting idea

Message-ID: <1139311257.195325.268460@z14g2000cwz.googlegroups .com> from
Beshoo contained the following:

>Hi I am trying to make voting script I ,BUT for sorry I cant add new
>question and any number of choices !!!!
>pleeeeeeez if you have any way out teel me
>thaaaaaaanx in advance


To do that you need a database with two tables. I used this:


--
-- Table structure for table `poll`
--

CREATE TABLE IF NOT EXISTS `poll` (
`poll_id` int(11) NOT NULL auto_increment,
`title` varchar(255) NOT NULL default '',
`question` varchar(255) NOT NULL default '',
`expires` date NOT NULL default '0000-00-00',
PRIMARY KEY (`poll_id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=48 ;

-- --------------------------------------------------------

--
-- Table structure for table `poll_answers`
--

CREATE TABLE IF NOT EXISTS `poll_answers` (
`answer_id` int(11) NOT NULL auto_increment,
`answer` varchar(255) NOT NULL default '',
`poll_id` int(11) NOT NULL default '0',
`votes` int(11) NOT NULL default '0',
PRIMARY KEY (`answer_id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=149 ;


--
Geoff Berrow 0110001001101100010000000110
001101101011011001000110111101100111001011
100110001101101111001011100111010101101011
Reply With Quote
  #3 (permalink)  
Old 02-08-2006
Connector5
 
Posts: n/a
Default Re: Voting idea

Geoff got you started in the right direction (assuming you are using mysql).
There are other considerations for a voting script as well. The least of
which is making sure one person can't sit and vote a whole bunch of times.

To stop this major problem, I like to make it so only registered and logged
in users can vote. You may need a third table to keep track of user_id,
poll_id, answer_id, and time(). Then a quick: "select * from
poll_answer_history where poll_id = blah and user_id = blah" will tell you
if your current user has already answered.



"Geoff Berrow" <blthecat@ckdog.co.uk> wrote in message
news:u8diu1lcd2gb8tq4jil3ui5dumiql6r7os@4ax.com...
> Message-ID: <1139311257.195325.268460@z14g2000cwz.googlegroups .com> from
> Beshoo contained the following:
>
> >Hi I am trying to make voting script I ,BUT for sorry I cant add new
> >question and any number of choices !!!!
> >pleeeeeeez if you have any way out teel me
> >thaaaaaaanx in advance

>
> To do that you need a database with two tables. I used this:
>
>
> --
> -- Table structure for table `poll`
> --
>
> CREATE TABLE IF NOT EXISTS `poll` (
> `poll_id` int(11) NOT NULL auto_increment,
> `title` varchar(255) NOT NULL default '',
> `question` varchar(255) NOT NULL default '',
> `expires` date NOT NULL default '0000-00-00',
> PRIMARY KEY (`poll_id`)
> ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=48 ;
>
> -- --------------------------------------------------------
>
> --
> -- Table structure for table `poll_answers`
> --
>
> CREATE TABLE IF NOT EXISTS `poll_answers` (
> `answer_id` int(11) NOT NULL auto_increment,
> `answer` varchar(255) NOT NULL default '',
> `poll_id` int(11) NOT NULL default '0',
> `votes` int(11) NOT NULL default '0',
> PRIMARY KEY (`answer_id`)
> ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=149 ;
>
>
> --
> Geoff Berrow 0110001001101100010000000110
> 001101101011011001000110111101100111001011
> 100110001101101111001011100111010101101011



Reply With Quote
  #4 (permalink)  
Old 02-08-2006
Beshoo
 
Posts: n/a
Default Re: Voting idea

Oh !! thnk u very much i have done it.
but,I have another idea to prevent the user fro voting more than 1 time
by get the his IP !!!

thanx !!!

Reply With Quote
  #5 (permalink)  
Old 02-08-2006
Arnold Shore
 
Posts: n/a
Default Re: Voting idea

That may not work, cuz IP addresses may or may not persist between
sessions - it depends on your network.

Cookies might work, or might not - if some users have access to several
machines.

The email address technique noted above is probably best, but also
unreliable and inconvenient.

AS

"Beshoo" <basheermoro@gmail.com> wrote in message
news:1139394349.818696.162130@f14g2000cwb.googlegr oups.com...
> Oh !! thnk u very much i have done it.
> but,I have another idea to prevent the user fro voting more than 1 time
> by get the his IP !!!
>
> thanx !!!
>



Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
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 Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 01:14 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0