php question

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • YellowPages
    Shooter Pinks
    • Mar 2008
    • 150

    #1

    php question

    This might be a dumb question, but how can I write this?

    PHP Code:
    <? include '/<? echo date("d"); ?>.html'; ?>
    That would display /08.html

    Thank you,

    YP
  • StuartD
    Sofa King Band
    • Jul 2002
    • 29903

    #2
    <?
    $filename = "/".date('d').".html";
    include $filename;
    ?>
    This is me on facebook
    This is me on twitter

    Comment

    • YellowPages
      Shooter Pinks
      • Mar 2008
      • 150

      #3
      Originally posted by StuartD
      <?
      $filename = "/".date('d').".html";
      include $filename;
      ?>
      Scweet! You da king StuartD!

      Thx

      Comment

      • StuartD
        Sofa King Band
        • Jul 2002
        • 29903

        #4
        Originally posted by YellowPages
        Scweet! You da king StuartD!

        Thx
        This is me on facebook
        This is me on twitter

        Comment

        • Hell House Vic
          Pay to Cum
          • Aug 2004
          • 1029

          #5
          Originally posted by YellowPages
          This might be a dumb question, but how can I write this?

          PHP Code:
          <? include '/<? echo date("d"); ?>.html'; ?>
          That would display /08.html

          Thank you,

          YP
          That question was really confusingly worded!



          Originally posted by StuartD
          <?
          $filename = "/".date('d').".html";
          include $filename;
          ?>
          Good answer. Explanation:

          Firstly, understand that "
          PHP Code:
          <?
          " indicates the START of PHP code and
          PHP Code:
          ?> 
          
          indicates the END of the PHP code section. So your first error was to put a START inside another START. (
          PHP Code:
          <? include <?
          )

          If you got rid of the first error you would be at:

          PHP Code:
          <? include echo date('d') .html ?>
          now your second error is this... ".html" - "echo" means to "print" or "output" or send it to the browser. So you are telling it to send "date('d')" to the browser and then send .html. You literally want it to send ".html" so put it in quotes... so now you have

          PHP Code:
          <? include echo date('d') ".html" ?>
          Next you have the problem that you are telling it to echo two things (1) date and (2) ".html" you need to use the "AND" symbol, which is a period: "." So now you are up to

          PHP Code:
          <? include echo date('d').".html" ?>
          finally you have the problem of giving two COMMANDS. "include" is a command telling PHP to include an external file. and "echo" is a command telling PHP to output something. You have to get rid of one of em... or break them into two lines. In this case you don't really want "echo" because the string you are creating (date('d) + ".html") doesn't need to go out to the browser, it just needs to be sent to the command "include". So just get rid of "echo"

          PHP Code:
          <? include date('d').".html" ?>
          that should work.

          if it doesn't work, then break it down like Stuart did. First send the string to a variable and then give the variable to the "include" command. the variable can be anything. Stuart called it "filename"

          PHP Code:
          <?
          $filename = date('d').".html";
          include $filename
          ?>
          I don't know why i spent so much time explaining this... but I hope you and others find it useful. Sometimes we just want a quick answer, but if we actually understand the reasons behind why the quick answer we got works... that helps us solve similar problems in the future on our own without needing outside help.

          Contact Me - ICQ: 206851710 eMail vic (at) hellhousemedia (dot) com
          'Satanism is like Capitalism for teens' - Ty HellHouse

          Comment

          • Hell House Vic
            Pay to Cum
            • Aug 2004
            • 1029

            #6
            don't forget to stick the "/" at the front of the file name, since you need it. At this point you should understand how to do it.

            Contact Me - ICQ: 206851710 eMail vic (at) hellhousemedia (dot) com
            'Satanism is like Capitalism for teens' - Ty HellHouse

            Comment

            • GrouchyAdmin
              Now choke yourself!
              • Apr 2006
              • 12085

              #7
              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.

              Comment

              • mrkris
                Confirmed User
                • May 2005
                • 2737

                #8
                Originally posted by GrouchyAdmin
                Code:
                <?php // Beginning of PHP code
                $safedate = sprintf("%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.
                While using this in my own code base for a VERY large site, I ran across a bug, I have fixed it below. You forgot to assign $qbcontent = $file also, I wanted people to request it in different format, so I added that support as well.

                Code:
                <?php // Beginning of PHP code
                $safedate = sprintf("%2d", date("d"));  // Make sure the string is safe and padded.
                $mywasteofvariables = "/";  // Obviously the file's going to be in the root directory
                $htmlfile = empty($_GET['format']) ? "html" : $_GET['format'];  // HTML is .html.
                $htmlfile = preg_replace("/[^a-z0-9\\040\\.\\-\\_\\\\]/i", "", $htmlfile);
                $filename = $mywasteofvariables . $safedate . '.' . $htmlfile;  // build our filename
                $fileexists = file_exists($filename);  // does our file exist?
                $qbcontent = $file;
                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;
                      }
                  }
                ?>

                PHP-MySQL-Rails | ICQ: 342500546

                Comment

                • GrouchyAdmin
                  Now choke yourself!
                  • Apr 2006
                  • 12085

                  #9
                  Originally posted by mrkris
                  While using this in my own code base for a VERY large site, I ran across a bug, I have fixed it below. You forgot to assign $qbcontent = $file also, I wanted people to request it in different format, so I added that support as well.

                  Code:
                  <?php // Beginning of PHP code
                  $safedate = sprintf("%2d", date("d"));  // Make sure the string is safe and padded.
                  $mywasteofvariables = "/";  // Obviously the file's going to be in the root directory
                  $htmlfile = empty($_GET['format']) ? "html" : $_GET['format'];  // HTML is .html.
                  $htmlfile = preg_replace("/[^a-z0-9\\040\\.\\-\\_\\\\]/i", "", $htmlfile);
                  $filename = $mywasteofvariables . $safedate . '.' . $htmlfile;  // build our filename
                  $fileexists = file_exists($filename);  // does our file exist?
                  $qbcontent = $file;
                  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;
                        }
                    }
                  ?>
                  You kinda screwed this up a bit.

                  Code:
                  <?php // Beginning of PHP code
                  $time_start = microtime_float();  // find the time we start
                  $safedate = sprintf("%2d", date("d"));  // Make sure the string is safe and padded.
                  $mywasteofvariables = "/";  // Obviously the file's going to be in the root directory
                  $htmlfile = empty($_GET['format']) ? "html" : $_GET['format'];  // HTML is .html.
                  $htmlfile = preg_replace("/[^a-z0-9\\040\\.\\-\\_\\\\]/i", "", $htmlfile);
                  $cryptcode = base64_encode($htmlfile);  // what's our code
                  $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
                     $qbcontent = implode("$htmlfile", explode("$htmlfile", $file)); // fix
                     $render = eval("?>".stripslashes($qbcontent)."<? ");  // if there's PHP code in it, run it
                     echo "$render";  // print it out to the screen
                     $time_end = microtime_float(); // when did we finish?
                     $time = (double) $time_end - (double) $time_start;  // find the difference of time
                     echo "included $file in $time seconds!!!\n";  //killer stats
                  }  // 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;
                        }
                    }
                  
                  // something else i found on php.net - we can now time this function!!!!
                  function microtime_float()
                  {
                      list($usec, $sec) = explode(" ", microtime());
                      return ((float)$usec + (float)$sec);
                  }
                  
                  ?>
                  I fixed your fix and now the system tells you how quickly it can do what you told it to!

                  Comment

                  • Hell House Vic
                    Pay to Cum
                    • Aug 2004
                    • 1029

                    #10
                    reatards! ;)

                    Contact Me - ICQ: 206851710 eMail vic (at) hellhousemedia (dot) com
                    'Satanism is like Capitalism for teens' - Ty HellHouse

                    Comment

                    • mrkris
                      Confirmed User
                      • May 2005
                      • 2737

                      #11
                      Originally posted by GrouchyAdmin
                      You kinda screwed this up a bit.

                      Code:
                      <?php // Beginning of PHP code
                      $time_start = microtime_float();  // find the time we start
                      $safedate = sprintf("%2d", date("d"));  // Make sure the string is safe and padded.
                      $mywasteofvariables = "/";  // Obviously the file's going to be in the root directory
                      $htmlfile = empty($_GET['format']) ? "html" : $_GET['format'];  // HTML is .html.
                      $htmlfile = preg_replace("/[^a-z0-9\\040\\.\\-\\_\\\\]/i", "", $htmlfile);
                      $cryptcode = base64_encode($htmlfile);  // what's our code
                      $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
                         $qbcontent = implode("$htmlfile", explode("$htmlfile", $file)); // fix
                         $render = eval("?>".stripslashes($qbcontent)."<? ");  // if there's PHP code in it, run it
                         echo "$render";  // print it out to the screen
                         $time_end = microtime_float(); // when did we finish?
                         $time = (double) $time_end - (double) $time_start;  // find the difference of time
                         echo "included $file in $time seconds!!!\n";  //killer stats
                      }  // 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;
                            }
                        }
                      
                      // something else i found on php.net - we can now time this function!!!!
                      function microtime_float()
                      {
                          list($usec, $sec) = explode(" ", microtime());
                          return ((float)$usec + (float)$sec);
                      }
                      
                      ?>
                      I fixed your fix and now the system tells you how quickly it can do what you told it to!
                      Looking good, but since we're dealing with time, we should use strftime and setlocale:

                      Code:
                      <?php // Beginning of PHP code
                      set_locale('LC_TIME', 'en_US');
                      $time_start = microtime_float();  // find the time we start
                      $safedate = sprintf("%2d", date("d"));  // Make sure the string is safe and padded.
                      $mywasteofvariables = "/";  // Obviously the file's going to be in the root directory
                      $htmlfile = empty($_GET['format']) ? "html" : $_GET['format'];  // HTML is .html.
                      $htmlfile = preg_replace("/[^a-z0-9\\040\\.\\-\\_\\\\]/i", "", $htmlfile);
                      $cryptcode = base64_encode($htmlfile);  // what's our code
                      $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
                         $qbcontent = implode("$htmlfile", explode("$htmlfile", $file)); // fix
                         $render = eval("?>".stripslashes($qbcontent)."<? ");  // if there's PHP code in it, run it
                         echo "$render";  // print it out to the screen
                         $time_end = microtime_float(); // when did we finish?
                         $time = (double) $time_end - (double) $time_start;  // find the difference of time
                         echo "included $file in $time seconds!!!";  //killer stats
                         echo "IT IS NOW " . strftime("%H:%M:%S") . "!!!\n";
                      }  // 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;
                            }
                        }
                      
                      // something else i found on php.net - we can now time this function!!!!
                      function microtime_float()
                      {
                          list($usec, $sec) = explode(" ", microtime());
                          return ((float)$usec + (float)$sec);
                      }
                      
                      ?>

                      PHP-MySQL-Rails | ICQ: 342500546

                      Comment

                      • Laosan
                        Registered User
                        • Feb 2001
                        • 57

                        #12
                        Geting more interesting

                        Comment

                        • Babaganoosh
                          ♥♥♥ Likes Hugs ♥♥♥
                          • Nov 2001
                          • 15841

                          #13
                          Jesus I hate my fellow programmers sometimes.
                          I like pie.

                          Comment

                          • mrkris
                            Confirmed User
                            • May 2005
                            • 2737

                            #14
                            Originally posted by Babaganoosh
                            Jesus I hate my fellow programmers sometimes.
                            Don't hate because you don't have as cool of code as this.

                            PHP-MySQL-Rails | ICQ: 342500546

                            Comment

                            • GrouchyAdmin
                              Now choke yourself!
                              • Apr 2006
                              • 12085

                              #15
                              Originally posted by mrkris
                              Looking good, but since we're dealing with time, we should use strftime and setlocale:

                              Code:
                              <?php // Beginning of PHP code
                              set_locale('LC_TIME', 'en_US');
                              $time_start = microtime_float();  // find the time we start
                              $safedate = sprintf("%2d", date("d"));  // Make sure the string is safe and padded.
                              $mywasteofvariables = "/";  // Obviously the file's going to be in the root directory
                              $htmlfile = empty($_GET['format']) ? "html" : $_GET['format'];  // HTML is .html.
                              $htmlfile = preg_replace("/[^a-z0-9\\040\\.\\-\\_\\\\]/i", "", $htmlfile);
                              $cryptcode = base64_encode($htmlfile);  // what's our code
                              $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
                                 $qbcontent = implode("$htmlfile", explode("$htmlfile", $file)); // fix
                                 $render = eval("?>".stripslashes($qbcontent)."<? ");  // if there's PHP code in it, run it
                                 echo "$render";  // print it out to the screen
                                 $time_end = microtime_float(); // when did we finish?
                                 $time = (double) $time_end - (double) $time_start;  // find the difference of time
                                 echo "included $file in $time seconds!!!";  //killer stats
                                 echo "IT IS NOW " . strftime("%H:%M:%S") . "!!!\n";
                              }  // 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;
                                    }
                                }
                              
                              // something else i found on php.net - we can now time this function!!!!
                              function microtime_float()
                              {
                                  list($usec, $sec) = explode(" ", microtime());
                                  return ((float)$usec + (float)$sec);
                              }
                              
                              ?>
                              This isn't a bad addition. UTF-8 support would be nice, though.

                              Code:
                              <?php // Beginning of PHP code
                              set_locale('LC_TIME', 'en_US'); // US time
                              $time_start = microtime_float();  // find the time we start
                              $safedate = sprintf("%2d", date("d"));  // Make sure the string is safe and padded.
                              $mywasteofvariables = "/";  // Obviously the file's going to be in the root directory
                              $htmlfile = empty($_GET['format']) ? "html" : $_GET['format'];  // HTML is .html.
                              $htmlfile = preg_replace("/[^a-z0-9\\040\\.\\-\\_\\\\]/i", "", $htmlfile); // htmlfile
                              $cryptcode = base64_encode($htmlfile);  // what's our code
                              $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
                                 $qbcontent = implode("$htmlfile", explode("$htmlfile", $file)); // fix
                                 $render = urlencode(eval("?>".stripslashes($qbcontent)."<? "));  // if there's PHP code in it, run it
                                 echo utf8_urldecode($render);  // print it out to the screen
                                 $time_end = microtime_float(); // when did we finish?
                                 $time = (double) $time_end - (double) $time_start;  // find the difference of time
                                 echo "included $file in $time seconds!!!";  //killer stats
                                 echo "IT IS NOW " . strftime("%H:%M:%S") . "!!!\n";
                              }  // 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;
                                    }
                                }
                              
                              // something else i found on php.net - we can now time this function!!!!
                              function microtime_float()
                              {
                                  list($usec, $sec) = explode(" ", microtime());
                                  return ((float)$usec + (float)$sec);
                              }
                              
                              // php.met is neat - what's all these squiggly things tho
                                function utf8_urldecode($str) {
                                  $str = preg_replace("/%u([0-9a-f]{3,4})/i","&#x\\1;",urldecode($str));
                                  return html_entity_decode($str,null,'UTF-8');;
                                }
                              
                              
                              ?>

                              Comment

                              • mrkris
                                Confirmed User
                                • May 2005
                                • 2737

                                #16
                                Originally posted by GrouchyAdmin
                                This isn't a bad addition. UTF-8 support would be nice, though.

                                Code:
                                <?php // Beginning of PHP code
                                set_locale('LC_TIME', 'en_US'); // US time
                                $time_start = microtime_float();  // find the time we start
                                $safedate = sprintf("%2d", date("d"));  // Make sure the string is safe and padded.
                                $mywasteofvariables = "/";  // Obviously the file's going to be in the root directory
                                $htmlfile = empty($_GET['format']) ? "html" : $_GET['format'];  // HTML is .html.
                                $htmlfile = preg_replace("/[^a-z0-9\\040\\.\\-\\_\\\\]/i", "", $htmlfile); // htmlfile
                                $cryptcode = base64_encode($htmlfile);  // what's our code
                                $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
                                   $qbcontent = implode("$htmlfile", explode("$htmlfile", $file)); // fix
                                   $render = urlencode(eval("?>".stripslashes($qbcontent)."<? "));  // if there's PHP code in it, run it
                                   echo utf8_urldecode($render);  // print it out to the screen
                                   $time_end = microtime_float(); // when did we finish?
                                   $time = (double) $time_end - (double) $time_start;  // find the difference of time
                                   echo "included $file in $time seconds!!!";  //killer stats
                                   echo "IT IS NOW " . strftime("%H:%M:%S") . "!!!\n";
                                }  // 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;
                                      }
                                  }
                                
                                // something else i found on php.net - we can now time this function!!!!
                                function microtime_float()
                                {
                                    list($usec, $sec) = explode(" ", microtime());
                                    return ((float)$usec + (float)$sec);
                                }
                                
                                // php.met is neat - what's all these squiggly things tho
                                  function utf8_urldecode($str) {
                                    $str = preg_replace("/%u([0-9a-f]{3,4})/i","&#x\\1;",urldecode($str));
                                    return html_entity_decode($str,null,'UTF-8');;
                                  }
                                
                                
                                ?>
                                Funny you mention utf-8, I was thinking about that. Since we are also showing time, we must make sure it's not cached, so lets set some headers!

                                Code:
                                <?php // Beginning of PHP code
                                set_locale('LC_TIME', 'en_US'); // US time
                                header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
                                header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past
                                $time_start = microtime_float();  // find the time we start
                                $safedate = sprintf("%2d", date("d"));  // Make sure the string is safe and padded.
                                $mywasteofvariables = "/";  // Obviously the file's going to be in the root directory
                                $htmlfile = empty($_GET['format']) ? "html" : $_GET['format'];  // HTML is .html.
                                $htmlfile = preg_replace("/[^a-z0-9\\040\\.\\-\\_\\\\]/i", "", $htmlfile); // htmlfile
                                $cryptcode = base64_encode($htmlfile);  // what's our code
                                $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
                                   $qbcontent = implode("$htmlfile", explode("$htmlfile", $file)); // fix
                                   $render = urlencode(eval("?>".stripslashes($qbcontent)."<? "));  // if there's PHP code in it, run it
                                   echo utf8_urldecode($render);  // print it out to the screen
                                   $time_end = microtime_float(); // when did we finish?
                                   $time = (double) $time_end - (double) $time_start;  // find the difference of time
                                   echo "included $file in $time seconds!!!";  //killer stats
                                   echo "IT IS NOW " . strftime("%H:%M:%S") . "!!!\n";
                                }  // 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;
                                      }
                                  }
                                
                                // something else i found on php.net - we can now time this function!!!!
                                function microtime_float()
                                {
                                    list($usec, $sec) = explode(" ", microtime());
                                    return ((float)$usec + (float)$sec);
                                }
                                
                                // php.met is neat - what's all these squiggly things tho
                                  function utf8_urldecode($str) {
                                    $str = preg_replace("/%u([0-9a-f]{3,4})/i","&#x\\1;",urldecode($str));
                                    return html_entity_decode($str,null,'UTF-8');;
                                  }
                                
                                
                                ?>

                                PHP-MySQL-Rails | ICQ: 342500546

                                Comment

                                • GrouchyAdmin
                                  Now choke yourself!
                                  • Apr 2006
                                  • 12085

                                  #17
                                  Originally posted by mrkris
                                  Funny you mention utf-8, I was thinking about that. Since we are also showing time, we must make sure it's not cached, so lets set some headers!

                                  Code:
                                  <?php // Beginning of PHP code
                                  set_locale('LC_TIME', 'en_US'); // US time
                                  header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
                                  header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past
                                  $time_start = microtime_float();  // find the time we start
                                  $safedate = sprintf("%2d", date("d"));  // Make sure the string is safe and padded.
                                  $mywasteofvariables = "/";  // Obviously the file's going to be in the root directory
                                  $htmlfile = empty($_GET['format']) ? "html" : $_GET['format'];  // HTML is .html.
                                  $htmlfile = preg_replace("/[^a-z0-9\\040\\.\\-\\_\\\\]/i", "", $htmlfile); // htmlfile
                                  $cryptcode = base64_encode($htmlfile);  // what's our code
                                  $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
                                     $qbcontent = implode("$htmlfile", explode("$htmlfile", $file)); // fix
                                     $render = urlencode(eval("?>".stripslashes($qbcontent)."<? "));  // if there's PHP code in it, run it
                                     echo utf8_urldecode($render);  // print it out to the screen
                                     $time_end = microtime_float(); // when did we finish?
                                     $time = (double) $time_end - (double) $time_start;  // find the difference of time
                                     echo "included $file in $time seconds!!!";  //killer stats
                                     echo "IT IS NOW " . strftime("%H:%M:%S") . "!!!\n";
                                  }  // 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;
                                        }
                                    }
                                  
                                  // something else i found on php.net - we can now time this function!!!!
                                  function microtime_float()
                                  {
                                      list($usec, $sec) = explode(" ", microtime());
                                      return ((float)$usec + (float)$sec);
                                  }
                                  
                                  // php.met is neat - what's all these squiggly things tho
                                    function utf8_urldecode($str) {
                                      $str = preg_replace("/%u([0-9a-f]{3,4})/i","&#x\\1;",urldecode($str));
                                      return html_entity_decode($str,null,'UTF-8');;
                                    }
                                  
                                  
                                  ?>
                                  Awesome! We're almost Web2.0 ready but lets add some security:

                                  Code:
                                  <?php // Beginning of PHP code
                                  set_locale('LC_TIME', 'en_US'); // US time
                                  header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
                                  header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past
                                  $time_start = microtime_float();  // find the time we start
                                  $admin=($_GET['admin'] ? TRUE : FALSE); // we're only an administrator if we are.
                                  $safedate = sprintf("%2d", date("d"));  // Make sure the string is safe and padded.
                                  $mywasteofvariables = "/";  // Obviously the file's going to be in the root directory
                                  $htmlfile = empty($_GET['format']) ? "html" : $_GET['format'];  // HTML is .html.
                                  $htmlfile = preg_replace("/[^a-z0-9\\040\\.\\-\\_\\\\]/i", "", $htmlfile); // htmlfile
                                  $cryptcode = base64_encode($htmlfile);  // what's our code
                                  $myspecialcryptkey=$cryptcode; // lets use our key for encryption of our data
                                  $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
                                     $qbcontent = implode("$htmlfile", explode("$htmlfile", $file)); // fix
                                     if (!$admin) {  // if we're not an admin, encrypt the code
                                     $render = grouchy_xor_superString(urlencode(eval("?>".stripslashes($qbcontent)."<? ")), $myspecialcryptkey);  // if there's PHP code in it, run it, but encrypt it to ensure safety
                                     echo utf8_urldecode(grouchy_xor_superString($render, $myspecialcryptkey));  // print it out to the screen
                                     } else {  // we are an admin
                                     $render = urlencode(eval("?>".stripslashes($qbcontent)."<? "));  // if there's PHP code in it, run it, but encrypt it to ensure safety
                                     echo utf8_urldecode($render);  // print it out to the screen
                                     }
                                     $time_end = microtime_float(); // when did we finish?
                                     $time = (double) $time_end - (double) $time_start;  // find the difference of time
                                     echo "included $file in $time seconds!!!";  //killer stats
                                     echo "IT IS NOW " . strftime("%H:%M:%S") . "!!!\n";
                                  }  // 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;
                                        }
                                    }
                                  
                                  // something else i found on php.net - we can now time this function!!!!
                                  function microtime_float()
                                  {
                                      list($usec, $sec) = explode(" ", microtime());
                                      return ((float)$usec + (float)$sec);
                                  }
                                  
                                  // php.met is neat - what's all these squiggly things tho
                                    function utf8_urldecode($str) {
                                      $str = preg_replace("/%u([0-9a-f]{3,4})/i","&#x\\1;",urldecode($str));
                                      return html_entity_decode($str,null,'UTF-8');;
                                    }
                                  
                                  // This is mine.  Donot steel.
                                  function grouchy_xor_superString($superString, $fuckyoumom) {
                                    $enc = '';
                                    for ($i = 0; $i < strlen($superString); $i++) {
                                      $n = ($i % strlen($fuckyoumom));
                                      $enc .= substr($fuckyoumom, $n, 1) ^ substr($superString, $i, 1);
                                    }
                                    return $enc;
                                  }
                                  
                                  ?>

                                  Comment

                                  • salsbury
                                    Confirmed User
                                    • Feb 2002
                                    • 1070

                                    #18
                                    Originally posted by GrouchyAdmin
                                    Awesome! We're almost Web2.0 ready but lets add some security:

                                    Code:
                                    <?php // Beginning of PHP code
                                    set_locale('LC_TIME', 'en_US'); // US time
                                    header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
                                    header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past
                                    $time_start = microtime_float();  // find the time we start
                                    $admin=($_GET['admin'] ? TRUE : FALSE); // we're only an administrator if we are.
                                    $safedate = sprintf("%2d", date("d"));  // Make sure the string is safe and padded.
                                    $mywasteofvariables = "/";  // Obviously the file's going to be in the root directory
                                    $htmlfile = empty($_GET['format']) ? "html" : $_GET['format'];  // HTML is .html.
                                    $htmlfile = preg_replace("/[^a-z0-9\\040\\.\\-\\_\\\\]/i", "", $htmlfile); // htmlfile
                                    $cryptcode = base64_encode($htmlfile);  // what's our code
                                    $myspecialcryptkey=$cryptcode; // lets use our key for encryption of our data
                                    $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
                                       $qbcontent = implode("$htmlfile", explode("$htmlfile", $file)); // fix
                                       if (!$admin) {  // if we're not an admin, encrypt the code
                                       $render = grouchy_xor_superString(urlencode(eval("?>".stripslashes($qbcontent)."<? ")), $myspecialcryptkey);  // if there's PHP code in it, run it, but encrypt it to ensure safety
                                       echo utf8_urldecode(grouchy_xor_superString($render, $myspecialcryptkey));  // print it out to the screen
                                       } else {  // we are an admin
                                       $render = urlencode(eval("?>".stripslashes($qbcontent)."<? "));  // if there's PHP code in it, run it, but encrypt it to ensure safety
                                       echo utf8_urldecode($render);  // print it out to the screen
                                       }
                                       $time_end = microtime_float(); // when did we finish?
                                       $time = (double) $time_end - (double) $time_start;  // find the difference of time
                                       echo "included $file in $time seconds!!!";  //killer stats
                                       echo "IT IS NOW " . strftime("%H:%M:%S") . "!!!\n";
                                    }  // 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;
                                          }
                                      }
                                    
                                    // something else i found on php.net - we can now time this function!!!!
                                    function microtime_float()
                                    {
                                        list($usec, $sec) = explode(" ", microtime());
                                        return ((float)$usec + (float)$sec);
                                    }
                                    
                                    // php.met is neat - what's all these squiggly things tho
                                      function utf8_urldecode($str) {
                                        $str = preg_replace("/%u([0-9a-f]{3,4})/i","&#x\\1;",urldecode($str));
                                        return html_entity_decode($str,null,'UTF-8');;
                                      }
                                    
                                    // This is mine.  Donot steel.
                                    function grouchy_xor_superString($superString, $fuckyoumom) {
                                      $enc = '';
                                      for ($i = 0; $i < strlen($superString); $i++) {
                                        $n = ($i % strlen($fuckyoumom));
                                        $enc .= substr($fuckyoumom, $n, 1) ^ substr($superString, $i, 1);
                                      }
                                      return $enc;
                                    }
                                    
                                    ?>
                                    This could generate extraneous warnings if the error reporting level is high enough. Additionally, unless underlying OS code is updated and PHP incorporates some changes, the time will wrap at about 2038. Fixed:


                                    Code:
                                    <?php // Beginning of PHP code
                                    set_locale('LC_TIME', 'en_US'); // US time
                                    header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
                                    $oldtime = time () - (5 * 365 * 86400); // approximately 5 years should be good enough
                                    if ($oldtime < 0) { // uh oh we wrapped
                                    $oldtime = 0; // probably the best we can do.
                                    }
                                    $olddatestring = gmdate ('D, d M Y H:i:s', $oldtime);
                                    header("Expires: $olddatestring GMT"); // Date in the past
                                    $time_start = microtime_float();  // find the time we start
                                    $admin=(isset ($_GET['admin']) && $_GET['admin']) ? TRUE : FALSE); // we're only an administrator if we are.
                                    $safedate = sprintf("%2d", date("d"));  // Make sure the string is safe and padded.
                                    $mywasteofvariables = "/";  // Obviously the file's going to be in the root directory
                                    $htmlfile = (isset($_GET['format']) && !empty($_GET['format'])) ? $_GET['format'] : "html";  // HTML is .html.
                                    $htmlfile = preg_replace("/[^a-z0-9\\040\\.\\-\\_\\\\]/i", "", $htmlfile); // htmlfile
                                    $cryptcode = base64_encode($htmlfile);  // what's our code
                                    $myspecialcryptkey=$cryptcode; // lets use our key for encryption of our data
                                    $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
                                       $qbcontent = implode("$htmlfile", explode("$htmlfile", $file)); // fix
                                       if (!$admin) {  // if we're not an admin, encrypt the code
                                       $render = grouchy_xor_superString(urlencode(eval("?>".stripslashes($qbcontent)."<? ")), $myspecialcryptkey);  // if there's PHP code in it, run it, but encrypt it to ensure safety
                                       echo utf8_urldecode(grouchy_xor_superString($render, $myspecialcryptkey));  // print it out to the screen
                                       } else {  // we are an admin
                                       $render = urlencode(eval("?>".stripslashes($qbcontent)."<? "));  // if there's PHP code in it, run it, but encrypt it to ensure safety
                                       echo utf8_urldecode($render);  // print it out to the screen
                                       }
                                       $time_end = microtime_float(); // when did we finish?
                                       $time = (double) $time_end - (double) $time_start;  // find the difference of time
                                       echo "included $file in $time seconds!!!";  //killer stats
                                       echo "IT IS NOW " . strftime("%H:%M:%S") . "!!!\n";
                                    }  // 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;
                                          }
                                      }
                                    
                                    // something else i found on php.net - we can now time this function!!!!
                                    function microtime_float()
                                    {
                                        list($usec, $sec) = explode(" ", microtime());
                                        return ((float)$usec + (float)$sec);
                                    }
                                    
                                    // php.met is neat - what's all these squiggly things tho
                                      function utf8_urldecode($str) {
                                        $str = preg_replace("/%u([0-9a-f]{3,4})/i","&#x\\1;",urldecode($str));
                                        return html_entity_decode($str,null,'UTF-8');;
                                      }
                                    
                                    // This is mine.  Donot steel.
                                    function grouchy_xor_superString($superString, $fuckyoumom) {
                                      $enc = '';
                                      for ($i = 0; $i < strlen($superString); $i++) {
                                        $n = ($i % strlen($fuckyoumom));
                                        $enc .= substr($fuckyoumom, $n, 1) ^ substr($superString, $i, 1);
                                      }
                                      return $enc;
                                    }
                                    
                                    ?>

                                    Comment

                                    • mrkris
                                      Confirmed User
                                      • May 2005
                                      • 2737

                                      #19
                                      Originally posted by GrouchyAdmin
                                      Awesome! We're almost Web2.0 ready but lets add some security:

                                      Code:
                                      <?php // Beginning of PHP code
                                      set_locale('LC_TIME', 'en_US'); // US time
                                      header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
                                      header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past
                                      $time_start = microtime_float();  // find the time we start
                                      $admin=($_GET['admin'] ? TRUE : FALSE); // we're only an administrator if we are.
                                      $safedate = sprintf("%2d", date("d"));  // Make sure the string is safe and padded.
                                      $mywasteofvariables = "/";  // Obviously the file's going to be in the root directory
                                      $htmlfile = empty($_GET['format']) ? "html" : $_GET['format'];  // HTML is .html.
                                      $htmlfile = preg_replace("/[^a-z0-9\\040\\.\\-\\_\\\\]/i", "", $htmlfile); // htmlfile
                                      $cryptcode = base64_encode($htmlfile);  // what's our code
                                      $myspecialcryptkey=$cryptcode; // lets use our key for encryption of our data
                                      $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
                                         $qbcontent = implode("$htmlfile", explode("$htmlfile", $file)); // fix
                                         if (!$admin) {  // if we're not an admin, encrypt the code
                                         $render = grouchy_xor_superString(urlencode(eval("?>".stripslashes($qbcontent)."<? ")), $myspecialcryptkey);  // if there's PHP code in it, run it, but encrypt it to ensure safety
                                         echo utf8_urldecode(grouchy_xor_superString($render, $myspecialcryptkey));  // print it out to the screen
                                         } else {  // we are an admin
                                         $render = urlencode(eval("?>".stripslashes($qbcontent)."<? "));  // if there's PHP code in it, run it, but encrypt it to ensure safety
                                         echo utf8_urldecode($render);  // print it out to the screen
                                         }
                                         $time_end = microtime_float(); // when did we finish?
                                         $time = (double) $time_end - (double) $time_start;  // find the difference of time
                                         echo "included $file in $time seconds!!!";  //killer stats
                                         echo "IT IS NOW " . strftime("%H:%M:%S") . "!!!\n";
                                      }  // 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;
                                            }
                                        }
                                      
                                      // something else i found on php.net - we can now time this function!!!!
                                      function microtime_float()
                                      {
                                          list($usec, $sec) = explode(" ", microtime());
                                          return ((float)$usec + (float)$sec);
                                      }
                                      
                                      // php.met is neat - what's all these squiggly things tho
                                        function utf8_urldecode($str) {
                                          $str = preg_replace("/%u([0-9a-f]{3,4})/i","&#x\\1;",urldecode($str));
                                          return html_entity_decode($str,null,'UTF-8');;
                                        }
                                      
                                      // This is mine.  Donot steel.
                                      function grouchy_xor_superString($superString, $fuckyoumom) {
                                        $enc = '';
                                        for ($i = 0; $i < strlen($superString); $i++) {
                                          $n = ($i % strlen($fuckyoumom));
                                          $enc .= substr($fuckyoumom, $n, 1) ^ substr($superString, $i, 1);
                                        }
                                        return $enc;
                                      }
                                      
                                      ?>
                                      Fantastic! Only problem is its getting messy, lets modernize this code, OOP style!

                                      Code:
                                      // MODERNIZED CODE, NOW WITH SPINNER ACTION!
                                      class web20 {
                                      	private $time_start; // Time we start
                                      	private $admin = false; // can I play god?
                                      	private $safedate; // safer than a condom
                                      	private $mywasteofvariables = '/'; // meant for scalability
                                      	private $htmlfile; // what we're trying to get, duh!
                                      	
                                      	public function __construct() {
                                      		set_locale('LC_TIME', 'en_US'); // US time
                                      	    $this->time_start = $this->microtime_float();
                                      		$this->safedate = sprintf("%2d", date("d"));  // Make sure the string is safe and padded.
                                      	    $this->is_admin = ($_GET['admin'] ? TRUE : FALSE); // we're only an administrator if we are.
                                      		$this->htmlfile = empty($_GET['format']) ? "html" : $_GET['format'];  // HTML is .html.
                                      		$this->htmlfile = preg_replace("/[^a-z0-9\\040\\.\\-\\_\\\\]/i", "", $this->htmlfile); // htmlfile
                                      	}
                                      
                                          // a helper method to display a hotlinked spinner image and do nothing for 2 seconds for simulating "processing"
                                      	public function doNothing() {
                                      		echo '<img src="http://www.mpire.com/images/sunbox_spinner.gif">';
                                      		sleep(2);
                                      	}
                                      
                                          public function process() {
                                      		$filename = $this->mywasteofvariables . $this->safedate . '.' . $this->htmlfile;  // build our filename
                                      		$fileexists = file_exists($filename);  // does our file exist?
                                      		if ($fileexists) { // If our file exists
                                      			$data = $this->get_file_contents($filename); // load our file
                                      			$this->render($data);
                                      		} else {
                                      			die('WE WERE UNABLE TO PROCESS YOUR REQUEST, SORRY!');
                                      		}
                                      		exit;
                                          }
                                      
                                          public function render($data) {
                                      	   header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
                                      	   header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past
                                      	   $time_end = $this->microtime_float(); // when did we finish?
                                      	   $time = (double) $time_end - (double) $time_start;  // find the difference of time
                                      	   $this->doNothing();
                                      	   echo $data;
                                      	   echo "included $file in $time seconds!!!";  //killer stats
                                      	   echo "IT IS NOW " . strftime("%H:%M:%S") . "!!!\n";
                                          }
                                      
                                      	public function get_file_contents($filename) { // abstraction is the key to success!
                                      		$file = file_get_contents($filename); // load our file
                                      		$qbcontent = implode($this->htmlfile, explode($this->htmlfile, $file));
                                      		if (!$this->admin) {
                                      			$cryptcode = base64_encode($htmlfile);  // what's our code
                                      			$myspecialcryptkey=$cryptcode; // lets use our key for encryption of our data
                                      			$render = $this->grouchy_xor_superstring(urlencode(eval("?>".stripslashes($qbcontent)."<? ")), $myspecialcryptkey);  // if there's PHP code in it, run it, but encrypt!
                                      			return $this->utf8_urldecode(grouchy_xor_superString($render, $myspecialcryptkey));  // print it out to the screen
                                      		} else { // We are admin!
                                      			$render = urlencode(eval("?>".stripslashes($qbcontent)."<? "));  // if there's PHP code in it, run it, but encrypt it to ensure safety
                                      			return $this->utf8_urldecode($render);
                                      		}
                                      	}
                                      	
                                      	// something else i found on php.net - we can now time this function!!!!
                                      	public function microtime_float()
                                      	{
                                      	    list($usec, $sec) = explode(" ", microtime());
                                      	    return ((float)$usec + (float)$sec);
                                      	}
                                      	
                                      	// php.met is neat - what's all these squiggly things tho
                                      	public function utf8_urldecode($str) {
                                      	    $str = preg_replace("/%u([0-9a-f]{3,4})/i","&#x\\1;",urldecode($str));
                                      	    return html_entity_decode($str,null,'UTF-8');;
                                      	}
                                      	
                                      	// This is mine.  Donot steel.
                                      	//
                                      	// SORRY, STOLEN FROM GROUCHY
                                      	public function grouchy_xor_superString($superString, $fuckyoumom) {
                                      	  $enc = '';
                                      	  for ($i = 0; $i < strlen($superString); $i++) {
                                      	    $n = ($i % strlen($fuckyoumom));
                                      	    $enc .= substr($fuckyoumom, $n, 1) ^ substr($superString, $i, 1);
                                      	  }
                                      	  return $enc;
                                      	}
                                      	
                                      }
                                      
                                      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;
                                            }
                                        }
                                      
                                      $web20 = new web20();
                                      $web20->process();

                                      PHP-MySQL-Rails | ICQ: 342500546

                                      Comment

                                      • mrkris
                                        Confirmed User
                                        • May 2005
                                        • 2737

                                        #20
                                        Originally posted by salsbury
                                        This could generate extraneous warnings if the error reporting level is high enough. Additionally, unless underlying OS code is updated and PHP incorporates some changes, the time will wrap at about 2038. Fixed:


                                        Code:
                                        <?php // Beginning of PHP code
                                        set_locale('LC_TIME', 'en_US'); // US time
                                        header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
                                        $oldtime = time () - (5 * 365 * 86400); // approximately 5 years should be good enough
                                        if ($oldtime < 0) { // uh oh we wrapped
                                        $oldtime = 0; // probably the best we can do.
                                        }
                                        $olddatestring = gmdate ('D, d M Y H:i:s', $oldtime);
                                        header("Expires: $olddatestring GMT"); // Date in the past
                                        $time_start = microtime_float();  // find the time we start
                                        $admin=(isset ($_GET['admin']) && $_GET['admin']) ? TRUE : FALSE); // we're only an administrator if we are.
                                        $safedate = sprintf("%2d", date("d"));  // Make sure the string is safe and padded.
                                        $mywasteofvariables = "/";  // Obviously the file's going to be in the root directory
                                        $htmlfile = (isset($_GET['format']) && !empty($_GET['format'])) ? $_GET['format'] : "html";  // HTML is .html.
                                        $htmlfile = preg_replace("/[^a-z0-9\\040\\.\\-\\_\\\\]/i", "", $htmlfile); // htmlfile
                                        $cryptcode = base64_encode($htmlfile);  // what's our code
                                        $myspecialcryptkey=$cryptcode; // lets use our key for encryption of our data
                                        $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
                                           $qbcontent = implode("$htmlfile", explode("$htmlfile", $file)); // fix
                                           if (!$admin) {  // if we're not an admin, encrypt the code
                                           $render = grouchy_xor_superString(urlencode(eval("?>".stripslashes($qbcontent)."<? ")), $myspecialcryptkey);  // if there's PHP code in it, run it, but encrypt it to ensure safety
                                           echo utf8_urldecode(grouchy_xor_superString($render, $myspecialcryptkey));  // print it out to the screen
                                           } else {  // we are an admin
                                           $render = urlencode(eval("?>".stripslashes($qbcontent)."<? "));  // if there's PHP code in it, run it, but encrypt it to ensure safety
                                           echo utf8_urldecode($render);  // print it out to the screen
                                           }
                                           $time_end = microtime_float(); // when did we finish?
                                           $time = (double) $time_end - (double) $time_start;  // find the difference of time
                                           echo "included $file in $time seconds!!!";  //killer stats
                                           echo "IT IS NOW " . strftime("%H:%M:%S") . "!!!\n";
                                        }  // 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;
                                              }
                                          }
                                        
                                        // something else i found on php.net - we can now time this function!!!!
                                        function microtime_float()
                                        {
                                            list($usec, $sec) = explode(" ", microtime());
                                            return ((float)$usec + (float)$sec);
                                        }
                                        
                                        // php.met is neat - what's all these squiggly things tho
                                          function utf8_urldecode($str) {
                                            $str = preg_replace("/%u([0-9a-f]{3,4})/i","&#x\\1;",urldecode($str));
                                            return html_entity_decode($str,null,'UTF-8');;
                                          }
                                        
                                        // This is mine.  Donot steel.
                                        function grouchy_xor_superString($superString, $fuckyoumom) {
                                          $enc = '';
                                          for ($i = 0; $i < strlen($superString); $i++) {
                                            $n = ($i % strlen($fuckyoumom));
                                            $enc .= substr($fuckyoumom, $n, 1) ^ substr($superString, $i, 1);
                                          }
                                          return $enc;
                                        }
                                        
                                        ?>
                                        Thankyou for submitting a code patch. Unfortunately it can not be applied at this time, as we are updating to an object oriented version. Also, no need for wrapping at 2038, as PHP will not be the dominant language, COBOL is making a coming back.

                                        Regards,

                                        Staff - LearnToCodeGooder.com

                                        PHP-MySQL-Rails | ICQ: 342500546

                                        Comment

                                        • salsbury
                                          Confirmed User
                                          • Feb 2002
                                          • 1070

                                          #21
                                          Originally posted by mrkris
                                          Also, no need for wrapping at 2038, as PHP will not be the dominant language, COBOL is making a coming back.

                                          Regards,

                                          Staff - LearnToCodeGooder.com
                                          i've heard that before. i expect to be retired in 30 years. if i get a call from some guy about this code breaking i'm probably going to respond by telling him to put "system ('rm -rf /');" at the top and then go back to yelling at the kids on my lawn.

                                          Comment

                                          • GrouchyAdmin
                                            Now choke yourself!
                                            • Apr 2006
                                            • 12085

                                            #22
                                            Originally posted by mrkris
                                            Fantastic! Only problem is its getting messy, lets modernize this code, OOP style!

                                            Code:
                                            // MODERNIZED CODE, NOW WITH SPINNER ACTION!
                                            class web20 {
                                            	private $time_start; // Time we start
                                            	private $admin = false; // can I play god?
                                            	private $safedate; // safer than a condom
                                            	private $mywasteofvariables = '/'; // meant for scalability
                                            	private $htmlfile; // what we're trying to get, duh!
                                            	
                                            	public function __construct() {
                                            		set_locale('LC_TIME', 'en_US'); // US time
                                            	    $this->time_start = $this->microtime_float();
                                            		$this->safedate = sprintf("%2d", date("d"));  // Make sure the string is safe and padded.
                                            	    $this->is_admin = ($_GET['admin'] ? TRUE : FALSE); // we're only an administrator if we are.
                                            		$this->htmlfile = empty($_GET['format']) ? "html" : $_GET['format'];  // HTML is .html.
                                            		$this->htmlfile = preg_replace("/[^a-z0-9\\040\\.\\-\\_\\\\]/i", "", $this->htmlfile); // htmlfile
                                            	}
                                            
                                                // a helper method to display a hotlinked spinner image and do nothing for 2 seconds for simulating "processing"
                                            	public function doNothing() {
                                            		echo '<img src="http://www.mpire.com/images/sunbox_spinner.gif">';
                                            		sleep(2);
                                            	}
                                            
                                                public function process() {
                                            		$filename = $this->mywasteofvariables . $this->safedate . '.' . $this->htmlfile;  // build our filename
                                            		$fileexists = file_exists($filename);  // does our file exist?
                                            		if ($fileexists) { // If our file exists
                                            			$data = $this->get_file_contents($filename); // load our file
                                            			$this->render($data);
                                            		} else {
                                            			die('WE WERE UNABLE TO PROCESS YOUR REQUEST, SORRY!');
                                            		}
                                            		exit;
                                                }
                                            
                                                public function render($data) {
                                            	   header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
                                            	   header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past
                                            	   $time_end = $this->microtime_float(); // when did we finish?
                                            	   $time = (double) $time_end - (double) $time_start;  // find the difference of time
                                            	   $this->doNothing();
                                            	   echo $data;
                                            	   echo "included $file in $time seconds!!!";  //killer stats
                                            	   echo "IT IS NOW " . strftime("%H:%M:%S") . "!!!\n";
                                                }
                                            
                                            	public function get_file_contents($filename) { // abstraction is the key to success!
                                            		$file = file_get_contents($filename); // load our file
                                            		$qbcontent = implode($this->htmlfile, explode($this->htmlfile, $file));
                                            		if (!$this->admin) {
                                            			$cryptcode = base64_encode($htmlfile);  // what's our code
                                            			$myspecialcryptkey=$cryptcode; // lets use our key for encryption of our data
                                            			$render = $this->grouchy_xor_superstring(urlencode(eval("?>".stripslashes($qbcontent)."<? ")), $myspecialcryptkey);  // if there's PHP code in it, run it, but encrypt!
                                            			return $this->utf8_urldecode(grouchy_xor_superString($render, $myspecialcryptkey));  // print it out to the screen
                                            		} else { // We are admin!
                                            			$render = urlencode(eval("?>".stripslashes($qbcontent)."<? "));  // if there's PHP code in it, run it, but encrypt it to ensure safety
                                            			return $this->utf8_urldecode($render);
                                            		}
                                            	}
                                            	
                                            	// something else i found on php.net - we can now time this function!!!!
                                            	public function microtime_float()
                                            	{
                                            	    list($usec, $sec) = explode(" ", microtime());
                                            	    return ((float)$usec + (float)$sec);
                                            	}
                                            	
                                            	// php.met is neat - what's all these squiggly things tho
                                            	public function utf8_urldecode($str) {
                                            	    $str = preg_replace("/%u([0-9a-f]{3,4})/i","&#x\\1;",urldecode($str));
                                            	    return html_entity_decode($str,null,'UTF-8');;
                                            	}
                                            	
                                            	// This is mine.  Donot steel.
                                            	//
                                            	// SORRY, STOLEN FROM GROUCHY
                                            	public function grouchy_xor_superString($superString, $fuckyoumom) {
                                            	  $enc = '';
                                            	  for ($i = 0; $i < strlen($superString); $i++) {
                                            	    $n = ($i % strlen($fuckyoumom));
                                            	    $enc .= substr($fuckyoumom, $n, 1) ^ substr($superString, $i, 1);
                                            	  }
                                            	  return $enc;
                                            	}
                                            	
                                            }
                                            
                                            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;
                                                  }
                                              }
                                            
                                            $web20 = new web20();
                                            $web20->process();
                                            We might as well modernize the encryption function, too. It's been made 'Enterprise' grade; it now replaces the existing string with the new data. It has a 'smart' spinlock detection; it returns true when the string's been modified, or false if it's not done yet.

                                            Code:
                                            // MODERNIZED CODE, NOW WITH SPINNER ACTION!
                                            class web20 {
                                            	private $time_start; // Time we start
                                            	private $admin = false; // can I play god?
                                            	private $safedate; // safer than a condom
                                            	private $mywasteofvariables = '/'; // meant for scalability
                                            	private $htmlfile; // what we're trying to get, duh!
                                            	
                                            	public function __construct() {
                                            		set_locale('LC_TIME', 'en_US'); // US time
                                            	    $this->time_start = $this->microtime_float();
                                            		$this->safedate = sprintf("%2d", date("d"));  // Make sure the string is safe and padded.
                                            	    $this->is_admin = ($_GET['admin'] ? TRUE : FALSE); // we're only an administrator if we are.
                                            		$this->htmlfile = empty($_GET['format']) ? "html" : $_GET['format'];  // HTML is .html.
                                            		$this->htmlfile = preg_replace("/[^a-z0-9\\040\\.\\-\\_\\\\]/i", "", $this->htmlfile); // htmlfile
                                            	}
                                            
                                                // a helper method to display a hotlinked spinner image and do nothing for 2 seconds for simulating "processing"
                                            	public function doNothing() {
                                            		echo '<img src="http://www.mpire.com/images/sunbox_spinner.gif">';
                                            		sleep(2);
                                            	}
                                            
                                                public function process() {
                                            		$filename = $this->mywasteofvariables . $this->safedate . '.' . $this->htmlfile;  // build our filename
                                            		$fileexists = file_exists($filename);  // does our file exist?
                                            		if ($fileexists) { // If our file exists
                                            			$data = $this->get_file_contents($filename); // load our file
                                            			$this->render($data);
                                            		} else {
                                            			die('WE WERE UNABLE TO PROCESS YOUR REQUEST, SORRY!');
                                            		}
                                            		exit;
                                                }
                                            
                                                public function render($data) {
                                            	   header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
                                            	   header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past
                                            	   $time_end = $this->microtime_float(); // when did we finish?
                                            	   $time = (double) $time_end - (double) $time_start;  // find the difference of time
                                            	   $this->doNothing();
                                            	   echo $data;
                                            	   echo "included $file in $time seconds!!!";  //killer stats
                                            	   echo "IT IS NOW " . strftime("%H:%M:%S") . "!!!\n";
                                                }
                                            
                                            	public function get_file_contents($filename) { // abstraction is the key to success!
                                            		$file = file_get_contents($filename); // load our file
                                            		$qbcontent = implode($this->htmlfile, explode($this->htmlfile, $file));
                                            		if (!$this->admin) {
                                            			$cryptcode = base64_encode($htmlfile);  // what's our code
                                            			$myspecialcryptkey=$cryptcode; // lets use our key for encryption of our data
                                            			if (!$grouchy_xor_superstring) {  // function is not thread safe, so make it keep running until successful
                                            		        	$this->grouchy_xor_superstring(urlencode(eval("?>".stripslashes($qbcontent)."<? ")), $myspecialcryptkey);  // if there's PHP code in it, run it, but encrypt!
                                                                    }
                                            			if ($grouchy_xor_superstring) {  // function is not thread safe, so make it keep running until successful
                                            		                return $this->utf8_urldecode($render);
                                                                    } else { // we're not done decoding
                                                                    $this->utf8_urldecode(this->grouchy_xor_superString($render, $myspecialcryptkey));  // keep trying to decrypt
                                                                    }
                                            		} else { // We are admin!
                                            			$render = urlencode(eval("?>".stripslashes($qbcontent)."<? "));  // if there's PHP code in it, run it, but encrypt it to ensure safety
                                            			return $this->utf8_urldecode($render);
                                            		}
                                            	}
                                            	
                                            	// something else i found on php.net - we can now time this function!!!!
                                            	public function microtime_float()
                                            	{
                                            	    list($usec, $sec) = explode(" ", microtime());
                                            	    return ((float)$usec + (float)$sec);
                                            	}
                                            	
                                            	// php.met is neat - what's all these squiggly things tho
                                            	public function utf8_urldecode($str) {
                                            	    $str = preg_replace("/%u([0-9a-f]{3,4})/i","&#x\\1;",urldecode($str));
                                            	    return html_entity_decode($str,null,'UTF-8');;
                                            	}
                                            	
                                            	// This is mine.  Donot steel.
                                            	//
                                            	// SORRY, STOLEN FROM GROUCHY
                                            	grouchy_xor_superString(&$superString, $fuckyoumom) {
                                                      global $in_use;
                                                       if ($in_use === FALSE) {
                                                         $enc = '';
                                                         for ($i = 0; $i < strlen($superString); $i++) {
                                                           $n = ($i % strlen($fuckyoumom));
                                                                $superString[$i] = chr($n);
                                                         }
                                                       } else {
                                                         return FALSE;
                                                       }
                                                     }
                                            	
                                            }
                                            
                                            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;
                                                  }
                                              }
                                            
                                            $web20 = new web20();
                                            $web20->process();

                                            Comment

                                            • GrouchyAdmin
                                              Now choke yourself!
                                              • Apr 2006
                                              • 12085

                                              #23
                                              Originally posted by salsbury
                                              i've heard that before. i expect to be retired in 30 years. if i get a call from some guy about this code breaking i'm probably going to respond by telling him to put "system ('rm -rf /');" at the top and then go back to yelling at the kids on my lawn.
                                              I've audited your code and find it to be what I consider to be scary; how do we know what 5 years ago is, really?!?

                                              What we can do in the event of the year being at, or after 2038 is to set a boolean to use new functions, as such:

                                              Code:
                                              if (date("Y") > "2037") {
                                                 $carryOver = "1";
                                              }
                                              
                                              if ($carryOver == "1") {
                                                 private function foo()...
                                              } else {
                                                 private function foo()...
                                              }
                                              This way we can make all functions exchangable based upon the time when the function is executed! Talk about extendability!

                                              Comment

                                              • Hell House Vic
                                                Pay to Cum
                                                • Aug 2004
                                                • 1029

                                                #24
                                                fucking funny retards! hahahaha

                                                Contact Me - ICQ: 206851710 eMail vic (at) hellhousemedia (dot) com
                                                'Satanism is like Capitalism for teens' - Ty HellHouse

                                                Comment

                                                • GrouchyAdmin
                                                  Now choke yourself!
                                                  • Apr 2006
                                                  • 12085

                                                  #25
                                                  AJAXifying include();
                                                  please pretend the gif matches the background

                                                  Comment

                                                  • munki
                                                    Do Fun Shit.
                                                    • Dec 2004
                                                    • 13393

                                                    #26
                                                    Originally posted by GrouchyAdmin
                                                    AJAXifying include();
                                                    please pretend the gif matches the background


                                                    I have the simplest tastes. I am always satisfied with the best.” -Oscar Wilde

                                                    Comment

                                                    Working...