Jump to content
MakeWebGames

It wont credit users second currency


GregFest

Recommended Posts

It wont credit users second currency, anyone no why just wipes users second currency

 

function credit_user_submit() {
global $db,$ir,$c,$h,$userid,$set;
     if ( !in_array($ir['user_level'],array(2,3)) ) {
  echo 'You cannot access this area.<br />> <a href="'.gen_url('main',true,true).'">Goto Main</a>';
  die($h->endpage());
     }
	$_POST['user'] = ( isset($_POST['user'])&&is_numeric($_POST['user']) )?abs(intval($_POST['user'])):0;
	$_POST[$set['main_currency']] = ( isset($_POST[$set['main_currency']])&&is_numeric($_POST[$set['main_currency']]) )?abs(intval($_POST[$set['main_currency']])):0;
	$_POST[$set['second_currency']] = ( isset($_POST[$set['second_currency']])&&is_numeric($_POST[$set['second_currency']]) )?abs(intval($_POST[$set['second_currency']])):0;
    if ( (empty($_POST[$set['main_currency']]) && empty($_POST[$set['second_currency']])) OR empty($_POST['user']) ) {
  echo '
Something went horribly wrong, please go back and try again.
<br />
> <a href="'.gen_url('users',true,true).'&action=creditform">Go Back</a>
  ';
  die($h->endpage());
    }
$d = $db->query('SELECT `username` FROM `users` WHERE `userid` = '.$_POST['user']);
    if ( $db->num_rows($d) == 0 ) {
  echo '
User doesn\'t seem to exist, Please go back and try again.
<br />
> <a href="'.gen_url('users',true,true).'&action=creditform">Go Back</a>
  ';
  die($h->endpage());
    }
$db->query('UPDATE `users` SET `main` = `main` + '.$_POST[$set['main_currency']].', `second` = `second` + '.$_POST[$set['second_currency']].' WHERE `userid` = '.$_POST['user']);
$un = $db->fetch_single($d);
	stafflog_add('Credited '.$un.' ['.$_POST['user'].'] '.money_formatter($_POST[$set['main_currency']]).' and/or '.number_format($_POST[$set['second_currency']]).' '.$set['second_currency'].'.');
  echo $un.' ['.$_POST['user'].'] was credited with '.money_formatter($_POST[$set['main_currency']]).' and/or '.number_format($_POST[$set['second_currency']]).' '.$set['second_currency'].'.
<br />
> <a href="'.gen_url('main',true,true).'">Goto Main</a>
  ';
}
function mcredit_user_form() {
global $db,$ir,$c,$h,$userid,$set;
     if ( !in_array($ir['user_level'],array(2,3)) ) {
  echo 'You cannot access this area.<br />> <a href="'.gen_url('main',true,true).'">Goto Main</a>';
  die($h->endpage());
     }
  echo "
<h3>Mass Payment</h3>
You can give all users ".$set['main_currency']."/".$set['second_currency'].".
<br />
<form action='".gen_url('users',true,true)."&action=masscreditsub' method='post'>
".$set['main_currency'].": <input type='text' name='".$set['main_currency']."' /> ".$set['second_currency'].": <input type='text' name='".$set['second_currency']."' />
<br />
<input type='submit' value='Credit User' />
</form>
  ";
}
function mcredit_user_submit() {
global $db,$ir,$c,$h,$userid,$set;
     if ( $ir['user_level'] != 2 ) {
  echo 'You cannot access this area.<br />> <a href="'.gen_url('main',true,true).'">Goto Main</a>';
  die($h->endpage());
     }
	$_POST[$set['main_currency']] = ( isset($_POST[$set['main_currency']])&&is_numeric($_POST[$set['main_currency']]) )?abs(intval($_POST[$set['main_currency']])):0;
	$_POST[$set['second_currency']] = ( isset($_POST[$set['second_currency']])&&is_numeric($_POST[$set['second_currency']]) )?abs(intval($_POST[$set['second_currency']])):0;
    if ( empty($_POST[$set['main_currency']]) && empty($_POST[$set['second_currency']]) ) {
  echo '
Something went horribly wrong, please go back and try again.
<br />
> <a href="'.gen_url('users',true,true).'&action=masscredit">Go Back</a>
  ';
  die($h->endpage());
    }
$db->query('UPDATE `users` SET `main` = `main` + '.$_POST[$set['main_currency']].', `second` = `second` + '.$_POST[$set['second_currency']]);
	stafflog_add('Credited all users '.money_formatter($_POST[$set['main_currency']]).' and/or '.number_format($_POST[$set['second_currency']]).' '.$set['second_currency'].'.');
  echo "
All Users credited. Click <a href='".gen_url('main',true,true)."&action=announce'>here to add an announcement</a> or <a href='".gen_url('main',true,true)."&action=massmailer'>here to send a mass mail</a> explaining why.
  ";
  die($h->endpage());
}
Link to comment
Share on other sites

  • 2 weeks later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...