PHP 5/MySQL Programming- P48

PHP 5/MySQL Programming- P48:computer programming has often been seen as a difficult and arcane skill. Programming languages are difficult and complicated, out of the typical person’s reach. However, the advent of the World Wide Web has changed that to some extent. It’s reasonably easy to build and post a Web page for the entire world to see. The language of the Web is reasonably simple, and numerous applications are available to assist in the preparation of static pages | 213 Invalid Password font HERE else check to see if user has chosen a form to edit if editFile new if it s a new file put in some dummy values quizName sample test quizEmail root@localhost quizData q a b c d correct quizPwd php else open up the file and get the data from it fp fopen editFile r quizName fgets fp quizEmail fgets fp quizPwd fgets fp while feof fp quizData . fgets fp end while fclose fp end new form if I decided to code the value absolute from the name of this book series as an administrative password. Each test has its own password and the administrative functions like editing a quiz have their own passwords. If the password field has any other value besides my chosen password the program indicates a problem and refuses to move forward. An administrative password keeps casual snoops out of your system but it s lj nowhere near bullet-proof security. This system is not appropriate for situations kl where you must absolutely secure the tests. Chapter 6 Working th Files Once you know the user is authorized to edit tests determine if it s a new or existing quiz. If the quiz is new I simply add sample data to the variables which are used for the upcoming form. If the user wants to see an existing test I open the file for read access and grab the first three lines which correspond to the quizName quizEmail and quizPwd fields. A foreach loop loads the rest of the file into the quizData variable. 214 PHP 5 MySQL Programming for the Absolute Beginner You might wonder why the quiz needs a password field if it took a password to get to this form. The quiz system has multiple levels of security. Anybody can get to the page. However to move to one of the other pages the user must have the right kind of password. Only an administrator should go to the editPage and showLog programs so these programs require special administrative password access. Each quiz also has an associated password. The quiz master file stores the password so you can associate a

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
31    89    2    24-04-2024
Đã 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.