Re: [PHP] Re: Avoiding NOTICEs on Array References

2005-01-27 Thread Burhan Khalid
Michael Sims wrote:
Jochem Maas wrote:
[EMAIL PROTECTED] wrote:
If one must check the value and not just the existence of the
checkbox entry, or for other uses, e.g. where a flag may or may not
be present, one is saddled with clumsy constructs like:
if (($isset($array['index'])  ($array['index'] == 1)) ...
okay, I get where your coming from - indeed nasty business
them checkboxes.

Here's an approach that I like which I think cuts down on the clumsy
constructs.
I'm surprised that no one mentioned
if (array_key_exists(index,$array)) { /* .. */ }
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] LDAP paged results?

2005-01-27 Thread Meester Gurth

I'm querying a rather large result set from an LDAP server, and I appear
to be bounded by some maximum result set size that is imposed by the
server. 

I've got similar code written in perl that uses the ldap3 paged result
sets control, but I see no mention of a similar implementation in the
php docs, and googling didn't provide any good references.

So, how does one handle ldap searching in php when your result set is
very large and can't be returned all at once?


-- 
[EMAIL PROTECTED]

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



Re: [PHP] Re: Avoiding NOTICEs on Array References

2005-01-27 Thread Jochem Maas
Michael Sims wrote:
Jochem Maas wrote:
[EMAIL PROTECTED] wrote:
If one must check the value and not just the existence of the
checkbox entry, or for other uses, e.g. where a flag may or may not
be present, one is saddled with clumsy constructs like:
if (($isset($array['index'])  ($array['index'] == 1)) ...
okay, I get where your coming from - indeed nasty business
them checkboxes.

Here's an approach that I like which I think cuts down on the clumsy
constructs.
On a controller page (the C in MVC) that handles form submissions I create
an array which defines what form variables are available and their default
values if not entered.  I then use array_merge() to combine that array with
$_POST (or $_GET, as the case may be) and the result is an array that
contains all of my form variables with each guaranteed to be set and contain
a sane default.  array_merge() works in such a way that values in the first
default array will only be replaced if they actually exist in $_POST, which
is what I want.  (Contrived) example:
$formVars = array_merge(array(
  'firstName' = '',
  'lastName'  = '',
  'contactMethod' = 'email',
  'flags' = array('one' = 0, 'two' = 0, 'three' = 0)
), $_POST);
Its a good idea - although to make this example work I believe you would
need to use array_merge_recursive() - which does what you mean ;-)
The above handles the case where you have:
input type=checkbox name=flags[one] value=1
input type=checkbox name=flags[two] value=1
input type=checkbox name=flags[three] value=1
Now, I do:
if (!empty($_POST)) {
  if (trim($formVars['firstName']) == '') {
//complain that first name is required
  }
  if ($formVars['flags']['one']) {
//handle the case where the first checkbox is checked
  }
  ...
}
This way I can safely reference anything in $formVars under E_ALL without
throwing notices.  I think it's a lot cleaner than the constant
(!isset($_POST['var']) || $_POST['var'] == '') stuff...YMMV
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: Call-time pass-by-reference ??

2005-01-27 Thread M. Sokolewicz
Michael Gale wrote:
Hello,
I am trying to start a small php ncurses app but the documenatation 
is not helping.

What does the following mean:
PHP Warning:  Call-time pass-by-reference has been deprecated - argument 
passed by value;  If you would like to pass it by reference, modify the 
declaration of ncurses_getmaxyx().  If you would like to enable 
call-time pass-by-reference, you can set allow_call_time_pass_reference 
to true in your INI file.  However, future versions may not support this 
any longer.  in /home/michael/gsmenu/gsmenu on line 10

Here is my code:
#!/usr/local/bin/php
?php
$y=0;
$x=0;
$ncurses_session = ncurses_init();
$main = ncurses_newwin(0,0,0,0);
ncurses_getmaxyx ($main,$y,$x );
ncurses_border(1,1,1,1, 1,1,1,1);
ncurses_wrefresh($main);
ncurses_end();
?
If I remove the  from main nothing happens at all,
the warning doesn't disappear?
 the php
documentation says that the variables should be passed from reference.
yes, but that should be done implicitly, not explictly. Thus, the 
definition of the ncurses_getmaxyx function should contain that in its 
definition (which it does AFAIK).
Any help would be appreciated.
Michael.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] in need of a directory/listing script/app

2005-01-27 Thread Jochem Maas
Bruce Douglas wrote:
hi...
i'm looking for a good app/function/code to allow users to select a given item(s) from a list of categories. 
i'd also like the user to be able to display users who have selected a given category from the list...

i can't seem to find an app that has this kind of code incorporated...
thanks
Bruce, please be more specific - (or use google.)
from what I read you're not going to be able to just plug and play something 
into a website and expect
it to do what you want, sounds like there will be coding involved (i.e. you 
want something custom!).
tell us what stage you're at, maybe explain why your doing it or what the 
underlying idea is.
show us some code - that is always a good thing (emphasis on 'some' - 1000 line 
scripts are not really cool
on a mailing list me thinks)
actually if you read back to yourself what you wrote you might notice you 
didn't actually ask a
question. :-) - now if I was on your payroll I would immediately understand you 
tone/intention and
go find an answer to the implied question  but I'm not atm ;-)
rgds,
Jochem
bruce
[EMAIL PROTECTED]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Apache: Request exceeded the limit of 10 internal redirects

2005-01-27 Thread Jochem Maas
Richard Lynch wrote:
James Guarriman wrote:
RewriteEngine on
RewriteOptions MaxRedirects=15
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ /$1.php
/Directory
/VirtualHost

...
I know its due to the way my Apache is setup (not rewrite rules)
but the following always works for me:
http://www.somedomain.com/doit
runs
http://www.somedomain.com/doit.php
--
apache just does its magic - I believe its to do with the DocumentIndex apache 
conf setting
(i.e. Apache makes use of the extensions found there) - please someone correct 
me if I'm wrong.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] check server status...please help

2005-01-27 Thread Tom
Sarcasm was also my first thought on this one, then I thought I'd tell 
the world how I handle it !

For one of my sites there are two solutions implemented to two 
situations (that's two solutions in total, not four :)).

1) User is already in site, and makes another request.
Load up a very small js with the site. When the request times out, this 
script either pops an error message or redirects the requests to the 
failover.

2) User is trying to get to the site for the first time.
The domain is actually pointed to a GSLOB (load balancer). This 
continually polls both primary and secondary (and tertiary...) sites and 
directs traffic to whichever has the lowest load, or to whichever site 
the rules are set to.
This is of course a more expensive solution that may not be at all 
applicable in your instance (expense is the purchase and hosting of the 
load balancer hardware).

Tom
Jay Blanchard wrote:
[snip]
I want to write a script that will check if the server is down if it is
I 
want to redirect the user to another site, the backup server.

Similarly I want users who go on to the seondary site when the main
server 
is UP to be redirected to the main site.

Can this be done using PHP. If not can you point me in the right
direction?
Kind regards,
[/snip]
So I'm on this server at this URL right? And the HTTP server is down,
right? The script would have to be aware of an HTTP request, right? 

Let us say I am on http://foo.com and I click a link or enter an address
for http://bar.com . If the server is down that is hosting
http://bar.com  well, I think you see where I am going.
Now, you could requests to port 80 maybe. And PHP CLI could be set in a
loop to handle the request, but this may be a really bad plan. You would
probably want some sort of port sniffer to monitor the port for
activity.
 

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


[PHP] help needed on imagettftext()

2005-01-27 Thread Harish Rao K
Hello,

While working with some CAPTCHA stuff I get the following error:
Fatal error: Call to undefined function imagettftext().
I have compiled with GD support and all the supporting libraries
(Freetype, TTF, jpeg, X11R6 etc).

What am I missing?

Below is the configure command that I have used.

'./configure' '--with-gd'
'--with-apxs2=/usr/local/apache2/bin/apxs' '--with-pgsql'
'--with-jpeg-dir=/usr/local/jpeg-6b'
'--with-zlib-dir=/usr/local/zlib-1.2.1' '--enable-gd-native-ttf'
'--with-png' '--with-ttf'
'--with-freetype-dir=/usr/local/freetype-2.1.9'
'--with-xpm-dir=/usr/X11R6'

Thanks  Regards,
Harish Rao K,


Nous Infosystems
This e-mail transmission may contain confidential or legally privileged
information that is intended only for the individual(s) or entity(ies) named
in the e-mail address. If you are not the intended recipient, please reply to
the [EMAIL PROTECTED], so that arrangements can be made for proper
delivery, and then please delete all copies and attachments.Any disclosure,
copying, distribution, or reliance upon the contents of this e-mail, by any
other than the intended recipients, is strictly prohibited.

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



Re: [PHP] Apache: Request exceeded the limit of 10 internal redirects

2005-01-27 Thread Marek Kilimajer
Jochem Maas wrote:
Richard Lynch wrote:
James Guarriman wrote:
RewriteEngine on
RewriteOptions MaxRedirects=15
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ /$1.php
/Directory
/VirtualHost


...
I know its due to the way my Apache is setup (not rewrite rules)
but the following always works for me:
http://www.somedomain.com/doit
runs
http://www.somedomain.com/doit.php
--
apache just does its magic - I believe its to do with the DocumentIndex 
apache conf setting
(i.e. Apache makes use of the extensions found there) - please someone 
correct me if I'm wrong.

Your conditions are as follows:
1. reqeusted filename is not a directory:
RewriteCond %{REQUEST_FILENAME} !-d
2. reqeusted filename is not a file:
RewriteCond %{REQUEST_FILENAME} !-f
If all above matches, put .php at the end:
RewriteRule ^(.*)$ /$1.php
So it has nothing to do with DocumentIndex. All that is necessary is to 
request a file that does not exist on the server even if you add .php 
at the end:

/foo - neither file or directory, rewrite to /foo.php
/foo.php - neither file or directory, rewrite to /foo.php.php
/foo.php.php - neither file or directory, rewrite to /foo.php.php.php
...etc.
The problem is ^(.*)$ matches everything. Try ^([^.]*)$ - no dot in url
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Magic quotes question (still driving me mad)

2005-01-27 Thread Ben Edwards
On Wed, 26 Jan 2005 13:07:34 -0800 (PST), Richard Lynch [EMAIL PROTECTED] 
wrote:
 Ben Edwards wrote:
  On Tue, 25 Jan 2005 17:02:21 -0800, Chris [EMAIL PROTECTED]
  wrote:
  You should probably use get_magic_quotes_runtime() , as _gpc only
  applies to GET/POST/COOKIE,
 
  htmlspecialchars  is needed so the HTML can be parsed properly:
 
  So this is this only done to stuff that is to be displayed on a web
  page?  What happens if it is done to stuff that is (possibly) also
  passed through addslashes and written to the database.
 
 Don't do it.

Don't worry, I wont.  Databases are for data.  I would'nt dream of
polluting them with HTML;)

 What if tomorrow you decide you need to output a PDF as well as your HTML
 from that same data -- You've got all those funky htmlspecialchars() in
 your database that have NOTHING to do with your data.  They are only
 needed for the HTML presentation of your data.

Seperation of data and presentation and logic, precisely.  

Ben

 For example, I have a web-site where we have had an on-line calendar for
 ages.  A few years ago, I found out the client was re-typing all his
 calendar items (a hundred a month) into three different software packages,
 just so he could get a print-out for flyers/handouts of his calendar of
 events.
 
 Silly client.
 
 Now his web-site provides him with a PDF of his calendar with a single
 click, instead of 4 hours of drudge-work every month copying data from A
 to B by hand.  There ain't no htmlspecialchars() in the database, thank
 [deity], or I'd have to un-do that just to make the PDF.  Ugh!
 
 --
 Like Music?
 http://l-i-e.com/artists.htm
 
 


-- 
Ben Edwards - Poole, UK, England
WARNING:This email contained partisan views - dont ever accuse me of
using the veneer of objectivity
If you have a problem emailing me use
http://www.gurtlush.org.uk/profiles.php?uid=4
(email address this email is sent from may be defunct)

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



Re: [PHP] Compiling PHP 4.3.3 with large file support

2005-01-27 Thread Marek Kilimajer
Jon wrote:
I'm running Fedora Core 1, all packages up to date.  I want to add large
file support to php.  I downloaded the source rpm. Added
-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 to CFLAGS in the spec file,
rebuilt the rpm and installed it.  Apache starts fine but I get
[notice] child pid  exit signal Segmentation fault (11) when ever
I request a page.  Compiling the same source without those flags works
fine.  I must be missing something, but I am in way over my head.  Can
someone tell me what I am doing wrong?
You did not mention your apache version and php setup (mod_php vs. cgi)
IMHO if you are using mod_php, both apache and php must be compiled with 
the same _FILE_OFFSET_BITS or you get segmen. fault. LFS is available on 
 for apache 2.X only. CGI should not be affected as it's another process.

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


Re: [PHP] Linux PHP CLI and Environment variables

2005-01-27 Thread Marek Kilimajer
Michael Gale wrote:
Hello,
I am running php 4.3.7 with ncurses support. I want to create a 
small app using php and ncurses but I will need to get some information 
from the shell environment variables.

I have searched every where ...is this possible ?
Michael.
http://sk.php.net/manual/en/language.variables.predefined.php#reserved.variables.environment
#!/usr/local/bin/php
?php
  print_r($_ENV);
?
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] error log

2005-01-27 Thread Benson
could anyone please help me on how to display all the errors to the
browser, but not to file?
I have tried modifying php.ini and httpd.conf (apache), but I am not
sure how to modify...
thx

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



Re: [PHP] Apache: Request exceeded the limit of 10 internal redirects

2005-01-27 Thread Jochem Maas
Marek Kilimajer wrote:
...
I know its due to the way my Apache is setup (not rewrite rules)
but the following always works for me:
http://www.somedomain.com/doit
runs
http://www.somedomain.com/doit.php
--
apache just does its magic - I believe its to do with the 
DocumentIndex apache conf setting
(i.e. Apache makes use of the extensions found there) - please someone 
correct me if I'm wrong.


heh Marek,
I wasn't the original poster on this thread - I don't have any problems
with my setup - I was just mentioning the behaviour of my server
which does make use of some rewrite rules - but (AFAIKS) not for the
behaviour I described.
Your conditions are as follows:
1. reqeusted filename is not a directory:
RewriteCond %{REQUEST_FILENAME} !-d
2. reqeusted filename is not a file:
RewriteCond %{REQUEST_FILENAME} !-f
If all above matches, put .php at the end:
RewriteRule ^(.*)$ /$1.php
So it has nothing to do with DocumentIndex. All that is necessary is to 
request a file that does not exist on the server even if you add .php 
at the end:

/foo - neither file or directory, rewrite to /foo.php
/foo.php - neither file or directory, rewrite to /foo.php.php
/foo.php.php - neither file or directory, rewrite to /foo.php.php.php
...etc.
The problem is ^(.*)$ matches everything. Try ^([^.]*)$ - no dot in url
as I said I don't have a problem but your point is well made is relation
to the originally posted problem :-)

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


[PHP] escaping quotes

2005-01-27 Thread Giles
Hi Guys

Really simple question. How do I change the following:

print(value=' . $attributes[messageSubject] . ');

to have double quotes around the subject field instead. i.e.:

print(value= . $attributes[messageSubject] . );

thanks

Giles Roadnight
http://giles.roadnight.name

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



RE: [PHP] Re: Avoiding NOTICEs on Array References

2005-01-27 Thread Michael Sims
Burhan Khalid wrote:
 Michael Sims wrote:
 [EMAIL PROTECTED] wrote:

 If one must check the value and not just the existence of the
 checkbox entry, or for other uses, e.g. where a flag may or may not
 be present, one is saddled with clumsy constructs like:

if (($isset($array['index'])  ($array['index'] == 1)) ...

 I'm surprised that no one mentioned

 if (array_key_exists(index,$array)) { /* .. */ }

Because we're talking about avoiding clumsiness, and:

if (array_key_exists('index', $array)  $array['index'] == 1) ...

is MORE verbose (and arguably clumsier) than

if (isset($array['index'])  $array['index'] == 1) ...

which for the purposes of this discussion is equivalent.

(And yes, I realize that in the case of a checkbox the mere test for key
existence is sufficient, but I like to be consistent in these types of
constructs despite the input type...)

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



RE: [PHP] Re: Avoiding NOTICEs on Array References

2005-01-27 Thread Michael Sims
Jochem Maas wrote:
 Michael Sims wrote:
 On a controller page (the C in MVC) that handles form submissions
 I create an array which defines what form variables are available
 and their default values if not entered.  I then use array_merge()
 to combine that array with $_POST (or $_GET, as the case may be) and
[...]
 Its a good idea - although to make this example work I believe you
 would need to use array_merge_recursive() - which does what you mean
 ;-)

Yup, good catch. :)  Since I started using this method I haven't actually
had a form with more than one dimension of variables like that.  Now if I do
I'll be saved a bit of troubleshooting; thanks. :)

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



[PHP] Re:[PHP] escaping quotes

2005-01-27 Thread Binoy AV
 

 Hi,

 Try this
 
 print(value=\ . $attributes[messageSubject] . \);


 Binoy 

 
__ __ __ __
Sent via the WebMail system at softwareassociates.co.uk


 
   
---
Scanned by MessageExchange.net (12:54:20 SPITFIRE)

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



[PHP] SourceForge project adroption

2005-01-27 Thread Devraj Mukherjee
I have run a SourceForge project for the past two years, its a document 
management product with the unique feature of not using a backend. It 
uses text files to keep the all its META information.

A very well accepted product that has been downloaded over nine thousand 
times and has a very strong foundation of design and implementation.

I don't have a lot of time these days since I am mentoring a company 
called Eternity Technologies heading development of products. I am thus 
interested in someone who has a bit of spare time and interest to take 
this project over and keep it running.

I am happy to share ideas, support the development of the product and 
hopefully in the near future even generate some funds to keep the 
development going.

Eternity Technologies has even done a few commercial customisation jobs 
for the project. This could be great experience for someone or just 
prove highly useful for your work.

If there are any willing adopters of a PHP based open source project 
please check out http://sourceforge.net/projects/terracotta/ Download 
the Alpha release of 0.7.1 to get a feel for where I managed to get it upto.

If you are interested please email me at 
[EMAIL PROTECTED], thank you for your time and consideration.

Kind regards,
Devraj
--
Devraj Mukherjee ([EMAIL PROTECTED])
Eternity Technologies Pty. Ltd. ACN 107 600 975
P O Box 5949 Wagga Wagga NSW 2650 Australia
Voice: +61-2-69717131 / Fax: +61-2-69251039
http://www.eternitytechnologies.com/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP] Re: Avoiding NOTICEs on Array References

2005-01-27 Thread Ford, Mike
To view the terms under which this email is distributed, please go to 
http://disclaimer.leedsmet.ac.uk/email.htm



On 26 January 2005 19:56, [EMAIL PROTECTED] wrote:

 On 26 Jan 2005 Jason Barnett wrote:
 
  if (isset($_POST['checkboxfieldname'])) {
 /** do stuff */
  }
 
 Sorry, I should have mentioned that I knew about using isset -- it
 works OK for the checkbox example, though I'm not clear if this
 behavior is specified and therefore will not change -- i.e. can one
 rely on the fact that the checkbox field name is missing
 entirely from
 _POST if the box is not checked?  Or are there cases where it could be
 present but with an empty or NULL value?
 
 If one must check the value and not just the existence of the checkbox
 entry, or for other uses, e.g. where a flag may or may not be present,
 one is saddled with clumsy constructs like:
 
   if (($isset($array['index'])  ($array['index'] == 1)) ...
 
 I would prefer that the second expression return FALSE, or that
 $array['index'] where the index is not present simply return
 NULL -- or
 probably better, an option to avoid E_NOTICE level errors for such
 cases.

The @ operator exactly matches your requirement (and is also my personal
preference in this case):

@$array['index']

will return NULL if either $array or $array['index'] doesn't exist, so:

if (@$array['index'] == 1)

works as you want.

I've seen arguments against doing this that say (i) it's bad form to be
using error suppression just to change the result returned from an
expression, and (ii) the error-suppression operator is very slow.  My
answers to these are: (i) if the operator exists and does exactly what you
want, why the heck not use it?, and (ii) According to my benchmarks, on
average it's no slower than other solutions.

Anyway, I like the elegance of a single character operator over any of the
other more verbose possibilities.

Cheers!

Mike

-
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning  Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Headingley Campus, LEEDS,  LS6 3QS,  United Kingdom
Email: [EMAIL PROTECTED]
Tel: +44 113 283 2600 extn 4730  Fax:  +44 113 283 3211 

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



[PHP] [ParrotHeadPoster] - Re: [PHP] escaping quotes

2005-01-27 Thread Jochem Maas
I had a parrot idea whilst writing this.. (see bottom)
Giles wrote:
Hi Guys
Really simple question. How do I change the following:
print(value=' . $attributes[messageSubject] . ');
to have double quotes around the subject field instead. i.e.:
print(value= . $attributes[messageSubject] . );
you have to escape the doublequotes in question - this is done with
a backslash:
print(value=\ . $attributes[messageSubject] . \);
or like this if you find it more readable (avoids the backslashes):
printf('value=%s', $attributes[messageSubject]);
actually you can do loads of funky things with printf() and its brother
sprintf() etc - check out the manual for all the formating codes (e.g. '%s')
that  are available
lastly, learn what string interpolation is and why it is technically
neater to only use doublequotes to delimit your php strings when you
want/require string interpolation to happen.
---
ParrotTalk: I think that this topic of string interpolation/quotes
deserves 'parrot' attention which made me think that maybe the parrot
could parse for markers (that if added to an email by an autorized poster)
would mark the post/thread as suitable material for 'training' the 'parrot'


thanks
Giles Roadnight
http://giles.roadnight.name
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP] escaping quotes

2005-01-27 Thread Ford, Mike
To view the terms under which this email is distributed, please go to 
http://disclaimer.leedsmet.ac.uk/email.htm



On 27 January 2005 12:14, Giles wrote:

 Hi Guys
 
 Really simple question. How do I change the following:
 
 print(value=' . $attributes[messageSubject] . ');
 
 to have double quotes around the subject field instead. i.e.:
 
 print(value= . $attributes[messageSubject] . );

print('value=' . $attributes[messageSubject] . '');

Cheers!

Mike

-
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning  Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Headingley Campus, LEEDS,  LS6 3QS,  United Kingdom
Email: [EMAIL PROTECTED]
Tel: +44 113 283 2600 extn 4730  Fax:  +44 113 283 3211 

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



RE: [PHP] escaping quotes

2005-01-27 Thread Mikey
 Hi Guys
 
 Really simple question. How do I change the following:
 
 print(value=' . $attributes[messageSubject] . ');
 
 to have double quotes around the subject field instead. i.e.:
 
 print(value= . $attributes[messageSubject] . );
 

Simple:

Print (value=\{$attributes['messageSubject']}\);

HTH,

Mikey

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



Re: [PHP] escaping quotes

2005-01-27 Thread John Holmes
Giles wrote:
Hi Guys
Really simple question. How do I change the following:
print(value=' . $attributes[messageSubject] . ');
to have double quotes around the subject field instead. i.e.:
print(value= . $attributes[messageSubject] . );
print(value=\ . $attributes[messageSubject] . \);
print(value=\{$attributes['messageSubject']}\);
Although, to prevent any vulnerabilities, you probably want:
print(value=\ . htmlentities($attributes[messageSubject]) . \);
if you're not already doing so at some point.
--
---John Holmes...
Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/
php|architect: The Magazine for PHP Professionals  www.phparch.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Web shopping cart

2005-01-27 Thread Afan Pasalic
I use osCommerce and they are not bad at all.
-afan
Rick Lim wrote:
Can anyone recommend a freeware shopping card app in php?
Thanks.
 

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


Re: [PHP] Web shopping cart

2005-01-27 Thread Abdul-Wahid Paterson
I would agree with that. Is relatively easy to install and configure.
Although the templating is not perfect...I have seen better ways of
doing it.

It works well though in doing what it is meant to do.

regards,

Abdul-Wahid



On Thu, 27 Jan 2005 07:32:44 -0600, Afan Pasalic [EMAIL PROTECTED] wrote:
 I use osCommerce and they are not bad at all.
 
 -afan
 
 
 Rick Lim wrote:
 
 Can anyone recommend a freeware shopping card app in php?
 Thanks.
 
 
 
 
 --
 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] read file from specific line

2005-01-27 Thread gustav
Hi there!

Is there any way reading a file from a specific line? (textfile)

/G
@varupiraten.se

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



[PHP] regular expressions ?

2005-01-27 Thread Zouari Fourat
Hello,
I need to verify if $x is between 1 and 20 and i need to do that with
regular expressions ?
anyone can help me outta there ?
thanks a lot

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



Re: [PHP] regular expressions ?

2005-01-27 Thread Marek Kilimajer
Zouari Fourat wrote:
Hello,
I need to verify if $x is between 1 and 20 and i need to do that with
regular expressions ?
anyone can help me outta there ?
thanks a lot
http://www.php.net/operators.comparison
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP] regular expressions ?

2005-01-27 Thread Jay Blanchard
[snip]
I need to verify if $x is between 1 and 20 and i need to do that with
regular expressions ?
anyone can help me outta there ?
[/snip]

Why regex? 

if((1  $x)  ($x  20)){
it's true
}

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



[PHP] Re: [ParrotHeadPoster] - Re: [PHP] escaping quotes

2005-01-27 Thread Jason Barnett
Jochem Maas wrote:
I had a parrot idea whilst writing this.. (see bottom)
...
---
ParrotTalk: I think that this topic of string interpolation/quotes
deserves 'parrot' attention which made me think that maybe the parrot
could parse for markers (that if added to an email by an autorized poster)
would mark the post/thread as suitable material for 'training' the 'parrot'
Actually that is a pretty good way to handle it... regardless of whether 
we use the Bayesian/SPAM or Heuristic approach.  It wouldn't require 
anyone to go to any website, just reply to a message like normal and tag it.

phParrot /
And then, if the parrot didn't already respond to the original 
message... well, then it could be trained / told to respond directly to 
that message.

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


RE: [PHP] read file from specific line

2005-01-27 Thread Jay Blanchard
[snip]
Is there any way reading a file from a specific line? (textfile)
[/snip]

Yes. 

Loop through a count until you reach the line you want, then read

while(!feof($myFile)){
if(lineNumberIWant = $i){
read line
$i++;
} else {
do not read line
$i++;
}
}

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



[PHP] HELLO, some question about php :)

2005-01-27 Thread KevinYu
Dear WM,

 Sorry to take your time, i wish to build a cluster, but i am not sure the 
php
can support cluster function or not, if so, where can find it?

Mysql also hope to run on the cluster, I didn't find any document about this 
tips!

Does PHP and Mysql supports CLUSTER library or function to be called?
 
 Best wishes!  :o)

 Kevin Yu
WM of volcanoSearch


Re: [PHP] Web shopping cart

2005-01-27 Thread Marek Kilimajer
Abdul-Wahid Paterson wrote:
I would agree with that. Is relatively easy to install and configure.
Although the templating is not perfect...I have seen better ways of
doing it.
It works well though in doing what it is meant to do.
What templating? There's no templating in osc :)
I would also evaluate zen-cart
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] [NEWBIE] Trying to create a function from an existing script

2005-01-27 Thread Dave
PHP List,
   The Situation:
   I'm trying to make a page where users can upload an image. I've 
located on the internet a script that is simple enough for me to use, 
and I can build upon it to customize for my needs.
   The script as it is on the web site I got it from is a stand alone 
.php file in the same directory as the form that calls it. In order to 
keep my site organized and consistent with what I've constructed so far, 
I'd like to make the code into a function, included in my directory with 
other image manipulation functions.

   The Problem:
   I'm not able to create the right syntax to pass the $HTTP_POST_FILES 
variable to the function. So the function gets called, but then it stops 
very early because what I end up giving it is essentially an empty 
array, so it thinks there's no file to handle.

   What I've Tried So Far:
   I've tried putting $HTTP_POST_FILES directly into the function 
parameters, and I've tried renaming $HTTP_POST_FILES as a different 
array before passing it to the function. But I'm essentially shooting in 
the dark, trying random variants of syntax.

   The Question:
   How do I pass the $HTTP_POST_FILES to the function?
   Any help would be much appreciated.
   For Reference:
   What follows is the form as it appears in the HTML, and then after 
that is the function as it appears in a separate .php file:

form enctype=multipart/form-data action=(EmptyReference!) 
method=POST
input type=hidden name=MAX_FILE_SIZE value=1
input name=upfile type=file
input name=store_dir type=hidden value=images
input type=submit name=Upload value=submit
?php
if(isset( $Upload ))
{
upload_img();
}
?
/form

--
function upload_img()
{
//  Check to see if a file has been included when the form was submitted
if( strlen($HTTP_POST_FILES['upfile']['name'])  1 )
{
  echo(Error! No files to upload... Exiting);
  exit();
}
// Check to see if the directory specified in the store_dir
// input field is a valid directory, if it isn't clear up
// the temporary files from the server.
if( !is_dir($store_dir) )
{
  echo(Specified directory is not valid... Exiting);
  unlink($HTTP_POST_FILES['upfile']['tmp_name']);
  exit();
}
// Copy the temporary file to the specified directory and
// give it the original name it had on the source machine.
if( 
copy($HTTP_POST_FILES['upfile']['tmp_name'],$store_dir.$HTTP_POST_FILES['upfile']['name']) 
)
{
  echo(Uploaded .$HTTP_POST_FILES['upfile']['name']. successfully.);
}
// If the copy function fails output a message.
else
{
  echo(Upload of .$HTTP_POST_FILES['upfile']['name']. to 
.$store_dir. failedBR);
}

// Finally tidy up behind yourself and delete the
// temporary file from the server.
unlink($HTTP_POST_FILES['upfile']['tmp_name']);
}
--
Dave Gutteridge
[EMAIL PROTECTED]
Tokyo Comedy Store
http://www.tokyocomedy.com/english/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP] [NEWBIE] Trying to create a function from an existing script

2005-01-27 Thread Mike Johnson
From: Dave [mailto:[EMAIL PROTECTED] 

 The Problem:
 I'm not able to create the right syntax to pass the 
 $HTTP_POST_FILES variable to the function. So the function 
 gets called, but then it stops very early because what I 
 end up giving it is essentially an empty array, so it 
 thinks there's no file to handle.

$HTTP_POST_FILES isn't an auto-global. As such, your function is looking
for a localized variable called $HTTP_POST_FILES and finds nothing.

Add the following as the first line of your function, and it should work
fine:

global $HTTP_POST_FILES;

See here for more info:
http://us3.php.net/manual/en/reserved.variables.php#reserved.variables.f
iles

Hope this helps!


-- 
Mike Johnson Smarter Living, Inc.
Web Developerwww.smartertravel.com
[EMAIL PROTECTED]   (617) 886-5539

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



[PHP] ftp_put and ftp_fput both failing me

2005-01-27 Thread Wayne Zeller
My first attempt at posting this appears to have failed, so I'll try 
again. My apologies if this is a duplicate...


I can't for the life of me figure out why this won't work.  I am 
downloading a file from a remote host via ftp, processing it and 
modifying part of it, and then uploading the updated file back to the 
remote server via ftp.

Everything is working great until it comes time to put the modified file 
back onto the remote host.

The script successfully logs in, but fails to put the file.
I want the final file to overwrite the original, but it fails even if I 
give it a new name so as to not overwrite. So overwriting isn't the problem.

Here is the section of code I'm using:
// I'm putting my contents into $myfile:
$myfile = 'A bunch of text. (An html file, actually.)';
// Setting up connection parameters:
$ftp_server = 'www.myserver.com';
$ftp_user_name = 'myusername';
$ftp_user_pass = 'mypassword';
$remote_file_name = 'filename.htm';
// Create a tmp file:
$fp = tmpfile();
fwrite($fp, $myfile);
rewind($fp);
// Log into the remote server:
$conn_id = ftp_connect($ftp_server);
$login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass);
if ((!$conn_id) || (!$login_result)) {
   echo FTP connection has failed!;
   echo Attempted connection to $ftp_server for $ftp_user_name;
   exit;
   } else {
   echo Connected to $ftp_server, for user $ftp_user_name.;
   }
// EVERYTHING WORKS FINE UP TO HERE
// upload the file:
$upload = ftp_put($conn_id, $remote_file_name, $fp, FTP_ASCII); //FAILS!
// check upload status
if (!$upload) {
   echo FTP upload has failed! $upload; //THIS IS THE OUTPUT I GET
   } else {
   echo Uploaded $source_file to $ftp_server as $destination_file;
   }
// close the FTP stream
ftp_close($conn_id);

When I run the program, it returns Connected to (servername), for user 
(username).FTP upload has failed!

Sure enough, when checking on the remote server, the file has not been 
touched.

I've tried using a file handle and using ftp_fput, but I get the same 
results.

I'm probably missing something obvious. If anybody sees it, please let 
me know!

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


Re: [PHP] regular expressions ?

2005-01-27 Thread Leif Gregory
Hello Zouari,

Thursday, January 27, 2005, 7:33:04 AM, you wrote:
Z I need to verify if $x is between 1 and 20 and i need to do that
Z with regular expressions ?

If you *need* to do it with regexp, try this:



if (preg_match(/[2-19]/,$x))
  echo It is!;





If 1 and 20 are values you want to verify too, change 2-19 to 1-20.


-- 
Leif (TB lists moderator and fellow end user).

Using The Bat! 3.0.2.3 Rush under Windows XP 5.1
Build 2600 Service Pack 2 on a Pentium 4 2GHz with 512MB

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



Re: [PHP] help needed on imagettftext()

2005-01-27 Thread Marek Kilimajer
Harish Rao K wrote:
Hello,
While working with some CAPTCHA stuff I get the following error:
Fatal error: Call to undefined function imagettftext().
I have compiled with GD support and all the supporting libraries
(Freetype, TTF, jpeg, X11R6 etc).
What am I missing?
Below is the configure command that I have used.
'./configure' '--with-gd'
'--with-apxs2=/usr/local/apache2/bin/apxs' '--with-pgsql'
'--with-jpeg-dir=/usr/local/jpeg-6b'
'--with-zlib-dir=/usr/local/zlib-1.2.1' '--enable-gd-native-ttf'
'--with-png' '--with-ttf'
'--with-freetype-dir=/usr/local/freetype-2.1.9'
'--with-xpm-dir=/usr/X11R6'
Thanks  Regards,
Harish Rao K,
make clean
make
make install
this helped me. I guess there are wrong dependencies in the Makefiles
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] regular expressions ?

2005-01-27 Thread Marek Kilimajer
Zouari Fourat wrote:
here's the problem :
my user MUST input only digits between 1 and 20
doing a is_numeric and some comparaison can be bypassed by inputing :
.5
or
0.5
or
5.1
or
0.3
or
.01
...
...
so i thought that the smartest way is to use regex
if( $i = 1  $i = 20  $i == (int)$i) ...
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] regular expressions ?

2005-01-27 Thread Zouari Fourat
 if (preg_match(/[2-19]/,$x))
   echo It is!;

doesnt work !
this is working fine :
if (eregi(^-?([1-3])+$,$x)
 echo x is 1 or 2 or 3;



On Thu, 27 Jan 2005 08:42:19 -0700, Leif Gregory [EMAIL PROTECTED] wrote:
 Hello Zouari,
 
 Thursday, January 27, 2005, 7:33:04 AM, you wrote:
 Z I need to verify if $x is between 1 and 20 and i need to do that
 Z with regular expressions ?
 
 If you *need* to do it with regexp, try this:
 
 
 
 if (preg_match(/[2-19]/,$x))
   echo It is!;
 
 
 
 If 1 and 20 are values you want to verify too, change 2-19 to 1-20.
 
 --
 Leif (TB lists moderator and fellow end user).
 
 Using The Bat! 3.0.2.3 Rush under Windows XP 5.1
 Build 2600 Service Pack 2 on a Pentium 4 2GHz with 512MB
 
 --
 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] Cannot connect to Database

2005-01-27 Thread Supersky
Hello,

I'm using the following statements to connect to a database.

?php $conn = mysql_connect('localhost', 'root', '') or die (Can't Connect 
To
Database);
$db = mysql_select_db(testDB, $conn) or die (Can't Select Database. 
mysql_error()); ?

But I cannot, and I see  Fatal error: Call to undefined function 
mysql_connect() in 

My OS is WinXP, I have installed Mysql 4.1, Apache 2.0.52, and PHP 5.03. 
Apache and PHP work well if I don't connect to a database.

Please any help or suggestions are welcome. Thanks!

Gan

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



Re: [PHP] regular expressions ?

2005-01-27 Thread Zouari Fourat
 this is working fine :
 if (eregi(^-?([1-3])+$,$x)
  echo x is 1 or 2 or 3;

i forgot to say that doesnt work with 1-20 :(
how to do it ?


On Thu, 27 Jan 2005 16:53:55 +0100, Zouari Fourat [EMAIL PROTECTED] wrote:
  if (preg_match(/[2-19]/,$x))
echo It is!;
 
 doesnt work !
 this is working fine :
 if (eregi(^-?([1-3])+$,$x)
  echo x is 1 or 2 or 3;
 
 
 On Thu, 27 Jan 2005 08:42:19 -0700, Leif Gregory [EMAIL PROTECTED] wrote:
  Hello Zouari,
 
  Thursday, January 27, 2005, 7:33:04 AM, you wrote:
  Z I need to verify if $x is between 1 and 20 and i need to do that
  Z with regular expressions ?
 
  If you *need* to do it with regexp, try this:
 
  
 
  if (preg_match(/[2-19]/,$x))
echo It is!;
 
  
 
  If 1 and 20 are values you want to verify too, change 2-19 to 1-20.
 
  --
  Leif (TB lists moderator and fellow end user).
 
  Using The Bat! 3.0.2.3 Rush under Windows XP 5.1
  Build 2600 Service Pack 2 on a Pentium 4 2GHz with 512MB
 
  --
  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] [NEWBIE] Trying to create a function from an existing script

2005-01-27 Thread Marek Kilimajer
Dave wrote:
PHP List,
   The Situation:
   I'm trying to make a page where users can upload an image. I've 
located on the internet a script that is simple enough for me to use, 
and I can build upon it to customize for my needs.
   The script as it is on the web site I got it from is a stand alone 
.php file in the same directory as the form that calls it. In order to 
keep my site organized and consistent with what I've constructed so far, 
I'd like to make the code into a function, included in my directory with 
other image manipulation functions.

   The Problem:
   I'm not able to create the right syntax to pass the $HTTP_POST_FILES 
variable to the function. So the function gets called, but then it stops 
very early because what I end up giving it is essentially an empty 
array, so it thinks there's no file to handle.

   What I've Tried So Far:
   I've tried putting $HTTP_POST_FILES directly into the function 
parameters, and I've tried renaming $HTTP_POST_FILES as a different 
array before passing it to the function. But I'm essentially shooting in 
the dark, trying random variants of syntax.

   The Question:
   How do I pass the $HTTP_POST_FILES to the function?
   Any help would be much appreciated.
   For Reference:
   What follows is the form as it appears in the HTML, and then after 
that is the function as it appears in a separate .php file:

form enctype=multipart/form-data action=(EmptyReference!) 
method=POST
input type=hidden name=MAX_FILE_SIZE value=1
input name=upfile type=file
input name=store_dir type=hidden value=images
input type=submit name=Upload value=submit
?php
if(isset( $Upload ))
{
upload_img();
}
?
/form

--
function upload_img()
define your function as upload_img($name, $store_dir)
then later on use $HTTP_POST_FILES[$name], your function will be more 
universal.

{
	global $HTTP_POST_FILES;
//  Check to see if a file has been included when the form was submitted
if( strlen($HTTP_POST_FILES['upfile']['name'])  1 )
{
  echo(Error! No files to upload... Exiting);
  exit();
}
// Check to see if the directory specified in the store_dir
// input field is a valid directory, if it isn't clear up
// the temporary files from the server.
if( !is_dir($store_dir) )
{
  echo(Specified directory is not valid... Exiting);
  unlink($HTTP_POST_FILES['upfile']['tmp_name']);
  exit();
}
// Copy the temporary file to the specified directory and
// give it the original name it had on the source machine.
if( 
copy($HTTP_POST_FILES['upfile']['tmp_name'],$store_dir.$HTTP_POST_FILES['upfile']['name']) 
Use move_uploaded_file($HTTP_POST_FILES[$name]['tmp_name'], $store_dir . 
basename($HTTP_POST_FILES[$name]['name']);

move_uploaded_file - so you can be sure it's really an uploaded file
basename - 'name' is provided by the user and it can contain anything, 
for example ../index.php. If $store_dir is 'upload/', then you would 
overwrite your index.php file

)
{
  echo(Uploaded .$HTTP_POST_FILES['upfile']['name']. successfully.);
}
// If the copy function fails output a message.
else
{
  echo(Upload of .$HTTP_POST_FILES['upfile']['name']. to 
.$store_dir. failedBR);
}

// Finally tidy up behind yourself and delete the
// temporary file from the server.
unlink($HTTP_POST_FILES['upfile']['tmp_name']);
temporary files are cleaned up automaticly. And if move_uploaded_file is 
used it no longer exists so it will trigger a warning

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


Re: [PHP] Cannot connect to Database

2005-01-27 Thread Leif Gregory
Hello Supersky,

Thursday, January 27, 2005, 8:55:04 AM, you wrote:
S But I cannot, and I see Fatal error: Call to undefined function
S mysql_connect() in 

1. Make sure you uncomment the extension=php_mysql.dll in your php.ini
2. Copy the php_mysql.dll to your Windows/System folder
3. Restart Apache.


You might look at:

?php

phpinfo();

?

To see before and after (Look for the section on MySQL.)




-- 
Leif (TB lists moderator and fellow end user).

Using The Bat! 3.0.2.3 Rush under Windows XP 5.1
Build 2600 Service Pack 2 on a Pentium 4 2GHz with 512MB

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



Re: [PHP] Cannot connect to Database

2005-01-27 Thread Marek Kilimajer
Supersky wrote:
Hello,
I'm using the following statements to connect to a database.
?php $conn = mysql_connect('localhost', 'root', '') or die (Can't Connect 
To
Database);
$db = mysql_select_db(testDB, $conn) or die (Can't Select Database. 
mysql_error()); ?

But I cannot, and I see  Fatal error: Call to undefined function 
mysql_connect() in 

My OS is WinXP, I have installed Mysql 4.1, Apache 2.0.52, and PHP 5.03. 
Apache and PHP work well if I don't connect to a database.

Please any help or suggestions are welcome. Thanks!
Gan
uncomment mysql.dll in your php.ini and restart apache
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] ftp_put and ftp_fput both failing me

2005-01-27 Thread Marek Kilimajer
Wayne Zeller wrote:
My first attempt at posting this appears to have failed, so I'll try 
again. My apologies if this is a duplicate...


I can't for the life of me figure out why this won't work.  I am 
downloading a file from a remote host via ftp, processing it and 
modifying part of it, and then uploading the updated file back to the 
remote server via ftp.

Everything is working great until it comes time to put the modified file 
back onto the remote host.

The script successfully logs in, but fails to put the file.
I want the final file to overwrite the original, but it fails even if I 
give it a new name so as to not overwrite. So overwriting isn't the 
problem.

Here is the section of code I'm using:
// I'm putting my contents into $myfile:
$myfile = 'A bunch of text. (An html file, actually.)';
// Setting up connection parameters:
$ftp_server = 'www.myserver.com';
$ftp_user_name = 'myusername';
$ftp_user_pass = 'mypassword';
$remote_file_name = 'filename.htm';
// Create a tmp file:
$fp = tmpfile();
fwrite($fp, $myfile);
rewind($fp);
// Log into the remote server:
$conn_id = ftp_connect($ftp_server);
$login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass);
if ((!$conn_id) || (!$login_result)) {
   echo FTP connection has failed!;
   echo Attempted connection to $ftp_server for $ftp_user_name;
   exit;
   } else {
   echo Connected to $ftp_server, for user $ftp_user_name.;
   }
// EVERYTHING WORKS FINE UP TO HERE
// upload the file:
$upload = ftp_put($conn_id, $remote_file_name, $fp, FTP_ASCII); //FAILS!
// check upload status
if (!$upload) {
   echo FTP upload has failed! $upload; //THIS IS THE OUTPUT I GET
   } else {
   echo Uploaded $source_file to $ftp_server as $destination_file;
   }
// close the FTP stream
ftp_close($conn_id);

When I run the program, it returns Connected to (servername), for user 
(username).FTP upload has failed!

Sure enough, when checking on the remote server, the file has not been 
touched.

I've tried using a file handle and using ftp_fput, but I get the same 
results.
You must use ftp_fput() because you are using open file handle.
Check that tmpfile() did not fail. Then make sure you are in the right 
directory after logging in the ftp server.

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


Re: [PHP] regular expressions ?

2005-01-27 Thread Zouari Fourat
to Marek Kilimajer :
$i='5.';
if (($i=1)  ($i=20)  ($i==(int)$i))
echo 'yes';

// yes
:'(



On Thu, 27 Jan 2005 16:52:20 +0100, Marek Kilimajer [EMAIL PROTECTED] wrote:
 Zouari Fourat wrote:
  here's the problem :
  my user MUST input only digits between 1 and 20
  doing a is_numeric and some comparaison can be bypassed by inputing :
 
  .5
  or
  0.5
  or
  5.1
  or
  0.3
  or
  .01
  ...
  ...
 
  so i thought that the smartest way is to use regex
 
 
 if( $i = 1  $i = 20  $i == (int)$i) ...


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



Re: [PHP] regular expressions ?

2005-01-27 Thread Marek Kilimajer
Zouari Fourat wrote:
to Marek Kilimajer :
$i='5.';
if (($i=1)  ($i=20)  ($i==(int)$i))
echo 'yes';
// yes
:'(
ok, then use regexp:
if (($i=1)  ($i=20)  regexp('^[0-9]+$', $i))
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] regular expressions ?

2005-01-27 Thread Robin Vickery
On Thu, 27 Jan 2005 16:56:05 +0100, Zouari Fourat [EMAIL PROTECTED] wrote:
  this is working fine :
  if (eregi(^-?([1-3])+$,$x)
   echo x is 1 or 2 or 3;
 
 i forgot to say that doesnt work with 1-20 :(
 how to do it ?

You're far better off doing it arithmetically as someone already said,
however  if you absolutely *have* to use a regexp then this is how you
go about it:

You need to match these possible variations:
1. the number '20'
2. the number '1' followed by any digit between 0 and 9.
3. any digit between 1 and 9.

the pattern for the first one is easy. it's just a fixed string: 20
the pattern for the second is only slightly harder: 1[0-9]
the pattern for the third is: [1-9]

You want to match any of them, so you join them together with an
alternation operator, the '|' symbol to get: 20|1[0-9]|[1-9]

This will match any string that contains the numbers 1-20, such as
'200'. To make sure it only matches exactly the numbers you're
interested in, you have to anchor the start and finish ending up
with this:

if (preg_match('/^(20|1[0-9]|1-9])$/', $candidate)) {
   // $candidate is a decimal integer between 1 and 20 inclusive with
no leading zeros.
}

 -robin

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



Re: [PHP] regular expressions ?

2005-01-27 Thread Zouari Fourat
Robin : 
$i='2';
if (preg_match('/^(20|1[0-9]|1-9])$/', $i)) {
echo 'yes';
}else
echo 'no';


stdout: no

Marek :
$i='02';
if (($i=1)  ($i=20)  (eregi('^[0-9]+$', $i)))
echo 'yes';


stdout: yes

i hate reposting but my problem seems to persist :( sorry.


On Thu, 27 Jan 2005 16:28:37 +, Robin Vickery [EMAIL PROTECTED] wrote:
 On Thu, 27 Jan 2005 16:56:05 +0100, Zouari Fourat [EMAIL PROTECTED] wrote:
   this is working fine :
   if (eregi(^-?([1-3])+$,$x)
echo x is 1 or 2 or 3;
 
  i forgot to say that doesnt work with 1-20 :(
  how to do it ?
 
 You're far better off doing it arithmetically as someone already said,
 however  if you absolutely *have* to use a regexp then this is how you
 go about it:
 
 You need to match these possible variations:
 1. the number '20'
 2. the number '1' followed by any digit between 0 and 9.
 3. any digit between 1 and 9.
 
 the pattern for the first one is easy. it's just a fixed string: 20
 the pattern for the second is only slightly harder: 1[0-9]
 the pattern for the third is: [1-9]
 
 You want to match any of them, so you join them together with an
 alternation operator, the '|' symbol to get: 20|1[0-9]|[1-9]
 
 This will match any string that contains the numbers 1-20, such as
 '200'. To make sure it only matches exactly the numbers you're
 interested in, you have to anchor the start and finish ending up
 with this:
 
 if (preg_match('/^(20|1[0-9]|1-9])$/', $candidate)) {
// $candidate is a decimal integer between 1 and 20 inclusive with
 no leading zeros.
 }
 
  -robin
 
 --
 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] regular expressions ?

2005-01-27 Thread John Nichel
Zouari Fourat wrote:
Robin : 
	$i='2';
	if (preg_match('/^(20|1[0-9]|1-9])$/', $i)) {
Open the bracket for the last parameter...
/^(20|1[0-9]|[1-9])$/
-^
--
John C. Nichel
ÜberGeek
KegWorks.com
716.856.9675
[EMAIL PROTECTED]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] HELLO, some question about php :)

2005-01-27 Thread Richard Lynch
KevinYu wrote:
  Sorry to take your time, i wish to build a cluster, but i am not sure
 the php
 can support cluster function or not, if so, where can find it?

 Mysql also hope to run on the cluster, I didn't find any document about
 this tips!

 Does PHP and Mysql supports CLUSTER library or function to be called?

  Best wishes!  :o)

As I understand it, PHP is a shared nothing architecture.

Translation:
There's nothing to *do* to make it work on a cluster, it just works.
Every PHP install will be completely independent, by design.

MySQL is a bit more tricky, but if you check the MySQL site for
replication and related topics, you'll find that current/future versions
have some pretty cool stuff for providing distributed tables and
processing farms.

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] escaping quotes

2005-01-27 Thread Richard Lynch
John Holmes wrote:
 print(value=\ . $attributes[messageSubject] . \);

Slight typo there:

value=\ . ...

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] error log

2005-01-27 Thread Richard Lynch
Benson wrote:
 could anyone please help me on how to display all the errors to the
 browser, but not to file?
 I have tried modifying php.ini and httpd.conf (apache), but I am not
 sure how to modify...

You would be MUCH MUCH MUCH better off to train yourself to use 'tail -f
/usr/local/apache/logs/error_log' instead.

Honest.

That said, you should have only needed to change php.ini in a rather
obvious way -- but you need to re-start Apache after changing it, which
was probably what you missed.

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] help needed on imagettftext()

