Skip to content

Commit

Permalink
Some comments on what this is doing.
Browse files Browse the repository at this point in the history
  • Loading branch information
linickx committed May 31, 2011
1 parent 38dbae3 commit 7b9a401
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions php/go.php
Expand Up @@ -6,18 +6,18 @@
**/

if (isset($_GET['k'])) {
if (isset($_GET['k'])) { // Mandatory Component 1 - The clients secret salt.

$ClientSalt = $_GET['k'];
settype($ClientSalt, "string");
$ClientSalt = substr($ClientSalt,0,128); // Anti-Buffer-Overflow protection... maybe?
}

if (isset($_GET['dhcp'])) {
if (isset($_GET['dhcp'])) { // Optional Component - The clients IP Address

$dhcpPreference = $_GET['dhcp'];
settype($dhcpPreference, "integer");
settype($dhcpPreference, "integer"); // numbers only, 1 = on ... anything else = off.

if ($dhcpPreference = 1) {

Expand All @@ -35,17 +35,22 @@
}

if (!$DHCP) {
if (getenv(HTTP_X_FORWARDED_FOR)) {
$IP = getenv(HTTP_X_FORWARDED_FOR);
if (getenv(HTTP_X_FORWARDED_FOR)) { // Proxy Server Detection/
$IP = getenv(HTTP_X_FORWARDED_FOR); // Proxy
} else {
$IP = getenv(REMOTE_ADDR);
$IP = getenv(REMOTE_ADDR); // No Proxy.
}
}


// Mandatory Component 2 - The Clients User Agent String.
$UserAgent = getenv(HTTP_USER_AGENT);
$Numbers = array("1", "2", "3", "4", "5", "6", "7", "8", "9", "0");
$UserAgent = str_replace($Numbers, '', $UserAgent);
$UserAgent = str_replace($Numbers, '', $UserAgent); // We strip version numbers to produce the same results after upgrades.



// Output.
header("Content-Type: text/plain");

echo "$ClientSalt \n";
Expand Down

0 comments on commit 7b9a401

Please sign in to comment.