PHP My SQL Lesson 4 cookie session 1
- Slides: 37
PHP +My. SQL快速入門 Lesson 4
四、cookie 與 session 1 認識cookie 2 session 3 session實作『會員登入系統』
session_decode( ) 將session資料解碼。 session_destroy( ) 取消所有註冊的session變數,記錄檔也刪除。 session_encode( ) 將session資料編碼。 session_get_cookie_params( ) 傳回cookie的相關資訊,如有效時間、路徑…等。 session_id( ) 傳回目前的session ID。 session_is_registered( ) 檢查session變數是否已註冊,已註冊傳回True,否則 傳回False。 session_module_name( ) 傳回或設定session模組。 session_name( ) 傳回目前的session名稱,php. ini檔案預設值為 PHPSESSID。 session_readonly( ) 讀取session內容,但不能修該內容。 session_register( ) 註冊session變數。 session_save_path( ) 尋找session的儲存路徑。 session_set_cookie_params( ) 設定php. ini檔案中的cookie參數。 session_set_save_handler( ) 設定session的儲存功能。 session_start( ) 啟動session。 session_unregister( ) 取銷所指定的session變數。記錄檔仍然存在。 session_unset( ) 釋放所有的session變數,但是記錄檔仍然存在。 session_write_close( ) 寫入session資料及結束session。
index. php 會員登入頁面 <? session_start(); session_destroy(); ? > <html> <head> <title>登入頁面</title> </head> <body> <p align="center">請輸入帳號、密碼</p> <form method="POST" action="login_check. php"> <table border="1" width="300" align="center"> <tr> <td>帳號:</td> <td><input type="text" name="id" size="20"></td> </tr> <td>密碼:</td> <td><input type="password" name="pw" size="20"></td> </tr> </table> <p align="center"><input type="submit" value="登入"></p> </form> </body></html>
login_check. php : 驗證會員身份 <? $news_pw=array("Bill"=>"aaa", "Calvin"=>"0000", "Andy"=>"1234", "David"=>"789"); $news=array_keys($news_pw); //傳回news_pw陣列中所有的索引� if ( !in_array($id, $news) ) { echo "您非本站會員喔!請離開!!"; exit; } if ( $pw != $news_pw[$id] ) { echo "您輸入的密碼錯誤喔!請重新輸入!!"; exit; } session_register("id", "pw"); header("location: members_index. php "); ? >
members_index. php 會員登入成功歡迎頁面 <? session_start(); $member_id = $_SESSION["id"]; $member_pw = $_SESSION["pw"]; If($member_id=="" OR $member_pw=="" ) { echo "尚未登入喔"; exit; } ? > <html> <head> <title>會員登入成功歡迎頁面</title> </head> <body> <? echo $member_id; ? >您好!!! <p><a href="members_loginout. php">登出會員</a></p> </body> </html>
- Cookie lemon cookie feedback
- Cookie monster who stole the cookie
- Cookie cookie subliminal
- Cookie lemon cookie feedback
- What is the value of the staff-session cookie?
- Instagram session cookie
- Servlet technology is used to create web application
- Php cookie
- Slidetodoc
- General.php?seccion=
- Info.php?seccion=
- Php session isset
- Php/index.php?id=
- Php php://input
- Inurl:sql.php?id=
- Inurl:sql.php?id=
- Php sql injection 방지 함수
- Https://slidetodoc.com/php-and-my-sql-david-lash-module-3/
- Sql injection attack example php
- Php sql tutorial
- Php?sql
- Difference between sql and pl/sql
- Sql developer real time sql monitor
- Lesson 2 session 3
- You gave me your peanut butter chocolate chip cookie
- Attitude countable or uncountable
- Is cookie countable or uncountable
- Stoichiometry cookie lab
- Cookie stoichiometry
- Stoichiometry
- Please dont eat my cookies
- Gary paulsen cookie dog
- Kara james facebook
- Javascript:alert(document.cookie)
- Condicional
- Analytic rubric for mathematics
- Principles of high performance liquid chromatography
- Highfibe