View Full Version : Contest Hack -- Points hack addon
eiSecure
06-20-2002, 10:00 PM
This is basically a hack addon to the points hack that allows users to use their points, similar to the lottery hack by Lesane for the store hack, to purchase tickets that can be used in random (or rigged.:cool:) drawings.;)
It has a decent admin cp interface, letting you edit/modify/delete contests, etc. and also has the option to pick a random winner.
Here's install instructions...
1. Run these SQL statements:CREATE TABLE `contest_contests` (
`id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
`name` TEXT NOT NULL,
`price` TEXT NOT NULL,
`open` TEXT NOT NULL,
`winner` TEXT NOT NULL,
INDEX (`id`)
);
CREATE TABLE `contest_entries` (
`id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
`userid` TEXT NOT NULL,
`contestid` TEXT NOT NULL,
INDEX (`id`)
);
2. Download the zip and replace your original points.php file in your mod directory with the updated one.
3. Extract contest.php to your forum directory.
4. In admin/index.php:
Find:makenavoption("New Posts","../mod/moderate.php?action=posts","<br>");
makenavoption("New Attachments","../mod/moderate.php?action=attachments");
makenavselect("Moderation","<hr>");
Add after:// *************************************************
makenavoption("Add","../mod/points.php?action=newcontest","|");
makenavoption("Modify","../mod/points.php?action=modifycontest", "|");
makenavoption("Draw","../mod/points.php?action=drawwinners", "|");
makenavoption("Past Winners","../mod/points.php?action=viewwinners");
makenavselect("Contests");
5. Enjoy!:bunny:
P.S.: This originally started as a hack I custom-wrote for a forum, but after some consideration, I decided to release it here to everybody.:)
Links (http://www.eisecure.com) and Donations (https://www.paypal.com/xclick/business=alex%40eisecure.com&item_name=Donation) are greatly appreciated.:)
P.P.S.: This is my first hack that's released here, so if you see problems, be sure to let me know.
If you want each user to be able to only have one entry, view post number 19 (https://vborg.vbsupport.ru/showthread.php?postid=264624#post264624)
eiSecure
06-21-2002, 08:57 PM
...silly me.... :sleep:
Velocd
06-21-2002, 09:06 PM
Looks very nice, an alternative option for those who use Shinra Online Point System and would like the fun of a lottery hack.
Great! ;)
eiSecure
06-21-2002, 09:10 PM
Thanks.:)
Chris M
06-21-2002, 09:25 PM
V Nice:)
Satan
MrBojangle1
06-21-2002, 10:21 PM
great hack but how I use so peeps can buy tickets??
Velocd
06-21-2002, 10:33 PM
Download it, install it, tada. ^_^
Vivi Ornitier
06-21-2002, 11:18 PM
hmmm . . i'm confused about what all this is. Like ppl enter into it, and then u pick a random person and they win? Well what do they win? lol. Also, i goto the contest.php file and all it dislpays is a blank page. looks very very nice but confused, lol.
eiSecure
06-21-2002, 11:22 PM
This hack doesn't give the user prizes, lol. It's your job to provide the user with prizes. ^_^
Here are the commands for contest.php
contest.php?view
Shows you all contests
contest.php?learn
Displays additional info on the contests. The text that is displayed is editable in the last few lines of contest.php
Vivi Ornitier
06-21-2002, 11:29 PM
hmmm . .. i tried those commands and it still brings up a blank page.
ULTIMATESSJ
06-21-2002, 11:36 PM
Originally posted by Vivi Ornitier
hmmm . .. i tried those commands and it still brings up a blank page.
same with me
eiSecure
06-22-2002, 12:49 AM
oh, whoop!
It's supposed to be contest.php?action=view
:bunny:
BigJohnson
06-22-2002, 08:41 AM
Wow that doesn't work neither. What do we do now.
BigJohnson
06-22-2002, 08:43 AM
Wait a sec. Where are the template edits? contest_main
Huh i see these in the php file but no where in the directions did it say to make templates. Something fishy is going on here. o_0
eiSecure
06-22-2002, 02:32 PM
Oh, whoops... yeah, you need to create a template, sorry, my bad. ^_^
Here, just put this in as your template content...
Name the template contest_main :) :bunny:
BigJohnson
06-22-2002, 07:23 PM
This hack works great but just one thing that is wierd about it. Is there any way you can only get into a contest once. Because i can click enter contest for the same contest and still be paying not even noing that i enter the contest. So if there could be an error screen or something that says you already have entered this contest please make something like that. Thanks so much. This hack is amazng. I love it. But with out this it seems pretty funny. Thanks ;)
eiSecure
06-22-2002, 07:58 PM
To prevent someone from submitting more than one ticket, you can modify the code a little to have a while() loop that checks if the results from a SQL select statement return any results.
If you make it select the username, and the number of results is greater than 0, just popup an error.:)
BigJohnson
06-22-2002, 08:02 PM
Thats the prob hehe. I don't no how to code hahaha. I am learning but please post the code that would help tremendously. Also where to put the code would help also hehe. Thanks.
eiSecure
06-22-2002, 08:18 PM
Okay...
In contest.php, find:// ############################### start enter contest ##########################
if ($action=="enter") {
include("./global.php");
//check usergroup of user to see if they can use Profile
if ($bbuserinfo[userid]==0) {
show_nopermission();
}
$contestentry=$DB_site->query("SELECT id,name,price,open,winner FROM contest_contests WHERE id='$contestid'");
while ($contest=$DB_site->fetch_array($contestentry)) {
$giladd=$contest['price'];
$open=$contest['open'];
}
if ($open=="NO") {
$contestbody .= "This contest has been concluded. Your entry has not been entered.";
eval("dooutput(\"".gettemplate("contest_main")."\");");
} else {
$pointfield="storep";
$gilstr=$DB_site->query_first("SELECT storep FROM user WHERE userid='$bbuserinfo[userid]'");
$gil=$gilstr[$pointfield];
$gilamt=$gilstr[$pointfield];
if ($gil < $giladd) {
$contestbody .= "You do not have enough points to enter.";
}
else {
$postgil = ($gilamt - $giladd);
$DB_site->query("UPDATE user SET storep='$postgil' WHERE userid='$bbuserinfo[userid]'");
$DB_site->query("INSERT INTO contest_entries (id,userid,contestid) VALUES (NULL,$bbuserinfo[userid],$contestid)");
$contestbody .= "You have entered this contest.";
}
eval("dooutput(\"".gettemplate("contest_main")."\");");
}
}
Replace:// ############################### start enter contest ##########################
if ($action=="enter") {
include("./global.php");
//check usergroup of user to see if they can use Profile
if ($bbuserinfo[userid]==0) {
show_nopermission();
}
$contestentry=$DB_site->query("SELECT id,name,price,open,winner FROM contest_contests WHERE id='$contestid'");
while ($contest=$DB_site->fetch_array($contestentry)) {
$giladd=$contest['price'];
$open=$contest['open'];
}
$contestcheck=$DB_site->query("SELECT * FROM contest_entries WHERE userid='$bbuserinfo[userid]'");
if ($open=="NO") {
$contestbody .= "This contest has been concluded. Your entry has not been entered.";
eval("dooutput(\"".gettemplate("contest_main")."\");");
} elseif ($DB_site->num_rows($contestcheck)>0) {
$contestbody .= "Sorry, you can only enter this contest once.";
eval("dooutput(\"".gettemplate("contest_main")."\");");
} else {
$pointfield="storep";
$gilstr=$DB_site->query_first("SELECT storep FROM user WHERE userid='$bbuserinfo[userid]'");
$gil=$gilstr[$pointfield];
$gilamt=$gilstr[$pointfield];
if ($gil < $giladd) {
$contestbody .= "You do not have enough points to enter.";
}
else {
$postgil = ($gilamt - $giladd);
$DB_site->query("UPDATE user SET storep='$postgil' WHERE userid='$bbuserinfo[userid]'");
$DB_site->query("INSERT INTO contest_entries (id,userid,contestid) VALUES (NULL,$bbuserinfo[userid],$contestid)");
$contestbody .= "You have entered this contest.";
}
eval("dooutput(\"".gettemplate("contest_main")."\");");
}
}
I haven't tested this, but it should work.:):bunny:
BigJohnson
06-22-2002, 08:20 PM
O it worked great. This is a great hack. Thanks so much. I think you should update the first post for everyone with this update this is a great update thanks so much you are the greatest.
BigJohnson
06-22-2002, 08:23 PM
I have some questions. No where does it say who actually one on the forums. Only the admin area tells you. Wouldn't it be cool if the whole board new. No where does it say who one. That would be a great update if you could add that.
eiSecure
06-22-2002, 08:25 PM
If everyone knew who was in a contest, it would spoil the part where the user decides if the risk is big enough for him/her to risk the points on.
Also, for announcing the winner, that's your job.:)
BigJohnson
06-22-2002, 09:04 PM
but wait a sec i am lost. Can u explain how this hack works in description. What is there is there 100 winners? lol. Or am i thinking this hack does something else.
eiSecure
06-22-2002, 10:20 PM
This is a contest hack. It allows you to create contests that your members can enter in.
You may have multiple contests, but each contest can only have one winner.
BigJohnson
06-22-2002, 10:40 PM
I am so tired hahah. Can you give me an example of a contest. Like name a contest and the question. Thanks haha. Because I odn't no how to use this hack.
eiSecure
06-22-2002, 10:45 PM
Do you know what a contest is? It has nothing to do with questions.
Please go to http://www.dictionary.com to look it up.:rolleyes:
Thanks,
Alex
BigJohnson
06-24-2002, 11:01 PM
so then how is this hack any different than the lotto hack?
eiSecure
06-24-2002, 11:03 PM
omg... if you don't want to use this hack, nobody's forcing you to. If you want to complain about work that others have made and have worked hard on, then complain to your psychiatrist, please.
Thanks,
Alex
BigJohnson
06-25-2002, 12:44 AM
No i am not complaining at all. I never complain about someones hard work. I am trying to simply ask how this hack works and if i can have an example of how one of you guys use it because I have no clue how to use it and how to impliment it in my board to have other people t use it. I want to use it so i am trying to ask how to work this. Thanks. Sorry if i sounded mean or anything. I wasn't.
BigJohnson
06-25-2002, 12:46 AM
Ok i get it now. I was thinking really hard and now i feel dumb haha. This is a great hack and I am using it now. Thanks so much. All I was doing is trying ti figure out how to get it done thanks.
novel44
06-25-2002, 07:29 PM
I have this hack installed.
Ive created a contest.
But how do my members in the forums sign up for these?
I created the template.
I loaded all the proper files, and users points are climbing.
Still cant figure out how a registered user will sign up for contest.
please assist :)
eiSecure
06-25-2002, 07:57 PM
http://yourdomain.com/yourforum/contest.php?action=view
:):bunny:
novel44
06-25-2002, 08:41 PM
Blank white page.. any thoughts
eiSecure
06-25-2002, 08:53 PM
It should work find... :/
novel44
06-25-2002, 09:18 PM
maybe i have the wrong contest.php file?
let me find the file and ill upload it again.. ill post results shortly
novel44
06-26-2002, 04:14 PM
eiSecure,
thanks for your assistance. My problem was as follows
I placed the contest.php file in the /forum/mod directory. OOPS
after re reading your instructions i placed it in the /forum directory and BLAM!
worked!
thank you, great hack
novel44
06-26-2002, 04:20 PM
below is error code generated when trying to sign up for a contest.
Database error in vBulletin 2.2.6:
Invalid SQL: SELECT storep FROM user WHERE userid='1'
mysql error: Unknown column 'storep' in 'field list'
mysql error number: 1054
while reviewing the database USER. No storep column. HELP :)
eiSecure
06-26-2002, 04:57 PM
Did you install the Points Hack?
funflyer
06-26-2002, 05:56 PM
Looks good! Good hack!!
novel44
06-26-2002, 07:15 PM
Fixed it.
dgessler
06-26-2002, 10:12 PM
P.S.: This originally started as a hack I custom-wrote for a forum, but after some consideration, I decided to release it here to everybody.
LOL - yes, a custom hack you wrote for my forum! Thought I'd never see this thread did ya! :mad:
lol jk, it's a nice hack though, works awesome, did a nice job on it alex, i don't really care that you publically released it. lol
eiSecure
06-26-2002, 11:18 PM
Yeah, I figured that after I wrote it for your forum, waiting a few months would be long enough for you to get a head start.:)
GrayFOX
07-04-2002, 10:46 PM
<font color="009999">
Hi all,
I have some problem, can somebody update the "Point Contest Hack" so that the Admin don't must manualy give the Users the Posts?
In this Version of this hack it doesn't work, I must manualy give the Users Posts, but I'll it that this going automatly.
THX Gray
</font>
eiSecure
07-04-2002, 10:56 PM
There's an addon for it that automatically awards users the points.
GrayFOX
07-04-2002, 11:02 PM
<font color="009999">
I mean I'll get like this befor I do install this Hack, that the Users get his UserPosts automatly, not that I must do ist manualy.
</font>
eiSecure
07-04-2002, 11:02 PM
Like I said, there's an addon for the points hack that will automaticall award your users points for posting.
GrayFOX
07-04-2002, 11:06 PM
<font color="009999">
oops sorry I've see just that it works so how I like it.
</font>
Brainmaster
07-15-2002, 12:56 AM
I've got a question, how get the users points?
I don't want to give them points manualy.
THX
eiSecure
07-15-2002, 02:15 AM
As mentioned above, there is another addon for the points hack that automatically awards points for user's posts.
Brainmaster
07-15-2002, 03:10 AM
I know, but it don't run, 'cause I got the contest Hack installed. *???*
eiSecure
07-15-2002, 03:20 AM
These two hacks are fully compatible.
Brainmaster
07-15-2002, 04:34 AM
Hmmm ... a mod from vb-germany saids me that it's doesn't goes, 'cause I've got one addon for the user point hack ... I'll try it later to do this ... THX U ;)
Heineken77
07-20-2002, 05:26 PM
If the original author of this great hack is too busy to make it so that you can choose in the adminCP to send an email / PM or both (choice is given to admin) to the winner saying - message you specify. And also sending out a email / PM or both to all the losers saying - message you specify?
This would really help me out as I'm running a basketball league and want to make it so they can check their messages to see what lottery draft possition they've won :)
Sincerely Hoping!
Heineken
Heineken77
07-22-2002, 04:36 AM
I will pay someone money via PayPal if they would be able to hook up the PM or Email notification addition to this hack that I requested above :)
Also, I am wondering if there's atleast a way to delete entries. If that is a small addition, that would SERIOUSLY help me out!
Heineken77
07-24-2002, 11:15 PM
OK....I figured out on my own how to remove entries. Through MySQL :) Is there anyone who could figure out how to have the winners and losers notified by PM and Email letting them know whether they won or lost? :( I'll pay for it! :)
eiSecure
07-24-2002, 11:19 PM
Since you put it that way... I'm in.;)
Just send me an email with your PayPal and what you think it's worth and I'll find some time to add it in.:)
planetrap
08-12-2002, 09:35 AM
i get a database error when i try to enter a contest
Database error in vBulletin 2.2.6:
Invalid SQL: SELECT storep FROM user WHERE userid='1143'
mysql error: Unknown column 'storep' in 'field list'
mysql error number: 1054
I do have the point hack installed
LilTara
02-07-2003, 08:48 PM
I had the same problem planetrap.... I ended up having to replace everwhere it said storep in the contest and points phps with field6 (The field my points are in) and changing user to userfield.
Seems to work... at least so far. Look where it says ***start enter contest*** in the contest.php and where it says ***startdopoints*** in the points.php
P.S. Don't know if it's relevant but I'm using 2.2.9 :paranoid:
lancepoint
11-10-2004, 01:03 AM
will this work with vb 3.03 if so HELP! it will be for logo template and flash design cotests at designerbeat.com. and at lancepoint.com I know this is an old post but i cannot seem to find anyone that can do a contest hack. I did however get a pm from someone who has one installed but it isnt for sale...
please help. my head is worked to the bone. racking it over this.
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.