<?php //index.php // PHP部分はここに書きます require_once 'init.php'; if (!isSignin()) { $signin_url = 'signin.php'; header("Location: {$signin_url}"); } $db = connectDb(); $posts = getTimeline($db); $user_id = $_SESSION['user_id']; if ($_SERVER['REQUEST_METHOD'] === 'POST') { if (isset($_POST['postText'])) { $postText = $_POST['postText']; writePost($db, $user_id, $postText); // 2重投稿防止のためにリロードする処理 header('Location: ' . $_SERVER['SCRIPT_NAME']); exit; } } ?> <!DOCTYPE html> <html lang="ja"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>index - Ditter</title> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
function my_repeat_function_rss() { // do here what needs to be done automatically as per your schedule $rss = setUpRss(); $items = getItems($rss); $items = array_reverse($items); foreach ($items as $item) { writePost($item); } }
function Save() { return writePost($this); }