-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathload.php
More file actions
executable file
·58 lines (57 loc) · 1.91 KB
/
load.php
File metadata and controls
executable file
·58 lines (57 loc) · 1.91 KB
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/semantic-ui@2.3.3/dist/semantic.min.css" />
<link rel="stylesheet" href="assets/css/style.css" />
</head>
<body>
<br>
<br>
<!--Fetch variables from url-->
<?php $url = $_GET['url']; $title = $_GET['title']; ?>
<div class="ui text container">
<form action="" method="post" class="ui form">
<h2 class="ui dividing header">Save bookmark</h2>
<br>
<div class="field">
<label >Title</label>
<input type="text" name="title" value="<?= $title ?>">
</div>
<div class="field">
<label >Address</label>
<input type="text" name="url" value="<?= $url ?>" >
</div>
<button class="ui button" type="submit">Submit URL</button>
<br>
<br>
<!--Alert messages-->
<?php
if('POST' == $_SERVER['REQUEST_METHOD']) {
include "include/connect.php";
$_url = mysqli_real_escape_string($link, $_REQUEST['url']);
$_title = mysqli_real_escape_string($link, $_REQUEST['title']);
$query = "INSERT INTO `bookmarks` (hash, url,title) VALUES ('".md5($_url)."','".$_url."','".$_title."')";
if(mysqli_query($link, $query)){
echo '<script language="javascript">';
echo 'window.location.href="bookmarks.php";';
echo '</script>';
} else{
echo '<div class="ui negative message"><i class="close icon"></i>';
echo "<div class='header'>Error !</div><p>". mysqli_error($link) ."</p></div>";
}
mysqli_close($link);
} ?>
</form>
</div>
<script src="https://code.jquery.com/jquery-3.1.1.min.js" ></script>
<script src="https://cdn.jsdelivr.net/npm/semantic-ui@2.3.3/dist/semantic.min.js"></script>
<script type="text/javascript">
$('.message .close')
.on('click', function() {
$(this).closest('.message').transition('fade');});
</script>
</body>
</html>