<?php

##############################################################################
// eCards Virtual Greeting Card System
// Copyright (C) 2004 by 4n-community.de
// http://www.4n-community.de
// http://www.xybersystem.net
// ---------------------------------------------------------------------------
// LICENSE:
// This Script is copyright of www.4n-community.de and may free of charge be used exclusively for private homepage.
// For free use  must all copyright notices unchanged in the Script! Also not be removed, converted, hidden or made invisible.
// If you liked not to indicate the copyright reference or the Script on commercial sides begin, you can acquire a license (= > LIZENZ.txt)!
// ---------------------------------------------------------------------------
// Filename: Card_V7.1 & XCard 0.7.3
// Original Author: Lothar Dambowsky
// Ported & modified by Inhyun Choi
// Purpose: Create via web a Virtual Greeting Card
// ---------------------------------------------------------------------------
// Forum to the Script of: http://www.xybersystem.net
##############################################################################

if (!eregi("admin.php", $PHP_SELF)) { die ("Access Denied"); }
include("header.php");
include("config.php");
$index=0;

if (isset($lang)) {
    include("modules/Card/language/lang-$lang.php");
    $language = $lang;
} else {
    include("modules/Card/language/lang-$language.php");
}

if ($action == ""._MENUETHUMBCREATE.""){include "modules/Card/thumb.php"; exit();}

OpenTable();

echo "<br>";

if (!((preg_match("/\.jpg$/i",$datei_name)) || (preg_match("/\.jpeg$/i",$datei_name)) || (preg_match("/\.png$/i",$datei_name)) || (preg_match("/\.gif$/i",$datei_name)))) {
echo "<center><br><b>"._MENUENORESTORE." </b><center><br> ";
echo "<center><br><a href=\"javascript:history.back();\"><b>"._CARDBACK."</b></a></center>"; CloseTable(); exit();}


  $ziel1="modules/Card/image/$ziel/";
  $handle = opendir($ziel1);
  while($file = readdir($handle))
  { if($file != "." && $file != ".." && $file != "index.htm" && $file!="thumb.php")
  { $vorh_dateien .= $file . " "; }}


  if(!eregi($datei_name, $vorh_dateien)) {
    $ueber=1;
  }

  if($ueber==1) {
    $dest = "modules/Cards/image/$ziel/$datei_name";
    if ($ziel == "") {echo "<center><br><b>"._MENUEKATSELINFO."</b></center>";
    echo "<center><br><a href='admin.php?op=card'><b>"._CARDBACK."</b></a></center><br>"; exit();}
    
    
    $gif="modules/Card/gif_image.gif";
    $gifthumb=("th_"."$datei_name");
    $gifpic="modules/Card/image/$ziel/$gifthumb";

   
    if (@copy($datei, $dest)){
    $dat= "modules/Card/image/$ziel/$datei_name";
    chmod ($dat, 0777);
    
    if (preg_match("/\.gif$/i",$datei_name))
    {
    @copy($gif, $gifpic);
    chmod ($gifpic, 0777);
    echo "<br><center><b>"._MENUEFILE." "._MENUEOKSTORE."</b></center><br>";
    }

    else {include "admin/modules/card/thumb1.php";}

    echo "<center><br>$datei_name "._MENUEOKSTORE."<br>";
    echo " "._MENUEFILESIZE." $datei_size "._MENUEBYTE."<br><br></center>";

    if(eregi($datei_name, $vorh_dateien))
      {
    $dat= "modules/Card/image/$ziel/$datei_name"; chmod ($dat, 0777);
    echo "<center><br> "._MENUEFILEREWRITE."<center> ";
      }}

    else
      {
    echo "<center><br><b>$datei_name  "._MENUENOSTORE."  </b><center> ";
      }}

    else
      {
    echo "<center><br><b>"._MENUEFILE." $datei_name "._MENUEFILEDOUBLE."</b></center> ";
      }

echo "<center><br><a href='admin.php?op=menue&ziel=$ziel'><b>"._CARDBACK."</b></a></center><br>";

CloseTable();

include("footer.php");

?>
