vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 2.x Full Releases (https://vborg.vbsupport.ru/forumdisplay.php?f=4)
-   -   Contest Hack -- Points hack addon (https://vborg.vbsupport.ru/showthread.php?t=40127)

eiSecure 06-20-2002 10:00 PM

Contest Hack -- Points hack addon
 
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:
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

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

Quote:

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:
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:

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.


All times are GMT. The time now is 04:18 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01254 seconds
  • Memory Usage 1,845KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (3)bbcode_code_printable
  • (2)bbcode_php_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (40)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.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/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete