php-general Digest 22 Feb 2005 10:12:08 -0000 Issue 3300

2005-02-22 Thread php-general-digest-help

php-general Digest 22 Feb 2005 10:12:08 - Issue 3300

Topics (messages 209152 through 209163):

Re: Can't load extension (was Re: PHP to C interface?)
209152 by: Richard Lynch
209157 by: N Deepak

Re: php request entity body help
209153 by: Richard Lynch

Re: Is there a way I can read full path names of files on the server and enter 
it into the database ?
209154 by: Richard Lynch

Re: php temporary files
209155 by: Marek Kilimajer

Re: The length of midi
209156 by: Eli

Re: Unable to load extension (was Re: PHP to C interface?)
209158 by: N Deepak

Sessions and cookies
209159 by: Jacques
209160 by: Brett Patterson

Re: Relative URLs
209161 by: Justin French

Webmail and mime
209162 by: Emil
209163 by: Christophe Chisogne

Administrivia:

To subscribe to the digest, e-mail:
[EMAIL PROTECTED]

To unsubscribe from the digest, e-mail:
[EMAIL PROTECTED]

To post to the list, e-mail:
php-general@lists.php.net


--
---BeginMessage---




N Deepak wrote:
 On Fri, Feb 18, 2005 at 09:20:02AM -0800, Richard Lynch wrote:
 N Deepak wrote:
Is there a way to invoke C functions in a library (.so) from PHP?
Like Xs in Perl?

 By definition, then, all you have to do is learn how to write a PHP
 extension, which Rasmus tells you how to do in a one-hour lecture at any
 PHP/Linux/Apache/OpenSource conference you care to name :-)

 I downloaded php-4.3.10 and tried to create a simple extension.  I
 followed instructions exactly as ext_skel told.  I modified config.m4
 only in the PHP_ARG_ENABLE() lines.  I ran buildconf, configure
 --with-foo, make and then ./sapi/cli/php -f ext/foo/foo.php.

What happened to make install ???

You have to make install your new .so file to get copied over into your
PHP extensions directory, which from the messages seems to be
/usr/local/lib/php/extensions/no-debug-non-zts-20020429/ on your system...

I'm betting you have an 'ext/foo.so' file, but it's not installed yet.


 To get this error:

 [EMAIL PROTECTED] php-4.3.10]$ ./sapi/cli/php -f ext/foo/nscli.php

 Warning: dl(): Unable to load dynamic library
 '/usr/local/lib/php/extensions/no-debug-non-zts-20020429/foo.so' -
 /usr/local/lib/php/extensions/no-debug-non-zts-20020429/foo.so: cannot
 open shared object file: No such file or directory in
 /home/deep/php-4.3.10/ext/foo/nscli.php on line 3
 Functions available in the test extension:br

 Warning: Invalid argument supplied for foreach() in
 /home/deep/php-4.3.10/ext/foo/nscli.php on line 8
 br
 Module foo is not compiled into PHP
 [EMAIL PROTECTED] php-4.3.10]$

 Could someone please help me?

-- 
Like Music?
http://l-i-e.com/artists.htm
---End Message---
---BeginMessage---
On Mon, Feb 21, 2005 at 02:08:28PM -0800, Richard Lynch wrote:
 
  I downloaded php-4.3.10 and tried to create a simple extension.  I
  followed instructions exactly as ext_skel told.  I modified config.m4
  only in the PHP_ARG_ENABLE() lines.  I ran buildconf, configure
  --with-foo, make and then ./sapi/cli/php -f ext/foo/foo.php.
 
 What happened to make install ???
 
 You have to make install your new .so file to get copied over into your
 PHP extensions directory, which from the messages seems to be
 /usr/local/lib/php/extensions/no-debug-non-zts-20020429/ on your system...
 
 I'm betting you have an 'ext/foo.so' file, but it's not installed yet.
 
No, there's none!

[EMAIL PROTECTED] ext]$ pwd
/home/deep/php-4.3.10/ext
[EMAIL PROTECTED] ext]$ find . -name *.so
[EMAIL PROTECTED] ext]$

I gave this find after saying './buildconf --force', './configure
--with-nscli', 'make'.

(Which is what the ext_skel script asked me to do, after editing
config.m4)

Thanks for all the help, I think I'm still not done, however.

Regards,
Deepak

  To get this error:
 
  [EMAIL PROTECTED] php-4.3.10]$ ./sapi/cli/php -f ext/foo/nscli.php
 
  Warning: dl(): Unable to load dynamic library
  '/usr/local/lib/php/extensions/no-debug-non-zts-20020429/foo.so' -
  /usr/local/lib/php/extensions/no-debug-non-zts-20020429/foo.so: cannot
  open shared object file: No such file or directory in
  /home/deep/php-4.3.10/ext/foo/nscli.php on line 3
  Functions available in the test extension:br
 
  Warning: Invalid argument supplied for foreach() in
  /home/deep/php-4.3.10/ext/foo/nscli.php on line 8
  br
  Module foo is not compiled into PHP
  [EMAIL PROTECTED] php-4.3.10]$
 

-- 
N Deepak || http://www.ndeepak.info/
---End Message---
---BeginMessage---
Å£À¤ wrote:
 I'm trying to get the entity body part from an http request. Is there an
 API which can do the job?
 We use post to communicate. But I don't the name of post.

Search the http://php.net/ site for HTTP_RAW_POST_DATA

I think that will have what you want.

-- 
Like Music?
http://l-i-e.com/artists.htm
---End Message---
---BeginMessage---
Vaibhav Sibal wrote:
 I wanted to ask whether there is 

[PHP] Webmail and mime

2005-02-22 Thread Emil
Hi
I'm creating a webmail interface for a pop3-server (I know weird to do 
webmail with pop3, but it's for a running server which I can't control. 
So pop3 it is and caching the mails in a mysql database). I've 
implemented the pop3-support myself since the one in www.php.net/imap 
lacks a lot of basic pop3 features like uidl support.

Anyway I've hit a wall trying to add support for receiving attachments. 
I'm not sure how to handle it. The imap_fetchstructure call doesn't seem 
to be useful for me, since I can't send it text but only an imapstream. 
I tried the pear projects mimeDecode class and it worked fine. But the 
only thing it returns was the structure (like it will return an array 
with info like one mime part plain text, one part image, etc.) and not 
the content. I don't get the actual text and the actual image.

Any ideas of how I can get the content split up in neat pieces? I've 
probably just missed something obvious in www.php.net/imap or the pear 
mail classes. Because I guess there are a function that does this.

I need this running nw. So I'm sort of desperate. If you have any 
ideas at all please please speak.

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


Re: [PHP] Webmail and mime

2005-02-22 Thread Christophe Chisogne
Emil a écrit :
I'm creating a webmail interface for a pop3-server
Why not use one of the many webmail apps?
Ex written in PHP/Perl, with no particular order:
Neomail
http://neocodesolutions.com/software/neomail/
Openwebmail
http://openwebmail.org/
IMP (horde)
http://horde.org/imp/
IlohaMail
http://ilohamail.org/
SquirrelMail
http://www.squirrelmail.org/
Ch.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] cannot remove cookies

2005-02-22 Thread Bruno Santos
Hello.
I'm using 2 cookies to control some user environmente.
every time the user logs in, the cookie is set, but when i try to change 
the value of that cookie,
deleting it firts and then setting a new one with another value, when i 
print the value of that cookie
the value is never the new one, but always the firts.

