View file Upload/Upload/common.php

File size: 3.71Kb
<?php
# ---------------------------------------------------------------------
# eFusian
# Copyright (C) 2002 by the Fusian Development Team.
# http://www.efusian.co.uk
# ---------------------------------------------------------------------
# Author:              Oliver James Ibbotson Esq.
# Date:                1st February 2003
# ---------------------------------------------------------------------
# Script Name:         common.php / FileFusian
# Script Version:      1.6
#
# Description:         This script is the common file for the
#                      file-fusian script.
#
# Revision History:
# ---------------------------------------------------------------------
?>


<?php

/* Upload Routine */

if(isset($fupload))
{

	require 'config.php';

	$ext = strrchr($fupload_name,'.');

	if ($ext == $filetype1 || $ext == $filetype2 || $ext == $filetype3 || $ext == $filetype4 || $ext == $filetype5)
	{

	/* Peform Upload Actions */

	$final_path=$file_dir . "/" . $fupload_name;					# Generate final path & filename.
	move_uploaded_file( $fupload, $final_path ) or die ("Unable To Copy");	# Moves file.


	/* Perform Post Upload Actions */

	upload_report($fupload, $fupload_name, $fupload_size, $fupload_type, $file_url, $file);	# Call upload report generation function.

	}

	else
	{

	echo '<script language="JavaScript">';

	echo 'error = window.open("error.php?id=filetype","","width=350,height=235,status=no,toolbar=no,menubar=no");';

	echo '</script>';

       }

}

?>



<?php

/* Upload Report Generation Function */

function upload_report($fupload, $fupload_name, $fupload_size, $fupload_type, $file_url, $file)
{

   	/* Generate Upload Report */

	require('config.php');

	echo '<font face="verdana" color="darkblue">';
	echo "<img src='$logo_file'>";
	Print "<h3>Результат Загрузки</h3>";
	echo '</font>';


	print "<b>Имя файла:</b> $fupload_name<br>";
	print "<b>Размер:</b> $fupload_size bytes<br>";
	print "<b>Тип:</b> $fupload_type<p>";

	print "<b>Теперь Вы можете зайти на сайт wap.sams-club.ru со своего телефона в раздел 'Архив Пользователей' и найти там ваш файл, но прежде его должен проверить Администратор.</b><br>";


}

?>



<?php

/* Directory Listing Function */

function directory_listing($file_dir, $file_url)
{

  require('config.php');									# Reads in configuration file.

  $directory = opendir ($file_dir);		    					# Open Directory for reading.

  echo '<div class = "container">';							# Use CSS Class (container).

  echo '<font face="verdana" color="darkblue">';					# Sets font face & color.
  echo "<img src='$logo_file'>";								# Display FileFusian logo.

  echo '<div class = "header">';								# Use CSS class (header).
  echo '<h3>Directory Listing</h3>';							# Display file listing page title.
  echo '</div>';										# End CSS class (header).

  print "<h6>A maximum of $listsize files will be displayed.</h6>";			# Displays number of files to be displayed.
  print "<hr>";										# Displays horizontal rule.

  echo '<table>';					     					# Create table.

  for($fcount = 0; $fcount < $listsize; $fcount++)   					# File display loop - runs until $listsize value is reached.
    {

      $file = readdir ($directory);
      echo '<tr><td>';				     					# Create table row, get ready for data.

      if($file != "" && $file != "." && $file != "..")
      {

      echo '<img src="http://efusian.co.uk/~filefusian/images/download.gif">';	# Link to download icon.

      print "  <a href='$file_url/$file'>$file</a>";					# Prints filename hyperlink to directory listing.

      }

      echo '</td></tr>';				     					# Close table data and row.

    }

  echo '</table>';					     					# Close table.

  echo '</div>';										# End CSS class (container).

  closedir ($directory);				     					# Close directory.

}

?>