[PHP] stripping comments
I'm trying to strip comments out of my code. I can get it to strip one section of comments but the problem comes in when I have more then one comment section to strip. I am using this: $code = preg_replace('/\/*(.*?)*\//is', '$1', $code) and need help fixing my regex. example: code 1 /* comment 1 */ code 2 /* comment 2 */ code 3 result (bad): = code 1 code 3 result (good): == code 1 code 2 code 3 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] stripping comments
On Sun, Oct 05, 2003 at 04:46:16AM -0400, zzz wrote: : : I'm trying to strip comments out of my code. I can get it to strip one : section of comments but the problem comes in when I have more then one : comment section to strip. : : I am using this: $code = preg_replace('/\/*(.*?)*\//is', '$1', $code) and : need help fixing my regex. : : example: : : code 1 : /* comment 1 */ : code 2 : /* comment 2 */ : code 3 : : result (bad): : = : code 1 : code 3 : : result (good): : == : code 1 : code 2 : code 3 How about this: $code = preg_replace('|/\*.*\*/|msU', '', $code); -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] stripping comments
You will run into more problems and there are many things you need to consider, for example /* in a string. But token_get_all() will parse php code for you and will make things much simpler. zzz wrote: I'm trying to strip comments out of my code. I can get it to strip one section of comments but the problem comes in when I have more then one comment section to strip. I am using this: $code = preg_replace('/\/*(.*?)*\//is', '$1', $code) and need help fixing my regex. example: code 1 /* comment 1 */ code 2 /* comment 2 */ code 3 result (bad): = code 1 code 3 result (good): == code 1 code 2 code 3 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] stripping comments
Hey perfect Eugene, thanks -Original Message- From: Eugene Lee [mailto:[EMAIL PROTECTED] Sent: October 5, 2003 5:14 AM To: [EMAIL PROTECTED] Subject: Re: [PHP] stripping comments On Sun, Oct 05, 2003 at 04:46:16AM -0400, zzz wrote: : : I'm trying to strip comments out of my code. I can get it to strip one : section of comments but the problem comes in when I have more then one : comment section to strip. : : I am using this: $code = preg_replace('/\/*(.*?)*\//is', '$1', $code) and : need help fixing my regex. : : example: : : code 1 : /* comment 1 */ : code 2 : /* comment 2 */ : code 3 : : result (bad): : = : code 1 : code 3 : : result (good): : == : code 1 : code 2 : code 3 How about this: $code = preg_replace('|/\*.*\*/|msU', '', $code); -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] php5 and possible oop features/questions
will something in the likes of this be possible in php5? /***/ class some_classname { function some_function(); } function some_classname::some_function($prefix, $text) { return $prefix.: .$text.\n; } $test = new some_classname; $test-some_function(Output,Hello World!); /***/ how about object/class aggregation from php4 (it was experimental and i imagine it still has a few bugs left, but it was a really usefull feature)..? i know the following is possible: class class_name implements class1, class2, class3 extends parent_class { ... } but, can you do something more dynamic, so you can tell which classes to implement at runtime? class class_name implemenets $vars extends parent_class ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: php5 and possible oop features/questions
if you want to use variable's in a function you need to give the function the paramaters..if you do not with to use it like that.. declare the vars in the beginning of the class class classname { var $1; var $2; } greetz -- -- It's Not God That Created Us, It's Us That Created God! Tit Black Petric [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] will something in the likes of this be possible in php5? /***/ class some_classname { function some_function(); } function some_classname::some_function($prefix, $text) { return $prefix.: .$text.\n; } $test = new some_classname; $test-some_function(Output,Hello World!); /***/ how about object/class aggregation from php4 (it was experimental and i imagine it still has a few bugs left, but it was a really usefull feature)..? i know the following is possible: class class_name implements class1, class2, class3 extends parent_class { ... } but, can you do something more dynamic, so you can tell which classes to implement at runtime? class class_name implemenets $vars extends parent_class ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] NEW: XML Application Objects
Robert Cummings wrote: On Sat, 2003-10-04 at 08:18, Terence wrote: Bloody hell Rob, you've started me on another rant when I could be in bed ;) *grin* glad to help out. XSLT is a pain in the butt if you want to master it - particularly if you're going from imperative programming to declarative (maybe XPath is functional, but declaring templates is definately declarative) as many My understanding, which could very well be incorrect, is that declarative and functional are synonymous and imperative and procedural are synonymous. Most of the literature I've read describes XSL as a functional language, and while XSL is not necessarily XSLT, it is most definitely a part. From what I understand, procedural is a subset of imperative and functional is different from declarative but I may be wrong too. It's been a long time since I've read up on my theory. Let's just say that XSLT is very different to what us PHP dudes are normally used to ;) PHP developers would be. It took me a good twelve months to get it (eg. use XPath filters and not xsl:if/). That didn't stop me from churning out some production applications using XSLT. You can learn the basics without mastering it and still find it plenty useful. I would argue that my XSLT skills still leave a lot to be desired, but mastery of it is still worthwhile persuing. Quite simply, XSLT has a lot of depth. I also develop in Java and C# where I can re-use all my template knowledge since this knowledge is based on a standard. I plan on having a play with building web apps in C++ and Python if I get the chance (by porting the XAO concept). For the time being, it happens that I am more skilled with PHP so I will develop the XAO architecture and concept in PHP. It's pointless splitting hairs over the capabilities/advantages of one templating language over another. If the idea of cross-technology compatability doesn't appeal to you enough to put the effort in to master XSLT, then don't master it. Everyone has their own style. XAO is for object oriented developers of XML-centric applications. I imagine it won't be everyone's cup of tea even for such a group. Its the same reason I never bothered to master LISP. It isn't my cup of tea, generally it isn't most people's cup of tea :) But in all honesty when a project insists I use XSL(T) then I do. warning: very personal opinion to follow... If you *do* finally decide to master XSLT, you have to conclude that *any* other templating system is a complete/utter waste of time. (all While this is a very personal opinion you state for others that you have to conclude that ... which changes the opinion from personal to a foredrawn conclusion of ubiquity. exactly, and if I wasn't being so opinionated, I would not have the luxury of being so foredrawn about things. I'd have to take a more scientific and hence concervative view with adequate disclaimers declarations about the possibilities and dangers of being incorrect - like we both did about definitions of functional/declarative and imperative/procedural (pardon my bad grammar). Although I strongly suspect you're right since I don't always spend enough time on the theory. I realise I made a mistake about assuming what XSLT masters will have to conclude being that I am no XSLT master myself. It was ambitious presumption based on the current trend of my experience with XSLT. And besides, it was a convenient foregone conclusion for my argument ;) I thought I had granted myself a licence for this when I prefixed my opinionation disclaimer. authors of ``yet another PHP templating system'', please try not to be offended). I'm not talking about features/functionality either (for which XSLT is more than adequate), I'm talking about sheer bothersomeness. ie. I'm fundamentally lazy and I couldn't be bothered learning snazzy g.o.a.t. [proprietary] templaty goodness system -- crappy or otherwise -- I don't care how fantastic it is. The reason why the PHP template has been re-invented so many times, is becuase there is something missing - IMHO, XSLT fits that gap more than good enough. And since it is a standard, it will only get better -- it has a future. And that, my friends, it good enough for me (being that I am lazy and all). This doesn't really affect me personally. My templating system is open source, I made it and released it without the intent of making money. While it has a business license it is only because if someone *is* going to profit from it, then consideration should trickle back to the developer. Without being argumentative, but rather to be descriptive, the reason I made my own templating system was because it satisfied my needs long ago (at which time I already had been exposed to XSLT) and by creating hooks to custom tags in PHP itself it lent itself to re-use much of the code I had already developed in PHP for one reason or another. Another reason is that by not crossing technologies too many times, it becomes
Re: [PHP] NEW: XML Application Objects
Rush wrote: Terence [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] warning: very personal opinion to follow... If you *do* finally decide to master XSLT, you have to conclude that *any* other templating system is a complete/utter waste of time. (all authors of ``yet another PHP templating system'', please try not to be offended). I'm not talking about features/functionality either (for which XSLT is more than adequate), I'm talking about sheer bothersomeness. ie. I'm fundamentally lazy and I couldn't be bothered learning snazzy g.o.a.t. [proprietary] templaty goodness system -- crappy or otherwise -- I don't care how fantastic it is. The reason why the PHP template has been re-invented so many times, is becuase there is something missing - IMHO, XSLT fits that gap more than good enough. And since it is a standard, it will only get better -- it has a future. And that, my friends, it good enough for me (being that I am lazy and all). Well, I completely agree with you that there is no one size fits all solution for templates, and that one should choose what suites him best. Anyway, in similar very personal way, especially since I am naturaly biased, I will like to point out my reasons why I prefere my php template system compared to the xml+xslt combination: a) xslt templates are fat or dirty ones if you will, meaning they contain code, effectively nullifying my major reason to use templates: separation of html from code. Some people prefer fat templetes and try to stuff whole presentation logic in them while only models reside in php, but prefer thin or clean templates, where template is basically resource produced independently by designer, and php runs presentation and model code. With fat templates, they usualy get to complex to be coded by web designers, so they have to be poked by programmers, which means that it is much more difficult to split the job. Also means that programmer has to code in 2 languages, php, and in some template language, while in thin templates model he can code in one language domain. b) working with xml+xslt requires more footwork than with TT. Well, again, it is just my reasons. Other people may have other needs and preferences. well I have to say I can't disagree with any of your reasons. One of the major dangers of XSLT is how easy it is to end up with a mess. In it's defence, I will say that it is also possible to program cleanly with XSLT and avoid the code aspects such as flow-control that you speak of. I'm still learning how to program XSLT cleanly in real-world situations. It can be done though. Like PHP, XSLT has a lot of depth. I've maintained (and produced myself) some pretty horrid code - but that doesn't stop me from chosing PHP as a weapon in my arsenal. I guess one of my main gripes about templating systems is that I can't re-use them between applications. Because there are so many different ones to chose from, almost every pre-built, open-source, PHP app that I download uses a different one. For me, this reason is good enough to pick the standard one and encourage others to do the same. With XSLT, I can develop HTML widgets and include them in different contexts in different applications -- provided those apps support the standard. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] OO parent/child relationship
Im trying to create some dummy code where child classes can talk to each other. Im looking to verify some behaviour Im running into. When a child extends a parent, from that point on, the parent, has no idea, on what the child is capable of, or what it contains. Is that a real parent??? ;) With this script Im getting - Fatal error: Call to undefined function: execute() in /files/www/data/misc/mpn2/index.php on line 47* *-- ?php $foo = new base; $foo-displayPage(); class base { var $var; function base() { $this-var['db'] = new db; $this-var['tpl'] = new smarty; } function displayPage() { return $this-var['tpl']-display(); } } // middle man class mm { } // child class class db extends mm { var $db = 'database'; function execute() { return 'execute'; } } // child class class smarty extends mm { var $smarty = 'smarty'; function display() { // By the time we are here, both smarty and db are children of mm // Is it normal for mm to not know what the children are capable of??? var_dump(parent::execute()); return 'display'; } } ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] OO parent/child relationship
* Thus wrote Gerard Samuel ([EMAIL PROTECTED]): Im trying to create some dummy code where child classes can talk to each other. Im looking to verify some behaviour Im running into. When a child extends a parent, from that point on, the parent, has no idea, on what the child is capable of, or what it contains. Is that a real parent??? ;) Yep. It wouldn't be good if it did either. Curt -- List Stats: http://zirzow.dyndns.org/html/mlists/php_general/ I used to think I was indecisive, but now I'm not so sure. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] OO parent/child relationship
Im looking to verify some behaviour Im running into. When a child extends a parent, from that point on, the parent, has no idea, on what the child is capable of, or what it contains. Is that a real parent??? ;) No but if you really wanted to you could create a framework for parents to talk to (and discipline if need be) their children. -Dan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
php-general Digest 5 Oct 2003 16:35:09 -0000 Issue 2337
php-general Digest 5 Oct 2003 16:35:09 - Issue 2337 Topics (messages 165079 through 165091): Re: Attempt at putting greedy htmlspecialchars on a diet 165079 by: Gerard Samuel stripping comments 165080 by: zzz 165081 by: Eugene Lee 165082 by: Marek Kilimajer 165083 by: zzz php5 and possible oop features/questions 165084 by: Tit \Black\ Petric 165085 by: Devish Re: XML Application Objects 165086 by: Terence 165087 by: Terence 165088 by: Terence OO parent/child relationship 165089 by: Gerard Samuel 165090 by: Curt Zirzow 165091 by: Dan Anderson Administrivia: To subscribe to the digest, e-mail: [EMAIL PROTECTED] To unsubscribe from the digest, e-mail: [EMAIL PROTECTED] To post to the list, e-mail: [EMAIL PROTECTED] -- ---BeginMessage--- Curt Zirzow wrote: That is an html entity and is not how it is stored. How that entity gets displayed depends entirely on what encoding you have set for the page. The japanese characters (charset ISO-2022-JP) to use to display the phrase for 'Contents' is: ^[$B$3$s$F$s$D^[(B (^[ == escape character) I can store those exact characters (with the proper escape character) in a database without a problem Then I haven't a clue as to why its stored that way, or its just the way the command line displays the content. Using postgresql on a database setup for unicode storage, Im getting - test=# select topic_title from forum_topics order by topic_time desc limit 1 offset 4; topic_title --- testing japanese #31038;#20250;#12491;#12517;#12540;#12473; (1 row) I read your other post, Ill see whats possible with |get_html_translation_table| ---End Message--- ---BeginMessage--- I'm trying to strip comments out of my code. I can get it to strip one section of comments but the problem comes in when I have more then one comment section to strip. I am using this: $code = preg_replace('/\/*(.*?)*\//is', '$1', $code) and need help fixing my regex. example: code 1 /* comment 1 */ code 2 /* comment 2 */ code 3 result (bad): = code 1 code 3 result (good): == code 1 code 2 code 3 ---End Message--- ---BeginMessage--- On Sun, Oct 05, 2003 at 04:46:16AM -0400, zzz wrote: : : I'm trying to strip comments out of my code. I can get it to strip one : section of comments but the problem comes in when I have more then one : comment section to strip. : : I am using this: $code = preg_replace('/\/*(.*?)*\//is', '$1', $code) and : need help fixing my regex. : : example: : : code 1 : /* comment 1 */ : code 2 : /* comment 2 */ : code 3 : : result (bad): : = : code 1 : code 3 : : result (good): : == : code 1 : code 2 : code 3 How about this: $code = preg_replace('|/\*.*\*/|msU', '', $code); ---End Message--- ---BeginMessage--- You will run into more problems and there are many things you need to consider, for example /* in a string. But token_get_all() will parse php code for you and will make things much simpler. zzz wrote: I'm trying to strip comments out of my code. I can get it to strip one section of comments but the problem comes in when I have more then one comment section to strip. I am using this: $code = preg_replace('/\/*(.*?)*\//is', '$1', $code) and need help fixing my regex. example: code 1 /* comment 1 */ code 2 /* comment 2 */ code 3 result (bad): = code 1 code 3 result (good): == code 1 code 2 code 3 ---End Message--- ---BeginMessage--- Hey perfect Eugene, thanks -Original Message- From: Eugene Lee [mailto:[EMAIL PROTECTED] Sent: October 5, 2003 5:14 AM To: [EMAIL PROTECTED] Subject: Re: [PHP] stripping comments On Sun, Oct 05, 2003 at 04:46:16AM -0400, zzz wrote: : : I'm trying to strip comments out of my code. I can get it to strip one : section of comments but the problem comes in when I have more then one : comment section to strip. : : I am using this: $code = preg_replace('/\/*(.*?)*\//is', '$1', $code) and : need help fixing my regex. : : example: : : code 1 : /* comment 1 */ : code 2 : /* comment 2 */ : code 3 : : result (bad): : = : code 1 : code 3 : : result (good): : == : code 1 : code 2 : code 3 How about this: $code = preg_replace('|/\*.*\*/|msU', '', $code); -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php ---End Message--- ---BeginMessage--- will something in the likes of this be possible in php5? /***/ class some_classname { function some_function(); } function some_classname::some_function($prefix, $text) { return $prefix.: .$text.\n; } $test = new some_classname; $test-some_function(Output,Hello World!);
[PHP] image upload
Hi I need to upload two resized images out from one jpg image. I use following code to do it: ?php $nw=100; //The Width Of The Thumbnails //$rn=400 $ipath = ./pics; //Path To Place Where Images Are Uploaded. $tpath = ./thumbs;//Path To Place Where Thumbnails Are Uploaded function LoadJpeg ($imgname) { $im = @imagecreatefromjpeg ($imgname); /* Attempt to open */ if (!$im) { /* See if it failed */ $im = imagecreate (150, 30); /* Create a blank image */ $bgc = imagecolorallocate ($im, 255, 255, 255); $tc = imagecolorallocate ($im, 0, 0, 0); imagefilledrectangle ($im, 0, 0, 150, 30, $bgc); /* Output an errmsg */ imagestring ($im, 1, 5, 5, Error loading $imgname, $tc); } return $im; } $dimensions = getimagesize($file); $thname = $tpath/$file_name; //$rname = $ipath/$file_name; $w=$dimensions[0]; $h=$dimensions[1]; $c=$nw/$w; //$c2=$rw/w; $nh=$h*$c; //The Height Of The Thumbnails //$rh=$h*$c2; //The Height Of The Large Pictures $img = LoadJpeg($file); //$img2 = LoadJpeg($file); $thumb = imagecreatetruecolor($nw,$nh); //$large = imagecreatetruecolor($rw,$rh); imagecopyresampled($thumb,$img,0,0,0,0,$nw,$nh,$w,$h); // imagecopyresampled($large,$img2,0,0,0,0,$rw,$rh,$w,$h); imagejpeg($thumb,$thname,95); // imagejpeg($large,$rname,95); imagedestroy($img2); ? This code is working perfectly but produces only one uploaded and resized image (I comented out the lines that I add for second image) If I take out comments from the code on the second image - this script doesn't work - it produces two files on the server but only one of them is working the other one shows error of wrong hedding. How should I upload two resized files? I know it's possible but how can I fit everything in one portion of code? Yury -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] OO parent/child relationship
Dan Anderson wrote: Im looking to verify some behaviour Im running into. When a child extends a parent, from that point on, the parent, has no idea, on what the child is capable of, or what it contains. Is that a real parent??? ;) No but if you really wanted to you could create a framework for parents to talk to (and discipline if need be) their children. Thanks for your reply. Yes, Im trying to formulate a solution to work more effeciently with classes. Im in the dark concerning frameworks, but I did come up with something that would work the other day. If you don't mind, I would like some comments on my wire work. http://marc.theaimsgroup.com/?l=php-generalm=106528530324596w=2 Thanks for any comments that you may provide. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] OO parent/child relationship
Out of curiousity, what exactly are you trying to do? Are you sure this type of framework is most appropriate (and easiest to implement?) -Dan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] OO parent/child relationship
Dan Anderson wrote: Out of curiousity, what exactly are you trying to do? Are you sure this type of framework is most appropriate (and easiest to implement?) In my current setup, the more classes Im adding to the code, the more complex things seem to get. For example. I have a smarty object that has a reference to a DB object. I plan on converting a file of user management functions to a class. If I do, then that new class, is going to need a reference to the DB object. Then on top of that, the smarty object is going to need a reference to the user management object. By the time we are here, the smarty object contains a reference to the DB object, *and* a reference to the user management object which contains a reference to the DB object. And thats just the beginning. There are other classes that intertwine in this manner. So what I would I forsee as a better playing ground would be 1. child classes being capable of talking to each other For example, the smarty class capable of calling the DB class and the user management class without the need for all those redundant *large* references. 2. The parent class capable of talking to the child classes. In this context, parent and child is not to be thought of as in normal class structures where children *extends* parents. All the *parent* class is, a means to provide wrappers around other *child* classes, and act as a controller. The *child* methods/variables, aren't/shouldn't be called directly. Also, if I can work it out, the class mm would only intially contain a constructor, and maybe a class loader. The class loader provides the additional class method wrappers on demand when needed. This is merely an first rate idea. Nothing is remotely concrete about it. Thanks for looking. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Newbie
Hi list, I have just installed PHP4.3.3-Win32. I have a book that said create a phpinfo.php ( ? phpinfo(); ? ) file and place it in my Apache 2 htdocs file. I did this and when I run it opens in a blank page of DreamweaverMX. I tried to open with Internet Explorer and it does nothing. My question is what file would tell it to open in DWMX or how do I get to the opening set-up page of PHP. I used php4.3.3-installer.exe but I got the message that it would have to be installed manually. Any help or direction would be appreciated. John H. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Newbie
Try http://localhost/phpinfo.php apache serves http requests, you tried opening the file from filesystem. John Hicks wrote: Hi list, I have just installed PHP4.3.3-Win32. I have a book that said create a phpinfo.php ( ? phpinfo(); ? ) file and place it in my Apache 2 htdocs file. I did this and when I run it opens in a blank page of DreamweaverMX. I tried to open with Internet Explorer and it does nothing. My question is what file would tell it to open in DWMX or how do I get to the opening set-up page of PHP. I used php4.3.3-installer.exe but I got the message that it would have to be installed manually. Any help or direction would be appreciated. John H. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Newbie
Did you try to browse to it on your machine such as: http://localhost/phpinfo.php This is what they're referring to. PHP doesn't interpret pages when you just double-click on them since they're not being run through the web server (Apache) which will trigger PHP to parse the file. -M -Original Message- From: John Hicks [mailto:[EMAIL PROTECTED] Sent: Sunday, October 05, 2003 1:29 PM To: [EMAIL PROTECTED] Subject: [PHP] Newbie Hi list, I have just installed PHP4.3.3-Win32. I have a book that said create a phpinfo.php ( ? phpinfo(); ? ) file and place it in my Apache 2 htdocs file. I did this and when I run it opens in a blank page of DreamweaverMX. I tried to open with Internet Explorer and it does nothing. My question is what file would tell it to open in DWMX or how do I get to the opening set-up page of PHP. I used php4.3.3-installer.exe but I got the message that it would have to be installed manually. Any help or direction would be appreciated. John H. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Newbie
The file should be saved in the webserver root.you didn't mention whether or not you still have IIS installed, but if you do, you need to uninstall it. You cant run both apache and IIS on the same port. Regard Dreamweaver.you can open in DW and use the Open With option for IE...unless you are previewing with DW. Shadow -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Newbie
--- John Hicks [EMAIL PROTECTED] wrote: I have just installed PHP4.3.3-Win32. I have a book that said create a phpinfo.php ( ? phpinfo(); ? ) file and place it in my Apache 2 htdocs file. So you installed both Apache and PHP? The first thing you need to do is figure out what your document root is (it is on your filesystem) and what the corresponding URL is. I did this and when I run it opens in a blank page of DreamweaverMX. Dreamweaver is an editor, right? It might have some libraries that make it perform some Web browser rendering and such, but it is much better to test in a real Web browser (not IE). I tried to open with Internet Explorer and it does nothing. View source. Do you see your code? If so, you need to configure Apache to parse PHP files. Hope that helps. Chris = My Blog http://shiflett.org/ HTTP Developer's Handbook http://httphandbook.org/ RAMP Training Courses http://www.nyphp.org/ramp -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] NEW: XML Application Objects
On Sun, 2003-10-05 at 09:52, Terence wrote: PS. Stop teasing us and give us the link to your open-source solution. I may be able to poach some ideas for my open-source solution :) Look no further than the signature. I thought it was bulky enough, but I guess I'll need to make it bigger now ;) Cheers, Rob. -- .. | InterJinn Application Framework - http://www.interjinn.com | :: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] $_ENV not working for me with PHP 4.2.0
I've been trying to make a simple script which just outputs the username that the script is currently executing under (in order to test that suexec is working properly). I've tried using the following line: ?php print $_ENV['USER']; ? and it fails to produce any output and returns the following error in my log file: [Sun Oct 5 14:02:35 2003] [error] PHP Notice: Undefined index: USER in /home/test/test.php on line 1 Now, I've tried the same command on another server running PHP 4.2.0 and it correctly outputs the username as expected. Both these machines are running Debian Linux. Now I figure it must be some configuration setting that is messing this up somehow, but I have no idea where to look. I've checked out the documentation and it states that PHP versions later than 4.2.0 use the $_ENV global variable to access environment variables, so it seems like I'm using it correctly. Anyways, if anyone has any suggestions, please let me know! Thanks in advance, John Wilcox __ Do you Yahoo!? The New Yahoo! Shopping - with improved product search http://shopping.yahoo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Apache API support?
PHP is most commonly run as an Apache API, though it can still be done as CGI. Edward Dudlik Becoming Digital www.becomingdigital.com - Original Message - From: [ASDF] Jeremy [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Saturday, 04 October, 2003 04:59 Subject: [PHP] Apache API support? Hi All, I've been thinking of developing an Apache module to ease my job, but I don't have a clue of C. I know that mod_perl and mod_tcl provides module programming support for Apache, are there any implementations of PHP in programming Apache modules? Thanks - Jeremy -- 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] OO parent/child relationship
What I would do is pass the handles to the objects in the class constructor by reference. For example create one db object similar to this: class database { ... } $db = new database(); and then pass the reference to all other classes like this: class smarty { var $db; function smarty($db) { $this-db = $db; } } This way you don't have the wasted memory of duplicate class instances. Of course PHP5 will make this easier as it passes objects by reference by default. Jeremy On Sun, 2003-10-05 at 12:20, Gerard Samuel wrote: Dan Anderson wrote: Out of curiousity, what exactly are you trying to do? Are you sure this type of framework is most appropriate (and easiest to implement?) In my current setup, the more classes Im adding to the code, the more complex things seem to get. For example. I have a smarty object that has a reference to a DB object. I plan on converting a file of user management functions to a class. If I do, then that new class, is going to need a reference to the DB object. Then on top of that, the smarty object is going to need a reference to the user management object. By the time we are here, the smarty object contains a reference to the DB object, *and* a reference to the user management object which contains a reference to the DB object. And thats just the beginning. There are other classes that intertwine in this manner. So what I would I forsee as a better playing ground would be 1. child classes being capable of talking to each other For example, the smarty class capable of calling the DB class and the user management class without the need for all those redundant *large* references. 2. The parent class capable of talking to the child classes. In this context, parent and child is not to be thought of as in normal class structures where children *extends* parents. All the *parent* class is, a means to provide wrappers around other *child* classes, and act as a controller. The *child* methods/variables, aren't/shouldn't be called directly. Also, if I can work it out, the class mm would only intially contain a constructor, and maybe a class loader. The class loader provides the additional class method wrappers on demand when needed. This is merely an first rate idea. Nothing is remotely concrete about it. Thanks for looking. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] DATE Question
Hi, is there a function in PHP that will work out the amount of time(hours) beween two different dates / times? Thanks for your help -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] unsuscribe
How cant i unsuscribe from this list? Thanks Como puedo darme de baja? Gracias -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] unsuscribe
On Sunday 05 October 2003 16:40, Sonia wrote: How cant i unsuscribe from this list? Thanks Como puedo darme de baja? Gracias Read the bottom of every email you get from this list. ---PHP General Mailing List (http://www.php.net/) ---To unsubscribe, visit: http://www.php.net/unsub.php Henrik -- Henrik Hudson [EMAIL PROTECTED] `If there's anything more important than my ego around, I want it caught and shot now.' --Hitchhikers Guide to the Galaxy -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] DATE Question
--- Shaun [EMAIL PROTECTED] wrote: is there a function in PHP that will work out the amount of time(hours) beween two different dates / times? You can just subtract the timestamps the find the number of seconds between any two times. PHP has a rich set of functions to help you generate timestamps if you only have a text representation (05 Oct 2003) as well as functions to help you format dates. See here for more: http://www.php.net/manual/en/ref.datetime.php One of the first user comments looks to be a function that combines a few of these other functions together to do something like you are wanting. Hope that helps. Chris = My Blog http://shiflett.org/ HTTP Developer's Handbook http://httphandbook.org/ RAMP Training Courses http://www.nyphp.org/ramp -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] OO parent/child relationship
Jeremy Johnstone wrote: What I would do is pass the handles to the objects in the class constructor by reference. For example create one db object similar to this: class database { ... } $db = new database(); and then pass the reference to all other classes like this: class smarty { var $db; function smarty($db) { $this-db = $db; } } This way you don't have the wasted memory of duplicate class instances. Of course PHP5 will make this easier as it passes objects by reference by default. This is currently how Im doing things. And this is what Im trying to get away from. In addition to passing smarty the $db object by reference, Im going to be passing the user management object to smarty by reference, which in turn has a copied reference to the $db object. So in the end the smarty object is going to have 2 references to the $db object. That is what I want to get away from... $smarty - $db (by reference) $smarty - $user_management (by reference) - $db (by reference) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] attach file with mail() function??
Is there a way to attach a file with the mail() function? Thanks!
Re: [PHP] attach file with mail() function??
On Monday 06 October 2003 07:34, Roy W wrote: Is there a way to attach a file with the mail() function? Yes. -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-general -- /* According to Kentucky state law, every person must take a bath at least once a year. */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] OO parent/child relationship
I would have to see your code, but maybe you don't need to be passing the references your doing. Why does your Smarty class need to access the database? Why does your Smarty class need a reference to the user management class inside it? Personally, I see your user class being the only one which needs to access either one. Your user class should have am instance of both because your user class should be what pulls the data from the database, and then pushes it to the Smarty class for display. Maybe I am way off here, but essentially that is how it should be done IMHO. Jeremy On Sun, 2003-10-05 at 17:57, Gerard Samuel wrote: Jeremy Johnstone wrote: What I would do is pass the handles to the objects in the class constructor by reference. For example create one db object similar to this: class database { ... } $db = new database(); and then pass the reference to all other classes like this: class smarty { var $db; function smarty($db) { $this-db = $db; } } This way you don't have the wasted memory of duplicate class instances. Of course PHP5 will make this easier as it passes objects by reference by default. This is currently how Im doing things. And this is what Im trying to get away from. In addition to passing smarty the $db object by reference, Im going to be passing the user management object to smarty by reference, which in turn has a copied reference to the $db object. So in the end the smarty object is going to have 2 references to the $db object. That is what I want to get away from... $smarty - $db (by reference) $smarty - $user_management (by reference) - $db (by reference) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] OO parent/child relationship
Jeremy Johnstone wrote: I would have to see your code That can be arranged. Ill email you offlist. , but maybe you don't need to be passing the references your doing. Why does your Smarty class need to access the database? Why does your Smarty class need a reference to the user management class inside it? Currently the templates dictate, how a page is laid out. So I made a smarty plugin for that, which need access to the database, and user management to determine who gets what. Personally, I see your user class being the only one which needs to access either one. Your user class should have am instance of both because your user class should be what pulls the data from the database, and then pushes it to the Smarty class for display. Maybe I am way off here, but essentially that is how it should be done IMHO. A redesign is probably in order. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] image upload
On Monday 06 October 2003 00:32, Yury B. wrote: Hi I need to upload two resized images out from one jpg image. I use following code to do it: [snip] This code is working perfectly but produces only one uploaded and resized image (I comented out the lines that I add for second image) If I take out comments from the code on the second image - this script doesn't work - it produces two files on the server but only one of them is working the other one shows error of wrong hedding. How should I upload two resized files? I know it's possible but how can I fit everything in one portion of code? Check the values of all your variables -- in particular $rw, as it doesn't seem to be initialised. -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-general -- /* One thing about the past. It's likely to last. -- Ogden Nash */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP session URL rewriting
I'm having trouble getting PHP's built-in session management to rewrite my a href= tags to include the session ID across pages when cookies are disabled. Unfortunately, PHP seems to only add the PHPSESSID to a link if the page ends in .php, not .html. I've preferred to hide my .php extensions and simply have Apache execute all files ending in .html (traffic isn't too heavy on this site). How can I force PHP to pass the session ID to all URLs, even ones that don't end in .php? Thanks for any help or references anyone can provide! Scott Teresi -- [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] attach file with mail() function??
Jason Wong wrote: On Monday 06 October 2003 07:34, Roy W wrote: Is there a way to attach a file with the mail() function? Yes. Is there a way to have PHP print out Hello World? -- By-Tor.com It's all about the Rush http://www.by-tor.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] attach file with mail() function??
Jason Wong wrote: On Monday 06 October 2003 07:34, Roy W wrote: Is there a way to attach a file with the mail() function? Yes. Is there a way to have PHP print out Hello World? Mr Wong has had his panties in a bunch all day, you may not want to bait him. Mike -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP session URL rewriting
I'm running PHP 4.3.2 on Mac OS X 10.2.8, with .html files parsed by PHP (specified with a local .htaccess file), and everything seems to be working fine here (.html URLs are re-written by PHP). My advice would be to delete all your cookies, clear your cache, restart your browser with cookies disabled, and THEN do some testing :) If it's still not working for your set-up, I guess you need to find out if the re-write code was changed between your version and mine, or perhaps something else? Justin On Monday, October 6, 2003, at 11:26 AM, Scott Teresi wrote: I'm having trouble getting PHP's built-in session management to rewrite my a href= tags to include the session ID across pages when cookies are disabled. Unfortunately, PHP seems to only add the PHPSESSID to a link if the page ends in .php, not .html. I've preferred to hide my .php extensions and simply have Apache execute all files ending in .html (traffic isn't too heavy on this site). How can I force PHP to pass the session ID to all URLs, even ones that don't end in .php? Thanks for any help or references anyone can provide! Scott Teresi -- [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php --- [This E-mail scanned for viruses] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] attach file with mail() function??
On Monday 06 October 2003 08:28, [EMAIL PROTECTED] wrote: Jason Wong wrote: On Monday 06 October 2003 07:34, Roy W wrote: Is there a way to attach a file with the mail() function? Yes. Is there a way to have PHP print out Hello World? Mr Wong has had his panties in a bunch all day, you may not want to bait him. Please, grow up. -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-general -- /* This novel is not to be tossed lightly aside, but to be hurled with great force. -- Dorothy Parker */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re[2]: [PHP] OO parent/child relationship
Hi, Monday, October 6, 2003, 3:20:08 AM, you wrote: GS Dan Anderson wrote: Out of curiousity, what exactly are you trying to do? Are you sure this type of framework is most appropriate (and easiest to implement?) GS In my current setup, the more classes Im adding to the code, the more GS complex things seem to get. GS For example. GS I have a smarty object that has a reference to a DB object. GS I plan on converting a file of user management functions to a class. GS If I do, then that new class, is going to need a reference to the DB object. GS Then on top of that, the smarty object is going to need a reference to GS the user management object. GS By the time we are here, the smarty object contains a reference to the GS DB object, *and* GS a reference to the user management object which contains a reference to GS the DB object. GS And thats just the beginning. There are other classes that intertwine GS in this manner. GS So what I would I forsee as a better playing ground would be GS 1. child classes being capable of talking to each other GS For example, the smarty class capable of calling the DB class and the GS user management class GS without the need for all those redundant *large* references. GS 2. The parent class capable of talking to the child classes. GS In this context, parent and child is not to be thought of as in normal GS class structures where children *extends* parents. GS All the *parent* class is, a means to provide wrappers around other GS *child* classes, GS and act as a controller. The *child* methods/variables, GS aren't/shouldn't be called directly. GS Also, if I can work it out, the class mm would only intially contain a GS constructor, and maybe a GS class loader. GS The class loader provides the additional class method wrappers on demand GS when needed. GS This is merely an first rate idea. Nothing is remotely concrete about it. GS Thanks for looking. To do this I have my classes register themselves in a global array. For example a mysql class which gets used a lot does this in its constructor: function mysql_class($db='',$ini=''){ global $class_ref; $class_ref[mysql_class] = $this; . . . } Then any class that needs access to mysql_class does this in the constructor: class galleryClass( var $mysql; var $db = 'test'; function galleryClass(){ global $class_ref; if(!empty($class_ref['mysql_class'])): $this-mysql = $class_ref['mysql_class']; else: $this-mysql = new mysql_class(); endif; if(!empty($this-mysql)): $this-con = $this-mysql-get_handle($this-db); endif; . . } . . } This way there is only need for 1 instance of the mysql class. I use global as a bad habit, but you can do the same with $GLOBALS['class_ref'] -- regards, Tom -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] $_ENV not working for me with PHP 4.2.0
Hi, Monday, October 6, 2003, 4:43:20 AM, you wrote: JW I've been trying to make a simple script which just JW outputs the username that the script is currently JW executing under (in order to test that suexec is JW working properly). I've tried using the following JW line: JW ?php print $_ENV['USER']; ? JW and it fails to produce any output and returns the JW following error in my log file: [Sun Oct 5 14:02:35 JW 2003] [error] PHP Notice: Undefined index: USER in JW /home/test/test.php on line 1 JW Now, I've tried the same command on another server JW running PHP 4.2.0 and it correctly outputs the JW username as expected. Both these machines are running JW Debian Linux. JW Now I figure it must be some configuration setting JW that is messing this up somehow, but I have no idea JW where to look. I've checked out the documentation and JW it states that PHP versions later than 4.2.0 use the JW $_ENV global variable to access environment variables, JW so it seems like I'm using it correctly. Anyways, if JW anyone has any suggestions, please let me know! JW Thanks in advance, JW John Wilcox JW __ JW Do you Yahoo!? JW The New Yahoo! Shopping - with improved product search JW http://shopping.yahoo.com Do this to see what is available in your enviroment, it would seem that USER is not being set by the system or is called something else. echo `printenv`; (use backticks) -- regards, Tom -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] attach file with mail() function??
[EMAIL PROTECTED] wrote: Jason Wong wrote: On Monday 06 October 2003 07:34, Roy W wrote: Is there a way to attach a file with the mail() function? Yes. Is there a way to have PHP print out Hello World? Mr Wong has had his panties in a bunch all day, you may not want to bait him. Mike Actually, I think Jason is as just tired of seeing the same, already answered, questions over and over again...like alot of us are. I think he's tired of people who won't take one bit of their time to look up answers for themselves, but expect us to hold their hand and waste our timelike alot of us are. Sure, the purpose of this list is to help, but it's not here to babysit. -- By-Tor.com It's all about the Rush http://www.by-tor.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP session URL rewriting
* Thus wrote Justin French ([EMAIL PROTECTED]): I'm running PHP 4.3.2 on Mac OS X 10.2.8, with .html files parsed by PHP (specified with a local .htaccess file), and everything seems to be working fine here (.html URLs are re-written by PHP). My advice would be to delete all your cookies, clear your cache, restart your browser with cookies disabled, and THEN do some testing :) also... PHP will not put a session id at the end of any absolute uri/url: href=http://somedomain.com/; href=/ Will not have the session automatically added (for security purposes). If you want a sessionid at the end of those you must explictly tell php that you want it there: href=/?php echo SID? Curt -- List Stats: http://zirzow.dyndns.org/html/mlists/php_general/ I used to think I was indecisive, but now I'm not so sure. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] OO parent/child relationship
Tom Rogers wrote: To do this I have my classes register themselves in a global array. For example a mysql class which gets used a lot does this in its constructor: function mysql_class($db='',$ini=''){ global $class_ref; $class_ref[mysql_class] = $this; . . . } Then any class that needs access to mysql_class does this in the constructor: class galleryClass( var $mysql; var $db = 'test'; function galleryClass(){ global $class_ref; if(!empty($class_ref['mysql_class'])): $this-mysql = $class_ref['mysql_class']; else: $this-mysql = new mysql_class(); endif; if(!empty($this-mysql)): $this-con = $this-mysql-get_handle($this-db); endif; . . } . . } This way there is only need for 1 instance of the mysql class. I use global as a bad habit, but you can do the same with $GLOBALS['class_ref'] :) I asked about something similar to your suggetion the other day - http://marc.theaimsgroup.com/?l=php-generalm=106519101018470w=2 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] attach file with mail() function??
Actually, I think Jason is as just tired of seeing the same, already answered, questions over and over again...like alot of us are. I think he's tired of people who won't take one bit of their time to look up answers for themselves, but expect us to hold their hand and waste our timelike alot of us are. Sure, the purpose of this list is to help, but it's not here to babysit. Then he doesn't have to respond. If he's not interested in a thread, he should delete it. Tossing a useless one word answer onto the list isn't helping to reduce the volume of email in everyones inbox. So far today I've had probably close to 15 OT emails from several threads land on my machine, none of them useful (including this one) none of them relating to PHP (including this one) and all of them avoidable (including this one) if he had just hit delete rather than send. Mike -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re[2]: [PHP] OO parent/child relationship
Hi, Well I must have missed that one :) My answer, if GLOBALS were not meant to be used they wouldn't be there.. So if they make life easier go ahead and use them. I notice a lot of 'purists' on this list that want things done a certain way but the bottom line is do what your comfortable with and works for you. Of course you have to keep security issues under control as well, it would be no good doing this if you run with register globals set to on as the array could very easily be trashed. -- regards, Tom -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] attach file with mail() function??
Then he doesn't have to respond. If he's not interested in a thread, he should delete it. Tossing a useless one word answer onto the list isn't helping to reduce the volume of email in everyones inbox. So far today I've had probably close to 15 OT emails from several threads land on my machine, none of them useful (including this one) none of them relating to PHP (including this one) and all of them avoidable (including this one) if he had just hit delete rather than send. not including this one. :-) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] attach file with mail() function??
[EMAIL PROTECTED] wrote: snip I've had probably close to 15 OT emails from several threads land on my machine, none of them useful (including this one) none of them relating to PHP (including this one) and all of them avoidable (including this one) if he had just hit delete rather than send. You could have followed that 'delete' road too man. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] $_ENV not working for me with PHP 4.2.0
* Thus wrote John Wilcox ([EMAIL PROTECTED]): I've been trying to make a simple script which just outputs the username that the script is currently executing under (in order to test that suexec is working properly). I've tried using the following line: ?php print $_ENV['USER']; ? This var isn't the USER that the process is running under, it is the USER that started apache (assuming thats your webserver). You can see all the same vars if you execute the command `env`. I also tested this: shutting down apache setenv TEST putvarinenv started apache test.php: echo getenv('TEST'); yields: 'putvarinenv' and it fails to produce any output and returns the following error in my log file: [Sun Oct 5 14:02:35 2003] [error] PHP Notice: Undefined index: USER in /home/test/test.php on line 1 Now, I've tried the same command on another server running PHP 4.2.0 and it correctly outputs the username as expected. Both these machines are running Debian Linux. if the username was expected, I'm guessing your output was root, you should really change the webserver process to something other than root (an unprivlaged user). Now I figure it must be some configuration setting that is messing this up somehow, but I have no idea where to look. I've checked out the documentation and it states that PHP versions later than 4.2.0 use the $_ENV global variable to access environment variables, so it seems like I'm using it correctly. Anyways, if anyone has any suggestions, please let me know! Thanks in advance, Technically it is 4.1.0 (where did you see the 4.2.0?) but anything prior to that you should use $HTTP_ENV_VARS http://php.net/manual/en/language.variables.predefined.php http://php.net/manual/en/reserved.variables.php A diff of your php.ini will tell the story I'll bet a diff output would be something like: 306c306 variables_order = GPCS --- variables_order = EGPCS To get the user that apache is really running as you want to do something like: print `whoami`; Curt -- List Stats: http://zirzow.dyndns.org/html/mlists/php_general/ I used to think I was indecisive, but now I'm not so sure. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] attach file with mail() function??
On Sun, Oct 05, 2003 at 09:58:55PM -0500, John Nichel wrote: : [EMAIL PROTECTED] wrote: : Jason Wong wrote: : On Monday 06 October 2003 07:34, Roy W wrote: : : Is there a way to attach a file with the mail() function? : : Yes. : : Is there a way to have PHP print out Hello World? : : Mr Wong has had his panties in a bunch all day, you may not want to : bait him. : : Actually, I think Jason is as just tired of seeing the same, already : answered, questions over and over again...like alot of us are. I think : he's tired of people who won't take one bit of their time to look up : answers for themselves, but expect us to hold their hand and waste our : timelike alot of us are. Sure, the purpose of this list is to help, : but it's not here to babysit. Maybe responders should take a slightly tougher attitude and make some less reasonable demands like requesting the original poster to read the online manual: http://www.php.net/manual/en/ the FAQ: http://www.php.net/FAQ.php the list archives: http://marc.theaimsgroup.com/?l=php-general or even some other links: http://www.php.net/links.php Or there be a FAQ specifically for this list? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: Re[2]: [PHP] OO parent/child relationship
On Sun, 2003-10-05 at 23:37, Tom Rogers wrote: Hi, Well I must have missed that one :) My answer, if GLOBALS were not meant to be used they wouldn't be there.. So if they make life easier go ahead and use them. I notice a lot of 'purists' on this list that want things done a certain way but the bottom line is do what your comfortable with and works for you. Of course you have to keep security issues under control as well, it would be no good doing this if you run with register globals set to on as the array could very easily be trashed. All fine and dandy till you decide to use some other class or library that just happened to use the same global names you've used. Then you have a mess :) But sure, if that's not an issue, go ahead and globalize everything. Cheers, Rob. -- .. | InterJinn Application Framework - http://www.interjinn.com | :: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] attach file with mail() function??
* Thus wrote [EMAIL PROTECTED] ([EMAIL PROTECTED]): Actually, I think Jason is as just tired of seeing the same, already answered, questions over and over again...like alot of us are. I think he's tired of people who won't take one bit of their time to look up answers for themselves, but expect us to hold their hand and waste our timelike alot of us are. Sure, the purpose of this list is to help, but it's not here to babysit. Then he doesn't have to respond. If he's not interested in a thread, he should delete it. Tossing a useless one word answer onto the list isn't helping to reduce the volume of email in everyones inbox. So far today I've had probably close to 15 OT emails from several threads land on my machine, none of them useful (including this one) none of them relating to PHP (including this one) and all of them avoidable (including this one) if he had just hit delete rather than send. If it bothers you that much, follow the instructions on the last line of this email. The only person who started this topic, 'Off Topic' was you. And I must say in bad taste. Then you complain about OT posts while being OT yourself. Perhaps you should stick with your own advice and just delete it, instead of wasting my time writing this email. That being said, I think i'll have this thread grow way off topic, and self promote my site. Now we can visually see how often somone helps people with the list: http://zirzow.dyndns.org/html/mlists/php_general/search?q=gremlin vs. http://zirzow.dyndns.org/html/mlists/php_general/search?q=mike%40array-media Now I really have to write that flame awarness patch :) Posts: 4 Flames: 3 Curt -- I used to think I was indecisive, but now I'm not so sure. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] attach file with mail() function??
* Thus wrote Eugene Lee ([EMAIL PROTECTED]): On Sun, Oct 05, 2003 at 09:58:55PM -0500, John Nichel wrote: : [EMAIL PROTECTED] wrote: : Jason Wong wrote: : On Monday 06 October 2003 07:34, Roy W wrote: : : Is there a way to attach a file with the mail() function? : : Yes. : : Is there a way to have PHP print out Hello World? : : Mr Wong has had his panties in a bunch all day, you may not want to : bait him. : : Actually, I think Jason is as just tired of seeing the same, already : answered, questions over and over again...like alot of us are. I think : he's tired of people who won't take one bit of their time to look up : answers for themselves, but expect us to hold their hand and waste our : timelike alot of us are. Sure, the purpose of this list is to help, : but it's not here to babysit. Maybe responders should take a slightly tougher attitude and make some less reasonable demands like requesting the original poster to read the online manual: http://www.php.net/manual/en/ These threads always go in circles :) this topic has been discussed before: http://marc.theaimsgroup.com/?l=php-general I believe that last one was started from Mr. Holmes, doing the very exact thing :) And I find it perfectly acceptable for people like John and Jason to occasionally post responses like that. In fact I found his response rather funny and enlightened my day a bit. Curt -- List Stats: http://zirzow.dyndns.org/html/mlists/php_general/ I used to think I was indecisive, but now I'm not so sure. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] OO parent/child relationship
* Thus wrote Tom Rogers ([EMAIL PROTECTED]): Hi, Monday, October 6, 2003, 3:20:08 AM, you wrote: To do this I have my classes register themselves in a global array. For example a mysql class which gets used a lot does this in its constructor: function mysql_class($db='',$ini=''){ global $class_ref; $class_ref[mysql_class] = $this; . . . } Then any class that needs access to mysql_class does this in the constructor: class galleryClass( var $mysql; var $db = 'test'; function galleryClass(){ global $class_ref; if(!empty($class_ref['mysql_class'])): $this-mysql = $class_ref['mysql_class']; else: $this-mysql = new mysql_class(); endif; if(!empty($this-mysql)): $this-con = $this-mysql-get_handle($this-db); endif; . . } . . } On the global topic, I would suggest establishing a standard naming convention for your common globals that are used, I do something like: $__object_something__; With your global var I can see myself writing something that will overwrite that $class_ref, Like say if I'm handling something that has to do with referee's in school classes :) Preceeding the global vars with '__' or something will keep the namespace clashing cases down to a minimum. Curt -- List Stats: http://zirzow.dyndns.org/html/mlists/php_general/ I used to think I was indecisive, but now I'm not so sure. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] attach file with mail() function??
On Mon, 6 Oct 2003 04:26:55 + Curt Zirzow [EMAIL PROTECTED] wrote: That being said, I think i'll have this thread grow way off topic, and self promote my site. Now we can visually see how often somone helps people with the list: http://zirzow.dyndns.org/html/mlists/php_general/search?q=gremlin vs. http://zirzow.dyndns.org/html/mlists/php_general/search?q=mike%40array-media Now I really have to write that flame awarness patch :) Posts: 4 Flames: 3 I was going to suggest, since you are into list statistics, to count how many of Mr Wang's replies consist of something more then a reference to the manual and similar (I counted over 50% in a day I had time to kill). It would be also interesting to keep track of how many hours some members spend with the list each day (and night). Talking about what people do with their time (and life). Just curious... Curt -- I used to think I was indecisive, but now I'm not so sure. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Regards, Andu Novac -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] OO parent/child relationship
On Mon, 2003-10-06 at 00:48, Curt Zirzow wrote: On the global topic, I would suggest establishing a standard naming convention for your common globals that are used, I do something like: $__object_something__; With your global var I can see myself writing something that will overwrite that $class_ref, Like say if I'm handling something that has to do with referee's in school classes :) Preceeding the global vars with '__' or something will keep the namespace clashing cases down to a minimum. But if everyone fallows your advice for using __ as a prefix... *grin*. Rob. -- .. | InterJinn Application Framework - http://www.interjinn.com | :: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] attach file with mail() function??
On Monday 06 October 2003 12:42, andu wrote: I was going to suggest, since you are into list statistics, to count how many of Mr Wang's replies consist of something more then a reference to the manual and similar (I counted over 50% in a day I had time to kill). If you are referring to me, the name is Wong, thank you. Maybe you should read this: http://marc.theaimsgroup.com/?l=php-generalm=106497838012812w=2 -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-general -- /* When a woman gives me a present I have always two surprises: first is the present, and afterward, having to pay for it. -- Donnay */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] $_ENV not working for me with PHP 4.2.0
Hi Tom, when I put echo `printenv`; into a script, I see in big bold letters: USER=john so this environment variable seems to be available.. getenv('USER'); works fine, so I guess I'll just use that instead.. No idea why $_ENV['USER']; doesn't work though. Thanks for the suggestion, John --- Tom Rogers [EMAIL PROTECTED] wrote: Hi, Monday, October 6, 2003, 4:43:20 AM, you wrote: JW I've been trying to make a simple script which just JW outputs the username that the script is currently JW executing under (in order to test that suexec is JW working properly). I've tried using the following JW line: JW ?php print $_ENV['USER']; ? JW and it fails to produce any output and returns the JW following error in my log file: [Sun Oct 5 14:02:35 JW 2003] [error] PHP Notice: Undefined index: USER in JW /home/test/test.php on line 1 JW Now, I've tried the same command on another server JW running PHP 4.2.0 and it correctly outputs the JW username as expected. Both these machines are running JW Debian Linux. JW Now I figure it must be some configuration setting JW that is messing this up somehow, but I have no idea JW where to look. I've checked out the documentation and JW it states that PHP versions later than 4.2.0 use the JW $_ENV global variable to access environment variables, JW so it seems like I'm using it correctly. Anyways, if JW anyone has any suggestions, please let me know! JW Thanks in advance, JW John Wilcox JW __ JW Do you Yahoo!? JW The New Yahoo! Shopping - with improved product search JW http://shopping.yahoo.com Do this to see what is available in your enviroment, it would seem that USER is not being set by the system or is called something else. echo `printenv`; (use backticks) -- regards, Tom -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php __ Do you Yahoo!? The New Yahoo! Shopping - with improved product search http://shopping.yahoo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] attach file with mail() function??
On Mon, 6 Oct 2003 13:07:36 +0800 Jason Wong [EMAIL PROTECTED] wrote: On Monday 06 October 2003 12:42, andu wrote: I was going to suggest, since you are into list statistics, to count how many of Mr Wang's replies consist of something more then a reference to the manual and similar (I counted over 50% in a day I had time to kill). If you are referring to me, the name is Wong, thank you. Yes, sorry about the typo, you're welcome. Maybe you should read this: http://marc.theaimsgroup.com/?l=php-generalm=106497838012812w=2 -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-general -- /* When a woman gives me a present I have always two surprises: first is the present, and afterward, having to pay for it. -- Donnay */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Andu -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] stripping comments
On Sun, 5 Oct 2003 04:46:16 -0400, you wrote: I'm trying to strip comments out of my code. I can get it to strip one section of comments but the problem comes in when I have more then one comment section to strip. I am using this: $code = preg_replace('/\/*(.*?)*\//is', '$1', $code) and need help fixing my regex. As someone already mentioned, regexes aren't the right tool for this job. Consider: echo (/*); /* test */ And while that's unlikely in real code it is /possible/, and doing it the right way is so easy due to the tokenizer functions (http://www.php.net/manual/en/ref.tokenizer.php) that it would be foolish not to. The following script prints out it's own source code, sans comments (I use something like this to replace tabs with spaces). It's adapted from a fragment in the manual. It removes /* comments */, !-- comments -- and // comments ?php $incoming = file_get_contents ($PATH_TRANSLATED); echo (strip_comments ($incoming)); function strip_comments ($in) { $out = ''; $tokens = token_get_all ($in); foreach ($tokens as $token) { if (is_string ($token)) { $out .= $token; } else { list ($id, $text) = $token; switch ($id) { case T_INLINE_HTML : $out .= preg_replace ('/!--(.|\s)*?--/', '', $text); break; case T_COMMENT : case T_ML_COMMENT : break; default : $out .= $text; break; } } } return ($out); } ? I'm reasonably certain I can get away with using a regex to strip HTML comments because SGML/XML are stricter on the placing of angle brackets. If anyone can come up with a case that breaks the regex I'll take a shot at an XSLT-based fix. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php