<?php
include("connect.php");
include("login_cookies.php");

$tid = date("H:i:s d/m - Y");

while($admin = mysql_fetch_array($db_admin)) {

if ($_COOKIE["pass"] == $admin["kode"]) {

 if ($admin["admin"] == "1") {

	if ($admin["exist"] == "1") {
/////////////////////////

if ($_GET['choose'] == "add") {
$touser = mysql_query("SELECT * FROM `pytox_community` WHERE `id` LIKE '{$_POST['touser']}' LIMIT 1");
while($to = mysql_fetch_array($touser)) {

$oldcoins = $to['coins'];

$newcoins = $oldcoins+$_POST['pycoins'];

mysql_query("UPDATE `pytox_community` SET `coins` = '$newcoins' WHERE `id` LIKE '{$_POST['touser']}' AND `bruger` LIKE '{$to['bruger']}' LIMIT 1");

print "Overførslen blev sandsynligvis overført uden problemer!";

}
} else {

?>
<strong>Uddel pycoins</strong>
<br />
<i>Hvis De ønsker at trække pycoins fra en bruger, skriv da - foran.</i>
<br />
<br />
<form method="post" action="?site=Adpycoins&amp;choose=add">
Til bruger: <select name="touser">
<option> - Vælg en bruger - </option>
<?php
$users = mysql_query("SELECT * FROM `pytox_community` ORDER BY `bruger` ASC");

while($bruger = mysql_fetch_array($users)) {
?>
<option value="<?=$bruger['id']?>"><?=$bruger['bruger']?></option>
<?php
}
?>
</select>
<br />
<br />
Pycoins der skal gives <i>(Må kun være tal, maksimalt 99999999999 pycoins!)</i>: <input type="text" name="pycoins" maxlength="11" />
<br />
<br />
<input type="submit" name="submit" value="Giv" />
</form>
<?php

}
/////////////////////////
	} else {// $admin[exist]
	header("Location: index.php?message=failure&errorid=60065");
	}

 }

}

}
?>