CodeCharge Studio
search Register Login  

Visual Web Reporting

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> PHP

 How to protect a generated static HTML page???

Print topic Send  topic

Author Message
teufel

Posts: 13
Posted: 07/15/2004, 2:59 PM

I came accross this problem after trying to generate a large output with no success. The page just broke before anything would start being received by the browser.

So I thought it had to do with timeout and I changed the php time limit (e.g. set_time_limit(6000);).

Well, I noticed that even then the page still did not bring anything, so that I decided to:

1) Instead of generating the output to the browser, I now write it to a file on my server.

2) The only output I generate is a link to that file.

Now it works, but......

I need the generated HTML page to be protected, i.e., to follow my standards as to which users may or may not see its contents.

So I tried writing a simple page inside CCS with just one label, and I fill this label with some predefined string (I will call this page the master page). So I have actually 3 files on my server named:

master.html
master.php
master_events.php

It is inside master_events.php that the label gets filled:

function Label_BeforeShow()  
{  
    $Label_BeforeShow = true;  
//End Label_BeforeShow  
  
//Custom Code @5-5014F291  
// -------------------------  
    global $Label;  
  
    $output = 'text_to_be_substituted';   
    $Label->SetValue($output);  
// -------------------------  
//End Custom Code  
  
//Close Label_BeforeShow @4-0A387B17  
    return $Label_BeforeShow;  
}  
//End Close Label_BeforeShow  


And then I just say that access to master.php is restricted according to my needs.

Now, when I generate my output file, instead of just generating the HTML output, what I do is to read from these 3 files, perform the necessary string substitutions and output 3 other files:

master_randomstring.html
master_randomstring.php
master_randomstring_events.php

And I generate a link to master_randomstring.php.

The greater difference would be inside master_randomstring_events.php, where I would have something like:

global $Label;  
  
    $output = '<p>Here comes all my HTML output, up to some MBytes.........</p>';   
    $Label->SetValue($output);

And now when I click over the link to master_randomstring.php the page breaks again....

Does this have to do with some PHP limitation (the size of a string expression which can be attributed to some variable, or passed as parameter to a function, etc...

Is there a simpler way to protect my output according to the permissions I want for the page???

Apparently Apache is not even generating an error log, which indicates that PHP is the one that is breaking the output....


Please HELP!!!!!!...
_________________
--teufel
View profile  Send private message
DonB
Posted: 07/15/2004, 7:43 PM

Take a look at the file_get_contents() function.:

In the Page Before Show event put this code.

echo file_get_contents("reallybigfile.html");

And be sure to have absolutely no HTML in master.html so it renders no
output.

Would that work?

--
DonB

logging at http://www.gotodon.com/ccbth, and blogging at
http://ccbth.gotodon.net

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

Web Database

Join thousands of Web developers who build Web applications with minimal coding.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.