Author Topic: Stealing Credits in 3.0  (Read 14512 times)

Offline jdv

Stealing Credits in 3.0
« on: January 29, 2007, 11:03:07 am »
It always says unsuccessful. Even at 90 or 100% success rate.

Its always unsuccesful.

Offline Sakuragi

Re: Stealing Credits in 3.0
« Reply #1 on: January 29, 2007, 10:55:08 pm »
Yup you found a bug!
to fix it on Steal.php
Replace
Code: [Select]
$_POST['username'] = strtr($_POST['username'], array('\\"' => '"'));
preg_match_all('~"([^"]+)"~', $_POST['username'], $matches);
$userArray = array_unique(array_merge($matches[1], explode(',', preg_replace('~"([^"]+)"~', '', $_POST['username']))));

with
Code: [Select]
$_POST['stealfrom'] = strtr($_POST['stealfrom'], array('\\"' => '"'));
preg_match_all('~"([^"]+)"~', $_POST['stealfrom'], $matches);
$userArray = array_unique(array_merge($matches[1], explode(',', preg_replace('~"([^"]+)"~', '', $_POST['stealfrom']))));

To fix the problem with SMF 1.1's "Find Members" popup
Replace
Code: [Select]
return 'Steal From: <input type="text" name="stealfrom" size="50" />
<a href="' . $scripturl . '?action=findmember;input=username;quote=0;sesc=' . $context['session_id'] . '" onclick="return reqWin(this.href, 350, 400);"><img src="' . $settings['images_url'] . '/icons/assist.gif" border="0" alt="' . $txt['find_members'] . '" /> Find Member</a><br />';

With
Code: [Select]
return 'Steal From: <input type="text" name="stealfrom" id="membername" size="50" />
<a href="' . $scripturl . '?action=findmember;input=membername;quote=0;sesc=' . $context['session_id'] . '" onclick="return reqWin(this.href, 350, 400);"><img src="' . $settings['images_url'] . '/icons/assist.gif" border="0" alt="' . $txt['find_members'] . '" /> Find Member</a><br />';

Offline jdv

Re: Stealing Credits in 3.0
« Reply #2 on: January 29, 2007, 11:08:16 pm »
thanks. it worked twice now. :)

ouch, my karma is low. hee hee.

thank you.

Offline Daniel15

Re: Stealing Credits in 3.0
« Reply #3 on: February 03, 2007, 08:57:58 am »
Thanks for reporting this bug (and thanks to Sakuragi for posting a fix) :D.
I've fixed this in the development version (Revision 95), and will fix it in the SMFShop 3.0 package soon.

Offline inkstains

Re: Stealing Credits in 3.0
« Reply #4 on: March 13, 2007, 10:35:42 am »
Yup you found a bug!
to fix it on Steal.php
Replace
Code: [Select]
$_POST['username'] = strtr($_POST['username'], array('\\"' => '"'));
preg_match_all('~"([^"]+)"~', $_POST['username'], $matches);
$userArray = array_unique(array_merge($matches[1], explode(',', preg_replace('~"([^"]+)"~', '', $_POST['username']))));

with
Code: [Select]
$_POST['stealfrom'] = strtr($_POST['stealfrom'], array('\\"' => '"'));
preg_match_all('~"([^"]+)"~', $_POST['stealfrom'], $matches);
$userArray = array_unique(array_merge($matches[1], explode(',', preg_replace('~"([^"]+)"~', '', $_POST['stealfrom']))));

To fix the problem with SMF 1.1's "Find Members" popup
Replace
Code: [Select]
return 'Steal From: <input type="text" name="stealfrom" size="50" />
<a href="' . $scripturl . '?action=findmember;input=username;quote=0;sesc=' . $context['session_id'] . '" onclick="return reqWin(this.href, 350, 400);"><img src="' . $settings['images_url'] . '/icons/assist.gif" border="0" alt="' . $txt['find_members'] . '" /> Find Member</a><br />';

With
Code: [Select]
return 'Steal From: <input type="text" name="stealfrom" id="membername" size="50" />
<a href="' . $scripturl . '?action=findmember;input=membername;quote=0;sesc=' . $context['session_id'] . '" onclick="return reqWin(this.href, 350, 400);"><img src="' . $settings['images_url'] . '/icons/assist.gif" border="0" alt="' . $txt['find_members'] . '" /> Find Member</a><br />';

thanks heaps for that worked a charm

one question though every where else the find member does not work any idea on what code i would need to change to get that back up and running?

thanks

Offline Sakuragi

Re: Stealing Credits in 3.0
« Reply #5 on: March 13, 2007, 11:41:16 pm »
change
<a href="' . $scripturl . '?action=findmember;input=username
with
<a href="' . $scripturl . '?action=findmember;input=membername