im setting the cookie with:
setcookie (cookie_name,cookie_value,time()+time-to-expiration);
when deleting it, i do
setcookie (cookie_name);
or
setcookie (cookie_name,,time()-time-to-expiration);
but it never works
the browser im testing it is firefox (linux)
but in IE is not working either...
PHP version is PHP-5.0.3
Apache version is Apache-2.0.52
Cheers
Bruno Santos
--
Say no to software patents
www.nosoftwarepatents.com/
--
[EMAIL PROTECTED]
--
Divisao de Informatica
[EMAIL PROTECTED]
Tel: +351 272 000 155
Fax: +351 272 000 257
--
Hospital Amato Lusitano
[EMAIL PROTECTED]
Tel: +351 272 000 272
Fax: +351 272 000 257
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Handling of partially completed forms

2005-02-22 Thread Joseph E. Maxwell
OK, I have no desire to re-invent the wheel , if a script exist that is 
available I'll jump at it, otherwise I'll write the code myself. Failing 
to find one, I've started on the latter approach. I've written code that 
places initial data fields into a MySQL database. The next step is to 
identify the user on login, extract the saved data and display the 
value(s) in the respective fields - This is where I am seeking guidance 
primarily, apparently this can't be a static code, dynamic?

b1nary Development Team wrote:
Are you looking to code it yourself?  If so, Here's the theory behind 
the concept...

So you have this multiple page form that you want to save and continue 
at a later time correct?  So you'll have to set up a save button.  You 
will also require some way to recognize the same user when the come 
back (ex. a login system).  So, when they half finish a form, and 
select the save button, you can send them to ex. save.php which will 
take all the user data, and store it in a mysql database, somehow tied 
the user (ex. a user id).  When the user comes back and logs in, you 
can extract this form data from the database, display the form and use 
the form's value= field to automatically fill in the data.

Joseph E. Maxwell wrote:
Does anyone have any suggestions, info or references on php 
script/code that would enable partially completed multiple page forms 
that can be saved,  retrieved and completed at a later date.  I might 
add also enabling/disabling or other navigational features? I think 
there are are some java ones around but prefer php.

Thanks


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


Re: [PHP] Can't load extension (was Re: PHP to C interface?)

2005-02-22 Thread N Deepak
N Deepak wrote:
On Mon, Feb 21, 2005 at 02:08:28PM -0800, Richard Lynch wrote:
You have to make install your new .so file to get copied over into your
PHP extensions directory, which from the messages seems to be
/usr/local/lib/php/extensions/no-debug-non-zts-20020429/ on your system...
I'm betting you have an 'ext/foo.so' file, but it's not installed yet.
No, there's none!
[EMAIL PROTECTED] ext]$ pwd
/home/deep/php-4.3.10/ext
[EMAIL PROTECTED] ext]$ find . -name *.so
[EMAIL PROTECTED] ext]$
I gave this find after saying './buildconf --force', './configure
--with-nscli', 'make'.
(Which is what the ext_skel script asked me to do, after editing
config.m4)
I found the problem.  One has to run 'phpize' in the extension 
directory, and then configure/make/make install.

ext_skel doesn't mention it at all, though?
Thanks,
Deepak
To get this error:
[EMAIL PROTECTED] php-4.3.10]$ ./sapi/cli/php -f ext/foo/nscli.php
Warning: dl(): Unable to load dynamic library
'/usr/local/lib/php/extensions/no-debug-non-zts-20020429/foo.so' -
/usr/local/lib/php/extensions/no-debug-non-zts-20020429/foo.so: cannot
open shared object file: No such file or directory in
/home/deep/php-4.3.10/ext/foo/nscli.php on line 3
Functions available in the test extension:br
Warning: Invalid argument supplied for foreach() in
/home/deep/php-4.3.10/ext/foo/nscli.php on line 8
br
Module foo is not compiled into PHP
[EMAIL PROTECTED] php-4.3.10]$

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


[PHP] zend_parse_parameters seg faults on string input.

2005-02-22 Thread N Deepak
Hi all,
  In the PHP file, I have written:
  helloworld(hello, world)
  where helloworld is in an extension.  Now, I use 
zend_parse_parameters() to parse input as follows:

  char* hstr = NULL, *wstr = NULL;
  argc = ZEND_NUM_ARGS();
  if (zend_parse_parameters(argc TSRMLS_CC, ss, hstr, wstr)
== FAILURE)
return;
  I get a seg-fault when I run the PHP file.  However, it works for one 
argument.

  Am I missing something?
Thanks,
Deepak
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Sessions and cookies

2005-02-22 Thread Jochem Maas
Brett Patterson wrote:
Well, if you look in your phpinfo() file, you will see a SESSION_TIMEOUT or
SESSION_LENGTH value that is something like 18... different for each
server.
If you hold all your session values in the array, then you can use
session_destory(); as long as session_start() is previous to that.
ie. you must have an active session for php to destroy it.
I am under the impressions that both Sessions and Cookies are stored on the
user end, but I may be wrong.
the contents of $_SESSION are stored on the server only (unless your doing 
something very convoluted
or wrong IMHO) when a session is started a cookie is also sent to the browser
(under certain conditions the session id will be passed via GET param instead - 
BTWWF),
the value of the cookie is the session id, which is used to recognise the 
browser
(when session_start() is called).
...
What is also the default life span of a session object? and can this 
bechanged?
check your php config:
? phpinfo();
you can set the lifetime in your script, more info here:
http://php.net/session
--
BTWWF - Browse The Web (With Firefox ;-)
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Hi ALL

2005-02-22 Thread Dhanasekar T
hi all,
i m new to this group ...now i want to learn php.
i want all u r guidence  to utilise this group...
thanks in advance 
dhanas

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



[PHP] PHP5 DOM

2005-02-22 Thread Sergio Gorelyshev
Hi to all. I have a problem. I need to glue 2 or more DomDocument? objects to 
one. After hours of hard coding I've came to the conclusion that there is no 
possibility to use  PHP 5.3.0 to realize it.  Is there anybody who could break 
this conclusion and give me an appropriate solution?

P.S. I did it with PHP 5.1.0 cvs version and I used a small trick.

Thanks.
-- 
RE5PECT
Sergio Gorelyshev

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



Re: [PHP] PHP5 DOM

2005-02-22 Thread Yann Larrivee
Hi Sergio maybe you should have a look at importNode 
http://ca3.php.net/manual/en/function.dom-domdocument-importnode.php

I beleive this is what you need along with Normalize.

Good luck.
Yann

On Tuesday 22 February 2005 06:54, Sergio Gorelyshev wrote:
 Hi to all. I have a problem. I need to glue 2 or more DomDocument?
 objects to one. After hours of hard coding I've came to the conclusion that
 there is no possibility to use  PHP 5.3.0 to realize it.  Is there anybody
 who could break this conclusion and give me an appropriate solution?

 P.S. I did it with PHP 5.1.0 cvs version and I used a small trick.

 Thanks.
 --
 RE5PECT
 Sergio Gorelyshev

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



Re: [PHP] PHP5 DOM

2005-02-22 Thread Sergio Gorelyshev
Sorry.  There is a mistake.

Hi to all. I have a problem. I need to glue 2 or more DomDocument? objects to 
one. After hours of hard coding I've came to the conclusion that there is no 
possibility to use  PHP 5.0.3 to realize it.  Is there anybody who could 
break this conclusion and give me an appropriate solution?
 
P.S. I did it with PHP 5.1.0 cvs version and I used a small trick.
 
Thanks.


-- 
RE5PECT
Sergio Gorelyshev

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



Re: [PHP] PHP5 DOM

