function getlevel($groupid) { $pdo = pdoconnect(); $stmt = $pdo->prepare("SELECT `level` FROM `joined` WHERE userid=:userid AND groupid=:groupid"); $stmt->bindParam(':userid', $_SESSION['userid']); $stmt->bindParam(':groupid', $groupid); $stmt->execute(); $data = $stmt->fetch(); return $data['level']; }
<?php require "../../lib/lib_teamcalendar.php"; if (!islogin() || !isset($_GET['id']) || !isjoined($_GET['id']) || getlevel($_GET['id']) != 1) { header('Location: ../../index.php'); } $pdo = pdoconnect(); ?> <img id="loadimg" src="calendar/ajax-loader.gif" alt="Loading.." class="hide"/> <button onclick="prev();" class="btn btn-info btn-xs">돌아가기</button> <h2>멤버</h2> <table class="table table-sm"> <tr> <th>이름</th> <th></th> </tr> <?php $stmt = $pdo->prepare("SELECT `user`.`name`,`user`.`userid` FROM `joined` LEFT JOIN `user` ON `joined`.`userid`=`user`.`userid` WHERE `joined`.`groupid`=:groupid AND `joined`.`level`=0"); $stmt->bindParam(':groupid', $_GET['id']); $stmt->execute(); $data = $stmt->fetchAll(PDO::FETCH_ASSOC); for ($i = 0; $i < count($data); $i++) { echo "<tr><td>{$data[$i]['name']}</td><td><button onclick=\"member_out({$data[$i]['userid']});\" class=\"btn btn-info btn-xs\">추방</button></td></tr>"; } ?> </table> <h2>가입 신청</h2> <table class="table table-sm"> <tr> <th>이름</th> <th></th>
function detectUTF8($string) { return preg_match('%(?: [\\xC2-\\xDF][\\x80-\\xBF] # non-overlong 2-byte |\\xE0[\\xA0-\\xBF][\\x80-\\xBF] # excluding overlongs |[\\xE1-\\xEC\\xEE\\xEF][\\x80-\\xBF]{2} # straight 3-byte |\\xED[\\x80-\\x9F][\\x80-\\xBF] # excluding surrogates |\\xF0[\\x90-\\xBF][\\x80-\\xBF]{2} # planes 1-3 |[\\xF1-\\xF3][\\x80-\\xBF]{3} # planes 4-15 |\\xF4[\\x80-\\x8F][\\x80-\\xBF]{2} # plane 16 )+%xs', $string); } // ACTION STARTS HERE // create latin1 and UTF8 connection $db1 = pdoconnect($charset = 'latin1'); $db2 = pdoconnect($charset = 'UTF8'); // for all defined tables foreach ($table_fields as $table => $tabdata) { // read in table data through latin1 connection $query = "SELECT * FROM " . table($table); $result = run_query($db1, $query); $i = 0; while ($line = pdo_fetch_assoc($result)) { // check whether selected fields (read via latin1) contain any valid UTF8 code $has_utf8 = false; foreach ($tabdata['fields'] as $f) { if (detectUTF8($line[$f])) { $has_utf8 = true; } } // if so, write back through UTF8 connection