forked from hareekrishna/CommunityCloud
-
Notifications
You must be signed in to change notification settings - Fork 0
/
thru_pc_init.php
233 lines (107 loc) · 2.75 KB
/
thru_pc_init.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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Start::CommunityCloud</title>
<script type="text/javascript" src="library/jquery.min.js" ></script>
</head>
<body>
<script>
function getUrlParameter(sParam)
{
var sPageURL = window.location.search.substring(1);
var sURLVariables = sPageURL.split('&');
for (var i = 0; i < sURLVariables.length; i++)
{
var sParameterName = sURLVariables[i].split('=');
if (sParameterName[0] == sParam)
{
return sParameterName[1];
}
}
}
$(function(){
var check=/AppName\/[0-9\.]+$/.test(navigator.userAgent);
var rand_code=getUrlParameter('code');
var mobile_no=getUrlParameter('num');
var flag=getUrlParameter('flag');
if(check && rand_code){
switch(flag){
case 'thru_pc':
$.ajax({
url:'infogiver.php',
dataType:'text',
type:'post',
data:{
flag:'thru_pc_init',
rand_code:rand_code,
mobile_no:mobile_no
},
success: function(data){
if(data=='updated'){
window.JSInterface.gotQR();
}
else{
}
},
error:function(jXHR,textStatus,errorThrown){
alert(errorThrown);
}
});
break;
case 'update':
rand_code=rand_code.replace("update_","");
$.ajax({
url:'infogiver.php',
dataType:'text',
type:'post',
data:{
flag:'update_init',
rand_code:rand_code,
mobile_no:mobile_no
},
success: function(data){
if(data=='updated'){
window.NewUser.update_user();
}
else{
}
},
error:function(jXHR,textStatus,errorThrown){
alert(errorThrown);
}
});
break;
case 'add_new':
rand_code=rand_code.replace("add_","");
$.ajax({
url:'infogiver.php',
dataType:'text',
type:'post',
data:{
flag:'added_init',
rand_code:rand_code,
mobile_no:mobile_no
},
success: function(data){
var info=JSON.parse(data);
if(info['status']=='updated'){
window.NewUser.added_user(info['tkt']);
}
else{
}
},
error:function(jXHR,textStatus,errorThrown){
alert(errorThrown);
}
});
break;
}
}
else{
window.location.replace("error.html");
}
});
</script>
</body>
</html>