2005-02-22 Thread Sergio Gorelyshev
On Tue, 22 Feb 2005 06:58:12 -0500
Yann Larrivee [EMAIL PROTECTED] wrote:

 Hi Sergio maybe you should have a look at importNode 
 http://ca3.php.net/manual/en/function.dom-domdocument-importnode.php
I've been tried to use this function. There are no results.  This function (as 
well as appendChild() ) requires parameter of DOMNode type. But root element of 
DOMDocument object is DOMElement. Any attempt to use it as DOMNode (while it is 
successor of DOMNode) becomes as fail. No errors. No results. Nothing.

Sample code:
?php   
   
$dom = new DomDocument();
$dom-appendChild(($root = $dom-createElement(test1)));

   
$dom2 = new DomDocument();
$dom2-appendChild(($root2 = $dom2-createElement(test2)));

$dom-importNode($dom2-childNodes-item(0));
var_dump($dom-saveXML());
?
Result is: 

string(31) ?xml version=1.0?
test1/



 I beleive this is what you need along with Normalize.
 Good luck.
 Yann
 
 On Tuesday 22 February 2005 06:54, Sergio Gorelyshev wrote:
  Hi to all. I have a problem. I need to glue 2 or more DomDocument?
  objects to one. After hours of hard coding I've came to the conclusion that
  there is no possibility to use  PHP 5.3.0 to realize it.  Is there anybody
  who could break this conclusion and give me an appropriate solution?
 
  P.S. I did it with PHP 5.1.0 cvs version and I used a small trick.
 
  Thanks.
  --
  RE5PECT
  Sergio Gorelyshev
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 


-- 
RE5PECT
Sergio Gorelyshev

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



[PHP] errors in insert queries

2005-02-22 Thread Bryan Dina
I am having problems making proper insert queries against a MS SQL box
when using a Linux server.  A little background info, I have had this
working correctly for many months.  I am running Fedora Core 1, have
compiled php 5.0.3 using the FreeTDS v.0.7 driver to access the MS SQL
2000 DBMS, and like I said, it has been working with out problems for
several months now.  I tried to update MySQL (which I also use locally
on the web server for certain projects), which went fine as well,
although after that every insert query I made against the MS SQL server
returned a failed status EVEN THOUGH the inserts were ACTUALLY made.  I
have seen posts to the PHP site with users of php v.4.x.x complaining
about this problem, and so far no answers on what to do to fix the
problem(s).  Any help would be greatly appreciated.

Thanks!
--Bryan

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



Re: [PHP] PHP5 DOM

2005-02-22 Thread Sergio Gorelyshev
On Tue, 22 Feb 2005 15:02:38 +0200
Sergio Gorelyshev [EMAIL PROTECTED] wrote:
It's work!!! :-) Thanks. 
Here is a valid code:
?php   
   
$dom = new DomDocument();   
   
$dom-appendChild(($root = $dom-createElement(test1)));  
   

   
$dom2 = new DomDocument();  
   
