[PHP] Set Cookie in PHP and call with Perl

2003-07-27 Thread TWSC HQ
Hi there - 

Is this possible :
How do i call the cookie value (surname) with Perl if it was set with PHP?

SAMPLE:

PHP Cookie set:



Need to call this cookie with a .pl extension file (perl)

thanks

August 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: Set Cookie in PHP and call with Perl

2003-07-28 Thread TWSC HQ
Hi -

Sorry - by caling I meant to echo the cookie value on a .pl page - and
include it (the cookie value)then in an email.

Any help would be appreciated because the PERL list people said I must try a
PHP list -

Thanks
August

>Is this possible :
>How do i call the cookie value (surname) with Perl if it was set with PHP?
>
>SAMPLE:
>
PHP Cookie set:
>
>setcookie("surname", "mc Seveney", time()+31536000, "/","",0);
>?>
>
>Need to call this cookie with a .pl extension file (perl)




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Write, Zip and Email

2003-06-24 Thread TWSC HQ
Hi all

Is it possible to write to files on a server via a browser, then zip those
files up and email them to the user?

Detail:
I want to enable my website visitors to customize a php script with their
details, all via field inputs. Write that personal info into the script
files << upto here it's easy >> but how does the server zip the package up,
email the package to the visitor and reset the values for the next user?

Thanks in advance!

August


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Help needed - Dynamically Zip Files & Sub-Directories

2003-10-14 Thread TWSC HQ
Hi everybody -

What is wrong with this php zip class (file : phpzip.inc.php)?

I've got this code on one page:

require("phpzip.inc.php");
 $z = new PHPZip();
 $z -> Zip("directory_name/", "out.zip");

where all files and sub-directories + files should be zipped into the zip
file called out.zip

trouble is the class does zip the files in the "directory_name" directory
but does not include the subdirectories and their files.
Works on Windows server but not on unix server

Thanks!

this is the class:

 GetFileList($dir);
   }

   if ((!empty($dir))&&(!is_array($dir))&&(file_exists($dir))) chdir($dir);
   else chdir($curdir);

   if (count($filelist)>0)
   {
foreach($filelist as $filename)
{
 if (is_file($filename))
 {
  $fd = fopen ($filename, "r");
  $content = fread ($fd, filesize ($filename));
  fclose ($fd);

  if (is_array($dir)) $filename = basename($filename);
  $this -> addFile($content, $filename);
 }
}
$out = $this -> file();

chdir($curdir);
$fp = fopen($zipfilename, "w");
fwrite($fp, $out, strlen($out));
fclose($fp);
   }
   return 1;
  }
  else return 0;
 }

 function GetFileList($dir)
 {
  if (file_exists($dir))
  {
   $args = func_get_args();
   $pref = $args[1];

   $dh = opendir($dir);
   while($files = readdir($dh))
   {
if (($files!=".")&&($files!=".."))
{
 if (is_dir($dir.$files))
 {
  $curdir = getcwd();
  chdir($dir.$files);
  $file = array_merge($file, $this -> GetFileList("", "$pref$files/"));
  chdir($curdir);
 }
 else $file[]=$pref.$files;
}
   }
   closedir($dh);
  }
  return $file;
 }

var $datasec  = array();
var $ctrl_dir = array();
var $eof_ctrl_dir = "\x50\x4b\x05\x06\x00\x00\x00\x00";
var $old_offset   = 0;

/**
 * Converts an Unix timestamp to a four byte DOS date and time format
(date
 * in high two bytes, time in low two bytes allowing magnitude
comparison).
 *
 * @param  integer  the current Unix timestamp
 *
 * @return integer  the current date in a four byte DOS format
 *
 * @access private
 */
function unix2DosTime($unixtime = 0) {
$timearray = ($unixtime == 0) ? getdate() : getdate($unixtime);

if ($timearray['year'] < 1980) {
 $timearray['year']= 1980;
 $timearray['mon'] = 1;
 $timearray['mday']= 1;
 $timearray['hours']   = 0;
 $timearray['minutes'] = 0;
 $timearray['seconds'] = 0;
} // end if

return (($timearray['year'] - 1980) << 25) | ($timearray['mon'] <<
21) | ($timearray['mday'] << 16) |
($timearray['hours'] << 11) | ($timearray['minutes'] << 5) |
($timearray['seconds'] >> 1);
} // end of the 'unix2DosTime()' method


/**
 * Adds "file" to archive
 *
 * @param  string   file contents
 * @param  string   name of the file in the archive (may contains the
path)
 * @param  integer  the current timestamp
 *
 * @access public
 */
function addFile($data, $name, $time = 0)
{
$data = str_replace("\x0a", "\x0d\x0a", $data);
$name = str_replace('\\', '/', $name);

$dtime= dechex($this->unix2DosTime($time));
$hexdtime = '\x' . $dtime[6] . $dtime[7]
  . '\x' . $dtime[4] . $dtime[5]
  . '\x' . $dtime[2] . $dtime[3]
  . '\x' . $dtime[0] . $dtime[1];
eval('$hexdtime = "' . $hexdtime . '";');

$fr   = "\x50\x4b\x03\x04";
$fr   .= "\x14\x00";// ver needed to extract
$fr   .= "\x00\x00";// gen purpose bit flag
$fr   .= "\x08\x00";// compression method
$fr   .= $hexdtime; // last mod time and date

// "local file header" segment
$unc_len = strlen($data);
$crc = crc32($data);
$zdata   = gzcompress($data);
$c_len   = strlen($zdata);
$zdata   = substr(substr($zdata, 0, strlen($zdata) - 4), 2); // fix
crc bug
$fr  .= pack('V', $crc); // crc32
$fr  .= pack('V', $c_len);   // compressed filesize
$fr  .= pack('V', $unc_len); // uncompressed filesize
$fr  .= pack('v', strlen($name));// length of filename
$fr  .= pack('v', 0);// extra field length
$fr  .= $name;

// "file data" segment
$fr .= $zdata;

// "data descriptor" segment (optional but necessary if archive is
not
// served as file)
$fr .= pack('V', $crc); // crc32
$fr .= pack('V', $c_len);   // compressed filesize
$fr .= pack('V', $unc_len); // uncompressed filesize

// add this entry to array
$this -> datasec[] = $fr;
$new_offset= strlen(implode('', $this->datasec));

// now add to central directory record
$cdrec