<?php
include('config.php');
include('../helper/sajatfeltolto.php');

$guid = $_GET['guid'];
$sorozatszam = $_GET['sn'];
$honnan = '/home/vendeg/support/' . $guid;
$hova = $folder . 'public/ugyfelupload/' . $sorozatszam;

//print "<br />guid: ".$guid."<br /> sorozatszam: ".$sorozatszam."<br />";

if (!$guid || !$sorozatszam) {
  $msh2->insert("`" . $config2['db_name'] . "`.`a_hibak`", array(
    "osztaly" => "projects",
    "fv" => "supportupload",
    "hiba" => "Hi�nyz� guid vagy sorozatsz�m:\nguid: " . $guid . "\nsorozatsz�m: " . $sorozatszam,
    "datum" => date('Y-m-d H:i:s', time()),
  ));
  return;
}

if (!file_exists($honnan) && file_exists($honnan . "=")) $honnan .= "=";
elseif (!file_exists($honnan) && file_exists($honnan . "==")) $honnan .= "==";

if (!is_dir($hova)) {
  print($hova);
  mkdir($hova, 0777);
  exec("chmod 777 " . $folder . $hova);
}
$hova .= "/" . trim(base64_decode($guid), "=");;

if (athelyez($honnan, $hova)) {
  exec("chmod 777 " . $folder . $hova);
} else // sikertelen masolas
{
  $msh2->insert("`" . $config2['db_name'] . "`.`a_hibak`", array(
    "osztaly" => "projects",
    "fv" => "supportupload",
    "hiba" => "M�sol�s hiba, honnan:" . $honnan . "\nhova: " . $hova,
    "datum" => date('Y-m-d H:i:s', time()),
  ));
}
