| @@ 1307-1333 (lines=27) @@ | ||
| 1304 | ||
| 1305 | // Attempt to register the site etc. |
|
| 1306 | $fp = @fsockopen('www.simplemachines.org', 80, $errno, $errstr); |
|
| 1307 | if ($fp) |
|
| 1308 | { |
|
| 1309 | $out = 'GET /smf/stats/register_stats.php?site=' . base64_encode($boardurl) . ' HTTP/1.1' . "\r\n"; |
|
| 1310 | $out .= 'Host: www.simplemachines.org' . "\r\n"; |
|
| 1311 | $out .= 'Connection: Close' . "\r\n\r\n"; |
|
| 1312 | fwrite($fp, $out); |
|
| 1313 | ||
| 1314 | $return_data = ''; |
|
| 1315 | while (!feof($fp)) |
|
| 1316 | $return_data .= fgets($fp, 128); |
|
| 1317 | ||
| 1318 | fclose($fp); |
|
| 1319 | ||
| 1320 | // Get the unique site ID. |
|
| 1321 | preg_match('~SITE-ID:\s(\w{10})~', $return_data, $ID); |
|
| 1322 | ||
| 1323 | if (!empty($ID[1])) |
|
| 1324 | $smcFunc['db_insert']('replace', |
|
| 1325 | $db_prefix . 'settings', |
|
| 1326 | array('variable' => 'string', 'value' => 'string'), |
|
| 1327 | array( |
|
| 1328 | array('sm_stats_key', $ID[1]), |
|
| 1329 | array('enable_sm_stats', 1), |
|
| 1330 | ), |
|
| 1331 | array('variable') |
|
| 1332 | ); |
|
| 1333 | } |
|
| 1334 | } |
|
| 1335 | // Don't remove stat collection unless we unchecked the box for real, not from the loop. |
|
| 1336 | elseif (empty($_POST['stats']) && empty($upcontext['allow_sm_stats'])) |
|
| @@ 1081-1107 (lines=27) @@ | ||
| 1078 | { |
|
| 1079 | // Attempt to register the site etc. |
|
| 1080 | $fp = @fsockopen('www.simplemachines.org', 80, $errno, $errstr); |
|
| 1081 | if ($fp) |
|
| 1082 | { |
|
| 1083 | $out = 'GET /smf/stats/register_stats.php?site=' . base64_encode($boardurl) . ' HTTP/1.1' . "\r\n"; |
|
| 1084 | $out .= 'Host: www.simplemachines.org' . "\r\n"; |
|
| 1085 | $out .= 'Connection: Close' . "\r\n\r\n"; |
|
| 1086 | fwrite($fp, $out); |
|
| 1087 | ||
| 1088 | $return_data = ''; |
|
| 1089 | while (!feof($fp)) |
|
| 1090 | $return_data .= fgets($fp, 128); |
|
| 1091 | ||
| 1092 | fclose($fp); |
|
| 1093 | ||
| 1094 | // Get the unique site ID. |
|
| 1095 | preg_match('~SITE-ID:\s(\w{10})~', $return_data, $ID); |
|
| 1096 | ||
| 1097 | if (!empty($ID[1])) |
|
| 1098 | $smcFunc['db_insert']('replace', |
|
| 1099 | $db_prefix . 'settings', |
|
| 1100 | array('variable' => 'string', 'value' => 'string'), |
|
| 1101 | array( |
|
| 1102 | array('sm_stats_key', $ID[1]), |
|
| 1103 | array('enable_sm_stats', 1), |
|
| 1104 | ), |
|
| 1105 | array('variable') |
|
| 1106 | ); |
|
| 1107 | } |
|
| 1108 | } |
|
| 1109 | else |
|
| 1110 | { |
|