PHP Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 



Go Back   Dev Articles Community ForumsProgrammingPHP Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old September 9th, 2002, 01:29 AM
fallen fallen is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Sep 2002
Posts: 1 fallen User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Voting using PHP/MySQL

Hello,

I recently read an article by Mitch Harper discussing how to setup a voting system on my website using PHP/MySQL, and in regards to the article I would just like to say it was great... the system is working fine. However I would like to take it one step further and I am at a loss on how to do it. At present Mitch's propsed poll system only allows for votng on the current poll. I would like to how if it is possible to actually make it so if a user comes into the site, he or she can vote on not only the current poll but all of the polls that previously existed. Thanks in advance.

Brian

Reply With Quote
  #2  
Old September 16th, 2002, 08:36 AM
kliertje kliertje is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Sep 2002
Location: netherlands
Posts: 5 kliertje User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
php poll question

When I download the support file for the 'Creating a Voting Poll With PHP And MySQL' article it is all machine coded, so I cannot use it. I use linux. Is the file corrupt or am I missing something? The articles here by the way are great. So thanks for that bit. please help. I cannot get any further without it

Reply With Quote
  #3  
Old September 19th, 2002, 10:19 AM
wAr-AnGeL wAr-AnGeL is offline
Forum Security
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2002
Location: Behind You
Posts: 479 wAr-AnGeL User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 6 m 50 sec
Reputation Power: 17
Send a message via ICQ to wAr-AnGeL Send a message via AIM to wAr-AnGeL
I don't really know what you mean by "machine coded" however the support file is not corrupt. I have used it before without any problems.

Just a small question: Do you have PHP & MySQL installed with the database & tables all setup?
__________________




"Only Linux users see the end of crashes."
- Pl4t0

Reply With Quote
  #4  
Old September 19th, 2002, 11:25 AM
kliertje kliertje is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Sep 2002
Location: netherlands
Posts: 5 kliertje User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
poll question

Yeah I had set it up from the article but the supportfile.php does not download correctly. I have tried it on two computers -part of the code reads "0f1%*VCd" that is not php. In fact the whole file looks like this. I would still like to try this pollout because the article was so well written, but for the moment I am using a poll that I downloaded from sourceforge.

i just want to get my hands dirty and learn.

I've changed the ectention to txt - here is the file I downloaded.

can anyone help sort this
Attached Files
File Type: txt supportfile.txt (5.0 KB, 533 views)

Reply With Quote
  #5  
Old September 19th, 2002, 11:27 AM
Lindset Lindset is offline
weirdomoderator
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jun 2002
Location: Alta, Norway
Posts: 370 Lindset User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 17
Send a message via ICQ to Lindset Send a message via AIM to Lindset
That's probably the compressed file or something? Use winzip or winrar for uncompressing it
__________________
Best Regards,
Hvard Lindset

Reply With Quote
  #6  
Old September 19th, 2002, 11:31 AM
Phynias Phynias is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2002
Posts: 18 Phynias User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
That shouldnt be to tough to do. You will jsut have to do some recoding to do the following.
Make a vote list page that shows all the polls, with links to them each havaing there own unqiue id.
so like vote.php?pid=1

So in the vote page you would check for pid if it doesnt exist then just use the most recent or active poll.
you would need to add code to carry the pid from just showing the poll to actually voting. Perhaps putting a hidden field in the form with the pid in it.

Reply With Quote
  #7  
Old September 19th, 2002, 11:48 AM
kliertje kliertje is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Sep 2002
Location: netherlands
Posts: 5 kliertje User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Smile Hey Lindset -you are right

Lindset, thanks man renamed it .zip and did an unzip and yo mother! must remember this trick its cool.

Reply With Quote
  #8  
Old September 19th, 2002, 07:22 PM
Ben Rowe
Guest
Dev Articles Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
Re: Hey Lindset -you are right

Quote:
Originally posted by kliertje
Lindset, thanks man renamed it .zip and did an unzip and yo mother! must remember this trick its cool.



All our support files are zip files, it should say so when you download it, unless your browser has some funny option turned on, then you would get download.zip, anyway for everyone out there, whenever you download a support file, it is a zip file!

Reply With Quote
  #9  
Old November 2nd, 2002, 03:09 AM
fmanolo fmanolo is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Nov 2002
Posts: 3 fmanolo User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
man, i downloaded the supportfile for this article, but when I want to add a poll, even I completed all the fields it get me the errors "You didn't complete the title" and "You must complete at least 2 answer options" or something like that.
All I did was to change database credentials to suit my username and password.
Any ideas?

Reply With Quote
  #10  
Old November 2nd, 2002, 04:57 AM
wAr-AnGeL wAr-AnGeL is offline
Forum Security
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2002
Location: Behind You
Posts: 479 wAr-AnGeL User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 6 m 50 sec
Reputation Power: 17
Send a message via ICQ to wAr-AnGeL Send a message via AIM to wAr-AnGeL
seems like your're the secnod person who has reported that. asp_man seems to have that problem too. i'm not sure whats wrong because the support file worked for me.

Reply With Quote
  #11  
