diff options
| author | Cassio de Campos <cassiopc@gmail.com> | 2017-08-01 07:22:00 +0000 |
|---|---|---|
| committer | Cassio de Campos <cassiopc@gmail.com> | 2017-08-01 07:22:00 +0000 |
| commit | e1b61094597488dcb3ef166013186b07bf379d76 (patch) | |
| tree | f01e30e7bfd717cb50cd889e0819f8624c6df59d /src/fextdata.php | |
| parent | 60c43eb105b192456f6b14e46055a9dc717ffb55 (diff) | |
| download | boca-e1b61094597488dcb3ef166013186b07bf379d76.tar.gz boca-e1b61094597488dcb3ef166013186b07bf379d76.zip | |
timeout and sanitizing
Diffstat (limited to 'src/fextdata.php')
| -rw-r--r-- | src/fextdata.php | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/src/fextdata.php b/src/fextdata.php index c3a5c3b..4158dda 100644 --- a/src/fextdata.php +++ b/src/fextdata.php @@ -63,7 +63,10 @@ $superlfile = $privatedir . $ds . "score_localsite_" . $localsite . "_x.dat"; if(substr($siteurl,strlen($siteurl)-1,1) == '/') $urldiv = ''; // LOGError("url=" .$siteurl . $urldiv . "index.php?getsessionid=1"); - $sess = @file_get_contents($siteurl . $urldiv . "index.php?getsessionid=1"); + $opts = array(); + $opts['http']['timeout'] = 5; + $context = stream_context_create($opts); + $sess = @file_get_contents($siteurl . $urldiv . "index.php?getsessionid=1", 0, $context); // LOGError("sess=$sess pass=" . trim($sitedata[2]) . " hash=" . myhash(trim($sitedata[2]))); $user = trim($sitedata[1]); $res = myhash( myhash (trim($sitedata[2])) . $sess); @@ -79,10 +82,9 @@ $superlfile = $privatedir . $ds . "score_localsite_" . $localsite . "_x.dat"; $opts['http']['proxy'] = $bocaproxy; if($bocaproxypass != "") $opts['http']['header'] .= "\r\nProxy-Authorization: Basic " . $bocaproxypass; - + $opts['http']['timeout'] = 5; $context = stream_context_create($opts); - $ok = @file_get_contents($siteurl . $urldiv . "index.php?name=${user}&password=${res}&action=transfer", 0, $context); // LOGError("ok=" . $ok); if(substr($ok,strlen($ok)-strlen('TRANSFER OK'),strlen('TRANSFER OK')) == 'TRANSFER OK') { @@ -134,7 +136,7 @@ $superlfile = $privatedir . $ds . "score_localsite_" . $localsite . "_x.dat"; $opts['http']['proxy'] = $bocaproxy; if($bocaproxypass != "") $opts['http']['header'] .= "\r\nProxy-Authorization: Basic " . $bocaproxypass; - + $opts['http']['timeout'] = 5; $context = stream_context_create($opts); $s = @file_get_contents($siteurl . $urldiv . "site/putfile.php", 0, $context); if(strpos($s,'SCORE UPLOADED OK') !== false) @@ -159,7 +161,7 @@ $superlfile = $privatedir . $ds . "score_localsite_" . $localsite . "_x.dat"; $opts['http']['proxy'] = $bocaproxy; if($bocaproxypass != "") $opts['http']['header'] .= "\r\nProxy-Authorization: Basic " . $bocaproxypass; - + $opts['http']['timeout'] = 5; $context = stream_context_create($opts); $s = @file_get_contents($siteurl . $urldiv . "site/putfilesuper.php", 0, $context); if(strpos($s,'SCORE UPLOADED OK') !== false) @@ -225,7 +227,10 @@ function getMainXML() { if(substr($siteurl,strlen($siteurl)-1,1) == '/') $urldiv = ''; // LOGError("url=" .$siteurl . $urldiv . "index.php?getsessionid=1"); - $sess = @file_get_contents($siteurl . $urldiv . "index.php?getsessionid=1"); + $opts = array(); + $opts['http']['timeout'] = 5; + $context = stream_context_create($opts); + $sess = @file_get_contents($siteurl . $urldiv . "index.php?getsessionid=1", 0, $context); // LOGError("sess=$sess pass=" . trim($sitedata[2]) . " hash=" . myhash(trim($sitedata[2]))); $user = trim($sitedata[1]); $res = myhash( myhash (trim($sitedata[2])) . $sess); @@ -240,7 +245,7 @@ function getMainXML() { $opts['http']['proxy'] = $bocaproxy; if($bocaproxypass != "") $opts['http']['header'] .= "\r\nProxy-Authorization: Basic " . $bocaproxypass; - + $opts['http']['timeout'] = 5; $context = stream_context_create($opts); $ok = @file_get_contents($siteurl . $urldiv . "index.php?name=${user}&password=${res}&action=transfer", 0, $context); $ti = mytime(); @@ -264,7 +269,7 @@ function getMainXML() { $opts['http']['proxy'] = $bocaproxy; if($bocaproxypass != "") $opts['http']['header'] .= "\r\nProxy-Authorization: Basic " . $bocaproxypass; - + $opts['http']['timeout'] = 5; $context = stream_context_create($opts); $s = @file_get_contents($siteurl . $urldiv . "site/getsite.php", 0, $context); if(strpos($s,'<OK>') !== false) |