-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathserviceinsertpicture.php
51 lines (41 loc) · 1.11 KB
/
serviceinsertpicture.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
49
50
51
<?php
$host = "localhost"; //database host server
$db = "fritter"; //database name
$user = "root"; //database user
$pass = ""; //password
$connection = mysql_connect($host, $user, $pass);
//Check to see if we can connect to the server
/*
$x = $_GET['x'];
$y = $_GET['y'];
$z = $_GET['z'];
*/
//imageID image image_text userID
$image = $_GET['image'];
$image_text = $_GET['image_text'];
$userID = $_GET['userID'];
if(!$connection)
{
die("Database server connection failed.");
}
else
{
//Attempt to select the database
$dbconnect = mysql_select_db("fritter", $connection);
//Check to see if we could select the database
if(!$dbconnect)
{
die("Unable to connect to the specified database!");
}
else
{
$query = "INSERT INTO images(image,image_text,userID)
VALUES('$image' ,'$image_text','$userID')";
$resultset = mysql_query($query, $connection);
$response = "Successfully added " . $query;
//echo "Successfully added ";
//echo $query;
}
echo json_encode($response);
}
?>