Hello there guys.
I'm wondering id anyone could help me to make a PHP script to send coin to certain user? Im not asking for spoonfeed just some head start.
Printable View
Hello there guys.
I'm wondering id anyone could help me to make a PHP script to send coin to certain user? Im not asking for spoonfeed just some head start.
PHP Code:<?php
if(isset($_POST['changecoins']))
{
$type = $_POST['type'];
$id = $_POST['id'];
$coins = $_POST['coins'];
if( $type == 0 )
{
$query02 = mssql_query("SELECT AID FROM Login(nolock) WHERE UserID = '$id'");
$part = "UserID";
}
elseif( $type == 1 )
{
$query02 = mssql_query("SELECT UserID FROM Login(nolock) WHERE AID = '$id'");
$part = "AID";
}
else
{
die();
}
if( mssql_num_rows($query02) != 1 )
{
die("Account doesn't exists");
}
else
{
mssql_query("UPDATE Login SET Coins = Coins + $coins WHERE $part = '$id'");
die("Coins added succesfully");
}
}
?>
<h3>Add Coins</h3>
<form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
<select name="type">
<option value="0">UserID</option>
<option value="1">AID</option>
</select>
<input type="text" name="id" /> Coins:
<input type="text" name="coins" />
<input type="submit" name="changeccoins" value="Add Coins" />
</form>