[PHP] Problems with imagecreatefromjpeg ?

2003-09-29 Thread Darren Gamble
Good day,

I'm having a problem working with an image that I've made with
imagecreatefromjpeg.  Here's the code:


$in_file = IMG_0050.jpg;
echo Testing for image .$in_file.BR /\n;
$image = imagecreatefromjpeg($in_file) || die(Failed to create image from
file.
BR\n);
echo Resource ID: .$image.BR\n;
echo Image width: .imagesx($image).BR\n;


It reads in the file OK and prints out 1 as the Resource ID, as expected.
However, imagesx fails with:

imagesx(): supplied argument is not a valid Image resource in
the_program_location on line 9


The resource ID was returned from imagecreatefromjpeg, so, I have no idea
why it's not valid.  The image in question displays fine in Mozilla, etc,
if that matters at all- and it's also a fairly large image, if that matters
at all too.  Other PHP functions that work with the image resource fail in
the same way.

This is on 4.3.3 / FreeBSD 5.1, built from the ports collection .  I have
also tried this on Red Hat 9, with a similar failure.

Here's my phpinfo()'s configure:

'./configure' '--enable-versioning' '--enable-memory-limit'
'--with-layout=GNU' '--with-zlib-dir=/usr' '--disable-all'
'--with-regex=php' '--disable-cli' '--with-apxs2=/usr/local/sbin/apxs'
'--with-bz2=/usr' '--enable-calendar' '--enable-ctype'
'--with-curl=/usr/local' '--enable-dba' '--with-dom=/usr/local'
'--with-dom-xslt=/usr/local' '--with-dom-exslt=/usr/local' '--enable-exif'
'--enable-ftp' '--with-gd' '--enable-gd-native-ttf' '--enable-gd-jis-conv'
'--with-freetype-dir=/usr/local' '--with-jpeg-dir=/usr/local'
'--with-png-dir=/usr/local' '--with-xpm-dir=/usr/local'
'--with-gdbm=/usr/local' '--with-gettext=/usr/local'
'--with-iconv=/usr/local' '--with-imap=/usr/local'
'--with-imap-ssl=/usr/local' '--with-inifile' '--enable-mbstring'
'--enable-mbregex' '--with-mcal=/usr/local' '--with-mcrypt=/usr/local'
'--with-mhash=/usr/local' '--with-mime-magic=/usr/share/misc/magic.mime'
'--with-mysql=/usr/local' '--with-ncurses=/usr' '--with-ldap=/usr/local'
'--with-openssl=/usr' '--enable-overload' '--with-pcre-regex=yes'
'--enable-posix' '--with-pspell=/usr/local' '--with-readline'
'--enable-session' '--enable-sockets' '--enable-tokenizer' '--enable-xml'
'--with-expat-dir=/usr/local' '--with-xmlrpc' '--enable-xslt'
'--with-xslt-sablot=/usr/local' '--with-zip=/usr/local' '--with-zlib=yes'
'--prefix=/usr/local' 'i386-portbld-freebsd5.1'


I have a feeling that I am missing something simple, but I don't know what
it could be.  I didn't find anything in the mailing list archives, and
Googling for the error message just shows pages and pages of actual broken
web pages.

Thanks in advance for any help,


Darren Gamble
Planner, Regional Services
Shaw Cablesystems GP
630 - 3rd Avenue SW
Calgary, Alberta, Canada
T2P 4L4
(403) 781-4948

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



[PHP] Problems with php.net

2003-01-28 Thread Darren Gamble
Good day,

This is a bit off-topic for the list, but, I'm not sure where else I can
send this.

The search function on php.net appears to be broken.  One can search
through the function list, but any query via whole site or online
documentation returns no results.

I tried to send a message to [EMAIL PROTECTED], the address posted on the
site for this sort of thing.  However, my message eventually bounces back to
me, with the php.net qmail deamon stating that it can not confirm that my
address was valid.  I presume that there is some sort of system that replies
to me to confirm that my return address is valid, but this also appears to
be broken, as no such e-mail is ever received.

If anyone can pass this along, or even suggest where this could be sent,
that would be great.  This problem has been present for a couple of weeks
now, at least.

Thanks,


Darren Gamble
Planner, Regional Services
Shaw Cablesystems GP
630 - 3rd Avenue SW
Calgary, Alberta, Canada
T2P 4L4
(403) 781-4948

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




[PHP] PHP socket connections with SSL

2002-10-08 Thread Darren Gamble

Good day,

I'm trying to create a PHP app to connect to a remote port that uses SSL.

According to the documentation for fsockopen() ...



As of PHP 4.3.0, if you have compiled in OpenSSL support, you may prefix the
hostname with either 'ssl://' or 'tls://' to use an SSL or TLS client
connection over TCP/IP to connect to the remote host. 



I don't see a 4.3.0 version available for download.  The CVS changelog
refers to a 4_3 branch someplace, so I presume I could get this feature by
compiling from CVS, but there are a number of other applications that
upgrading could break so I'd like to try to avoid using CVS if possible.

Is there any other way to do this via PHP, other than calling stunnel via a
shell command and using fsockopen to the unencrypted endpoint?  I have
Googled and searched though the PHP site, but I haven't come up with
anything else.

I don't need to supply a client certificate, if that helps any...

Thanks in advance,


Darren Gamble
Planner, Regional Services
Shaw Cablesystems GP
630 - 3rd Avenue SW
Calgary, Alberta, Canada
T2P 4L4
(403) 781-4948


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




RE: [PHP] Agh! trim (#$@#@^%!!!)

2002-08-21 Thread Darren Gamble

Good day,

Well, for one, you are discarding the results of trim().

Check out the online manual page for trim().  The trim'ed string is
returned.  It does not say it modifies the string it is passed.


Darren Gamble
Planner, Regional Services
Shaw Cablesystems GP
630 - 3rd Avenue SW
Calgary, Alberta, Canada
T2P 4L4
(403) 781-4948


 -Original Message-
 From: Mike At Spy [mailto:[EMAIL PROTECTED]]
 Sent: Wednesday, August 21, 2002 7:12 AM
 To: [EMAIL PROTECTED]
 Subject: RE: [PHP] Agh! trim (#$@#@^%!!!)
 
 
 
 Here is the complete code - I have a lot of prints to watch 
 things as they
 happen. $whois is the result of a WHOIS search.
 
 
 
 // beginning of my stuff
 
 function get_date ($whois){
 trim ($whois);
 $whoisarray = explode (\n, $whois);
 print_r(array_values ($whoisarray));
 
 $total_elements = count ($whoisarray);
 
 print pb$total_elements/b elements in this array;
 
 $ce = 0;
 
 while ($ce  $total_elements){
 
   $single_line = array_pop ($whoisarray);
 
   $expiration = strstr ($single_line,xpires);
 
   if ($expiration != '' || 0) {
 
   print pbThis is the line you want!  Line $ce that sez:
 $single_line/bp;
 
   // $single_line = preg_replace (.,  , $single_line);
 
   $single_line = substr($single_line, 0, -2);
 
   //  $single_line = rtrim ($single_line, \t\s\n\r);
 
   $getdatearray = explode ( , $single_line);
   print_r(array_values ($getdatearray));
 
   $total_expire_elements = count ($getdatearray);
 
   print pbr.$total_expire_elements;
 
   $dc = 0;
 
   while ($dc  $total_expire_elements){
 
   $element = array_pop($getdatearray);
 
   $date_dash = strstr($element,-);
 
   if ($date_dash != '' || 0){
 
   print pbrFirst Detection 
 .$element;
 
   // $trimmed = rtrim ($element, \t.);
 
   print pbrLast print before 
 date function .$element;
 
   month_replace ($element);
 
   print pbrResult after function 
 .$element.pbr;
 
   $MySQLDate=date_validate($element);
   if (substr($MySQLDate, 0, 5)==Error) {
   // Insert Error Code if you want
   } else {
   // Insert Valid Date Code if you want
   }
 
   print pThe MySQL Formated date is 
 $MySQLDate;
 
   
   }
   else {}
 
   $dc++;
 
}
 
   
   }
   else {}
 
   $ce++;
 
   }
 
 }
   // end of my stuff
 
 
 Thanks,
 
 -Mike
 
 
 
 
 
 
  -Original Message-
  From: Jason Wong [mailto:[EMAIL PROTECTED]]
  Sent: Wednesday, August 21, 2002 8:53 AM
  To: [EMAIL PROTECTED]
  Subject: Re: [PHP] Agh! trim (#$@#@^%!!!)
 
 
  On Wednesday 21 August 2002 20:36, Mike At Spy wrote:
   Get this - it didn't work!  :(
  
   I tried decreasing the -1 to -2 and so on, but nothing on that
  either.  :(
 
  Post your exact code which didn't work.
 
  --
  Jason Wong - Gremlins Associates - www.gremlins.com.hk
  Open Source Software Systems Integrators
  * Web Design  Hosting * Internet  Intranet Applications 
 Development *
 
  /*
  You can't go home again, unless you set $HOME.
  */
 
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 
 
 
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 

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




RE: [PHP] mcrypt

2002-08-01 Thread Darren Gamble

Good day,

 i started using crypt()
 
 then changed to mcrypt()
 
 which was not any good cause of the high ascii characters
 
 then i read about converting the high ascii characters to hex .
 
 Is this the ideal way to encrypt passwords or is their 
 something better.

The crypt() function will generate a standard UNIX crypt password that other
programs can understand.  UNIX crypt has some limitations (only using the
first 8 characters is the major one) but it's good enough for most people
and is probably the most widely supported.

If you want something stronger, you can use md5().  The examples on php's
documentation for this function should help you if you're interested in
having other programs use it (to have it the right format and length).


Darren Gamble
Planner, Regional Services
Shaw Cablesystems GP
630 - 3rd Avenue SW
Calgary, Alberta, Canada
T2P 4L4
(403) 781-4948

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




RE: [PHP] Is there a way?

2002-07-16 Thread Darren Gamble

Good day,

 In Perl you could print a block of information as it was 
 written like this;
 print HTML_END;
 
 This a whole bunch of HTML code!!!
 
 HTML_END
 
 The best part about this, was that you did not have to escape 
 your  and you
 could mix in your variables making it easy to design and 
 layout the HTML. Is
 there a similiar way to do this in PHP?

Yeppers.  It's lmost the same.

echo MULTILINE

...

MULTILINE;


Darren Gamble
Planner, Regional Services
Shaw Cablesystems GP
630 - 3rd Avenue SW
Calgary, Alberta, Canada
T2P 4L4
(403) 781-4948


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




RE: [PHP] gd project question

2002-05-31 Thread Darren Gamble

Good day,

Wow, a high school math question.

You should use asin() and acos() of the angle to get the y and x
differentials, respectively.  Multiply the result by the size of the needle.

This assumes that your guage is oriented horizontally, and the needle sweeps
from right to left, pointing upwards.  Adjust the sign or switch the
functions around if your gauge is different.

Note that the functions operate in radians (2*pi radians == 360 degrees).


Darren Gamble
Planner, Regional Services
Shaw Cablesystems GP
630 - 3rd Avenue SW
Calgary, Alberta, Canada
T2P 4L4
(403) 781-4948


 -Original Message-
 From: Michael Geier [mailto:[EMAIL PROTECTED]]
 Sent: Friday, May 31, 2002 9:18 AM
 To: Php-General
 Subject: [PHP] gd project question
 
 
 I have the following issue:
 
   I am making a gas guage based on a percentage.
   ie.  
   - a 180 degree arc is created
   - the range will be 0 to n (undetermined ammount)
   - there will be x number of entries
   - the needle will pount to a a percentage 
 for (int)floor((x / n) * 100)
 
   The issue is, I have the starting pt for the needle 
 (imagefilledarc 
   needs the center of the 'circle' as the starting pt, 
 which is where 
   the needle will start too), but how would I get the x|y 
 coordinates 
   for the end of the needle based on a perentage of a half-circle 
   (180 degree arc)?
   
 Appreciate any clues or ideas.
 
 ---
 Michael Geier
 
 
 -- 
 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] Undefined variables

2002-05-31 Thread Darren Gamble

Good day,

I don't have a piece of code off the top of my head, but you'll get lots of
results and examples if you enter those variables into www.php.net 's search
field and search the online documentation (which is very, very good, I
should add).

Hope that helps.


Darren Gamble
Planner, Regional Services
Shaw Cablesystems GP
630 - 3rd Avenue SW
Calgary, Alberta, Canada
T2P 4L4
(403) 781-4948


 -Original Message-
 From: Christopher J. Crane [mailto:[EMAIL PROTECTED]]
 Sent: Thursday, May 30, 2002 8:06 PM
 To: [EMAIL PROTECTED]
 Subject: Re: [PHP] Undefined variables
 
 
 Darren,
 Thanks for the tip on direction to head in. Could you provide 
 an example of
 what you are referring to?
 
 
 Darren Gamble [EMAIL PROTECTED] wrote in message
 078EC26E265CD411BD9100508BDFFC860ED3E64E@shawmail02">news:078EC26E265CD411BD9100508BDFFC860ED3E64E@shawmail02...
  Good day,
 
  Just to clarify, Perl will, in fact, complain if you have undefined
  variables (or variables that you use once) if you have 
 warnings and/or
  strict mode in effect.  Using at least one is strongly recommended.
 
  In PHP, the method you're using for getting form data is 
 deprecated.  You
  should use $HTTP_POST_VARS or $_POST, depending on your 
 version.  Check
 the
  docco for more info on those.
 
  If you really have to check variables using this method, 
 use isset() to
 see
  if the variables ... have been set. =)
 
  ====
  Darren Gamble
  Planner, Regional Services
  Shaw Cablesystems GP
  630 - 3rd Avenue SW
  Calgary, Alberta, Canada
  T2P 4L4
  (403) 781-4948
 
 
   -Original Message-
   From: Crane, Christopher [mailto:[EMAIL PROTECTED]]
   Sent: Thursday, May 30, 2002 3:07 PM
   To: '[EMAIL PROTECTED]'
   Subject: [PHP] Undefined variables
  
  
   I have an annoying problem, that I know is my own ignorance
   to PHP. I came
   from PERL and this was not a problem there but is with PHP.
  
   Here's the issue.
   I have a number of scripts that use a index.php?Task='some
   sort of task
   name', for example, http://www.foo.com/index.php?Task=ShowVersion
   http://www.foo.com/index.php?Task=ShowVersion .  Then I use
   an if/else
   statement to tell the script what to do if it sees the
   ShowVersion variable.
   In the ShowVersion example, I would call a function that 
 displays the
   version information I defined in the script. As a back up, I
   always provide
   an else statement to catch variables I have no functions for.
  
   If I have a ShowVersion function, GetData function and a 
 CreateImage
   function and the Task variable is empty or a variable that
   does not exists
   comes in like http://www.foo.com/index.php?Task=SomethingDumb
   http://www.foo.com/index.php?Task=SomethingDumb  it 
 would go to the
   default function of something by using the ELSE part of 
 the if/else
   statements.
  
   I hope I am describing this correctly.now here is the
   problem. If I have
   warnings turned on, or if I have a log written for warnings,
   the log fills
   up if someone goes to http://www.foo.com/index.php
   http://www.foo.com/index.php  or http://www.foo.com
  http://www.foo.com
  will error messages like undefine variable TASK on line 
 255. I understand
  the reason, that PHP was expecting the variable Task when 
 it got to the
  if/else statements. So I put in something like if(!($Task)) 
 { function
  Something(); } but it still is looking for the variable so it still
 errors.
 
  In Perl, it would simply be ignored. What do I do here.
 
  Here is a simple example of the code.
 
  if ($Task == ShowVersion) { function ShowVersion(); }
  elseif ($Task == GetData) { function GetData(); print 
 $DataOutput; }
  elseif ($Task == CreateImage) { function CreateImage(); }
  else { print Incorrect Variable or no Variable Suppliesbr; }
 
 
 
 
 
  Christopher J. Crane
  Network Operations Manager
 
  IKON Office Solutions
  860.659.6464
 
 
 
 
 
 -- 
 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] Undefined variables

2002-05-30 Thread Darren Gamble

Good day,

Just to clarify, Perl will, in fact, complain if you have undefined
variables (or variables that you use once) if you have warnings and/or
strict mode in effect.  Using at least one is strongly recommended.

In PHP, the method you're using for getting form data is deprecated.  You
should use $HTTP_POST_VARS or $_POST, depending on your version.  Check the
docco for more info on those.

If you really have to check variables using this method, use isset() to see
if the variables ... have been set. =)


Darren Gamble
Planner, Regional Services
Shaw Cablesystems GP
630 - 3rd Avenue SW
Calgary, Alberta, Canada
T2P 4L4
(403) 781-4948


 -Original Message-
 From: Crane, Christopher [mailto:[EMAIL PROTECTED]]
 Sent: Thursday, May 30, 2002 3:07 PM
 To: '[EMAIL PROTECTED]'
 Subject: [PHP] Undefined variables
 
 
 I have an annoying problem, that I know is my own ignorance 
 to PHP. I came
 from PERL and this was not a problem there but is with PHP.
  
 Here's the issue.
 I have a number of scripts that use a index.php?Task='some 
 sort of task
 name', for example, http://www.foo.com/index.php?Task=ShowVersion
 http://www.foo.com/index.php?Task=ShowVersion .  Then I use 
 an if/else
 statement to tell the script what to do if it sees the 
 ShowVersion variable.
 In the ShowVersion example, I would call a function that displays the
 version information I defined in the script. As a back up, I 
 always provide
 an else statement to catch variables I have no functions for.
  
 If I have a ShowVersion function, GetData function and a CreateImage
 function and the Task variable is empty or a variable that 
 does not exists
 comes in like http://www.foo.com/index.php?Task=SomethingDumb
 http://www.foo.com/index.php?Task=SomethingDumb  it would go to the
 default function of something by using the ELSE part of the if/else
 statements. 
  
 I hope I am describing this correctly.now here is the 
 problem. If I have
 warnings turned on, or if I have a log written for warnings, 
 the log fills
 up if someone goes to http://www.foo.com/index.php
 http://www.foo.com/index.php  or http://www.foo.com 
http://www.foo.com
will error messages like undefine variable TASK on line 255. I understand
the reason, that PHP was expecting the variable Task when it got to the
if/else statements. So I put in something like if(!($Task)) { function
Something(); } but it still is looking for the variable so it still errors.
 
In Perl, it would simply be ignored. What do I do here.
 
Here is a simple example of the code.
 
if ($Task == ShowVersion) { function ShowVersion(); }
elseif ($Task == GetData) { function GetData(); print $DataOutput; }
elseif ($Task == CreateImage) { function CreateImage(); }
else { print Incorrect Variable or no Variable Suppliesbr; }
 
 
 
 

Christopher J. Crane
Network Operations Manager

IKON Office Solutions
860.659.6464

 

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




[PHP] Entering password on a command line

2002-05-27 Thread Darren Gamble

Good day,

I have a command-line PHP script that connects to an LDAP database and does
some queries.

To increase security, I would like to not put the bind password into the
program, and instead have the user type it in.  But, I'd like to have this
done so that the password is not echo'd to the screen.

Lots of searching has shown that people have done something similar in C and
Perl by closing the stdout channel.  But, I haven't found anything similar
in PHP (and I would need to reopen the channel again somehow afterwards
anyway).

Does anyone have a suggestion on how this might be accomplished?

In the meantime I'll just put the password in the program, but, I'd like to
learn how this could be done.

Thanks in advance,


Darren Gamble
Planner, Regional Services
Shaw Cablesystems GP
630 - 3rd Avenue SW
Calgary, Alberta, Canada
T2P 4L4
(403) 781-4948


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




[PHP] Web hoster solution?

2002-05-10 Thread Darren Gamble

Good day,

A friend of mine has been asked to set up a simple website for a third
party, which will be used by visitors to order products.

She has been programming for a little while now, but, she doesn't have much
experience with other web hosting companies (and neither do I, really).  I
know that some hosters provide shopping cart programs with their packages,
which would probably make things much easier.  She's also willing to try to
install something PHP-ish (or even in ASP) if that's not an option.

The site wouldn't have a lot of visitors- 1000 a month, tops, so there isn't
much need for a lot of bandwidth.  And, other than this purchasing
interface, their needs are pretty basic, so a low cost is probably the most
important thing.

What would people here recommend?  I know that this question has been asked
before, but her needs are a little bit simpler than the average PHP'er on
this list. =)

Thanks,


Darren Gamble
Planner, Regional Services
Shaw Cablesystems GP
630 - 3rd Avenue SW
Calgary, Alberta, Canada
T2P 4L4
(403) 781-4948

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




RE: [PHP] file() and macintosh line break

2002-05-01 Thread Darren Gamble

Good day,

Calm down, the excessive !'s are a bit unnecessary.

One possible solution is to read the entire thing into one string, and then
use the split or preg_split function on the \r against it.  This will give
you an array with one line per entry.


Darren Gamble
Planner, Regional Services
Shaw Cablesystems GP
630 - 3rd Avenue SW
Calgary, Alberta, Canada
T2P 4L4
(403) 781-4948


 -Original Message-
 From: Rodrigo Peres [mailto:[EMAIL PROTECTED]]
 Sent: Wednesday, May 01, 2002 8:55 AM
 To: [EMAIL PROTECTED]
 Subject: [PHP] file() and macintosh line break
 
 
 Hi list,
 
 I'm in a problem that is driving me crazy!!! I want open a 
 file and puts 
 each line into an array, but this files was created in macintosh!! so 
 the file() can't recognize the end line and only outputs 1 element in 
 array!! How can I solve it. I tried to fread() the file and 
 eregi_replace the line breaks, it worked, but now I don't know how to 
 use this to create the array!
 
 Thank's in advance
 
 Rodrigo
 
 
 -- 
 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] Regex

2002-04-22 Thread Darren Gamble

Good day,

Just off the top of my head, try:

/.+\@.*([^\.]*\.[^\.]*)$/ 

Might not have the exact syntax, but, you get the idea.


Darren Gamble
Planner, Regional Services
Shaw Cablesystems GP
630 - 3rd Avenue SW
Calgary, Alberta, Canada
T2P 4L4
(403) 781-4948


 -Original Message-
 From: James Taylor [mailto:[EMAIL PROTECTED]]
 Sent: Monday, April 22, 2002 2:17 PM
 To: [EMAIL PROTECTED]
 Subject: [PHP] Regex
 
 
 I'm trying to come up with a regular expression that will 
 match the TL 
 and Second Level domain names in someone's email address ONLY.
 
 So, say someone's address is 
 [EMAIL PROTECTED], I 
 need to match ONLY pacbell.net.   It shouldn't matter what 
 the address 
 looks like, I'm looking for any number of digits, a dot, any 
 number of 
 digits, and the end of the line.  The closest thing I can 
 come up with 
 is  /\@.+?(.+\..+)?$/, but, as you can guess, that matches everything 
 except the very first character.  Can anyone help me with this? 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




RE: [PHP] Nasty DoS in PHP

2002-04-18 Thread Darren Gamble

Good day,

Just reading this thread, figured I would put my $0.02 in.

This is apparently a known problem.  It seems to occur whenever the php
script uses lots of memory, actually, and it does the same thing whether
it's run standalone or as a module.

I first experienced it when I had a PHP script load a 10 meg LDAP database
into memory, which took some 90 Megs of RAM to do (overhead, I guess).  If I
ran the script standalone, it wouldn't quit right away.  If it was run as a
module, Apache would have to kill the child off (it logged this activity) if
I asked Apache to shut down.  If I ran the script a few times, all of the
memory of the machine would be used up, and I'd have to kill off Apache to
get it back.


Darren Gamble
Planner, Regional Services
Shaw Cablesystems GP
630 - 3rd Avenue SW
Calgary, Alberta, Canada
T2P 4L4
(403) 781-4948


-Original Message-
From: Jason Soza [mailto:[EMAIL PROTECTED]]
Sent: Thursday, April 18, 2002 12:10 AM
To: [EMAIL PROTECTED]
Subject: RE: [PHP] Nasty DoS in PHP


Mine produced the same error message as yours, Jason, but the memory and CPU
usage continued until I hit the 'stop' button on the browser. It seemed to
have overridden both time and memory limits, as it had racked up 320 megs of
my RAM by the time I stopped it.

Jason

-Original Message-
From: Jason Murray [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, April 17, 2002 9:57 PM
To: 'CC Zona'; [EMAIL PROTECTED]
Subject: RE: [PHP] Nasty DoS in PHP


 So that was both as an Apache mod and a CGI binary?  Sounds like it's
 reproducible.

Running as an Apache module here, it terminated as expected at 30 seconds.

Jason


-- 
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] chown ..opperation not permitted

2002-04-15 Thread Darren Gamble

Good day.

As you've probably surmised, chown needs to be run as the root user, even if
the file or directory in question is owned by the user wanting to make the
change.

Setting up sudo access should work properly.  Ensure that the service is
actually running as nobody and not another unprivileged user.

However, it should be mentioned that this is a very, very insecure method!
The chown operator was designed more for PHP command-line scripts that would
be run as another user.  You may want to re-evaluate why you are changing
ownerships of directories from a web page, and determine if there is a
safer, more secure way of doing what you want.


Darren Gamble
Planner, Regional Services
Shaw Cablesystems GP
630 - 3rd Avenue SW
Calgary, Alberta, Canada
T2P 4L4
(403) 781-4948


-Original Message-
From: John Weez [mailto:[EMAIL PROTECTED]]
Sent: Monday, April 15, 2002 11:55 AM
To: [EMAIL PROTECTED]
Subject: [PHP] chown ..opperation not permitted



Hi all,


My config is Apache 1.3 with PhP4 loaded as a module.

I have a script which makes a directory. This directory is owned by 
nobody.nobody because that is what apache runs as. But, I want this 
directory to be owned by a differrent user. So, After making the 
directory i use the php command chown to change the directory ownership. 
Now, I get an error saying opperation not permitted.

  I figured this is because of some security problems... So i try 
dropping in to the shell using teh backtick operator and by also setting 
up sudo to give access to the chown command to user nobodythis does 
not work from my php script BUT, it does work fine if i enter it on a 
shell line...

There must be a simple way that I can implement the chown function in 
php? Any ideas???

John



-- 
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] Exit();

2002-04-04 Thread Darren Gamble

Good day,

As the documentation says, exit() will end your script.

http://www.php.net/manual/en/function.exit.php

Use return() to end a function.


Darren Gamble
Planner, Regional Services
Shaw Cablesystems GP
630 - 3rd Avenue SW
Calgary, Alberta, Canada
T2P 4L4
(403) 781-4948


-Original Message-
From: Mauricio Cuenca [mailto:[EMAIL PROTECTED]]
Sent: Thursday, April 04, 2002 8:25 AM
To: [EMAIL PROTECTED]
Subject: [PHP] Exit();


Hello,

I'm using recursive functions and call a function from inside another one.
The problem is that when I call the Exit(); function the whole program is
aborted. How can I quit just the current function, not the whole program ?

example
Function One()
{
If (!$var) { Exit(); }
}

Function Two();
{
One();//This line kills the program
Print(Hello); //This is not printed =(
}
/example

TIA,

__
Mauricio Cuenca


-- 
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] Really slow include

2002-04-02 Thread Darren Gamble

Good day,

The include/require path is relative to the filesystem as seen by the web
system user, not the web root.

It's designed this way so that you can put your include files someplace
where users can't fetch them, which is a recommended practice.

So, if your web root is /usr/local/www on your filesystem , then you could
say:

require(/usr/local/www/header/html).

If you don't put in a leading slash, it will look in the current directory.

What you were doing in your second example is asking PHP to look in the file
under your root directory.


Darren Gamble
Planner, Regional Services
Shaw Cablesystems GP
630 - 3rd Avenue SW
Calgary, Alberta, Canada
T2P 4L4
(403) 781-4948


-Original Message-
From: anti-blank [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, April 02, 2002 2:38 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Really slow include


I have a header section for my website and I'd like to include it into each
page.  Since this is where
I'm housing all of my navagation.  Here is my problem though.  I have the
header tables sitting in a page
header.htm.  I'm calling it as so:
?
require (header.htm)
?

This works fine as long as I stay in the main folder /htdocs where the
header.htm file is.
The problem lies when I go any deeper.  I tried replacing the link with:
?
require (/header.htm)
?
Hoping that would put it back to the /htdocs folder as it works for my
standard links.  Instead
I get this:
Fatal error: Failed opening required '/header.htm'
(include_path='.:/usr/local/lib/php') in /www/foo/htdocs/foo/index_test.php
on line 82

I've tried correcting it by including the full path: 
?
require (http://www.foo.com/header.htm;)
?

This does work but it's so amazingly slow.  Even on my cable connection it
will take 20-30 seconds
to load this.  I've switched back and forth between require and include with
no change in speed.  Anyone
have a suggestion or an idea on why my load time is suffering so much?

I hope all of that was clear enough.

Thanks
anti-blank

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




RE: [PHP] How is code in PHP interpreted,from 1st line to last? i do nt think so

2002-03-28 Thread Darren Gamble

Good day,

Please keep this conversation on the list.

As my message says, no, in HTML you don't have text and images together.
The image is retrieved from the server by the client in a completely
different request.

The main request basically says An image goes here.  Go ask over there to
go get that image.


Darren Gamble
Planner, Regional Services
Shaw Cablesystems GP
630 - 3rd Avenue SW
Calgary, Alberta, Canada
T2P 4L4
(403) 781-4948


-Original Message-
From: Moschitz Martin [mailto:[EMAIL PROTECTED]]
Sent: Thursday, March 28, 2002 8:58 AM
To: 'Darren Gamble'
Subject: AW: [PHP] How is code in PHP interpreted, from 1st line to
last? i do nt think so


But the problem with include tag is, that I can´t display images and text
together, or can i?

thx
martin

-Ursprüngliche Nachricht-
Von: Darren Gamble [mailto:[EMAIL PROTECTED]]
Gesendet am: Donnerstag, 28. März 2002 16:49
An: 'Moschitz Martin'; [EMAIL PROTECTED]
Betreff: RE: [PHP] How is code in PHP interpreted, from 1st line to
last? i do nt think so

Good day.

If you want some php code to execute another file of php code and the
continue afterwards, use the include() statement.

Please note that with the example you've listed there, the code isn't
executed the way that you might think.  The client will receive all of the
html from the PHP script first.  Then, the client will look at the img tag
and figured out that it has to request graf.php, which is does (which will
be executed separately).


Darren Gamble
Planner, Regional Services
Shaw Cablesystems GP
630 - 3rd Avenue SW
Calgary, Alberta, Canada
T2P 4L4
(403) 781-4948


-Original Message-
From: Moschitz Martin [mailto:[EMAIL PROTECTED]]
Sent: Thursday, March 28, 2002 8:46 AM
To: [EMAIL PROTECTED]
Subject: [PHP] How is code in PHP interpreted, from 1st line to last? i
do nt think so


How can I say php to execute graf.php until it´s finished and then move on
to the rest of the code?

echo img src='graf.php;
...
more code
...

tanxs

-- 
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] How is code in PHP interpreted,from 1st line to last? i do nt think so

2002-03-28 Thread Darren Gamble

Good day,

No, there is no real way in HTML to have this work.  You would be best off
looking at WHY you need the image to be done first, and change your
programming appropriately to take into account how HTML works.

A very messy solution would be to have an include statement that generates
an image someplace, referenced by your main program.  This will cause the
image to be generated before the rest of the code is executed.  But, then
you'll have to worry about cleaning it up later.


Darren Gamble
Planner, Regional Services
Shaw Cablesystems GP
630 - 3rd Avenue SW
Calgary, Alberta, Canada
T2P 4L4
(403) 781-4948


-Original Message-
From: Moschitz Martin [mailto:[EMAIL PROTECTED]]
Sent: Thursday, March 28, 2002 9:06 AM
To: 'Darren Gamble'; Moschitz Martin
Cc: Php
Subject: AW: [PHP] How is code in PHP interpreted, from 1st line to
last? i do nt think so


As my message says, no, in HTML you don't have text and images together.
The image is retrieved from the server by the client in a completely
different request.

The main request basically says An image goes here.  Go ask over there
to
go get that image.

so, do you have any solution for me, how i can get the image processed
first? include doesn´t work...

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




RE: [PHP] running commands as root from a script

2002-03-28 Thread Darren Gamble

Good day,

A bit off topic, but you can run a Perl script setuid.  You have to pass a
flag to Perl to let it know that it's OK, though (it's -U, I believe) which
would appear in your first she-bang line.

I've never had to run a PHP script setuid.  I would imagine that one would
have to write it CGI-like instead of via the server module.


Darren Gamble
Planner, Regional Services
Shaw Cablesystems GP
630 - 3rd Avenue SW
Calgary, Alberta, Canada
T2P 4L4
(403) 781-4948


-Original Message-
From: Ken Nagorski [mailto:[EMAIL PROTECTED]]
Sent: Thursday, March 28, 2002 10:37 AM
To: [EMAIL PROTECTED]
Subject: [PHP] running commands as root from a script


Hi there,

I have a little problem. I need to run a few commands for Courier from a
script. What I have is a php based application that makes it easy to create
and manage virtual domains and the addresses for them from the web. However
when You Apply the changes everything is written to /tmp dir and the a
little perl script parses the file and moves things where they need to go
and then runs couriers makealiases command. Now you can't run a perl script
SUID so I wrote a C program that just calls system() and runs the script and
it is SUID. This doens't work however. No matter what I do. It is like
Courier ignores this.

I can't imagine there isn't anyone who has not run into the problem of
automating things via PHP and not had to run a system command as root at
some point in time. I am wondering what the different approaches to this
problem are.

Thanks
Ken




-- 
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] Loading Images

2002-03-28 Thread Darren Gamble

Good day,

Yep, this is possible all right.  I use this to display my rrdtool images.

Just have the php program as the target for the image, and then supply the
right header.  For a gif image:

header(Cache-control: private, no-cache);
header(Expires: Mon, 26 Jul 1997 05:00:00 GMT); // Past date
header(Pragma: no-cache);
header(Content-type: image/gif);

Then, just output the raw data.  If you gather it with a shell command, use
passthru() .

There isn't anything to stop the user from saving the image, although the
above headers will request that the user's client not cache it.  You can
make it more difficult for the user by supplying a Javascript override
function to be executed when the user uses their right-mouse button over the
image.


