-
Notifications
You must be signed in to change notification settings - Fork 0
/
notemanager.php
71 lines (57 loc) · 2 KB
/
notemanager.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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
<?php
//print_r($_FILES); //this will print out the received name, temp name, type, size, etc.
//SQL------------
#mysql_connect("localhost","root","quantum123");
#mysql_select_db("babycry");
#mysql_query("set names utf8");
//---------------------
//$type=$_FILES['audio_data']['type'];
//$size = $_FILES['audio_data']['size']; //the size in bytes
//$input = $_FILES['audio_data']['tmp_name']; //temporary name that PHP gave to the uploaded file
//$timerec = $_FILES['audio_data']['name']; //. $file; //letting the client control the filename is a rather bad idea
//$timeupload = date("Y:m:d H:i:s",time()+0); //UTC+8
//$timeupload2 = date('YmdHis',time()+0); //待測試
$Barcode = $_POST['author'];
#$note = $_POST['note'];
//$gender = $_POST['gender'];
//$platform = $_POST['platform'];
//$age = $_POST['age'];
//$label = $_POST['label'];
//$weight = $_POST['weight'];
//$path = 'uploads/' . $label . '/';
// 網路端存檔作者名可能會有中文問題,後續需要再注意
//Cookies設定區(改到app.js執行)
//setcookie('platform',$platform,time()+10800); //30天有效
//setcookie('author',$author,time()+10800); //30天有效
$response = array();
//move the file from temp name to local folder using $output name
if(True){
/*
$sqlresult = mysql_query("
SELECT `note`
FROM `babycry`
WHERE filename ='$author'
");
$sqlquery=mysql_fetch_row($sqlresult);
//$sqlquery = mysqli_fetch_all($sqlresult,MYSQLI_ASSOC);
//echo $sqlquery[0];
$writedata=$sqlquery[0] . ", " . $note ;
mysql_query("
UPDATE `babycry`
SET note='$writedata'
WHERE filename ='$author'
");
$response['save'] =1;
*/
$ourFileName = "./temp/temp.txt";
$ourFileHandle = fopen($ourFileName, 'w') or die("can't open file");
fwrite($ourFileHandle,$Barcode);
fclose($ourFileHandle);
} else {
//echo "create file " . $output . " failed";
$response['save'] =0;
}
//echo json_encode($_POST);
//echo json_encode($_FILES['audio_data']);
echo json_encode($response);
?>