3v4l.org

run code in 300+ PHP versions simultaneously
<Html> <Head> <Title>登録状況確認</Title> </Head> <Body> <?php session_start(); // セッションを開始 // 管理者かどうかを$_SESSION["user_class"]により確認 // ログインせず直接アクセスした場合(内容未定) if( $_SESSION["user_class"] == ""){ } // 一般ユーザが直接アクセスした場合(内容未定) elseif( $_SESSION["user_class"] == "0"){ } // 管理者がアクセスした場合(以下の処理を開始) elseif( $_SESSION["user_class"] == "1"){ // ホーム画面からイベントIDを引き継ぎ(未完成) //(ホームでも$_SESSION["event_id"]を使ってもらえば再定義不要?) $_SESSION["event_id"] = 002; // 仮の数値 // DB $url = "localhost"; $user = "root"; $pass = ""; $db = "test"; // MySQLへ接続する $link = mysql_connect($url,$user,$pass) or die("MySQLへの接続に失敗しました。"); // データベースを選択する $sdb = mysql_select_db($db,$link) or die("データベースの選択に失敗しました。"); // クエリを送信する // ①イベント名の取得…ホーム画面から引き継いだイベントIDの列を選択、event_nameを取得 $sql = "select event_title from event "; $sql.= "where event_id= " . '$_SESSION["event_id"]' ; $result = mysql_query($sql, $link) or die("クエリの送信に失敗しました。<br/>SQL:".$sql); $row = mysql_fetch_assoc($result); $event_title = $row["event_title"]; // イベントタイトル表示 echo '$_SESSION["event_id"]'; // ②ビューを作る // MySQLへの接続を閉じる mysql_close($link) or die("MySQL切断に失敗しました。"); } //管理者アクセスの動作、ここまで ?> <br> <button type="button" onclick="location.href='top.php'">ホームへ戻る</button> </Body> </Html>
Output for 8.3.0 - 8.3.6
<Html> <Head> <Title>登録状況確認</Title> </Head> <Body> Warning: session_start(): Session cannot be started after headers have already been sent in /in/l4BBF on line 8 Warning: Undefined global variable $_SESSION in /in/l4BBF on line 13 Warning: Trying to access array offset on null in /in/l4BBF on line 13 <br> <button type="button" onclick="location.href='top.php'">ホームへ戻る</button> </Body> </Html>
Output for 8.1.0 - 8.1.28, 8.2.0 - 8.2.18
<Html> <Head> <Title>登録状況確認</Title> </Head> <Body> Warning: session_start(): Session cannot be started after headers have already been sent in /in/l4BBF on line 8 Warning: Undefined global variable $_SESSION in /in/l4BBF on line 13 Warning: Trying to access array offset on value of type null in /in/l4BBF on line 13 <br> <button type="button" onclick="location.href='top.php'">ホームへ戻る</button> </Body> </Html>
Output for 8.0.0 - 8.0.30
<Html> <Head> <Title>登録状況確認</Title> </Head> <Body> Warning: session_start(): Session cannot be started after headers have already been sent in /in/l4BBF on line 8 Warning: Undefined variable $_SESSION in /in/l4BBF on line 13 Warning: Trying to access array offset on value of type null in /in/l4BBF on line 13 <br> <button type="button" onclick="location.href='top.php'">ホームへ戻る</button> </Body> </Html>
Output for 7.4.0 - 7.4.33
<Html> <Head> <Title>登録状況確認</Title> </Head> <Body> Warning: session_start(): Cannot start session when headers already sent in /in/l4BBF on line 8 Notice: Undefined variable: _SESSION in /in/l4BBF on line 13 Notice: Trying to access array offset on value of type null in /in/l4BBF on line 13 <br> <button type="button" onclick="location.href='top.php'">ホームへ戻る</button> </Body> </Html>
Output for 7.3.32 - 7.3.33
<Html> <Head> <Title>登録状況確認</Title> </Head> <Body> Warning: session_start(): Cannot start session when headers already sent in /in/l4BBF on line 8 <br> <button type="button" onclick="location.href='top.php'">ホームへ戻る</button> </Body> </Html>
Output for 7.2.0 - 7.2.33, 7.3.0 - 7.3.31
<Html> <Head> <Title>登録状況確認</Title> </Head> <Body> Warning: session_start(): Cannot start session when headers already sent in /in/l4BBF on line 8 Notice: Undefined variable: _SESSION in /in/l4BBF on line 13 <br> <button type="button" onclick="location.href='top.php'">ホームへ戻る</button> </Body> </Html>
Output for 7.0.18 - 7.0.33, 7.1.4 - 7.1.25
<Html> <Head> <Title>登録状況確認</Title> </Head> <Body> Warning: session_start(): Cannot send session cookie - headers already sent by (output started at /in/l4BBF:1) in /in/l4BBF on line 8 Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /in/l4BBF:1) in /in/l4BBF on line 8 Notice: Undefined index: user_class in /in/l4BBF on line 13 <br> <button type="button" onclick="location.href='top.php'">ホームへ戻る</button> </Body> </Html>
Output for 5.3.0 - 5.3.29, 5.4.0 - 5.4.45, 5.5.0 - 5.5.38, 5.6.0 - 5.6.38, 7.0.0 - 7.0.17, 7.1.0 - 7.1.3
<Html> <Head> <Title>登録状況確認</Title> </Head> <Body> Warning: session_start(): Cannot send session cookie - headers already sent by (output started at /in/l4BBF:7) in /in/l4BBF on line 8 Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /in/l4BBF:7) in /in/l4BBF on line 8 Notice: Undefined index: user_class in /in/l4BBF on line 13 <br> <button type="button" onclick="location.href='top.php'">ホームへ戻る</button> </Body> </Html>
Output for 4.3.2 - 4.3.11, 4.4.0 - 4.4.9, 5.0.0 - 5.0.5, 5.1.0 - 5.1.6, 5.2.0 - 5.2.17
<Html> <Head> <Title>登録状況確認</Title> </Head> <Body> Warning: session_start(): Cannot send session cookie - headers already sent by (output started at /in/l4BBF:7) in /in/l4BBF on line 8 Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /in/l4BBF:7) in /in/l4BBF on line 8 Notice: Undefined index: user_class in /in/l4BBF on line 13 <br> <button type="button" onclick="location.href='top.php'">ホームへ戻る</button> </Body> </Html>
Output for 4.3.0 - 4.3.1
<Html> <Head> <Title>登録状況確認</Title> </Head> <Body> Warning: session_start() [http://www.php.net/function.session-start]: Cannot send session cookie - headers already sent by (output started at /in/l4BBF:7) in /in/l4BBF on line 8 Warning: session_start() [http://www.php.net/function.session-start]: Cannot send session cache limiter - headers already sent (output started at /in/l4BBF:7) in /in/l4BBF on line 8 Notice: Undefined index: user_class in /in/l4BBF on line 13 <br> <button type="button" onclick="location.href='top.php'">ホームへ戻る</button> </Body> </Html>

preferences:
332.4 ms | 402 KiB | 424 Q