Darren Gamble
Planner, Regional Services
Shaw Cablesystems GP
630 - 3rd Avenue SW
Calgary, Alberta, Canada
T2P 4L4
(403) 781-4948


-Original Message-
From: Omland Christopher m [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, March 26, 2002 12:47 PM
To: Chris
Cc: [EMAIL PROTECTED]
Subject: [PHP] Loading Images


I don't have any code for this, but I'm hoping someone can point me in the
right direction. I want to load images or navigation menus dynamically. Is
it possible to build a database of images and then use php to display
them? Or something along these lines. I know this must be possible,
becuase I see sites that do something like this, and I cant seem to right
click the image and save it. Does this make any sense?
Thanks.
-Chris



-- 
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] XSLT; XML = PHP code

2002-03-28 Thread Darren Gamble

Good day,

To have PHP evaluate string contents as an expression, use eval().

The usual disclaimer comes with this function... be careful.


Darren Gamble
Planner, Regional Services
Shaw Cablesystems GP
630 - 3rd Avenue SW
Calgary, Alberta, Canada
T2P 4L4
(403) 781-4948


-Original Message-
From: Erik Price [mailto:[EMAIL PROTECTED]]
Sent: Thursday, March 28, 2002 2:47 PM
To: [EMAIL PROTECTED]
Subject: [PHP] XSLT; XML = PHP code


I am using XSLT functions in PHP to transform a string (whose data is a 
string of XML) into another string.  Ideally, the second string will 
consist of PHP code.  I would like this outputted PHP code to be 
executed within the same script as the that which performs this 
transformation.

Here is what I am wondering -- will I be able to evaluate the variable 
containing the new string somehow?  In other words, I will have PHP code 
trapped in a variable, which I will need to have evaluated in order to 
have the code inside executed.  How can I take a variable containing PHP 
code and have it get executed along with the rest of the script?

In other words,

$php_code_in_here = 'echo hi there;';  // PHP code in a variable

Will this variable just be evaluated by the script as it is parsed??




Forgive me if the answer is staring me in the face, I'm just not seeing 
it.



Thanks,

Erik







Erik Price
Web Developer Temp
Media Lab, H.H. Brown
[EMAIL PROTECTED]


-- 
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] XSLT; XML = PHP code

2002-03-28 Thread Darren Gamble

Good day,

eval() is a very powerful function.  You should be careful that users can't
find some way to execute arbitrary code by providing input that your program
did not expect.

Also, if your string doesn't have the correct syntax, your program will
terminate.


Darren Gamble
Planner, Regional Services
Shaw Cablesystems GP
630 - 3rd Avenue SW
Calgary, Alberta, Canada
T2P 4L4
(403) 781-4948


-Original Message-
From: Erik Price [mailto:[EMAIL PROTECTED]]
Sent: Thursday, March 28, 2002 3:20 PM
To: Darren Gamble
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] XSLT; XML = PHP code



On Thursday, March 28, 2002, at 04:52  PM, Darren Gamble wrote:

 Good day,

 To have PHP evaluate string contents as an expression, use eval().

Thanks for the pointer, I have never used this function before.  I'm not 
sure what it means by as with any function that outputs directly to the 
browser, since in their example it just shows an evaluation of a simple 
variable assignment (which I'm guessing doesn't get output to the 
browser).  I will have to experiment with this and make sure it works 
right.

 The usual disclaimer comes with this function... be careful.

(... of what?)



Thanks again Darren,

Erik







Erik Price
Web Developer Temp
Media Lab, H.H. Brown
[EMAIL PROTECTED]

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




RE: [PHP] syntax

2002-03-27 Thread Darren Gamble

Good day.

I believe that one would have to use the eval() statement to construct that
syntax.

You probably would be much better off using an array to store this
information.  If you are trying to read form data, then construct your form
names so that the results will be put into an array by PHP.


Darren Gamble
Planner, Regional Services
Shaw Cablesystems GP
630 - 3rd Avenue SW
Calgary, Alberta, Canada
T2P 4L4
(403) 781-4948


-Original Message-
From: John Fishworld [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, March 27, 2002 10:55 AM
To: Php-General-List (E-mail)
Subject: [PHP] syntax


Can someone please remind me what the correct syntax for this is !
in a loop
and want individual

$ned_1_city = blah
$ned_2_city = blur

I've been trying this but its wrong

$ned_.$i._city = $ned_city ;

thanks
john




-- 
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] syntax

2002-03-27 Thread Darren Gamble

Good day,

In this situation, you should use an array to store the results.

Please check PHP's documentation for more information on how to use arrays.


Darren Gamble
Planner, Regional Services
Shaw Cablesystems GP
630 - 3rd Avenue SW
Calgary, Alberta, Canada
T2P 4L4
(403) 781-4948


-Original Message-
From: John Fishworld [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, March 27, 2002 11:09 AM
To: Darren Gamble; Php-General-List (E-mail)
Subject: Re: [PHP] syntax


Sorry I think I've badly explained this !

I'm getting results from mysql in a while loop
but I need the results outside of the loops
and so what I want to do is take the first variable from the db
and rename it as variable 1
and then before the end of the while loop have a $i++;

so i want
$newvar_$i = result 1
$newvar_$i = result 2

so I can use them outside the loops as
$newvar_1 and $newvar_2

hope that makes more sense !



 Can someone please remind me what the correct syntax for this is !
 in a loop
 and want individual

 $ned_1_city = blah
 $ned_2_city = blur

 I've been trying this but its wrong

 $ned_.$i._city = $ned_city ;

 thanks
 john




 --
 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] Nevermind I figured it out

2002-03-27 Thread Darren Gamble

Good day.

As you may have guessed by now, the .= operator does what you want.


Darren Gamble
Planner, Regional Services
Shaw Cablesystems GP
630 - 3rd Avenue SW
Calgary, Alberta, Canada
T2P 4L4
(403) 781-4948


-Original Message-
From: David Johansen [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, March 27, 2002 12:13 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Nevermind I figured it out


I just user $message = $message . Some text;
But is there a better way to do this with something like the += operator?
Dave

David Johansen [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 I was just wondering if there was a way to add new text to the end of
 strings. I tried doing
 $message += Some text here;
 but that just set $message to 0. I'm sure it's something simple  but I
 couldn't find anything on it in the documentation.
 Dave





-- 
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] preventing back button usage?

2002-03-27 Thread Darren Gamble

Good day,

This can be accomplished in a few ways.  The easiest way is to tell the
client not to cache the page.  And yep, you do this via headers.

In PHP (attempting to hit as many types of browsers as possible):

header(Cache-Control: no-store, no-cache, must-revalidate);
header(Pragma: no-cache);

You can also do some fancy redirection with Location headers.

As a failsafe, you should have the processing page make sure that the user
isn't submitting the same thing more than once.


Darren Gamble
Planner, Regional Services
Shaw Cablesystems GP
630 - 3rd Avenue SW
Calgary, Alberta, Canada
T2P 4L4
(403) 781-4948


-Original Message-
From: Erik Price [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, March 27, 2002 2:10 PM
To: [EMAIL PROTECTED]
Subject: [PHP] preventing back button usage?


Sorry to plague this list with questions today, but I was hoping someone 
could help me understand a fundamental thing about how browsers work -- 
how can I achieve the effect that many ecommerce sites (such as Amazon) 
use to prevent the user from going back in their history?  For obvious 
reasons, I would like to avoid JavaScript to achieve this feat.  I have 
some multi-part forms that I do not wish users to be able to repeat 
accidentally.

I believe it has something to do with a header and the browser's cache, 
but I really don't know anything about it.


TIA,

Erik







Erik Price
Web Developer Temp
Media Lab, H.H. Brown
[EMAIL PROTECTED]


-- 
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] OT - number of chars in querystring

2002-03-26 Thread Darren Gamble

Good day,

The RFC says that there is no limit on the size of the request.  But, I
remember reading that the real world maximum is 2048 characters, which I
believe is a hard limit on some clients.

I also recall reading that there is an RFC that suggests limiting the
request to 255 characters.

It appears that you might be submitting a lot of data.  If that's the case,
you should really have your application determine the information to be
submitted and then store/create them as hidden values in a form.  That way,
not only will you have no problems with length, but you don't have to worry
about the client caching it.


Darren Gamble
Planner, Regional Services
Shaw Cablesystems GP
630 - 3rd Avenue SW
Calgary, Alberta, Canada
T2P 4L4
(403) 781-4948


-Original Message-
From: Erik Price [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, March 26, 2002 9:41 AM
To: [EMAIL PROTECTED]
Subject: [PHP] OT - number of chars in querystring


Sorry for this quick OT question --

I'm skimming thru the HTTP spec but can't find anything that defines the 
character limit in GET requests.  I'm writing a form that uses GET to 
send data to my PHP script, but I'm afraid that if the user enters too 
many characters then some will get cut off.  Does anyone know the actual 
limit?

If not, is there a generally-accepted maximum that is used (to assure 
compatibility with most user agents and servers)?


Erik







Erik Price
Web Developer Temp
Media Lab, H.H. Brown
[EMAIL PROTECTED]


-- 
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] sorting data from a field

2002-03-26 Thread Darren Gamble

Good day.

You can do this using the ORDER clause in SQL.  Please consult your
particular database's documentation for more information.

Alternately, you can load all of the unsorted results into an associative
array, and use PHP's native sorting functions (such as ksort() ) to sort the
results.


Darren Gamble
Planner, Regional Services
Shaw Cablesystems GP
630 - 3rd Avenue SW
Calgary, Alberta, Canada
T2P 4L4
(403) 781-4948


-Original Message-
From: Chuck Barnett [mailto:[EMAIL PROTECTED]]
Sent: Sunday, February 03, 2002 1:50 PM
To: PHP General List
Subject: [PHP] sorting data from a field


Hello again :)

 I have a db field that holds the first and last name of a person.  Is
there a way to sort by the last name in that field?

The whole reason for this is to populate a select box sorted by last name.

I don't want to go back and create a separate field if I don't have to.

Any help is appreciated.

Thanks,
Chuck



-- 
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] sorting data from a field

2002-03-26 Thread Darren Gamble

Good day,

Sorry, I didn't read your request as clearly as I should have. =)

If you have a single field, the best way would be to load all of the
results, and then have PHP split() the results by whitespace.  Then store
the results by associative array and use ksort() to sort them.

The best way would be to have a first name and last name field.  This
addresses situations where people have their family name first and their
given name second.


Darren Gamble
Planner, Regional Services
Shaw Cablesystems GP
630 - 3rd Avenue SW
Calgary, Alberta, Canada
T2P 4L4
(403) 781-4948


-Original Message-
From: Darren Gamble [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, March 26, 2002 2:13 PM
To: 'Chuck Barnett'; PHP General List
Subject: RE: [PHP] sorting data from a field


Good day.

You can do this using the ORDER clause in SQL.  Please consult your
particular database's documentation for more information.

Alternately, you can load all of the unsorted results into an associative
array, and use PHP's native sorting functions (such as ksort() ) to sort the
results.


Darren Gamble
Planner, Regional Services
Shaw Cablesystems GP
630 - 3rd Avenue SW
Calgary, Alberta, Canada
T2P 4L4
(403) 781-4948


-Original Message-
From: Chuck Barnett [mailto:[EMAIL PROTECTED]]
Sent: Sunday, February 03, 2002 1:50 PM
To: PHP General List
Subject: [PHP] sorting data from a field


Hello again :)

 I have a db field that holds the first and last name of a person.  Is
there a way to sort by the last name in that field?

The whole reason for this is to populate a select box sorted by last name.

I don't want to go back and create a separate field if I don't have to.

Any help is appreciated.

Thanks,
Chuck



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

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

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




RE: [PHP] what's undefined index ?

2002-03-25 Thread Darren Gamble

Good day,

The error message refers to the KundeRemark in $val[KundeRemark], not
$KundeRemark which you are trying to assign the result to.  The former is
(if it existed) an index, the latter is a variable.


Darren Gamble
Planner, Regional Services
Shaw Cablesystems GP
630 - 3rd Avenue SW
Calgary, Alberta, Canada
T2P 4L4
(403) 781-4948


-Original Message-
From: Kai Schaetzl [mailto:[EMAIL PROTECTED]]
Sent: Monday, March 25, 2002 9:31 AM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] what's undefined index ?


Your message of Mon, 25 Mar 2002 11:35:57 +1100:

 undefined variable is when you try to use a variable before you set it,
eg
 $foobar
 undefined index is when you try to reference an array index before you
set
 it, eg $foobar[10]


Hi, thank you both for the explanation. It's clear why I get the
undefined, 
these variables *are* for various reasons undefined at the moment. However, 
there are NO arrays involved, f.i. KundeRemark is NOT an array it's a
simple 
string variable created by

$KundeRemark   = stripslashes($val[KundeRemark]);

which is a field from a SQL result which currently doesn't exist because I 
changed the connection to a different db where this field is named 
differently. So, it's undefined, fine. But why is it called undefined
index 
where it should be undefined variable ?

 Warning: Undefined index: KundeRemark in
 
 C:\Server\www\conadmin\admin-beta\lib\kunden_functions.inc on line
 
 138




Kai

--

Kai Schätzl, Berlin, Germany
Get your web at Conactive Internet Services: http://www.conactive.com
IE-Center: http://ie5.de  http://msie.winware.org




-- 
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] undefined variable when using if ($var) {}

2002-03-25 Thread Darren Gamble

Good day.

What is this message that you get, that you don't want?

A cursory glance of the code reveals two else statements attached to the
same if statement.  You should address that.


Darren Gamble
Planner, Regional Services
Shaw Cablesystems GP
630 - 3rd Avenue SW
Calgary, Alberta, Canada
T2P 4L4
(403) 781-4948


-Original Message-
From: Martha S [mailto:[EMAIL PROTECTED]]
Sent: Monday, March 25, 2002 9:44 AM
To: [EMAIL PROTECTED]
Subject: [PHP] undefined variable when using if ($var) {}


I'm rather new to PHP, so this should be fairly easy to answer. I checked
the manual and FAQ already.

I'm using the following code, and I get the following message if $id has
nothing in the var (i have it set to a default of  type int, not null in
mysql). Is there a way around this or something I'm missing?

Thanks :)

-- code---

if ($id) {

   $result = mysql_query(SELECT * FROM entries WHERE id=$id,$db);

   $myrow = mysql_fetch_array($result);

   printf(table border=1tr\n);
   printf(trtd%s/td/tr, $myrow[title]);
   printf(trtd%s | , $myrow[id]);
   printf(%s/td/tr, $myrow[posted]);
   printf(trtd%s\n/td/tr, $myrow[post]);
   printf(/tabletr\n);

   printf(a href=\$PHP_SELF\all/a);

   } else {

do {

printf(%s a href=\%s?id=%s\%s/abr\n, $myrow[id], $PHP_SELF,
$myrow[id], $myrow[title], $myrow[post]);

  } while ($myrow = mysql_fetch_array($result));

} else {

  // no records to display

  echo Sorry, no records were found!;

}




-- 
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? Help!

2002-03-25 Thread Darren Gamble

Good day,

exec() isn't very good at capturing output.  It will only return the last
line of output, which is designed mostly to capture error conditions.

You would be best off using popen() and attaching a pipe to the output, and
then just read from the pipe.  More information can be found about popen()
with PHP's documentation.

Try that instead.


Darren Gamble
Planner, Regional Services
Shaw Cablesystems GP
630 - 3rd Avenue SW
Calgary, Alberta, Canada
T2P 4L4
(403) 781-4948


-Original Message-
From: Walker, Roy [mailto:[EMAIL PROTECTED]]
Sent: Monday, March 25, 2002 12:26 PM
To: '[EMAIL PROTECTED]'
Subject: [PHP] Regular Expressions? Help!


I am trying to do a match for an expression and it to a variable from the
output of a command: 

?php

$lines = file ($file);
while (list ($line_num, $line) = each ($lines)) {
$trimline = trim ($line);
$output = shell_exec ($prog $cmdline $trimline );
}
?

How can look through $output to set the information returned as different
variables the output would look like:
variable1:some information variable2:some information

I want to set each variable to a string and write it to a file.

Thank You for you help.
Roy


** PLEASE NOTE **
This E-Mail/telefax message and any documents accompanying this transmission
may contain privileged and/or confidential information and is intended
solely for the addressee(s) named above.  If you are not the intended
addressee/recipient, you are hereby notified that any use of, disclosure,
copying, distribution, or reliance on the contents of this E-Mail/telefax
information is strictly prohibited and may result in legal action against
you. Please reply to the sender advising of the error in transmission and
immediately delete/destroy the message and any accompanying documents.
Thank you. 


-- 
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] cron with php as apache module

2002-03-22 Thread Darren Gamble

Good day,

Most Linux packages also install the php binary as part of the distribution
(I know Redhat does).

Look in /usr/local/bin (or other common places) to see if the executable
php has been installed.

If it is, you're set.  Just run the script as if it were a .cgi .
Instructions are on php's site.

On a sour note, FreeBSD's package does not include the executable.. =(


Darren Gamble
Planner, Regional Services
Shaw Cablesystems GP
630 - 3rd Avenue SW
Calgary, Alberta, Canada
T2P 4L4
(403) 781-4948


-Original Message-
From: Paul Roberts [mailto:[EMAIL PROTECTED]]
Sent: Friday, March 22, 2002 12:00 PM
To: [EMAIL PROTECTED]
Subject: [PHP] cron with php as apache module


I want to run a php script via a crontab, (i can set up the crontab etc).

this is a Linux server and php is installed as an apache module, is there
any way to run the php script via cron.

 the build details are 

  Configure Command './configure' '--with-apxs=/usr/sbin/apxs'
'--with-mysql' '--enable-track-vars' '--enable-versioning' '--enable-bcmath'




Paul Roberts
[EMAIL PROTECTED]




--
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] strlen() gives a wrong count

2002-03-19 Thread Darren Gamble

Good day,

Could you post this mystery string so that we could help you?


Darren Gamble
Planner, Regional Services
Shaw Cablesystems GP
630 - 3rd Avenue SW
Calgary, Alberta, Canada
T2P 4L4
(403) 781-4948


-Original Message-
From: Gil Disatnik [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, March 19, 2002 1:12 PM
To: [EMAIL PROTECTED]
Subject: [PHP] strlen() gives a wrong count


Hello there,

I have a 98 characters string (including spaces), wc -c says it's 98 
characters and a file containing this string is 98 bytes as well.

For some reason - strlen() says it's more... it says it's a 104 characters 
strings, when I removed the spaces (using sed on the shell and using 
str_replace on php) - wc said it's 83 characters and strlen() said it's
89...

How could that be? is there another way to get the exact number of 
characters in a string?

Thanks.



Regards

Gil Disatnik
UNIX system/security administrator.

GibsonLP@EFnet

_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
Windows NT has detected mouse movement, you MUST restart
your computer before the new settings will take effect, [ OK ]

Windows is a 32 bit patch to a 16 bit GUI based on a 8 bit operating
system, written for a 4 bit processor by a 2 bit company which can
not stand 1 bit of competition.
-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-



-- 
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] How to get the IP of a visitor

2002-03-18 Thread Darren Gamble

Good day,

You'll need to check the documentation of your web server for that (or post
on the appropriate list).

You can use the phpinfo() function to see all of the environment values that
PHP sees.

Off the top of my head, I think Apache stores it in REMOTE_IP .


Darren Gamble
Planner, Regional Services
Shaw Cablesystems GP
630 - 3rd Avenue SW
Calgary, Alberta, Canada
T2P 4L4
(403) 781-4948


-Original Message-
From: Ulrik Witschass [mailto:[EMAIL PROTECTED]]
Sent: Monday, March 18, 2002 9:57 AM
To: [EMAIL PROTECTED]
Subject: [PHP] How to get the IP of a visitor


Hi, I am new to this list and to PHP, so please excuse any newbie questions
:)

Want I need to know is how to get either the ISP or the IP of the visitor of
a page. I guess this is a environment variable, but I don't know which.
Any help is greatly appreciated :)

Thanx!

Ulrik


-- 
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] Parse Error Suggestions?

2002-03-18 Thread Darren Gamble

Good day,

It's not really possible to have an error reporting function on a parse
error.  If there is a parse error, then the program can not be run, period.


Darren Gamble
Planner, Regional Services
Shaw Cablesystems GP
630 - 3rd Avenue SW
Calgary, Alberta, Canada
T2P 4L4
(403) 781-4948


-Original Message-
From: Mike At Spy [mailto:[EMAIL PROTECTED]]
Sent: Monday, March 18, 2002 10:53 AM
To: [EMAIL PROTECTED]
Subject: [PHP] Parse Error Suggestions?



Anyone have any suggestions for getting better reporting on a generic Parse
Error?  Code is falling to the end of the script, and I can't find a problem
anywhere.

I looked on the PHP site for error reporting functions, but apparently they
do not handle Parse Errors.

Thanks,

-Mike



-- 
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] Two easy HTML/CSS questions

2002-03-18 Thread Darren Gamble

Good day,

Just to clarify, yes, you can set the size of a text field, as well as its
color, text font, border, and so on.  This is also done with css and is
outside the scope of this mailing list.


Darren Gamble
Planner, Regional Services
Shaw Cablesystems GP
630 - 3rd Avenue SW
Calgary, Alberta, Canada
T2P 4L4
(403) 781-4948


-Original Message-
From: Hunter, Ray [mailto:[EMAIL PROTECTED]]
Sent: Monday, March 18, 2002 11:31 AM
To: 'Phil Schwarzmann'; [EMAIL PROTECTED]
Subject: RE: [PHP] Two easy HTML/CSS questions


Answers:

1. Yes you can do it with css.  http://www.w3schools.com/css/default.asp

2. The text field area is defined by the browse...You cannot change the size
of the actual box that is the text field...



Thank you,

Ray Hunter
Firmware Engineer

ENTERASYS NETWORKS


-Original Message-
From: Phil Schwarzmann [mailto:[EMAIL PROTECTED]] 
Sent: Monday, March 18, 2002 11:18 AM
To: [EMAIL PROTECTED]
Subject: [PHP] Two easy HTML/CSS questions


I know I shouldn't be asking these questions on this mailing list but you
guys are ALWAYS EXTREMELY helpful...
 
1) I want a a text link to change color when the mouse is hovering over top
of it.  How do I do this?  Im sure it's some CSS thingy.
 
2) Is it possible to make a text field smaller when using forms. 
Let's say I'm using font size 1, I want the text field to be just as small
as the rest of text.
 
Thanks again

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




RE: [PHP] Driving me nuts, need one second of your time

2002-03-15 Thread Darren Gamble

Good day,

You get this message because the mysql_db_query statement failed, and that
your code didn't check to see that it did or not before proceeding to the
next statement.

And, this statement fails because you have not even connected to the
database yet.

At the risk of sounding condescending, I would request that you look at
PHP's documentation on how to use the MySQL wrapper functions (
http://www.php.net/manual/en/ref.mysql.php ).  There you can find good
documentation and a number of useful examples (the two best things a coder
could ask for).

Your error message is also in PHPs FAQ list.
http://www.php.net/manual/en/faq.databases.php .

Hope this helps,


Darren Gamble
Planner, Regional Services
Shaw Cablesystems GP
630 - 3rd Avenue SW
Calgary, Alberta, Canada
T2P 4L4
(403) 781-4948


-Original Message-
From: cosmin laslau [mailto:[EMAIL PROTECTED]]
Sent: Friday, March 15, 2002 4:14 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Driving me nuts, need one second of your time


?
$query = SELECT * from mytable;
$result = mysql_db_query(db, $query);

while ($myarray = mysql_fetch_array($result))
{
$title = $myarray[title];
echo $titlebr;
}
?

Can someone PLEASE tell me why the coding above gives the following error:


Warning: Supplied argument is not a valid MySQL result resource in 
/var/web/somesite.com/html/index.php on line 5


It's absurd. It's driving me nuts. I'm about to introduce my computer to the

pavement 40 feet below.

Thanks in advance for whoever sees what I am sure is a glaring and obvious 
flaw in the coding. I've been looking at it for an hours and just can't get 
anything from where I'm standing, maybe a different perpective will help.



_
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp.


-- 
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] Netscape vs. IE/Mozilla

2002-03-08 Thread Darren Gamble

Good day,

A 10-second search on Google comes up with:

http://www.omninet.net.au/~kg/docs/demyst9.html

Personally, I can tell you that the biggest difference between the two
browsers is the way that Netscape 4.X uses styles.  In particular, it
generally doesn't inherit styles from other elements.  So, if you use a
stylesheet and say that you want text to be green, you need to specify that
p is green, td is green, etc.

A bigger explanation of the differences would be outside the scope of this
list.


Darren Gamble
Planner, Regional Services
Shaw Cablesystems GP
630 - 3rd Avenue SW
Calgary, Alberta, Canada
T2P 4L4
(403) 781-4948


-Original Message-
From: Vlad Kulchitski [mailto:[EMAIL PROTECTED]]
Sent: Friday, March 08, 2002 8:44 AM
To: [EMAIL PROTECTED]
Subject: [PHP] Netscape vs. IE/Mozilla


 
Hi guys,
 
I know it's a wrong place to ask about this, but I am sure someone here
faced the same problem. I am trying to get the site to look consistent
in
Netscape Navigator and it's giving me hard times.

Either tables or/and cell background doesn't show up or spacing between
two tables is not what it is supposed to be.

If anyone can give me suggestion about where to look for some hints
online
that would be appreciated.

Thanks,
Vlad

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




RE: [PHP] php, text file, and mysql

2002-03-07 Thread Darren Gamble

Good day,

This isn't really on the topic of PHP.

But, to answer your question- yes, MySQL will let you do lots of neat things
with those large text fields, like looking for substrings and such.  If you
want to store some text information, even that which might have special
characters, line feeds and so forth, the TEXT field is definately the way
to go.


Darren Gamble
Planner, Regional Services
Shaw Cablesystems GP
630 - 3rd Avenue SW
Calgary, Alberta, Canada
T2P 4L4
(403) 781-4948


-Original Message-
From: Erik Price [mailto:[EMAIL PROTECTED]]
Sent: Thursday, March 07, 2002 4:10 PM
To: gregory hernandez
Cc: PHP NEWS
Subject: Re: [PHP] php, text file, and mysql



On Thursday, March 7, 2002, at 07:16  PM, gregory hernandez wrote:

 can i insert the actual file (i.e. document.txt, of course with it
 contents) into a mysql?

 in other words, i don't want to read the contents of the file and 
 insert the
 contents into a field in mysql.  i want to insert the actual file into 
 the
 database.  is this possible?

Yes you can, though it might be an inefficient way of doing it unless 
you have some reason to do it this way.  Look into the column type 
BLOB (binary large object), it lets you store binary large objects, 
such as images or files or anything, really.

Why inefficient?  Well, for one thing, BLOBs don't retrieve as quickly 
as regular fields, for reasons I don't altogether know.  Also, you won't 
be able to form a query to search for any characteristics of a BLOB, 
since MySQL will treat the BLOB as a BLOB and doesn't try to imagine 
what's inside it -- as opposed to, say, a VARCHAR column.  There is also 
a TEXT column type for very long text strings, and I forget whether or 
not the contents of these can be used in queries -- can someone please 
confirm this?  But basically, almost any other column type is valid 
subject matter for forming queries.

But for storing images and PDFs or other binary data, there's no other 
way.

Note that many MySQL wizards will recommend that instead of storing 
binary data in a database, use a filesystem to store the data and then 
use the database to create a sort of directory for quickly locating 
those files in the filesystem, remembering the path to the file or 
something.  I think this is how a lot of web sites incorporate graphic 
content in with their database (text) content (including mine).


Erik





Erik Price
Web Developer Temp
Media Lab, H.H. Brown
[EMAIL PROTECTED]


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

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




RE: [PHP] Re: time limit ?

2002-03-04 Thread Darren Gamble

Good day,

That won't submit the form, unfortunately.  It'll just redirect the user to
the page without submitting the contents of the form.

If the browser supports it, one can use javascript to submit the form after
a certain amount of seconds have elapsed.


Darren Gamble
Planner, Regional Services
Shaw Cablesystems GP
630 - 3rd Avenue SW
Calgary, Alberta, Canada
T2P 4L4
(403) 781-4948


-Original Message-
From: George Whiffen [mailto:[EMAIL PROTECTED]]
Sent: Monday, March 04, 2002 12:16 PM
To: [EMAIL PROTECTED]; Ác¬P
Subject: [PHP] Re: time limit ?




ÁC¬P wrote:

 How can I set a time limit for a form made by PHP (i.e.the value will auto
 transfer after a certain time)
 --
 Ác¬P¤u§@«Ç
 http://fansing.hk.st/
 ACG¤¬°Ê°Ï°ì(¤j®a¦h¨Ç¨Ó¶K¹Ï§a!)
 http://acgzone.hk.st/

HTML forms execute in the client's browser, which does not care at all
whether
the form came from static html file, php, Perl, whatever.

The simplest way to get a browser to time out is with a  META refresh html
tag in the HEADER part of your page e.g.

META HTTP-EQUIV=Refresh CONTENT=15;
URL=http://www.mysite.com/too_long.html;.

This would automatically redirect to the too_long.html page after 15
seconds.

George


-- 
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] Using SSL - slightly OT

2002-02-28 Thread Darren Gamble

Good day,

I'm trying to set up a site that will use SSL for all of its web and control
transactions.

Currently I get an error when Apache is started up with PHP and SSL compiled
together (on FreeBSD).  There's a bug report on it, so it's just a matter of
waiting.

In the meantime, I'd like to set up Apache with SSL.  I note that there are
two packages- modssl and Apache-ssl, which appear to be two completely
different packages.

Has anyone here tried both of these packages, or has a recommendation on
which to use?  I'm curious as to what everyone would recommend for someone
new to SSL.

Thanks,


Darren Gamble
Planner, Regional Services
Shaw Cablesystems GP
630 - 3rd Avenue SW
Calgary, Alberta, Canada
T2P 4L4
(403) 781-4948

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




RE: [PHP] using a mysql temporary table.

2002-02-25 Thread Darren Gamble

Good day,

I would have to dig around to find the appropriate note in the
documentation, however I seem to recall reading that PHP's MySQL wrappers
intentially prohibit a user from using semicolons- basically to prevent
one's database from being hacked due to a poorly constructed query using
user input.

I can't immediately find a reference to this, though.

As a workaround, you could execute two separate queries and store all of the
results in a 2-D array in memory.


Darren Gamble
Planner, Regional Services
Shaw Cablesystems GP
630 - 3rd Avenue SW
Calgary, Alberta, Canada
T2P 4L4
(403) 781-4948


-Original Message-
From: Jeff Bearer [mailto:[EMAIL PROTECTED]]
Sent: Monday, February 25, 2002 8:34 AM
To: [EMAIL PROTECTED]
Subject: [PHP] using a mysql temporary table.


Hello,

I'm trying to use a temporary table in mySQL with PHP.  First I tried to
create a temporary table and then query it in the same script. But the
table didn't persist to the second query in the PHP script. 

I found this knowledge base entry:
http://www.faqts.com/knowledge_base/view.phtml/aid/445

Where it shows to do all the querying in one swoop.  The problem I'm
having now is that PHP is throwing an error at the first semi-colon.  It
appears that it doesn't want to run multiple query statements in 1 query
function.

I'm using the mySQL pear class in my application, I wouldn't think that
it would have any effect on the problem.

Here is an example of the query I'm attempting.

CREATE TEMPORARY TABLE tmp_events SELECT event_id, event_title FROM
events; INSERT INTO tmp_events SELECT event_id, event_title FROM
special_events; SELECT event_id, event_title FROM tmp_events ORDER BY
event_title;

But I get an error like:
1064: You have an error in your SQL syntax near '; INSERT INTO
tmp_events'


If I echo my SQL statement and paste it into mySQL the query works fine.
Any suggestions that you can offer would be great.




-- 
Jeff Bearer, RHCE
Webmaster
PittsburghLIVE.com
2002 EPpy Award, Best Online U.S. Newspaper


-- 
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] Next and Preview Row

2002-02-22 Thread Darren Gamble

Good day,

It should be pointed out that even with this syntax, the database will still
scour all of the rows in the table.  The only savings is that the database
won't return all of these rows due to the limit statement.

It might be more efficient to use min and max to determine which row in the
database is before and after the desired row, and then only fetch those
rows.  This can easily done with subselects, but since MySQL does not
support them one will have to use multiple queries to piece it together.  Of
course, if your table is small then this is mostly irrelevant anyway.

It might also be worthwhile to note that this code can be made into one
query with the UNION statement.  However, MySQL doesn't support that part of
SQL either (although the documentation says that it's provided in version
4.X ).


Darren Gamble
Planner, Regional Services
Shaw Cablesystems GP
630 - 3rd Avenue SW
Calgary, Alberta, Canada
T2P 4L4
(403) 781-4948


-Original Message-
From: Fournier Jocelyn [Presence-PC] [mailto:[EMAIL PROTECTED]]
Sent: Friday, February 22, 2002 1:24 PM
To: Chris Boget; Raymond Gubala; Mark Lo; [EMAIL PROTECTED];
[EMAIL PROTECTED]
Subject: Re: [PHP] Next and Preview Row


Yes, but how to get ONLY the 3 records you need ?
Because often in an application, you don't care about the other records.
In this case AFAIK, there is no other solution than issuing at least two
queries :

SELECT * FROM table WHERE field='ID00025' ORDER BY field DESC LIMIT 2
SELECT * FROM table WHERE field'ID00025' ORDER BY field ASC LIMIT 1
- Original Message -
From: Chris Boget [EMAIL PROTECTED]
To: Fournier Jocelyn [Presence-PC] [EMAIL PROTECTED]; Raymond Gubala
[EMAIL PROTECTED]; Mark Lo [EMAIL PROTECTED];
[EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Friday, February 22, 2002 9:17 PM
Subject: Re: [PHP] Next and Preview Row


  It seems worst to me because in your case mysql has to retrieve all the
  rows. If it's a table with 1 million records or more, this should hurt
;)

 As I said, it was pseudo code.  Now, imagine that you were just
 getting the records for a particular user?  a particular application?
 Where there won't be millions and millions of rows?

 Chris


 -
 Before posting, please check:
