Send Event/Donate Coins via AdminCP
Add this to your accounts.php file, Note this code is really old, it can be done easier but the code still works 100%:
PHP Code:
elseif( isset($_POST['mcoins']) )
{
$type = clean_sql($_POST['type']);
$id = clean_sql($_POST['id']);
$coins = clean_sql($_POST['ncoins']);
if( $type == "" || $id == "" || $coins == "" )
{
setmessage("Event Coins change!", $_STR[Msg1]);
redirect("index.php?do=accounts");
die();
}
if( $type == 0 )
{
$query02 = odbc_exec($connection, "SELECT AID FROM {$_CONFIG[AccountTable]}(nolock) WHERE UserID = '$id'");
$part = "UserID";
}
elseif( $type == 1 )
{
$query02 = odbc_exec($connection, "SELECT UserID FROM {$_CONFIG[AccountTable]}(nolock) WHERE AID = '$id'");
$part = "AID";
}
else
{
redirect("index.php?do=accounts");
die();
}
if( num_rows($query02) != 1 )
{
setmessage("Event Coins Change!", $_STR[Acc16]);
redirect("index.php?do=accounts");
die();
}
else
{
$EventcoinsinDB = odbc_exec($connection, "SELECT EventCoins FROM {$_CONFIG[AccountTable]}(nolock) WHERE $part = '$id'");
odbc_fetch_row($EventcoinsinDB);
$Eventcoins = odbc_result($EventcoinsinDB, 1);
$newecoins = $Eventcoins + $coins;
odbc_exec($connection, "UPDATE {$_CONFIG[AccountTable]} SET Eventcoins = '$newecoins' WHERE $part = '$id'");
writetolog( sprintf($_STR[mco4], $part, $id, $newecoins) );
setmessage("Coins Changed!", $_STR[mco5]);
redirect("index.php?do=accounts");
die();
}
}elseif( isset($_POST['Dcoins']) )
{
$type = clean_sql($_POST['type']);
$id = clean_sql($_POST['id']);
$coins = clean_sql($_POST['ncoins']);
if( $type == "" || $id == "" || $coins == "" )
{
setmessage("Donate Coins change!", $_STR[Msg1]);
redirect("index.php?do=accounts");
die();
}
if( $type == 0 )
{
$query02 = odbc_exec($connection, "SELECT AID FROM {$_CONFIG[AccountTable]}(nolock) WHERE UserID = '$id'");
$part = "UserID";
}
elseif( $type == 1 )
{
$query02 = odbc_exec($connection, "SELECT UserID FROM {$_CONFIG[AccountTable]}(nolock) WHERE AID = '$id'");
$part = "AID";
}
else
{
redirect("index.php?do=accounts");
die();
}
if( num_rows($query02) != 1 )
{
setmessage("Donate Coins Change!", $_STR[Acc16]);
redirect("index.php?do=accounts");
die();
}
else
{
$DonatecoinsinDB = odbc_exec($connection, "SELECT Coins FROM {$_CONFIG[AccountTable]}(nolock) WHERE $part = '$id'");
odbc_fetch_row($DonatecoinsinDB);
$Donatecoins = odbc_result($DonatecoinsinDB, 1);
$newDcoins = $Donatecoins + $coins;
odbc_exec($connection, "UPDATE {$_CONFIG[AccountTable]} SET coins = '$newDcoins' WHERE $part = '$id'");
writetolog( sprintf($_STR[Dco4], $part, $id, $newDcoins) );
setmessage("Coins Changed!", $_STR[Dco5]);
redirect("index.php?do=accounts");
die();
}
}
HTML part:
PHP Code:
<table border="1" style="border-collapse: collapse" id="mcoins">
<tr><td colspan="2"><b><?php echo $_STR[mco0]; ?></b></td></tr>
<tr><td colspan="2"> </td></tr>
<form method="post" action="index.php?do=accounts">
<tr>
<td>
<select name="type">
<option value="0">UserID</option>
<option value="1">AID</option>
</select>: <input type="text" name="id" /> <?php echo $_STR[mco2]; ?>: <input type="text" name="ncoins" />
<input type="submit" name="mcoins" value="<?php echo $_STR[mco3]; ?>" />
</td>
</tr>
<tr><td colspan="2"> </td></tr>
</form>
</table>
<body>
<table style="border-collapse: collapse;" id="Dcoins"
border="1">
<tbody>
<tr>
<td colspan="2"><b>Add Donate Coins</b></td>
</tr>
<tr>
<td colspan="2"> </td>
</tr>
<form method="post" action="index.php?do=accounts">
<tr>
<td>
<select name="type">
<option value="0">UserID</option>
<option value="1">AID</option>
</select>
: <input name="id" type="text"> DonateCoins to Add: <input
name="ncoins" type="text">
<input name="Dcoins" value="Add Coins"
type="submit">
</td>
</tr>
<tr>
<td colspan="2"> </td>
</tr>
</form>
</tbody>
</table>
<br />
Lang file, English.php:
PHP Code:
// MCoins
$_STR[mco0] = "Add EventCoins";
$_STR[mco1] = "EventCoins send";
$_STR[mco2] = "EventCoins to add";
$_STR[mco3] = "Add Coins";
$_STR[mco4] = "The EventCoins of the %s %s has been changed to %s";
$_STR[mco5] = "EventCoins added!";
//DCoins
$_STR[Dco4] = "The DonateCoins of the %s %s has been changed to %s";
$_STR[Dco5] = "Donate Coins added!";
Re: Send Event/Donate Coins via AdminCP
HEy thanks mate, is this just a simple php file, or is this replaceable with a website for example: Ijji 2010 website rip?
thanks in advance
thejj,
Re: Send Event/Donate Coins via AdminCP
Quote:
Originally Posted by
thajj
HEy thanks mate, is this just a simple php file, or is this replaceable with a website for example: Ijji 2010 website rip?
thanks in advance
thejj,
its a simple file edit in your AdminCP of Emisand.
Re: Send Event/Donate Coins via AdminCP
Dammit. I keep thinkin you quit.
Re: Send Event/Donate Coins via AdminCP
Message from: Event Coins Change!
The selected account does not exist
wth?