-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathenable.php
92 lines (79 loc) · 3.01 KB
/
enable.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
<?php
require ("config.php");
function email_letter($to, $from, $subject = 'no subject', $msg = 'no msg') {
$headers = "From: $from\r\n";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
$headers .= 'X-Mailer: PHP/' . phpversion ();
return mail ( $to, $subject, $msg, $headers );
}
$cb = new Couchbase ( "127.0.0.1:8091", "openmoney", "", "openmoney" );
$trading_name = null;
if( isset( $_GET['trading_name'] ) ) {
$trading_name = urldecode( $_GET['trading_name'] );
$trading_name = str_replace(" ","+",$trading_name);//plus sign gets replaced with a space
}
$currency = null;
if( isset( $_GET['currency'] ) ) {
$currency = urldecode( $_GET['currency'] );
$currency = str_replace(" ","+",$currency);//plus sign gets replaced with a space
}
$space = null;
if( isset( $_GET['space'] ) ) {
$space = urldecode( $_GET['space'] );
$space = str_replace(" ","+",$space);//plus sign gets replaced with a space
}
$auth = null;
if( isset( $_GET['auth'] ) ) {
$auth = urldecode( $_GET['auth'] );
$auth = str_replace(" ","+",$auth);//plus sign gets replaced with a space
}
if( $trading_name != null && $currency != null) {
$trading_name = $cb->get ( "trading_name," . $trading_name . "," . $currency);
$trading_name = json_decode ( $trading_name, true );
if( isset( $trading_name ['key'] ) && $auth != null ) {
require ("password.php");
if( password_verify ( $trading_name ['key'], $auth ) ) {
$trading_name ['enabled'] = true;
$trading_name ['enabled_at'] = intval( round(microtime(true) * 1000) );
$cb->set ( "trading_name," . $trading_name['name'] . "," . $trading_name['currency'], json_encode ( $trading_name ) );
echo "Trading Name " . $trading_name['name'] . " in currency " . $trading_name['currency'] . " is enabled.";
} else {
echo "Authentication Failed!";
}
} else {
echo "Authentication Failed!";
}
} else if ( $currency != null ) {
$currency = $cb->get ( "currency," . $currency);
$currency = json_decode ( $currency, true );
if( isset( $currency ['key'] ) && $auth != null ) {
require ("password.php");
if( password_verify ( $currency ['key'], $auth ) ) {
$currency ['enabled'] = true;
$currency ['enabled_at'] = intval( round(microtime(true) * 1000) );
$cb->set ( "currency," . $currency['currency'], json_encode ( $currency ) );
echo "Currency " . $currency['currency'] . " is enabled.";
} else {
echo "Authentication Failed!";
}
} else {
echo "Authentication Failed!";
}
} else if ( $space != null ) {
$space = $cb->get ( "space," . $space);
$space = json_decode ( $space, true );
if( isset( $space ['key'] ) && $auth != null ) {
require ("password.php");
if( password_verify ( $space ['key'], $auth ) ) {
$space ['enabled'] = true;
$space ['enabled_at'] = intval( round(microtime(true) * 1000) );
$cb->set ( "space," . $space['space'], json_encode ( $space ) );
echo "Space " . $space['space'] . " is enabled.";
} else {
echo "Authentication Failed!";
}
} else {
echo "Authentication Failed!";
}
}