Re: [PHP] Need help with line breaks in a textarea form
PHP User wrote: Hi, I have been trying to format the textarea output and have come across some code that almost does what I need, but I still have one small problem. Look at the text below that was input into my textarea: Now is the time for all young men to come to the aid of the party. Now is the time for all young men to come to the aid of the party. Testing Now is the time for all young men to come to the aid of the party. Now is the time for all young men to come to the aid of the party. Testing. When I print this out to my webpage it has a line break before and after the word Testing. I want it to be a wysiwyg - so in the case above there should be no extra line breaks. It should look exactly as typed. The code I tried to change the \n to BR are: $text2= nl2br ($text); or $text2 str_replace(\n,br,$text); This is what I have in my form. textarea rows=10 cols=51 name=texttextarea textarea rows=10 cols=51 name=text?=htmlentities($text2)?/textarea -- ---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
Re: [PHP] track click throughs
Ed, Thank you found it with your help. Cheers Col Ed Lazor [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Check the script that records the click. It shouldn't have any output, spaces, or extra lines before or after ?php ? -Original Message- From: cab [mailto:[EMAIL PROTECTED] Sent: Thursday, July 15, 2004 9:39 PM To: [EMAIL PROTECTED] Subject: [PHP] track click throughs Hi, newbie question I have a linked image, I want to track the users/times the image has been clicked. I've set up another .php page that populates a database with the click, then I wanted to: Header(Location: http://someothersite ); but I get the lovely Headers already set error message. Any suggestions please? Locations of tutorials on this sort of thing. Col -- 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] track click throughs
Ed, Sorry it redirects now but on checking the database is no longer being updated? ?php require_once('/home/virtual/site/var/www/cgi-bin/Connections/DB_connection _script.php'); $newUserTracking = mysql_query(INSERT INTO track (user,type) VALUES (' ','Join')); Header(Location: https://secure.ibill.com/cgi-win/ccard/rscookie.exe?RevShareID=what everreturnto=http://www.google.com/index.htm;); ? Help Col Ed Lazor [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Check the script that records the click. It shouldn't have any output, spaces, or extra lines before or after ?php ? -Original Message- From: cab [mailto:[EMAIL PROTECTED] Sent: Thursday, July 15, 2004 9:39 PM To: [EMAIL PROTECTED] Subject: [PHP] track click throughs Hi, newbie question I have a linked image, I want to track the users/times the image has been clicked. I've set up another .php page that populates a database with the click, then I wanted to: Header(Location: http://someothersite ); but I get the lovely Headers already set error message. Any suggestions please? Locations of tutorials on this sort of thing. Col -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Using SSL and PHP
Hi everyone. We've recently decided to move all our PHP pages to an SSL server. Can anyone give any advice on any caveats I should be aware of...? -- - Michael Mason Arras People www.arraspeople.co.uk - -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Using SSL and PHP
You add an S to http ;) Beyond that, some servers allow one webspace for your files and encryption is based on whether you specify the S or not. Some servers have separate directories for http and https files. -Original Message- Hi everyone. We've recently decided to move all our PHP pages to an SSL server. Can anyone give any advice on any caveats I should be aware of...? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] How To capture WebCam
Hi everyone Is there any body woh knows how to capture web cam in php i need some tutorial / code that helps me in this regard.waiting for soon reply Thanks Khuram __ Do you Yahoo!? New and Improved Yahoo! Mail - 100MB free storage! http://promotions.yahoo.com/new_mail -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] track click throughs
mysql_query() should return a boolean true if your insert-query works. Check that. [code] print (mysql_query('insert bla...')) ? '(-:' : ')-:'; die(); [/code] Cab wrote: Ed, Sorry it redirects now but on checking the database is no longer being updated? ?php require_once('/home/virtual/site/var/www/cgi-bin/Connections/DB_connection _script.php'); $newUserTracking = mysql_query(INSERT INTO track (user,type) VALUES (' ','Join')); Header(Location: https://secure.ibill.com/cgi-win/ccard/rscookie.exe?RevShareID=what everreturnto=http://www.google.com/index.htm;); ? Help Col Ed Lazor [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Check the script that records the click. It shouldn't have any output, spaces, or extra lines before or after ?php ? -Original Message- From: cab [mailto:[EMAIL PROTECTED] Sent: Thursday, July 15, 2004 9:39 PM To: [EMAIL PROTECTED] Subject: [PHP] track click throughs Hi, newbie question I have a linked image, I want to track the users/times the image has been clicked. I've set up another .php page that populates a database with the click, then I wanted to: Header(Location: http://someothersite ); but I get the lovely Headers already set error message. Any suggestions please? Locations of tutorials on this sort of thing. Col -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- WWE e-commerce IT GmbH Eiffestrasse 462, D-20537 Hamburg Tel.: +49-40-2530659-0, Fax: +49-40-2530659-50 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Trouble with include/require
Hi list, i'm trying to include files in my php scripts but things seem not to work properly. In my script, i include a file like this: ?php include 'includes/db.inc' ? I have all include files in includes directory, that's a children of the directory where my scrips are. The include_path config. variable is set like this: include_path = .:/php/includes (i have uncommented that line) PHP does not include my files. What i am doing wrong? Thanks AL -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] image
Php wrote: like i call an image if the img tag but instead of loading the image it loads a php script did you send the mime-type header first? Something like: header(Content-Type: image/png); Then you can do an include of the image or something like that. Jason Wong [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] On Friday 16 July 2004 08:06, php wrote: how do you catch an image request and instead of the image display php? Please elaborate. -- 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 -- /* Neil Armstrong tripped. */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] problem including images in safe_mode
Jason Wong wrote: On Thursday 15 July 2004 23:30, Frank Holtschke wrote: Even if you could prevent an included file from being parsed, I can't see how it would help you as you can't assign the contents to a variable. But you say that you sometimes have problems which implies that sometimes it works. Could you explain how it works? We just flush it on the display. the php-script is an image src like img src=showImage.php That's interesting. The showImage.php does an include of the image which is located out of the DocumentRoot. The image is generated by a cron script. Mostly it works but sometimes we have the problem described above. And anyway why are your images in safe_mode_include_dir in the first place? Cause php-scripts (owned by different uids = therefore the safe_mode_include_dir ) of various virtual servers make use of the image. Several suggestions: 1) If the various virtual servers have no need to perform file operations anywhere else then you may get away with setting open_basedir appropriately. 2) Use the safe_mode_gid switch. 3) If cronjob is owned by root then have it create images for each of the virtual servers and set permissions accordingly. thanks for your suggestions. We think about a very simple solution. Just changing the parser-identifier from '?' to '?php' by setting the short_open_tag=Off in the php.ini . The probability of the substring '?php' in the image-stream seems to be very low. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Trouble with include/require
You should not overwrite the whole include-path. Just append new paths. This should do: [code] // Expand include-path (';' on Windows) $sep = ('WIN' == substr(PHP_OS, 0, 3)) ? ';' : ':'; ini_set('include_path', ini_get('include_path') . $sep . dirname(__FILE__) . 'includes/'); [/code] Daniel A. Lanza wrote: Hi list, i'm trying to include files in my php scripts but things seem not to work properly. In my script, i include a file like this: ?php include 'includes/db.inc' ? I have all include files in includes directory, that's a children of the directory where my scrips are. The include_path config. variable is set like this: include_path = .:/php/includes (i have uncommented that line) PHP does not include my files. What i am doing wrong? Thanks AL -- WWE e-commerce IT GmbH Eiffestrasse 462, D-20537 Hamburg Tel.: +49-40-2530659-0, Fax: +49-40-2530659-50 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Trouble with include/require
In fact, i'm not changing the include_path in my code, just uncommented the line in php.ini configuration file. Do i have to set include_path in code? Where in code should i put that piece of code setting include_path? Is there any simple way to include files using relative paths from the ones where main scripts are? I have /var/www/html/project, where i put my scripts. includes directory is under that path. I want to put all my include files in there. I guessed that including files like this, include 'includes/db.inc', would work, since include_path is set to . in php.ini, but it does not. Any help? On Fri, 2004-07-16 at 10:35, Daniel Kullik wrote: You should not overwrite the whole include-path. Just append new paths. This should do: [code] // Expand include-path (';' on Windows) $sep = ('WIN' == substr(PHP_OS, 0, 3)) ? ';' : ':'; ini_set('include_path', ini_get('include_path') . $sep . dirname(__FILE__) . 'includes/'); [/code] Daniel A. Lanza wrote: Hi list, i'm trying to include files in my php scripts but things seem not to work properly. In my script, i include a file like this: ?php include 'includes/db.inc' ? I have all include files in includes directory, that's a children of the directory where my scrips are. The include_path config. variable is set like this: include_path = .:/php/includes (i have uncommented that line) PHP does not include my files. What i am doing wrong? Thanks AL -- WWE e-commerce IT GmbH Eiffestrasse 462, D-20537 Hamburg Tel.: +49-40-2530659-0, Fax: +49-40-2530659-50 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Trouble with include/require
Does your PHP-interpreter parse .inc files at all? Did you get any error-messages? If not, set your error-reporting level to E_ALL any force PHP to display errors on screen. [code] error_reporting(E_ALL); ini_set('display_errors', true); [/code] Place this code before your include() call. PHP should print out an error-message if it fails to include a file. A. Lanza wrote: In fact, i'm not changing the include_path in my code, just uncommented the line in php.ini configuration file. Do i have to set include_path in code? Where in code should i put that piece of code setting include_path? Is there any simple way to include files using relative paths from the ones where main scripts are? I have /var/www/html/project, where i put my scripts. includes directory is under that path. I want to put all my include files in there. I guessed that including files like this, include 'includes/db.inc', would work, since include_path is set to . in php.ini, but it does not. Any help? On Fri, 2004-07-16 at 10:35, Daniel Kullik wrote: You should not overwrite the whole include-path. Just append new paths. This should do: [code] // Expand include-path (';' on Windows) $sep = ('WIN' == substr(PHP_OS, 0, 3)) ? ';' : ':'; ini_set('include_path', ini_get('include_path') . $sep . dirname(__FILE__) . 'includes/'); [/code] Daniel A. Lanza wrote: Hi list, i'm trying to include files in my php scripts but things seem not to work properly. In my script, i include a file like this: ?php include 'includes/db.inc' ? I have all include files in includes directory, that's a children of the directory where my scrips are. The include_path config. variable is set like this: include_path = .:/php/includes (i have uncommented that line) PHP does not include my files. What i am doing wrong? Thanks AL -- WWE e-commerce IT GmbH Eiffestrasse 462, D-20537 Hamburg Tel.: +49-40-2530659-0, Fax: +49-40-2530659-50 -- WWE e-commerce IT GmbH Eiffestrasse 462, D-20537 Hamburg Tel.: +49-40-2530659-0, Fax: +49-40-2530659-50 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Getting the primary key from a MySQL insert
If the primary key in a MySQL DB is an autoincrementing integer, is there anyway of automatically getting it back when I do an insert in PHP. In other words taking the status returned by mysql_query and extracting the PK of the record we just entered? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Getting the primary key from a MySQL insert
Here you can find an overview of all existing MySQL functions in PHP: http://www.php.net/mysql And this is the function you are looking for: http://www.php.net/manual/en/function.mysql-insert-id.php And please take your time to look at this posting: http://marc.theaimsgroup.com/?l=php-generalm=108986762507986w=2 Daniel Andrew Wood wrote: If the primary key in a MySQL DB is an autoincrementing integer, is there anyway of automatically getting it back when I do an insert in PHP. In other words taking the status returned by mysql_query and extracting the PK of the record we just entered? -- WWE e-commerce IT GmbH Eiffestrasse 462, D-20537 Hamburg Tel.: +49-40-2530659-0, Fax: +49-40-2530659-50 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Getting the primary key from a MySQL insert
Thanks. When it says 'the last insert' is that just the last insert my PHP script did, or the last insert on the DB as a whole? On 16 Jul 2004, at 11:40, [EMAIL PROTECTED] wrote: If the primary key in a MySQL DB is an autoincrementing integer, is there anyway of automatically getting it back when I do an insert in PHP. In other words taking the status returned by mysql_query and extracting the PK of the record we just entered? int mysql_insert_id ([resource link-id]) returns the key from the most recent INSERT statement or 0 if there's no auto-increment field. At last, a question I can answer :-) HTH J -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Getting the primary key from a MySQL insert
Andrew Wood wrote: Thanks. When it says 'the last insert' is that just the last insert my PHP script did, or the last insert on the DB as a whole? Read the links Daniel just sent out. -- ---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: PHP and MySQL Installation on Apache for Windows
PHP doesn't detect anything. You need to have your mysql server running and you try with mysql_connect() or mysql_pconnect() to see if you can connect to the server Sean Vasey [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Does anyone know how to get PHP to detect MySQL after it has been installed and is running on an Apache 1.3.1 server for Windows? Any help would be greatly appreciated. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Dynamic to Static
Ed Lazor [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Is anyone taking a dynamic PHP / MySQL site and storing or cacheing it statically in order for pages to display more quickly when visitors access the site? If so, what solutions are you using to achieve this? well, mysql query result cacheing is great preformance booster, and so is any kind of php accellerator )which basically cache compiled byte codes). Often turning on html compression has great effect on performance. As for application level cacheing, if needed, I cache parts of the page that repeat often menues, toolbars, articles, and store resulting html for them in db, so that the do not need to be recalculated each time page is displayed. (I use TT support for cacheing). rush -- http://www.templatetamer.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Trouble with include/require
Still i cannot place my include files in a directory other than the same as my main scripts... I have scripts in /var/www/html/project/ directory. I would like to put the include files in /var/www/html/project/includes. How should i include them in the main scripts? I've tried the two following ways, 1. include 'includes/file.inc'; 2. ini_set('include_path', './includes'); include 'file.inc'; but neither of them have worked. Any help? On Fri, 2004-07-16 at 11:30, Daniel Kullik wrote: Does your PHP-interpreter parse .inc files at all? Did you get any error-messages? If not, set your error-reporting level to E_ALL any force PHP to display errors on screen. [code] error_reporting(E_ALL); ini_set('display_errors', true); [/code] Place this code before your include() call. PHP should print out an error-message if it fails to include a file. A. Lanza wrote: In fact, i'm not changing the include_path in my code, just uncommented the line in php.ini configuration file. Do i have to set include_path in code? Where in code should i put that piece of code setting include_path? Is there any simple way to include files using relative paths from the ones where main scripts are? I have /var/www/html/project, where i put my scripts. includes directory is under that path. I want to put all my include files in there. I guessed that including files like this, include 'includes/db.inc', would work, since include_path is set to . in php.ini, but it does not. Any help? On Fri, 2004-07-16 at 10:35, Daniel Kullik wrote: You should not overwrite the whole include-path. Just append new paths. This should do: [code] // Expand include-path (';' on Windows) $sep = ('WIN' == substr(PHP_OS, 0, 3)) ? ';' : ':'; ini_set('include_path', ini_get('include_path') . $sep . dirname(__FILE__) . 'includes/'); [/code] Daniel A. Lanza wrote: Hi list, i'm trying to include files in my php scripts but things seem not to work properly. In my script, i include a file like this: ?php include 'includes/db.inc' ? I have all include files in includes directory, that's a children of the directory where my scrips are. The include_path config. variable is set like this: include_path = .:/php/includes (i have uncommented that line) PHP does not include my files. What i am doing wrong? Thanks AL -- WWE e-commerce IT GmbH Eiffestrasse 462, D-20537 Hamburg Tel.: +49-40-2530659-0, Fax: +49-40-2530659-50 -- WWE e-commerce IT GmbH Eiffestrasse 462, D-20537 Hamburg Tel.: +49-40-2530659-0, Fax: +49-40-2530659-50 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Encrypting passwords from page to page -mcrypt question
Why don't you try POST instead of GET? This way the password will not be visible in the URL. Scott Taylor [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] I would like to go from page to page, submitting the password through a GET query string. Of course I wouldn't want to do this unencrypted. So is mcrypt the best option? When submitting the data, would I also need to sumit the IV as well as the encrypted data? Or am I completely off base with this one? Should I also base64_encode() this data when passing it? Scott Taylor -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] flash to image using PHP
Is it possible to convert a swf file(static, no animation) to an image format(jpeg or png preferably) using PHP? I have a flash script which chooses the colors for a logo and saves it a swf file and I need to transform it in an image file so I could I use it in a PDF file -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Checking for character absence with regular expressions
Hi List I am currently trying to check for the absence of certain substrings within larger strings using regular expressions. I know that I could use on of the string functions, but in the interests of flexibility I must use a regexp match of some shape or variety. Up until now, I have used PHP's POSIX functions, but if someone has a solution for PCRE, I will use that as well. An example of my problem: I need to check that the substring R (that's a space followed by an uppercase R) is not contained within my haystack. E.g. Whatever pattern I match, if I match it against the following haystacks: Blah Blah R 99.99 or Blah Blah R99.99 it should return negative (i.e. the substring is contained within the haystack) while Blah Blah 99.99CR should return positive (i.e. the substring is not within the haystack). I have RTFM, RTFA, STFW and perhaps I am not phraseing my search terms correctly, as I am having no luck. Can anyone suggest a solution? Rory McKinley Nebula Solutions +27 21 555 3227 - office +27 21 551 0676 - fax +27 82 857 2391 - mobile www.nebula.co.za This e-mail is intended only for the person to whom it is addressed and may contain confidential information which may be legally privileged. Nebula Solutions accepts no liability for any loss, expense or damage arising from this e-mail and/or any attachments. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: mysql connection question
John Meyer [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hi, For a long time, on all of my mysql pages, I've done something like this $conn = mysql_connect($server,$username,$password) or die(Could not connect) mysql_select_db($db); I've finally put that into its own script file, moved it to my include files, and simply included it whereever I needed a connection. My question is, could this get me into trouble if multiple people access the database at the same time? Including it is no different to placing it directly into your code. So there will be no difference. Regards, Torsten Roehr -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Most used oop pattern to use for php application development?
Brent Clements [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Good Evening All, I know this will probably start a flame war, but I want to get everyone's opinion on which oop pattern is either the accepted pattern or most used pattern for php application. I'm pretty partial to MVC but it has it's benefits and drawbacks. What does everyone else use? Hopefully my question will start some meaningful conversation. Unless of course I'm asking a redundant question and this has already been answered. Excuse my redundancy if it has. Have a great night everyone! Brent Hi Brent, you can use more than one pattern within an application (Singleton, Decorater etc.) so maybe you have to change your question ;) Here's some good resource on the topic: http://www.phppatterns.com/ Regards, Torsten Roehr -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Want to save png to file
2004-07-08 kl. 06.25 skrev Wudi: int imagepng ( resource image [, string filename]) Back on track again! What I don't know is how to save the file - do I read the datastream from imagepng and then create a file and write the stream to it? Sincerely Victor -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Trouble with include/require
Using chmod 710 on your include-directroy and chmod 640 on your scripts might solve your file-permission problem. A. Lanza wrote: Still i cannot place my include files in a directory other than the same as my main scripts... I have scripts in /var/www/html/project/ directory. I would like to put the include files in /var/www/html/project/includes. How should i include them in the main scripts? I've tried the two following ways, 1. include 'includes/file.inc'; 2. ini_set('include_path', './includes'); include 'file.inc'; but neither of them have worked. Any help? On Fri, 2004-07-16 at 11:30, Daniel Kullik wrote: Does your PHP-interpreter parse .inc files at all? Did you get any error-messages? If not, set your error-reporting level to E_ALL any force PHP to display errors on screen. [code] error_reporting(E_ALL); ini_set('display_errors', true); [/code] Place this code before your include() call. PHP should print out an error-message if it fails to include a file. A. Lanza wrote: In fact, i'm not changing the include_path in my code, just uncommented the line in php.ini configuration file. Do i have to set include_path in code? Where in code should i put that piece of code setting include_path? Is there any simple way to include files using relative paths from the ones where main scripts are? I have /var/www/html/project, where i put my scripts. includes directory is under that path. I want to put all my include files in there. I guessed that including files like this, include 'includes/db.inc', would work, since include_path is set to . in php.ini, but it does not. Any help? On Fri, 2004-07-16 at 10:35, Daniel Kullik wrote: You should not overwrite the whole include-path. Just append new paths. This should do: [code] // Expand include-path (';' on Windows) $sep = ('WIN' == substr(PHP_OS, 0, 3)) ? ';' : ':'; ini_set('include_path', ini_get('include_path') . $sep . dirname(__FILE__) . 'includes/'); [/code] Daniel A. Lanza wrote: Hi list, i'm trying to include files in my php scripts but things seem not to work properly. In my script, i include a file like this: ?php include 'includes/db.inc' ? I have all include files in includes directory, that's a children of the directory where my scrips are. The include_path config. variable is set like this: include_path = .:/php/includes (i have uncommented that line) PHP does not include my files. What i am doing wrong? Thanks AL -- WWE e-commerce IT GmbH Eiffestrasse 462, D-20537 Hamburg Tel.: +49-40-2530659-0, Fax: +49-40-2530659-50 -- WWE e-commerce IT GmbH Eiffestrasse 462, D-20537 Hamburg Tel.: +49-40-2530659-0, Fax: +49-40-2530659-50 -- WWE e-commerce IT GmbH Eiffestrasse 462, D-20537 Hamburg Tel.: +49-40-2530659-0, Fax: +49-40-2530659-50 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Got JavaScript error when using PHP's include()...
It doesn't matter where because the webpage is loading, the JavaScript is not running while loading. It only run when the user click on the pop-up window. It worked fine if I use HTML/JavaScript only. Just that it doesn't work when I use PHP. FletchSOD Neal Owen [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] You defined jsTest after the include where it should be before. On Thu, 2004-07-15 at 16:24, Scott Fletcher wrote: When an include file contain plain JavaScript codes, with the echo command before and after the include file. I get the javascript error saying undefined jsTest... Anyone know why is that? --snip-- echo tabletrtd/td/tr/table; echo script type='text/javascript'; include('test.inc'); echo var jsTest = 0; ; echo /script; echo forminput type='button/form; --snip-- Let's say the script in the test.inc contain --snip-- function test() { if (jsTest != 0) { //blah blah balh... } } --snip-- Thanks, FletchSOD -- Neal Owen | IT Programmer Marketing Resources, Inc. Main : 312.238.8923 x1218 Direct : 630.592.3118 [EMAIL PROTECTED] | http://www.mrichi.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Want to save png to file
On Friday 16 July 2004 20:41, Victor Spång Arthursson wrote: 2004-07-08 kl. 06.25 skrev Wudi: int imagepng ( resource image [, string filename]) Back on track again! What I don't know is how to save the file - do I read the datastream from imagepng and then create a file and write the stream to it? If you already have an image resource then calling imagepng() with a filename will create and write the file for you. -- 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 -- /* IBM's original motto: Cogito ergo vendo; vendo ergo sum. */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Got JavaScript error when using PHP's include()...
Okay, I still get this same error when I move the jsTest to before the function FletchSOD Neal Owen [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] You defined jsTest after the include where it should be before. On Thu, 2004-07-15 at 16:24, Scott Fletcher wrote: When an include file contain plain JavaScript codes, with the echo command before and after the include file. I get the javascript error saying undefined jsTest... Anyone know why is that? --snip-- echo tabletrtd/td/tr/table; echo script type='text/javascript'; include('test.inc'); echo var jsTest = 0; ; echo /script; echo forminput type='button/form; --snip-- Let's say the script in the test.inc contain --snip-- function test() { if (jsTest != 0) { //blah blah balh... } } --snip-- Thanks, FletchSOD -- Neal Owen | IT Programmer Marketing Resources, Inc. Main : 312.238.8923 x1218 Direct : 630.592.3118 [EMAIL PROTECTED] | http://www.mrichi.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Got JavaScript error when using PHP's include()...
Oh never mind... I looked up at http://us3.php.net/manual/en/function.include.php and saw this... --snip-- When a file is included, parsing drops out of PHP mode and into HTML mode at the beginning of the target file, and resumes again at the end. For this reason, any code inside the target file which should be executed as PHP code must be enclosed within valid PHP start and end tags. --snip-- So by moving those over to PHP like this solve my problem... --snip-- ? echo script type='text/javascript'; blah blah ? --snip-- FletchSOD Neal Owen [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] You defined jsTest after the include where it should be before. On Thu, 2004-07-15 at 16:24, Scott Fletcher wrote: When an include file contain plain JavaScript codes, with the echo command before and after the include file. I get the javascript error saying undefined jsTest... Anyone know why is that? --snip-- echo tabletrtd/td/tr/table; echo script type='text/javascript'; include('test.inc'); echo var jsTest = 0; ; echo /script; echo forminput type='button/form; --snip-- Let's say the script in the test.inc contain --snip-- function test() { if (jsTest != 0) { //blah blah balh... } } --snip-- Thanks, FletchSOD -- Neal Owen | IT Programmer Marketing Resources, Inc. Main : 312.238.8923 x1218 Direct : 630.592.3118 [EMAIL PROTECTED] | http://www.mrichi.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: including external C header files and libraries
Jeremy Booker wrote: I have a 3rd party SDK written in C. It includes a compiled .a file and a header file (.h). Is there any way that I can call the functions included in the SDK from within a php script? Regards, Jeremy Yes you can extend the Zend engine. You'll need to write an extension wrapper and build the extension into PHP - it can be as easy as that for procedural coding. You may also want to register settings for php.ini and/or some globals (i.e. global in PHP). If you want object-oriented access to your SDK then that's another can of worms. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: How to tell if the file is already locked with flock()???
Scott Fletcher wrote: Hi! How do we tell if the file is already locked when someone use a flock() on the file?? FletchSOD Do you mean within PHP code? If that's the case then this is taken care of by the flock() function... it checks the file's status and based on the parameter(s) that you use it will give you access or not. I believe that if another script tries to access the file but doesn't try to flock() it then they can simply do whatever they want with the file (someone correct me here if I'm wrong). -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: How To capture WebCam
Please search google for tutorials, you can often find them when you use the right keywords. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Need help with line breaks in a textarea form
Thanks for the info John, but your suggestion produces the same output. Look at the source below to see what it produces. Now is the time for all young men to come to the aid of the party. Now is the time for all young men to come to the aid of the party.br / brbr / brTestingbr / brbr / brNow is the time for all young men to come to the aid of the party. Now is the time for all young men to come to the aid of the party.br / brbr / brTesting After 'party' and 'Testing' I hit enter twice, but as you can see above it adds a 3rd and 4th br... Suggestions? Thanks -Original Message- From: John W. Holmes [mailto:[EMAIL PROTECTED] Sent: July 16, 2004 2:00 AM To: PHP User Cc: PHP Subject: Re: [PHP] Need help with line breaks in a textarea form PHP User wrote: Hi, I have been trying to format the textarea output and have come across some code that almost does what I need, but I still have one small problem. Look at the text below that was input into my textarea: Now is the time for all young men to come to the aid of the party. Now is the time for all young men to come to the aid of the party. Testing Now is the time for all young men to come to the aid of the party. Now is the time for all young men to come to the aid of the party. Testing. When I print this out to my webpage it has a line break before and after the word Testing. I want it to be a wysiwyg - so in the case above there should be no extra line breaks. It should look exactly as typed. The code I tried to change the \n to BR are: $text2= nl2br ($text); or $text2 str_replace(\n,br,$text); This is what I have in my form. textarea rows=10 cols=51 name=texttextarea textarea rows=10 cols=51 name=text?=htmlentities($text2)?/textarea -- ---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
Re: [PHP] Got JavaScript error when using PHP's include()...
* Thus wrote Scott Fletcher: When an include file contain plain JavaScript codes, with the echo command before and after the include file. I get the javascript error saying undefined jsTest... Anyone know why is that? With the information you've provided, jsTest is never accessed. So its impossible for that error to occur. 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] Re: Embedded Email Directives
Hello, On 07/15/2004 10:25 PM, Jordi Canals wrote: Dennis Gearon wrote: remove carriage returns to prevent embedded email directives In an other thread, I readed that sentence. I'm interested to find more information about that. I have some mail forms and want to make them as secure and possible, but do not know about what and where should I filter. Should I filter all CR and LF Just in headers or also I should do that in the message body? (Which is sent in the SMTP DATA section). For SMTP, all lines should be ended with CR+LF, or else messages may be discarded by spam filters or other programs. However, if you use the mail() function it may do some filtering on its own. Anyway, you may want to take a look at this SMTP class to check how it filters message lines sent by SMTP: http://www.phpclasses.org/smtpclass -- Regards, Manuel Lemos PHP Classes - Free ready to use OOP components written in PHP http://www.phpclasses.org/ PHP Reviews - Reviews of PHP books and other products http://www.phpclasses.org/reviews/ Metastorage - Data object relational mapping layer generator http://www.meta-language.net/metastorage.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Need help with line breaks in a textarea form
John, Something came to mind as soon as I sent my last email, and it seems to work. Not sure it will work in every circumstance but the few tests I tried seemed ok. This is what I did. I added the two following lines to my script. $text=str_replace(\n,br,$text); $text=str_replace(br /,,$text); Thanks for your input CR -Original Message- From: John W. Holmes [mailto:[EMAIL PROTECTED] Sent: July 16, 2004 2:00 AM To: PHP User Cc: PHP Subject: Re: [PHP] Need help with line breaks in a textarea form PHP User wrote: Hi, I have been trying to format the textarea output and have come across some code that almost does what I need, but I still have one small problem. Look at the text below that was input into my textarea: Now is the time for all young men to come to the aid of the party. Now is the time for all young men to come to the aid of the party. Testing Now is the time for all young men to come to the aid of the party. Now is the time for all young men to come to the aid of the party. Testing. When I print this out to my webpage it has a line break before and after the word Testing. I want it to be a wysiwyg - so in the case above there should be no extra line breaks. It should look exactly as typed. The code I tried to change the \n to BR are: $text2= nl2br ($text); or $text2 str_replace(\n,br,$text); This is what I have in my form. textarea rows=10 cols=51 name=texttextarea textarea rows=10 cols=51 name=text?=htmlentities($text2)?/textarea -- ---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
Re: [PHP] Re: Trouble with include/require
* Thus wrote A. Lanza: In fact, i'm not changing the include_path in my code, just uncommented the line in php.ini configuration file. Do i have to set include_path in code? Where in code should i put that piece of code setting include_path? Is there any simple way to include files using relative paths from the ones where main scripts are? I have /var/www/html/project, where i put my scripts. includes directory is under that path. I want to put all my include files in there. I guessed that including files like this, include 'includes/db.inc', would work, since include_path is set to . in php.ini, but it does not. From my understanding you have: php.ini:include_path = .:/php/includes; The scripts you want to include are located in: /var/www/html/project/includes All you have to do is set your include_path in php.ini: include_path = /var/www/html/project/includes:.:/php/includes; restart webserver. Then to include the file you want, include it relative to the include_path: include('db.inc'); That will try and find a file in these locations in order: /var/www/html/projects/include/db.inc ./db.inc /php/includes/db.inc And will use the first one found. I would not suggest using ini_set() inside you're scripts to adjust your paths. 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] Re: problem with super global '$_REQUEST'
It does. ;-) I was just throwing out an interesting piece of code. Honestly, I'm surprised that it doesn't segfault PHP. Good job, internals! On Thu, 15 Jul 2004 21:02:10 -0700, Dennis Gearon [EMAIL PROTECTED] wrote: I bet it would work, 'cause whenever $GLOBALS is 'print_r'd, Globals shows up and a 'recursion note' ends the execution of 'print_r'. Justin Patrin wrote: You *can* unset it, you just have to unset the place where it really sits. When you have a global in a function, then unset it, you only disconnect the variable. unset doesn't destroy a variable, it just breaks the reference. As I said in my earlier e-mail, using this *will* work (I tested it): unset($GLOBALS['_REQUEST']); $GLOBALS is itself a superglobal.hmmm, wonder what would happen if you unset($GLOBALS['GLOBALS']) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php !DSPAM:40f75144237587900317931! -- DB_DataObject_FormBuilder - The database at your fingertips http://pear.php.net/package/DB_DataObject_FormBuilder paperCrane --Justin Patrin-- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] SNMP traps generation
Hi all, does anybody know any good library (class|script) for generating SNMP traps wirtten in PHP? thanks in advance, A. *** Alessandro Vitale Jr. Software Engineer Tiscali International Network Spa +39 070 4601678 [EMAIL PROTECTED] *** -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Checking for character absence with regular expressions
I need to check that the substring R (that's a space followed by an uppercase R) is not contained within my haystack. Just one way to do it: $strings[] = 'Blah Blah R 99.99'; $strings[] = 'Blah Blah R99.99'; $strings[] = 'Blah Blah 99.99CR'; foreach($strings as $value) { if (preg_match('/\sR/', $value)) { echo 'A match was found in '.$value.'br /'; } else { echo 'A match was not found '.$value.'br /'; } } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Most used oop pattern to use for php application development?
On Thu, 15 Jul 2004 23:57:59 -0500, Brent Clements [EMAIL PROTECTED] wrote: Good Evening All, I know this will probably start a flame war, but I want to get everyone's opinion on which oop pattern is either the accepted pattern or most used pattern for php application. I'm pretty partial to MVC but it has it's benefits and drawbacks. What does everyone else use? Hopefully my question will start some meaningful conversation. Unless of course I'm asking a redundant question and this has already been answered. Excuse my redundancy if it has. Many PHP developers use the MVC pattern (sometimes loosely) when developing applications. I find it very useful in my larger applications. For small things, my view and controller tend to be the same piece of code. As for other patterns, many PEAR libraries implement other ones and I use them from within my apps constantly. IMHO, many of the other design patterns (drivers, decorators, renderers, factories, etc) are library-level. They work very well for a specific piece of code which fits into MVC in one of its areas. -- DB_DataObject_FormBuilder - The database at your fingertips http://pear.php.net/package/DB_DataObject_FormBuilder paperCrane --Justin Patrin-- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Echoing Results in a Table
I've managed to develop a query which pulls a finite number of records from a table based on a query. What commends do I now use to present these results in a table...? -- - Michael Mason Arras People www.arraspeople.co.uk - -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Echoing Results in a Table
http://www.google.com/search?hl=enie=UTF-8q=HTML+tablebtnG=Google+Search On Fri, 16 Jul 2004 17:07:17 +0100, Harlequin [EMAIL PROTECTED] wrote: I've managed to develop a query which pulls a finite number of records from a table based on a query. What commends do I now use to present these results in a table...? -- - Michael Mason Arras People www.arraspeople.co.uk - -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php !DSPAM:40f7fb4e155681589816038! -- DB_DataObject_FormBuilder - The database at your fingertips http://pear.php.net/package/DB_DataObject_FormBuilder paperCrane --Justin Patrin-- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] quotes in text.
I'm having some difficulty with quotation marks, both single and double, input via a textarea in a form. Here's and example of text. Trying out the Special Character thing. Page 1 is the form. Page 2 is the data shown back to the user. original POST data is not touched. NO stripslashes original typed text is show to the user by stripslashes($thistext) original POST data is transferred to next page via hidden input field without stripping slashes. Page 3 posts the data to a MySQL database. original POST data is not touched. No stipslashes. Text gets cut off in database (Trying out the) What exactly do I need to do to the text so that any quotation marks (single or double) get input into the database. TIA, Ed Curtis -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Need help with line breaks in a textarea form
PHP User wrote: Something came to mind as soon as I sent my last email, and it seems to work. Not sure it will work in every circumstance but the few tests I tried seemed ok. This is what I did. I added the two following lines to my script. $text=str_replace(\n,br,$text); $text=str_replace(br /,,$text); Okay... let's say you have $text that is text that was entered into a textarea. To put it _back into_ a textare, you simply need to do this: textarea rows=5 cols=50?=htmlentities($text)?/textarea That's it. If you want to display $text to the user outside of a textarea, then you do this: echo nl2br(htmlentities($text)); If you want to insert $text into a database and magic_quotes_gpc is enabled, you do this: $query = INSERT INTO yourtable (textcolumn) VALUES ('$text'); If magic_quotes_gpc is not enabled (you can check with get_magic_quotes_gpc(), btw), then you'd use this: $text = addslashes($text); $query = INSERT INTO yourtable (textcolumn) VALUES ('$text'); If you'd like to extract the winning lottery numbers from $text, you simply... -- ---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
Re: [PHP] Echoing Results in a Table
Harlequin wrote: I've managed to develop a query which pulls a finite number of records from a table based on a query. What commends do I now use to present these results in a table...? How would you show a table now with a single record? Start there. Now, what areas would need repeating with a finite number of records? Those elements should be in a loop, either FOR, FOREACH or WHILE, more than likely. If you don't know how to run your query and extract the results, then you've got some reading to do. Check the PHP manual; there are user comments that walk you through everything. -- ---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
Re: [PHP] quotes in text.
Ed Curtis wrote: I'm having some difficulty with quotation marks, both single and double, input via a textarea in a form. Here's and example of text. Trying out the Special Character thing. Page 1 is the form. Page 2 is the data shown back to the user. original POST data is not touched. NO stripslashes original typed text is show to the user by stripslashes($thistext) original POST data is transferred to next page via hidden input field without stripping slashes. Page 3 posts the data to a MySQL database. original POST data is not touched. No stipslashes. Text gets cut off in database (Trying out the) What exactly do I need to do to the text so that any quotation marks (single or double) get input into the database. Let's say you have $_POST['text'] from the user. To display the value back to the user with magic_quotes_enabled, you'd do this: echo htmlentities(stripslashes($_POST['text'])); To put the value into a hidden form element, you'd do this: input type=hidden name=text value=?=htmlentities(stripslashes($_POST['text']))? Now, $_POST['text'] will come out correctly on Page 3. Since you seem to have magic_quotes_gpc enabled, you can put the value directly into your query. -- ---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
RE: [PHP] Need help with line breaks in a textarea form
John, If I just echo $text on the webpage now, everything shows as it should. HOWEVER, another problem I didn't even clue into until now. This form gets emailed to a specified address and all I get in my email is one long line with no line breaks. How do I fix this? I was reading a thread in a web based group you were having with another person, but none of your suggestions there worked. Suggestions Thanks again... -Original Message- From: John W. Holmes [mailto:[EMAIL PROTECTED] Sent: July 16, 2004 12:14 PM To: PHP User Cc: PHP Subject: Re: [PHP] Need help with line breaks in a textarea form PHP User wrote: Something came to mind as soon as I sent my last email, and it seems to work. Not sure it will work in every circumstance but the few tests I tried seemed ok. This is what I did. I added the two following lines to my script. $text=str_replace(\n,br,$text); $text=str_replace(br /,,$text); Okay... let's say you have $text that is text that was entered into a textarea. To put it _back into_ a textare, you simply need to do this: textarea rows=5 cols=50?=htmlentities($text)?/textarea That's it. If you want to display $text to the user outside of a textarea, then you do this: echo nl2br(htmlentities($text)); If you want to insert $text into a database and magic_quotes_gpc is enabled, you do this: $query = INSERT INTO yourtable (textcolumn) VALUES ('$text'); If magic_quotes_gpc is not enabled (you can check with get_magic_quotes_gpc(), btw), then you'd use this: $text = addslashes($text); $query = INSERT INTO yourtable (textcolumn) VALUES ('$text'); If you'd like to extract the winning lottery numbers from $text, you simply... -- ---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
Re: [PHP] Re: Trouble with include/require
That will try and find a file in these locations in order: /var/www/html/projects/include/db.inc ./db.inc /php/includes/db.inc And will use the first one found. I would not suggest using ini_set() inside you're scripts to adjust your paths. Curt Hey Curt, why do you suggest we don't use ini_set to adjust paths? I'm using it as part of my library autoloader - it may not be as efficient as changing the path directly but it seems to work well. ?php /** * Used to load all class definitions. It temporarily adds directories * listed in $classDirs to the include path and tries to load the class * definition from the new temporary path. Path resets to original * after failure / success. * * @param string The name of the class that you want to instanciate. * This should use PEAR-style class names, e.g. * Directory_Subdir_File * @return object|void */ function __autoload($class) { if (empty($class) || strpos($class, '://')) { // Zend engine can't throw exceptions in __autoload() trigger_error('Cannot get class file', E_USER_WARNING); return; } if (!defined('PATH_SEPARATOR')) { if (strstr(PHP_OS, 'WIN')) { define('PATH_SEPARATOR', ';'); } else { define('PATH_SEPARATOR', ':'); } } static $origPath = null; if (is_null($origPath)) { $origPath = ini_get('include_path'); } static $newPath = null; if (is_null($newPath)) { $cur = dirname(__FILE__ . DIRECTORY_SEPARATOR); $classDirs = array($cur); $aryPath = explode(PATH_SEPARATOR, $origPath); $aryPath = array_merge($aryPath, $classDirs); $newPath = implode(PATH_SEPARATOR, $aryPath); } // Do PEAR-like file inclusion $class = str_replace('_', DIRECTORY_SEPARATOR, $class); ini_set('include_path', $newPath); include_once ($class . .php); if (!class_exists($class)) { trigger_error(No class definition for $class found in library, E_USER_ERROR); } ini_set('include_path', $origPath); } ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Trouble with include/require
Jason Barnett wrote: I would not suggest using ini_set() inside you're scripts to adjust your paths. Hey Curt, why do you suggest we don't use ini_set to adjust paths? I'm using it as part of my library autoloader - it may not be as efficient as changing the path directly but it seems to work well. Donno about Curt, but i have found ini_set does not seem reliable, perhaps I may not have been doing something right but never found chaning php setting wtih .htaccess and ini_set to be particularly usefull. By reliable i mean work across many installations of PHP. -- Raditha Dissanayake. http://www.radinks.com/sftp/ | http://www.raditha.com/megaupload Lean and mean Secure FTP applet with | Mega Upload - PHP file uploader Graphical User Inteface. Just 128 KB | with progress bar. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] quotes in text.
On Fri, 16 Jul 2004, John W. Holmes wrote: Let's say you have $_POST['text'] from the user. To display the value back to the user with magic_quotes_enabled, you'd do this: echo htmlentities(stripslashes($_POST['text'])); To put the value into a hidden form element, you'd do this: input type=hidden name=text value=?=htmlentities(stripslashes($_POST['text']))? Now, $_POST['text'] will come out correctly on Page 3. Since you seem to have magic_quotes_gpc enabled, you can put the value directly into your query. Actually when I tried the above example nothing was entered into the database. This worked.. htmlentities($_POST['text']). Thanks, Ed -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Echoing Results in a Table
Harlequin [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] I've managed to develop a query which pulls a finite number of records from a table based on a query. What commends do I now use to present these results in a table...? There are plenty of such advices, I assume google will find them nicely. Here are few from TT site: http://www.templatetamer.org/index.php?SimpleMySqlRowList http://www.templatetamer.org/index.php?MySqlRowList http://www.templatetamer.org/index.php?AlternatingListExample rush -- http://www.templatetamer.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] mysqli prepapred SELECT statement
Anyone working with php5/mysql 4.1 yet with the new ext/mysqli? This has me stumped: $stmt = $mysqli-prepare('SELECT * FROM users WHERE userid=?'); $stmt-bind_param('i', $userID); $stmt-execute(); ...now how to get the results??? I can't use bind_result() since I have no clue how many columns `*' will retreive. I have been reading the docs now for over two hours and need to get back to work :-) $stmt-close(); Jim Grill -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Security vulerability, any more detail info than this???
Saw a website about security vulerability and there's no info on php.net that can describe more about it. So, anyone know? http://pcworld.co.nz/news.nsf/0/4D6AE0157B37ACDCCC256ED200693BB3?OpenDocument FletchSOD -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Security vulerability, any more detail info than this???
Except that 4.3.8 cover the 4.3.7 issues Scott Fletcher [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Saw a website about security vulerability and there's no info on php.net that can describe more about it. So, anyone know? http://pcworld.co.nz/news.nsf/0/4D6AE0157B37ACDCCC256ED200693BB3?OpenDocument FletchSOD -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] load data infile
I have a tab delimited file I am trying to load in my database using: LOAD DATA INFILE '/users/dbs/sites/phpmyadmin/gus/exptab.txt' INTO TABLE datable; But all it will load is the first record and I have about 2000 records. There are 20 columns of data in my 'exptab.txt' file I am loading and there are 20 fields in datable. Any ideas, if you could email me directly I would appreciate it, thanks, Doug -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Putting $_POST into string to send to ASP
Dumb question, sorry if it's a repeat. I will use PHP for a form with error checking. When there are no errors I need to send all the variables thru something like this: $URL = https://example.com/script.asp?First=JimLast=Smith;; urlencode($URL); header(Location: $URL\n); How do I gather up all the variables in $_POST and attach them as a string after the question mark? Thanks. Jeff -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Putting $_POST into string to send to ASP
How do I gather up all the variables in $_POST and attach them as a string after the question mark? Thanks. this is untested: $arr = array(); foreach($_POST as $key = $value) { $arr[] = $key.'='.urlencode($value); } $URL = https://example.com/script.asp?.implode('',$arr); header(Location: $URL\n); -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] load data infile
[snip] I have a tab delimited file I am trying to load in my database using: LOAD DATA INFILE '/users/dbs/sites/phpmyadmin/gus/exptab.txt' INTO TABLE datable; But all it will load is the first record and I have about 2000 records. There are 20 columns of data in my 'exptab.txt' file I am loading and there are 20 fields in datable. [/snip] Have you, by any chance, consulted the MySQL list? http://dev.mysql.com/doc/mysql/en/LOAD_DATA.html ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Echoing Results in a Table
Thanks John. I managed to get what I wanted. Now I have a very neat table showing my results. Nice. Next conundrum is stuffing a dropdown menu with results. I'll post a new thread but have a dig around the Internet, many thanks John. -- - Michael Mason Arras People www.arraspeople.co.uk - John W. Holmes [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Harlequin wrote: I've managed to develop a query which pulls a finite number of records from a table based on a query. What commends do I now use to present these results in a table...? How would you show a table now with a single record? Start there. Now, what areas would need repeating with a finite number of records? Those elements should be in a loop, either FOR, FOREACH or WHILE, more than likely. If you don't know how to run your query and extract the results, then you've got some reading to do. Check the PHP manual; there are user comments that walk you through everything. -- ---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] Populating a Dropdown Menu From a Query
Another day another conundrum. I have a form where one option is a dropdown menu. I'd like that menu to only have items in it that are actually available. Selecting the items with a query is easy enough but I wondered if anyone could tell me where to start wit the code. Am I using a for each again . . . ? Any help greatly appreciated. -- - Michael Mason Arras People www.arraspeople.co.uk - -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Populating a Dropdown Menu From a Query
I have a form where one option is a dropdown menu. I'd like that menu to only have items in it that are actually available. Selecting the items with a query is easy enough but I wondered if anyone could tell me where to start wit the code. I dont know what kind of db so I will just use mysql, this comes almost straight from the manual http://us3.php.net/mysql: $query = SELECT * FROM my_table WHERE available; $result = mysql_query($query) or die(Query failed : . mysql_error()); /* Printing results in HTML */ echo select name=\yourDropdownName\\n; while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) { echo option value=\$line[itemnum]\$line[itemname]/option\n; } echo /select\n; -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Populating a Dropdown Menu From a Query
The exact implementation differs with your database system, but as an example for MySQL: select name=select size=1 ?php $result = mysql_query($query); while($row = mysql_fetch_assoc){ echo(option value=\{$row['name_of_value_field']}\{$row['name_of_description_field']} /option); } ? /select greetz, Arnout Harlequin [EMAIL PROTECTED] schreef in bericht news:[EMAIL PROTECTED] Another day another conundrum. I have a form where one option is a dropdown menu. I'd like that menu to only have items in it that are actually available. Selecting the items with a query is easy enough but I wondered if anyone could tell me where to start wit the code. Am I using a for each again . . . ? Any help greatly appreciated. -- - Michael Mason Arras People www.arraspeople.co.uk - -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Putting $_POST into string to send to ASP
Jeff Oien wrote: Dumb question, sorry if it's a repeat. I will use PHP for a form with error checking. When there are no errors I need to send all the variables thru something like this: $URL = https://example.com/script.asp?First=JimLast=Smith;; urlencode($URL); header(Location: $URL\n); How do I gather up all the variables in $_POST and attach them as a string after the question mark? Thanks. Jeff Try the http_build_query() function. If you don't have PHP 5, look in the user notes--someone appears to have written one for PHP 4 as well (the user note 21-Jun-2004 from 'brooklynphil'). I haven't tested either one. http://www.php.net/manual/en/function.http-build-query.php Using this, you could just do something like: $query_string = http_build_query($_POST); Hope this helps, Torben [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: Putting $_POST into string to send to ASP
How about (probably one of fifty solutions; Foreach($_POST as $k = $v) $vals[] = $k.=.$v; $strvals = urlencode(implode(,$vals)); Header(Location: https://example.com/script.asp?.$strvals); One thing to think about, URL's are limited in length, and one reason for using method=post is that they won't fit in a URL, for this you'll need to make sure they fit. Warren Vail -Original Message- From: Lars Torben Wilson [mailto:[EMAIL PROTECTED] Sent: Friday, July 16, 2004 12:32 PM To: Jeff Oien Cc: PHP Subject: [PHP] Re: Putting $_POST into string to send to ASP Jeff Oien wrote: Dumb question, sorry if it's a repeat. I will use PHP for a form with error checking. When there are no errors I need to send all the variables thru something like this: $URL = https://example.com/script.asp?First=JimLast=Smith;; urlencode($URL); header(Location: $URL\n); How do I gather up all the variables in $_POST and attach them as a string after the question mark? Thanks. Jeff Try the http_build_query() function. If you don't have PHP 5, look in the user notes--someone appears to have written one for PHP 4 as well (the user note 21-Jun-2004 from 'brooklynphil'). I haven't tested either one. http://www.php.net/manual/en/function.http-build-query.php Using this, you could just do something like: $query_string = http_build_query($_POST); Hope this helps, Torben [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Putting $_POST into string to send to ASP
Vail, Warren wrote: How about (probably one of fifty solutions; Foreach($_POST as $k = $v) $vals[] = $k.=.$v; $strvals = urlencode(implode(,$vals)); Header(Location: https://example.com/script.asp?.$strvals); One thing to think about, URL's are limited in length, and one reason for using method=post is that they won't fit in a URL, for this you'll need to make sure they fit. Warren Vail You could do that, but for one thing, it doesn't handle arrays. The code snippet in the user notes does. -- Torben Wilson [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] quotes in text.
On Fri, 16 Jul 2004 11:58:55 -0500 (EST), Ed Curtis [EMAIL PROTECTED] wrote: On Fri, 16 Jul 2004, John W. Holmes wrote: Let's say you have $_POST['text'] from the user. To display the value back to the user with magic_quotes_enabled, you'd do this: echo htmlentities(stripslashes($_POST['text'])); To put the value into a hidden form element, you'd do this: input type=hidden name=text value=?=htmlentities(stripslashes($_POST['text']))? Now, $_POST['text'] will come out correctly on Page 3. Since you seem to have magic_quotes_gpc enabled, you can put the value directly into your query. Actually when I tried the above example nothing was entered into the database. This worked.. htmlentities($_POST['text']). This is why he said: Since you seem to have magic_quotes_gpc enabled, you can put the value directly into your query. You shouldn't use htmlentities when putting it into the DB. Use it when displaying the text. -- DB_DataObject_FormBuilder - The database at your fingertips http://pear.php.net/package/DB_DataObject_FormBuilder paperCrane --Justin Patrin-- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Putting $_POST into string to send to ASP
Thanks for the helpful examples. One other question. Is there an advantage to sending the URL via a header as opposed to doing http_post like this? http://shiflett.org/hacks/php/http_post Jeff -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: Putting $_POST into string to send to ASP
You could do that, but for one thing, it doesn't handle arrays. The code snippet in the user notes does. You are absolutely correct, but I'm not sure that ASP could handle arrays either. On the other side Matt M.s processing should work better than mine; foreach($_POST as $key = $value) { $arr[] = $key.'='.urlencode($value); } I believe my loop may change the character to something it shouldn't? Warren Vail -Original Message- From: Lars Torben Wilson [mailto:[EMAIL PROTECTED] Sent: Friday, July 16, 2004 12:55 PM To: Vail, Warren Cc: 'Lars Torben Wilson'; Jeff Oien; PHP Subject: Re: [PHP] Re: Putting $_POST into string to send to ASP Vail, Warren wrote: How about (probably one of fifty solutions; Foreach($_POST as $k = $v) $vals[] = $k.=.$v; $strvals = urlencode(implode(,$vals)); Header(Location: https://example.com/script.asp?.$strvals); One thing to think about, URL's are limited in length, and one reason for using method=post is that they won't fit in a URL, for this you'll need to make sure they fit. Warren Vail You could do that, but for one thing, it doesn't handle arrays. The code snippet in the user notes does. -- Torben Wilson [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] quotes in text.
On Fri, 16 Jul 2004, Justin Patrin wrote: This is why he said: Since you seem to have magic_quotes_gpc enabled, you can put the value directly into your query. You shouldn't use htmlentities when putting it into the DB. Use it when displaying the text. I tried it both ways and it only works correctly when I do use htmlentities($_POST['text']) in my insert query. I'm not showing the text to the user on page 3 at all. Ed -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Putting $_POST into string to send to ASP
Thanks for the helpful examples. One other question. Is there an advantage to sending the URL via a header as opposed to doing http_post like this? http://shiflett.org/hacks/php/http_post Jeff Like someone mentioned earlier. URL's have length limits. That would be one reason to do a post. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP5 Install Version (Win32)
Hello List, Does anybody got some information if there will be a Win32 Install Version of PHP5 like it exists for 4.3.8 ? Kind Regards, -Ron **Disclaimer: everything I post, will post and have posted, is subject to change without reason; any errors in logic, math or spelling is to assumed to be on purpose. By flaming me, you admit you are wrong. The poster of this message takes no responsibility for any deaths, sicknesses, annoyences, pains or pregnancies as a result of this post.** -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: Putting $_POST into string to send to ASP
If the hack works, it should get around the length limitation of the URL, but I would be more tempted to use CURL for that. http://www.php.net/manual/en/ref.curl.php Warren Vail Warren Vail (415) 667-0240 SF211-07-434 -Original Message- From: Jeff Oien [mailto:[EMAIL PROTECTED] Sent: Friday, July 16, 2004 1:12 PM To: PHP Subject: Re: [PHP] Re: Putting $_POST into string to send to ASP Thanks for the helpful examples. One other question. Is there an advantage to sending the URL via a header as opposed to doing http_post like this? http://shiflett.org/hacks/php/http_post Jeff -- 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] Security vulerability, any more detail info than this???
Scott Fletcher wrote: Saw a website about security vulerability and there's no info on php.net that can describe more about it. So, anyone know? http://pcworld.co.nz/news.nsf/0/4D6AE0157B37ACDCCC256ED200693BB3?OpenDocument One more reason to not use strip_tags... like I really needed another, though. -- ---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
Re: [PHP] quotes in text.
Ed Curtis wrote: On Fri, 16 Jul 2004, Justin Patrin wrote: This is why he said: Since you seem to have magic_quotes_gpc enabled, you can put the value directly into your query. You shouldn't use htmlentities when putting it into the DB. Use it when displaying the text. I tried it both ways and it only works correctly when I do use htmlentities($_POST['text']) in my insert query. I'm not showing the text to the user on page 3 at all. Well, if you're happy with it just working and not knowing why or how it's going to break in the future... have fun. -- ---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
Re: [PHP] Re: Putting $_POST into string to send to ASP
Jeff Oien wrote: Thanks for the helpful examples. One other question. Is there an advantage to sending the URL via a header as opposed to doing http_post like this? http://shiflett.org/hacks/php/http_post Jeff As mentioned a couple of times, size is one. But you still need to url-encode the data if you're going to send it via post. ?php $data = array('item1' = 'value1', 'item2' = 'value2'); $query_string = http_build_query($data); // Now, you can send the data either via post: $response = http_post('www.example.com', '/form.php', $data); // ...or via get: header('http://www.example.com?form.php?' . $data); ? The first lets your script grab the output of the form to which you're submitting (it's in $response after the http_post() call); the second actually loads and displays the target form. Another option is cURL, which is designed for exactly this sort of thing: http://www.php.net/curl ...but it may or may not be overkill for what you need. However, cURL pretty much rules the data posting/fetching game as far as configurability etc. Cheers, Torben [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Problem with calculate
Hi, I have following problem: I use some numbers from mysql table and other local vars to calculate one number. But on one calc I receive thath $value=4.5474735088646E-013; This must be zero (0) - I see all vars and calc then with calculator. I use function number_format($value, 2, ., ) and it return me -0.00 Can someone help me ? Thanks in advance! Rosen -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problem with calculate
Rosen wrote: I use some numbers from mysql table and other local vars to calculate one number. But on one calc I receive thath $value=4.5474735088646E-013; This must be zero (0) - I see all vars and calc then with calculator. I use function number_format($value, 2, ., ) and it return me -0.00 When you use floating point numbers, you can get small errors like this. To the computer, 4.54E-13 is about the same as zero. number_format() returns the correct result... well, the negative sign may throw you off. You can use abs() and round() to get what you want, more than likely. The thing to remember and react accordingly to is that for floating point numbers, 2.0 - 1.5 can equal 0.4999 and be correct because of the precision. -- ---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
Re: [PHP] quotes in text.
On Fri, 16 Jul 2004, John W. Holmes wrote: Ed Curtis wrote: On Fri, 16 Jul 2004, Justin Patrin wrote: This is why he said: Since you seem to have magic_quotes_gpc enabled, you can put the value directly into your query. You shouldn't use htmlentities when putting it into the DB. Use it when displaying the text. I tried it both ways and it only works correctly when I do use htmlentities($_POST['text']) in my insert query. I'm not showing the text to the user on page 3 at all. Well, if you're happy with it just working and not knowing why or how it's going to break in the future... have fun. Ok then, I want to know how to do it the right way but just using $_POST['text'], as stated before, in my query still cuts off the text at the quote. While passing this field between pages I don't do anything to it but when I want to show it to the user I would use stripslashes($_POST['text']). Is this the correct way to make sure my quotes get passed into the database? Ed -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] quotes in text.
Ok then, I want to know how to do it the right way but just using $_POST['text'], as stated before, in my query still cuts off the text at the quote. While passing this field between pages I don't do anything to it but when I want to show it to the user I would use stripslashes($_POST['text']). Is this the correct way to make sure my quotes get passed into the database? First I would turn off magic_quotes_gpc. I would use sessions to pass the data from step 1 to the end, much easier imho than messing around with hidden fields. When you store the data in the database use make sure you escape it, when you redisplay it, use the htmlentities function. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: Putting $_POST into string to send to ASP
I believe we all missed something important here, but I've been wrong before. Notice his URL below, specifically the https part. I believe this means that the data not only needs to be URL encoded but SSL encrypted. I believe this makes a stronger case for using CURL, does it not? I also would mean that his hack code would not work. Correct me if I'm wrong? Warren Vail -Original Message- From: Lars Torben Wilson [mailto:[EMAIL PROTECTED] Sent: Friday, July 16, 2004 12:32 PM To: Jeff Oien Cc: PHP Subject: [PHP] Re: Putting $_POST into string to send to ASP Jeff Oien wrote: Dumb question, sorry if it's a repeat. I will use PHP for a form with error checking. When there are no errors I need to send all the variables thru something like this: $URL = https://example.com/script.asp?First=JimLast=Smith;; urlencode($URL); header(Location: $URL\n); How do I gather up all the variables in $_POST and attach them as a string after the question mark? Thanks. Jeff Try the http_build_query() function. If you don't have PHP 5, look in the user notes--someone appears to have written one for PHP 4 as well (the user note 21-Jun-2004 from 'brooklynphil'). I haven't tested either one. http://www.php.net/manual/en/function.http-build-query.php Using this, you could just do something like: $query_string = http_build_query($_POST); Hope this helps, Torben [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problem with calculate
Thanks ! abs() will not work for me, because I may have na negative numbers, but with round() it worked ! 10x John W. Holmes [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Rosen wrote: I use some numbers from mysql table and other local vars to calculate one number. But on one calc I receive thath $value=4.5474735088646E-013; This must be zero (0) - I see all vars and calc then with calculator. I use function number_format($value, 2, ., ) and it return me -0.00 When you use floating point numbers, you can get small errors like this. To the computer, 4.54E-13 is about the same as zero. number_format() returns the correct result... well, the negative sign may throw you off. You can use abs() and round() to get what you want, more than likely. The thing to remember and react accordingly to is that for floating point numbers, 2.0 - 1.5 can equal 0.4999 and be correct because of the precision. -- ---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: PHP5 Install Version (Win32)
Ron Stiemer wrote: Does anybody got some information if there will be a Win32 Install Version of PHP5 like it exists for 4.3.8 ? Personally I simply don't see the point :) Unzip the zip, tweak Apache and php.ini and I have what *I* want running in minutes. I don't want MySQL, I do use Apache2 so the installer is simply a waste of effort ;) No doubt someone who prefers a knobled version will do it though :) -- Lester Caine - L.S.Caine Electronic Services -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Putting $_POST into string to send to ASP
The client's vendor only specifies that it's field=data pairs and that it's URL encoded so I don't think that's an issue. But don't let that squelch any discussion. :) Jeff Oien Vail, Warren wrote: I believe we all missed something important here, but I've been wrong before. Notice his URL below, specifically the https part. I believe this means that the data not only needs to be URL encoded but SSL encrypted. I believe this makes a stronger case for using CURL, does it not? I also would mean that his hack code would not work. Correct me if I'm wrong? Warren Vail Jeff Oien wrote: Dumb question, sorry if it's a repeat. I will use PHP for a form with error checking. When there are no errors I need to send all the variables thru something like this: $URL = https://example.com/script.asp?First=JimLast=Smith;; urlencode($URL); header(Location: $URL\n); How do I gather up all the variables in $_POST and attach them as a string after the question mark? Thanks. Jeff Try the http_build_query() function. If you don't have PHP 5, look in the user notes--someone appears to have written one for PHP 4 as well (the user note 21-Jun-2004 from 'brooklynphil'). I haven't tested either one. http://www.php.net/manual/en/function.http-build-query.php Using this, you could just do something like: $query_string = http_build_query($_POST); Hope this helps, Torben [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Putting $_POST into string to send to ASP
Thee is a PEAR package to do posts, gets, etc. http://pear.php.net/package/HTTP_Request On Fri, 16 Jul 2004 14:00:02 -0700, Vail, Warren [EMAIL PROTECTED] wrote: I believe we all missed something important here, but I've been wrong before. Notice his URL below, specifically the https part. I believe this means that the data not only needs to be URL encoded but SSL encrypted. I believe this makes a stronger case for using CURL, does it not? I also would mean that his hack code would not work. Correct me if I'm wrong? Warren Vail -Original Message- From: Lars Torben Wilson [mailto:[EMAIL PROTECTED] Sent: Friday, July 16, 2004 12:32 PM To: Jeff Oien Cc: PHP Subject: [PHP] Re: Putting $_POST into string to send to ASP Jeff Oien wrote: Dumb question, sorry if it's a repeat. I will use PHP for a form with error checking. When there are no errors I need to send all the variables thru something like this: $URL = https://example.com/script.asp?First=JimLast=Smith;; urlencode($URL); header(Location: $URL\n); How do I gather up all the variables in $_POST and attach them as a string after the question mark? Thanks. Jeff Try the http_build_query() function. If you don't have PHP 5, look in the user notes--someone appears to have written one for PHP 4 as well (the user note 21-Jun-2004 from 'brooklynphil'). I haven't tested either one. http://www.php.net/manual/en/function.http-build-query.php Using this, you could just do something like: $query_string = http_build_query($_POST); Hope this helps, Torben [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php !DSPAM:40f8402e32021142355! -- DB_DataObject_FormBuilder - The database at your fingertips http://pear.php.net/package/DB_DataObject_FormBuilder paperCrane --Justin Patrin-- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] convert degrees to heading
I have to write a little function to convert a direction from degrees to a compass -type heading. 0 = West. 90 = North. E.g.: from: 135 degrees to: NW Now, I was planning to write a series of if statements to evaluate e.g., if ($heading_degrees 112.5 $heading_degrees 67.5) { $heading_compass = N; } The works, but it will require N, NNW, NNE, NE, NW, ENE, NWW... many IF statements. Can anyone think of a programatically more elegant and efficient way of converting this type of data? (I suppose this is not really a problem, just a curiosity.) ...Rene -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: convert degrees to heading
In article [EMAIL PROTECTED], René fournier wrote: I have to write a little function to convert a direction from degrees to a compass -type heading. 0 = West. 90 = North. E.g.: from: 135 degrees to: NW Now, I was planning to write a series of if statements to evaluate e.g., if ($heading_degrees 112.5 $heading_degrees 67.5) { $heading_compass = N; } The works, but it will require N, NNW, NNE, NE, NW, ENE, NWW... many IF statements. Can anyone think of a programatically more elegant and efficient way of converting this type of data? (I suppose this is not really a problem, just a curiosity.) Might need some corrections, but the idea should be clear: function degrees2compass($degrees) { $compass = array('N', 'NNW', 'NNE', 'NE', ...); $index = $heading_degrees / sizeof($compass); return $compass[$index]; } Or you could use a switch -- Tim Van Wassenhove http://home.mysth.be/~timvw -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: convert degrees to heading
Here's a quick script I wrote for it: ?php $deg = $_GET['deg']; // get from URL, for testing atm $deg %= 360; // make sure it doesn't break on eg 560 degrees $deg = ((ceil(($deg-22.5)/45))*45+22.5); // break it up into parts we know, there might be an easier way though, just too tired to see it. switch($deg) { case 22.5: echo 'W'; break; case 67.5: echo 'NW'; break; case 112.5: echo 'N'; break; case 157.5: echo 'NE'; break; case 202.5: echo 'E'; break; case 247.5: echo 'SE'; break; case 292.5: echo 'S'; break; case 337.5: echo 'SW'; break; default: echo 'W'; break; } ? René fournier wrote: I have to write a little function to convert a direction from degrees to a compass -type heading. 0 = West. 90 = North. E.g.: from: 135 degrees to: NW Now, I was planning to write a series of if statements to evaluate e.g., if ($heading_degrees 112.5 $heading_degrees 67.5) { $heading_compass = N; } The works, but it will require N, NNW, NNE, NE, NW, ENE, NWW... many IF statements. Can anyone think of a programatically more elegant and efficient way of converting this type of data? (I suppose this is not really a problem, just a curiosity.) ...Rene -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: convert degrees to heading
Works beautifully. Thanks! ...Rene On Friday, July 16, 2004, at 04:36 PM, Tim Van Wassenhove wrote: function degrees2compass($degrees) { $compass = array('N', 'NNW', 'NNE', 'NE', ...); $index = $heading_degrees / sizeof($compass); return $compass[$index]; } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: convert degrees to heading
Well, isn't north really about 340 to 020 degrees? Looks like if you threw in a factor. Warren Vail -Original Message- From: René Fournier [mailto:[EMAIL PROTECTED] Sent: Friday, July 16, 2004 3:59 PM To: Tim Van Wassenhove Cc: php Subject: Re: [PHP] Re: convert degrees to heading Works beautifully. Thanks! .Rene On Friday, July 16, 2004, at 04:36 PM, Tim Van Wassenhove wrote: function degrees2compass($degrees) { $compass = array('N', 'NNW', 'NNE', 'NE', ...); $index = $heading_degrees / sizeof($compass); return $compass[$index]; } -- 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] PHPEclipse?
I have downloaded the latest .zip from source forge but it keeps giving me an error has occured when activating this view.. and hsow the php browser. eclipse 3.0, linux fedora core2, java 1.4.2_04-fcs -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Tiff to Jpeg conversion
Hi Group, Can anyone suggest me a tool for converting Tiff image to JPEG image? Currently i am using the GD library for manipulating images and i didn't see any function which converts Tiff image to JPEG image. I notice Imagmagic support this feature. Please let me know if anyone has any idea about selecting the proper tool. Thanks, Hardik __ Do you Yahoo!? Vote for the stars of Yahoo!'s next ad campaign! http://advision.webevents.yahoo.com/yahoo/votelifeengine/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] SNMP traps generation
If you find something, it's interesting me !! Because of ASN1 encryption, it's hard to send a simple SNMP Trap with somes lines of code. Alessandro Vitale [EMAIL PROTECTED] a écrit dans le message de news:[EMAIL PROTECTED] Hi all, does anybody know any good library (class|script) for generating SNMP traps wirtten in PHP? thanks in advance, A. *** Alessandro Vitale Jr. Software Engineer Tiscali International Network Spa +39 070 4601678 [EMAIL PROTECTED] *** -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP5 and pass by reference bug.
So, I'm getting all these errors/warnings in PHP5 now saying that I have to put the on the function and not in the passing (which sorta makes sense and puts the burden on the function rather than the user, which I like too). So I spend the time to go and fix several thousand lines of code. Then I start to see these other errors... Maybe I'm missing something, but this seems like a glaring bug in passing by reference that nobody caught... say you have function foo($bar) { } well that works great as long as you use it like foo($x); but if you try foo(something here); Or foo( array('a','b','c') ); it shits the bed. :-( -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] using PHP script to simulate a login
Hi, We have a web interface to do following: 1. login 2. check phone number (maybe thousands of) 3. logout. I am just wondering is it possible to use a php script to simulate the three steps? I understand that after login the web server will send a cookie to browser, so in that way a session can be kept at the visiter's end in correspondance to the web server. However I have no idea is it possible for a script to simulate browser's session handling? Alex -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Uploading a directory of files
Does anyone have a script to upload a directory full of files? .something like a recursive upload. Thanks, Ryan
[PHP] php5.0.0(cli) + loose STDIN when using pcntl_alarm
My goal is to parse apache log into a php piped program. I need pcntl_alarm to launch some function, while reading stdin. When exiting of pcntl_alarm function handler, i loose STDIN, php say it's a valid resource, but feof found, since data continu to be send into the pipe. With php5-rc1 it was working, using fopen(php://stdin,r); With php5-rc2,rc3,0.0.0, it doesn't work, using STDIN I think it's a bug but i'm not sure, please correct me if a make a nonsense. - You will find php sample code at http://exeprod.com/test_cli_signal.txt - To use it you just make something like that : while :; do date; sleep 1; done | /usr/local/bin/php test_cli_signal.php - It will give you output like : sam jui 17 01:29:48 CEST 2004 sam jui 17 01:29:49 CEST 2004 sam jui 17 01:29:50 CEST 2004 je passe dans sig_handler (14) -- sig_handler() function Already reading from stdin-- read_stdin() function exiting read_stdin() STDIN: Resource id #1 is_resource(STDIN)=1 Any help will be very appreciated. Critical for me Thanks in advanced. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Uploading a directory of files
Ryan Schefke wrote: Does anyone have a script to upload a directory full of files? .something like a recursive upload. Not going to happen with PHP and an HTML interface. If you have PHP running on two machines and want to do this, then say so. -- ---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