tạo ứng dụng webchat phần 3

Tham khảo tài liệu 'tạo ứng dụng webchat phần 3', công nghệ thông tin, hệ điều hành phục vụ nhu cầu học tập, nghiên cứu và làm việc hiệu quả | Chapter 26 WebChat Finally chat_buffer is ended with a footer stating that the end of the occupants list has been reached. chat_buffer . P H2 End of Occupants List H2 P End of occupants processing Process Chat Messages The next part of the chat script processes the chat messages for display to the user. Here there is one thing to take into consideration frames. If frames are activated the chat program should display messages only if it has been called upon to read messages fmsgs is on . If the main frame HTML document is being output frames is on or if the message submit frame is being output fsubmit the script will not enter the part of the script that processes messages. if fmsgs eq on frames ne on fsubmit ne on Process Who Files Before the messages are collected a new who file is generated indicating that the user has read new messages. First the old who file is deleted using unlink. Then the who file is re-created and the user information is printed to it user_name user_email user_http and current_date_time. whofile chat_room_dir unlink whofile open WHOFILE whofile print WHOFILE user_name user_email user_http print WHOFILE current_date_time n close WHOFILE 709 Chapter 26 WebChat EThe code deletes the file instead of writing over it to ensure that the who file is assigned a different file creation time. A subroutine discussed later removes old who files on the basis of creation time. NOTE . . Because this script is meant to run on multiple operating system platforms other than UNIX the file is deleted and re-created to ensure consistency on as many platforms as possible. The RemoveOldWhoFiles subroutine is called to delete who files for users that have not read messages within the chat_who_length period of time. chat_who_length is a global variable that is specified in . RemoveOldWhoFiles Read Chat Messages To read the chat messages the script can be configured to restrict the number of messages that are seen. Generally users do not want to

Không thể tạo bản xem trước, hãy bấm tải xuống
TÀI LIỆU MỚI ĐĂNG
Đã 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.