-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmclust5.php
More file actions
executable file
·30 lines (26 loc) · 867 Bytes
/
mclust5.php
File metadata and controls
executable file
·30 lines (26 loc) · 867 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
<?
mysql_connect("localhost","pool","pool");
mysql_select_db("pool");
$pool=json_decode($_POST['json'],true);
for($i=0;$i<count($pool);$i++)
{
if($pool[$i]['takers']!=NULL)
{
$gmid=$pool[$i]['mid'];
$gpid=$pool[$i]['pid'];
$getcount=mysql_query("select count(pid) as count from belongs_to where pid=$gpid group by pid");
$count=mysql_fetch_array($getcount);
$pcount=$count['count'];
for($j=0;$j<count($pool[$i]['takers']);$j++)
{
$tpid=$pool[$i]['takers'][$j]['pid'];
$tmid=$pool[$i]['takers'][$j]['mid'];
$pcount++;
$temp1=-$pcount;
mysql_query("delete from pool where pid='$tpid'") or die(mysql_error());
mysql_query("insert into belongs_to values ('$tmid','$gpid','$temp1')") or die(mysql_error());
}
$temp=$pool[$i]['capacity'];
mysql_query("update pool set capacity=$temp where pid=$gpid");
}
}