utf-8 인데요 euc-kr로 변환할려면 소스 머손대야할까욤^^;; 정보
utf-8 인데요 euc-kr로 변환할려면 소스 머손대야할까욤^^;;
본문
if(!$member[mb_id]||$member[mb_level]<$open_level){ // 로그인 체크
echo "ERROR";
exit;
}
if (!$page || !is_int($page))
$page = 1;
$limitnum = ($page - 1) * 10;
$sql = " select * from q_stock_list order by qst_today*qst_num desc limit $limitnum, 10";
$result = sql_query($sql);
$sync_data = array();
for ($i=0; $row = sql_fetch_array($result); $i++)
{
$gapper = number_format(round((($row['qst_today']-$row['qst_yesterday'])/$row['qst_yesterday']*100), 2), 2);
$sync_data[0][$i] = array("company"=>htmlspecialchars($row['qst_company']), "code"=>$row['qst_code'],
"price"=>$row['qst_today'], "gap"=>$row['qst_today']-$row['qst_yesterday'], "gapper"=>$gapper,
"volume"=>$row['qst_vol_sell']+$row['qst_vol_buy'], "high"=>$row['qst_high'], "low"=>$row['qst_low'],
"num"=>$row['qst_num'], "rest"=>$row['qst_rest']);
}
$sql = " select qst_index from q_stock ";
$row = sql_fetch($sql);
$stockindex = number_format($row[qst_index], 2);
$sync_data[1] = array("index"=>$stockindex, "userpoint"=>$member[mb_point], "commission" => $commission);
$sync_data= str_replace (" ", "", $sync_data);
echo urldecode(json_encode($sync_data));
?>
>>>>>>>>>>>>>> 값받아오는것같구욤
js 파일은욤
var viewpage = 1; // 현재 페이지
var userpoint = 0;
var commission = 0;
var codeNum = Array();
var refreshTimer = setInterval("stock_refresh()", 10000); // 목록 갱신 반복
$(function() {
$( ".buy_btn" ).button().click(function(){
$( "#codeNum" ).val( $(this).val() );
$( "#buyCompany" ).val( $(this).parent().siblings( ".listCompany" ).children( "A" ).html().replace("&", "&") );
$( "#buyPrice" ).val( $(this).parent().siblings( ".listPrice" ).html() );
$( "#trade_slider" ).slider({
value: 0,
max: tradeCal($(this).parent().siblings( ".listPrice" ).html(), $(this).parent().siblings( ".listRest" ).html() )
});
$( "#buyNum" ).val( 0 );
$( "#buy_dialog" ).dialog( "open" );
return false;
});
$( "#button_prev" ).button().click(function() { pagechange("prev"); return false; });
$( "#button_next" ).button().click(function() { pagechange("next"); return false; });
var buyNum = $( "#buyNum" ),
allFields = $( [] ).add( buyNum ),
tips = $( ".validateTips" );
// 매수 팝업
$( "#buy_dialog" ).dialog({
autoOpen: false,
resizable: false,
height: 350,
width: 350,
modal: true,
buttons: {
"매수": function() {
var bValid = true;
allFields.removeClass( "ui-state-error" );
bValid = bValid && checkRegexp( buyNum, /^[0-9]+$/i, "구매 수량을 정확히 입력하세요" );
if ( bValid ) {
trade("buy", $( "#codeNum" ).val(), buyNum.val());
$( this ).dialog( "close" );
}
},
"취소": function() {
$( this ).dialog( "close" );
}
},
close: function() {
allFields.val( "" ).removeClass( "ui-state-error" );
}
});
$( "#trade_slider" ).slider({
range: "max",
min: 0,
max: 10,
value: 0,
slide: function( event, ui ) {
$( "#buyNum" ).val( ui.value );
}
});
$( "#buyNum" ).val( $( "#trade_slider" ).slider( "value" ) );
function updateTips( t ) {
tips.text( t ).addClass( "ui-state-highlight" );
setTimeout(function() {
tips.removeClass( "ui-state-highlight", 1500 );
}, 500 );
}
function checkRegexp( o, regexp, n ) {
if ( !( regexp.test( o.val() ) ) ) {
o.addClass( "ui-state-error" );
updateTips( n );
return false;
} else {
return true;
}
}
setTimeout("stock_refresh()", 1); // 초기 목록 로드
});
// 목록 갱신
function stock_refresh() {
clearInterval(refreshTimer);
$.ajax({
url: "/xgb/skin/board/skin_stock/stock_list_exec.php?page="+viewpage,
type: "POST",
timeout : 10000,
dataType: "json",
async: false,
cache: false,
success: function(data) {
userpoint = data[1].userpoint;
commission = data[1].commission;
for (i=0; i<data[0].length; i++) {
codeNum[i] = data[0][i].code;
data[0][i].company=decodeURIComponent(data[0][i].company);
$( ".listCompany:eq("+i+") > A" ).html( data[0][i].company );
$( ".listPrice:eq("+i+")" ).html( commify(data[0][i].price) );
$( ".listGap:eq("+i+")" ).html( updown(data[0][i].gap) );
$( ".listGapper:eq("+i+")" ).html( percent(data[0][i].gapper) );
$( ".listVolume:eq("+i+")" ).html( commify(data[0][i].volume) );
$( ".listHigh:eq("+i+")" ).html( commify(data[0][i].high) );
$( ".listLow:eq("+i+")" ).html( commify(data[0][i].low) );
$( ".listRest:eq("+i+")" ).html( commify(data[0][i].rest) );
$( ".buy_btn:eq("+i+")" ).val( data[0][i].code );
$( ".buy_btn:eq("+i+")" ).show();
}
for (; i<10; i++) {
codeNum[i] = 0;
$( ".listCompany:eq("+i+") > A" ).html( " " );
$( ".listPrice:eq("+i+")" ).html( " " );
$( ".listGap:eq("+i+")" ).html( " " );
$( ".listGapper:eq("+i+")" ).html( " " );
$( ".listVolume:eq("+i+")" ).html( " " );
$( ".listHigh:eq("+i+")" ).html( " " );
$( ".listLow:eq("+i+")" ).html( " " );
$( ".listRest:eq("+i+")" ).html( " " );
$( ".buy_btn:eq("+i+")" ).val( "" );
$( ".buy_btn:eq("+i+")" ).hide();
}
$( "#stockindex" ).html( data[1].index );
refreshTimer = setInterval("stock_refresh()", 10000);
},
error: function(data) {
refreshTimer = setInterval("stock_refresh()", 10000);
}
});
}
이거에욤 몇개 수정해서 영문은 나오구요 한글은 아에 안나오다가 몇개수정해서 null 이라고 나오는데
고수님아들~ 도와주삼욤~
echo "ERROR";
exit;
}
if (!$page || !is_int($page))
$page = 1;
$limitnum = ($page - 1) * 10;
$sql = " select * from q_stock_list order by qst_today*qst_num desc limit $limitnum, 10";
$result = sql_query($sql);
$sync_data = array();
for ($i=0; $row = sql_fetch_array($result); $i++)
{
$gapper = number_format(round((($row['qst_today']-$row['qst_yesterday'])/$row['qst_yesterday']*100), 2), 2);
$sync_data[0][$i] = array("company"=>htmlspecialchars($row['qst_company']), "code"=>$row['qst_code'],
"price"=>$row['qst_today'], "gap"=>$row['qst_today']-$row['qst_yesterday'], "gapper"=>$gapper,
"volume"=>$row['qst_vol_sell']+$row['qst_vol_buy'], "high"=>$row['qst_high'], "low"=>$row['qst_low'],
"num"=>$row['qst_num'], "rest"=>$row['qst_rest']);
}
$sql = " select qst_index from q_stock ";
$row = sql_fetch($sql);
$stockindex = number_format($row[qst_index], 2);
$sync_data[1] = array("index"=>$stockindex, "userpoint"=>$member[mb_point], "commission" => $commission);
$sync_data= str_replace (" ", "", $sync_data);
echo urldecode(json_encode($sync_data));
?>
>>>>>>>>>>>>>> 값받아오는것같구욤
js 파일은욤
var viewpage = 1; // 현재 페이지
var userpoint = 0;
var commission = 0;
var codeNum = Array();
var refreshTimer = setInterval("stock_refresh()", 10000); // 목록 갱신 반복
$(function() {
$( ".buy_btn" ).button().click(function(){
$( "#codeNum" ).val( $(this).val() );
$( "#buyCompany" ).val( $(this).parent().siblings( ".listCompany" ).children( "A" ).html().replace("&", "&") );
$( "#buyPrice" ).val( $(this).parent().siblings( ".listPrice" ).html() );
$( "#trade_slider" ).slider({
value: 0,
max: tradeCal($(this).parent().siblings( ".listPrice" ).html(), $(this).parent().siblings( ".listRest" ).html() )
});
$( "#buyNum" ).val( 0 );
$( "#buy_dialog" ).dialog( "open" );
return false;
});
$( "#button_prev" ).button().click(function() { pagechange("prev"); return false; });
$( "#button_next" ).button().click(function() { pagechange("next"); return false; });
var buyNum = $( "#buyNum" ),
allFields = $( [] ).add( buyNum ),
tips = $( ".validateTips" );
// 매수 팝업
$( "#buy_dialog" ).dialog({
autoOpen: false,
resizable: false,
height: 350,
width: 350,
modal: true,
buttons: {
"매수": function() {
var bValid = true;
allFields.removeClass( "ui-state-error" );
bValid = bValid && checkRegexp( buyNum, /^[0-9]+$/i, "구매 수량을 정확히 입력하세요" );
if ( bValid ) {
trade("buy", $( "#codeNum" ).val(), buyNum.val());
$( this ).dialog( "close" );
}
},
"취소": function() {
$( this ).dialog( "close" );
}
},
close: function() {
allFields.val( "" ).removeClass( "ui-state-error" );
}
});
$( "#trade_slider" ).slider({
range: "max",
min: 0,
max: 10,
value: 0,
slide: function( event, ui ) {
$( "#buyNum" ).val( ui.value );
}
});
$( "#buyNum" ).val( $( "#trade_slider" ).slider( "value" ) );
function updateTips( t ) {
tips.text( t ).addClass( "ui-state-highlight" );
setTimeout(function() {
tips.removeClass( "ui-state-highlight", 1500 );
}, 500 );
}
function checkRegexp( o, regexp, n ) {
if ( !( regexp.test( o.val() ) ) ) {
o.addClass( "ui-state-error" );
updateTips( n );
return false;
} else {
return true;
}
}
setTimeout("stock_refresh()", 1); // 초기 목록 로드
});
// 목록 갱신
function stock_refresh() {
clearInterval(refreshTimer);
$.ajax({
url: "/xgb/skin/board/skin_stock/stock_list_exec.php?page="+viewpage,
type: "POST",
timeout : 10000,
dataType: "json",
async: false,
cache: false,
success: function(data) {
userpoint = data[1].userpoint;
commission = data[1].commission;
for (i=0; i<data[0].length; i++) {
codeNum[i] = data[0][i].code;
data[0][i].company=decodeURIComponent(data[0][i].company);
$( ".listCompany:eq("+i+") > A" ).html( data[0][i].company );
$( ".listPrice:eq("+i+")" ).html( commify(data[0][i].price) );
$( ".listGap:eq("+i+")" ).html( updown(data[0][i].gap) );
$( ".listGapper:eq("+i+")" ).html( percent(data[0][i].gapper) );
$( ".listVolume:eq("+i+")" ).html( commify(data[0][i].volume) );
$( ".listHigh:eq("+i+")" ).html( commify(data[0][i].high) );
$( ".listLow:eq("+i+")" ).html( commify(data[0][i].low) );
$( ".listRest:eq("+i+")" ).html( commify(data[0][i].rest) );
$( ".buy_btn:eq("+i+")" ).val( data[0][i].code );
$( ".buy_btn:eq("+i+")" ).show();
}
for (; i<10; i++) {
codeNum[i] = 0;
$( ".listCompany:eq("+i+") > A" ).html( " " );
$( ".listPrice:eq("+i+")" ).html( " " );
$( ".listGap:eq("+i+")" ).html( " " );
$( ".listGapper:eq("+i+")" ).html( " " );
$( ".listVolume:eq("+i+")" ).html( " " );
$( ".listHigh:eq("+i+")" ).html( " " );
$( ".listLow:eq("+i+")" ).html( " " );
$( ".listRest:eq("+i+")" ).html( " " );
$( ".buy_btn:eq("+i+")" ).val( "" );
$( ".buy_btn:eq("+i+")" ).hide();
}
$( "#stockindex" ).html( data[1].index );
refreshTimer = setInterval("stock_refresh()", 10000);
},
error: function(data) {
refreshTimer = setInterval("stock_refresh()", 10000);
}
});
}
이거에욤 몇개 수정해서 영문은 나오구요 한글은 아에 안나오다가 몇개수정해서 null 이라고 나오는데
고수님아들~ 도와주삼욤~
댓글 전체

json이 한글데이타 지원이 안되는걸로 알고있습니다.
html로 받아서 eval하셔야 할테구요.
최근에 변경되지 않았다면, json타입으로 리턴받기에 한글을 못받습니다.
html로 받아서 eval하셔야 할테구요.
최근에 변경되지 않았다면, json타입으로 리턴받기에 한글을 못받습니다.