Old November 2nd, 2002, 05:15 AM
fmanolo fmanolo is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Nov 2002
Posts: 3 fmanolo User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
look, I'm a newbie with PHP and MySQL but as far as I learned until now, everything seems OK, and I can't figure out why it doesn't work, and that piss me off.
I wonder if it is a PHP configuration problem?

PS. I have other tables in the same database and everytime I want to add records it works, but not for the poll. That's why I can't understand.

Reply With Quote
  #12  
Old November 2nd, 2002, 09:52 AM
FrankieShakes FrankieShakes is offline
Frank The Tank!
Dev Articles Beginner (1000 - 1499 posts)
 
Join Date: Jun 2002
Location: Toronto, Canada
Posts: 1,240 FrankieShakes User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 18
Send a message via ICQ to FrankieShakes Send a message via MSN to FrankieShakes
The code from the support file seems to have been written for PHP configurations with "register_globals" set to on. Most likely, you're running with register_globals set to off.

Do make sure, setup a php file with:
PHP Code:
<?php phpinfo(); ?>

And run it in your browser to check for regiter_globals. If your register_globals is set to off, you will need to modify the code to use the PHP superglobals ($_POST[], $_GET[], etc...).

If you need help, let us know.
__________________
____________________________________________
Developer Shed Weekly Writer | DevArticles Forum Moderator
Build Your Own KlipFolio Klip With PHP
FrankManno.com - Under Construction
Design Interactive Group - Under Construction

Reply With Quote
  #13  
Old November 4th, 2002, 04:35 AM
fmanolo fmanolo is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Nov 2002
Posts: 3 fmanolo User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
oh yeah, register_globals was off, i set it on, let's hope it will work now...thx mate for the tip!

Reply With Quote
  #14  
Old November 8th, 2002, 03:10 PM
FrankieShakes FrankieShakes is offline
Frank The Tank!
Dev Articles Beginner (1000 - 1499 posts)
 
Join Date: Jun 2002
Location: Toronto, Canada
Posts: 1,240 FrankieShakes User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 18
Send a message via ICQ to FrankieShakes Send a message via MSN to FrankieShakes
Not a problem... When in doubt check your globals! But I would stress that you're better off modifying the code to work with globals OFF rather than turning them back on. For security reasons it's better to modify.

Reply With Quote
  #15  
Old November 8th, 2002, 08:46 PM
mytch mytch is offline
Dev Articles Novice (500 - 999 posts)
 
Join Date: Apr 2002
Location: Sydney, Australia
Posts: 588 mytch User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 17
Hi guys,
Just a quick note. Those articles were written about 6-8 months ago when the superglobal arrays (i.e. $_GET, $_POST etc) weren't in existance. If you want to use the code now, you'll need register_globals on, or you'll need to replace $HTTP_GET_VARS with $_GET and $HTTP_POST_VARS with $_POST, etc...

Reply With Quote
  #16  
Old November 8th, 2002, 09:09 PM
jpenn jpenn is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Oct 2002
Location: Washington, DC
Posts: 317 jpenn User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 m 3 sec
Reputation Power: 16
Quote:
If you want to use the code now, you'll need register_globals on, or you'll need to replace $HTTP_GET_VARS with $_GET and $HTTP_POST_VARS with $_POST, etc...


Stay away from turning RG 'on' - thats what we refer to in the PHP world as an open invitation to hackers.

The below might solve your problem ->

PHP Code:
/*
    Add to the top of the pages
*/

if ( phpversion() > '4.1' )
    {
        
$HTTP_POST_VARS $_POST;
        
$HTTP_GET_VARS $_GET;

__________________
~ Joe Penn

We work for free to help make this a valuable resource on the internet. Do you appreciate the help - did we provide help that will help you prosper and help that has contributed to sharpening your current skill set?

Show your appreciation and purchase something from our Amazon Wishlist's - it's simple and a great way to say thank you.




Last edited by jpenn : November 8th, 2002 at 09:27 PM.

Reply With Quote
  #17  
Old December 17th, 2002, 01:51 PM
zigote zigote is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Aug 2002
Location: Atlanta GA
Posts: 73 zigote User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 55 m 11 sec
Reputation Power: 17
I also have register_globals off,
I have added the code that jpenn suggested

I still cannot connect to the database, All dbvars.php info has been checked 101 times.
Now if I add a poll in MyAdmin, I can vote. But, I cannot Add or Delete polls.
If I try to Add = Couldn't connect to the database server
If I try to Delete= Couldn't connect to the database server

Before I added the code to the top of each file, I got this
Add = Incomplete Fields
Delete= Couldn't connect to the database server
I have also hard coded these in the files, And Still get the same read out.
Tested on 2 different servers, And it was the same errors.

Maybe Mitchell Harper should come back and update this,

Reply With Quote
  #18  
Old December 17th, 2002, 02:10 PM
zigote zigote is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Aug 2002
Location: Atlanta GA
Posts: 73 zigote User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 55 m 11 sec
Reputation Power: 17
Ok, I have now turned on register_globals,
Just to test this scripts, And it works great,

So there's something else in the code that need to be changed besides...

$HTTP_POST_VARS And $HTTP_GET_VARS

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingPHP Development > Voting using PHP/MySQL


Developer Shed Advertisers and Affiliates


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.

© 2003-2018 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap