RE: [PHP] apostrophe ( ' ) on a form, adding \; How can i fix this?

2004-02-26 Thread Chris W. Parker
as others have mentioned already, it's happening automatically because of the magic 
quotes feature. use the function stripslashes() to remove the escaping character.
 
$text = o\'reilly;
 
$text = stripslashes($text);
 
// $text now equals o'reilly;
 
 
hth,
chris.

-Original Message- 
From: Louie Miranda [mailto:[EMAIL PROTECTED] 
Sent: Wed 2/25/2004 9:19 PM 
To: [EMAIL PROTECTED] 
Cc: 
Subject: [PHP] apostrophe ( ' ) on a form, adding \; How can i fix this?



I have a user/form that client enters data. And one of my clients have an
apostrophe on his name

eg: Ero's

Now, this page has a confirmation page that the client would see first
before his form will be directed into my system. Now its shows Ero\'s how
come this is happening? I dont have any filters for this?

Any help is much appreciated! Thank you!

-- -
Louie Miranda
http://www.axishift.com

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





Re: [PHP] Re: Image resize on upload

2004-02-26 Thread Gareth Williams
I'll second that one, I wrote a shell script in PHP to resize images, 
using ImageMagicks mogrify
command, and it took ages.  It's really much too slow for a web site.

If you need a faster solution, I think you have to buy something.

On 26 Feb 2004, at 09:15, Adam Bregenzer wrote:

On Thu, 2004-02-26 at 02:25, Will wrote:
I forgot to mention what I was trying to do.
There is a web page that pulls the image file name from the database
then  reads the URL to the directory where the image is.  Is it 
possible
to just resize it when the web page is brought up in the browser?
I use ImageMagick's[1] convert[2] to do this.  It is not a PHP module
and must be run through exec[3].  Also, in my experience image
manipulation is rather time consuming, it is a good idea to cache
altered images so they do not have to be recreated on every page load.
[1] http://www.imagemagick.org/
[2] http://www.imagemagick.org/www/convert.html
[3] http://www.php.net/exec
--
Adam Bregenzer
[EMAIL PROTECTED]
http://adam.bregenzer.net/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

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


Re: [PHP] Re: Image resize on upload

2004-02-26 Thread Adam Bregenzer
On Thu, 2004-02-26 at 02:25, Will wrote:
 I forgot to mention what I was trying to do.
 There is a web page that pulls the image file name from the database 
 then  reads the URL to the directory where the image is.  Is it possible 
 to just resize it when the web page is brought up in the browser?

I use ImageMagick's[1] convert[2] to do this.  It is not a PHP module
and must be run through exec[3].  Also, in my experience image
manipulation is rather time consuming, it is a good idea to cache
altered images so they do not have to be recreated on every page load.

[1] http://www.imagemagick.org/
[2] http://www.imagemagick.org/www/convert.html
[3] http://www.php.net/exec

-- 
Adam Bregenzer
[EMAIL PROTECTED]
http://adam.bregenzer.net/


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



Re: [PHP] Re: Image resize on upload

2004-02-26 Thread daniel
gd seems to work fine ? even nconvert via command line does a good job and
it resizes gif too

 I'll second that one, I wrote a shell script in PHP to resize images,
 using ImageMagicks mogrify
 command, and it took ages.  It's really much too slow for a web site.

 If you need a faster solution, I think you have to buy something.

 On 26 Feb 2004, at 09:15, Adam Bregenzer wrote:

 On Thu, 2004-02-26 at 02:25, Will wrote:
 I forgot to mention what I was trying to do.
 There is a web page that pulls the image file name from the database
 then  reads the URL to the directory where the image is.  Is it
 possible
 to just resize it when the web page is brought up in the browser?

 I use ImageMagick's[1] convert[2] to do this.  It is not a PHP module
 and must be run through exec[3].  Also, in my experience image
 manipulation is rather time consuming, it is a good idea to cache
 altered images so they do not have to be recreated on every page load.

 [1] http://www.imagemagick.org/
 [2] http://www.imagemagick.org/www/convert.html
 [3] http://www.php.net/exec

 --
 Adam Bregenzer
 [EMAIL PROTECTED]
 http://adam.bregenzer.net/


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



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

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



Re: [PHP] Apache/IE hangs with PHP

2004-02-26 Thread Evan Nemerson
It's only IE? Perhaps IE keeps connections in a global structure and tries to 
use already established connections, regardless of which window you're using? 
It's just a guess, but it seems logical- it would cut down on TCP handshake 
waste, but one window could effectively DoS another. I wonder what would 
happen on multi-user installations of windows...? Anyone got a box the could 
test on?


On Wednesday 25 February 2004 06:30 pm, Vincent Bouret wrote:
 Hi,

 I have this strange problem. I have Apache 1.3.28 on Windows XP Home SP1
 with PHP 4.3.4 as a module:

 httpd.conf
 LoadModule php4_module c:/php/sapi/php4apache.dll
 AddType application/x-httpd-php .php
 AddType application/x-httpd-php .phtml

 //After a list of modules
 AddModule mod_php4.c

 Let's say I have test.php that does nothing more than sleeping for 30
 seconds:
 ?php
 sleep(30);
 ?
 html
 content
 /html

 When I open up this script in IE with http://localhost/test.php and within
 the 30 seconds sleep I try to load another file with .php extension
 (regardless of whether there are some php statements or not in the file) on
 the same localhost server with another IE window, IE or Apache hangs until
 the first script is done and then gives output of the second script.

 The thing is that when I connect to Apache manually with Telnet during the
 same 30 seconds and I request a PHP script, I get the answer immediately.

 I've tried almost everything, Apache 2.0, PHP5, disabling Keep-Alive in
 Apache, nothing works.

 What am I doing wrong? Is that a natural behaviour.

 Thanks for your help,
 Vincent

-- 
Evan Nemerson
[EMAIL PROTECTED]
http://coeusgroup.com/en

--
...the whole idea of revenge and punishment is a childish daydream. Properly 
speaking, there is no such thing as revenge. Revenge is an act which you want 
to commit when you are powerless and because you are powerless: as soon as 
the sense of impotence is removed, the desire evaporates also. 

-George Orwell

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



Re: [PHP] Access DNS record

2004-02-26 Thread Evan Nemerson
On Wednesday 25 February 2004 06:19 pm, Jeff Schwartz wrote:
 Does anyone know how to access a DNS record? Can it be done with fopen?

it could be done with fsockopen (*grins maniacally*)... but 
php.net/dns_get_record may be a better way to go.

 Jeff


 -
 Do you Yahoo!?
 Yahoo! Mail SpamGuard - Read only the mail you want.

-- 
Evan Nemerson
[EMAIL PROTECTED]
http://coeusgroup.com/en

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



[PHP] Send Attachments via mail using form

2004-02-26 Thread Dave Carrera
Hi List,

I would like to allow my visitors to send attachments via my contact form.

I already have email validation, field verifications and other nice bits but
I am stuck on the add attachment bit.

Also would this be limited to one file or can multiple files be allowed ?

Thank you in advance for any help or advise with this.

Yours Truly

Dave C

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.595 / Virus Database: 378 - Release Date: 25/02/2004
 

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



[PHP] Re: Send Attachments via mail using form

2004-02-26 Thread Michael Kunze
Dave Carrera wrote:

 I would like to allow my visitors to send attachments via my contact form.

the easiest way is to use the http://phpmailer.sf.net
great piece of software. it has a simple function to add attachments.

 Also would this be limited to one file or can multiple files be allowed ?

via html forms you can only upload one file per browse button (simple
saying)
if you want to upload more do something like yahoo.com after one upload
is finished you get the chance to upload more. but still only one file a
time.

michael

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



[PHP] Re: Send Attachments via mail using form

2004-02-26 Thread Michael Nolan
Dave Carrera wrote:
Hi List,

I would like to allow my visitors to send attachments via my contact form.

I already have email validation, field verifications and other nice bits but
I am stuck on the add attachment bit.
Also would this be limited to one file or can multiple files be allowed ?

Thank you in advance for any help or advise with this.

Yours Truly

Dave C

Have you read the manual?  Try reading the comments for the mail entry:

http://www.php.net/mail

Michael

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


[PHP] pager related issue

2004-02-26 Thread Alessandro Vitale
I am working on a pager class that relies on a standard statement like:

select * from my_table limit $offset, $limit


As a feature of my pager class, I would like to display the total number of
pages (each one of $limit rows) to display and the current page number. Does
anybody use any clever trick other than performing an additional query like
SELECT COUNT(*) WHERE.. ?

any suggestion is welcome.

thanks

alessandro

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



Re: [PHP] How to get the auto-incremented value?

2004-02-26 Thread Gareth Williams
The function  mysql_insert_id() will return the correct value.

On 26 Feb 2004, at 17:10, Brian Dunning wrote:

When I write a record to a MySQL db with an auto-incremented key 
column, say it's called id, what's the easy to retrieve that value? 
Do I have to run a query?

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



Re: [PHP] How to get the auto-incremented value?

2004-02-26 Thread Brian Dunning
On Feb 26, 2004, at 8:14 AM, Gareth Williams wrote:

The function  mysql_insert_id() will return the correct value.
Thanks!

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


[PHP] Re: PHP5 simpleXML bug or am i just being silly :)

2004-02-26 Thread Andre Cerqueira
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
or this:

print('p$this-user-site[0]::/p');
print_r($this-user-site[0]);
wait... thats what he done hehe
nvm?
what is your php5 build?
have you tried the examples? 
(http://www.php.net/manual/en/ref.simplexml.php)

did they work?
anyway, it looks pretty odd...


Luke wrote:
Dont you need to use  instead of ' as ' is a string literal, while  parses
variables etc in that string
try this instead:
print(p$this-user-site[0]::/p);
Maybe that will help?

- -- 
André Cerqueira
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.2.4 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFAPuGxaxdA/5C8vH8RAmdMAKDUQ49EszUioLy4VXZ8UEnaJmpq4wCggKNB
ROhlu0/fR4E43KDaFdsrzmI=
=NW8F
-END PGP SIGNATURE-
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Ming library

2004-02-26 Thread Rostislav Kerey
I've developed the web-site by PHP with using Ming-library. All worked well
on the local computer, but when I uploaded all to the internet server I have
got an  error :(
Ming library does not set in php.ini. The hosting provider company does not
want to add extension=php_ming.so to php.ini.
What should I do???
dl() function does not work too, because it is multithreaded Web servers.

I'm congused...
I really need to use it! Maybe I can find such library written by PHP?
There are few classes, nothig else.

Help me, please!!

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



[PHP] PHP Warning. Anyone knows what it means?

2004-02-26 Thread vjove


Hi,

the error_log file shows the following message:

PHP Warning:  Unknown(): Actual POST length does not match Content-Length, and exceeds 
20 bytes in Unknown on line 0

and I have a php application not working properly and it looks like it may be caused 
by something related to this error. The symptons are post fields not reaching the 
destination page, or receiving corrupted data.

Anyone knows what it means and how to solve it?

Using Suse Linux 8.2, apache 2.0.46 and php 4.3.1 (i've also tested with 4.3.3). It 
happens with Mozilla and IE.

The same application in a SUSE 9.0 box, php 4.3.3 and apache 2.0.48, works ok. 

Thanks,

Valentí Jové

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



Re: [PHP] Apache/IE hangs with PHP

2004-02-26 Thread Vincent Bouret
I just made the same test with IIS/PHP on Windows 2000 system and the
problem described previously doesn't occur. Looks like an Apache problem
then.

I've read that Internet Explorer is using only two connection / server.
Maybe it has something to do with that.

Thanks
Vincent

Evan Nemerson [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 It's only IE? Perhaps IE keeps connections in a global structure and tries
to
 use already established connections, regardless of which window you're
using?
 It's just a guess, but it seems logical- it would cut down on TCP
handshake
 waste, but one window could effectively DoS another. I wonder what would
 happen on multi-user installations of windows...? Anyone got a box the
could
 test on?


 On Wednesday 25 February 2004 06:30 pm, Vincent Bouret wrote:
  Hi,
 
  I have this strange problem. I have Apache 1.3.28 on Windows XP Home SP1
  with PHP 4.3.4 as a module:
 
  httpd.conf
  LoadModule php4_module c:/php/sapi/php4apache.dll
  AddType application/x-httpd-php .php
  AddType application/x-httpd-php .phtml
 
  //After a list of modules
  AddModule mod_php4.c
 
  Let's say I have test.php that does nothing more than sleeping for 30
  seconds:
  ?php
  sleep(30);
  ?
  html
  content
  /html
 
  When I open up this script in IE with http://localhost/test.php and
within
  the 30 seconds sleep I try to load another file with .php extension
  (regardless of whether there are some php statements or not in the file)
on
  the same localhost server with another IE window, IE or Apache hangs
until
  the first script is done and then gives output of the second script.
 
  The thing is that when I connect to Apache manually with Telnet during
the
  same 30 seconds and I request a PHP script, I get the answer
immediately.
 
  I've tried almost everything, Apache 2.0, PHP5, disabling Keep-Alive in
  Apache, nothing works.
 
  What am I doing wrong? Is that a natural behaviour.
 
  Thanks for your help,
  Vincent

 -- 
 Evan Nemerson
 [EMAIL PROTECTED]
 http://coeusgroup.com/en

 --
 ...the whole idea of revenge and punishment is a childish daydream.
Properly
 speaking, there is no such thing as revenge. Revenge is an act which you
want
 to commit when you are powerless and because you are powerless: as soon as
 the sense of impotence is removed, the desire evaporates also. 

 -George Orwell

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



[PHP] Re: Question about CGI binary

2004-02-26 Thread Chris
I am aware of safe mode but, are you saying that when PHP is installed as a
CGI binary safe mode is on by default?
Chris

André cerqueira [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 -BEGIN PGP SIGNED MESSAGE-
 Hash: SHA1

 http://www.php.net/set_time_limit

 [snip]
   Warning
  
   set_time_limit() has NO EFFECT when PHP is running in safe mode. There
   is NO workaround other than turning off safe mode or changing the time
   limit in the php.ini.
 [/snip]

 most servers do that



 Chris wrote:

  I've run into situation where my PHP script, (which loads records into a
  database) gets timed out after 30 seconds, terminating the script
execution.
  I understand that PHP, on my hosting system, is installed as a CGI
binary.
  I've even included set_time_limit which seems to have no effect. Is is
  possible that the timeout is being caused by a cgi script execution
limit?
  Or may something else be afoot?
 
  Chris

 - -- 
 André Cerqueira
 -BEGIN PGP SIGNATURE-
 Version: GnuPG v1.2.4 (MingW32)
 Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

 iD8DBQFAPZvSaxdA/5C8vH8RAgXiAJ0Y7lBzXZmAtQI9kssLrO08fcmtOgCdHgwu
 uJtKL+MjART6lvCYzHu5JqY=
 =s+B1
 -END PGP SIGNATURE-

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



[PHP] values from string query

2004-02-26 Thread Angelo Zanetti
HI all I have a Select that get a resultset, once I get this then I use the
values of this resultset to enter them into another table using an INSERT
statement. I get no errors from the statement but it just doesn't seem to
see my variables from the recordset,

below is my code:



$q=select * from prospects where p_id = '$p_id';
$result=mysql_query($q, $this-link) or die (.mysql_error());

while($a_row=mysql_fetch_array($result))
{
$c_query=Insert into client (c_name, c_company, c_worktel, 
c_directtel,
c_hometel, c_fax, c_cell, c_email, c_address, c_city, c_pcode, c_country)
VALUES ($a_row['p_name'], $a_row['p_company'], $a_row['p_worktel'],
$a_row['p_directtel'], $a_row['p_hometel'], $a_row['p_fax'],
$a_row['p_cell'], $a_row['c_email'], $a_row['c_address'], $a_row['c_city'],
$a_row['c_pcode'], $a_row['c_country']);
mysql_query($c_query,$this-link) or die (.mysql_error());
}

I echo'd out the values from the Select just to make sure it was getting the
correct values.

any help will be appreciated, thanx in advance

Angelo


Disclaimer 
This e-mail transmission contains confidential information,
which is the property of the sender.
The information in this e-mail or attachments thereto is 
intended for the attention and use only of the addressee. 
Should you have received this e-mail in error, please delete 
and destroy it and any attachments thereto immediately. 
Under no circumstances will the Cape Technikon or the sender 
of this e-mail be liable to any party for any direct, indirect, 
special or other consequential damages for any use of this e-mail.
For the detailed e-mail disclaimer please refer to 
http://www.ctech.ac.za/polic or call +27 (0)21 460 3911

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



Re: [PHP] Re: Image resize on upload

2004-02-26 Thread Will
Thanks!! I found some documentation on the GD library.
I most likely be posting again!! :)
~WILL~

[EMAIL PROTECTED] wrote:
gd seems to work fine ? even nconvert via command line does a good job and
it resizes gif too

I'll second that one, I wrote a shell script in PHP to resize images,
using ImageMagicks mogrify
command, and it took ages.  It's really much too slow for a web site.
If you need a faster solution, I think you have to buy something.

On 26 Feb 2004, at 09:15, Adam Bregenzer wrote:


On Thu, 2004-02-26 at 02:25, Will wrote:

I forgot to mention what I was trying to do.
There is a web page that pulls the image file name from the database
then  reads the URL to the directory where the image is.  Is it
possible
to just resize it when the web page is brought up in the browser?
I use ImageMagick's[1] convert[2] to do this.  It is not a PHP module
and must be run through exec[3].  Also, in my experience image
manipulation is rather time consuming, it is a good idea to cache
altered images so they do not have to be recreated on every page load.
[1] http://www.imagemagick.org/
[2] http://www.imagemagick.org/www/convert.html
[3] http://www.php.net/exec
--
Adam Bregenzer
[EMAIL PROTECTED]
http://adam.bregenzer.net/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

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


Re: [PHP] XML Tool Needed

2004-02-26 Thread Burhan Khalid
Nick Wilson wrote:
* and then Burhan Khalid declared

Nick Wilson wrote:


I'm looking for a tool that will parse an xml doc into somthing like an
associative array for me. Basically somthing to make life simple when
dealing with Amazon XML docs.
I have been all thru hotscripts and even tried doing it myself but my
time is limited and the tools out there are waay beyond what I
actually need.
Anyone have any recommendations or ideas?
http://pear.php.net/manual/en/package.xml.xml-serializer.php

Does what you want and more :)


Thanks very much!

I see it will turn an array/obj to a xml doc, will it return that xml to
array/obj? - I think so but was not sure from a quick look at the
docs...
http://pear.php.net/manual/en/package.xml.xml-serializer.xml-unserializer-summary.php

Helps to click a bit further down the page ;)

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


[PHP] Re: values from string query

2004-02-26 Thread Jakes
excape your variables like so in your insert statement - ' $a_row[p_company]
' (quick and dirty style),
or the clean way  .$a_row['p_company'] .


Angelo Zanetti [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 HI all I have a Select that get a resultset, once I get this then I use
the
 values of this resultset to enter them into another table using an INSERT
 statement. I get no errors from the statement but it just doesn't seem to
 see my variables from the recordset,

 below is my code:



 $q=select * from prospects where p_id = '$p_id';
 $result=mysql_query($q, $this-link) or die (.mysql_error());

 while($a_row=mysql_fetch_array($result))
 {
 $c_query=Insert into client (c_name, c_company, c_worktel, c_directtel,
 c_hometel, c_fax, c_cell, c_email, c_address, c_city, c_pcode, c_country)
 VALUES ($a_row['p_name'], $a_row['p_company'], $a_row['p_worktel'],
 $a_row['p_directtel'], $a_row['p_hometel'], $a_row['p_fax'],
 $a_row['p_cell'], $a_row['c_email'], $a_row['c_address'],
$a_row['c_city'],
 $a_row['c_pcode'], $a_row['c_country']);
 mysql_query($c_query,$this-link) or die (.mysql_error());
 }

 I echo'd out the values from the Select just to make sure it was getting
the
 correct values.

 any help will be appreciated, thanx in advance

 Angelo

 
 Disclaimer
 This e-mail transmission contains confidential information,
 which is the property of the sender.
 The information in this e-mail or attachments thereto is
 intended for the attention and use only of the addressee.
 Should you have received this e-mail in error, please delete
 and destroy it and any attachments thereto immediately.
 Under no circumstances will the Cape Technikon or the sender
 of this e-mail be liable to any party for any direct, indirect,
 special or other consequential damages for any use of this e-mail.
 For the detailed e-mail disclaimer please refer to
 http://www.ctech.ac.za/polic or call +27 (0)21 460 3911

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



Re: [PHP] File access from another machine

2004-02-26 Thread Raditha Dissanayake
hi,

how about RCP,SCP, SFTP or FTP or worse comes to worse NFS

Harish wrote:

Hello All,

Is there any possibility to open a file in another machine, provided the IP
of the machine using PHP scripts.
I only need to open a file with the format abc190104.csv in another machine
 write data into that file. Or to steam it through the HTTP.
Regards
Harish Rao K
 



--
Raditha Dissanayake.

http://www.radinks.com/sftp/ | http://www.raditha.com/megaupload
Lean and mean Secure FTP applet with | Mega Upload - PHP file uploader
Graphical User Inteface. Just 150 KB | with progress bar.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Apache/IE hangs with PHP

2004-02-26 Thread Erwin Kerk
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
Vincent Bouret wrote:

| Hi,
|
| I have this strange problem. I have Apache 1.3.28 on Windows XP Home SP1
| with PHP 4.3.4 as a module:
|
| httpd.conf
| LoadModule php4_module c:/php/sapi/php4apache.dll
| AddType application/x-httpd-php .php
| AddType application/x-httpd-php .phtml
|
| //After a list of modules
| AddModule mod_php4.c
|
| Let's say I have test.php that does nothing more than sleeping for 30
| seconds:
| ?php
| sleep(30);
| ?
| html
| content
| /html
|
| When I open up this script in IE with http://localhost/test.php and within
| the 30 seconds sleep I try to load another file with .php extension
| (regardless of whether there are some php statements or not in the
file) on
| the same localhost server with another IE window, IE or Apache hangs until
| the first script is done and then gives output of the second script.
|
| The thing is that when I connect to Apache manually with Telnet during the
| same 30 seconds and I request a PHP script, I get the answer immediately.
| Thanks for your help,
| Vincent
|
I suspect it has something to do with session handling. Check your ini
settings for a session_autostart or something.
Normal behavior for jultiple windows (or frames) and sessions, is that
they wait for each other to close (not destrow, close) the session.
See http://www.php.net/manual/en/function.session-write-close.php for
more information.
Godd luck with this one.

Erwin Kerk
Web Developer
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.2.4 (MingW32)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org
iD8DBQFAPfIW4rV3/oG+84URAizzAJ4+OpLSfMnA0J4tKl0NSdDprfvrtQCgvcc2
F2l+E0q/e0HpOwW5ecBAxUk=
=sPMG
-END PGP SIGNATURE-
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Re: Image resize on upload

2004-02-26 Thread Ed Curtis

 Make sure you use imagecreatetruecolor() with GD when resizing images or
you'll get some undesirable results. Imagemagick's convert and mogrify
worked well for me although I was resizing an uploaded image.

Ed Curtis


On Thu, 26 Feb 2004, Will wrote:

 Thanks!! I found some documentation on the GD library.
 I most likely be posting again!! :)

 ~WILL~


 [EMAIL PROTECTED] wrote:
  gd seems to work fine ? even nconvert via command line does a good job and
  it resizes gif too
 
 
 I'll second that one, I wrote a shell script in PHP to resize images,
 using ImageMagicks mogrify
 command, and it took ages.  It's really much too slow for a web site.
 
 If you need a faster solution, I think you have to buy something.
 
 On 26 Feb 2004, at 09:15, Adam Bregenzer wrote:
 
 
 On Thu, 2004-02-26 at 02:25, Will wrote:
 
 I forgot to mention what I was trying to do.
 There is a web page that pulls the image file name from the database
 then  reads the URL to the directory where the image is.  Is it
 possible
 to just resize it when the web page is brought up in the browser?
 
 I use ImageMagick's[1] convert[2] to do this.  It is not a PHP module
 and must be run through exec[3].  Also, in my experience image
 manipulation is rather time consuming, it is a good idea to cache
 altered images so they do not have to be recreated on every page load.
 
 [1] http://www.imagemagick.org/
 [2] http://www.imagemagick.org/www/convert.html
 [3] http://www.php.net/exec
 
 --
 Adam Bregenzer
 [EMAIL PROTECTED]
 http://adam.bregenzer.net/
 
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php

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


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



[PHP] Re: values from string query

2004-02-26 Thread Ben Ramsey
You may want to try putting single quotation marks around your values 
and place your array values within curly braces...

VALUES ('{$a_row['p_name']}', '{$a_row['p_company']}',

... and so forth.

Also, try echoing $c_query to see if the values are being stored in the 
variable properly, if you haven't already done so.  If the values aren't 
showing up in the variable, then you definitely need to include the 
curly braces.  If they are showing up, then perhaps MySQL needs the 
single quotation marks.

--
Regards,
 Ben Ramsey
 http://benramsey.com
 http://www.phpcommunity.org/wiki/People/BenRamsey
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Cant build php with apache2 `parent_req' might be clobbered by `longjmp' or `vfork'

2004-02-26 Thread Stephen
Hi Im trying to build php4 and php5 with apache2 but get errors building
sapi_apache2.lo

Building php5 gives me FATAL: can't create sapi/apache2handler/mod_php5.lo: No such 
file or director
Building php4 gives me FATAL: can't create sapi/apache2handler/sapi_apache2.lo: No 
such file or directory



error from php4
make[1]: Entering directory `/usr/src/php/php4-4.3.5/apache2-build'
/bin/sh /usr/src/php/php4-4.3.5/apache2-build/libtool --silent
--preserve-dup-deps --mode=compile /usr/src/php/php4-4.3.5/apache2-build/meta_ccld 
-I/usr/include/apache2  -I/usr/include/apr-0 -I/usr/include  -I/usr/include/apr-0
-Isapi/apache2handler/ -I/usr/src/php/php4-4.3.5/sapi/apache2handler/ -DPHP_ATOM_INC 
-I/usr/src/php/php4-4.3.5/apache2-build/include
-I/usr/src/php/php4-4.3.5/apache2-build/main -I/usr/src/php/php4-4.3.5 
-I/usr/src/php/php4-4.3.5/apache2-build/Zend -I/usr/include/sasl 
-I/usr/include/libxml2 -I/usr/X11R6/include
-I/usr/include/freetype2 -I/usr/include/c-client 
-I/usr/src/php/php4-4.3.5/ext/mbstring/mbregex  
-I/usr/src/php/php4-4.3.5/ext/mbstring/libmbfl 
-I/usr/src/php/php4-4.3.5/ext/mbstring/libmbfl/mbfl -I/usr/include/mysql
-I/usr/include/ucd-snmp -I/usr/src/php/php4-4.3.5/main -I/usr/src/php/php4-4.3.5/Zend 
-I/usr/src/php/php4-4.3.5/TSRM  -D_REENTRANT 
-I/usr/src/php/php4-4.3.5/apache2-build/TSRM
-O2 -Wall -fsigned-char -gstabs -pthread -DZTS  -prefer-pic -c 
/usr/src/php/php4-4.3.5/sapi/apache2handler/sapi_apache2.c
-o sapi/apache2handler/sapi_apache2.lo
/usr/src/php/php4-4.3.5/sapi/apache2handler/sapi_apache2.c: In function `php_handler':
/usr/src/php/php4-4.3.5/sapi/apache2handler/sapi_apache2.c:462: warning:
variable `parent_req' might be clobbered by `longjmp' or `vfork'
Assembler messages:
FATAL: can't create sapi/apache2handler/sapi_apache2.lo: No such file or directory
make[1]: *** [sapi/apache2handler/sapi_apache2.lo] Error 1
make[1]: Leaving directory `/usr/src/php/php4-4.3.5/apache2-build'
make: *** [build-apache2-stamp] Error 2


for php5
make[1]: Entering directory `/usr/src/php/php5-5.0.0/apache2-build'
/bin/sh /usr/src/php/php5-5.0.0/apache2-build/libtool --silent
--preserve-dup-deps --mode=compile
/usr/src/php/php5-5.0.0/apache2-build/meta_ccld  -I/usr/in
clude/apache2  -I/usr/include/apr-0 -I/usr/include  -I/usr/include/apr-0
-Isapi/apache2handler/ -I/usr/src/php/php5-5.0.0/sapi/apache2handler/
-DPHP_ATOM_I
NC -I/usr/src/php/php5-5.0.0/apache2-build/include
-I/usr/src/php/php5-5.0.0/apache2-build/main -I/usr/src/php/php5-5.0.0
-I/usr/src/php/php5-5.0.0/apache2-
build/Zend -I/usr/include/libxml2 -I/usr/X11R6/include
-I/usr/include/freetype2 -I/usr/include/c-client
-I/usr/src/php/php5-5.0.0/ext/mbstring/oniguruma -I/
usr/src/php/php5-5.0.0/ext/mbstring/libmbfl
-I/usr/src/php/php5-5.0.0/ext/mbstring/libmbfl/mbfl -I/usr/include/mysql
-I/usr/include/ucd-snmp -I/usr/src/php/
php5-5.0.0/main -I/usr/src/php/php5-5.0.0/Zend
-I/usr/src/php/php5-5.0.0/TSRM  -D_REENTRANT
-I/usr/src/php/php5-5.0.0/apache2-build/TSRM  -O2 -Wall -fsigned-char
-gstabs -pthread -DZTS  -prefer-pic -c
/usr/src/php/php5-5.0.0/sapi/apache2handler/mod_php5.c -o
sapi/apache2handler/mod_php5.lo
Assembler messages:
FATAL: can't create sapi/apache2handler/mod_php5.lo: No such file or directory
make[1]: *** [sapi/apache2handler/mod_php5.lo] Error 1
make[1]: Leaving directory `/usr/src/php/php5-5.0.0/apache2-build'
make: *** [build-apache2-stamp] Error 2

Thanks
Stephen

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



RE: [PHP] Obtaing the URL of current page

2004-02-26 Thread Shaunak Kashyap
url: $PHP_SELF
get variables: $QUERY_STRING

Shaunak

 -Original Message-
 From: Shaun [mailto:[EMAIL PROTECTED]
 Sent: Thursday, February 26, 2004 10:31 AM
 To: [EMAIL PROTECTED]
 Subject: [PHP] Obtaing the URL of current page
 
 
 Hi,
 
 How can i obtain the URL of the current page including any $_GET 
 variables?
 
 Thanks for your help
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 

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



RE: [PHP] Obtaing the URL of current page

2004-02-26 Thread Shaunak Kashyap
To be totally accurate --

1. $QUERY_STRING would only work with register_globals on. If
register_globals is off, use $_SERVER[QUERY_STRING].

2. I suppose you would also need the hostname. This can be obtained form
$_SERVER[HTTP_HOST]. Again, with register_globals on $HTTP_HOST may be
used.

Shaunak

 -Original Message-
 From: Shaunak Kashyap [mailto:[EMAIL PROTECTED]
 Sent: Thursday, February 26, 2004 10:29 AM
 To: [EMAIL PROTECTED]
 Subject: RE: [PHP] Obtaing the URL of current page


 url: $PHP_SELF
 get variables: $QUERY_STRING

 Shaunak

  -Original Message-
  From: Shaun [mailto:[EMAIL PROTECTED]
  Sent: Thursday, February 26, 2004 10:31 AM
  To: [EMAIL PROTECTED]
  Subject: [PHP] Obtaing the URL of current page
 
 
  Hi,
 
  How can i obtain the URL of the current page including any $_GET
  variables?
 
  Thanks for your help
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 

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


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



[PHP] Re: values from string query

2004-02-26 Thread André Cerqueira
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
you may find insert ... select interesting for what you want hehe
try this:
$sql = INSERT INTO client (c_name, c_company, c_worktel, c_directtel,
c_hometel, c_fax, c_cell, c_email, c_address, c_city, c_pcode,
c_country)
SELECT p_name, p_company, p_worktel, p_directtel, p_hometel,
p_fax, p_cell, c_email, c_address, c_city, c_pcode, c_country FROM
prospects WHERE p_id='. $p_id .';
mysql_query($q, $this-link) or die (.mysql_error());



more information:
http://www.mysql.com/doc/en/INSERT_SELECT.html
Angelo Zanetti wrote:
HI all I have a Select that get a resultset, once I get this then I
use the values of this resultset to enter them into another table
using an INSERT statement. I get no errors from the statement but it
just doesn't seem to see my variables from the recordset,
below is my code:



$q=select * from prospects where p_id = '$p_id'; 
$result=mysql_query($q, $this-link) or die (.mysql_error());

while($a_row=mysql_fetch_array($result)) { $c_query=Insert into
client (c_name, c_company, c_worktel, c_directtel, c_hometel, c_fax,
c_cell, c_email, c_address, c_city, c_pcode, c_country) VALUES
($a_row['p_name'], $a_row['p_company'], $a_row['p_worktel'], 
$a_row['p_directtel'], $a_row['p_hometel'], $a_row['p_fax'], 
$a_row['p_cell'], $a_row['c_email'], $a_row['c_address'],
$a_row['c_city'], $a_row['c_pcode'], $a_row['c_country']); 
mysql_query($c_query,$this-link) or die (.mysql_error()); }

I echo'd out the values from the Select just to make sure it was
getting the correct values.
any help will be appreciated, thanx in advance

Angelo

 
Disclaimer This e-mail transmission contains confidential
information, which is the property of the sender. The information in
this e-mail or attachments thereto is intended for the attention and
use only of the addressee. Should you have received this e-mail in
error, please delete and destroy it and any attachments thereto
immediately. Under no circumstances will the Cape Technikon or the
sender of this e-mail be liable to any party for any direct,
indirect, special or other consequential damages for any use of this
e-mail. For the detailed e-mail disclaimer please refer to 
http://www.ctech.ac.za/polic or call +27 (0)21 460 3911
- -- 
André Cerqueira
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.2.4 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFAPhoRaxdA/5C8vH8RAhJcAKDAf1xmOleWw/6MiQZbY62zXlBalACfcHBf
M6dd6Cadf44qGVjc1RS3kSM=
=5ZMB
-END PGP SIGNATURE-
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: Obtaing the URL of current page

2004-02-26 Thread Ben Ramsey
Take a look here, you may find this documentation useful:
http://www.php.net/manual/en/language.variables.predefined.php
Shaun wrote:

Hi,

How can i obtain the URL of the current page including any $_GET variables?

Thanks for your help
--
Regards,
 Ben Ramsey
 http://benramsey.com
 http://www.phpcommunity.org/wiki/People/BenRamsey
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Multiple Socket Read and Writes?

2004-02-26 Thread Matthew Vos
Wednesday, February 25, 2004, 2:19:26 AM, you wrote:
 
 D Hello all,
 
 D I am having a problem with getting multiple socket reads working in a
 D simple socket server!
 D The writes appear to be working but the reads seam to only allow one read?
 
 D I know i am missing something.  Could even be my approach is totally wrong
 D Currently I have:
 
 D$input = socket_read($client[$i]['sock'] , 2024,PHP_BINARY_READ );
 Dif ($input == null) {
 D  // Zero length string meaning disconnected
 D  echo null input 1\n;
 D  unset($client[$i]);
 D}
 Delseif ($input == 'exit') {
 D  // requested disconnect
 D  echo exit\n;
 D  socket_shutdown($client[$i]['sock']);
 D  socket_close($client[$i]['sock']);
 D}
 D  elseif ($input==kill) {
 D  echo kill\n;
 D  socket_shutdown($sock);
 D  socket_close($sock);
 D  die;
 D  }
 D  elseif ($input) {
 D  // strip white spaces and write back to user
 D  echo  -- . $input.\n;
 D  socket_write( $client[$i]['sock'],dechex(50) );
 D  echo  -- SYN 
 D .socket_strerror(socket_last_error()).\n;
 D  socket_write( $client[$i]['sock'],dechex(50) );
 D  echo  -- SYN 
 D .socket_strerror(socket_last_error()).\n;
 D  socket_write( $client[$i]['sock'],dechex(50) );
 D  echo  -- SYN 
 D .socket_strerror(socket_last_error()).\n;
 D  //$output = ereg_replace([ \t\n\r],,$input).chr(0);
 D  if ( false == ( socket_write( 
 D $client[$i]['sock'],dechex(46) ) ) ) {
 D  echo socket_write() failed: reason:  . 
 D socket_strerror(socket_last_error()) . \n;
 D  }
 D  else {
 D  echo  -- 
 D ENQ  .socket_strerror(socket_last_error()).\n;
 D  $input1 =
 D socket_read($client[$i]['sock'] , 
 D 2024,PHP_BINARY_READ );
 D  echo -- . $input1.   . 
 D socket_strerror(socket_last_error()) .\n;
 D  };
 D  }
 D  else {
 D  echo nothing on INPUT\n;
 D  }
 
 
 D --
 
 D UMPA
 DBrian C. Doyle
 D  Director, Internet Services
 D  United Merchant Processing Association
 D  http://www.umpa-us.comhttp://www.umpa-us.com
 D  1-800-555-9665 ext 212

How are you storing the socket in $client[$i]['sock']?
Like This:?
$socket = socket_create(...);
$client[$i]['sock'];

You need to do it like this:
$client[$i]['sock'] = socket_create(...);

Why are you using something like this anyways though? Wouldn't it be
easier to use some sort of daemon? When processing one client your
script will not be able to handle any of the others if you use the
way you are using now. However, if you run it as a daemon, forking
the process everyone someone connects, then it will be a separate
process for each client and you wont have latency issues.

Just a thought.

Matt


signature.asc
Description: This is a digitally signed message part


[PHP] PHP5 simpleXML bug or am i just being silly :)

2004-02-26 Thread William Bailey
Hi All,

	I am currently working with PHP5 beta and have found something strange 
with the simplexml objects. It seems to be forgetting its values. Below 
is an example..



[[the PHP5 code]]
snip
print('pre');
print('p$this-user::/p');
print_r($this-user);
print('p$this-user-site::/p');
print_r($this-user-site);
print('p$this-user-site[0]::/p');
print_r($this-user-site[0]);
die('/pre');
snip
[[END]]
[[the PHP5 Browser Output]]
$this-user::
simplexml_element Object
(
[login] = wb
[password] = 3c1175c6cdf614fb006cee10fdc325e3aa0f1894
[site] = Array
(
[0] = www.pro-net.co.uk
[1] = www.example.com
)
)

$this-user-site::
Array
(
[0] = simplexml_element Object
(
)
[1] = simplexml_element Object
(
)
)

$this-user-site[0]::
simplexml_element Object
(
)
[[END]]
	Shouldn't $this-user-site return the Array displayed in the output 
for $this-user or even shouldn't the simplexml_element Objects for 
$this-user-site have a value or something. Basically they shouldn't be 
blank otherwise how to you get the data?

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


[PHP] PHP ODBC and Pervasive.SQL

2004-02-26 Thread Pascal Schaedeli
Hi,

I am executing a SELECT query from PHP (4.3.4) through ODBC on a Pervasive
2000SP4 (all on Windows). odbc_result_all, odbc_fetch_into, and all other
php odbc function stop returning records before the end of the effective
resultset.

Here is what is happening  :
* In Pervasive: SELECT * FROM table returns n records (correct).
* In Access, throught ODBC, the same query returns the same n records
(correct).
* In PHP, odbc_exec of the same query returns mn records.

Specifically, I have identifed one field (call it fieldx) that seems to be
at the source of the problem : it seems stored over 4 bytes in Pervasive and
represents a decimal number.
If I rewrite the query in PHP to read SELECT fielda, fieldb,fieldc FROM
table, it returns n records (correct) (just to clarify SELECT fielda,
fieldb,fieldc,fieldx FROM table returns mn records).

How many is m? It depends on the sort order. I have identified with record's
fieldx is causing the problem. The records returned by odbc_* are up to that
problem record. If the sort order makes that problem record to be the last
one, then m = n-1. If the sort order makes that record be the first, then m
= 0.

Here is even more details for those who are still reading:
fieldx is written to Pervasive from an application for which I do not have
the source code. If I read the content of fieldx of the problem records,
erase it and manually re-enter it (in Pervasive Control Center), the issue
is solved and the PHP odbc query returns n records.

I'm not an expert on odbc and pervasive. Intuitively, it seems that the
field is somehow missformated. However, both Pervasive and Access are able
to interpret it correctly.

Does anybody have a suggestion on how I could either:
- Get Pervasive to reformat all field correctly.
- Get the odbc library in PHP to at least give me an error, or better,
interpret the field as Access does.

Thanks,
Pascal

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



[PHP] fscanf and memory

2004-02-26 Thread Sébastien Guay
Hi,

I don't know if it's a bug in php but if I do

$fp=fopen(some_file,r);
while (!feof($fp))
{
   fscanf($fp, %d %d,$var1,$var2);
   // some treatment
}
fclose($fp);
and the file is big enough, php eat up memory like hot cakes.
But if I do
$fp=fopen(some_file,r);
while (!feof($fp))
{
   $line = fscanf($fp, %d %d);
   list ($var1, $var2) = $line;
   // some treatment
}
fclose($fp);
It work just fine.  Seems a problem with fscanf.

Has someone ever experienced this?  Any advises?

Oh btw I'm using php 4.3.4 with Apache 1.3.29

Thanks in advance

Sébastien Guay

_
MSN Search, le moteur de recherche qui pense comme vous !  
http://fr.ca.search.msn.com/

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


[PHP] PHP5: Class behavior: method overloading

2004-02-26 Thread Vivian Steller
Hello,

in the latest snapshot i found some very important differences to the php5
beta 4 version concerning the behavior of inherited classes. please look at
the following example:

pre
?php
class MyClass extends MyParent{ 
function test($arg) {

}
}   

class MyParent {
function test($arg1, $arg2) {

}
}

$obj = new MyClass();
?
/pre

the output is:

Fatal error:  Declaration of MyClass::test() must be compatible with that of
MyParent::test() in ... on line 3


I think that this is a nice feature in the face of compatibility, but may
cause in a complete restructure of existing class trees. The consequence is
a bad :( backward compatibility!! Personally I think it would be a good
solution to set an option in the configuration or something like this.

other oppinions would be appreciated.

thanks,
vivi

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



[PHP] PHP Apache Log Stats and viewer?

2004-02-26 Thread Karl Timmermann
Hi,

I am looking for a PHP program to dynamically read big apache log files 
(over 500 MBs) and show interesting stats and graphs. Does anything 
like this exist?

Thanks!

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


Re: [PHP] values from string query

2004-02-26 Thread BAO RuiXian


Angelo Zanetti wrote:

[snip...]
$q=select * from prospects where p_id = '$p_id';
$result=mysql_query($q, $this-link) or die (.mysql_error());
while($a_row=mysql_fetch_array($result))
{
$c_query=Insert into client (c_name, c_company, c_worktel, 
c_directtel,
c_hometel, c_fax, c_cell, c_email, c_address, c_city, c_pcode, c_country)
VALUES ($a_row['p_name'], $a_row['p_company'], $a_row['p_worktel'],
$a_row['p_directtel'], $a_row['p_hometel'], $a_row['p_fax'],
$a_row['p_cell'], $a_row['c_email'], $a_row['c_address'], $a_row['c_city'],
$a_row['c_pcode'], $a_row['c_country']);

Should you use $a_row-[0], $a_row-[1] ... to refer to each individual 
value, since $a_row is a reference to an array?

mysql_query($c_query,$this-link) or die (.mysql_error());
}
I echo'd out the values from the Select just to make sure it was getting the
correct values.
 

How have you done that?

Best

Bao

any help will be appreciated, thanx in advance

Angelo



 

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


[PHP] Re: Send Attachments via mail using form

2004-02-26 Thread Manuel Lemos
Hello,

On 02/26/2004 06:54 AM, Dave Carrera wrote:
I would like to allow my visitors to send attachments via my contact form.

I already have email validation, field verifications and other nice bits but
I am stuck on the add attachment bit.
Also would this be limited to one file or can multiple files be allowed ?
You may want to try this class. You can add as many attachments as you want:

http://www.phpclasses.org/mimemessage

--

Regards,
Manuel Lemos
PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/
PHP Reviews - Reviews of PHP books and other products
http://www.phpclasses.org/reviews/
Metastorage - Data object relational mapping layer generator
http://www.meta-language.net/metastorage.html
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: PHP5 simpleXML bug or am i just being silly :)

2004-02-26 Thread Luke
Dont you need to use  instead of ' as ' is a string literal, while  parses
variables etc in that string

try this instead:
print(p$this-user-site[0]::/p);


Maybe that will help?

-- 
Luke


William Bailey [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
Hi All,

I am currently working with PHP5 beta and have found something strange
with the simplexml objects. It seems to be forgetting its values. Below
is an example..



[[the PHP5 code]]
snip
 print('pre');
 print('p$this-user::/p');
 print_r($this-user);
 print('p$this-user-site::/p');
 print_r($this-user-site);
 print('p$this-user-site[0]::/p');
 print_r($this-user-site[0]);
 die('/pre');
snip
[[END]]


[[the PHP5 Browser Output]]
$this-user::
simplexml_element Object
(
 [login] = wb
 [password] = 3c1175c6cdf614fb006cee10fdc325e3aa0f1894
 [site] = Array
 (
 [0] = www.pro-net.co.uk
 [1] = www.example.com
 )

)

$this-user-site::
Array
(
 [0] = simplexml_element Object
 (
 )

 [1] = simplexml_element Object
 (
 )

)

$this-user-site[0]::
simplexml_element Object
(
)
[[END]]

Shouldn't $this-user-site return the Array displayed in the output
for $this-user or even shouldn't the simplexml_element Objects for
$this-user-site have a value or something. Basically they shouldn't be
blank otherwise how to you get the data?

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



[PHP] Paginate Queries

2004-02-26 Thread Shaun
Hi,

Using the following function I can present any query in a table. However
some of the results are very large and I would like to limit all results to
1000 rows. So I am trying to paginate the results. However the page that
calls these queries uses form elements to create the query. So I need to be
able to add links to the top of the query result i.e. previous and next, and
I need to resubmit the $_POST variables to create the query again.

Thanks for any advice offered.

 function doQuery($query){
  if(!($result = mysql_query(stripslashes($query{
   echo 'brbrdiv align=center'.mysql_error().'/div';
   exit;
  } else {
   $num_fields = mysql_num_fields($result);
   $num_rows = mysql_num_rows($result);
   if ($num_fields  0  $num_rows  0){
echo '
 table border=1 cellspacing=0 cellpadding=2
bordercolor=#FF
  tr';
for($i = 0; $i  mysql_num_fields($result); $i++){
 echo 'td bgcolor=#ff
align=centerstrong'.mysql_field_name($result, $i).'/strong/td';
}
for($i = 0; $i  mysql_num_rows($result); $i++){
 echo 'tr';
 $row_array = mysql_fetch_row($result);
 for($j = 0; $j  mysql_num_fields($result); $j++){
  echo 'td bgcolor=#ee align=center'.$row_array[$j].'/td';
 }
 echo '/tr';
}
echo '/table';
   } else {
echo 'brbrdiv align=centerNo data in table/div';
   }
  }
 }

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



[PHP] bug in PHP

2004-02-26 Thread Kyle Goetz
hey so i've been struggling with an apparent bug in and older version of 
(BPHP but i wouldn't know where to look about this bug, as it concerns the 
(Binclude function and there is no mention of a bug that i can find...
(B
(Bversion of php: 4.1.0
(Bi have a line of code
(Binclude 'new_album.php';
(Bi keep getting a file not found error
(Bi KNOW the file is there
(Bi copy the code to a new file, and save it as 123.php and then change the 
(Bline of code to
(Binclude '123.php';
(Band voile! it works!
(Bit seems there is something wrong with using the name 'new_album.php' with 
(Binclude but i dunno why...
(B
(Banyone got any input on this? i don't wanna have to worry about filenames 
(Bmaking errors...
(B
(B-- 
(B\Kyle Goetz
(BBS Pure Mathemetics, BA Japanese 2006
(BThe University of Texas
(B
(BUsing M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/
(B
(B-- 
(BPHP General Mailing List (http://www.php.net/)
(BTo unsubscribe, visit: http://www.php.net/unsub.php

[PHP] Re: Send Attachments via mail using form

2004-02-26 Thread Justin Patrin
Dave Carrera wrote:

Hi List,

I would like to allow my visitors to send attachments via my contact form.

I already have email validation, field verifications and other nice bits but
I am stuck on the add attachment bit.
Also would this be limited to one file or can multiple files be allowed ?

Thank you in advance for any help or advise with this.

Yours Truly

Dave C

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.595 / Virus Database: 378 - Release Date: 25/02/2004
 
And for a third possibility, you could try:
PEAR::Mail_Mime
http://pear.php.net/package/Mail_Mime
--
paperCrane Justin Patrin
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] fscanf and memory

2004-02-26 Thread Tom Rogers
Hi,

Friday, February 27, 2004, 4:48:20 AM, you wrote:
SG Hi,

SG I don't know if it's a bug in php but if I do

SG $fp=fopen(some_file,r);
SG while (!feof($fp))
SG {
SG fscanf($fp, %d %d,$var1,$var2);
SG // some treatment
SG }
SG fclose($fp);

SG and the file is big enough, php eat up memory like hot cakes.
SG But if I do

SG $fp=fopen(some_file,r);
SG while (!feof($fp))
SG {
SG $line = fscanf($fp, %d %d);
SG list ($var1, $var2) = $line;
SG // some treatment
SG }
SG fclose($fp);

SG It work just fine.  Seems a problem with fscanf.

SG Has someone ever experienced this?  Any advises?

SG Oh btw I'm using php 4.3.4 with Apache 1.3.29

SG Thanks in advance

SG Sébastien Guay

SG _
SG MSN Search, le moteur de recherche qui pense comme vous !  
SG http://fr.ca.search.msn.com/


Thats not the way to use scanf, I think you are doing a scanf for each
line in the file. It should be something like:

while(fscanf($fp, %d %d,$var1,$var2)){
//... do something with the values
}

-- 
regards,
Tom

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



Re: [PHP] renamed images are now corrupt...

2004-02-26 Thread Bryan Henry
Browser and FTP client act as if the image
files do not exist, even though the directory
contents can be views via FTP...
What did I do?
 Bryan




On Thu, 26 Feb 2004 17:56:25 -0600, Bryan Henry [EMAIL PROTECTED] 
wrote:

Hello all,

I wrote a small script to rename a few thousand images,
both gif and jpeg... After running the script, none of
the renamed images can be viewed or downloaded.
Trying to download these images from an FTP client fails.
FTP client attempts to download the images PASSIVE-ly
Unaltered images can be downloaded as binary files with
no problem..
I now have over 3000 images I cannot download or view
on our website. What about rename caused this?
Thank you,
Bryan Henry


--
Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: renamed images are now corrupt...

2004-02-26 Thread Michael Nolan
Check the permissions and ownership of the files, especially if you ran 
the script as some privileged user like root.  chmod or chown can be 
used to changed these.

Mike

Bryan Henry wrote:

Browser and FTP client act as if the image
files do not exist, even though the directory
contents can be views via FTP...
What did I do?
 Bryan




On Thu, 26 Feb 2004 17:56:25 -0600, Bryan Henry 
[EMAIL PROTECTED] wrote:

Hello all,

I wrote a small script to rename a few thousand images,
both gif and jpeg... After running the script, none of
the renamed images can be viewed or downloaded.
Trying to download these images from an FTP client fails.
FTP client attempts to download the images PASSIVE-ly
Unaltered images can be downloaded as binary files with
no problem..
I now have over 3000 images I cannot download or view
on our website. What about rename caused this?
Thank you,
Bryan Henry



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


Re: [PHP] Re: renamed images are now corrupt...

2004-02-26 Thread Bryan Henry
Looking throught my FTP client it seems that the
permission are the same? Could this be incorrect?
Should I chmod or chown through a shell? or using PHP?

~ bryan



On Fri, 27 Feb 2004 00:01:47 +, Michael Nolan 
[EMAIL PROTECTED] wrote:

Check the permissions and ownership of the files, especially if you ran 
the script as some privileged user like root.  chmod or chown can be 
used to changed these.

Mike

Bryan Henry wrote:

Browser and FTP client act as if the image
files do not exist, even though the directory
contents can be views via FTP...
What did I do?
 Bryan




On Thu, 26 Feb 2004 17:56:25 -0600, Bryan Henry 
[EMAIL PROTECTED] wrote:

Hello all,

I wrote a small script to rename a few thousand images,
both gif and jpeg... After running the script, none of
the renamed images can be viewed or downloaded.
Trying to download these images from an FTP client fails.
FTP client attempts to download the images PASSIVE-ly
Unaltered images can be downloaded as binary files with
no problem..
I now have over 3000 images I cannot download or view
on our website. What about rename caused this?
Thank you,
Bryan Henry






--
Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] renamed images are now corrupt...

2004-02-26 Thread Michal Migurski
I wrote a small script to rename a few thousand images, both gif and
jpeg... After running the script, none of the renamed images can be
viewed or downloaded.

I now have over 3000 images I cannot download or view on our website.
What about rename caused this?

Well, on line 5 of your script... oh wait. /Where's your script?/

-
michal migurski- contact info and pgp key:
sf/cahttp://mike.teczno.com/contact.html

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



Re: [PHP] renamed images are now corrupt...

2004-02-26 Thread Bryan Henry
Here is the script I used to rename images.



?php
clearstatcache();
$filename = product_tn.txt;
$imgs = (array) null;
$tmp = (array) null;
$config = file($filename);
reset ($config);
$handle = fopen(import_product_tn.txt, w);
$write = ;
foreach ($config as $line) {
 if ( $line ==  ) next($config);
 elseif ( $line == \n ) next($config);
 elseif ( strstr($line,#)) next($config);
 else {
 $value = split(Chr(9),$line);
 $imgs[$value[0]] = $value[1];
 }
 }
foreach ($imgs as $k = $v)	{
	if ((strpos($v,'/s.gif') === FALSE) AND (strpos($v,'noimage') === FALSE) 
AND (strlen(trim($v)) = 0)) {
		$tmp = split(/,$v);
		$cnt = count($tmp);
		$cnt = $cnt - 1;
		$re = explode(., $tmp[$cnt]);
		$ext = $re[1];
		$renamed = strtolower($k)...strtolower($ext);
		if (file_exists(Merchant2/.trim($v)) AND $cnt) {
			rename(Merchant2/.trim($v), pi/.$renamed);
			$write .= $k.Chr(9).graphics/0001/.$renamed.Chr(10);
		} else {
			$write .= $k.Chr(9).Chr(10);
			echo $k.br;
		}
	} else {
		$write .= $k.Chr(9).Chr(10);
	}
}

fwrite($handle, $write);
fclose($handle);
clearstatcache();
?
On Thu, 26 Feb 2004 16:21:55 -0800 (PST), Michal Migurski 
[EMAIL PROTECTED] wrote:

I wrote a small script to rename a few thousand images, both gif and
jpeg... After running the script, none of the renamed images can be
viewed or downloaded.
I now have over 3000 images I cannot download or view on our website.
What about rename caused this?
Well, on line 5 of your script... oh wait. /Where's your script?/

-
michal migurski- contact info and pgp key:
sf/cahttp://mike.teczno.com/contact.html


--
Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] renamed images are now corrupt...

2004-02-26 Thread Bryan Henry


Chmod and file_exists report that the file does not exist,
even though I can view the files via the FTP client.
bryan

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


RE: [PHP] bug in PHP

2004-02-26 Thread Chris W. Parker
Kyle Goetz mailto:[EMAIL PROTECTED]
on Thursday, February 26, 2004 3:06 PM said:

 hey so i've been struggling with an apparent bug in and older version
 of PHP but i wouldn't know where to look about this bug, as it
 concerns the include function and there is no mention of a bug that i
 can find...

i'm not familiar with any bug like that (seems unlikely that there would
be a bug like that) so i'm just going to start at square one.

1. what exactly does your code look like?
2. what exactly is the error you're getting?



chris.

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



Re: [PHP] Weird result from query...?

2004-02-26 Thread Erwin Kerk
Ryan A wrote:
which runs the sql in show_accounts.php:
SELECT *,now()-0 from .$tcname. where oorder='.$o.' and nname='.$n.'
and total='$p'
Try this:
which runs the sql in show_accounts.php:
SELECT *,now()-0 from .$tcname. where oorder='.$o.' and 
nname='.$n.' and total=$p

without the single quotes around $p

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


Re: [PHP] Re: renamed images are now corrupt...

2004-02-26 Thread Adam Bregenzer
On Thu, 2004-02-26 at 20:18, Bryan Henry wrote:
 I realized that I did not trim the end line characters off of the file 
 extensions
 after I grabbed all the file names from a text file. Now all the images 
 have
 end of line chracters as part of the extension.  I cannot access/edit the 
 files
 through SHH, PHP or FTP...

You should be able to through a shell.  Try using a shell script to
rename the files, here's something in bash script to get you started:

for x in `ls`; do
  good_name=`echo -n ${x}|sed s/\(.*\.[a-zA-Z]*\)/\1/`;
  mv ${x} ${good_name};
done

This will find any characters followed by a '.' and any upper or
lowercase letter.  This should grab everything except for the newline at
the end and rename the file accordingly.  Since I don't have any files
with newlines in their names I didn't test it so it may need a bit of
tweaking.

Regards,
Adam

-- 
Adam Bregenzer
[EMAIL PROTECTED]
http://adam.bregenzer.net/

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



Re: [PHP] Re: Image resize on upload

2004-02-26 Thread Will
Thanks everyone. I got GD2 to work quite well!  The thumb look pretty good.

~WILL~

Ed Curtis wrote:

 Make sure you use imagecreatetruecolor() with GD when resizing images or
you'll get some undesirable results. Imagemagick's convert and mogrify
worked well for me although I was resizing an uploaded image.
Ed Curtis

On Thu, 26 Feb 2004, Will wrote:


Thanks!! I found some documentation on the GD library.
I most likely be posting again!! :)
~WILL~

[EMAIL PROTECTED] wrote:

gd seems to work fine ? even nconvert via command line does a good job and
it resizes gif too


I'll second that one, I wrote a shell script in PHP to resize images,
using ImageMagicks mogrify
command, and it took ages.  It's really much too slow for a web site.
If you need a faster solution, I think you have to buy something.

On 26 Feb 2004, at 09:15, Adam Bregenzer wrote:



On Thu, 2004-02-26 at 02:25, Will wrote:


I forgot to mention what I was trying to do.
There is a web page that pulls the image file name from the database
then  reads the URL to the directory where the image is.  Is it
possible
to just resize it when the web page is brought up in the browser?
I use ImageMagick's[1] convert[2] to do this.  It is not a PHP module
and must be run through exec[3].  Also, in my experience image
manipulation is rather time consuming, it is a good idea to cache
altered images so they do not have to be recreated on every page load.
[1] http://www.imagemagick.org/
[2] http://www.imagemagick.org/www/convert.html
[3] http://www.php.net/exec
--
Adam Bregenzer
[EMAIL PROTECTED]
http://adam.bregenzer.net/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

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


Re: [PHP] PHP Apache Log Stats and viewer?

2004-02-26 Thread Jim Serio
At 08:17 PM 2/26/2004, you wrote:
Warning. I would NOT use Webalizer. This guy went commercial around 1999
and it's well known that the free version (demo) contains code to
call-home on every use. Beware.
Talk to me - what do you mean? I can't find any references on that, and
the fact that the project is distributed as source and licensed under the
GPL makes me think it wouldn't be in wide use if it were malware.
My mistake. AccessWatch (http://accesswatch.com/) is the log analyzer I was 
speaking of. I always get the two mixed up. It used to be free but the guy 
went commercial in the late 90s.

Jim

--
Jim Serio - [EMAIL PROTECTED] 

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


[PHP] Re: Question about CGI binary

2004-02-26 Thread André Cerqueira
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
actually i thought you said your scripts were running in a remote host 
which you cant change php.ini
and assuming that, i said that most servers setup php in safe mode

i believe php.ini is the same for php as module and cgi-bin
dont know if that helps, but if safe-mode was default for cgi-bin, it 
would be for module too
safe mode being default or could depend on the distribution... all i got 
had php.ini-dist and php.ini-recommened, none had safe mode on

hope it helps



Chris wrote:
 I am aware of safe mode but, are you saying that when PHP is 
installed as a
 CGI binary safe mode is on by default?
 Chris

 André cerqueira [EMAIL PROTECTED] wrote in message
 news:[EMAIL PROTECTED]

http://www.php.net/set_time_limit

[snip]
  Warning
  set_time_limit() has NO EFFECT when PHP is running in safe mode. There
  is NO workaround other than turning off safe mode or changing the time
  limit in the php.ini.
[/snip]
most servers do that



Chris wrote:


I've run into situation where my PHP script, (which loads records into a
database) gets timed out after 30 seconds, terminating the script

execution.

I understand that PHP, on my hosting system, is installed as a CGI

binary.

I've even included set_time_limit which seems to have no effect. Is is
possible that the timeout is being caused by a cgi script execution

limit?

Or may something else be afoot?

Chris

- -- 
André Cerqueira
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.2.4 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFAPs0+axdA/5C8vH8RAqpeAJ4phC8gykyhYIvjwlazAPvvvq/zmwCfRHG2
8Y2dB0pnyUCn3EmUvzKCs/4=
=1H3c
-END PGP SIGNATURE-
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Weird result from query...?

2004-02-26 Thread André Cerqueira
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
[snip]
 I do think that a dot is valid in the URL coz it seems to be working if
 there are 2 zeros in the
 decimal part.
[/snip]
i think that means the dot DOESNT work hehe
because with 0's or not, a 4.00 is a 4, while 4.11 wouldnt be the same 
thing without the dot and the things that follow...

try an url like this: 
http://localhost/show_accounts.php?o=8927437717300145n=shanep=4%2E78



Ryan A wrote:

Hey everyone,
Thanks for your response,
I did try the query without the single quote, with double quotes but didnt
work.
I do think that a dot is valid in the URL coz it seems to be working if
there are 2 zeros in the
decimal part. I even tried running the SQL in PHPMyAdmin with same
results...
and I did try this:
total='.$p.';

I wonder if total is a mysql reserved word or something

Like I said before, i took that out and everythings running fine 'n
dandy...but am just curious as
to what was wrong...never know if it may come up again in future.
Cheers,
-Ryan


Try this:
which runs the sql in show_accounts.php:
SELECT *,now()-0 from .$tcname. where oorder='.$o.' and
nname='.$n.' and total=$p
without the single quotes around $p

Erwin Kerk
Web Developer
- -- 
André Cerqueira
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.2.4 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFAPtCAaxdA/5C8vH8RAvPpAJ9Ay6WK9BsYaUh/TJsaNt+d6YaLtACg1gGE
8Z39+7oB32MAg1fKw/3sla8=
=3/la
-END PGP SIGNATURE-
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: Uploading a file to server behind a firewall

2004-02-26 Thread Andre Cerqueira
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
i dont know if that can be fixed using php, it looks like a firewall 
setup problem?
which port is apache running?

i got confused with your ponctuation and explanations, maybe some 
rephrasing and more details, like error message, could help



Rick Laird wrote:

I am trying to upload a file to a server behind a firewall.
Notes
 It works fine from inside the firewall.
 I access the server and run the following
?php
 phpinfo();
?
Bug when I run the following code. It works in from within the firewall.
But not from outside.
I have port forwarding turned on obviously.  But is there anything else that
I need to do.
Any help would be much appreciated.

Thanks

Rick Laird

?php if ($HTTP_POST_VARS['action']) { ?
!-- Code to process Uploaded File and Display --
!-- The HTML to display the results --
?
BRA HREF=?php echo $PHP_SELF ?Back/A
/FONT/P
/BODY
/HTML
?php } else { ?
HTML
HEAD
TITLEFile Upload/TITLE
/HEAD
BODY BGCOLOR=WHITE TEXT=BLACK
PFONT FACE=Arial, Helvetica, sans-serifFONT SIZE=+1File
Upload/FONTBRBR
   FORM METHOD=POST ENCTYPE=multipart/form-data
   ACTION=?php echo $PHP_SELF;?
INPUT TYPE=HIDDEN NAME=MAX_FILE_SIZE VALUE=80
INPUT TYPE=HIDDEN NAME=action VALUE=1
File 1: INPUT TYPE=FILE NAME=file1 SIZE=30BRBR
INPUT TYPE=SUBMIT VALUE=Upload
/FORM
/FONT/P
/BODY
/HTML
?php } ?
?php if ($HTTP_POST_VARS['action']) { ?
HTML
HEAD
TITLEFile Upload Results/TITLE
/HEAD
BODY BGCOLOR=WHITE TEXT=BLACK
PFONT FACE=Arial, Helvetica, sans-serifFONT SIZE=+1File Upload
Results/FONTBRBR
?php
  $uploadpath = '/files/';
  $source = $HTTP_POST_FILES['file1']['tmp_name'];
  $dest = $uploadpath.$HTTP_POST_FILES['file1']['name'];
  if ( move_uploaded_file( $source, $dest ) ) {

 echo 'File successfully stored.BR';

   } else {

echo 'File could not be stored.BR';

   }

?
BRA HREF=?php echo $PHP_SELF ?Back/A
/FONT/P
/BODY
/HTML
?php } else { ?
!-- File Upload Form HTML Code Here --
?php } ?
- -- 
André Cerqueira
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.2.4 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFAPtRhaxdA/5C8vH8RAiIjAJ9wtAfZ9UV0FcabcfXv7z6qZxQIiwCg1DGR
H3D5zq0s/2XSFIJSDiBKLKA=
=4OMG
-END PGP SIGNATURE-
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Uploading a file to server behind a firewall

2004-02-26 Thread Rick Laird
I am trying to upload a file to a server behind a firewall.
Notes
 It works fine from inside the firewall.
 I access the server and run the following
?php
 phpinfo();
?

Bug when I run the following code. It works in from within the firewall.
But not from outside.

I have port forwarding turned on obviously.  But is there anything else that
I need to do.

Any help would be much appreciated.

Thanks

Rick Laird

?php if ($HTTP_POST_VARS['action']) { ?
!-- Code to process Uploaded File and Display --
!-- The HTML to display the results --
?
BRA HREF=?php echo $PHP_SELF ?Back/A
/FONT/P
/BODY
/HTML
?php } else { ?
HTML
HEAD
TITLEFile Upload/TITLE
/HEAD
BODY BGCOLOR=WHITE TEXT=BLACK
PFONT FACE=Arial, Helvetica, sans-serifFONT SIZE=+1File
Upload/FONTBRBR

   FORM METHOD=POST ENCTYPE=multipart/form-data
   ACTION=?php echo $PHP_SELF;?

INPUT TYPE=HIDDEN NAME=MAX_FILE_SIZE VALUE=80
INPUT TYPE=HIDDEN NAME=action VALUE=1
File 1: INPUT TYPE=FILE NAME=file1 SIZE=30BRBR
INPUT TYPE=SUBMIT VALUE=Upload
/FORM
/FONT/P
/BODY
/HTML
?php } ?
?php if ($HTTP_POST_VARS['action']) { ?
HTML
HEAD
TITLEFile Upload Results/TITLE
/HEAD
BODY BGCOLOR=WHITE TEXT=BLACK
PFONT FACE=Arial, Helvetica, sans-serifFONT SIZE=+1File Upload
Results/FONTBRBR
?php

  $uploadpath = '/files/';
  $source = $HTTP_POST_FILES['file1']['tmp_name'];
  $dest = $uploadpath.$HTTP_POST_FILES['file1']['name'];


  if ( move_uploaded_file( $source, $dest ) ) {

 echo 'File successfully stored.BR';

   } else {

echo 'File could not be stored.BR';

   }

?
BRA HREF=?php echo $PHP_SELF ?Back/A
/FONT/P
/BODY
/HTML
?php } else { ?
!-- File Upload Form HTML Code Here --
?php } ?

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



Re: [PHP] Weird result from query...?

2004-02-26 Thread Ryan A
Hey everyone,
Thanks for your response,

I did try the query without the single quote, with double quotes but didnt
work.
I do think that a dot is valid in the URL coz it seems to be working if
there are 2 zeros in the
decimal part. I even tried running the SQL in PHPMyAdmin with same
results...
and I did try this:

total='.$p.';

I wonder if total is a mysql reserved word or something

Like I said before, i took that out and everythings running fine 'n
dandy...but am just curious as
to what was wrong...never know if it may come up again in future.

Cheers,
-Ryan


 Try this:
 which runs the sql in show_accounts.php:
 SELECT *,now()-0 from .$tcname. where oorder='.$o.' and
 nname='.$n.' and total=$p

 without the single quotes around $p


 Erwin Kerk
 Web Developer

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



Re: [PHP] Weird result from query...?

2004-02-26 Thread Daniel Clark
p=4.78

I wonder if a dot is a valid character for a URL adderss?

 Hi,
 Just been getting some weird results from a query...can anybody tell me
 why..?

 Basically am sending 3 variables via a link on the page...
 http://localhost/show_accounts.php?o=8927437717300145n=shanep=4.78

 which runs the sql in show_accounts.php:
 SELECT *,now()-0 from .$tcname. where oorder='.$o.' and
 nname='.$n.' and total='$p'

 (globals is off and i am assigning the variables on top of the page. eg:
 $o=$_GET['o'],)

 my tables structure is:
 oorder varchar(20) // varchar because I will have dashes and underscores
 in it.
 nname varchar 60
 total float(6,2)

 I have checked the database and I DO have a record that matches the SQL
 above but it does not
 return a result  _unless_ the decimal spaces have two zeros in it, eg:
 4.00 works fine
 1.00 works fine
 77.00 works fine
 4.77 does not work
 1.42 does not work
 etc

 I have taken out the purchase amount and everythings running fine...but
 am just curious as to what was
 actually causing the problem...any ideas?

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



Re: [PHP] Weird result from query...?

2004-02-26 Thread Erwin Kerk
Daniel Clark wrote:
p=4.78

I wonder if a dot is a valid character for a URL adderss?
Yup. Just tried it, it works.

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


[PHP] Weird result from query...?

2004-02-26 Thread Ryan A
Hi,
Just been getting some weird results from a query...can anybody tell me
why..?

Basically am sending 3 variables via a link on the page...
http://localhost/show_accounts.php?o=8927437717300145n=shanep=4.78

which runs the sql in show_accounts.php:
SELECT *,now()-0 from .$tcname. where oorder='.$o.' and nname='.$n.'
and total='$p'

(globals is off and i am assigning the variables on top of the page. eg:
$o=$_GET['o'],)

my tables structure is:
oorder varchar(20) // varchar because I will have dashes and underscores in
it.
nname varchar 60
total float(6,2)

I have checked the database and I DO have a record that matches the SQL
above but it does not
return a result  _unless_ the decimal spaces have two zeros in it,
eg:
4.00 works fine
1.00 works fine
77.00 works fine
4.77 does not work
1.42 does not work
etc

I have taken out the purchase amount and everythings running fine...but am
just curious as to what was
actually causing the problem...any ideas?

Cheers,
-Ryan

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



Re: [PHP] Re: renamed images are now corrupt...

2004-02-26 Thread Bryan Henry
I realized that I did not trim the end line characters off of the file 
extensions
after I grabbed all the file names from a text file. Now all the images 
have
end of line chracters as part of the extension.  I cannot access/edit the 
files
through SHH, PHP or FTP...

Oh well...

bryan





On Fri, 27 Feb 2004 00:01:47 +, Michael Nolan 
[EMAIL PROTECTED] wrote:

Check the permissions and ownership of the files, especially if you ran 
the script as some privileged user like root.  chmod or chown can be 
used to changed these.

Mike

Bryan Henry wrote:

Browser and FTP client act as if the image
files do not exist, even though the directory
contents can be views via FTP...
What did I do?
 Bryan




On Thu, 26 Feb 2004 17:56:25 -0600, Bryan Henry 
[EMAIL PROTECTED] wrote:

Hello all,

I wrote a small script to rename a few thousand images,
both gif and jpeg... After running the script, none of
the renamed images can be viewed or downloaded.
Trying to download these images from an FTP client fails.
FTP client attempts to download the images PASSIVE-ly
Unaltered images can be downloaded as binary files with
no problem..
I now have over 3000 images I cannot download or view
on our website. What about rename caused this?
Thank you,
Bryan Henry






--
Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] renamed images are now corrupt...

2004-02-26 Thread Bryan Henry
Hello all,

I wrote a small script to rename a few thousand images,
both gif and jpeg... After running the script, none of
the renamed images can be viewed or downloaded.
Trying to download these images from an FTP client fails.
FTP client attempts to download the images PASSIVE-ly
Unaltered images can be downloaded as binary files with
no problem..
I now have over 3000 images I cannot download or view
on our website. What about rename caused this?
Thank you,
Bryan Henry
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] php script that sends the user a link to complete validation process

2004-02-26 Thread bruce
hey...
(B
(Btrying to find a quick php script/sample code/etc... that does validation
(Bfor a user.
(B
(Bbasically, i want the admin to authorize a user via a form. i want the form
(Bto kick off an email to the user that will require the user to goto the link
(Bto complete the validation process.
(B
(Bi've seen these before, but i can't seem to find an example now!!
(B
(Bany help would be appreciated.
(B
(Bthanks
(B
(Bbruce
(B
(B[EMAIL PROTECTED]
(B
(B-- 
(BPHP General Mailing List (http://www.php.net/)
(BTo unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] Paginate Queries

2004-02-26 Thread Tom Rogers
Hi,

Friday, February 27, 2004, 8:31:32 AM, you wrote:
S Hi,

S Using the following function I can present any query in a table. However
S some of the results are very large and I would like to limit all results to
S 1000 rows. So I am trying to paginate the results. However the page that
S calls these queries uses form elements to create the query. So I need to be
S able to add links to the top of the query result i.e. previous and next, and
S I need to resubmit the $_POST variables to create the query again.

S Thanks for any advice offered.

Here is a class that will create a google like pagination of results  if that is
what you are after :)

?
class page_class {
var $count = 0; //total pages
var $start = 0; //starting record
var $pages = 0; //number of pages available
var $page = 1;  //current page
var $maxpages;  //shows up to 2 * this number and makes a sliding scale
var $show;  //number of results per page
function page_class($count=0,$show=5,$max=9){
$this-count = $count;
$this-show = $show;
$this-maxpages = $max;
($this-count % $this-show == 0)? $this-pages = 
intval($this-count/$this-show):$this-pages intval($this-count/$this-show) +1;
if(!empty($_GET['search_page'])){
$this-page = $_GET['search_page'];
$this-start = $this-show * $this-page - $this-show;
}
}
function get_limit(){
$limit = '';
if($this-count  $this-show) $limit = 
'LIMIT'.$this-start.','.$this-show;
return $limit;
}
function make_head_string($pre){
$r = $pre.' ';
$end = $this-start + $this-show;
if($end  $this-count) $end = $this-count;
$r .= ($this-start +1).' - '.$end.' of '.$this-count;
return $r;
}
function make_page_string($words,$pre='Result Page:'){
$r = $pre.' ';
if($this-page  1){
$y = $this-page - 1;
$r .= 'a 
href='.$_SERVER['PHP_SELF'].'?search_page='.$y.$words.'Previous/anbsp;';
}
$end = $this-page + $this-maxpages-1;
if($end  $this-pages) $end = $this-pages;
$x = $this-page - $this-maxpages;
$anchor = $this-pages - (2*$this-maxpages) +1;
if($anchor  1) $anchor = 1;
if($x  1) $x = 1;
if($x  $anchor) $x = $anchor;
while($x = $end){
if($x == $this-page){
$r .= 'span class=s'.$x.'/spannbsp;';
}
else{
$r.= 'a 
href='.$_SERVER['PHP_SELF'].'?search_page='.$x.$words.''.$x.'/anbsp;';
}
$x++;
}
if($this-page  $this-pages){
$y = $this-page + 1;
$r .= 'a 
href='.$_SERVER['PHP_SELF'].'?search_page='.$y.$words.'Next/anbsp;';
}
return $r;
}
}

//Usage

mysql_connect(**.**.**.**, **, ) or die (mysql_error());

$Query = SELECT COUNT(*) AS cnt FROM tabletosearch WHERE fieldtosearch LIKE '% 
.$searchword.%';
$query = mysql_query($Query) or die(mysql_error());
$row = mysql_fetch_array($result);
$count = $row['cnt'];
if($count  0){
  //start class total number of results,number of results to show,max number 
of pages on a sliding scale (ends up as 2x this number..ie 20)
$page = new page_class($count,5,10); 
$limit = $page-get_limit();
$Query2= SELECT * FROM tabletosearch WHERE fieldtosearch LIKE '% 
.$searchword. %' ORDER BY  whatever ASC .$limit;
$result = mysql_query($Query2) or die(mysql_error());
$hstring = $page-make_head_string('Results');
$pstring = 
$page-make_page_string(amp;searchword=.$searchword.amp;whatever=.$whatever);//add
 the other variables to pass to next page in a
similar fashion
echo tabletrtd.$hstring./td/tr;
while($row = mysql_fetch_array($result)){
   echo trtd.$show_data_here./td/tr;
}
echo trtd.$pstring./td/tr/table;
}
?
Note: the search variables on subsequent pages will be passed by GET method



-- 
regards,
Tom

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



Re: [PHP] PHP Apache Log Stats and viewer?

2004-02-26 Thread Michal Migurski
I am looking for a PHP program to dynamically read big apache log files
(over 500 MBs) and show interesting stats and graphs. Does anything like
this exist?

It's not PHP, but it's probably exactly what you're looking for:
http://www.mrunix.net/webalizer/

-
michal migurski- contact info and pgp key:
sf/cahttp://mike.teczno.com/contact.html

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



[PHP] How to get the auto-incremented value?

2004-02-26 Thread Brian Dunning
When I write a record to a MySQL db with an auto-incremented key 
column, say it's called id, what's the easy to retrieve that value? 
Do I have to run a query?

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


[PHP] Re: values from string query

2004-02-26 Thread André Cerqueira
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
oops

i changed the name of a variable in one place and forgot the other...

mysql_query($sql, $this-link) or die (.mysql_error());

André cerqueira wrote:

you may find insert ... select interesting for what you want hehe
try this:
$sql = INSERT INTO client (c_name, c_company, c_worktel, c_directtel,
c_hometel, c_fax, c_cell, c_email, c_address, c_city, c_pcode,
c_country)
SELECT p_name, p_company, p_worktel, p_directtel, p_hometel,
p_fax, p_cell, c_email, c_address, c_city, c_pcode, c_country FROM
prospects WHERE p_id='. $p_id .';
mysql_query($q, $this-link) or die (.mysql_error());



more information:
http://www.mysql.com/doc/en/INSERT_SELECT.html
Angelo Zanetti wrote:

HI all I have a Select that get a resultset, once I get this then I
use the values of this resultset to enter them into another table
using an INSERT statement. I get no errors from the statement but it
just doesn't seem to see my variables from the recordset,
below is my code:



$q=select * from prospects where p_id = '$p_id'; 
$result=mysql_query($q, $this-link) or die (.mysql_error());

while($a_row=mysql_fetch_array($result)) { $c_query=Insert into
client (c_name, c_company, c_worktel, c_directtel, c_hometel, c_fax,
c_cell, c_email, c_address, c_city, c_pcode, c_country) VALUES
($a_row['p_name'], $a_row['p_company'], $a_row['p_worktel'], 
$a_row['p_directtel'], $a_row['p_hometel'], $a_row['p_fax'], 
$a_row['p_cell'], $a_row['c_email'], $a_row['c_address'],
$a_row['c_city'], $a_row['c_pcode'], $a_row['c_country']); 
mysql_query($c_query,$this-link) or die (.mysql_error()); }

I echo'd out the values from the Select just to make sure it was
getting the correct values.
any help will be appreciated, thanx in advance

Angelo

 
Disclaimer This e-mail transmission contains confidential
information, which is the property of the sender. The information in
this e-mail or attachments thereto is intended for the attention and
use only of the addressee. Should you have received this e-mail in
error, please delete and destroy it and any attachments thereto
immediately. Under no circumstances will the Cape Technikon or the
sender of this e-mail be liable to any party for any direct,
indirect, special or other consequential damages for any use of this
e-mail. For the detailed e-mail disclaimer please refer to 
http://www.ctech.ac.za/polic or call +27 (0)21 460 3911


-- André Cerqueira
- -- 
André Cerqueira
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.2.4 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFAPhruaxdA/5C8vH8RAnRsAKDKgzxahedEeYoa6gV0rmZFM8K2GgCgkiVD
A79t3PbPW1jUqR++djgnnVs=
=SP25
-END PGP SIGNATURE-
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Obtaing the URL of current page

2004-02-26 Thread Shaun
Hi,

How can i obtain the URL of the current page including any $_GET variables?

Thanks for your help

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



[PHP] Re: values from string query

2004-02-26 Thread Ben Ramsey
thanx yes i was echoing them and it worked!!
Angelo
Please remember to include the list on messages.  Does this mean that 
your code now works?  Or it still doesn't work but the values are being 
properly echoed?

--
Regards,
 Ben Ramsey
 http://benramsey.com
 http://www.phpcommunity.org/wiki/People/BenRamsey
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: PHP Warning. Anyone knows what it means? Solved.

2004-02-26 Thread Valent Jov

Right. I've found it.
The problem was an error in php.ini. I had the following line

post_max_size = 20M  #commnent

and this is obviously incorrect because comments start with ;

I don't know how but php was reading it bad and post forms weren't working,
specially forms with long content.
Maybe PHP should treat these format errors more cautiously.

Everything is back to normal now.

Bye.


[EMAIL PROTECTED] wrote:

 
 
 Hi,
 
 the error_log file shows the following message:
 
 PHP Warning:  Unknown(): Actual POST length does not match Content-Length,
 and exceeds 20 bytes in Unknown on line 0
 
 and I have a php application not working properly and it looks like it may
 be caused by something related to this error. The symptons are post fields
 not reaching the destination page, or receiving corrupted data.
 
 Anyone knows what it means and how to solve it?
 
 Using Suse Linux 8.2, apache 2.0.46 and php 4.3.1 (i've also tested with
 4.3.3). It happens with Mozilla and IE.
 
 The same application in a SUSE 9.0 box, php 4.3.3 and apache 2.0.48, works
 ok.
 
 Thanks,
 
 Valentí Jové

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



[PHP] Re: Ming library

2004-02-26 Thread Jakes
Change your provider... :-)

If it is a multi thread server, you wont be using extension=php_ming.so,
try using extension=php_ming.dll


Rostislav Kerey [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 I've developed the web-site by PHP with using Ming-library. All worked
well
 on the local computer, but when I uploaded all to the internet server I
have
 got an  error :(
 Ming library does not set in php.ini. The hosting provider company does
not
 want to add extension=php_ming.so to php.ini.
 What should I do???
 dl() function does not work too, because it is multithreaded Web servers.

 I'm congused...
 I really need to use it! Maybe I can find such library written by PHP?
 There are few classes, nothig else.

 Help me, please!!

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



[PHP] File access from another machine

2004-02-26 Thread Harish
Hello All,

Is there any possibility to open a file in another machine, provided the IP
of the machine using PHP scripts.
I only need to open a file with the format abc190104.csv in another machine
 write data into that file. Or to steam it through the HTTP.

Regards
Harish Rao K

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



[PHP] Re: [PHP-DEV] PHP5: Class behavior: method overloading

2004-02-26 Thread Vivian Steller
Walter A. Boring IV wrote:

 I say keep compatibility.  If you want to enforce this, then declare an
 interface.  That is after all why they exist.
 
 Walt
...

Would be nice if you could give a simple example - i really have problems
working with interfaces :(

My problem was to design a filesystem structure with classes like this:

class Folder {
var $name;
var $path;

function init() {}  // should set $name and $path...

function read($recursive = FALSE) {}// should read own content and
eventually all subdirs
}

class File extends Folder {
// inherited properties and funcs...

function read() {}  // should read the file content, $recursive is not
needed

}


how could i implement my interfaces? I think interfaces wouldn't solve php4
compatibility problems...

best regards,
vivi

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



[PHP] Re: [PHP-DEV] PHP5: Class behavior: method overloading

2004-02-26 Thread Walter A. Boring IV
Quoting Vivian Steller [EMAIL PROTECTED]:

 Walter A. Boring IV wrote:
 
  I say keep compatibility.  If you want to enforce this, then declare an
  interface.  That is after all why they exist.
  
  Walt
 ...
 
 Would be nice if you could give a simple example - i really have problems
 working with interfaces :(

interface Entry 
  function __construct($name, $path);
}

class Folder implements Entry {

  var $name = '';
  var $path = '';

  function __construct( $name, $path ) {
$this-name = $name;
$this-path = $path;
  }
}
 

 
 
 how could i implement my interfaces? I think interfaces wouldn't solve php4
 compatibility problems...
well, if you are implementing something completely new in php5, there there
are no compatibility issues.  I have many classes in my projects in php4.  I'm
not sure of how many child constructors have different parameters (my guess is
not many), but enforcing strict parameter count for childs classes would break
compatibility.  Which is why I think that one should just use an interface to
enforce this rule.  It seems like the right place for it.

my $0.02
Walt

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