$dom2-appendChild(($root2 = $dom2-createElement(test2)));   
   

   
$dom-appendChild($dom-importNode($dom2-childNodes-item(0));
var_dump($dom-saveXML());  
   
?

The result is:
string(40) ?xml version=1.0?
test1/
test2/


 On Tue, 22 Feb 2005 06:58:12 -0500
 Yann Larrivee [EMAIL PROTECTED] wrote:
 
  Hi Sergio maybe you should have a look at importNode 
  http://ca3.php.net/manual/en/function.dom-domdocument-importnode.php
 I've been tried to use this function. There are no results.  This function 
 (as well as appendChild() ) requires parameter of DOMNode type. But root 
 element of DOMDocument object is DOMElement. Any attempt to use it as DOMNode 
 (while it is successor of DOMNode) becomes as fail. No errors. No results. 
 Nothing.
 
 Sample code:
 ?php 
  
 $dom = new DomDocument();
 $dom-appendChild(($root = $dom-createElement(test1)));
   
  
 $dom2 = new DomDocument();
 $dom2-appendChild(($root2 = $dom2-createElement(test2)));
 
 $dom-importNode($dom2-childNodes-item(0));
 var_dump($dom-saveXML());
 ?
 Result is: 
 
 string(31) ?xml version=1.0?
 test1/
 
 
 
  I beleive this is what you need along with Normalize.
  Good luck.
  Yann
  
  On Tuesday 22 February 2005 06:54, Sergio Gorelyshev wrote:
   Hi to all. I have a problem. I need to glue 2 or more DomDocument?
   objects to one. After hours of hard coding I've came to the conclusion 
   that
   there is no possibility to use  PHP 5.3.0 to realize it.  Is there anybody
   who could break this conclusion and give me an appropriate solution?
  
   P.S. I did it with PHP 5.1.0 cvs version and I used a small trick.
  
   Thanks.
   --
   RE5PECT
   Sergio Gorelyshev
  
  -- 
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
  
 
 
 -- 
 RE5PECT
 Sergio Gorelyshev
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 


-- 
RE5PECT
Sergio Gorelyshev

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



Re: [PHP] Hi ALL

2005-02-22 Thread Bret Hughes
On Tue, 2005-02-22 at 05:27, Dhanasekar T wrote:
 hi all,
 i m new to this group ...now i want to learn php.
 i want all u r guidence  to utilise this group...
 thanks in advance 
 dhanas


I would start by looking at and dare I say reading the manual at
php.net.  Then surf around for a beginners tutorial, and start coding.  

I suspect the learning curve shape depends on whether you have any
previous programming experience or not.

Bret

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



Re: [PHP] errors in insert queries

2005-02-22 Thread Bret Hughes
On Tue, 2005-02-22 at 07:32, Bryan Dina wrote:
 I am having problems making proper insert queries against a MS SQL box
 when using a Linux server.  A little background info, I have had this
 working correctly for many months.  I am running Fedora Core 1, have
 compiled php 5.0.3 using the FreeTDS v.0.7 driver to access the MS SQL
 2000 DBMS, and like I said, it has been working with out problems for
 several months now.  I tried to update MySQL (which I also use locally
 on the web server for certain projects), which went fine as well,
 although after that every insert query I made against the MS SQL server
 returned a failed status EVEN THOUGH the inserts were ACTUALLY made.  I
 have seen posts to the PHP site with users of php v.4.x.x complaining
 about this problem, and so far no answers on what to do to fix the
 problem(s).  Any help would be greatly appreciated.
 

Have you checked the bug database to see if it has been entered as a
bug?  Most projects don't get anything fixed unless there is a bug
filed.

Bret

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



[PHP] Re: cannot remove cookies

2005-02-22 Thread Jason Barnett
Bruno Santos wrote:
 Hello.
 
 I'm using 2 cookies to control some user environmente.
 every time the user logs in, the cookie is set, but when i try to change
 the value of that cookie,
 deleting it firts and then setting a new one with another value, when i
 print the value of that cookie
 the value is never the new one, but always the firts.
 
 im setting the cookie with:
 setcookie (cookie_name,cookie_value,time()+time-to-expiration);
 
 when deleting it, i do
 setcookie (cookie_name);
 or
 setcookie (cookie_name,,time()-time-to-expiration);

time-to-expiration may as well be something fixed and fairly large...
this way you account for a computer's clock being off from the actual
time.  3600 is good.  I'm guessing that this is the cause of your problem...

 
 but it never works

If this is a session cookie that you are trying to destroy then you
should go ahead and destroy both the session as well as the cookie.

 
 the browser im testing it is firefox (linux)
 but in IE is not working either...
 
 PHP version is PHP-5.0.3
 
 Apache version is Apache-2.0.52
 
 Cheers
 
 Bruno Santos
 


-- 
Teach a man to fish...

NEW? | http://www.catb.org/~esr/faqs/smart-questions.html
STFA | http://marc.theaimsgroup.com/?l=php-generalw=2
STFM | http://php.net/manual/en/index.php
STFW | http://www.google.com/search?q=php
LAZY |
http://mycroft.mozdev.org/download.html?name=PHPsubmitform=Find+search+plugins


signature.asc
Description: OpenPGP digital signature


[PHP] [HAB] str_replace

2005-02-22 Thread OOzy Pal
Dears
 
I am trying replace anything between '{!' and '!}' i.e {!A!} and {!B!} 
and {!ABC!} with XYZ. I tried the following but no help. Can anyone 
help?
 
$this-template=str_replace({!*!},XYZ,$this-template);
 
Thank you




Regards,
OOzy

What is the purpose of life?



Regards,
OOzy

What is the purpose of life?

-
Do you Yahoo!?
 Yahoo! Mail - Helps protect you from nasty viruses.

[PHP] resetting pg_fetch_array

2005-02-22 Thread Dave O
Hi all.  I'm been trying the following code for the past day or so and I 
 can't seem to get around it.  I'm issuing a query to pgsql and 
iterating  through the results twice in order to facilitate the 
separation of shipment history.

Below is the simplest example I can come up with.  The results only 
display once, even though I'm not issuing any other db calls after the 
1st iteration and the resouce id remains the same.  Heck, even 
pg_num_rows returns the same result twice, but the results just won't 
display a second time.

I'm running this on freebsd 5.3 using pgsql v8 and php 4.3.10.  Anybody 
got any suggestions.  TIA.

Dave
table looptest
 rownum | rowstr
+
  1 | aa
  2 | bb
  3 | cc
  4 | dd
include ('connection.inc.php');
$sql = SELECT rownum, rowstr FROM looptest;
$result = pg_query($conn, $sql);
$c=2;
$x=0;
echo pre\n;
while ($x$c)
{
echo pg_num_rows($result) . -;
print_r($result);
echo \n\n;
reset($result);
while($row = pg_fetch_array($result))
{
echo $row[rownum] .  -  . $row[rowstr] .  \n;
} 

echo \n; 

$x++; 

} 

echo /pre\n;
--
results
--
4-Resource id #4
1 - aa
2 - bb
3 - cc
4 - dd

4-Resource id #4

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


[PHP] Writing PNG Images to File from Command Line

2005-02-22 Thread dpgirago
Howdy,

Because of some latency issues in the display of dynamically created PNG 
images, I've been trying to separate the image-creation process from the 
image-display process. Essentially, I'm trying to run a cron job that 
writes a PNG image to file every 5 seconds. The php file pulls data from a 
MySQL db and creates a color-coded map of a cancer treatment building. The 
presence of normal levels of Neutrons would lead to the creation of a 
green flag, above-normal levels yields a yellow flag, and high levels 
yields a red flag. Another page will simply use a SRC tag to display the 
image, and will refresh every 5-6 seconds to get the latest 
readings/image.

The concept worked extremely well when the image was output to the 
browser, except for the fact that a latency caused the image in the 
browser to flicker when it refreshed.

So I've attempted the above, but without success, in that I can't get the 
cron job to actually make the image file. I know that the file is being 
processed because I can echo out a few words to the screen. And I know 
that the php file can create an image file because it does so when I add 
the file_name attribute to the imagecreate() function. 

I've checked permissions on folders, etc, and have tried both the CLI and 
SAPI versions of php, with and without available command line flags, but 
no luck. And it's not the db query portion of the process because I've 
commented out that portion of the code.

Pretty much stumped and very open to thoughts/comments. 

The Set Up: 
RH 9.0 
Apache 2.0.48
PHP 4.3.4
Mozilla 1.5
(MySQL 4.0.18)

Thanks,
 David

Re: [PHP] [HAB] str_replace

2005-02-22 Thread Bret Hughes
On Tue, 2005-02-22 at 09:59, OOzy Pal wrote:
 Dears
  
 I am trying replace anything between '{!' and '!}' i.e {!A!} and {!B!} 
 and {!ABC!} with XYZ. I tried the following but no help. Can anyone 
 help?
  
 $this-template=str_replace({!*!},XYZ,$this-template);
  
 Thank you
 
 

IIRC str_replace does not use any type of globbing.  You need to use one
of the function that uses regular expresions I prefer preg_replace
personally.  regexes can get complicated looking pretty quick but are an
incredibly powerful mechanism once you understand even the rudiments.  I
would place my self in that catagory.

try something like :

$this-template = preg_replace (/![^!]*!/,!XYZ!,$this-template);

untested but should be close.

what the /![^!]*!/ says is match any string that starts with a ! and is
followed by zero or more characters that are not ! followed by a ! the
replacement part of the function replaces it all with !XYZ!.

this will also catch the string !! and replace it with !XYZ! if this is
not what you want replace the * above with + (one or more)  exactly one
char between them leave the * off altogether.

HTH

Bret

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



Re: [PHP] Writing PNG Images to File from Command Line

2005-02-22 Thread Bret Hughes
On Tue, 2005-02-22 at 10:14, [EMAIL PROTECTED] wrote:
 Howdy,
 
 Because of some latency issues in the display of dynamically created PNG 
 images, I've been trying to separate the image-creation process from the 
 image-display process. Essentially, I'm trying to run a cron job that 
 writes a PNG image to file every 5 seconds. The php file pulls data from a 
 MySQL db and creates a color-coded map of a cancer treatment building. The 
 presence of normal levels of Neutrons would lead to the creation of a 
 green flag, above-normal levels yields a yellow flag, and high levels 
 yields a red flag. Another page will simply use a SRC tag to display the 
 image, and will refresh every 5-6 seconds to get the latest 
 readings/image.
 
 The concept worked extremely well when the image was output to the 
 browser, except for the fact that a latency caused the image in the 
 browser to flicker when it refreshed.
 
 So I've attempted the above, but without success, in that I can't get the 
 cron job to actually make the image file. I know that the file is being 
 processed because I can echo out a few words to the screen. And I know 
 that the php file can create an image file because it does so when I add 
 the file_name attribute to the imagecreate() function. 
 
 I've checked permissions on folders, etc, and have tried both the CLI and 
 SAPI versions of php, with and without available command line flags, but 
 no luck. And it's not the db query portion of the process because I've 
 commented out that portion of the code.
 
 Pretty much stumped and very open to thoughts/comments. 
 
 The Set Up: 
 RH 9.0 
 Apache 2.0.48
 PHP 4.3.4
 Mozilla 1.5
 (MySQL 4.0.18)
 

how are you trying to do this?  your comment that it can create the file
when you add the filename attribute to imagecreate leads me to believe
you are not using this feature.  Why not?

Also what is the error_reporting set to?

you might try error_reporting(E_ALL); at the top of your script to get
additional info.  

Are you checking the returncode from the imagecreate?

you might try posting the code and letting someone wiht more experience
than I take a look.

Bret

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



Re: [PHP] Writing PNG Images to File from Command Line

2005-02-22 Thread Richard Lynch
 Because of some latency issues in the display of dynamically created PNG
 images, I've been trying to separate the image-creation process from the
 image-display process. Essentially, I'm trying to run a cron job that
 writes a PNG image to file every 5 seconds. The php file pulls data from a
 MySQL db and creates a color-coded map of a cancer treatment building. The
 presence of normal levels of Neutrons would lead to the creation of a
 green flag, above-normal levels yields a yellow flag, and high levels
 yields a red flag. Another page will simply use a SRC tag to display the
 image, and will refresh every 5-6 seconds to get the latest
 readings/image.

The potential problem here is that your PHP script will frequently be
attempting to read the file at the same time that your cron job has the
file open for writing -- and presumably locked at that point.

I don't know enough about FileSystem internals to be certain, but it
sounds like a recipe for trouble.

 The concept worked extremely well when the image was output to the
 browser, except for the fact that a latency caused the image in the
 browser to flicker when it refreshed.

I don't think a latency in creating the image is at fault here...

The browser is gonna get the HTML first, find the IMG tag, and download
the image, and depending on how large the image is, and on your network,
there will always be some flicker there.

I suspect that GD spewing out an image is probably not significantly
slower than reading the image from the hard drive.

You can minimize it by:
  Making the image smaller (fewer colors, lower resolution)
  Using WIDTH and HEIGHT attributes on your IMG tag
  Buying more bandwidth or decreasing network hops (see traceroute)

 So I've attempted the above, but without success, in that I can't get the
 cron job to actually make the image file. I know that the file is being
 processed because I can echo out a few words to the screen. And I know
 that the php file can create an image file because it does so when I add
 the file_name attribute to the imagecreate() function.

Which user is running the cron job?  It's probably NOT the same user as
what runs PHP, so your permissions tests may not be valid.

Are you providing a FULL PATH to the php binary, the script, the image
file and all your includes?  You should assume NOTHING about the current
working directory when you run a cron job.

 I've checked permissions on folders, etc, and have tried both the CLI and
 SAPI versions of php, with and without available command line flags, but
 no luck. And it's not the db query portion of the process because I've
 commented out that portion of the code.

Add some error-checking to your fopen(..., 'w') to log any error and the
result of the fopen.
http://php.net/error_log

You may be missing out on some crucial info the computer is trying to give
you, simply by ignoring its error messages.  Kind of like a girl, only
much less complicated :-)

