PHP用户验证和标签推荐的简单使用(5)

<?php require_once('bookmark_fns.php'); session_start(); $new_url = $_POST['new_url']; do_html_header('Adding bookmarks'); try { check_valid_user(); if (!filled_out($_POST)) { throw new Exception('Form not completely filled out.'); } if (strstr($new_url, 'http://') === false) { $new_url = 'http://'.$new_url; } // check url is valid if (!@fopen($new_url, 'r')) { throw new Exception('Not a valid URL.'); } add_bm($new_url); echo "Bookmark added"; if ($mks = get_user_urls($_SESSION['valid_user'])) { display_user_urls($mks); } }catch(Exception $e) { echo $e -> getMessage(); } display_user_menu(); do_html_footer(); ?>

delete_bms.php

<?php require_once('bookmark_fns.php'); session_start(); $del_me = $_POST['del_me']; $valid_user = $_SESSION['valid_user']; do_html_header('Deleting bookmarks'); check_valid_user(); if (!filled_out($_POST)) { echo "<p>You have not chosen any bookmarks to delete.<br /> Please try again.</p>"; 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)."<br />"; }else { echo "Could not deleted ".htmlspecialchars($url)."<br />"; } } }else { echo "No bookmarks selected for deletion."; } } if ($mks = get_user_urls($_SESSION['valid_user'])) { display_user_urls($mks); } display_user_menu(); do_html_footer(); ?>

recommend.php

<?php require_once('bookmark_fns.php'); session_start(); do_html_header('Recommending URLS'); try { check_valid_user(); $urls = recommend_urls($_SESSION['valid_user'], 1); display_recommended_urls($urls); }catch(Exception $e) { echo $e -> getMessage(); } display_user_menu(); do_html_footer(); ?>

member.php

<?php require_once('bookmark_fns.php'); session_start(); @$username = $_POST['username']; @$passwd = $_POST['passwd']; if ($username && $passwd) { try { // Log in login($username, $passwd); $_SESSION['valid_user'] = $username; }catch(Exception $e) { do_html_header('Problem: '); echo "You could not be logged in. You must be logged in to view this page."; do_html_url('login.php', 'Login'); do_html_footer(); exit; } } do_html_header('Home'); check_valid_user(); if ($url_array = get_user_urls($_SESSION['valid_user'])) { display_user_urls($url_array); } display_user_menu(); do_html_footer(); ?>

以上所述是小编给大家介绍的PHP用户验证和标签推荐的简单使用,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对脚本之家网站的支持!

您可能感兴趣的文章:

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/e491488caa6d95c5c9352240082a9d5a.html