-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp_new_user.php
More file actions
219 lines (198 loc) · 11.7 KB
/
app_new_user.php
File metadata and controls
219 lines (198 loc) · 11.7 KB
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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
<?php
/************************FUNCTION FOR MASTER ACCOUNT *********************/
function cust_ins($primary_name,$msname,$company_name,$company_email,$second_company_name,$second_company_email,$third_company_name,$third_company_email,$address,$mobile,$password,$promo_code){
include('../../account_master/db.php');
if($promo_code!=''){
$s_ad = "SELECT * FROM `admin` WHERE `affiliate_code` = $promo_code";
$r_ad = $con->query($s_ad);
$row_ad = $r_ad->fetch_assoc();
$sales_person = $row_ad['email'];
}else{
$sales_person = '';
}
$date = date('Y-m-d');
if (isset($_SESSION['plan_name'])) {
$plan_name = $_SESSION['plan_name'];
}else{
$plan_name = 'Demo';
}
if (isset($_SESSION['stripeEmail'])) {
$stripeEmail = $_SESSION['stripeEmail'];
}else{
$stripeEmail = $company_email;
}
if (isset($_SESSION['payment'])) {
$payment = $_SESSION['payment'];
}else{
$payment = '00';
}
if (isset($_SESSION['plan_expire']) && $_SESSION['plan_expire'] == 'yearly') {
$e_date1 = date('Y-m-d', strtotime($date. ' + 1 year'));
$plan_expire == 'yearly';
}else{
$e_date1 = date('Y-m-d', strtotime($date. ' + 1 month'));
$plan_expire == 'monthly';
}
$i_c = "INSERT INTO `customers` (`date`, `primary_name`, `name`, `email`, `password`, `sales_person`, `payment_term`, `address`, `company_name`, `mobile`, `company_email`, `second_company_name`, `second_company_email`, `third_company_name`, `third_company_email`, `status`) VALUES('$date', '$primary_name', '$msname', '$company_email', '$password', '$sales_person', 'Monthly', '$address', '$company_name', '$mobile', '$company_email', '$second_company_name', '$second_company_email', '$third_company_name', '$third_company_email', 'active')";
$con->query($i_c);
$customer_last_id = $con->insert_id;
$s_p = "SELECT * FROM `plan` WHERE `name` = '$plan_name'";
$r_p = $con->query($s_p);
$row_p = $r_p->fetch_assoc();
$p_id = $row_p['id'];
$amount = $row_p['price_monthly'];
$sql = "INSERT INTO `subscriptions` (`date`, `customer_id`, `plan_id`, `amount`, `activated_on`, `affiliate_code`, `nest_bill`, `expiry_date`, `trial_days`, `time_peiod`, `status`, `company_email`) VALUES('$date', '".$customer_last_id."', '$p_id', '$amount', '$date', '$promo_code', '$e_date1', '$e_date1', '30', '$plan_expire', '$plan_name', '$company_email')";
$r_sql = $con->query($sql);
$subscription_last_id = $con->insert_id;
$iinv1 = "INSERT INTO `invoice` (`date`,`s_id`,`c_id`,`amount`,`nest_bill`,`expiry_date`,`time_peiod`,`status`,`payer_email`) VALUES('$date','".$subscription_last_id."','".$customer_last_id."','".$amount."','".$e_date1."','".$e_date1."','$plan_expire','$plan_name','$stripeEmail')";
$con->query($iinv1);
//echo '<script>alert("'.$iinv1.'");</script>';
if($sales_person != ''){
$body = "http://more-acc.com/email_cust.php?name=".urlencode($msname);
?>
<script>
var xmlhttp = new XMLHttpRequest();
xmlhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
alert(this.responseText);
}
};
xmlhttp.open("GET", "http://vatguru.info/mail/PHP/examples/url_mail.php?email_to=<?php echo $sales_person; ?>&email_subject=New Account created on More Accounts&email_body=<?php echo urlencode($body); ?>", true);
xmlhttp.send();
</script>
<?php }
$body = "http://more-acc.com/email_admin.php?name=".urlencode($msname);
?>
<script>
var xmlhttp = new XMLHttpRequest();
xmlhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
alert(this.responseText);
}
};
xmlhttp.open("GET", "http://vatguru.info/mail/PHP/examples/url_mail.php?email_to=accountantdubai@gmail.com &email_subject=New Account created on More Accounts&email_body=<?php echo urlencode($body); ?>", true);
xmlhttp.send();
</script>
<?php
}
/************************FUNCTION FOR MASTER ACCOUNT *********************/
include('db.php');
if(isset($_POST['submit'])){
$secret="6LeBNjsUAAAAAH48auuEgOJEdyWjD9kJp9N2q5vU";
$response=$_POST["g-recaptcha-response"];
$ip = $_SERVER['REMOTE_ADDR'];
$verify=file_get_contents("https://www.google.com/recaptcha/api/siteverify?secret=".$secret."&response=".$response."&remoteip=".$ip);
$captcha_success=json_decode($verify);
//print_r($captcha_success);
if ($captcha_success->success==false && !isset($_POST['force_register'])) {
echo "<script>window.location.href = '../registration.php?error=Robots not allowed to register.';</script>";
}else if ($captcha_success->success==true || isset($_POST['force_register'])) {
$primary_name = $_POST['primary_name'];
$first_name = $_POST['first_name'];
$last_name = $_POST['last_name'];
$name = $primary_name.' '.$first_name.' '.$last_name;
$company_name = $_POST['company_name'];
$company_email = $_POST['company_email'];
$address = $_POST['address'];
$mobile = $_POST['mobile'];
$password = $_POST['password'];
$confirm_password = $_POST['confirm_password'];
$promo_code = $_POST['promo_code'];
$msname = $first_name.' '.$last_name;
$date = date('Y-m-d');
if (isset($_SESSION['plan_expire']) && $_SESSION['plan_expire'] == 'yearly') {
$e_date1 = date('Y-m-d', strtotime($date. ' + 1 year'));
$plan_expire == 'yearly';
}else{
$e_date1 = date('Y-m-d', strtotime($date. ' + 1 month'));
$plan_expire == 'monthly';
}
if($password == $confirm_password){
$new = $conn->query("SELECT * FROM `user` WHERE `company_email`='$company_email'");
$count = $new->num_rows;
if($count > '0'){
$not = "not";
echo "<script>window.location.href = '../registration.php?error=User already exist.';</script>";
}else{
$email = $company_email;
$newas = $conn->query("SELECT * FROM `company` WHERE `email` = '$email'");
echo $count = $newas->num_rows;
if($count == ''){
$body = "http://more-acc.com/email/user_email.php?name=".urlencode($name)."&username=".urlencode($company_email);
?>
<script>
var xmlhttp = new XMLHttpRequest();
xmlhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
alert(this.responseText);
}
};
xmlhttp.open("GET", "http://vatguru.info/mail/PHP/examples/url_mail.php?email_to=<?php echo $company_email; ?>&email_subject=Welcome To More Accounts&email_body=<?php echo urlencode($body); ?>", true);
xmlhttp.send();
</script>
<?php
if(isset($_SESSION['plan_name'])){
$account_plan_name = $_SESSION['plan_name'];
}
if(isset($account_plan_name) && $account_plan_name == 'prime3'){
$second_company_name = $_POST['second_company_name'];
$second_company_email = $_POST['second_company_email'];
$third_company_name = $_POST['third_company_name'];
$third_company_email = $_POST['third_company_email'];
echo cust_ins($primary_name,$msname,$company_name,$company_email,$second_company_name,$second_company_email,$third_company_name,$third_company_email,$address,$mobile,$password,$promo_code);
}elseif(isset($account_plan_name) && $account_plan_name == 'prime2'){
$second_company_name = $_POST['second_company_name'];
$second_company_email = $_POST['second_company_email'];
echo cust_ins($primary_name,$msname,$company_name,$company_email,$second_company_name,$second_company_email,'','',$address,$mobile,$password,$promo_code);
}else{
echo cust_ins($primary_name,$msname,$company_name,$company_email,'','','','',$address,$mobile,$password,$promo_code);
}
/////////////////////////////////////////////////////////////////////////////////////////
//first company
/////////////////////////////////////////////////////////////////////////////////////////
$conn->query("INSERT INTO `user`(`user_name`, `email`, `password`, `address`, `phone1`, `access_level`,`promo_code` , `active`, `status`, `company_email`) VALUES ('$name','$company_email','$password','$address','$mobile','admin', '$promo_code','active','active','$company_email')");
$sql = "INSERT INTO `company` (`img_url` , `company_name` , `address` ,`city` , `state` , `country` , `phone` ,`mobile` , `fax` , `email` , `website` , `tax_number` , `document_formate` , `account_currenccy` , `default_location` , `auto_nmbering` , `reset_account` , `delete_account` , `company_email`,`expiry_date`)VALUES ('emoji/46451d222301bdaa4e6711a96831482d.jpg', '$company_name', '', '', '', '', '', '', '', '$email', '', '', '', 'AED', '', '', '', '', '$email','$e_date1') ";
$conn->query($sql);
/////////////////////////////////////////////////////////////////////////////////////////
//first company
/////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////
//Second company
/////////////////////////////////////////////////////////////////////////////////////////
if(isset($account_plan_name) && $account_plan_name == 'prime2'){
$company_name = $_POST['second_company_name'];
$company_email = $_POST['second_company_email'];
$email = $company_email;
$conn->query("INSERT INTO `user`(`user_name`, `email`, `password`, `address`, `phone1`, `access_level`,`promo_code` , `active`, `status`, `company_email`) VALUES ('$name','$company_email','$password','$address','$mobile','admin', '$promo_code','active','active','$company_email')");
$sql = "INSERT INTO `company` (`img_url` , `company_name` , `address` ,`city` , `state` , `country` , `phone` ,`mobile` , `fax` , `email` , `website` , `tax_number` , `document_formate` , `account_currenccy` , `default_location` , `auto_nmbering` , `reset_account` , `delete_account` , `company_email`,`expiry_date`)VALUES ('emoji/46451d222301bdaa4e6711a96831482d.jpg', '$company_name', '', '', '', '', '', '', '', '$email', '', '', '', 'AED', '', '', '', '', '$email','$e_date1') ";
$conn->query($sql);
}
/////////////////////////////////////////////////////////////////////////////////////////
//Second company
/////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////
//Third company
/////////////////////////////////////////////////////////////////////////////////////////
if(isset($account_plan_name) && $account_plan_name == 'prime3'){
$company_name = $_POST['third_company_name'];
$company_email = $_POST['third_company_email'];
$email = $company_email;
$conn->query("INSERT INTO `user`(`user_name`, `email`, `password`, `address`, `phone1`, `access_level`,`promo_code` , `active`, `status`, `company_email`) VALUES ('$name','$company_email','$password','$address','$mobile','admin', '$promo_code','active','active','$company_email')");
$sql = "INSERT INTO `company` (`img_url` , `company_name` , `address` ,`city` , `state` , `country` , `phone` ,`mobile` , `fax` , `email` , `website` , `tax_number` , `document_formate` , `account_currenccy` , `default_location` , `auto_nmbering` , `reset_account` , `delete_account` , `company_email`,`expiry_date`)VALUES ('emoji/46451d222301bdaa4e6711a96831482d.jpg', '$company_name', '', '', '', '', '', '', '', '$email', '', '', '', 'AED', '', '', '', '', '$email','$e_date1') ";
$conn->query($sql);
}
/////////////////////////////////////////////////////////////////////////////////////////
//Third company
/////////////////////////////////////////////////////////////////////////////////////////
echo "user created successfully....... Thanks for choosing More Accounts.";
session_unset();
session_destroy();
echo "<script>window.location.href = '../registration.php?done=done';</script>";
}
}//checking user already register
}else{
echo "<script>window.location.href = '../registration.php?error=Password doesn't match.';</script>";
}
}
}
?>