php-windows Digest 26 Feb 2003 06:57:45 -0000 Issue 1606
Topics (messages 18701 through 18707):
file write issues...
18701 by: Chris Kranz
Re: File Upload Help Needed
18702 by: Chris Kranz
18703 by: Chris Kranz
Disable FTP in Win32 Binary ?
18704 by: greg
eval function
18705 by: Kevin Smith
18707 by: Robert Nürnberg
newbie BASIC sessions...
18706 by: Leo G. Divingracia III
Administrivia:
To subscribe to the digest, e-mail:
[EMAIL PROTECTED]
To unsubscribe from the digest, e-mail:
[EMAIL PROTECTED]
To post to the list, e-mail:
[EMAIL PROTECTED]
----------------------------------------------------------------------
--- Begin Message ---
running this script command line...
$temp_file = "temp_file.txt";
if( !file_exists( $temp_file ) )
{
touch( $temp_file ) or die( "couldn't create new file" );
}
$fp = fopen( $temp_file, "wb" ) or die( "file opening failed" );
fwrite( $fp, $cvs ) or die( "write file failed" );
fclose( $fp );
doesn't write to file. the $cvs is there, nice little comma delimited
string waiting to be put into my file. if i run this off my web server,
it runs fine. but i need to run it command line, and it just gives me
the error "write file failes". dunno why. tried changing it to fputs,
and also added the touch line in there incase it was having trouble
creating the file... which it's not, coz the file gets created fine.
any help please? :)
chris kranz
<http://www.fatcuban.com/> fatcuban.com
--- End Message ---
--- Begin Message ---
It's actually pretty similar to Linux stuff. Most of my local stuff I do
is Win2k, and I don't have much of a problem transferring. Apart from
directories... But then I have a nice little thing in my config file to
figure out if the file is being run locally, or live, and changes the
values for that...
The forms are pretty straight forward to create... Here's something
straight from my website...
$now = time();
$home_dir = "d:/www/fatcuban/";
print "File Upload<br>";
print "Name: ".$file."<br>";
print "Original Name: ".$file_name."<br>";
print "Size: ".$file_size."b<br>";
print "Type: ".$file_type."<br>";
if( $file_size > "10000" )
{
print "File too big. Keep filesize below 10000<br>";
}
else
{
if( $file_type == "text/plain" || $file_type ==
"text/html" )
$new_file = "downloads/".$now.".txt";
if( isset( $new_file ) )
{
print "New File: ".$home_dir.$new_file."<br>";
#copy file to it's new location
if( copy( $file, $home_dir.$new_file ) )
{
print "File successfully copied - <a
href=\"".$new_file."\">here</a><br>";
}
else
{
print "<b>ERROR</b> File copy error:
<br> Source: ".$file."<br>Destination: ".$home_dir.$new_file."<br>";
$new_file = "";
}
unlink( $file );
}
else
{
print "Invalid File type or no file<br>";
$new_file = "";
}
}
Customise $home_dir for whatever you have... This will only upload txt
or html files... But it will display the file properties even if the
file is denied. Also has a file size limit of about 10k. This is a cut
down script of something straight of my website, and that runs on both a
win xp box, and a linux box. Only difference is $home_dir comes from my
config file, and detects for itself what system it's on.
chris kranz
fatcuban.com
-----Original Message-----
From: Jeremy Whitlock [mailto:[EMAIL PROTECTED]
Sent: 25 February 2003 18:10
To: 'Chris Kranz'
Subject: RE: [PHP-WIN] File Upload Help Needed
Chris,
Thanks for your reply. It explains it but it doesn't really
give you any examples. Everything in the manual seems to be Linux based
anyways and for the time being, I'm on Windows 2000. Do you have an
example you'd like to donate? Thanks, Jeremy
-----Original Message-----
From: Chris Kranz [mailto:[EMAIL PROTECTED]
Sent: Tuesday, February 25, 2003 10:23 AM
To: 'PHP'
Subject: RE: [PHP-WIN] File Upload Help Needed
http://www.php.net/manual/en/features.file-upload.php
Surprisingly enough, straight from the manual ;)
chris kranz
fatcuban.com
-----Original Message-----
From: Jeremy Whitlock [mailto:[EMAIL PROTECTED]
Sent: 25 February 2003 17:13
To: PHP
Subject: [PHP-WIN] File Upload Help Needed
PHP List,
I'm new to PHP and I'd like to create a File Upload Page
for my users. Can someone point me in the right direction about how to
get started or offer a script to learn from? Thanks,
Jeremy Whitlock --- MCP/MCSA
IT Manager for Star Precision, Inc.
Phone: (970) 535-4795
Metro: (303) 926-0559
Fax: (970) 535-0780
Metro Fax: (303) 926-0559
http://www.starprecision.com
--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
Oh... And there are better ways of doing this, like using move instead
of copy... But this is how I do it, and it's worked fine for me for the
past few years, so I haven't bothered updating my method much :p
Check phpbuilder.net and dig around the php manual some more... There
are some very good resources in there.
chris kranz
fatcuban.com
-----Original Message-----
From: Jeremy Whitlock [mailto:[EMAIL PROTECTED]
Sent: 25 February 2003 17:13
To: PHP
Subject: [PHP-WIN] File Upload Help Needed
PHP List,
I'm new to PHP and I'd like to create a File Upload Page
for my users. Can someone point me in the right direction about how to
get started or offer a script to learn from? Thanks,
Jeremy Whitlock --- MCP/MCSA
IT Manager for Star Precision, Inc.
Phone: (970) 535-4795
Metro: (303) 926-0559
Fax: (970) 535-0780
Metro Fax: (303) 926-0559
http://www.starprecision.com
--- End Message ---
--- Begin Message ---
Hi!
Can someone provide guidance on how to disable FTP in the Win32 Binary
version?
(The IT Security team at my workplace does not permit FTP. We may not be
able to use PHP unless FTP is disabled, but haven't figured out how to do it
on the Win32 binary version.)
Any assistance would be greatly appreciated.
Thanks,
Greg
--- End Message ---
--- Begin Message ---
Hi All,
Does anyone know why this won't work?
I'm trying to retrieve the contents of a $_POST name dynamically depending
on a unique value as below.
// Works great
$_POST['ADDRESS_ID_1']
// Does work. But shows a blank value, no errors.
$numb=1;
eval("\$_POST['ADDRESS_ID_".$numb."'];");
Any ideas?
Thanks,
Kevin
--- End Message ---
--- Begin Message ---
Why use eval in the first place? $_POST["ADDRESS_ID_".$numb] will work,
as will $_POST["ADDRESS_ID_{$numb}"].
-----Original Message-----
From: Kevin Smith [mailto:[EMAIL PROTECTED]
Sent: Wednesday, February 26, 2003 1:00 AM
To: [EMAIL PROTECTED]
Subject: [PHP-WIN] eval function
Hi All,
Does anyone know why this won't work?
I'm trying to retrieve the contents of a $_POST name dynamically
depending on a unique value as below.
// Works great
$_POST['ADDRESS_ID_1']
// Does work. But shows a blank value, no errors.
$numb=1;
eval("\$_POST['ADDRESS_ID_".$numb."'];");
Any ideas?
Thanks,
Kevin
--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
okay, i'm stumped as heck. i cant seem to get it this to work. using
win2k, apache 1.3.x, php4.3.0, registers_globals OFF.
S1.PHP:
<?php
session_start();
//$userid = "blow";
//session_register ('userid');
$_session['userid']="joe";
echo (' <A HREF="s2.php">s1</A></P>');
?>
S2.PHP:
<?php
session_start();
if (!session_is_registered ("userid"))
{
echo ("not registered");
}
else
{
if (!isset($_session['userid']))
{echo "userid not set";}
else
{
echo ($_session['userid']." is the NAME");
session_unregister ('userid');
}
}
?>
result is "userid not set" each time.
am i missing something so basic here?
i've read through the RTFMs, various web sites describing sessions, etc...
thanks...
--
Leo G. Divinagracia III
[EMAIL PROTECTED]
zzzzz
--- End Message ---