forked from jackrtd/LINE-BOT-PHP-Starter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathadd_lineid.php
86 lines (83 loc) · 4.16 KB
/
add_lineid.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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
<!DOCTYPE html>
<html>
<head>
<title>โปรแกรมเพิ่ม Contact Line bot</title>
<meta charset="utf-8">
<meta http-equiv="Content-Type">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="node_modules/bootstrap/dist/css/bootstrap.min.css" rel='stylesheet'>
<link href="node_modules/bootstrap-material-design/dist/css/bootstrap-material-design.min.css" rel='stylesheet'>
<link href="node_modules/bootstrap-material-design/dist/css/ripples.min.css" rel='stylesheet'>
<link href="node_modules/toastr/build/toastr.min.css" rel='stylesheet'>
</head>
<body>
<div class="container">
<div class="row" style='margin-top:20px;'>
<div class="col-xs-4 col-xs-offset-4 col-sm-4 col-sm-offset-4 col-md-2 col-md-offset-5 text-center">
<img src="https://upload.wikimedia.org/wikipedia/commons/thumb/4/41/LINE_logo.svg/1024px-LINE_logo.svg.png" class="img-responsive">
</div>
</div>
<div class="row" style='margin-top:10px;'>
<div class="col-sm-12">
<div class="panel panel-success">
<div class="panel-heading">
<h3 class="panel-title">Puri Add Contact Line
<small>โปรแกรมเพิ่ม Contact</small></h3>
</div>
<div class="panel-body">
<form action="https://api.mlab.com/api/1/databases/puridb/collections/col_line_id?apiKey=JrLs9PiSVp8OfgZn_jbSdKCvO01BIbxx" method="post" id="form_sender">
<div class="inputs">
<div class="form-group label-floating">
<label for="line_id" class="control-label">Line ID</label>
<input type="text" class="form-control" id="line_id" name="line_id">
</div>
</div>
<div class="inputs">
<div class="form-group label-floating">
<label for="nickname" class="control-label">ชื่อเล่น</label>
<input type="text" class="form-control" id="nickname" name="nickname">
</div>
</div>
<div class="form-group">
<button type="submit" class="btn btn-raised btn-success">ส่ง</button>
<button type="clear" class="btn btn-raised btn-default">clear</button>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
<script src="node_modules/jquery/dist/jquery.min.js"></script>
<script src="node_modules/bootstrap/dist/js/bootstrap.min.js"></script>
<script src="node_modules/bootstrap-material-design/dist/js/material.min.js"></script>
<script src="node_modules/bootstrap-material-design/dist/js/ripples.min.js"></script>
<script src="node_modules/toastr/build/toastr.min.js"></script>
<script>
$(document).ready(function(){
$.material.init();
$("body").on("submit","#form_sender",function(e){
e.preventDefault();
var this_ = $(this);
var url = this_.attr('action');
var line_id = this_.find("#line_id").val();
var nickname = this_.find("#nickname").val();
var data = JSON.stringify({line_id:line_id,nickname:nickname});
$.ajax({
type: 'POST',
url: url,
data: data,
contentType: "application/json",
dataType: 'json',
success: function(response) {
console.log(response);
toastr.success("บันทึกเรียบร้อย");
$("#line_id").val('');
$("#nickname").val('');
}
});
});
});
</script>
</body>
</html>