Jump to content
GIGN Forum

Recorddemo Direktorija Uz Remote Serveri.


Recommended Posts

saksim ar to ka noskaidrosim kādu OS lieto - win vai linux ?

ja win tad pieņemsim ka servera lokālā ip ir 10.10.10.1 bet remota kaste ir ar *.2 ip addresi

tad uz servera atver my computer, ieraksti \\10.10.10.2 un atversi vaļā to kompi, protams pirmstam jabut šārētai direktorijai ko lietot

ja remotais hosts nav lokālajā tīklā, tad nāksies vien instalet pliku serveri un laist hltv no tā, konektet serverim un ierakstit visu ko gribi..

Link to comment
Share on other sites

Ir ir lokālajā un ir sharots un lūk skripts (windows)

<?php
  function zipcompressfile($source,$destination,$filename,$level=false)
  {
      $dest=$destination.$filename.'.zip';
      $mode='wb'.$level;
      $error=false;
      if($fp_out=gzopen($dest,$mode))
     {
          if($fp_in=fopen($source.$filename,'rb'))
          {
             while(!feof($fp_in))
              {
                  gzwrite($fp_out,fread($fp_in,1024*512));
              }
              fclose($fp_in);
         }
         else
         {
             $error=true;
                       }
          gzclose($fp_out);
      }
      else $error=true;
      if($error) return false;
      else return $dest;
  }

  $demo_dir = '\\192.168.1.199\cs\war3\cstrike\demo'; // Folder with .dem files
 $dl_dir = 'var/www/clients/client6/web25/web/hltv/demo'; // Folder, where to put compressed files

  $handle = opendir($demo_dir);  
  if ($handle)
  {
      while (false !== ($fails = readdir($handle)))
      {
          if ( preg_match("/(.*).dem/", $fails, $demo) )
          {
              zipcompressfile($demo_dir, $dl_dir, $fails);
        }  
  }
     closedir($handle);  
     }

include 'lv.php';

$available_dates = array();
$all_files = array();

foreach (glob("demo/nosaukums-*.zip") as $filename) {

   if (preg_match('/^demo\/nosaukums\-\d{10}\-[a-zA-Z0-9_\-\.]{1,200}\.zip$/', $filename)) {

       $parts = explode("-", $filename);
       $date = $parts[1];
       $map = $parts[2];
       $mapparts = explode(".", $map);
       $map = $mapparts[0];

       $year = substr($date,0,2);
       $month = substr($date,2,2);
       $day = substr($date,4,2);
       $hour = substr($date,6,2);
       $minute = substr($date,8,2);

       $size = filesize($filename);

       $ymd = $year.'-'.$month.'-'.$day;

       if (!in_array($ymd, $available_dates)) {
           if ($ymd >= date('y-m-d', time() - 504800)) {
               $available_dates[] = $ymd;
           }
       }

       $all_files[] = array(
           'filename' => $filename,
           'map' => $map,
           'date' => $ymd,
           'fulldate' => '20'.$year.'-'.$month.'-'.$day.' '.$hour.':'.$minute,
           'size' => $size
       );

   }

}

rsort($available_dates);

$date_to_match = '';
if (empty($_GET['date'])) {
   if (!empty($available_dates[0])) {
       $date_to_match = $available_dates[0];
   }
} elseif ($_GET['date'] >= date('y-m-d', time() - 604800)) {
   $date_to_match = $_GET['date'];
}

$files_to_show = array();

foreach($all_files as $v) {

   if ($v['date'] == $date_to_match) {
       $files_to_show[] = $v;
   }

}

?>
<html>
<head>
   <title>Demo files</title>
   <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
   <script type="text/JavaScript">
   <!--
   function jump(select_obj) {
       if (select_obj.value != '') {
           document.getElementById('form1').submit();
       }
   }
   //-->
   </script>
</head>
<body>
   <table width="400" border=0 cellspacing=0 cellpadding=0 align="center">
       <tr>
           <td align="left">
           <form id="form1">
               <select name="date" onChange="jump(this)" size="1">
                   <option value=""><?php echo $web_lang['hltv_chose_date'];?></option>
                   <?php foreach ($available_dates as $v) { ?>
                   <option <?php echo (!empty($_GET['date']) && $_GET['date'] == $v) ? 'selected="selected"' : ''; ?> value="<?php echo $v; ?>"><?php echo $v; ?></option>
                   <?php } ?>
               </select>
           </form>
           </td>
       </tr>
   </table>
   <br>
   <table width="400" border=0 cellspacing=0 cellpadding=0 align="center">
       <tr>
           <td width="150" align="left"><?php echo $web_lang['hltv_name'];?></td><td width="50"><?php echo $web_lang['hltv_size'];?></td><td width="150"><?php echo $web_lang['hltv_date'];?></td>
       </tr>
       <?php foreach ($files_to_show as $v) { ?>
       <tr>
           <td><a href="<?php echo $v['filename']; ?>"><?php echo $v['map']; ?></a></td>
           <td><?php echo $v['size'] ?></td>
           <td><?php echo $v['fulldate']; ?></td>
       </tr>
       <?php } ?>
   </table>
</body>
</html>

bet parādās šis Warning: opendir(\192.168.1.199\cs\war3\cstrike\demo) [function.opendir]: failed to open dir: No such file or directory in /var/www/clients/client6/web25/web/hltv/hltv.php on line 31

man nesanāk ar šo... kļūda kautkur?

Edit: nezinu ko darīt ar to ka codebox ir tiks liels!

Edited by bloodguy
Link to comment
Share on other sites

nu gandriz pareizi vienigi pirms ip ir jabut \\ nevis vienam slašam..

atver vaļā to remoto cs direktoriju, spied mouse2 uz demo foldera, un tur bus, Map Network Drive, noradi burtu, un iekš tava my computer paradisies x:\ kur x bus burts ko tu esi noradijis, tā būs demo direktorija kā vis disks..

Link to comment
Share on other sites

  • 1 month later...

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...