function make_id($type, $db = null) { global $sg; if ($db == null) { // DB渡って来ないと接続〜解放までやってあげる $db = new DBLib($sg); $db->connect(); $id = _make_id($type, $db); $db->close(); return $id; } return _make_id($type, $db); }
/** * __invoke middleware invokable class * * @param \Psr\Http\Message\ServerRequestInterface $request PSR7 request * @param \Psr\Http\Message\ResponseInterface $response PSR7 response * @param callable $next Next middleware * @classV array $GroupCheck Groups * @return \Psr\Http\Message\ResponseInterface */ public function __invoke($request, $response, $next) { //Check if session login_id is set. This is set in the /login route. if (isset($_SESSION["login_id"])) { $query = "CALL CheckLogin(:loginid);"; $params = array(":loginid" => $_SESSION["login_id"]); $results = DBLib::GetRow($query, $params); //Retrieve groups from logins table that were returned $groups = json_decode($results['aResultData']['UserGroups']); if ($results['bSuccess'] == false || !isset($results['aResultData']['LoginID'])) { $newResponse = $response->withStatus(401); $newResponse->getBody()->write('Requires Authentication1'); return $newResponse; } //If group array exists, check to see if user is part of any of the required groups if (!empty($this->GroupsCheck)) { $InGroup = false; foreach ($groups as $key => $v) { if (in_array($v, $this->GroupsCheck)) { $InGroup = true; } } //Handle user not in a group associated with this route if (!$InGroup) { $newResponse = $response->withStatus(401); $newResponse->getBody()->write('Requires Group Membership'); return $newResponse; } } } else { //No login_id present $newResponse = $response->withStatus(401); $newResponse->getBody()->write('Requires Authentication'); return $newResponse; } //If all checks have passed, move on to next routing function or middleware $response = $next($request, $response); return $response; }
function write() { global $sg; $this->fin(); $sql = "insert into access_log (log_date,accept_date,proc_time,status,url,uri,from_ip,from_addr,referer,referer_full,ua,\r\ncarrier,ment_flg,option1,option2,option3,option4,option5,option6) values (\r\nsysdate(), ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"; $db = new DBLib($sg); $db->connect(); $db->prepare($sql); $db->bind(date("Y/m/d H:i:s", $this->accept_date / 1000)); $db->bind(floor($this->proc_time)); $db->bind($this->status); $db->bind($this->url); $db->bind($this->uri); $db->bind($this->from_ip); $db->bind($this->from_addr); $db->bind($this->referer); $db->bind($this->referer_full); $db->bind($this->ua); $db->bind($this->carrier); $db->bind($this->ment_flg); $db->bind($this->option1); $db->bind($this->option2); $db->bind($this->option3); $db->bind($this->option4); $db->bind($this->option5); $db->bind($this->nowment); $r = $db->execute_update(false); if (!$r) { print ht(mysql_error()); $db->rollback(); } else { $db->commit(false); } $db->close(); }
$ret .= sprintf("<li><span><a href=\"news.php?i=%s\">%s</a></span></li>\n", $ar["id"], g_title(ht($ar["title"]))); } return $ret; } function make_pr($db) { $sql1 = "select id,name,movie_path,date_format(term, '%Y年%m月%d日') as term from practice \r\nwhere delete_flg = '0'\r\norder by create_date desc\r\nlimit 2"; $db->prepare($sql1); $arr = $db->execute(); $ret = ""; foreach ($arr as $ar) { $ret .= sprintf("<li><a href=\"s_pr.php?i=%s\">%s 様</a> <p class=\"small2\">(%sの練習風景)</p></li>\n", $ar["id"], g_name(ht($ar["name"])), ht($ar["term"])); } return $ret; } $db = new DBLib($sg); $db->connect(); $sch = make_schedule($db); $news = make_news($db); $pr = make_pr($db); if ($news == "") { $news = "<li><span>ニュースは特にありません</span></li>"; } $db->close(); ?> <h4><img src="img/arrow21-006-03.gif" style="vertical-align: -2px"> 今月の営業日</h4> <div class="x"> <ul id="ul3"> <?php print $sch; ?>
<a href="faq.php" title="当スタジオへよくいただく質問をまとめてあります">■ よくある質問</a> <a href="contact.php" title="当スタジオへのお問い合わせはこちらまで">■ お問い合わせ</a> </p><hr class="design" /> <br /> <?php if ($sg["TITLE_IMG_OFF"] != 1) { ?> <a href="https://twitter.com/‎" title="twitter" target="_blank"><img src="img/twitter.jpg" border="0"></a> <a href="http://line.naver.jp/ja/" title="line" target="_blank"><img src="img/linex.jpg" height="27px" border="0"></a> <a href="https://ja-jp.facebook.com/" title="facebook" target="_blank"><img src="img/facebook.jpg" border="0"></a> <a href="http://www.youtube.com/?gl=JP&hl=ja" title="YouTube" target="_blank"><img src="img/youtube.jpg" border="0"></a> <a href="http://www.nicovideo.jp/" title="ニコニコ動画" target="_blank"><img src="img/nico.jpg" border="0"></a> <a href="http://www.ustream.tv/new" title="Ustream" target="_blank"><img src="img/ust1.jpg" border="0"></a> <?php $sql = "select id,title,url,img_path, priority\r\n\tfrom link where delete_flg = '0' order by priority asc"; $db = new DBLib($sg); $db->connect(); $db->prepare($sql); $arr = $db->execute(); $db->close(); $fmt = '<a href="%s" title="%s" target="_blank"><img src="%s" border="0"%s></a>' . "\n"; foreach ($arr as $ar) { $img = "img/noimage.jpg"; if ($ar["img_path"] != "") { $img = $ar["img_path"]; if (!file_exists($img)) { $img = "img/noimage.jpg"; } else { } } $v = sprintf($fmt, ht($ar["url"]), ht($ar["title"]), $img, imgsize($img, 120, 20));