[PHP] pear website?
does anybody know if the pear website is having any problems? i cant seem to be able to go there and its the only website giving me problems right now... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Why don't webhosts upgrade to PHP5 ?
My webhost doesn't want to upgrade to PHP5 because of security reasons and some scripts that will mallfunction. I find it hard to believe. Current conf of webhost is PHP 4.3.11, Apache 1.3.33 and MySQL 3.23.49. What real reasons could there be not to upgrade ? How could I convince them to upgrade to PHP5 ? (Less important for me : but why not upgrade to Apache 2.x and at least MySQL 4.x ?) Enlighten me, Pugi! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Security question
Hi list I've got a concern for a user add/edit form. Right now when the user is logged in, I put its id in the session. Then when the user edits his details I put the id in the form and when it comes back I verify if the id matches the one in the session. Is it possible for someone who does not have access to the server to edit arbitary accounts? With kind regards Andy -- Now listening to Top! Radio Live www.topradio.be/stream on amaroK Geek code: www.vlaamse-kern.com/geek Registered Linux User No 379093 If life was for sale, what would be its price? www.vlaamse-kern.com/sas/ for free php utilities -- pgpWGI97TkKdb.pgp Description: PGP signature
Re: [PHP] Security question
Andy Pieters napisał(a): Is it possible for someone who does not have access to the server to edit arbitary accounts? well this depends on the forum You use, there're many many exploits out there. The best way to know is to try and keep up with places like the bugtraq@securityfocus.com list, or other security websites/mailing lists and such. -- Best wishes Łukasz -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Why don't webhosts upgrade to PHP5 ?
On Wednesday 07 December 2005 08:37, Pugi! wrote: > My webhost doesn't want to upgrade to PHP5 because of security reasons and > some scripts that will mallfunction. I find it hard to believe. Current > conf of webhost is PHP 4.3.11, Apache 1.3.33 and MySQL 3.23.49. > What real reasons could there be not to upgrade ? > How could I convince them to upgrade to PHP5 ? > (Less important for me : but why not upgrade to Apache 2.x and at least > MySQL 4.x ?) 1. If it ain't broken, don't fix it. 2. PHP 4 has proven its worth. Now that PHP 5 came out, there will be tons of bugs that aren't found yet. 3. PHP 5 *WILL* break some scripts, and most big suits like forums and shops and stuff will need a serious amount of work to convert to php 5 Same applies for Apache and MySQL. Consider this, NASA still uses 386 cpu's in their space equipment because they are a lot more stable and mission secure then newer chipsets. HTH Andy -- Now listening to Top! Radio Live www.topradio.be/stream on amaroK Geek code: www.vlaamse-kern.com/geek Registered Linux User No 379093 If life was for sale, what would be its price? www.vlaamse-kern.com/sas/ for free php utilities -- pgpJOPHFo2w1x.pgp Description: PGP signature
Re: [PHP] Security question
On Wednesday 07 December 2005 08:57, Łukasz Hejnak wrote: > The best way to know is to try and keep up with places like > the bugtraq@securityfocus.com list, or other security websites/mailing > lists and such. > It isn't a forum, it is software I write myself. -- Now listening to Top! Radio Live www.topradio.be/stream on amaroK Geek code: www.vlaamse-kern.com/geek Registered Linux User No 379093 If life was for sale, what would be its price? www.vlaamse-kern.com/sas/ for free php utilities -- pgpkC5xo4fmtq.pgp Description: PGP signature
Re: [PHP] Why don't webhosts upgrade to PHP5 ?
Andy Pieters wrote: On Wednesday 07 December 2005 08:37, Pugi! wrote: My webhost doesn't want to upgrade to PHP5 because of security reasons and some scripts that will mallfunction. I find it hard to believe. Current upgrade to php5 == "scripts that will mallfunction" == support calls == losing money. thats how I see the ISPs view of upgrading to php5, regardless of whether they are right for them it seems to be a simple matter of economics and operational stability. you also have to consider the ammount of work involved is purely performing the upgrade properly. conf of webhost is PHP 4.3.11, Apache 1.3.33 and MySQL 3.23.49. What real reasons could there be not to upgrade ? How could I convince them to upgrade to PHP5 ? (Less important for me : but why not upgrade to Apache 2.x and at least MySQL 4.x ?) 1. If it ain't broken, don't fix it. PHP4 _is_ broken in places. if it was perfect then there would be no need for improvement. 2. PHP 4 has proven its worth. Now that PHP 5 came out, there will be tons of bugs that aren't found yet. rather defeatist attitude, and a point that cannot be truely substantiated. besides there is a point when it becomes too difficult to successfully enchance or add features to something (move forward) and you have to start 'fresh'. 3. PHP 5 *WILL* break some scripts, and most big suits like forums and shops and stuff will need a serious amount of work to convert to php 5 and some scripts are broken. there is a lot of code out there that is technically evil (potential segfaults etc) so this cuts boths ways. besides most apps [forums etc] out there arn't hard at all to convert - the problem for the developers of such apps is more likely to be about releasing versions that run on both (which is more difficult) or maintaining 2 releases, which eat into your time. Same applies for Apache and MySQL. Consider this, NASA still uses 386 cpu's in their space equipment because they are a lot more stable and mission secure then newer chipsets. are you sure its not because they have invested so much time and energy into the hardware, software and procedures surrounding the cpus. refitting a space shuttle is not done on a whim like your changing the cpu in the box under your desk... comparitive stability wirth newer models doesn't factor in at all if you consider that every part on a space shuttle could be assumed to only be authorized for use after it's absolute stability has been proven. HTH Andy -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] What software do you use for writing PHP?
Nusphere PhpED and love it. Tried a few other editors but stayed with PhpED now for the last year and about to renew my subscription. Excellent project management, brilliant debugger (local and remote), code error detection and highlighting, fast (much faster than the java editors), able to handle huge projects, and very stable. Not as expensive as the Zend equivalent (last time I checked) and in my opinion it's better. Good support from the forum and quick responses from the support desk. I keep checking out the new editors and new versions of old editors as they come out but nothing yet to match PhpED. I develop on Windows but there's a Linux version too (which I haven't tried). If you're looking for a professional PHP IDE you won't find better. And BTW I don't work for Nusphere, I just really like their product. Arno DotContent Professional Content Management Solutions www.dotcontent.net -Original Message- [snip] Forever now I've been using Frontpage for all my web work including php. I'm sure there's better software out there that is more suited to writing and editing PHP pages. What do you all use? [/snip] -- No virus found in this outgoing message. Checked by AVG Free Edition. Version: 7.1.371 / Virus Database: 267.13.12/193 - Release Date: 2005/12/06 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Why do Sessions use Cookies?
Hi Michael, On 12/3/05, Michael B Allen <[EMAIL PROTECTED]> wrote: > Why do sessions use cookies? 'cause HTTP is a "stateless" protocol ... check Wikiepedia on HTTP Cookies at http://en.wikipedia.org/wiki/HTTP_cookies and RFC 2109 http://www.cse.ohio-state.edu/cgi-bin/rfc/rfc2109.html such "statelessness" is the source of one of the major attack types in Web applications: Session Hijacking... Chris has more to say here http://shiflett.org/articles/security-corner-aug2004 (hello Chris :) >Isn't a session just a container associated > with the user's socket No it's not, 'cause if so, the clien has to keep a socket open to the server during the "whole" session... statelessness has design benefits ... Regards, Ahmed
RE: [PHP] What software do you use for writing PHP?
Hi Jeff, On 12/6/05, Jeff McKeon <[EMAIL PROTECTED]> wrote: > I'm sure there's better software out there that is more suited to > writing and editing PHP pages. What do you all use? Eclipse + TruFoundation (PHP/Python) + JSEclipse + CSSEditor + Web Standard Tools (HTML/XML/...) Well, first of all, these are open source and/or free (for commercial use, so no Zend or NuSphere price tags)... TruPHP has auto-completion (both user defined and builtin functions/classes); class insight; debugging; instant syntax checking and error highlighting; code folding among other features... In Eclipse, you can manage your code through CVS, Subversion (using Subclipse), FTP, WebDav, ... or just the little built-in "History" feature... I use Eclipse also for Java (JDT) and C/C++ (CDT) development... Eclipse has plugins for nearly anything you want... As for editors, i use Kate, and VIM when i'm not running X... Eclipse and Web Standard Tools: http://www.eclipse.org TruFoundation: http://www.xored.com/trustudio JSEclipse: http://www.interaktonline.com/Products/Eclipse/JSEclipse/Overview/ CSSEditor: http://csseditor.sourceforge.net/ Subclipse (SVN support): http://subclipse.tigris.org/ Clay (database modeling): http://www.azzurri.jp/en/software/clay/index.jsp -ahmed
RE: [PHP] Security question
Hi Andy, On 12/7/05, Andy Pieters <[EMAIL PROTECTED]> wrote: > Right now when the user is logged in, I put its id in the session. > Then when the user edits his details I put the id in the form and when it > comes back I verify if the id matches the one in the session. Well, is session data saved in a "secure" place on the server side? Read Form Processing and Sessions sections in the PHP Security Guide http://phpsec.org/projects/guide/ Regards, Ahmed
Re: [PHP] Simple Authentication Infrastructure
Michael B Allen wrote: Hi, I scoping out an Internet site project and my primary consideration at the moment is authentication infrastructure. Conceptually I was thinking about something like the pseudocode at the bottom of this message (pardon all the Java-esc typing). Can PHP do this sort of thing? I'm wondering if there are some classes available to do this? I don't think I want to use WWW-Authenticate (at least I don't want to use the ugly password dialog) and I certainly don't want to authenticate via pam or something like that. I want "as simple as possible, but not simpler" type of thing. I have a strong aversion to bloatware. Or am I off track? I normally do pretty low level C type stuff so websites conceptually? not as far as I can see. practically speaking: session and request are not objects in php (you could create userland wrapper objects for them though), string concatenation is done with a '.', variables are prefixed with '$', you don't have to declare variable types, etc. are new to me (ie. php). Thanks, Mike int handleRequest(Request req) { Ticket ticket, tmp; /* If the user already has a ticket associated with their session, * just pass through and handle the request */ if ((ticket = req.session.getProperty("ticket")) == null) { SqlResults results; /* If the user has a ticket (embeeded in a cookie) then associate * it with their session and pass through and handle the request. */ String cookie = req.getCookie("ticket"); if (cookie) {/* try ticket from cookie */ tmp = Ticket.decrypt("12345", cookie); results = Sql.exec( /* sql injection vulnerbility, wahoo! */ "select ssnkey from accounts where emailaddr = " + tmp.emailaddr); if (results.size() == 1 && tmp.sshkey == results.getInteger(0)) { req.session.setProperty("ticket", tmp); ticket = tmp; /* Success! */ } } if (ticket == null && req.session.isHttps) { /* try new login */ String emailaddr = req.getParameter("emailaddr"); String password = req.getParameter("password"); if (emailaddr && password) { results = Sql.exec( "select status, password from accounts where emailaddr = " + emailaddr); if (results.size() != 1 || results.getString(0) != "valid" || password != results.getString(1)) { return sendError(req, ERROR_AUTH_FAILED); } tmp = new Ticket(emailaddr); Sql.exec("update accounts set ssnkey = " + tmp.ssnkey + " where emailaddr = " + tmp.emailaddr); req.setCookie("ticket", ticket.encrypt("12345")); req.session.setProperty("ticket", tmp); ticket = tmp; /* Success! */ } } } /* null ticket means not logged in / anonymous */ return handleAuthenticatedRequest(req, ticket); } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP Warning: imagettftext() expects parameter 2 to be double
James wrote: Hi there, I have been using the GD functions from PHP5.0 on Mac OS X. I have a simple script that creates a PNG image with text on the image using fonts using FreeType 2. I am trying to use the imagettftext() function within a foreach loop but I get the following error: PHP Warning: imagettftext() expects parameter 2 to be double what does paramter 2 contain in each case? var_dump(), print_r(), echo ?!? The code is as follows: $font['type']="./fonts/font.ttf²; $font['color']=imageColorAllocate($card['png'],$font['hexcolor']['r'],$font[ 'hexcolor']['g'],$font['hexcolor']['b']); imageFill($card['png'],0,0,$card['color']); foreach ($xml->textblock as $text) { $fontsize=$text->fontsize;$fontangle=$text->fontangle; $fontxpos=$text->fontxpos;$fontypos=$text->fontypos; $text=$text->text; try var_dump($text); or print_r($text); to see what you have (if its an XML node object - dump $fontsize, $fontxpos instead!!!) imagettftext($image['png'],$fontsize,$fontangle,$fontxpos,$fontypos,$font['c olor'],$font['type'],$text);} It works fine if I add just one line outside of the loop but as soon as its within the loop it errors. Cheers, James -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP Warning: imagettftext() expects parameter 2 to be double
Title: Re: [PHP] PHP Warning: imagettftext() expects parameter 2 to be double Hi, Thank you for getting back to me, your the first. The array works fine – I have tested it using var_dump(). Attached are the two files – xml.test – this holds the array of the text blocks which is being parsed by image.php. Line 38 is the problem, if you comment around the foreach() statement and un-comment the commented lines you should see it working fine, its when its within the foreach statement when it errors. Regards, James Jochem Maas Wrote: James wrote: > Hi there, > > I have been using the GD functions from PHP5.0 on Mac OS X. > > I have a simple script that creates a PNG image with text on the image using > fonts using FreeType 2. > > I am trying to use the imagettftext() function within a foreach loop – but I > get the following error: > > PHP Warning: imagettftext() expects parameter 2 to be double what does paramter 2 contain in each case? var_dump(), print_r(), echo ?!? > > The code is as follows: > > $font['type']="./fonts/font.ttf”; > > > $font['color']=imageColorAllocate($card['png'],$font['hexcolor']['r'],$font[ > 'hexcolor']['g'],$font['hexcolor']['b']); > > imageFill($card['png'],0,0,$card['color']); > > foreach ($xml->textblock as $text) { > $fontsize=$text->fontsize; $fontangle=$text->fontangle; > $fontxpos=$text->fontxpos; $fontypos=$text->fontypos; > $text=$text->text; try var_dump($text); or print_r($text); to see what you have (if its an XML node object - dump $fontsize, $fontxpos instead!!!) > imagettftext($image['png'],$fontsize,$fontangle,$fontxpos,$fontypos,$font['c > olor'],$font['type'],$text); } > > It works fine if I add just one line outside of the loop – but as soon as > its within the loop it errors. > > Cheers, > > James > name; $image['hexcolor']=$xml->frontcolor; $image['intcolor']=hex2int($image['hexcolor']); $image['width']=$xml->width; $image['height']=$xml->height; $font['type']=$xml->font; $font['hexcolor']=$xml->fontcolor; $font['intcolor']=hex2int($font['hexcolor']); $font['type']="./fonts/".$font['type']; $image['png']=imageCreateTrueColor($image['width'],$image['height']); $image['color']=imageColorAllocate($image['png'],$image['intcolor']['r'],$image['intcolor']['g'],$image['intcolor']['b']); $font['color']=imageColorAllocate($image['png'],$font['intcolor']['r'],$font['intcolor']['g'],$font['intcolor']['b']); imageFill($image['png'],0,0,$image['color']); foreach ($xml->textblock as $text) { $fontsize=$text->fontsize; $fontangle=$text->fontangle; $fontxpos=$text->fontxpos; $fontypos=$text->fontypos; $text=$text->text; imagettftext($image['png'],$fontsize,$fontangle,$fontxpos,$fontypos,$font['color'],$font['type'],"$text",array()); } /* imagettftext($image['png'],"83",0,10,120,$font['color'],$font['type'],"Happy",array()); imagettftext($image['png'],"55",0,10,178,$font['color'],$font['type'],"Birthday",array()); imagettftext($image['png'],"104",0,8,280,$font['color'],$font['type'],"Cunt",array()); */ #$image['png']=imagerotate($image['png'],90,0); header("Content-type: image/png"); imagepng($image['png']); } else { exit('Failed to open test.xml.'); } function hex2int($hex) { return array( 'r' => hexdec(substr($hex, 0, 2)), 'g' => hexdec(substr($hex, 2, 2)), 'b' => hexdec(substr($hex, 4, 2)) ); } ?> Welcome 003366 360 360 princetown.ttf CC 83px 0 10 140 Welcome 60px 0 10 240 to 83px 0 10 340 My Website -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] RE: XmlWriter::writeDTD bug...
> -Original Message- > From: Rob Richards [mailto:[EMAIL PROTECTED] > Sent: 07 December 2005 04:21 > To: [EMAIL PROTECTED] > Cc: php-general@lists.php.net > Subject: Re: XmlWriter::writeDTD bug... > > Jared Williams wrote: > > Hi, > > > > $writer = new XmlWriter(); > > ... > > > > $writer->writeDtd('html', '-//W3C//DTD XHTML 1.0 Strict//EN', > > 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd'); > > > > produces no whitespace between the public & system ids like... > > > > > Strict//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd";> > > > > Has anyone got a workaround for this problem? > > libxml bug. Add $writer->setIndent(TRUE); before the writeDTD > call (can revert it back right after if you dont want > indenting). This will force whitespace insertion between the > two - not pretty but its a workaround. > > Rob Ahh excellent. Cheers Jared -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: XmlWriter::writeDTD bug...
> Jared Williams wrote: > > Hi, > > > > $writer = new XmlWriter(); > > ... > > > > $writer->writeDtd('html', '-//W3C//DTD XHTML 1.0 Strict//EN', > > 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd'); > > > > produces no whitespace between the public & system ids like... > > > > > Strict//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd";> > > > > Has anyone got a workaround for this problem? > > libxml bug. Add $writer->setIndent(TRUE); before the writeDTD > call (can revert it back right after if you dont want > indenting). This will force whitespace insertion between the > two - not pretty but its a workaround. > PS. Yeah, thought it was libxml, hence didn't file a pecl bug report. But there does seem a problem with this method as can't just have a publicId or a systemId, libxml function uses NULL as a parameter to specify which id you don't want to use. Which we've lost with the PHP wrapper, as can only specify two strings. And when pecl.php.net was reachable I'll report it. Jared -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] how to lock multiple rows in oracle?
Hi friends , my code like this $sql="SELECT mid,substr(ROWID,0,100) as nROWID,MEMBER_ID, NAME, SURNAME, E_MAIL, SUBJECT, MAIL_BODY, to_char(DATE_CREATED,'DD.MM. HH24:MI:SS') as DATE_CREATED, RETRY, PRIORITY, E_MAIL_FROM, RECEIVER_MEMBER_ID, RECEIVER_NAME, RECEIVER_SURNAME, MAIL_TYPE, ATTACHMENT1, ATTACHMENT2, EMBEDDING1, EMBEDDING2 FROM MEMBERS_TO_MAIL_SEND_HTML where flag=0 and rownum<2000"; putenv("NLS_LANG=TURKISH_TURKEY.WE8ISO8859P9"); $baglanti = ocilogon(USERNAME,PASSWORD,DATABASE); $statement = ociparse ($baglanti, $sql); ociexecute ($statement); $i=0; while (ocifetchinto ($statement,$row, OCI_ASSOC)) { I want to lock this 2000 rows, for this I make query like below: $sql=" .. FROM MEMBERS_TO_MAIL_SEND_HTML where flag=0 and rownum<2000 FOR UPDATE"; this time, it is updateting only one row. I tried to use "LOCK TABLE table IN ROW SHARE MODE;LOCK TABLE table IN ROW SHARE MODE;"; but I don't know how to use in php. How can I lock all rows, any advice ? Thanks a lot rasim -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] FW: Advanced search form
Hello PHP-Gurus, I have already ask this on php-de and pgsql-pgp but unfortunatly gotten no answer. I have a search form and I like to add advanced search options like "this is a search" -XXX Test which mean, 1) "this is a search" must be in this order 2) -XXXDo not find XXX contents 3) TestAND Does anyone has a PHP/PGSQL code sniplet? Thanks Michelle -- Linux-User #280138 with the Linux Counter, http://counter.li.org/ # Debian GNU/Linux Consultant # Michelle Konzack Apt. 917 ICQ #328449886 50, rue de Soultz MSM LinuxMichi 0033/3/8845235667100 Strasbourg/France IRC #Debian (irc.icq.com) -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php - End forwarded message - ** * Do not Cc: me, because I am on THIS list, if I write here * * Keine Cc: am mich, bin auf DIESER Liste wenn ich hier schreibe * ** Hello, Greetings Michelle -- Linux-User #280138 with the Linux Counter, http://counter.li.org/ # Debian GNU/Linux Consultant # Michelle Konzack Apt. 917 ICQ #328449886 50, rue de Soultz MSM LinuxMichi 0033/3/8845235667100 Strasbourg/France IRC #Debian (irc.icq.com) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Assigns True but not false?
Thanks guys, very helpful! Gabe wrote: In this if statement, if the condition is true, then it will assign true to the array (as I want it to). If the condition evaluates to false, it assigns nothing. Any idea why it won't assign false? If I switch the FALSE boolean value to the number 0, that will get assigned. Seems kinda strange... $this->m_arrQuesInfo[$this->m_itemID]['blnVacPromo'] = ( ( !empty($_POST['vac_promo']) ) && ( $_POST['vac_promo'] == 'on' ) ) ? TRUE : FALSE; -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] What software do you use for writing PHP?
Curt Zirzow wrote: On Tue, Dec 06, 2005 at 06:36:33PM +0100, M. Sokolewicz wrote: Jason Petersen wrote: On 12/6/05, Jeff McKeon <[EMAIL PROTECTED]> wrote: Hey all, Forever now I've been using Frontpage for all my web work including php. I'm sure there's better software out there that is more suited to writing and editing PHP pages. What do you all use? Vim is my editor of preference. If I have to use Windows, I usually go with Homesite (because I already have a licensed copy) or Textpad (because it's better than Notepad). IDEs? Who needs 'em ;) Best, Jason same here :) Vim on UNIX machines, and Textpad on Windows man you guys are wimps.. gvim on windows... :) Pt'Edit' in DOS. ;) -- John C. Nichel IV Programmer/System Admin (ÜberGeek) Dot Com Holdings of Buffalo 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] how to lock multiple rows in oracle?
Rasim ÞEN wrote: Hi friends , my code like this $sql="SELECT mid,substr(ROWID,0,100) as nROWID,MEMBER_ID, NAME, SURNAME, E_MAIL, SUBJECT, MAIL_BODY, to_char(DATE_CREATED,'DD.MM. HH24:MI:SS') as DATE_CREATED, RETRY, PRIORITY, E_MAIL_FROM, RECEIVER_MEMBER_ID, RECEIVER_NAME, RECEIVER_SURNAME, MAIL_TYPE, ATTACHMENT1, ATTACHMENT2, EMBEDDING1, EMBEDDING2 FROM MEMBERS_TO_MAIL_SEND_HTML where flag=0 and rownum<2000"; putenv("NLS_LANG=TURKISH_TURKEY.WE8ISO8859P9"); $baglanti = ocilogon(USERNAME,PASSWORD,DATABASE); $statement = ociparse ($baglanti, $sql); ociexecute ($statement); $i=0; while (ocifetchinto ($statement,$row, OCI_ASSOC)) { I want to lock this 2000 rows, for this I make query like below: $sql=" .. FROM MEMBERS_TO_MAIL_SEND_HTML where flag=0 and rownum<2000 FOR UPDATE"; this time, it is updateting only one row. I tried to use "LOCK TABLE table IN ROW SHARE MODE;LOCK TABLE table IN ROW SHARE MODE;"; but I don't know how to use in php. How can I lock all rows, any advice ? I'm not an Oracle expert, but I would _think_ you just execute the query, like you would execute any other query in PHP. -- John C. Nichel IV Programmer/System Admin (ÜberGeek) Dot Com Holdings of Buffalo 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Anyone getting bounces from
[EMAIL PROTECTED] ? I am getting failure notices out the wazoo for some very old messages to the general list. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Anyone getting bounces from
Jay Blanchard wrote: [EMAIL PROTECTED] ? I am getting failure notices out the wazoo for some very old messages to the general list. I'm not. Told you Bill was going to get mad at you. ;) -- John C. Nichel IV Programmer/System Admin (ÜberGeek) Dot Com Holdings of Buffalo 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Anyone getting bounces from
Yeah, I am recieving the same. Jay Blanchard wrote: [EMAIL PROTECTED] ? I am getting failure notices out the wazoo for some very old messages to the general list. -- Jason Gerfen "Oh I have seen alot of what the world can do, and its breaking my heart in two..." ~ Wild World, Cat Stevens -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] FW: Advanced search form
Here is some code that you can modify. It's design to convert a search string into a MySQL full text search string, not sure how different pgsql is. It adds * for word expansion where appropriate. It assume a space is the delimiter, but that's easy to change in the explode statement. Example: "this is a search" -XXX Test becomes +"this is a search" -XXX* +Test* Conversion function: function prepFullTextSearch($searchVal) { //Split words into list $word_List = explode(' ',stripslashes(trim($searchVal))); //Step through word list to get search phrases $i = 0; $isPhrase = false; foreach($word_List as $word) { $searchItems[$i] = trim(($isPhrase?$searchItems[$i].' '.$word: $word)); //Check for start of Phrase if(substr($searchItems[$i],0,1) == '"') { $isPhrase = true; } //If not building a phrase, append wildcard (*) to end of word if(!$isPhrase) { $searchItems[$i].= '*'; $i++; } //Check for end of Phrase if(substr($searchItems[$i],-1) == '"') { $isPhrase = false; $i++; } } $searchVal = '+'.implode(' +',$searchItems); $searchVal = str_replace('+-','-',$searchVal); return $searchVal; } On Dec 7, 2005, at 8:18 AM, Michelle Konzack wrote: Hello PHP-Gurus, I have already ask this on php-de and pgsql-pgp but unfortunatly gotten no answer. I have a search form and I like to add advanced search options like "this is a search" -XXX Test which mean, 1) "this is a search" must be in this order 2) -XXXDo not find XXX contents 3) TestAND Does anyone has a PHP/PGSQL code sniplet? Thanks Michelle -- Linux-User #280138 with the Linux Counter, http://counter.li.org/ # Debian GNU/Linux Consultant # Michelle Konzack Apt. 917 ICQ #328449886 50, rue de Soultz MSM LinuxMichi 0033/3/8845235667100 Strasbourg/France IRC #Debian (irc.icq.com) -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php - End forwarded message - ** * Do not Cc: me, because I am on THIS list, if I write here * * Keine Cc: am mich, bin auf DIESER Liste wenn ich hier schreibe * ** Hello, Greetings Michelle -- Linux-User #280138 with the Linux Counter, http://counter.li.org/ # Debian GNU/Linux Consultant # Michelle Konzack Apt. 917 ICQ #328449886 50, rue de Soultz MSM LinuxMichi 0033/3/8845235667100 Strasbourg/France IRC #Debian (irc.icq.com) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Brent Baisley Systems Architect Landover Associates, Inc. Search & Advisory Services for Advanced Technology Environments p: 212.759.6400/800.759.0577 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Anyone getting bounces from
John Nichel wrote: Jay Blanchard wrote: [EMAIL PROTECTED] ? I am getting failure notices out the wazoo for some very old messages to the general list. I am too. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] What software do you use for writing PHP?
Pt'Edit' in DOS. ;) Absolutely!! It can't be beaten for undocumented features. :p thnx, Chris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Anyone getting bounces from
Jay Blanchard wrote: > [EMAIL PROTECTED] ? > > I am getting failure notices out the wazoo for some very old messages to the > general list. > Just got seven in a row, looks like the MTA is trying for three weeks and then giving up. The messages appear to be for: [EMAIL PROTECTED] Can this address be unsubscribed? Cheers, David -- David Grant http://www.grant.org.uk/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Anyone getting bounces from
me 3 Jason Gerfen wrote: Yeah, I am recieving the same. Jay Blanchard wrote: [EMAIL PROTECTED] ? I am getting failure notices out the wazoo for some very old messages to the general list. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] What software do you use for writing PHP?
> > Curt Zirzow wrote: > > On Tue, Dec 06, 2005 at 06:36:33PM +0100, M. Sokolewicz wrote: > > > >>Jason Petersen wrote: > >> > >>>On 12/6/05, Jeff McKeon <[EMAIL PROTECTED]> wrote: > >>> > >>> > Hey all, > > Forever now I've been using Frontpage for all my web work > including php. > I'm sure there's better software out there that is more suited to > writing and editing PHP pages. What do you all use? > > >>> > >>> > >>>Vim is my editor of preference. If I have to use Windows, > I usually go > >>>with > >>>Homesite (because I already have a licensed copy) or > Textpad (because it's > >>>better than Notepad). > >>> > >>>IDEs? Who needs 'em ;) > >>> > >>>Best, > >>>Jason > >>> > >> > >>same here :) > >>Vim on UNIX machines, and Textpad on Windows > > > > > > man you guys are wimps.. gvim on windows... :) > > Pt'Edit' in DOS. ;) > (Pt * 2) 'edlin' in DOS. :P -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] What software do you use for writing PHP?
Jim Moseby wrote: man you guys are wimps.. gvim on windows... :) Pt'Edit' in DOS. ;) (Pt * 2) 'edlin' in DOS. :) Infinitely recursive pfft A pencil and a piece of paper and ringing people to describe the cool web site you've just drawn, -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] What software do you use for writing PHP?
[snip] >>> man you guys are wimps.. gvim on windows... :) >>> >> Pt'Edit' in DOS. ;) >> >> > > (Pt * 2) 'edlin' in DOS. :) Infinitely recursive pfft A pencil and a piece of paper and ringing people to describe the cool web site you've just drawn, [/snip] Two words punch cards. 'Nuff said. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] What software do you use for writing PHP?
Jay Blanchard wrote: [snip] man you guys are wimps.. gvim on windows... :) Pt'Edit' in DOS. ;) (Pt * 2) 'edlin' in DOS. :) Infinitely recursive pfft A pencil and a piece of paper and ringing people to describe the cool web site you've just drawn, [/snip] Two words punch cards. 'Nuff said. Come on now Jay, we know you're old and all, but everyone knows that you cannot edit php with punch cards. Hanging chads will cause too many fatal errors. ;) -- John C. Nichel IV Programmer/System Admin (ÜberGeek) Dot Com Holdings of Buffalo 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] What software do you use for writing PHP?
[snip] > Two words punch cards. 'Nuff said. > Come on now Jay, we know you're old and all, but everyone knows that you cannot edit php with punch cards. Hanging chads will cause too many fatal errors. ;) [/snip] ROFLMMFAO -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Eval To String
Hi, Is it possible to return the result of eval function to a string rather than outputting directly to the browser? Thanks for your advice -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] What software do you use for writing PHP?
At 11:45 AM 12/7/2005, Jay Blanchard wrote: [snip] > Two words punch cards. 'Nuff said. > Come on now Jay, we know you're old and all, but everyone knows that you cannot edit php with punch cards. Hanging chads will cause too many fatal errors. ;) [/snip] ROFLMMFAO Why these clumsy interfaces? Just plug the Firewire in your ear! Miles -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Eval To String
[snip] Is it possible to return the result of eval function to a string rather than outputting directly to the browser? Thanks for your advice [/snip] Yes. You're welcome. The first freakin' example in TFM http://www.php.net/eval is this; -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Eval To String
Shaun Shaun wrote: > Is it possible to return the result of eval function to a string rather than > outputting directly to the browser? ob_start(); eval('$eval = "evil";'); $output = ob_get_clean(); Cheers, David Grant -- David Grant http://www.grant.org.uk/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Call to undefined function mysql_real_escape_string()
Can someone help me overcome this recurring problem? I am using the Joomla content management system and I keep coming across the following errors. Fatal error: Call to undefined function mysql_real_escape_string() in /usr/local/apache2/htdocs/common.php on line 24 Fatal error: Call to undefined function mysql_real_escape_string() in /usr/local/apache2/htdocs/class.inputfilter.php on line 344 I notice in my Dynamic Extensions section of php.ini there are no extensions called for; if that helps. Joomla works fine, but when adding components or modules the problems start. One component author made a test for the mysql_real_escape_string and I think avoided using it then the component worked. I think that's probably not the best solution. Fedora Core 3 Apache 2.0.55 PHP 5.0.5 (compiled with mysqli vice mysql) './configure' '--with-apxs2=/usr/local/apache2/bin/apxs' '--enable-ftp' '--enable-inline-optimization' '--enable-magic-quotes' '--enable-mbstring' '--enable-track-vars' '--enable-trans-sid' '--enable-wddx=shared' '--enable-xml' '--with-dom' '--with-gd' '--with-gettext' '--with-mysqli=/usr/local/mysql/bin/mysql_config' '--with-regex=system' '--with-xml' '--with-zlib-dir=/usr/lib' MySQL 4.1.15 TIA, Paul Hickey Christian Patriot Palm Bay Fl
Re: [PHP] Call to undefined function mysql_real_escape_string()
Paul Hickey wrote: Can someone help me overcome this recurring problem? I am using the Joomla content management system and I keep coming across the following errors. Fatal error: Call to undefined function mysql_real_escape_string() in /usr/local/apache2/htdocs/common.php on line 24 Fatal error: Call to undefined function mysql_real_escape_string() in /usr/local/apache2/htdocs/class.inputfilter.php on line 344 I notice in my Dynamic Extensions section of php.ini there are no extensions called for; if that helps. Joomla works fine, but when adding components or modules the problems start. One component author made a test for the mysql_real_escape_string and I think avoided using it then the component worked. I think that's probably not the best solution. Fedora Core 3 Apache 2.0.55 PHP 5.0.5 (compiled with mysqli vice mysql) './configure' '--with-apxs2=/usr/local/apache2/bin/apxs' '--enable-ftp' '--enable-inline-optimization' '--enable-magic-quotes' '--enable-mbstring' '--enable-track-vars' '--enable-trans-sid' '--enable-wddx=shared' '--enable-xml' '--with-dom' '--with-gd' '--with-gettext' '--with-mysqli=/usr/local/mysql/bin/mysql_config' '--with-regex=system' '--with-xml' '--with-zlib-dir=/usr/lib' MySQL 4.1.15 mysql_real_escape_string() is a MySQL function, and you're server is compiled with the 'improved' MySQL functions. You want mysqli_real_escape_string() http://us3.php.net/manual/en/function.mysqli-real-escape-string.php -- John C. Nichel IV Programmer/System Admin (ÜberGeek) Dot Com Holdings of Buffalo 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] What software do you use for writing PHP?
Miles Thompson wrote: At 11:45 AM 12/7/2005, Jay Blanchard wrote: [snip] > Two words punch cards. 'Nuff said. > Come on now Jay, we know you're old and all, but everyone knows that you cannot edit php with punch cards. Hanging chads will cause too many fatal errors. ;) [/snip] ROFLMMFAO Why these clumsy interfaces? Just plug the Firewire in your ear! n00b ;) -- John C. Nichel IV Programmer/System Admin (ÜberGeek) Dot Com Holdings of Buffalo 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] What software do you use for writing PHP?
I'm using quanta on linux, it those nice things like code completion, syntax highlighting, upload the pages, etc... -- http://esu.proyectoanonimo.com http://www.proyectoanonimo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Anyone getting bounces from
4 here -- http://esu.proyectoanonimo.com http://www.proyectoanonimo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] What software do you use for writing PHP?
John Nichel wrote: Miles Thompson wrote: At 11:45 AM 12/7/2005, Jay Blanchard wrote: [snip] > Two words punch cards. 'Nuff said. > Come on now Jay, we know you're old and all, but everyone knows that you cannot edit php with punch cards. Hanging chads will cause too many fatal errors. ;) [/snip] ROFLMMFAO Why these clumsy interfaces? Just plug the Firewire in your ear! n00b at least he is past the oral-phase :-) ;) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] What software do you use for writing PHP?
It's not a full FTP client, you can't set permissions in it. I think that's a major minus in DW's favor. Especially if you don't have access to ssh into your machine ... -Original Message- From: Michael Hulse [mailto:[EMAIL PROTECTED] Sent: Tuesday, December 06, 2005 10:09 PM To: 'php' Subject: Re: [PHP] What software do you use for writing PHP? On Dec 6, 2005, at 9:25 AM, Mark Steudel wrote: > I primarily code in Dreamweaver 8. Two of my favorite features that > were added from MX are as follows: > 1. Code folding, basically you can collapse blocks of code. If you > have to work with other peoples code, matching braces and code folding > is an awesome way of just seeing the logical flow of the code, and > hide all the details. > DW 8 code folding is great because you can select any amount of code > and collapse it. The bummer about dreamweaver is that it doesn't > detect functions and add a collapse handle to it like Zend Studio, or > have the default to automatically collapse functions when you open a > page like Zend Studio. Sah-wt! I have yet to upgrade. Waiting to get a new puter. :) Code-folding sound fricken cool! I am pretty stoked that they finally fixed the crappy built-in ftp. But, can you set permissions? I wonder if there is a plugin for DW8 that will detect functions? Me = googling. M -- 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] Anyone getting bounces from
had about 15 in my inbox this morning :) On Wednesday 07 December 2005 08:36, Jay Blanchard wrote: > [EMAIL PROTECTED] ? > > I am getting failure notices out the wazoo for some very old messages to > the general list. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: XmlWriter::writeDTD bug...
Jared Williams wrote: PS. Yeah, thought it was libxml, hence didn't file a pecl bug report. But there does seem a problem with this method as can't just have a publicId or a systemId, libxml function uses NULL as a parameter to specify which id you don't want to use. Which we've lost with the PHP wrapper, as can only specify two strings. Have you tried passing NULL for publicId? :) And systemId can only be NULL if there is no publicId (publicId requires a systemId). Rob -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re[2]: [PHP] What software do you use for writing PHP?
Hello Miles, Wednesday, December 7, 2005, 8:56:23 AM, you wrote: > Why these clumsy interfaces? > Just plug the Firewire in your ear! So that's where it's supposed to go!?!?!? I've been doing it wrong all this time, not to mention it made sitting so very uncomfortable. -- TBUDL/BETA/DEV/TECH Lists Moderator / PGP 0x6C0AB16B __ Geocaching:http://gps.PCWize.com ( ) ( ___)(_ _)( ___) TBUDP Wiki Site: http://www.PCWize.com/thebat/tbudp )(__ )__) _)(_ )__) Roguemoticons & Smileys:http://PCWize.com/thebat ()()()(__)PHP Tutorials and snippets:http://www.DevTek.org Sometimes the majority just means all the fools are on the same side. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Class Constant PHP 5
is there a way to dynamically define a class constant during runtime in PHP 5? for example I would like to achieve the result of something like: class Example { const FOO = bar(); } However this would obviously give a parse error. I know it is possible with variables but I would like it to be a constant. Thanks. - Jeff ~~ Jeffrey Sambells Director of Research and Development Zend Certified Engineer (ZCE) We-Create Inc. [EMAIL PROTECTED] email 519.745.7374 office 519.897.2552 mobile ~~ Get Mozilla Firefox at http://spreadfirefox.com
RE: [PHP] Re: XmlWriter::writeDTD bug...
> > Jared Williams wrote: > > > > PS. > > Yeah, thought it was libxml, hence didn't file a pecl > bug report. But > > there does seem a problem with this method as can't just have a > > publicId or a systemId, libxml function uses NULL as a > parameter to specify which id you don't want to use. Which > we've lost with the PHP wrapper, as can only specify two strings. > > > Have you tried passing NULL for publicId? :) And systemId can > only be NULL if there is no publicId (publicId requires a systemId). > Ah, yes, I blame it time, 3am, when was tinkering with XmlWriter :) Jared -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Class Constant PHP 5
Dynamically setting a constant would break the very rule of it being a constant in the first place. a constant is something that does not change it cannot be dynamic. On Wednesday 07 December 2005 12:00, Jeffrey Sambells wrote: > is there a way to dynamically define a class constant during runtime > in PHP 5? > > for example I would like to achieve the result of something like: > > class Example { > const FOO = bar(); > } > > However this would obviously give a parse error. > > I know it is possible with variables but I would like it to be a > constant. > > Thanks. > > - Jeff > > ~~ > Jeffrey Sambells > Director of Research and Development > Zend Certified Engineer (ZCE) > > We-Create Inc. > [EMAIL PROTECTED] email > 519.745.7374 office > 519.897.2552 mobile > > ~~ > Get Mozilla Firefox at > http://spreadfirefox.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Class Constant PHP 5
[snip] is there a way to dynamically define a class constant during runtime in PHP 5? for example I would like to achieve the result of something like: class Example { const FOO = bar(); } However this would obviously give a parse error. I know it is possible with variables but I would like it to be a constant. [/snip] Well, first of all the syntax you describe above does not define a constant at all, you would need to use define() The second thing is good old basic OOP theory, you should declare a private static variable http://us3.php.net/private http://us3.php.net/manual/en/language.oop5.static.php Of course you could define a global constant and then pass it into your object when instantiating it, but that is a bad idea generally. Thirdly, you could never use a function to derive your constant value...it would then be an oxymoron. If the value generated by the function bar() changes, FOO is a variable. Constants are for simple values. For instance, we can all agree that pi is 3.14159 (to 5 decimal places, so defining a constant pi makes sense; define("PI", 3.14159); If we do not know what the outcome of a function will be it makes the value of the outcome a variable, always. It would be foolish (and would fail anyhow) to do something like this; define("RANDOM", rand(5,12)); -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Class Constant PHP 5
> It would be foolish (and would fail anyhow) to do something like this; Nope. :P int(12) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] What software do you use for writing PHP?
Murray @ PlanetThoughtful said the following on 12/07/2005 07:31 AM: Jim Moseby wrote: Pt'Edit' in DOS. ;) (Pt * 2) 'edlin' in DOS. :) Infinitely recursive pfft A pencil and a piece of paper and ringing people to describe the cool web site you've just drawn, What, can't you use punch cards? - Ben -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Class Constant PHP 5
[snip] > It would be foolish (and would fail anyhow) to do something like this; Nope. :P int(12) [/snip] Wow, that should fail. But you did have use var_dump() to get it, which may be slightly counter-intuitive. I just did this function realRand($x){ $x = $x * rand(5,10); return $x; } define("RANDOM", realRand(1.2)); var_dump(RANDOM); and it returns floats. Well, I'll be jiggered. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Class Constant PHP 5
[snip] Wow, that should fail. But you did have use var_dump() to get it, which may be slightly counter-intuitive. I just did this function realRand($x){ $x = $x * rand(5,10); return $x; } define("RANDOM", realRand(1.2)); var_dump(RANDOM); and it returns floats. Well, I'll be jiggered. [/snip] >From http://us3.php.net/manual/en/language.constants.php "Only scalar data (boolean, integer, float and string) can be contained in constants." -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Preventing Cross Site Scripting Vulnerbilities
Can someone recommend a general method for avoiding / eliminating XSS vulnerbilities with PHP? Specifically is there a library function for validating fields? If not, can someone recommend a regex that detects HTML tags? Similarly is there a library function for escaping database content for inclusion in HTML pages? Thanks, Mike -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Preventing Cross Site Scripting Vulnerbilities
> Similarly is there a library function for escaping database content for > inclusion in HTML pages? http://php.net/htmlspecialchars http://php.net/htmlentities -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Preventing Cross Site Scripting Vulnerbilities
Michael B Allen wrote: Can someone recommend a general method for avoiding / eliminating XSS vulnerbilities with PHP? Yeah, escape output. It's really that simple. Curt Zirzow made a nice post related to this topic yesterday., and here's a simple example: http://phpsecurity.org/code/ch01-4 Hope that helps! 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] Preventing Cross Site Scripting Vulnerbilities
comex wrote: Similarly is there a library function for escaping database content for inclusion in HTML pages? http://php.net/htmlspecialchars http://php.net/htmlentities Or roll your own and replace the eregi regex with data that is valid to your application: function chk_input( $string ) { if( eregi( "^[0-9a-z_ -]$", $string ) ) { return 0; } else { return 1; } } if( chk_input( $string ) == 0 ) { echo "valid"; } else { echo "invalid"; } -- Jason Gerfen "Oh I have seen alot of what the world can do, and its breaking my heart in two..." ~ Wild World, Cat Stevens -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Preventing Cross Site Scripting Vulnerbilities
There's been a lot of great articles in the PHP|Architect magazine over the past 3 months or so about this (http://www.phparch.com) You do have to purchase back-issues though. Very good articles though. They cover how to make functions to filter what variables should be sent in, and how to make sure all the data is what you expect. Jason Gerfen wrote: comex wrote: Similarly is there a library function for escaping database content for inclusion in HTML pages? http://php.net/htmlspecialchars http://php.net/htmlentities Or roll your own and replace the eregi regex with data that is valid to your application: function chk_input( $string ) { if( eregi( "^[0-9a-z_ -]$", $string ) ) { return 0; } else { return 1; } } if( chk_input( $string ) == 0 ) { echo "valid"; } else { echo "invalid"; } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Preventing Cross Site Scripting Vulnerbilities
Ray Hauge wrote: There's been a lot of great articles in the PHP|Architect magazine over the past 3 months or so about this (http://www.phparch.com) You do have to purchase back-issues though. Past editions of Security Corner are eventually available for free from my web site: http://shiflett.org/articles Hope that helps! 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: What software do you use for writing PHP?
I use JEdit with code browser plug-in. Once it's started, it's quite fast. It's Java-based, so it runs both on windows and linux. Very easy to configure, has many useful coding features. If you need more, just install some plug-ins. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP 5 XML Dom, set doctype and system
Hello, I need to set the doctype and the system dtd of a document created directly with the xml DOM. I couldn´t find any function or property to set this, i saw some examples that directly wrote onto the file manually, but i´m pretty sure thare must be a way to do this with the dom (i remembered that libxml c api has such capability, so, if php dom is based on such, then it would be able to). Any ideas? Thanks in advance, cheers. Mariano. -- No virus found in this outgoing message. Checked by AVG Free Edition. Version: 7.1.371 / Virus Database: 267.13.12/193 - Release Date: 06/12/2005 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Class Constant PHP 5
Stephen Leaf wrote: Dynamically setting a constant would break the very rule of it being a constant in the first place. Did you say something about my Java? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Non-trivial task of converting text to HTML
Task: Create a script that converts text into HTML with paragraphs. Problem: Input text could use the book notation, as well as the web notation, plus it can contain HTML. == This is a title This is a Book paragraph. This is another book paragraph. This is yet another book paragraph, but it's not indented with spaces, because user wrote it in OpenOffice. == == This is a web paragraph. This is another web paragraph. This is yet another web paragraph, which is indented with spaces for some unknown reason. == Output text should be correctly formatted without using lots of br's and 's. Doing so manually is not a problem, I would just use for web paragraphs, and for book paragraphs. However, formatting such text with a scrip is very difficult. Does anyone knows a good exaple of such script? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Non-trivial task of converting text to HTML
Quoting Roman Ivanov <[EMAIL PROTECTED]>: Output text should be correctly formatted without using lots of br's and 's. Doing so manually is not a problem, I would just use for web paragraphs, and for book paragraphs. However, formatting such text with a scrip is very difficult. Does anyone knows a good exaple of such script? How do you intend to distinguish between a web paragraph and a book paragraph? How can you even accomplish this manually? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Non-trivial task of converting text to HTML
Eric Gorr wrote: Quoting Roman Ivanov <[EMAIL PROTECTED]>: Output text should be correctly formatted without using lots of br's and 's. Doing so manually is not a problem, I would just use for web paragraphs, and for book paragraphs. However, formatting such text with a scrip is very difficult. Does anyone knows a good exaple of such script? How do you intend to distinguish between a web paragraph and a book paragraph? Good question. I don't know. If I would know, than writing scipt would be simple. It would be interesting to hear how other developers deal with such kind of things. How can you even accomplish this manually? By reading the text. *smiley* -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Preventing Cross Site Scripting Vulnerbilities
Michael B Allen wrote: Can someone recommend a general method for avoiding / eliminating XSS vulnerbilities with PHP? IMO, the best way to avoid XSS is to filter _output_. My script: http://nengine.korsengineering.com/files/src/misc/HtmlFilter.phps -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Non-trivial task of converting text to HTML
Maybe I'm missing some requirement, but what if you just used HTML "" tags. You can still use other HTML for formatting within the tags but it'll pay attention to carriage returns/line feeds and spaces without having to use s For example, if you did the following... is it what you need or what's wrong with it still? This is a title This is a Book paragraph. This is another book paragraph. This is yet another book paragraph, but it's not indented with spaces, because user wrote it in OpenOffice. == == This is a web paragraph. This is another web paragraph. This is yet another web paragraph, which is indented with spaces for some unknown reason. == = = = Original message = = = Task: Create a script that converts text into HTML with paragraphs. Problem: Input text could use the book notation, as well as the web notation, plus it can contain HTML. == This is a title This is a Book paragraph. This is another book paragraph. This is yet another book paragraph, but it's not indented with spaces, because user wrote it in OpenOffice. == == This is a web paragraph. This is another web paragraph. This is yet another web paragraph, which is indented with spaces for some unknown reason. == Output text should be correctly formatted without using lots of br's and 's. Doing so manually is not a problem, I would just use for web paragraphs, and for book paragraphs. However, formatting such text with a scrip is very difficult. Does anyone knows a good exaple of such script? ___ Sent by ePrompter, the premier email notification software. Free download at http://www.ePrompter.com. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] What software do you use for writing PHP?
TECO rox! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Does the extension php_printer.dll work with php version 5.1.1 on a XP System
I trying to get php_printer.dll extension to work on a xp system . I downloaded correct version of php_printer.dll to match php version 5.1.1 . The extension_dir is set correctly , because other extensions load and work perfectly. When I execute the following code, I get ... an undefined function call error , even though the extension loaded at boot time without any errors. php_printer.dll is in the extension directory. Does anyone have a solution to my problem. Thanks , Jim Crooks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Inserting a NULL value into MySQL via PHP
I tried this and it didn't work using PHP it just leaves a blank instead of a NULL setting. Any other ideas? On 11/11/05, Richard Lynch <[EMAIL PROTECTED]> wrote: > > On Thu, November 10, 2005 11:15 pm, Curt Zirzow wrote: > > > > > $sql_quoted = array(); // shiflett' -- style > > > > $myFieldValue = isset($POST['myFieldValue'])? $_POST['myFieldValue']: > > ''; > > > > if (strlen(trim($myFieldValue)) { > > $sql_quoted['myField'] = "'" . > > mysql_real_escape_string($myFieldValue) . "'"; > > } else { > > $sql_quoted['myField'] = 'NULL'; > > } > > I personally would do this part all in one shot: > > $field = (isset($_CLEAN['field']) && strlen($_CLEAN['field'])) ? > "'$_CLEAN[field]" : 'NULL'; > > Otherwise, I find myself too distracted by all the assignments and > if/else logic, and too likely to mess them up later with code changes > in earlier/later lines. > > Note that you already have the apostrophes in $field for non-NULL, so > you would just do: > > $query = "insert into foo (field) values($_CLEAN[field])"; > > with no apostrophes > > $_CLEAN represents an escaped and filtered string, or an unset index, > if nothing was in $_POST to start with. Or you can just use the empty > string '' in $_CLEAN if you find that easier to process. > > More than one way to skin a cat. > > -- > 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 > > -- ** The content of this e-mail message and any attachments are confidential and may be legally privileged, intended solely for the addressee. If you are not the intended recipient, be advised that any use, dissemination, distribution, or copying of this e-mail is strictly prohibited. If you receive this message in error, please notify the sender immediately by reply email and destroy the message and its attachments. *
Re: [PHP] Class Constant PHP 5
The point was more that the constant's value is 'defined' at the beginning of the script, and is constant and non changing throughout the entire execution of the script. But I was looking for a way to give it a namespace inside a class rather than just defining in in the global scope so that I do not have to worry about conflicting names with other packages such as PEAR et al. I wanted to do something like: so that I I could later use the notation $value = ClassName::ConstantName or from within the class $value = self::ConstantName and ensure other developers could not change the value of the constant. To achieve the result I want I could do: But that just seems pointless and messy. I will assume that the simple answer to my original question was 'No that it is not possible'. Thanks - Jeff Jeffrey Sambells cell 519.897.2552 phone 905.878.4701 web http://www.sambells.info On 7-Dec-05, at 1:22 PM, Jay Blanchard wrote: [snip] is there a way to dynamically define a class constant during runtime in PHP 5? for example I would like to achieve the result of something like: class Example { const FOO = bar(); } However this would obviously give a parse error. I know it is possible with variables but I would like it to be a constant. [/snip] Well, first of all the syntax you describe above does not define a constant at all, you would need to use define() The second thing is good old basic OOP theory, you should declare a private static variable http://us3.php.net/private http://us3.php.net/manual/en/language.oop5.static.php Of course you could define a global constant and then pass it into your object when instantiating it, but that is a bad idea generally. Thirdly, you could never use a function to derive your constant value...it would then be an oxymoron. If the value generated by the function bar() changes, FOO is a variable. Constants are for simple values. For instance, we can all agree that pi is 3.14159 (to 5 decimal places, so defining a constant pi makes sense; define("PI", 3.14159); If we do not know what the outcome of a function will be it makes the value of the outcome a variable, always. It would be foolish (and would fail anyhow) to do something like this; define("RANDOM", rand(5,12));
Re: [PHP] PHP Warning: imagettftext() expects parameter 2 to be double
You've got 83px in you XML file for the fontsize. the 'px' is messing it up change it to just 83 in the XML file or cast the value to (float) which will extract the 83 and remove the px: foreach ($xml->textblock as $text) { $fontsize=(float)$text->fontsize; $fontangle=(float)$text->fontangle; $fontxpos=(int)$text->fontxpos; $fontypos=(int)$text->fontypos; $text=$text->text; imagettftext($image['png'],$fontsize,$fontangle,$fontxpos,$fontypos,$fon t['color'],$font['type'],"$text",array()); } - Jeff On 7-Dec-05, at 7:06 AM, James wrote: Hi, Thank you for getting back to me, your the first. The array works fine – I have tested it using var_dump(). Attached are the two files – xml.test – this holds the array of the text blocks which is being parsed by image.php. Line 38 is the problem, if you comment around the foreach() statement and un-comment the commented lines you should see it working fine, its when its within the foreach statement when it errors. Regards, James Jochem Maas Wrote: James wrote: > Hi there, > > I have been using the GD functions from PHP5.0 on Mac OS X. > > I have a simple script that creates a PNG image with text on the image using > fonts using FreeType 2. > > I am trying to use the imagettftext() function within a foreach loop – but I > get the following error: > > PHP Warning: imagettftext() expects parameter 2 to be double what does paramter 2 contain in each case? var_dump(), print_r(), echo ?!? > > The code is as follows: > > $font['type']="./fonts/font.ttf”; > > > $font['color']=imageColorAllocate($card['png'],$font['hexcolor']['r'], $font[ > 'hexcolor']['g'],$font['hexcolor']['b']); > > imageFill($card['png'],0,0,$card['color']); > > foreach ($xml->textblock as $text) { > $fontsize=$text->fontsize; $fontangle=$text->fontangle; > $fontxpos=$text->fontxpos; $fontypos=$text->fontypos; > $text=$text->text; try var_dump($text); or print_r($text); to see what you have (if its an XML node object - dump $fontsize, $fontxpos instead!!!) > imagettftext($image['png'],$fontsize,$fontangle,$fontxpos,$fontypos,$f ont['c > olor'],$font['type'],$text); } > > It works fine if I add just one line outside of the loop – but as soon as > its within the loop it errors. > > Cheers, > > James > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] references, circular references, oop, and garbage collection in PHP5
[ man.. I just realized that "reply" to this list doesn't send to the list... replies being re-sent... thanks for the help! ] On Dec 6, 2005, at 10:45 PM, Curt Zirzow wrote: I'm going to jump to the code as fast as possible to explain what I can, the key thing to remember in php5 is that the old &$var declaration has no real meaning in objects. php5's objects exist outside of the old oop reference. Consider: class Object { public $val; function __construct($v) { $this->val = $v; } } In PHP5: $o = new Object(2); $b = $o; $b->val = 3; print $o->val; // echos 3 in PHP4 (assuming var is used instead of public) $o = new Object(2); $b = $o; $b->val = 3; print $o->val; // echos 2 This is cause objects in php5 exist all on there own, that get referenced to a php variable. On Tue, Dec 06, 2005 at 05:23:45PM -0500, Alan Pinstein wrote: Question #1: Is the fact that references to objects in the form $objRef = &$obj don't bump the refcount of $obj an intended behavior that can be counted on? If so, cool! So, now that we have a way to do weak references, we should be able to implement a reasonable memory management scheme for parent-child objects. Normally from the client side the interface should look something like: $parent = new Parent(); $child = new Child(); $parent->addChild($child); Ok, i get to the code and well what I mentioned above explains why there is no need to use the $o = &$object; If I take your code and run it against one of the latest version's of php 5.1 i will get a var_dump($child) of: object(pChild)#2 (1) { ["parent"]=> object(pParent)#1 (1) { ["children"]=> array(1) { [0]=> object(pChild)#2 (1) { ["parent"]=> object(pParent)#1 (1) { ["children"]=> array(1) { [0]=> *RECURSION* } } } } } } Which is what I see as expected results. Curt. -- cat .signature: No such file or directory -- 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] references, circular references, oop, and garbage collection in PHP5
Hey Ray- Thanks for the link! Actually, the article didn't help directly, but it did spark an idea. My main problem all along was trying to get a true reference to $this. For some reason reading the article led me to try "$this- >this", which works, to my surprise! So, I now have a complete solution to my problem code follows... ONE QUESTION REMAINS: is what I'm doing intended / publicly exposed behavior, or am I hacking and at risk of failure in future versions? Thanks, Alan * Playing around with proper reference counting of nested objects in PHP. * * The proper way to handle refCounting of nested objects is to have parents "retain" their kids, and have the kids use "weak references" to the parent. * */ $mem0 = memory_get_usage(); for ($i=0;$i<10;$i++) { $a = new A; $b = new B; $a->addB($b); $b = NULL; // kill the ref from a to b so as to GC b. If we've done things right, b will still exist and the next line will not fail. $a->printBs(); $a = NULL; // kill the local ref to a, which should be the only ref-counted ref to a if we've done things right; this should cause a (and thus b) to be gc'd NOW. } print "Leaked: " . (memory_get_usage() - $mem0) . "\n"; print "Done\n"; exit; class A { public $b = array(); private $memWaste; function __construct() { $this->memWaste = ""; for ($i = 0; $i < 1000; $i++) { $this->memWaste .= "1234567890"; } print "new A{$this}\n"; } function __destruct() { print "kill A{$this}\n"; } // add a child B to our list. We want a ref-counted instance here. function addB($b) { $this->b[] = $b;// refCounted desired in parent->child link $b->setA($this->this); // so, this is apparently how you access a true reference to $this, because &$this doens't work. } function printBs() { foreach ($this->b as $b) { $b->sayHi(); } } } class B { public $a; private $memWaste; function __construct() { $this->memWaste = ""; for ($i = 0; $i < 1000; $i++) { $this->memWaste .= "1234567890"; } print "new B{$this}\n"; } function __destruct() { print "kill B{$this}\n"; } // refCount NOT desired in child->parent link, so use ref vars function setA(&$a) { $this->a = &$a; } function sayHi() { print "HI from {$this}\n"; } } ?> On Dec 6, 2005, at 7:10 PM, Ray Hauge wrote: I am uncertain on this, but I believe that the $this variable is already just a reference to the class you are calling it from. Then passing the reference by-reference to the addParent() method of the Child class could be what is causing your issue. I'd be curious to see what would happen if you took out the pass-by- reference and instead pass-by-value for the addParent() method. Then again, that doesn't particularly sound correct either. This link might help. They cover a lot of advanced reference usage for PHP. http://www.onlamp.com/pub/a/php/2002/09/12/php_foundations.html Alan Pinstein wrote: So.. I am having PHP5 memory management problems. They are similar to those described in this thread: http://aspn.activestate.com/ASPN/Mail/Message/php-Dev/1555640 (so maybe this question belongs on php-dev but I figured I'd try here first... seems like a userland question) Basically I have an object model to represent db objects, and I am bulk-loading the objects via some PHP scripts. Sadly the scripts consume unbounded memory because of this problem. I have done a lot of programming in C++ and Obj-C and the normal way to handle circular references is to have parents "retain" (keep ref- counted links) to their kids, and have the kids have "weak references" (non-ref-counted) links to their parents. This way, when the parent is no longer used, it will automatically 0-out the ref counts to all children it links too and things GC correctly. Now, how to do this in PHP? Well, there are no "documented" weak references. However, I figured out by trial that if you obtain a php-reference to an object, it doesn't bump the refcount. Question #1: Is the fact that references to objects in the form $objRef = &$obj don't bump the refcount of $obj an intended behavior that can be counted on? If so, cool! So, now that we have a way to do weak references, we should be able to implement a reasonable memory management scheme for parent-child objects. Normally from the client side the interface should look something like: $parent = new Parent(); $child = new Child(); $parent->addChild($child); Where parent can have 0,n children and child can have 0,1 parent. And all of parent's internal links to child should be refcounted, and the internal links from child to parent are weak (not ref- counted). So based on the abo
Re: [PHP] references, circular references, oop, and garbage collection in PHP5
On Dec 7, 2005, at 12:36 AM, Curt Zirzow wrote: My original statement was to show how the the php4 = &$o is different. Oh, well, sure I believe that! :) In php5 variables are just containers that point to objects, so when you make a variable a reference to another variable all you are doing is saying these variables are the same thing. That's good to know... one thing that's difficult about PHP is that everything's opaque and not well documented. In C/C++ I know what things actually are b/c you can see the typedefs. In php I just don't know how objects are represented, what references are, etc. So, knowing that an "object" variable is really just a "special container object" that points to the real instance, this is useful. That isn't clear from the php docs. Thanks! php5's objects dont know any such thing as a reference, they just know of instances of themselves. The variables ($o, $a, $b) existance is just a container for the instance of the object. So in the case when I do a: $b = &$o; All that is happening is the container is identical, so when I say: $o = null; Since $b is the same thing as $o , $b is set to null as well and thus, there are now more variable (containers) that reference to the instance of the object, thus the object will get destroyed, but.. if i say we have two containers: $o = new stcClass; $b = $o; Now the instance of that 'new StdClass' is contained in two vars, when I set $o to null, $b still exists since it doesn't know about $o whats so ever, and the instance of the stdClass still exists. Yes, this makes sense, too. It's tricky, with so many levels of indirection. So at the core level, you've got the "real" object instance. Then, you've got N container "object variables" that point to the real instance. PHP refcounts the number of object variables pointing at the real instance. Then, on top of that, you have references, which are "aliases" to "object variables" and thus don't affect the ref count. So good this all makes sense and agrees with the behavior I see. I guess it comes down to objects are treated the same way as you would expect these results: Yes... The sample code below shows that indeed, in practice, on 5.0.4, that & will create another reference (ie a weak reference) to an object WITHOUT incrementing the refcount I'm not sure how you mean a weak reference, and well a refcount is rather meaning less in php userland. So, this gets interesting. I don't know if you're familiar with the circular-reference problem. But if you have two instances that have references to each other, even once you remove all references to the objects, they will not be GC'd since they have a mutual deadlock on each other: $a = new MyObj; $b = new MyObj; $a->setB($b);// does $this->b = $b; $b->setA($a);// does $this->a = $a; $a = NULL; $b = NULL; The actual instances pointed to by $a and $b WILL NOT GET FREED HERE as you would *wish*. However this is expected behavior. Only by changing MyObj to store "weak references", that is references to the objects that are NOT reference-counted, can you get the GC to free the instances. function setB(&$B) { $this->b = &$a; } function setA(&$B) { $this->a = &$b; } Now, the instances will be freed when the $a and $b are null'd out. So, while I now feel more confident of how references act with respect to objects (which is, they act the same as they do for any variable), I still am not sure what "$this->this" is and why it worked so magically. Thanks for the explanations! I feel better about this now. Alan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] ob_start & session_start
Hello, Something just crossed my mind about using output buffering is there any reason why you should start a session before calling ob_start() ??? Just curious which way would be the proper way of doing it... or doesn't it matter? Thanks -- Joe Harman - * My programs never have bugs, they just develop random features. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] ob_start & session_start
Okay.. makes sense after you spelled it out to me... LOL... I always start my session first.. so, that must why i have never had any problems Cheers & Thanks! Joe On 12/7/05, Zack Bloom <[EMAIL PROTECTED]> wrote: > yes, it will display the content in the buffer before creating the session. > If your session uses cookies (this is usually automatically decided by php) > it cannot send out the header after the buffer. > > > On 12/7/05, Joe Harman <[EMAIL PROTECTED]> wrote: > > > > Hello, > > > > Something just crossed my mind about using output buffering is > > there any reason why you should start a session before calling > > ob_start() ??? > > > > Just curious which way would be the proper way of doing it... or > > doesn't it matter? > > > > Thanks > > > > -- > > Joe Harman > > - > > * My programs never have bugs, they just develop random features. > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > > -- Joe Harman - * My programs never have bugs, they just develop random features. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: [PHP-DB] ftp_put
Hi Chris... sometimes there is no replacement for a FTP program... but you can use INI_SET() at in your PHP file to temporarily set the file upload size. i think you will have to change the time out settings also look at the manual on ini_set... also search this list for ini_set even better... take a look at this http://www.radinks.com/upload/config.php Joe On 12/8/05, Chris Payne <[EMAIL PROTECTED]> wrote: > Hi there everyone, > > > > I'm using FTP to upload a file from a form, the information is stored in a > MySQL DB and then FTP'd to the server. Is it possible - without altering > the php.ini file as I don't have access to this on my clients server - to be > able to upload large files rather than small ones? I know with POST there > are limits, but we're talking about megabytes rather than KB's needing to be > uploaded. They HAVE to be uploaded via some kind of form as it sends the > data to a database such as the file name and location so that it can easily > be found by the system otherwise I'd just tell them to use normal FTP > software. > > > > What's the best way of achieving this? I'm talking file 5-20megs in size. > > > > Thanks everyone. > > > > Chris > > > -- Joe Harman - * My programs never have bugs, they just develop random features. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] ob_start & session_start
Joe Harman wrote: Okay...makes sense after you spelled it out to me. That didn't make sense to me (and I missed the original reply). Mind elaborating? :-) 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] ob_start & session_start
Sure, ob_start begins a buffer allowing you to display content in the browser before your script has finished executing. This is useful when loading a time intensive page to tell the user to wait. When you create a session (provide php is not configured otherwise) php attempts to store a cookie with the session id that corisponds to the session file on the server. If it cannot set this cookie it appends the session id to pages in the get format. If you were to call session_start() after the output buffering, content and consequentially the headers would have been already sent to the browser. Since cookies must be set in the headers and the headers must be set before any content is sent to the page, to use cookie based sessions you must begin the session before the buffer. Hope that cleared it up, Zack Bloom On 12/8/05, Chris Shiflett <[EMAIL PROTECTED]> wrote: > > Joe Harman wrote: > > Okay...makes sense after you spelled it out to me. > > That didn't make sense to me (and I missed the original reply). Mind > elaborating? :-) > > 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] ob_start & session_start
I guess this was just out of general curiousity... If you started 'session_start()' after 'ob_start()' would the sessions work correctly? k.. maybe I am still confused... lol... I normally do session_start() before the ob_start()... Zack Said : 'yes, it will display the content in the buffer before creating the session. If your session uses cookies (this is usually automatically decided by php) it cannot send out the header after the buffer.' So, the question is really... in what order is the best way to do this... I would think that you always want to start a session first... but then again, you guys are the experts... i am sure someone knows a reason when you should not do that. ;o) Joe On 12/8/05, Chris Shiflett <[EMAIL PROTECTED]> wrote: > Joe Harman wrote: > > Okay...makes sense after you spelled it out to me. > > That didn't make sense to me (and I missed the original reply). Mind > elaborating? :-) > > Chris > > -- > Chris Shiflett > Brain Bulb, The PHP Consultancy > http://brainbulb.com/ > -- Joe Harman - * My programs never have bugs, they just develop random features. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] array carrying from one php page to another
I have an array $journal that I want to carry from a page (where it was created) to another page (a popup that shows the variables contents). Is this automatically available? or do I have to do something special to php?? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] ob_start & session_start
On Thu, Dec 08, 2005 at 01:23:40AM -0500, Joe Harman wrote: > > So, the question is really... in what order is the best way to do > this... I would think that you always want to start a session first... > but then again, you guys are the experts... i am sure someone knows a > reason when you should not do that. The first thing I would ask is why are you using/need ob_start(). session_start() should be the first thing that happens in most cases. Since, well, any code that exist is potentially going to rely on a session state. If you are trying to use ob_start() to rid of the common error 'headers already sent in some_file.php on line such and such', i would first consider why that is causing the error and how can you call session_start() before that happens. Since '97 i think i've used ob_start twice, in all my php apps, and that was cause I wanted to filter the output either with tidy or modify the data in a very obscure way. Curt. -- cat .signature: No such file or directory -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] array carrying from one php page to another
On Thu, Dec 08, 2005 at 01:33:52AM -0500, Eternity Records Webmaster wrote: > I have an array $journal that I want to carry from a page (where it was > created) to another page (a popup that shows the variables contents). Is > this automatically available? or do I have to do something special to php?? It can be sort of automatically: And in the code that is called in the popup: Curt. -- cat .signature: No such file or directory -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] array carrying from one php page to another
Session variable or hidden field maybe Eternity Records Webmaster wrote: I have an array $journal that I want to carry from a page (where it was created) to another page (a popup that shows the variables contents). Is this automatically available? or do I have to do something special to php?? -- life is a game... so have fun. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] ob_start & session_start
Zack Bloom wrote: Sure, ob_start begins a buffer allowing you to display content in the browser before your script has finished executing. Calling ob_start() turns on PHP's output buffering. In other words, it buffers output from the moment this function is called until the buffer is flushed (whether explicitly or because the script finishes). As long as PHP is buffering the output, the client can't get it. This is useful when loading a time intensive page to tell the user to wait. I think you might be thinking of flush(), which flushes PHP's output buffer as well as the output buffer of the web server (or whatever backend PHP is using). When you create a session (provide php is not configured otherwise) php attempts to store a cookie with the session id that corisponds to the session file on the server. If it cannot set this cookie it appends the session id to pages in the get format. Yeah, PHP includes a Set-Cookie header in its response. If session.use_trans_sid is enabled, it will also rewrite URLs to include the session identifier. When PHP receives a request that includes a session identifier, it knows whether the client accepts cookies. if (session identifier in cookie) { cookies enabled } elseif (session identifier in URL) { cookies disabled } else { new user } If you were to call session_start() after the output buffering, content and consequentially the headers would have been already sent to the browser. Maybe you're getting the buffering and flushing concepts reversed? Think of a toilet - buffering is the handle up, and flushing is the handle down. :-) Hope that helps! 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] references, circular references, oop, and garbage collection in PHP5
On Wed, Dec 07, 2005 at 09:30:36PM -0500, Alan Pinstein wrote: > > On Dec 7, 2005, at 12:36 AM, Curt Zirzow wrote: > > > >I'm not sure how you mean a weak reference, and well a refcount is > >rather meaning less in php userland. > > So, this gets interesting. I don't know if you're familiar with the > circular-reference problem. But if you have two instances that have > references to each other, even once you remove all references to the > objects, they will not be GC'd since they have a mutual deadlock on > each other: > > $a = new MyObj; > $b = new MyObj; > $a->setB($b); // does $this->b = $b; > $b->setA($a); // does $this->a = $a; > > $a = NULL; > $b = NULL; > > The actual instances pointed to by $a and $b WILL NOT GET FREED HERE > as you would *wish*. However this is expected behavior. I would have to disagree with the 'as you would *wish*' part. if I pass something to a function/method via copy (vs reference) i would hardly expect code outside the function/method to affect their existance. > > Only by changing MyObj to store "weak references", that is references > to the objects that are NOT reference-counted, can you get the GC to > free the instances. > > function setB(&$B) { $this->b = &$a; } > function setA(&$B) { $this->a = &$b; } > > Now, the instances will be freed when the $a and $b are null'd out. I think you meant to type: function setB(&$a) { $this->b = &$a; } function setA(&$b) { $this->a = &$b; } And consider the definition written as: function setB(&$a) { $this->b = $a; } function setA(&$b) { $this->a = $b; } does the $a = null; and $b = null; outside the class cause the objects to get null'd inside the class as well? > So, while I now feel more confident of how references act with > respect to objects (which is, they act the same as they do for any > variable), I still am not sure what "$this->this" is and why it > worked so magically. You lost me on your $this->this statement. Curt. -- cat .signature: No such file or directory -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] broken code....
I have this code that doesnt print the db results like they should... it uses pear::db package for the database. Was wondering if anybody can figure out how come it doesnt work... getMessage()); } $results->query('select * from eternityrecords.journal'); if (PEAR::isError($results)) { die($db->getMessage()); } //test the results out.. ?> fetchInto($journal, DB_FETCHMODE_ASSOC)){ ?> disconnect(); ?> -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Anyone getting bounces from
On Wed, Dec 07, 2005 at 08:36:05AM -0600, Jay Blanchard wrote: > [EMAIL PROTECTED] ? > > I am getting failure notices out the wazoo for some very old messages to the > general list. > expect some more of them, if you've sent a message recently. time to get him/her unsubscribed.. Curt. -- cat .signature: No such file or directory -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] array carrying from one php page to another
you could just pass in in the address, eg: www.example.com?var1=$var1&var2=$var2 to get them use $_REQUEST['var1'] to pass an array you could use serialize($var1) and unserialize($var1) On 12/8/05, Chris Shiflett <[EMAIL PROTECTED]> wrote: > > Curt Zirzow wrote: > > > $array = array('my', 'list', 'of', 'stuff'); > > $_SESSION['array_for_popup'] = $array; > > ?> > > > > And in the code that is called in the popup: > > > > > if(!isset($_SESSION['array_for_popup']) { > > die('you should not be here anyway, only on a popup is this allowed'); > > } > > > > $array = $_SESSION['array_for_popup']; > > // .. do your magic. > > > > // optionally clean things up. so the session var is removed. > > unset($_SESSION['array_for_popup']); > > ?> > > Don't forget session_start(). :-) > > (You might have session.auto_start enabled, but it's not by default.) > > 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] array carrying from one php page to another
Curt Zirzow wrote: And in the code that is called in the popup: Don't forget session_start(). :-) (You might have session.auto_start enabled, but it's not by default.) 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] ob_start & session_start
I have never tried it but if it did work i doubt it would use cookies, it would probably pass it in the addresses or throw an error. On 12/8/05, Joe Harman <[EMAIL PROTECTED]> wrote: > > I guess this was just out of general curiousity... If you started > 'session_start()' after 'ob_start()' would the sessions work > correctly? k.. maybe I am still confused... lol... I normally do > session_start() before the ob_start()... > > > Zack Said : 'yes, it will display the content in the buffer before > creating the session. If your session uses cookies (this is usually > automatically decided by php) it cannot send out the header after the > buffer.' > > > So, the question is really... in what order is the best way to do > this... I would think that you always want to start a session first... > but then again, you guys are the experts... i am sure someone knows a > reason when you should not do that. > > ;o) > Joe > > > > > On 12/8/05, Chris Shiflett <[EMAIL PROTECTED]> wrote: > > Joe Harman wrote: > > > Okay...makes sense after you spelled it out to me. > > > > That didn't make sense to me (and I missed the original reply). Mind > > elaborating? :-) > > > > Chris > > > > -- > > Chris Shiflett > > Brain Bulb, The PHP Consultancy > > http://brainbulb.com/ > > > > > -- > Joe Harman > - > * My programs never have bugs, they just develop random features. > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > >
Re: [PHP] ob_start & session_start
Sorry it looked like the rest of your email was part of the previous one. To answer your question it is better to call session_start() before ob_start() On 12/8/05, Zack Bloom <[EMAIL PROTECTED]> wrote: > > I have never tried it but if it did work i doubt it would use cookies, it > would probably pass it in the addresses or throw an error. > > On 12/8/05, Joe Harman <[EMAIL PROTECTED]> wrote: > > > > I guess this was just out of general curiousity... If you started > > 'session_start()' after 'ob_start()' would the sessions work > > correctly? k.. maybe I am still confused... lol... I normally do > > session_start() before the ob_start()... > > > > > > Zack Said : 'yes, it will display the content in the buffer before > > creating the session. If your session uses cookies (this is usually > > automatically decided by php) it cannot send out the header after the > > buffer.' > > > > > > So, the question is really... in what order is the best way to do > > this... I would think that you always want to start a session first... > > but then again, you guys are the experts... i am sure someone knows a > > reason when you should not do that. > > > > ;o) > > Joe > > > > > > > > > > On 12/8/05, Chris Shiflett <[EMAIL PROTECTED] > wrote: > > > Joe Harman wrote: > > > > Okay...makes sense after you spelled it out to me. > > > > > > That didn't make sense to me (and I missed the original reply). Mind > > > elaborating? :-) > > > > > > Chris > > > > > > -- > > > Chris Shiflett > > > Brain Bulb, The PHP Consultancy > > > http://brainbulb.com/ > > > > > > > > > -- > > Joe Harman > > - > > * My programs never have bugs, they just develop random features. > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > >
Re: [PHP] array carrying from one php page to another
On Thu, Dec 08, 2005 at 02:39:46AM -0500, Zack Bloom wrote: > you could just pass in in the address, eg: > www.example.com?var1=$var1&var2=$var2 > > to get them use $_REQUEST['var1'] > > to pass an array you could use serialize($var1) and unserialize($var1) Or just use http_build_query() (php5 only) Curt. -- cat .signature: No such file or directory -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php