code.fastix.org

Dateiansicht:

Datei:Projekte -> PHP:executeAlone -> executeAlone.php
md5:e8bd51fb50c8c594fae09cc06cc2a1cc
sha1:c2e7c0c9040c1289f0b378cd00e46ba34410c7b0
Download-Link:Download
  1. <?php # This has to be the FIRST line! Show $stripFirstPhpOpenLine in executeCaller.php
  2.  
  3. # All in the next rows the is only a example. Do her, what you have to do!
  4.  
  5. /*
  6. * Configuration:
  7. */
  8.  
  9. $deleteFile = true; #delete the temporary File after execution? Set FALSE for debugging.
  10. $to         = "fastix@localhost"; # Often you want to use the mailaddress from the user, given via formular ($_POST, $_GET).
  11. $subject    = "alone executed";
  12.  
  13. /*
  14. * This is only a DEMONSTRATION how to handle the data. Show to executeCaller.php how export the vars.
  15. */
  16.  
  17. ob_start(); # save all output to a buffer!
  18.  
  19. ini_set("display_errors", 1);
  20.  
  21. #
  22. if ( ! false == strpos( __FILE__, 'executeAlone.php' ) ) {
  23.     trigger_error ( "Dieses Skript sollte nicht direkt aufgerufen werden!", E_USER_ERROR );
  24. }
  25.  
  26. echo "Data:\n=====\n\n";
  27.  
  28. if ( isset( $_SESSION )  ) {
  29.     session_id( $_SESSION['id'] );
  30.     session_start();
  31.     # this is only for the mail:
  32.    echo '$_SESSION = ' . var_export( $_SESSION, true ) . "\n\n";
  33. }
  34.  
  35. if ( isset( $_ENV )  ) {
  36.     # this is only for the mail:
  37.    echo '$_ENV = ' . var_export( $_ENV, true ) . "\n\n";
  38. }
  39.  
  40. if ( isset( $_SERVER )  ) {
  41.     # this is only for the mail:
  42.    echo '$_SERVER = ' . var_export( $_SERVER, true ) . "\n\n";
  43. }
  44.  
  45. if ( isset( $_GET )  ) {
  46.     # this is only for the mail:
  47.    echo '$_GET = ' . var_export( $_GET, true ) . "\n\n";
  48. }
  49.  
  50. if ( isset( $_POST )  ) {
  51.     # this is only for the mail:
  52.    echo '$_POST = ' . var_export( $_POST,  true) . "\n\n";
  53. }
  54.  
  55. if ( isset( $_COOKIE )  ) {
  56.     #
  57.    # You have to know, that you DON'T can send cookies to the Browser!
  58.    #
  59.    # this is only for the mail:
  60.    echo '$_COOKIE = ' . var_export( $_COOKIE, true ) . "\n\n";
  61. }
  62.  
  63. if ( isset( $foo )  ) {
  64.     echo '$foo = ' . var_export($foo, 1) . "\n";
  65. }
  66.  
  67. if ( isset( $bar )  ) {
  68.     echo '$bar = ' . var_export($bar, 1) . "\n";
  69. }
  70.  
  71. # Now you can send all output to the given emailaddress:
  72. $message = ob_get_clean();
  73. mb_language( 'uni' );
  74. mb_send_mail ( $to , $subject , $message, '', '' );
  75.  
  76. # This can delete the file after executing
  77.  
  78. if ( $deleteFile && ( false === strpos(__FILE__, 'executeAlone.php' ) ) ) {
  79.     unlink (__FILE__);
  80. }