http://www.mysql.com/manual.php   (the manual)
http://lists.mysql.com/   (the list archive)

 To request this thread, e-mail [EMAIL PROTECTED]
 To unsubscribe, e-mail
[EMAIL PROTECTED]
 Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




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

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




RE: [PHP] preg_replace(/^\//.. doesnt work?

2002-02-20 Thread Darren Gamble

Good day,

The first argument should just be a normal regular expression, not a
replacement regular expression.

I'm not at my server right now, but I would guess that it'll work once you
get rid of the last / in the first expression.


Darren Gamble
Planner, Regional Services
Shaw Cablesystems GP
630 - 3rd Avenue SW
Calgary, Alberta, Canada
T2P 4L4
(403) 781-4948


-Original Message-
From: John Ericson [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, February 20, 2002 1:25 PM
To: [EMAIL PROTECTED]
Subject: [PHP] preg_replace(/^\//.. doesnt work?


Im having a weird regexp problem in PHP that I think is correct but it
doesnt appear to work.

The code is this:

$a = /test/;
preg_replace(/^\//, , $a);
echo $a;

I want preg_replace to replace the first '/' in $a with '' so that the 
echo function echoes test/, but instead it echoes /test/ as if
preg_replace didnt worked? What am I doing wrong?

Im using:
PHP Version 4.1.1
Configure Command: './configure' '--with-mysql=/usr/local/mysql'
'--with-apxs=/usr/local/apache/bin/apxs' '--with-db2--disable-debug'
'--disable-static' '--enable-sockets' '--with-yp' '--with-zlib'
Regex Library: Bundled library enabled
PCRE (Perl Compatible Regular Expressions) Support: enabled
PCRE Library Version: 3.4 22-Aug-2000


Please CC me since Im not a member of this maillinglist.

-- 
* John Ericson [EMAIL PROTECTED]
* ICQ: 7325429 JID: [EMAIL PROTECTED]
* web: http://john.pp.se

-- 
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] argv and argc

2002-02-19 Thread Darren Gamble

Good day,

The array $argv contains what you're looking for (I'm not sure if this is
deprecated in 4.1.0, though) so you'll have to flip through the manual and
release notes.


Darren Gamble
Planner, Regional Services
Shaw Cablesystems GP
630 - 3rd Avenue SW
Calgary, Alberta, Canada
T2P 4L4
(403) 781-4948


-Original Message-
From: Chris Boget [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, February 19, 2002 3:00 PM
To: PHP General
Subject: [PHP] argv and argc


The other day, I was reading the docs and I just happened
across something that emulated argc and argv.  However,
I just spent 2 hours in the docs and can't find it.
Is there something in PHP that you can use to get this info?

thnx,
Chris


-- 
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] Sorting an array of arrays....

2002-02-14 Thread Darren Gamble

Good day,

uasort() should do what you need.

http://www.php.net/manual/en/function.uasort.php

There's an example for the usort function that does something similar to
what you want, in fact.


Darren Gamble
Planner, Regional Services
Shaw Cablesystems GP
630 - 3rd Avenue SW
Calgary, Alberta, Canada
T2P 4L4
(403) 781-4948


-Original Message-
From: Fifield, Mike [mailto:[EMAIL PROTECTED]]
Sent: Thursday, February 14, 2002 9:26 AM
To: [EMAIL PROTECTED]
Subject: [PHP] Sorting an array of arrays


What I am trying to do is sort a array of arrays but I want to sort by one
of the pieces of data stored in the arrays inside the array. For example;
$data[blue] = array(name, age, time, 3);
$data[green] = array(name, age, time, 7);
$data[red] = array(name, age, time, 6);
$data[yellow] = array(name, age, time, 2);
$data[white] = array(name, age, time, 1);
$data[black] = array(name, age, time, 9);

I want to be able to sort this array of arrays by the very last element, the
numbers. 

Mike Fifield
Charles Schwab  Co, Inc.
WARNING: All e-mail sent to or from this address will be received by the
Charles Schwab corporate e-mail system and is subject to archival and review
by someone other than the recipient.



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

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




RE: [PHP] Re-Importing .CSV file into Database

2002-02-13 Thread Darren Gamble

Good day,

The proper syntax is:

INTO TABLE table

and not:

INTO table


Darren Gamble
Planner, Regional Services
Shaw Cablesystems GP
630 - 3rd Avenue SW
Calgary, Alberta, Canada
T2P 4L4
(403) 781-4948


-Original Message-
From: Thomas Edison Jr. [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, February 13, 2002 9:54 AM
To: Jason Murray
Cc: [EMAIL PROTECTED]
Subject: RE: [PHP] Re-Importing .CSV file into Database


Hi,

Ok, considering the FULL PATH and the QUOTES thingy,
this is the code i'm applying :

?php
$db = mysql_connect(localhost,mydb,pwd);
mysql_select_db(mydb,$db);

$query = LOAD DATA INFILE 'D:\Apache
Group\Apache\htdocs\mjimm\php3\tabledata\fanlist.csv'
INTO fanlist_try FIELDS TERMINATED BY ',' OPTIONALLY
ENCLOSED BY '\' LINES TERMINATED BY '\n' ;

mysql_query($query) or die(error:. mysql_error());
?

And this is the error i'm getting :

error:You have an error in your SQL syntax near
'fanlist_try FIELDS TERMINATED BY ',' OPTIONALLY
ENCLOSED BY '' LINES TERMINATED' at line 1

So... what's the problem??

Thanks guys, though.
T. Edison jr.



=
Rahul S. Johari (Director)
**
Abraxas Technologies Inc.
Homepage : http://www.abraxastech.com
Email : [EMAIL PROTECTED]
Tel : 91-4546512/4522124
***

__
Do You Yahoo!?
Send FREE Valentine eCards with Yahoo! Greetings!
http://greetings.yahoo.com

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

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




RE: [PHP] Re-Importing .CSV file into Database

2002-02-13 Thread Darren Gamble

Good day,

That's difficult to say, as I'm not familiar with running MySQL on Windows.

You should print out $query, and then make sure the file exists and that the
MySQL server has the permissions to read it.   Remember that it's the server
that's reading in the file, not whatever the client is (be it PHP or
whatever).

You should really take this conversation over to a MySQL list, since you
need help with MySQL and not PHP.


Darren Gamble
Planner, Regional Services
Shaw Cablesystems GP
630 - 3rd Avenue SW
Calgary, Alberta, Canada
T2P 4L4
(403) 781-4948


-Original Message-
From: Thomas Edison Jr. [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, February 13, 2002 10:35 AM
To: Darren Gamble
Cc: [EMAIL PROTECTED]
Subject: RE: [PHP] Re-Importing .CSV file into Database


Hi Darren,

Actually your code worked, those errors did go way by
putting in INTO TABLE .. but there's a very funny new
problem.

I get this error on the page :

error:Access denied for user: 'mjimm@localhost' (Using
password: YES)

And believe me, i'm using the correct password/user!
The same file, i just insert any other code than the
$query, it works! But if i use the loading data infile
code.. it gives me this access denied error! What is
happening!!

T. Edison jr.



--- Darren Gamble [EMAIL PROTECTED] wrote:
 Good day,
 
 The proper syntax is:
 
 INTO TABLE table
 
 and not:
 
 INTO table
 
 
 Darren Gamble
 Planner, Regional Services
 Shaw Cablesystems GP
 630 - 3rd Avenue SW
 Calgary, Alberta, Canada
 T2P 4L4
 (403) 781-4948
 
 
 -Original Message-
 From: Thomas Edison Jr.
 [mailto:[EMAIL PROTECTED]]
 Sent: Wednesday, February 13, 2002 9:54 AM
 To: Jason Murray
 Cc: [EMAIL PROTECTED]
 Subject: RE: [PHP] Re-Importing .CSV file into
 Database
 
 
 Hi,
 
 Ok, considering the FULL PATH and the QUOTES thingy,
 this is the code i'm applying :
 
 ?php
 $db = mysql_connect(localhost,mydb,pwd);
 mysql_select_db(mydb,$db);
 
 $query = LOAD DATA INFILE 'D:\Apache

Group\Apache\htdocs\mjimm\php3\tabledata\fanlist.csv'
 INTO fanlist_try FIELDS TERMINATED BY ',' OPTIONALLY
 ENCLOSED BY '\' LINES TERMINATED BY '\n' ;
 
 mysql_query($query) or die(error:. mysql_error());
 ?
 
 And this is the error i'm getting :
 
 error:You have an error in your SQL syntax near
 'fanlist_try FIELDS TERMINATED BY ',' OPTIONALLY
 ENCLOSED BY '' LINES TERMINATED' at line 1
 
 So... what's the problem??
 
 Thanks guys, though.
 T. Edison jr.
 
 
 
 =
 Rahul S. Johari (Director)
 **
 Abraxas Technologies Inc.
 Homepage : http://www.abraxastech.com
 Email : [EMAIL PROTECTED]
 Tel : 91-4546512/4522124
 ***
 
 __
 Do You Yahoo!?
 Send FREE Valentine eCards with Yahoo! Greetings!
 http://greetings.yahoo.com
 
 -- 
 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
 


=
Rahul S. Johari (Director)
**
Abraxas Technologies Inc.
Homepage : http://www.abraxastech.com
Email : [EMAIL PROTECTED]
Tel : 91-4546512/4522124
***

__
Do You Yahoo!?
Send FREE Valentine eCards with Yahoo! Greetings!
http://greetings.yahoo.com

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




RE: [PHP] how a function 'return' statement works

2002-02-13 Thread Darren Gamble

Good day,

You're returning $current_page_name.

$current_page_name is set to the return value for array_slice.

And array_slice returns an array.

So, $current_page_name will be an array.

So, you'll always return an array.


I think what you're trying to do is return one particular element out of the
array.  If that's the case, just use something like:

return $current_page_name[-1]

to return the last element in the array.


Darren Gamble
Planner, Regional Services
Shaw Cablesystems GP
630 - 3rd Avenue SW
Calgary, Alberta, Canada
T2P 4L4
(403) 781-4948


-Original Message-
From: Erik Price [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, February 13, 2002 2:56 PM
To: PHP
Subject: [PHP] how a function 'return' statement works



Can anyone give my puny mind an explanation as to why the following 
function only returns the value Array ?

# ===
# get_current_page_name()
# ---
# Returns the current document
#  Arguments
# ---
# no arguments
# ===

function get_current_page_name()
{
$current_page_name = explode(/, $_SERVER['PHP_SELF']);
$current_page_name = array_slice($current_page_name, -1);
return $current_page_name;
}

(I know this does the same thing as 'basename($_SERVER['PHP_SELF'])', I 
just want to understand something a bit more fundamental to the way 
functions work)

Thanks,



Erik






Erik Price
Web Developer Temp
Media Lab, H.H. Brown
[EMAIL PROTECTED]


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

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




RE: [PHP] PHP and CGI

2002-02-12 Thread Darren Gamble

Good day,

The php file can have whichever extension that you want, provided that the
webserver understands which application is associated with which extension.

If you want to run a PHP script as a CGI or without the webserver , just
install the PHP standalone executable.  This is done by default with many
RPM packages, and can easily be done with a tarball.

To run the script, just put:

#!/usr/local/bin/php

(or whatever location it's installed into) as the first line of your php
script.  Your CGI program can run this program like any other shell command
and get the results.

Also, if the extension is .cgi , your web server should understand that it's
a cgi program and exec it appropriately.


Darren Gamble
Planner, Regional Services
Shaw Cablesystems GP
630 - 3rd Avenue SW
Calgary, Alberta, Canada
T2P 4L4
(403) 781-4948


-Original Message-
From: hugh danaher [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, February 12, 2002 1:20 PM
To: [EMAIL PROTECTED]; php
Subject: Re: [PHP] PHP and CGI


That I know, the file with the php code needs to have the extension of .php
I absolutely don't know anything about CGI, but could you somehow include
a .php file in your script?
- Original Message -
From: SpyProductions Support Team [EMAIL PROTECTED]
To: hugh danaher [EMAIL PROTECTED]; php
[EMAIL PROTECTED]
Sent: Tuesday, February 12, 2002 12:07 PM
Subject: RE: [PHP] PHP and CGI



 No, it is in a CGI script.

 And I can't recompile PHP for cgi extensions.  :(

 -Mike


  -Original Message-
  From: hugh danaher [mailto:[EMAIL PROTECTED]]
  Sent: Tuesday, February 12, 2002 2:43 PM
  To: [EMAIL PROTECTED]; php
  Subject: Re: [PHP] PHP and CGI
 
 
  is your file extension .php?
  hugh
  - Original Message -
  From: SpyProductions Support Team [EMAIL PROTECTED]
  To: [EMAIL PROTECTED]
  Sent: Tuesday, February 12, 2002 11:25 AM
  Subject: [PHP] PHP and CGI
 
 
  
   I did some research in the archives on this, but couldn't come up with
a
   straight answer.
  
   I have a CGI script that uses and HTML template/form.  I would like to
  embed
   a PHP script in the template to take some of the values of the
  CGI and put
   them in a database.  I set up the database, wrote the PHP, but now
find
  that
   the CGI script apparently won't recognize my PHP.
  
   Anyone have any ideas as to what I need to do?
  
   The CGI is a preset thing I can't re-write in PHP (at least for
  now).  And
  I
   don't know much CGI myself.
  
   Thanks!
  
   -Mike
  
  
  
   --
   PHP General Mailing List (http://www.php.net/)
   To unsubscribe, visit: http://www.php.net/unsub.php
  
 
 




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

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




RE: [PHP] PHP and CGI

2002-02-12 Thread Darren Gamble

Good day.

That's not a comment.  The #! at the start tells the shell to execute that
as the interpreter for the script.

Are you sure that you typed it in correctly?

Did you install the PHP standalone application?

Is it installed in that location?

Did you set the file as executable?

Did you try to run the script?

What error did you receive?


Darren Gamble
Planner, Regional Services
Shaw Cablesystems GP
630 - 3rd Avenue SW
Calgary, Alberta, Canada
T2P 4L4
(403) 781-4948


-Original Message-
From: Michael R @ Spy [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, February 12, 2002 2:28 PM
To: Darren Gamble; php
Subject: RE: [PHP] PHP and CGI



I made some time to test, and no dice.  The comment doesn't seem to matter.
:(

Thanks,

-Mike


 -Original Message-
 From: Darren Gamble [mailto:[EMAIL PROTECTED]]
 Sent: Tuesday, February 12, 2002 3:26 PM
 To: 'hugh danaher'; [EMAIL PROTECTED]; php
 Subject: RE: [PHP] PHP and CGI


 Good day,

 The php file can have whichever extension that you want, provided that the
 webserver understands which application is associated with which
 extension.

 If you want to run a PHP script as a CGI or without the webserver , just
 install the PHP standalone executable.  This is done by default with many
 RPM packages, and can easily be done with a tarball.

 To run the script, just put:

 #!/usr/local/bin/php

 (or whatever location it's installed into) as the first line of your php
 script.  Your CGI program can run this program like any other
 shell command
 and get the results.

 Also, if the extension is .cgi , your web server should
 understand that it's
 a cgi program and exec it appropriately.

 
 Darren Gamble
 Planner, Regional Services
 Shaw Cablesystems GP
 630 - 3rd Avenue SW
 Calgary, Alberta, Canada
 T2P 4L4
 (403) 781-4948


 -Original Message-
 From: hugh danaher [mailto:[EMAIL PROTECTED]]
 Sent: Tuesday, February 12, 2002 1:20 PM
 To: [EMAIL PROTECTED]; php
 Subject: Re: [PHP] PHP and CGI


 That I know, the file with the php code needs to have the
 extension of .php
 I absolutely don't know anything about CGI, but could you somehow
 include
 a .php file in your script?
 - Original Message -
 From: SpyProductions Support Team [EMAIL PROTECTED]
 To: hugh danaher [EMAIL PROTECTED]; php
 [EMAIL PROTECTED]
 Sent: Tuesday, February 12, 2002 12:07 PM
 Subject: RE: [PHP] PHP and CGI


 
  No, it is in a CGI script.
 
  And I can't recompile PHP for cgi extensions.  :(
 
  -Mike
 
 
   -Original Message-
   From: hugh danaher [mailto:[EMAIL PROTECTED]]
   Sent: Tuesday, February 12, 2002 2:43 PM
   To: [EMAIL PROTECTED]; php
   Subject: Re: [PHP] PHP and CGI
  
  
   is your file extension .php?
   hugh
   - Original Message -
   From: SpyProductions Support Team [EMAIL PROTECTED]
   To: [EMAIL PROTECTED]
   Sent: Tuesday, February 12, 2002 11:25 AM
   Subject: [PHP] PHP and CGI
  
  
   
I did some research in the archives on this, but couldn't
 come up with
 a
straight answer.
   
I have a CGI script that uses and HTML template/form.  I
 would like to
   embed
a PHP script in the template to take some of the values of the
   CGI and put
them in a database.  I set up the database, wrote the PHP, but now
 find
   that
the CGI script apparently won't recognize my PHP.
   
Anyone have any ideas as to what I need to do?
   
The CGI is a preset thing I can't re-write in PHP (at least for
   now).  And
   I
don't know much CGI myself.
   
Thanks!
   
-Mike
   
   
   
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
   
  
  
 
 


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

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




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




[PHP] Installing PHP 4.1.1 on Redhat w/ RPMs

2002-02-04 Thread Darren Gamble

Good day,

This isn't strictly a PHP question, but, I am hoping someone on this list
has gone through this already and can provide some assistance.

I'd like to upgrade to PHP 4.1.1 on our Redhat 7.2 servers, and so I've
downloaded all of the PHP RPMs from Rawhide.  I would really, really like to
do this with RPMs if at all possible.

When I go to install, I find out that:


error: failed dependencies:
libcrypto.so.3   is needed by php-4.1.1-1


OK, no problem so far.  I just need to get the new openssl packages.

But, after downloading them and adding them to the install list, I then find
that libcrypto.so.2 (which would be replaced by libcrypto.so.3) is needed by
dozens of packages on the system.  I really can't upgrade them all.

I am just going from openssl-0.9.6b-8 to openssl-0.9.6c-2 .  It appears to
me that openssl must have changed the API for their library between an
extremely minor version number (is that even supposed to happen?), which is
what I think is causing me the problem.

I'm not quite sure how to proceed.  Has anyone else on the list done this
yet?

Thanks to all who reply,


Darren Gamble
Planner, Regional Services
Shaw Cablesystems GP
630 - 3rd Avenue SW
Calgary, Alberta, Canada
T2P 4L4
(403) 781-4948

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




RE: [PHP] Tables Loading Slow

2002-01-30 Thread Darren Gamble

Good day,

As it has been said, this is a function of the browser.

You can get around this by not using a large table to render your data.  You
could use one table per row, with all columns formatted with the same width.
You could also try to use SPAN containers to store the data, but in my
experience only IE supports the width style attribute of these.

You will also have to ensure that PHP is flushing the output as it displays
it.

And, you could also optimize your data structure so that the results are
returned quicker. =)


Darren Gamble
Planner, Regional Services
Shaw Cablesystems GP
630 - 3rd Avenue SW
Calgary, Alberta, Canada
T2P 4L4
(403) 781-4948


-Original Message-
From: Bryan Gintz [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, January 30, 2002 7:39 AM
To: PHP List
Subject: [PHP] Tables Loading Slow


Hi.
I have a large database query that returns anywhere from 10-30ish 
records.  The problem comes from loading them in tables.  With IE5 and 
Netscape 5 on windows, the results do not display until the last 
/table tag is written.  Does anyone have any ideas on how to show the 
results as the come from the query?

Thanks.


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] mailing to 19000 users

2002-01-28 Thread Darren Gamble

Good day,

I've already done this once with Perl and qmail, which was used against
about 50,000 users.  I'm sure it would not be much different with PHP.

All I did was create a program to get the addresses from the DB, and then
use what effectively is a wrapper script for qmail-inject (you would use
whatever program you use) that would add 500 people to the BCC list at a
time and pass the text of the e-mail to the program via a pipe.

It was about a 15 minute job.  I would recommend it, as it's easy to convert
if you have to switch MTAs.


Darren Gamble
Planner, Regional Services
Shaw Cablesystems GP
630 - 3rd Avenue SW
Calgary, Alberta, Canada
T2P 4L4
(403) 781-4948


-Original Message-
From: Jason Wong [mailto:[EMAIL PROTECTED]]
Sent: Monday, January 28, 2002 8:37 AM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] mailing to 19000 users


On Monday 28 January 2002 23:33, Anas Mughal wrote:
 I am soon to encounter the problem Mostafa is facing.
 Currently, I have written my custom code to mail to
 users subscribed to mailing lists on my site. (It is
 custom code using PHP, MySQL, Linux cron.)
 I was wondering if there is a mailing list system that
 could use MySQL to retreive the list of subscribers.
 Thanks.

If you're using qmail, then ezmlm (or even better ezmlm-idx) can be made to 
work with MySQL.


-- 
Jason Wong - Gremlins Associates - www.gremlins.com.hk

/*
Leveraging always beats prototyping.
*/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] browser back button - Page has Expired.. problem

2002-01-28 Thread Darren Gamble

Good day,

By default, IE will cache these pages (i.e. you won't get this message).

If you're receiving that message, it means that the browser doesn't have a
cached version of the page.  Getting a new version would obviously mean
submitting the form information again, which IE, thankfully, doesn't
automatically do.

It may be that the IE users aren't caching their pages, or the cache is
automatically cleaned (had this happen once with users writing onto their
profile).  Or, it may be that meta tags on the page have instructed the
browser not to cache the page, or to quickly expire it.  You should check
the page source for such headers.

I know it is tempting to trash-talk IE, but in this situation, regardless of
the problem, most likely the browser is just doing what the user or web page
has instructed it to do.


Darren Gamble
Planner, Regional Services
Shaw Cablesystems GP
630 - 3rd Avenue SW
Calgary, Alberta, Canada
T2P 4L4
(403) 781-4948


-Original Message-
From: Lee P Reilly [mailto:[EMAIL PROTECTED]]
Sent: Monday, January 28, 2002 3:27 PM
To: PHP List
Subject: [PHP] browser back button - Page has Expired..  problem


Hi,

I wonder if anyone can offer me a few pointers..?

I'm building a portal to do various bits and bobs. I'm using sessions to
facilitate the user authentication/login, etc. The only problem I have
is that when viewing these (.php) pages in IE once the session variable
has been set, a Warning: Page has Expired  page is displayed whenever
the 'Back' button is pressed. This means that the user can only access
the page again by hitting 'Refresh' (and therefore posting the form data
back  executing whatever scripts again).

The rest of IE's error message reads, The page you requested was
created using information you submitted in a form. This page is no
longer available. As a security precaution, Internet Explorer does not
automatically resubmit your information for you.

I know from using other web applications (Hotmail is one example), that
this doesn't always have to be the case. Is there anyway I can eliminate
this security precaution on the *server side* i.e. without telling users
to ditch IE ;-)

Thanks very much in advance for any advice.

- Best regards,

   Lee


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] break statement usage

2002-01-25 Thread Darren Gamble

Good day,

Actually, using the break statement is the accepted, proper way to break
out of a switch statement, just as it is in other programming languages.

And yes, the break statement can be used to terminate other loops, such as
while and for, just like in other languages.  Using it there is not
considered bad programming practice either, although in the case of the
while statement you should try to utilize the loop condition if possible.
FYI, the command to break to the next iteration of a loop is continue.

The PHP site has very good documentation on the usage and appropriateness
for switch, break and continue.  I would highly recommend you take a
look, if you have not already.


Darren Gamble
Planner, Regional Services
Shaw Cablesystems GP
630 - 3rd Avenue SW
Calgary, Alberta, Canada
T2P 4L4
(403) 781-4948


-Original Message-
From: Erik Price [mailto:[EMAIL PROTECTED]]
Sent: Friday, January 25, 2002 2:11 PM
To: PHP
Subject: [PHP] break statement usage


Hello, all

I have a quick question about using the break statement from within a 
switch() statement.

After accepting user input from a form, I want to run this input through 
some error checking via PHP code (not Javascript error checking).  So 
the first thing is the code puts the input through to a couple of error 
functions (this is all inside of a switch statement that is determined 
by a radio button on the previous page).  If the error functions show 
the input as invalid, I echo back a specific error-message telling the 
user which field needs to be fixed, and then break to end the case 
statement.  That way the input never comes near the database functions 
(mysql_query()) if it is invalid input.

Is this a poor way to code -- using the break as a shortcut to jump 
out of the switch statement?  Are there other ways that break can be 
used -- such as from loops?  I've been learning Python on the side, and 
in that language, the break statement is used often, sometimes in a 
loop like

while 1
   do some code
   if condition is true
  break

This is basically an infinite loop until the condition is true -- though 
I've never seen a WHILE loop in PHP that is formed this way (using a 1 
to make it happen infinitely until a condition is met and then BREAKing 
out of the loop).  Usually, at least from what I've seen, PHP WHILE 
loops are constructed so that they terminate when a condition is met 
specified immediately after the WHILE, as in:

while (x  $number_of_iterations) {
 do some code
}

So what I'm wondering is,

Is it bad coding practice to make heavy use of break statements in 
switch() flow control?

Thank you for your opinions,

Erik


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] bug in echo function?

2002-01-18 Thread Darren Gamble

Good day,

The reason that the first statement doesn't work as intended is due to the
order that the operands are processed.

The operands in the line:

td . ($i*8)+$j . /td

are being processed like this:

(td . ($i*8))+($j . /td)

If you change the line to:

td . (($i*8)+$j) . /td

then you'll get the desired result.

Rule of thumb: Use parenthesis whenever you have a complex operation to
ensure the result is what you want.


Darren Gamble
Planner, Regional Services
Shaw Cablesystems GP
630 - 3rd Avenue SW
Calgary, Alberta, Canada
T2P 4L4
(403) 781-4948


-Original Message-
From: Billy Harvey [mailto:[EMAIL PROTECTED]]
Sent: Friday, January 18, 2002 11:44 AM
To: php
Subject: [PHP] bug in echo function?


I ran across a curious bug in the echo function this morning.  My PHP is
Debian binary 4.1.1-1.

The first example below does not work (it should draw a
checkerboard-like table):

-

html
head
titleChess/title
body
table border=1
?

for ($i=0 ; $i8 ; $i++) {
  echo tr align=center valign=center;
  for ($j=0 ; $j8 ; $j++) {
echo td . ($i*8)+$j . /td;
  }
  echo /tr\n;
}

?
/table
/body
/html

-

However, by changing the echo line to two echo lines, it works as
desired:

-

html
head
titleChess/title
body
table border=1
?

for ($i=0 ; $i8 ; $i++) {
  echo tr align=center valign=center;
  for ($j=0 ; $j8 ; $j++) {
echo td;
echo ($i*8)+$j . /td;
  }
  echo /tr\n;
}

?
/table
/body
/html

-

I don't see any limitations about concatenating strings in the man page
of the echo statement.  Perhaps this is a bug?

Billy



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] bug in echo function?

2002-01-18 Thread Darren Gamble

Good day,

No, that's not it.

It's just a simple matter of order of operations.  You have an expression-
that expression needs to be evaluated into one thing, and that one thing is
then passed to echo() as the single argument.

I'm not a php expert, but evidently the . operator is evaluated before the
* operator, which in turn is evaluated before the + operator. 

Perhaps it would be easier to understand if you thought of the . operator
like the exponent operator in math- it is evaluated before * or + is.


Darren Gamble
Planner, Regional Services
Shaw Cablesystems GP
630 - 3rd Avenue SW
Calgary, Alberta, Canada
T2P 4L4
(403) 781-4948


-Original Message-
From: Billy Harvey [mailto:[EMAIL PROTECTED]]
Sent: Friday, January 18, 2002 12:07 PM
To: Darren Gamble
Cc: php
Subject: RE: [PHP] bug in echo function?


On Fri, 2002-01-18 at 13:54, Darren Gamble wrote:
 Good day,
 
 The reason that the first statement doesn't work as intended is due to the
 order that the operands are processed.
 
 The operands in the line:
 
 td . ($i*8)+$j . /td
 
 are being processed like this:
 
 (td . ($i*8))+($j . /td)
 
 If you change the line to:
 
 td . (($i*8)+$j) . /td
 
 then you'll get the desired result.
 
 Rule of thumb: Use parenthesis whenever you have a complex operation to
 ensure the result is what you want.

Hmmm - so my assumption that the concatenation operator between the
strings gives them a delination equivalent to listing this as three
separate echo statements is incorrect, I take it.

Shouldn't the echo function process it in this manner from a standpoint
of consistency?

Thanks for the clarification.

Billy

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] how to send to URL on if statement?

