PDA

View Full Version : Store Redemption Hack v1.1


X-Fan
15 Sep 2003, 00:16
G'day all,

This is my first released hack for vBulletin, so please be gentle with me! :) I'm not a hacker myself by any stretch of the imagination, as this hack is basically adapted from another. As always, back-up your files and your database before installing. It works on my heavily-hacked v2.3.0 board, and should (in theory) work on any board that Lesane's Store Hack works on, but better safe than sorry!

This hack is only useful for those boards that use both the Store and g-force2k2's Warning Hack v2.1, though I'm sure it could quite easily be adapted to work with other such warnings systems.

Hack Name: Store Redemption Hack v1.0 for vBulletin 2.x.x
Hack Author: X-Fan (x-fan@bigpond.net.au)
Inspired by: Dark Jim's More Private Messages Quota Hack
Thanks to: N9ne and Mist for their help in getting this hack working! :)
Required: g-force2k2's Warning Hack v2.1
First Release: 15 September 2003
Description: This add-on for Lesane's Store Hack will give users the opportunity to redeem themselves by paying for a warning point to be removed from their account.

Installation is pretty simple. There's one query to run, three templates to make, and one file to edit.

Here's hoping your users appreciate the opportunity to redeem themselves! ;) If you use this hack, please don't forget to click install. Any questions, feel free to ask.

Cheers,

kamu
15 Sep 2003, 00:24
Good idea, I'll be looking forward to more of your work :)

halo
15 Sep 2003, 00:50
cool hack yo.. im gonna go install it right away

lasto
15 Sep 2003, 00:56
i would install this x-fan but the warning hack is misisng from the orginal post so its a bit of a killer really