All that said:
If you only have a handful of color coded flags, and you are using GD to
re-draw an image every time, that's kinda silly...

Perhaps I'm missing something here, but:

Just use your query to decide which flag to *USE* instead of drawing a new
one every time.

html
  body
?php
  /* db query to determine flag color here */
  echo img src=\$flag_color.png\;
?
  /body
/html

No need to fire up GD on every image if you only have a handful of
possible outputs.

Or does a single image consist of many many many flags?  Oh, okay.  GD is
the answer then.  Probably.  An HTML table of a bunch of tiny images
*might* be faster/smoother.

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

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



Re: [PHP] php temporary files

2005-02-22 Thread Péntek Imre
2005. február 21. 21.24 dátummal dan ezt írta:
 I'm not sure if PHP works this way, but did you completely shut down
 Apache and then restart it after making these changes?
Yes I did.
-- 
Üdvözlettel: Ifj. Péntek Imre
E-mail: [EMAIL PROTECTED]

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



Re: [PHP] resetting pg_fetch_array

2005-02-22 Thread Richard Lynch
Dave O wrote:
 Hi all.  I'm been trying the following code for the past day or so and I
   can't seem to get around it.  I'm issuing a query to pgsql and
 iterating  through the results twice in order to facilitate the
 separation of shipment history.

 Below is the simplest example I can come up with.  The results only
 display once, even though I'm not issuing any other db calls after the
 1st iteration and the resouce id remains the same.  Heck, even
 pg_num_rows returns the same result twice, but the results just won't
 display a second time.

 I'm running this on freebsd 5.3 using pgsql v8 and php 4.3.10.  Anybody
 got any suggestions.  TIA.

 Dave

 table looptest
   rownum | rowstr
 +
1 | aa
2 | bb
3 | cc
4 | dd

 include ('connection.inc.php');
 $sql = SELECT rownum, rowstr FROM looptest;
 $result = pg_query($conn, $sql);
 $c=2;
 $x=0;
 echo pre\n;
 while ($x$c)
 {
  echo pg_num_rows($result) . -;
  print_r($result);
  echo \n\n;
  reset($result);
  while($row = pg_fetch_array($result))

This automatically advances an internal counter to the next row.

You never rewind the counter.
[Be kind, rewind!]

You can either find the pg_data_seek function that does the rewind, or you
can do a counter yourself and pass in the optional row number argument to
pg_fetch_array:

$row_num = 0;
while ($row = pg_fetch_array($result, $row_num++))

The reset function you are using is for ARRAYS, and has nothing to do with
pg resources and database result sets.

I'm surprise you are not getting some kind of error on that...

Or maybe you aren't using 'error_reporting(E_ALL)' like you should.

  {
  echo $row[rownum] .  -  . $row[rowstr] .  \n;
  }

  echo \n;

  $x++;

 }

 echo /pre\n;

 --
 results
 --

 4-Resource id #4

 1 - aa
 2 - bb
 3 - cc
 4 - dd
 
 4-Resource id #4

 

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




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

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



Re: [PHP] cannot remove cookies

2005-02-22 Thread Richard Lynch
Bruno Santos wrote:
 I'm using 2 cookies to control some user environmente.
 every time the user logs in, the cookie is set, but when i try to change
 the value of that cookie,
 deleting it firts and then setting a new one with another value, when i
 print the value of that cookie
 the value is never the new one, but always the firts.

Keep in mind the interaction here:

