Search CanProVar data
Protein/Gene Cancer Type Protein list Chromosome location Pathway
/*
Will use a file to keep the counts of the local and remote users
The files are called local_users.txt and remote_users.txt
When a user hits the page the ip address is checked against
the local subdomains.
Then the correct file is opened and the count pulled from the file
and incremented and then overwirte the same file with the new count
and the latest date.
Really do not find a need to keep this in a dbase.
*/
$local_sub_domain_one = "129.59";
$local_sub_domain_two = "160.129";
$local_sub_domain_three = "10.151";
$local_sub_domain_four = "10.0";
// grab the users IP address
if (@$_SERVER['HTTP_X_FORWARD_FOR']=="") {
$ip = $_SERVER['REMOTE_ADDR'];
} else {
$ip = $_SERVER['HTTP_X_FORWARD_FOR'];
}
// get the octets of the IP
@list($first_octet, $second_octet, $third_octet, $fourth_octet) = explode(".", $ip);
// This is the users subdomain we want to know if from Vanderbilt or remote
$subdomain = $first_octet;
$subdomain .= ".";
$subdomain .= $second_octet;
// If local subdomain print to local_users.txt else print to remote_users.txt
// this if statement is one line
// open the file and read the count into a variable trim it and increment it. Close this file and reopen the same file and write
// which overwirtes the same file with the new count with the latest date.
if ((strstr($subdomain, $local_sub_domain_one)) || (strstr($subdomain, $local_sub_domain_two)) || (strstr($subdomain, $local_sub_domain_three))|| (strstr($subdomain, $local_sub_domain_four))){
$fp = fopen("./stats/local_users.txt", "r") or exit("Unable to open file for read");
$count = fgets($fp);
$count = trim($count);
$time = @date("m\/d\/y"); // IMPORTANT Those are not Vs they are escape(backslash)/ (\ /) "m \ /d\ / but no space in code
fclose($fp);
$count++;
$fp = fopen("./stats/local_users.txt", "w") or exit("Unable to open file for write");
fwrite($fp, $count);
fwrite($fp, "\n");
fwrite($fp, $time);
fclose($fp);
}
else
{
$fp = fopen("./stats/remote_users.txt", "r") or exit("Unable to open file for read");
$count = fgets($fp);
$count = trim($count);
$time = @date("m\/d\/y"); // Again those are not Vs escape(using backslash) forward slash
fclose($fp);
$count++;
$fp = fopen("./stats/remote_users.txt", "w") or exit("Unable to open file for write");
fwrite($fp, $count);
fwrite($fp, "\n");
fwrite($fp, $time);
fclose($fp);
}
?>
@2015 Menghuan Zhang, Bing Zhang, Jing Li
|