Like the hack though but cant use :(

X-Fan
15 Sep 2003, 02:34
Good idea, I'll be looking forward to more of your work :)
They'll be few and far between, as my RL job keeps me pretty busy, but I really wanted this add-on for the store and it looked like a fairly simple thing to do. Thanks to N9ne and Mist it was! :)

Glad you liked it, and hope it proves useful for you!

lasto
15 Sep 2003, 21:37
an addon to an hack that is no longer on vbull

did the author remove it or did the upgrade to vb3 destroy it?

Hobbes
16 Sep 2003, 04:53
nice hack..

I instlaled, but it isnt showing on my store list...o_O

X-Fan
16 Sep 2003, 05:01
nice hack..

I instlaled, but it isnt showing on my store list...o_O
Did you run the SQL query via phpMyAdmin?

Hobbes
16 Sep 2003, 05:04
yep, and added the templates and file edit O_O



EDIT: Nevermind.

I R TEH N00B *hits self* sorry lol :(

Hobbes
16 Sep 2003, 05:10
Database error in vBulletin 2.2.6:
Invalid SQL: SELECT storecost FROM usergroup WHERE usergroupid=6
mysql error: Unknown column 'storecost' in 'field list'
mysql error number: 1054
Date: Tuesday 16th of September 2003 12:11:46 AM
Script: http://forums.squareultima.com/store.php?action=removewarn
Referer:





....ish not works0rzing...:(

edit- also, when a user tries to, it just displays a normal DB error screen

X-Fan
16 Sep 2003, 05:35
Ah, you don't have the Store Staff Discount hack installed.

Okay, in store.php, find:


// ###################### Start Remove Warning Verify #######################
if ($action=="removewarn") {
$contest = $DB_site->query_first("SELECT * FROM store WHERE action='removewarn'");
$storeid=$contest[id];
$costpercent=$DB_site->query_first("SELECT storecost FROM usergroup WHERE usergroupid=$bbuserinfo[usergroupid]");
$cost=round($contest[costs] * ($costpercent[storecost]/100));
$need=$points - $cost;

if ($cost>$points) {
eval("standarderror(\"".gettemplate('store_error')."\");");
}
$warns = $DB_site->query_first("SELECT warninglvl FROM user WHERE userid=$bbuserinfo[userid]");
if ($warns['warninglvl'] < 1 or empty($warns['warninglvl'])) {
eval("standarderror(\"".gettemplate('store_removewarn_error')."\");");
}
$oldwarnings=$warns[warninglvl];
$newwarnings=$oldwarnings-1;
eval("dooutput(\"".gettemplate("store_removewarn_verify")."\");");
}
// ###################### Start Remove Warning #######################
if ($action=="removewarndo") {
$contest = $DB_site->query_first("SELECT * FROM store WHERE action='removewarn'");
$title=$contest[title];
$costpercent=$DB_site->query_first("SELECT storecost FROM usergroup WHERE usergroupid=$bbuserinfo[usergroupid]");
$cost=round($contest[costs] * ($costpercent[storecost]/100));

if ($cost>$points) {
eval("standarderror(\"".gettemplate('store_error')."\");");
} else {
$DB_site->query("UPDATE user SET warninglvl=warninglvl-1,storep=storep-$cost WHERE userid='$bbuserinfo[userid]'");
$changestorenow = $DB_site->query("UPDATE store SET sold=sold+1 WHERE action='removewarn'");
$moneycheck = $DB_site->query_first("SELECT storep FROM user WHERE userid=$bbuserinfo[userid]");
$money = $moneycheck[storep];
eval("dooutput(\"".gettemplate("store_removewarn_done")."\");");
}
}


And replace with:


// ###################### Start Remove Warning Verify #######################
if ($action=="removewarn") {
$contest = $DB_site->query_first("SELECT * FROM store WHERE action='removewarn'");
$storeid=$contest[id];
$cost=$contest[costs];
$need=$points - $cost;

if ($cost>$points) {
eval("standarderror(\"".gettemplate('store_error')."\");");
}
$warns = $DB_site->query_first("SELECT warninglvl FROM user WHERE userid=$bbuserinfo[userid]");
if ($warns['warninglvl'] < 1 or empty($warns['warninglvl'])) {
eval("standarderror(\"".gettemplate('store_removewarn_error')."\");");
}
$oldwarnings=$warns[warninglvl];
$newwarnings=$oldwarnings-1;
eval("dooutput(\"".gettemplate("store_removewarn_verify")."\");");
}
// ###################### Start Remove Warning #######################
if ($action=="removewarndo") {
$contest = $DB_site->query_first("SELECT * FROM store WHERE action='removewarn'");
$title=$contest[title];
$cost=$contest[costs];

if ($cost>$points) {
eval("standarderror(\"".gettemplate('store_error')."\");");
} else {
$DB_site->query("UPDATE user SET warninglvl=warninglvl-1,storep=storep-$cost WHERE userid='$bbuserinfo[userid]'");
$changestorenow = $DB_site->query("UPDATE store SET sold=sold+1 WHERE action='removewarn'");
$moneycheck = $DB_site->query_first("SELECT storep FROM user WHERE userid=$bbuserinfo[userid]");
$money = $moneycheck[storep];
eval("dooutput(\"".gettemplate("store_removewarn_done")."\");");
}
}


That should work. I'll update the install instructions to take this into account as well.

Hobbes
16 Sep 2003, 05:40
hmmm....and teh page is now blank o_O..when trying with a register user


edit- and i get

You do not have any warning points, and so do not need to remove one. when trying with admin username


edit2- me go sleep >=\

X-Fan
16 Sep 2003, 05:48
hmmm....and teh page is now blank o_O..when trying with a register user
Not sure why that would be... did you try a SHIFT-refresh on the page?


edit- and i get

when trying with admin username

Well, if you don't have any warning points then that's the result you'll get! :)

Hobbes
16 Sep 2003, 14:55
Not sure why that would be... did you try a SHIFT-refresh on the page?


i refreshed hehe...still blank :(

X-Fan
17 Sep 2003, 09:28
Did you add the templates correctly?

Hobbes
19 Sep 2003, 03:25
yeesh :(

X-Fan
19 Sep 2003, 04:41
Well, sorry, but I had to ask. I can't think of any reason why it wouldn't be showing up. Just make sure you followed the steps in the txt file as listed and you shouldn't have any problems.

PixelFx
27 Sep 2003, 13:39
very cool idea, I don't have either hack installed yet, again, but I'll definaly add this when I do :)