Chcialbym rzucic wam na pozarcie skrypt do obslugi malego programiku
http://www.websitescreenshots.com/.
Jak nazwa wskazuje screenshot strony.
Kto ma serwer na windowsie moze to sprawdzic. Program mozna pobrac ze strony powyzej.

Sam skrypt jest bardzo prosty.

Co moge dodac to parametr download 0 badz 1. Poprostu albo mozemy wyswietlic obrazek
albo wymusic sciaganie.

  1. <?php
  2.  
  3. /**
  4.  * WebShoot php Executor
  5.  * 
  6.  * @author Marek `100procent` Serafin
  7.  * @version 1.0.0
  8.  */
  9.  
  10. $mimes = array("jpg" => "image/jpeg",
  11.  "jpeg" => "image/jpeg",
  12.  "jpe" => "image/jpeg",
  13.  "gif" => "image/gif",
  14.  "png" => "image/png",
  15.  "bmp" => "image/bmp");
  16.  
  17. if(isset($_GET['url'])){
  18.  
  19. if(!isset($_GET['bwidth']))  $_GET['bwidth']  = '1024';
  20. if(!isset($_GET['bheight'])) $_GET['bheight'] = '768';
  21. if(!isset($_GET['width'])) $_GET['width'] = '800';
  22. if(!isset($_GET['height']))  $_GET['height']  = '600';
  23. if(!isset($_GET['encoder'])) $_GET['encoder'] = 'png';
  24. if(!isset($_GET['quality'])) $_GET['quality'] = '100';
  25. if(!isset($_GET['download'])) $_GET['download']  = 0;
  26.  
  27. if(array_key_exists($_GET['encoder'], $mimes)){
  28.  
  29. if(!isset($_GET['out'])) $_GET['out'] = md5(date("U")) . '.' . $_GET['encoder'];
  30. if(file_exists($_GET['out'])) $_GET['out'] = md5(date("U")) . '.' . $_GET['encoder'];
  31.  
  32. exec("webshotcmd.exe /url ".$_GET['url']." /bwidth ".$_GET['bwidth']." /bheight ".$_GET['bheight']." /width ".$_GET['width']." /height ".$_GET['height']." /out ".$_GET['out']." /encoder ".$_GET['encoder']." /quality ".$_GET['quality']." ");
  33.  
  34. $headers = apache_request_headers();
  35. if($_GET['download'] == 0){
  36. if (isset($headers['If-Modified-Since']) && (strtotime($headers['If-Modified-Since']) == filemtime($_GET['out']))) {
  37. header('Last-Modified: ' . gmdate('D, d M Y H:i:s', filemtime($_GET['out'])) . ' GMT', true, 304);
  38. }else{
  39. header('Last-Modified: ' . gmdate('D, d M Y H:i:s', filemtime($_GET['out'])) . ' GMT', true, 200);
  40. }
  41.  
  42. header('Content-Length: ' . filesize($_GET['out']));
  43. header('Content-Type: ' . $mimes[$_GET['encoder']]);
  44. header("Cache-Control: public, must-revalidate");
  45. }elseif($_GET['download'] == 1){
  46.  
  47. header("Pragma: hack");
  48. header("Content-Type: " . $mimes[$_GET['encoder']]);
  49. header("Content-Length: " .(string)(filesize($_GET['out'])) );
  50. header('Content-Disposition: attachment; filename="' . basename($_GET['out']) . '"');
  51. header("Content-Transfer-Encoding: binaryn");
  52.  
  53. }
  54.  
  55. print file_get_contents($_GET['out']);
  56.  
  57.  
  58. }else{
  59. echo '<b>Error ::</b> Wrong encoder !';
  60. }
  61. }else{
  62. echo '<b>Error ::</b> Please put url !';
  63. }
  64.  
  65. ?>