getDb(); mysql_query("SET NAMES utf8"); $app = set_app_config(); $smarty->assign("app", $app); $username = $_SESSION["username"]; $userno = $_SESSION["mnum"]; $userstatas = $_SESSION["userstatas"]; //コンフィグファイル require_once("admin/config/c_config.php"); //アクセスクラス require_once("Class/Log_class2.php"); // フォームデータの変換 if ($_SERVER["REQUEST_METHOD"] == "POST") { $param = cnv_formstr($_POST); } else { $param = cnv_formstr($_GET); } $smarty->assign("url", $_SERVER["PHP_SELF"]); // 処理ページの決定 $param["act"] = isset($param["act"]) ? $param["act"] : DEF_ACT; $screen_function_name = "screen_" . $param["act"]; call_user_func($screen_function_name, $param); // ========================================================= // トップページ // ========================================================= function screen_view() { global $db; global $smarty; //アクセス $loging[page] = $_SERVER["REQUEST_URI"]; $loging[id] = $param["id"]; $loging[host] = gethostbyaddr($_SERVER['REMOTE_ADDR']); $loging[ip] = $_SERVER['REMOTE_ADDR']; $today = new DateTime(); $loging[time] = $today->format('Y年n月j日 H:i'); $loging[time_ts] = $today->format('U'); $log=new Log_class(); $log->AccessPageData($loging); //リスト取得 $sql="select * from `omi_toplist` where statas = '1'"; $result = mysql_query($sql); $row=mysql_fetch_array($result); $lookset=$row["lookset"]; $topimage[]=$row; $smarty->assign("topimage",$topimage); $smarty->assign("lookset",$lookset); //リスト取得 $sql="select * from `omi_toplist` where statas = 'default'"; $result = mysql_query($sql); $row=mysql_fetch_array($result); $topimage_d[]=$row; $smarty->assign("topimage_d",$topimage_d); //リスト取得 $sql="select * from `omi_movielist`"; $result = mysql_query($sql); $row=mysql_fetch_array($result); $movielist[]=$row; $smarty->assign("movielist",$movielist); //pickup用 //リスト取得 $sql="select * from `omi_pickup`"; $result = mysql_query($sql); while($row=mysql_fetch_array($result)){ $group_id=$row["fasi"]; if($row["link"] !=""){ $str=$db->prepare("select * from omi_fasi where id = '$group_id'"); $rs=$db->execute($str); $roww=$rs->fetchRow(DB_FETCHMODE_ASSOC); $directory=$roww["directory"]; if($directory == $row["link"]){ $row["text"] = "".$row["text"].""; }else{ $row["text"] = "".$row["text"].""; } } $fasi = $row["fasi"]; $pickup[$fasi]=$row; } $smarty->assign("pickup",$pickup); //情報取得 $today = new DateTime(); $tod = $today->format('U'); //リスト1取得 //$sql="select * from `omi_eventlist` where (statas = '3' and find_in_set('2', category)) and totalsite is null and ((start_ts <= '$tod' and end_ts >= '$tod') and end_ev_ts >= '$tod') order by start_ev_ts desc limit 0 , 5"; $sql="select * from `omi_eventlist` where (statas = '3' and find_in_set('2', category)) and totalsite is null and ((start_ts <= '$tod' and end_ts >= '$tod') or (start_ts <= '$tod' and end_ts is null)) and end_ev_ts >= '$tod' order by start_ev_ts desc limit 0 , 5"; $result = mysql_query($sql); while($row=mysql_fetch_array($result)){ $group_id = $row["group_id"]; $string = $row["caption"]; $row["caption"] = mb_strimwidth($string, 0, 60,'・・・','UTF-8'); $string2 = $row["title"]; $row["title"] = mb_strimwidth($string2, 0, 60,'・・・','UTF-8'); $sql2="select * from omi_fasi where id ='$group_id'"; $result2 = mysql_query($sql2); $row2=mysql_fetch_array($result2); $row["fasi_name"] = $row2["name"]; $junle=explode(",",$row["junle"]); $jun=""; for($i = 0; $i < count($junle); $i++){ $sql3="select * from omi_jnl where id ='$junle[$i]'"; $result3 = mysql_query($sql3); $row3=mysql_fetch_array($result3); $jun.="".$row3["name"].""; if($i < (count($junle)-1)){ $jun.="・"; } else{ $jun.=""; } } $row["junl"] = $jun; $todolist_t[] = $row; } $smarty->assign("todolist_t",$todolist_t); //リスト2取得 $sql="select * from `omi_eventlist` where (statas = '3' and find_in_set('3', category)) and totalsite is null and ((start_ts <= '$tod' and end_ts >= '$tod') or (start_ts <= '$tod' and end_ts is null)) and end_ev_ts >= '$tod' order by start_ev_ts desc limit 0 , 5"; $result = mysql_query($sql); while($row=mysql_fetch_array($result)){ $group_id = $row["group_id"]; $string = $row["caption"]; $row["caption"] = mb_strimwidth($string, 0, 60,'・・・','UTF-8'); $string2 = $row["title"]; $row["title"] = mb_strimwidth($string2, 0, 60,'・・・','UTF-8'); $sql2="select * from omi_fasi where id ='$group_id'"; $result2 = mysql_query($sql2); $row2=mysql_fetch_array($result2); $row["fasi_name"] = $row2["name"]; $junle=explode(",",$row["junle"]); $jun=""; for($i = 0; $i < count($junle); $i++){ $sql3="select * from omi_jnl where id ='$junle[$i]'"; $result3 = mysql_query($sql3); $row3=mysql_fetch_array($result3); $jun.="".$row3["name"].""; if($i < (count($junle)-1)){ $jun.="・"; } else{ $jun.=""; } } $row["junl"] = $jun; $todolist_m[] = $row; } $smarty->assign("todolist_m",$todolist_m); //リスト3取得 $sql="select * from `omi_eventlist` where (statas = '3' and find_in_set('1', category)) and totalsite is null and ((start_ts <= '$tod' and end_ts >= '$tod') or (start_ts <= '$tod' and end_ts is null)) and end_ev_ts >= '$tod' order by start_ev_ts desc limit 0 , 5"; $result = mysql_query($sql); while($row=mysql_fetch_array($result)){ $group_id = $row["group_id"]; $string = $row["caption"]; $row["caption"] = mb_strimwidth($string, 0, 60,'・・・','UTF-8'); $string2 = $row["title"]; $row["title"] = mb_strimwidth($string2, 0, 60,'・・・','UTF-8'); $sql2="select * from omi_fasi where id ='$group_id'"; $result2 = mysql_query($sql2); $row2=mysql_fetch_array($result2); $row["fasi_name"] = $row2["name"]; $junle=explode(",",$row["junle"]); $jun=""; for($i = 0; $i < count($junle); $i++){ $sql3="select * from omi_jnl where id ='$junle[$i]'"; $result3 = mysql_query($sql3); $row3=mysql_fetch_array($result3); $jun.="".$row3["name"].""; if($i < (count($junle)-1)){ $jun.="・"; } else{ $jun.=""; } } $row["junl"] = $jun; $todolist_o[] = $row; } $smarty->assign("todolist_o",$todolist_o); // テンプレートを表示 $smarty->display("index.tpl"); } ?>