-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathadd_bms.php
More file actions
38 lines (33 loc) · 847 Bytes
/
add_bms.php
File metadata and controls
38 lines (33 loc) · 847 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<?php
require_once('bookmark_fns.php');
session_start();
//create short variable name
$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.');
}
// check URL format
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.');
// try to add bm
add_bm($new_url);
echo 'Bookmark added.';
// get the bookmarks this user has saved
if ($url_array = get_user_urls($_SESSION['valid_user']))
display_user_urls($url_array);
}
catch (Exception $e)
{
echo $e->getMessage();
}
display_user_menu();
do_html_footer();
?>