|
Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com |
php-general-digest-help_at_lists.php.net
Date: Mon Nov 04 2002 - 05:03:01 CST
php-general Digest 4 Nov 2002 11:03:01 -0000 Issue 1684
Topics (messages 122582 through 122655):
Re: Am I blind? simple 15 line code producing error
122582 by: Chris Shiflett
122623 by: . Edwin
122626 by: Justin French
122629 by: . Edwin
Re: fread() fails with large files
122583 by: rija
Phpmyadmin HELP!!!
122584 by: Rodrigo de Oliveira Costa
122628 by: Jason Wong
Re: Multiple Addresses Mailer
122585 by: Manuel Lemos
122586 by: Manuel Lemos
Re: XSLT Sablotron output
122587 by: Mark Charette
Re: Kxparse 0.2
122588 by: Justin French
Re: Cookies disabled, new session ID each click!
122589 by: Steve Fatula
122598 by: Steve Fatula
122627 by: Jason Wong
Re: Your opinion on globals/reference
122590 by: rolf vreijdenberger
Re: Send $out embedded in a mail in HTML FORMAT
122591 by: Kevin Fradkin
uploading help please again
122592 by: marcelo
122594 by: John W. Holmes
Add content thru e-mail
122593 by: Rodrigo de Oliveira Costa
122595 by: Timothy Hitchens (HiTCHO)
FTP Search
122596 by: Manuel Jenne
radio buttons from MySQL query?
122597 by: David Jackson
122607 by: rija
122610 by: John Nichel
122616 by: rija
122619 by: David Jackson
122620 by: John Nichel
Error in code - Seems simple enough
122599 by: vernon
122601 by: John W. Holmes
122603 by: vernon
122608 by: rija
Images retrieved from MYSQL database using PHP becoming corrupted.
122600 by: Darren McPhee
122640 by: Hatem Ben
trouble with maximum_execution_time and file upload
122602 by: Eduardo M. Bragatto
122655 by: Marek Kilimajer
re:[PHP] uploading help please again
122604 by: rija
122624 by: Jason Wong
Global Variables Off
122605 by: Paul
122606 by: Chris Shiflett
122609 by: Paul
122611 by: John Nichel
122612 by: Paul
122613 by: Chris Shiflett
122614 by: Justin French
122615 by: Paul
122618 by: rija
122625 by: . Edwin
More on cleaning Windows characters...
122617 by: a.h.s. boy
122635 by: Tom Rogers
Threads
122621 by: Khalid El-Kary
122622 by: Rasmus Lerdorf
Session cookies
122630 by: Shaun
122633 by: Erwin
Re: phpinfo
122631 by: David Russell
fgets()
122632 by: Khalid El-Kary
122634 by: Erwin
Battling with highlighting search criteria
122636 by: David Russell
122639 by: Erwin
122643 by: David Russell
122644 by: Justin French
122645 by: Erwin
122648 by: David Russell
122649 by: David Russell
122650 by: David Russell
122651 by: Erwin
122652 by: Erwin
122653 by: Justin French
Address array?
122637 by: Steve Jackson
122638 by: Erwin
122647 by: Jason Wong
Re: confirm subscribe to php-general
lists.php.net
122641 by: David Robley
Re: Who can tell me where I can get the cracked Zend Encoder3.0 ?
122642 by: Krzysztof Dziekiewicz
How to use OCISaveLob & OCILoadLob & OCISaveLobFile
122646 by: Jean Tardy
Re: Battling with highlighting search criteria -solution
122654 by: Justin French
Administrivia:
To subscribe to the digest, e-mail:
php-general-digest-subscribe
lists.php.net
To unsubscribe from the digest, e-mail:
php-general-digest-unsubscribe
lists.php.net
To post to the list, e-mail:
php-general
lists.php.net
----------------------------------------------------------------------
attached mail follows:
Paul,
Something I don't think others have mentioned yet is tht a common reason
for this error is when there is an error somewhere in your script prior
to the header() call. Because PHP will output the error to the screen
(assuming you don't have any special error handling), it might not be
you who is generating output but rather PHP due to an error somewhere.
It might even just be a warning. So, the error you are receiving might
be a bit misleading.
My advice would be to take the header() call out for the moment, and see
if you get any output on the screen. If you see something, you've found
the problem. If you don't see anything, check for any possible places
where whitespace might be output (as others have suggested).
Chris
Paul wrote:
>Warning: Cannot add header information - headers already sent by (output
>started by.. ..line 6) ...on line 12
>
attached mail follows:
Hello,
Could it be that because you have a blank line between
> require_once "classes/HtmlTemplate.class";
>
> if ($HTTP_SESSION_VARS[user_id]){
?
(Or even some blank lines or spaces before "require_once".)
Just guessing...
- E
attached mail follows:
on 04/11/02 4:15 PM,
Edwin (copperwalls
hotmail.com) wrote:
> Hello,
>
> Could it be that because you have a blank line between
>
>> require_once "classes/HtmlTemplate.class";
Shouldn't it be require_once("classes/HtmlTemplate.class");
???
Justin
attached mail follows:
Perhaps?
But you don't really need the parenthesis ;)
- E
"Justin French" <justin
indent.com.au> wrote:
> on 04/11/02 4:15 PM,
Edwin (copperwalls
hotmail.com) wrote:
>
> > Hello,
> >
> > Could it be that because you have a blank line between
> >
> >> require_once "classes/HtmlTemplate.class";
>
> Shouldn't it be require_once("classes/HtmlTemplate.class");
>
> ???
>
attached mail follows:
Use readfile instead fread() if you've got some problem with, it looks
better!
Header("Content-Type: $type");
Header("Content-Disposition: attachment; filename=$downloadname");
header("Content-Length: $size");
header("Content-Transfer-Encoding: binary");
readfile($file);
----- Original Message -----
From: "Sora B. Harbater" <harbater
teamgenesis.com>
To: <php-general
lists.php.net>
Sent: Monday, November 04, 2002 12:44 AM
Subject: [PHP] fread() fails with large files
> Hi. I am using Linux/Apache with PHP 4.1.2. I have been experiencing
this
> problem since upgrading from an earlier version of PHP 4.
>
> My script forces a download of a PDF file after looking up some info in a
> database. The code looks like this:
>
>
> $file="/path/to/file";
> $fp = fopen($file, "r");
> $size=filesize($file);
> $contents = fread($fp, $size);
> fclose($fp);
>
> Header("Content-Type: $type");
> Header("Content-Disposition: attachment; filename=$downloadname");
> header("Content-Length: $size");
> header("Content-Transfer-Encoding: binary");
> echo $contents;
>
> filesize() is reporting the size properly. The code works perfectly for
> smaller files, but the fread() fails for files larger than 19 MB or so and
> I got a page cannot be displayed error. I know that it is fread() which is
> causing the problem because I commented out all the code that follows it
> and still get the error. All the files being downloaded are PDF files.
>
> Can anyone shed some light on this?
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
attached mail follows:
Hi people,
After I installed phpmyadmin on my computer that runs an Apache I've worked almost everything out.
The only problem I seem to have is that when I create a Database I can't put more than 8 columns and if I do it simply doesnt accept it.
Another problem that it looks like I'm having is that when I log into a database it shows all the tables in that database on my left but if I click on a table with more than 8 columns, that I created in the DOS, it simply doesnt show the details. HELP!!!
I'm running:
Windows XP
Php 4.2.2
Apache 2.0.39
MySql 3.23.51
PhpMyAdmin 2.3.2
Thanks,
Rodrigo
attached mail follows:
On Monday 04 November 2002 07:16, Rodrigo de Oliveira Costa wrote:
> Hi people,
>
> After I installed phpmyadmin on my computer that runs an Apache I've worked
> almost everything out. The only problem I seem to have is that when I
> create a Database I can't put more than 8 columns and if I do it simply
> doesnt accept it. Another problem that it looks like I'm having is that
> when I log into a database it shows all the tables in that database on my
> left but if I click on a table with more than 8 columns, that I created in
> the DOS, it simply doesnt show the details. HELP!!!
I think phpmyadmin has its own mailing list. You should be asking on there.
-- Jason Wong -> Gremlins Associates -> www.gremlins.com.hk Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development */* I used to be disgusted, now I find I'm just amused. -- Elvis Costello */
attached mail follows:
Hello,
On 10/31/2002 10:09 AM, -<>- wrote: >>You are contradicting yourself. Most mailing list programs put all >>recipients in Bcc: and queue only on message, so it is the same thing >>that you are recommending against and for it. > > But most listservers generate a new message for each receiver. Most
You are confusing queuing with sending. Most list servers queue a single message with all recipients in Bcc and the mail server delivers separate messages obviously because the destination SMTP server is different.
> mailservers, my own included, do not accept more than 5 recipients in the > bcc field...50 total for to and cc combined (some allow more).
That is usually a limit that exists for relaying (via SMTP) .
> The limit's there to prevent spam. Also it would be abuse of the intent to
The limit exists to prevent unwarned clients from abusing from their ISP servers overloading it with messages to many recipients that make the mail server hog the machine for a long time. You may even be sending solicited newsletter messages which are not SPAM, but for your ISP the load that it inflicts to the server is inacceptable.
You may still use the server for sending SPAM, either many messages at once or one at a time. Either way, you should not be doing that unless your ISP authorizes you to do so.
> use bcc for the entire list of receivers. Also you cannot have a bcc > without a to field anyway ...
>>Spam filters that discard messages which the recipients are in Bcc: are >>wrong, just like everybody that filters messages with general criteria >>like that. Anyway, it is their problem if they discard messages arbitrarily. > > > If the bcc field is the only field with a receiver, then the message is > malformed and should be rejected. The To:, Subject:, and Date: fields are > required to fullfill RFC 822. If you only get Bcc: and no To:, then the > message should be bounced, that's how alot of spam used to be addressed, > and some still is.
Let me tell you a secret, for the SMTP protocol, whatever you put in the headers is irrelevant. Message headers are actually part of the message body for the SMTP protocol. So, you can put a fake To: header in there but the message is actually not delivered to it.
What I mean is that SMTP servers do not parse headers. SPAM filters may do so and reject the message if you lack a wellformed To: header though.
So, to please everybody, you can just put an arbitrary To: header and put all the real recipients in Bcc:.
>>You need to check with the ISP if sending to many recipients respects >>the acceptable use policy. If they don't accept bulk mailing, it doesn't >>matter the method you use. > > > I've never met an ISP that would refuse bulk mailing, as long as you can > proove that you've got concent from the receivers for the messages. My > mail server handles all the concent things itself, and sofar my ISPs have > not complained about the up to 3 digit amounts of message that go out each > day, with up to 4 digits coming in...
So, there you have it, some ISP may allow a number of messages upto a limit but you need to ask them to know what the limit is.
--Regards, Manuel Lemos
attached mail follows:
Hello,
On 10/31/2002 01:53 PM, Olinux wrote: >>I've never met an ISP that would refuse bulk >>mailing, as long as you can >>proove that you've got concent from the receivers >>for the messages. My >>mail server handles all the concent things itself, >>and sofar my ISPs have >>not complained about the up to 3 digit amounts of >>message that go out each >>day, with up to 4 digits coming in... > > I have a site hosted on a shared server and if I try > to generate an email with more than 75 BCC addresses > it will not be sent. I was instructed to use the > listserve software that they provide to do mailings > like this. They don't disapprove high volume mailing, > but they do have a problem if you use BCC. I guess > that it's either harder on the server or because its > most likely spam.
You need to understand what the difference is. Most likely what they do not allow is relaying messages to many receipients sent via SMTP which is different from injecting the messages in the mail queue using sendmail program or similar.
> On my dedicated servers (another company) we can do > whatever we please, but I do think that a large number > of filters are tipped off by a high volume of BCC's > ...
Of course, you are already paying a lot of money for the dedicated resources.
--Regards, Manuel Lemos
attached mail follows:
There's nothing to "solve"; without the complete XML doc & the XSL stylesheet, there's no way to know if in fact everything is being parsed as expected. I don't know if it's CDATA, xsl:text, a strip-spaces directive, etc. And ... I'd expect anyone using XML & XSL to double check and re-reference all their books before posting a problem (Sablotron is pretty well tested; I don't think it's the problem ...)
Then, after exhausting my brain and building the smallest possible set of code that reproduces my problem ...
I'd submit it to a XML list.
Of couse, the sample script to me looks perfectly valid, since HTML isn't required to have newlines and of course newlines within text blocks aren't preserved anyway ...
Mark C.
-----Original Message-----
From: Daniele Baroncelli [mailto:ubimmc93
libero.it]
Sent: Sunday, November 03, 2002 2:48 PM
To: php-general
lists.php.net
Subject: [PHP] Re: XSLT Sablotron output
No one replied yet, so I suppose no one was able to solve this.
By the way, is there anyone that actually experienced the same situation?
"Daniele Baroncelli" <ubimmc93
libero.it> wrote in message
news:20021102212518.34728.qmail
pb1.pair.com...
> Hi guys,
>
> I have typed a simple script to test the Sablotron module recently
> installed.
> I found out that the HTML is output all in one line, without newlines,
which
> is very annoying.
> Anyone can tell me if this is a bug of the module, or I have to specify
> something somewhere?
>
> Here is the script on the server, where you can watch the result:
> http://www.rockit.it/redazione/sixth/prova.php
>
> Below you can find my PHP, XML and XSL files.
>
>
> Cheers
>
> Daniele
>
>
> ==========
>
> PHP file
> ----------
>
>
> <?php
>
> // Allocate a new XSLT processor
> $xh = xslt_create();
>
> // call the XSLT processor directly
> xslt_process($xh, 'prova.xml', 'prova.xsl', 'prova.html');
>
> // output the result
> readfile('prova.html');
>
> xslt_free($xh);
>
> ?>
>
> ==========
>
> XML file
> -----------
>
> <?xml version="1.0"?>
> <me>
> <name>John Doe</name>
> <address>94, Main Street, Nowheresville 16463, XY</address>
> <tel>738 2838</tel>
> <email>johndoe
black.hole.com</email>
> <url>http://www.unknown_and_unsung.com/>
> </me>
>
> ===========
>
> XSL file
> ---------
>
> <?xml version="1.0"?>
>
> <xsl:stylesheet version="1.0"
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
>
> <xsl:template match="/">
>
> <html>
> <head>
> </head>
> <body>
> <h1>Contact information for <b><xsl:value-of select="me/name" /></b></h1>
>
> <h2>Mailing address:</h2>
> <xsl:value-of select="me/address" />
>
> <h2>Phone:</h2>
> <xsl:value-of select="me/tel" />
>
> <h2>Email address:</h2>
> <xsl:value-of select="me/email" />
>
> <h2>Web site URL:</h2>
> <xsl:value-of select="me/url" />
>
> </body>
> </html>
>
> </xsl:template>
>
> </xsl:stylesheet>
>
> ==========
>
>
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
attached mail follows:
Haven't we heard about this a few times now?
on 04/11/02 5:45 AM, Khalid El-Kary (khalid_kary
hotmail.com) wrote:
> hi, > > i want to just tell you about the new release of Kxparse (a XML parser) > you can find everything about the new release here > > http://creaturesx.ma.cx/kxparse/ > > khalid > > > > > > > > _________________________________________________________________ > Surf the Web without missing calls! Get MSN Broadband. > http://resourcecenter.msn.com/access/plans/freeactivation.asp >
attached mail follows:
Oleg and anyone else, PLEASE READ THE POST.
This is vendor software, this is what it does, it doesn't matter if it's the way you would do it, if it is the best way, or anything else. So, please tell me why the short program I uploaded as an example does or does not work for you.
Steve
Oleg Krogius wrote:
> You do not need to add any "SID" to your links. Those will be added
> automatically by the php session system when needed.
>
> -----Original Message-----
> From: Steve Fatula [mailto:sfatula
usa.net]
> Sent: Saturday, November 02, 2002 10:29 PM
> To: php-general
lists.php.net
> Subject: Cookies disabled, new session ID each click!
>
> I posted this but not sure Google works, so using my own account as it
> did not show up yet.
>
> I am fairly new to PHP, and am running a shopping cart app written in
> PHP. Most people using this cart do not have this issue, but I do!
>
> I have boiled the program down to a few lines, and it doesn't work. When
>
> you click on the link in the code, it gives you a session ID. Then, when
>
> you click again, it goes away. The SID appears to be blank every other
> time.
>
> Why would that be? I am using PHP 4.2.0 and 4.2.2, BSD and Linux, and
> Apache 1.3.20 something. Two different hosts. Same result. Client is
> IE5.5 with cookies disabled, running on NT. New session file is
> generated even though one already existed. This happens every other
> click as SID is blank every other click.
>
> Please help me understand what the issue is.
>
> Steve
>
> <?php
> session_name('Steve');
> session_start();
> ?>
> <!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
> <html>
> <head>
> <meta http-equiv="Content-Type" content="text/html">
> <title>Test Page</title>
> </head>
> <body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0"
> leftmargin="0" rightmargin="0">
> <?php echo '<a href="http://linux.office.home/catalog/default_test.php?'
>
> . SID . '">link to me</a>'; ?>
> </body>
> </html>
>
>
>
>
attached mail follows:
If you want to see a site where the small program works (and be SURE and turn cookies off), click here: http://www.thewebmakerscorner.com/snapmods_new/default_test.php
So, can anyone tell me why it does not work on MY site(s)? Any ideas? Surely this is a PHP configuration issue/bug perhaps? Logically, I don't see any settings that could possibly affect the outcome using this technique.
Steve
Steve Fatula wrote:
> Oleg and anyone else, PLEASE READ THE POST.
>
> This is vendor software, this is what it does, it doesn't matter if it's
> the way you would do it, if it is the best way, or anything else. So,
> please tell me why the short program I uploaded as an example does or
> does not work for you.
>
> Steve
>
>
> Oleg Krogius wrote:
>
>> You do not need to add any "SID" to your links. Those will be added
>> automatically by the php session system when needed.
>>
>> -----Original Message-----
>> From: Steve Fatula [mailto:sfatula
usa.net] Sent: Saturday, November
>> 02, 2002 10:29 PM
>> To: php-general
lists.php.net
>> Subject: Cookies disabled, new session ID each click!
>>
>> I posted this but not sure Google works, so using my own account as it
>> did not show up yet.
>>
>> I am fairly new to PHP, and am running a shopping cart app written in
>> PHP. Most people using this cart do not have this issue, but I do!
>>
>> I have boiled the program down to a few lines, and it doesn't work. When
>>
>> you click on the link in the code, it gives you a session ID. Then, when
>>
>> you click again, it goes away. The SID appears to be blank every other
>> time.
>>
>> Why would that be? I am using PHP 4.2.0 and 4.2.2, BSD and Linux, and
>> Apache 1.3.20 something. Two different hosts. Same result. Client is
>> IE5.5 with cookies disabled, running on NT. New session file is
>> generated even though one already existed. This happens every other
>> click as SID is blank every other click.
>>
>> Please help me understand what the issue is.
>>
>> Steve
>>
>> <?php
>> session_name('Steve');
>> session_start();
>> ?>
>> <!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
>> <html>
>> <head>
>> <meta http-equiv="Content-Type" content="text/html">
>> <title>Test Page</title>
>> </head>
>> <body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0"
>> leftmargin="0" rightmargin="0">
>> <?php echo '<a href="http://linux.office.home/catalog/default_test.php?'
>>
>> . SID . '">link to me</a>'; ?>
>> </body>
>> </html>
>>
>>
>>
>>
>
attached mail follows:
On Monday 04 November 2002 10:24, Steve Fatula wrote: > If you want to see a site where the small program works (and be SURE and > turn cookies off), click here: > http://www.thewebmakerscorner.com/snapmods_new/default_test.php > > > So, can anyone tell me why it does not work on MY site(s)? Any ideas? > Surely this is a PHP configuration issue/bug perhaps? Logically, I don't > see any settings that could possibly affect the outcome using this
Have you tried any browsers other than IE 5.5?
First time I go into that page, my URL shows this
http://www.thewebmakerscorner.com/snapmods_new/default_test.php
Clicking on the link appends the session id to the URL. As does clicking on the link again (same session id). Ad infinitum.
So basically it works?
-- Jason Wong -> Gremlins Associates -> www.gremlins.com.hk Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development */* University politics are vicious precisely because the stakes are so small. -- Henry Kissinger */
attached mail follows:
but what if you decide later you want more objects or globals in your function?? your parameter list could get quit long!
-- Rolf Vreijdenberger De Pannekoek en De Kale W: www.depannekoekendekale.nl "Gerard Samuel" <gsamtrini0.org> schreef in bericht news:3DC54436.2090803
trini0.org... > Something I just thought of about using global in a function. > Mostly I global objects in a function like -> > > function foo() > { > global $bar_object; > $bar_object->do_something(); > } > > Is it better, more effiecient, if I pass it by reference, like -> > function foo(&$bar_object) > { > $bar_object->do_something(); > } > > Thanks for your thoughts... > > -- > Gerard Samuel > http://www.trini0.org:81/ > http://dev.trini0.org:81/ > >
attached mail follows:
Thanks a lot!!.. finally.. i found what i was looking! nice having people who can help us!
attached mail follows:
Ok I'm back
This script is to upload 2 image files
Whit register_globals = on it Works fine
script A
"p.php"
<title>Jornal O Leme</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> </head>
<body bgcolor="#006699"> <table width="100%" border="0" cellpadding="0" cellspacing="0"> <!--DWLayoutTable--> <tr> <td width="100%" height="70" valign="top"><img src="test.jpg" width="600" height="120"> </td> </tr> <tr> <td height="262" valign="top"><p> </p> <form method="post" action="pi.php" enctype="multipart/form-data"> <table width="75%" border="0" align="center" bgcolor="#FFFFFF"> <tr> <td width="23%"><div align="center"><font face="BankGothic Md BT"> </font></div></td> <td width="77%" bgcolor="#FFFFFF"> </td> </tr> <tr> <td><div align="center"></div></td> <td bgcolor="#FFFFFF"> </td> </tr> <tr> <td><div align="center"></div></td> <td bgcolor="#FFFFFF"> </td> </tr> <tr> <td><div align="left"><strong>Imagem pequena</strong></div></td> <td bgcolor="#FFFFFF"> <input type=hidden name=MAX_FILE_SIZE value=102400> <input type="File" name="origem"> </td> </tr> <tr> <td><div align="left"><strong>Imagem grande</strong></div></td> <td bgcolor="#FFFFFF"><input type=hidden name=MAX_FILE_SIZE value=102400> <input type="File" name="origem2"> </td> </tr> <tr> <td><div align="center"></div></td> <td bgcolor="#FFFFFF"> </td> </tr> <tr> <td> </td> <td> </td> </tr> </table> <p align="center"> <input name="submit" type="submit" value="Adicionar"> <input type="hidden" name="page" value="inserir1"> </form></p> </td> </tr> <tr> <td height="81" valign="top"><div align="center"> <p> </p> <p> <?php
include ('menu.php');
?> </p> </div></td> </tr> </table>
---------------------------------------------------------------------------- ------------------------
"pi.php"
echo $page; ---> returns inserir1 _correct echo $origem; ---> returns the temp path of the file _correct set_time_limit(60); $path=(dirname($PATH_TRANSLATED))."/primeirapagina/"; $origem_name="fdx.jpg"; $dest= $path.$origem_name;
if (($origem <> "none") && ($origem <> "")){ if (copy($origem,$dest)){;
} else { echo "directoria sem direitos de escrita <br>"; } unlink ($origem); }
set_time_limit(60); $path2=(dirname($PATH_TRANSLATED))."/primeirapagina/"; $origem2_name="porra.jpg"; $dest2= $path2.$origem2_name; //printf("$path"); //printf("<br>"); //printf("$origem_name"); if (($origem2 <> "none") && ($origem2 <> "")){ if (copy($origem2,$dest2)){; //echo "<br>upload do ficheiro $origem_name efectuada com sucesso !!!"; // echo "<br>tamanho do ficheiro $origem_size"; // echo " <br>tipo de ficheiro $origem_type"; } else { echo "directoria sem direitos de escrita <br>"; } unlink ($origem2); } ?>
</body> </html>
but Whit register_globals = off the script B dont work
script B:
"p.php"
<title>Jornal O Leme</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> </head>
<body bgcolor="#006699"> <table width="100%" border="0" cellpadding="0" cellspacing="0"> <!--DWLayoutTable--> <tr> <td width="100%" height="70" valign="top"><img src="test.jpg" width="600" height="120"> </td> </tr> <tr> <td height="262" valign="top"><p> </p> <form method="post" action="pi.php" enctype="multipart/form-data"> <table width="75%" border="0" align="center" bgcolor="#FFFFFF"> <tr> <td width="23%"><div align="center"><font face="BankGothic Md BT"> </font></div></td> <td width="77%" bgcolor="#FFFFFF"> </td> </tr> <tr> <td><div align="center"></div></td> <td bgcolor="#FFFFFF"> </td> </tr> <tr> <td><div align="center"></div></td> <td bgcolor="#FFFFFF"> </td> </tr> <tr> <td><div align="left"><strong>Imagem pequena</strong></div></td> <td bgcolor="#FFFFFF"> <input type=hidden name=MAX_FILE_SIZE value=102400> <input type="File" name="origem"> </td> </tr> <tr> <td><div align="left"><strong>Imagem grande</strong></div></td> <td bgcolor="#FFFFFF"><input type=hidden name=MAX_FILE_SIZE value=102400> <input type="File" name="origem2"> </td> </tr> <tr> <td><div align="center"></div></td> <td bgcolor="#FFFFFF"> </td> </tr> <tr> <td> </td> <td> </td> </tr> </table> <p align="center"> <input name="submit" type="submit" value="Adicionar"> <input type="hidden" name="page" value="inserir1"> </form></p> </td> </tr> <tr> <td height="81" valign="top"><div align="center"> <p> </p> <p> <?php
include ('menu.php');
?> </p> </div></td> </tr> </table>
---------------------------------------------------------------------------- ------------------------
"pi.php"
echo $_REQUEST['page']; returns inserir1 _correct
echo $_FILES['origem']; returns ARRAY _error why ? what i have to do to return the temp path of the file to ? im lost set_time_limit(60); $path=(dirname($PATH_TRANSLATED))."/primeirapagina/"; $origem_name="fdx.jpg"; $dest= $path.$origem_name;
if (($origem <> "none") && ($origem <> "")){ if (copy($origem,$dest)){;
} else { echo "directoria sem direitos de escrita <br>"; } unlink ($origem); }
set_time_limit(60); $path2=(dirname($PATH_TRANSLATED))."/primeirapagina/"; $origem2_name="porra.jpg"; $dest2= $path2.$origem2_name; //printf("$path"); //printf("<br>"); //printf("$origem_name"); if (($origem2 <> "none") && ($origem2 <> "")){ if (copy($origem2,$dest2)){; //echo "<br>upload do ficheiro $origem_name efectuada com sucesso !!!"; // echo "<br>tamanho do ficheiro $origem_size"; // echo " <br>tipo de ficheiro $origem_type"; } else { echo "directoria sem direitos de escrita <br>"; } unlink ($origem2); } ?>
</body> </html>
attached mail follows:
That's because $_FILES['origem'] is an array. It will have the following elements, where 'userfile' is 'origem' in your case:
$_FILES['userfile']['name'] The original name of the file on the client machine.
$_FILES['userfile']['type'] The mime type of the file, if the browser provided this information. An example would be "image/gif".
$_FILES['userfile']['size'] The size, in bytes, of the uploaded file.
$_FILES['userfile']['tmp_name'] The temporary filename of the file in which the uploaded file was stored on the server.
$_FILES['userfile']['error'] The error code associated with this file upload. ['error'] was added in PHP 4.2.0
Note: In PHP versions prior 4.1.0 this was named $HTTP_POST_FILES and it's not an autoglobal variable like $_FILES is. PHP 3 does not support $HTTP_POST_FILES.
When register_globals is turned on in php.ini, additional variables are available. For example, $userfile_name will equal $_FILES['userfile']['name'], $userfile_type will equal $_FILES['userfile']['type'], etc. Keep in mind that as of PHP 4.2.0, register_globals defaults to off. It's preferred to not rely on this directive.
---John Holmes...
> -----Original Message-----
> From: marcelo [mailto:msalvador
sinesdigital.pt]
> Sent: Sunday, November 03, 2002 8:32 PM
> To: php-general
lists.php.net
> Subject: [PHP] uploading help please again
>
> Ok I'm back
>
> This script is to upload 2 image files
>
> Whit register_globals = on it Works fine
>
>
>
> script A
>
> "p.php"
>
> <title>Jornal O Leme</title>
> <meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1">
> </head>
>
> <body bgcolor="#006699">
> <table width="100%" border="0" cellpadding="0" cellspacing="0">
> <!--DWLayoutTable-->
> <tr>
> <td width="100%" height="70" valign="top"><img src="test.jpg"
> width="600" height="120">
> </td>
> </tr>
> <tr>
> <td height="262" valign="top"><p> </p>
> <form method="post" action="pi.php"
enctype="multipart/form-data">
> <table width="75%" border="0" align="center"
bgcolor="#FFFFFF">
> <tr>
> <td width="23%"><div align="center"><font face="BankGothic
Md
> BT">
> </font></div></td>
> <td width="77%" bgcolor="#FFFFFF"> </td>
> </tr>
> <tr>
> <td><div align="center"></div></td>
> <td bgcolor="#FFFFFF"> </td>
> </tr>
> <tr>
> <td><div align="center"></div></td>
> <td bgcolor="#FFFFFF"> </td>
> </tr>
> <tr>
> <td><div align="left"><strong>Imagem
> pequena</strong></div></td>
> <td bgcolor="#FFFFFF"> <input type=hidden
name=MAX_FILE_SIZE
> value=102400>
> <input type="File" name="origem"> </td>
> </tr>
> <tr>
> <td><div align="left"><strong>Imagem
> grande</strong></div></td>
> <td bgcolor="#FFFFFF"><input type=hidden
name=MAX_FILE_SIZE
> value=102400>
> <input type="File" name="origem2"> </td>
> </tr>
> <tr>
> <td><div align="center"></div></td>
> <td bgcolor="#FFFFFF"> </td>
> </tr>
> <tr>
> <td> </td>
> <td> </td>
> </tr>
> </table>
> <p align="center">
> <input name="submit" type="submit" value="Adicionar">
> <input type="hidden" name="page" value="inserir1">
> </form></p>
> </td>
> </tr>
> <tr>
> <td height="81" valign="top"><div align="center">
> <p> </p>
> <p>
> <?php
>
> include ('menu.php');
>
> ?>
> </p>
> </div></td>
> </tr>
> </table>
>
>
>
>
>
------------------------------------------------------------------------
--
> --
> ------------------------
>
> "pi.php"
>
>
>
> echo $page; ---> returns inserir1 _correct
> echo $origem; ---> returns the temp path of the file _correct
> set_time_limit(60);
> $path=(dirname($PATH_TRANSLATED))."/primeirapagina/";
> $origem_name="fdx.jpg";
> $dest= $path.$origem_name;
>
> if (($origem <> "none") && ($origem <> "")){
> if (copy($origem,$dest)){;
>
> } else {
> echo "directoria sem direitos de escrita <br>";
> }
> unlink ($origem);
> }
>
> set_time_limit(60);
> $path2=(dirname($PATH_TRANSLATED))."/primeirapagina/";
> $origem2_name="porra.jpg";
> $dest2= $path2.$origem2_name;
> //printf("$path");
> //printf("<br>");
> //printf("$origem_name");
> if (($origem2 <> "none") && ($origem2 <> "")){
> if (copy($origem2,$dest2)){;
> //echo "<br>upload do ficheiro $origem_name efectuada com sucesso
!!!";
> // echo "<br>tamanho do ficheiro $origem_size";
> // echo " <br>tipo de ficheiro $origem_type";
> } else {
> echo "directoria sem direitos de escrita <br>";
> }
> unlink ($origem2);
> }
> ?>
>
>
> </body>
> </html>
>
>
>
>
>
>
>
>
> but Whit register_globals = off the script B dont work
>
> script B:
>
>
>
> "p.php"
>
> <title>Jornal O Leme</title>
> <meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1">
> </head>
>
> <body bgcolor="#006699">
> <table width="100%" border="0" cellpadding="0" cellspacing="0">
> <!--DWLayoutTable-->
> <tr>
> <td width="100%" height="70" valign="top"><img src="test.jpg"
> width="600" height="120">
> </td>
> </tr>
> <tr>
> <td height="262" valign="top"><p> </p>
> <form method="post" action="pi.php"
enctype="multipart/form-data">
> <table width="75%" border="0" align="center"
bgcolor="#FFFFFF">
> <tr>
> <td width="23%"><div align="center"><font face="BankGothic
Md
> BT">
> </font></div></td>
> <td width="77%" bgcolor="#FFFFFF"> </td>
> </tr>
> <tr>
> <td><div align="center"></div></td>
> <td bgcolor="#FFFFFF"> </td>
> </tr>
> <tr>
> <td><div align="center"></div></td>
> <td bgcolor="#FFFFFF"> </td>
> </tr>
> <tr>
> <td><div align="left"><strong>Imagem
> pequena</strong></div></td>
> <td bgcolor="#FFFFFF"> <input type=hidden
name=MAX_FILE_SIZE
> value=102400>
> <input type="File" name="origem"> </td>
> </tr>
> <tr>
> <td><div align="left"><strong>Imagem
> grande</strong></div></td>
> <td bgcolor="#FFFFFF"><input type=hidden
name=MAX_FILE_SIZE
> value=102400>
> <input type="File" name="origem2"> </td>
> </tr>
> <tr>
> <td><div align="center"></div></td>
> <td bgcolor="#FFFFFF"> </td>
> </tr>
> <tr>
> <td> </td>
> <td> </td>
> </tr>
> </table>
> <p align="center">
> <input name="submit" type="submit" value="Adicionar">
> <input type="hidden" name="page" value="inserir1">
> </form></p>
> </td>
> </tr>
> <tr>
> <td height="81" valign="top"><div align="center">
> <p> </p>
> <p>
> <?php
>
> include ('menu.php');
>
> ?>
> </p>
> </div></td>
> </tr>
> </table>
>
>
>
>
>
------------------------------------------------------------------------
--
> --
> ------------------------
>
> "pi.php"
>
>
>
> echo $_REQUEST['page']; returns inserir1 _correct
>
>
> echo $_FILES['origem']; returns ARRAY _error why ? what i have to do
to
> return the temp path of the file to ? im lost
> set_time_limit(60);
> $path=(dirname($PATH_TRANSLATED))."/primeirapagina/";
> $origem_name="fdx.jpg";
> $dest= $path.$origem_name;
>
> if (($origem <> "none") && ($origem <> "")){
> if (copy($origem,$dest)){;
>
> } else {
> echo "directoria sem direitos de escrita <br>";
> }
> unlink ($origem);
> }
>
> set_time_limit(60);
> $path2=(dirname($PATH_TRANSLATED))."/primeirapagina/";
> $origem2_name="porra.jpg";
> $dest2= $path2.$origem2_name;
> //printf("$path");
> //printf("<br>");
> //printf("$origem_name");
> if (($origem2 <> "none") && ($origem2 <> "")){
> if (copy($origem2,$dest2)){;
> //echo "<br>upload do ficheiro $origem_name efectuada com sucesso
!!!";
> // echo "<br>tamanho do ficheiro $origem_size";
> // echo " <br>tipo de ficheiro $origem_type";
> } else {
> echo "directoria sem direitos de escrita <br>";
> }
> unlink ($origem2);
> }
> ?>
>
>
> </body>
> </html>
>
>
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
attached mail follows:
Hi people, i'd like to know if there is a way to add content to a database thru sending an e-mail, and if there is how it would be done. Thanks, Rodrigo
attached mail follows:
The simplest way to do this to setup a pop3 account and have a php script check this account at intervals via cron.
Or you could write a pipe script via aliases.
Timothy Hitchens (HiTCHO)
tim
hitcho.com.au
On Sun, 3 Nov 2002, Rodrigo de Oliveira Costa wrote:
> Hi people, i'd like to know if there is a way to add content to a database thru sending an e-mail, and if there is how it would be done. > Thanks, > Rodrigo >
attached mail follows:
Hi, i wont to find a special Dir on many FTP Server's over PHP. For searching my Server's have an site command like "site dupe "Dirname"" But if I try it with ftp_site I get only a bool back and not the search result. With a ftp_nlist I can't search Dir's only files. And with ftp_rawlist I get this: total 3 drwxrwxrwx 4 user group 96 Oct 18 17:24 pub drwxrwxrwx 29 user group 2000 Oct 31 03:58 bin drwxrwxrwx 5 user group 120 Oct 18 17:23 misc the code: $dir=ftp_pwd($conn_id); $list=Array(); $list=ftp_rawlist($conn_id, "$dir"); $i=0; do{ echo $list[$i], "<br>"; $i++; }while($list[$i]); But how to extract only the Dir name from this result, enter it, list and so on. Is there any other easier way to search for an Dir? thx Manuel
attached mail follows:
How do I go about building radio buttons using the results of a MySQL query. The record layout looks like this:
acct cat description
I want to use acct as the value="acct" in the input statement for the radio box. The code below almost works?
TIA, David
<?php $header = mysql_query ("SELECT * FROM chart ORDER BY acct ");
if ($row = mysql_fetch_array($header)) { do { print("<tr bgcolor=\"white\" >"); print '<td width="5"><input type="radio" name="gl_acct" value=acct[]"></td>'; print("<td width=\"12\">"); print $row["acct"]; print "</td><td width=\"12\">"; print $row["cat"]; print "</td><td >"; print $row["descript"]; print("</td></tr>\n"); } while($row = mysql_fetch_array($header));
} else {print "Sorry, no records were found!";}
?>
attached mail follows:
I don't think so, Put the bracket with your radio's name not with your the value///
For example : print "<td width=2><input type=radio name=gl_acct[] value=$row['acct']>{$row['acct']}</td>" ... and so one/
----- Original Message -----
From: "David Jackson" <info
mustardandrelish.com>
To: <php-general
lists.php.net>
Sent: Monday, November 04, 2002 1:15 PM
Subject: [PHP] radio buttons from MySQL query?
> How do I go about building radio buttons using the results of a MySQL > query. The record layout looks like this: > > acct > cat > description > > I want to use acct as the value="acct" in the input statement for the > radio box. The code below almost works? > > TIA, > David > > > <?php > $header = mysql_query ("SELECT * FROM chart > ORDER BY acct "); > > if ($row = mysql_fetch_array($header)) { > do { > print("<tr bgcolor=\"white\" >"); > print '<td width="5"><input type="radio" name="gl_acct" > value=acct[]"></td>'; > print("<td width=\"12\">"); > print $row["acct"]; > print "</td><td width=\"12\">"; > print $row["cat"]; > print "</td><td >"; > print $row["descript"]; > print("</td></tr>\n"); > } while($row = mysql_fetch_array($header)); > > } else {print "Sorry, no records were found!";} > > > ?> > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > >
attached mail follows:
There is no reason to put brackets behind the name of the radio element. The brackets are neccessary for multi-select elements like checkboxes, but radio buttone are a single select element.
Your if statement should be a while loop.
I'm sure you don't want to set this ( value=acct[] ) as the value for each radio button. Do it that way, and no matter which one is picked, it will be the same value.
rija wrote:
> I don't think so,
> Put the bracket with your radio's name not with your the value///
>
> For example :
> print "<td width=2><input type=radio name=gl_acct[]
> value=$row['acct']>{$row['acct']}</td>" ...
> and so one/
>
> ----- Original Message -----
> From: "David Jackson" <info
mustardandrelish.com>
> To: <php-general
lists.php.net>
> Sent: Monday, November 04, 2002 1:15 PM
> Subject: [PHP] radio buttons from MySQL query?
>
>
>
>>How do I go about building radio buttons using the results of a MySQL
>>query. The record layout looks like this:
>>
>>acct
>>cat
>>description
>>
>>I want to use acct as the value="acct" in the input statement for the
>>radio box. The code below almost works?
>>
>>TIA,
>>David
>>
>>
>><?php
>>$header = mysql_query ("SELECT * FROM chart
>> ORDER BY acct ");
>>
>>if ($row = mysql_fetch_array($header)) {
>> do {
>> print("<tr bgcolor=\"white\" >");
>> print '<td width="5"><input type="radio" name="gl_acct"
>>value=acct[]"></td>';
>> print("<td width=\"12\">");
>> print $row["acct"];
>> print "</td><td width=\"12\">";
>> print $row["cat"];
>> print "</td><td >";
>> print $row["descript"];
>> print("</td></tr>\n");
>> } while($row = mysql_fetch_array($header));
>>
>> } else {print "Sorry, no records were found!";}
>>
>>
>>?>
>>
>>
>>--
>>PHP General Mailing List (http://www.php.net/)
>>To unsubscribe, visit: http://www.php.net/unsub.php
>>
>>
>
>
>
>
attached mail follows:
oups ... you're right !
----- Original Message -----
From: "John Nichel" <jnichel
by-tor.com>
To: <rija
vatu.com>
Cc: "php" <php-general
lists.php.net>; "David Jackson"
<info
mustardandrelish.com>
Sent: Monday, November 04, 2002 2:57 PM
Subject: Re: [PHP] radio buttons from MySQL query?
> There is no reason to put brackets behind the name of the radio element.
The brackets are neccessary for multi-select elements like checkboxes, but
radio buttone are a single select element.
>
> Your if statement should be a while loop.
>
> I'm sure you don't want to set this ( value=acct[] ) as the value for each
radio button. Do it that way, and no matter which one is picked, it will be
the same value.
>
> rija wrote:
> > I don't think so,
> > Put the bracket with your radio's name not with your the value///
> >
> > For example :
> > print "<td width=2><input type=radio name=gl_acct[]
> > value=$row['acct']>{$row['acct']}</td>" ...
> > and so one/
> >
> > ----- Original Message -----
> > From: "David Jackson" <info
mustardandrelish.com>
> > To: <php-general
lists.php.net>
> > Sent: Monday, November 04, 2002 1:15 PM
> > Subject: [PHP] radio buttons from MySQL query?
> >
> >
> >
> >>How do I go about building radio buttons using the results of a MySQL
> >>query. The record layout looks like this:
> >>
> >>acct
> >>cat
> >>description
> >>
> >>I want to use acct as the value="acct" in the input statement for the
> >>radio box. The code below almost works?
> >>
> >>TIA,
> >>David
> >>
> >>
> >><?php
> >>$header = mysql_query ("SELECT * FROM chart
> >> ORDER BY acct ");
> >>
> >>if ($row = mysql_fetch_array($header)) {
> >> do {
> >> print("<tr bgcolor=\"white\" >");
> >> print '<td width="5"><input type="radio" name="gl_acct"
> >>value=acct[]"></td>';
> >> print("<td width=\"12\">");
> >> print $row["acct"];
> >> print "</td><td width=\"12\">";
> >> print $row["cat"];
> >> print "</td><td >";
> >> print $row["descript"];
> >> print("</td></tr>\n");
> >> } while($row = mysql_fetch_array($header));
> >>
> >> } else {print "Sorry, no records were found!";}
> >>
> >>
> >>?>
> >>
> >>
> >>--
> >>PHP General Mailing List (http://www.php.net/)
> >>To unsubscribe, visit: http://www.php.net/unsub.php
> >>
> >>
> >
> >
> >
> >
>
>
attached mail follows:
OK, this works but there has to be a pretty way? John, I'm not sure what you mean about the while loop?
David
------------- Works -------------------------
<html> <head><title>Operation Sticky Bun</title></head <body> <h3 align="center">Operation Sticky Bun </h3> <?php require('connect.php'); ?> <?php print '<form action="hello.php" method="post">'; $header = mysql_query ("SELECT * FROM chart ORDER BY acct "); if ($row = mysql_fetch_array($header)) { do { print '<input type="radio" name="ledger_acct" value="'; print $row["acct"];print '">'; print $row["descript"];print '<br>'; } while($row = mysql_fetch_array($header));
} else {print "Sorry, no records were found!";}
print '</form>'; ?> </body> </html>
Rija wrote:
> oups ... you're right !
>
> ----- Original Message -----
> From: "John Nichel" <jnichel
by-tor.com>
> To: <rija
vatu.com>
> Cc: "php" <php-general
lists.php.net>; "David Jackson"
> <info
mustardandrelish.com>
> Sent: Monday, November 04, 2002 2:57 PM
> Subject: Re: [PHP] radio buttons from MySQL query?
>
>
>
>>There is no reason to put brackets behind the name of the radio element.
>
> The brackets are neccessary for multi-select elements like checkboxes, but
> radio buttone are a single select element.
>
>>Your if statement should be a while loop.
>>
>>I'm sure you don't want to set this ( value=acct[] ) as the value for each
>
> radio button. Do it that way, and no matter which one is picked, it will be
> the same value.
>
>>rija wrote:
>>
>>>I don't think so,
>>>Put the bracket with your radio's name not with your the value///
>>>
>>>For example :
>>>print "<td width=2><input type=radio name=gl_acct[]
>>>value=$row['acct']>{$row['acct']}</td>" ...
>>>and so one/
>>>
>>>----- Original Message -----
>>>From: "David Jackson" <info
mustardandrelish.com>
>>>To: <php-general
lists.php.net>
>>>Sent: Monday, November 04, 2002 1:15 PM
>>>Subject: [PHP] radio buttons from MySQL query?
>>>
>>>
>>>
>>>
>>>>How do I go about building radio buttons using the results of a MySQL
>>>>query. The record layout looks like this:
>>>>
>>>>acct
>>>>cat
>>>>description
>>>>
>>>>I want to use acct as the value="acct" in the input statement for the
>>>>radio box. The code below almost works?
>>>>
>>>>TIA,
>>>>David
>>>>
>>>>
>>>><?php
>>>>$header = mysql_query ("SELECT * FROM chart
>>>> ORDER BY acct ");
>>>>
>>>>if ($row = mysql_fetch_array($header)) {
>>>> do {
>>>> print("<tr bgcolor=\"white\" >");
>>>> print '<td width="5"><input type="radio" name="gl_acct"
>>>>value=acct[]"></td>';
>>>> print("<td width=\"12\">");
>>>> print $row["acct"];
>>>> print "</td><td width=\"12\">";
>>>> print $row["cat"];
>>>> print "</td><td >";
>>>> print $row["descript"];
>>>> print("</td></tr>\n");
>>>> } while($row = mysql_fetch_array($header));
>>>>
>>>> } else {print "Sorry, no records were found!";}
>>>>
>>>>
>>>>?>
>>>>
>>>>
>>>>--
>>>>PHP General Mailing List (http://www.php.net/)
>>>>To unsubscribe, visit: http://www.php.net/unsub.php
>>>>
>>>>
>>>
>>>
>>>
>>>
>>
>
>
attached mail follows:
Belay that. I didn't notice the do / while loop inside of the if statement. I don't know if this is prettier, but I would echo out the radio button in one line....
echo ( "<input type=\"radio\" name=\"ledger_acct\" value=\"" . $row["acct"] . "\">" . $row["descript"] . "<br>\n";
David Jackson wrote:
> OK, this works but there has to be a pretty way?
> John, I'm not sure what you mean about the while loop?
>
>
> David
>
> ------------- Works -------------------------
>
> <html>
> <head><title>Operation Sticky Bun</title></head
> <body>
> <h3 align="center">Operation Sticky Bun </h3>
> <?php require('connect.php'); ?>
> <?php
> print '<form action="hello.php" method="post">';
> $header = mysql_query ("SELECT * FROM chart
> ORDER BY acct ");
> if ($row = mysql_fetch_array($header)) {
> do {
> print '<input type="radio" name="ledger_acct" value="';
> print $row["acct"];print '">';
> print $row["descript"];print '<br>';
> } while($row = mysql_fetch_array($header));
>
> } else {print "Sorry, no records were found!";}
>
> print '</form>';
> ?>
> </body>
> </html>
>
>
>
>
> Rija wrote:
>
>> oups ... you're right !
>>
>> ----- Original Message -----
>> From: "John Nichel" <jnichel
by-tor.com>
>> To: <rija
vatu.com>
>> Cc: "php" <php-general
lists.php.net>; "David Jackson"
>> <info
mustardandrelish.com>
>> Sent: Monday, November 04, 2002 2:57 PM
>> Subject: Re: [PHP] radio buttons from MySQL query?
>>
>>
>>
>>> There is no reason to put brackets behind the name of the radio element.
>>
>>
>> The brackets are neccessary for multi-select elements like checkboxes,
>> but
>> radio buttone are a single select element.
>>
>>> Your if statement should be a while loop.
>>>
>>> I'm sure you don't want to set this ( value=acct[] ) as the value for
>>> each
>>
>>
>> radio button. Do it that way, and no matter which one is picked, it
>> will be
>> the same value.
>>
>>> rija wrote:
>>>
>>>> I don't think so,
>>>> Put the bracket with your radio's name not with your the value///
>>>>
>>>> For example :
>>>> print "<td width=2><input type=radio name=gl_acct[]
>>>> value=$row['acct']>{$row['acct']}</td>" ...
>>>> and so one/
>>>>
>>>> ----- Original Message -----
>>>> From: "David Jackson" <info
mustardandrelish.com>
>>>> To: <php-general
lists.php.net>
>>>> Sent: Monday, November 04, 2002 1:15 PM
>>>> Subject: [PHP] radio buttons from MySQL query?
>>>>
>>>>
>>>>
>>>>
>>>>> How do I go about building radio buttons using the results of a MySQL
>>>>> query. The record layout looks like this:
>>>>>
>>>>> acct
>>>>> cat
>>>>> description
>>>>>
>>>>> I want to use acct as the value="acct" in the input statement for the
>>>>> radio box. The code below almost works?
>>>>>
>>>>> TIA,
>>>>> David
>>>>>
>>>>>
>>>>> <?php
>>>>> $header = mysql_query ("SELECT * FROM chart
>>>>> ORDER BY acct ");
>>>>>
>>>>> if ($row = mysql_fetch_array($header)) {
>>>>> do {
>>>>> print("<tr bgcolor=\"white\" >");
>>>>> print '<td width="5"><input type="radio" name="gl_acct"
>>>>> value=acct[]"></td>';
>>>>> print("<td width=\"12\">");
>>>>> print $row["acct"];
>>>>> print "</td><td width=\"12\">";
>>>>> print $row["cat"];
>>>>> print "</td><td >";
>>>>> print $row["descript"];
>>>>> print("</td></tr>\n");
>>>>> } while($row = mysql_fetch_array($header));
>>>>>
>>>>> } else {print "Sorry, no records were found!";}
>>>>>
>>>>>
>>>>> ?>
>>>>>
>>>>>
>>>>> --
>>>>> PHP General Mailing List (http://www.php.net/)
>>>>> To unsubscribe, visit: http://www.php.net/unsub.php
>>>>>
>>>>>
>>>>
>>>>
>>>>
>>>>
>>>
>>
>>
>
>
>
attached mail follows:
I'm having trouble with the following code dispalying an error, which I don't understand because the code actually works (other than the error). Any ideas?
<? if(!isset($HTTP_SESSION_VARS['svUserAccess'])){ echo "<td class='mainmenu' align='center' width='12.5%' style='cursor:hand' onMouseover='this.style.backgroundColor='#C0E0FF'' onMouseout='this.style.backgroundColor=''' onClick='window.location.href='login.php''><a href='login.php'>Login</a></td>"; } else { echo "<td class='mainmenu' align='center' width='12.5%' style='cursor:hand' onMouseover='this.style.backgroundColor='#C0E0FF'' onMouseout='this.style.backgroundColor=''' onClick='window.location.href='logout.php''><a href='login.php'>Logout</a></td>"; } ?>
Thanks
attached mail follows:
And the error is??
> -----Original Message-----
> From: vernon [mailto:vernon
comp-wiz.com]
> Sent: Sunday, November 03, 2002 9:28 PM
> To: php-general
lists.php.net
> Subject: [PHP] Error in code - Seems simple enough
>
> I'm having trouble with the following code dispalying an error, which
I
> don't understand because the code actually works (other than the
error).
> Any
> ideas?
>
> <?
> if(!isset($HTTP_SESSION_VARS['svUserAccess'])){
> echo "<td class='mainmenu' align='center' width='12.5%'
> style='cursor:hand' onMouseover='this.style.backgroundColor='#C0E0FF''
> onMouseout='this.style.backgroundColor='''
> onClick='window.location.href='login.php''><a
> href='login.php'>Login</a></td>";
> } else {
> echo "<td class='mainmenu' align='center' width='12.5%'
> style='cursor:hand' onMouseover='this.style.backgroundColor='#C0E0FF''
> onMouseout='this.style.backgroundColor='''
> onClick='window.location.href='logout.php''><a
> href='login.php'>Logout</a></td>";
> }
> ?>
>
> Thanks
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
attached mail follows:
That's the thing, everything works but the error message keeps coming up?
Runtime Error: Syntax Error
attached mail follows:
This is rather problem about javascript than PHP - But I think that you need to use double quotes (escaped) to distinguish query and variables in your javascript query:
Try out this, It work fine for me: if(!isset($HTTP_SESSION_VARS['svUserAccess'])){
echo "<td class='mainmenu' align='center' width='12.5%'
style='cursor:hand' onMouseover=\"this.style.backgroundColor='#C0E0FF'\"
onMouseout=\"this.style.backgroundColor=''\"
onClick=\"window.location.href='login.php'\"><a
href='login.php'>Login</a></td>";
} else {
echo "<td class='mainmenu' align='center' width='12.5%'
style='cursor:hand' onMouseover=\"this.style.backgroundColor='#C0E0FF'\"
onMouseout=\"this.style.backgroundColor=''\"
onClick=\"window.location.href='logout.php'\"><a
href='login.php'>Logout</a></td>";
wrote in message news:20021104022815.4043.qmail
pb1.pair.com...
> I'm having trouble with the following code dispalying an error, which I
> don't understand because the code actually works (other than the error). Any
> ideas?
>
> <?
> if(!isset($HTTP_SESSION_VARS['svUserAccess'])){
> echo "<td class='mainmenu' align='center' width='12.5%'
> style='cursor:hand' onMouseover='this.style.backgroundColor='#C0E0FF''
> onMouseout='this.style.backgroundColor='''
> onClick='window.location.href='login.php''><a
> href='login.php'>Login</a></td>";
> } else {
> echo "<td class='mainmenu' align='center' width='12.5%'
> style='cursor:hand' onMouseover='this.style.backgroundColor='#C0E0FF''
> onMouseout='this.style.backgroundColor='''
> onClick='window.location.href='logout.php''><a
> href='login.php'>Logout</a></td>";
> }
> ?>
>
> Thanks
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
attached mail follows:
I have spent the last 3 days trying to figure this out. And will probably give up very soon. I have written 2 programs (which are very common PHP programs) that A) Allows me to upload image files into a MYSQL database using a simple form. And B) Allows me to retrieve and display the image using a PHP script. This is my problem:-
I can upload the images ok. I store the binary code, image type, name, and size within the MYSQL database. On checking the database directly using DBTools, I can see that the files have uploaded. The file sizes reflect exactly what was originally on the hard disk of my PC (not sure if this is a correct gauge).
When I run my PHP program to display the images, maybe only 1 out of 10 actually displays correctly. The rest are broken up or non displayable images. One image even made a prompt window appear and somehow now causes Windows paint to load the image instead of the browser. God only knows how that occurred !!
Below are my (designed by others) 2 programs. The first program is the upload form. This seems to work ok.
<HTML> <HEAD><TITLE>Store binary data into SQL Database</TITLE></HEAD> <BODY>
<?php // code that will be executed if the form has been submitted:
if ($submit) {
// connect to the database
require_once('../../Connections/TestServer.php'); mysql_select_db($database_TestServer, $TestServer);
$data = addslashes(fread(fopen($form_data, "r"), filesize($form_data)));
$result=MYSQL_QUERY("INSERT INTO master_products (image_thumbnail,image_thumbnail_name,image_thumbnail_size,image_thumbnail_t ype) ". "VALUES ('$data','$form_data_name','$form_data_size','$form_data_type')");
$id= mysql_insert_id(); print "<p>This file has the following Database ID: <b>$id</b>";
MYSQL_CLOSE();
} else {
// else show the form to submit new data: ?>
<form method="post" action="<?php echo $PHP_SELF; ?>" enctype="multipart/form-data"> <INPUT TYPE="hidden" name="MAX_FILE_SIZE" value="1000000"> <br>File to upload/store in database:<br> <input type="file" name="form_data" size="40"> <p><input type="submit" name="submit" value="submit"> </form>
<?php
}
?>
</BODY> </HTML>
Here is the code to display the image:-
<?php
if($id) {
require_once('../Connections/TestServer.php');
mysql_select_db($database_TestServer, $TestServer);
$query = "select image_thumbnail,image_thumbnail_type from
master_products where item_id=$id";
$result =
MYSQL_QUERY($query);
$data =
MYSQL_RESULT($result,0,"image_thumbnail");
$type =
MYSQL_RESULT($result,0,"image_thumbnail_type");
Header( "Content-type: $type");
echo $data;
};
?>
I run the above program in the following way: http://192.168.0.11/htdocs/displayimage2.php?id The ID is the item_id primary key field for whichever record I want to display.
I have tried these programs on a test server here in my room to a test Apache server and MYSQL test database, and also from my ISP to a MYSQL database at a server at my ISP. I get exactly the same problem. When I run the display image program, the images being displayed are always being displayed the same. Which points the problem towards the upload process (maybe). If anybody can tell me what the heck is wrong here, I'll give them a medal !! There is basically some kind of binary corruption going on (it looks like)
For added information, below is my database table structure. At the moment, the only part I am actually using relates to the image_thumbnail sections.
Darren.
CREATE TABLE master_products ( item_id SMALLINT UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT, item_code VARCHAR (10) UNIQUE, item_dateadded DATETIME DEFAULT '0000-00-00 00:00:00', item_datemodified DATETIME DEFAULT '0000-00-00 00:00:00',
category ENUM ("none","single herbs","general vitality","ageing","arthritis","eyesite","prostate","ahlzheimers", "weight loss","menopause","depression","fatigue","headaches","insomnia","colds and flues","allergies", "healthy heart","cancer prevention","aphrodisiacs","sexual herbs","for women","for men","books"),
name VARCHAR (30), name_dateadded DATETIME DEFAULT '0000-00-00 00:00:00', name_datemodified DATETIME DEFAULT '0000-00-00 00:00:00', INDEX idx_name (name),
desc_brief VARCHAR (255), desc_brief_dateadded DATETIME DEFAULT '0000-00-00 00:00:00', desc_brief_datemodified DATETIME DEFAULT '0000-00-00 00:00:00', INDEX idx_desc_brief (desc_brief),
desc_long TEXT, desc_long_dateadded DATETIME DEFAULT '0000-00-00 00:00:00', desc_long_datemodified DATETIME DEFAULT '0000-00-00 00:00:00',
price DECIMAL (7,2), price_dateadded DATETIME DEFAULT '0000-00-00 00:00:00', price_datemodified DATETIME DEFAULT '0000-00-00 00:00:00',
image LONGBLOB, image_name VARCHAR (50), image_size INT UNSIGNED, image_type VARCHAR (50), image_dateadded DATETIME DEFAULT '0000-00-00 00:00:00', image_datemodified DATETIME DEFAULT '0000-00-00 00:00:00',
image_thumbnail LONGBLOB, image_thumbnail_name VARCHAR (50), image_thumbnail_size INT UNSIGNED, image_thumbnail_type VARCHAR (50), image_thumbnail_dateadded DATETIME DEFAULT '0000-00-00 00:00:00', image_thumbnail_datemodified DATETIME DEFAULT '0000-00-00 00:00:00' );
attached mail follows:
hello,
Check the PHP-DB archives you'll find a code for the upload, and this one for viewing image :
<? $mysql_hostname = ""; $mysql_username = ""; $mysql_passwd = ""; $mysql_dbname = "";
// Connecting, selecting database
$link =
mysql_connect($mysql_hostname,$mysql_username, $mysql_passwd)
or die("Could not connect");
mysql_select_db($mysql_dbname) or die("Could not select database");
$query = "select image_thumbnail,image_thumbnail_type from master_products
where item_id=$id";
$result = mysql_query( $query ) or die("Query failed");
$num = musql_numrows($result);
$data =
mysql_fetch_array($result);
if ($id == 1)
{
// Output the MIME header
$mime = $data["image_thumbnail_type"];
header("Content-Type: $mime");
echo $data["image_thumbnail"];
} else {
// not valid id image, you can send any other message
}
?>
Hope this will help Hatem
"Darren McPhee" <dsmcphee
hotmail.com> a écrit dans le message de news:
20021104023953.11862.qmail
pb1.pair.com...
> I have spent the last 3 days trying to figure this out. And will probably
> give up very soon. I have written 2 programs (which are very common PHP
> programs) that A) Allows me to upload image files into a MYSQL database
> using a simple form. And B) Allows me to retrieve and display the image
> using a PHP script. This is my problem:-
>
> I can upload the images ok. I store the binary code, image type, name,
and
> size within the MYSQL database. On checking the database directly using
> DBTools, I can see that the files have uploaded. The file sizes reflect
> exactly what was originally on the hard disk of my PC (not sure if this is
a
> correct gauge).
>
> When I run my PHP program to display the images, maybe only 1 out of 10
> actually displays correctly. The rest are broken up or non displayable
> images. One image even made a prompt window appear and somehow now causes
> Windows paint to load the image instead of the browser. God only knows
how
> that occurred !!
>
> Below are my (designed by others) 2 programs. The first program is the
> upload form. This seems to work ok.
>
> <HTML>
> <HEAD><TITLE>Store binary data into SQL Database</TITLE></HEAD>
> <BODY>
>
> <?php
> // code that will be executed if the form has been submitted:
>
> if ($submit) {
>
> // connect to the database
>
> require_once('../../Connections/TestServer.php');
> mysql_select_db($database_TestServer, $TestServer);
>
> $data = addslashes(fread(fopen($form_data, "r"),
filesize($form_data)));
>
> $result=MYSQL_QUERY("INSERT INTO master_products
>
(image_thumbnail,image_thumbnail_name,image_thumbnail_size,image_thumbnail_t
> ype) ".
> "VALUES
> ('$data','$form_data_name','$form_data_size','$form_data_type')");
>
> $id= mysql_insert_id();
> print "<p>This file has the following Database ID: <b>$id</b>";
>
> MYSQL_CLOSE();
>
> } else {
>
> // else show the form to submit new data:
> ?>
>
> <form method="post" action="<?php echo $PHP_SELF; ?>"
> enctype="multipart/form-data">
> <INPUT TYPE="hidden" name="MAX_FILE_SIZE" value="1000000">
> <br>File to upload/store in database:<br>
> <input type="file" name="form_data" size="40">
> <p><input type="submit" name="submit" value="submit">
> </form>
>
> <?php
>
> }
>
> ?>
>
> </BODY>
> </HTML>
>
> Here is the code to display the image:-
>
> <?php
> if($id) {
> require_once('../Connections/TestServer.php');
> mysql_select_db($database_TestServer, $TestServer);
> $query = "select image_thumbnail,image_thumbnail_type from
> master_products where item_id=$id";
> $result =
MYSQL_QUERY($query);
> $data =
MYSQL_RESULT($result,0,"image_thumbnail");
> $type =
MYSQL_RESULT($result,0,"image_thumbnail_type");
> Header( "Content-type: $type");
> echo $data;
> };
> ?>
>
> I run the above program in the following way:
> http://192.168.0.11/htdocs/displayimage2.php?id=9 The ID is the item_id
> primary key field for whichever record I want to display.
>
> I have tried these programs on a test server here in my room to a test
> Apache server and MYSQL test database, and also from my ISP to a MYSQL
> database at a server at my ISP. I get exactly the same problem. When I
run
> the display image program, the images being displayed are always being
> displayed the same. Which points the problem towards the upload process
> (maybe). If anybody can tell me what the heck is wrong here, I'll give
them
> a medal !! There is basically some kind of binary corruption going on (it
> looks like)
>
> For added information, below is my database table structure. At the
moment,
> the only part I am actually using relates to the image_thumbnail sections.
>
> Darren.
>
>
>
> CREATE TABLE master_products (
> item_id SMALLINT UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT,
> item_code VARCHAR (10) UNIQUE,
> item_dateadded DATETIME DEFAULT '0000-00-00 00:00:00',
> item_datemodified DATETIME DEFAULT '0000-00-00 00:00:00',
>
> category ENUM ("none","single herbs","general
> vitality","ageing","arthritis","eyesite","prostate","ahlzheimers",
> "weight
> loss","menopause","depression","fatigue","headaches","insomnia","colds and
> flues","allergies",
> "healthy heart","cancer prevention","aphrodisiacs","sexual herbs","for
> women","for men","books"),
>
> name VARCHAR (30),
> name_dateadded DATETIME DEFAULT '0000-00-00 00:00:00',
> name_datemodified DATETIME DEFAULT '0000-00-00 00:00:00',
> INDEX idx_name (name),
>
> desc_brief VARCHAR (255),
> desc_brief_dateadded DATETIME DEFAULT '0000-00-00 00:00:00',
> desc_brief_datemodified DATETIME DEFAULT '0000-00-00 00:00:00',
> INDEX idx_desc_brief (desc_brief),
>
> desc_long TEXT,
> desc_long_dateadded DATETIME DEFAULT '0000-00-00 00:00:00',
> desc_long_datemodified DATETIME DEFAULT '0000-00-00 00:00:00',
>
> price DECIMAL (7,2),
> price_dateadded DATETIME DEFAULT '0000-00-00 00:00:00',
> price_datemodified DATETIME DEFAULT '0000-00-00 00:00:00',
>
> image LONGBLOB,
> image_name VARCHAR (50),
> image_size INT UNSIGNED,
> image_type VARCHAR (50),
> image_dateadded DATETIME DEFAULT '0000-00-00 00:00:00',
> image_datemodified DATETIME DEFAULT '0000-00-00 00:00:00',
>
> image_thumbnail LONGBLOB,
> image_thumbnail_name VARCHAR (50),
> image_thumbnail_size INT UNSIGNED,
> image_thumbnail_type VARCHAR (50),
> image_thumbnail_dateadded DATETIME DEFAULT '0000-00-00 00:00:00',
> image_thumbnail_datemodified DATETIME DEFAULT '0000-00-00 00:00:00'
> );
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
attached mail follows:
I've send an e-mail with a doubt related with the "maximum_execution_time" variable but it has no answers, so, I'm submiting it again...
I'm using a single php script to send files named upload.php, here is the source code:
<?php
set_time_limit(500);
copy($userfile, "log\\$userfile_name");
echo "<html><head><title>Uploading file...</title><meta http-equiv=\"refresh\" content=\"0; url=http://test.com/file_sent.html\"></head><body><center><font face=\"Verdana\" size=\"4\">Uploading file...</font></center></body></html>";
?>
I've tried to change the "time limit" because there's an error that doesn't stop when trying to send big files (when the duration of upload takes more than 20 seconds):
Fatal error: Maximum execution time of 20 seconds exceeded in D:\dominios\E\escolas-es\spe\upload.php on line 2
As you can see, the time limit is exceeded before the "set_time_limit" is executed. I thing that's because the script begins only after the file is uploaded. My problem is that I can't change the "maximum_execution_time" in the configuration file.
Does anyone knows how to solve that problem?
Thank you, Eduardo M. Bragatto.
PS: Sorry for my miserable english #)
attached mail follows:
If you are running in safe mode, setting time limit has no effect
Eduardo M. Bragatto wrote:
> I've send an e-mail with a doubt related with the > "maximum_execution_time" variable but it has no answers, so, I'm > submiting it again... > > I'm using a single php script to send files named upload.php, > here is the source code: > > <?php > > set_time_limit(500); > > copy($userfile, "log\\$userfile_name"); > > echo "<html><head><title>Uploading file...</title><meta > http-equiv=\"refresh\" content=\"0; > url=http://test.com/file_sent.html\"></head><body><center><font > face=\"Verdana\" size=\"4\">Uploading > file...</font></center></body></html>"; > > ?> > > I've tried to change the "time limit" because there's an error that > doesn't stop when trying to send big files (when the duration of > upload takes more than 20 seconds): > > Fatal error: Maximum execution time of 20 seconds exceeded in > D:\dominios\E\escolas-es\spe\upload.php on line 2 > > As you can see, the time limit is exceeded before the > "set_time_limit" is executed. I thing that's because the script begins > only after the file is uploaded. My problem is that I can't change the > "maximum_execution_time" in the configuration file. > > Does anyone knows how to solve that problem? > > Thank you, > Eduardo M. Bragatto. > > PS: Sorry for my miserable english #) > > >
attached mail follows:
You might receive 2 files throught upload, then the first file name should be $_FILES['origem'] ; and the second file name $_FILES['origem2'] ;
To use the different variables you can use, peer John Holmes's answer, there aren't no full answer like this anywhere?
to ask if file uploaded is ok uploaded_file() is better than you are doing and use move_uploaded_file() instead copy() and unset() ; like this :
if (is_uploaded_file($_FILES['origem']) ) move_uploaded_file($_FILES['origem'], $dest) ;
/* $path=(dirname($PATH_TRANSLATED))."/primeirapagina/"; $origem_name="fdx.jpg"; $dest= $path.$origem_name;
if (($origem <> "none") && ($origem <> "")){ if (copy($origem,$dest)){;
} else { echo "directoria sem direitos de escrita <br>"; } unlink ($origem); }
----- Original Message -----
From: "'marcelo'" <msalvador
sinesdigital.pt>
To: <php-general
lists.php.net>
Sent: Monday, November 04, 2002 12:46 PM
Subject: RE: [PHP] uploading help please again
Ok I'm back
This script is to upload 2 image files
Whit register_globals = on it Works fine
script A
"p.php"
<title>Jornal O Leme</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> </head>
<body bgcolor="#006699"> <table width="100%" border="0" cellpadding="0" cellspacing="0"> <!--DWLayoutTable--> <tr> <td width="100%" height="70" valign="top"><img src="test.jpg" width="600" height="120"> </td> </tr> <tr> <td height="262" valign="top"><p> </p> <form method="post" action="pi.php" enctype="multipart/form-data"> <table width="75%" border="0" align="center" bgcolor="#FFFFFF"> <tr> <td width="23%"><div align="center"><font face="BankGothic Md BT"> </font></div></td> <td width="77%" bgcolor="#FFFFFF"> </td> </tr> <tr> <td><div align="center"></div></td> <td bgcolor="#FFFFFF"> </td> </tr> <tr> <td><div align="center"></div></td> <td bgcolor="#FFFFFF"> </td> </tr> <tr> <td><div align="left"><strong>Imagem pequena</strong></div></td> <td bgcolor="#FFFFFF"> <input type=hidden name=MAX_FILE_SIZE value=102400> <input type="File" name="origem"> </td> </tr> <tr> <td><div align="left"><strong>Imagem grande</strong></div></td> <td bgcolor="#FFFFFF"><input type=hidden name=MAX_FILE_SIZE value=102400> <input type="File" name="origem2"> </td> </tr> <tr> <td><div align="center"></div></td> <td bgcolor="#FFFFFF"> </td> </tr> <tr> <td> </td> <td> </td> </tr> </table> <p align="center"> <input name="submit" type="submit" value="Adicionar"> <input type="hidden" name="page" value="inserir1"> </form></p> </td> </tr> <tr> <td height="81" valign="top"><div align="center"> <p> </p> <p> <?php
include ('menu.php');
?> </p> </div></td> </tr> </table>
---------------------------------------------------------------------------- ------------------------
"pi.php"
echo $page; ---> returns inserir1 _correct echo $origem; ---> returns the temp path of the file _correct set_time_limit(60); $path=(dirname($PATH_TRANSLATED))."/primeirapagina/"; $origem_name="fdx.jpg"; $dest= $path.$origem_name;
if (($origem <> "none") && ($origem <> "")){ if (copy($origem,$dest)){;
} else { echo "directoria sem direitos de escrita <br>"; } unlink ($origem); }
set_time_limit(60); $path2=(dirname($PATH_TRANSLATED))."/primeirapagina/"; $origem2_name="porra.jpg"; $dest2= $path2.$origem2_name; file://printf("$path"); file://printf("<br>"); file://printf("$origem_name"); if (($origem2 <> "none") && ($origem2 <> "")){ if (copy($origem2,$dest2)){; file://echo "<br>upload do ficheiro $origem_name efectuada com sucesso !!!"; // echo "<br>tamanho do ficheiro $origem_size"; // echo " <br>tipo de ficheiro $origem_type"; } else { echo "directoria sem direitos de escrita <br>"; } unlink ($origem2); } ?>
</body> </html>
but Whit register_globals = off the script B dont work
script B:
"p.php"
<title>Jornal O Leme</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> </head>
<body bgcolor="#006699"> <table width="100%" border="0" cellpadding="0" cellspacing="0"> <!--DWLayoutTable--> <tr> <td width="100%" height="70" valign="top"><img src="test.jpg" width="600" height="120"> </td> </tr> <tr> <td height="262" valign="top"><p> </p> <form method="post" action="pi.php" enctype="multipart/form-data"> <table width="75%" border="0" align="center" bgcolor="#FFFFFF"> <tr> <td width="23%"><div align="center"><font face="BankGothic Md BT"> </font></div></td> <td width="77%" bgcolor="#FFFFFF"> </td> </tr> <tr> <td><div align="center"></div></td> <td bgcolor="#FFFFFF"> </td> </tr> <tr> <td><div align="center"></div></td> <td bgcolor="#FFFFFF"> </td> </tr> <tr> <td><div align="left"><strong>Imagem pequena</strong></div></td> <td bgcolor="#FFFFFF"> <input type=hidden name=MAX_FILE_SIZE value=102400> <input type="File" name="origem"> </td> </tr> <tr> <td><div align="left"><strong>Imagem grande</strong></div></td> <td bgcolor="#FFFFFF"><input type=hidden name=MAX_FILE_SIZE value=102400> <input type="File" name="origem2"> </td> </tr> <tr> <td><div align="center"></div></td> <td bgcolor="#FFFFFF"> </td> </tr> <tr> <td> </td> <td> </td> </tr> </table> <p align="center"> <input name="submit" type="submit" value="Adicionar"> <input type="hidden" name="page" value="inserir1"> </form></p> </td> </tr> <tr> <td height="81" valign="top"><div align="center"> <p> </p> <p> <?php
include ('menu.php');
?> </p> </div></td> </tr> </table>
---------------------------------------------------------------------------- ------------------------
"pi.php"
echo $_REQUEST['page']; returns inserir1 _correct
echo $_FILES['origem']; returns ARRAY _error why ? what i have to do to return the temp path of the file to ? im lost set_time_limit(60); $path=(dirname($PATH_TRANSLATED))."/primeirapagina/"; $origem_name="fdx.jpg"; $dest= $path.$origem_name;
if (($origem <> "none") && ($origem <> "")){ if (copy($origem,$dest)){;
} else { echo "directoria sem direitos de escrita <br>"; } unlink ($origem); }
set_time_limit(60); $path2=(dirname($PATH_TRANSLATED))."/primeirapagina/"; $origem2_name="porra.jpg"; $dest2= $path2.$origem2_name; file://printf("$path"); file://printf("<br>"); file://printf("$origem_name"); if (($origem2 <> "none") && ($origem2 <> "")){ if (copy($origem2,$dest2)){; file://echo "<br>upload do ficheiro $origem_name efectuada com sucesso !!!"; // echo "<br>tamanho do ficheiro $origem_size"; // echo " <br>tipo de ficheiro $origem_type"; } else { echo "directoria sem direitos de escrita <br>"; } unlink ($origem2); } ?>
</body> </html>
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
attached mail follows:
On Monday 04 November 2002 11:04, rija wrote: > You might receive 2 files throught upload, > then the first file name should be $_FILES['origem'] ; > and the second file name $_FILES['origem2'] ; > > To use the different variables you can use, peer John Holmes's answer, > there aren't no full answer like this anywhere?
There's a perfectly good example in the manual that people should use and adapt instead of trying to write their own non-working upload forms.
If they could just spend a couple of minutes searching the archives or even reading the manual, they could save themselved oodles of time and grief.
-- Jason Wong -> Gremlins Associates -> www.gremlins.com.hk Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development */* Getting into trouble is easy. -- D. Winkel and F. Prosser */
attached mail follows:
Ok, I have turned global vars off and I have replaced my old $HTTP_GET_VARS with $_GET[] but I seem to not get the values passed. I run the phpinfo and I see the variables being stored as _GET["variable_name"]
Is calling $_GET["variable_name"] correct? If so, why would I not get the value?
I use it in the following statement (checking if error_message is empty) : if ($_GET["error_message"])
Thanks Paul
attached mail follows:
You didn't really tell us how you're passing data or what is not working.
Try this. Create a test script called test.php that looks like this:
<? echo "<p>The test variable is [" . $_GET["test"] . "]</p>"; ?>
Assuming this script is located at http://example.org/test.php, access this page using a URL like this:
http://example.org/test.php?test=foo
Chris
Paul wrote:
>Ok, I have turned global vars off and I have replaced my old >$HTTP_GET_VARS with $_GET[] but I seem to not get the values passed. I >run the phpinfo and I see the variables being stored as >_GET["variable_name"] > >Is calling $_GET["variable_name"] correct? If so, why would I not get >the value? > >I use it in the following statement (checking if error_message is empty) >: >if ($_GET["error_message"]) >
attached mail follows:
I am passing it via URL as: http://example.org/test.php?test=foo
When I do that call to $_GET["test"] shows that variable is not set, however, when I run phpinfo() it shows value assigned to _GET. With no change in code, I turn global variables 'on' and the same page works..
Paul
PS using php 4.2.3
-----Original Message-----
From: Chris Shiflett [mailto:shiflett
php.net]
Sent: Sunday, November 03, 2002 10:15 PM
To: Paul
Cc: php-general
lists.php.net
Subject: Re: [PHP] Global Variables Off
You didn't really tell us how you're passing data or what is not working.
Try this. Create a test script called test.php that looks like this:
<? echo "<p>The test variable is [" . $_GET["test"] . "]</p>"; ?>
Assuming this script is located at http://example.org/test.php, access this page using a URL like this:
http://example.org/test.php?test=foo
Chris
Paul wrote:
>Ok, I have turned global vars off and I have replaced my old >$HTTP_GET_VARS with $_GET[] but I seem to not get the values passed. I >run the phpinfo and I see the variables being stored as >_GET["variable_name"] > >Is calling $_GET["variable_name"] correct? If so, why would I not get >the value? > >I use it in the following statement (checking if error_message is empty) >: >if ($_GET["error_message"]) >
attached mail follows:
Try single quotes...
$_GET['test']
Paul wrote:
> I am passing it via URL as: http://example.org/test.php?test=foo
>
> When I do that call to $_GET["test"] shows that variable is not set,
> however, when I run phpinfo() it shows value assigned to _GET.
> With no change in code, I turn global variables 'on' and the same page
> works..
>
> Paul
>
> PS using php 4.2.3
>
> -----Original Message-----
> From: Chris Shiflett [mailto:shiflett
php.net]
> Sent: Sunday, November 03, 2002 10:15 PM
> To: Paul
> Cc: php-general
lists.php.net
> Subject: Re: [PHP] Global Variables Off
>
> You didn't really tell us how you're passing data or what is not
> working.
>
> Try this. Create a test script called test.php that looks like this:
>
> <?
> echo "<p>The test variable is [" . $_GET["test"] . "]</p>";
> ?>
>
> Assuming this script is located at http://example.org/test.php, access
> this page using a URL like this:
>
> http://example.org/test.php?test=foo
>
> Chris
>
> Paul wrote:
>
>
>>Ok, I have turned global vars off and I have replaced my old
>>$HTTP_GET_VARS with $_GET[] but I seem to not get the values passed. I
>>run the phpinfo and I see the variables being stored as
>>_GET["variable_name"]
>>
>>Is calling $_GET["variable_name"] correct? If so, why would I not get
>>the value?
>>
>>I use it in the following statement (checking if error_message is
>
> empty)
>
>>:
>>if ($_GET["error_message"])
>>
>
>
>
>
>
attached mail follows:
Makes no difference..I tried them both
-----Original Message-----
From: John Nichel [mailto:jnichel
by-tor.com]
Sent: Sunday, November 03, 2002 10:59 PM
To: Paul
Cc: 'Chris Shiflett'; php-general
lists.php.net
Subject: Re: [PHP] Global Variables Off
Try single quotes...
$_GET['test']
Paul wrote:
> I am passing it via URL as: http://example.org/test.php?test=foo
>
> When I do that call to $_GET["test"] shows that variable is not set,
> however, when I run phpinfo() it shows value assigned to _GET.
> With no change in code, I turn global variables 'on' and the same page
> works..
>
> Paul
>
> PS using php 4.2.3
>
> -----Original Message-----
> From: Chris Shiflett [mailto:shiflett
php.net]
> Sent: Sunday, November 03, 2002 10:15 PM
> To: Paul
> Cc: php-general
lists.php.net
> Subject: Re: [PHP] Global Variables Off
>
> You didn't really tell us how you're passing data or what is not
> working.
>
> Try this. Create a test script called test.php that looks like this:
>
> <?
> echo "<p>The test variable is [" . $_GET["test"] . "]</p>";
> ?>
>
> Assuming this script is located at http://example.org/test.php, access
> this page using a URL like this: > > http://example.org/test.php?test=foo > > Chris > > Paul wrote: > > >>Ok, I have turned global vars off and I have replaced my old >>$HTTP_GET_VARS with $_GET[] but I seem to not get the values passed. I >>run the phpinfo and I see the variables being stored as >>_GET["variable_name"] >> >>Is calling $_GET["variable_name"] correct? If so, why would I not get >>the value? >> >>I use it in the following statement (checking if error_message is > > empty) > >>: >>if ($_GET["error_message"]) >> > > > > >
attached mail follows:
I assume you mean that the echo statement I gave as an example shows this:
The test variable is []
Right? If so, that is truly odd, especially considering you are using 4.2.3. I don't have a good answer for that ...
Add this code to the top of your script to see if PHP thinks the client is passing any data at all:
echo "<pre>"; print_r($_REQUEST); echo "</pre>";
Chris
Paul wrote:
>I am passing it via URL as: http://example.org/test.php?test=foo
>
>When I do that call to $_GET["test"] shows that variable is not set,
>however, when I run phpinfo() it shows value assigned to _GET.
>With no change in code, I turn global variables 'on' and the same page
>works..
>
>Paul
>
>PS using php 4.2.3
>
>-----Original Message-----
>From: Chris Shiflett [mailto:shiflett
php.net]
>Sent: Sunday, November 03, 2002 10:15 PM
>To: Paul
>Cc: php-general
lists.php.net
>Subject: Re: [PHP] Global Variables Off
>
>You didn't really tell us how you're passing data or what is not
>working.
>
>Try this. Create a test script called test.php that looks like this:
>
><?
>echo "<p>The test variable is [" . $_GET["test"] . "]</p>";
>?>
>
>Assuming this script is located at http://example.org/test.php, access
>this page using a URL like this:
>
>http://example.org/test.php?test=foo
>
>Chris
>
>Paul wrote:
>
>
>
>>Ok, I have turned global vars off and I have replaced my old
>>$HTTP_GET_VARS with $_GET[] but I seem to not get the values passed. I
>>run the phpinfo and I see the variables being stored as
>>_GET["variable_name"]
>>
>>Is calling $_GET["variable_name"] correct? If so, why would I not get
>>the value?
>>
>>I use it in the following statement (checking if error_message is
>>
>>
>empty)
>
>
>>:
>>if ($_GET["error_message"])
>>
>>
>>
>
>
>
>
>
>
attached mail follows:
Try these two simple tests, with the url test.php?test=foo
<HTML> <BODY> <? print_r($_GET); ?><br /> <?=$_GET['test']?> </BODY> </HTML>
And show us the results.
Justin
on 04/11/02 1:54 PM, Paul (pax
cfl.rr.com) wrote:
> I am passing it via URL as: http://example.org/test.php?test=foo
>
> When I do that call to $_GET["test"] shows that variable is not set,
> however, when I run phpinfo() it shows value assigned to _GET.
> With no change in code, I turn global variables 'on' and the same page
> works..
>
> Paul
>
> PS using php 4.2.3
>
> -----Original Message-----
> From: Chris Shiflett [mailto:shiflett
php.net]
> Sent: Sunday, November 03, 2002 10:15 PM
> To: Paul
> Cc: php-general
lists.php.net
> Subject: Re: [PHP] Global Variables Off
>
> You didn't really tell us how you're passing data or what is not
> working.
>
> Try this. Create a test script called test.php that looks like this:
>
> <?
> echo "<p>The test variable is [" . $_GET["test"] . "]</p>";
> ?>
>
> Assuming this script is located at http://example.org/test.php, access
> this page using a URL like this:
>
> http://example.org/test.php?test=foo
>
> Chris
>
> Paul wrote:
>
>> Ok, I have turned global vars off and I have replaced my old
>> $HTTP_GET_VARS with $_GET[] but I seem to not get the values passed. I
>> run the phpinfo and I see the variables being stored as
>> _GET["variable_name"]
>>
>> Is calling $_GET["variable_name"] correct? If so, why would I not get
>> the value?
>>
>> I use it in the following statement (checking if error_message is
> empty)
>> :
>> if ($_GET["error_message"])
>>
>
>
>
attached mail follows:
OK I guess I am closer = the variable is being passed as I tested but I guess is failing on the test:
if (isset($_GET["error_message"]))
Thank you for all your help
Paul
-----Original Message-----
From: Chris Shiflett [mailto:shiflett
php.net]
Sent: Sunday, November 03, 2002 11:08 PM
To: Paul
Cc: php-general
lists.php.net
Subject: Re: [PHP] Global Variables Off
I assume you mean that the echo statement I gave as an example shows this:
The test variable is []
Right? If so, that is truly odd, especially considering you are using 4.2.3. I don't have a good answer for that ...
Add this code to the top of your script to see if PHP thinks the client is passing any data at all:
echo "<pre>"; print_r($_REQUEST); echo "</pre>";
Chris
Paul wrote:
>I am passing it via URL as: http://example.org/test.php?test=foo
>
>When I do that call to $_GET["test"] shows that variable is not set,
>however, when I run phpinfo() it shows value assigned to _GET.
>With no change in code, I turn global variables 'on' and the same page
>works..
>
>Paul
>
>PS using php 4.2.3
>
>-----Original Message-----
>From: Chris Shiflett [mailto:shiflett
php.net]
>Sent: Sunday, November 03, 2002 10:15 PM
>To: Paul
>Cc: php-general
lists.php.net
>Subject: Re: [PHP] Global Variables Off
>
>You didn't really tell us how you're passing data or what is not
>working.
>
>Try this. Create a test script called test.php that looks like t