PHP bookmark system case

墨辰丷
Release: 2023-03-29 19:50:01
Original
1995 people have browsed it

This article mainly introduces the case of PHP bookmark system. Interested friends can refer to it. I hope it will be helpful to everyone.

1. Requirements analysis

First, each user needs to be identified. There should be a verification mechanism.
Secondly, you need to save a single user's bookmarks. Users should be able to add and delete bookmarks.
Again, it is necessary to recommend sites to users that may be of interest to them based on what is known about them.

2. Solution2.1 System flow chart

##2.2 File list in PHPbookmark

3. Implement database

create database bookmarks; use bookmarks; create table user ( username varchar(16) primary key, passwd char(40) not null, email varchar(100) not null ); create table bookmark ( username varchar(16) not null, bm_URL varchar(255) not null, index (username), index (bm_URL) ); grant select, insert, update, delete on bookmarks.* to bm_user@localhost identified by 'password';
Copy after login

4. Implement basic website4.1 login.php

Copy after login

4.2 bookmark_fns.php

Copy after login

5. Implement user authentication5.1 register_form.php

Copy after login

5.2 register_new.php

 16)) { throw new exception('Your password must be between 6 and 16 characters Please go back and try again.'); } //尝试注册 register($username,$email,$passwd); //注册会话变量 $_SESSION['valid_user'] = $username; //提供成员页面链接 do_html_header('Registration successful'); //HTML标题 echo 'Your registration was successful.Go to the members page to start setting up your bookmarks!'; //输出URL do_html_URL('member.php','Go to members page'); //HTML页脚 do_html_footer(); //HTML页脚 } catch(exception $e) { do_html_header('Problem:'); echo $e->getMessage(); do_html_footer(); exit; } ?>
Copy after login

5.3 member.php

Copy after login

5.4 logout.php

'; do_html_URL('login.php','Login'); } else //不成功 { echo 'Could not log you out.
'; } } else { echo 'You were not logged in, and so have not been logged ot.
'; do_html_URL('login.php','Login'); } do_html_footer(); ?>
Copy after login

5.5 change_passwd.php

 16) || (strlen($new_passwd) < 6)) { throw new exception('New password must be between 6 and 16 characters. Try again.'); } //尝试修改 change_password($_SESSION['valid_user'],$old_passwd,$new_passwd); echo 'Password changed.'; } catch(exception $e) { echo $e ->getMessage(); } display_user_menu(); do_html_footer(); ?>
Copy after login

5.6 forgot_paswd.php

'; } catch(exception $e) { echo 'Your password could not be reset - please try again later.'; } do_html_URL('login.php','Login'); do_html_footer(); ?>
Copy after login

6. Implement bookmark storage and retrieval6.1 add_bms.php

getMessage(); } display_user_menu(); do_html_footer(); ?>
Copy after login

6.2 delete_bms.php

You have not chosen any bookmarks to delete.
Please try again.

'; display_user_menu(); do_html_footer(); exit; } else { if(count($del_me) > 0) { foreach($del_me as $url) { if(delete_bm($valid_user,$url)) { echo 'Deleted '. htmlspecialchars($url) .'.
'; } else { echo 'Could not delete '. htmlspecialchars($url) .'.
'; } } } else { echo 'No bookmarks selected for deletion'; } } if($url_array = get_user_urls($valid_user)) { display_user_urls($url_array); } display_user_menu(); do_html_footer(); ?>
Copy after login

6.3 recommend.php

getMessage(); } display_user_menu(); do_html_footer(); ?>
Copy after login

Summary: That’s it The entire content of the article is hoped to be helpful to everyone's study.

Related recommendations:

Examples of access methods for class attributes and class static variables in PHP

php cookie working principle and detailed explanation of examples

PHP uses socket to simulate POST method

The above is the detailed content of PHP bookmark system case. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
php
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!