1 <?php 2 session_start(); 3 $u=htmlspecialchars($_post['user'], ent_quotes); 4 $p=htmlspecialchars($_post['pass'], ent_quotes); ?>
<html> <head> <meta http equiv='content-type' content='text/html;charset=utf=8'> <title>ようこそ 画像掲示板へ</title> <body> <?php require_once("db_init.php"); $ps=$db->query("select password from table2 where id='$u'"); if($ps->rowcount()>0){ $r=$ps->fetch(); if($r['password']===md5($p)){ $_SESSION['user-name']=$u; $_SESSION['time']=time(); if($u === "admin"){ print "管理者のページにどうぞ<br> <a href='gz_admin.php'>管理者のページ</a>"; }else{ print "<p>一般ユーザー".$u."さん<br> ようこそ画像掲示板へ</p> <a href='gz.php'>ここをクリックして一覧表示にどうぞ</a>"; } }else{ session_destroy(); print"<p>登録されていなか、パスワードが違います<br> <a href='gz_logon.php'>ログオン</a></p>"; } }else{ session_destroy(); print "<p>登録されていなか、パスワードが違います<br> <a href='gz_logon.php'>ログオン</a></P>"; } ?> </body> </html>これを実行する結果
Notice: Undefined variable: _post in C:\xampp\htdocs\gz_logon2.php on line 3
Notice: Use of undefined constant ent_quotes - assumed 'ent_quotes' in C:\xampp\htdocs\gz_logon2.php on line 3
Warning: htmlspecialchars() expects parameter 2 to be long, string given in C:\xampp\htdocs\gz_logon2.php on line 3
Notice: Undefined variable: _post in C:\xampp\htdocs\gz_logon2.php on line 4
Notice: Use of undefined constant ent_quotes - assumed 'ent_quotes' in C:\xampp\htdocs\gz_logon2.php on line 4
Warning: htmlspecialchars() expects parameter 2 to be long, string given in C:\xampp\htdocs\gz_logon2.php on line 4
といようなメッセージが出てしまいます。
どうすれば解決できるのでしょうか?
よろしくお願いいたします。
回答3件
あなたの回答
tips
プレビュー