I am trying to reuse a function on a new site that works perfectly on one of my others but not on the new one. On the index.php page, there is some code that saves a couple values as sessions:
So, for example, the sessions might contain:
PrintVersionPath = localhost/index.php?TabID=6
PrintVersionParam = ?TabID=6
Then the function itself, which is on a print_page.php script, grabs these values and should open the same database entry, but it is breaking on the implode() function so clearly it is not getting the page data from these values. I did not write the function so I do not fully understand how it works but here it is:
Of course there's other code to bring it to the screen but the issue seems to be in the function itself which, as I said, works perfectly on another site.
I already tried:
to give the session values:
PrintVersionPath = localhost
PrintVersionParam = /index.php?TabID=6
then removing the explode() and implode functions and it no longer gives errors but neither does it bring up the page. Does anyone see a solution as to what's wrong?
Don
Experienced in HTML, Perl, PHP, VBScript, PWS, IIS and Apache and MS-Access, MS-SQL, MySQL databases
Code:
$ServerName = $_SERVER['SERVER_NAME'];
$ScriptName = $_SERVER['SCRIPT_NAME'];
$QueryString = "?TabID=6";
$_SESSION['PrintVersionPath'] = $ServerName . $ScriptName . $QueryString;
$_SESSION['PrintVersionParam'] = $QueryString;
PrintVersionPath = localhost/index.php?TabID=6
PrintVersionParam = ?TabID=6
Then the function itself, which is on a print_page.php script, grabs these values and should open the same database entry, but it is breaking on the implode() function so clearly it is not getting the page data from these values. I did not write the function so I do not fully understand how it works but here it is:
Code:
function getFile($host, $query) {
$path=explode('/',$host);
$host=$path[0];
unset($path[0]);
$path = $host;
$path='/'.(implode('/',$path));
$post="POST $path HTTP/1.1\r\nHost: $host\r\nContent-type: application/x-[URL unfurl="true"]www-form-urlencoded\r\nUser-Agent:[/URL] Mozilla 4.0\r\nContent-length: ".strlen($query)."\r\nConnection: close\r\n\r\n$query";
$h=fsockopen($host,80);
fwrite($h,$post);
for($a=0,$r='';!$a;){
$b=fread($h,8192);
$r.=$b;
$a=(($b=='')?1:0);
}
fclose($h);
return $r;
}
I already tried:
Code:
$ServerName = $_SERVER['SERVER_NAME'];
$ScriptName = $_SERVER['SCRIPT_NAME'];
$QueryString = "?".CCGetQueryString("All", "");
$_SESSION['PrintVersionPath'] = $ServerName;
$_SESSION['PrintVersionParam'] = $ScriptName . $QueryString;
PrintVersionPath = localhost
PrintVersionParam = /index.php?TabID=6
then removing the explode() and implode functions and it no longer gives errors but neither does it bring up the page. Does anyone see a solution as to what's wrong?
Don
Experienced in HTML, Perl, PHP, VBScript, PWS, IIS and Apache and MS-Access, MS-SQL, MySQL databases