-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathget-url-insert.php
More file actions
54 lines (42 loc) · 1.11 KB
/
get-url-insert.php
File metadata and controls
54 lines (42 loc) · 1.11 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
<?php
header('Content-Type: text/html; charset=UTF-8');
$con=mysqli_connect("localhost","root","","geturl");
// Check connection
if (mysqli_connect_error())
{
echo "Failed to connect to MySQL SERVER: " . mysqli_connect_error();
}
$keywords = $_POST[origkeywords];
$page1 = file_get_contents($_POST[origpage]);
$page = base64_encode($page1);
$sql="INSERT INTO urls (keywords, page)
VALUES
('$keywords','$page')";
if (!mysqli_query($con,$sql))
{
die('Error - Failed to post: ' . mysqli_error($con));
}
mysqli_close($con);
header("Location: get-url.php");
?>
<?php
header('Content-Type: text/html; charset=UTF-8');
?>
<?php include('get-url-connect.php'); ?>
<?php
//execute the SQL query and return records
$result = mysql_query("SELECT * FROM `urls`" . " ORDER BY `ID` DESC LIMIT 5 ");
//fetch the data from the database
?>
<div class="boxit">
<?php
while ($row = mysql_fetch_array($result)) {
echo "ID -"
.$row['id']." Date:"
.$row['date']."<br />";
$page = base64_decode($row['page'])."<br />";
$keywords = $row['keywords'];
echo $keywords."<br />";
echo $page."<br /><br /><hr>";
}
?>