Mua icon mà sao nó không lưu vào nhỉ. nhưng vẫn trừ tiền?
PHP
<?php define('_IN_JOHNCMS', 1); require('../incfiles/core.php'); $textl = 'Chức Năng'; require('../incfiles/head.php'); echo '<div class="phdr">Shop Icon</div>'; if($user_id){ if($datauser['balans'] < 1000) { echo '<div class="notif">Lỗi!<br/>Bạn không đủ 1000 Xu để mua Icon. Hãy nạp thêm để sử dụng</div>'; require("../incfiles/foot.php"); exit; } if(!$_GET['ic']){ function layid($name){ $res; $name = substr( $name, 16, 6); for($i=0;$i<strlen($name);$i++) if($name[$i] == '.' ) break; else $res = $res . $name[$i]; return $res; } $dir = "../images/icons/"; $page = $_GET['page']; if(!$page) $page=1; $icon = glob('../images/icons/*.png'); $tong = count($icon); $end = $start + $kmess; if ($end > $tong) $end = $tong; for($i=$start;$i<$end;$i++){ echo '<div class="list1">'; echo '<img src="'.$icon[$i].'"/> - '; echo '<a href="?ic='.layid($icon[$i]).'">Chọn</a>'; echo '</div>'; } if ($tong > $kmess) { echo '<p>' . functions::display_pagination('icon.php?', $start, $tong, $kmess) . '</p>' . '<p><form action="icon.php?" method="post">' . '<input type="text" name="page" size="2"/>' . '<input type="submit" value="' . $lng['to_page'] . ' >>"/>' . '</form></p>'; } require ("../incfiles/foot.php"); exit(); } if($_GET['ic'] && file_exists(($rootpath . 'images/icons/' . $_GET['ic'] . '.png'))){ if(isset($_POST['submit'])){ $truoc = '../images/icons/'.$_GET['ic'].'.png'; $sau = '../files/users/icon/'.$datauser['id'].'.png'; copy ($truoc , $sau ); if(copy($truoc,$sau)){ echo '<div class="gmenu">Bạn đã mua icon thành công.<br/><a href="/store/icon.php">Tiếp tục</a></div>'; mysql_query("UPDATE users SET balans = balans - 1000 WHERE `id`= '".$datauser['id']."'"); mysql_query("INSERT INTO `shop_history` SET `user_id` = '".$user_id."', `giaodich`='Mua icon trả cho @BOT số lượng 1000 Xu.', `time`='".time()."' "); } else echo '<div class="notif">Giao dịch không thành công.Xin thử lại.</div>'; } else { echo '<div class="notif">Bạn có muốn mua icon này với giá 1000 Xu? Bạn đang có '.$datauser['balans'].' Xu. Chú ý: Icon cũ sẽ bị mất khi bạn đổi icon mới <p></p> <p><img src="/images/icons/'.$_GET['ic'].'.png" alt=""></p><p></p> <form action="?ic='.$_GET['ic'].'" method="post"> <input type="submit" name="submit" value="Đồng ý"></form><p></p></div>'; } } else echo '<div class="notif">Lỗi : Icon không tồn tại.Xin thử lại</div>'; } else echo '<div class="notif">Bạn phải đăng nhập để sử dụng</div>'; require('../incfiles/foot.php'); ?>
![[OFF]](/assets/images/off.gif)