⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 wog_act_group.php

📁 WEBGAME源码,有架设说明,只是非常简单
💻 PHP
📖 第 1 页 / 共 2 页
字号:
		$group_total=$DB_site->query_first("select count(a.g_id) as g_id from wog_group_main a ");
		if(empty($_POST["page"]))
		{
			$_POST["page"]="1";
		}
		$spage=((int)$_POST["page"]*8)-8;
		$group=$DB_site->query("select a.g_id,a.g_name,sum(b.p_g_number) as p_g_number,avg(b.p_g_morale),a.g_peo,a.g_money,a.g_win,a.g_lost,a.g_adm_id1 from wog_group_main a,wog_player b where a.g_id=b.p_g_id  group by b.p_g_id  ORDER BY a.g_id desc LIMIT ".$spage.",8 ");
		$temp_s="";
		while($groups=$DB_site->fetch_array($group))
		{
			$p=$DB_site->query_first("select a.p_name from wog_player a where a.p_id=".$groups[8]);
			$temp_s.=";".$groups[0].",".$groups[1].",".$groups[2].",".round($groups[3]).",".$groups[4].",".$groups[5].",".$groups[6].",".$groups[7].",".$p["p_name"];
		}
		$DB_site->free_result($group);
		unset($groups);
		unset($p);
		$temp_s=substr($temp_s,1,strlen($temp_s));
		showscript("parent.group_join($group_total[0],".$_POST["page"].",'$temp_s')");
		unset($temp_s);
		unset($group_total);
	}

	function group_p_number($user_id)
	{
		global $DB_site,$_POST,$lang;
		$p=$DB_site->query_first("select a.g_id,a.g_money,c.g_a_hp,b.p_g_number from wog_group_main a,wog_player b,wog_group_area c where a.g_id=b.p_g_id and b.p_id=".$user_id." and c.g_a_id=b.p_g_a_id ");
		$temp_money=0;
		if($_POST["temp_id"]=="full")
		{
			$temp_money=10000-$p["p_g_number"];
			$p["p_g_number"]=10000;
		}else
		{
			$p["p_g_number"]=$p["p_g_number"]+(int)$_POST["temp_id"];
			if($p["p_g_number"]>10000)
			{
				$temp_money=$p["p_g_number"]-10000;
				$p["p_g_number"]=10000;
			}
			$temp_money=(int)$_POST["temp_id"]-$temp_money;
		}
		if($p["g_a_hp"]<=0)
		{
			alertWindowMsg($lang['wog_act_group_noadd']);
		}
		if($p["g_money"]<$temp_money)
		{
			alertWindowMsg($lang['wog_act_group_nogmoney']);	
		}
		$DB_site->query("update wog_player set p_g_number=".$p["p_g_number"].",p_money=p_money-".$temp_money." where p_id=".$user_id);
		$DB_site->query("update wog_group_main set g_money=g_money-".$temp_money." where g_id=".$p["g_id"]);
		$this->group_center($user_id);
		unset($p);
	}

	function group_morale($user_id)
	{
		global $DB_site,$lang;
		$p=$DB_site->query_first("select p_money,p_au,p_g_morale from wog_player where p_id=".$user_id);
		if($p["p_money"]<100)
		{
			alertWindowMsg($lang['wog_act_nomoney']);
		}
		$p_morale=rand(1,round(($p["p_au"]/680)*15))+9;
		$p_morale=$p_morale+$p["p_g_morale"];
		if($p_morale>100){$p_morale=100;}
		$DB_site->query("update wog_player set p_g_morale=$p_morale,p_money=p_money-100 where p_id=".$user_id);
		$this->group_center($user_id);
		unset($p);
	}

	function group_number($user_id)
	{
		global $DB_site,$_POST,$wog_arry,$lang;
		if(empty($_POST["p_id"]))
		{
			alertWindowMsg($lang['wog_act_group_nosel']);
		}
		$group_main=$DB_site->query_first("select a.g_id,a.g_adm_id1,a.g_adm_id2 from wog_group_main a,wog_player b where a.g_id=b.p_g_id and b.p_id=".$user_id."");
		if(!$group_main)
		{
			alertWindowMsg($lang['wog_act_group_nogroup']);
		}
		if($group_main["g_adm_id1"]!=$user_id && $group_main["g_adm_id2"]!=$user_id)
		{
			alertWindowMsg($lang['wog_act_group_nolv']);
		}
		if($_POST["g_del"]==1)
		{
			if(htmlspecialchars($_POST["p_id"])==$group_main["g_adm_id1"])
			{
				$DB_site->query("delete from wog_group_main where g_id=".$group_main["g_id"]."");
				$DB_site->query("delete from wog_group_area where g_id=".$group_main["g_id"]."");
				$DB_site->query("delete from wog_group_event where g_b_id=".$group_main["g_id"]."");
				$DB_site->query("update wog_player set p_g_id=0,p_g_a_id=0,p_g_number=0,p_g_morale=0 where p_g_id=".$group_main["g_id"]."");
			}else
			{
				$DB_site->query("update wog_group_main set g_peo=g_peo-1 where g_id=".$group_main["g_id"]."");
				$DB_site->query("update wog_player set p_g_id=0,p_g_a_id=0,p_g_number=0,p_g_morale=0 where p_id=".htmlspecialchars($_POST["p_id"])."");
			}
		}else
		{
			if(empty($_POST["g_a_type"]))
			{
				alertWindowMsg($lang['wog_act_group_settype']);
			}
			if($_POST["g_a_type"]=="7")
			{
				$DB_site->query("update wog_player set p_g_a_id=0 where p_id=".htmlspecialchars($_POST["p_id"])."");
			}else
			{
				$get_g_a_id=$DB_site->query_first("select g_a_id from wog_group_area  where g_id=".$group_main["g_id"]." and g_a_type=".$_POST["g_a_type"]." ");
				$peo_num=$DB_site->query_first("select count(p_id) as p_id from wog_player where p_g_a_id=".$get_g_a_id[0]." ");
				if($peo_num[0]>=$wog_arry["g_a_peo"])
				{
					alertWindowMsg($lang['wog_act_group_fulpeople'].$wog_arry["g_a_peo"]." member");
				}else
				{
					$DB_site->query("update wog_player set p_g_a_id=".$get_g_a_id[0]." where p_id=".htmlspecialchars($_POST["p_id"])."");
				}
			}
		}
		showscript("parent.job_end(11)");
		unset($temp_s);
		unset($group_main);
		unset($u_g_a);
	}
	
	function group_peolist($user_id)
	{
		global $DB_site,$lang;
		$group_main=$DB_site->query_first("select a.g_id,a.g_name,a.g_adm_id1,a.g_adm_id2 from wog_group_main a,wog_player b where a.g_id=b.p_g_id and b.p_id=".$user_id."");
		if(!$group_main)
		{
			alertWindowMsg($lang['wog_act_group_nogroup']);
		}
		$temp_s="";
		$u_g_a=$DB_site->query("select a.p_id,a.p_name,a.p_g_number,a.p_g_morale,a.p_g_a_id,a.p_lv from wog_player a where a.p_g_id=".$group_main[0]." ");
		while($u_g_as=$DB_site->fetch_array($u_g_a))
		{
			$g_a_type=$DB_site->query_first("select g_a_type from wog_group_area  where g_a_id=".$u_g_as["p_g_a_id"]."");
			if(!$g_a_type)
			{
				$g_a_type[0]="7";
			}
			if($u_g_as["p_id"]==$group_main["g_adm_id1"])
			{
				$u_g_as["p_name"].=$lang['wog_act_group_ad'];
			}
			$temp_s.=";".$u_g_as["p_id"].",".$u_g_as["p_name"].",".$u_g_as["p_g_morale"].",".$u_g_as["p_g_number"].",".$u_g_as["p_lv"].",".$g_a_type[0];
		}
		$temp_s=substr($temp_s,1,strlen($temp_s));
		showscript("parent.group_peolist('".$temp_s."','".$group_main[1]."')");
		unset($temp_s);
		unset($group_main);
		unset($u_g_a);
	}
	
	function group_center($user_id)
	{
		global $DB_site,$lang;
		$group_main=$DB_site->query_first("select a.g_id,a.g_name,a.g_fire from wog_group_main a,wog_player b where a.g_id=b.p_g_id and b.p_id=".$user_id."");
		if(!$group_main)
		{
			alertWindowMsg($lang['wog_act_group_nogroup']);
		}
		$temp_s="";
		$group_area=$DB_site->query("select g_a_type,g_a_hp,g_a_id from wog_group_area where g_id=".$group_main[0]." ");
		while($group_areas=$DB_site->fetch_array($group_area))
		{
			$g_a_body=$DB_site->query_first("select sum(p_g_number) as p_g_number,avg(p_g_morale) as p_g_morale,count(p_id) as p_id 
			from wog_player where p_g_id=".$group_main[0]." and p_g_a_id=".$group_areas["g_a_id"]."");
			$temp_s.=";".$group_areas["g_a_type"].",".$g_a_body["p_g_number"].",".round($g_a_body["p_g_morale"]).",".$group_areas["g_a_hp"].",".$g_a_body["p_id"];
		}
		$DB_site->free_result($group_area);
		unset($group_area);
		$temp_s=substr($temp_s,1,strlen($temp_s));
		$u_g="";
		$u_g_a=$DB_site->query_first("select a.p_g_number,a.p_g_morale,b.g_a_type from wog_player a,wog_group_area b where p_id=".$user_id." and b.g_a_id=a.p_g_a_id");
		if($u_g_a)
		{
			$u_g=$u_g_a[2].",".$u_g_a[0].",".$u_g_a[1];	
		}
		showscript("parent.group_center('".$temp_s."','".$group_main[g_name]."','".$u_g."',".$group_main[g_fire].")");
		unset($temp_s);
		unset($group_areas);
		unset($group_main);
		unset($u_g_a);
		unset($u_g);
	}
	
	function group_creat($user_id)
	{
		global $DB_site,$_POST,$wog_arry,$lang;
		if(empty($_POST["temp_id"]))
		{
			alertWindowMsg($lang['wog_act_group_noname']);
		}
		if(eregi("[<>'\", ;]", $_POST["temp_id"]))
		{
			alertWindowMsg($lang['wog_act_errword']);
		}
		$_POST["temp_id"]=addslashes(htmlspecialchars($_POST["temp_id"]));
		$group=$DB_site->query_first("select g_name from wog_group_main where g_name='".$_POST["temp_id"]."'");
		if($group)
		{
			alertWindowMsg($lang['wog_act_group_used']);
		}else
		{
			$have_price=$DB_site->query_first("select p_money,p_g_id from wog_player where p_id=".$user_id."");	
			if($have_price[0]<$wog_arry["creat_group"])
			{
				alertWindowMsg($lang['wog_act_nomoney']);
			}
			if($have_price[1]>0)
			{
				alertWindowMsg($lang['wog_act_group_notcreat']);
			}
				$DB_site->query("insert into wog_group_main(g_name,g_adm_id1,g_peo)values('".$_POST["temp_id"]."',".$user_id.",1)");
				$g_id=$DB_site->insert_id();
				$DB_site->query("update wog_player set p_g_id=".$g_id.",p_g_number=1000,p_g_morale=100,p_money=p_money-".$wog_arry["creat_group"]." where p_id=".$user_id."");
				$DB_site->query("insert into wog_group_area(g_id,g_a_type,g_a_hp,g_a_dateline)values(".$g_id.",1,100,".time().")");
				$DB_site->query("insert into wog_group_area(g_id,g_a_type,g_a_hp,g_a_dateline)values(".$g_id.",2,100,".time().")");
				$DB_site->query("insert into wog_group_area(g_id,g_a_type,g_a_hp,g_a_dateline)values(".$g_id.",3,100,".time().")");
				$DB_site->query("insert into wog_group_area(g_id,g_a_type,g_a_hp,g_a_dateline)values(".$g_id.",4,100,".time().")");
				$DB_site->query("insert into wog_group_area(g_id,g_a_type,g_a_hp,g_a_dateline)values(".$g_id.",5,100,".time().")");
				$DB_site->query("insert into wog_group_area(g_id,g_a_type,g_a_hp,g_a_dateline)values(".$g_id.",6,100,".time().")");
				showscript("parent.job_end(10);parent.p_group='".$_POST["temp_id"]."'");
		}
		unset($groups);
		$temp_s=substr($temp_s,1,strlen($temp_s));
		showscript("parent.group_join($group_total[0],".$_POST["page"].",'$temp_s')");
		unset($temp_s);
		unset($group_total);
	}

	function group_book_view($user_id)
	{
		global $DB_site,$_POST,$wog_arry,$lang;
		$group=$DB_site->query_first("select p_g_id from wog_player where p_id=".$user_id."");
		if($group['p_g_id']==0)
		{
			alertWindowMsg($lang['wog_act_group_nogroup']);
		}
		$group=$DB_site->query_first("select g_book from wog_group_book where g_id=".$group['p_g_id']."");
		$temp=str_replace("\r\n","&n",$group[0]);
		showscript("parent.group_book_view('$temp')");
		unset($group);
	}

	function group_book_save($user_id)
	{
		global $DB_site,$_POST,$wog_arry,$lang;
		if(empty($_POST["temp_id"]))
		{
			alertWindowMsg($lang['wog_act_nodata']);
		}
		$temp=htmlspecialchars($_POST["temp_id"]);
		if(strlen($temp) > 800)
		{
			alertWindowMsg($lang['wog_act_group_long']);
		}
		$group_main=$DB_site->query_first("select a.g_id,a.g_adm_id1,a.g_adm_id2 from wog_group_main a,wog_player b where a.g_id=b.p_g_id and b.p_id=".$user_id);
		if(!$group_main)
		{
			alertWindowMsg($lang['wog_act_group_nogroup']);
		}
		if($user_id!=$group_main["g_adm_id1"])
		{
			alertWindowMsg($lang['wog_act_group_nolyadmin']);
		}
		$g_id=$group_main['g_id'];
		$group_main=$DB_site->query_first("select g_id from wog_group_book where g_id=".$g_id);
		if($group_main)
		{
			$DB_site->query("update wog_group_book set g_book='".$temp."' where g_id=".$g_id);
		}else
		{
			$DB_site->query("insert wog_group_book(g_id,g_book)values(".$g_id.",'".$temp."')");
		}
		unset($group_main);
		unset($temp);
		$this->group_book_view($user_id);
	}

}
?>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -