-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathsignup_backend.php
68 lines (49 loc) · 1.31 KB
/
signup_backend.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
<?php
include "includes/db_conn.php";
include "includes/utilities.php";
// if (isset($_POST['fname']) && isset($_POST['lname'])) {
if ($_SERVER["REQUEST_METHOD"] == "POST") {
$emaq = $_POST['email'];
// $emaq = "[email protected]";
$fname = $_POST['fname'];
$lname = $_POST['lname'];
$phone = $_POST['phone'];
$country = $_POST['country'];
$refid = $_POST['refid'];
// var_dump($phone);
$body = [
"first_name" => "$fname",
"last_name" => "$lname",
"email" => "$emaq",
"ewallet_reference_id" => "$refid",
"metadata" => [
"merchant_defined" => true
],
"phone_number" => "$phone",
"type" => "person",
"contact" => [
"contact_type" => "personal",
"country" => "$country",
"metadata" => [
"merchant_defined" => true
],
],
];
var_dump(json_encode($body));
try {
$signup = make_request('post', '/v1/user', $body);
var_dump($signup);
$ewall = $signup["data"]["id"];
$sql = "UPDATE user_details SET ewallet_id = '$ewall' WHERE email_id = '$emaq'";
$result = mysqli_query($conn, $sql);
header("Location: wallet.php");
exit();
} catch(Exception $e) {
echo "Error: $e";
}
}
else {
header("Location: wallet.php");
exit();
}
?>