1
|
<?php
|
2
|
|
3
|
|
4
|
|
5
|
|
6
|
|
7
|
include_once("AbE_API.php");
|
8
|
$config = new AbE_General_Config();
|
9
|
|
10
|
|
11
|
function byteConvert($bytes)
|
12
|
{
|
13
|
if($bytes > 0) {
|
14
|
$s = array('o', 'Ko', 'Mo', 'Go', 'To', 'Po');
|
15
|
$e = @floor(log($bytes)/log(1000));
|
16
|
|
17
|
return sprintf('%.2f '.$s[$e], ($bytes/pow(1000, floor($e))));
|
18
|
}
|
19
|
else return 0;
|
20
|
}
|
21
|
|
22
|
$machine_info = gather_machine_info();
|
23
|
|
24
|
$dummy = exec("/sbin/ifconfig eth0 2>/dev/null | grep HWaddr | sed s/.*HWaddr//",$mac_eth0);
|
25
|
$dummy = exec("/sbin/ifconfig eth1 2>/dev/null | grep HWaddr | sed s/.*HWaddr//",$mac_eth1);
|
26
|
|
27
|
|
28
|
|
29
|
if(file_exists("/proc/ide/ide0/hda/model"))
|
30
|
$hdd0 = trim(@file_get_contents("/proc/ide/ide0/hda/model")) . " " . byteConvert((@file_get_contents("/proc/ide/ide0/hda/capacity")*512));
|
31
|
|
32
|
else if(file_exists("/sys/block/sda/device/model"))
|
33
|
$hdd0 = trim(@file_get_contents("/sys/block/sda/device/model")) . " " . byteConvert((@file_get_contents("/sys/block/sda/size")*512));
|
34
|
|
35
|
|
36
|
if(file_exists("/proc/ide/ide0/hdb/model"))
|
37
|
$hdd1 = trim(@file_get_contents("/proc/ide/ide0/hdb/model")) . " " . byteConvert((@file_get_contents("/proc/ide/ide0/hdb/capacity")*512));
|
38
|
else if(file_exists("/proc/ide/ide0/hdc/model"))
|
39
|
$hdd1 = trim(@file_get_contents("/proc/ide/ide0/hdc/model")) . " " . byteConvert((@file_get_contents("/proc/ide/ide0/hdc/capacity")*512));
|
40
|
|
41
|
else if(file_exists("/sys/block/sdb/device/model"))
|
42
|
$hdd1 = trim(@file_get_contents("/sys/block/sdb/device/model")) . " " . byteConvert((@file_get_contents("/sys/block/sdb/size")*512));
|
43
|
|
44
|
|
45
|
$m .= "pass=" . $_POST['pass'] . "&code=" . $_POST['code'] . "&";
|
46
|
$m .= "INAME=" . $installation_name . "&ITEL=" . $installation_phone . "&IEMAIL=" . $installation_email . "&IADDRESS0=" . $installation_address0 .
|
47
|
"&IADDRESS1=" . $installation_address1 . "&ICITY=" . $installation_city . "&IPOSTALCODE=" . $installation_postalcode . "&ICOUNTRY=" . $installation_country .
|
48
|
"&ICOMMENT=" . $installation_comment .
|
49
|
"&ADM_LASTNAME=" . $installation_adm_lastname . "&ADM_FIRSTNAME=" . $installation_adm_firstname . "&ADM_EMAIL=" . $installation_adm_email .
|
50
|
"&PR_LASTNAME=" . $installation_pr_lastname . "&PR_FIRSTNAME=" . $installation_pr_firstname . "&PR_EMAIL=" . $installation_pr_email .
|
51
|
"&ATICE_LASTNAME=" . $installation_atice_lastname . "&ATICE_FIRSTNAME=" . $installation_atice_firstname . "&ATICE_EMAIL=" . $installation_atice_email .
|
52
|
"&MAC0=" . trim(str_replace(":", "", $mac_eth0[0])) . "&MAC1=" . trim(str_replace(":", "", $mac_eth1[0])) .
|
53
|
"&CPU=" . trim($machine_info["nbcpu"]) . " x " . trim($machine_info["cpu"]) . "&RAM=" . $machine_info["mem"] . "&HDD0=" . $hdd0 . "&HDD1=" . $hdd1;
|
54
|
|
55
|
$m .= "&MINIWEBADMIN=1";
|
56
|
|
57
|
|
58
|
$m .= "&RCODE=" . $config->GetValue("RVD_CODE") . "&RNAME=" . $config->GetValue("RVD_NAME") . "&RTEL=" . $config->GetValue("RVD_PHONE") . "&REMAIL=" . $config->GetValue("RVD_EMAIL");
|
59
|
$m .= "&RADDRESS=" . $config->GetValue("RVD_ADDRESS") . "&RCP=" . $config->GetValue("RVD_CP") . "&RVILLE=" . $config->GetValue("RVD_CITY");
|
60
|
|
61
|
|
62
|
$m .= "&IROOT=" . $config->GetValue("ROOT") . "&IABE=" . $config->GetValue("ABULADMIN") . "&ISRV=" . $config->GetValue("SERVER") . "&ISERIAL=" . $config->GetValue("NUMSERIE") . "&IDATE=" . $config->GetValue("DATE");
|
63
|
|
64
|
|
65
|
$m .= "&";
|
66
|
|
67
|
$data = base64_encode("$m");
|
68
|
|
69
|
|
70
|
|
71
|
|
72
|
$path = "/epack/register/";
|
73
|
$host = "www.abuledu.net";
|
74
|
$proxyHost = "192.168.128.65";
|
75
|
$proxyPort = 3128;
|
76
|
$referer = "servecole.miniwebadmin.11.04.0";
|
77
|
|
78
|
if($fp = fsockopen($proxyHost, $proxyPort)) {
|
79
|
|
80
|
|
81
|
fputs($fp, "POST http://$host$path HTTP/1.1\r\n");
|
82
|
fputs($fp, "Host: $host\r\n");
|
83
|
fputs($fp, "Referer: $referer\r\n");
|
84
|
fputs($fp, "Content-type: application/x-www-form-urlencoded\r\n");
|
85
|
fputs($fp, "Content-length: ". strlen($m) ."\r\n");
|
86
|
fputs($fp, "Connection: close\r\n\r\n");
|
87
|
fputs($fp, $m);
|
88
|
$result = '';
|
89
|
while(!feof($fp)) {
|
90
|
|
91
|
$result .= fgets($fp, 128);
|
92
|
}
|
93
|
|
94
|
fclose($fp);
|
95
|
}
|
96
|
|
97
|
$result = explode("\r\n\r\n", $result, 2);
|
98
|
$header = isset($result[0]) ? $result[0] : '';
|
99
|
$content = isset($result[1]) ? $result[1] : '';
|
100
|
|
101
|
|
102
|
$new = unserialize($content);
|
103
|
|
104
|
fichier_script($new['command'],"register");
|
105
|
print $new['message'];
|
106
|
|
107
|
|
108
|
|
109
|
|
110
|
|
111
|
|
112
|
|
113
|
|
114
|
?>
|