php-general Digest 13 Jun 2005 14:52:51 -0000 Issue 3510
php-general Digest 13 Jun 2005 14:52:51 - Issue 3510 Topics (messages 216875 through 216887): Re: PHP ImageCreateFrom.. malfunctioning in last PHP releases... 216875 by: Richard Lynch Re: news php 5.0.5/5.1 216876 by: JamesBenson Delivery failed 216877 by: Mail Administrator Re: Compilation trouble on OS X 216878 by: Marcus Bointon 216880 by: Marcus Bointon php extension with pthreads 216879 by: Nikunj Gupta Re: Oracle Interface 216881 by: Shane Presley 216882 by: Jay Blanchard 216884 by: Shane Presley Re: [nyphp] IBM's PHP Strategy - New York PHP June Meeting - Designer Training June 27th 216883 by: Hans Zaunere Re: reverse MD5 ??? 216885 by: Jason Barnett Optimizing Help 216886 by: jack jackson 216887 by: Chris Ramsay Administrivia: To subscribe to the digest, e-mail: [EMAIL PROTECTED] To unsubscribe from the digest, e-mail: [EMAIL PROTECTED] To post to the list, e-mail: php-general@lists.php.net -- ---BeginMessage--- On Sun, June 12, 2005 7:37 pm, M said: I use ImageCreateFromString PHP functions to resize (thumbnails and so) dynamically my JPG images. I use third party WEB hosting provider , so I have no control about new releases and updates of server softwares. I have not changed my images in last 3 years (they are used for virtual stores), they appeared beautiful in these 3 years, but from some days ago, they are appearing with terrible filter colors (all blue for instance, some entirely black and so). When bypassing image PHP functions, images again appear beautiful in my page, but site performance to show product catalogs gets terrible, not to say impossible for customers browse on it. I wrote web provider to check what changed in their PHP environment, but I am afraid they will answer none has changed. I use the following sequence of commands to rebuild thumb images: $orimage = ImageCreateFromString(string) to get original image from opened JPG file $thumb = ImageCreate(new-width, new-height) to create empty new thumbnail Make this one be ImageCreateTrueColor() http://php.net/imagecreatetruecolor ImageCopyResized($thumb,$origame,) to fill thumbnail ImageJpeg($thumb) to show thumbnail I checked by increasing 'quality' parameter ImageJpeg($thumb,'',100) but result continue to be wrong. Is anobody else experiencing these problems lately?, how did you solve it? I believe something changed in the GD library where lo-res internal images were not promoted to hi-res or something like that... -- Like Music? http://l-i-e.com/artists.htm ---End Message--- ---BeginMessage--- 5.1.0 BETA, http://www.php.net/downloads.php mbneto wrote: Hi, I've looked at php.net but could not find info regarding if/when are we going to have further 5.0.x versions and what will change in php 5.1. Any pointers (besides the php-devel) ? ---End Message--- ---BeginMessage--- ALERT! This e-mail, in its original form, contained one or more attached files that were infected with a virus, worm, or other type of security threat. This e-mail was sent from a Road Runner IP address. As part of our continuing initiative to stop the spread of malicious viruses, Road Runner scans all outbound e-mail attachments. If a virus, worm, or other security threat is found, Road Runner cleans or deletes the infected attachments as necessary, but continues to send the original message content to the recipient. Further information on this initiative can be found at http://help.rr.com/faqs/e_mgsp.html. Please be advised that Road Runner does not contact the original sender of the e-mail as part of the scanning process. Road Runner recommends that if the sender is known to you, you contact them directly and advise them of their issue. If you do not know the sender, we advise you to forward this message in its entirety (including full headers) to the Road Runner Abuse Department, at [EMAIL PROTECTED] Message could not be delivered file attachment: message.zip This e-mail in its original form contained one or more attached files that were infected with the [EMAIL PROTECTED] virus or worm. They have been removed. For more information on Road Runner's virus filtering initiative, visit our Help Member Services pages at http://help.rr.com, or the virus filtering information page directly at http://help.rr.com/faqs/e_mgsp.html. ---End Message--- ---BeginMessage--- On 12 Jun 2005, at 04:17, Richard Lynch wrote: I vaguely recall an issue with mb_* where people saw this nifty new feature and turned it on having no idea what it was, and, well, they didn't really want that feature turned on at all... This could be the same thing. Or not. Try ./configure --without-mbstring Unfortunately I'm deliberately enabling mbstring because I need multibyte string support,
[PHP] Delivery failed
ALERT! This e-mail, in its original form, contained one or more attached files that were infected with a virus, worm, or other type of security threat. This e-mail was sent from a Road Runner IP address. As part of our continuing initiative to stop the spread of malicious viruses, Road Runner scans all outbound e-mail attachments. If a virus, worm, or other security threat is found, Road Runner cleans or deletes the infected attachments as necessary, but continues to send the original message content to the recipient. Further information on this initiative can be found at http://help.rr.com/faqs/e_mgsp.html. Please be advised that Road Runner does not contact the original sender of the e-mail as part of the scanning process. Road Runner recommends that if the sender is known to you, you contact them directly and advise them of their issue. If you do not know the sender, we advise you to forward this message in its entirety (including full headers) to the Road Runner Abuse Department, at [EMAIL PROTECTED] Message could not be delivered file attachment: message.zip This e-mail in its original form contained one or more attached files that were infected with the [EMAIL PROTECTED] virus or worm. They have been removed. For more information on Road Runner's virus filtering initiative, visit our Help Member Services pages at http://help.rr.com, or the virus filtering information page directly at http://help.rr.com/faqs/e_mgsp.html. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Compilation trouble on OS X
On 12 Jun 2005, at 04:17, Richard Lynch wrote: I vaguely recall an issue with mb_* where people saw this nifty new feature and turned it on having no idea what it was, and, well, they didn't really want that feature turned on at all... This could be the same thing. Or not. Try ./configure --without-mbstring Unfortunately I'm deliberately enabling mbstring because I need multibyte string support, along with mbregex... If I could live without these extensions I wouldn't need to recompile. I just tried compiling on a clean install of 10.4, with a clean install of fink (I'm using some fink packages like apache2, JPEG, PNG, etc) and I'm still getting the ld problem I mentioned. Think I may have to report it as a bug and see what comes of that. Marcus -- Marcus Bointon Synchromedia Limited: Putting you in the picture [EMAIL PROTECTED] | http://www.synchromedia.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] php extension with pthreads
hi i am new to php and am building my first php extension. i have a code in cpp that uses pthreads for carrying out the job. i tried to convert this into a php extension but was unable to do so despite a number of tries. i am able to compile the extension that i build but am unable to load it. the error that i get is :: PHP Warning: Unknown(): Unable to load dynamic library '/home/y/lib/php/20020429/perfext.so' - /home/y/lib/php/20020429/perfext.so: Undefined symbol quot;pthread_exitquot; in Unknown on line 0 i have used the line PHP_ADD_LIBRARY_WITH PATH to include pthread library and also used -pthread in the cppflags. do i need to do anything else for creating such an extension. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Compilation trouble on OS X
On 13 Jun 2005, at 10:52, Marcus Bointon wrote: I just tried compiling on a clean install of 10.4, with a clean install of fink (I'm using some fink packages like apache2, JPEG, PNG, etc) and I'm still getting the ld problem I mentioned. Think I may have to report it as a bug and see what comes of that. A little perseverance always helps... I went through my configure command and removed a few possibly obsolete directives. I then ran into a dependency on gdbm that I can't explain, but after adding that in, I'm happy to report that it now works. For the record, here's my working config while building PHP 5.0.4 on OS X 10.4.1 as an apache2handler using fink libraries, also notable is that it also enables both mysql and mysqli extensions simultaneously: './configure' \ '--disable-overload' \ '--enable-bcmath' \ '--enable-calendar' \ '--enable-dba' \ '--enable-exif' \ '--enable-ftp' \ '--enable-gd-imgstrttf' \ '--enable-gd-native-ttf' \ '--enable-mbregex' \ '--enable-mbstring' \ '--enable-mcal' \ '--enable-pcntl' \ '--enable-shmop' \ '--enable-soap' \ '--enable-sockets' \ '--enable-sysvsem' \ '--enable-sysvshm' \ '--enable-track-vars' \ '--enable-wddx' \ '--sysconfdir=/etc' \ '--with-apxs2=/sw/sbin/apxs' \ '--with-bz2' \ '--with-config-file-path=/etc' \ '--with-config-file-scan-dir=/etc/php.d' \ '--with-curl' \ '--with-dom=/usr' \ '--with-freetype2-dir=/sw' \ '--with-gd' \ '--with-gdbm=/sw' \ '--with-gettext=/sw' \ '--with-iconv' \ '--with-imap-ssl=/sw' \ '--with-jpeg-dir=/sw' \ '--with-png-dir=/sw' \ '--with-ldap' \ '--with-mcrypt=/sw' \ '--with-mhash=/sw' \ '--with-mysql=/usr/local/mysql' \ '--with-mysqli=/usr/local/mysql/bin/mysql_config' \ '--with-openssl' \ '--with-pcre' \ '--with-pear' \ '--with-png' \ '--with-ttf' \ '--with-xml' \ '--with-xsl' \ '--with-zlib' \ '--without-oci8' Marcus -- Marcus Bointon Synchromedia Limited: Putting you in the picture [EMAIL PROTECTED] | http://www.synchromedia.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Oracle Interface
On 6/10/05, Richard Lynch [EMAIL PROTECTED] wrote: On Fri, June 10, 2005 8:48 am, Shane Presley said: Where can I find some info on integrating Oracle and PHP? http://php.net/oracle pretty much covers it. Thanks! You're right, that looks pretty straight forward. Although I do have two additional questions... How do I find out how my PHP was compiled? The documentation states: You have to compile PHP with the option --with-oracle[=DIR], where DIR defaults to your environment variable ORACLE_HOME. But I'm using PHP from the Red Hat default install (I didn't compile it). Also, do you know if this is Oracle version independent. More specifically will this work with Oracle 10g? Thanks Shane -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Oracle Interface
[snip] How do I find out how my PHP was compiled? The documentation states: You have to compile PHP with the option --with-oracle[=DIR], where DIR defaults to your environment variable ORACLE_HOME. But I'm using PHP from the Red Hat default install (I didn't compile it). Also, do you know if this is Oracle version independent. More specifically will this work with Oracle 10g? [/snip] To find out how your PHP was compiled create a test page with this only... ?php phpinfo(); ? And then load the page from your web server. It will return a wealth of information to you. As far as Oracle compatability it would be hard to know with the info you provided, but you'll find out things like PHP version when you do the test page. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] FW: [nyphp] IBM's PHP Strategy - New York PHP June Meeting - Designer Training June 27th
FYI for those in the tri-state area. -Original Message- From: Hans Zaunere [mailto:[EMAIL PROTECTED] Sent: Sunday, June 12, 2005 2:50 PM To: [EMAIL PROTECTED] Subject: [nyphp-announce] IBM's PHP Strategy - New York PHP June Meeting New York PHP June Meeting -- When: June 28th, 2005 at 6:30pm *sharp* Where: 590 Madison Avenue, Room 1219 (12th floor) Post-Meeting: TGI Fridays at Lexington and 56th NEW RSVP POLICY: You must RSVP within 30 days of the meeting you will attend and must RSVP for every meeting. This means you likely need to RSVP! Please http://www.nyphp.org/rsvp.php to check your RSVP status. If there are any questions, contact us at http://www.nyphp.org/contact.php IBM's PHP Strategy Join us this month as we hear from David Boloker, CTO of Emerging Technology in the IBM Software Group. Dave and his team will speak about IBM's PHP strategy, contributions, and upcoming products. The team from IBM will also discuss the recent Zend Technologies partnership and demonstrate some PHP applications and extensions that are in the works. This meeting promises to be a great opportunity to ask questions about IBM's PHP roadmap. The presenters will cover the following topics: IBM's PHP Strategy (David Boloker) - Why PHP - The Zend relationship - What are we doing and where are we going PHP Technologies and IBM (Stewart Nickolas) - PDO status and efforts - Web services Composite Applications using Mambo (Dan Gisolfi) - Building composite applications with open source components and frameworks Thanks to Dan Krook and Platinum sponsor IBM for providing a great presentation space with seating for plenty. As a service to our community, New York PHP meetings are always free and open to the public. Come prepared with a business card to enter book raffles. When: June 28th, 2005 at 6:30pm *sharp* Where: 590 Madison Avenue, Room 1219 (12th floor) Post-Meeting: TGI Fridays at Lexington and 56th Join us after the meeting for good food and discussion! NEW RSVP POLICY: RSVP online at http://www.nyphp.org/rsvp.php Designer Track Training Seat Available -- We have a couple seats available in the upcoming training in June. If you'd like to attend see http://www.nyphp.org/contactedu and learn more at http://www.nyphp.org/content/training/twodaycourse.php PHP Turns 10 -- Thanks to all those who showed up for our informal get together on June 8th for PHP's tenth birthday. Lots of good development discussion was had! --- New York PHP http://www.nyphp.org AMP Technology Supporting Apache, MySQL and PHP -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Oracle Interface
On 6/13/05, Jay Blanchard [EMAIL PROTECTED] wrote: To find out how your PHP was compiled create a test page with this only... ?php phpinfo(); ? And then load the page from your web server. It will return a wealth of information to you. As far as Oracle compatability it would be hard to know with the info you provided, but you'll find out things like PHP version when you do the test page. Thanks! So it looks like PHP wasn't compiled with the needed variable. PHP Version 4.3.2 './configure' '--host=i386-redhat-linux' '--build=i386-redhat-linux' '--target=i386-redhat-linux-gnu' '--program-prefix=' '--prefix=/usr' '--exec-prefix=/usr' '--bindir=/usr/bin' '--sbindir=/usr/sbin' '--sysconfdir=/etc' '--datadir=/usr/share' '--includedir=/usr/include' '--libdir=/usr/lib' '--libexecdir=/usr/libexec' '--localstatedir=/var' '--sharedstatedir=/usr/com' '--mandir=/usr/share/man' '--infodir=/usr/share/info' '--cache-file=../config.cache' '--with-config-file-path=/etc' '--with-config-file-scan-dir=/etc/php.d' '--enable-force-cgi-redirect' '--disable-debug' '--enable-pic' '--disable-rpath' '--enable-inline-optimization' '--with-bz2' '--with-db4=/usr' '--with-curl' '--with-dom=/usr' '--with-exec-dir=/usr/bin' '--with-freetype-dir=/usr' '--with-png-dir=/usr' '--with-gd' '--enable-gd-native-ttf' '--with-ttf' '--with-gettext' '--with-ncurses' '--with-gmp' '--with-iconv' '--with-jpeg-dir=/usr' '--with-openssl' '--with-png' '--with-pspell' '--with-regex=system' '--with-xml' '--with-expat-dir=/usr' '--with-pcre-regex=/usr' '--with-zlib' '--with-layout=GNU' '--enable-bcmath' '--enable-exif' '--enable-ftp' '--enable-magic-quotes' '--enable-safe-mode' '--enable-sockets' '--enable-sysvsem' '--enable-sysvshm' '--enable-discard-path' '--enable-track-vars' '--enable-trans-sid' '--enable-yp' '--enable-wddx' '--enable-mbstring' '--enable-mbstr-enc-trans' '--enable-mbregex' '--with-pear=/usr/share/pear' '--with-imap=shared' '--with-imap-ssl' '--with-kerberos=/usr/kerberos' '--with-ldap=shared' '--with-mysql=shared,/usr' '--with-pgsql=shared' '--with-unixODBC=shared' '--enable-memory-limit' '--enable-bcmath' '--enable-shmop' '--enable-versioning' '--enable-calendar' '--enable-dbx' '--enable-dio' '--enable-mcal' '--with-apxs2filter=/usr/sbin/apxs' However, there is a section about dbx... dbx support enabled dbx version 1.0.0 supported databases MySQL ODBC PostgreSQL Microsoft SQL Server FrontBase Oracle 8 (oci8) Sybase-CT Not sure what that is? Shane -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: reverse MD5 ???
Richard Lynch wrote: On Fri, June 10, 2005 3:01 pm, Jason Barnett said: That is incredibly interesting stuff, many thanks for that link! So the position seems to be that it may not be feasible to reverse MD5, but it is now feasible to create forged documents / binaries / whatever that result in exactly the same MD5 hash as the original. No. Richard, did you actually go to the site that Greg showed and look at the example? Two very different (as in content) postscript documents... same MD5 hash. I actually tried it out for myself... and indeed the two different documents produced the exact same MD5 sum. That's a one in a billion chance... So, if your binary file HAPPENS to match that meaningless string, you could use that OTHER meaningless string instead... Again I say... did you look at the other meaningless string in the example? I don't pretend to understand how the authors made it work, but it wasn't just some meaningless string that they got to match. I'll bet neither of the two strings has any real-world meaning They just happen to be the two strings that are easy to find that have the same MD5. This has absolutely NO meaning in real-world uses of MD5. You'd have heard a LOT more screaming and wailing and gnashing of teeth if this mattered. :-) Unless of course most people dismiss it the same way that you seem to be dismissing it. ;) -- NEW? | http://www.catb.org/~esr/faqs/smart-questions.html STFA | http://marc.theaimsgroup.com/?l=php-generalw=2 STFM | http://php.net/manual/en/index.php STFW | http://www.google.com/search?q=php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Optimizing Help
Hello, Recently with the help of several of you I got a script working. It's complex, I'm still new, some parts of it came from other authors and I adapted it, and generally despite the fact that it seems to work perfectly at this point, I am certain that there is bloat, repetition and simply useless crap. I'd like to know if anyone can have a look and help me optimize what I have. For example, there are several mysql queries - would it be possible to combine them somehow? I use the image upload section twice because I couldn't figure out how to make it work using different vars within the same section. That kind of newbie stuff. The code is here: http://hashphp.org/pastebin.php?pid=3701 Thanks in advance! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Optimizing Help
Hey there Jackson, The first thing I would consider would be to see if you can classify the code into chunks that do a certain job, and then rewrite them as functions. I would also consider looping through arrays for repetitive jobs (lines 258 - 270 for example). Down the line you could consider the use of classes, your own or ready made - such as the ever useful PEAR (http://pear.php.net). I personally found that the greatest saver of time to be the re-use of code that I know works well for given situations. HTH Chris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Optimizing Help
Thanks, Chris, I see what you're getting at. I'm not sure I understand what you mean about looping through the array in the area you specified- isn't that just the definitions of the vars? Or is that what you meant and I'm missing the point!!? On 6/13/05, Chris Ramsay [EMAIL PROTECTED] wrote: Hey there Jackson, The first thing I would consider would be to see if you can classify the code into chunks that do a certain job, and then rewrite them as functions. I would also consider looping through arrays for repetitive jobs (lines 258 - 270 for example). Down the line you could consider the use of classes, your own or ready made - such as the ever useful PEAR (http://pear.php.net). I personally found that the greatest saver of time to be the re-use of code that I know works well for given situations. HTH Chris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PEAR DB and MSSQL
I originally submitted this to the PHP DB mailing list. Hopefully someone on this list not on the other can give me some help. My company runs a Linux based PHP website with a MySQL database backend. We also have several MSSQL databases deployed throughout the organization. One of our MSSQL databases has a process running on it that transfers it's data to our MySQL database. However this process has become unstable and the data does not always make it over. This is mission critical data and must be present on the website to meet federal and state regulations. Our director has mandated that we get rid of the data transfer and query the MSSQL database directly. I have found several very useful sites on the net to give me instructiosn on setting this up. I installed unixODBC and FreeTDS and set up a test server using fedora core 1. When I first got unixODBC and FreeTDS installed, I was able to connect to the database just fine. However, when I rebooted the server and tried to connect again PEAR returns a db_error object with a message of [nativecode=IM002 [unixODBC][Driver Manager]Data source name not found, and no default driver specified] ** odbc://#:#/@# {hash marks added to hide username and password and ODBC name}. I got the message from the output of print_r($db). After the reboot, I was still able to connect to the MSSQL database from the console using isql so this does not appear to be an issue with unixODBC and FreeTDS. Does anyone have a clue as to why this happened and what I can do to get this working? Thank you, Robbert van Andel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: reverse MD5 ???
In that framework there is no such thing as decrypting an MD5 digest, because an MD5 digest is not an encrypted version of the message to start with. No amount of CPU power will change this basic fact -- though CPU power can be used to do a brute force search for strings which will generate a given MD5 value. However, as stated before, at current levels of computing power this is not feasible for messages beyond I think 7 or 8 characters long (don't quote me on that). One real-world example of the potential weakness of 'md5 out of the box' comes from a consultancy project I was involved in not so long back. The app in question was storing the md5 value of 4-digit PINs in the background database, and the owners of the app were quietly confident that this meant the PINs were 'encrypted' and 'secure'. Of course, there are only 10,000 possible PIN values between and , regardless of whether or not they're stored in plaintext or md5 hashed form, and I guess it took me less than 15 minutes to build a reference table of all md5 hash values for the possible plaintext PINs and therefore effortlessly retrieve the plaintext PIN values from their table. Imagine their surprise. And if *I* could do it... Md5 is a very handy way of 'securing' [1] password information, but only when the plaintext value offers enough possible variation in length and / or value to make building a 'possible variations' lookup table a difficult proposition. Regards, Murray Footnotes: [1] Without wanting to get into a technical debate of exactly what constitutes 'secure' when it comes to hashing / encrypting sensitive information -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Optimizing Help
Jackson, Yeah, what you can do is place all your form values you just got into an array, and then act on each of them in turn by looping through the array when it comes to repetitive jobs, such as the mysql_real_escape_string(trim($_POST['variable'])) part of the code I referred to earlier. You could also use a similar method for generating your date option menus later (lines 342). Needless to say, this is only my way of doing things, and other list members will have different/better ideas no doubt!!! Cheers Chris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Documenting Code Question
Hi Cris, I think object is necessary for PHPDoc standart (or similar);) But a detailed description of what object contains will be very helpfull. Unfortunatly you should make it in a separate file. -- Bogomil B. Shopov http://purplerain.org Reply --- Chris Drozdowski wrote: I need some help regarding documenting code. Say you have a function/method that takes an object as a parameter and/or returns an object. When documenting, do you specify the specific class of the object when listing the datatype in the docblock @param and @return specs or do you simply specify object? Thanks, Chris Drozdowski [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] include()
Hi Just a quickie. Is there a big difference between me including a file by putting the url in the include() such as include(http://www.examplesite.com/examplefile.php) and putting the server path such as include(number/www.examplesite.com/public_html/examplefile.php) ? I want to get into good habits you see. I assume I have to use the first example when the file is on a different server. Many thanks. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] include()
() is meaningless in an include. But in PHP you can put () around just about anything you want. Just like you can do: $a = ($b); There is no point in the brackets there. The PHP parser simply uses brackets to create precedence groups. So yes, you can do include(foo.php) if you want, but you are just making the parser do extra work for no reason. -Rasmus I. Gray wrote: Hi Just a quickie. Is there a big difference between me including a file by putting the url in the include() such as include(http://www.examplesite.com/examplefile.php) and putting the server path such as include(number/www.examplesite.com/public_html/examplefile.php) ? I want to get into good habits you see. I assume I have to use the first example when the file is on a different server. Many thanks. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: reverse MD5 ???
Murray @ PlanetThoughtful wrote: The app in question was storing the md5 value of 4-digit PINs in the background database, and the owners of the app were quietly confident that this meant the PINs were 'encrypted' and 'secure'. Amazing. Thanks for sharing that. It's a great example. :-) Of course, there are only 10,000 possible PIN values between and , regardless of whether or not they're stored in plaintext or md5 hashed form, and I guess it took me less than 15 minutes to build a reference table of all md5 hash values for the possible plaintext PINs and therefore effortlessly retrieve the plaintext PIN values from their table. There are efforts to create these types of tables for arbitrary strings: http://md5.rednoize.com/ Of course, it's worth noting that these methods aren't reversing MD5. Md5 is a very handy way of 'securing' [1] password information, but only when the plaintext value offers enough possible variation in length and / or value to make building a 'possible variations' lookup table a difficult proposition. Exactly, and this is why it's a good practice to use a seed when you generate MD5s for passwords. Thanks again for the story, frightening as it was. :-) Chris -- Chris Shiflett Brain Bulb, The PHP Consultancy http://brainbulb.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: include()
* I. Gray [EMAIL PROTECTED]: Is there a big difference between me including a file by putting the url in the include() such as include(http://www.examplesite.com/examplefile.php) and putting the server path such as include(number/www.examplesite.com/public_html/examplefile.php) ? I want to get into good habits you see. I assume I have to use the first example when the file is on a different server. From a security standpoint, you usually only want to include and/or require files that are on your local system (your second example), unless under unusual circumstances (content sharing agreements with other sites, etc). Ideally, unless you want access to those scripts directly (i.e., http://www.examplesite.com/examplefile.php), you should place them somewhere in your include_path, which should be _outside_ the web server's document root. This prevents idle hacking attempts, and is generally considered a best practice. Additionally, using a network stream (which is what you're using when you specify 'http://') means that you've got additional performance overhead. Network streams are often more costly, resource wise, than file streams, and if the file truly is on a remote network, you then have to wait for that transaction to finish before continuing with your own processing. If you need to pull content off another server, but that content does not change often, you would be wise to have a background process running that pulls this content and caches it for use in your scripts. -- Matthew Weier O'Phinney | WEBSITES: Webmaster and IT Specialist | http://www.garden.org National Gardening Association| http://www.kidsgardening.com 802-863-5251 x156 | http://nationalgardenmonth.org mailto:[EMAIL PROTECTED] | http://vermontbotanical.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Documenting Code Question
* Chris Drozdowski [EMAIL PROTECTED]: I need some help regarding documenting code. Say you have a function/method that takes an object as a parameter and/or returns an object. When documenting, do you specify the specific class of the object when listing the datatype in the docblock @param and @return specs or do you simply specify object? You should mention that this has to do with PhpDocumentor... :-) The documentation for PhpDoc says that you can specify either 'object' or the classname of the object's type that is expected. If the class is in your documentation tree, then it will even link to that class' documentation; if not, it shows it statically. I tend to go with the class name, as it gives more information to the individual reading the documentation. -- Matthew Weier O'Phinney | WEBSITES: Webmaster and IT Specialist | http://www.garden.org National Gardening Association| http://www.kidsgardening.com 802-863-5251 x156 | http://nationalgardenmonth.org mailto:[EMAIL PROTECTED] | http://vermontbotanical.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] include()
Hello, Monday, June 13, 2005, 5:02:40 PM, you wrote: IG Is there a big difference between me including a file by putting IG the url in the include() such as IG include(http://www.examplesite.com/examplefile.php) and putting IG the server path such as IG include(number/www.examplesite.com/public_html/examplefile.php) Well the first will have to use an HTTP stream (socket operation) in order to open the file, whereas the second will use a simple File stream. A file stream on a local host is nearly always going to be faster as it carries far less protocol baggage with it. IG I assume I have to use the first example when the file is on a IG different server. If the only way to access this file is via HTTP then yes. You do realise that when you use include with an HTTP address that only the *resulting output* of that PHP file will be included? (just making sure -- you cannot split up code across servers using include) Best regards, Richard Davey -- http://www.launchcode.co.uk - PHP Development Services I do not fear computers. I fear the lack of them. - Isaac Asimov -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Tried to run PHP as shell script and got the error...
Oh, forgot to add the ! to the #/usr/local/bin/php.. Since it's my first time in shell scripting with php so I wasn't thinking correctly... Scott Fletcher [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hi! I'm trying to run PHP as a shell script but I got the error message... Source code below is ... --snip-- #/usr/local/bin/php ? echo Hello World!!\n; ? --snip-- Attempt to run the file below and got the error --snip-- -=[/usr/local/bin]==./ecbi_inquiry_pull_experian.sh Hello World!!\n ./ecbi_inquiry_pull_experian.sh: line 4: syntax error near unexpected token `?' ./ecbi_inquiry_pull_experian.sh: line 4: `?' --snip-- I checked to see if there's no spaces at the end on line 4 and there isn't... So, how do I get it working so I can hook up the file to the crontab. Thanks, FletchSOD -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] pcntl_fork and reading from childs stdout
Hi Richard, Thanks for the response. I'll try out the fifo. Tom [EMAIL PROTECTED] wrote: On Sun, June 12, 2005 12:57 pm, Tom Fishwick said: I have a script that spawns off a bunch of children with pcntl_fork(), but I can't figure out how to connect up a pipe from the parent to each childs stdout and stdin. In c I would use pipe,close and dup... This might help: http://php.net/posix-mkfifo How you would tie stdout to your named pipe... Or perhaps you could http://php.net/exec something in each process to re-direct or tee stdin/stdout to your named pipes. Or... I dunno, really, just guessing. -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: reverse MD5 ???
Amazing. Thanks for sharing that. It's a great example. :-) You're very welcome! If it helps just one other developer avoid the same pitfall, then today is a very good day. :-) Exactly, and this is why it's a good practice to use a seed when you generate MD5s for passwords. Which is exactly what I suggested, and what they ended up implementing, thanks to the fact that I could provide them with the original plaintext PIN values for the existing records. Still, once I'd had a chance to look at the plaintext PINs, it was depressing to notice the frequency of 'easy' PIN values, such as '', '1234', '' etc. Even with a seed, those values would have been relatively easy to guess at with frequency analysis, and it goes beyond my meager hostile decryption skills to guess at whether that made deriving the seed any easier or not. I suggested implementing a class that randomly selected from somewhere between 5 to 10 possible seed values when hashing the PIN for storage, which would have meant simply using all 5 or 10 seeds when comparing the PIN for subsequent validation, to reduce the frequency of hash-to-easy-PIN repetition, but it hadn't been implemented by the time my consultancy ended and I'd be willing to bet a year's pay it, or any other method of providing some sort of buffering against frequency analysis, hasn't been since. Of course, there's a whole conversation to be had regarding the fact that if your db server has been compromised to the point where the contents of tables are exposed, then it's reasonable to at least speculate (depending on your server setup and method by which it was accessed) that perhaps your entire app has been compromised, and your seed values may now be known to the hostile entity as well. Still and all, there's absolutely no reason to make the job of compromising your data any easier on a hypothetical hacker than is within your level of competency as a developer. Adding a seed value to md5 hashes is a simple and effective method under most circumstances that even beginner to intermediate developers can employ. In other words, It Is A Very Good Thing. ;-) Regards, Murray -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP 4.4.0RC1
Hello! The PHP Team just released it's first release candidate for PHP 4.4.0. This is solely a bug-fix only release, the increased middle digit is needed because this release changes PHP's Internal API that causes third-party binary extensions to be incompatible with PHP 4.3.x. This release address a major problem within PHP concerning references. If references where used in a wrong way, PHP would often create memory corruptions which would not always surface and be visible. In other cases it can cause variables and objects to change type or class. If you encountered strange behavior like this, this release might fix it. Besides addressing this reference related bug, 46 other bugs are fixed. Please test this release and report any bugs or problems in our bugsystem (after searching first). If all goes well I plan to roll a release of 4.4.0 on June 27th. If there are problems a new RC will follow. Only critical bugs are going to be fixed between RC1 and RC2. You can find 4.4.0 RC1 at http://qa.php.net/~derick/php-4.4.0RC1.tar.bz2 regards, Derick -- Derick Rethans http://derickrethans.nl | http://ez.no | http://xdebug.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP Bug/Error with XML Parsing Syntax??
I'm not sure what's wrong with PHP.. I ran the XML file through the Mozilla and it validate just fine. I get XML parse error but it gave no reason for the errors. The source code here is [code] $data = MessageWere changing/Message; $xml_parser = xml_parser_create('ISO-8859-1'); xml_parser_set_option($xml_parser, XML_OPTION_SKIP_WHITE, 1); xml_parse_into_struct($xml_parser, trim($data), $vals, $index); if (xml_error_string($xml_parser)) { echo br; echo XML error in given source on br; echo Line: .xml_get_current_line_number($xml_parser).br; echo Column: .xml_get_current_column_number($xml_parser).br; echo Reason: .xml_error_string(xml_get_error_code($xml_parser)).br; echo br; echo XML Data: .$data; echo br; } xml_parser_free($xml_parser); [/code] The Error output is ... [code] XML error in given source on Line: 1 Column: 32 Reason: MessageWere changing/Message [/code] Anyone know?? I'm using PHP version 4.3.2 Thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: PHP 4.4.0RC1
I've tested it under solaris 9 and it failed 3 tests: = FAILED TEST SUMMARY - Bug #31213 (Sideeffects caused by bug #29493) [ext/standard/tests/array/bug31213.phpt] Bug #25665 (var_dump () hangs on Nan and INF) [ext/standard/tests/math/bug25665.phpt] Bug #27780 (strtotime(+1 xxx) returns a wrong date/time) [ext/standard/tests/time/bug27780.phpt] = = TEST RESULT SUMMARY - Exts skipped: 78 Exts tested :9 - Number of tests : 629 Tests skipped : 284 (45.2%) Tests warned:0 (0.0%) Tests failed:3 (0.5%) Tests passed: 342 (54.4%) - Time taken : 38 seconds = Nuno P.S.: the 'make test' didn't submit the report properly (at least i couldnt find it in the news server) Derick Rethans [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hello! The PHP Team just released it's first release candidate for PHP 4.4.0. This is solely a bug-fix only release, the increased middle digit is needed because this release changes PHP's Internal API that causes third-party binary extensions to be incompatible with PHP 4.3.x. This release address a major problem within PHP concerning references. If references where used in a wrong way, PHP would often create memory corruptions which would not always surface and be visible. In other cases it can cause variables and objects to change type or class. If you encountered strange behavior like this, this release might fix it. Besides addressing this reference related bug, 46 other bugs are fixed. Please test this release and report any bugs or problems in our bugsystem (after searching first). If all goes well I plan to roll a release of 4.4.0 on June 27th. If there are problems a new RC will follow. Only critical bugs are going to be fixed between RC1 and RC2. You can find 4.4.0 RC1 at http://qa.php.net/~derick/php-4.4.0RC1.tar.bz2 regards, Derick -- Derick Rethans http://derickrethans.nl | http://ez.no | http://xdebug.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] formatting paragraphs in to strings
Hi, I'm having a perplexing problem. I'm gather data through a textarea html from field and dumping it to MySQL. I want to display the data as a long string with no carriage returns or line breaks in a dhtml div window. The problem I'm have is that the form data is remembering the carriage returns. I tried using trim() and rtrim() with no luck. The data is still formatted exactly like it was inputed. Any ideas why this is happening and how I can format the text properly?? TIA! -- Paul Nowosielski Webmaster CelebrityAccess.com 303.440.0666 ext:219 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] formatting paragraphs in to strings
Use the PHP str_replace function before writing it to the DB. Replace all \n characters with an empty string . http://us2.php.net/manual/en/function.str-replace.php On 6/13/05, Paul Nowosielski [EMAIL PROTECTED] wrote: Hi, I'm having a perplexing problem. I'm gather data through a textarea html from field and dumping it to MySQL. I want to display the data as a long string with no carriage returns or line breaks in a dhtml div window. The problem I'm have is that the form data is remembering the carriage returns. I tried using trim() and rtrim() with no luck. The data is still formatted exactly like it was inputed. Any ideas why this is happening and how I can format the text properly?? TIA! -- Paul Nowosielski Webmaster CelebrityAccess.com 303.440.0666 ext:219 -- 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] formatting paragraphs in to strings
Use the PHP str_replace function before writing it to the DB. Replace all \n characters with an empty string . http://us2.php.net/manual/en/function.str-replace.php I think it might be better to replace all \n characters with spaces , otherwise you will end up with sentences that have no space break between them. Ie: original text This is the first sentence. This is the second sentence. /original text ...would become: replaced text This is the first sentence.This is the second sentence. /replaced text Regards, Murray -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] formatting paragraphs in to strings
Good point. Only problem is, if someone hit enter a-million times, you would end up with a-million spaces where the \n characters were. To take care of that repetition, maybe something like: while (strpos($textarea_text, \n\n)) { . } would be one way you could do it. On 6/13/05, Murray @ PlanetThoughtful [EMAIL PROTECTED] wrote: Use the PHP str_replace function before writing it to the DB. Replace all \n characters with an empty string . http://us2.php.net/manual/en/function.str-replace.php I think it might be better to replace all \n characters with spaces , otherwise you will end up with sentences that have no space break between them. Ie: original text This is the first sentence. This is the second sentence. /original text ...would become: replaced text This is the first sentence.This is the second sentence. /replaced text Regards, Murray -- 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] formatting paragraphs in to strings
Good point. Only problem is, if someone hit enter a-million times, you would end up with a-million spaces where the \n characters were. To take care of that repetition, maybe something like: while (strpos($textarea_text, \n\n)) { . } would be one way you could do it. Ordinarily most browsers render multiple consecutive spaces as a single space. This doesn't mean that it's not a good idea to remove them, just that not doing so shouldn't effect the way the text is displayed in the div tag, as the original poster mentioned was his intention. Regards, Murray -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] formatting paragraphs in to strings
Right.. But the browser also should be ignoring the carriage returns as well, which makes me think the div is set to white-space: pre; or something. He said the text is being formatted in a div exactly how it is entered into the system. By default, a div does not render any carriage returns. On 6/13/05, Murray @ PlanetThoughtful [EMAIL PROTECTED] wrote: Good point. Only problem is, if someone hit enter a-million times, you would end up with a-million spaces where the \n characters were. To take care of that repetition, maybe something like: while (strpos($textarea_text, \n\n)) { . } would be one way you could do it. Ordinarily most browsers render multiple consecutive spaces as a single space. This doesn't mean that it's not a good idea to remove them, just that not doing so shouldn't effect the way the text is displayed in the div tag, as the original poster mentioned was his intention. Regards, Murray -- 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] OT ??: Form posting without leaving form
This is perhaps a javascript question Is there a way to post a form to a url without having a user submit from the form? I have a php web page that is a detailed form with a lot of fields. If the user does some work on this form and let's it sit, their session can time out (I had this happen to the user after it sat for 2 hours). Is there some way to have a timer in the page and have partial form results sent back to the server, but still leave the form on the screen as-is? In other words, I want to have the client periodically post the form data back to the server, but leave the same web page displayed. Thanks, Bruce -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] OT ??: Form posting without leaving form
Check out the xmlhttp object in Javascript: http://jibbering.com/2002/4/httprequest.html On 6/13/05, Kall, Bruce A. [EMAIL PROTECTED] wrote: This is perhaps a javascript question Is there a way to post a form to a url without having a user submit from the form? I have a php web page that is a detailed form with a lot of fields. If the user does some work on this form and let's it sit, their session can time out (I had this happen to the user after it sat for 2 hours). Is there some way to have a timer in the page and have partial form results sent back to the server, but still leave the form on the screen as-is? In other words, I want to have the client periodically post the form data back to the server, but leave the same web page displayed. Thanks, Bruce -- 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] formatting paragraphs in to strings
On Mon, June 13, 2005 12:06 pm, Paul Nowosielski said: I'm having a perplexing problem. I'm gather data through a textarea html from field and dumping it to MySQL. I want to display the data as a long string with no carriage returns or line breaks in a dhtml div window. What styles have you applied to the div and surrounding elements? The problem I'm have is that the form data is remembering the carriage returns. I tried using trim() and rtrim() with no luck. The data is still formatted exactly like it was inputed. That sounds like PRE tag (or 'pre' style) or perhaps http://php.net/nl2br is being used when you don't really want that. Any ideas why this is happening and how I can format the text properly?? Show us actual output, like a URL for better guesses. -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP Bug/Error with XML Parsing Syntax??
On Mon, June 13, 2005 10:21 am, Scott Fletcher said: I'm not sure what's wrong with PHP.. I ran the XML file through the Mozilla and it validate just fine. I get XML parse error but it gave no reason for the errors. The source code here is [code] $data = MessageWere changing/Message; $xml_parser = xml_parser_create('ISO-8859-1'); xml_parser_set_option($xml_parser, XML_OPTION_SKIP_WHITE, 1); xml_parse_into_struct($xml_parser, trim($data), $vals, $index); if (xml_error_string($xml_parser)) { echo br; echo XML error in given source on br; echo Line: .xml_get_current_line_number($xml_parser).br; echo Column: .xml_get_current_column_number($xml_parser).br; echo Reason: .xml_error_string(xml_get_error_code($xml_parser)).br; echo br; echo XML Data: .$data; echo br; } xml_parser_free($xml_parser); [/code] The Error output is ... [code] XML error in given source on Line: 1 Column: 32 Reason: MessageWere changing/Message [/code] Anyone know?? I'm using PHP version 4.3.2 Thanks Wild Guess! Column 32 is the end of your data. Perhaps it wants a newline??? Or, perhaps, you need something like a doctype at the beginning? -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] formatting paragraphs in to strings
Good point. Only problem is, if someone hit enter a-million times, you would end up with a-million spaces where the \n characters were. To take care of that repetition, maybe something like: while (strpos($textarea_text, \n\n)) { . } would be one way you could do it. $new_str = ereg_replace([\n\r]+, , $textarea_text); would be another and avoid the loop as well at the expense of adding some regexps :) On 6/13/05, Murray @ PlanetThoughtful [EMAIL PROTECTED] wrote: Use the PHP str_replace function before writing it to the DB. Replace all \n characters with an empty string . http://us2.php.net/manual/en/function.str-replace.php I think it might be better to replace all \n characters with spaces , otherwise you will end up with sentences that have no space break between them. Ie: original text This is the first sentence. This is the second sentence. /original text ...would become: replaced text This is the first sentence.This is the second sentence. /replaced text Regards, Murray -- 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 General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] =?iso-8859-1?Q?Re:_[PHP]_OT_??:_Form_posting_without_leaving_form?=
I did this using PHP and Javascript not too long ago. My solution may not be elegant but it works. I set up an inline frame on a page that had my large form. I set the soruce of the frame to my processing page and set the display style of the frame to none using CSS. Then for all the form elements, I set an onchange event that called a javascript function. The function creates a query string that is passed to the source page of the frame. Kall, Bruce A. [EMAIL PROTECTED] wrote on 06/13/2005, 07:28:44 PM: This is perhaps a javascript question Is there a way to post a form to a url without having a user submit from the form? I have a php web page that is a detailed form with a lot of fields. If the user does some work on this form and let's it sit, their session can time out (I had this happen to the user after it sat for 2 hours). Is there some way to have a timer in the page and have partial form results sent back to the server, but still leave the form on the screen as-is? In other words, I want to have the client periodically post the form data back to the server, but leave the same web page displayed. Thanks, Bruce -- 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] OT ??: Form posting without leaving form
Kall, Bruce A. wrote: I have a php web page that is a detailed form with a lot of fields. If the user does some work on this form and let's it sit, their session can time out (I had this happen to the user after it sat for 2 hours). Is there some way to have a timer in the page and have partial form results sent back to the server, but still leave the form on the screen as-is? Why not construct your application so that a user can enter the password again after timing out and continue? If I submit a form, and you tell me that I've timed out, I should be able to provide my password and not lose everything. You have all of the data in $_POST or $_GET. Do something with it. :-) There may be some client-side way to handle this, but it's definitely not necessary. Chris -- Chris Shiflett Brain Bulb, The PHP Consultancy http://brainbulb.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP Bug/Error with XML Parsing Syntax??
Finally, the newsgroup start working once again... The problem was if (xml_error_string($xml_parser)) { which I was told should be if (xml_get_error_code($xml_parser) != XML_ERROR_NONE) { It solve my problem now. Now how do I parse the DTD's entity, element, etc along with the PHP's xml_parse_into_struct() I figured that I would need to add another function before that to make it work. So, can anyone give me an example that would do the trick?? XML Code is --snip-- ?xml version=1.0 standalone=yes? !DOCTYPE NewsFeed [ !ENTITY nbsp test ] NewsFeed Message Blah nbsp;nbsp;nbsp;Arcadia, nbsp;nbsp;nbsp;nbsp;nbsp;TranSouth /Message /NewsFeed --snip-- I got --snip-- Blah Arcadia, TransSouth --snip-- with no nbsp; within those data in the Message tag.. Thanks... FletchSOD Richard Lynch [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] On Mon, June 13, 2005 10:21 am, Scott Fletcher said: I'm not sure what's wrong with PHP.. I ran the XML file through the Mozilla and it validate just fine. I get XML parse error but it gave no reason for the errors. The source code here is [code] $data = MessageWere changing/Message; $xml_parser = xml_parser_create('ISO-8859-1'); xml_parser_set_option($xml_parser, XML_OPTION_SKIP_WHITE, 1); xml_parse_into_struct($xml_parser, trim($data), $vals, $index); if (xml_error_string($xml_parser)) { echo br; echo XML error in given source on br; echo Line: .xml_get_current_line_number($xml_parser).br; echo Column: .xml_get_current_column_number($xml_parser).br; echo Reason: .xml_error_string(xml_get_error_code($xml_parser)).br; echo br; echo XML Data: .$data; echo br; } xml_parser_free($xml_parser); [/code] The Error output is ... [code] XML error in given source on Line: 1 Column: 32 Reason: MessageWere changing/Message [/code] Anyone know?? I'm using PHP version 4.3.2 Thanks Wild Guess! Column 32 is the end of your data. Perhaps it wants a newline??? Or, perhaps, you need something like a doctype at the beginning? -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Optimizing Help
jack jackson wrote: Hello, Recently with the help of several of you I got a script working. It's complex, I'm still new, some parts of it came from other authors and I adapted it, and generally despite the fact that it seems to work perfectly at this point, I am certain that there is bloat, repetition and simply useless crap. I'd like to know if anyone can have a look and help me optimize what I have. For example, there are several mysql queries - would it be possible to combine them somehow? I use the image upload section twice because I couldn't figure out how to make it work using different vars within the same section. That kind of newbie stuff. The code is here: http://hashphp.org/pastebin.php?pid=3701 # ?php # # require_once('nscfg.php'); # # //Initialize vars # $query = ''; # $dropdown = ''; # $result = 0; # $errors = array(); # $msgArray = array(); # $msgText = ''; be neat, it helps: $query = ''; $dropdown= ''; $result = 0; # # $query = 'SELECT art.*,publisher.* # FROM art,subject,publisher,series # GROUP BY publisher_name'; make good (ab)use of alignment (your style may differ ;-) $query = 'SELECT art.*, publisher.* FROM art, subject, publisher, series GROUP BY publisher_name'; // ps - why is 'series' 'subject' in there? # # $subject_query = 'SELECT art.*,subject.* # FROM art,subject # GROUP BY subject_name'; # # $series_query = 'SELECT art.*,series.* # FROM art,series # GROUP BY series_name'; # # $media_query = 'SELECT media_id,media_name # FROM media # GROUP BY media_name'; # # $result = mysql_query($query); # $media_result = mysql_query($media_query); # $subject_result = mysql_query($subject_query); # $series_result = mysql_query($series_query); # instead of creating 4 result identifiers, run and loop thru 1 at a time, its allows you to reuse a single $result var (as well as being better in other ways) # $dropdown_publishers = 'select name=publisher'; # while ($rows = mysql_fetch_assoc($result)){ # $dropdown_publishers .= 'option value=' . $rows['publisher_id'] . '' . htmlentities($rows['publisher_name']); # } # $dropdown_publishers .= '/select'; here is a candidate for a function: buildOptionList($name, $result, $valKey, $nameKey) { while ($row = mysql_fetch_assoc($result)) { $dropdown[] = 'option value=' . htmlentities($row[$valKey], ENT_QUOTES) . '' . htmlentities($row[$nameKey], ENT_QUOTES) . '/option'; // options have closing tags } return 'select name=' . $name . '' . join('',$dropdown) . '/select'; } # # # $dropdown_subject = 'select name=subject'; # while ($rows = mysql_fetch_assoc($subject_result)){ ^- white space? # $dropdown_subject .= 'option value=' . $rows['subject_id'] . '' . htmlentities($rows['subject_name']); # } # $dropdown_subject .= '/select'; # # $dropdown_series = 'select name=seriesoption value=Select A Series/option'; # while ($rows = mysql_fetch_assoc($series_result)){ # $dropdown_series .= 'option value=' . $rows['series_id'] . '' . htmlentities($rows['series_name']); # } # $dropdown_series .= '/select'; # # $checkbox_media = array (); # $media_types = array(); # while ($media_rows = mysql_fetch_assoc($media_result)){ # $checkbox_media[] = input type='checkbox' name='media_types[]' value='{$media_rows['media_id']}' /{$media_rows['media_name']} ; # } # # ///IMAGE SECTION - MAIN IMAGE (IMAGE UPLOAD SCRIPT COPYRIGHT INFO IN CFG FILE) # ///THIS SECTION Copyright (c) 2000 Marcus Kazmierczak, [EMAIL PROTECTED] # if ($REQUEST_METHOD == POST) # { # $uploaddir = images/jpg; # # /*== checks the extension for .jpg or .tiff ==*/ # $pext = getFileExtension($imgfile_name); TURN OFF register_globals, and access the $_FILES array instead. # # $pext = strtolower($pext); # # # //If main image don't match extentions # if (empty($POST['imgfile'])) { # $errors[] = 'Please select an image. This is sort of the whole point, yes?'; your error checking for whether the image was actually uploaded is non-existent, check the manual (+usernotes) for guidelines on how to check whether anything made it thru. # } # # if (($pext != jpg) ($pext != jpeg) ($pext != tif) ($pext != tiff)) # { or maybe: $validExtensions = array(jpg,jpeg,tif,tiff); if (!in_array($pext, $validExtensions)) { /* bad */ } /* having said that the file extension doesn't say anything - better to use the info returned by imagegetsize() ... read this: http://nl2.php.net/manual/en/function.getimagesize.php */ # print h1DOH!/h1pThat's not a valid image extension. br /; # print pYou are only permitted to upload JPG, JPEG, tif or TIFF images with the extension .jpg, .jpeg, .tif or
Re: [PHP] What Works Works Validator
Although this isn't a validator, I recently found this site which seems to hold a lot of good information for supporting a wide range of browsers (especially some of the dinosaurs). http://www.quirksmode.org/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Delivery reports about your e-mail
ALERT! This e-mail, in its original form, contained one or more attached files that were infected with a virus, worm, or other type of security threat. This e-mail was sent from a Road Runner IP address. As part of our continuing initiative to stop the spread of malicious viruses, Road Runner scans all outbound e-mail attachments. If a virus, worm, or other security threat is found, Road Runner cleans or deletes the infected attachments as necessary, but continues to send the original message content to the recipient. Further information on this initiative can be found at http://help.rr.com/faqs/e_mgsp.html. Please be advised that Road Runner does not contact the original sender of the e-mail as part of the scanning process. Road Runner recommends that if the sender is known to you, you contact them directly and advise them of their issue. If you do not know the sender, we advise you to forward this message in its entirety (including full headers) to the Road Runner Abuse Department, at [EMAIL PROTECTED] The message could not be delivered file attachment: Message.scr This e-mail in its original form contained one or more attached files that were infected with the [EMAIL PROTECTED] virus or worm. They have been removed. For more information on Road Runner's virus filtering initiative, visit our Help Member Services pages at http://help.rr.com, or the virus filtering information page directly at http://help.rr.com/faqs/e_mgsp.html. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] OT ??: Form posting without leaving form
On Mon, 2005-06-13 at 17:26, Chris Shiflett wrote: Kall, Bruce A. wrote: I have a php web page that is a detailed form with a lot of fields. If the user does some work on this form and let's it sit, their session can time out (I had this happen to the user after it sat for 2 hours). Is there some way to have a timer in the page and have partial form results sent back to the server, but still leave the form on the screen as-is? Why not construct your application so that a user can enter the password again after timing out and continue? If I submit a form, and you tell me that I've timed out, I should be able to provide my password and not lose everything. You have all of the data in $_POST or $_GET. Do something with it. :-) There may be some client-side way to handle this, but it's definitely not necessary. Keepalive session ping :) Just retrieve some content via javascript that keeps the session going. I'm not necessarily advocating this for the best solution, but it is a client side solution with very little complexity. Cheers, Rob. -- .. | InterJinn Application Framework - http://www.interjinn.com | :: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Displaying an Outlook Calendar on a webpage using PHP
Hi, perhaps someone might be able to look at this code - it works when I run it from the command line, but not when viewed through a web page. I am running IIS 6 on Windows 2003 server. Thanks Justin ?php $comobjOutlook = new COM(outlook.application) or die(Unable to instantiate outlook); $comobjOutlook - Activate; # This is your mailbox name just like it appears in your Folders view. It might be 'Inbox' or something else. $targetmailboxname = Mailbox - Baiocchi, Justin (CSIRO IT, Armidale); # This is the folder you're looking for. In this case, I'm looking for calendar items, but you can look for # any folder. You need to add another loop to look for subfolders. Although there's probably a better # way, that's how I did it when I needed to get to Personal Folders/Inbox/Subfoldername $targetfoldername = Calendar; $objNamespace = $comobjOutlook-GetNameSpace(MAPI); $objFolders = $objNamespace-Folders(); $mailboxcount = $objFolders - Count(); $foundmailbox = FALSE; for ($i=1; $i=$mailboxcount; $i++) { $folderitem = $objFolders -Item($i); if ($folderitem - Name == $targetmailboxname) { $objMailbox = $folderitem; $foundmailbox = TRUE; } } $foundcal = FALSE; if ($foundmailbox) { $objFolders = $objMailbox-Folders(); $foldercount = $objFolders - Count(); for ($i=1; $i=$foldercount; $i++) { $folderitem = $objFolders - Item($i); if ($folderitem - Name == $targetfoldername) { $objCalendar = $folderitem; $foundcal = TRUE; } } if ($foundcal) { $objItems = $objCalendar-Items(); $itemcount = $objItems-Count(); for ($i=1; $i=$itemcount; $i++) { $apptitem = $objItems - Item($i); $apptstart = $apptitem - Start(); $apptend = $apptitem - End(); $apptallday = $apptitem - AllDayEvent(); $apptrecur = $apptitem - IsRecurring(); $apptsubject = $apptitem - Subject(); $apptlocation = $apptitem - Location(); $secondsadj = $apptstart - 14400; $startadj = date(m/d/Y H:i:s, mktime(0,0,$secondsadj,1,1,1970)); $secondsadj = $apptend - 14400; $endadj = date(m/d/Y H:i:s, mktime(0,0,$secondsadj,1,1,1970)); if($apptallday) { $allday = All Day; } else { $allday = ; } if($apptrecur) { $recurring = Recurring; } else { $recurring = ; } echo $apptsubject @ $apptlocation\r\nFrom: $startadj To: $endadj\r\n; if ($allday OR $recurring ) echo $allday $recurring\r\n; echo \r\n\r\n; } } else { die (Did not find calendar folder); } } else { die(Did not find target mailbox: $targetmailboxname); } ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: OT ??: Form posting without leaving form
Hello, on 06/13/2005 02:28 PM Kall, Bruce A. said the following: Is there a way to post a form to a url without having a user submit from the form? I have a php web page that is a detailed form with a lot of fields. If the user does some work on this form and let's it sit, their session can time out (I had this happen to the user after it sat for 2 hours). Is there some way to have a timer in the page and have partial form results sent back to the server, but still leave the form on the screen as-is? In other words, I want to have the client periodically post the form data back to the server, but leave the same web page displayed. Simple, user the target attribute of the form to specify the name of frame (zero sized if you want the user to not see the results). -- 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