1. inside lib/config.inc.php add
PHP Code:
$_config['change_school_pay']=200;
2.inside Extend.php add
PHP Code:
case "webcs":
$character->changeschool();
break;
3.create a php inside parts call extend.webcs.inc.php
PHP Code:
<table width="100%" height="350" border="0" cellspacing="0" cellpadding="0">
<tr>
<td style="border-bottom:1px solid #ffffff;" valign=top>
<!--content/s-->
<form name="phpnetForm" method="post" action="<?php echo 'extend.php?do=webcs'; ?>" onsubmit="javascript:return WebForm_OnSubmit();" onkeypress="javascript:return WebForm_FireDefaultButton(event, 'ctl00_ContentPlaceHolder_main_HyperLink2')" id="phpnetForm">
<div>
<input type="hidden" name="__EVENTTARGET" id="__EVENTTARGET" value="" />
<input type="hidden" name="__EVENTARGUMENT" id="__EVENTARGUMENT" value="" />
</div>
<script type="text/javascript">
var theForm = document.forms['phpnetForm'];
if (!theForm) {
theForm = document.phpnetForm;
}
function __doPostBack(eventTarget, eventArgument) {
if (!theForm.onsubmit || (theForm.onsubmit() != false)) {
theForm.__EVENTTARGET.value = eventTarget;
theForm.__EVENTARGUMENT.value = eventArgument;
theForm.submit();
}
}
</script>
<?php
if($_config['AjaxMode']){
echo '<script src="/WebResource.axd/4a26f1ecae0a33a44b198d94629e3bfb.js" type="text/javascript"></script>'."\n",
'<script src="/ScriptResource.axd/5460f4dfbd221bcd575ca1292a108cfa.js" type="text/javascript"></script>'."\n",
'<script src="/ScriptResource.axd/42c740683f0709257bab43d28ea0de90.js" type="text/javascript"></script>'."\n",
'<script src="/ScriptResource.axd/b4b17b0bafa5744aeb3dfe229abd0952.js" type="text/javascript"></script>'."\n",
'<script src="/WebResource.axd/8873f142ec7ff7723ba99c2d06688bce.js" type="text/javascript"></script>'."\n";
}
?>
<script type="text/javascript">
function WebForm_OnSubmit() {
if (typeof(ValidatorOnSubmit) == "function" && ValidatorOnSubmit() == false) return false;
return true;
}
</script>
<div class="space"></div>
<table width="100%" border="0" cellpadding="10" cellspacing="1" align="center" class="showdetail">
<tr>
<td style="padding:6px">
<P>請確定您的角色已經離線,每次轉學需要 </FONT><FONT color=#ff0000><STRONG><?php print $_config['change_school_pay'];?></STRONG></FONT><FONT color=#000000> 積分</FONT> </P>
</td>
</tr>
</table>
<div class="space"></div>
<table width="100%" border="0" align="center" cellpadding="5" cellspacing="0">
<tr>
<td width="30%" height="30"><img src="/images/point_b.gif" /> 您的帳號 </td>
<td >
<span id="ctl00_ContentPlaceHolder_main_UserID"><?php print $user->userID;?></span>
</td>
</tr>
</table>
<table width="100%" border="0" align="center" cellpadding="5" cellspacing="0">
<tr>
<td width="30%" height="30"><img src="/images/point_b.gif" /> 選擇角色 </td>
<td>
<select name="ChaList" id="ctl00_ContentPlaceHolder_main_ChaList">
<option value="-1">請選擇角色</option>
<?php $character->get_CharacterList($user->userNum); ?>
</select>
<span id="ctl00_ContentPlaceHolder_main_ChaList_Check" style="color:#FF6600;display:none;">*</span>
</td>
</tr>
</table>
<table width="100%" border="0" align="center" cellpadding="5" cellspacing="0">
<tr>
<td width="30%" height="30"><img src="/images/point_b.gif" /> 選擇學院 </td>
<td>
<select name="SchoolList" id="ctl00_ContentPlaceHolder_main_SchoolList">
<option value="-1">請選擇學院</option>
<option <?php if (clean_variable($_POST["SchoolList"]) == 'SG') { echo 'selected="selected"'; } ?>value="SG">聖門</option>
<option <?php if (clean_variable($_POST["SchoolList"]) == 'MP') { echo 'selected="selected"'; } ?>value="MP">玄岩</option>
<option <?php if (clean_variable($_POST["SchoolList"]) == 'Phoenix') { echo 'selected="selected"'; } ?>value="Phoenix">鳳凰</option>
</select>
<span id="ctl00_ContentPlaceHolder_main_SchoolList_Check" style="color:#FF6600;display:none;">*</span>
</td>
</tr>
</table>
<table width="100%" border="0" align="center" cellpadding="5" cellspacing="0">
<tr>
<td width="30%"><img src="/images/point_b.gif" /> 請填入右圖中的字符 </td>
<td width="30%"><input name="ValidateCode" type="text" class="form_pay" id="ctl00_ContentPlaceHolder_main_ValidateCode" style="width:143px;" tabindex="3" value="<?php echo htmlentities($_POST["ValidateCode"], ENT_QUOTES, 'UTF-8');?>" maxlength="4" /></td>
<td><img id="imgVerify" name="imgVerify" onclick="this.src='/VerifyCode.php?'+Math.random()+';'" alt="看不清?點擊更換" />
<SCRIPT language=javascript>
phpnetForm.imgVerify.src="/VerifyCode.php?" + Math.random();
</script>
<span id="ctl00_ContentPlaceHolder_main_Code_Check_Null" style="color:Red;display:none;">此項為必填項。</span></td>
</tr>
<tr>
<td> </td>
<td colspan="2">
<span id="ctl00_ContentPlaceHolder_main_ValidateCode_Check" style="color:Red;display:none;">校驗碼輸入有誤,請重新輸入。</span>
<span id="ctl00_ContentPlaceHolder_main_Code_Check" style="color:Red;"><?php echo $character->errs['CodeCheck'];?></span></td>
</tr>
</table>
<div align=center style="border-bottom:1px solid #ffffff;">
<span id="ctl00_ContentPlaceHolder_main_Result" style="color:Red;"><?php echo $character->errs['Result'];?></span>
</div>
<br>
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td align="center">
<br><img height=20 width=0>
<input type="submit" name="HyperLink2" value="提交" onclick="javascript:WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions("HyperLink2", "", true, "", "", false, false))" id="ctl00_ContentPlaceHolder_main_HyperLink2" tabindex="4" class="btn2" style="font-size:12px;height:24px;width:50px;" />
<input type="reset" name="reset" value="重置" tabindex="5" class="btn2" style="font-size:12px;height:24px;width:50px;" />
<br><img height=20 width=0>
</td>
</tr>
</table>
<script type="text/javascript">
var Page_Validators = new Array(document.getElementById("ctl00_ContentPlaceHolder_main_ChaList_Check"),document.getElementById("ctl00_ContentPlaceHolder_main_SchoolList_Check"), document.getElementById("ctl00_ContentPlaceHolder_main_Code_Check_Null"), document.getElementById("ctl00_ContentPlaceHolder_main_ValidateCode_Check"));
</script>
<script type="text/javascript">
var ctl00_ContentPlaceHolder_main_ChaList_Check = document.all ? document.all["ctl00_ContentPlaceHolder_main_ChaList_Check"] : document.getElementById("ctl00_ContentPlaceHolder_main_ChaList_Check");
ctl00_ContentPlaceHolder_main_ChaList_Check.controltovalidate = "ctl00_ContentPlaceHolder_main_ChaList";
ctl00_ContentPlaceHolder_main_ChaList_Check.errormessage = "*";
ctl00_ContentPlaceHolder_main_ChaList_Check.display = "Dynamic";
ctl00_ContentPlaceHolder_main_ChaList_Check.evaluationfunction = "RegularExpressionValidatorEvaluateIsValid";
ctl00_ContentPlaceHolder_main_ChaList_Check.validationexpression = "^[0-9]{1,10}$";
var ctl00_ContentPlaceHolder_main_SchoolList_Check = document.all ? document.all["ctl00_ContentPlaceHolder_main_SchoolList_Check"] : document.getElementById("ctl00_ContentPlaceHolder_main_SchoolList_Check");
ctl00_ContentPlaceHolder_main_SchoolList_Check.controltovalidate = "ctl00_ContentPlaceHolder_main_SchoolList";
ctl00_ContentPlaceHolder_main_SchoolList_Check.errormessage = "*";
ctl00_ContentPlaceHolder_main_SchoolList_Check.display = "Dynamic";
ctl00_ContentPlaceHolder_main_SchoolList_Check.evaluationfunction = "RequiredFieldValidatorEvaluateIsValid";
ctl00_ContentPlaceHolder_main_SchoolList_Check.initialvalue = "-1";
var ctl00_ContentPlaceHolder_main_Code_Check_Null = document.all ? document.all["ctl00_ContentPlaceHolder_main_Code_Check_Null"] : document.getElementById("ctl00_ContentPlaceHolder_main_Code_Check_Null");
ctl00_ContentPlaceHolder_main_Code_Check_Null.controltovalidate = "ctl00_ContentPlaceHolder_main_ValidateCode";
ctl00_ContentPlaceHolder_main_Code_Check_Null.display = "Dynamic";
ctl00_ContentPlaceHolder_main_Code_Check_Null.evaluationfunction = "RequiredFieldValidatorEvaluateIsValid";
ctl00_ContentPlaceHolder_main_Code_Check_Null.initialvalue = "";
var ctl00_ContentPlaceHolder_main_ValidateCode_Check = document.all ? document.all["ctl00_ContentPlaceHolder_main_ValidateCode_Check"] : document.getElementById("ctl00_ContentPlaceHolder_main_ValidateCode_Check");
ctl00_ContentPlaceHolder_main_ValidateCode_Check.controltovalidate = "ctl00_ContentPlaceHolder_main_ValidateCode";
ctl00_ContentPlaceHolder_main_ValidateCode_Check.errormessage = "Please try new code instead";
ctl00_ContentPlaceHolder_main_ValidateCode_Check.display = "Dynamic";
ctl00_ContentPlaceHolder_main_ValidateCode_Check.evaluationfunction = "RegularExpressionValidatorEvaluateIsValid";
ctl00_ContentPlaceHolder_main_ValidateCode_Check.validationexpression = "^[0-9a-z]{4}$";
</script>
<script type="text/javascript">
var Page_ValidationActive = false;
if (typeof(ValidatorOnLoad) == "function") {
ValidatorOnLoad();
}
function ValidatorOnSubmit() {
if (Page_ValidationActive) {
return ValidatorCommonOnSubmit();
}
else {
return true;
}
}
WebForm_AutoFocus('HyperLink2');Sys.Application.initialize();
document.getElementById('ctl00_ContentPlaceHolder_main_ChaList_Check').dispose = function() {
Array.remove(Page_Validators, document.getElementById('ctl00_ContentPlaceHolder_main_ChaList_Check'));
}
document.getElementById('ctl00_ContentPlaceHolder_main_SchoolList_Check').dispose = function() {
Array.remove(Page_Validators, document.getElementById('ctl00_ContentPlaceHolder_main_SchoolList_Check'));
}
document.getElementById('ctl00_ContentPlaceHolder_main_Code_Check_Null').dispose = function() {
Array.remove(Page_Validators, document.getElementById('ctl00_ContentPlaceHolder_main_Code_Check_Null'));
}
document.getElementById('ctl00_ContentPlaceHolder_main_ValidateCode_Check').dispose = function() {
Array.remove(Page_Validators, document.getElementById('ctl00_ContentPlaceHolder_main_ValidateCode_Check'));
}
</script>
</form>
<!--content/e-->
</td>
</tr>
</table>
4. inside control/ctl_user.inc.php add
PHP Code:
function SchoolType($sc){
switch ($sc){
case 'SG':
return '0';
break;
case 'MP':
return '1';
break;
case 'Phoenix':
return '2';
break;
default:
return '3';
break;
}
}
5.inside control/ctl_character.inc.php add
PHP Code:
function changeschool(){
global $_config;
global $db;
if(isset($_POST["HyperLink2"])){
if($_POST["ChaList"]=="-1"){
$this->errs['Result'] = $this->msg_Table(CHARACTER_SELECT_ERR_MSG);
}elseif($this->SchoolType(clean_variable($_POST['SchoolList']))=='-1'){
$this->errs['Result'] = _SCHOOL_SELECT_MSG;
}elseif(!$this->isvalidCheckCode()){
$this->errs['CodeCheck'] = CHECK_CODE_ERR_MSG;
}else{
$this->characterVO->chaNum = (int)$_POST["ChaList"];
$this->get_CharacterInfo();
if(!$this->character->isCharacterOnline($this->characterVO)){
$this->errs['Result'] = $this->msg_Table(CHARACTER_ONLINE_ERR_MSG);
}elseif($this->userInfo->userPoint < $_config['change_school_pay']){
$this->errs['Result'] = $this->msg_Table(USER_POINT_ERR_MSG);
}else{
$school = $db->Execute("Select * from RanGame1.dbo.ChaInfo Where ChaNum = ?",array((int)$_POST["ChaList"]));
if( $this->SchoolType1($school->fields["ChaSchool"]) == $_POST['SchoolList']){
$this->_alert(_SCHOOL_SAME_SCHOOL,'extend.php?do=webcs');
}
$this->userInfo->userPoint = $_config['change_school_pay'];
$this->user->charge_Point($this->userInfo);
$_result = $db->Execute('update rangame1.dbo.chainfo set ChaSchool = ? where chanum = ?',array($this->SchoolType(clean_variable($_POST['SchoolList'])),(int)$_POST["ChaList"]));
echo '<script type="text/javascript">alert("',_SCHOOL_SUCCESS,'");window.self.location=\'index.php\';</script>';
}
}
}
}
6. inside lib/common/English.lang.php add
PHP Code:
//Change School Msg
define('_SCHOOL_SELECT_MSG','請選擇校園!');
define('_SCHOOL_SAME_SCHOOL','不能選擇相同的校園!');
define('_SCHOOL_SUCCESS','成功!');
give a like...