2002-01-18 Thread Darren Gamble

Good day,

I've had to do something similar to this.

I do not think there is a way to do this with only HTML- you either need to
use a header like the one shown, or a META tag, and they have to be written
right away.

I worked around this once with Javascript.  The page had an ONLOAD function
that would look on the page for a URL (stored as a hidden input element) and
then try to go there if the input element had any data in it.  This works
nicely since you don't actually have to write this data with PHP until
you're ready to close your BODY tag.  Then, when the page is loaded, the
ONLOAD triggers and does its work.

I don't have the code on me, but this should be a good enough push in the
right direction.

Hope this helps,


Darren Gamble
Planner, Regional Services
Shaw Cablesystems GP
630 - 3rd Avenue SW
Calgary, Alberta, Canada
T2P 4L4
(403) 781-4948


-Original Message-
From: Andrea Caldwell [mailto:[EMAIL PROTECTED]]
Sent: Friday, January 18, 2002 2:19 PM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] how to send to URL on if statement?


Sorry,  I'm new at this...

I have already sent output... any way to do this?

Thanks again,
Andrea

Ing. Daniel Manrique [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
  Can anyone advise or direct me to the documentation that references how
to
  send a user to a URL if an 'if' statement is satisfied?

 Assuming you hadn't sent any output before:

 if ($condition){
 header(Location: http://wherever.com;);
 exit;
 }




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] RTFM

2002-01-18 Thread Darren Gamble

Good day,

I would agree that there certainly are some questions that deserve a bit
more thought before they are posted to the list.  Witness, for example,
posters who respond to their own question 10 minutes later with Never mind,
I solved it.

However, I don't think anyone is in a position to say whether a question is
stupid or not.  Sometimes there is a simple way to do something, but it
escapes the poster who is otherwise a good programmer.

Or, sometimes, it's just because other readers don't read the question
properly, and think it's a lot simpler than it really is.  I know I, on
_many_ occasions, have posted I need to do foo, and A won't work because X,
and B would be too much overhead because Y and have people answer with my
own rejected solution Do A, you newbie , obviously without even reading
the entirety of the message.  With apologies to Bart, I will point out that
the question that Bart quoted is a perfectly valid question with non-trivial
solutions.  The original poster is well aware of how if statements work,
but that appeared to be lost in Bart's reading.  Does using Javascript to
redirect a user to another page have to do anything with PHP?  In this case
... yes!  The situation described by the original poster would be something
that only a PHP programmer (or ASP, etc.) would run into, where a user has
to make a decision whether or not to redirect a user halfway though a page.
Where would be the best place to ask for advice on how to do that?  Is this
PHP mailing list perhaps not the MOST suitable place for something like
that?

Yes, for a user to succeed with a programming language it's important that
they not use a mailing list as a crutch, and be told to examine the
documentation when appropriate (especially documentation as good as it is
with PHP).  But I, for one, would much rather have a friendly community such
as this one to encourage and support the use of PHP for all.

My two cents CND (one cent USD).


Darren Gamble
Planner, Regional Services
Shaw Cablesystems GP
630 - 3rd Avenue SW
Calgary, Alberta, Canada
T2P 4L4
(403) 781-4948


-Original Message-
From: Bart Brinkmann [mailto:[EMAIL PROTECTED]]
Sent: Friday, January 18, 2002 3:25 PM
To: Andrew; Nick Wilson; [EMAIL PROTECTED]
Subject: RE: [PHP] RTFM


 no such thing as a stupid question...

I strongly disagree. Refer to the topic: RTFM. A stupid question is one
that is posted to this message board before the poster bothers to do a shred
of independent thinking. I've seen way too many of these questions come
through this list. The MySQL list was about the same. It was more of a
bother to read than it was a benefit. This list is about the same quality.
Every once in a long while something useful comes along, but unfortunately
their burried underneath 100 other postings of lazy newbies asking questions
like *scrolls about 10 messages down* How to send url on if statement.

1) if statements are surely covered on php.net
2) It is not a php-specific question
3) If you don't understand how if statements work, use that 8lb mass on
your shoulders - RTFM

Just my $0.02 USD.

/bart

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] sql question

2002-01-15 Thread Darren Gamble

Good day,

This isn't a PHP question, but hey...

This is dependant on the database platform that you're using.  The suggested
statement would work on MySQL.  On Informix, for example, you would say
'where lit_source matches c* '.

You should consult your database manual for more information.


Darren Gamble
Planner, Regional Services
Shaw Cablesystems GP
630 - 3rd Avenue SW
Calgary, Alberta, Canada
T2P 4L4
(403) 781-4948