PHP sends cookie to browser in HTTP interaction 1.
Browser returns cookie to PHP in the *next* HTTP request. (#2)

So the play is going like this:

Act I, Scene 1.
setcookie sends cookie to browser.
Act I, Scene 2.
browser sends cookie to PHP
PHP sends new value to browser.
You check the value of the cookie, and it's still the old value
[You have not yet gone beyond this step, but you should]
Act II, Scene 1.
browser sends new cookie value to PHP

So provide yourself with a link to a new page, and your new cookie value
will magically appear

In Act I, Scene 2, you can simply keep track of the cookie value within
your script, and trust the browser (mostly) to send it back in the next
scene.

 im setting the cookie with:
 setcookie (cookie_name,cookie_value,time()+time-to-expiration);

For some versions of Micrsoft Internet Explorer, you *MUST* provide a path
if you provide a time-out.

Use '/' at the end of your setcookie after any timeout value.

 when deleting it, i do
 setcookie (cookie_name);
 or
 setcookie (cookie_name,,time()-time-to-expiration);

 but it never works

 the browser im testing it is firefox (linux)
 but in IE is not working either...

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

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



Re: [PHP] resetting pg_fetch_array

2005-02-22 Thread Dave O
Richard Lynch wrote:
Dave O wrote:
Hi all.  I'm been trying the following code for the past day or so and I
 can't seem to get around it.  I'm issuing a query to pgsql and
iterating  through the results twice in order to facilitate the
separation of shipment history.
Below is the simplest example I can come up with.  The results only
display once, even though I'm not issuing any other db calls after the
1st iteration and the resouce id remains the same.  Heck, even
pg_num_rows returns the same result twice, but the results just won't
display a second time.
I'm running this on freebsd 5.3 using pgsql v8 and php 4.3.10.  Anybody
got any suggestions.  TIA.
Dave
table looptest
 rownum | rowstr
+
  1 | aa
  2 | bb
  3 | cc
  4 | dd
include ('connection.inc.php');
$sql = SELECT rownum, rowstr FROM looptest;
$result = pg_query($conn, $sql);
$c=2;
$x=0;
echo pre\n;
while ($x$c)
{
echo pg_num_rows($result) . -;
print_r($result);
echo \n\n;
reset($result);
while($row = pg_fetch_array($result))

This automatically advances an internal counter to the next row.
You never rewind the counter.
[Be kind, rewind!]
You can either find the pg_data_seek function that does the rewind, or you
   ^  ^  ^  ^
 pg_result_seek ???
can do a counter yourself and pass in the optional row number argument to
pg_fetch_array:
$row_num = 0;
while ($row = pg_fetch_array($result, $row_num++))
The reset function you are using is for ARRAYS, and has nothing to do with
pg resources and database result sets.
I'm surprise you are not getting some kind of error on that...
Or maybe you aren't using 'error_reporting(E_ALL)' like you should.

 stuff snipped
Yep, pg_result_seek did the trick.  Using:
pg_result_seek($result, 0)
..just before the 'while' statement makes the results show up twice.  I 
reread the manual page for this and understood there was a counter, but 
it didn't click that there might be a pg function to handle this.  I 
took the mention of array too seriously and was looking under the 
array functions.

Btw, E_ALL is set, but following suggestions in these lists and the 
site, I've it set to log to a file and not display any errors.  That's 
probably something to reconsider for development.

Thanks for the help Richard.  Much appreciated.
Dave
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] php temporary files

2005-02-22 Thread Péntek Imre
2005. feb 22. 05.17 dátummal Marek Kilimajer wrote:
 You need to set enviroment variables $TMPDIR and $TMP. I'm not sure
 which one of these are used by those functions, but you can safely
 change both.
Thanks for your kind help.
-- 
With regards: Ifj. Péntek Imre
E-mail: [EMAIL PROTECTED]

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



Re: [PHP] Sessions and cookies

2005-02-22 Thread Chris Shiflett
 When a session object is created - where is it store?

Assuming you mean session data, it is stored on the server, in /tmp by
default.

 To destroy the session object (widht all session vairables inside the
 particluar session object) can I use session_destroy();

http://www.php.net/session_destroy says:

session_destroy() destroys all of the data associated with the current
session. It does not unset any of the global variables associated with the
session, or unset the session cookie.

This means that session_destroy deletes the particular record from the
session data store. It does not act on the cookie nor the $_SESSION
superglobal array.

Hope that helps.

Chris

=
Chris Shiflett - http://shiflett.org/

PHP Security - O'Reilly HTTP Developer's Handbook - Sams
Coming Soon http://httphandbook.org/

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



Re: [PHP] Writing PNG Images to File from Command Line

2005-02-22 Thread Jason Barnett
Richard Lynch wrote:
... Good stuff ...
 All that said:
 If you only have a handful of color coded flags, and you are using GD to
 re-draw an image every time, that's kinda silly...
 
 Perhaps I'm missing something here, but:
 
 Just use your query to decide which flag to *USE* instead of drawing a new
 one every time.
 
 html
   body
 ?php
   /* db query to determine flag color here */
   echo img src=\$flag_color.png\;
 ?
   /body
 /html
 
 No need to fire up GD on every image if you only have a handful of
 possible outputs.
 
 Or does a single image consist of many many many flags?  Oh, okay.  GD is
 the answer then.  Probably.  An HTML table of a bunch of tiny images
 *might* be faster/smoother.
 

Agreed... you should create a bunch of tiny images if you have a fixed
set of flags that you will need to output.  If there are too many
possible combinations to make this practicable then using GD on-the-fly
is a good, but in general I try to serve static content where possible.

Now this doesn't mean you shouldn't use GD to create the images that you
will need... it just means that you should do it and then save these
images to the server for later use.  That way the image creation is a
one-time hit and all future use is just reading from disk.


-- 
Teach a man to fish...

NEW? | http://www.catb.org/~esr/faqs/smart-questions.html
STFA | http://marc.theaimsgroup.com/?l=php-generalw=2
STFM | http://php.net/manual/en/index.php
STFW | http://www.google.com/search?q=php
LAZY |
http://mycroft.mozdev.org/download.html?name=PHPsubmitform=Find+search+plugins


signature.asc
Description: OpenPGP digital signature


[PHP] ranking product based on votes in a given week

2005-02-22 Thread Ryan Schefke
I am trying to echo the ranking of votes (highest to lowest) that a product
received in a given week. See example of desired output.

 

In the  query below, It's working great and outputs ID, votes, and week;
however, I can't figure out how to get the ranking for a given week. In the
example below, how would I be able to output values in the Ranking column
for week 8 so that ID 1 is ranked 1, ID 3 is ranked 2, etc. Help?

 

Example ranking:

ID VotesRankingWeek

1  29 1  8

3  23 2  8

7  2  3  8

1  2  1  10



 

 QUERY --

$query = SELECT WEEK(date) as week, count(*) as hits, listingID as lidcount
FROM 

invotestotal GROUP BY week, lidcount ORDER BY week DESC, hits DESC; 

$result  = @mysql_query($query);

while ($row = mysql_fetch_array($result, MYSQL_NUM)) {

$printweek = $row[0];

$countinvotes = $row[1];

$lidnumber = $row[2];

 

Then, echo values in table rows...

 

}

 QUERY --

 

 

 DEFINITIONS IN QUERY --

WEEK(date) as week :: week vote took place

count(*) as hits :: counts total votes

listingID as lidcount :: ID of the product that received the vote

 DEFINITIONS IN QUERY --

 

 

 

Best regards,

Ryan



Re: [PHP] Writing PNG Images to File from Command Line

2005-02-22 Thread dpgirago
Bret, Richard, Jason,

Thank you all for your comments and suggestions.

What I had been doing -- using GD to create the image with db data in one 
file, then calling this file from IMG SRC=make_the 
_picture_in_here.php in another page, seems to have been the culprit in 
regards to the latency issue. Of note is that this is an intranet app, 
traffic is not so heavy, and the netadmin has already said that he didn't 
think the network was the issue. However at a previous building, the app 
worked just fine, which was the only reason that I even pursued the 
approach I was taking. Also, Mozilla (Gecko...?) is almost perfectly 
stable as opposed to IE, which just doesn't cut it at all. 

I had concerns similar to  Richard about reading and writing to the same 
file at the same time. So, for the time being, we are going to live with a 
5 second delay in data availability, i.e., use html to display the latest 
image file at the top of the page, then jump into php and overwrite the 
file with new data at the bottom of the page, then wait 5 seconds for the 
page to refresh with the latest image. 

The idea of using pre-made, colored flags, handled within the code, sounds 
very reasonable, and if problems persist, I think this approach will be 
tried next. There are only 3 colors for flag states, red - yellow - green, 
and these cover 24 Neutron monitors, so not too time consuming to 
implement. But other data from the db get displayed also, so it still 
seems best to create one image with all the data for the entire page, 
assuredly large at  about 1200 X 800 pixels. 

Is it possible to limit the bit-depth or reduce the file size of a PNG 
image ? I haven't found anything in the manual about this as yet.

David 

[PHP] how to select files from a directory and transfer to a different dir ?

2005-02-22 Thread Vaibhav Sibal
Hello,
I need to select around 200 files at random out of a file pool of
10k-15k files from a directory and then transfer them to another
directory on my linux server which runs Apache 2.0.52, PHP 5.0.3 and
Mysql. I will also be requiring to add the paths of all those files
into a database. If someone can please suggest the way to do it, I
will be really grateful. I dont know how to select 200 files at random
and then transferring the files to another directory and then adding
those files to a database.

thanks
Vaibhav

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



[PHP] DataObject insert issue: triplicate inserts

2005-02-22 Thread Sasha Sklar
This is the issue: every insert I perform is generating 3 rows instead
of 1.

 

I'm using DataObjects with manually created classes, I can't use the
generator do to permission issues.

 

This is my class:

 

class DO_test extends DB_DataObject {

var $__table = 'test';

var $test_id;

var $test_value;

 

function staticGet($k,$v=NULL) { return
DB_DataObject::staticGet('DataObjects_Grp',$k,$v); }

 

function keys() {

return array('test_id');

}

 

function table() {

return array(

'test_id'   = DB_DATAOBJECT_INT,

'test_value'= DB_DATAOBJECT_STR

);

}

}

 

Here is the test insert:

 

DB_DataObject::debugLevel (5);

 

$test_do = new DO_test;

$test_do-test_value = 'bork this shit';

$id = $test_do-insert();

 

DB_DataObject::debugLevel();

 

if (PEAR::isError($id)) {

  die($id-getMessage());

}

echo $id;

 

Here is a description of the table:

 

++-+--+-+-++

| Field  | Type| Null | Key | Default | Extra  |

++-+--+-+-++

| test_id| int(9)  |  | PRI | NULL| auto_increment |

| test_value | varchar(64) | YES  | | ||

++-+--+-+-++

 

Can anyone give me a clue?

 

I can provide any other info that is needed.

 

Thanks a lot,

 

Sasha

 



[PHP] Looking for commercial coder

2005-02-22 Thread Verdon Vaillancourt
Hi :)
I am looking for a competent coder to help me with a shipping module 
for an e-commerce project I am working on. Essentially I need a script 
that can check a Canadian postal code and/or US zip code (from the 
cart) against a flat-file or db table, find it's zone in a series of 
ranges of codes, grab the correct value for the weight of the products 
in the cart, and pass it back to the cart. The cart I am working with 
is Zen-Cart. I am not looking for a freebie.

