This repository has been archived by the owner on Dec 7, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 39
/
research.php
executable file
·90 lines (61 loc) · 2.42 KB
/
research.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
<?php
die("DEPRECATED");
if($_SERVER['REQUEST_METHOD'] == 'POST'){
require '/var/www/classes/Session.class.php';
require '/var/www/classes/Player.class.php';
require '/var/www/classes/PC.class.php';
require '/var/www/classes/Finances.class.php';
require '/var/www/classes/Ranking.class.php';
require '/var/www/classes/Process.class.php';
$software = new SoftwareVPC();
$finances = new Finances();
$session = new Session();
$ranking = new Ranking();
$process = new Process();
$id = $_POST['id'];
$name = $_POST['name'];
$acc = $_POST['acc'];
if(array_key_exists('keep', $_POST)){
$keep = '1';
} else {
$keep = '0';
}
if(is_numeric($id)){
if($software->issetSoftware($id, $_SESSION['id'],'VPC')){
if(is_numeric($acc)){
$accInfo = $finances->bankAccountInfo($acc);
if ($accInfo['0']['exists'] == '0') {
$error = 'INVALID_ACC';
die($error);
} elseif ($accInfo['0']['bankuser'] != $_SESSION['id']) {
$error = 'INVALID_ACC';
die($error);
}
$softInfo = $software->getSoftware($id, $_SESSION['id'], 'VPC');
$price = $software->research_calculatePrice($softInfo->softversion);
$infoStr = $acc.'/'.$keep.'/'.$price;
if($finances->totalMoney() >= $price){
if ($process->newProcess($_SESSION['id'], 'RESEARCH', '', 'local', $id, $name, $infoStr, '0')) {
$pid = $session->processID('show');
header("Location:processes?pid=$pid");
} else {
$pid = $session->processID('show');
$process->getProcessInfo($pid);
$process->showProcess();
}
} else {
die("Not enough money");
}
} else {
die("Invalid acc");
}
} else {
die("THis software doesnt exists");
}
} else {
die("Invalid ID");
}
} else {
header("Location:index.php");
}
?>