[PHP] Re: exclude_once(); ?
or if your PHP versions is prior to 4.3.0 use ini_set('include_path', '.:/path'): http://de3.php.net/manual/en/function.ini-set.php Yes that was my idea, too. Probably its best to kick there whole include-path and substitute it with my own. Lets hope it has nothing to do with the auto_append thing. I am just a little curious why they, by default, include old PEAR classes. Thats def a bad trap if you dont do a $ pear upgrade-all by cronjob. Thanks for your assistance, M -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP /\ UML
thanks. i just dislike the idea of usingdesktop apps bound to a single gui. why the hell we need this in times of java/awt/swing, .net, xul and other funky technologies? any more ideas? /m -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] no value for upload_tmp_dir
Sorry if this kind of an easy but can someone advise me on how to add a value for upload_tmp_dir? I have php4.3.4 installed on a w2k3 server running postnuke and mysql5. I notice in phpinfo.php that upload_tmp_dir says no value even though the directory is defined in the php.ini file. This is preventing me from adding images via the Gallery app so I'm wondering if anyone could advise on how to resolve this. Thanks
Re: [PHP] Remove cahracters in string
Mike Mapsnac wrote: I search on php.net and couldn't find the function. I need a function that will remove characters in the string until it reached the pattern and remove characters in the string after another pattern. The program reads huge file, and remove unnessary data. So I need to remove characters before and after the line. Wouldn't it be smarter to match the pattern into a new string and ignore the rest?? -- ---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] Re: readdir and opendir
Vincent Dupont wrote: Simple question : do readdir and opendir support opening HTTP urls ?? RTFM ! No it doesn't. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: readdir and opendir
Thank you greg. Do you know if they support remote drive from Windows, like \\servername\dir\. I'm having huge problems to list files and dirs on the remote server ( with opendir, readdir) while i can easily read or write a file on the same server using fread, fopen. From the bugs reports that I have seen so far, it seems to be a known problem (see http://forums.devshed.com/showthread.php?p=624872) I wonder how I could re write the opendir and readdir functions so as to implement the fopen wrappers. Any idea? vincent -Original Message- From: greg [mailto:[EMAIL PROTECTED] Sent: lundi 10 mai 2004 15:21 To: [EMAIL PROTECTED] Subject: [PHP] Re: readdir and opendir Vincent Dupont wrote: Simple question : do readdir and opendir support opening HTTP urls ?? RTFM ! No it doesn't. -- 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] thumbnail problems
Ninti Systems wrote: I've searched the archives on this and, while I have turned up some tips, they don't seem to solve my problem. I an building a website for an indigenous organisation where jpg images are uploaded, resized to a standard format, and thumbnails also generated at the same time (so that is two resizes for each image). Most of the time this works OK, but there are a lot of pages where many thumbnails are just blacked out, eg: http://waru.org/arakuwaritja.php?p=63 On some pages, all images are blacked out, eg: http://waru.org/arakuwaritja.php?p=36 whereas on others they're all OK, eg: http://waru.org/arakuwaritja.php?p=43 The people in the field taking and uploading the photos insist that the format, color depth, etc, is not changing from photo to photo, and I can't discern any differences. Yet some work, some don't. I read somewhere that memory limitations could cause this, but still, it only happens sometimes and not others. We are on a crowded shared server I think. I'm use ImageCreateTrueColor() after checking with ImageIsTrueColor(), otherwise just ImageCreate(). The initial resizes almost always work (down from 640x480 to 400x300), with the thumbnails it is looking like a 50% failure rate. Try to always use ImageCreateTrueColor() - even if the original has only 255 colors the thumbnails might have more. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] system command?
Anyone know what this wouldn't work? I have tried using a couple of functions defined at http://us2.php.net/manual/en/ref.exec.php and none seem to have the desired effect. ?php $tailed = shell_exec('tail -f /path/to/log'); //$tailed = exec('tail -f /path/to/log'); //$tailed = system('tail -f /path/to/log'); print = textarea$tailed/textarea; ? Thanks in advance, Jas -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] system command?
[snip] Anyone know what this wouldn't work? I have tried using a couple of functions defined at http://us2.php.net/manual/en/ref.exec.php and none seem to have the desired effect. ?php $tailed = shell_exec('tail -f /path/to/log'); //$tailed = exec('tail -f /path/to/log'); //$tailed = system('tail -f /path/to/log'); print = textarea$tailed/textarea; ? [/snip] Is PHP running in safe mode? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] system command?
I believe when you add the -f flag, the tail command doesn't exit, it just keeps printing as data is appended to the log, did you try dropping the -f flag? On Mon, 2004-05-10 at 10:15, Jas wrote: Anyone know what this wouldn't work? I have tried using a couple of functions defined at http://us2.php.net/manual/en/ref.exec.php and none seem to have the desired effect. ?php $tailed = shell_exec('tail -f /path/to/log'); //$tailed = exec('tail -f /path/to/log'); //$tailed = system('tail -f /path/to/log'); print = textarea$tailed/textarea; ? Thanks in advance, Jas -- Adam Voigt [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] system command?
[snip] Anyone know what this wouldn't work? I have tried using a couple of functions defined at http://us2.php.net/manual/en/ref.exec.php and none seem to have the desired effect. ?php $tailed = shell_exec('tail -f /path/to/log'); //$tailed = exec('tail -f /path/to/log'); //$tailed = system('tail -f /path/to/log'); print = textarea$tailed/textarea; ? [/snip] Take a look at your print statement, print = textarea$tailed/textarea; That should throw a parse error. Try print(textarea . $tailed . /textarea); HTH! -- 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] Upgrading SAPI from 4.2.2 to 4.3.6 on RH9 with Apache 2
Hi. I'm trying to upgrade a server (up2date RedHat9) - which is running Apache 2 (default!) and PHP 4.2.2 - to PHP 4.3.6. It is the SAPI version (running as an Apache module). I have downloaded the tar.gz, exploded that and run ./configure --disable-cgi --with-apxs2=/var/share/Apache/apxs.pl However it errors with apxs:Error: /home/httpd-win32-msi/apache-1.3.20/httpd not found or not executable So it seems I have completely the wrong version! I don't seem to be able to find apxs.pl for Apache 2 on linux (RH9). Could anyone point me in the right direction and possibly warn of me of the upcoming problems I am bound to face? :) Thanks. Tom -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] system command?
Jas wrote: Anyone know what this wouldn't work? I have tried using a couple of functions defined at http://us2.php.net/manual/en/ref.exec.php and none seem to have the desired effect. ?php $tailed = shell_exec('tail -f /path/to/log'); //$tailed = exec('tail -f /path/to/log'); //$tailed = system('tail -f /path/to/log'); print = textarea$tailed/textarea; ? Thanks in advance, Jas 'tail -f' won't exit. -- John C. Nichel KegWorks.com 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] system command?
[snip] It is now... but it still doesn't work. I have tried passthru(), exec(), shell_exec() system() trying to tail -f a log file into a textarea box and I get nothing or the output is put in the headers and stops the rest of the page from loading. I am at a loss. Jay Blanchard wrote: [snip] Anyone know what this wouldn't work? I have tried using a couple of functions defined at http://us2.php.net/manual/en/ref.exec.php and none seem to have the desired effect. ?php $tailed = shell_exec('tail -f /path/to/log'); //$tailed = exec('tail -f /path/to/log'); //$tailed = system('tail -f /path/to/log'); print = textarea$tailed/textarea; ? [/snip] Is PHP running in safe mode? [/snip] a. safe mode must be OFF b. you must remove the = from the print statement, should be thrwoing a syntax erro c. get rid of the -f as it will not continue to update the text area d. do not reply off-list unless requested -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: readdir and opendir
On 5/10/2004 3:21:14 PM, greg ([EMAIL PROTECTED]) wrote: Vincent Dupont wrote: Simple question : do readdir and opendir support opening HTTP urls ?? RTFM ! No it doesn't. DUDE! Anger management!!! ;-p Cheers, -Ryan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] system command?
I didn't sent off list, always to php.general in reply to whatever message thread I am in. In any event, I have tried safe mode = On and safe mode = Off with the 4 commands I listed in my last thread and my actual code is using an echo = textarea$tailed/textarea; I even tried to remove the -f and replaced it with a -n 600 (for six hundred lines to be output) and it still wont place the $tailed var into the textarea. It will output to the screen but not to the textarea, I am just going to scrap it and try it a different way. Cheers, Jas Jay Blanchard wrote: [snip] It is now... but it still doesn't work. I have tried passthru(), exec(), shell_exec() system() trying to tail -f a log file into a textarea box and I get nothing or the output is put in the headers and stops the rest of the page from loading. I am at a loss. Jay Blanchard wrote: [snip] Anyone know what this wouldn't work? I have tried using a couple of functions defined at http://us2.php.net/manual/en/ref.exec.php and none seem to have the desired effect. ?php $tailed = shell_exec('tail -f /path/to/log'); //$tailed = exec('tail -f /path/to/log'); //$tailed = system('tail -f /path/to/log'); print = textarea$tailed/textarea; ? [/snip] Is PHP running in safe mode? [/snip] a. safe mode must be OFF b. you must remove the = from the print statement, should be thrwoing a syntax erro c. get rid of the -f as it will not continue to update the text area d. do not reply off-list unless requested -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] system command?
[snip] I didn't sent off list, always to php.general in reply to whatever message thread I am in. In any event, I have tried safe mode = On and safe mode = Off with the 4 commands I listed in my last thread and my actual code is using an echo = textarea$tailed/textarea; ?php $tailed = shell_exec('tail -f /path/to/log'); //$tailed = exec('tail -f /path/to/log'); //$tailed = system('tail -f /path/to/log'); print = textarea$tailed/textarea; ? [/snip] ?php $tailed = shell_exec('tail /path/to/log'); print = textarea$tailed/textarea; ? I can only think that it must be a permissions issue. What happens if you run the script from the command line? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: Problems with very special characters
Hi, Thanks for your suggestion. The problem appeared to be in the AddDefaultCharSet directive. It was set to UTF-8, and for the characters to be displayed it should've been set to iso-8859-1. Wouter (wonder why redhat uses UTF-8 encoding, if it causes this many problems ... ) -Original Message- From: Aidan Lister [mailto:[EMAIL PROTECTED] Sent: Sunday, May 09, 2004 04:08 To: [EMAIL PROTECTED] Subject: [PHP] Re: Problems with very special characters Hi, Make sure the charset of your document matches the charset sent by the server - If you tell the browser the charset is A, and use characters from charset B, you will get the problem observed. The charset can be sent from Apache, PHP and the actual charset is set in the document. It's a pain in the arse to fix, I've had the same problem, it took a lot of experimenting Good luck, Wouter Van Vliet [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hello everybody, I'm back! (been a subscriber here before, a while ago .. was quite an active one at that time .. ;)) .. and I'm back for a reason, having a very wicked problem. The setup is one RedHat linux 9 machine (called s007), previously in use as both our web and database server. As traffic increased dramatically earlier this week, we had to grab another server, running RedHat Fedora. We'll call her s006, and use to serve the webpages. All happened very quickly and smooth for most of it. Only currently still existing problem has (appearantly) to do with transferring the very special characters over the lines between s007 and s006, displaying them on the screen and entering them in the database through webforms. Normal special chars like é, ê, à and so on seem to be displayed ok (after calling htmlentities in php: PHP 4.3.3 (cgi) (built: Oct 21 2003 09:51:55) on s006 and PHP 4.3.4 (cli) (built: Jan 24 2004 22:34:14) on s007), but the more exotic ones (~ and ^ signs on and under Z, S .. and stuff like that) still cause problems on the s006. Same script, requesting data from the same rows of the same database on the s007 works as it is supposed to. MySQL version of both servers is mysql Ver 11.18 Distrib 3.23.58, for redhat-linux-gnu (i386), for both machines, /etc/sysconfig/i18n looks like: 1 LANG=en_US 2 SUPPORTED=nl_NL:nl_NL:nl:en_US:en 3 SYSFONT=lat0-sun16 4 SYSFONTACM=iso15 (numbers are line numbers). To compare the pages: http://esctoday.s007.interlize.net/annual/2004/participants.php http://esctoday.s006.interlize.net/annual/2004/participants.php http://esctoday.s006.interlize.net/annual/2004/participants.php I'm stuck here with my hands in my hair, and would very much appriciate any clue to a solution, Wouter van Vliet (ps. since I'm not sure of the solution will be found in php, mysql or any other place I have posted this message also to the mysql-general list) -- 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: Active PHP Sessions
I'm not sure if this is the right place to post this (if not, I would appreciate being directed to the correct place). I looked into adodb and got it running. However, it mentions the ability to execute a function when a session expires. I would like to know where I write this function. Thanks! From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Subject: Re: [PHP] Re: Active PHP Sessions Date: Fri, 7 May 2004 12:17:32 -0400 adodb also handles sessions in a database http://phplens.com/lens/adodb/docs-session.htm - Original Message - From: Paul Higgins [EMAIL PROTECTED] To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Friday, May 07, 2004 9:40 AM Subject: RE: [PHP] Re: Active PHP Sessions I've read stuff like that also. However, if I choose to do this, I must write all the session handling myself, correct? Are there any scripts already out there that do this? Thanks From: Torsten Roehr [EMAIL PROTECTED] To: [EMAIL PROTECTED] Subject: [PHP] Re: Active PHP Sessions Date: Fri, 7 May 2004 15:30:29 +0200 Paul Higgins [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hi all, I'm on a shared server, and I do not believe that I have access to the /tmp directory where the session files are stored (I believe that is how it works :). I want to keep track of which sessions are active. Basically, I just want a list of the active sessions for my site. How can I do this? If you use a database as container for your session data you could easily do a SELECT COUNT(*) FROM sessions to get the number of the sessions. Using a DB as session container is also more secure on a shared server (at least that's what I often read about session security). Regards, Torsten Thanks! _ Watch LIVE baseball games on your computer with MLB.TV, included with MSN Premium! http://join.msn.com/?page=features/mlbpgmarket=en-us/go/onm00200439ave/dir e ct/01/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php _ FREE pop-up blocking with the new MSN Toolbar - get it now! http://toolbar.msn.com/go/onm00200415ave/direct/01/ -- 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 _ Mothers Day is May 9. Make it special with great ideas from the Mothers Day Guide! http://special.msn.com/network/04mothersday.armx -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] system command?
[snip] I didn't sent off list [/snip] I am in an relatively crappy mood this day, you may want to NOT refute something I have said and in essence call me a liar. You'll get little help that way. P.S. Stop top posting too. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] system command?
lol On Mon, 2004-05-10 at 11:16, Jay Blanchard wrote: [snip] I didn't sent off list [/snip] I am in an relatively crappy mood this day, you may want to NOT refute something I have said and in essence call me a liar. You'll get little help that way. P.S. Stop top posting too. -- Adam Voigt [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] system command?
[snip] ?php $tailed = shell_exec('tail /path/to/log'); print = textarea$tailed/textarea; ? [/snip] I forgot to take out the = ?php $tailed = shell_exec('tail /path/to/log'); print = textarea$tailed/textarea; ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Save page
Hello I' m writing php script that will request page and save it locally. The page URL will be parameter (example: http://www.pagetoget.com/thispage.html). How php can request such page and save it locally on the file? Thanks _ Stop worrying about overloading your inbox - get MSN Hotmail Extra Storage! http://join.msn.com/?pgmarket=en-uspage=hotmail/es2ST=1/go/onm00200362ave/direct/01/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Save page
I think you have to write apache rules to handle the request (search for ReWriteRule) and an index.php can save the file regards Mike Mapsnac wrote: Hello I' m writing php script that will request page and save it locally. The page URL will be parameter (example: http://www.pagetoget.com/thispage.html). How php can request such page and save it locally on the file? Thanks _ Stop worrying about overloading your inbox - get MSN Hotmail Extra Storage! http://join.msn.com/?pgmarket=en-uspage=hotmail/es2ST=1/go/onm00200362ave/direct/01/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Save page
try something like $handle = fopen (http://www.pagetoget.com/thispage.html;, rb); $contents = ; do { $data = fread($handle, 1024); if (strlen($data) == 0) { break; } $contents .= $data; } while(true); fclose ($handle); then you have all text from the .html page in $contents and you can do a fwrite on it to a local file, echo it, str_rep etc etc etc Brandon Holtsclaw [EMAIL PROTECTED] - Original Message - From: Mike Mapsnac [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Monday, May 10, 2004 10:37 AM Subject: [PHP] Save page Hello I' m writing php script that will request page and save it locally. The page URL will be parameter (example: http://www.pagetoget.com/thispage.html). How php can request such page and save it locally on the file? Thanks _ Stop worrying about overloading your inbox - get MSN Hotmail Extra Storage! http://join.msn.com/?pgmarket=en-uspage=hotmail/es2ST=1/go/onm00200362ave/direct/01/ -- 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 /\ UML
Try Umbrello http://www.blinkenlights.de/arcade/index.en.html /Martin Eriksen Matthias H. Risse wrote: Hi, I wonder if anyone here is aware of UML Tools for PHP? I know of ArgoUML whichs PHP-codegenerator seems to be very beta. Maybe there are or are planned and well intergrated plugins for Zend Studio, PHPEd, TruStudio/Eclipse or alike? Basically I would be interrested in a solution that really makes it possible to use UML in the design and implementation process and which works both ways (code-uml, uml-code).. I hope this is not offtopic for this list, but I couldnt find any public OO-related one. Yours, Matthias -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP /\ UML
This time with the correct URL http://uml.sourceforge.net /Martin Eriksen Martin Hjort Eriksen wrote: Try Umbrello http://www.blinkenlights.de/arcade/index.en.html /Martin Eriksen Matthias H. Risse wrote: -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Save page
* Thus wrote Mike Mapsnac ([EMAIL PROTECTED]): Hello I' m writing php script that will request page and save it locally. The page URL will be parameter (example: http://www.pagetoget.com/thispage.html). How php can request such page and save it locally on the file? $ch = curl_init(); curl_setopt($ch, CURLOPT_FILE, '/path/to/output'); curl_setopt($ch, CURLOPT_URL, http://www.pagetoget.com/thispage.html;); curl_setopt($ch, CURLOPT_HEADER, 0); curl_exec($ch); curl_close($ch); Curt -- I used to think I was indecisive, but now I'm not so sure. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Save page
* Thus wrote Curt Zirzow ([EMAIL PROTECTED]): * Thus wrote Mike Mapsnac ([EMAIL PROTECTED]): Hello I' m writing php script that will request page and save it locally. The page URL will be parameter (example: http://www.pagetoget.com/thispage.html). How php can request such page and save it locally on the file? $ch = curl_init(); curl_setopt($ch, CURLOPT_FILE, '/path/to/output'); sorry that should be: $fp = fopen('/path/to/output', 'w'); curl_setopt($ch, CURLOPT_FILE, $fp ); Curt -- I used to think I was indecisive, but now I'm not so sure. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] LOBs
sorry, the specifications are php 4.3.6RC1 as a CGI on apache 1.3 using oci functions and connecting to an 8.1.7.4.1 oracle database Thanks -Original Message- From: Fidencio Monroy [mailto:[EMAIL PROTECTED] Sent: Monday, May 10, 2004 12:29 AM To: (PHP General List) Subject: [PHP] LOBs Hi, in the documentation there are several examples about updating LOB columns, but i have not found some example retrieving and working with this kind of data. I will be thankful if you can send an example to me how to do it; by example to write this data to a file. Thanks in advance. Fidencio Monroy. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] rounding average to one decimal point
Hi, I have a randon group of numbers I need the average of. When I add them up and divide by how many there are and print the result, I get a lot of decimal places. The number comes out to look like 29.3529411765, but I don't need that many decimal places. rounding to one decimal place will be fine. anyway to trim off the excess decimal values? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] rounding average to one decimal point
Hello Adam, Monday, May 10, 2004, 7:03:36 PM, you wrote: AW Hi, I have a randon group of numbers I need the average of. When I add AW them up and divide by how many there are and print the result, I get a AW lot of decimal places. The number comes out to look like 29.3529411765, AW but I don't need that many decimal places. rounding to one decimal place AW will be fine. anyway to trim off the excess decimal values? Try the round() function? :) ceil() and floor() might help if you decide you don't want the extra decimal places too. -- Best regards, Richard Davey http://www.phpcommunity.org/wiki/296.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] rounding average to one decimal point
How about round() echo round(1.95583, 2); // 1.96 echo round(1241757, -3); // 1242000 http://www.phpbuilder.com/manual/function.round.php Hi, I have a randon group of numbers I need the average of. When I add them up and divide by how many there are and print the result, I get a lot of decimal places. The number comes out to look like 29.3529411765, but I don't need that many decimal places. rounding to one decimal place will be fine. anyway to trim off the excess decimal values? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] rounding average to one decimal point
On Mon, 10 May 2004, Richard Davey wrote: Hello Adam, Monday, May 10, 2004, 7:03:36 PM, you wrote: AW Hi, I have a randon group of numbers I need the average of. When I add AW them up and divide by how many there are and print the result, I get a AW lot of decimal places. The number comes out to look like 29.3529411765, AW but I don't need that many decimal places. rounding to one decimal place AW will be fine. anyway to trim off the excess decimal values? Try the round() function? :) ceil() and floor() might help if you decide you don't want the extra decimal places too. i didn't know about round(), guess i should check php.net/round next time ;) thanks! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Accessing the values of objects
Hi, OOP is not my strong suit, and I'm trying to work with someone else's code, but am having trouble accessing a value. Let's say I have an object called $bob, and doing a print_r on $bob produces this Array ( [one] = this [two] = that [three] = Array ( [alpha] = something ) [_four] = Array ( [beta] = another [gamma] = Array ( [word] = up ) ) ) Now, I want to retrive the value of $bob-_four-gamma-word, but how? I've tried $bob-_four-gamma-word, $bob-_four['gamma']['word'], etc. I've also tried get_object_vars(), but for some reason 'word' isn't in the resulting array. Anyone? TIA -- John C. Nichel KegWorks.com 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Accessing the values of objects
John Nichel wrote: OOP is not my strong suit, and I'm trying to work with someone else's code, but am having trouble accessing a value. Let's say I have an object called $bob, and doing a print_r on $bob produces this Array ( Are you sure $bob is an object? It says above that it's an array. If $bob were an object, print_r() should give objectname Object instead of Array. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Accessing the values of objects
Hello John, Monday, May 10, 2004, 7:18:04 PM, you wrote: JNOOP is not my strong suit, and I'm trying to work with someone else's JN code, but am having trouble accessing a value. Let's say I have an JN object called $bob, and doing a print_r on $bob produces this JN Array [snip] That isn't an Object :) Maybe the object function you called returned an array? You'd treat the data you posted as a normal array. -- Best regards, Richard Davey http://www.phpcommunity.org/wiki/296.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Accessing the values of objects
Michael Sims wrote: John Nichel wrote: OOP is not my strong suit, and I'm trying to work with someone else's code, but am having trouble accessing a value. Let's say I have an object called $bob, and doing a print_r on $bob produces this Array ( Are you sure $bob is an object? It says above that it's an array. If $bob were an object, print_r() should give objectname Object instead of Array. Nah, that's just my bad typing without thinking. When I print_r($bob), it does start bob Object ( blah . -- John C. Nichel KegWorks.com 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] How to find path for PHP script
Does anyone know a quick way to find the full path on a shared hosting plan to use in an include file? Thanks, Tom
Re: [PHP] How to find path for PHP script
Hello Tom, Monday, May 10, 2004, 7:32:16 PM, you wrote: TC Does anyone know a quick way to find the full path on a shared hosting plan TC to use in an include file? Take a peek at this (upload to your host first of course!) ?php echo phpinfo(); ? It'll tell you exactly what you need to know (i.e. which $_SERVER variable it's hiding under) plus a whole load more you might find useful. -- Best regards, Richard Davey http://www.phpcommunity.org/wiki/296.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How to find path for PHP script
What about: $_SERER['PATH_TRANSLATED'] http://www.phpbuilder.com/manual/reserved.variables.php#reserved.variables.server Does anyone know a quick way to find the full path on a shared hosting plan to use in an include file? Thanks, Tom -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How to find path for PHP script
oops. $_SERVER[] What about: $_SERER['PATH_TRANSLATED'] http://www.phpbuilder.com/manual/reserved.variables.php#reserved.variables.server -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How to find path for PHP script
From: Daniel Clark [EMAIL PROTECTED] Does anyone know a quick way to find the full path on a shared hosting plan to use in an include file? What about: $_SERER['PATH_TRANSLATED'] If you note my message from yesterday, I was having some trouble with this variable on certain configurations. You may want to use $_SERVER['SCRIPT_FILENAME'] which will have the same value and seems to be present in more cases (or just test for both). ---John Holmes... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] To pack(), or not to pack()
Hi, I'm developing a PHP program that must send data, over a socket connection, to a server. The server requires the data in a particular format, e.g.: FORMAT: 3-byte delimiter - Message Length (N = 4 bytes) - Message Type (4 bytes) - Message Body (N - 4 bytes) - 3-byte Delimiter SAMPLE MESSAGE: STX00110018Hello WorldENX The sparse documentation *seems* to indicate that the message data must be in binary format. The reason I say seems is that the docs say the data must be in a particular byte order (bigendian, I think, 'cause the server is running on SuperSPARC). It also talks about default integer size of 32 bits, unsigned char, blah, blah, blahstuff I normally never worry about with PHP. All the sample code is in C, which I don't know. I'm a one-trick (PHP) pony. Now, as I understand it, socket_write($socket, $data) by default will send $data in ASCII formatright? But if I must send this message in binary, then would I use pack() to convert the ASCII to binary? ..Rene -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Check for parse errors right after edit
Hi- what's the best way to automatically check for parse errors after editing a php script with vi or vim? I suppose that php -l name_of_script can be ran after exiting, but I wouldn't want that command to be ran after running vim everytime. Or maybe there's a plugin for vim that will do this? Thanks for any input. David -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How to find path for PHP script
Thanks John. From: Daniel Clark [EMAIL PROTECTED] Does anyone know a quick way to find the full path on a shared hosting plan to use in an include file? What about: $_SERER['PATH_TRANSLATED'] If you note my message from yesterday, I was having some trouble with this variable on certain configurations. You may want to use $_SERVER['SCRIPT_FILENAME'] which will have the same value and seems to be present in more cases (or just test for both). ---John Holmes... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] 0 == null ?
Hi, Does 0(zero) really equate to null? if( 0 == null ) { echo 'true'; } else echo 'false'; Result echo's: true This can not be right, can it? I have never heard of such a thing. As far as I recall from any language null is of no value equaling nothing? So how can it equal 0? Any help or explanation would be greatly appreciated. Regards, Justin Palmer -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] 0 == null ?
On Mon, 2004-05-10 at 15:17, Justin Palmer wrote: Hi, Does 0(zero) really equate to null? if( 0 == null ) { echo 'true'; } else echo 'false'; Result echo's: true This can not be right, can it? I have never heard of such a thing. As far as I recall from any language null is of no value equaling nothing? So how can it equal 0? Any help or explanation would be greatly appreciated. In C the NULL macro is equal to 0. In PHP null is equivalent to 0. The test will fail if you use === instead. Cheers, Rob. -- .. | InterJinn Application Framework - http://www.interjinn.com | :: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] unsigned long int
I don't know C, but I was wondering if it is possible to: 1. Define 32-bit integer in PHP, called $val (max value of $val); 2. Assign the value of 10 to $val. 3. Pack $val to a binary variable ($bin_var); ...such that $val is only equal to 10, but it is occupying 32-bits of data... (In case you were wondering, am I quite lost, yes, I am.) ...Rene -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Accessing the values of objects
John Nichel wrote: Michael Sims wrote: John Nichel wrote: Are you sure $bob is an object? It says above that it's an array. If $bob were an object, print_r() should give objectname Object instead of Array. Nah, that's just my bad typing without thinking. When I print_r($bob), it does start bob Object Well, in that case let me address your original post: John Nichel wrote: Now, I want to retrive the value of $bob-_four-gamma-word, but how? I've tried $bob-_four-gamma-word, $bob-_four['gamma']['word'], That last one ($bob-_four['gamma']['word']) should work. It does here. This test script: ---begin quote--- class bob { var $one; var $two; var $three; var $_four; function bob() { $this-one = 'this'; $this-two = 'that'; $this-three = array('alpha' = 'something'); $this-_four = array( 'beta' = 'another', 'gamma' = array('word' = 'up') ); } } $bob = new bob; print_r($bob); print $bob-_four['gamma']['word'].\n; end quote prints: ---begin quote--- bob Object ( [one] = this [two] = that [three] = Array ( [alpha] = something ) [_four] = Array ( [beta] = another [gamma] = Array ( [word] = up ) ) ) up end quote Do you get different results? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] 0 == null ?
Does 0(zero) really equate to null? if( 0 == null ) { echo 'true'; } else echo 'false'; Result echo's: true This can not be right, can it? I have never heard of such a thing. As far as I recall from any language null is of no value equaling nothing? So how can it equal 0? You can use is_null instead. If(is_null($var)){ do something } Else{ do something different } alex hogan ** The contents of this e-mail and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom it is addressed. The views stated herein do not necessarily represent the view of the company. If you are not the intended recipient of this e-mail you may not copy, forward, disclose, or otherwise use it or any part of it in any form whatsoever. If you have received this e-mail in error please e-mail the sender. **
RE: [PHP] 0 == null ?
Hi Robert, Thanks. Regards, Justin Palmer -Original Message- From: Robert Cummings [mailto:[EMAIL PROTECTED] Sent: Monday, May 10, 2004 12:22 PM To: [EMAIL PROTECTED] Cc: PHP-General Subject: Re: [PHP] 0 == null ? On Mon, 2004-05-10 at 15:17, Justin Palmer wrote: Hi, Does 0(zero) really equate to null? if( 0 == null ) { echo 'true'; } else echo 'false'; Result echo's: true This can not be right, can it? I have never heard of such a thing. As far as I recall from any language null is of no value equaling nothing? So how can it equal 0? Any help or explanation would be greatly appreciated. In C the NULL macro is equal to 0. In PHP null is equivalent to 0. The test will fail if you use === instead. Cheers, Rob. -- .. | InterJinn Application Framework - http://www.interjinn.com | :: | An application and templating framework for PHP. Boasting | a | powerful, scalable system for accessing system services | such as | forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `' -- 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] PHP 5 Documentation
Does PHP 5 documentation exist? I have not found it in php.net. can someone send link please? Tnx
[PHP] Re: PHP 5 Documentation
Fidencio Monroy wrote: Does PHP 5 documentation exist? I have not found it in php.net. can someone send link please? Tnx There is only one documentation with version numbers for each function. http://www.php.net/docs.php Rainer -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] To pack(), or not to pack()
* Thus wrote Ren Fournier ([EMAIL PROTECTED]): Hi, I'm developing a PHP program that must send data, over a socket connection, to a server. The server requires the data in a particular format, e.g.: FORMAT: 3-byte delimiter - Message Length (N = 4 bytes) - Message Type (4 bytes) - Message Body (N - 4 bytes) - 3-byte Delimiter SAMPLE MESSAGE: STX00110018Hello WorldENX From the looks of this you wont need to use pack(). Curt -- I used to think I was indecisive, but now I'm not so sure. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Check for parse errors right after edit
* Thus wrote David Yee ([EMAIL PROTECTED]): Hi- what's the best way to automatically check for parse errors after editing a php script with vi or vim? I suppose that php -l name_of_script can be ran after exiting, but I wouldn't want that command to be ran after running vim everytime. Or maybe there's a plugin for vim that will do this? Thanks for any input. I usually define a map like: map ;s :!php -l -d display_errors=1 %CR Then if I type ';s' it takes the file loaded in vim and runs it through php. Curt -- I used to think I was indecisive, but now I'm not so sure. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] thumbnails of images
is there any code or function out there that gives you a thumbnail of an image in the size and compression means you specify?? ive been looking, but found nothing, youd think thered be a function -- ** Free Nokia Ringtones US http://www.ring-tones.us ** -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Accessing the values of objects
Michael Sims wrote: John Nichel wrote: Michael Sims wrote: John Nichel wrote: Are you sure $bob is an object? It says above that it's an array. If $bob were an object, print_r() should give objectname Object instead of Array. Nah, that's just my bad typing without thinking. When I print_r($bob), it does start bob Object Well, in that case let me address your original post: John Nichel wrote: Now, I want to retrive the value of $bob-_four-gamma-word, but how? I've tried $bob-_four-gamma-word, $bob-_four['gamma']['word'], That last one ($bob-_four['gamma']['word']) should work. It does here. This test script: ---begin quote--- class bob { var $one; var $two; var $three; var $_four; function bob() { $this-one = 'this'; $this-two = 'that'; $this-three = array('alpha' = 'something'); $this-_four = array( 'beta' = 'another', 'gamma' = array('word' = 'up') ); } } $bob = new bob; print_r($bob); print $bob-_four['gamma']['word'].\n; end quote prints: ---begin quote--- bob Object ( [one] = this [two] = that [three] = Array ( [alpha] = something ) [_four] = Array ( [beta] = another [gamma] = Array ( [word] = up ) ) ) up end quote Do you get different results? Yeah, I get an empty value for the object I'm working with (quite a bit bigger than the example I posted) when I try to retrive the individual value, but the print_r of the object shows that it has value. I thought my syntax was wrong, but I guess I have to keep digging to find out where the 'trouble' is. Thanks for the help. Aaargh, I hate going behind other people. :-( -- John C. Nichel KegWorks.com 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP 5 Documentation
Fidencio Monroy wrote: Does PHP 5 documentation exist? I have not found it in php.net. can someone send link please? Tnx http://www.zend.com/php5/zend-engine2.php /Martin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP 5 Documentation
* Thus wrote Fidencio Monroy ([EMAIL PROTECTED]): Does PHP 5 documentation exist? I have not found it in php.net. There isn't any php5 documentation that is seperated from php4. There is a possibility that this will happen in the future. To see a some information about whats different about php5: http://php.net/manual/en/migration5.php Curt -- I used to think I was indecisive, but now I'm not so sure. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP graphing tool?
Is there a PHP tool or module out there that would be good for creating line or bar graphs? I'm looking for something I can pass numbers to and it will just graph those numbers. Any recommendations? Thanks! Amanda -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] SOLVED Re: [PHP] using cookies
Hi, all -- ...and then David T-G said... % % I guess I need a primer on cookie usage. I've read the manual regarding [snip] All has become clear, or at least only murky :-) I was having trouble wrapping my head around how to start cookies (a la sessions) and then check to see if I had a cookie on the browser machine to log in a user automatically, since setcookie() looked to be the only way to do anything and that wipes anything that may be there. Richard was kind enough to clarify that the browser will automatically send the cookie, even without asking, the next time the visitor comes to the site, so I can immediately check $_COOKIE['mycookie'] without having to call setcookie() to instantiate things. Now to put it all into practice, but I see my cookie in the browser cache file and it gets setn back to me when I return. Yay! :-) HTH Thanks again HAND :-D -- David T-G [EMAIL PROTECTED] http://justpickone.org/davidtg/ Shpx gur Pbzzhavpngvbaf Qrprapl Npg! pgp0.pgp Description: PGP signature
Re: [PHP] PHP graphing tool?
http://www.aditus.nu/jpgraph/ On Mon, 2004-05-10 at 16:10, Amanda Hemmerich wrote: Is there a PHP tool or module out there that would be good for creating line or bar graphs? I'm looking for something I can pass numbers to and it will just graph those numbers. Any recommendations? Thanks! Amanda -- Adam Voigt [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP graphing tool?
Also, the cheaper, the better, and free is best! Thanks again. On Mon, 10 May 2004, Adam Voigt wrote: http://www.aditus.nu/jpgraph/ On Mon, 2004-05-10 at 16:10, Amanda Hemmerich wrote: Is there a PHP tool or module out there that would be good for creating line or bar graphs? I'm looking for something I can pass numbers to and it will just graph those numbers. Any recommendations? Thanks! Amanda -- Adam Voigt [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: thumbnails of images
John [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] is there any code or function out there that gives you a thumbnail of an image in the size and compression means you specify?? ive been looking, but found nothing, youd think thered be a function -- ** Free Nokia Ringtones US http://www.ring-tones.us ** I have got a function that is capable of doing this, but as it is a bit longer I don't want to post it. If you are interested I could send it to you. Regards, Torsten -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Accessing the values of objects
From: John Nichel [EMAIL PROTECTED] Yeah, I get an empty value for the object I'm working with (quite a bit bigger than the example I posted) when I try to retrive the individual value, but the print_r of the object shows that it has value. I thought my syntax was wrong, but I guess I have to keep digging to find out where the 'trouble' is. Thanks for the help. Try going step by step. You know the results of print_r($bob), now print_r($bob-_four) and examine the results. Then print_r($bob-_four['gamma']), etc... may help you track down where something is going wrong... ---John Holmes... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP graphing tool?
Amanda Hemmerich [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Also, the cheaper, the better, and free is best! Older versions are available for free but may not be used commercially: http://www.aditus.nu/jpgraph/jpdownload.php Regards, Torsten Thanks again. On Mon, 10 May 2004, Adam Voigt wrote: http://www.aditus.nu/jpgraph/ On Mon, 2004-05-10 at 16:10, Amanda Hemmerich wrote: Is there a PHP tool or module out there that would be good for creating line or bar graphs? I'm looking for something I can pass numbers to and it will just graph those numbers. Any recommendations? Thanks! Amanda -- Adam Voigt [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: thumbnails of images
won't the gd library do this? http://www.php.net/manual/en/function.exif-thumbnail.php if there is a better function..I am interested in it also as I have to do this something this week for a project. Thanks, Eddie -Original Message- From: Torsten Roehr [mailto:[EMAIL PROTECTED] Sent: Monday, May 10, 2004 4:21 PM To: [EMAIL PROTECTED] Subject: [PHP] Re: thumbnails of images John [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] is there any code or function out there that gives you a thumbnail of an image in the size and compression means you specify?? ive been looking, but found nothing, youd think thered be a function -- ** Free Nokia Ringtones US http://www.ring-tones.us ** I have got a function that is capable of doing this, but as it is a bit longer I don't want to post it. If you are interested I could send it to you. Regards, Torsten -- 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: thumbnails of images
Edward Peloke [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] won't the gd library do this? http://www.php.net/manual/en/function.exif-thumbnail.php if there is a better function..I am interested in it also as I have to do this something this week for a project. Thanks, Eddie This is what I'm using (of course the GD library is required). Hope the comments make everything clear. I have only used it with JPEGs, though: /** * Creates and saves a thumbnail of the supplied image * * @param string $fileName source file name * @param string $sourceDir source directory * @param string $targetDir target directory * @param string $fileNameExtension file name extension (e.g.: image.jpeg - image_thumb.jpg) * @param integer $dimension target image * @param string $dimensionType ('height', 'width', 'min') */ function createImageThumbnail($fileName, $sourceDir, $targetDir, $fileNameExtension, $dimension = 60, $dimensionType = 'width') { // Set file name, file, extension and target file name $file= $sourceDir . $fileName; $pointPos= strrpos($fileName, '.'); $extOrig = substr($fileName, $pointPos + 1); $ext = strtolower($extOrig); $targetFileName = substr($fileName, 0, strlen($fileName) - strlen($ext) - 1) . $fileNameExtension; // Create new temp image in memory depending on image type // JPEG if($ext == 'jpg' || $ext == 'jpeg') { $img = imagecreatefromjpeg($file); } // GIF elseif($ext == 'gif') { $img = imagecreatefromgif($file); } // PNG elseif($ext == 'png') { $img = imagecreatefrompng($file); } // None of the above, return false else{ return false; } // Get source dimensions $sourceWidth = imagesx($img); $sourceHeight = imagesy($img); // Determine smaller side if dimension type is 'min' if ($dimensionType == 'min') { // if width is smaller than height if ($sourceWidth $sourceHeight) { $dimensionType = 'width'; } else{ $dimensionType = 'height'; } } // Calculate dimension if ($dimensionType == 'width') { // Calculate target height relative to supplied target width // (Resize bigger so that dirty right hand pixels will be outside of new image) $targetWidth = $dimension; $targetHeight = round(($targetWidth / $sourceWidth) * $sourceHeight, 0); } else{ // Calculate target width relative to supplied target height // (Resize bigger so that dirty right hand pixels will be outside of new image) $targetHeight = $dimension; $targetWidth = round(($targetHeight / $sourceHeight) * $sourceWidth, 0); } // set oversize $overSizePercentage = 1; $overSizePixelsWidth = round($targetWidth * ($overSizePercentage / 100), 0); $overSizePixelsHeight = round($targetHeight * ($overSizePercentage / 100), 0); // Create new-sized target image in memory // (Height should be smaller so that dirty bottom end pixels will be outside) $new_img = imagecreatetruecolor($targetWidth, $targetHeight); if (!$new_img) { // Create new-sized target image in memory // (Height should be smaller so that dirty bottom end pixels will be outside) $new_img = imagecreate($targetWidth, $targetHeight); imagecopyresized($new_img, $img, 0, 0, 0, 0, $targetWidth + $overSizePixelsWidth, $targetHeight + $overSizePixelsHeight, $sourceWidth, $sourceHeight); } else{ imagecopyresampled($new_img, $img, 0, 0, 0, 0, $targetWidth + $overSizePixelsWidth, $targetHeight + $overSizePixelsHeight, $sourceWidth, $sourceHeight); } // Save target image depending on image type // JPEG if ($ext == 'jpg' || $ext == 'jpeg') { imagejpeg($new_img, $targetDir . $targetFileName . '.' . $extOrig); } // GIF elseif ($ext == 'gif') { imagegif($new_img, $targetDir . $targetFileName . '.' .
Re: [PHP] unsigned long int
René Fournier wrote: I don't know C, but I was wondering if it is possible to: 1. Define 32-bit integer in PHP, called $val (max value of $val); 2. Assign the value of 10 to $val. 3. Pack $val to a binary variable ($bin_var); ...such that $val is only equal to 10, but it is occupying 32-bits of data... (In case you were wondering, am I quite lost, yes, I am.) ...Rene http://www.php.net/pack $val = 10; $bin_var = pack('i', $val); -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Remove cahracters in string
I search on php.net and couldn't find the function. I need a function that will remove characters in the string until it reached the pattern and remove characters in the string after another pattern. The program reads huge file, and remove unnessary data. So I need to remove characters before and after the line. FedoraPHPLINUXOct72004 _ Is your PC infected? Get a FREE online computer virus scan from McAfee® Security. http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Remove cahracters in string
Mike Mapsnac [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] I search on php.net and couldn't find the function. I need a function that will remove characters in the string until it reached the pattern and remove characters in the string after another pattern. The program reads huge file, and remove unnessary data. So I need to remove characters before and after the line. Could you post an example to make absolutely clear what you have and what you want? Thanks. Torsten FedoraPHPLINUXOct72004 _ Is your PC infected? Get a FREE online computer virus scan from McAfee® Security. http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: Remove cahracters in string
Below is string let's name it A. ttPhiladelphiaFirstadate05Oct2004tt I want to get string B. That looks like PhiladelphiaFirstadate05Oct2004 No characters before Philadelphia and after 20004 From: Torsten Roehr [EMAIL PROTECTED] To: [EMAIL PROTECTED] Subject: [PHP] Re: Remove cahracters in string Date: Mon, 10 May 2004 22:37:36 +0200 Mike Mapsnac [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] I search on php.net and couldn't find the function. I need a function that will remove characters in the string until it reached the pattern and remove characters in the string after another pattern. The program reads huge file, and remove unnessary data. So I need to remove characters before and after the line. Could you post an example to make absolutely clear what you have and what you want? Thanks. Torsten FedoraPHPLINUXOct72004 _ Is your PC infected? Get a FREE online computer virus scan from McAfee® Security. http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php _ FREE pop-up blocking with the new MSN Toolbar get it now! http://toolbar.msn.com/go/onm00200415ave/direct/01/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Remove cahracters in string
Mike Mapsnac [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Below is string let's name it A. ttPhiladelphiaFirstadate05Oct2004tt I want to get string B. That looks like PhiladelphiaFirstadate05Oct2004 No characters before Philadelphia and after 20004 Is the character you want to remove ('t') always the same? Torsten From: Torsten Roehr [EMAIL PROTECTED] To: [EMAIL PROTECTED] Subject: [PHP] Re: Remove cahracters in string Date: Mon, 10 May 2004 22:37:36 +0200 Mike Mapsnac [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] I search on php.net and couldn't find the function. I need a function that will remove characters in the string until it reached the pattern and remove characters in the string after another pattern. The program reads huge file, and remove unnessary data. So I need to remove characters before and after the line. Could you post an example to make absolutely clear what you have and what you want? Thanks. Torsten FedoraPHPLINUXOct72004 _ Is your PC infected? Get a FREE online computer virus scan from McAfee® Security. http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php _ FREE pop-up blocking with the new MSN Toolbar get it now! http://toolbar.msn.com/go/onm00200415ave/direct/01/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Remove cahracters in string
No. It just an example From: Torsten Roehr [EMAIL PROTECTED] To: [EMAIL PROTECTED] Subject: Re: [PHP] Re: Remove cahracters in string Date: Mon, 10 May 2004 22:49:27 +0200 Mike Mapsnac [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Below is string let's name it A. ttPhiladelphiaFirstadate05Oct2004tt I want to get string B. That looks like PhiladelphiaFirstadate05Oct2004 No characters before Philadelphia and after 20004 Is the character you want to remove ('t') always the same? Torsten From: Torsten Roehr [EMAIL PROTECTED] To: [EMAIL PROTECTED] Subject: [PHP] Re: Remove cahracters in string Date: Mon, 10 May 2004 22:37:36 +0200 Mike Mapsnac [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] I search on php.net and couldn't find the function. I need a function that will remove characters in the string until it reached the pattern and remove characters in the string after another pattern. The program reads huge file, and remove unnessary data. So I need to remove characters before and after the line. Could you post an example to make absolutely clear what you have and what you want? Thanks. Torsten FedoraPHPLINUXOct72004 _ Is your PC infected? Get a FREE online computer virus scan from McAfee® Security. http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php _ FREE pop-up blocking with the new MSN Toolbar get it now! http://toolbar.msn.com/go/onm00200415ave/direct/01/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php _ Check out the coupons and bargains on MSN Offers! http://youroffers.msn.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: Remove cahracters in string
Below is string let's name it A. ttPhiladelphiaFirstadate05Oct2004ttt ttt I want to get string B. That looks like PhiladelphiaFirstadate05Oct2004 No characters before Philadelphia and after 20004 Is the character you want to remove ('t') always the same? No. It just an example An accurate example of what you're actually going to be doing would help. For this example I would have suggested: ?php $str = PhiladelphiaFirstadate05Oct2004; $str = trim( $str, t ); print( $str ); // outputs PhiladelphiaFirstadate05Oct2004 ? Cheers, Rick -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: PHP graphing tool?
You will find a couple on phpclasses.org, also a few on sourceforge.net Some googling and youll find a few more. Ive been down the same road, finally youll see that accually there are no free ones usable for your project (atleast I had a real hard time finding some). There are some really great flash graphs out there, and the last year the pricing has dropped to a reasonable one aswell so you might aswell look at the comercial sollutions out there, they have become real good. Well, thats one day worth of work summed up for you in one handy little reply, :) -- -- Kim Steinhaug -- There are 10 types of people when it comes to binary numbers: those who understand them, and those who don't. -- www.steinhaug.com - www.easywebshop.no - www.webkitpro.com -- Amanda Hemmerich [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Is there a PHP tool or module out there that would be good for creating line or bar graphs? I'm looking for something I can pass numbers to and it will just graph those numbers. Any recommendations? Thanks! Amanda -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: Remove cahracters in string
For this example I would have suggested: ?php $str = PhiladelphiaFirstadate05Oct2004; $str = trim( $str, t ); print( $str ); // outputs PhiladelphiaFirstadate05Oct2004 ? Cheers, Rick t is not static character. My example isn't correct Correct Example: tdahregdgfdhPhiladelphiaFirstadate05Oct2004ahahrehbGSG Ok. What do you know for certain about the leading and trailing garbage? For Example: Is it always lowercase? Is it always the same number of characters? Will the trailing garbage always begin after a 4 digit number? There has to be some known characteristic of the junk before you can trim it programmatically. Otherwise you'll never be able to trim it with absolute accuracy. Hope that makes sense. Rick (Please reply to the list, by the way. Otherwise it doesn't help anyone else.) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Regex Help
Greetings list, I have been given a list of products, and I need some help building a regular expression to split the category from the sub category. Example: CamerasDigital_CannonXLRshot -Original entry in list Cameras Digital Cannon XLRshot -Desired result. I can use str_replace() for the underscore, but I also want to be able to split on lowercase char followed by an uppercase char. I have not worked with regular expressions much before, and I just need a push in the right direction. Thanks in advance, Keith -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Regex Help
* Thus wrote hitek ([EMAIL PROTECTED]): Greetings list, I have been given a list of products, and I need some help building a regular expression to split the category from the sub category. Example: CamerasDigital_CannonXLRshot -Original entry in list Cameras Digital Cannon XLRshot -Desired result. One possiblity: echo preg_replace('/([a-z])_?([A-Z])/', '$1 $2', 'CamerasDigital_CannonXLRshot'); explanation: match a lower case character preceding an uppercase character, with an optional underscore between them. Replace that match with the matched lowercase character, space and matched uppercase character. Curt -- I used to think I was indecisive, but now I'm not so sure. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Binary to ASCII
When reading from a Socket Server, my Socket Client retrieves data that includes ASCII and binary data: while(($buf = socket_read($socket,128,PHP_BINARY_READ)) !== false) { $data .= $buf; if(preg_match(/ENX/, $data)) break; } echo RESPONSE: .$data.\n; The output looks like: RESPONSE: STXThe system is up and running.ENX Between the STX and The system is up... are 8 bytes of binary data (which this case appear as an ampersand), which I want to extract from $data, split into two 4 byte variables, and convert back into integers. I suspect that I need unpack() at some point, but any ideas how to extract and split the binary data from this string? (Sometimes, the binary data is not visible, but it's still there.) ...Rene PS. Thanks guys for the earlier advice with pack()--which worked. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Regex Help
Curt, That's perfect. Works like a charm. Thanks, Keith At 03:54 PM 5/10/2004, Curt Zirzow wrote: * Thus wrote hitek ([EMAIL PROTECTED]): Greetings list, I have been given a list of products, and I need some help building a regular expression to split the category from the sub category. Example: CamerasDigital_CannonXLRshot -Original entry in list Cameras Digital Cannon XLRshot -Desired result. One possiblity: echo preg_replace('/([a-z])_?([A-Z])/', '$1 $2', 'CamerasDigital_CannonXLRshot'); explanation: match a lower case character preceding an uppercase character, with an optional underscore between them. Replace that match with the matched lowercase character, space and matched uppercase character. Curt -- I used to think I was indecisive, but now I'm not so sure. -- 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] Binary to ASCII
* Thus wrote Ren Fournier ([EMAIL PROTECTED]): When reading from a Socket Server, my Socket Client retrieves data that includes ASCII and binary data: while(($buf = socket_read($socket,128,PHP_BINARY_READ)) !== false) { $data .= $buf; if(preg_match(/ENX/, $data)) break; } echo RESPONSE: .$data.\n; The output looks like: RESPONSE: STXThe system is up and running.ENX Between the STX and The system is up... are 8 bytes of binary data (which this case appear as an ampersand), which I want to extract from $data, split into two 4 byte variables, and convert back into integers. I suspect that I need unpack() at some point, but any ideas how to extract and split the binary data from this string? (Sometimes, the binary data is not visible, but it's still there.) //I would Assume that that was packed with something like this: $string = 'The system is up and running.'; $pck = pack('a3iia*a3', 'STX', strlen($string), 38, $string, 'ENX'); echo $pck, \n; //So This will unpack it for you. $unpacked = unpack('a3code/istrlen/itype/a*stringWithEndDelim', $pck); print_r($unpacked); //You'll notice the stringWithCode will have to be adjusted. $stringResult = substr($unpacked['stringWithEndDelim'], 0, -3); $stringEndDelim = substr($unpacked['stringWithEndDelim'], -3); echo $stringResult, \n ; echo $stringEndDelim, \n ; // and check the string to make sure data isn't currupt: if (strlen($stringResult) != $unpacked['strlen']) { echo 'corrupt', \n; } else { echo 'fine', \n; } Curt -- I used to think I was indecisive, but now I'm not so sure. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Binary to ASCII
* Thus wrote Curt Zirzow ([EMAIL PROTECTED]): * Thus wrote Ren Fournier ([EMAIL PROTECTED]): //I would Assume that that was packed with something like this: $string = 'The system is up and running.'; $pck = pack('a3iia*a3', 'STX', strlen($string), 38, $string, 'ENX'); echo $pck, \n; IIRC, your Original post mention the requirement of big endian byte order. If that is the case you want pack('a2NNa*a3', ...) //So This will unpack it for you. $unpacked = unpack('a3code/istrlen/itype/a*stringWithEndDelim', $pck); ditto with unpack: unpack('a3code/Nstrlen/Ntype/a*stringWithEndDelim', ...) See the chart here for what type gets converted from what: http://php.net/pack Curt -- I used to think I was indecisive, but now I'm not so sure. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] $_SESSION - Learning
there must be session_start() before your code have you check the $row-user, is it have value?? rgds [xm] http://amadarum.e-tics.net/nigritude-ultramarine.php - Original Message - From: Ross Bateman [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Monday, May 10, 2004 12:24 PM Subject: [PHP] $_SESSION - Learning Hi I am finally starting to try and use register_globals = off on my Servers. This means a lot of code that has to be checked and changed. Unfortunatly I am struggeling to come to grips with this new concept (new to me that is) and was wondering if anybody could give me some pointers. Getting stumped at my login script. Once I have checked user and passwords, I pass a few SESSION vars to use throughout my app. snip if ($status == 1) { //initiate a session session_start(); //register session variables $_SESSION['SESSION']; //Get DataBase details and connect to it include($root_path . include/vars.php); $query = SELECT * FROM admin WHERE user_name = '$user'; $result = mysql_query($query); $row = mysql_fetch_object($result); //include the username $_SESSION['SESSION_UNAME'] = $row-user; //include the user id $_SESSION['SESSION_UID'] = $row-admin_id; //set the SecLevel Session Var $_SESSION['SESSION_SEC'] = $row-sec_level; //Now do the redirect //redirect to Admin Page header(Location: ./admin_main.php); exit(); } else /snip Where ever I have the $SESSION['var_name'] I used to have a session_register(SESSION_VAR); $SESSION_VAR = $row-user; I then redirect to my app main page and check if a session is registerd to make sure a user is logged in: //check that each page is secure session_start(); //OLD CODE IN SCRIPT = if (!session_is_registered(SESSION)) if(isset($_SESSION['SESSION'])) { //if session check fails, invoke error handler header(Location: ./../error.php?e=2); exit(); } ? That all works fine, but when I finaly start to display data on the main page, nothing shows up. One of the things I try to display is the name of the user logged in: From the login script //include the username $_SESSION['SESSION_UNAME'] = $row-user; then on my main page echo logged in as b . $_SESSION['SESSION_UNAME'] . /b ; Needless to say, no data is displayed. anybody able to point out what I am getting wrong here. It used to work fine before the old way with register_globals = on. SIDE Note: On a Windows PC with Apache, PHP and MySQL installed, even with the register_globals = on set, the SESSION vars do not work. Thanks and sorry for the long post, Ross -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
AW: [PHP] page_title ... Erik Gjertsen
Erik Gjertsen wrote html head title ? echo $page_title; ? /title /head body ?php $page_title = Welcome; ? h1 Now you see it /h1 /body /html Rev. Raja shahed -Ursprüngliche Nachricht- Von: Erik Gjertsen [mailto:[EMAIL PROTECTED] Gesendet: Samstag, 8. Mai 2004 00:36 An: [EMAIL PROTECTED] Betreff: [PHP] page_title I have write following code: ?php $page_title = Welcome; ? But I can not see Welcome on top of the page. Can someone tell me why I not can see it? Thanks Erik Gjertsen -- 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] LOBs
Hi, in the documentation there are several examples about updating LOB columns, but i have not found some example retrieving and working with this kind of data. I will be thankful if you can send an example to me how to do it; by example to write this data to a file. Thanks in advance. Fidencio Monroy.
[PHP] open remote file: password problem under SMB
Hi, I need to open files on a remote computer (from windows to windows) The path is like \\servername\share\file.txt The SMB protocol is supported in PHP and ususally works very well on simple LAN networks (see http://be2.php.net/manual/en/wrappers.php) The default user is the user running the web server (IIS or Apache) However, I need to use a specified user and password. I have searched the php docs and the web about inserting user and password info into the URL, but found no help. I know SMB allows to define a user and a password,such as most protocols (ftp://usrer:[EMAIL PROTECTED]/share, etc.). But what the hell should I do to use a user and password in the PHP implemetation of SMB?? Under windows, we use 'net use * \\smbserver\share password /user:username', so the user and password are not part of the URL of the file. Could someone help me? thank you vincent -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: exclude_once(); ?
Matthias H. Risse [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hi again! Question: Does anyone know of a possibility to exclude files which have been included _before_ my script starts on the fly (e.g. at the first lines after the entrypoint) ? Reasons: This ISP of my customer somehow includes a bunch of old PEAR files by default which I dont need or of which I need in a later version. So when several PEAR-packages perform a require_once('HTML/foo.php') PHP recognizes that it has already included foo.php and does not overload with the one specified in my user space code. This could also be the case if the include path is set to the ISP's version of PEAR and when you try to include your own PEAR packages then the conflicts arises. So maybe the ISP's PEAR is not automatically included via auto_prepend but it is in the include path. You could use set_include_path() to overwrite the global settings: http://de3.php.net/manual/en/function.set-include-path.php or if your PHP versions is prior to 4.3.0 use ini_set('include_path', '.:/path'): http://de3.php.net/manual/en/function.ini-set.php Hope this helps. Regards, Torsten Maybe there is a general possibility from blocking my ISP including some files by default? Anyone knows why this has become practice by some ISPs? (Doesnt make sense to me to have overhead for dozens of requests which scripts most of the dont require those classes to be used). Yours, M -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Complicated sql for search query ?
Hi List, I think this a complicated sql query but I am sure one of you gurus will show me how easy this is. I am doing a search script an have it finding multiple words and highlighting those words. Now my issue is how do I order each row from my result so that if the row has word1 and word2 and word3 it is at the top of this listing returned and then rows with word1 and word2 and then word1. I think it might be something to do with count() somewhere in my sql but I have not found an answer elsewhere to achieve this. Here is an example of how I am building the sql in Php: $find = word1 word2 word3; $far = explode(' ',$find); $far = array_unique($far); $count = count($far); // print_r($far); for($kw = 0; $kw = count($far)-1; $kw++){ if($kw ==0){ $queryor .= title_keywords like \%$far[$kw]%\ ; $queryor .= or body_keywords like \%$far[$kw]%\ ; } elseif($kw == $count){ $queryor .= title_keywords like \%$far[$kw]%\ ; $queryor .= or body_keywords like \%$far[$kw]%\ ; } else { $queryor .= or title_keywords like \%$far[$kw]%\ ; $queryor .= or body_keywords like \%$far[$kw]%\ ; } } //echo $query; $sqlor = mysql_query(select * from database where.$queryor. ) or die(mysql_error()); Any advise or examples are very much appreciated. Thank you in advance for any help Dave Carrera --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.679 / Virus Database: 441 - Release Date: 07/05/2004 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] A work around my HTTP_REFERER Prob...
If returning a floating point variable, cast it back to an (int) hth Tristan Pretty [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Cheers for all ideas/suggetions so far.. I've made a little progres... Visit this URL: http://www.risk.sungard.com/secure.php?secure=126807.714285714 and here's the code.. ? $today_day = date(d); $code1 = ($today_day+1) * $_GET[secure]; $code2 = $today_day * $_GET[secure]; $code3 = ($today_day-1) * $_GET[secure]; $master_code = 887654; if (($code1 == $master_code) || ($code2 == $master_code) || ($code3 == $master_code)) { $woopee = h2DONE IT!!!/h2; } ? html head titleSecure Test/title /head body ?=$woopee ? bDebug:/b br /Secure: ?=$_GET[secure] ? br /Day: ?=$today_day ? br /Master: ?=$master_code ? br /Code 1: ?=$code1 ? br /Code 2: ?=$code2 ? br /Code 3: ?=$code3 ? /body /html If I change the GET requests to simple variables, and assign a new variable called $secure, and asign it the value: 126807.714285714 The page works! Makes me think there's a GET error? Can anyone spot my potentially obvious error? Tris... Jason Wong [EMAIL PROTECTED] 07/05/2004 13:37 To [EMAIL PROTECTED] cc Subject Re: [PHP] A work around my HTTP_REFERER Prob... On Friday 07 May 2004 20:05, [EMAIL PROTECTED] wrote: varibale called 'secure' we asign that variable that value of '4654376534' and divide it by the day (eg: if it's the 12th of may, we divide by 12.. 7th of June, we divide by 7) That would result in a floating point number ... if (($code1 == $master_code) || ($code2 == $master_code) || ($code3 == $master_code)) { ... which does not lend easily to such comparisons. If you're still intent on using this *ahem* 'security' scheme then I suggest you use multiplication instead (just make sure that the largest number you're processing is less than 2147483648 - or use the BCMath functions). -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-general -- /* After all, it is only the mediocre who are always at their best. -- Jean Giraudoux */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php * The information contained in this e-mail message is intended only for the personal and confidential use of the recipient(s) named above. If the reader of this message is not the intended recipient or an agent responsible for delivering it to the intended recipient, you are hereby notified that you have received this document in error and that any review, dissemination, distribution, or copying of this message is strictly prohibited. If you have received this communication in error, please notify us immediately by e-mail, and delete the original message. *** -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Complicated sql for search query ?
Dave Carrera [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hi List, I think this a complicated sql query but I am sure one of you gurus will show me how easy this is. I am doing a search script an have it finding multiple words and highlighting those words. Now my issue is how do I order each row from my result so that if the row has word1 and word2 and word3 it is at the top of this listing returned and then rows with word1 and word2 and then word1. I think it might be something to do with count() somewhere in my sql but I have not found an answer elsewhere to achieve this. Here is an example of how I am building the sql in Php: $find = word1 word2 word3; $far = explode(' ',$find); $far = array_unique($far); $count = count($far); // print_r($far); for($kw = 0; $kw = count($far)-1; $kw++){ if($kw ==0){ $queryor .= title_keywords like \%$far[$kw]%\ ; $queryor .= or body_keywords like \%$far[$kw]%\ ; } elseif($kw == $count){ $queryor .= title_keywords like \%$far[$kw]%\ ; $queryor .= or body_keywords like \%$far[$kw]%\ ; } else { $queryor .= or title_keywords like \%$far[$kw]%\ ; $queryor .= or body_keywords like \%$far[$kw]%\ ; } } file://echo $query; $sqlor = mysql_query(select * from database where.$queryor. ) or die(mysql_error()); Any advise or examples are very much appreciated. Thank you in advance for any help Dave Carrera Hi Dave, take a look at MySQL's fulltext search functions. I think the results will be ordered by relevance: http://www.mysql.de/doc/en/Fulltext_Search.html If this doesn't work for you here's my workaround suggestion: I would do a loop for every search word within every row of your result and add it to an multi-dimensional array with the count of the found words as the index: // $count is set above in your script $result = array(); while($row = mysql_fetch_assoc($sqlor)) { $found = 0; for ($i = 0; $i $count; $i++) { // increment found if the word is found in one of the columns if (stristr($row['title_keywords'], $far[$i]) || stristr($row['body_keywords'], $far[$i])) { $found++; } } // add row values to result array $array[$found][] = $row; } This should give you something like this where the first dimension is the count fo the found words: Array { [1] = Array { [0] = Array { title_keywords = 'xyz', body_keywords 'whatever' }, [1] = Array { title_keywords = 'xyz', body_keywords 'whatever' } }, [3] = Array { [0] = Array { title_keywords = 'xyz', body_keywords 'whatever' } } } Then you could loop through the array again starting with the highest index (highest number of found words) and output your resulst. Have not tested the code. Maybe you could try it out and do var_dump($result) to check if the result is what you want. Regards, Torsten -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Uploading and directory permissions
Hi all For few years now I've been creating custom CMSs and I've been having an images folder with permissions 777 so the PHP script can upload images through the CMS. You can imagine what the problem is... although I never had someone deleting images (low profile sites usually), couple of days ago someone deleted all images from one of the websites (gg!!!). Anyways I was wondering if there is a way to upload through PHP without having write permission to all. Is there a way maybe, for the script, to change permission to write before the upload and then take it off? or anything else I can do to protect the dir? Thank you Mario - Marios Adamantopoulos Web Developer [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Complicated sql for search query ?
Something like: select , IF(title_keywords like \%$word1%\ or body_keywords like \%$word1%\, 1, 0) + IF(title_keywords like \%$word2%\ or body_keywords like \%$word2%\, 1, 0) as relevance .. ORDER BY relevance I hope you get the point. Dave Carrera wrote: Hi List, I think this a complicated sql query but I am sure one of you gurus will show me how easy this is. I am doing a search script an have it finding multiple words and highlighting those words. Now my issue is how do I order each row from my result so that if the row has word1 and word2 and word3 it is at the top of this listing returned and then rows with word1 and word2 and then word1. I think it might be something to do with count() somewhere in my sql but I have not found an answer elsewhere to achieve this. Here is an example of how I am building the sql in Php: $find = word1 word2 word3; $far = explode(' ',$find); $far = array_unique($far); $count = count($far); // print_r($far); for($kw = 0; $kw = count($far)-1; $kw++){ if($kw ==0){ $queryor .= title_keywords like \%$far[$kw]%\ ; $queryor .= or body_keywords like \%$far[$kw]%\ ; } elseif($kw == $count){ $queryor .= title_keywords like \%$far[$kw]%\ ; $queryor .= or body_keywords like \%$far[$kw]%\ ; } else { $queryor .= or title_keywords like \%$far[$kw]%\ ; $queryor .= or body_keywords like \%$far[$kw]%\ ; } } //echo $query; $sqlor = mysql_query(select * from database where.$queryor. ) or die(mysql_error()); Any advise or examples are very much appreciated. Thank you in advance for any help Dave Carrera -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] readdir and opendir
Simple question : do readdir and opendir support opening HTTP urls ?? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: thumbnail problems
just turn on the error report on php and look for errors.. and if you use @ in front of any method, take it away.. I think you've got some error on your script that dosent show Ninti Systems [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] I've searched the archives on this and, while I have turned up some tips, they don't seem to solve my problem. I an building a website for an indigenous organisation where jpg images are uploaded, resized to a standard format, and thumbnails also generated at the same time (so that is two resizes for each image). Most of the time this works OK, but there are a lot of pages where many thumbnails are just blacked out, eg: http://waru.org/arakuwaritja.php?p=63 On some pages, all images are blacked out, eg: http://waru.org/arakuwaritja.php?p=36 whereas on others they're all OK, eg: http://waru.org/arakuwaritja.php?p=43 The people in the field taking and uploading the photos insist that the format, color depth, etc, is not changing from photo to photo, and I can't discern any differences. Yet some work, some don't. I read somewhere that memory limitations could cause this, but still, it only happens sometimes and not others. We are on a crowded shared server I think. I'm use ImageCreateTrueColor() after checking with ImageIsTrueColor(), otherwise just ImageCreate(). The initial resizes almost always work (down from 640x480 to 400x300), with the thumbnails it is looking like a 50% failure rate. Thanks in advance for any assistance. Michael Hall -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP with imap support
I'm trying to re-compile php with imap, but all I've got so far is a huge headache. I have a working installation of courier-imap + I installed the imap-devel rpm but the configure script fails and the last line says: checking whether IMAP works... no configure: error: build test failed. Please check the config.log for details. I googled and saw lots of other people have had the same error...but haven't really seen an answer to the problem. Maybe someone lurking on this list has had the same? any input greatly appreciated James
RE: [PHP] Re: form submission logic
[snip] This is more of a HTML than a PHP question, but anyway: It doesn't matter where you put the buttons as long as they are INSIDE the form-tag and have different names. [/snip] Actually you can name them all the same thing and then have PHP process the form via a switch/case statment. input type=submit name=action valuePublish input type=submit name=action valueUn-Publish ?php switch($_POST['action']){ case Publish: ... do stuff ... break; case Un-Publish: ... do stuff ... break; } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Uploading and directory permissions
On Monday 10 May 2004 05:20 am, Mario wrote: Anyways I was wondering if there is a way to upload through PHP without having write permission to all. Is there a way maybe, for the script, to change permission to write before the upload and then take it off? or anything else I can do to protect the dir? You could keep your upload directory with 777, but after uploading move files to safer directory with stricter file permissions. You could probably even get away with just changing the permission of the file after it was uploaded. http://php.net/filesystem http://php.net/manual/en/function.chmod.php // Read and write for owner, read for everybody else chmod(/somedir/somefile, 0644); James Hicks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Uploading and directory permissions
[snip] For few years now I've been creating custom CMSs and I've been having an images folder with permissions 777 so the PHP script can upload images through the CMS. ... Anyways I was wondering if there is a way to upload through PHP without having write permission to all. Is there a way maybe, for the script, to change permission to write before the upload and then take it off? or anything else I can do to protect the dir? [/snip] First of all the directory needs only to be world-writable, so a 446 permission should work on the directory, resulting in dr--r--rw-. Since the Apache likely operates nobody nogroup you would also want to set the ownership properly. Anyone with root access to the server could still do harm, but hopefully you don't have a lot of those folks running around. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php