For example, my postal code might be: P1B 7E9
The zone chart uses the 1st 3 chars, and looks something like:
Range   Zone
A0A-A0N 11
G6E-G6K 5
J5Y-J6A 4
R5A-R6W 8
T9E 6
A1A-A1S 11
G6L-G6T 5
J6E 4
R7A-R7C 7
T9G 9
A1V-A2N 11
Then there's a weight/price ratio for each zone.
If I really have to, I'll tackle this myself, but I'd rather contract 
it out and invest my own time elsewhere. If you have the skills to do 
this, and are interested and available, please contact me off-list.

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


Re: [PHP] [HAB] str_replace

2005-02-22 Thread Jochem Maas
Bret Hughes wrote:
On Tue, 2005-02-22 at 09:59, OOzy Pal wrote:
Dears
I am trying replace anything between '{!' and '!}' i.e {!A!} and {!B!} 
and {!ABC!} with XYZ. I tried the following but no help. Can anyone 
help?

$this-template=str_replace({!*!},XYZ,$this-template);
Thank you


IIRC str_replace does not use any type of globbing.  You need to use one
of the function that uses regular expresions I prefer preg_replace
personally.  regexes can get complicated looking pretty quick but are an
incredibly powerful mechanism once you understand even the rudiments.  I
would place my self in that catagory.

echo preg_replace(/{\!(.*)\!}/,{!REPLACED!},erg9872et 
{!---SUPERDUPER---!}gjhgo6*%^*^%Y)7ygr9y2343);
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Hi ALL

2005-02-22 Thread Jochem Maas
Bret Hughes wrote:
On Tue, 2005-02-22 at 05:27, Dhanasekar T wrote:
hi all,
i m new to this group ...now i want to learn php.
right now? not in five minutes.
i want all u r guidence  to utilise this group...
thanks in advance 
dhanas

Dhanas,
do you have php installed ?
can you access http://php.net ? the best place to start
reading/learning

I would start by looking at and dare I say reading the manual at
php.net.  Then surf around for a beginners tutorial, and start coding.  

I suspect the learning curve shape depends on whether you have any
previous programming experience or not.
hey! I was looking forward to being utilized. ;-)
Bret
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Hi ALL

2005-02-22 Thread Rory Browne
How to use this list best:

Search the archives at lists.php.net for [NEWBIE GUIDE] It was written
by Jay Blanchard earlier this year I believe. Read it.

Then read this: http://www.catb.org/~esr/faqs/smart-questions.html

Then try learning PHP from the PHP manual. If you come across a
problem, then explain the problem, AND WHAT STEPS YOU HAVE TAKEN TO
SOLVE THE PROBLEM YOURSELF BEFORE POSTING TO THE LIST.

Give a little back. After you've learn't a little, and you see someone
else posting a question that you know the answer to an feel you can
explain well, then hit your email clients reply button.

If you want to fit in, and you want to be taken seriously, and most
importantly if you want to learn, then consider the above points.



On Tue, 22 Feb 2005 23:21:48 +0100, Jochem Maas [EMAIL PROTECTED] wrote:
 Bret Hughes wrote:
  On Tue, 2005-02-22 at 05:27, Dhanasekar T wrote:
 
 hi all,
 i m new to this group ...now i want to learn php.
 
 right now? not in five minutes.
 
 i want all u r guidence  to utilise this group...
 thanks in advance
 dhanas
 
 Dhanas,
 
 do you have php installed ?
 can you access http://php.net ? the best place to start
 reading/learning
 
 
 
  I would start by looking at and dare I say reading the manual at
  php.net.  Then surf around for a beginners tutorial, and start coding.
 
  I suspect the learning curve shape depends on whether you have any
  previous programming experience or not.
 
 hey! I was looking forward to being utilized. ;-)
 
 
  Bret
 
 
 --
 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] Having problem with ob_start('gz_handler'); (seg fault)

2005-02-22 Thread Chris W. Parker
Hello,

I'm having a mysterious problem with phpMyAdmin 2.6.1. I've already
consulted the phpMyAdmin forum on sourceforge but so far I've not had
any answers come my way.

All of a sudden this morning I found that the program stops dead in its
track's during a call to ob_start('gz_handler');. There are no errors
displayed on screen but there is one error logged to the error_log. It
is:

[Tue Feb 22 15:38:38 2005] [notice] child pid 2909 exit signal
Segmentation fault (11)

I realize this is not phpMyAdmin's problem, however it was the software
I was using when I found this problem.

I have not made any configuration changes whatsoever for quite a long
time now on my server so I don't see why it would all of a sudden stop
working.

I'm running Apache/2.0.40,  MySQL 3.23.54, and PHP 4.2.2.

I read that this might be related to hardware I SURE HOPE NOT! Ugh.

Any help would be appreciated.


Thanks,
Chris.

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



Re: [PHP] ranking product based on votes in a given week

2005-02-22 Thread Ligaya Turmelle
how about a WHERE clause.
Maybe something like:
$query = SELECT WEEK(date) as week, count(*) as hits, listingID as 
lidcount FROM invotestotal WHERE WEEK(date) = 8 ORDER BY hits DESC;

Ryan Schefke wrote:
I am trying to echo the ranking of votes (highest to lowest) that a product
received in a given week. See example of desired output.
 

In the  query below, It's working great and outputs ID, votes, and week;
however, I can't figure out how to get the ranking for a given week. In the
example below, how would I be able to output values in the Ranking column
for week 8 so that ID 1 is ranked 1, ID 3 is ranked 2, etc. Help?
 

Example ranking:
ID VotesRankingWeek
1  29 1  8
3  23 2  8
7  2  3  8
1  2  1  10


 

 QUERY --
$query = SELECT WEEK(date) as week, count(*) as hits, listingID as lidcount
FROM 

invotestotal GROUP BY week, lidcount ORDER BY week DESC, hits DESC; 

$result  = @mysql_query($query);
while ($row = mysql_fetch_array($result, MYSQL_NUM)) {
$printweek = $row[0];
$countinvotes = $row[1];
$lidnumber = $row[2];
 

Then, echo values in table rows...
 

}
 QUERY --
 

 

 DEFINITIONS IN QUERY --
