--- a/details.php Wed Jun 16 13:28:45 2010 +0100
+++ b/details.php Fri Jun 18 15:36:31 2010 +0000
@@ -44,31 +44,6 @@
}
-/* if ($currID == "")
- {
- $currID = "1";
-echo $currID;
- }
-*/
-/* if ($currID == "")
- {
- $currID = 1;
- $mysql = new mysqli("localhost", "www-data", "www-data", "members");
- # $result = $mysql->query("SELECT sid, sid_dir FROM sessions WHERE ((uid = '$currID' or uid = 1) AND (expiration_date = DATE_ADD(NOW(), INTERVAL 24 HOUR)))");
-$result = $mysql->query("SELECT sid, sid_dir FROM sessions WHERE ((uid = '$currID' or uid = 1) AND (expiration_date = DATE_ADD(NOW(), INTERVAL 24 HOUR)))");
- $row = $result->fetch_assoc();
- $tsid1 = $row["sid"];
- $tsid2 = $row["sid_dir"];
- $result->close();
-
-
- }
-*/
- // read session IDs from cookie, if cookie doesn't exist, set to 06D5VlLQTbM57LL7IBMW38yHkFpb1XVa (master)
-
-
-
-//echo $_COOKIE["sid1"];
$currSID2 = $_COOKIE['sid2'];
$sid2 = $currSID2;
if (!isset($_COOKIE['sid2']))
@@ -77,30 +52,6 @@
// $sid2 = '06D5VlLQTbM57LL7IBMW38yHkFpb1XVa';
$currSID2 = $sid2;
}
-/*echo $uid;
-echo $sid1;
-echo $sid2;
-echo $enum;
-*/
-/*
- if ($currSID1 == "")
- {
- $currSID1 = "06D5VlLQTbM57LL7IBMW38yHkFpb1XVa";
-// $currSID1 = $tsid1;
-
-echo $currSID1;
-
- }
-
- $currSID2 = $_COOKIE['sid2'];
- if ($currSID2 == "")
- {
- $currSID2 = "06D5VlLQTbM57LL7IBMW38yHkFpb1XVa";
-// $currSID2 = $tsid2;
-echo $currSID2;
- }
-*/
-#print_r($_COOKIE);
$status = $_GET['alert'];
$view_mode = $_GET['view_mode'];
@@ -122,23 +73,15 @@
else
{
$query_cache = mysql_query("SELECT * FROM requests_tbl WHERE (uid = 1)");
- while ($db_fieldcache = mysql_fetch_assoc($query_cache))
+ }
+ /* while ($db_fieldcache = mysql_fetch_assoc($query_cache))
{
- // send command to squid and return value
- # $command2 = "squidclient -m HEAD -p 8080 -H \"Cache-Control: only-if-cached\n\" -u " . $db_fieldcache["req_ID"] . " -w " . $db_fieldcache["uid"] . " " . $db_fieldcache["req_val"] . " |grep X-Cache: |grep MISS";
-# $command2 = "squidclient -m HEAD -p 8080" . $db_fieldcache["req_val"] . " |grep X-Cache: |grep MISS";
-// $command2 = "squidclient -m HEAD -p 8080 -u {$db_fieldcache["req_ID"]} -w $currSID1 http://localhost/router_stage/{$db_fieldcache["req_ID"]}/$strip_url_val/ |grep X-Cache: |grep MISS";
- $curr_reqID = $db_fieldcache["req_ID"];
-# $http_proxy = "http://localhost:8080";
-# $staging = "/var/www/private/HTMLrequester/staging/";
-# $wget_options = " --delete-after -N -r -l 3 --no-remove-listing -p --max-redirect 10 -t 1 -d";
-# $strip_url_val = remove_http($db_fieldcache['req_val']);
-# $command1 = "wget -P $staging $wget_options http://localhost/router_stage/{$db_fieldcache["req_ID"]}/$strip_url_val/ . '?' . 'uid=' . $uid . '&' . 'sid1=' . $sid1 . '&' . 'sid2=' . $sid2";
-# exec($command1, $wget_results);
-
-$http_proxy = "http://localhost:8080";
- $command2 = "squidclient -m HEAD -p 8080 -u www-data -w www-data http://localhost/router_stage/{$db_fieldcache["req_ID"]}/$strip_url_val/?uid=$uid'&'sid1=$sid1'&'sid2=$sid2 |grep X-Cache: |grep MISS";
- exec($command2, $cache_results);
+ $curr_reqID = $db_fieldcache["req_ID"];
+ $strip_url_val = remove_http($db_fieldcache['req_val']);
+ $http_proxy = "http://localhost:8080";
+ $command2 = "squidclient -m HEAD -p 8080 -u www-data -w www-data http://localhost/router_stage/{$db_fieldcache["req_ID"]}/$strip_url_val/?uid=$uid'&'sid1=$sid1'&'sid2=$sid2 |grep MISS |awk -F \" \" '{print $2}'";
+ exec($command2, $cache_results);
+ echo $cache_results;
// find out if site is available and update the database
if (strpos($cache_results, "HIT") == true)
{
@@ -150,20 +93,8 @@
if (file_exists($filename))
{
$query_update = mysql_query("UPDATE responses_tbl SET req_response = '0' WHERE req_ID = '$curr_reqID'");
- # $http_proxy = "http://localhost:8080";
- # $http_proxy = "http://localhost:8080";
- $staging = "/var/www/private/HTMLrequester/staging/";
- # $wget_options = "--dns-timeout=1 --proxy-user=www-data --proxy-password=www-data --cache=off -N -r -l 3 --no-remove-listing -p --max-redirect 10 -t 1 -d -I http://localhost/router_stage/{$db_fieldcache["req_ID"]}/$strip_url_val/ -X http://localhost/router_stage/{$db_fieldcache["req_ID"]}/";
- #$wget_options = "--dns-timeout=1 --proxy-user=www-data --proxy-password=www-data -N -r -l 3 --no-remove-listing -p --max-redirect 10 -t 1 -d -I http://localhost/router_stage/{$db_fieldcache["req_ID"]}/$strip_url_val/ -X http://localhost/router_stage/{$db_fieldcache["req_ID"]}/";
- #$wget_options = "--no-cache --dns-timeout=1 --proxy-user=www-data --proxy-password=www-data -N -r -l 3 --no-remove-listing -p --max-redirect 10 -t 1 -d -I http://localhost/router_stage/{$db_fieldcache["req_ID"]}/$strip_url_val/ -X http://localhost/router_stage/{$db_fieldcache["req_ID"]}/ http://localhost/router_stage/{$db_fieldcache["req_ID"]}/$strip_url_val/";
+ $staging = "/data/www/private/HTMLrequester/staging/";
$wget_options = "--dns-timeout=1 --proxy-user=www-data --proxy-password=www-data -N -r -l 3 --no-remove-listing -p --max-redirect 10 -t 1 -d";
-
-
-
- $strip_url_val = remove_http($db_fieldcache['req_val']);
- # $command1 = "wget -P $staging $wget_options http://localhost/router_stage/{$db_fieldcache["req_ID"]}/$strip_url_val/?uid=$uid'&'sid1=$sid1'&'sid2=$sid2";
- # exec($command1, $wget_results);
-
$command1 = "wget -P $staging $wget_options http://localhost/router_stage/{$db_fieldcache["req_ID"]}/$strip_url_val/?uid=$uid'&'sid1=$sid1'&'sid2=$sid2";
exec($command1, $wget_results);
}
@@ -175,11 +106,11 @@
}
}
-
+*/
while ($db_fieldcache = mysql_fetch_assoc($query_cache))
{
$curr_reqID = $db_fieldcache["req_ID"];
- $filename = "/var/www/private/HTMLrequester/router_stage/{$db_fieldcache["req_ID"]}/";
+ $filename = "/data/www/private/HTMLrequester/router_stage/{$db_fieldcache["req_ID"]}/";
if (file_exists($filename))
{
$query_update = mysql_query("UPDATE requests_tbl SET req_response = '1' WHERE req_ID = '$curr_reqID'");