-
Notifications
You must be signed in to change notification settings - Fork 1
/
allFunctions.php
99 lines (72 loc) · 2 KB
/
allFunctions.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
<?php
include_once("database.php");
//$referer2 = $_SERVER['HTTP_REFERER'];
//echo $referer2;
?>
<?php
//setRates(null);
//getRates();
//getAmount(1);
//setRates(null);
//getRates();
//getAmount(1);
function setRates($finalArray){
//accepts an array containing the rates upon trigger by updateConvertRates
foreach($finalArray as $sr_no=>$value)
{
//echo $sr_no."\n".$value;
$query = "UPDATE current_rates SET rate = $value where sr_no = '".($sr_no+1)."' ";
mysql_query($query);
}
}
function setPL($finalArray){
//accepts an array containing the rates upon trigger by updateConvertRates
foreach($finalArray as $sr_no=>$value)
{
//echo $sr_no."\n".$value;
$query = "UPDATE current_rates SET dif = $value where sr_no = '".($sr_no+1)."' ";
mysql_query($query);
}
}
function getRates(){
$query = "SELECT rate from current_rates";
$result = mysql_query($query);
$i = 0;
$finalValues = array();
while( $arrayTemp = mysql_fetch_array( $result ) )
{
$finalValues[$i++ ] = $arrayTemp[ 0 ];
}
//foreach($finalValues as $key=>$value)
// echo $key."<br />".$value;
return $finalValues;
}
function setAmount($login, $usd){
$query = "UPDATE user_amount SET amount = '".$usd."' where login = '".($login)."' ";
mysql_query($query);
$query = "UPDATE forex_sessions SET amount = '".$usd."' where login = '".($login)."' ";
mysql_query($query);
}
function getAmount($login){
$query = "SELECT amount from user_amount where login = '".$login."'";
$result = mysql_query($query);
$i = 0;
$finalValues = array();
while( $arrayTemp = mysql_fetch_array( $result ) )
{
$finalValues[$i++ ] = $arrayTemp[ 0 ];
}
return $finalValues[0];
}
function getVariations(){
$query = "SELECT dif from current_rates";
$result = mysql_query($query);
$i = 0;
$finalValues = array();
while( $arrayTemp = mysql_fetch_array( $result ) )
{
$finalValues[$i++ ] = $arrayTemp[ 0 ];
}
return $finalValues;
}
?>