2005-01-27 Thread Richard Lynch
Harish Rao K wrote:
 While working with some CAPTCHA stuff I get the following error:
 Fatal error: Call to undefined function imagettftext().
 I have compiled with GD support and all the supporting libraries
 (Freetype, TTF, jpeg, X11R6 etc).

 What am I missing?

Check the log files from in the PHP source directory -- Often configure
will seem to work fine, but have error messages buried in that zillion
lines of output...

And, as always, you might have forgotten to re-start apache.

-- 
Like Music?
http://l-i-e.com/artists.htm

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



RE: [PHP] escaping quotes

2005-01-27 Thread Giles
Thanks, that works great.

Knew that worked for JavaScript but didn't know it worked for PHP.

Giles Roadnight
http://giles.roadnight.name


-Original Message-
From: Richard Lynch [mailto:[EMAIL PROTECTED] 
Sent: 27 January 2005 17:07
To: John Holmes
Cc: Giles; php-general@lists.php.net
Subject: Re: [PHP] escaping quotes

John Holmes wrote:
 print(value=\ . $attributes[messageSubject] . \);

Slight typo there:

value=\ . ...

-- 
Like Music?
http://l-i-e.com/artists.htm

-- 
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] Web shopping cart

2005-01-27 Thread Richard Lynch
Rick Lim wrote:
 Can anyone recommend a freeware shopping card app in php?
 Thanks.

Years ago, when this question repeatedly generated flame-wars on this
list, I got fed up and built this:

http://l-i-e.com/compare/index.htm?date=1970-01-01

Dunno if anybody has voted recently...

If anybody wants to tell me any of those products are gone I'll take
them off, and get rid of the bogus features while I'm at it.

YMMV

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] regular expressions ?

2005-01-27 Thread Leif Gregory
Hello Zouari,

Thursday, January 27, 2005, 8:53:55 AM, you wrote:
Z doesnt work !
Z this is working fine :
Z if (eregi(^-?([1-3])+$,$x)
Z  echo x is 1 or 2 or 3;

Whoops. Sorry.. That's what I get for throwing out an answer while on
the run:

Try this:

?php

for ($x=0; $x  120; $x++)
{
  if (preg_match(/^([1-9]{1}|1[0-9]{1}|20)$/,$x))
echo It is!  . $i . br;
  else
echo It's not! . $i . br;
}

?

The for loop is just for show.


-- 
Leif (TB lists moderator and fellow end user).

Using The Bat! 3.0.2.3 Rush under Windows XP 5.1
Build 2600 Service Pack 2 on a Pentium 4 2GHz with 512MB

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



[PHP] mysql_pconnect / persistent database conections

2005-01-27 Thread Ben Edwards
Been meaning to investigate persistent database connections for a
while.  Coming from a rdbms background (oracle with a bit of whatcom
sqlanywhare) I have always felt that the overhead of opening a
connection at the beginning of each page was a little resource
intensive.

Anyway, I found mysql_pconnect and this sounds like just the ticket. 
Seems that I can just change my connect method from mysql_connect to
mysql_pconnect and it will just work.

I do have a couple of questions.  Firstly what is the story with
mysql_close.  There is no mysql_pclose.  I guess you don't need to
close the connection at the end of each page but what if you do.   Is
mysql_close ignored if the connection was made with mysql_pconnect or
douse it close the connection and next time mysql_pconnect is run it
reconnects causing no benefit over mysql_pconnect.  also what is the
timeout likely to be?

My other question is what happens if lots of people connect using the
same user/password.  I tend to do my own user management so everybody
douse.  Is doing my own user management really dodge, if we were
talking about oracle I would probably say it is.

Ben
-- 
Ben Edwards - Poole, UK, England
WARNING:This email contained partisan views - dont ever accuse me of
using the veneer of objectivity
If you have a problem emailing me use
http://www.gurtlush.org.uk/profiles.php?uid=4
(email address this email is sent from may be defunct)

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



Re: [PHP] set-time-limit

2005-01-27 Thread Richard Lynch
Wiberg wrote:
 why is it so that when I echo something to the screen then I can run the
 script for a longer time, than if I don't have echo? Don't get the
 logic...

Somewhere, deep in the guts of PHP, there is something not unlike this:

if (exceeded_time_limit()){
  trigger_error(Time limit exceeded., E_ERROR);
  exit;
}
process_next_php_instruction();

Now, sometimes, process_next_php_instruction() may be reduced to a very
very very simple tight loop in C or Assembler or byte-code or whatever you
care to think of it as.

Without the 'echo' in your code, PHP treats your code as an atomic unit to
be processed (including the loop) and never gives itself the opportunity
to break out with the test about time limit.

When you add the 'echo' statement, that gives PHP a chance to break in
to the tight loop and check the time on it, because now you've got TWO
instructions where before you only really had ONE.

PHP also doesn't count time spent in certain tasks, for reasons that are
not apparent to me, but some would probably boil down to That would be
really hard to do deep in the guts of the PHP code.

In some case, though, it's by design:  They're trying *NOT* to count it
against you if your database server takes forever to respond, or if your
fopen('http://...') takes forever to respond.

The purpose of the PHP php.ini time limit is to avoid an infinite loop in
your PHP script taking down the server, not a hard-and-fast absolute limit
on the number of seconds any given PHP script should live.

Or, in other words, the timing in PHP that decides when you've used up
to much cpu time is at a relatively high level of processing/language
interpretation, and only applies to actual PHP code being executed, not
down at the raw CPU timing level.

This has advantages and disadvantages, of course, but that's why it is the
way it is.

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] regular expressions ?

