function item_html_won($results) { ob_start(); foreach ($results as $row) { $item = get_item_id($row['item_id']); ?> <div class="item-thumbnail"> <?php if ($item['image']) { ?> <img src="img/image_view.php?item_id=<?php echo $row['item_id']; ?> " class="thumbnail"> <?php } else { ?> <img src="img/placeholder.png" class="thumbnail"> <?php } ?> <span> <a href="auction.php?auction_id=<?php echo $row['id']; ?> "> <?php echo $item['name']; ?> </a> <br> <?php if (!get_feedback($row["id"])) { ?> <a href="feedback.php?auction_id=<?php echo $row['id']; ?> ">Write Feedback</a> <?php } ?> </span> </div> <?php } $ret_val = ob_get_contents(); ob_end_clean(); return $ret_val; }
function paint_feedback($sid, $rid, $sec, $additional = array()) { // get all the feedback so far, if any $hasFeedback = get_feedback($feedback, $totalCredit, $sid, $rid, $sec); // if there are is feedback, paint it and exit if ($hasFeedback) { // open the form paint_submission_form_open($additional); // paint feedback to each response echo '<table>'; array_walk($feedback, 'paint_feedback_row'); echo '</table>'; // paint total credit if (!is_null($totalCredit)) { echo _('Total credit:') . ' ' . $totalCredit; } // paint the next button // NOTE: don't call it "next", because the logic above has specific expectations about // NOTE: the cases when that button is pressed echo '<fieldset>'; echo mksubmit("go", _('Next Page')); echo '</fieldset>'; // close the form paint_submission_form_close(); // all done exit; } }
$ticket = urlencode($result_arr["ticket"]); $html = '<img width="240" height="240" src="https://mp.weixin.qq.com/cgi-bin/showqrcode?ticket=' . $ticket . '">'; $smarty->assign('qrcode_img', $html); } else { $smarty->assign('qrcode_img', ''); } /** * 微信扫描绑定end */ $smarty->display('member_personal/personal_authenticate.htm'); } elseif ($act == 'feedback') { $smarty->assign('title', '用户反馈 - 个人会员中心 - ' . $_CFG['site_name']); $smarty->assign('feedback', get_feedback($_SESSION['uid'])); $smarty->display('member_personal/personal_feedback.htm'); } elseif ($act == 'feedback_save') { $get_feedback = get_feedback($_SESSION['uid']); if (count($get_feedback) >= 5) { showmsg('反馈信息不能超过5条!', 1); exit; } $setsqlarr['infotype'] = intval($_POST['infotype']); $setsqlarr['feedback'] = trim($_POST['feedback']) ? trim($_POST['feedback']) : showmsg('请填写内容!', 1); $setsqlarr['uid'] = $_SESSION['uid']; $setsqlarr['usertype'] = $_SESSION['utype']; $setsqlarr['username'] = $_SESSION['username']; $setsqlarr['addtime'] = $timestamp; write_memberslog($_SESSION['uid'], 2, 7001, $_SESSION['username'], "添加反馈信息"); !$db->inserttable(table('feedback'), $setsqlarr) ? showmsg("添加失败!", 0) : showmsg("添加成功,请等待管理员回复!", 2); } elseif ($act == 'del_feedback') { $id = intval($_GET['id']); del_feedback($id, $_SESSION['uid']) ? showmsg('删除成功!', 2) : showmsg('删除失败!', 1);
<?php include 'get_connection.php'; get_feedback($conn); $conn = null; function get_feedback($conn) { $query = "\n\t\t\tSELECT users.username, fb.content, fb.ts \n\t\t\tFROM feedback fb\n\t\t\tjoin users\n\t\t\ton users.id = fb.user_id;"; $query = $conn->prepare($query); $query->execute(); $results = $query->fetchall(); for ($i = 0; $i < count($results); $i++) { echo "<tr><td>" . $results[$i]['username'] . "</td><td>" . $results[$i]['content'] . "</td><td>" . $results[$i]['ts'] . "</td></tr>"; } }
<?php /* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ $section = ""; $feedback = get_feedback($proyectid, $step, $section); //var_dump($feedback); ?> <div class="alert alert-warning" role="alert"> <form class="form_review"> <div class="form-group group-comment"> <label class="col-sm-2 control-label">Comentario</label> <div class="col-sm-10"> <textarea class="form-control comment" placeholder="Comentario"><?php echo $feedback !== false ? $feedback[1] : ""; ?> </textarea> </div> </div> <div class="form-group group-rating hidden"> <label class="col-sm-2 control-label">Punteo</label> <div class="br-wrapper-f col-sm-10"> <select class="rating" id="rating_<?php echo $step . "_" . $section; ?> " name="rating"> <option value="1">1</option> <option value="2">2</option>
<?php session_start(); require_once "../resources/modules/check_login.php"; check_login(true); if (!isset($_GET['auction_id'])) { header("Location: index.php"); die; } require_once "../resources/modules/auctions.php"; require_once "../resources/modules/feedbacks.php"; $auction = get_auctions_id($_GET['auction_id']); if (get_feedback($auction['id']) || !check_auction_feedback($auction['id'], $_SESSION['id'])) { header("Location: index.php"); die; } if (isset($_POST['submitFeedback'])) { require_once "../resources/modules/feedbacks.php"; require_once "../resources/modules/users.php"; $rating = intval($_POST['rating']); $comment = intval($_POST['comment']); submit_feedback($_SESSION['id'], $auction['id'], $rating, $comment); update_user_rating($auction['seller_id'], get_new_avg($auction['seller_id'])); header("Location: index.php"); } ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge">
<?php session_start(); require 'database.php'; switch ($_SERVER["REQUEST_METHOD"]) { case 'GET': get_feedback(); break; case 'POST': post_feedback(); break; default: http_response_code(405); die; } function get_feedback() { if ($_SESSION["loggedin"] == true) { $db = new Database(); $sth = $db->prepare('SELECT * FROM feedback'); $sth->execute(); echo json_encode($sth->fetchAll(PDO::FETCH_ASSOC)); } else { echo json_encode(array('status' => 'unauthorized')); http_response_code(403); } } function post_feedback() { $data = json_decode(file_get_contents('php://input')); $db = new Database();