Đang chuẩn bị liên kết để tải về tài liệu:
Học php, mysql và javascript - p 46

Không đóng trình duyệt đến khi xuất hiện nút TẢI XUỐNG

Example 20-12. rnmessages.php You need to login to view this page"); $user = $_SESSION['user']; if (isset($_GET['view'])) $view = sanitizeString($_GET['view']); else $view = $user; if (isset($_POST['text'])) { $text = sanitizeString($_POST['text']); if ($text != "") { $pm = substr(sanitizeString($_POST['pm']),0,1); $time = time(); queryMysql("INSERT INTO rnmessages VALUES(NULL, '$user', '$view', '$pm', $time, '$text')"); } } if ($view != "") { if ($view == { $name1 = $name2 = } else { $name1 = $name2 = } $user) "Your"; "Your"; "$view's"; "$view's"; echo "$name1 Messages"; showProfile($view); echo Type here to leave a message: . | Example 20-12. rnmessages.php php rnmessages.php include_once rnheader.php if isset _SESSION user die br br You need to login to view this page user _SESSION user if isset _GET view view sanitizeString _GET view else view user if isset _POST text text sanitizeString _POST text if text pm substr sanitizeString _POST pm 0 1 time time queryMysql INSERT INTO rnmessages VALUES NULL user view pm time text if view if view user name1 Your name2 Your else name1 a href rnmembers.php view view view a s name2 view s echo h3 name1 Messages h3 showProfile view echo _END form method post action rnmessages.php view view Type here to leave a message br textarea name text cols 40 rows 3 textarea br Public input type radio name pm value 0 checked checked Private input type radio name pm value 1 input type submit value Post Message form _END if isset _GET erase erase sanitizeString _GET erase queryMysql DELETE FROM rnmessages WHERE id erase AND recip user rnmessages.php 431 query SELECT FROM rnmessages WHERE recip view ORDER BY time DESC result queryMysql query num mysql_num_rows result for j 0 j num j row mysql_fetch_row result if row 3 0 row 1 user row z user echo date M jS y g sa row 4 echo a href rnmessages.php echo view row 1 row 1 a if row 3 0 echo wrote quot row 5 quot else echo whispered i font color 006600 quot row 5 quot font i if row 2 user echo a href rnmessages.php view view echo erase row 0 erase a echo br if num echo li No messages yet li br echo br a href rnmessages.php view view Refresh messages a echo a href rnfriends.php view view View name2 friends a rnlogout.php The final ingredient in our social networking recipe is Example 20-13 rnlogout.php the logout page that closes a session and deletes any associated data and cookies. The result of calling up this program can be seen in Figure 20-8 where the user is now asked to click on a link which will take them to the un-logged-in home page and remove the logged-in links from the top of the screen. Of course you could .

Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.