2005-01-27 Thread Richard Lynch
Zouari Fourat wrote:
 Robin :
   $i='2';
   if (preg_match('/^(20|1[0-9]|1-9])$/', $i)) {

You are missing a [ before the 1-9 in after the last |

The regex WILL work if you type it correctly :-)

-- 
Like Music?
http://l-i-e.com/artists.htm

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



[PHP] Vars with flash

2005-01-27 Thread Carolina Silva
Hello everybody!

This might be a dumb question but i'm having a bit of trouble here:

I'm making a contact form in flash MX: the swf sends a string with the
variables through a loadVariables function. The string is read by a php
file. All the vars get their value through a $HTTP_POST_VARS [] function and
are sent to an email.

The thing is that the special characters such as ñ or á are changed. If I
write méxico id the swf file... the php send the email with the value
méxico. Can someone please tell what can I do to fix this?


Thanks for your help,
Carolina

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



[PHP] Ming - php sync problem?

2005-01-27 Thread John Coppens
Hi all.

I have simple page that generates a simple flash with some random images,
then publishes it - on the same page. If I do this, i regularly have
several kinds of problems, one of them, an error message like:

getimagesize(img/topmovie/toplogo.swf): failed to open stream: No such
file or directory

or the size getimagesize reports isn't the correct one.

If I only _call_ the swf (no generation), the message isn't there and
things look more normal.

Is the swf generation an asynchronous process and do I have to wait until
the  movie-save(xxx) finishes?

Thanks for suggestions
John

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



Re: [PHP] ftp_put and ftp_fput both failing me

2005-01-27 Thread Wayne Zeller
Marek Kilimajer wrote:
You must use ftp_fput() because you are using open file handle.
Check that tmpfile() did not fail. Then make sure you are in the right 
directory after logging in the ftp server.
That's what I get for trying to put together code for my post during 
attempts to do it several different ways. I ended up posting code that 
was a hybrid of when I tried it using the file name with ftp_put and 
when I used a file handle with ftp_fput.

The exact same code that I posted, but with ftp_fput instead of ftp_put 
gives the same results.

The script takes about 30 seconds to run, and then reports its failure. 
 I've verified that the temp file is being created with the correct 
contents.

Getting this to work is pretty key for a project I'm working on, so if 
there's another way to do it, even if it's a harder way, I'm totally 
open to any suggestions.  :)

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


RE: [PHP] escaping quotes

2005-01-27 Thread Philip Olson

What also works is this:

 print 'value='. $foo['bar'] . '';

Read the manual section on strings:

 http://php.net/types.string

Regards,
Philip

On Thu, 27 Jan 2005, Giles wrote:

 Thanks, that works great.
 
 Knew that worked for JavaScript but didn't know it worked for PHP.
 
  print(value=\ . $attributes[messageSubject] . \);
 
 Slight typo there:
 
 value=\ . ...

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



[PHP] Re: read file from specific line

2005-01-27 Thread John Coppens
On Thu, 27 Jan 2005 15:15:48 +0100 (CET)
[EMAIL PROTECTED] wrote:

 Hi there!
 
 Is there any way reading a file from a specific line? (textfile)
 
 /G
 @varupiraten.se

Not directly - there's no way to know where the line starts, except
if they are all of the same length. Read the file, split it on \n's,
and then use it as an array.

John

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



Re: [PHP] mysql_pconnect / persistent database conections

2005-01-27 Thread Richard Lynch
Ben Edwards wrote:
 Been meaning to investigate persistent database connections for a
 while.  Coming from a rdbms background (oracle with a bit of whatcom
 sqlanywhare) I have always felt that the overhead of opening a
 connection at the beginning of each page was a little resource
 intensive.

Pretty much is the biggest time sink on most small/medium web-sites.

 Anyway, I found mysql_pconnect and this sounds like just the ticket.
 Seems that I can just change my connect method from mysql_connect to
 mysql_pconnect and it will just work.

Yes, but...

 I do have a couple of questions.  Firstly what is the story with
 mysql_close.  There is no mysql_pclose.  I guess you don't need to
 close the connection at the end of each page but what if you do.   Is
 mysql_close ignored if the connection was made with mysql_pconnect or
 douse it close the connection and next time mysql_pconnect is run it
 reconnects causing no benefit over mysql_pconnect.  also what is the
 timeout likely to be?

mysql_close() will almost-for-sure just ignore you if you are silly enough
to close a _pconnect() opening.

Not sure which timeout you are referring to, though...

There are several timeouts you could be asking about...

You can safely assume that the default timeouts are okay for MOST sites.

 My other question is what happens if lots of people connect using the
 same user/password.  I tend to do my own user management so everybody
 douse.  Is doing my own user management really dodge, if we were
 talking about oracle I would probably say it is.

Essentially, using _pconnect() boils down to having ONE connection for
each Apache process using the same user/pass.

Or, if you have shell users, add them in as well.

Make damn sure your /etc/my.cnf setting has a limit with a few MORE
connections than your httpd.conf has for number of Apache children.

Maybe even add a comment to that effect in both places (my.cnf and
httpd.conf), so any goofball changing either configuration file knows what
not to do.

Less MySQL connections than Apache children means some Apache children
will be starved for db, and after very short time-out waiting for db, will
just puke and die on you.

Leave a few EXTRA mysql connections, so a run-away Apache/MySQL/query
problem leaves *YOU* with the ability to log in from shell with mysql
monitor or mysqladmin to diagnose/fix/kill the thing.

Otherwise, you have to bring down all of Apache to get into your database,
if you even can, with, say, a runaway MySQL query tying up the db, and
Apache patiently waiting for that and refusing to die on anything less
than kill -9 because it's busy...

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] Re: read file from specific line

2005-01-27 Thread John Nichel
John Coppens wrote:
On Thu, 27 Jan 2005 15:15:48 +0100 (CET)
[EMAIL PROTECTED] wrote:

Hi there!
Is there any way reading a file from a specific line? (textfile)
/G
@varupiraten.se

Not directly - there's no way to know where the line starts, except
if they are all of the same length. Read the file, split it on \n's,
and then use it as an array.
The file() function will do this.
http://us4.php.net/file
--
John C. Nichel
ÜberGeek
KegWorks.com
716.856.9675
[EMAIL PROTECTED]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] ftp_put and ftp_fput both failing me

2005-01-27 Thread Marek Kilimajer
Wayne Zeller wrote:
Marek Kilimajer wrote:
You must use ftp_fput() because you are using open file handle.
Check that tmpfile() did not fail. Then make sure you are in the right 
directory after logging in the ftp server.

That's what I get for trying to put together code for my post during 
attempts to do it several different ways. I ended up posting code that 
was a hybrid of when I tried it using the file name with ftp_put and 
when I used a file handle with ftp_fput.

The exact same code that I posted, but with ftp_fput instead of ftp_put 
gives the same results.

The script takes about 30 seconds to run, and then reports its failure. 
 I've verified that the temp file is being created with the correct 
contents.
30 seconds? This must be your firewall blocking connections from outside 
world. Use ftp_pasv() to turn on passive mode.

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


Re: [PHP] Ming - php sync problem?

2005-01-27 Thread Richard Lynch
John Coppens wrote:
 I have simple page that generates a simple flash with some random images,
 then publishes it - on the same page. If I do this, i regularly have
 several kinds of problems, one of them, an error message like:

 getimagesize(img/topmovie/toplogo.swf): failed to open stream: No such
 file or directory

 or the size getimagesize reports isn't the correct one.

 If I only _call_ the swf (no generation), the message isn't there and
 things look more normal.

You have PHP configured to dump error messages out to the browser, which
in the first case is where you are sending out the SWF, so they get all
muddled together.

Change your php.ini to send error messages somewhere else, and get in the
habit of checking that somewhere else when you code.

My errors all go to Apache error_log, so I just to tail -f error_log

 Is the swf generation an asynchronous process and do I have to wait until
 the  movie-save(xxx) finishes?

It's possible that you could manage to write several scripts that would be
trying to read/write the same SWF file, and movie-save(xxx) would only be
half-finished writing the file when your other script was reading, and the
reading script would time-out waiting for the writing script...

But you'd probably have to really work at it to make that all happen...

It has NOTHING to do with your current problem of having error output
mixed in with the Flash content though, so for your current purposes, you
can safely assume that the process is synchronous -- The movie will get
totally saved before you send it to the browser, assuming you have PHP
code that does those things in order:

?php
.
.
.
$movie-save(xxx);
header(Content-type: application/swf);
readfile(xxx);
?

or something similar is synchronous.

If you're doing $movie-save(xxx) in one script, and reading xxx from some
different script, all bets are off, though it will USUALLY work because
the -save(xxx) will end up being atomic mostly sorta...  Not TRULY
atomic, depending on the size of the SWF and other factors, but ...

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] Ming - php sync problem?

2005-01-27 Thread John Coppens
On Thu, 27 Jan 2005 10:54:18 -0800 (PST)
[EMAIL PROTECTED] (Richard Lynch) wrote:

 Change your php.ini to send error messages somewhere else, and get in
 the habit of checking that somewhere else when you code.

Thanks for the hint

 It has NOTHING to do with your current problem of having error output
 mixed in with the Flash content though, so for your current purposes,

No - I didn't worry about the fact the messages were there - just the
flash problem

 $movie-save(xxx);
 header(Content-type: application/swf);
 readfile(xxx);
 ?

You are right, of course. I made a mistake in my script. Your error hint
was welcome though.

Thanks.
John

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



[PHP] background process

2005-01-27 Thread mbneto
Hi,

I'd like to create a script that will act as a daemon.

Now I simply add while() {  do stuff }

But this forces me to call it script.php .  Is there a way to make
this work without the 

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



Re: [PHP] regular expressions ?

