[PHP] Multibyte strings as array keys
Does this work? Something is breaking when I try to do this, and all I can think of is that PHP does not allow multibyte array keys. - Naz. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] re[PHP] gister_globals
I'm a newbie to php and i would like to set register_globals to 'on' from my php script itself(eg:- index.php). Is there any way of doing this. You can't do this from inside the script with ini_set() as register_globals has already had it's affect at that point, so you can put this in a .htaccess file if you're using Apache: php_flag register_globals 1 -- Richard Heyes http://www.websupportsolutions.co.uk Mailing list management service allowing you to reach your Customers and increase your sales. ** NOW OFFERING FREE ACCOUNTS TO CHARITIES AND NON-PROFITS ** -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Word Wrap on highlight_file
Can anyone tell me how to wrap the results of highlight_file so it doesn't mess up the size of my table div? I tried the following and doesn't work! if ($ext == phps) { $showcode = highlight_file($pathtoscripts . $_GET['file']); echo wordwrap($showcode, 70); } else { echo Nice try, but you are not authorised to view the source of files with a $ext extension! ;)\n; } Thanks, Tom -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Word Wrap on highlight_file
Tom Chubb schreef: Can anyone tell me how to wrap the results of highlight_file so it doesn't mess up the size of my table div? use CSS to control the visual display in the browser. not to mention that 'table div' doesn't make much sense as a concept. probably you'll want to do something with the CSS property 'overflow'. I tried the following and doesn't work! if ($ext == phps) { $showcode = highlight_file($pathtoscripts . $_GET['file']); you are not santizing the request data, you need to be doing something like the following (maybe someone else can check my example and offer even better sanitizing code?): $file = basename($_GET['file']); if (!$file) die('nice try'); $ext = explode('.', $file); $ext = array_pop($ext); if ($ext != 'phps') die('nice try'); $file = $pathtoscripts . basename($_GET['file']); if (is_dir($file) || !is_readable($file)) die('nice try'); echo wordwrap($showcode, 70);x } else { echo Nice try, but you are not authorised to view the source of files with a $ext extension! ;)\n; } Thanks, Tom -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] re[PHP] gister_globals
tbt schreef: Hi, I'm a newbie to php and i would like to set register_globals to 'on' from my php script itself(eg:- index.php). Is there any way of doing this. you think you would like that. but you are wrong. register_globals is a security risk in the hands of someone who doesn't know exactly what they are doing. besides which register_globals is depreciated. also you can search the list archives for lots of posts that explain why register_globals is evil. learn how to write your script without using register_globals - ask here if you get stuck (but don't forget the manual!). Thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] snmp_set_valueretrieval depends on what?
I am experimenting with the snmp_set_valueretrieval function, which does not appear to be documented: http://il.php.net/snmp_set_valueretrieval What does this function depend upon? Simply using it throws this: Fatal error: Call to undefined function snmp_set_valueretrieval() in I'm on a debian-based system (Ubuntu), so if there is a deb package that provides the proper libs I'd appreciate knowing about it. This is my build info: $ php -v PHP 5.2.1 (cli) (built: Nov 28 2007 23:14:55) Thanks in advance. Dotan Cohen http://what-is-what.com http://gibberish.co.il א-ב-ג-ד-ה-ו-ז-ח-ט-י-ך-כ-ל-ם-מ-ן-נ-ס-ע-ף-פ-ץ-צ-ק-ר-ש-ת A: Because it messes up the order in which people normally read text. Q: Why is top-posting such a bad thing?
Re: [PHP] snmp_set_valueretrieval depends on what?
Dotan Cohen wrote: I am experimenting with the snmp_set_valueretrieval function, which does not appear to be documented: http://il.php.net/snmp_set_valueretrieval What does this function depend upon? Simply using it throws this: Fatal error: Call to undefined function snmp_set_valueretrieval() in http://il.php.net/manual/en/ref.snmp.php In order to use the SNMP functions on Unix you need to install the » NET-SNMP package. Now compile PHP --with-snmp[=DIR]. /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Encryption failing
On Jan 15, 2008, at 10:48 PM, Casey wrote: It returns the correct value. If you look at the last example, and run base64_decode on MDAwMzEwMDI0NDA0MTMyOQ==, you will get 0003100244041329. Oops. Haste makes crappy programming. Ken -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Closures in PHP
On Jan 16, 2008 1:58 AM, Larry Garfield [EMAIL PROTECTED] wrote: On Tuesday 15 January 2008, Nathan Nobbe wrote: when i said a function would have to be loaded into the interpreter to avoid a runtime error upon invocation, i didnt mention that its best to programatically verify it can be called before letting the runtime error occur (of course you can let that happen if you prefer :)), to avoid it. anywho, i prefer the variable function construct more than call_user_func(), simply because it feels a bit more natural to me, but semantically, they are the same, they just have a different syntax is all. i suppose call_user_func() is a bit more clear and might help some people when drifting through the code of others. cool contrived example, btw ;) -nathan Not true, actually. $function() is considerably faster than call_user_func() or call_user_func_array(). call_user_func_array(), however, lets you pass in an arbitrary number of parameters while the other two do not. not quite. speed has nothing to do w/ semantics, and if you read the doc on call_user_func() you can pass in a variable number of parameters (which is what i said in my later post). the difference is call_user_func_array() takes an array w/ the parameters to pass to the function it invokes and call_user_func() accepts the standard format for a variable number of parameters. eg. (from php.net) mixed *call_user_func* ( callback $function [, mixed $parameter [, mixed $... ]] ) -nathan
Re: [PHP] utf-8 in $_POST
the user agents in question are various mobile phones, which as you might guess are premature technology and have their own ways with things. here is an example posting from a Samsung D600 which insists on posting form data in UTF-8 even though i serve it ISO-8859-1 and it claims to support all character sets. [_POST] = Array ( [message] = Norwegian characters: øá ) [_SERVER] = Array ( [HTTP_ACCEPT_CHARSET] = * [CONTENT_TYPE] = application/x-www-form-urlencoded; charset=utf-8 [HTTP_USER_AGENT] = SAMSUNG-SGH-D600E/1.0 Profile/MIDP-2.0 Configuration/CLDC-1.1 UP.Browser/6.2.3.3.c.1.101 (GUI) MMP/2.0 ) i would consider switching to utf-8 if i knew how make the windows version of emacs work fine with utf-8 text files (and still work with iso-8859-1 files as well). On 08/01/2008, Per Jessen [EMAIL PROTECTED] wrote: Olav Mørkrid wrote: i specify iso-8859-1 in both header and body: meta http-equiv=Content-type content=text/html; charset=iso-8859-1/ form action=/ method=post accept-charset=iso-8859-1 Have you checked 1) what the webserver sends in the header and 2) what the browser actually uses? I'm pretty certain I've had issues where the meta tags were fine, but the server overrode me settings in the header. /Per Jessen, Zürich -- 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] Encryption failing
On Jan 16, 2008, at 1:28 AM, Andrés Robinet wrote: 1 - Mike is right about first encrypting and then doing a base64_encode (then saving results to DB, cookies, etc). I don't know why replacing to + for decrypting, though. His other post explains that php didn't seem to like spaces. No spaces in the test strings -- I'll check for those when/if I can get the core en/decryption working. 2 - Mike is also right about $text = base64_decode($text) which should be $text = base64_decode($text_out) I think. Yup -- that's what i get for trying to do this hastily and late at night -- 3 - You are trimming the results on return, according to one post in the manual notes this will remove null padding on the decrypted string. This is desired, most of the time, but if the original (cleartext message) string ended in nulls you will get a difference and that may be the cause of the errors you are getting. I understand that, thank you. There are no trailing nulls on the original string. After correcting the my program, I still get the same results, about 4% wrong: 70: String: 5214006139804600 -|- Enc: Ϊ%bÇCsšBsìD%Å#z[ä. m…‡¿m§ð -|- Dec:àc8 -|- Nope 75: String: 1034702254251899 -|- Enc: !:Ã2ºÍé×»àe2s? :Ù0LµŒÕ[« -|- Dec:à`*' -|- Nope 89: String: 8245007043826594 -|- Enc: µÆ Íãd-‘Á´E3½yÍ×v‹,ZØWéûqüŽ‚ó -|- Dec:[EMAIL PROTECTED] -|- Nope etc. Wrong: 23/500 Phooey. Ken -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] snmp_set_valueretrieval depends on what?
On 16/01/2008, Per Jessen [EMAIL PROTECTED] wrote: Dotan Cohen wrote: I am experimenting with the snmp_set_valueretrieval function, which does not appear to be documented: http://il.php.net/snmp_set_valueretrieval What does this function depend upon? Simply using it throws this: Fatal error: Call to undefined function snmp_set_valueretrieval() in http://il.php.net/manual/en/ref.snmp.php In order to use the SNMP functions on Unix you need to install the » NET-SNMP package. Now compile PHP --with-snmp[=DIR]. /Per Jessen, Zürich Thanks. I was hoping to avoid a recompile... Dotan Cohen http://what-is-what.com http://gibberish.co.il א-ב-ג-ד-ה-ו-ז-ח-ט-י-ך-כ-ל-ם-מ-ן-נ-ס-ע-ף-פ-ץ-צ-ק-ר-ש-ת A: Because it messes up the order in which people normally read text. Q: Why is top-posting such a bad thing?
Re: [PHP] re[PHP] gister_globals
On Wednesday 16 January 2008 15:33:04 Jochem Maas wrote: tbt schreef: Hi, I'm a newbie to php and i would like to set register_globals to 'on' from my php script itself(eg:- index.php). Is there any way of doing this. you think you would like that. but you are wrong. register_globals is a security risk in the hands of someone who doesn't know exactly what they are doing. besides which register_globals is depreciated. also you can search the list archives for lots of posts that explain why register_globals is evil. learn how to write your script without using register_globals - ask here if you get stuck (but don't forget the manual!). Thanks Hell frezezer over. Me thinks regsiter_globals are evil too. And what about this session_start(); $_SESSION['refString'] = $_GET['refNo']; Sancar -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] utf-8 in $_POST
you don't have to have your files in utf-8 for it to work, just the browser header. although any utf-8 characters in your files will look funky. it just depends where the content comes from... you could always use #174; for the (r) registered symbol for example. i'd be more apt to figuring out how to make things work under utf-8 than trying to force something from utf-8 back to iso-8859-1... personally :) On 1/16/08, Olav Mørkrid [EMAIL PROTECTED] wrote: the user agents in question are various mobile phones, which as you might guess are premature technology and have their own ways with things. here is an example posting from a Samsung D600 which insists on posting form data in UTF-8 even though i serve it ISO-8859-1 and it claims to support all character sets. [_POST] = Array ( [message] = Norwegian characters: øá ) [_SERVER] = Array ( [HTTP_ACCEPT_CHARSET] = * [CONTENT_TYPE] = application/x-www-form-urlencoded; charset=utf-8 [HTTP_USER_AGENT] = SAMSUNG-SGH-D600E/1.0 Profile/MIDP-2.0 Configuration/CLDC-1.1 UP.Browser/6.2.3.3.c.1.101 (GUI) MMP/2.0 ) i would consider switching to utf-8 if i knew how make the windows version of emacs work fine with utf-8 text files (and still work with iso-8859-1 files as well).
Re: [PHP] Encryption failing
On 1/16/08, Ken Kixmoeller -- reply to [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: On Jan 16, 2008, at 1:28 AM, Andrés Robinet wrote: His other post explains that php didn't seem to like spaces. No spaces in the test strings -- I'll check for those when/if I can get the core en/decryption working. See below - I had an issue with a .NET encrypted string in a cookie and decrypting it in PHP. It was required for that. I think it might be due to how .NET does it's base64 encoding; but I've kept it in my code just in case even for pure PHP. Here are my encrypt/decrypt functions. This is -not- the previous .NET/PHP exchange I mentioned. That uses a weaker bit AES due to .NET's defaults function data_encrypt($data) { if(!$data) { return false; } return base64_encode(mcrypt_encrypt(MCRYPT_RIJNDAEL_256, $GLOBALS['config']['salt'], $data, 'cbc', md5($GLOBALS['config'][' salt'].$GLOBALS['config']['salt']))); } function data_decrypt($data) { if(!$data) { return false; } return rtrim(mcrypt_decrypt(MCRYPT_RIJNDAEL_256, $GLOBALS['config']['salt'], base64_decode(str_replace(' ', '+', $data)), ' cbc', md5($GLOBALS['config']['salt'].$GLOBALS['config']['salt']))); } where $config['salt'] in a config file is your random key. make it something worthwhile like haX0r$sUCK! that won't ever be easily guessed. I have code like this running on a couple sites - works like a charm, that includes using it to encrypt cookie data and decrypt it on the way back. I am not entirely sure if the str_replace for the spaces is -required- for a PHP to PHP encryption/decryption, but it doesn't seem to hurt, and I don't believe this should fail for any reason in your tests... The one caveat is I think it is suggested to use the mcrypt_generic() functions now, which I believe meant writing a bunch more lines of code and I liked my single line solution (and I might have had an issue for some reason trying to make it work... I'll probably have to redo this someday either way)
Re: [PHP] New years resolution: To get serious with my programming! Anyone wanna help? :)
On Jan 15, 2008 6:42 PM, Jochem Maas [EMAIL PROTECTED] wrote: funny that, I usually use 'exit;' for a clean exit and 'die();' to signify a shitty exit ... although they are actually indentical functionally - just my idiosyncrasity ... that said I also so stuff like 'exit(1);' when I really want to offer a proper exit code. :-/ [snip!] While I'd be more inclined to believe that die() would be considered more of a function (which is why I continue to write it with the attached parentheses) than a language construct (such as 'exit'), it appears to be nothing more than a matter of semantics in PHP. Whereas Perl, where I was prior to PHP[^1] had noticeable and usable differences between exit and die(). See here: http://perldoc.perl.org/functions/exit.html You can successfully use die without parentheses, which may lead some to believe that it is DEFINITELY not a function but to combat that, you can use any function that doesn't require parameters (i.e. time(), ob_start(), ob_end_clean(), etc.) without parentheses as well, and there will be no errors. An example script to show how loosely PHP code can be written and still work without any errors: ? error_reporting(E_ALL); ob_start; $h = time; // Literally prints 'time' $i = time(); // Shows the current Unix Epoch time $any_errors = ob_get_contents(); // Required, otherwise will be literal 'ob_get_contents' ob_end_clean; echo($h.\n.$i.\n); // echo is a construct, but as expected, can use parentheses() echo $any_errors.\n; // Just in case there were errors in the buffer (there aren't) die; // So in any case, whether function or construct, no parentheses are required here. ? Footnotes: 1: I met a 'programmer' last night who had 'many years of experience', who was a kid who looked like he just started college and got his first 'puter. He must've been 13373R than me, because he argued with me for about 15 minutes that the languages themselves are pronounced literally FIPP (PHP), asp (ASP), gypsie (JSP - yeah, I know), and so on. He argued to the point that he was calling me profane names (while I laughed) as he said he has worked with the 'companies' that made the language. When asked who created the 'FIPP' language, he told me it was made by the Linux Corporation. I'm not exaggerating, I had to run to the bathroom because I was literally on the verge of pissing myself. -- /Dan Daniel P. Brown Senior Unix Geek and #1 Rated Year's Coolest Guy By Self Since Nineteen-Seventy-[mumble]. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How to take video embed codes and change all their widths/heights?
On Jan 15, 2008 6:37 PM, Jochem Maas [EMAIL PROTECTED] wrote: Daniel Brown schreef: .. $embed_code = preg_replace('/height=([0-9]*)/U','height='.$height.'',preg_replace('/width=([0-9]*)/U','width='.$width.'',$embed_code)); I wouldn't have given him the complete regexp - how will they ever learn. :-) Right, but for something that simple, I don't see the harm in pointing in the proper direction. If someone can learn faster than I was able to teach myself by my helping them, everyone benefits. BUT $embed_code = preg_replace( array('/height=([0-9]*)/U', '/width=([0-9]*)/U') array('height='.$height.'', 'width='.$width.''), $embed_code); i.e. save the nested calls to preg_replace() Mine may look like a run-on sentence, but there's also less parsing and processing involved. Fewer cycles lead to faster scripts. (Even if yours DOES look nicer ;-P) when's the last time you read the manual man-with-really-long-name? :-P I have to admit, Jochem, I don't get it. My name is one of the shortest and plainest on the list (Dan Brown) zip me a message off-list so that I don't feel as though I'm missing out on a joke. I'm guessing I'm just not processing very well this morning. -- /Dan Daniel P. Brown Senior Unix Geek and #1 Rated Year's Coolest Guy By Self Since Nineteen-Seventy-[mumble]. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] changing the ini from a file
I'm using .htaccess to do php_value auto_prepend_file auth.php The problem is that there are very specific files that I want to be able to NOT run that in. I guess I could just move them to a directory and use .htaccess to perform a php_value auto_prepend_file But I was hoping to not have to make a separate folder for that. Anyone encoutered being able to change/disable the setting on the fly in a specific file? Thanks! Wolf -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] changing the ini from a file
On Jan 16, 2008 11:10 AM, Wolf [EMAIL PROTECTED] wrote: I'm using .htaccess to do php_value auto_prepend_file auth.php The problem is that there are very specific files that I want to be able to NOT run that in. I guess I could just move them to a directory and use .htaccess to perform a php_value auto_prepend_file But I was hoping to not have to make a separate folder for that. Anyone encoutered being able to change/disable the setting on the fly in a specific file? At that point, wouldn't it be just as easy to ? require('auth.php'); ? as the first line of each file you want it in, and omit the line in those you don't? Or are there a lot of files? -- /Dan Daniel P. Brown Senior Unix Geek and #1 Rated Year's Coolest Guy By Self Since Nineteen-Seventy-[mumble]. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] changing the ini from a file
Daniel Brown [EMAIL PROTECTED] wrote: On Jan 16, 2008 11:10 AM, Wolf [EMAIL PROTECTED] wrote: I'm using .htaccess to do php_value auto_prepend_file auth.php The problem is that there are very specific files that I want to be able to NOT run that in. I guess I could just move them to a directory and use .htaccess to perform a php_value auto_prepend_file But I was hoping to not have to make a separate folder for that. Anyone encoutered being able to change/disable the setting on the fly in a specific file? At that point, wouldn't it be just as easy to ? require('auth.php'); ? as the first line of each file you want it in, and omit the line in those you don't? Or are there a lot of files? -- LOTS of files, hence wanting to do it sporadic, mostly just for diagnostic pages. I can always just drop them and use the .htaccess to disable the prepend for that folder/files but was wondering if I could do it on the fly. Seems like the prepend can't but figured I would check with the folks here before I completely gave up. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] changing the ini from a file
On Jan 16, 2008 11:33 AM, Wolf [EMAIL PROTECTED] wrote: Daniel Brown [EMAIL PROTECTED] wrote: [snip] At that point, wouldn't it be just as easy to ? require('auth.php'); ? as the first line of each file you want it in, and omit the line in those you don't? Or are there a lot of files? -- LOTS of files, hence wanting to do it sporadic, mostly just for diagnostic pages. I can always just drop them and use the .htaccess to disable the prepend for that folder/files but was wondering if I could do it on the fly. Seems like the prepend can't but figured I would check with the folks here before I completely gave up. If it's strictly for testing purposes, you could use a switch to include a file. This is NOT SAFE, and NOT SANITIZED, so read it as a DISCLAIMER: NOT FOR PRODUCTION USE. Just to get that out of the way for the lawyers out there. Not clean, not pretty, not anything more than a hack job. Maybe a suggestion that could lead you to a better idea though. ? $prepend_to = array( 'file1.php', 'file7.php', 'file12.php', 'file14.php', 'file46.php', 'file134.php'); if($_GET['incfile']) { if(in_array($_GET['incfile'],$prepend_to)) { include('auth.php'); } include($incfile); } ? -- /Dan Daniel P. Brown Senior Unix Geek and #1 Rated Year's Coolest Guy By Self Since Nineteen-Seventy-[mumble]. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] New years resolution: To get serious with my programming! Anyone wanna help? :)
Daniel Brown wrote: On Jan 15, 2008 6:42 PM, Jochem Maas [EMAIL PROTECTED] wrote: funny that, I usually use 'exit;' for a clean exit and 'die();' to signify a shitty exit ... although they are actually indentical functionally - just my idiosyncrasity ... that said I also so stuff like 'exit(1);' when I really want to offer a proper exit code. :-/ [snip!] While I'd be more inclined to believe that die() would be considered more of a function (which is why I continue to write it with the attached parentheses) than a language construct (such as 'exit'), it appears to be nothing more than a matter of semantics in PHP. I saw questioning whether die() was a really function or not, as metaphorical joke on the metaphysical. Maybe I'm just weird. Other discussion re: globals-on has me thinking about an element of coding on a client site I haven't reviewed lately, a move to OOP seems indicated. Is that the usual method to avoid that or is that just one of several methods? Ulex (channeling an English teacher who said That that is that that that was technically correct in English but she wouldn't explain it to the class at the time. It was high school, many years ago.) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] changing the ini from a file
Wolf wrote: I'm using .htaccess to do php_value auto_prepend_file auth.php The problem is that there are very specific files that I want to be able to NOT run that in. I guess I could just move them to a directory and use .htaccess to perform a php_value auto_prepend_file But I was hoping to not have to make a separate folder for that. Anyone encoutered being able to change/disable the setting on the fly in a specific file? Thanks! Wolf Just had an interesting way of solving this problem come to mind. I would like others to way in on this. You can do this completely from within apache. For the pages that you want to have auth.php included with, give them and extension of .phtml or something else... Then, configure apache to allow php to process those like this AddType application/x-httpd-php .php AddType application/x-httpd-php .phtml then in apache, could be in httpd.conf or .htaccess have something like this. Files .phtml php_value auto_prepend_file auth.php /Files When finished, restart apache and you should be good to go. I would try something like this. Should work, others might have better ideas. -- Jim Lucas Some men are born to greatness, some achieve greatness, and some have greatness thrust upon them. Twelfth Night, Act II, Scene V by William Shakespeare -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] changing the ini from a file
Jim Lucas wrote: Wolf wrote: I'm using .htaccess to do php_value auto_prepend_file auth.php The problem is that there are very specific files that I want to be able to NOT run that in. I guess I could just move them to a directory and use .htaccess to perform a php_value auto_prepend_file But I was hoping to not have to make a separate folder for that. Anyone encoutered being able to change/disable the setting on the fly in a specific file? Thanks! Wolf Just had an interesting way of solving this problem come to mind. I would like others to way in on this. You can do this completely from within apache. For the pages that you want to have auth.php included with, give them and extension of .phtml or something else... Then, configure apache to allow php to process those like this AddType application/x-httpd-php .php AddType application/x-httpd-php .phtml then in apache, could be in httpd.conf or .htaccess have something like this. Files .phtml php_value auto_prepend_file auth.php /Files When finished, restart apache and you should be good to go. I would try something like this. Should work, others might have better ideas. Now that I am looking at this a second time. Couldn't all this apache stuff be done in the .htaccess file? Just place all the following in a .htaccess file, then change the extension on the file(s) that you want to have work this way. I don't think you need to touch the httpd.conf file at all. AddType application/x-httpd-php .php AddType application/x-httpd-php .phtml Files .phtml php_value auto_prepend_file auth.php /Files -- Jim Lucas Some men are born to greatness, some achieve greatness, and some have greatness thrust upon them. Twelfth Night, Act II, Scene V by William Shakespeare -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] changing the ini from a file
Daniel Brown [EMAIL PROTECTED] wrote: On Jan 16, 2008 11:33 AM, Wolf [EMAIL PROTECTED] wrote: Daniel Brown [EMAIL PROTECTED] wrote: [snip] At that point, wouldn't it be just as easy to ? require('auth.php'); ? as the first line of each file you want it in, and omit the line in those you don't? Or are there a lot of files? -- LOTS of files, hence wanting to do it sporadic, mostly just for diagnostic pages. I can always just drop them and use the .htaccess to disable the prepend for that folder/files but was wondering if I could do it on the fly. Seems like the prepend can't but figured I would check with the folks here before I completely gave up. If it's strictly for testing purposes, you could use a switch to include a file. This is NOT SAFE, and NOT SANITIZED, so read it as a DISCLAIMER: NOT FOR PRODUCTION USE. Just to get that out of the way for the lawyers out there. Not clean, not pretty, not anything more than a hack job. Maybe a suggestion that could lead you to a better idea though. !-- SNIP! -- I'm trying to NOT prepend the file, not have to modify every other file out there. I'd use other includes if that was the case, but I don't need them, so it's more along the lines of disabling something preset for the site for a few files. Wolf -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Encryption failing
Many thanks, Mike --- yours works great... 0 errors. On Jan 16, 2008, at 9:24 AM, mike wrote: function data_encrypt($data) { if(!$data) { return false; } return base64_encode(mcrypt_encrypt(MCRYPT_RIJNDAEL_256, $GLOBALS['config']['salt'], $data, 'cbc', md5($GLOBALS['config'][' salt'].$GLOBALS['config']['salt']))); } function data_decrypt($data) { if(!$data) { return false; } return rtrim(mcrypt_decrypt(MCRYPT_RIJNDAEL_256, $GLOBALS['config']['salt'], base64_decode(str_replace(' ', '+', $data)), ' cbc', md5($GLOBALS['config']['salt'].$GLOBALS['config']['salt']))); } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] changing the ini from a file
On Jan 16, 2008 12:02 PM, Jim Lucas [EMAIL PROTECTED] wrote: Jim Lucas wrote: Wolf wrote: I'm using .htaccess to do php_value auto_prepend_file auth.php The problem is that there are very specific files that I want to be able to NOT run that in. I guess I could just move them to a directory and use .htaccess to perform a php_value auto_prepend_file But I was hoping to not have to make a separate folder for that. Anyone encoutered being able to change/disable the setting on the fly in a specific file? Thanks! Wolf Just had an interesting way of solving this problem come to mind. I would like others to way in on this. You can do this completely from within apache. For the pages that you want to have auth.php included with, give them and extension of .phtml or something else... Then, configure apache to allow php to process those like this AddType application/x-httpd-php .php AddType application/x-httpd-php .phtml then in apache, could be in httpd.conf or .htaccess have something like this. Files .phtml php_value auto_prepend_file auth.php /Files When finished, restart apache and you should be good to go. I would try something like this. Should work, others might have better ideas. Now that I am looking at this a second time. Couldn't all this apache stuff be done in the .htaccess file? Just place all the following in a .htaccess file, then change the extension on the file(s) that you want to have work this way. I don't think you need to touch the httpd.conf file at all. AddType application/x-httpd-php .php AddType application/x-httpd-php .phtml Files .phtml php_value auto_prepend_file auth.php /Files Then all of the links or includes would have to be updated to handle the .phtml extension change, too. Good idea, but it sounds to be like what he's asking unfortunately just isn't possible without some form of major overhaul. -- /Dan Daniel P. Brown Senior Unix Geek and #1 Rated Year's Coolest Guy By Self Since Nineteen-Seventy-[mumble]. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] changing the ini from a file
Jim Lucas [EMAIL PROTECTED] wrote: Jim Lucas wrote: Wolf wrote: I'm using .htaccess to do php_value auto_prepend_file auth.php The problem is that there are very specific files that I want to be able to NOT run that in. I guess I could just move them to a directory and use .htaccess to perform a php_value auto_prepend_file But I was hoping to not have to make a separate folder for that. Anyone encoutered being able to change/disable the setting on the fly in a specific file? Thanks! Wolf Just had an interesting way of solving this problem come to mind. I would like others to way in on this. You can do this completely from within apache. !-- snip -- I love the idea and I might reverse it to handle the case of NOT prepending the file... That or I'll just make a clean/diag directory, then put a .htaccess file in the folder and use it to remove the prepend... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] XAdES in PHP
Thanks for your responses I think I will start a project for PHP with the implementation of a library for signatures Of course, with XAdES, XMLDSig will be covered... Now I have to learn XAdES specifications, a splendid activity ;-) stay tuned... ;-) -- Pierre PINTARIC SICTIAM Porte 15 Space Antipolis 3 2323, chemin Saint Bernard 06225 Vallauris Tel : 04 92 96 80 83 Fax : 04 92 96 92 96 http://www.sictiam.fr/ Paul Scott a écrit : On Mon, 2008-01-14 at 10:59 -0600, Richard Lynch wrote: After a quick Google to find out what the Hades is XAdES, I'd suggest you look for a C implementation and link it in as an extension. There are a couple of implementations of XMLDSIG in PHP that I have seen, although none really up to scratch IMO. You could try one of those (I think there is a pretty decent Python implementation as a starting point) and fix it up and extend that. --Paul All Email originating from UWC is covered by disclaimer http://www.uwc.ac.za/portal/public/portal_services/disclaimer.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] changing the ini from a file
Personally, I would find it confusing to have settings in httpd.conf with different file suffixes controlling whether or not any given application file included the auth.inc file... Even doing it in .htaccess with Files seems a bit hackish. Turning auto_prepend on/off seems reasonable. But I'd still just go with editing the files to do require 'auth.inc' and be done with it. You can almost for sure figure out an awk script to put it into the top of every file, and then hand-edit however many should NOT have it. -- Some people have a gift link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] snmp_set_valueretrieval depends on what?
On Wed, January 16, 2008 7:34 am, Dotan Cohen wrote: I am experimenting with the snmp_set_valueretrieval function, which does not appear to be documented: http://il.php.net/snmp_set_valueretrieval What does this function depend upon? Simply using it throws this: Fatal error: Call to undefined function snmp_set_valueretrieval() in I'm on a debian-based system (Ubuntu), so if there is a deb package that provides the proper libs I'd appreciate knowing about it. This is my build info: $ php -v PHP 5.2.1 (cli) (built: Nov 28 2007 23:14:55) You can check at http://xlr.php.net but I suspect that it's too new to be in your version of PHP. You are on 5.2.1 and php.net is offering 5.2.5, so you're just enough behind for this to be very plausible. Maybe get Ubuntu to catch up? :-) -- Some people have a gift link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Scripts are fast locally, but slow on remote server
Are you relying on autoload or anything of that nature to load in class files, perhaps? On Wed, January 16, 2008 1:02 am, Dave M G wrote: PHP list, I have a set of PHP scripts that seem to be efficient and quick enough both on my home testing environment, and a few different web-hosting services I use. However, on one particular web-hosting service, there is often a very painful 10 second (!) lag when first loading up the scripts. This long lag time can sometimes be manifest not just on the first page loaded, but the second and maybe third as well. But then after the first initial pages are loaded, the site seems to speed up to what I would consider normal download pages for times. There are some pages on the site that are not driven by these PHP scripts, and they load up very quickly, indicating that only my PHP scripts are affected. So the problem seems to be, as far as I can tell, that something about my PHP scripts is combining with some setting of this one web-hosting server to create some kind of slowdown. Is there any way I can diagnose a situation like this to get to the root of the problem? Perhaps there are common discrepancies between server settings that I can look out for? Any advice would be much appreciated. Thank you. -- Dave M G Articlass - open source CMS http://articlass.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Some people have a gift link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Scripts are fast locally, but slow on remote server
On Wed, January 16, 2008 1:29 am, Dave M G wrote: Per Jessen, Thank you for responding. Might this be a name-server issue? Maybe, but I don't think so. The reason I suspect that is not the case is because I can go first to a .html page on the server, and it loads up quickly. Then I go to one of my .php pages, and the slowdown occurs. If it were a name server issue, I would expect the slowdown to happen regardless of which page I load first. So, I guess to be more specific, the slowdown happens the first time I load one of my PHP scripts on this site, not the first time I access the site. Try it with just this in a .php file: ?php phpinfo();? Is *that* slow the first time? Also try it with: ?php echo Hello World!? Is that slow the first time? -- Some people have a gift link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Don't search for domains on Network Solutions...
... otherwise this will happen: erics:~/Sites eric$ /opt/php5/bin/php networksolutions.php Starting at 01/16/2008 12:36pm.Result: ...snip... Your Domain Name Search Results Congratulations! The following domains are available eric-butera-for-php-general Then a few minutes later: erics:~ eric$ whois eric-butera-for-php-general.com ...snip... Domain Name: ERIC-BUTERA-FOR-PHP-GENERAL.COM Registrar: NETWORK SOLUTIONS, LLC. Whois Server: whois.networksolutions.com Referral URL: http://www.networksolutions.com Name Server: NS1.RESERVEDDOMAINNAME.COM Name Server: NS2.RESERVEDDOMAINNAME.COM Status: clientHold Updated Date: 16-jan-2008 Creation Date: 16-jan-2008 Expiration Date: 16-jan-2009 networksolutions.php: ?php printf(Starting at %s., date('m/d/Y h:ia')); $url= 'http://www.networksolutions.com/domainSearch.do'; $values = array( 'domainNames' = 'eric-butera-for-php-general', 'method-submit.x' = '', 'method-submit.y' = '', 'Search' = '/domain-name-registration/domain-name-search-results.jsp', 'allowBulk' = 'false', 'currentPage' = '/home.jsp?layoutIdIndex=0', 'formTargetPage' = '/domain-name-registration/index.jsp' ); // semi-borrowed from Ojas Ojasvi php.net/curl because my vanilla post was rejected $header[] = Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5; $header[] = Cache-Control: max-age=0; $header[] = Connection: keep-alive; $header[] = Keep-Alive: 300; $header[] = Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7; $header[] = Accept-Language: en-us,en;q=0.5; $header[] = Pragma: ; $c = curl_init(); curl_setopt($c, CURLOPT_HTTPHEADER, $header); curl_setopt($c, CURLOPT_REFERER, 'http://www.networksolutions.com'); curl_setopt($c, CURLOPT_USERAGENT, 'Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.8.1.11) Gecko/20071127 Firefox/2.0.0.11'); curl_setopt($c, CURLOPT_POST, true); curl_setopt($c, CURLOPT_POSTFIELDS, $values); curl_setopt($c, CURLOPT_URL, $url); curl_setopt($c, CURLOPT_RETURNTRANSFER, true); curl_setopt($c, CURLOPT_FOLLOWLOCATION, true); echo Result:\n; echo curl_exec($c); -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] green bean question on singleton php5
Hi, I am implementing this class dbaccess{ static $db=null; static $othervar=33; private function dbaccess(){ dbaccess::$db= new mysqli(localhost,USER,PASSWD,DB); if(mysqli_connect_errno()){ echo no way; } } public static function GetDb(){ if(dbaccess::$db==null){ dbaccess::$db= new dbaccess(); } return dbaccess::$db; } } $db=dbaccess::GetDE(); $db-query(..); will fail...with Call to undefined method dbaccess::query() apparently $db is of type dbaccess... and thus has not does not have query implemented any hhelp appreciated. JCG -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Word Wrap on highlight_file
On 16/01/2008, Jochem Maas [EMAIL PROTECTED] wrote: Tom Chubb schreef: Can anyone tell me how to wrap the results of highlight_file so it doesn't mess up the size of my table div? use CSS to control the visual display in the browser. not to mention that 'table div' doesn't make much sense as a concept. probably you'll want to do something with the CSS property 'overflow'. I tried the following and doesn't work! if ($ext == phps) { $showcode = highlight_file($pathtoscripts . $_GET['file']); you are not santizing the request data, you need to be doing something like the following (maybe someone else can check my example and offer even better sanitizing code?): $file = basename($_GET['file']); if (!$file) die('nice try'); $ext = explode('.', $file); $ext = array_pop($ext); if ($ext != 'phps') die('nice try'); $file = $pathtoscripts . basename($_GET['file']); if (is_dir($file) || !is_readable($file)) die('nice try'); echo wordwrap($showcode, 70);x } else { echo Nice try, but you are not authorised to view the source of files with a $ext extension! ;)\n; } Thanks, Tom Jochem, Thanks for that. So presumably it's not possible to do it in PHP? Haven't come across array_pop before - that's much quicker than what I was doing before. Thanks :) And thanks for the pointers about sanitizing. That was my next step! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] re[PHP] gister_globals
On Wed, January 16, 2008 12:21 am, tbt wrote: I'm a newbie to php and i would like to set register_globals to 'on' from my php script itself(eg:- index.php). Is there any way of doing this. You can't turn it on really, because by the time your PHP script is running and trying to turn it on, it's too late for the built-in routines to globalize everything -- They have already opted not to run because it was off (as it should be). You could use extract($_REQUEST); which amounts the same thing, however, cramming all the $_REQUEST variables into your PHP script. THIS IS A BAD IDEA!!! There is a *REASON* why register_globals got turned OFF! You should do this ONLY for legacy code that cannot be fixed, and with a clear path to STOP doing it ASAP. You also could turn it on in .htaccess for a single directory tree, which would be more common. -- Some people have a gift link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: re[PHP] gister_globals
Stop using session_register, and start using: $_SESSION['refString'] = $_GET['refNo']; And, actually, you should do something more like this: $refNo = (int) $_GET['refNo']; //sanitize input $_SESSION['refString'] = $refNo; The MORE specific you can be about what is a VALID $refNo, in place of the (int) typecast, the better. On Wed, January 16, 2008 1:20 am, tbt wrote: Hi I have two php files as follows session_register.php // sets the value of $refString ?php session_start(); session_register(refString); $refString = $_GET['refNo']; ? and session_data.php // retrieves the value of $refString ?php session_start(); echo $refString; ? This code works fine when register_globals is set to 'on'. But the hosting site has set it to 'off' and I have no way of adding a .htaccess file. Is there anyway to modify my php files so that it works correctly when register_globals is set to 'off'. I only need the value of the variable $refString accessible from all the php files. Thanks tbt wrote: Hi, I'm a newbie to php and i would like to set register_globals to 'on' from my php script itself(eg:- index.php). Is there any way of doing this. Thanks -- View this message in context: http://www.nabble.com/register_globals-tp14868899p14871630.html Sent from the PHP - General mailing list archive at Nabble.com. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Some people have a gift link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] green bean question on singleton php5
On Jan 16, 2008 12:57 PM, julian [EMAIL PROTECTED] wrote: Hi, I am implementing this class dbaccess{ static $db=null; static $othervar=33; private function dbaccess(){ dbaccess::$db= new mysqli(localhost,USER,PASSWD,DB); if(mysqli_connect_errno()){ echo no way; } } public static function GetDb(){ if(dbaccess::$db==null){ dbaccess::$db= new dbaccess(); } return dbaccess::$db; } } $db=dbaccess::GetDE(); $db-query(..); will fail...with Call to undefined method dbaccess::query() apparently $db is of type dbaccess... and thus has not does not have query implemented any hhelp appreciated. JCG -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Try changing dbaccess to self inside the class. Look at this: http://us.php.net/manual/en/language.oop5.patterns.php Example#2 Singleton Function -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] (SOLVED) /etc/php.init changes not honored
All, The problem turned out to be selinux. With the newest version of RH, a new security model has been implemented. Instead of doing Discretionary Access Control (DAC, conventional rwx permissions) RH implements selinux which uses Mandatory Access Control (MAC, enhanced permissions using contexts). The /etc/php.ini file on the development box didn't have correct MAC permissions. I restored them to the correct context and apache is now reading the /etc/php.ini file. Steps below: #To restore the selinux configuration on a file. 1. check the permissions [EMAIL PROTECTED] etc]$ sudo getfattr -m . -d php.ini Password: # file: php.ini security.selinux=user_u:object_r:etc_t:s0\000 2. Create a file with the right permissions / context. [EMAIL PROTECTED] etc]$ cat /home/admmadis/setme # file: php.ini security.selinux=system_u:object_r:etc_t:s0\000 3. Restore the context of the file. [EMAIL PROTECTED] etc]$ sudo setfattr --restore=/home/ryan/setme 4. look again to test. [EMAIL PROTECTED] etc]$ getfattr -m . -d php.ini # file: php.ini security.selinux=system_u:object_r:etc_t:s0\000 5. restart apache... -Thanks for everyone's help!! -Original Message- From: Richard Lynch [mailto:[EMAIL PROTECTED] Sent: Monday, January 14, 2008 10:43 AM To: Ryan H. Madison Cc: php-general@lists.php.net Subject: Re: [PHP] /etc/php.init changes not honored In phpinfo() output, PHP tells you where it is looking for its php.ini file. If you aren't changing a php.ini file in that location, then PHP isn't going to see it... On Thu, January 10, 2008 4:59 pm, Ryan H. Madison wrote: Hello, I am trying to increase upload_max_filesize beyond the 2M limit. I've set this in my /etc/php.ini file, but every time I look at the output of phpinfo(); the changes I make in /etc/php.init don't seem to be honored. This isn't limited to upload_max_filesize, I've changed the Engine safe_mode values, but these don't seem to make any difference either. I've looked in the /etc/php.d directory, and those files only reference other libraries. I've even removed the /etc/php.ini file which doesn't seem to make a difference. What am I missing? -Thanks, RYAN I'm running a default installation of CentOS 5. [EMAIL PROTECTED] etc]$ cat /etc/redhat-release CentOS release 5 (Final) [EMAIL PROTECTED] etc]$ rpm -qa | grep php php-5.1.6-5.el5 php-pdo-5.1.6-5.el5 php-pear-1.4.9-4 php-common-5.1.6-5.el5 php-cli-5.1.6-5.el5 php-mysql-5.1.6-5.el5 [EMAIL PROTECTED] etc]$ rpm -qa | grep httpd httpd-2.2.3-6.el5.centos.1 httpd-manual-2.2.3-6.el5.centos.1 [EMAIL PROTECTED] etc]$ Ryan Madison Senior Systems Administrator, UNIX Services Internet Services and Servers Department of Information Technology State of Nevada p. 775.684.4313 f. 775.684.4324 e. [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] w. http://sug.state.nv.us http://sug.state.nv.us/ P Please consider the environment before printing this email. This communication, including any attachments, may contain confidential information and is intended only for the individual or entity to it is addressed. Any review, dissemination or copying of this communication by anyone other than the intended recipient is strictly prohibited. If you are not the intended recipient, please contact the sender by reply e-Mail and delete all copies of the original message. -- Some people have a gift link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: [QUESTION] MAIL: Send a NOOP instead of DATA
On Tue, January 15, 2008 11:03 pm, Manuel Lemos wrote: Hello, on 01/16/2008 02:11 AM mike said the following: Why not look at phpmailer? Probably more robust than some random classes. I did not suggest any random classes. I developed those classes since 1999 and I know they work reliably because they are used by me and tens of thousands of users that have downloaded the classes from the site. If you have not used these classes, I do not understand why you need to make assertions about their robustness, unless your only purpose was to put down my work. Does it bother you by the fact that I suggest that people use my classes to solve their problems? E. *I* read the first paragraph to refer to the OP's reinvent-the-wheel classes, *NOT* yours. Lighten up. :-) -- Some people have a gift link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: green bean question on singleton php5
julian wrote: Hi, I am implementing this class dbaccess{ static $db=null; static $othervar=33; private function dbaccess(){ dbaccess::$db= new mysqli(localhost,USER,PASSWD,DB); if(mysqli_connect_errno()){ echo no way; } } public static function GetDb(){ if(dbaccess::$db==null){ dbaccess::$db= new dbaccess(); } return dbaccess::$db; } } $db=dbaccess::GetDE(); $db-query(..); will fail...with Call to undefined method dbaccess::query() apparently $db is of type dbaccess... and thus has not does not have query implemented any hhelp appreciated. That's not technically a singletron. A singltron is a class of which only one instance is permitted. Here you are trying to mysqli object. You have two options here. I'll let you take your pick: 1. extend mysqli class dbaccess extends mysqli { private function __construct { parent::__construct(localhost,USER,PASSWD,DB); if (mysqli_connect_errno()){ throw Exception('No Way'); } } public static function GetDb(){ static $obj = false; if (false === $obj) { $obj = new dbaccess(); } return $obj } } Or 2. Just create an accessor class class dbaccess { public static function GetDb(){ static $obj = false; if (false === $obj) { $obj = new mysqli(localhost,USER,PASSWD,DB); if (mysqli_connect_errno()){ return false; } } return $obj } } You call them essentially the same way, but the first one has to use an exception as the errors are detected in the constructor this will return an object of type dbaccess (which in turn is an extension of mysqli). The second is just a static function wrapped in a class (and could be implemented as a normal function if you prefer - there is no need for a class really). It will return an object of type mysqli. Apologies if there are typos or thinkos as I've not run the above. Col -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] green bean question on singleton php5
On Jan 16, 2008 12:57 PM, julian [EMAIL PROTECTED] wrote: Hi, I am implementing this [snip!] I'm heading out to lunch, so double-check this for errors, but I rewrote your class. You'll have to add your fetch handlers and such. ? class dbaccess{ static $db = null; static $conn = null; static $query = null; static $othervar = 33; private function self(){ dbaccess::$conn = new mysqli(HOST,DBNAME,PASS,USERNAME); if(mysqli_connect_errno()){ return False; } else { return dbaccess::$conn; } } public function query($query){ dbaccess::$query = mysqli_query(dbaccess::self(),$query); return dbaccess::$query; } public static function GetDb(){ if(dbaccess::$db==null){ dbaccess::$db= new dbaccess(); } return dbaccess::$db; } } $db=dbaccess::GetDb(); $db-query(..); // Your query here. ? -- /Dan Daniel P. Brown Senior Unix Geek and #1 Rated Year's Coolest Guy By Self Since Nineteen-Seventy-[mumble]. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Don't search for domains on Network Solutions...
-Original Message- From: Eric Butera [mailto:[EMAIL PROTECTED] Sent: Wednesday, January 16, 2008 2:57 PM To: php php Subject: [PHP] Don't search for domains on Network Solutions... ... otherwise this will happen: erics:~/Sites eric$ /opt/php5/bin/php networksolutions.php Starting at 01/16/2008 12:36pm.Result: ...snip... Your Domain Name Search Results Congratulations! The following domains are available eric-butera-for-php-general Then a few minutes later: erics:~ eric$ whois eric-butera-for-php-general.com ...snip... Domain Name: ERIC-BUTERA-FOR-PHP-GENERAL.COM Registrar: NETWORK SOLUTIONS, LLC. Whois Server: whois.networksolutions.com Referral URL: http://www.networksolutions.com Name Server: NS1.RESERVEDDOMAINNAME.COM Name Server: NS2.RESERVEDDOMAINNAME.COM Status: clientHold Updated Date: 16-jan-2008 Creation Date: 16-jan-2008 Expiration Date: 16-jan-2009 networksolutions.php: ?php printf(Starting at %s., date('m/d/Y h:ia')); $url= 'http://www.networksolutions.com/domainSearch.do'; $values = array( 'domainNames' = 'eric-butera-for-php-general', 'method-submit.x' = '', 'method-submit.y' = '', 'Search' = '/domain-name-registration/domain-name-search-results.jsp', 'allowBulk' = 'false', 'currentPage' = '/home.jsp?layoutIdIndex=0', 'formTargetPage' = '/domain-name-registration/index.jsp' ); // semi-borrowed from Ojas Ojasvi php.net/curl because my vanilla post was rejected $header[] = Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/pla in;q=0.8,image/png,*/*;q=0.5; $header[] = Cache-Control: max-age=0; $header[] = Connection: keep-alive; $header[] = Keep-Alive: 300; $header[] = Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7; $header[] = Accept-Language: en-us,en;q=0.5; $header[] = Pragma: ; $c = curl_init(); curl_setopt($c, CURLOPT_HTTPHEADER, $header); curl_setopt($c, CURLOPT_REFERER, 'http://www.networksolutions.com'); curl_setopt($c, CURLOPT_USERAGENT, 'Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.8.1.11) Gecko/20071127 Firefox/2.0.0.11'); curl_setopt($c, CURLOPT_POST, true); curl_setopt($c, CURLOPT_POSTFIELDS, $values); curl_setopt($c, CURLOPT_URL, $url); curl_setopt($c, CURLOPT_RETURNTRANSFER, true); curl_setopt($c, CURLOPT_FOLLOWLOCATION, true); echo Result:\n; echo curl_exec($c); A couple of days ago I've come across this: http://www.seomoz.org/blog/network-solutions-exploits-icanns-fiveday-refund- rule-to-hoard-domains So... I don't even think that network solutions is the only one doing it. I know this is not strictly related to PHP, but I thought it would be a good idea to throw the warning. I think this is I-CANN's fault. Regards, Rob Andrés Robinet | Lead Developer | BESTPLACE CORPORATION 5100 Bayview Drive 206, Royal Lauderdale Landings, Fort Lauderdale, FL 33308 | TEL 954-607-4207 | FAX 954-337-2695 Email: [EMAIL PROTECTED] | MSN Chat: [EMAIL PROTECTED] | SKYPE: bestplace | Web: http://www.bestplace.biz | Web: http://www.seo-diy.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] QNX build
-Original Message- From: Richard [mailto:[EMAIL PROTECTED] Sent: Wednesday, January 16, 2008 12:48 PM To: php-general@lists.php.net Subject: [PHP] QNX build Hi, After installing PHP on a Windows machine I see a very small PHP-executable and several extension dll's that can be loaded. When I build PHP on a QNX machine I get one huge executable of 8.6 MB. Is it possible to build something similar to the Windows version? Regards, Richard -- Hi Richard, I have no clue on the QNX OS or the QNX programming environment, but maybe you can move some PECL extensions out of the PHP core by compiling them as shared extensions instead of compiling them statically into PHP http://ar.php.net/manual/en/install.pecl.php. Regards, Rob -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] green bean question on singleton php5
but that forces me to implement a large interface of functions that I prefer to avoid... the $dummy thing works... but I guess it is not by the book. I would like to understand what am I missing fom the concept Thanks. JCG Daniel Brown wrote: On Jan 16, 2008 12:57 PM, julian [EMAIL PROTECTED] wrote: Hi, I am implementing this [snip!] I'm heading out to lunch, so double-check this for errors, but I rewrote your class. You'll have to add your fetch handlers and such. ? class dbaccess{ static $db = null; static $conn = null; static $query = null; static $othervar = 33; private function self(){ dbaccess::$conn = new mysqli(HOST,DBNAME,PASS,USERNAME); if(mysqli_connect_errno()){ return False; } else { return dbaccess::$conn; } } public function query($query){ dbaccess::$query = mysqli_query(dbaccess::self(),$query); return dbaccess::$query; } public static function GetDb(){ if(dbaccess::$db==null){ dbaccess::$db= new dbaccess(); } return dbaccess::$db; } } $db=dbaccess::GetDb(); $db-query(..); // Your query here. ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] green bean question on singleton php5
nope... only works if I change $dummy= new dbaccess(); and keep the rest . Thanks. ... hope it does not repeat... got undelivered... Eric Butera wrote: On Jan 16, 2008 12:57 PM, julian [EMAIL PROTECTED] wrote: Hi, I am implementing this class dbaccess{ static $db=null; static $othervar=33; private function dbaccess(){ dbaccess::$db= new mysqli(localhost,USER,PASSWD,DB); if(mysqli_connect_errno()){ echo no way; } } public static function GetDb(){ if(dbaccess::$db==null){ dbaccess::$db= new dbaccess(); } return dbaccess::$db; } } $db=dbaccess::GetDE(); $db-query(..); will fail...with Call to undefined method dbaccess::query() apparently $db is of type dbaccess... and thus has not does not have query implemented any hhelp appreciated. JCG -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Try changing dbaccess to self inside the class. Look at this: http://us.php.net/manual/en/language.oop5.patterns.php Example#2 Singleton Function -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] green bean question on singleton php5
to all who have posted classes w/ the singleton instance as a public static; this is not good. the singleton instance should be stored in a private static variable. why? because, otherwise client code can just access the value directly, and even unset the instance; which sort of defeats the purpose of singleton. -nathan
Re: [PHP] SMTP vs mail()
You can easily make a mail queue in php yourself with a daemon that checks the queue and sends waiting mail in batches of say 200 per minute. (provided you have access to the cli on the server) Black http://rssphp.net a85020316bb687648d6f73c4eb3bec93 :msg::id Chris wrote: Manuel Lemos wrote: Hello, on 01/15/2008 07:16 AM Per Jessen said the following: If there's any way to re-configure the MTA to queue the messages for later sending, that would save you a lot of overhead on the PHP end... The MTA will always queue the messages - well, that is certainly the case for postfix. qmail too. Sendmail can be configured to just queue the messages too but that is not its default configuration. This is all getting way OT for php. All except exim will queue the message AND have a process that looks at the queue at the same time. exim has an option called 'queue_only' which then tells it to just store the message and there is no process trying to actually send the emails until it hits another option which tells it when to run the queue. If you run 'mailq' (or qmail-qstat) while you are sending lots of emails, the numbers and emails will change as emails are incoming and outgoing at the same time. You won't see emails sitting at the top of the send queue for very long because another process is picking it up and sending it. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] green bean question on singleton php5
-Original Message- From: Julian [mailto:[EMAIL PROTECTED] Sent: Wednesday, January 16, 2008 3:37 PM To: Daniel Brown Cc: julian; php-general@lists.php.net Subject: Re: [PHP] green bean question on singleton php5 but that forces me to implement a large interface of functions that I prefer to avoid... the $dummy thing works... but I guess it is not by the book. I would like to understand what am I missing fom the concept Thanks. JCG Daniel Brown wrote: On Jan 16, 2008 12:57 PM, julian [EMAIL PROTECTED] wrote: Hi, I am implementing this [snip!] I'm heading out to lunch, so double-check this for errors, but I rewrote your class. You'll have to add your fetch handlers and such. ? class dbaccess{ static $db = null; static $conn = null; static $query = null; static $othervar = 33; private function self(){ dbaccess::$conn = new mysqli(HOST,DBNAME,PASS,USERNAME); if(mysqli_connect_errno()){ return False; } else { return dbaccess::$conn; } } public function query($query){ dbaccess::$query = mysqli_query(dbaccess::self(),$query); return dbaccess::$query; } public static function GetDb(){ if(dbaccess::$db==null){ dbaccess::$db= new dbaccess(); } return dbaccess::$db; } } $db=dbaccess::GetDb(); $db-query(..); // Your query here. ? dbaccess has no query method as you are not inheriting from mysqli. So dbaccess::$db will have no query method either. I don't even think you need to construct objects of type dbaccess to make this work, after all, you have only static methods and properties which are attached to the type and not the instances. Also, dbaccess::$db should be mysqli::db instead. Check the previous suggestions about creating either an inherited class, or an accessor. Regards, Rob Andrés Robinet | Lead Developer | BESTPLACE CORPORATION 5100 Bayview Drive 206, Royal Lauderdale Landings, Fort Lauderdale, FL 33308 | TEL 954-607-4207 | FAX 954-337-2695 Email: [EMAIL PROTECTED] | MSN Chat: [EMAIL PROTECTED] | SKYPE: bestplace | Web: http://www.bestplace.biz | Web: http://www.seo-diy.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: green bean question on singleton php5
Julian wrote: but that forces me to implement a large interface of functions that I prefer to avoid... the $dummy thing works... but I guess it is not by the book. I would like to understand what am I missing fom the concept You made a critial error in the original implem. You effectively write dbaccess::$db twice. Your $dummy gets around this. See my previous post, but the real issue is this code flow: In GetDb() you do: dbaccess::$db= new dbaccess(); So firstly PHP creates calls the constructor. In the constructor of dbaccess you do: dbaccess::$db = new mysqli(...); So PHP will assign the mysqli object to the variable you want. PHP will then return from the contructor of dbaccess returning the dbaccess object itself, which is then assigned to dbaccess::$db, overwriting the mysqli object. Hope that explains why what you did was a bit wrong and that one of the solutions I proposed is what you want. Col -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] green bean question on singleton php5
julian schreef: Hi, I am implementing this try comparing this rewrite with your version: abstract class dbaccess { static $db = null; private static function init() { if (dbaccess::$db)) return; dbaccess::$db = new mysqli(localhost,USER,PASSWD,DB); if(mysqli_connect_errno()) throw new Exception('cannot connect to DB'); } public static function getDB() { self::init(); return dbaccess::$db; } } try { $db = dbaccess::getDB(); $db-query(SELECT `foo` FROM `bar` WHERE `qux`=1); } catch (Exception) { die($e-getMessage()); } class dbaccess{ static $db=null; static $othervar=33; private function dbaccess(){ dbaccess::$db= new mysqli(localhost,USER,PASSWD,DB); if(mysqli_connect_errno()){ echo no way; } } public static function GetDb(){ if(dbaccess::$db==null){ dbaccess is a static class, you should not be constructing it here it! dbaccess::$db= new dbaccess(); } return dbaccess::$db; } } $db=dbaccess::GetDE(); $db-query(..); will fail...with Call to undefined method dbaccess::query() apparently $db is of type dbaccess... and thus has not does not have query implemented any hhelp appreciated. JCG -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] green bean question on singleton php5
On Jan 16, 2008 1:36 PM, Julian [EMAIL PROTECTED] wrote: I would like to understand what am I missing fom the concept here are the issues i see; you should have a private static for the instance of dbaccess you should have a private instance variable for the instance of the mysqli class you should be able to programatically handle failure to connect to the database in the code i show here, you do not have to return the mysqli instance from dbaccess::GetDb() if you prefer, that method would return the instance to the singleton, then you would have a public accessor method that would return the instance of the mysqli class. this is the simpler of the 2 options. class dbaccess{ private static $instance = null; // instance of dbaccess public static $othervar=33; // dont know what this is for, but you can keep it if you want private $mySqliConn = null; // instance of mysqli private function dbaccess() { $this-mySqliConn = new mysqli(localhost,USER,PASSWD,DB); if(mysqli_connect_errno()) { throw new RuntimeException(mysqli_connect_error()); } } public static function GetDb(){ if(dbaccess::$instance == null) { dbaccess::$instance = new dbaccess(); } return $this-mySqliConn; } } -nathan
RE: [PHP] green bean question on singleton php5
-Original Message- From: Julian [mailto:[EMAIL PROTECTED] Sent: Wednesday, January 16, 2008 3:39 PM Cc: php-general@lists.php.net Subject: Re: [PHP] green bean question on singleton php5 nope... only works if I change $dummy= new dbaccess(); and keep the rest . Thanks. ... hope it does not repeat... got undelivered... Eric Butera wrote: On Jan 16, 2008 12:57 PM, julian [EMAIL PROTECTED] wrote: Hi, I am implementing this class dbaccess{ static $db=null; static $othervar=33; private function dbaccess(){ dbaccess::$db= new mysqli(localhost,USER,PASSWD,DB); if(mysqli_connect_errno()){ echo no way; } } public static function GetDb(){ if(dbaccess::$db==null){ dbaccess::$db= new dbaccess(); } return dbaccess::$db; } } $db=dbaccess::GetDE(); $db-query(..); will fail...with Call to undefined method dbaccess::query() apparently $db is of type dbaccess... and thus has not does not have query implemented any hhelp appreciated. JCG -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Try changing dbaccess to self inside the class. Look at this: http://us.php.net/manual/en/language.oop5.patterns.php Example#2 Singleton Function Not the ideal solution, but this is what I meant: class dbaccess { private static $db = null; public static function GetDb() { if (!isset(self::$db)) { self::$db = new mysqli(localhost, USER, PASSWD, DB); if(mysqli_connect_errno()) { die(Very bad, you need to handle errors better); } } return self::$db; } } $db = dbaccess::GetDb(); $stmt = $db-query('SHOW DATABASES'); print_r($stmt); // Outputs mysqli_result Object ( ) Regards, Rob Andrés Robinet | Lead Developer | BESTPLACE CORPORATION 5100 Bayview Drive 206, Royal Lauderdale Landings, Fort Lauderdale, FL 33308 | TEL 954-607-4207 | FAX 954-337-2695 Email: [EMAIL PROTECTED] | MSN Chat: [EMAIL PROTECTED] | SKYPE: bestplace | Web: http://www.bestplace.biz | Web: http://www.seo-diy.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Word Wrap on highlight_file
Tom Chubb schreef: On 16/01/2008, Jochem Maas [EMAIL PROTECTED] wrote: Tom Chubb schreef: ... Jochem, Thanks for that. So presumably it's not possible to do it in PHP? there probably is but I can't tell what the problem is exactly without seeing the output source and rendering, that said I still recommend CSS given the adage use the right tool for the job Haven't come across array_pop before - that's much quicker than what I was doing before. Thanks :) And thanks for the pointers about sanitizing. That was my next step! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Don't search for domains on Network Solutions...
On Jan 16, 2008 2:32 PM, Andrés Robinet [EMAIL PROTECTED] wrote: A couple of days ago I've come across this: http://www.seomoz.org/blog/network-solutions-exploits-icanns-fiveday-refund- rule-to-hoard-domains So... I don't even think that network solutions is the only one doing it. I know this is not strictly related to PHP, but I thought it would be a good idea to throw the warning. I think this is I-CANN's fault. It obviously isn't related to PHP. I figured that most of us are in the business of making web applications for clients that are accessed through a domain at some point, so I sent it as a general warning to people. My company has recommended people to use it as a simple starting point of figuring out what domain name they think they might like. Of course we never use them for anything other than that, but I guess the joke is on us in the end, right? :) Thanks for the link! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] green bean question on singleton php5
you are forcing the no instantiation via abstract, instead of hiding via private method constructor. You change the constructor for an init function. still the $dummy = new dbaccess (). looks like a simpler solution Thanks for your comments Jochem Maas wrote: julian schreef: Hi, I am implementing this try comparing this rewrite with your version: abstract class dbaccess { static $db = null; private static function init() { if (dbaccess::$db)) return; dbaccess::$db = new mysqli(localhost,USER,PASSWD,DB); if(mysqli_connect_errno()) throw new Exception('cannot connect to DB'); } public static function getDB() { self::init(); return dbaccess::$db; } } try { $db = dbaccess::getDB(); $db-query(SELECT `foo` FROM `bar` WHERE `qux`=1); } catch (Exception) { die($e-getMessage()); } class dbaccess{ static $db=null; static $othervar=33; private function dbaccess(){ dbaccess::$db= new mysqli(localhost,USER,PASSWD,DB); if(mysqli_connect_errno()){ echo no way; } } public static function GetDb(){ if(dbaccess::$db==null){ dbaccess is a static class, you should not be constructing it here it! dbaccess::$db= new dbaccess(); } return dbaccess::$db; } } $db=dbaccess::GetDE(); $db-query(..); will fail...with Call to undefined method dbaccess::query() apparently $db is of type dbaccess... and thus has not does not have query implemented any hhelp appreciated. JCG -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: green bean question on singleton php5
That very much make sense. I am indeed doing two assignments. I was just wondering how to call the constructor. The new statement was the only way I saw and it only worked in an assignment . I could not call dbaccess(); nor dbaccess::dbaccess();... Probably the easiest way is a mix of the solutions. Have an emtpy private constructor, and have the an init fucntion do the work so typing does not get mixed up. Thanks. Colin Guthrie wrote: Julian wrote: but that forces me to implement a large interface of functions that I prefer to avoid... the $dummy thing works... but I guess it is not by the book. I would like to understand what am I missing fom the concept You made a critial error in the original implem. You effectively write dbaccess::$db twice. Your $dummy gets around this. See my previous post, but the real issue is this code flow: In GetDb() you do: dbaccess::$db= new dbaccess(); So firstly PHP creates calls the constructor. In the constructor of dbaccess you do: dbaccess::$db = new mysqli(...); So PHP will assign the mysqli object to the variable you want. PHP will then return from the contructor of dbaccess returning the dbaccess object itself, which is then assigned to dbaccess::$db, overwriting the mysqli object. Hope that explains why what you did was a bit wrong and that one of the solutions I proposed is what you want. Col -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Don't search for domains on Network Solutions...
On Jan 16, 2008 2:29 PM, Eric Butera [EMAIL PROTECTED] wrote: It obviously isn't related to PHP. I figured that most of us are in the business of making web applications for clients that are accessed through a domain at some point, so I sent it as a general warning to people. My company has recommended people to use it as a simple starting point of figuring out what domain name they think they might like. Of course we never use them for anything other than that, but I guess the joke is on us in the end, right? :) Eric, If you're using a *nix system, try this. I just whipped it up now, so it's not going to be perfect, but it will give accurate results, without risking any kind of domain hoarding (which is ridiculous, and companies should be fined for it, in my opinion): ? if(!isset($argv[1])) { die(Usage: .$argv[0]. domain.com\n); } $domain = $argv[1]; exec('`which dig` '.$domain,$ret,$err); if($err) { die(ERROR: .$err.\n); } for($i=0;$icount($ret);$i++) { if(preg_match('/status: (.*),/Ui',$ret[$i],$status)) { switch($status[1]) { case NXDOMAIN: echo Domain is not registered.\n; break; case NOERROR: echo Domain is registered.\n; break; default: echo Unknown status.\n; break; } } } ? -- /Dan Daniel P. Brown Senior Unix Geek and #1 Rated Year's Coolest Guy By Self Since Nineteen-Seventy-[mumble]. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Don't search for domains on Network Solutions...
-Original Message- From: Daniel Brown [mailto:[EMAIL PROTECTED] Sent: Wednesday, January 16, 2008 5:06 PM To: Eric Butera Cc: Andrés Robinet; php php Subject: Re: [PHP] Don't search for domains on Network Solutions... On Jan 16, 2008 2:29 PM, Eric Butera [EMAIL PROTECTED] wrote: It obviously isn't related to PHP. I figured that most of us are in the business of making web applications for clients that are accessed through a domain at some point, so I sent it as a general warning to people. My company has recommended people to use it as a simple starting point of figuring out what domain name they think they might like. Of course we never use them for anything other than that, but I guess the joke is on us in the end, right? :) Eric, If you're using a *nix system, try this. I just whipped it up now, so it's not going to be perfect, but it will give accurate results, without risking any kind of domain hoarding (which is ridiculous, and companies should be fined for it, in my opinion): ? if(!isset($argv[1])) { die(Usage: .$argv[0]. domain.com\n); } $domain = $argv[1]; exec('`which dig` '.$domain,$ret,$err); if($err) { die(ERROR: .$err.\n); } for($i=0;$icount($ret);$i++) { if(preg_match('/status: (.*),/Ui',$ret[$i],$status)) { switch($status[1]) { case NXDOMAIN: echo Domain is not registered.\n; break; case NOERROR: echo Domain is registered.\n; break; default: echo Unknown status.\n; break; } } } ? -- /Dan Daniel P. Brown Senior Unix Geek and #1 Rated Year's Coolest Guy By Self Since Nineteen-Seventy-[mumble]. Maybe one of these classes will do the trick if you have exec disabled (like in most of the shared hosting enviroments), anybody tried them? http://www.phpclasses.org/searchtag/whois/by/package/tag/whois/ Regards, Rob -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] snmp_set_valueretrieval depends on what?
Richard Lynch wrote: On Wed, January 16, 2008 7:34 am, Dotan Cohen wrote: I am experimenting with the snmp_set_valueretrieval function, which does not appear to be documented: http://il.php.net/snmp_set_valueretrieval What does this function depend upon? Simply using it throws this: Fatal error: Call to undefined function snmp_set_valueretrieval() in I'm on a debian-based system (Ubuntu), so if there is a deb package that provides the proper libs I'd appreciate knowing about it. This is my build info: $ php -v PHP 5.2.1 (cli) (built: Nov 28 2007 23:14:55) You can check at http://xlr.php.net but I suspect that it's too new to be in your version of PHP. According to the manual, it's supported since php 4.3.3. /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] green bean question on singleton php5
julian schreef: you are forcing the no instantiation via abstract, instead of hiding via private method constructor. you want to garantee a single instance of the mysqli object - who cares exactly how this is done. besides which the whole exercise is bogus. you want a DB connection abstraction that allows to create connections to multiple DBs and given a given set of connection parameters to always return the same connection object ... which is not exactly the same as a singleton (at all) given that dbaccess doesn't extend mysqli instantiation of dbaccess is completely pointless no? You change the constructor for an init function. still the $dummy = new dbaccess (). looks like a simpler solution no idea what you mean, personally I can't see anything complicated in any of these examples - I couldn't find a post showing something with $dummy. Thanks for your comments Jochem Maas wrote: julian schreef: Hi, I am implementing this try comparing this rewrite with your version: abstract class dbaccess { static $db = null; private static function init() { if (dbaccess::$db)) return; dbaccess::$db = new mysqli(localhost,USER,PASSWD,DB); if(mysqli_connect_errno())throw new Exception('cannot connect to DB'); } public static function getDB() { self::init(); return dbaccess::$db; } } try { $db = dbaccess::getDB(); $db-query(SELECT `foo` FROM `bar` WHERE `qux`=1); } catch (Exception) { die($e-getMessage()); } class dbaccess{ static $db=null; static $othervar=33; private function dbaccess(){ dbaccess::$db= new mysqli(localhost,USER,PASSWD,DB); if(mysqli_connect_errno()){ echo no way; } } public static function GetDb(){ if(dbaccess::$db==null){ dbaccess is a static class, you should not be constructing it here it! dbaccess::$db= new dbaccess(); } return dbaccess::$db; } } $db=dbaccess::GetDE(); $db-query(..); will fail...with Call to undefined method dbaccess::query() apparently $db is of type dbaccess... and thus has not does not have query implemented any hhelp appreciated. JCG -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] green bean question on singleton php5
On Jan 16, 2008 3:59 PM, Jochem Maas [EMAIL PROTECTED] wrote: given that dbaccess doesn't extend mysqli instantiation of dbaccess is completely pointless no? i dont know; i think using an instance of dbaccess to control a single instance of the mysqli class is appropriate. personally, i wouldnt extend mysqli unless i had a good reason to. i would probly only rationalize this if i wanted to override some of the behavior in a specific way, or extend it in some meaningful way (even then i might use composition). if that isnt the intention i think composition is the best choice for the singleton. more a matter of preference than anything i suppose. at least i cant think of a better reason to argue for composition. no idea what you mean ya; some of these posts from you are a little hard to understand, julian. -nathan
Re: [PHP] Don't search for domains on Network Solutions...
On Jan 16, 2008 4:27 PM, Andrés Robinet [EMAIL PROTECTED] wrote: -Original Message- From: Daniel Brown [mailto:[EMAIL PROTECTED] Sent: Wednesday, January 16, 2008 5:06 PM To: Eric Butera Cc: Andrés Robinet; php php Subject: Re: [PHP] Don't search for domains on Network Solutions... On Jan 16, 2008 2:29 PM, Eric Butera [EMAIL PROTECTED] wrote: It obviously isn't related to PHP. I figured that most of us are in the business of making web applications for clients that are accessed through a domain at some point, so I sent it as a general warning to people. My company has recommended people to use it as a simple starting point of figuring out what domain name they think they might like. Of course we never use them for anything other than that, but I guess the joke is on us in the end, right? :) Eric, If you're using a *nix system, try this. I just whipped it up now, so it's not going to be perfect, but it will give accurate results, without risking any kind of domain hoarding (which is ridiculous, and companies should be fined for it, in my opinion): ? if(!isset($argv[1])) { die(Usage: .$argv[0]. domain.com\n); } $domain = $argv[1]; exec('`which dig` '.$domain,$ret,$err); if($err) { die(ERROR: .$err.\n); } for($i=0;$icount($ret);$i++) { if(preg_match('/status: (.*),/Ui',$ret[$i],$status)) { switch($status[1]) { case NXDOMAIN: echo Domain is not registered.\n; break; case NOERROR: echo Domain is registered.\n; break; default: echo Unknown status.\n; break; } } } ? -- /Dan Daniel P. Brown Senior Unix Geek and #1 Rated Year's Coolest Guy By Self Since Nineteen-Seventy-[mumble]. Maybe one of these classes will do the trick if you have exec disabled (like in most of the shared hosting enviroments), anybody tried them? http://www.phpclasses.org/searchtag/whois/by/package/tag/whois/ Regards, Rob -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php His program was for CLI. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Don't search for domains on Network Solutions...
On Jan 16, 2008 4:30 PM, Eric Butera [EMAIL PROTECTED] wrote: His program was for CLI. Correct. Sorry, forgot to mention it lunch was calling my name, and I had to answer. -- /Dan Daniel P. Brown Senior Unix Geek and #1 Rated Year's Coolest Guy By Self Since Nineteen-Seventy-[mumble]. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] green bean question on singleton php5
On Jan 16, 2008 4:13 PM, Nathan Nobbe [EMAIL PROTECTED] wrote: On Jan 16, 2008 3:59 PM, Jochem Maas [EMAIL PROTECTED] wrote: given that dbaccess doesn't extend mysqli instantiation of dbaccess is completely pointless no? i dont know; i think using an instance of dbaccess to control a single instance of the mysqli class is appropriate. personally, i wouldnt extend mysqli unless i had a good reason to. i would probly only rationalize this if i wanted to override some of the behavior in a specific way, or extend it in some meaningful way (even then i might use composition). if that isnt the intention i think composition is the best choice for the singleton. more a matter of preference than anything i suppose. at least i cant think of a better reason to argue for composition. no idea what you mean ya; some of these posts from you are a little hard to understand, julian. -nathan I still don't understand the obsession of a singleton in regards to a db connection. Using a registry is a much better practice I think. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Don't search for domains on Network Solutions...
On Jan 16, 2008 4:35 PM, Daniel Brown [EMAIL PROTECTED] wrote: On Jan 16, 2008 4:30 PM, Eric Butera [EMAIL PROTECTED] wrote: His program was for CLI. Correct. Sorry, forgot to mention it lunch was calling my name, and I had to answer. -- /Dan Daniel P. Brown Senior Unix Geek and #1 Rated Year's Coolest Guy By Self Since Nineteen-Seventy-[mumble]. You did forget to escape the user input value in case I was trying to hacks myself. :) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Don't search for domains on Network Solutions...
On Jan 16, 2008 4:48 PM, Eric Butera [EMAIL PROTECTED] wrote: You did forget to escape the user input value in case I was trying to hacks myself. :) No I didn't. QUOTE: I just whipped it up now, so it's not going to be perfect, but it will give accurate results, without risking any kind of domain hoarding Common sense, while not assumed in general, is presumed in this case. ;-P -- /Dan Daniel P. Brown Senior Unix Geek and #1 Rated Year's Coolest Guy By Self Since Nineteen-Seventy-[mumble]. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Don't search for domains on Network Solutions...
On Jan 16, 2008 4:51 PM, Daniel Brown [EMAIL PROTECTED] wrote: On Jan 16, 2008 4:48 PM, Eric Butera [EMAIL PROTECTED] wrote: You did forget to escape the user input value in case I was trying to hacks myself. :) No I didn't. QUOTE: I just whipped it up now, so it's not going to be perfect, but it will give accurate results, without risking any kind of domain hoarding Common sense, while not assumed in general, is presumed in this case. ;-P -- /Dan Daniel P. Brown Senior Unix Geek and #1 Rated Year's Coolest Guy By Self Since Nineteen-Seventy-[mumble]. Not going to help the user who copies and pastes that somewhere someday and puts it as a backend to some form. :P -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] green bean question on singleton php5
Eric Butera schreef: On Jan 16, 2008 4:13 PM, Nathan Nobbe [EMAIL PROTECTED] wrote: On Jan 16, 2008 3:59 PM, Jochem Maas [EMAIL PROTECTED] wrote: given that dbaccess doesn't extend mysqli instantiation of dbaccess is completely pointless no? i dont know; i think using an instance of dbaccess to control a single instance of the mysqli class is appropriate. personally, i wouldnt extend mysqli unless i had a good reason to. i would probly only rationalize this if i wanted to override some of the behavior in a specific way, or extend it in some meaningful way (even then i might use composition). if that isnt the intention i think composition is the best choice for the singleton. more a matter of preference than anything i suppose. at least i cant think of a better reason to argue for composition. no idea what you mean ya; some of these posts from you are a little hard to understand, julian. -nathan I still don't understand the obsession of a singleton in regards to a db connection. Using a registry is a much better practice I think. I think I alluded to the registry pattern in my reply above - although I'm not sure. could you care to ellaborate what you mean by registry? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Scripts are fast locally, but slow on remote server
Richard Lynch schreef: Are you relying on autoload or anything of that nature to load in class files, perhaps? garanteed that it's not an autoload related problem. and Im willing to bet it's a dns related issue - I remember similar problems reported on the list and it always came down to dns. On Wed, January 16, 2008 1:02 am, Dave M G wrote: PHP list, I have a set of PHP scripts that seem to be efficient and quick enough both on my home testing environment, and a few different web-hosting services I use. However, on one particular web-hosting service, there is often a very painful 10 second (!) lag when first loading up the scripts. This long lag time can sometimes be manifest not just on the first page loaded, but the second and maybe third as well. But then after the first initial pages are loaded, the site seems to speed up to what I would consider normal download pages for times. There are some pages on the site that are not driven by these PHP scripts, and they load up very quickly, indicating that only my PHP scripts are affected. So the problem seems to be, as far as I can tell, that something about my PHP scripts is combining with some setting of this one web-hosting server to create some kind of slowdown. Is there any way I can diagnose a situation like this to get to the root of the problem? Perhaps there are common discrepancies between server settings that I can look out for? Any advice would be much appreciated. Thank you. -- Dave M G Articlass - open source CMS http://articlass.org -- 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] green bean question on singleton php5
On Jan 16, 2008 4:55 PM, Jochem Maas [EMAIL PROTECTED] wrote: Eric Butera schreef: On Jan 16, 2008 4:13 PM, Nathan Nobbe [EMAIL PROTECTED] wrote: On Jan 16, 2008 3:59 PM, Jochem Maas [EMAIL PROTECTED] wrote: given that dbaccess doesn't extend mysqli instantiation of dbaccess is completely pointless no? i dont know; i think using an instance of dbaccess to control a single instance of the mysqli class is appropriate. personally, i wouldnt extend mysqli unless i had a good reason to. i would probly only rationalize this if i wanted to override some of the behavior in a specific way, or extend it in some meaningful way (even then i might use composition). if that isnt the intention i think composition is the best choice for the singleton. more a matter of preference than anything i suppose. at least i cant think of a better reason to argue for composition. no idea what you mean ya; some of these posts from you are a little hard to understand, julian. -nathan I still don't understand the obsession of a singleton in regards to a db connection. Using a registry is a much better practice I think. I think I alluded to the registry pattern in my reply above - although I'm not sure. could you care to ellaborate what you mean by registry? Sure. A registry is just a place to store things. So create an instance of your DB and stick it in the registry and you're done. Then make your script rely on the registry so you can swap stuff out that way instead of having a hard coded reference to some static method that cannot be replaced at runtime. Also with the registry you can use lazy loading. My scripts don't create an instance of the db class until it is actually used. It has the ability to create one at any time by calling the fancy_namespace_Registry::get('db') which will read some config I enabled upstream with the fancy_namespace_Registry::lazy('db', array(config to pass)). In testing I can just replace the db entry with a mock and life is good. Also, my database doesn't connect to the server until an actual method is called that uses it. So just layers of just in time. Of course you could argue that using static methods in the registry is bad too, but I gotta draw the line somewhere! :) There isn't really a right or wrong. Just different ways of doing things. I used to use the singleton with my DB but it became troublesome to test plus always making sure the dependences were pre-loaded was annoying. Now everything takes care of itself. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] green bean question on singleton php5
On Jan 16, 2008 4:55 PM, Jochem Maas [EMAIL PROTECTED] wrote: Eric Butera schreef: I still don't understand the obsession of a singleton in regards to a db connection. Using a registry is a much better practice I think. I think I alluded to the registry pattern in my reply above - although I'm not sure. could you care to ellaborate what you mean by registry? though i havent seen registry defined in any of the few patterns books ive seen; i think its supposed to be a list of singletons, essentially; if you want a 'global' registry that is. and i suppose the registry class would itself be a singleton as well. here is a somewhat concrete definition / explanation / example.. http://www.phppatterns.com/doku.php/design/the_registry -nathan
Re: [PHP] QNX build
Richard schreef: Hi, After installing PHP on a Windows machine I see a very small PHP-executable and several extension dll's that can be loaded. When I build PHP on a QNX machine I get one huge executable of 8.6 MB. Is it possible to build something similar to the Windows version? yes, by specifying to ./configure that it should build shared extensions or those extensions that allow it. so the relevant ./configure options will look something like: --enable-foo=shared,/path/to/libs what's your configure line look like right now? PS - I'd never heard of QNX - just looked it up - interested to know what your doing with it and php. PPS - Is a single large binary any worse than a smaller binary that loads in a bunch of extensions (assuming the same extensions in each case), won't the memory footprint be near enough the same for each? Regards, Richard -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] green bean question on singleton php5
On Jan 16, 2008 5:06 PM, Eric Butera [EMAIL PROTECTED] wrote: Also with the registry you can use lazy loading. singleton is typically implemented with a lazy loading approach, and most of the code samples ive seen on this thread today use a lazy loading approach. could you give us a more concrete example of what youre defining as a registry, eric? thanks, -nathan
Re: [PHP] green bean question on singleton php5
On Jan 16, 2008 5:06 PM, Nathan Nobbe [EMAIL PROTECTED] wrote: On Jan 16, 2008 4:55 PM, Jochem Maas [EMAIL PROTECTED] wrote: Eric Butera schreef: I still don't understand the obsession of a singleton in regards to a db connection. Using a registry is a much better practice I think. I think I alluded to the registry pattern in my reply above - although I'm not sure. could you care to ellaborate what you mean by registry? though i havent seen registry defined in any of the few patterns books ive seen; i think its supposed to be a list of singletons, essentially; if you want a 'global' registry that is. and i suppose the registry class would itself be a singleton as well. here is a somewhat concrete definition / explanation / example.. http://www.phppatterns.com/doku.php/design/the_registry -nathan Here is an implementation: http://framework.zend.com/manual/en/zend.registry.html Here is another: http://www.stubbles.net/browser/trunk/src/main/php/net/stubbles/util/stubRegistry.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] green bean question on singleton php5
On Jan 16, 2008 5:09 PM, Eric Butera [EMAIL PROTECTED] wrote: Here is an implementation: http://framework.zend.com/manual/en/zend.registry.html Here is another: http://www.stubbles.net/browser/trunk/src/main/php/net/stubbles/util/stubRegistry.php cool; ill have a look when i get home. -nathan
Re: [PHP] green bean question on singleton php5
Eric Butera schreef: On Jan 16, 2008 4:55 PM, Jochem Maas [EMAIL PROTECTED] wrote: Eric Butera schreef: On Jan 16, 2008 4:13 PM, Nathan Nobbe [EMAIL PROTECTED] wrote: On Jan 16, 2008 3:59 PM, Jochem Maas [EMAIL PROTECTED] wrote: given that dbaccess doesn't extend mysqli instantiation of dbaccess is completely pointless no? i dont know; i think using an instance of dbaccess to control a single instance of the mysqli class is appropriate. personally, i wouldnt extend mysqli unless i had a good reason to. i would probly only rationalize this if i wanted to override some of the behavior in a specific way, or extend it in some meaningful way (even then i might use composition). if that isnt the intention i think composition is the best choice for the singleton. more a matter of preference than anything i suppose. at least i cant think of a better reason to argue for composition. no idea what you mean ya; some of these posts from you are a little hard to understand, julian. -nathan I still don't understand the obsession of a singleton in regards to a db connection. Using a registry is a much better practice I think. I think I alluded to the registry pattern in my reply above - although I'm not sure. could you care to ellaborate what you mean by registry? Sure. A registry is just a place to store things. So create an instance of your DB and stick it in the registry and you're done. Then make your script rely on the registry so you can swap stuff out that way instead of having a hard coded reference to some static method that cannot be replaced at runtime. Also with the registry you can use lazy loading. My scripts don't create an instance of the db class until it is actually used. It has the ability to create one at any time by calling the fancy_namespace_Registry::get('db') which will read some config I enabled upstream with the fancy_namespace_Registry::lazy('db', array(config to pass)). In testing I can just replace the db entry with a mock and life is good. Also, my database doesn't connect to the server until an actual method is called that uses it. So just layers of just in time. Of course you could argue that using static methods in the registry is bad too, but I gotta draw the line somewhere! :) There isn't really a right or wrong. Just different ways of doing things. I used to use the singleton with my DB but it became troublesome to test plus always making sure the dependences were pre-loaded was annoying. Now everything takes care of itself. that makes it clear. thank you. I guess what I was alluding to was a DB [connection object] specific registry. I guess I have never actually thought about it enough because reading your explaination makes it blatantly obvious that the 'pattern' can be made so much more generic ... and I love the generic lazy loading mechanism - I'll be using that idea sharpish :) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] green bean question on singleton php5
On Jan 16, 2008 5:10 PM, Nathan Nobbe [EMAIL PROTECTED] wrote: On Jan 16, 2008 5:09 PM, Eric Butera [EMAIL PROTECTED] wrote: Here is an implementation: http://framework.zend.com/manual/en/zend.registry.html Here is another: http://www.stubbles.net/browser/trunk/src/main/php/net/stubbles/util/stubRegistry.php cool; ill have a look when i get home. -nathan A more to the point example would be the Solar implementation that has the lazy loading I keep ranting about. http://solarphp.com/manual/Registry Sorry for the noise. :) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Don't search for domains on Network Solutions...
In news: [EMAIL PROTECTED] - Daniel Brown wrote : On Jan 16, 2008 2:29 PM, Eric Butera [EMAIL PROTECTED] wrote: It obviously isn't related to PHP. I figured that most of us are in the business of making web applications for clients that are accessed through a domain at some point, so I sent it as a general warning to people. My company has recommended people to use it as a simple starting point of figuring out what domain name they think they might like. Of course we never use them for anything other than that, but I guess the joke is on us in the end, right? :) Eric, If you're using a *nix system, try this. I just whipped it up now, so it's not going to be perfect, but it will give accurate results, without risking any kind of domain hoarding (which is ridiculous, and companies should be fined for it, in my opinion): ? if(!isset($argv[1])) { die(Usage: .$argv[0]. domain.com\n); } $domain = $argv[1]; exec('`which dig` '.$domain,$ret,$err); if($err) { die(ERROR: .$err.\n); } for($i=0;$icount($ret);$i++) { if(preg_match('/status: (.*),/Ui',$ret[$i],$status)) { switch($status[1]) { case NXDOMAIN: echo Domain is not registered.\n; break; case NOERROR: echo Domain is registered.\n; break; default: echo Unknown status.\n; break; } } } -- /Dan Daniel P. Brown Senior Unix Geek and #1 Rated Year's Coolest Guy By Self Since Nineteen-Seventy-[mumble]. This may help as well,Ive used for sometime now with out problem.. http://www.cyberstrider.net/index.php?page=wewbo -- Cheap As Chips Broadband http://yeah.kick-butt.co.uk Superb hosting domain name deals http://host.kick-butt.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Don't search for domains on Network Solutions...
On Jan 16, 2008 4:54 PM, Eric Butera [EMAIL PROTECTED] wrote: On Jan 16, 2008 4:51 PM, Daniel Brown [EMAIL PROTECTED] wrote: On Jan 16, 2008 4:48 PM, Eric Butera [EMAIL PROTECTED] wrote: You did forget to escape the user input value in case I was trying to hacks myself. :) No I didn't. QUOTE: I just whipped it up now, so it's not going to be perfect, but it will give accurate results, without risking any kind of domain hoarding Common sense, while not assumed in general, is presumed in this case. ;-P Not going to help the user who copies and pastes that somewhere someday and puts it as a backend to some form. :P It's also not intended for copy and paste for a backend. Anyone who does that blindly deserves whatever happens, and shouldn't be working with something on that level in the first place. I doubt anyone here, including yourself, would disagree with me on that. And kidding or not, making scolding or sanctimonious statements in a public forum is not really the way to garner any future interest in your threads. Especially when you won't win, and we'll just wind up flooding the list with verbal bitchslaps. Zip 'em to my personal address instead. I never take offense! ;-P -- /Dan Daniel P. Brown Senior Unix Geek and #1 Rated Year's Coolest Guy By Self Since Nineteen-Seventy-[mumble]. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Don't search for domains on Network Solutions...
On Jan 16, 2008 5:21 PM, Daniel Brown [EMAIL PROTECTED] wrote: On Jan 16, 2008 4:54 PM, Eric Butera [EMAIL PROTECTED] wrote: On Jan 16, 2008 4:51 PM, Daniel Brown [EMAIL PROTECTED] wrote: On Jan 16, 2008 4:48 PM, Eric Butera [EMAIL PROTECTED] wrote: You did forget to escape the user input value in case I was trying to hacks myself. :) No I didn't. QUOTE: I just whipped it up now, so it's not going to be perfect, but it will give accurate results, without risking any kind of domain hoarding Common sense, while not assumed in general, is presumed in this case. ;-P Not going to help the user who copies and pastes that somewhere someday and puts it as a backend to some form. :P It's also not intended for copy and paste for a backend. Anyone who does that blindly deserves whatever happens, and shouldn't be working with something on that level in the first place. I doubt anyone here, including yourself, would disagree with me on that. And kidding or not, making scolding or sanctimonious statements in a public forum is not really the way to garner any future interest in your threads. Especially when you won't win, and we'll just wind up flooding the list with verbal bitchslaps. Zip 'em to my personal address instead. I never take offense! ;-P -- /Dan Daniel P. Brown Senior Unix Geek and #1 Rated Year's Coolest Guy By Self Since Nineteen-Seventy-[mumble]. ??? This is a forum for newbies to get help on their coding problems. You put code up with a potential flaw in it. We both know it wasn't inteded for copy/paste. What about the beginner who on the offhand chance does a Google search and finds your code and does put it into a file? Somebody starting out won't know about escaping data based on context. We've had this debate before and I really think you need to take a step back and realize you are giving answers not asking questions. I think saying they know that isn't correct because in a lot of cases people don't. I am sorry that I struck a nerve with my response as that wasn't my goal. I just hoped that it would be in the archives in case somebody did stumble upon the thread. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Don't search for domains on Network Solutions...
On Jan 16, 2008 5:49 PM, Eric Butera [EMAIL PROTECTED] wrote: [snip!] Okay, Eric, I'm not getting involved in any kind of flame war. I am sorry that I struck a nerve with my response as that wasn't my goal. I just hoped that it would be in the archives in case somebody did stumble upon the thread. Your point here is correct, but the way in which you're approaching it is not. And don't worry, you didn't strike any kind of nerve, I just don't want to further contribute useless traffic to the list. Hence my saying to write to me privately. I have no problem debating things; it's the only way to advance and mature. Well, in my case, I use the word mature loosely. Especially on Fridays. ;-P -- /Dan Daniel P. Brown Senior Unix Geek and #1 Rated Year's Coolest Guy By Self Since Nineteen-Seventy-[mumble]. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Encryption failing
On Tue, January 15, 2008 10:48 pm, Casey wrote: On Jan 15, 2008 8:40 PM, Ken Kixmoeller -- reply to [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: On Jan 15, 2008, at 11:08 PM, Andrés Robinet wrote: I second that, you should base64 encode values before encrypting and base64 decode them after decrypting to be safe. Thanks for the idea. Like this? Fails 500/500 times on my test. if ($EorD == D) { $text_out = mdecrypt_generic($cypher,$text); You are base64-ing it, but... $text = base64_decode($text); You are not decoding the base64, but the original. } else { $text= base64_encode($text); $text_out = mcrypt_generic($cypher,$text); } // endif ($EorD == D) A quick test looks like this: 1: String: 9334133814260182 -|- Enc: X5Þ(c)·a`p#È]#c¦±3 ÔýCõÒiÏ~r ¢Tª -|- Dec:OTMzNDEzMzgxNDI2MDE4Mg== -|- Nope 2: String: 3027022406512648 -|- Enc: j£n,h\m ê´ uKP%¥ ¼D }H'f ¢ -|- Dec:MzAyNzAyMjQwNjUxMjY0OA== -|- Nope 3: String: 5042504153020331 -|- Enc: 9ÿ ýݧ¤6Wi+×éáon ñº*J 6}Ø+ -|- Dec:NTA0MjUwNDE1MzAyMDMzMQ== -|- Nope 4: String: 6741156238850410 -|- Enc: · :´[Úq\ë 4\Q«Í5±{ºµØtþðtN?b -|- Dec:Njc0MTE1NjIzODg1MDQxMA== -|- Nope 5: String: 0003100244041329 -|- Enc: D¾¤ úV:!Mû 4ÜàòÐÐ^ï Hñ- %z -|- Dec:MDAwMzEwMDI0NDA0MTMyOQ== -|- Nope Wrong: 5/5 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php It returns the correct value. If you look at the last example, and run base64_decode on MDAwMzEwMDI0NDA0MTMyOQ==, you will get 0003100244041329. -Casey -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Some people have a gift link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Encryption failing
Is it possible that 4% of the time, you have spaces on the start/end of the string, which get trimmed before encryption? And if rijndael is one of the algorithms which requires a fixed-size input, that also would be bad to trim it. If you need multiple of 16 bytes input, leave the input alone. Actually, I'd suggest that the encryption function has no business trimming the text anyway. If I want to jagencdecr(str_repeat(' ', 1000), 'E'), then I probably don't want the function to trim that, eh? :-) On Tue, January 15, 2008 6:54 pm, Ken Kixmoeller -- reply to [EMAIL PROTECTED] wrote: Hey --- - - I am in the process of upgrading the encryption technology I am using from (64 bit) blowfish to (256 bit) rijndael. The code (and some explanations) is below, but the results are, um, unusual, and I can't see what I am doing wrong. For testing, I have a program that generates a random 16-character string, encrypts it to a variable, and decrypts it. Running it in 500 iteration loops, it fails roughly 4% of the time. By fails I mean that the original string and the eventual decrypted one don't match. Anybody able to spot why? Ken -- function jagencdecr($text,$EorD,$encpass='') { // parameters: // - $text = string to be en/decrypted, // - $EorD = Encrypt or Decrypt // - $encpass = key phrase if (empty($text)) {return ;} $text = trim($text); $cypher = mcrypt_module_open('rijndael-256', '', 'ecb', ''); // ecb mode produces the above results. // ofb mode produces 100% errors $size = mcrypt_enc_get_iv_size($cypher); $phprand = rand(1000,); $iv = mcrypt_create_iv($size,$phprand); // produces the same results as below, platform independent //$iv = mcrypt_create_iv($size,MCRYPT_RAND); // for Windows //$iv = mcrypt_create_iv($size,MCRYPT_DEV_RAND); // for 'NIX $ks = mcrypt_enc_get_key_size($cypher); /* Create key */ $key = substr(md5($encpass), 0, $ks); mcrypt_generic_init($cypher,$key,$iv); if ($EorD == D) { $text_out = mdecrypt_generic($cypher,$text); } else { $text_out = mcrypt_generic($cypher,$text); } // endif ($EorD == D) mcrypt_generic_deinit($cypher); mcrypt_module_close($cypher); return trim($text_out); } // endfunc jagencdecr Jaguar Ecnrypt/Decrypt -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Some people have a gift link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] New years resolution: To get serious with my programming! Anyone wanna help? :)
On Wed, January 16, 2008 9:57 am, Daniel Brown wrote: echo($h.\n.$i.\n); // echo is a construct, but as expected, can use parentheses() Just to be picuyane: echo isn't using the parens. The parens are forcing PHP to evaluate the concatenation of the strings FIRST, and then echo them. And since the concatenation operator takes precedence over the language construct, the parens are basically useless cruft. -- Some people have a gift link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How to take video embed codes and change all their widths/heights?
$stringtoedit = preg_replace(/width=(\?[0-9%]\?[^0-9%\])/msi, width=\\\1\, $stringtoedit); $stringtoedit = preg_replace(/height=(\?[0-9%]\?[^0-9%\])/msi, height=\\\1\, $stringtoedit); This adds quotes around quote-less values, which were once acceptable HTML, but aren't really a Good Idea. It also allows for a % in the value, which is still used in some places, and may even still be valid. You MIGHT want to actually pull out $width and $height and then change them proporationally rather than forcing a movie to an aspect ratio that might suck. You're on your own to do the arithmetic on that one, but find any scale image PHP script to see how it's done. On Tue, January 15, 2008 4:25 pm, Rob Gould wrote: Can anytime give me some insights on how to write a PHP script that could accept any of the below strings below and edit the strings to change their width and height settings dynamically? For instance, if I want all embedded videos to have a width of 320, and a height of 240, using PHP's string manipulation commands, what's the best way to hone in on width=425 and change it to width=320? (In all cases in each string) stringtoedit='object width=425 height=355param name=movie value=http://www.youtube.com/v/B1O2jcfOylUrel=1;/paramparam name=wmode value=transparent/paramembed src=http://www.youtube.com/v/B1O2jcfOylUrel=1 type=application/x-shockwave-flash wmode=transparent width=425 height=355/embed/object'; stringtoedit='object width=464 height=388 classid=clsid:d27cdb6e- ae6d-11cf-96b8-44455354param name=movie value=http://www2.funnyordie.com/public/flash/fodplayer.swf /param name=flashvars value=key=5468 /param name=allowfullscreen value=true /embed width=464 height=388 flashvars=key=5468 allowfullscreen=true quality=high src=http://www2.funnyordie.com/public/flash/fodplayer.swf type=application/x-shockwave-flash/embed/objectnoscripta href=http://www.funnyordie.com/videos/5468;Cars/a on a href=http://www.funnyordie.com FunnyOrDie.com/a/noscript'; -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Some people have a gift link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Function-return-array idea
Hello I've an idea for PHP6. Let's kickoff with an example. ?php $info = getUserInformation($id); //return an array with all the information of an user. echo $info['naam']; ? This is nice, but when I want one element of the returned array, I have to store the returned array into a variable and then call the variable. The next code example is my idea. ?php echo getUserInformation($id)['naam']; ? Let's look further then this small example. ?php echo $object-fetchObjects()[0]-method(); ? This example is more realistic when you use OO. This code style is faster for developing applications. This code style is available in Java, Javascript, C, C++, Perl, Python, ... So why not in PHP(6)? You can read more on my blog. http://www.eos-team.org/2007/09/06/php6-function-return-array-idea.html I hope for good response and also response from php-dev team. Greetings Stijn Leenknegt
Re: [PHP] re[PHP] gister_globals
Sancar Saran schreef: On Wednesday 16 January 2008 15:33:04 Jochem Maas wrote: tbt schreef: Hi, I'm a newbie to php and i would like to set register_globals to 'on' from my php script itself(eg:- index.php). Is there any way of doing this. you think you would like that. but you are wrong. register_globals is a security risk in the hands of someone who doesn't know exactly what they are doing. besides which register_globals is depreciated. also you can search the list archives for lots of posts that explain why register_globals is evil. learn how to write your script without using register_globals - ask here if you get stuck (but don't forget the manual!). Thanks Hell frezezer over. odd verb. but I get the message. indeed it's seem it hath freezeth nicely. Me thinks regsiter_globals are evil too. And what about this session_start(); $_SESSION['refString'] = $_GET['refNo']; what about it? 1. you mean the fact that the GET val is not sanitized? 2. or the oddness of 'refNo' becoming 'refString' (is it a string, a number, superman)? 3. or the direct use of $_SESSION and the lack of specific session cookie settings? 1. is evil, 2. is odd and 3. is a change recommendation ... if you ask me. Sancar -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Function-return-array idea
On Wed, January 16, 2008 5:32 pm, Stijn Leenknegt wrote: I've an idea for PHP6. Let's kickoff with an example. This belongs on php-internals... ?php echo getUserInformation($id)['naam']; ? where it has already been discussed at length, and, as I recall, rejected as too obfuscated for the intent of PHP. I apologize to php-internals for my gross over-simplification of a zillion posts. :-) Read the php-internals archives for the gory details. -- Some people have a gift link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] calling java within php setup?
On Tue, January 15, 2008 5:32 pm, Jochem Maas wrote: Janet N schreef: with a bit of luck you'll then have a .so file that is your new extension, now it a matter moving the .so to a suitable place (if you have root access, you can run 'make install') and of editing php.ini to load the extension. If you don't have root, you probably can't move it to the suitable place. Otherwise, any bozo could install and .so file into the PHP binary, which could do anything at all to the PHP process, including hack all kinds of nasty functions to, say, dump ALL incoming GET/POST data whose variable name looks like *cc* or *credit* or *card* out to some email address... That said, if your host is a bit lax in security, you might be able to use DL to LOAD your .so file into your script: http://php.net/dl Note that 'dl' is probably going away in PHP 6, last I heard. -- Some people have a gift link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Function-return-array idea
I think this would be an easier/quicker fix for you then requesting that the PHP developers re-write a large portion of the way PHP currently works. ?php function i($arr, $i) { return $arr[$i]; } echo i(getUserInformation($id), 'naam'); #or echo i($object-fetchObjects(), 0)-method(); ? Stijn Leenknegt wrote: Hello I've an idea for PHP6. Let's kickoff with an example. ?php $info = getUserInformation($id); //return an array with all the information of an user. echo $info['naam']; ? This is nice, but when I want one element of the returned array, I have to store the returned array into a variable and then call the variable. The next code example is my idea. ?php echo getUserInformation($id)['naam']; ? Let's look further then this small example. ?php echo $object-fetchObjects()[0]-method(); ? This example is more realistic when you use OO. This code style is faster for developing applications. This code style is available in Java, Javascript, C, C++, Perl, Python, ... So why not in PHP(6)? You can read more on my blog. http://www.eos-team.org/2007/09/06/php6-function-return-array-idea.html I hope for good response and also response from php-dev team. Greetings Stijn Leenknegt -- Jim Lucas Some men are born to greatness, some achieve greatness, and some have greatness thrust upon them. Twelfth Night, Act II, Scene V by William Shakespeare -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Function-return-array idea
I'm sure I'm a pea-brain, but this caught my attention. So you execute the fetchObjects() method which could return a large number of objects, then you reference a method of the 0th one. I didn't test, but why not use: $object-fetchObjects(0)-method(); Where fetchObjects($id) returns the object referenced by $id instead of all? -Shawn echo $object-fetchObjects()[0]-method(); Stijn Leenknegt wrote: Hello I've an idea for PHP6. Let's kickoff with an example. ?php $info = getUserInformation($id); //return an array with all the information of an user. echo $info['naam']; ? This is nice, but when I want one element of the returned array, I have to store the returned array into a variable and then call the variable. The next code example is my idea. ?php echo getUserInformation($id)['naam']; ? Let's look further then this small example. ?php echo $object-fetchObjects()[0]-method(); ? This example is more realistic when you use OO. This code style is faster for developing applications. This code style is available in Java, Javascript, C, C++, Perl, Python, ... So why not in PHP(6)? You can read more on my blog. http://www.eos-team.org/2007/09/06/php6-function-return-array-idea.html I hope for good response and also response from php-dev team. Greetings Stijn Leenknegt -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] system command runs application, but application doesn't work correctly
Hello, I'm trying to run mencoder command line utility to encode videos. When I use these two command in terminal (through SSH), everything works fine. But when I run them from PHP script with system command, it doesn't work. The commands are: First pass: system(/usr/local/bin/mencoder -vf scale=448:-3,expand=448:336 -sws 9 -of lavf -ovc lavc -lavcopts vcodec=flv:vbitrate=250:trell:v4mv:mv0:mbd=2:cbp:aic:cmp=3:subcmp=3:vpass=1 -frames 800 -ofps 24000/1001 -oac mp3lame -lameopts abr:br=64:mode=0 -channels 1 -srate 22050 -of lavf -lavfopts format=flv -o .$outputFile. /home/re/ff/logo7.avi .$inputFile); Second pass: system(/usr/local/bin/mencoder -vf scale=448:-3,expand=448:336 -sws 9 -of lavf -ovc lavc -lavcopts vcodec=flv:vbitrate=250:trell:v4mv:mv0:mbd=2:cbp:aic:cmp=3:subcmp=3:vpass=1 -frames 800 -ofps 24000/1001 -oac mp3lame -lameopts abr:br=64:mode=0 -channels 1 -srate 22050 -of lavf -lavfopts format=flv -o .$outputFile. /home/re/ff/logo7.avi .$inputFile); And the output is: MEncoder dev-SVN-r25703-4.1.2 (C) 2000-2008 MPlayer Team CPU: Intel(R) Celeron(R) D CPU 3.20GHz (Family: 15, Model: 6, Stepping: 5) CPUflags: Type: 15 MMX: 1 MMX2: 1 3DNow: 0 3DNow2: 0 SSE: 1 SSE2: 1 Compiled for x86 CPU with extensions: MMX MMX2 SSE SSE2 success: format: 0 data: 0x0 - 0x206e57e AVI file format detected. [aviheader] Video stream found, -vid 0 [aviheader] Audio stream found, -aid 1 VIDEO: [] 448x336 24bpp 23.976 fps 86617.4 kbps (10573.4 kbyte/s) [V] filefmt:3 fourcc:0x0 size:448x336 fps:23.98 ftime:=0.0417 == Opening audio decoder: [mp3lib] MPEG layer-2, layer-3 AUDIO: 44100 Hz, 2 ch, s16le, 320.0 kbit/22.68% (ratio: 4-176400) Selected audio codec: [mp3] afm: mp3lib (mp3lib MPEG layer-2, layer-3) == OK, exit Opening video filter: [expand osd=1] Expand: -1 x -1, -1 ; -1, osd: 1, aspect: 0.00, round: 1 Opening video filter: [expand w=448 h=336] Expand: 448 x 336, -1 ; -1, osd: 0, aspect: 0.00, round: 1 Opening video filter: [scale w=448 h=-3] == Opening video decoder: [raw] RAW Uncompressed Video VDec: vo config request - 448 x 336 (preferred colorspace: BGR 24-bit) VDecoder init failed :( Opening video decoder: [raw] RAW Uncompressed Video VDec: vo config request - 448 x 336 (preferred colorspace: BGR 24-bit) VDecoder init failed :( Opening video decoder: [raw] RAW Uncompressed Video VDec: vo config request - 448 x 336 (preferred colorspace: BGR 24-bit) VDecoder init failed :( Opening video decoder: [raw] RAW Uncompressed Video VDec: vo config request - 448 x 336 (preferred colorspace: BGR 24-bit) VDecoder init failed :( Opening video decoder: [raw] RAW Uncompressed Video VDec: vo config request - 448 x 336 (preferred colorspace: BGR 24-bit) VDecoder init failed :( Opening video decoder: [raw] RAW Uncompressed Video VDec: vo config request - 448 x 336 (preferred colorspace: BGR 24-bit) VDec: using BGR 24-bit as output csp (no 0) Opening video filter: [flip] Movie-Aspect is undefined - no prescaling applied. videocodec: libavcodec (448x336 fourcc=31564c46 [FLV1]) [VE_LAVC] High quality encoding selected (non-realtime)! VDecoder init failed :( Opening video decoder: [raw] RAW Uncompressed Video VDec: vo config request - 448 x 336 (preferred colorspace: BGR 24-bit) VDec: using BGR 24-bit as output csp (no 0) Opening video filter: [flip] Movie-Aspect is undefined - no prescaling applied. videocodec: libavcodec (448x336 fourcc=31564c46 [FLV1]) [VE_LAVC] High quality encoding selected (non-realtime)! VDecoder init failed :( Opening video decoder: [raw] RAW Uncompressed Video VDec: vo config request - 448 x 336 (preferred colorspace: BGR 24-bit) VDecoder init failed :( Opening video decoder: [raw] RAW Uncompressed Video VDec: vo config request - 448 x 336 (preferred colorspace: BGR 24-bit) VDecoder init failed :( Opening video decoder: [raw] RAW Uncompressed Video VDec: vo config request - 448 x 336 (preferred colorspace: BGR 24-bit) VDecoder init failed :( Opening video decoder: [raw] RAW Uncompressed Video VDec: vo config request - 448 x 336 (preferred colorspace: BGR 24-bit) VDecoder init failed :( Opening video decoder: [raw] RAW Uncompressed Video VDec: vo config request - 448 x 336 (preferred colorspace: BGR 24-bit) VDecoder init failed :( Opening video decoder: [raw] RAW Uncompressed Video VDec: vo config request - 448 x 336 (preferred colorspace: BGR 24-bit) VDecoder init failed :( Opening video decoder: [raw] RAW Uncompressed Video VDec: vo config request - 448 x 336 (preferred colorspace: BGR 24-bit) VDecoder init failed :( Opening video decoder: [raw] RAW Uncompressed Video VDec: vo config request - 448 x 336 (preferred colorspace: Packed YUY2) VDec: using Packed YUY2 as output
Re: [PHP] system command runs application, but application doesn't work correctly
On Jan 16, 2008 7:56 PM, Apple [EMAIL PROTECTED] wrote: Hello, I'm trying to run mencoder command line utility to encode videos. When I use these two command in terminal (through SSH), everything works fine. But when I run them from PHP script with system command, it doesn't work. [snip] Try replacing system() with die() and letting it print out the information full command string. That may give you an idea of a variable that's either incorrect or undefined. If you copy and paste it and run the command from the command line and it works, then it may be permissions issues. One part of the snipped content that I noticed kept repeating is the following (and actually ending with this line): 'VDecoder init failed :( Read DOCS/HTML/en/codecs.html' Did you follow the advice and read that document? Beyond that, it's a question that should probably instead be asked on a mencoder mailing list, since PHP's system() function is working correctly, but apparently isn't getting the information it needs to pass stuff back-and-forth with the system. -- /Dan Daniel P. Brown Senior Unix Geek and #1 Rated Year's Coolest Guy By Self Since Nineteen-Seventy-[mumble]. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] snmp_set_valueretrieval depends on what?
On 16/01/2008, Richard Lynch [EMAIL PROTECTED] wrote: You can check at http://xlr.php.net but I suspect that it's too new to be in your version of PHP. You are on 5.2.1 and php.net is offering 5.2.5, so you're just enough behind for this to be very plausible. Maybe get Ubuntu to catch up? :-) Thanks, Richard. That link seems broken, are you sure that it is correct? Dotan Cohen http://what-is-what.com http://gibberish.co.il א-ב-ג-ד-ה-ו-ז-ח-ט-י-ך-כ-ל-ם-מ-ן-נ-ס-ע-ף-פ-ץ-צ-ק-ר-ש-ת A: Because it messes up the order in which people normally read text. Q: Why is top-posting such a bad thing?
RE: [PHP] Scripts are fast locally, but slow on remote server
memory limitation in the php ini? bastien Date: Wed, 16 Jan 2008 16:29:53 +0900 From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] CC: php-general@lists.php.net Subject: Re: [PHP] Scripts are fast locally, but slow on remote server Per Jessen, Thank you for responding. Might this be a name-server issue? Maybe, but I don't think so. The reason I suspect that is not the case is because I can go first to a .html page on the server, and it loads up quickly. Then I go to one of my .php pages, and the slowdown occurs. If it were a name server issue, I would expect the slowdown to happen regardless of which page I load first. So, I guess to be more specific, the slowdown happens the first time I load one of my PHP scripts on this site, not the first time I access the site. -- Dave M G -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php _
[PHP] PHP array entries max limit
Hi All I would like to know how many entries does PHP associative array can handle. Cheers Prabath
[PHP] PHP function to list all mysql tables used in a script
Hello All, I have php script which performs various sql operations, like insert row in table A, delete row from Table B and Update rows in table C. Now I would like to display all those tables that are affected by my script. Can anyone send me a function or script if it is already available? Thanks, javed _ Express yourself instantly with MSN Messenger! Download today it's FREE! http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/
Re: [PHP] PHP function to list all mysql tables used in a script
Javed Khan wrote: Hello All, I have php script which performs various sql operations, like insert row in table A, delete row from Table B and Update rows in table C. Now I would like to display all those tables that are affected by my script. Can anyone send me a function or script if it is already available? You probably could have written what you wanted by now, and that's going to be the only way to do it - write something by hand. -- Postgresql php tutorials http://www.designmagick.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php