Offline Lew_Cipher

Re: Stealing Credits in 3.0
« Reply #6 on: March 18, 2007, 02:31:12 am »
This still needs to be corrected manually after install.

Just FYI.


Offline Daniel15

Re: Stealing Credits in 3.0
« Reply #7 on: March 18, 2007, 11:10:50 am »
Grr... I swear I fixed this :o
Anyways, it's definitely fixed now ;)

Offline adicrst

Re: Stealing Credits in 3.0
« Reply #8 on: May 03, 2007, 04:31:04 am »
does the stealing item include sending a pm to the victim ?...it it doesn, it's not working.
If it doesn't..it would be great to know who robered you and how much
« Last Edit: May 03, 2007, 06:24:13 am by adicrst »

Offline adicrst

Re: Stealing Credits in 3.0
« Reply #9 on: May 04, 2007, 10:33:55 pm »
someone ?  :smiley6600:

Offline jdv

Re: Stealing Credits in 3.0
« Reply #10 on: May 04, 2007, 10:35:01 pm »
no it does not pm the person.

Offline adicrst

Re: Stealing Credits in 3.0
« Reply #11 on: June 21, 2007, 07:19:28 am »
can someone make it to pm the persone who got robed with the robber's name ?

Pratt

  • Guest
Re: Stealing Credits in 3.0
« Reply #12 on: June 26, 2007, 05:12:54 am »
Well, i did the following

Searched for
Code: [Select]
function onUse()
{
global $db_prefix, $ID_MEMBER, $item_info;

And replaeced it with

Code: [Select]
function onUse()
{
global $db_prefix, $ID_MEMBER, $item_info, $context;


Then searched for
Code: [Select]
if ($steal_amount < 50) {

And after that i added
Code: [Select]
// Who the IM will come from
$pmfrom = array(
'id' => 1071,
'name' => 'Chorineita',
'username' => 'Chorineita'
);

// Who the IM is going to
$pmto = array(
'to' => array($_POST['stealfrom']),
'bcc' => array()
);

// The subject of the message
$subject = 'You Got robbed';
// The actual message contents
$message = 'The user <b>' . $context['user']['name'] . '</b> robbed you, less than 50 points! Youu got lucky blablabla';
// Now, send!
sendpm($pmto, $subject, $message, 0, $pmfrom);

Then right before the other Return line or after
Code: [Select]
}
 else  {

I added practically the same
Code: [Select]
// Who the IM will come from
$pmfrom = array(
'id' => 1071,
'name' => 'Chorineita',
'username' => 'Chorineita'
);

// Who the IM is going to
$pmto = array(
'to' => array($_POST['stealfrom']),
'bcc' => array()
);

// The subject of the message
$subject = 'You Got screwed!';
// The actual message contents
$message = 'The user <b>' . $context['user']['name'] . '</b> robbed you big time! blablabla';
// Now, send!
sendpm($pmto, $subject, $message, 0, $pmfrom);


And finally i added another PM, to alert the user that someone has tried to rob him, but he didint succeed!

Search for
Code: [Select]
// If reducing Karma doesn't work, replace
// 'karmaBad = karmaBad + 10' with 'karmaGood = karmaGood - 10'
$result = db_query("
UPDATE {$db_prefix}members
SET karmaBad = karmaBad + 10
WHERE ID_MEMBER = {$ID_MEMBER}", __FILE__, __LINE__);

And right after that i added!
Code: [Select]
// Who the IM will come from
$pmfrom = array(
'id' => 1071,
'name' => 'Chorineita',
'username' => 'Chorineita'
);

// Who the IM is going to
$pmto = array(
'to' => array($_POST['stealfrom']),
'bcc' => array()
);

// The subject of the message
$subject = 'someone is trying to rob you!';
// The actual message contents
$message = 'The user <b>' . $context['user']['name'] . '</b> is trying to rob you! blablabla';
// Now, send!
sendpm($pmto, $subject, $message, 0, $pmfrom);


You have to sepcify the data on the part
Code: [Select]
$pmfrom = array(
'id' => 1071,
'name' => 'Chorineita',
'username' => 'Chorineita'
);

You could (i guess, im not sooo sure though), change the values with
Code: [Select]

$pmfrom = array(
'id' => 1,
'name' => 'Admin',
'username' => 'Admin'
);

I took the code frome another item and then changed it a bit, so that it could work with the steal.php item... it worked for me!




Offline adicrst

Re: Stealing Credits in 3.0
« Reply #13 on: August 07, 2007, 08:27:06 am »
thanks alot..i'll try that and let you know if it worked for me aswell

Offline ravi4uever87

Re: Stealing Credits in 3.0
« Reply #14 on: November 30, 2011, 08:01:06 am »
THANKS I LIKE THIS MOD