2005-01-27 Thread Rick Fletcher
Robin Vickery wrote:
On Thu, 27 Jan 2005 16:56:05 +0100, Zouari Fourat [EMAIL PROTECTED] wrote:
this is working fine :
if (eregi(^-?([1-3])+$,$x)
echo x is 1 or 2 or 3;
i forgot to say that doesnt work with 1-20 :(
how to do it ?

if (preg_match('/^(20|1[0-9]|1-9])$/', $candidate)) {
   // $candidate is a decimal integer between 1 and 20 inclusive with
no leading zeros.
}
/^(1?[1-9]|[12]0)$/ works too.  The first part covers 1-9, 11-19; the 
second part gets you 10 and 20.

Plus, it's ever so slightly shorter!  And isnt' that what's most 
important? :P

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


Re: [PHP] regular expressions ?

2005-01-27 Thread Leif Gregory
Hello Rick,

Thursday, January 27, 2005, 12:36:39 PM, you wrote:
R /^(1?[1-9]|[12]0)$/ works too. The first part covers 1-9, 11-19;
R the second part gets you 10 and 20.

R Plus, it's ever so slightly shorter! And isnt' that what's most
R important? :P


Purty  :grin:


-- 
Leif (TB lists moderator and fellow end user).

Using The Bat! 3.0.2.3 Rush under Windows XP 5.1
Build 2600 Service Pack 2 on a Pentium 4 2GHz with 512MB

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



Re: [PHP] background process

2005-01-27 Thread Richard Lynch
mbneto wrote:
 I'd like to create a script that will act as a daemon.

 Now I simply add while() {  do stuff }

 But this forces me to call it script.php .  Is there a way to make
 this work without the 

You're probably better off using  when calling it, but:
http://php.net/pcntl_fork
and friends could do what you think you want...

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] Cannot connect to Database

2005-01-27 Thread Supersky
Dear Leif,

Thank you for your help. I have done what you told me to do. But it doesn't 
work.

Best,

Supersky
Leif Gregory [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]
 Hello Supersky,

 Thursday, January 27, 2005, 8:55:04 AM, you wrote:
 S But I cannot, and I see Fatal error: Call to undefined function
 S mysql_connect() in 

 1. Make sure you uncomment the extension=php_mysql.dll in your php.ini
 2. Copy the php_mysql.dll to your Windows/System folder
 3. Restart Apache.


 You might look at:

 ?php

 phpinfo();

 ?

 To see before and after (Look for the section on MySQL.)




 -- 
 Leif (TB lists moderator and fellow end user).

 Using The Bat! 3.0.2.3 Rush under Windows XP 5.1
 Build 2600 Service Pack 2 on a Pentium 4 2GHz with 512MB 

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



Re: [PHP] ftp_put and ftp_fput both failing me

2005-01-27 Thread Wayne Zeller
Marek Kilimajer wrote:
30 seconds? This must be your firewall blocking connections from outside 
world. Use ftp_pasv() to turn on passive mode.
That did the trick. Thanks s much!
Wayne
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Cannot connect to Database

2005-01-27 Thread Leif Gregory
Hello Supersky,

Thursday, January 27, 2005, 1:37:12 PM, you wrote:
S Thank you for your help. I have done what you told me to do. But it
S doesn't work.

Does phpinfo(); output anything like below (except it looks prettier!
:grin: )?

mysql
MySQL Support   enabled
Active Persistent Links 0
Active Links0
Client API version  4.1.7

Directive   Local Value Master Value
mysql.allow_persistent  On  On
mysql.connect_timeout   60  60
mysql.default_host  no valueno value
mysql.default_password  no valueno value
mysql.default_port  no valueno value
mysql.default_socketno valueno value
mysql.default_user  no valueno value
mysql.max_links Unlimited   Unlimited
mysql.max_persistentUnlimited   Unlimited
mysql.trace_modeOff Off


If you don't see that in the phpinfo(); output, then it didn't get
loaded correctly.


Hmmm. It's been a bit since I've installed PHP. Find libmysql.dll and
dump that in your windows/system folder too.

See:
http://php.mirrors.powertrip.co.za/manual/en/install.windows.extensions.php

However, I checked my system folder and I do not have that one in
there. It might be pulling it from my path somewhere though. I'll have
to check when I get home.


-- 
Leif (TB lists moderator and fellow end user).

Using The Bat! 3.0.2.3 Rush under Windows XP 5.1
Build 2600 Service Pack 2 on a Pentium 4 2GHz with 512MB

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



Re: [PHP] Cannot connect to Database

2005-01-27 Thread Richard Lynch
Supersky wrote:
 Thank you for your help. I have done what you told me to do. But it
 doesn't
 work.

Are you seeing the same error message, or is it not working in a different
way?

If it's the same way:

1. Did you restart Apache?
2. What does ?php phpinfo()? say about php.ini?
3. What does ?php phpinfo()? say about MySQL?

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] Compiling PHP 4.3.3 with large file support

2005-01-27 Thread Jon
Ok, I am using Apache 2.0.51, and PHP 4.3.8.  I compiled both srpms with
the -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 added to the CFLAGS.
Attached is the last few lines of an strace httpd -X.  Compiling without
these flags works fine.