WEEK(date) as week :: week vote took place
count(*) as hits :: counts total votes
listingID as lidcount :: ID of the product that received the vote
 DEFINITIONS IN QUERY --
 

 

 

Best regards,
Ryan

--
Respectfully,
Ligaya Turmelle
Life is a game so have fun
-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

[PHP] uploading remote server

2005-02-22 Thread Sebastian
i have some php forms which uploads files/images and i would like to know if
its possible to upload them to a remote server instead, if so, how?

cheers

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



[PHP] Re: uploading remote server

2005-02-22 Thread Jason Barnett
Sebastian wrote:
 i have some php forms which uploads files/images and i would like to know if
 its possible to upload them to a remote server instead, if so, how?
 
 cheers

Yes it is possible.  This is a bit of reading, but it is exactly what
you need to read:

http://php.net/manual/en/features.file-upload.php
http://php.net/manual/en/features.remote-files.php

After you read the above links you should have a pretty clear idea of
how it works (in general).  If you have a specific question about your
FTP server or whatever, feel free to come back and ask us that detailed
question instead.  :)

-- 
Teach a man to fish...

NEW? | http://www.catb.org/~esr/faqs/smart-questions.html
STFA | http://marc.theaimsgroup.com/?l=php-generalw=2
STFM | http://php.net/manual/en/index.php
STFW | http://www.google.com/search?q=php
LAZY |
http://mycroft.mozdev.org/download.html?name=PHPsubmitform=Find+search+plugins


signature.asc
Description: OpenPGP digital signature


Re: [PHP] Problem: mysqli class not found

2005-02-22 Thread sylikc
David,


 I have an install of PHP 5 on Windows 2003 Server with Apache 2 and when I
 reference mysqli in my php code, I get an error that the mysqli class is not
 found.

I've wrestled with Windows 2000 Server with Apache 2 configuration,
and hopefully this will apply for 2003 as well.


 I looked at the php.ini file and I added a line for php_mysqli in the
 extensions section and I edited the extension_dir directive to point to
 c:\php\ext folder (I used /php/ext as the value assigned to the directive.
 
 I made sure that the c:\php\ext folder actually had a file called
 php_mysqli.dll, which it did.

Somehow PHP ISAPI can't seem to find your extensions folder.  In my
setup, I also have PHP installed into c:\php\ext, and in effect, in my
PHP.INI I set

extension_dir = C:\php\ext

...which works just fine.  I don't think you need to use the UNIX path
structure, and that may be the root of your problem.

Another thing to check would be NTFS permissions on the PHP.INI file. 
If the user that Apache2 is running under cannot read the PHP.INI
file, then none of your extra configuration directives would appy.

Also, I think there is a bulletproof way to ensure everything works,
just in case you installed some additional extension that requires
some extra DLLs you don't want to drop into your SYSTEM32 directory. 
You can add c:\php\ext into your global windows environment
variable.  I've found that to work out well in the long run if you
have additional extensions and dependencies.


 No I can't start my Apache server.
 
 I had done a default install of both Apache 2 and PHP 5.
 
 Any ideas as to how I can get the mysqli class identified and allow my
 Apache server to start.

Apache can't start properly when the extension can't be found.  But,
if the above works and you're able to start up Apache, write a small
script and put in

? phpinfo(); ?

and run through the wealth of information that is displayed to make
sure mysqli is installed as an extension.


/sylikc

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



[PHP] String validation

2005-02-22 Thread Ashley M. Kirchner
   How can I check that a string is no more than 6 characters long and 
only contains alpha characters (no numbers, spaces, periods, hyphens, or 
anything else, just letters.)

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


Re: [PHP] String validation

2005-02-22 Thread John Holmes
Ashley M. Kirchner wrote:
   How can I check that a string is no more than 6 characters long and 
only contains alpha characters (no numbers, spaces, periods, hyphens, or 
anything else, just letters.)

if(preg_match('/^[a-zA-Z]{0,6}$/',$string))
{ echo 'good'; }
else
{ echo 'bad'; }
Change to {1,6} if you want to ensure the string isn't empty.
--
---John Holmes...
Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/
php|architect: The Magazine for PHP Professionals  www.phparch.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Formatting e-mail using mail()

2005-02-22 Thread Jacques
Can I format an e-mail message with html tags inside the mail() function? 
If not, how can I go about it? I would like to format the layout of the 
e-mail message using tables, colors and perhaps images.

Regards - Jacques 

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



[PHP] Bug or undocumented functionality of unset()?

2005-02-22 Thread karl
Hi All,

Does unset() create a copy of the array and then overwrite the 
original
somehow 
destroying the reference?
In the example below, no item has it's value set to 'foo', however if 
the
$stuff array is 
accessed directly (see commented line) rather than by reference it 
works
fine.  In 
addition to this, if the unset(); line is commented, the reference 
will
also work.

Anyone know why?

Thanks,

Karl.
---
?php
$stuff = array(array('one','two'),
array('one','two'),
array('three','four'),
array('five','six'),
array('seven','eight'),
array('nine','ten'));

print 'pre'; print_r($stuff); print '/pre';

foreach ($stuff as $key = $values) {
print on key:$keybr;
if(($key%2)==0){
print Running unset for $key br;
unset ($stuff[$key]);
}else{
print Running change for $key br;
$values[1]='foo';
//  $stuff[$key][1] = 'foo';
}
}
print 'pre'; print_r($stuff); print '/pre';
?

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



Re: [PHP] String validation

2005-02-22 Thread Ligaya Turmelle
or if you aren't into regex (which I find confusing and still am trying 
to learn):

if ((strlen(trim($string)) =6)  ctype_alpha(trim($string)))
{ echo 'good'; }
else
{ echo 'bad'; }

John Holmes wrote:
Ashley M. Kirchner wrote:
   How can I check that a string is no more than 6 characters long and 
only contains alpha characters (no numbers, spaces, periods, hyphens, 
or anything else, just letters.)

if(preg_match('/^[a-zA-Z]{0,6}$/',$string))
{ echo 'good'; }
else
{ echo 'bad'; }
Change to {1,6} if you want to ensure the string isn't empty.
--
Respectfully,
Ligaya Turmelle
Life is a game so have fun
-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] Formatting e-mail using mail()

2005-02-22 Thread Burhan Khalid
Jacques wrote:
Can I format an e-mail message with html tags inside the mail() function? 
If not, how can I go about it? I would like to format the layout of the 
e-mail message using tables, colors and perhaps images.
Please, FFS RTFM  http://www.php.net/manual/en/function.mail.php
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Having problem with ob_start('gz_handler'); (seg fault)

2005-02-22 Thread Burhan Khalid
Chris W. Parker wrote:
[ snipped ]
I'm running Apache/2.0.40,  MySQL 3.23.54, and PHP 4.2.2.
You need to upgrade to the latest PHP version, which is 4.3.10 and while 
you are at it, consider upgrading MySQL to 4.0.

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


[PHP] Putting Evaluated Contents Of Include File Into Varialble

2005-02-22 Thread Michael Stearne
Hi,

I have an file that contains PHP code..variables, db, etc.  Is it
possible to include the evaluted contents of that file into a variable
in another, the calling PHP script?

Essentailly I am looking to do something like

include(myCode.php) - HTML Output - $myVariable.

I know could do this with something like
$myVariable=file_get_contents(http://localhost/myCode.php;) but I am
not allowed to use urls in file opens.

Any suggestions?

Thanks,
Michael

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