[PHP] Re: a stupid question
Blake Schroeder wrote: Hey I cant figureout the syntax please help echo Some text.aFunction().some more text; The function is not working. Thanks -B What is it you expect, and what is actually happening? -- David Robley What do batteries run on? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] R: [PHP] MYSQL Query results in pages
Here is a nice trick guys... if you want to page the result of this query : SELECT * FROM user; turn it into this one: SELECT SQL_CALC_FOUND_ROWS * FROM user LIMIT $offset,$limit; so in the end all you have to do is to perform one single query and even before fetching the rows you can call the mysql_num_rows() function and it will return the number of total rows rather than just $limit. cheers, Alessandro -Messaggio originale- Da: Matt Matijevich [mailto:[EMAIL PROTECTED] Inviato: giovedi 24 giugno 2004 21.41 A: [EMAIL PROTECTED]; [EMAIL PROTECTED] Oggetto: Re: [PHP] MYSQL Query results in pages [snip] Is this right? Is there other efficent way to do it? What about if data changes (i.e. new records are added) while the user browses through pages? [/snip] on each page do a: SELECT count(*) FROM table WHERE your_condition this will give you your total number of results -- 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] How? First big letter
Hello, how to make the firs letter of the word Big? for example I have: $colour = car is red; but I need: $colour = Car is big. Thank you very much, I would look for the answer myself using google, but I have no time for it. I hope there is an easy solution for this. Lab. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How? First big letter
Use ucfirst() Labunski wrote: Hello, how to make the firs letter of the word Big? for example I have: $colour = car is red; but I need: $colour = Car is big. Thank you very much, I would look for the answer myself using google, but I have no time for it. I hope there is an easy solution for this. Lab. -- Miguel J. Jiménez ISOTROL, S.A. (Área de Internet) Avda. Innovación nº1, 3ª - 41020 Sevilla (ESPAÑA) mjjimenez AT isotrol DOT com --- http://www.isotrol.com ICQ# 12670750 TLFNO. 955036800 ext. 111 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How? First big letter
Thank you very much! That helps! As I sad before, I would look for it myself , but I wasn't sleepinng all the night, this way I think it would be a liittle bit difficult to find it. Thank you once more, Lab. Miguel J. Jiménez wrote in message news:[EMAIL PROTECTED] Use ucfirst() Labunski wrote: Hello, how to make the firs letter of the word Big? for example I have: $colour = car is red; but I need: $colour = Car is big. Thank you very much, I would look for the answer myself using google, but I have no time for it. I hope there is an easy solution for this. Lab. -- Miguel J. Jiménez ISOTROL, S.A. (Área de Internet) Avda. Innovación nº1, 3ª - 41020 Sevilla (ESPAÑA) mjjimenez AT isotrol DOT com --- http://www.isotrol.com ICQ# 12670750 TLFNO. 955036800 ext. 111 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: a 4 days diary
since there aren't much data you can do something like this: 1 . make db table tableName id INT title VARCHAR(30) Data TEXT timestamp VARCHAR(30) 2. just dump the data you get from the user into a db.. 3. when you are ready to get the data back for view from database you can simply use SQL and ask for the right time and date.. SELECT * FROM myTable WHERE timestamp BETWEN x AND y where x and yy is the timastamp value Pierre [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hi all, I have to code a 4 days diary for a client, schedule every 30 mn and with a system of rdv accepted by mail. I really don't know how to start to draw a cool diary and to code it correctly to be the most reusable as possible. POO or not? If you have there any examples of this style of coding this is could great or just maybe an idea of how I can start my code to have a good one? Just a good direction and way of coding to not have many surprises... I hope I was clear Thx all Pierre -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] [Newbie Guide] For the benefit of new members
=== Please feel free to add more points and send to the list. === 1. If you have any queries/problems about PHP try http://www.php.net/manual/en first. You can download a copy and use it offline also. Please also try http://www.php.net/manual/faq.php for answers to frequently answered questions about PHP (added by Christophe Chisogne). 2. Try http://www.google.com next. Searching for php YOUR QUERY may fetch you relevant information within the first 10 results. 3. There is a searchable archive of the mailing list discussion at http://phparch.com/mailinglists. Many of the common topics are discussed repeatedly, and you may get answer to your query from the earlier discussions. For example: One of the repeatedly discussed question in the list is Best PHP editor. Everyone has his/her favourite editor. You can get all the opinions by going through the list archives. If you want a chosen list try this link : http://www.thelinuxconsultancy.co.uk/phpeditors/ (contributed by Christophe Chisogne). 4. Not sure if PHP is working or you want find out what extensions are available to you? Just put the following code into a file with a .php extension and access it through your webserver: ?php phpinfo(); ? If PHP is installed you will see a page with a lot of information on it. If PHP is not installed (or not working correctly) your browser will try to download the file. (contributed by Teren and reworded by Chris W Parker) 5. If you are stuck with a script and do not understand what is wrong, instead of posting the whole script, try doing some research yourself. One useful trick is to print the variable/sql query using print or echo command and check whether you get what you expected. After diagnosing the problem, send the details of your efforts (following steps 1, 2 3) and ask for help. 6. PHP is a server side scripting language. Whatever processing PHP does takes place BEFORE the output reaches the client. Therefore, it is not possible to access users' computer related information (OS, screen size etc) using PHP. Nor can you modify any the user side settings. You need to go for JavaScript and ask the question in a JavaScript list. On the other hand, you can access the information that is SENT by the user's browser when a client requests a page from your server. You can find details about browser, OS etc as reported by this request. - contributed by Wouter van Vliet and reworded by Chris W Parker. 7. Provide a clear descriptive subject line. Avoid general subjects like Help!!, A Question etc. Especially avoid blank subjects. 8. When you want to start a new topic, open a new mail composer and enter the mailing list address [EMAIL PROTECTED] instead of replying to an existing thread and replacing the subject and body with your message. 9. It's always a good idea to post back to the list once you've solved your problem. People usually add [SOLVED] to the subject line of their email when posting solutions. By posting your solution you're helping the next person with the same question. [contribued by Chris W Parker] 10. Ask smart questions http://catb.org/~esr/faqs/smart-questions.html [contributed by Jay Blanchard) 11. Do not send your email to the list with attachments. If you don't have a place to upload your code, try the many pastebin websites (such as www.pastebin.com). [contributed by Burhan Khalid] -- Integrated Management Tools for leather industry -- http://www.leatherlink.net Ma Siva Kumar, BSG LeatherLink (P) Ltd, Chennai - 600106 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Date Select
How can I query a MySQL table to get the latest results from a date field? Basically, I am inserting several records at a time at the end of each week. I want to have a page that displays the results for the last week only. The date format in the field is -MM-DD
[PHP] Re: [PHP-DB] Date Select
How can I query a MySQL table to get the latest results from a date field? Basically, I am inserting several records at a time at the end of each week. I want to have a page that displays the results for the last week only. The date format in the field is -MM-DD if you want the latest row - select * from table order by max(date_column) limit 1; if you want rows in a range of dates there are lots o ways, and instead of showing one or two, I'd suggest taking a look at the manual on dates http://dev.mysql.com/doc/mysql/en/Date_and_time_functions.html, and seeing what fits your needs best. Seems like you may want to look at BETWEEN And if you don't want to use those, you are always free to use select * from table where date_column '-mm-dd' and date_column '-mm-dd' order by date_col desc HTH Jeff -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] RE: [PHP-DB] Date Select
Jeffrey, Thanks for this, I've just realised that it's always the same no of inserts, so perhaps I should just order by date then my previous sort field and then limit the result to 20? (It's all 20 results that I need displayed) Thanks, Tom -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: 25 June 2004 12:15 To: Tom Chubb Cc: [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: Re: [PHP-DB] Date Select How can I query a MySQL table to get the latest results from a date field? Basically, I am inserting several records at a time at the end of each week. I want to have a page that displays the results for the last week only. The date format in the field is -MM-DD if you want the latest row - select * from table order by max(date_column) limit 1; if you want rows in a range of dates there are lots o ways, and instead of showing one or two, I'd suggest taking a look at the manual on dates http://dev.mysql.com/doc/mysql/en/Date_and_time_functions.html, and seeing what fits your needs best. Seems like you may want to look at BETWEEN And if you don't want to use those, you are always free to use select * from table where date_column '-mm-dd' and date_column '-mm-dd' order by date_col desc HTH Jeff -- PHP Database 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] Re: Date Select
select * from table where week(date_field) = ( week(now()) -1 ) Tom Chubb wrote: How can I query a MySQL table to get the latest results from a date field? Basically, I am inserting several records at a time at the end of each week. I want to have a page that displays the results for the last week only. The date format in the field is -MM-DD -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Form Submission
Hi, I have a form on my page. The form action is linked to itself so that the values entered will refresh the page accordingly. Is it possible to add another button to the form that utilises my JavaScript popup function and takes the values from the same form? function openQueryWindow(URL) { var args =left=150,top=100,width=742,height=402,toolbar=no,location=no,directories=n o,status=nos,menubar=no,scrollbars=yes,resizable=yes; var newWindow = window.open(URL, query, args); newWindow.focus(); } Thanks for your help -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] problems with system() call
On Friday 25 June 2004 13:20, Jim Rainville wrote: system(write_port 0x); When I call this from the script the port does not get written to. 1) Enable FULL error reporting 2) Use /full/path/to/write_port -- 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 -- /* A bachelor is a selfish, undeserving guy who has cheated some woman out of a divorce. -- Don Quinn */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Form Submission
another button to the form that utilises my JavaScript popup function and takes the values from the same form? This is not a php question. All you need to do is loop through the form fields on you page and add them to the end of your url. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Form Submission
Matt M. [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] another button to the form that utilises my JavaScript popup function and takes the values from the same form? This is not a php question. All you need to do is loop through the form fields on you page and add them to the end of your url. Hi, Thanks for your reply, the problem here is that if I loop through the values and them to the URL when the other button is pressed to submit the form the form action will still kink to itself rather than opening a new popup window... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Form Submission
Thanks for your reply, the problem here is that if I loop through the values and them to the URL when the other button is pressed to submit the form the form action will still kink to itself rather than opening a new popup window... input type=submit name=submit value=Submit onclick=return false; / that should stop form submission if they click your butto, also not much point of having that button on the page though. Anyway, this really does not have anything to do with php. Search for javascript help. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Form Submission
Shaun wrote --- napsal:: Matt M. [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] another button to the form that utilises my JavaScript popup function and takes the values from the same form? This is not a php question. All you need to do is loop through the form fields on you page and add them to the end of your url. Hi, Thanks for your reply, the problem here is that if I loop through the values and them to the URL when the other button is pressed to submit the form the form action will still kink to itself rather than opening a new popup window... How is the button defined? It should be type=button, not type=submit. And check for javascript errors, still the new window should be opened. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] gd2 functions without gd2?
I have a small image resize function which works great on my local server as I have the gd2 library. It uses the imagecreatetruecolor function which makes the thumbnails look good, without it, they look bad. The problem is, my webhost is not going to upgrade to gd2 sois there anyway I can pull out the necessary functions or do they require a certain php version? Thanks, Eddie WARNING: The information contained in this message and any attachments is intended only for the use of the individual or entity to which it is addressed. This message may contain information that is privileged, confidential and exempt from disclosure under applicable law. It may also contain trade secrets and other proprietary information for which you and your employer may be held liable for disclosing. You are hereby notified that any unauthorized dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please notify [EMAIL PROTECTED] by E-Mail and then destroy this communication in a manner appropriate for privileged information. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Streaming
What I'm basically trying to do is make the database display out the information from it's tables as soon as it possibly can without the need for refreshing. For example: Someone enters in some text, and it's put into the database. As soon as possible, the text is shown in a page that wasn't refreshed and has been shown at all times, on several computers. They don't all have to be synchronized, just that it shows as soon as it possibly can without refreshing. This may be an HTTP push method, the name sounds similar to what I'm trying to do. What exactly is it and how do you utilize it? Thanks for all the help! Thanks, Stephen Craton http://www.melchior.us -Original Message- From: Curt Zirzow [mailto:[EMAIL PROTECTED] Sent: Friday, June 25, 2004 12:53 AM To: PHP List Subject: Re: [PHP] Streaming * Thus wrote Stephen Craton: So my question is, does anyone know how the phpOpenChat system works? Can anyone provide some insight into the world of streaming and avoiding the refresh game? streaming ?php echo data streamed to browser; ? It is very unclear how you mean streaming, if you're talking about a HTTP push method, then thats a whole nother ballpark. Curt -- First, let me assure you that this is not one of those shady pyramid schemes you've been hearing about. No, sir. Our model is the trapezoid! -- 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] No MySQL in Fedora?
Greetings all, just installed Fedora with the bundled PHP Version 4.3.4. Upon calliing mysql_* functions I get errors like: Fatal error: Call to undefined function: mysql_pconnect() blah blah blah A call to phpinfo() reveals it was configured with: --with-mysql=shared,/usr' And doing a locate mysql.so from the command line reveals mysql.so is not anywhere to be found. I looked at the mysql docs at php.net so see how to properly install mysql.so and couldn't find anything. Am I dense? Do I need more coffee? So I added the line: extension=mysql.so to one of the config files, copied mysql.so over from the production server and restarted apache as a hack to try to see if it worked. It didn't. Please let me know how you'd go about troubleshooting or solving this Thanks!! --Jough -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] No MySQL in Fedora?
Install php-mysql package Jough P wrote --- napísal:: Greetings all, just installed Fedora with the bundled PHP Version 4.3.4. Upon calliing mysql_* functions I get errors like: Fatal error: Call to undefined function: mysql_pconnect() blah blah blah A call to phpinfo() reveals it was configured with: --with-mysql=shared,/usr' And doing a locate mysql.so from the command line reveals mysql.so is not anywhere to be found. I looked at the mysql docs at php.net so see how to properly install mysql.so and couldn't find anything. Am I dense? Do I need more coffee? So I added the line: extension=mysql.so to one of the config files, copied mysql.so over from the production server and restarted apache as a hack to try to see if it worked. It didn't. Please let me know how you'd go about troubleshooting or solving this Thanks!! --Jough -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] socket_bind
I'm trying to do socket_bind() and it works fine from the command line as root, but when I try to use it through apache I get this error Warning: socket_bind() unable to bind address [13]: Permission denied in .. Is there a way to have this run through apache? -Josh -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] socket_bind
I think all sockets less then 1024 need superuser permission to bind. And because Apache typically runs as nobody you don't have permission, so either run apache as root (DANGER!) or choose a socket above 1024. -Brad - Original Message - From: Josh Close [EMAIL PROTECTED] Date: Friday, June 25, 2004 10:18 am Subject: [PHP] socket_bind I'm trying to do socket_bind() and it works fine from the command line as root, but when I try to use it through apache I get this error Warning: socket_bind() unable to bind address [13]: Permission denied in .. Is there a way to have this run through apache? -Josh -- 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] socket_bind
Thanks, changing the port worked. -Josh -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Friday, June 25, 2004 9:22 AM To: [EMAIL PROTECTED] Cc: PHP (E-mail) Subject: Re: [PHP] socket_bind I think all sockets less then 1024 need superuser permission to bind. And because Apache typically runs as nobody you don't have permission, so either run apache as root (DANGER!) or choose a socket above 1024. -Brad - Original Message - From: Josh Close [EMAIL PROTECTED] Date: Friday, June 25, 2004 10:18 am Subject: [PHP] socket_bind I'm trying to do socket_bind() and it works fine from the command line as root, but when I try to use it through apache I get this error Warning: socket_bind() unable to bind address [13]: Permission denied in .. Is there a way to have this run through apache? -Josh -- 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] How to force mod_php to load php.ini ?
Hi, is there a way configure mod_php4 (for apache) so as to be *absolutely* sure that it will always load all definitions in php.ini when apache starts up? Maybe with some directive in http.conf ? Almost every time I reboot my pc apache and php start, but php is not running with /etc/php.ini, so I have to execute /etc/init.d/httpd restart Thanks, Nico Sabbi - Officine Digitali - Bologna Tel. 051 - 4187565 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] a stupid question
Your problem is the paren's echo 'some text' $aFunction 'some more text'; You need double quotes for the entire string, but single quotes around the text so it knows it is text. Alicia Riggs Professional Services Group Senior Web Development Engineer 214-550-7452 -Original Message- From: Blake Schroeder [mailto:[EMAIL PROTECTED] Sent: Thursday, June 24, 2004 4:45 PM To: PHP List Subject: [PHP] a stupid question Hey I cant figureout the syntax please help echo Some text.aFunction().some more text; The function is not working. Thanks -B -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How to force mod_php to load php.ini ?
Nico Sabbi wrote --- napísal:: Hi, is there a way configure mod_php4 (for apache) so as to be *absolutely* sure that it will always load all definitions in php.ini when apache starts up? Maybe with some directive in http.conf ? Almost every time I reboot my pc apache and php start, but php is not running with /etc/php.ini, so I have to execute /etc/init.d/httpd restart Thanks, Nico Sabbi - Officine Digitali - Bologna Tel. 051 - 4187565 This is most likely a configuration issue. Next time you restart, run phpinfo() script and find out what php.ini is used, or where is it being looked for. It's mentioned right in the top box. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Understanding behavior of 'directories below files'
I'm a system administrator who's dabbled a bit in PHP, but am not very experienced in it. My PHP developer came to me with a behavior which neither of us can understand. If you go to this URL, you'll get a broken version of the main home page on our site: http://www.hcpartnership.org/index.php/search . We can't understand this, because 'index.php' is a file, not a directory. (The correct web page is just at http://www.hcpartnership.org/index.php.) Here's another example: http://www.hcpartnership.org/path_test.php/search : does not generate a 404 error http://www.hcpartnership.org/path_test.html/search : generates a 404 error This is despite the fact that both of these two files are empty: www:/var/www/hcpartnership/htdocs# ls -l path* -rw-r--r--1 rmcpeak wwwadmin0 Jun 25 10:09 path_test.html -rw-r--r--1 rmcpeak wwwadmin0 Jun 25 10:10 path_test.php www:/var/www/hcpartnership/htdocs# Can anyone explain to me why this is happening? Is this a danger? Can this be turned off? Is this controlled in the .php code, in the php.ini file or in the Apache configuration, or elsewhere? We didn't even know how to describe this problem well, so our searches of the archives of this mailing list and Google weren't successful. Let me know if we overlooked something. Thanks so much for your suggestions and thoughts. -Kevin Zembower - E. Kevin Zembower Unix Administrator Johns Hopkins University/Center for Communications Programs 111 Market Place, Suite 310 Baltimore, MD 21202 410-659-6139 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] mail sent but not received?!
Hi, I've been pulling my hair out over this problem for a while... ?php $msg = Hi, this is a test; $to = [EMAIL PROTECTED]; $sbj = test message from my.edu; $rev = mail($to,$sbj,$msg); echo mail from my.edu result is $rev; ? -- Since the result of the mail() returned is 1, the message should have been delivered fine. but I did not get anything. Where can I look for more clues of what the problem might be, like possible log, or turn on some debug level in php? I've also tried mail($to,$sbj,$msg, -f [EMAIL PROTECTED]), no workie either. Any help would be greatly appreciated! Bing -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] TIFF images
Hi Everyone, Last week I posted about having a problem displaying TIFFs thru PHP. This week I'm back to issues, tho slightly different. I'll start over with my case. I have a docroot: /usr/local/apache/htdocs-chm/ I have an images dir: /usr/local/apache/chm-images/ These are sensitive documents that I cannot have out where the public can get to them. I was using ImageMagick, however it took a multipage tiff and turned it into: 1.TIFF 1.JPG.0 1.JPG.1 1.JPG.2 1.JPG.3 Sometimes they are 1.JPG, sometimes only 2 pages, sometimes 10 pages. We've decided to go with a TIFF viewer plug-in, and just use those. I am using the follow PHP script to handle this: ? session_cache_limiter('private'); include( $_SERVER['DOCUMENT_ROOT'] . /master.include.php ); $blah = /usr/local/apache/chm-images/ . $_GET['id'] . .TIFF; header(Content-type: image/tiff); header(Content-Transfer-Encoding: binary); $_GET['id'] = str_replace( ., , $_GET['id'] ); $_GET['id'] = str_replace( /, , $_GET['id'] ); readfile( $blah ); ? If the TIFF is a single pager, it works fine. If it's a multipager, I get an invalid file format error. I'm really at a loss as what to do. I'm willing to explore other solutions to display the TIFF images also. Can anyone please help? -Dan Joseph -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Understanding behavior of 'directories below files'
KEVIN ZEMBOWER wrote: If you go to this URL, you'll get a broken version of the main home page on our site: http://www.hcpartnership.org/index.php/search . We can't understand this, because 'index.php' is a file, not a directory. (The correct web page is just at http://www.hcpartnership.org/index.php.) Hopefully someone with more experience than me will answer this, but I did some research and thought I'd post my findings. First of all, I tested this on one of my servers and the same thing happened. I requested an existing PHP file and appended another directory name after it, and got the page I requested. It was broken the same way your example is, because the page used relative URI's for the src attribute of all the img tags, and the browser believed it was in a different directory than it really was, and requested images that did not exist. The output of php_info() showed this additional information to be in the $_SERVER['PATH_INFO'] variable. After doing some research I discovered that PATH_INFO is part of the CGI spec. Web servers will make this additional information available to the CGI script as an environment variable. Further reading indicated to me that Apache passes all of this information to a script handler and the script handler decides what to do with it. Apache 2.x provides a configuration directive to force it to return a 404 when given a path like the above, but 1.x does not. I believe that you can disable this behavior in PHP by configuring it with --disable-path-info-check. I'd be interested to know if this does correct this. I personally see it as a problem for people who aren't intending to use it and use relative URI's for images. Not that it would come up very often, but still... More info: http://www.php.net/manual/en/configure.php http://httpd.apache.org/docs-2.0/en/mod/core.html#acceptpathinfo HTH -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] mail sent but not received?!
On Fri, 25 Jun 2004 11:08:26 -0500 (CDT), Bing Du [EMAIL PROTECTED] wrote: Since the result of the mail() returned is 1, the message should have been delivered fine. but I did not get anything. Where can I look for more clues of what the problem might be, like possible log, or turn on some debug level in php? I've also tried mail($to,$sbj,$msg, -f [EMAIL PROTECTED]), no workie either. Can you send email to that address from that server? On unixy systems the mail log is usually in (shocker) /var/log/maillog. For a Windows system make sure you have the mail settings in php.ini setup correctly (see http://php.net/mail for full info). -- Stuttle -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Date Select
select * from table where TO_DAYS(date_field) ( TO_DAYS(NOW()) -7 ) this will give the entries of the last 7 days (and the ones that are in the future) Tom Chubb [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] How can I query a MySQL table to get the latest results from a date field? Basically, I am inserting several records at a time at the end of each week. I want to have a page that displays the results for the last week only. The date format in the field is -MM-DD -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Understanding behavior of 'directories below files'
Michael, thank you for finding out this information. I think you're right on the money. Unfortunately, when I tried to implement the --disable-path-info-check on my PHP system, it didn't work. Reading the fine print at http://www.php.net/manual/en/configure.php showed: --disable-path-info-check If this is disabled, paths such as /info.php/test?a=b will fail to work. Available since PHP 4.3.0. For more information see the Apache Manual. Alas: www:/etc/php4/cgi# php4 -v 4.1.2 www:/etc/php4/cgi# which is the version with Debian 3.0 (woody). Thanks, again, for researching this and finding the answers that I couldn't. -Kevin Michael Sims [EMAIL PROTECTED] 06/25/04 12:25PM KEVIN ZEMBOWER wrote: If you go to this URL, you'll get a broken version of the main home page on our site: http://www.hcpartnership.org/index.php/search . We can't understand this, because 'index.php' is a file, not a directory. (The correct web page is just at http://www.hcpartnership.org/index.php.) Hopefully someone with more experience than me will answer this, but I did some research and thought I'd post my findings. First of all, I tested this on one of my servers and the same thing happened. I requested an existing PHP file and appended another directory name after it, and got the page I requested. It was broken the same way your example is, because the page used relative URI's for the src attribute of all the img tags, and the browser believed it was in a different directory than it really was, and requested images that did not exist. The output of php_info() showed this additional information to be in the $_SERVER['PATH_INFO'] variable. After doing some research I discovered that PATH_INFO is part of the CGI spec. Web servers will make this additional information available to the CGI script as an environment variable. Further reading indicated to me that Apache passes all of this information to a script handler and the script handler decides what to do with it. Apache 2.x provides a configuration directive to force it to return a 404 when given a path like the above, but 1.x does not. I believe that you can disable this behavior in PHP by configuring it with --disable-path-info-check. I'd be interested to know if this does correct this. I personally see it as a problem for people who aren't intending to use it and use relative URI's for images. Not that it would come up very often, but still... More info: http://www.php.net/manual/en/configure.php http://httpd.apache.org/docs-2.0/en/mod/core.html#acceptpathinfo 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] string function that adds before and after
What I'm trying to do is find a substring in a much longer string and insert another string before and after the substring. For example: string to find: weather string to search in: This is the worst weather ever. Weather around here is terrible. string to add before: strong string to add after: /strong I can't do a simple search and replace, because I need to maintain the case sensitivity of the word that's in the searched string. So I was hoping to find something that would locate the string to find, add something before and after it (which that something before and after could be different from each other), then continue the search to see if another instance exists. And so on and so forth There's a number of functions in PHP that will give me the position of the *first* instance of the matched string, but it doesn't look like the function would keep searching after the first match. Anyway, am I overlooking a function that already has the functionality that I'm searching for? Or does anyone have any ideas how I can accomplish this efficiently since my search strings can be quite long? Thanks! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] image upload woes
I have code which attempts to upload some files and create thumbnails. The same code on one server works ok, the same code on another server throws an error everytime I hit submit that says The document contains no data...it appears to be a javascript error. It is not an error that I am throwing. Has anyone ever had this problem? Thanks, Eddie WARNING: The information contained in this message and any attachments is intended only for the use of the individual or entity to which it is addressed. This message may contain information that is privileged, confidential and exempt from disclosure under applicable law. It may also contain trade secrets and other proprietary information for which you and your employer may be held liable for disclosing. You are hereby notified that any unauthorized dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please notify [EMAIL PROTECTED] by E-Mail and then destroy this communication in a manner appropriate for privileged information. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] string function that adds before and after
There's a number of functions in PHP that will give me the position of the *first* instance of the matched string, but it doesn't look like the function would keep searching after the first match. Anyway, am I overlooking a function that already has the functionality that I'm searching for? Or does anyone have any ideas how I can accomplish this efficiently since my search strings can be quite long? try this preg_replace('/(weather)/i', strong$1/strong, 'This is the worst weather ever. Weather around here is terrible. ') -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] mail sent but not received?!
Your message could have bounced or been rejected for some other reason, in which case you wouldn't have recieved it, but it'll look like it's sent fine. -Josh -Original Message- From: Bing Du [mailto:[EMAIL PROTECTED] Sent: Friday, June 25, 2004 11:08 AM To: [EMAIL PROTECTED] Subject: [PHP] mail sent but not received?! Hi, I've been pulling my hair out over this problem for a while... ?php $msg = Hi, this is a test; $to = [EMAIL PROTECTED]; $sbj = test message from my.edu; $rev = mail($to,$sbj,$msg); echo mail from my.edu result is $rev; ? -- Since the result of the mail() returned is 1, the message should have been delivered fine. but I did not get anything. Where can I look for more clues of what the problem might be, like possible log, or turn on some debug level in php? I've also tried mail($to,$sbj,$msg, -f [EMAIL PROTECTED]), no workie either. Any help would be greatly appreciated! Bing -- 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] image upload woes
[snip] I have code which attempts to upload some files and create thumbnails. The same code on one server works ok, the same code on another server throws an error everytime I hit submit that says The document contains no data...it appears to be a javascript error. It is not an error that I am throwing. Has anyone ever had this problem? [/snip] I am sure that someone has had a problem like this, but if you believe it to be a JavaScript problem why would you not ask a JavaScript list? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] string function that adds before and after
Matt M. wrote: There's a number of functions in PHP that will give me the position of the *first* instance of the matched string, but it doesn't look like the function would keep searching after the first match. Anyway, am I overlooking a function that already has the functionality that I'm searching for? Or does anyone have any ideas how I can accomplish this efficiently since my search strings can be quite long? try this preg_replace('/(weather)/i', strong$1/strong, 'This is the worst weather ever. Weather around here is terrible. ') Thanks Matt. I think that will do the trick. Let me see if I understand it correctly. the i will make the search case-INsensitive, and the parenthesis around weather will store what it finds in the variable $1? Is that right? Thanks again, that was a big help. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] a stupid question
That would work if aFunction was a variable - more less. It would display the inner single quotes, so you'd really want: echo some text $aFunction some more text; However, aFunction is, ironically, a function, so it needs to be a function call. echo some text . aFunction() . some more text; On Fri, 25 Jun 2004 10:09:42 -0500, Alicia Riggs [EMAIL PROTECTED] wrote: Your problem is the paren's echo 'some text' $aFunction 'some more text'; You need double quotes for the entire string, but single quotes around the text so it knows it is text. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] a stupid question
I cant figureout the syntax please help echo Some text.aFunction().some more text; The function is not working. Your problem is the paren's echo 'some text' $aFunction 'some more text'; You need double quotes for the entire string, but single quotes around the text so it knows it is text. This is very much incorrect, not sure where to begin but please ignore this advice. A string is a string is a string is a string: http://www.php.net/types.string I'm 99% sure the problem is aFunction() is echoing a value as opposed to returning one, this is a common question answered here: http://www.php.net/manual/en/faq.using.php#faq.using.wrong-order If that doesn't answer your question then please post the code. Regarding the subject of this thread you should consider asking smart questions by reading the following in its entirety: http://www.catb.org/~esr/faqs/smart-questions.html Very useful for all parties involved! :) Regards, Philip -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] socket_set_block undefined
I'm trying to use socket_set_block and php.net says (php4 = 4.2, php5). I'm using version 4.3.1 but I get this error Fatal error: Call to undefined function: socket_set_block() in . Any idea why this is? Has the name changed or been something else? socket_set_nonblock() work fine. -Josh -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] string function that adds before and after
There's a number of functions in PHP that will give me the position of the *first* instance of the matched string, but it doesn't look like the function would keep searching after the first match. Anyway, am I overlooking a function that already has the functionality that I'm searching for? Or does anyone have any ideas how I can accomplish this efficiently since my search strings can be quite long? try this preg_replace('/(weather)/i', strong$1/strong, 'This is the worst weather ever. Weather around here is terrible. ') Thanks Matt. I think that will do the trick. Let me see if I understand it correctly. the i will make the search case-INsensitive, and the parenthesis around weather will store what it finds in the variable $1? Is that right? Also consider str_replace() as it's faster albeit case sensitive. str_ireplace() exists in PHP 5. Just another option, I'm surprised you didn't find it when looking around strpos() and friends. Your assumptions above are correct, sorry Matt for stepping in! :) I prefer cold weather. Regards, Philip -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] string function that adds before and after
Philip Olson wrote: There's a number of functions in PHP that will give me the position of the *first* instance of the matched string, but it doesn't look like the function would keep searching after the first match. Anyway, am I overlooking a function that already has the functionality that I'm searching for? Or does anyone have any ideas how I can accomplish this efficiently since my search strings can be quite long? try this preg_replace('/(weather)/i', strong$1/strong, 'This is the worst weather ever. Weather around here is terrible. ') Thanks Matt. I think that will do the trick. Let me see if I understand it correctly. the i will make the search case-INsensitive, and the parenthesis around weather will store what it finds in the variable $1? Is that right? Also consider str_replace() as it's faster albeit case sensitive. str_ireplace() exists in PHP 5. Just another option, I'm surprised you didn't find it when looking around strpos() and friends. Your assumptions above are correct, sorry Matt for stepping in! :) I prefer cold weather. Regards, Philip Thanks Philip. I did notice str_replace() but it didn't look like I could use it without it actually replacing what it found instead of just adding strings before and after it. Am I wrong? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] a stupid question
Everyone Thank you for all the great feedback. Since my function doesnt return data it just echos it to the browser. When I use this format it does not display correctly echo some text . aFunction() . some more text; If I use the orginal code it displays fine. echo Some text; aFunction(); echo More text; Thanks for all the help. -B Philip Olson wrote: I cant figureout the syntax please help echo Some text.aFunction().some more text; The function is not working. Your problem is the paren's echo 'some text' $aFunction 'some more text'; You need double quotes for the entire string, but single quotes around the text so it knows it is text. This is very much incorrect, not sure where to begin but please ignore this advice. A string is a string is a string is a string: http://www.php.net/types.string I'm 99% sure the problem is aFunction() is echoing a value as opposed to returning one, this is a common question answered here: http://www.php.net/manual/en/faq.using.php#faq.using.wrong-order If that doesn't answer your question then please post the code. Regarding the subject of this thread you should consider asking smart questions by reading the following in its entirety: http://www.catb.org/~esr/faqs/smart-questions.html Very useful for all parties involved! :) Regards, Philip -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] socket_set_block undefined
I'm trying to use socket_set_block and php.net says (php4 = 4.2, php5). I'm using version 4.3.1 but I get this error Fatal error: Call to undefined function: socket_set_block() in . Any idea why this is? Has the name changed or been something else? socket_set_nonblock() work fine. Strange as the name has not changed and the function requires nothing special (no IF block around it), here's the source: http://lxr.php.net/source/php-src/ext/sockets/sockets.c#715 Since socket_set_nonblock() exists you must have the socket extension available so this is odd. Are you sure this problem exists and it's not something silly? Seems like an impossible problem assuming your php source wasn't modified :) Regards, Philip -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] socket_set_block undefined
Well, here's the code i'm using. Let me know if I'm doing something silly. if(!socket_set_nonblock($this-socket)){ if($this-logging){ syslog(LOG_ERR, Could not set socket to nonblock.); } exit(); } //connection part goes here if(!socket_set_block($this-socket)){ if($this-logging){ syslog(LOG_ERR, Could not set socket to block.); } exit(); } if($this-loggging){ syslog(LOG_INFO, Socket set to block.); } and here's the error Fatal error: Call to undefined function: socket_set_block() -Josh -Original Message- From: Philip Olson [mailto:[EMAIL PROTECTED] Sent: Friday, June 25, 2004 2:11 PM To: Josh Close Cc: PHP (E-mail) Subject: Re: [PHP] socket_set_block undefined I'm trying to use socket_set_block and php.net says (php4 = 4.2, php5). I'm using version 4.3.1 but I get this error Fatal error: Call to undefined function: socket_set_block() in . Any idea why this is? Has the name changed or been something else? socket_set_nonblock() work fine. Strange as the name has not changed and the function requires nothing special (no IF block around it), here's the source: http://lxr.php.net/source/php-src/ext/sockets/sockets.c#715 Since socket_set_nonblock() exists you must have the socket extension available so this is odd. Are you sure this problem exists and it's not something silly? Seems like an impossible problem assuming your php source wasn't modified :) Regards, Philip -- 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] socket_set_block undefined
also, i know socket_set_option() used to be socket_setopt(), that's why i ask -Josh -Original Message- From: Philip Olson [mailto:[EMAIL PROTECTED] Sent: Friday, June 25, 2004 2:11 PM To: Josh Close Cc: PHP (E-mail) Subject: Re: [PHP] socket_set_block undefined I'm trying to use socket_set_block and php.net says (php4 = 4.2, php5). I'm using version 4.3.1 but I get this error Fatal error: Call to undefined function: socket_set_block() in . Any idea why this is? Has the name changed or been something else? socket_set_nonblock() work fine. Strange as the name has not changed and the function requires nothing special (no IF block around it), here's the source: http://lxr.php.net/source/php-src/ext/sockets/sockets.c#715 Since socket_set_nonblock() exists you must have the socket extension available so this is odd. Are you sure this problem exists and it's not something silly? Seems like an impossible problem assuming your php source wasn't modified :) Regards, Philip -- 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] socket_set_block undefined
Perhaps you have multiple PHP versions on your system? Like an old CLI or CGI laying around somewhere? Maybe try checking the PHP version in the code as well. If it's not that then I have no idea. Regards, Philip On Fri, 25 Jun 2004, Josh Close wrote: Well, here's the code i'm using. Let me know if I'm doing something silly. if(!socket_set_nonblock($this-socket)){ if($this-logging){ syslog(LOG_ERR, Could not set socket to nonblock.); } exit(); } //connection part goes here if(!socket_set_block($this-socket)){ if($this-logging){ syslog(LOG_ERR, Could not set socket to block.); } exit(); } if($this-loggging){ syslog(LOG_INFO, Socket set to block.); } and here's the error Fatal error: Call to undefined function: socket_set_block() -Josh -Original Message- From: Philip Olson [mailto:[EMAIL PROTECTED] Sent: Friday, June 25, 2004 2:11 PM To: Josh Close Cc: PHP (E-mail) Subject: Re: [PHP] socket_set_block undefined I'm trying to use socket_set_block and php.net says (php4 = 4.2, php5). I'm using version 4.3.1 but I get this error Fatal error: Call to undefined function: socket_set_block() in . Any idea why this is? Has the name changed or been something else? socket_set_nonblock() work fine. Strange as the name has not changed and the function requires nothing special (no IF block around it), here's the source: http://lxr.php.net/source/php-src/ext/sockets/sockets.c#715 Since socket_set_nonblock() exists you must have the socket extension available so this is odd. Are you sure this problem exists and it's not something silly? Seems like an impossible problem assuming your php source wasn't modified :) Regards, Philip -- 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] socket_set_block undefined
I want to get rid of the version on php in /urs/local, how do I do this? There is no src to do a make uninstall from. I deleted some file/directories, but when I do php -v it's still looking for the version in /usr/local/bin instead of /usr/bin. -Josh -Original Message- From: Philip Olson [mailto:[EMAIL PROTECTED] Sent: Friday, June 25, 2004 3:21 PM To: Josh Close Subject: RE: [PHP] socket_set_block undefined That sounds about right :) After sending my first reply I realized it was the most likely reason, I can see why you went down the name could have changed track... I knew it wasn't the case as in PHP names were only changed to give proper names like socket_set_block as opposed to setsocketblock or whatever. Good luck :) Regards, Philip On Fri, 25 Jun 2004, Josh Close wrote: I'm installing a new version right now. I found there was two cli versions, when i typed /usr/bin/php -v i got version 4.1.2 so i'm reinstalling a new version. There was actually 3 versions of php on this box. how annoying. -Josh -Original Message- From: Philip Olson [mailto:[EMAIL PROTECTED] Sent: Friday, June 25, 2004 2:39 PM To: Josh Close Cc: PHP (E-mail) Subject: RE: [PHP] socket_set_block undefined Perhaps you have multiple PHP versions on your system? Like an old CLI or CGI laying around somewhere? Maybe try checking the PHP version in the code as well. If it's not that then I have no idea. Regards, Philip On Fri, 25 Jun 2004, Josh Close wrote: Well, here's the code i'm using. Let me know if I'm doing something silly. if(!socket_set_nonblock($this-socket)){ if($this-logging){ syslog(LOG_ERR, Could not set socket to nonblock.); } exit(); } //connection part goes here if(!socket_set_block($this-socket)){ if($this-logging){ syslog(LOG_ERR, Could not set socket to block.); } exit(); } if($this-loggging){ syslog(LOG_INFO, Socket set to block.); } and here's the error Fatal error: Call to undefined function: socket_set_block() -Josh -Original Message- From: Philip Olson [mailto:[EMAIL PROTECTED] Sent: Friday, June 25, 2004 2:11 PM To: Josh Close Cc: PHP (E-mail) Subject: Re: [PHP] socket_set_block undefined I'm trying to use socket_set_block and php.net says (php4 = 4.2, php5). I'm using version 4.3.1 but I get this error Fatal error: Call to undefined function: socket_set_block() in . Any idea why this is? Has the name changed or been something else? socket_set_nonblock() work fine. Strange as the name has not changed and the function requires nothing special (no IF block around it), here's the source: http://lxr.php.net/source/php-src/ext/sockets/sockets.c#715 Since socket_set_nonblock() exists you must have the socket extension available so this is odd. Are you sure this problem exists and it's not something silly? Seems like an impossible problem assuming your php source wasn't modified :) Regards, Philip -- 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] imagecopyresampled, GD
Hi there, I've looked in many places but have not found any clues on how to work around this problem. I'm using imagecopyresampled to resize an image and crop part of it at the same time. The area I need to crop, unfortunately, is sometimes a float, which leads to my problem. imagecopyresampled does not accept float values, and interpolate the images. (Well, technically it accepts them, but just converts them to an integer internally) The source image is 63x63 pixels ($rImg1). The destination image is 100x100 pixels ($rImg2). I want to resize $rImg1 to 100.611x100.611, and place the center 100x100 square in $rImg2. The theoretical imagecopyresampled call is below. imagecopyresampled($rImg2, $rImg1, -0.3055, -0.3055, 0, 0, 100.611, 100.611, 63, 63); I realize the above code is incorrect, but it seemed the best way to illustrate what I'm attempting to accomplish. Any help would be greatly appreciated, thanks! Chris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] word count on record insertion
Hi There, I'm trying to develop a band listing site and was just wondering if there is a php function that could limit the amount of words added into a text area. I'm aware that this can be done in javascript but the only one I found doesn't work properly if you try and paste in text to the text box. This was the script I was looking at: http://javascript.internet.com/forms/word-counter.html I want to have something similar to this but as mentioned above want something more reliable so does anyone know a php function to do this or have a better option? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] word count on record insertion
I want to have something similar to this but as mentioned above want something more reliable so does anyone know a php function to do this or have a better option? http://us3.php.net/manual/en/function.str-word-count.php, also some good suggestions in the user comments -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] imagecopyresampled, GD
Chris wrote --- napísal:: Hi there, I've looked in many places but have not found any clues on how to work around this problem. I'm using imagecopyresampled to resize an image and crop part of it at the same time. The area I need to crop, unfortunately, is sometimes a float, which leads to my problem. imagecopyresampled does not accept float values, and interpolate the images. (Well, technically it accepts them, but just converts them to an integer internally) The source image is 63x63 pixels ($rImg1). The destination image is 100x100 pixels ($rImg2). I want to resize $rImg1 to 100.611x100.611, and place the center 100x100 square in $rImg2. The theoretical imagecopyresampled call is below. imagecopyresampled($rImg2, $rImg1, -0.3055, -0.3055, 0, 0, 100.611, 100.611, 63, 63); I realize the above code is incorrect, but it seemed the best way to illustrate what I'm attempting to accomplish. Any help would be greatly appreciated, thanks! Chris One pixel is the smallest value in images. How do you want your resulting image to look like? You can resize the image to higher resolution, but you will need to create 100611x100611 pixel image, and that's one hell a lot of memory :) So, what are you trying to achieve? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] imagecopyresampled, GD
Marek Kilimajer wrote: Chris wrote --- napísal:: Hi there, I've looked in many places but have not found any clues on how to work around this problem. I'm using imagecopyresampled to resize an image and crop part of it at the same time. The area I need to crop, unfortunately, is sometimes a float, which leads to my problem. imagecopyresampled does not accept float values, and interpolate the images. (Well, technically it accepts them, but just converts them to an integer internally) The source image is 63x63 pixels ($rImg1). The destination image is 100x100 pixels ($rImg2). I want to resize $rImg1 to 100.611x100.611, and place the center 100x100 square in $rImg2. The theoretical imagecopyresampled call is below. imagecopyresampled($rImg2, $rImg1, -0.3055, -0.3055, 0, 0, 100.611, 100.611, 63, 63); I realize the above code is incorrect, but it seemed the best way to illustrate what I'm attempting to accomplish. Any help would be greatly appreciated, thanks! Chris One pixel is the smallest value in images. How do you want your resulting image to look like? You can resize the image to higher resolution, but you will need to create 100611x100611 pixel image, and that's one hell a lot of memory :) So, what are you trying to achieve? If I resized the image to 100,611x100,611, cropped it to 100,000, and then resized it to 100x100 it would achieve the effect I want. It's very difficult for me to explain, but I'll try. It's very similar to the interpolation done on the inner pixels. It's taking the values of all pixels that 'touch' the new pixel, and meshing them together, basically, shifting the pixels 0.3055 to the right would overlap old and new pixels partially. I'll try a grayscale example (it's a bit simpler). If a black pixel overlapped onto a white pixel, I would get the percentage of the white pixel it's covering, then combine that with the percentage of the white pixel not covered by the black pixel). So, if the black pixel was shifter over 0.4 pixels (40%) onto a white pixel I would calculate the new color : $iGrey = ($iBlack*0.40) + ($iWhite*0.60); If $iBlack and $iWhite contained the brightess value of a color it would look liek this: $iGrey = (0 * 0.40) + (255 * 0.60); $iGrey = 0 + 153; $iGrey = 153; If I was overlapping a White on to a black by 0.4 pixels: $iGrey = (255 * 0.40) + (0 * 0.60); $iGrey = 102 + 0; $iGrey = 102; or two differing shades of grey pixels: $iGrey = (18 * 0.40) + (97 * 0.60); $iGrey = 7.2 + 58.2; $iGrey = 65.4; $iGrey = 65; imagecopyresampled is already doing something similar when it's resampling an image to a size that is not a multiple of the old size. I know there are no fractional pixels in images, but when interpolating between two images, fractions of pixels must be taken into account. I hope I cleared things up... Chris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] string function that adds before and after
-Original Message- From: Gabe Sent: Friday, June 25, 2004, 9:06:15 PM Philip Olson wrote: There's a number of functions in PHP that will give me the position of the *first* instance of the matched string, but it doesn't look like the function would keep searching after the first match. Anyway, am I overlooking a function that already has the functionality that I'm searching for? Or does anyone have any ideas how I can accomplish this efficiently since my search strings can be quite long? try this preg_replace('/(weather)/i', strong$1/strong, 'This is the worst weather ever. Weather around here is terrible. ') Thanks Matt. I think that will do the trick. Let me see if I understand it correctly. the i will make the search case-INsensitive, and the parenthesis around weather will store what it finds in the variable $1? Is that right? Also consider str_replace() as it's faster albeit case sensitive. str_ireplace() exists in PHP 5. Just another option, I'm surprised you didn't find it when looking around strpos() and friends. Your assumptions above are correct, sorry Matt for stepping in! :) I prefer cold weather. Regards, Philip Thanks Philip. I did notice str_replace() but it didn't look like I could use it without it actually replacing what it found instead of just adding strings before and after it. Am I wrong? I'd say it will do the job just fine if case sensitivity is not an issue: $word = 'weather'; $new = str_replace($word, strong$word/strong, $phrase); ... speaks for itself ;) /rh -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] word count on record insertion
Did you try calling the word counter function in the onChange event of textbox and truncate the characters/words -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] MYSQL Query results in pages
No other way. Use one query to count the total record and then another query for limiting -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Handling Code Continuation
Hi everyone, I would like to know how to handle code breaks or code blocks that takes up more than two lines. For readability, I would like to know if there is something like the following: function input($type,$size,$name,$value) { return input type=\$type\ size=\$size\ value=\$value\ name=\$name\; } Thanks. -gohaku -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Handling Code Continuation
On Fri, 25 Jun 2004 22:13:03 -0400, gohaku [EMAIL PROTECTED] wrote: Hi everyone, I would like to know how to handle code breaks or code blocks that takes up more than two lines. For readability, I would like to know if there is something like the following: function input($type,$size,$name,$value) { return input type=\$type\ size=\$size\ value=\$value\ name=\$name\; } function input($type,$size,$name,$value) { return EOF input type=$type size=$size value=$value name=$name EOF; } -- Greg Donald http://destiney.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Handling Code Continuation
gohaku wrote --- napísal:: Hi everyone, I would like to know how to handle code breaks or code blocks that takes up more than two lines. For readability, I would like to know if there is something like the following: function input($type,$size,$name,$value) { return input type=\$type\ size=\$size\ value=\$value\ name=\$name\; } Thanks. -gohaku function input($type,$size,$name,$value) { return input type=\$type\ size=\$size\ value=\$value\ . name=\$name\; } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] malloc() failure - single function document
* Thus wrote Joe Lewis: The script works perfectly from the command line. It turns out to be related directly to Apache 2.0 and the handling of buckets. yeah, I was afraid of that, and I'm really at a loss with any suggestions as is, except for: Ideal solution: use apache 1.x Alternate solution: remove the package you have for php and compile it from the latest source (4.3.7). if the problem persists then enable the --enable-debug compile option in php's configure and submit a bug report at bugs.php.net. Curt -- First, let me assure you that this is not one of those shady pyramid schemes you've been hearing about. No, sir. Our model is the trapezoid! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Understanding behavior of 'directories below files'
Just to re-enforce Michael Sims, post... * Thus wrote KEVIN ZEMBOWER: I'm a system administrator who's dabbled a bit in PHP, but am not very experienced in it. My PHP developer came to me with a behavior which neither of us can understand. If you go to this URL, you'll get a broken version of the main home page on our site: http://www.hcpartnership.org/index.php/search . We can't understand this, because 'index.php' is a file, not a directory. (The correct web page is just at http://www.hcpartnership.org/index.php.) This behaviour has been around (cept for iis php) since way back in the CERN httpd days. traditionally this behaviour was only known within your cgi-bin directory. But since php is ran in your document root, the behaviour has changed. The original behaviour was to issue something like: /cgi-bin/script.cgi/path/to/some/random/thing And the CGI script would be passed two extra environment variables: PATH_INFO PATH_TRANSLATED PATH_INFO would contain the string after the name of the cgi being executed PATH_TRANSLATED would be DOCUMENT_ROOT/PATH_INFO. If you followed all that I said so far, the cgi application, with super ease, could check and read a file that actually existed in the normal html document tree. Which made writing C programs a lot more easier :) Here's another example: http://www.hcpartnership.org/path_test.php/search : does not generate a 404 error http://www.hcpartnership.org/path_test.html/search : generates a 404 error Apache is smart enough to determain the difference between a .html and php script. PHP simply inherits the traditional CGI environment, and an html simplyy can't do anything with PATH_INFO, so apache just decides to say 404. Can anyone explain to me why this is happening? Is this a danger? Can this be turned off? Is this controlled in the .php code, in the php.ini file or in the Apache configuration, or elsewhere? One quick fix, i could suggest but not recomend is to add an auto_prepend_file in php that checks for $_SERVER['PATH_INFO'] and will redirect to $_SERVER['PHP_SELF']. A better solution, on the other hand, would be just to make sure your html output behaves properly, aka not define a link that goes to /index.php/search. And the best solution, depending on how active and complex your site is, is to use the quick fix and have it alert you in some way, ie using error_log(), as to let you know that you need to fix some html somewhere. We didn't even know how to describe this problem well, so our searches of the archives of this mailing list and Google weren't successful. Let me know if we overlooked something. Thanks so much for your suggestions and thoughts. I just hope my thoughts and suggestions were clear enough :) And that I didn't go overboard. Curt -- First, let me assure you that this is not one of those shady pyramid schemes you've been hearing about. No, sir. Our model is the trapezoid! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] mail sent but not received?!
* Thus wrote Bing Du: $rev = mail($to,$sbj,$msg); echo mail from my.edu result is $rev; ? -- Since the result of the mail() returned is 1, the message should have been delivered fine. but I did not get anything. Where can I look for more Negative! $rev will simply let you know that your MTA (mail transfer agent) accepted your message. The MTA will attempt to deliver the message at its own will. clues of what the problem might be, like possible log, or turn on some debug level in php? I've also tried mail($to,$sbj,$msg, -f [EMAIL PROTECTED]), no workie either. if the mail was unsucessfully delivered, and [EMAIL PROTECTED] is a valid email then the email will get returned to [EMAIL PROTECTED] it gets more complicated than that but thats the jest of it. Any help would be greatly appreciated! If you have access to you're maillog's then view those. Curt -- First, let me assure you that this is not one of those shady pyramid schemes you've been hearing about. No, sir. Our model is the trapezoid! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How to force mod_php to load php.ini ?
* Thus wrote Nico Sabbi: Hi, is there a way configure mod_php4 (for apache) so as to be *absolutely* sure that it will always load all definitions in php.ini when apache starts up? Maybe with some directive in http.conf ? As far as I know, there isn't a php directive in apache to tell it which ini to load. Almost every time I reboot my pc apache and php start, but php is not running with /etc/php.ini, so I have to execute The php loading goes as follows: apache starts apche request from php to load php gets loaded using its compile path to locate php.ini (see output from phpinfo()) /etc/init.d/httpd restart You might want to evaluate your startup procedures to make sure it starting apache correctly. Curt -- First, let me assure you that this is not one of those shady pyramid schemes you've been hearing about. No, sir. Our model is the trapezoid! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] string function that adds before and after
* Thus wrote Richard Harb: -Original Message- From: Gabe Sent: Friday, June 25, 2004, 9:06:15 PM Philip Olson wrote: lots of ... I'd say it will do the job just fine if case sensitivity is not an issue: $word = 'weather'; $new = str_replace($word, strong$word/strong, $phrase); ... speaks for itself ;) I'm thinking to myself at this moment... style weather { font-weight: bold } /style It simply just would make the world a whole lot nicer :) Do note, this is not a valid css tag, just a simple dream of mine. Curt -- First, let me assure you that this is not one of those shady pyramid schemes you've been hearing about. No, sir. Our model is the trapezoid! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] image upload woes
* Thus wrote Edward Peloke: I have code which attempts to upload some files and create thumbnails. The same code on one server works ok, the same code on another server throws an error everytime I hit submit that says The document contains no data...it appears to be a javascript error. It is not an error that I am throwing. Has anyone ever had this problem? diff -u otherserver:/usr/local/lib/php.ini /usr/local/lib/php.ini WARNING: The information contained in this message and any attachments is intended only for the use of the individual or entity to which it is for some reason I'm always tempted to make some sort of comment here. Curt -- First, let me assure you that this is not one of those shady pyramid schemes you've been hearing about. No, sir. Our model is the trapezoid! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] socket_set_block undefined
* Thus wrote Josh Close: I want to get rid of the version on php in /urs/local, how do I do this? This can be a long story.. but basically in normal conditions if php is compiled with --prefix=/usr/local (by default) then you'll find the php binary in /usr/local/bin/php and stuff in /usr/local/lib/php* And then depending on what and how you compiled you're webserver, an extra library can be anywhere, usually decided by you're webserver's configuration There is no src to do a make uninstall from. I deleted some file/directories, but when I do php -v it's still looking for the version in /usr/local/bin instead of /usr/bin. php's installation can get complicated and if you're not in a controlled environment (aka a system package) you're going to have to uninstall php manually. You're 'php -v' issue can be easily solved by modifying your $PATH environment. look at `echo $PATH` Curt -- First, let me assure you that this is not one of those shady pyramid schemes you've been hearing about. No, sir. Our model is the trapezoid! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Handling Code Continuation
* Thus wrote gohaku: Hi everyone, I would like to know how to handle code breaks or code blocks that takes up more than two lines. you just might start a war of the gods here For readability, I would like to know if there is something like the following: function input($type,$size,$name,$value) { return input type=\$type\ size=\$size\ value=\$value\ name=\$name\; } In general practice, and depending on how much html you're outputing: function input($type,$size,$name,$value) { ?php input type=php echo $type? size=?php echo $size? value=?php echo $value? name=?php echo $name? } But on the other hand a different approach: $field = array( 'type' = $type, 'size' = $size, 'value' = $value, 'name' = $type, 'id'= $id, /* forgot this one :) */ ); echo 'input '; foreach($field as $name = $value ) { echo $name=\$value\ } echo ''; Curt -- First, let me assure you that this is not one of those shady pyramid schemes you've been hearing about. No, sir. Our model is the trapezoid! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] TIFF images
* Thus wrote Dan Joseph: ... I was using ImageMagick, however it took a multipage tiff and turned it into: 1.TIFF 1.JPG.0 1.JPG.1 1.JPG.2 1.JPG.3 Sometimes they are 1.JPG, sometimes only 2 pages, sometimes 10 pages. We've decided to go with a TIFF viewer plug-in, and just use those. I am using the follow PHP script to handle this: ? code ok... ? If the TIFF is a single pager, it works fine. If it's a multipager, I get an invalid file format error. I'm really at a loss as what to do. I'm willing to explore other solutions to display the TIFF images also. Can anyone please help? I'm not familiar with TIFF (nor ie plugin) and these paging things in .jpg, but the first question that comes to mind is, what exactly is telling you that its an invalid format? Curt -- First, let me assure you that this is not one of those shady pyramid schemes you've been hearing about. No, sir. Our model is the trapezoid! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] imagecopyresampled, GD
* Thus wrote Chris: Marek Kilimajer wrote: Chris wrote --- napísal:: Hi there, I've looked in many places but have not found any clues on how to work around this problem. I'm using imagecopyresampled to resize an image and crop part of it at the same time. The area I need to crop, unfortunately, is sometimes a float, which leads to my problem. imagecopyresampled does not accept float values, and interpolate the images. (Well, technically it accepts them, but just converts them to an integer internally) The source image is 63x63 pixels ($rImg1). The destination image is 100x100 pixels ($rImg2). ... So, what are you trying to achieve? If I resized the image to 100,611x100,611, cropped it to 100,000, and then resized it to 100x100 it would achieve the effect I want. It's very difficult for me to explain, but I'll try. It's very similar to the interpolation done on the inner pixels. It's taking the values of all pixels that 'touch' the new pixel, and meshing them together, basically, shifting the pixels 0.3055 to the right would overlap old and new pixels partially. I'll try a grayscale example (it's a bit simpler). Woah.. that way to much math for my brain at the moment :) If I understand the situation properly you need to take a smaller image and make it the boundary for the larger image?? I might suggest looking at imagick, it is a bit more friendlier with image manipulation: http://pecl.php.net/package/imagick Curt -- First, let me assure you that this is not one of those shady pyramid schemes you've been hearing about. No, sir. Our model is the trapezoid! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php