##  strace
###
brk(0)  = 0x80119000
brk(0x8013a000) = 0x8013a000
fcntl64(8, F_GETFL) = 0x2 (flags O_RDWR)
fcntl64(8, F_SETFL, O_RDWR|O_NONBLOCK)  = 0
read(8, 0x801194d8, 8000)   = -1 EAGAIN (Resource
temporarily unavailable)
poll([{fd=8, events=POLLIN, revents=POLLIN}], 1, 30) = 1
read(8, GET /index.php HTTP/1.1\r\nHost: t..., 8000) = 784
gettimeofday({1106860629, 791325}, NULL) = 0
stat64(/var/www/html/index.php, {st_mode=S_IFREG|0744,
st_size=24699, ...}) = 0
open(/var/www/html/index.php, O_RDONLY) = 9
read(9, ?php\r\n\r\n/**..., 4096) = 4096
close(9)= 0
getpid()= 21659
open(/var/www/html/index.php, O_RDONLY) = 9
gettimeofday({1106860629, 792560}, NULL) = 0
--- SIGSEGV (Segmentation fault) @ 0 (0) ---
+++ killed by SIGSEGV +++


On Thu, 2005-01-27 at 12:45 +0100, Marek Kilimajer wrote:
 Jon wrote:
  I'm running Fedora Core 1, all packages up to date.  I want to add large
  file support to php.  I downloaded the source rpm. Added
  -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 to CFLAGS in the spec file,
  rebuilt the rpm and installed it.  Apache starts fine but I get
  [notice] child pid  exit signal Segmentation fault (11) when ever
  I request a page.  Compiling the same source without those flags works
  fine.  I must be missing something, but I am in way over my head.  Can
  someone tell me what I am doing wrong?
  
 
 You did not mention your apache version and php setup (mod_php vs. cgi)
 IMHO if you are using mod_php, both apache and php must be compiled with 
 the same _FILE_OFFSET_BITS or you get segmen. fault. LFS is available on 
   for apache 2.X only. CGI should not be affected as it's another process.
 

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



Re: [PHP] Ming - php sync problem?

2005-01-27 Thread Marek Kilimajer
John Coppens wrote:
Hi all.
I have simple page that generates a simple flash with some random images,
then publishes it - on the same page. If I do this, i regularly have
several kinds of problems, one of them, an error message like:
getimagesize(img/topmovie/toplogo.swf): failed to open stream: No such
file or directory
or the size getimagesize reports isn't the correct one.
If I only _call_ the swf (no generation), the message isn't there and
things look more normal.
Is the swf generation an asynchronous process and do I have to wait until
the  movie-save(xxx) finishes?
If you checked for existance of the flash file before it is created you 
need to call clearstatcache() to make php realize it is existing.

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


Re: [PHP] Cannot connect to Database

2005-01-27 Thread Supersky
Hello Richard,

1. I restarted Apache.
2. ?php phpinfo()? say D:\WINDOWS.
3. ?php phpinfo()? say  nothing about MySQL.

Thanks,

Supersky

Richard Lynch [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]
 Supersky wrote:
 Thank you for your help. I have done what you told me to do. But it
 doesn't
 work.

 Are you seeing the same error message, or is it not working in a different
 way?

 If it's the same way:

 1. Did you restart Apache?
 2. What does ?php phpinfo()? say about php.ini?
 3. What does ?php phpinfo()? say about MySQL?

 -- 
 Like Music?
 http://l-i-e.com/artists.htm 

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



Re: [PHP] Cannot connect to Database

2005-01-27 Thread Supersky
Hello Leif,

There is nothing about mysql on the information page. Thanks for your link 
and I am reading it.

Thanks,

Supersky
Leif Gregory [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]
 Hello Supersky,

 Thursday, January 27, 2005, 1:37:12 PM, you wrote:
 S Thank you for your help. I have done what you told me to do. But it
 S doesn't work.

 Does phpinfo(); output anything like below (except it looks prettier!
 :grin: )?

 mysql
 MySQL Support   enabled
 Active Persistent Links 0
 Active Links0
 Client API version  4.1.7

 Directive   Local Value Master Value
 mysql.allow_persistent  On  On
 mysql.connect_timeout   60  60
 mysql.default_host  no valueno value
 mysql.default_password  no valueno value
 mysql.default_port  no valueno value
 mysql.default_socketno valueno value
 mysql.default_user  no valueno value
 mysql.max_links Unlimited   Unlimited
 mysql.max_persistentUnlimited   Unlimited
 mysql.trace_modeOff Off


 If you don't see that in the phpinfo(); output, then it didn't get
 loaded correctly.


 Hmmm. It's been a bit since I've installed PHP. Find libmysql.dll and
 dump that in your windows/system folder too.

 See:
 http://php.mirrors.powertrip.co.za/manual/en/install.windows.extensions.php

 However, I checked my system folder and I do not have that one in
 there. It might be pulling it from my path somewhere though. I'll have
 to check when I get home.


 -- 
 Leif (TB lists moderator and fellow end user).

 Using The Bat! 3.0.2.3 Rush under Windows XP 5.1
 Build 2600 Service Pack 2 on a Pentium 4 2GHz with 512MB 

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



Re: [PHP] Cannot connect to Database

2005-01-27 Thread Richard Lynch
Supersky wrote:
 2. ?php phpinfo()? say D:\WINDOWS.

And is your php.ini file in D:\WINDOWS?

Cuz if it ain't, PHP ain't reading it.

-- 
Like Music?
http://l-i-e.com/artists.htm

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



[PHP] in need of php code for user management/admin function...

2005-01-27 Thread Bruce Douglas
hi...

i'm looking for 'open source' code that can be used in a website for handling 
user registration, user admin functions... does anybody know of a good set of 
functions that can provide this kind of feature set. or, can anybody give me 
opinions regarding apps that you've used that have had this kind of 
functionality...

as long as the code is open source, i can rip out/recode the functionality that 
i'm looking for...

i'm looking for something that would be mysql based, with the ability to allow 
users to register/login, and have an admin function that allows the admin to 
deny/enable/disable users, as well as track various attributes within the 
site...

if i have the basic shell/structure, i can modify the code to my needs.. 

comments/criticisms/thoughts...

thanks

bruce
[EMAIL PROTECTED]

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



[PHP] in need of php code for user management/admin function...

2005-01-27 Thread The Disguised Jedi
osCommerce handles it pretty well, but a lot of the data doesn't go
through much sanitization, so it can fall victim to SQL code
injection

www.oscommerce.com


On Thu, 27 Jan 2005 16:16:51 -0800 (PST), Bruce Douglas
[EMAIL PROTECTED] wrote:
 hi...

 i'm looking for 'open source' code that can be used in a website for handling 
 user registration, user admin functions... does anybody know of a good set of 
 functions that can provide this kind of feature set. or, can anybody give me 
 opinions regarding apps that you've used that have had this kind of 
 functionality...

 as long as the code is open source, i can rip out/recode the functionality 
 that i'm looking for...

 i'm looking for something that would be mysql based, with the ability to 
 allow users to register/login, and have an admin function that allows the 
 admin to deny/enable/disable users, as well as track various attributes 
 within the site...

 if i have the basic shell/structure, i can modify the code to my needs..

 comments/criticisms/thoughts...

 thanks

 bruce
 [EMAIL PROTECTED]

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




--
The Disguised Jedi
[EMAIL PROTECTED]

PHP rocks!
Knowledge is Power.  Power Corrupts.  Go to school, become evil

Disclaimer: Any disclaimer attached to this message may be ignored.
This message is Certified Virus Free


-- 
The Disguised Jedi
[EMAIL PROTECTED]

PHP rocks!
Knowledge is Power.  Power Corrupts.  Go to school, become evil

Disclaimer: Any disclaimer attached to this message may be ignored.
This message is Certified Virus Free

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



Re: [PHP] Cannot connect to Database

2005-01-27 Thread Supersky
Hello Richard,

I've added my PHP folder to the system path. I think this can do the same as 
putting in in D:\windows. My problem has been solved.

Thank you very much.

Gan
Richard Lynch [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]
 Supersky wrote:
 2. ?php phpinfo()? say D:\WINDOWS.

 And is your php.ini file in D:\WINDOWS?

 Cuz if it ain't, PHP ain't reading it.

 -- 
 Like Music?
 http://l-i-e.com/artists.htm 

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



Re: [PHP] Cannot connect to Database

2005-01-27 Thread Supersky
Hello Leif,

I've solved my problem. Thanks!

Supersky
Supersky [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]
 Hello Leif,

 There is nothing about mysql on the information page. Thanks for your link 
 and I am reading it.

 Thanks,

 Supersky
 Leif Gregory [EMAIL PROTECTED] wrote in message 
 news:[EMAIL PROTECTED]
 Hello Supersky,

 Thursday, January 27, 2005, 1:37:12 PM, you wrote:
 S Thank you for your help. I have done what you told me to do. But it
 S doesn't work.

 Does phpinfo(); output anything like below (except it looks prettier!
 :grin: )?

 mysql
 MySQL Support   enabled
 Active Persistent Links 0
 Active Links0
 Client API version  4.1.7

 Directive   Local Value Master Value
 mysql.allow_persistent  On  On
 mysql.connect_timeout   60  60
 mysql.default_host  no valueno value
 mysql.default_password  no valueno value
 mysql.default_port  no valueno value
 mysql.default_socketno valueno value
 mysql.default_user  no valueno value
 mysql.max_links Unlimited   Unlimited
 mysql.max_persistentUnlimited   Unlimited
 mysql.trace_modeOff Off


 If you don't see that in the phpinfo(); output, then it didn't get
 loaded correctly.


 Hmmm. It's been a bit since I've installed PHP. Find libmysql.dll and
 dump that in your windows/system folder too.

 See:
 http://php.mirrors.powertrip.co.za/manual/en/install.windows.extensions.php

 However, I checked my system folder and I do not have that one in
 there. It might be pulling it from my path somewhere though. I'll have
 to check when I get home.


 -- 
 Leif (TB lists moderator and fellow end user).

 Using The Bat! 3.0.2.3 Rush under Windows XP 5.1
 Build 2600 Service Pack 2 on a Pentium 4 2GHz with 512MB 

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



[PHP] Re: Cannot connect to Database

2005-01-27 Thread Supersky
Thank all of you who helped me. My problem has been solved.

Supersky


Supersky [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]
 Hello,

 I'm using the following statements to connect to a database.

 ?php $conn = mysql_connect('localhost', 'root', '') or die (Can't 
 Connect To
 Database);
 $db = mysql_select_db(testDB, $conn) or die (Can't Select Database. 
 mysql_error()); ?

 But I cannot, and I see  Fatal error: Call to undefined function 
 mysql_connect() in 

 My OS is WinXP, I have installed Mysql 4.1, Apache 2.0.52, and PHP 5.03. 
 Apache and PHP work well if I don't connect to a database.

 Please any help or suggestions are welcome. Thanks!

 Gan 

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



[PHP] mail problem at interland

2005-01-27 Thread David Edwards
Hi,

I have a fairly simple script written that uses the mail() function on a 
client site hosted at Interland. I have used a similar script quite a few 
times before with no problem. However although the script generates no 
errors, no emails appear at their intended destination. Interland support 
has not been that helpful and they did suggest I try the '-f' option in the 
header. That did not work either. Has anyone seen this before, I am running 
out of ideas. The mail portion of the script is below:

$headers .= MIME-Version: 1.0\n;
$headers .= Content-type: text/plain; charset=iso-8859-1\n;
$headers .= X-Priority: 1\n;
$headers .= X-MSMail-Priority: High\n;
$headers .= X-Mailer: php\n;
$headers .= From: $emailfrom\n;

$mailsent = mail($emailto, $subject, $msg, $headers,-f . $emailfrom);

Any help would be MUCH appreciated.



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



[PHP] Developer needed in London

2005-01-27 Thread Underodog H.R.
Sorry for using the list in this way, wont happen again.

PLEASE DON¹T REPLY TO THIS MESSAGE THROUGH THE LIST RESPOND DIRECT TO
[EMAIL PROTECTED]

Job Opportunity:

Web Developer/Designer In-house in London (not outsourced).
A great opportunity to join a young vibrant company working on exciting high
profile projects. Would suit recent graduates and experienced pro's alike. A
strong background in web technologies and programming is essential, good
working knowledge of; D/HTML, PHP, MySQL is necessary, other technologies
(Flash etc) are a bonus. Please apply by sending your CV to
[EMAIL PROTECTED]

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



[PHP] getid3

2005-01-27 Thread Daniel Lahey
I found a really great utility for getting info on music files that I 
thought I'd share.  Here's the info:

/
/// getID3() by James Heinrich [EMAIL PROTECTED]   //
//  available at http://getid3.sourceforge.net //
//or http://www.getid3.org///
/
Very cool stuff.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] [NEWBIE] Trying to create a function from an existing script

2005-01-27 Thread Dave
Marek, Mark,
   Thanks for the advice. I've added global $HTTP_POST_FILES; into my 
function, and it is working.
I'd also like to follow Marek's advice to modify my script, as it 
sounds like it helps to make it more secure. However, I don't think I'm 
using the syntax right. I changed:

if( 
copy($HTTP_POST_FILES['upfile']['tmp_name'],$store_dir.$HTTP_POST_FILES['upfile']['name'])

to
if ( move_uploaded_file($HTTP_POST_FILES[$name]['tmp_name'], $store_dir 
. basename($HTTP_POST_FILES[$name]['name']) )

... because I looked up move_upload_file() in the manual, and it says it 
will return FALSE if it fails, so I thought I could encase it in an if() 
statement. But it's always returning false and not uploading the file. 
Have I got it wroing?

--
Dave Gutteridge
[EMAIL PROTECTED]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] [NEWBIE] Trying to create a function from an existing script

2005-01-27 Thread Josip Dzolonga
On Fri, 2005-01-28 at 14:41 +0900, Dave wrote:
 if ( move_uploaded_file($HTTP_POST_FILES[$name]['tmp_name'], $store_dir 
 . basename($HTTP_POST_FILES[$name]['name']) )

Try echoing $store_dir . basename($HTTP_POST_FILES[$name]['name'] before
uploading the file (before the move_uploaded_file function). It might
_NOT_ contain a slash between $store_dir and
$HTTP_POST_FILES[$name]['name'].
 
-- 
Josip Dzolonga,
dzolonga at mt dot net dot mk

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



Re: [PHP] [NEWBIE] Trying to create a function from an existing script

2005-01-27 Thread Jon
basename is looking for a file and $HTTP_POST_FILES[$name]['name'] is
not a valid path to a file.

Something like this should work

if(move_uploaded_file($_HTTP_POST_FILES['upfile']['tmp_name'],
rawurlencode($store_dir.$HTTP_POST_FILES['upfile']['name']))
On Fri, 2005-01-28 at 14:41 +0900, Dave wrote:
 Marek, Mark,
 Thanks for the advice. I've added global $HTTP_POST_FILES; into my 
 function, and it is working.
  I'd also like to follow Marek's advice to modify my script, as it 
 sounds like it helps to make it more secure. However, I don't think I'm 
 using the syntax right. I changed:
 
 if( 
 copy($HTTP_POST_FILES['upfile']['tmp_name'],$store_dir.$HTTP_POST_FILES['upfile']['name'])
 
 to
 
 if ( move_uploaded_file($HTTP_POST_FILES[$name]['tmp_name'], $store_dir 
 . basename($HTTP_POST_FILES[$name]['name']) )
 
 ... because I looked up move_upload_file() in the manual, and it says it 
 will return FALSE if it fails, so I thought I could encase it in an if() 
 statement. But it's always returning false and not uploading the file. 
 Have I got it wroing?
 
 -- 
 Dave Gutteridge
 [EMAIL PROTECTED]
 

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



Re: [PHP] mail problem at interland

2005-01-27 Thread Jason Wong
On Friday 28 January 2005 10:09, David Edwards wrote:

 I have a fairly simple script written that uses the mail() function on a
 client site hosted at Interland. I have used a similar script quite a few
 times before with no problem. However although the script generates no
 errors, no emails appear at their intended destination. Interland support
 has not been that helpful and they did suggest I try the '-f' option in the
 header. That did not work either. Has anyone seen this before, I am running
 out of ideas. The mail portion of the script is below:

 $headers .= MIME-Version: 1.0\n;
 $headers .= Content-type: text/plain; charset=iso-8859-1\n;
 $headers .= X-Priority: 1\n;
 $headers .= X-MSMail-Priority: High\n;
 $headers .= X-Mailer: php\n;
 $headers .= From: $emailfrom\n;

 $mailsent = mail($emailto, $subject, $msg, $headers,-f . $emailfrom);

1) Use the proper delimiters between headers -- \r\n
2) Check your mailserver logs

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
--
New Year Resolution: Ignore top posted posts

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



Re: [PHP] mysql_pconnect / persistent database conections

2005-01-27 Thread Steve Slater
At 10:43 AM 1/27/2005, Richard Lynch wrote:
Ben Edwards wrote:
 Been meaning to investigate persistent database connections for a
 while.  Coming from a rdbms background (oracle with a bit of whatcom
 sqlanywhare) I have always felt that the overhead of opening a
 connection at the beginning of each page was a little resource
 intensive.
The mysql_pconnect() function should work well to solve the wasted
resource/overhead you describe.
But you should be aware that the pconnect function does not exist
in the mysqli set of PHP functions. The mysqli functions allow you to
access newer features of MySQL 4.1 and higher...like prepared statements.
Here is the blurb from Zend:
http://www.zend.com/php5/articles/php5-mysqli.php#fn1
Steve
--
Steve Slater
[EMAIL PROTECTED]
Information Security Training and Consulting
PHP / MySQL / Web App Security (LAMP) Training:
http://www.handsonsecurity.com/training.html
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] [NEWBIE] Trying to create a function from an existing script

2005-01-27 Thread Dave
Jon,
   Thanks for responding. Unfortunately, it still doesn't work. I tried 
it exactly as you wrote, and it still gives me the message that it 
failed to upload.
   Also, I actually want to force a name change to the file, so that 
regardless of what the name of the file uploaded is, it gets changed to 
imagefile.jpg. I did try it exactly as you suggested, and it didn't 
work so I think there is something else I'm doing wrong. But I thought I 
should mention now that I want to impose my own name on the file, to 
save confusion later.

   Here is the whole if() statement:
if(move_uploaded_file($_HTTP_POST_FILES['upfile']['tmp_name'],rawurlencode($store_dir. 
imagefile.jpg)))
{
  echo(Uploaded .$HTTP_POST_FILES['upfile']['name']. successfully.);
}
// If the copy function fails output a message.
else
{
  echo(Upload of .$HTTP_POST_FILES['upfile']['name']. to 
.$store_dir. failed.);
}

--
Dave Gutteridge
[EMAIL PROTECTED]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] [NEWBIE] Trying to create a function from an existing script

2005-01-27 Thread Jon
Dave,
Does  $store_dir end with a slash? Is it writable by apache?  What do
your log files reveal?  What is the output of the script?
On Fri, 2005-01-28 at 15:18 +0900, Dave wrote:
 Jon,
 Thanks for responding. Unfortunately, it still doesn't work. I tried 
 it exactly as you wrote, and it still gives me the message that it 
 failed to upload.
 Also, I actually want to force a name change to the file, so that 
 regardless of what the name of the file uploaded is, it gets changed to 
 imagefile.jpg. I did try it exactly as you suggested, and it didn't 
 work so I think there is something else I'm doing wrong. But I thought I 
 should mention now that I want to impose my own name on the file, to 
 save confusion later.
 
 Here is the whole if() statement:
 
 if(move_uploaded_file($_HTTP_POST_FILES['upfile']['tmp_name'],rawurlencode($store_dir.
  
 imagefile.jpg)))
 {
echo(Uploaded .$HTTP_POST_FILES['upfile']['name']. successfully.);
 }
 // If the copy function fails output a message.
 else
 {
echo(Upload of .$HTTP_POST_FILES['upfile']['name']. to 
 .$store_dir. failed.);
 }
 

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



  1   2   >