summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarvin Borner2018-09-19 18:39:51 +0200
committerMarvin Borner2018-09-19 18:39:51 +0200
commitb4c9a7fa69ffe6be856a2a0fd063f76584ed2096 (patch)
tree58710004fc81e977f6996a5e098909a2c2a8ad22
parentcbe2b6db3b2c439a85cf0286720d7ebb235277a7 (diff)
Added better requesting of data :zap:
-rw-r--r--request.php21
-rw-r--r--request/request.php5
2 files changed, 5 insertions, 21 deletions
diff --git a/request.php b/request.php
deleted file mode 100644
index e649103..0000000
--- a/request.php
+++ /dev/null
@@ -1,21 +0,0 @@
-<?php
-include 'mysql_conf.inc';
-
-print_r(getContent($argv[1]));
-
-function getContent($query)
-{
- $conn = initDbConnection();
- $checkStmt = $conn->prepare('SELECT url, title, description, lang FROM url_data WHERE title LIKE :query OR description LIKE :query');
- $checkStmt->execute([':query' => '%' . $query . '%']);
- return $checkStmt->fetchAll(PDO::FETCH_ASSOC);
-}
-
-function initDbConnection()
-{
- global $servername, $dbname, $username, $password;
- $conn = new PDO("mysql:host=$servername;dbname=$dbname", $username, $password);
- $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
- $conn->exec('SET CHARACTER SET utf8');
- return $conn;
-} \ No newline at end of file
diff --git a/request/request.php b/request/request.php
new file mode 100644
index 0000000..0dc7a14
--- /dev/null
+++ b/request/request.php
@@ -0,0 +1,5 @@
+<?php
+include '../database/mysqlConf.inc';
+include '../database/Database.php';
+
+print_r(Database::getUrlData($_GET['search'] ?? '')); \ No newline at end of file