PHPで最終行にエラーがでます。
場所は、htmlの部分です。
PHP
1<?php 2session_start(); 3 4 5if (empty($_SESSION['username'])) { 6 $user_login_pas = "../user/guest/icon/icon.gif"; 7} else { 8 $user_login_pas = "../user/data/".$_SESSION['username']."/icon/icon.gif"; 9} 10 11if (isset($_POST['_submit'])) { 12$name = $_POST['accountname']; 13$file = "../user/data/".$name; 14 15if (empty($_POST['accountname'])) { 16 $test_alert = "<script type='text/javascript'>alert('アカウントネームを入力してください');</script>"; 17 echo $test_alert; 18} else { 19 if (empty($_POST['mail'])) { 20 $test_alert = "<script type='text/javascript'>alert('メールアドレスを再入力してください');</script>"; 21 echo $test_alert; 22 } else { 23 if (empty($_POST['username'])) { 24 $test_alert = "<script type='text/javascript'>alert('ユーザーネームを入力してください');</script>"; 25 echo $test_alert; 26 } else { 27 if (empty($_POST['password'])) { 28 $test_alert = "<script type='text/javascript'>alert('パスワードを入力してください');</script>"; 29 echo $test_alert; 30 } else { 31if (file_exists($file)) { 32 //存在した 33 $msg = "そのアカウントは使われています。"; 34 header("location:#"); 35} else { 36 //存在しない 37 if ($_POST['password'] == $_POST['pas_check']) { 38 //pas 39 mkdir("../user/data/".$name, 0777, true); 40 $msg = "アカウント仮作成成功"; 41 $data = $_POST['accountname']; 42 $file = fopen("../user/data/".$name."/username.txt", "w"); 43 $username_ps = $_POST['accountname']; 44 45 touch("../user/data/".$name."/username.txt"); 46 fwrite($file, $data); 47 fclose($file); 48 49//pas 50 51 $data = $_POST['password']; 52 $file = fopen("../user/data/".$name."/password.txt", "w"); 53 54 touch("../user/data/".$name."/password.txt"); 55 fwrite($file, $data); 56 fclose($file); 57 58//mail 59 60 $data = $_POST['mail']; 61 $file = fopen("../user/data/".$name."/mail.txt", "w"); 62 63 touch("../user/data/".$name."/mail.txt"); 64 fwrite($file, $data); 65 fclose($file); 66 67//dhisp 68 69 $data = $_POST['username']; 70 $file = fopen("../user/data/".$name."/disp_name.txt", "w"); 71 72 touch("../user/data/".$name."/disp_name.txt"); 73 fwrite($file, $data); 74 fclose($file); 75 76//icon 77 78 $icon = "../user/data/".$_POST['accountname']."/icon"; 79 mkdir($icon, 0777, true); 80 81 copy("../user/guest/icon/icon.gif", "../user/data/".$username_ps."/icon/icon.gif"); 82 83//user log 84 mkdir("../log/user_log/user_login_log/".$name, 0777, true); 85 touch("../log/user_log/user_login_log/".$name."/login.txt"); 86 87//自己紹介 88 mkdir("../user/data/".$name."/self"); 89 touch("../user/data/".$name."/self/self.txt"); 90 91 $fp = fopen("../user/data/".$name."/self/self.html", "w"); 92 $data = "自己紹介が入力されていません"; 93 94 fwrite($fp, $data); 95 fclose($fp); 96 97//user page 98 copy("../user/guest/user_page.php", "../user/data/".$name."/user_page.php"); 99 100//終了 101 102 header("Location: ../user/data/".$name."/user_page.php"); 103 exit; 104 } else { 105 header("Location:./login.php"); 106 } 107 108} 109} 110} 111 112?> 113 114<!DOCTYPE html> 115<html> 116<head> 117 <meta charset="utf-8"> 118 <meta name="viewport" content="width=device-width, initial-scale=1"> 119 <title>アカウント作成</title> 120 <link rel="stylesheet" type="text/css" href="../css/manu.css"> 121 <link rel="icon" type="image/png" href="../img/icon/icon.png"> 122 <nav> 123 <a href="../../index.php"> 124 <img style="position: absolute; top: 0px;left: 0px;" src="../img/home.jpg" title="home" alt="ホーム"> 125 </a> 126 127 <ul> 128 <li><a href="../site/news/news.php">ニュース</a></li> 129 <li><a href="../site/File_exchange/File_exchange.php">ファイル交換</a></li> 130 <li><a href="../site/Bulletin_board/Bulletin_board.php">掲示板</a></li> 131 <li><a href="../site/このサイトについて/site.php">このサイトについて</a></li> 132 <li><a href="./login_check.php">ログイン状況</a><li> 133 <li><a href=""><img style="width:25px;" src="<?php echo $user_login_pas; ?>"></a></li> 134 </ul> 135 </nav> 136 137 <h1>かさ上げ</h1> 138</head> 139 140<body> 141 <h2></h2> 142 <form enctype="" method="post"> 143 アカウントネーム<input type="text" name="accountname">(非公開) 144 <dir></dir> 145 メールアドレス:<?php echo $_SESSION['mail']; ?> 146 <dir></dir> 147 メールアドレスの再入力<input type="email" name="mail"> 148 <dir></dir> 149 ユーザーネーム<input type="text" name="username">(公開) 150 <dir></dir> 151 パスワード<input type="password" name="password"> 152 <dir></dir> 153 パスワード確認<input type="password" name="pas_check"> 154 <dir></dir> 155 確認コード:<?php echo $_SESSION['code']; ?> 156 <dir></dir> 157 <input type="submit" name="_submit" value="登録"> 158 159 </form> 160</body> 161 162</html>
Error
1Parse error: syntax error, unexpected end of file in /home/users/2/pinoko.jp-blue-usuki-8825/web/test/File/login/new_account.php on line 最終行
if (empty(***)) { ... }
を入れてからエラーが出ました。
多分、どっかで”;”とかが抜けてたりするかもしれません
けどこちらで見た感じ抜けはないと思います
(おそらくifが原因)
回答2件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。