Go Back   vb.org Archive > vBulletin Modifications > Archive > vB.org Archives > vBulletin 2.x > vBulletin 2.x Full Releases
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools
Contest Hack -- Points hack addon Details »»
Contest Hack -- Points hack addon
Version: 1.00, by eiSecure eiSecure is offline
Developer Last Online: Apr 2003 Show Printable Version Email this Page

Version: 2.2.x Rating:
Released: 06-20-2002 Last Update: Never Installs: 19
 
No support by the author.

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.) 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:
Code:
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:
Code:
makenavoption("New Posts","../mod/moderate.php?action=posts","<br>");
makenavoption("New Attachments","../mod/moderate.php?action=attachments");
makenavselect("Moderation","<hr>");
Add after:
Code:
// *************************************************
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 and Donations 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

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.

Comments
  #12  
Old 06-21-2002, 11:36 PM
ULTIMATESSJ's Avatar
ULTIMATESSJ ULTIMATESSJ is offline
 
Join Date: Nov 2001
Location: Bristol, England
Posts: 315
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally posted by Vivi Ornitier
hmmm . .. i tried those commands and it still brings up a blank page.
same with me
Reply With Quote
  #13  
Old 06-22-2002, 12:49 AM
eiSecure's Avatar
eiSecure eiSecure is offline
 
Join Date: Dec 2001
Posts: 145
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

oh, whoop!

It's supposed to be contest.php?action=view

:bunny:
Reply With Quote
  #14  
Old 06-22-2002, 08:41 AM
BigJohnson BigJohnson is offline
 
Join Date: Nov 2001
Posts: 535
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Wow that doesn't work neither. What do we do now.
Reply With Quote
  #15  
Old 06-22-2002, 08:43 AM
BigJohnson BigJohnson is offline
 
Join Date: Nov 2001
Posts: 535
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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
Reply With Quote
  #16  
Old 06-22-2002, 02:32 PM
eiSecure's Avatar
eiSecure eiSecure is offline
 
Join Date: Dec 2001
Posts: 145
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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:
Reply With Quote
  #17  
Old 06-22-2002, 07:23 PM
BigJohnson BigJohnson is offline
 
Join Date: Nov 2001
Posts: 535
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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
Reply With Quote
  #18  
Old 06-22-2002, 07:58 PM
eiSecure's Avatar
eiSecure eiSecure is offline
 
Join Date: Dec 2001
Posts: 145
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #19  
Old 06-22-2002, 08:02 PM
BigJohnson BigJohnson is offline
 
Join Date: Nov 2001
Posts: 535
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #20  
Old 06-22-2002, 08:18 PM
eiSecure's Avatar
eiSecure eiSecure is offline
 
Join Date: Dec 2001
Posts: 145
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Okay...

In contest.php, find:
PHP Code:
// ############################### 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:
PHP Code:
// ############################### 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:
Reply With Quote
  #21  
Old 06-22-2002, 08:20 PM
BigJohnson BigJohnson is offline
 
Join Date: Nov 2001
Posts: 535
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
Reply


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 On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 01:00 AM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.18086 seconds
  • Memory Usage 2,347KB
  • Queries Executed 27 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (3)bbcode_code
  • (2)bbcode_php
  • (1)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (6)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (3)pagenav_pagelink
  • (11)post_thanks_box
  • (11)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (11)post_thanks_postbit_info
  • (10)postbit
  • (11)postbit_onlinestatus
  • (11)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete