Thread: php question
View Single Post
Old 05-08-2008, 11:49 AM  
GrouchyAdmin
Now choke yourself!
 
GrouchyAdmin's Avatar
 
Industry Role:
Join Date: Apr 2006
Posts: 12,085
Code:
<?php // Beginning of PHP code
$safedate = sprintf("&#37;2d", date("d"));  // Make sure the string is safe and padded.
$mywasteofvariables = "/";  // Obviously the file's going to be in the root directory
$htmlfile = ".html";  // HTML is .html.
$filename = $mywasteofvariables . $safedate . $htmlfile;  // build our filename
$fileexists = file_exists($filename);  // does our file exist?

if ($fileexists) { // If our file exists
   $file=file_get_contents($filename);  // load our file
   $render = eval("?>".stripslashes($qbcontent)."<? ");  // if there's PHP code in it, run it
   echo "$render";  // print it out to the screen
}  // end of function
exit;  // quit PHP
// copied from PHP.net or something I dont really know what it does
if (!function_exists('file_get_contents')) {
      function file_get_contents($filename, $incpath = false, $resource_context = null)
      {
          if (false === $fh = fopen($filename, 'rb', $incpath)) {
              trigger_error('file_get_contents() failed to open stream: No such file or directory', E_USER_WARNING);
              return false;
          }
 
          clearstatcache();
          if ($fsize = @filesize($filename)) {
              $data = fread($fh, $fsize);
          } else {
              $data = '';
              while (!feof($fh)) {
                  $data .= fread($fh, 8192);
              }
          }
 
          fclose($fh);
          return $data;
      }
  }
?>
Hope this disccusion has helped u.
__________________
GrouchyAdmin is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote