Modify module vote for credits WCoinC
Hello, do not know if I can help any programmer in the following, it happens that would like to change this module to deliver credits instead WCoinC
PHP Code:
<?
ob_start();if("1" == "1"){$load_vote_settings = simplexml_load_file('engine/config_mods/vote_credits_settings.xml');$active = trim($load_vote_settings->active);if($active == '0'){ echo msg('0',text_sorry_feature_disabled);}else{$delay_hours = trim($load_vote_settings->delay_hours);$votef = file('engine/variables_mods/vote_credits.tDB');if(isset($_GET['vid'])){ if(!empty($_GET['vid'])){ $delete_time_script = $core_db->Execute("select deletetime from MUCore_VoteCreditsIp order by deletetime asc"); while (!$delete_time_script->EOF){ $time_check2 = $delete_time_script->fields[0]-time(); if($time_check2 <= 0){ $delete_time = $core_db->Execute("Delete from MUCore_VoteCreditsIp where deletetime=?",array($delete_time_script->fields[0])); } $delete_time_script->MoveNext(); } $make_time_hours2 = $delay_hours*3600; $time_vote2 = time()+$make_time_hours2; $check_ip = $core_db->Execute("Select username,ip,deletetime from MUCore_VoteCreditsIp where username=?",array($user_auth_id)); if($check_ip->EOF){ $check_ip_2 = $core_db->Execute("Select ip from MUCore_VoteCreditsIp where ip=?",array($_SERVER['REMOTE_ADDR'])); if(!$check_ip_2->EOF){ echo msg('0',str_replace("{delay_hours}",$delay_hours,text_module_vote_credits_t1)); }else{ $create_ip_acc = $core_db->Execute("Insert into MUCore_VoteCreditsIp (username,deletetime,ip)VALUES(?,?,?)",array($user_auth_id,$time_vote2,$_SERVER['REMOTE_ADDR'])); } }else{ $voteid = safe_input($_GET['vid'],''); foreach ($votef as $vote_dat_re){ $vote_dat_re = explode("¦",$vote_dat_re); if($vote_dat_re[0] == $voteid){ $vote_credits = $vote_dat_re[3]; $vote_link = $vote_dat_re[2]; $vote_id_found = '1'; $vote_id = $vote_dat_re[0]; break; } } if($vote_id_found == '1'){ $select_vote = $core_db->Execute("Select username,vote_time from MUCore_VoteCredits where username=? and vote_id=?",array($user_auth_id,$vote_id)); $make_time_hours = $delay_hours*3600; $time_vote = time()+$make_time_hours; if($select_vote->EOF){ $insert_username = $core_db->Execute("insert into MUCore_VoteCredits(vote_id,username,vote_time)VALUES(?,?,?)",array($vote_id,$user_auth_id,$time_vote)); if($insert_username){ $check_memb_acc = $core_db2->Execute("Select memb___id from memb_Credits where memb___id=?",array($user_auth_id)); if($check_memb_acc->EOF){ $x = mssql_query("Select coupons from MEMB_INFO where memb___id='$user_auth_id'"); $xx = mssql_fetch_row($x); $k = $xx[0]+1; mssql_query("Update MEMB_INFO set Coupon = '$k' where memb___id='$user_auth_id'"); $insert_memb_acc = $core_db2->Execute("INSERT INTO MEMB_CREDITS(memb___id,credits)VALUES(?,?)",array($user_auth_id,$vote_credits)); if($insert_memb_acc){ header('Location: '.$vote_link.''); }else{ echo msg('0',text_module_vote_credits_t2); } }else{ $x = mssql_query("Select coupons from MEMB_INFO where memb___id='$user_auth_id'"); $xx = mssql_fetch_row($x); $k = $xx[0]+1; mssql_query("Update MEMB_INFO set Coupon = '$k' where memb___id='$user_auth_id'"); $insert_credits = $core_db2->Execute("Update memb_credits set credits=credits+".$vote_credits." where memb___id=?",array($user_auth_id)); if($insert_credits){ header('Location: '.$vote_link.''); }else{ echo msg('0',text_module_vote_credits_t2); } } } }else { $time_check = $select_vote->fields[1]-time(); if($time_check > 0){ echo msg('0',str_replace("{delay_hours}",$delay_hours,text_module_vote_credits_t3)); }else{ $update_vote_info = $core_db->Execute("Update MUCore_VoteCredits set [vote_time]=$time_vote where username=? and vote_id=?",array($user_auth_id,$vote_id)); if($update_vote_info){ $x = mssql_query("Select coupons from MEMB_INFO where memb___id='$user_auth_id'"); $xx = mssql_fetch_row($x); $k = $xx[0]+1; mssql_query("Update MEMB_INFO set Coupon = '$k' where memb___id='$user_auth_id'"); $insert_credits = $core_db->Execute("Update memb_credits set credits=credits+".$vote_credits." where memb___id=?",array($user_auth_id)); if($insert_credits){ header('Location: '.$vote_link.''); }else{ echo msg('0',text_module_vote_credits_t2); } } } } } } }}
echo '<table width="100%" border="0" align="center" cellpadding="0" cellspacing="8">';$count=0;foreach ($votef as $vote_data){ $vote_data = explode("¦",$vote_data); $count++; echo ' <tr> <td align="left" class="iR_class">'.htmlspecialchars($vote_data[1]).'</td> <td rowspan="2" align="center" width="70" class="iR_stats_reset"><form action="'.$core_run_script.'&vid='.$vote_data[0].'" method="post"> <input type="submit" value="Vote Now!"></form></td> </tr> <tr> <td class="iR_stats_level">'.text_module_vote_credits_t4.' : '.number_format($vote_data[3]).'</td> </tr> <tr> <td style="background-image:url(template/'.$core['config']['template'].'/images/inner_line.jpg); background-repeat:repeat-x; height: 2px;" colspan="3"></td> </tr>';}if($count=='0'){ echo ' <tr> <td align"center">'.msg('0',text_module_vote_credits_t6).'</td> </td>';}echo '</table>';}}
?>
In DB:
Table: T_InGameShop_Point
Column: WCoinC
Userid: AccountID
Re: Modify module vote for credits WCoinC
Code:
Update memb_credits set credits=credits+".$vote_credits." where memb___id=?",array($user_auth_id));
change to
Code:
Update T_InGameShop_Point set WCoinC=WCoinC+".$vote_credits." where AccountID =?",array($user_auth_id));
-----------------------------------------
Code:
$insert_memb_acc = $core_db2->Execute("INSERT INTO MEMB_CREDITS(memb___id,credits)VALUES(?,?)",array($user_auth_id,$vote_credits));
change to
Code:
$insert_memb_acc = $core_db2->Execute("INSERT INTO T_InGameShop_Point(AccountID ,WCoinC)VALUES(?,?)",array($user_auth_id,$vote_credits));
-----------------------------------------
Code:
("Select memb___id from memb_Credits where memb___id=?",array($user_auth_id));
change to
Code:
("Select AccountID from T_InGameShop_Point where AccountID =?",array($user_auth_id));
-----------------------------------------
and test
Re: Modify module vote for credits WCoinC