php-general Digest 29 Jun 2004 22:16:08 -0000 Issue 2848 Topics (messages 189219 through 189241):
Re: Session file in /tmp 189219 by: Tim Best Function that creates a class instance with a given name 189220 by: Maris 189221 by: Maris 189230 by: Justin Patrin calling imagemagick from php 189222 by: Edward Peloke 189224 by: Edward Peloke 189227 by: Michal Migurski 189228 by: Edward Peloke 189229 by: Edward Peloke Re: OOP, Classes, Sharing Code 189223 by: rush imagecopyresampled() 189225 by: Klaus Reimer CHAT 189226 by: Juan Pablo Herrera 189234 by: Pablo Gosse 189235 by: Juan Pablo Herrera E-mail account disabling warning. 189231 by: management.php.net Mail Processing - Bounce 189232 by: Jason Williard Re: *** [sapi/cgi/php] Error 1 189233 by: Nguyen, Long P (Mission Systems) php-4.3.7 installation error 189236 by: Nguyen, Long P (Mission Systems) test if $int is integer 189237 by: vlad georgescu 189238 by: Lars Torben Wilson 189239 by: Pierre 189240 by: Matthew Sims 189241 by: Mark Leavy 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: [EMAIL PROTECTED] ----------------------------------------------------------------------
--- Begin Message ---2 Problems: 1. User A's information will come up when user B logs in instead of user B's information coming up when user B logs in... User A's information seems to be cached in /tmp/sess_8ce0348cbf6704f96c2d8094e876ac3b. Any ideas how to keep this from happening? 2. When a user exits Internet Explorer without logging off and invoking session_destroy(); the user cannot log back in immediately. If I SSH into the server and delete /tmp/sess_8ce0348cbf6704f96c2d8094e876ac3b then the user can log back in. Do I need to write a shell_exec routine to delete this file when the session is destroyed? How can I tell from the server that the user has closed the window? Thanks again! /T on 6/29/04 4:01, Red Wingate at [EMAIL PROTECTED] wrote: > i guess what u are looking for is session_destroy(); > > Binay wrote: > >> If i m getting ur problem correctly then u want to restrict the same user >> logging from different machines concurrently. If tht being the case the >> snippet u mentioned below alone won't solve the problem . you have >> maintain a flag in the database which will be on when the user logs in and >> off when he/she logs out. >> >> >>> Code: >>> >>> session_cache_expire(0); >>> session_cache_limiter('private'); >>> session_start(); >>> >>> I use this at the beginning of my script that processes data objects for >> my >>> users. The users use multiple machines and login to the web site. This >>> prevents the cached information from one user popping up when another >>> user >>> logs in. Will this contribute to the solution for my main problem: >>> >>> When a user exits a window without logging out they have to wait until >>> the cookie expires or the session file in /tmp is deleted before they can >>> get >>> back in. This is the code that executes at login: >>> >>> session_cache_expire(0); >>> session_cache_limiter('private'); >>> setcookie("cookie","",0,"/","iffinet.com",1); >>> session_start(); >>> >>> I was hoping this would cause the session file in /tmp to be deleted but >> it >>> doesn¹t work. I also tried unset($_SESSION[Oid¹]) this doesn¹t work >> either. >>> Anyone have any ideas as to how I can resolve this? >>> >>> Thanks for your help! >>> >>> /Tim >>> >>> -- >>> PHP General Mailing List (http://www.php.net/) >>> To unsubscribe, visit: http://www.php.net/unsub.php >>> Best IT cell: 504-231-1084 fax: 206-338-6162 [EMAIL PROTECTED] http://www.best-it.biz
--- End Message ---
--- Begin Message ---Hi there! I am trying to make a PHP function "create_object" that would allow me to create a class instance with supplied name Here's the Smarty code snipset I would like to use my function in: {* Let's create a new class object with name "car" *} {create_object id=$id_car name="car"} {* When it is created, we can print out its properties or do whatever we need to *} The brand is: {$car->brand} and car's color is: {$car->color} Any ideas how to create PHP function that would allow to create the instance so I can operate with it in Smarty as shown above? function create_object($id, $name){ //help needed } Thanks, Maris
--- End Message ---
--- Begin Message ---Found the solution: function create_car($params){ global $smarty; $car = new Car("Jeep sWrangler","black"); $smarty->register_object($params[id], $car); } "Maris" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hi there! > > I am trying to make a PHP function "create_object" that would allow me to > create a class instance with supplied name > > Here's the Smarty code snipset I would like to use my function in: > > {* Let's create a new class object with name "car" *} > {create_object id=$id_car name="car"} > > {* When it is created, we can print out its properties or do whatever we > need to *} > The brand is: {$car->brand} > and car's color is: {$car->color} > > > > Any ideas how to create PHP function that would allow to create the instance > so I can > operate with it in Smarty as shown above? > > function create_object($id, $name){ > //help needed > } > > > Thanks, > Maris
--- End Message ---
--- Begin Message ---On Tue, 29 Jun 2004 14:16:16 +0300, Maris <[EMAIL PROTECTED]> wrote: > > Hi there! > > I am trying to make a PHP function "create_object" that would allow me to > create a class instance with supplied name > > Here's the Smarty code snipset I would like to use my function in: > > {* Let's create a new class object with name "car" *} > {create_object id=$id_car name="car"} > > {* When it is created, we can print out its properties or do whatever we > need to *} > The brand is: {$car->brand} > and car's color is: {$car->color} > > Any ideas how to create PHP function that would allow to create the instance > so I can > operate with it in Smarty as shown above? > > function create_object($id, $name){ > //help needed > } Perhaps: function create_object($class, $name){ $obj = new $class(); $this->assign($name, $obj); } > > Thanks, > Maris > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > !DSPAM:40e14d8b133258412246093! > > -- paperCrane --Justin Patrin--
--- End Message ---
--- Begin Message ---Hello, I am trying to call imagemagick directly from php and am using this code: http://sniptools.com/vault/dynamic-thumbnailing-with-imagemagick-in-php.htm problem is, nothing happens, I simply get the returned error that the thumbnail wasn't created. I have talked to my isp and imagemagick is installed....how can I debug this?? Thanks, Eddie
--- End Message ---
--- Begin Message ---I have actually changed my code to this for debug purposes system('convert -geometry 200 x 200 image.JPG theThumb.gif', $retval) and if I cut out string between the single quotes and just run it at a command prompt, it works great....when I run this php script, I get syntax errors....what is wrong? Thanks, Eddie -----Original Message----- From: Edward Peloke [mailto:[EMAIL PROTECTED] Sent: Tuesday, June 29, 2004 10:14 AM To: Php-General Subject: [PHP] calling imagemagick from php Hello, I am trying to call imagemagick directly from php and am using this code: http://sniptools.com/vault/dynamic-thumbnailing-with-imagemagick-in-php.htm problem is, nothing happens, I simply get the returned error that the thumbnail wasn't created. I have talked to my isp and imagemagick is installed....how can I debug this?? Thanks, Eddie -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---> I have actually changed my code to this for debug purposes > > system('convert -geometry 200 x 200 image.JPG theThumb.gif', $retval) > > and if I cut out string between the single quotes and just run it at a > command prompt, it works great....when I run this php script, I get > syntax errors....what is wrong? Perhaps convert is not in your path? Also, I'm not sure that the -geometry argument is going to behave how you expect - typically, geometry is expressed as "WxH", not "W x H", in command-line arguments to imagemagick. In the former case, you will set the size of your output image to W width and H height. In the latter case, I believe that the 'x H' is ignored, and you implicitly set the size of your output image to W width and W height. Big difference for any aspect ratio besides 1:1. --------------------------------------------------------------------- michal migurski- contact info and pgp key: sf/ca http://mike.teczno.com/contact.html
--- End Message ---
--- Begin Message ---I can go into the directory cut out the code between the single quotes and execute it and it works fine. It just doesn't seem to work running from the system or exec function. The $retval is 1. When I try to run the php script from the command line I get "syntax error near unexpected token 'theThumb.gif',$retvalue)' Thanks, Eddie -----Original Message----- From: Michal Migurski [mailto:[EMAIL PROTECTED] Sent: Tuesday, June 29, 2004 11:09 AM To: Edward Peloke Cc: Php-General Subject: RE: [PHP] calling imagemagick from php > I have actually changed my code to this for debug purposes > > system('convert -geometry 200 x 200 image.JPG theThumb.gif', $retval) > > and if I cut out string between the single quotes and just run it at a > command prompt, it works great....when I run this php script, I get > syntax errors....what is wrong? Perhaps convert is not in your path? Also, I'm not sure that the -geometry argument is going to behave how you expect - typically, geometry is expressed as "WxH", not "W x H", in command-line arguments to imagemagick. In the former case, you will set the size of your output image to W width and H height. In the latter case, I believe that the 'x H' is ignored, and you implicitly set the size of your output image to W width and W height. Big difference for any aspect ratio besides 1:1. --------------------------------------------------------------------- michal migurski- contact info and pgp key: sf/ca http://mike.teczno.com/contact.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---I changed 200 x 200 to 200x200 and it still doesn't work. I also checked and safe_mode is OFF. Thanks, Eddie -----Original Message----- From: Edward Peloke [mailto:[EMAIL PROTECTED] Sent: Tuesday, June 29, 2004 11:36 AM To: Michal Migurski Cc: Php-General Subject: RE: [PHP] calling imagemagick from php I can go into the directory cut out the code between the single quotes and execute it and it works fine. It just doesn't seem to work running from the system or exec function. The $retval is 1. When I try to run the php script from the command line I get "syntax error near unexpected token 'theThumb.gif',$retvalue)' Thanks, Eddie -----Original Message----- From: Michal Migurski [mailto:[EMAIL PROTECTED] Sent: Tuesday, June 29, 2004 11:09 AM To: Edward Peloke Cc: Php-General Subject: RE: [PHP] calling imagemagick from php > I have actually changed my code to this for debug purposes > > system('convert -geometry 200 x 200 image.JPG theThumb.gif', $retval) > > and if I cut out string between the single quotes and just run it at a > command prompt, it works great....when I run this php script, I get > syntax errors....what is wrong? Perhaps convert is not in your path? Also, I'm not sure that the -geometry argument is going to behave how you expect - typically, geometry is expressed as "WxH", not "W x H", in command-line arguments to imagemagick. In the former case, you will set the size of your output image to W width and H height. In the latter case, I believe that the 'x H' is ignored, and you implicitly set the size of your output image to W width and W height. Big difference for any aspect ratio besides 1:1. --------------------------------------------------------------------- michal migurski- contact info and pgp key: sf/ca http://mike.teczno.com/contact.html -- 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
--- End Message ---
--- Begin Message ---"Joel Kitching" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > What generic class name would be appropriate in this case? I just > can't see how I would link the two together. Also, they would have to > use fairly generic variables names if I were to do this. Like using > the variable $items for the array of classes of either albums or > photos. I am using AbstractItemList, and then subclass PhotoList, and others form it. Abstract item list takes care of repeating items, pagination, and displaying navigation between listing pages. Concrete classes know how to display item in list (itemAsListElement()), know how many items there are in total, and getNextItem iterator. There is a bit more but this should be enough to get you started. rush -- http://www.templatetamer.com/
--- End Message ---
--- Begin Message ---Hello, I have a problem with imagecopyresampled() and I'm not sure if this is a bug in GD or PHP or it's a feature. I'm trying to do the following (This example doesn't make much sense, it's just a simple way to reproduce the problem): I have an alphatransparent image 512x512. I want to resample that image to 256x256 and draw it onto a blue background. After that I want the background color to be pixel-transparent. With GD I'm doing it like that: 1. Create new true color image with a size of 255x255 2. Allocate a background color and fill the new image 3. Load the alphatransparent PNG 4. Render the PNG on the background image with imagecopyresampled 5. Define the background color as transparent (imagecolortransparent) 6. Save the image as PNG. Now here is the result: http://www.ailis.de/~k/test/imagecopyresampled/255.png If I do exactly the same with a target image size which is a base of 2 (2, 4, 8, 16, .... 256) it works. See here: http://www.ailis.de/~k/test/imagecopyresampled/256.png With imagecopyresized everything works fine. But imagecopyresampled has problems with "binary uneven" target sizes. Is this a GD bug? I'm using PHP 4.3.3 with GD 2.0.23 (The stuff from current Debian Sarge). Does anybody know a solution or a workaround? -- Bye, K <http://www.ailis.de/~k/> (FidoNet: 2:240/2188.18) [A735 47EC D87B 1F15 C1E9 53D3 AA03 6173 A723 E391] (Finger [EMAIL PROTECTED] to get public key)
--- End Message ---
--- Begin Message ---Hi! I need a chat program in php with GNU License. What's experience whith chat program in PHP? regards, Juan Pablo
--- End Message ---
--- Begin Message ---Juan Pablo Herrera wrote: > Hi! > I need a chat program in php with GNU License. What's experience > whith chat program in PHP? regards, Juan Pablo G-O-O-G-L-E: Search: php chat program gnu http://www.google.ca/search?q=php+chat+program+gnu&ie=UTF-8&hl=en&meta=
--- End Message ---
--- Begin Message ---> Juan Pablo Herrera wrote: >> Hi! >> I need a chat program in php with GNU License. What's experience whith >> chat program in PHP? regards, Juan Pablo > > G-O-O-G-L-E: > > Search: php chat program gnu > > http://www.google.ca/search?q=php+chat+program+gnu&ie=UTF-8&hl=en&meta Thank you, but i am not answer "Where". Experience? Regards, Juan Pablo
--- End Message ---
--- Begin Message ---<<attachment: rysciigebi.bmp>>
--- End Message ---
--- Begin Message ---I'm building a tool to process incoming mail. So far, I have a script that receives mail that is piped to it. I am able to process the mail without a problem. However, the script causes a bounce message containing the output of the script. Does anyone know how I can fix this? The script: http://www.janix.net/test/mail.phps The bounce message: This message was created automatically by mail delivery software. A message that you sent could not be delivered to one or more of its recipients. This is a permanent error. The following address(es) failed: pipe to |/www/test/mail.php generated by [EMAIL PROTECTED] The following text was generated during the delivery attempt: ------ pipe to /www/test/mail.php generated by [EMAIL PROTECTED] ------
--- End Message ---
--- Begin Message ---I am getting these errors when I run a 'make'. Any ideas why? ./configure --with-mysql make /tmp/dres/php-4.3.7/ext/mysql/libmysql/my_tempnam.c:115: warning: the use of `tempnam' is dangerous, better use `mkstemp' ext/standard/image.o(.text+0x6b0): In function `php_handle_swc': /tmp/dres/php-4.3.7/ext/standard/image.c:212: undefined reference to `uncompress' ext/standard/image.o(.text+0x80b):/tmp/dres/php-4.3.7/ext/standard/image.c:230: undefined reference to `uncompress' main/output.o(.text+0xa72): In function `php_ob_init_named': /tmp/dres/php-4.3.7/main/output.c:428: undefined reference to `php_ob_gzhandler_check' collect2: ld returned 1 exit status make: *** [sapi/cgi/php] Error 1
--- End Message ---
--- Begin Message ---I ran the following: ./configure --with-mysql=/usr/local/mysql --with-apxs2=/usr/local/apache/bin/apxs ---> came back OK make -----> and got the following ..... olv -lm -ldl -lnsl -lcrypt -lcrypt -o libphp4.la ext/ctype/ctype.lo: file not recognized: File truncated collect2: ld returned 1 exit status make: *** [libphp4.la] Error 1 Any ideas?
--- End Message ---
--- Begin Message ---how can test if var $int is integer ?
--- End Message ---
--- Begin Message ---Vlad Georgescu wrote:
how can test if var $int is integer ?
In the manual:
http://www.php.net/is_int
Another one which might be helpful:
http://www.php.net/is_numeric
Hope this helps,
Torben
--- End Message ---
--- Begin Message ---Please just read the manual Function is_integer ... it seems ok ? cdt Pierre -----Message d'origine----- De : vlad georgescu [mailto:[EMAIL PROTECTED] Envoyé : mardi 29 juin 2004 22:13 À : php-general Objet : [PHP] test if $int is integer how can test if var $int is integer ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---> Vlad Georgescu wrote: > >> how can test if var $int is integer ? > > In the manual: > > http://www.php.net/is_int > > Another one which might be helpful: > > http://www.php.net/is_numeric > > > Hope this helps, > > Torben > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > I recently purchased George Schlossnagle's Advanced PHP Programming and on page 85 in the Error Handling chapter, he made a reference about the is_int function. In the above function example he had: if (!preg_match('/^\d+$/',$n) || $n < 0) {.... In which he mentions: It might be strange to choose to evaluate whether $n is an integer by using a regular expression instead of the is_int function. The is_int function, however, does not do what you want. It only evaluates whether $n has been typed as a string or as an integer, not whether the value of $n is an integer. Can anyone comment on this? --Matthew Sims --<http://killermookie.org>
--- End Message ---
--- Begin Message ---Yeah, 4 will pass the is_int() test, '4' won't. I prefere just to use if(ctype_digit($foo)){ ... } On Tue, 29 Jun 2004 15:12:22 -0700 (PDT), Matthew Sims <[EMAIL PROTECTED]> wrote: > I recently purchased George Schlossnagle's Advanced PHP Programming and on > page 85 in the Error Handling chapter, he made a reference about the > is_int function. > > In the above function example he had: > if (!preg_match('/^\d+$/',$n) || $n < 0) {.... > > In which he mentions: > It might be strange to choose to evaluate whether $n is an integer by > using a regular expression instead of the is_int function. The is_int > function, however, does not do what you want. It only evaluates whether $n > has been typed as a string or as an integer, not whether the value of $n > is an integer. > > Can anyone comment on this? > > --Matthew Sims > --<http://killermookie.org>
--- End Message ---