Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Update submission of server information

  • Loading branch information...
commit f85e80bfa612062d830ab98b4ebcc01b3729aa15 1 parent 2f40cb9
@haraldpdl haraldpdl authored
View
4 catalog/admin/includes/functions/general.php
@@ -856,10 +856,10 @@ function tep_get_system_information($anonymous = false) {
'extensions' => get_loaded_extensions());
// If we need anonymous data we need to remove some data which could
- // potentially be used to identify a particular installation. A SHA1 hash
+ // potentially be used to identify a particular installation. An MD5 hash
// is used purely to identify duplicate submissions
if ($anonymous === true) {
- $data['system']['host'] = sha1($data['system']['host'] . $data['system']['ip']);
+ $data['system']['host'] = md5($data['system']['ip']);
$data['system']['ip'] = '0.0.0.0';
$data['system']['uptime'] = '0';
View
41 catalog/admin/server_info.php
@@ -18,44 +18,57 @@
case 'export':
$info = tep_get_system_information(true);
break;
+
case 'submit':
- $info = tep_get_system_information(true);
- $encoded = base64_encode(serialize($info));
- $target = '';
+ $target_host = 'www.oscommerce.com';
+ $target_path = '/usage_info.php';
+
+ $encoded = base64_encode(serialize(tep_get_system_information(true)));
+
$response = false;
+
if (function_exists('curl_init')) {
- $data = array('stats' => $encoded);
+ $data = array('info' => $encoded);
+
$ch = curl_init();
- curl_setopt($ch, CURLOPT_URL, $target);
+ curl_setopt($ch, CURLOPT_URL, 'http://' . $target_host . $target_path);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$response = trim(curl_exec($ch));
curl_close($ch);
} else {
- if ($fp = @fsockopen('', 80, $errno, $errstr, 30)) {
- $data = 'stats=' . $encoded;
- fputs($fp, "POST HTTP/1.1\r\n");
- fputs($fp, "Host: \r\n");
+ if ($fp = @fsockopen($target_host, 80, $errno, $errstr, 30)) {
+ $data = 'info=' . $encoded;
+
+ fputs($fp, "POST " . $target_path . " HTTP/1.1\r\n");
+ fputs($fp, "Host: " . $target_host . "\r\n");
fputs($fp, "Content-type: application/x-www-form-urlencoded\r\n");
- fputs($fp, "Content-length: ".strlen($data)."\r\n");
+ fputs($fp, "Content-length: " . strlen($data) . "\r\n");
fputs($fp, "Connection: close\r\n\r\n");
fputs($fp, $data."\r\n\r\n");
- while(!feof($fp)) {
- $response .= fgets($fp,4096);
+
+ $response = '';
+
+ while (!feof($fp)) {
+ $response .= fgets($fp, 4096);
}
+
fclose($fp);
+
+ $response = trim(substr($response, strrpos($response, "\r\n\r\n")));
}
}
-
- if (!$response) {
+ if ($response != 'OK') {
$messageStack->add_session(ERROR_INFO_SUBMIT, 'error');
} else {
$messageStack->add_session(SUCCESS_INFO_SUBMIT, 'success');
}
+
tep_redirect(tep_href_link(FILENAME_SERVER_INFO));
break;
+
case 'save':
$info = tep_get_system_information(true);
$info_file = 'server_info-' . date('YmdHis') . '.txt';
Please sign in to comment.
Something went wrong with that request. Please try again.