-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathput_onion.php
48 lines (34 loc) · 1.11 KB
/
put_onion.php
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
<?php
$servername = "localhost";
$username = "sql_username";
$password = "sql_password";
$dbname = "sql_database";
$onion = $_GET["onion"]; //<---- TEXT.ONION
$des = urldecode($_GET["des"]); //<---- TEXT.DESCRIPTION
// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
$setup = "CREATE TABLE `onions` (
`id` int(11) NOT NULL,
`onion` text COLLATE utf8_unicode_ci NOT NULL DEFAULT 0,
`description` text COLLATE utf8_unicode_ci DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci";
$sql = "INSERT INTO onions (onion, description)
VALUES ('$onion', '$des')";
if(isset($_GET['setup']) && isset($_GET['setup'])){
if ($conn->query($setup) === TRUE) {
echo "Setup database is successfully installed!<br />Now run C# Code. :) ";
} else {
echo "Database Connection Error! Change credetains and try it again.";
}
}
if ($conn->query($sql) === TRUE) {
echo "New record created successfully";
} else {
echo "Creating post Error";
}
$conn->close();
?>