code.fastix.org

Dateiansicht:

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