-Original Message-
From: Janet Valade [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, January 15, 2002 3:04 PM
To: Wolf-Dietrich von Loeffelholz; [EMAIL PROTECTED]
Subject: Re: [PHP] sql question


select * from tbl_lit where lit_source like c%

Janet

- Original Message - 
From: Wolf-Dietrich von Loeffelholz [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Tuesday, January 15, 2002 12:09 PM
Subject: [PHP] sql question


i want that a select query display me all words beginning with an a ..
like select * from tbl_lit where lit_source = 'c*' .. 
 
thnx bSue



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Possible bug: Using h and H with unpack()

2002-01-10 Thread Darren Gamble

Good day,

I can not seem to get the h or H options to work at all with unpack().

I'm pretty sure that I have this right, although the documentation for this
function is bit sparse.

The code:


  print The data has been encoded (.strlen($varbind). bytes in size).;

  print Hex: PRE ;
  $hex_unpacked = unpack( H* , $varbind );
  for ( $i=1 ; $i = sizeof($hex_unpacked) ; $i++) {
print $hex_unpacked[$i] . |;
  }
  print \n. sizeof($hex_unpacked) .  elements unpacked.\n;
  print /PRE\n;


prints out:


The data has been encoded (20 bytes in size).Hex: 
 |
1 elements unpacked.


.. for the sample binary string.  If I use C* instead of H* (to print
out characters instead of hex strings) then I get the expected result:


The data has been encoded (20 bytes in size).Hex: 
 6|49|0|2|52|0|0|0|0|48|57|6|49|0|2|52|0|0|0|0|
20 elements unpacked.


Now, I can work around this problem by combining sprintf with the C*
format to format the characters into hex strings.  But, if this is a bug
then it should be addressed.

Alternatively, if unpack() isn't supposed to support all of the options of
pack() (such as H and h) then the documentation should state which
options it can support.

Is this a bug, or have I just missed something?


Darren Gamble
Planner, Regional Services
Shaw Cablesystems GP
630 - 3rd Avenue SW
Calgary, Alberta, Canada
T2P 4L4
(403) 781-4948

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] regular expression

2001-12-19 Thread Darren Gamble

Good day,

The problem here is with the .* expression, which matches any character,
including  .  The regex is greedy and will try and match as much as it
possibly can.

What you could do is change it so that it doesn't match  .  Then, the 
will be matched later in the expression,, as you want.

So, [^]* instead of .* should do it, I believe.


Darren Gamble
Planner, Regional Services
Shaw Cablesystems GP
630 - 3rd Avenue SW
Calgary, Alberta, Canada
T2P 4L4
(403) 781-4948


-Original Message-
From: Wakan [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, December 19, 2001 9:08 AM
To: [EMAIL PROTECTED]
Subject: [PHP] regular expression


Hi,
Can you help me on this simple regexp?
I've this string:
$testata = tr bgcolor=\#FF9900\ valign=\middle\td colspan=\2\
align=\center\ height=\11\div align=\left\ class=\titoliblu\NEWS
A ROTAZIONE/div/tdtd class=\titolipiccolibianchi\ align=\center\
height=\11\ width=\10%\cancella/td/tr;

and this eregi:
eregi(^tr(.*)(.*)/tr$,$header,$regs);

In this way I'd like to obtain the properties of the row
(ie: bgcolor=\#FF9900\ valign=\middle\)
and all the columns in the row (the content of each pair td.../td).

I'm expecting to have this:
in $reg[1]: bgcolor=\#FF9900\ valign=\middle\
in $reg[2]: td colspan=\2\ align=\center\ height=\11\div
align=\left\ class=\titoliblu\NEWS A ROTAZIONE/div/tdtd
class=\titolipiccolibianchi\ align=\center\ height=\11\
width=\10%\cancella/td

Instead I''ve this:
$reg[1]: bgcolor=\#FF9900\ valign=\middle\td colspan=\2\
align=\center\ height=\11\div align=\left\ class=\titoliblu\NEWS
A ROTAZIONE/div/tdtd class=\titolipiccolibianchi\ align=\center\
height=\11\ width=\10%\cancella/td

ie the last  was found, but I'd like the FIRST one!!

Can someone give me a solution?
Thanks, Carlo


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] regular expression: THANK YOU!!!!!!

2001-12-19 Thread Darren Gamble

Good day,

There's a link on PHP's site to
http://www.phpbuilder.com/columns/dario19990616.php3 .  It looks pretty
good.

There are many other sites on the 'Net with regular expression
references/tutorials.  You can probably find some more with just a search
engine.


Darren Gamble
Planner, Regional Services
Shaw Cablesystems GP
630 - 3rd Avenue SW
Calgary, Alberta, Canada
T2P 4L4
(403) 781-4948


-Original Message-
From: Wakan [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, December 19, 2001 10:21 AM
To: Darren Gamble
Subject: RE: [PHP] regular expression: THANK YOU!!


If fact: that's the solution!
It works.
I don't know how to thank you.
As have you surely notice, I'd need a good regexp (POSIX) manual.
have you some good links??
Thanks very much again, Carlo (excuse my English too)

At 09.10 19/12/2001 -0700, you wrote:
Good day,

The problem here is with the .* expression, which matches any character,
including  .  The regex is greedy and will try and match as much as it
possibly can.

What you could do is change it so that it doesn't match  .  Then, the 
will be matched later in the expression,, as you want.

So, [^]* instead of .* should do it, I believe.


Darren Gamble
Planner, Regional Services
Shaw Cablesystems GP
630 - 3rd Avenue SW
Calgary, Alberta, Canada
T2P 4L4
(403) 781-4948


-Original Message-
From: Wakan [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, December 19, 2001 9:08 AM
To: [EMAIL PROTECTED]
Subject: [PHP] regular expression


Hi,
Can you help me on this simple regexp?
I've this string:
$testata = tr bgcolor=\#FF9900\ valign=\middle\td colspan=\2\
align=\center\ height=\11\div align=\left\ class=\titoliblu\NEWS
A ROTAZIONE/div/tdtd class=\titolipiccolibianchi\ align=\center\
height=\11\ width=\10%\cancella/td/tr;

and this eregi:
eregi(^tr(.*)(.*)/tr$,$header,$regs);

In this way I'd like to obtain the properties of the row
(ie: bgcolor=\#FF9900\ valign=\middle\)
and all the columns in the row (the content of each pair td.../td).

I'm expecting to have this:
in $reg[1]: bgcolor=\#FF9900\ valign=\middle\
in $reg[2]: td colspan=\2\ align=\center\ height=\11\div
align=\left\ class=\titoliblu\NEWS A ROTAZIONE/div/tdtd
class=\titolipiccolibianchi\ align=\center\ height=\11\
width=\10%\cancella/td

Instead I''ve this:
$reg[1]: bgcolor=\#FF9900\ valign=\middle\td colspan=\2\
align=\center\ height=\11\div align=\left\ class=\titoliblu\NEWS
A ROTAZIONE/div/tdtd class=\titolipiccolibianchi\ align=\center\
height=\11\ width=\10%\cancella/td

ie the last  was found, but I'd like the FIRST one!!

Can someone give me a solution?
Thanks, Carlo


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] http referer problems

2001-12-13 Thread Darren Gamble

Good day,

It's a bit difficult to determine what the problem is without more
information.

If you add before this:

echo pre|$efa|/prepre|$HTTP_REFERER|/pre;

What is the output?


Darren Gamble
Planner, Regional Services
Shaw Cablesystems GP
630 - 3rd Avenue SW
Calgary, Alberta, Canada
T2P 4L4
(403) 781-4948


-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Thursday, December 13, 2001 7:58 AM
To: [EMAIL PROTECTED]
Subject: [PHP] http referer problems


For some reason, the following if  statement isn't working.  Maybe I haven't
had enough coffee to drink or maybe I've had too much - what am I missing?

if ($efa != nm || $HTTP_REFERER !=
http://www.globalhealth.org/news/article.php3?id=1526;){
do this);
}

Thank you, Shawna

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] RE: @file problems w/ remote files

2001-12-11 Thread Darren Gamble

Good day,

I had not even noticed the @ character... and you are right, your original
setup should have supressed the message.

Most likely this is a bug; it would be worthwhile to post it on PHP's bug
list to prevent future pain and suffering for people doing the same thing.
=)

Question, though... if the host is resolvable, but the file does not exist,
does the function print an error (with the @ character)?


Darren Gamble
Planner, Regional Services
Shaw Cablesystems GP
630 - 3rd Avenue SW
Calgary, Alberta, Canada
T2P 4L4
(403) 781-4948


-Original Message-
From: Joseph Fung [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, December 11, 2001 6:24 AM
To: PHP General Mailing List
Subject: RE: [PHP] RE: @file problems w/ remote files


Thanks Tim,

I had aready tried that and it didn't work either - go figure.

I did, however, manage to work around the problem by setting
error_reporting(0) before the operation, then returning error_reporting to
it's previous value, and continuing on my mery way.

Thanks for all the suggestions,

Joseph

-Original Message-
From: Tim Ward [mailto:[EMAIL PROTECTED]]
Sent: December 11, 2001 4:55 AM
To: PHP General Mailing List; Joseph Fung
Subject: [PHP] RE: @file problems w/ remote files


How about wrapping the @file(...); in an if(file_exists(...)) {...}

Doesn't seem to give an error at all , even without the @. I've tested this
on non-existant domain names and with my firewall internet connection
blocked.

Tim
http://www.chessish.com/ http://www.chessish.com/

Thanks for any help - sorry for the miscommunication earlier.

Joseph


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] php as cron

2001-12-10 Thread Darren Gamble

Good day,

Doesn't having the statement #!/usr/local/bin/php -q at the start of the
program makes running php (rather than the script itself) redundant?  Why
not just call the script in the crontab?


Darren Gamble
Planner, Regional Services
Shaw Cablesystems GP
630 - 3rd Avenue SW
Calgary, Alberta, Canada
T2P 4L4
(403) 781-4948


-Original Message-
From: Shane Wright [mailto:[EMAIL PROTECTED]]
Sent: Monday, December 10, 2001 11:47 AM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] php as cron


Hi

You probably need to set the path to your PHP binary in crontab.

Alternatively (this is probs a better way), wrap the whole lot up in a
simple 
shell script and get cron to run the shell script.

It's easier than it sounds...

#!/bin/bash
cd /path/to/php/scripts
php  myscript.php  /dev/null

(also, I tend not to have PHP direct output to /dev/null, but to configure 
cron not to send emails on completion - that way you get the info when you 
run the script on the command line but dont get overrun with pointless
emails)

Hope that helps :)

--
Shane

On Monday 10 Dec 2001 5:54 pm, Jay Paulson wrote:
 I'm trying to test php running as a cron job and I have installed php as a
 CGI in /usr/local/bin and I have edited my crontab file to call a php file
 every two minutes.  However, it's not working and I was wondering if you
 all would know what's going on.  Anyway, here's how I have things set up.

 crontab file:
 */2 * * * * php /home/crontest.php  /dev/null

 crontest.php:
 #!/usr/local/bin/php -q
 ?php
 mail([EMAIL PROTECTED],cron test, testing,NULL);
 ?

 email I'm receiving with error:
 Subject: Cron  php /home/crontest.php  /dev/null
 Body: /bin/sh: php: command not found

 thanks for any help.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] php as cron

2001-12-10 Thread Darren Gamble

Good day,

Calling another program with this script is unnecessary, since you are using
the shebang operator.

Instead of:

*/2 * * * * php /home/crontest.php  /dev/null

Use:

*/2 * * * * /home/crontest.php  /dev/null

Which should work just fine.

As pointed out, the reason you were getting the message was because cron is
not able to find php because /usr/local/bin is not in the path.  If you
really want to use it, then the following:

*/2 * * * * /usr/local/bin/php /home/crontest.php  /dev/null

would also work.  You could remove the #! line in your script if you do so.


Darren Gamble
Planner, Regional Services
Shaw Cablesystems GP
630 - 3rd Avenue SW
Calgary, Alberta, Canada
T2P 4L4
(403) 781-4948


-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Monday, December 10, 2001 12:12 PM
To: Darren Gamble
Cc: '[EMAIL PROTECTED]'; [EMAIL PROTECTED]
Subject: RE: [PHP] php as cron



Why not just use lynx to run it?

*/2 * * * * /usr/local/bin/lynx -dump crontest.php 

JR

 
 On Monday 10 Dec 2001 5:54 pm, Jay Paulson wrote:
  I'm trying to test php running as a cron job and I have installed php as
a
  CGI in /usr/local/bin and I have edited my crontab file to call a php
file
  every two minutes.  However, it's not working and I was wondering if you
  all would know what's going on.  Anyway, here's how I have things set
up.
 
  crontab file:
  */2 * * * * php /home/crontest.php  /dev/null
 
  crontest.php:
  #!/usr/local/bin/php -q
  ?php
  mail([EMAIL PROTECTED],cron test, testing,NULL);
  ?
 
  email I'm receiving with error:
  Subject: Cron  php /home/crontest.php  /dev/null
  Body: /bin/sh: php: command not found
 
  thanks for any help.
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]
 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] Using @file

2001-12-10 Thread Darren Gamble

Good day,

The error means that it can not resolve the name.

Replace the comma in the name with a period.


Darren Gamble
Planner, Regional Services
Shaw Cablesystems GP
630 - 3rd Avenue SW
Calgary, Alberta, Canada
T2P 4L4
(403) 781-4948


-Original Message-
From: Jeff Lewis [mailto:[EMAIL PROTECTED]]
Sent: Monday, December 10, 2001 1:24 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Using @file


I am using this line in part of my code but am getting an error that looks
like below:

Code:
$serverDetails =
@file(http://www.myserver,com/versions.php?l=$scripturlv=$version;);

Error:
2: php_network_getaddresses: gethostbyname failed 
(c:\inetpub\wwwroot\yabbse\Sources\Admin.php ln 43)

What would be causing this error?  It works on some machines but not others?

Jeff

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] Using @file

2001-12-10 Thread Darren Gamble

Good day,

Again, this error means that the server can not resolve a name.

Please ensure that the name www.myserver.com can be DNS resolved.  Please
contact your DNS administrator if it can not.


Darren Gamble
Planner, Regional Services
Shaw Cablesystems GP
630 - 3rd Avenue SW
Calgary, Alberta, Canada
T2P 4L4
(403) 781-4948


-Original Message-
From: Jeff Lewis [mailto:[EMAIL PROTECTED]]
Sent: Monday, December 10, 2001 1:32 PM
To: Darren Gamble; [EMAIL PROTECTED]
Subject: Re: [PHP] Using @file


Sorry that was a typo, it is a period, I mistyped into the email.  If it
cant resolve the name, what would cause that problem?

