장바구니 기능 질문드립니다.
본문
안녕하세요.
예전에 영카트 장바구니 기능을 그누보드에 이식하여 사용을 하였는데요
게시물에서 장바구니 버튼을 누른 후 장바구니에 넣어 놓고 보면
내가 장바구니에 넣어놓은 내용이 아닌
다른 사람이 넣어놓은 내용까지 전부 보여집니다.
로그인은 하지 않고 비회원이 주로 사용합니다.
아래는 장바구니 확인 화면 소스 입니다.
<?php
error_reporting ( E_ALL );
ini_set ( "display_errors", 0 );
define('_CART_', true);
include_once('./_common.php');
include_once(G5_THEME_PATH.'/head.php');
if($wr_id && $bo_table){
$query="insert into yc4_cart set on_uid='$_SESSION[on_uid]', wr_id='$wr_id', ct_status='', ct_qty='1', ct_time=now(), ct_ip='$_SERVER[SERVER_ADDR]',bo_table='$bo_table'";
$result = sql_query($query);
}
?>
<div id="cart_">
<form name="form1" method="post" action="cart2.php">
<table cellspacing="0" border="1">
<caption>table</caption>
<colgroup>
<col width="5%" class="mrs"><col width="15%"><col width="25%"><col width="25%"><col width="20%"><col width="15%">
</colgroup>
<thead>
<tr>
<th scope="col" class="mrs">번호</th>
<th scope="col">제품이미지</th>
<th scope="col">물품명</th>
<th scope="col">제품사양</th>
<th scope="col">수량</th>
<th scope="col">관리</th>
</tr>
</thead>
<tbody>
<?
$query="select * from yc4_cart where on_uid='$_SESSION[on_uid]' order by ct_id";
$cart_result=sql_query($query);
if(!$cart_result) echo mysql_error();
$i=0;
while($cart=sql_fetch_array($cart_result)){
$query="select * from g5_write_".$cart[bo_table]." where wr_id='$cart[wr_id]'";
$it_result=sql_query($query);
$it=sql_fetch_array($it_result,MYSQL_ASSOC);
$query="select * from g5_board_file where bo_table='$cart[bo_table]' and wr_id='$cart[wr_id]'";
$file_result=sql_query($query);
$file_rows=sql_fetch_array($file_result,MYSQL_ASSOC);
?>
<input type=hidden name="ct_id[<?php echo $i;?>]" value="<?=$cart[ct_id]?>" target="hiddenframe">
<tr>
<td class="mrs"><?=($i+1)?></td>
<td><?if($file_rows[bf_file]){?><img src="/data/file/<?=$cart[bo_table]?>/<?=$file_rows[bf_file]?>"><?}else{?><?}?></td>
<td><?=$it[wr_subject]?></td>
<td>
<select id="cc_6[<?php echo $i;?>]" name="cc_6[<?php echo $i;?>]" style="width:80%">
<option value="" selected>선택하세요</option>
<?php
for($a=1; $a<11; $a++) {
if($it['wr_'.$a]) {
echo "<option value='".$it['wr_'.$a]."'>".$it['wr_'.$a]."</option>";
}
}
?>
</td>
<td><input type="text" name="ct_qty[<?php echo $i;?>]" value="<?=$cart[ct_qty]?>" style="text-align:center"><a href="javascript:cartupdate(<?=$i?>)" class="cart_btn01">수정</a> </td>
<td><a href="cart_delete.php?ct_id=<?=$cart[ct_id]?>" class="cart_btn02">삭제</a></td>
</tr>
<? $i++; }?>
</tbody>
</table>
<input type="hidden" name="product_count" value="<?php echo $i;?>">
</form>
<script>
function cartupdate(no){
f=document.form1;
f.action="cart_update.php?no="+no;
f.submit();
}
function submitCart(){
f=document.form1;
f.action="cart2.php";
for(i=0;i<f.product_count.value;i++){
var e = f['cc_6['+i+']'];
console.log(e);
}
f.submit();
}
</script>
</div>
<?php
include_once(G5_THEME_PATH.'/tail.php');
?>
섹션부분이 잘못된거 같은데
고수님들 도움 부탁드립니다. ㅠ
!-->
답변을 작성하시기 전에 로그인 해주세요.