One thing that you could do is embed one page into another page. Even though they are different languages, you can still do that and pass variables. I did this with one PHP script that I did not want to rewrite in ASP. I used an Window's XHTML control to embed the PHP page. Variables collected on the ASP page (some via the query string) are passed to the PHP page.
<% Function GetHTML(strPage) On Error Resume Next Set objXMLHttp = Server.CreateObject ("Microsoft.XMLHTTP") objXMLHttp.Open "GET", strPage ,False,"","" objXMLHttp.Send If Err.Number = 0 Then If objXMLHttp.Status = 200 then GetHTML = objXMLHttp.ResponseText Else GetHTML = "Incorrect URL" End if Else GetHTML = Err.Description End If Set objXMLHttp = Nothing End Function
' write the results to our page by calling the function above Response.Write GetHTML("http://www.example.com/amazon/amazon.php?locale=" & locale & "&mode=" & mode & "&search=" & search & "&associates_id=myid-20&page=" & page & "&dir=" & dir & "")
%>
|
Note: I entered some hard returns in the Response.Write statement so you wouldn't have to scroll sideways. Everything between Response.Write and "") should be on the same line.
If you are wondering why I did this, its because I use site-wide ASP include files, some of them data-driven and I didn't want to rewrite working code. So I basically wrapped the ASP page around a PHP page, and then modified the PHP page to refer to the ASP page in all the links, instead of the PHP page.
In this example, I was not concerned with whether or not someone found the PHP script. It would basically serve the same content regardless, it would just be missing the header and footer of my website.
PHP has a similar function that can be used to include HTML (including ASP) pages. The PHP function, is much shorter, if I remember correctly.
Although I haven't tried this, you may be able to check who is calling the script and deny access if its not coming from the embedded page. You could probably do this by checking the referrer.
I know that when I embedded an ASP include in an ASP.NET page, the referred was listed as the calling page. It may be the same with PHP and ASP. If so, you can check to see if the referrer matches the page that the script is supposed to be embedded in, and refuse to run if called directly or from any other page.