function parse($host,$port) { global $now; /////////////////////////////////////////////////////////////////////// // // Map Parse Engine // // // Read params // $next = time() + (30 * 60); // 30 mins, so we don't get stuck $DbLink = new DB; $DbLink->query("UPDATE ".C_STATS_REGIONS_TBL." set lastcheck = ".$next." " . " where serverIP = '" . mysql_escape_string($host) . "' AND ". "serverPort = '" . mysql_escape_string($port) . "'"); $buildurl = $host.":".$port."/simstatusx/"; // Grabbing the version from the region $statusdata = GetURL($buildurl); $status = json_decode($statusdata, true); $version = $status["Version"]; $opensim = trim($version); // Count the length of the returning string $length = strlen($opensim); if ($length > 2) { $DbLink->query("UPDATE ".C_STATS_REGIONS_TBL." set version = '".$opensim."'" . " where serverIP = '" . mysql_escape_string($host) . "' AND ". "serverPort = '" . mysql_escape_string($port) . "'"); } else { $DbLink->query("UPDATE ".C_STATS_REGIONS_TBL." set version = 'Unknown'" . " where serverIP = '" . mysql_escape_string($host) . "' AND ". "serverPort = '" . mysql_escape_string($port) . "'"); } }
function CheckHost($hostname, $port) { global $now; $xml = GetURL($hostname, $port, "?method=collector"); if ($xml == "") { //No data was retrieved? (CURL may have timed out) $failcounter = "failcounter + 1"; } else { $failcounter = "0"; } //Update nextcheck to be 10 minutes from now. The current OS instance //won't be checked again until at least this much time has gone by. $next = $now + 600; mysql_query("UPDATE hostsregister SET nextcheck = {$next}," . " checked = 1, failcounter = " . $failcounter . " WHERE host = '" . mysql_real_escape_string($hostname) . "'" . " AND port = '" . mysql_real_escape_string($port) . "'"); if ($xml != "") { parse($hostname, $port, $xml); } }
<?php define('IN_PHPBB', true); define('OR911_INFO', true); $phpbb_root_path = '/home/oregon911/oregon911.net/discussion/'; $phpEx = substr(strrchr(__FILE__, '.'), 1); require_once $phpbb_root_path . 'common.' . $phpEx; // Start session management $user->session_begin(); $auth->acl($user->data); if ($user->data['username'] == 'Anonymous' or $user->data['is_bot']) { header("location: http://cad.oregon911.net/login?redirect=" . urlencode(GetURL())); } function GetURL() { $protocol = strpos(strtolower($_SERVER['SERVER_PROTOCOL']), 'https') === FALSE ? 'http' : 'https'; $host = $_SERVER['HTTP_HOST']; $script = $_SERVER['SCRIPT_NAME']; $params = $_SERVER['QUERY_STRING']; $currentUrl = $protocol . '://' . $host . $script . '?' . $params; return $currentUrl; }
* - Copy this file under Samples/ * - It will use Samples/config.php * * - Configure following values : * YOUR PUSH_URL * YOUR OAUTH_ACCESS_TOKEN * YOUR OAUTH_ACCESS_TOKEN_SECRET */ define('PUSH_URL', 'https://etwspush.etrade.com/apistream/cometd/oauth/'); define('OAUTH_ACCESS_TOKEN', 'your token'); define('OAUTH_ACCESS_TOKEN_SECRET', 'your secret'); require_once "config.php"; require_once dirname(__FILE__) . '/../Common/Common.php'; $consumer = new etOAuthConsumer(ETWS_APP_KEY, ETWS_APP_SECRET); $consumer->oauth_token = OAUTH_ACCESS_TOKEN; // YOUR ACCESS TOKEN $consumer->oauth_token_secret = OAUTH_ACCESS_TOKEN_SECRET; // YOUR ACCESS TOKEN. $method = 'POST'; $etHttpObj = new etHttpUtils($consumer, GetURL(URL_ACCOUNTLIST), true, $method); $token_obj = new OAuthToken($consumer->oauth_token, $consumer->oauth_token_secret); $request_obj = OAuthRequest::from_consumer_and_token($consumer, $token_obj, $method, PUSH_URL, array()); $sig_method = new OAuthSignatureMethod_HMAC_SHA1(); $request_obj->sign_request($sig_method, $consumer, $token_obj); $header_str = $request_obj->to_header(); echo "\n----headers---------\n"; print_r($header_str); echo "\n--------------------\n"; $etHttpObj = new etHttpUtils($consumer, PUSH_URL, true, $method); $etHttpObj->GetResponse(); print_r($etHttpObj);
function ProcessReturnToForm($s_url, $a_values, $a_strip = array()) { global $php_errormsg; // // read the original form, and modify it to provide values // for the fields // if (!CheckValidURL($s_url)) { Error("invalid_url", GetMessage(MSG_RETURN_URL_INVALID, array("URL" => $s_url)), false, false); } $s_form_url = AddUserAgent($s_url); $s_error = ""; $s_form_buf = GetURL($s_form_url, $s_error); if ($s_form_buf === false) { Error("invalid_url", GetMessage(MSG_OPEN_URL, array("URL" => $s_form_url, "ERROR" => $s_error . ": " . (isset($php_errormsg) ? $php_errormsg : ""))), false, false); } // // Next, we replace or set actual field values. // echo SetPreviousValues($s_form_buf, $a_values, $a_strip); }
} // // read the original form, and modify it to provide values // for the fields // $sFormURL = AddUserAgent(StripGPC($aGetVars["this_form"])); if (session_id() !== "") { $sFormURL = AddURLParam($sFormURL, "sessid=" . urlencode(session_id())); } if (defined("SID")) { $sFormURL = AddURLParam($sFormURL, SID); } // // Read the form into one big string buffer. // $sFormBuf = GetURL($sFormURL); if ($sFormBuf === false) { ReportError("Cannot open form URL: {$sFormURL}: {$php_errormsg}"); } // // For each field do some pattern matching and replacement. // // // first, uncheck any checkboxes and select options // $sFormBuf = UnCheckStuff($sFormBuf); foreach ($aDataArray as $sName => $sValue) { // $sName = StripGPC($sName); // probably not needed //$aDebug[] = "Name='$sName', type=".gettype($sValue); if (is_array($sValue)) { //
function parse($host,$port, $texture) { global $now; /////////////////////////////////////////////////////////////////////// // // Map Parse Engine // // // Read params // $next = time() + (30 * 60); // 30 mins, so we don't get stuck $DbLink = new DB; $DbLink->query("UPDATE ".C_MAP_REGIONS_TBL." set lastcheck = ".$next." " . " where serverIP = '" . mysql_escape_string($host) . "' AND ". "serverPort = '" . mysql_escape_string($port) . "' AND ". "regionMapTexture = '".mysql_escape_string($texture) ."'"); // Get the maptexture out $DbLink->query("SELECT regionMapTexture from ".C_MAP_REGIONS_TBL. " where serverIP = '" . mysql_escape_string($host) . "' AND ". "serverPort = '" . mysql_escape_string($port) . "' AND ". "regionMapTexture = '".mysql_escape_string($texture) ."'"); list($UUID) = $DbLink->next_record(); $UUID = str_replace("-", "", $UUID); $buildurl = $host.":".$port."/index.php?method=regionImage".$UUID; // Grabbing the map texure from the region $mapdata = GetURL($buildurl); $DbLink->query("SELECT locX, locY from ".C_MAP_REGIONS_TBL. " where serverIP = '" . mysql_escape_string($host) . "' AND ". "serverPort = '" . mysql_escape_string($port) . "' AND ". "regionMapTexture = '".mysql_escape_string($texture) ."'"); list($regionX,$regionY ) = $DbLink->next_record(); $fp = fopen("maptiles\mapimage-".$regionX."-".$regionY.".jpg", "w"); fwrite($fp, $mapdata); fclose($fp); }
function getQuery() { $Res = parse_url(GetURL()); return $Res['query']; }
$count = $db->sql_fetchrow($result); if ($_GET['request'] == "showall") { ?> <div id="calllog-all"> </div> <a href="<?php echo str_replace("&request=showall", "", GetURL()); ?> ">Show Less</a> <?php } else { ?> <div id="calllog"> </div> <?php if ($count['C'] >= 15) { ?> <a href="<?php echo GetURL() . '&request=showall'; ?> ">Show All</a> <?php } } ?> </details> <?php if (!$mobile) { ?> <details <?php echo $theme; ?> open=true>
function GetDataURLs($filename, $mod = null, $version = null, $which = -1) { $files = GetDataFiles($filename, $mod, $version, $which); if (is_array($files)) { if ($which < 0) { foreach ($files as $idx => $file) { $files[$idx] = GetURL($file); } return $files; } else { return GetURL($files[$which]); } } else { return GetURL($files); } }
function ProcessReturnToForm($s_url, $a_values) { global $aSubstituteErrors, $aSubstituteValues, $sSubstituteMissing; global $php_errormsg; // // read the original form, and modify it to provide values // for the fields // if (!CheckValidURL($s_url)) { Error("invalid_url", GetMessage(MSG_RETURN_URL_INVALID, array("URL" => $s_url)), false, false); } $s_form_url = AddUserAgent($s_url); $s_error = ""; $s_form_buf = GetURL($s_form_url, $s_error); if ($s_form_buf === false) { Error("invalid_url", GetMessage(MSG_OPEN_URL, array("URL" => $s_form_url, "ERROR" => $s_error . ": " . (isset($php_errormsg) ? $php_errormsg : ""))), false, false); } /***** This is not correct here, because this function is only called for non-template URLs. // // First, we do any "$var" substitutions // // // initialize the errors list // $aSubstituteErrors = array(); // // initialize the values // $aSubstituteValues = $a_values; $sSubstituteMissing = $s_missing; // // search for words in this form: // $word // where word begins with an alphabetic character and // consists of alphanumeric and underscore // // $s_form_buf = preg_replace_callback('/\$([a-z][a-z0-9_]*)/i', // 'SubstituteValueForPage',$s_form_buf); // SendAlert("Error count=".count($aSubstituteErrors)); if (count($aSubstituteErrors) != 0) Error("template_failed", GetMessage(MSG_TEMPLATE_ERRORS,array("NAME"=>$s_template)). implode("\n",$aSubstituteErrors),false,false); ******/ // // Next, we replace or set actual field values. // echo SetPreviousValues($s_form_buf, $a_values); }
function GetURL($s_url, $n_depth = 0) { global $php_errormsg, $aDataArray, $FMBH_VERS; global $AUTHENTICATE, $AUTH_USER, $AUTH_PW; // // parse the URL to get the component parts // $a_parts = parse_url($s_url); // // must have a host // if (!isset($a_parts["host"])) { $php_errormsg = "URL parse failed"; return false; } $s_host_hdr = $a_parts["host"]; // // if no port number is given, we support http and https // if (!isset($a_parts["port"])) { if (!isset($a_parts["scheme"]) || strtolower($a_parts["scheme"]) == "http") { $a_parts["port"] = 80; } elseif (strtolower($a_parts["scheme"]) == "https") { $a_parts["port"] = 443; } else { $php_errormsg = "Unsupported URL scheme '" . $a_parts["scheme"] . "'"; return false; } } if ($a_parts["port"] == 443) { // // fsockopen requires ssl:// in the host name // $a_parts["host"] = "ssl://" . $a_parts["host"]; } // // default the path if empty // if (!isset($a_parts["path"]) || $a_parts["path"] === "") { $a_parts["path"] = "/"; } $f_sock = @fsockopen($a_parts["host"], (int) $a_parts["port"], $i_errno, $s_errstr, 30); if ($f_sock === false) { $php_errormsg = "Error {$i_errno}: {$s_errstr}: {$php_errormsg}"; return false; } $s_req = $a_parts["path"]; // // add the query to the path // Note that parse_url decodes the query string (urldecode), so // we need to split it into its component parameters // are re-encode their values. Calling urlencode($a_parts["query"]) // encodes the '=' between parameters and this breaks things. // if (isset($a_parts["query"])) { $a_params = explode('&', $a_parts["query"]); foreach ($a_params as $i_idx => $s_param) { if (($i_pos = strpos($s_param, "=")) === false) { $a_params[$i_idx] = urlencode($s_param); } else { $a_params[$i_idx] = substr($s_param, 0, $i_pos) . '=' . urlencode(substr($s_param, $i_pos + 1)); } } $s_req .= '?' . implode('&', $a_params); } // // add the fragment to the path. Note, however, this // won't actually make the user's browser jump to that // location (because we'd need to alter our current URL // and add the fragment to achieve that - we might // add that feature in a later version if we can // figure out how to do it!) // if (isset($a_parts["fragment"])) { $s_req .= '#' . urlencode($a_parts["fragment"]); } // // the GET request // fputs($f_sock, "GET " . $s_req . " HTTP/1.0\r\n"); // // Determine authentication requirements // if ($AUTHENTICATE !== "" || $AUTH_USER !== "" || $AUTH_PW !== "") { if ($AUTHENTICATE === "") { fputs($f_sock, "Authorization: Basic " . base64_encode("{$AUTH_USER}:{$AUTH_PW}") . "\r\n"); } else { fputs($f_sock, "Authorization: {$AUTHENTICATE}\r\n"); } } else { if (isset($a_parts["user"]) || isset($a_parts["pass"])) { $s_auth_user = isset($a_parts["user"]) ? $a_parts["user"] : ""; $s_auth_pass = isset($a_parts["pass"]) ? $a_parts["pass"] : ""; } else { $s_auth_type = isset($aDataArray["PHP_AUTH_TYPE"]) ? $aDataArray["PHP_AUTH_TYPE"] : ""; $s_auth_user = isset($aDataArray["PHP_AUTH_USER"]) ? $aDataArray["PHP_AUTH_USER"] : ""; $s_auth_pass = isset($aDataArray["PHP_AUTH_PW"]) ? $aDataArray["PHP_AUTH_PW"] : ""; } if (!isset($s_auth_type) || $s_auth_type === "") { $s_auth_type = "Basic"; } // // Add the authentication header // if ($s_auth_user !== "" || $s_auth_pass !== "") { fputs($f_sock, "Authorization: {$s_auth_type} " . base64_encode("{$s_auth_user}:{$s_auth_pass}") . "\r\n"); } } // // Specify the host name // fputs($f_sock, "Host: {$s_host_hdr}\r\n"); // // Specify the user agent // fputs($f_sock, "User-Agent: FMBadHandler/{$FMBH_VERS} (FormMail Bad Handler from www.tectite.com)\r\n"); // // Accept any output // fputs($f_sock, "Accept: */*\r\n"); // // End of request headers // fputs($f_sock, "\r\n"); // // Read and parse the response header // $i_http_code = 0; $s_status = ""; $s_location = ""; while (!feof($f_sock)) { $s_line = fgets($f_sock, 4096); if ($s_line == "\r\n" || $s_line == "\n") { break; } if (substr($s_line, 0, 4) == "HTTP") { $i_pos = strpos($s_line, " "); $s_status = substr($s_line, $i_pos + 1); $i_end_pos = strpos($s_status, " "); if ($i_end_pos === false) { $i_end_pos = strlen($s_status); } $i_http_code = (int) substr($s_status, 0, $i_end_pos); } if (strtolower(substr($s_line, 0, 9)) === "location:") { $s_location = trim(substr($s_line, 9)); } } if ($i_http_code < 200 || $i_http_code > 299) { fclose($f_sock); switch ($i_http_code) { case 300: // multiple choices (we'll take the first) // multiple choices (we'll take the first) case 301: // moved permanently // moved permanently case 302: // found // found case 303: // see other // see other case 307: // temporary redirect // // a "location" header must be present for us to continue // In the case of infinite redirects, we need to stop. // So, we limit to a maximum of 10 redirects. // if ($n_depth < 10) { if ($s_location !== "") { return GetURL($s_location, $n_depth + 1); } } // FALL THRU // FALL THRU default: $php_errormsg = "Failed: {$s_status}"; return false; } } // // read content into one big string buffer and return // $s_buf = ""; while (!feof($f_sock)) { $s_buf .= fread($f_sock, 1024); } fclose($f_sock); return $s_buf; }
$Head->AddStyleSheet('extensions/GuestSignIn/style.css'); $Panel->AddString('<div id="GuestSignIn"> <h2>' . $GuestSignIn_Title . '</h2> <p>' . $GuestSignIn_Message . '</p> <fieldset><form id="frmSignIn" method="post" action="' . GetUrl($Context->Configuration, 'people.php') . '"> <div> <input name="PostBackAction" value="SignIn" type="hidden" /> <input name="ReturnUrl" value="' . GetRequestUri() . '" type="hidden" /> <ul> <li><label for="txtUsername">' . $GuestSignIn_User . '</label> <input id="txtUsername" name="Username" value="" class="Input" maxlength="20" type="text" /> </li> <li><label for="txtPassword">' . $GuestSignIn_Pass . '</label> <input id="txtPassword" name="Password" value="" class="Input" type="password" /> </li> <li id="RememberMe"><label for="RememberMeID"> <input name="RememberMe" value="1" id="RememberMeID" type="checkbox" checked="checked" /> ' . $GuestSignIn_Remember . '</label> </li> </ul> <input name="btnSignIn" value="' . $GuestSignIn_Submit . '" class="Button" type="submit" /> </div></form></fieldset> <ul class="MembershipOptionLinks"> <li class="ForgotPasswordLink"><a href="' . GetUrl($Context->Configuration, 'people.php', '', '', '', '', 'PostBackAction=PasswordRequestForm') . '">' . $GuestSignIn_Forgot . '</a></li> <li class="ApplyForMembershipLink"><a href="' . GetURL($Context->Configuration, 'people.php', '', '', '', '', 'PostBackAction=ApplyForm') . '">' . $GuestSignIn_Apply . '</a></li> </ul></div>', 10); } else { if ($GuestSignIn_Welcome) { $Head->AddStyleSheet('extensions/GuestSignIn/style.css'); $Panel->Addstring('<div id="GuestSignIn">' . $GuestSignIn_Welcome . '</div>', 10); } }