php-general Digest 24 Nov 2005 06:58:48 -0000 Issue 3812
php-general Digest 24 Nov 2005 06:58:48 - Issue 3812 Topics (messages 226375 through 226397): Re: Is there an alternative for $_FILES['guildimage']['type'] == image/jpeg 226375 by: Ben 226377 by: Stephen Leaf Re: Is there an alternative for $_FILES['guildimage']['type'] 226376 by: eric van blokland Re: Assistance debugging php 5.x.x 226378 by: Jochem Maas 226379 by: eric van blokland 226381 by: Jochem Maas 226383 by: eric van blokland preg_match_all for dummies 226380 by: Kristen G. Thorson Re: Can't execute external program 226382 by: Henry Castillo 226384 by: comex 226386 by: Henry Castillo Re: PHP and email 226385 by: Anas Mughal 226389 by: Manuel Lemos Code generators 226387 by: Danny 226397 by: Thiago Silva readfile and get_file_contents don't work 226388 by: Richard K. Miller Re: mysqli unclonable object 226390 by: Matt Monaco 226394 by: Curt Zirzow 226396 by: Matt Monaco Re: NTLM, PHP and Apache 226391 by: Manuel Lemos http protocols defining what gets sent between web server and browser 226392 by: bruce 226393 by: David Tulloh 226395 by: Curt Zirzow Administrivia: To subscribe to the digest, e-mail: [EMAIL PROTECTED] To unsubscribe from the digest, e-mail: [EMAIL PROTECTED] To post to the list, e-mail: php-general@lists.php.net -- ---BeginMessage--- Curt Zirzow wrote: You should really consider using the fileinfo extension, or mabey even http://php.net/getimagesize. The ['type'] information can't be trusted to be what it says it is. Any reason why no one is suggesting the use of mime_content_type? http://ca.php.net/mime_content_type It seems to work well for me and there's no need to trust whatever the browser claims a file is or having to worry about different browsers inconsistently describing a mime type. - Ben ---End Message--- ---BeginMessage--- I'd say because it's been depreciated. LXXVI. Mimetype Functions Introduction Warning This extension has been deprecated as the PECL extension fileinfo provides the same functionality (and more) in a much cleaner way. On Wednesday 23 November 2005 12:45 pm, Ben wrote: Curt Zirzow wrote: You should really consider using the fileinfo extension, or mabey even http://php.net/getimagesize. The ['type'] information can't be trusted to be what it says it is. Any reason why no one is suggesting the use of mime_content_type? http://ca.php.net/mime_content_type It seems to work well for me and there's no need to trust whatever the browser claims a file is or having to worry about different browsers inconsistently describing a mime type. - Ben ---End Message--- ---BeginMessage--- You could use the exif_imagetype() function http://nl2.php.net/manual/en/function.exif-imagetype.php ---End Message--- ---BeginMessage--- eric van blokland wrote: LOL @ Jochem Well I sure can't argue with that! (serious) But with or without comments, the code is broken or breaks something. I've tracked down the weird bevahiour a little further. Now I would sure like, if one of you has about 30 minutes time to look at my problem with me, using VNC and Skype If you got the spare time I would really appreciate it and as I've been unable to create some actual reproduce code, the only thing that's left is looking at the real thing. I'm still sure it's related to the way I use references, wheter it is or isn't a bug in the compiler, it sure would be nice to know this particular DON'T about references. Please let me know 1. it could be considered over-engineered 2. you seem to be reinventing the wheel (templating?) 3. you are lacking knowledge regarding php5 OO (for starters why are not you using __construct() for the ctors?) 4. YOU ARE USING REFERENCES ALL OVER THE PLACE!!! ;-) regarding no. 4, some examples: function fs_handle_object_properties($object) { // ^--- destroy it // why bother sticking the object in a 'serialize container'? // and where was the class defined in the example code??? function fs_serialize($object) { // ^--- destroy it $container=new fs_serialize_container(); $container-object=$object; // ^--- destroy it return serialize($container); } // what happens in this code when $name // is 'properties' or some other value that // is the name of pre-defined object attribute? function fs_handle_object_properties($object) { global $stdo; $changed=false; if(isset($object-properties) is_array($object-properties)) { foreach($object-properties as $name= $property) { if(isset($property-changed) $property-changed==true){
Re: [PHP] Is there a way to determine wich browser a visitor uses in php?
$_SERVER['HTTP_USER_AGENT'] contains whatever the browser passes to the server to identify itself, which may be faked by certain browsers at the discretion of the user. The two user agents you provide as an example are both extremely common. Cheers, David Grant twistednetadmin wrote: Thanks guys. That helps alot! But this: ?php print $_SERVER['HTTP_USER_AGENT']; ? Returned this using Mozilla: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.12) Gecko/20050915 Firefox/1.0.7 And this using IE: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1) Does that just mean that it's not completely accurate? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Is there a way to determine wich browser a visitor uses in php?
twistednetadmin wrote: Thanks guys. That helps alot! But this: ?php print $_SERVER['HTTP_USER_AGENT']; ? Returned this using Mozilla: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.12) Gecko/20050915 Firefox/1.0.7 And this using IE: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1) Does that just mean that it's not completely accurate? Try get_browser() http://php.net/manual/en/function.get-browser.php HTH Frank -- tradeOver | http://www.tradeover.net ready to become the King of the World? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] cms type session - how to ?
Sorry for the lack of clarity on the single page... eg : http://127.0.0.1/index.php? where the index.php holds the logic of what is displayed and by passing vars back to it's self determins what is next displayed .. hope that helps.. On 11/22/05, Richard Lynch [EMAIL PROTECTED] wrote: On Tue, November 22, 2005 3:24 am, Gregory Machin wrote: I'm looking for a how to , on creating sessions similar to those used my cms's that ref only a single page.. http://php.net/session_start ??? I don't understand what you mean by that ref only a single page and suspect not many others understand that either. -- Like Music? http://l-i-e.com/artists.htm -- Gregory Machin [EMAIL PROTECTED] [EMAIL PROTECTED] www.linuxpro.co.za www.exponent.co.za Web Hosting Solutions Scalable Linux Solutions www.iberry.info (support and admin) +27 72 524 8096
[PHP] Re: Autodeleting news when it has become yesterdays news
I have a news-script on a webpage. Or an eventscript you might call it. This lists up events thats gonna happen on a given day. ie concerts and sportsevents. To get this deleted without having to log on to the adminpage when the event is over would have been a great relief. 1. Is it just as simple as writing a query that executes and removes news with yesterdays date? - Even simpler, why don't you keep the data instead of deleting it and write a query for the homepage which only displays events whcih occur in the future? 2. And how should I set it to execute if so? If you do want to execute a regular PHP script to delete data for some reason, look into cron (*nix) or task scheduler (windows) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Decision table/business rule parser?
Hi folks As an alternative, I worked briefly on a native PHP Petri-net workflow engine with a guy called Tony Marston before we parted ways. He has written it up here: http://www.tonymarston.net/php-mysql/workflow.html I wrote to Tony a couple of months ago and he said that his workflow code might be available someday, but wasn't available currently. His ideas are published on his website, but only code snippets. The code is Tony's, so I can't help, I'm afraid. I think you'll find it's itertwined with his development framework, so I'm not sure how useful it would be as a standalone in any case. Geoff Caplan Creative Living -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Accessing Arrays in HTML
Shaun wrote: Hi, I am trying to create a form on my page. The idea is that for each project people can select whether they are allocated for scheduling, non_scheduling or both. Here is an example of my form: take the time to work out what it is that is being POSTed: echo 'pre'; var_dump( $_POST ); echo '/pre'; ... tr tdinput name=project[25][Scheduling] type=checkbox value=25td tdinput name=project[25][Non_Scheduling] type=checkbox ... '.$fields[$i].', '.$fields[$i][0].', '.$fields[$i][1].', the 2 lines above should probably something like: '.$fields[$i]['Scheduling'].', '.$fields[$i]['Non_Scheduling'].', )); ... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Accessing Arrays in HTML
Shaun, This: $values[] = $value; Does this: $values[] = array('Scheduling' = '44'); Therefore, it must be accessed like this: $values[$i]['Scheduling'] // gives '44' But not this: $values[$i][0] // index doesn't exist. Cheers, David Grant Shaun wrote: Hi, I am trying to create a form on my page. The idea is that for each project people can select whether they are allocated for scheduling, non_scheduling or both. Here is an example of my form: tr tdinput name=project[44][Scheduling] type=checkbox value=44/td tdinput name=project[44][Non_Scheduling] type=checkbox value=44td tdProject 1/td /tr tr tdinput name=project[25][Scheduling] type=checkbox value=25td tdinput name=project[25][Non_Scheduling] type=checkbox value=25/td tdProject 2/td /tr I am trying to access the arrays in the HTML as follows: if (is_array($_POST['project'])){ $fields=''; $values=''; foreach ($_POST['project'] as $project_id = $value) { $fields[] = $project_id; $values[] = $value; } $i = 0; $num_elements = count($fields); while($i $num_elements){ if(($values[$i]) != 0){ echo 'br /$i = '.$i.'br /'; print_r($fields); $query = (INSERT INTO Allocations ( User_ID, Project_ID, Scheduling, Non_Scheduling ) VALUES ( '.$user_id.', '.$fields[$i].', '.$fields[$i][0].', '.$fields[$i][1].', )); echo $query.'br /'; } $i++; } } However I can't access the 'Scheduling / 'Non_Scheduling' part. Can anyone see where I am going wrong here? Thanks for your advice -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP and email
Hi Angelo, Why not send them all in one go? If you want to reduce server load, you should perhaps adjust the 'nice'ness of the script. If you do the following: nice --adjustment=19 ./script.php Your script will run in the background and use only spare resources. Cheers, David Grant Angelo Zanetti wrote: Hi I have a dedicated server in the states. I need to send about 8000 emails (once off). There pretty small +- 5KB. so I want to write a php script and run it from the command line in the background. I was thinking of sending 50 emails then waiting 90 seconds then sending again. Or the same script gets run by cron every 90 seconds and just sends 50 emails. What do you recommend? thanks clive -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Is there a way to determine wich browser a visitor uses in php?
Dirty Code if((ereg(Nav, getenv(HTTP_USER_AGENT))) || (ereg(Gold, getenv(HTTP_USER_AGENT))) || (ereg(X11, getenv(HTTP_USER_AGENT))) || (ereg(Mozilla, getenv( HTTP_USER_AGENT))) || (ereg(Netscape, getenv(HTTP_USER_AGENT))) AND (!ereg(MSIE, getenv(HTTP_USER_AGENT $c_browser = Netscape; elseif(ereg(MSIE, getenv(HTTP_USER_AGENT))) $c_browser = MSIE; elseif(ereg(Lynx, getenv(HTTP_USER_AGENT))) $c_browser = Lynx; elseif(ereg(Opera, getenv(HTTP_USER_AGENT))) $c_browser = Opera; elseif(ereg(WebTV, getenv(HTTP_USER_AGENT))) $c_browser = WebTV; elseif(ereg(Konqueror, getenv(HTTP_USER_AGENT))) $c_browser = Konqueror; elseif((eregi(bot, getenv(HTTP_USER_AGENT))) || (ereg(Google, getenv(HTTP_USER_AGENT))) || (ereg(Slurp, getenv(HTTP_USER_AGENT))) || (ereg(Scooter, getenv(HTTP_USER_AGENT))) || (eregi(Spider, getenv(HTTP_USER_AGENT))) || (eregi(Infoseek, getenv(HTTP_USER_AGENT $c_browser = Bot; else $c_browser = Other; On 11/23/05, Frank Armitage [EMAIL PROTECTED] wrote: twistednetadmin wrote: Thanks guys. That helps alot! But this: ?php print $_SERVER['HTTP_USER_AGENT']; ? Returned this using Mozilla: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.12) Gecko/20050915 Firefox/1.0.7 And this using IE: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1) Does that just mean that it's not completely accurate? Try get_browser() http://php.net/manual/en/function.get-browser.php HTH Frank -- tradeOver | http://www.tradeover.net ready to become the King of the World? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- In theory there is no difference between theory and practice. In practice there is. -- Fortune Cookie -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Assistance debugging php 5.x.x
Curt Zirzow [EMAIL PROTECTED] wrote in message * news:[EMAIL PROTECTED]news:[EMAIL PROTECTED] ... On Tue, Nov 22, 2005 at 07:41:10PM +0100, Eric wrote: I would like to have some assistance in debugging php. It's about a bug in php not a script of mine. First off there is a big difference between 5.0.x and 5.1.x as well as 5.0.1 and 5.0.5, what version are we talking about? I tried it with different versions of php5 even a recent CVS of 5.1.x, the code runs fine on all versions of 5 except for the specific anomaly I can't post a bug report as I do not exactly know why my code is suffering from a php bug. It's related to a very complex objects-model ... If it isn't your code is there ever a known state at which it did work? Yes, by just escaping a single line, the surfaced error doesn't occur anymore, however, as of the simplicity of the specific line of code, I believe the compiler is already choking without that line while errors will begin to surface with the line included. ... where objects, cross-referenced, wake up from a session. (note, these are cross-references, not circular, all circular (parent - child) references are unset before the objects are serialized) This almost sounds like some douglas adams, story.. I'd wake up dizzy with all those circular but not circular references. Circular references: Object A has Object B, while Object B has a parent attribute which is referenced back to its parent: Object A Cross-referenced: Object A has a child Object X, Object B also has a child, it's a reference to the very same Object X The dizzy making thing here? Object B is also a child of Object A, which appears to be the causing this problem: php still hates references Curt. -- cat .signature: No such file or directory Thank you for your reply! Think you can help me? Kind regards, Eric van Blokland
RE: [PHP] Assistance debugging php 5.x.x
[snip] I understand your point, but I can't offer you the project as it's company property. Again, I will try to make a reproduce/example script. Meanwhile, try to believe my assumption that the PHP compiler is broken because: [/snip] Have you thought about sending your description of the problem to the DEV list? Again, they are going to ask for code snippets, error messages, items from the log. Code snippets or explicit examples of the code, while in the pursuit of solutions, would probably not violate any company ownership/rights issue. [snip] Still, to rule out any mistakes of mine, I tried the code at a ZendPlatform enabled server and the bug seems to disappear. Not really, though, because a value seem to leak to someplace else and even worse: while ZendPlatform seems te work perfectly (I can debug everything, even this specific piece of code) httpd segfaults when debugging this code with the evil parameter [/snip] Again, without seeing the specific piece of code, as a starting point, it would be hard for us to speculate. [snip] - Back to the error message: even the error message is corrupted, the compiler doesn't seem to know what it's doing (what would explain de httpd segfault with ZendPlatform: PHP does something it's not meant to do) [/snip] In what way is the error message corrupted? At this point we can only speak in hypotheticals. Assuming your code is correct the compiler is broken somehow. Without knowing what the code is we cannot begin to know how the compiler is broken. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Assistance debugging php 5.x.x
[snip] Object A has Object B, while Object B has a parent attribute which is referenced back to its parent: Object A Cross-referenced: Object A has a child Object X, Object B also has a child, it's a reference to the very same Object X The dizzy making thing here? Object B is also a child of Object A, which appears to be the causing this problem: php still hates references [/snip] I'd love to see the UML for this. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Autodeleting news when it has become yesterdays news
- Original Message - From: twistednetadmin [EMAIL PROTECTED] To: php-general@lists.php.net Sent: Wednesday, November 23, 2005 7:02 AM Subject: [PHP] Autodeleting news when it has become yesterdays news I have a news-script on a webpage. Or an eventscript you might call it. This lists up events thats gonna happen on a given day. ie concerts and sportsevents. To get this deleted without having to log on to the adminpage when the event s over would have been a great relief. 1. Is it just as simple as writing a query that executes and removes news with yesterdays date? Yup, DELETE FROM your_table WHERE date_column = curdate() -1; Cheers Matt -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Assistance debugging php 5.x.x
-- Forwarded message -- From: eric van blokland [EMAIL PROTECTED] Date: Nov 23, 2005 2:44 PM Subject: Re: [PHP] Assistance debugging php 5.x.x To: Jay Blanchard [EMAIL PROTECTED] On 11/23/05, Jay Blanchard [EMAIL PROTECTED] wrote: [snip] I understand your point, but I can't offer you the project as it's company property. Again, I will try to make a reproduce/example script. Meanwhile, try to believe my assumption that the PHP compiler is broken because: [/snip] Have you thought about sending your description of the problem to the DEV list? Again, they are going to ask for code snippets, error messages, items from the log. Code snippets or explicit examples of the code, while in the pursuit of solutions, would probably not violate any company ownership/rights issue. [snip] Still, to rule out any mistakes of mine, I tried the code at a ZendPlatform enabled server and the bug seems to disappear. Not really, though, because a value seem to leak to someplace else and even worse: while ZendPlatform seems te work perfectly (I can debug everything, even this specific piece of code) httpd segfaults when debugging this code with the evil parameter [/snip] Again, without seeing the specific piece of code, as a starting point, it would be hard for us to speculate. [snip] - Back to the error message: even the error message is corrupted, the compiler doesn't seem to know what it's doing (what would explain de httpd segfault with ZendPlatform: PHP does something it's not meant to do) [/snip] In what way is the error message corrupted? At this point we can only speak in hypotheticals. Assuming your code is correct the compiler is broken somehow. Without knowing what the code is we cannot begin to know how the compiler is broken. Screwed up error message: Cannot use a scalar value as an array In function [fs_sso-edit()] In file [/include/libraries/footsteps.php] on line [834]fs_sso-edit() [/structure_edit.php] on line [62] This error is correct for all but, that the error occurs in fuction fs_register_property() which is called by object fs_sso from function edit() I will now start stripping the code of the affected objects for an example script, I hope (but doubt) the error will still occur in de example script
Re: [PHP] Accessing Arrays in HTML
On Wednesday 23 November 2005 13:07, Shaun wrote: Hi, I am trying to create a form on my page. The idea is that for each project people can select whether they are allocated for scheduling, non_scheduling or both. Here is an example of my form: [...] However I can't access the 'Scheduling / 'Non_Scheduling' part. Can anyone see where I am going wrong here? Thanks for your advice Scheduling or Non_Scheduling is an array key. Greets Boerni -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Autodeleting news when it has become yesterdays news
twistednetadmin wrote: Just at the beginning of the page with the news is my thought. So that it checks for the eventdate and erases the overdued ones before it collects the news. If you wanted to do that, I'd recommend adding some sort of probability factor into it, so not all scripts have to run the function. e.g. 1% chance of cleaning up the database. ?php if (rand(1,100) 99) { deleteItems(); } ? Cheers, David Grant -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP and email
On 11/23/05, David Grant [EMAIL PROTECTED] wrote: Hi Angelo, Why not send them all in one go? If you want to reduce server load, you should perhaps adjust the 'nice'ness of the script. Because niceness would only affect the script itself and not any smtp servers it comes across along the way. renicing would make the script nice to the local computer, but sending 8000 in one go, will overload the remote smtp servers which do not know the local nice value. If you do the following: nice --adjustment=19 ./script.php Your script will run in the background and use only spare resources. but that will only affect the local machine. You could adjust the bandwidth using trickle, but to answer the mans question - it doesn't really matter. Personally I'd perfer the former, but you have to make sure that your script doesn't time out by setting some php.ini value(forget the name of it.) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP and email
Angelo Zanetti wrote: Hi I have a dedicated server in the states. I need to send about 8000 emails (once off). There pretty small +- 5KB. so I want to write a php script and run it from the command line in the background. I was thinking of sending 50 emails then waiting 90 seconds then sending again. Or the same script gets run by cron every 90 seconds and just sends 50 emails. What do you recommend? I would send them one at a time. While the script itself could probably handle sending 50+ at a time, you have to think about the mail server. Say you have the 8000 emails in an array #!/usr/local/bin/php ?php // Stuff to get email addresses // and create message foreach ( $emails as $email ) { mail ( $email, $subject, $message, $headers ); sleep ( 10 ); } ? YMMV -- 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] Assistance debugging php 5.x.x
I've got some example code on what I'm doing, however, as I expected, the error is gone! All involved objects were taken from the project, but not related code has been stripped-off. (Which means that some of that at code level not related code is in fact related at compiler level. I still suspect references. Anyway, the code is still a bit rough, I'm going to do some further testing. The code is useless for debugging, but might give you an idea on what I'm doing, if you like i could make it available for download. On 11/23/05, Jay Blanchard [EMAIL PROTECTED] wrote: [snip] I understand your point, but I can't offer you the project as it's company property. Again, I will try to make a reproduce/example script. Meanwhile, try to believe my assumption that the PHP compiler is broken because: [/snip] Have you thought about sending your description of the problem to the DEV list? Again, they are going to ask for code snippets, error messages, items from the log. Code snippets or explicit examples of the code, while in the pursuit of solutions, would probably not violate any company ownership/rights issue. [snip] Still, to rule out any mistakes of mine, I tried the code at a ZendPlatform enabled server and the bug seems to disappear. Not really, though, because a value seem to leak to someplace else and even worse: while ZendPlatform seems te work perfectly (I can debug everything, even this specific piece of code) httpd segfaults when debugging this code with the evil parameter [/snip] Again, without seeing the specific piece of code, as a starting point, it would be hard for us to speculate. [snip] - Back to the error message: even the error message is corrupted, the compiler doesn't seem to know what it's doing (what would explain de httpd segfault with ZendPlatform: PHP does something it's not meant to do) [/snip] In what way is the error message corrupted? At this point we can only speak in hypotheticals. Assuming your code is correct the compiler is broken somehow. Without knowing what the code is we cannot begin to know how the compiler is broken.
RE: [PHP] Assistance debugging php 5.x.x
[snip] I've got some example code on what I'm doing, however, as I expected, the error is gone! All involved objects were taken from the project, but not related code has been stripped-off. (Which means that some of that at code level not related code is in fact related at compiler level. I still suspect references. Anyway, the code is still a bit rough, I'm going to do some further testing. The code is useless for debugging, but might give you an idea on what I'm doing, if you like i could make it available for download. [/snip] How long is the code example? Could it not be pasted here or pastebin? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Assistance debugging php 5.x.x
Example is still quite large, all database functionality and other arbitrary code has been stripped. Over 50.000 lines of code have been reduced to a few hundred. Example can be downloaded here: http://213.10.83.232/example.tar Explanation of example: - When you load index.php, the involved objects will be loaded into your session. - If you use the reset link, the objects will be reinitialized. - Continue just reloads index.php, objects will just wakeup from the session - You can change the title of the fs_ssl object, via the text input - Underneath the submit button, the current title of fs_ssl is displayed - The error that occurs in the real project: On changing (submitting) the title of ssl, the sso-properties array gets overwritten, this does not happen with this example Further, just explore the code to see what I'm doing exactly, if you need more comment on what i'm doing, I will add comments to the example source code. On 11/23/05, Jay Blanchard [EMAIL PROTECTED] wrote: [snip] I've got some example code on what I'm doing, however, as I expected, the error is gone! All involved objects were taken from the project, but not related code has been stripped-off. (Which means that some of that at code level not related code is in fact related at compiler level. I still suspect references. Anyway, the code is still a bit rough, I'm going to do some further testing. The code is useless for debugging, but might give you an idea on what I'm doing, if you like i could make it available for download. [/snip] How long is the code example? Could it not be pasted here or pastebin?
Re: [PHP] PHP and email
John Nichel wrote: Angelo Zanetti wrote: Hi I have a dedicated server in the states. I need to send about 8000 emails (once off). There pretty small +- 5KB. so I want to write a php script and run it from the command line in the background. I was thinking of sending 50 emails then waiting 90 seconds then sending again. Or the same script gets run by cron every 90 seconds and just sends 50 emails. What do you recommend? I would send them one at a time. While the script itself could probably handle sending 50+ at a time, you have to think about the mail server. Say you have the 8000 emails in an array #!/usr/local/bin/php ?php // Stuff to get email addresses // and create message foreach ( $emails as $email ) { mail ( $email, $subject, $message, $headers ); sleep ( 10 ); } ? YMMV Thanks to those who have replied so far, yes our main concern is the smtp server falling over or dying. So to come back to John Nichel's answer: John, have you done this personally and I assume the effects were good?? IE everything ran smoothly? thanks Angelo -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] PHP and email
John Nichel wrote: Angelo Zanetti wrote: Hi I have a dedicated server in the states. I need to send about 8000 emails (once off). There pretty small +- 5KB. so I want to write a php script and run it from the command line in the background. I was thinking of sending 50 emails then waiting 90 seconds then sending again. Or the same script gets run by cron every 90 seconds and just sends 50 emails. What do you recommend? I would send them one at a time. While the script itself could probably handle sending 50+ at a time, you have to think about the mail server. Say you have the 8000 emails in an array #!/usr/local/bin/php ?php // Stuff to get email addresses // and create message foreach ( $emails as $email ) { mail ( $email, $subject, $message, $headers ); sleep ( 10 ); } ? YMMV Thanks to those who have replied so far, yes our main concern is the smtp server falling over or dying. So to come back to John Nichel's answer: John, have you done this personally and I assume the effects were good?? IE everything ran smoothly? I have done it just as John has described above, though I didn't have 8000 to send. All went well, no hiccups. A couple of things I would mention is that I seem to remember reading somewhere that the sleep() function on Windows eats a lot of processor. Not an issue for me since I'm on Linux, but worth a mention. And the function John suggested above will take over 22 hours to send 8000 emails. Since you say its a one shot deal, its probably OK. JM -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Assistance debugging php 5.x.x
[snip] Example is still quite large, all database functionality and other arbitrary code has been stripped. Over 50.000 lines of code have been reduced to a few hundred. Example can be downloaded here: http://213.10.83.232/example.tar Explanation of example: - When you load index.php, the involved objects will be loaded into your session. - If you use the reset link, the objects will be reinitialized. - Continue just reloads index.php, objects will just wakeup from the session - You can change the title of the fs_ssl object, via the text input - Underneath the submit button, the current title of fs_ssl is displayed - The error that occurs in the real project: On changing (submitting) the title of ssl, the sso-properties array gets overwritten, this does not happen with this example Further, just explore the code to see what I'm doing exactly, if you need more comment on what i'm doing, I will add comments to the example source code. [/snip] As soon as I have several hours of time to spare *cough* I will explore the code *cough*. 1. If the error does not occur with this example the situation you originally described becomes non-reproducable. If we cannot reproduce the error we have no chance of offering a solution. As you add things back into this example code, when does it break? 2. The folks on this list are here to help, but I don't think that anyone has time to sort through 100's of lines of code looking for what may be a potential error, without wanting to charge a consulting fee. 3. You have no comments in your example code? Brilliant! I know that I am being sarcastic here. I (and others) really would like to help, but I need you to help me (us) do that. I understand that the code is sensitive (company copyright/work product issues) and lengthy. I strongly suspect that the application may be overly complex (based on a quick read through the code) and that you could accomplish that which you are trying to do without being so obsfuscate. I also think that you should send the information you have given us thus far to the PHP-DEV list (http://www.php.net/mailinglists) and see what response that they have to offer given your assertion that the compiler is broken. It is more likely that someone lurking that list will be aware of problems like this where the compiler is concerned. Happy Thanksgiving! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Assistance debugging php 5.x.x
1. That's what I've warned about from the beginning, that outside the complete project environment the error probably wouldn't occur. 2. I understand this completely, naturally. I would like to thank everybody spending time in reading my posts, particulary you, Jay. But that's why I would like to give you, or anyone else for that matter, an attended tour through the project. 3. I'm beeing pushed to present results, writting comments in my code would take almost twice the time writing the code itself. And in most cases, it's faster just to read my code instead of reading the comment. And finally, you wouldn't be able to read my comments, as my comments would be in dutch. Happy Thanksgiving back at you! On 11/23/05, Jay Blanchard [EMAIL PROTECTED] wrote: [snip] Example is still quite large, all database functionality and other arbitrary code has been stripped. Over 50.000 lines of code have been reduced to a few hundred. Example can be downloaded here: http://213.10.83.232/example.tar Explanation of example: - When you load index.php, the involved objects will be loaded into your session. - If you use the reset link, the objects will be reinitialized. - Continue just reloads index.php, objects will just wakeup from the session - You can change the title of the fs_ssl object, via the text input - Underneath the submit button, the current title of fs_ssl is displayed - The error that occurs in the real project: On changing (submitting) the title of ssl, the sso-properties array gets overwritten, this does not happen with this example Further, just explore the code to see what I'm doing exactly, if you need more comment on what i'm doing, I will add comments to the example source code. [/snip] As soon as I have several hours of time to spare *cough* I will explore the code *cough*. 1. If the error does not occur with this example the situation you originally described becomes non-reproducable. If we cannot reproduce the error we have no chance of offering a solution. As you add things back into this example code, when does it break? 2. The folks on this list are here to help, but I don't think that anyone has time to sort through 100's of lines of code looking for what may be a potential error, without wanting to charge a consulting fee. 3. You have no comments in your example code? Brilliant! I know that I am being sarcastic here. I (and others) really would like to help, but I need you to help me (us) do that. I understand that the code is sensitive (company copyright/work product issues) and lengthy. I strongly suspect that the application may be overly complex (based on a quick read through the code) and that you could accomplish that which you are trying to do without being so obsfuscate. I also think that you should send the information you have given us thus far to the PHP-DEV list (http://www.php.net/mailinglists) and see what response that they have to offer given your assertion that the compiler is broken. It is more likely that someone lurking that list will be aware of problems like this where the compiler is concerned. Happy Thanksgiving!
Re: [PHP] PHP and email
Angelo Zanetti wrote: John Nichel wrote: Angelo Zanetti wrote: Hi I have a dedicated server in the states. I need to send about 8000 emails (once off). There pretty small +- 5KB. so I want to write a php script and run it from the command line in the background. I was thinking of sending 50 emails then waiting 90 seconds then sending again. Or the same script gets run by cron every 90 seconds and just sends 50 emails. What do you recommend? I would send them one at a time. While the script itself could probably handle sending 50+ at a time, you have to think about the mail server. Say you have the 8000 emails in an array #!/usr/local/bin/php ?php // Stuff to get email addresses // and create message foreach ( $emails as $email ) { mail ( $email, $subject, $message, $headers ); sleep ( 10 ); } ? YMMV Thanks to those who have replied so far, yes our main concern is the smtp server falling over or dying. So to come back to John Nichel's answer: John, have you done this personally and I assume the effects were good?? IE everything ran smoothly? I use some code just like that at least once a month to send out a newsletter for a site I run, and it works fine. I'm only sending out appx 1400 emails though, so I can afford to let it sleep for a longer period of time. You can probably go lower on the sleep time, but it all depends on your setup. A better solution, if you have access to it and your mail server supports it, is to just inject the whole thing...that way you're not making a SMTP connection each time. -- 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] syntax checking?
Bing Du wrote: Jay Blanchard wrote: [snip] How should PHP syntax be checked before execution? Anything similar to what option -c does in Perl? % perl -c test.pl [/snip] from the command line /usr/local/bin/php -i myScript.php [/snip] Ooops, sorry, should be an ell l /usr/local/bin/php -l myScript.php Too late :). I've already tried -i. Boy, that returns tons of information . My machine was choked. Bing Even with error_reporting set to E_ALL in php.ini, I still get 'Errors parsing file.php' using the php command with the -l option. Anyway to see more than that? Thanks, Bing -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Assistance debugging php 5.x.x
[snip] 1. That's what I've warned about from the beginning, that outside the complete project environment the error probably wouldn't occur. 2. I understand this completely, naturally. I would like to thank everybody spending time in reading my posts, particulary you, Jay. But that's why I would like to give you, or anyone else for that matter, an attended tour through the project. 3. I'm beeing pushed to present results, writting comments in my code would take almost twice the time writing the code itself. And in most cases, it's faster just to read my code instead of reading the comment. And finally, you wouldn't be able to read my comments, as my comments would be in dutch. Happy Thanksgiving back at you! [/snip] 1. Again, when adding code back nto your example when does it break? That would give us a better clue. 2. I really do wish that there was more time available for me to help you. If I find some spare time in quantities great enough it would have to be sometime next weekmaybe. 3. Always comment your code. It is not an option. I hear this excuse all of the time. It is only the fool who does not comment his code, especially code so complex. Commenting may have helped you more precisely locate the problem. And how do you know that I do not read Dutch, have a person on my staff that speaks and writes fluent Dutch, or have access to google Translate? :) We have an office in Pijnacker! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] syntax checking?
[snip] Even with error_reporting set to E_ALL in php.ini, I still get 'Errors parsing file.php' using the php command with the -l option. Anyway to see more than that? [/snip] Here are some command line options http://us2.php.net/features.commandline You could run it in a browser to get line numbers and more precise error messages -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] syntax checking?
Jay Blanchard wrote: [snip] Even with error_reporting set to E_ALL in php.ini, I still get 'Errors parsing file.php' using the php command with the -l option. Anyway to see more than that? [/snip] Here are some command line options http://us2.php.net/features.commandline You could run it in a browser to get line numbers and more precise error messages Just found out this web based PHP syntax checking tool http://www.meandeviation.com/tutorials/learnphp/php-syntax-check/, it helped me find the problem. Pretty nice. Bing -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] syntax checking?
[snip] Just found out this web based PHP syntax checking tool http://www.meandeviation.com/tutorials/learnphp/php-syntax-check/, it helped me find the problem. Pretty nice. [/snip] Nice find. Tried it and it works pretty well. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: PHP and email
Thanks to those who have replied so far, yes our main concern is the smtp server falling over or dying. So to come back to John Nichel's answer: John, have you done this personally and I assume the effects were good?? IE everything ran smoothly? I have done it just as John has described above, though I didn't have 8000 to send. All went well, no hiccups. A couple of things I would mention is that I seem to remember reading somewhere that the sleep() function on Windows eats a lot of processor. Not an issue for me since I'm on Linux, but worth a mention. And the function John suggested above will take over 22 hours to send 8000 emails. Since you say its a one shot deal, its probably OK. I don't think the long running script with sleep function is the best approach to this problem. I would recommend writing the whole queue somewhere (to database) and run script every 5 minutes, load some not sent yet e-mails (100), send them and write info (it_was_sent tag) back to database. It's always better to not have long running script, you never know what can go wrong and if it fails somewhere or process is killed or machine rebooted or something happens, you don't know which emails were sent and which not. And there's no stupidest thing as sending the same company newsletter twice to the same client. Petr -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Is there an alternative for $_FILES['guildimage']['type'] == image/jpeg
On Wed, Nov 23, 2005 at 06:48:25AM +0100, twistednetadmin wrote: This did the trick: elseif ($_FILES['guildimage']['type'] == image/pjpeg or image/jpeg) Not for reasons you think. The (or image/jpeg) is going to evaulate as TRUE, so your expression will always be true. For example: var_dump((bool) image/jpeg); You should really consider using the fileinfo extension, or mabey even http://php.net/getimagesize. The ['type'] information can't be trusted to be what it says it is. 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] Re: PHP and email
Petr Smith wrote: Thanks to those who have replied so far, yes our main concern is the smtp server falling over or dying. So to come back to John Nichel's answer: John, have you done this personally and I assume the effects were good?? IE everything ran smoothly? I have done it just as John has described above, though I didn't have 8000 to send. All went well, no hiccups. A couple of things I would mention is that I seem to remember reading somewhere that the sleep() function on Windows eats a lot of processor. Not an issue for me since I'm on Linux, but worth a mention. And the function John suggested above will take over 22 hours to send 8000 emails. Since you say its a one shot deal, its probably OK. I don't think the long running script with sleep function is the best approach to this problem. I would recommend writing the whole queue somewhere (to database) and run script every 5 minutes, load some not sent yet e-mails (100), send them and write info (it_was_sent tag) back to database. What's to stop you from writing this 'sent tag' using the sleep method? What I wouldn't like about the every 5 minutes cron method is that the script will run _every_ five minutes regardless if it's sending mail or not. Not to mention the fact that even with a small number like a 100, you could still cause problems with the mail server trying to make that many SMTP connections in less than a second or two. It's always better to not have long running script, you never know what can go wrong and if it fails somewhere or process is killed or machine rebooted or something happens, you don't know which emails were sent and which not. And there's no stupidest thing as sending the same company newsletter twice to the same client. You computer is full of scripts/programs/daemons that have long runs...some 24/7. That isn't a problem as long as you think ahead. With proper logging, I can easily pick up where I left off should the script fail for one reason or another. -- 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] syntax checking?
Jay Blanchard wrote: [snip] Just found out this web based PHP syntax checking tool http://www.meandeviation.com/tutorials/learnphp/php-syntax-check/, it helped me find the problem. Pretty nice. [/snip] Nice find. Tried it and it works pretty well. I get this when I try to check a php script on my machine... Sorry! bad URL :-( Guess it only works if you're on a Windows client. ;) -- 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] mysqli unclonable object
On Wed, Nov 23, 2005 at 01:13:22AM -0500, Matt Monaco wrote: On a Fedora 4 machine running MySQL 4.1 I am having trouble declaring an instance of a mysqli extension. class Data extends mysqli { $link = new Data(localhost, user, password, db); This invokes the error Trying to clone unclonable object of type Data. However if I create the link with a reference ... $link = new Data(); ...everything works fine. This is because you have the ini option: zend.ze1_compatibility_mode = On 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] Assistance debugging php 5.x.x
Eric, everything you have written suggests to me that the problem is in your code (that may be being caused by changes to the engine, which have either removed an ability due to the fact that it was dangerous [e.g. reference issues], or abilities that have been changed because they were deemed wrong) regardless of whether that is the case or not you are best off by assuming that the problem is in your code: 1. if its your code you have the power to fix it, which is a better situation to be in than have to rely on third parties to fix an underlying texchnology. 2. it avoids 'blaming' core developers until such time as you can _prove_ the engine has a bug. eric van blokland wrote: 1. That's what I've warned about from the beginning, that outside the complete project environment the error probably wouldn't occur. 2. I understand this completely, naturally. I would like to thank everybody spending time in reading my posts, particulary you, Jay. But that's why I would like to give you, or anyone else for that matter, an attended tour through the project. 3. I'm beeing pushed to present results, writting comments in my code would take almost twice the time writing the code itself. And in most cases, it's faster just to read my code instead of reading the comment. And finally, you the last 3 lines are bullshit on all counts (apart from the implied deadline pressure), do yourself a favor and starting commenting! :-) wouldn't be able to read my comments, as my comments would be in dutch. I'd be happy to translate for you Jay ;-) having said that there is no reason to write comments in dutch if your english is as good as it is, but comments in any language are always better than none. (assuming the comments actually have some baring on the actual code - i.e. comments like '// Bill Gates has lots of money' don't really help!) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Assistance debugging php 5.x.x
LOL @ Jochem Well I sure can't argue with that! (serious) But with or without comments, the code is broken or breaks something. I've tracked down the weird bevahiour a little further. Now I would sure like, if one of you has about 30 minutes time to look at my problem with me, using VNC and Skype If you got the spare time I would really appreciate it and as I've been unable to create some actual reproduce code, the only thing that's left is looking at the real thing. I'm still sure it's related to the way I use references, wheter it is or isn't a bug in the compiler, it sure would be nice to know this particular DON'T about references. Please let me know On 11/23/05, Jochem Maas [EMAIL PROTECTED] wrote: Eric, everything you have written suggests to me that the problem is in your code (that may be being caused by changes to the engine, which have either removed an ability due to the fact that it was dangerous [e.g. reference issues], or abilities that have been changed because they were deemed wrong) regardless of whether that is the case or not you are best off by assuming that the problem is in your code: 1. if its your code you have the power to fix it, which is a better situation to be in than have to rely on third parties to fix an underlying texchnology. 2. it avoids 'blaming' core developers until such time as you can _prove_ the engine has a bug. eric van blokland wrote: 1. That's what I've warned about from the beginning, that outside the complete project environment the error probably wouldn't occur. 2. I understand this completely, naturally. I would like to thank everybody spending time in reading my posts, particulary you, Jay. But that's why I would like to give you, or anyone else for that matter, an attended tour through the project. 3. I'm beeing pushed to present results, writting comments in my code would take almost twice the time writing the code itself. And in most cases, it's faster just to read my code instead of reading the comment. And finally, you the last 3 lines are bullshit on all counts (apart from the implied deadline pressure), do yourself a favor and starting commenting! :-) wouldn't be able to read my comments, as my comments would be in dutch. I'd be happy to translate for you Jay ;-) having said that there is no reason to write comments in dutch if your english is as good as it is, but comments in any language are always better than none. (assuming the comments actually have some baring on the actual code - i.e. comments like '// Bill Gates has lots of money' don't really help!)
Re: [PHP] Is there an alternative for $_FILES['guildimage']['type'] == image/jpeg
Curt Zirzow wrote: You should really consider using the fileinfo extension, or mabey even http://php.net/getimagesize. The ['type'] information can't be trusted to be what it says it is. Any reason why no one is suggesting the use of mime_content_type? http://ca.php.net/mime_content_type It seems to work well for me and there's no need to trust whatever the browser claims a file is or having to worry about different browsers inconsistently describing a mime type. - Ben -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Is there an alternative for $_FILES['guildimage']['type']
You could use the exif_imagetype() function http://nl2.php.net/manual/en/function.exif-imagetype.php
Re: [PHP] Is there an alternative for $_FILES['guildimage']['type'] == image/jpeg
I'd say because it's been depreciated. LXXVI. Mimetype Functions Introduction Warning This extension has been deprecated as the PECL extension fileinfo provides the same functionality (and more) in a much cleaner way. On Wednesday 23 November 2005 12:45 pm, Ben wrote: Curt Zirzow wrote: You should really consider using the fileinfo extension, or mabey even http://php.net/getimagesize. The ['type'] information can't be trusted to be what it says it is. Any reason why no one is suggesting the use of mime_content_type? http://ca.php.net/mime_content_type It seems to work well for me and there's no need to trust whatever the browser claims a file is or having to worry about different browsers inconsistently describing a mime type. - Ben -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Assistance debugging php 5.x.x
eric van blokland wrote: LOL @ Jochem Well I sure can't argue with that! (serious) But with or without comments, the code is broken or breaks something. I've tracked down the weird bevahiour a little further. Now I would sure like, if one of you has about 30 minutes time to look at my problem with me, using VNC and Skype If you got the spare time I would really appreciate it and as I've been unable to create some actual reproduce code, the only thing that's left is looking at the real thing. I'm still sure it's related to the way I use references, wheter it is or isn't a bug in the compiler, it sure would be nice to know this particular DON'T about references. Please let me know 1. it could be considered over-engineered 2. you seem to be reinventing the wheel (templating?) 3. you are lacking knowledge regarding php5 OO (for starters why are not you using __construct() for the ctors?) 4. YOU ARE USING REFERENCES ALL OVER THE PLACE!!! ;-) regarding no. 4, some examples: function fs_handle_object_properties($object) { // ^--- destroy it // why bother sticking the object in a 'serialize container'? // and where was the class defined in the example code??? function fs_serialize($object) { // ^--- destroy it $container=new fs_serialize_container(); $container-object=$object; // ^--- destroy it return serialize($container); } // what happens in this code when $name // is 'properties' or some other value that // is the name of pre-defined object attribute? function fs_handle_object_properties($object) { global $stdo; $changed=false; if(isset($object-properties) is_array($object-properties)) { foreach($object-properties as $name= $property) { if(isset($property-changed) $property-changed==true){ $object-changed=true; $changed=true; $object-$name=$property-value; } } // if you are already using $_SESSION why complicate matters // by also storing duplicate stuff in $_COOKIE? _seems_ a // waste of time. function fs_process_properties(){ if(isset($_COOKIE['fs_properties'])){ $properties=explode(';',$_COOKIE['fs_properties']); function fs_unserialize($string) { // ^-- destroy it class std_page { /* ... */ function edit($structure) { //^-- ??? global $stdo; foreach($this-properties as $key=$property){ // ^-- $property is an object print $property-parse(); } and so on. getting rid of all the referencing of objects will most probably get rid of your problems - I'll pass on the argument as to whether it should work as it is. - you might also want to read up on __call(), __set() and __get(). oh and there are the functions is_array(), is_object() and the keyword 'instanceof' which you might want to consider making more use of in order to check your variables. On 11/23/05, *Jochem Maas* [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: Eric, everything you have written suggests to me that the problem is in your code (that may be being caused by changes to the engine, which have either removed an ability due to the fact that it was dangerous [e.g. reference issues], or abilities that have been changed because they were deemed wrong) regardless of whether that is the case or not you are best off by assuming that the problem is in your code: 1. if its your code you have the power to fix it, which is a better situation to be in than have to rely on third parties to fix an underlying texchnology. 2. it avoids 'blaming' core developers until such time as you can _prove_ the engine has a bug. eric van blokland wrote: 1. That's what I've warned about from the beginning, that outside the complete project environment the error probably wouldn't occur. 2. I understand this completely, naturally. I would like to thank everybody spending time in reading my posts, particulary you, Jay. But that's why I would like to give you, or anyone else for that matter, an attended tour through the project. 3. I'm beeing pushed to present results, writting comments in my code would take almost twice the time writing the code itself. And in most cases, it's faster just to read my code instead of reading the comment. And
Re: [PHP] Assistance debugging php 5.x.x
1. Overengineering perhaps... 2. Reinventing the wheel? Probably, but I just like to know every single bit of the wheel I use 3. I do get confused every now and then about PHP5 OO 4. References everywhere? Yes, the code was originally written for PHP4 I have already started removing them, but seriously, does PHP5 cares about passing an object reference by reference (it's useless and overhead, ok, but does it matter?) Because the code originates from PHP4, I don't have __constructor functions On 11/23/05, Jochem Maas [EMAIL PROTECTED] wrote: eric van blokland wrote: LOL @ Jochem Well I sure can't argue with that! (serious) But with or without comments, the code is broken or breaks something. I've tracked down the weird bevahiour a little further. Now I would sure like, if one of you has about 30 minutes time to look at my problem with me, using VNC and Skype If you got the spare time I would really appreciate it and as I've been unable to create some actual reproduce code, the only thing that's left is looking at the real thing. I'm still sure it's related to the way I use references, wheter it is or isn't a bug in the compiler, it sure would be nice to know this particular DON'T about references. Please let me know 1. it could be considered over-engineered 2. you seem to be reinventing the wheel (templating?) 3. you are lacking knowledge regarding php5 OO (for starters why are not you using __construct() for the ctors?) 4. YOU ARE USING REFERENCES ALL OVER THE PLACE!!! ;-) regarding no. 4, some examples: function fs_handle_object_properties($object) { // ^--- destroy it I will // why bother sticking the object in a 'serialize container'? // and where was the class defined in the example code??? function fs_serialize($object) { // ^--- destroy it $container=new fs_serialize_container(); $container-object=$object; // ^--- destroy it return serialize($container); } The container is used so references within $object to $object will remain intact, the class is missing from the example code, because the example isn't going to serialize or unserialize anything // what happens in this code when $name // is 'properties' or some other value that // is the name of pre-defined object attribute? function fs_handle_object_properties($object) { global $stdo; $changed=false; if(isset($object-properties) is_array($object-properties)) { foreach($object-properties as $name= $property) { if(isset($property-changed) $property-changed==true){ $object-changed=true; $changed=true; $object-$name=$property-value; } } This is most definitely a bug, or overlook issue, however, this is not the cause of my problem // if you are already using $_SESSION why complicate matters // by also storing duplicate stuff in $_COOKIE? _seems_ a // waste of time. function fs_process_properties(){ if(isset($_COOKIE['fs_properties'])){ $properties=explode(';',$_COOKIE['fs_properties']); This function is used for external data input from the clients. I do not post all forms, some are sent by cookie function fs_unserialize($string) { // ^-- destroy it I will class std_page { /* ... */ function edit($structure) { //^-- ??? global $stdo; foreach($this-properties as $key=$property) { // ^-- $property is an object print $property-parse(); } and so on. getting rid of all the referencing of objects will most probably get rid of your problems - I'll pass on the argument as to whether it should work as it is. - I will remove them you might also want to read up on __call(), __set() and __get(). oh and there are the functions is_array(), is_object() and the keyword 'instanceof' which you might want to consider making more use of in order to check your variables. But still I would like to ask you to take a look with me On 11/23/05, *Jochem Maas* [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: Eric, everything you have written suggests to me that the problem is in your code (that may be being caused by changes to the engine, which have either removed an ability due to the fact that it was dangerous [e.g. reference issues], or abilities that have been changed because they were deemed wrong) regardless of whether that is the case or not you are best off by assuming that the problem is in your code: 1. if its your code you have the power to fix
[PHP] preg_match_all for dummies
I am a regex retard. I am trying to pull keywords out of this crazy bbcode-like file, but only for bbcode-like code NOT enclosed in HTML comments. I currently have managed to create this regex: '/(?!!--)\[!(\w+)::.*!\](?!--)/U' Which matches [!keyword::crazy bbcode!] and not !--[!keyword::crazy bbcode!]-- That's a step in the right direction. But it includes in the match keywords within phrases like this: !-- A sentence including some [!keyword::crazy bbcode!]. -- I want to ignore all bbcode within HTML quotes. How do I do this? thanks kgt -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Assistance debugging php 5.x.x
eric van blokland wrote: 1. Overengineering perhaps... 2. Reinventing the wheel? Probably, but I just like to know every single bit of the wheel I use hmm, did you build your own PC? and the CPU did you build that? do you know exactly how it works? me niether. 3. I do get confused every now and then about PHP5 O we have a club. :-) 4. References everywhere? Yes, the code was originally written for PHP4 I have already started removing them, but seriously, does PHP5 cares about passing an object reference by reference (it's useless and overhead, ok, but does it matter?) its not my code, I haven't even seen it run, how do I know if it will actually help? but I have a strong feeling that it will fix the issue. so change the code and find out. given the fact that you are migrating php4 OO code to php5 you might consider reading up on all the potential problems that might occur. Because the code originates from PHP4, I don't have __constructor functions its __construct(), and given that the code contains php5 only syntax I would suggest removing anything that is there for the benefit of php4. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Can't execute external program
Hi Still desperate DOCUMENT_ROOT is /var/www/html Check all settings at http://provi.voicenetworx.net:8080/t.php From the command line it runs perfectly: [EMAIL PROTECTED] html]# /var/www/html/myprog -E 123456789098.dat sample1.txt sample1.new (no output, it just creates the file .new) Here is the php I've created, fairly simple: ?php exec(/var/www/html/myprog -E 123456789098.dat sample1.txt sample1.new); phpinfo(); ? On 11/22/05, n.g. [EMAIL PROTECTED] wrote: is /var/www/html your web root dir ? maybe its the plobrem. On 11/23/05, Henry Castillo [EMAIL PROTECTED] wrote: That was on of the first things I checked: safe mode is set to off Any ideas... Henry Voip tech said the following on 11/20/2005 10:31 PM: Hello, I cannot get exec(), system() or passthru() to run an extenal program. From the command line it runs perfectly: snip I'm getting frustrated, Any help will be deeply appreciated Henry The answer is probably in your php.ini. Look into whether you are running in safe mode or not, and if you are whether you have your program in the safe_mode_exec_dir or not. Also check disable_functions to see if any of the ones you are having trouble with are listed. - Ben -- Tomorrow will be a good day :-)
Re: [PHP] Assistance debugging php 5.x.x
I will start with removing obsolete references from my code. But if the problem persist, could you please try to find some time to look at the issue with me. Thank you for the support so far. I'll be back here in one or two days Have a nice evening! On 11/23/05, Jochem Maas [EMAIL PROTECTED] wrote: eric van blokland wrote: 1. Overengineering perhaps... 2. Reinventing the wheel? Probably, but I just like to know every single bit of the wheel I use hmm, did you build your own PC? and the CPU did you build that? do you know exactly how it works? me niether. 3. I do get confused every now and then about PHP5 O we have a club. :-) 4. References everywhere? Yes, the code was originally written for PHP4 I have already started removing them, but seriously, does PHP5 cares about passing an object reference by reference (it's useless and overhead, ok, but does it matter?) its not my code, I haven't even seen it run, how do I know if it will actually help? but I have a strong feeling that it will fix the issue. so change the code and find out. given the fact that you are migrating php4 OO code to php5 you might consider reading up on all the potential problems that might occur. Because the code originates from PHP4, I don't have __constructor functions its __construct(), and given that the code contains php5 only syntax I would suggest removing anything that is there for the benefit of php4.
Re: [PHP] Re: Can't execute external program
Hi Still desperate Try adding 21 to the command line; maybe that will show an error. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: PHP and email
I have implemeted a system that dispatches between 600 to 2000 emails every night. An email is sent for each recepient. My system is hosted on a shared Linus server. I have not heard any complaints from the hosting company so far. Here are my recommendations: - Have a cron job that kicks off your PHP script at intervals long enough to guarantee the completion of an earlier execution of the script. - Have a sleep interval between a predefined number of emails sent. You need to figure out what works well for you depending on your dispatch frequency, etc. (I would keep the sleep interval short.) - No need to nice anything. The problem is the load on the smtp server. You need to give it some time to process what you sent already before sending more emails. - Log all outbound activity. We log the email addresses of who receives each message. That provides auditing and helps in recovering any failures. - We use flags in our database to flag what messages were sent successfully. That way, we can search and resend any failed messages. Hope this helps. -- Anas Mughal
[PHP] Re: Can't execute external program
I added 21 but still nothing... as a matter of fact it won't execute anything. I put echo exec('asdf'); and nothing happend either ( i should've echoed an error) However it'll execute some other commands echo exec('ls -lart'); will output correctly. Any ohter Idea? Henry
[PHP] Code generators
Hi there, There´s a lot of manufacturers, about PHP code generators. What do you think about that? I mean, it seems like PHP Nuke fashion or other portal systems. Everybody has its portal, but all web pages seems to be the same, because all are under the same design. I would like to gather opinions about it. Example: http://www.yessoftware.com/index2.php Thank you P.S. Please sorry my poor english, I´m trying to improve my skills -- dpc
[PHP] readfile and get_file_contents don't work
I compiled PHP from source on Fedora Core 4, but I must have left something out because readfile and get_file_contents aren't working. If I try to connect to a http://; address I get the error failed to open stream: HTTP request failed. Any ideas why? Richard -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP and email
Hello, on 11/24/2005 11:38 AM Angelo Zanetti said the following: Thanks to those who have replied so far, yes our main concern is the smtp server falling over or dying. So to come back to John Nichel's answer: John, have you done this personally and I assume the effects were good?? IE everything ran smoothly? I think you are making a big confusion. SMTP servers do not send e-mail. SMTP servers only receive e-mail. What sends e-mail are MTA (Mail Transfer Agents). Some MTA come with SMTP servers but those are independent operations. There is no reason for an SMTP server or MTA to die unless it is not configure to work upto the operating system limits. What mail server do you use? -- Regards, Manuel Lemos Metastorage - Data object relational mapping layer generator http://www.metastorage.net/ PHP Classes - Free ready to use OOP components written in PHP http://www.phpclasses.org/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] mysqli unclonable object
Thanks for your attention Curt, but unfortunatly that is not the issue. Compatibility mode is not on. For documentation's sake, I think the problem is that there are other links in the code using the same credentials. When you declare a link resource to a database, PHP first searches to see if there is already one open, therefore despite the fact that this link wasn't even using the same library (mysql vs mysqli) it didn't matter; only one connection to the database could be made (as root in this case). If this is incorrect or anyone has additional insight, please reply. Thanks, Matt Curt Zirzow [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] On Wed, Nov 23, 2005 at 01:13:22AM -0500, Matt Monaco wrote: On a Fedora 4 machine running MySQL 4.1 I am having trouble declaring an instance of a mysqli extension. class Data extends mysqli { $link = new Data(localhost, user, password, db); This invokes the error Trying to clone unclonable object of type Data. However if I create the link with a reference ... $link = new Data(); ...everything works fine. This is because you have the ini option: zend.ze1_compatibility_mode = On 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] Re: NTLM, PHP and Apache
Hello, on 11/23/2005 02:58 AM Joe Wollard said the following: I'm running a rogue (the company knows about it but doesn't support it) web server for my dept and I'd like to be able to authenticate users transparently. The company is currently doing this on their own supported Intranet servers via NTLM on IIS. All I'm really looking for here is a way to extract the user name from the 'Authentication:' HTTP header using PHP on Apache (FC4). It seems that some of the string can be extracted using base64_decode(). Unfortunately it is not the part of the string that I need. It's just the domain name, the computer's NET BIOS name and the Auth-type which of course is NTLMSSP. I found a mod_ntlm for Apache, but even if I could compile it on FC4 (yes, I tried) I'm not sure I need/want the full functionality of NTLM - just a way to extract the user name of the user logged into the client machine from the HTTP header using apache. mod_ntlm is exactly what tou need. It seems that there are many sites out there that do this in Java and Perl, but none describe a way to do this in PHP..any ideas? PHP or any other language do not do anything. The Web server authentication module performs the authentication dialog and pass it to the scripts of any language through the environment variable LOGON_USER. All you need to do is to call GetEnv(LOGON_USER); -- Regards, Manuel Lemos Metastorage - Data object relational mapping layer generator http://www.metastorage.net/ PHP Classes - Free ready to use OOP components written in PHP http://www.phpclasses.org/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] http protocols defining what gets sent between web server and browser
hi... this might not be a php question but might still provide interest... I'm working on a project, and need to know if there's anyone who's a guru with Web Server/Client interactions. Basically, I'm trying to get a much better/deeper understanding of the HTTP protocols defining the information that is sent/transfered between the web server/client browser apps. I'm interested in understanding what the various information is that gets transfered between the apps, as well as understanding what information can be spoofed/altered on the client side, as it goes back to the server. I know you can get the querystring information from the get/put/request/etc... I'm more interested in any other information that gets transferred as potentially part of the header structure, like machine id, mac address, date/time, etc I'm interested in whether this can be spoofed/altered, and potentially rendered invalid by a 'man in the middle' type of attack. Searching google isn't getting me what i really want!! So, if you have the skills/expertise in this area, and you're willing to talk to me for a few minutes, I'd appreciate it. As stated, the underlying reason for the questions is to get a better understanding of 'man in the middle attacks' as this applies to web server apps. Thanks bruce [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] http protocols defining what gets sent between web server and browser
I find the LiveHTTPHeaders extension for firefox to be very good for this kind of thing. http://livehttpheaders.mozdev.org/ It gives you a realistic (as opposed to theoretical) view of exactly what is being sent between the browser and the server. Networking details that you listed like the mac address are handled in the networking layer rather than by the browser, you probably also want to look up TCP/IP headers. David bruce wrote: hi... this might not be a php question but might still provide interest... I'm working on a project, and need to know if there's anyone who's a guru with Web Server/Client interactions. Basically, I'm trying to get a much better/deeper understanding of the HTTP protocols defining the information that is sent/transfered between the web server/client browser apps. I'm interested in understanding what the various information is that gets transfered between the apps, as well as understanding what information can be spoofed/altered on the client side, as it goes back to the server. I know you can get the querystring information from the get/put/request/etc... I'm more interested in any other information that gets transferred as potentially part of the header structure, like machine id, mac address, date/time, etc I'm interested in whether this can be spoofed/altered, and potentially rendered invalid by a 'man in the middle' type of attack. Searching google isn't getting me what i really want!! So, if you have the skills/expertise in this area, and you're willing to talk to me for a few minutes, I'd appreciate it. As stated, the underlying reason for the questions is to get a better understanding of 'man in the middle attacks' as this applies to web server apps. Thanks bruce [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] mysqli unclonable object
On Wed, Nov 23, 2005 at 06:48:50PM -0500, Matt Monaco wrote: Thanks for your attention Curt, but unfortunatly that is not the issue. Compatibility mode is not on. What does this say just before you do $link = new ...: var_dump(ini_get('zend.ze1_compatibility_mode')); If it says string(1) 0, then either your using php4 or some buggy version of php5. For documentation's sake, I think the problem is that there are other links in the code using the same credentials. When you declare a link resource to a database, PHP first searches to see if there is already one open, therefore despite the fact that this link wasn't even using the same library (mysql vs mysqli) it didn't matter; only one connection to the database could be made (as root in this case). If this is incorrect or anyone has additional insight, please reply. Only the old mysql extension has any sort of credential checking and if they are the same, returns the same connection (which can be bypassed with an option to mysql_connect(). mysqli has no such credential checking. 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] http protocols defining what gets sent between web server and browser
On Wed, Nov 23, 2005 at 04:53:50PM -0800, bruce wrote: hi... this might not be a php question but might still provide interest... I'm working on a project, and need to know if there's anyone who's a guru with Web Server/Client interactions. Basically, I'm trying to get a much better/deeper understanding of the HTTP protocols defining the information that is sent/transfered between the web server/client browser apps. I'd probably recomend this book: http://www.amazon.com/gp/product/0672324547/103-9975129-7570262 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] mysqli unclonable object
I get string(1) , should that be taken just the same as 0? In addition phpinfo() indicates php 5.0.4 - does the upgrade to .5 involve remove .4 first? btw, as I'm new to the mailing list thing, why do some names appear in quotes and others do not? Thanks, Matt Curt Zirzow [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] On Wed, Nov 23, 2005 at 06:48:50PM -0500, Matt Monaco wrote: Thanks for your attention Curt, but unfortunatly that is not the issue. Compatibility mode is not on. What does this say just before you do $link = new ...: var_dump(ini_get('zend.ze1_compatibility_mode')); If it says string(1) 0, then either your using php4 or some buggy version of php5. For documentation's sake, I think the problem is that there are other links in the code using the same credentials. When you declare a link resource to a database, PHP first searches to see if there is already one open, therefore despite the fact that this link wasn't even using the same library (mysql vs mysqli) it didn't matter; only one connection to the database could be made (as root in this case). If this is incorrect or anyone has additional insight, please reply. Only the old mysql extension has any sort of credential checking and if they are the same, returns the same connection (which can be bypassed with an option to mysql_connect(). mysqli has no such credential checking. 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] Re: Code generators
Danny wrote: Hi there, There´s a lot of manufacturers, about PHP code generators. What do you think about that? I mean, it seems like PHP Nuke fashion or other portal systems. Everybody has its portal, but all web pages seems to be the same, because all are under the same design. I would like to gather opinions about it. Example: http://www.yessoftware.com/index2.php Thank you P.S. Please sorry my poor english, I´m trying to improve my skills -- dpc Funny. This is getting more and more popular, in many different levels. I've seen RAD pop up here and there on PHP(I'm planning/developing one since 2003). Now, i'm not sure, but maybe this is getting a lot of atention, these days, because ruby on rails way of doing things Or simply, people are tired of doing the same old things the same old way. (Ok, we are tired for a long time, but seems that only now, tools like that are having attention). I think that what ever can do the boring work for you the exacly same way (maybe, better) that you would, is welcome. I'm having a look right now in that app (from yessoftware). Seems interesting. Too bad is commercial/for-windows product :( Thiago -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php