Jeff
- Original Message -
From: Darren Gamble [EMAIL PROTECTED]
To: 'Jeff Lewis' [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Monday, December 10, 2001 3:19 PM
Subject: RE: [PHP] Using @file


 Good day,

 The error means that it can not resolve the name.

 Replace the comma in the name with a period.

 
 Darren Gamble
 Planner, Regional Services
 Shaw Cablesystems GP
 630 - 3rd Avenue SW
 Calgary, Alberta, Canada
 T2P 4L4
 (403) 781-4948


 -Original Message-
 From: Jeff Lewis [mailto:[EMAIL PROTECTED]]
 Sent: Monday, December 10, 2001 1:24 PM
 To: [EMAIL PROTECTED]
 Subject: [PHP] Using @file


 I am using this line in part of my code but am getting an error that looks
 like below:

 Code:
 $serverDetails =
 @file(http://www.myserver,com/versions.php?l=$scripturlv=$version;);

 Error:
 2: php_network_getaddresses: gethostbyname failed
 (c:\inetpub\wwwroot\yabbse\Sources\Admin.php ln 43)

 What would be causing this error?  It works on some machines but not
others?

 Jeff



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] Using @file

2001-12-10 Thread Darren Gamble

Good day,

While I am sure most of the readers of the list are finding this
conversation amusing, I will still try to explain this a bit better to you.

DNS, or Domain Name Service, is the protocol which translates names into IP
addresses.  If you supply a computer with a name, it must use DNS (or
NetBIOS, or a hosts file, etc.) in order to determine what an IP address is
from a name.

If you have not correctly configured your machine to use DNS, then your
computer will not be able to find the server you are asking it to.  The
error message you have supplied indicates that this is the problem.

From a command prompt on the server you are trying to run this on, try to
ping the server you are trying to reach by name (e.g. ping
www.myserver.com .  If you can not reach the server, then this is the
reason.  If this is the case, please contact the administrator of your
machine/network to correct this problem and take this discussion off the PHP
list.


Darren Gamble
Planner, Regional Services
Shaw Cablesystems GP
630 - 3rd Avenue SW
Calgary, Alberta, Canada
T2P 4L4
(403) 781-4948


-Original Message-
From: Jeff Lewis [mailto:[EMAIL PROTECTED]]
Sent: Monday, December 10, 2001 1:50 PM
To: Darren Gamble; [EMAIL PROTECTED]
Subject: Re: [PHP] Using @file


Again, this works on some servers and othes not.  Does IIS support this
particular function?

Jeff
- Original Message -
From: Darren Gamble [EMAIL PROTECTED]
To: 'Jeff Lewis' [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Monday, December 10, 2001 3:32 PM
Subject: RE: [PHP] Using @file


 Good day,

 Again, this error means that the server can not resolve a name.

 Please ensure that the name www.myserver.com can be DNS resolved.  Please
 contact your DNS administrator if it can not.

 -Original Message-
 From: Jeff Lewis [mailto:[EMAIL PROTECTED]]
 Sent: Monday, December 10, 2001 1:32 PM
 To: Darren Gamble; [EMAIL PROTECTED]
 Subject: Re: [PHP] Using @file


 Sorry that was a typo, it is a period, I mistyped into the email.  If it
 cant resolve the name, what would cause that problem?

 Jeff
 - Original Message -
 From: Darren Gamble [EMAIL PROTECTED]
 To: 'Jeff Lewis' [EMAIL PROTECTED]; [EMAIL PROTECTED]
 Sent: Monday, December 10, 2001 3:19 PM
 Subject: RE: [PHP] Using @file


  Good day,
 
  The error means that it can not resolve the name.
 
  Replace the comma in the name with a period.
 
  -Original Message-
  From: Jeff Lewis [mailto:[EMAIL PROTECTED]]
  Sent: Monday, December 10, 2001 1:24 PM
  To: [EMAIL PROTECTED]
  Subject: [PHP] Using @file
 
 
  I am using this line in part of my code but am getting an error that
looks
  like below:
 
  Code:
  $serverDetails =
  @file(http://www.myserver,com/versions.php?l=$scripturlv=$version;);
 
  Error:
  2: php_network_getaddresses: gethostbyname failed
  (c:\inetpub\wwwroot\yabbse\Sources\Admin.php ln 43)
 
  What would be causing this error?  It works on some machines but not
 others?
 
  Jeff
 
 



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] Multidimensional array construction

2001-12-04 Thread Darren Gamble

Good day,

Thanks to all who replied.

This isn't quite what I needed, though.  I _have_ the array (or delimited
list would do, too).  What I need to do is _CREATE_ the array element
$myarray['foo']['bar']['green']['apple'] and set it to some value.  Actually
traversing said array isn't hard, as you pointed out.

foreach() doesn't work, as it just uses a copy of the original array.  I
think there might be some way to use variable references, but I haven't
gotten one to work yet.

Any other suggestions?


Darren Gamble
Planner, Regional Services
Shaw Cablesystems GP
630 - 3rd Avenue SW
Calgary, Alberta, Canada
T2P 4L4
(403) 781-4948


-Original Message-
From: Mike Eheler [mailto:[EMAIL PROTECTED]]
Sent: Monday, December 03, 2001 5:30 PM
To: Martin Towell
Cc: 'Darren Gamble'; PHP List
Subject: Re: [PHP] Multidimensional array construction


I did something like this recently. Here's how I did it:

$some_value1 = 'Hello World';
$myarray['foo']['bar']['green']['apple'] = $some_value1;

function get_opt($arr, $keys,$sep=':') {
$var = $arr;
$tmp = split($sep,$keys);
foreach ($tmp as $k = $v) {
$var = $var[$v];
}
if (isset($var)) return $var;
return '';
}

echo get_opt($myarray, 'foo:bar:green:apple');

It needs refining, but it should do the job. That's entirely from 
memory, mind you.. it should work, though.

Mike

Martin Towell wrote:

I was thinking that you could use a pointer to var, eg:
$var = 'myarray[foo][bar][red][apple]';
// this would obviously be created dynamically, hard coded for testing
$$var = $some_value1;
echo $myarray[foo][bar][red][apple];
but when I tried it, it didn't work :(
looks like eval() to the rescue...

-Original Message-
From: Darren Gamble [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, December 04, 2001 10:37 AM
To: PHP List
Subject: [PHP] Multidimensional array construction


Here's a question for the list:

I have a two-dimensional array; essentially a list of arrays.  Each element
(an array) can have any number of elements.  As a small example:

(
  ( foo , bar , red , apple ),
  ( foo , bar , red , car),
  ( foo , green )
)

I would like to traverse this array and place all of the data into another
multidimensional array.  The following statements illustrate how I'd like
to
do this from the example:

$myarray[foo][bar][red][apple] = $some_value1;
$myarray[foo][bar][red][car]   = $some_value2;
$myarray[foo][green]   = $some_value3;

Is there any way to easily do this in PHP?  I could cheat and use eval(),
but there is probably a better way.  I have thought of using each() or
references, but nothing has come to mind so far. 

Any ideas?  Should I just use eval() ?


Darren Gamble
Planner, Regional Services
Shaw Cablesystems GP
630 - 3rd Avenue SW
Calgary, Alberta, Canada
T2P 4L4
(403) 781-4948



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Multidimensional array construction

2001-12-03 Thread Darren Gamble

Here's a question for the list:

I have a two-dimensional array; essentially a list of arrays.  Each element
(an array) can have any number of elements.  As a small example:

(
  ( foo , bar , red , apple ),
  ( foo , bar , red , car),
  ( foo , green )
)

I would like to traverse this array and place all of the data into another
multidimensional array.  The following statements illustrate how I'd like to
do this from the example:

$myarray[foo][bar][red][apple] = $some_value1;
$myarray[foo][bar][red][car]   = $some_value2;
$myarray[foo][green]   = $some_value3;

Is there any way to easily do this in PHP?  I could cheat and use eval(),
but there is probably a better way.  I have thought of using each() or
references, but nothing has come to mind so far. 

Any ideas?  Should I just use eval() ?


Darren Gamble
Planner, Regional Services
Shaw Cablesystems GP
630 - 3rd Avenue SW
Calgary, Alberta, Canada
T2P 4L4
(403) 781-4948

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] chown/chgrp not working

2001-11-30 Thread Darren Gamble

Good day,

What user is the application running as?  Only the superuser can use these
functions (this is documented with both of these functions).

For security reasons, you may want to use an external sudo script to
accomplish this.  Be very, very careful...


Darren Gamble
Planner, Regional Services
Shaw Cablesystems GP
630 - 3rd Avenue SW
Calgary, Alberta, Canada
T2P 4L4
(403) 781-4948


-Original Message-
From: Paul Warner [mailto:[EMAIL PROTECTED]]
Sent: Friday, November 30, 2001 8:24 AM
To: [EMAIL PROTECTED]
Subject: [PHP] chown/chgrp not working


I have a client that I made a image uploader/thumbnailer for
that insists on using FrontPage.  In order to make FP
happy, I need to set the owner to 'nobody' and the group
to 'site3' which are uid 99 and gid 117.  The uploaded file
is set as httpd/root and the thumbnail created by the script
comes out httpd/site3.

First I tried:

 chown($file_name, 99);
 chgrp($file_name, 117);

Next I tried:

 chown($file_name, '99');
 chgrp($file_name, '117');

This fails to get the uid or gid, so the first syntax appears
to be correct.

Finally I tried:

 chown($file_name, 'nobody');
 chgrp($file_name, 'site3');

Error message for first and third attempts is identical:

Warning: chown failed: Operation not permitted in
/home/sites/site3/web/dev/maintenance.php on line 191

Why is it 'not permitted' and how do I allow it?

-- Paul


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] Re: system(), flush() and so on...

2001-11-30 Thread Darren Gamble

Good day,

flush() will just empty the contents of the output buffer when it's called.
You should do this after you output the command, yes, or the user will have
to wait until the rest of the page is loaded.  But this won't let you see
the output as it is generated by the system() function.

You may want to try popen instead.  This gives you a pipe to the process, so
you _should_ be able to read in lines of the output and display them as they
appear, whilst using flush()  (although I have never tried this myself so I
can not vouch for it).


Darren Gamble
Planner, Regional Services
Shaw Cablesystems GP
630 - 3rd Avenue SW
Calgary, Alberta, Canada
T2P 4L4
(403) 781-4948


-Original Message-
From: faeton [mailto:[EMAIL PROTECTED]]
Sent: Friday, November 30, 2001 2:21 PM
To: Julio Nobrega Trabalhando
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] Re: system(), flush() and so on...


Hello Julio,

Hm... I don't even know what to specify :)
The exact problem is using system(traceroute host.com), but it
should've returned its results line by line, instead of executing the
whole command and then outputting its result.

That is done by flush(), which is executed by system() foo itself, but
i couldn't understand why i have needed result on some servers and on
others - vice versa.

JNT   Hi, please be more specific. Including what error you are getting,
what is
JNT the tools being used, and their versions.
JNT   Here's a quick help for producing better questions, wich will in turn
make
JNT us answer faster and with more quality:
JNT http://www.tuxedo.org/~esr/faqs/smart-questions.html
JNT   PS: btw, I am far away from being a 'hacker', don't get me wrong
whole
JNT list people :-)


Ivan 'Faeton aka xetrix' Danishevsky
ICQ(240266) [EMAIL PROTECTED] www.xemichat.com


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: Re[2]: [PHP] Re: system(), flush() and so on...

2001-11-30 Thread Darren Gamble

Good day,

Oops, you're right.  I did not read that line nor was I aware of that.

I just tried ?php system(traceroute www.google.com); ? .  It works
exactly as it says it should- outputs the lines as they come in.  I also
know flush() works fine (at least for me).

Perhaps you could provide some information about your O/S and PHP version?


Darren Gamble
Planner, Regional Services
Shaw Cablesystems GP
630 - 3rd Avenue SW
Calgary, Alberta, Canada
T2P 4L4
(403) 781-4948


-Original Message-
From: faeton [mailto:[EMAIL PROTECTED]]
Sent: Friday, November 30, 2001 2:35 PM
To: Darren Gamble
Cc: [EMAIL PROTECTED]
Subject: Re[2]: [PHP] Re: system(), flush() and so on...


Hello Darren,

-- manual cut 
The system() call also tries to automatically flush the web server's
output buffer after each line of output if PHP is running as a server
module.
-- manual cut 

Hehe. The problem is not in flushing ability of system() foo, but
flush() itself is not working :(
I've tried to install PHP as a module (as written above), cgi,
compiled with apache. But nothing worked.

DG flush() will just empty the contents of the output buffer when it's
called.
DG You should do this after you output the command, yes, or the user will
have
DG to wait until the rest of the page is loaded.  But this won't let you
see
DG the output as it is generated by the system() function.

DG You may want to try popen instead.  This gives you a pipe to the
process, so
DG you _should_ be able to read in lines of the output and display them as
they
DG appear, whilst using flush()  (although I have never tried this myself
so I
DG can not vouch for it).



Ivan 'Faeton aka xetrix' Danishevsky
ICQ(240266) [EMAIL PROTECTED] www.xemichat.com

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: Re[4]: [PHP] Re: system(), flush() and so on...

2001-11-30 Thread Darren Gamble

Good day,

I am not sure what the problem is, then.  I presume that you installed these
via RPMs, and have PHP operating as an Apache module.  Does the simple
script provided fail as well?

Have you tried some simple scripts with sleep() and flush() to see if
flush() works?

If you don't hear from anyone else on the list, you may want to try posting
a bug report.


Darren Gamble
Planner, Regional Services
Shaw Cablesystems GP
630 - 3rd Avenue SW
Calgary, Alberta, Canada
T2P 4L4
(403) 781-4948


-Original Message-
From: faeton [mailto:[EMAIL PROTECTED]]
Sent: Friday, November 30, 2001 3:01 PM
To: Darren Gamble
Cc: [EMAIL PROTECTED]
Subject: Re[4]: [PHP] Re: system(), flush() and so on...


Hello Darren,

Linux RedHat 7.1, Apache 1.3.20, PHP 4.0.6

DG Oops, you're right.  I did not read that line nor was I aware of that.
DG I just tried ?php system(traceroute www.google.com); ? .  It works
DG exactly as it says it should- outputs the lines as they come in.  I also
DG know flush() works fine (at least for me).
DG Perhaps you could provide some information about your O/S and PHP
version?



Ivan 'Faeton aka xetrix' Danishevsky
ICQ(240266) [EMAIL PROTECTED] www.xemichat.com

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: Re[6]: [PHP] Re: system(), flush() and so on...

2001-11-30 Thread Darren Gamble

Good day,

For whatever reason, your traceroute command is returning results very
quickly.  It may be functioning normally.

Perhaps you should try a command that will take much longer to execute, such
as du / --max-depth=1.


Darren Gamble
Planner, Regional Services
Shaw Cablesystems GP
630 - 3rd Avenue SW
Calgary, Alberta, Canada
T2P 4L4
(403) 781-4948


-Original Message-
From: faeton [mailto:[EMAIL PROTECTED]]
Sent: Friday, November 30, 2001 3:32 PM
To: Darren Gamble
Cc: [EMAIL PROTECTED]
Subject: Re[6]: [PHP] Re: system(), flush() and so on...


Hello Darren,

You can try it yourself : www.xemi.info/test.php
What do you think?

Server config:
RedHat 7.1, Apache 1.3.20, PHP 4.0.6 loaded as a module.

PS. I tried everything. Simply everything.

DG I am not sure what the problem is, then.  I presume that you installed
these
DG via RPMs, and have PHP operating as an Apache module.  Does the simple
DG script provided fail as well?
DG Have you tried some simple scripts with sleep() and flush() to see if
DG flush() works?
DG If you don't hear from anyone else on the list, you may want to try
posting
DG a bug report.


Ivan 'Faeton aka xetrix' Danishevsky
ICQ(240266) [EMAIL PROTECTED] www.xemichat.com

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: Re[8]: [PHP] Re: system(), flush() and so on...

2001-11-30 Thread Darren Gamble

Good day,

Then I'm not sure.  Perhaps someone in-the-know will respond to your
question.  Else, file a bug report.  Your script runs fine on my 'puter,
FYI.

Otherwise, it would be worthwhile to write something quick to test flush()
with.  If it is also not working, it will provide more evidence as to the
cause of the problem.


Darren Gamble
Planner, Regional Services
Shaw Cablesystems GP
630 - 3rd Avenue SW
Calgary, Alberta, Canada
T2P 4L4
(403) 781-4948


-Original Message-
From: faeton [mailto:[EMAIL PROTECTED]]
Sent: Friday, November 30, 2001 3:57 PM
To: Darren Gamble
Cc: PHP General List
Subject: Re[8]: [PHP] Re: system(), flush() and so on...


Hello Darren,

It's quick because of the fact that it's tracing a host near to my
server. If you have noticed - ping from my server to login.icq.com
that is being traced by default is only 10ms.

Try that: www.xemi.info/test.php?host=www.google.com
or something like that

I waited too long... And still haven't got any results.

DG For whatever reason, your traceroute command is returning results very
DG quickly.  It may be functioning normally.
DG Perhaps you should try a command that will take much longer to execute,
such
DG as du / --max-depth=1.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Memory leaks with LDAP?

2001-11-29 Thread Darren Gamble

Hey all,

Has anyone else had problems with memory leaks using PHP's LDAP functions?

I put together a LDAP server the other day, and wrote a PHP program to test
it.  I've stripped this program down to basically a ldap_connect, ldap_bind,
ldap_search on objectclass=* , ldap_get_entries, ldap_free_result and
ldap_unbind.  There are about 8k entries in the DB which is a bit under
10MB, but with each iteration of the program, about 100MB of memory is
leaked to httpd!  The program doesn't have to be run many times before the
server stops responding.

I note errors in the apache log indicating that it can not kill off its
children.  And, /etc/init.d/httpd stop needs to be called exactly twice to
stop the web process after the program is run.

I'm running php-4.0.6-7 as a module for apache-1.3.20-16; all Redhat 7.2
RPMs.

I posted a message on the PHP bug page recently, but, by reading the posting
guidelines on that page it seems that there is a good chance that no one
will even look at it.  I'm hoping that someone on this list has encountered
something similar and would be able to share their resolution.

Thanks to all who respond!


Darren Gamble
Planner, Regional Services
Shaw Cablesystems GP
630 - 3rd Avenue SW
Calgary, Alberta, Canada
T2P 4L4
(403) 781-4948

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Displaying content on the fly

2001-11-23 Thread Darren Gamble

Good day,

I've been using both Perl and PHP for some time now for dynamic content.
I'm presently running PHP4 as an apache module.

One difference that I've noticed is that PHP doesn't produce any output
until the script is complete, whereas with Perl one could print doing
this...  , perform something, done. messages when performing long tasks.

Is there any way to have this enabled?  It would be quite appreciated, as I
have a few web pages that perform very heavy database work and I would like
to make the output hot so that I can print out statements as it
progresses- and if there is a problem, the user will be able to identify
where it failed.

There doesn't appear to be a php.ini directive that does this, though...

Thanks in advance,


Darren Gamble
Planner, Regional Services
Shaw Cablesystems GP
630 - 3rd Avenue SW
Calgary, Alberta, Canada
T2P 4L4
(403) 781-4948


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] Displaying content on the fly

2001-11-23 Thread Darren Gamble

Good day,

Thanks for the reply!  I was not quite sure how this would be phrased
(searching for on the fly on the page causes an error to be returned).


Darren Gamble
Planner, Regional Services
Shaw Cablesystems GP
630 - 3rd Avenue SW
Calgary, Alberta, Canada
T2P 4L4
(403) 781-4948


-Original Message-
From: Richard Black [mailto:[EMAIL PROTECTED]]
Sent: Friday, November 23, 2001 9:31 AM
To: 'Darren Gamble'; '[EMAIL PROTECTED]'
Subject: RE: [PHP] Displaying content on the fly


Try using the flush(); function. It flushes all output to the browser, and
allows exactly the type of thing you're talking about here

-Original Message-
From:   Darren Gamble [SMTP:[EMAIL PROTECTED]]
Sent:   23 November 2001 16:17
To: '[EMAIL PROTECTED]'
Subject:[PHP] Displaying content on the fly

Good day,

I've been using both Perl and PHP for some time now for dynamic content.
I'm presently running PHP4 as an apache module.

One difference that I've noticed is that PHP doesn't produce any output
until the script is complete, whereas with Perl one could print doing
this...  , perform something, done. messages when performing long tasks.

Is there any way to have this enabled?  It would be quite appreciated, as I
have a few web pages that perform very heavy database work and I would like
to make the output hot so that I can print out statements as it
progresses- and if there is a problem, the user will be able to identify
where it failed.

There doesn't appear to be a php.ini directive that does this, though...

Thanks in advance,


Darren Gamble
Planner, Regional Services
Shaw Cablesystems GP
630 - 3rd Avenue SW
Calgary, Alberta, Canada
T2P 4L4
(403) 781-4948


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]