Re: [PHP] A Good OOP Tutorial/Read?
On 05/16/2013 11:55 AM, Dan Joseph wrote: Hey Folks, I'm looking to refine my PHP 5 OOP skills. I know the basics, understand patterns, but have clearly missed a few things along the way. Do any of you have some real good PHP 5 OOP tutorials/reads bookmarked you could share? Something other than php.net/oop5. Try, Tente, http://www.killerphp.com/tutorials/object-oriented-php/ Success! Sucesso! ___ Francisco C Soares ( *Junior* ) 403790c89847cdbe5a262146de8fb93139c4 BLOG dotjunior.blogspot.com http://dotjunior.blogspot.com/
[PHP] Re: Date validation
What about using this: $date = DateTime::createFromFormat(Y-m-d, 2011-05-20); -- João Cândido de Souza Neto Geoff Lane ge...@gjctech.co.uk escreveu na mensagem news:11565581.20110520132...@gjctech.co.uk... Hi All, I'm scratching my head trying to remember how I validated string representation of dates 'the first time around' with PHP (before going over to ASP/VBScript for almost a decade). I have a feeling that I must have rolled my own validation function, because I can't find anything other than strtotime() and checkdate() in PHP itself. Although checkdate() seems fine, strtotime() appears to be 'broken'. It seems where possible to return a timestamp that makes some sense rather than return FALSE when handed an invalid date. For example, strtotime('30 Feb 1999') returns 920332800, which is equivalent to strtotime('02 Mar 1999'). When I ask a user to enter a date and they make a typo, forget that September only has 30 days, etc., I want to be able to detect the problem rather than post a date in the following month! It also seems that where the DateTime class uses string representation of dates, times, or intervals that these must be 'in a format accepted by strtotime()'; which implies that 'under the hood' strtotime() is used to convert the string to a date/time value, which implies that the Date/Time class cannot properly handle string input values. This seems to be such a common requirement that I suspect I've missed something basic. I'd thus be grateful for any pointers as to how to properly validate user-input string representation of dates. Cheers, -- Geoff Lane -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Date validation
If you look carefully, you´ll notice that I´m using the DateTime object (default from PHP 5.2.0 or higher) not the function date. -- João Cândido de Souza Neto Peter Lind peter.e.l...@gmail.com escreveu na mensagem news:banlktinjonyvfnqjqtfqtdmu_r2-cfp...@mail.gmail.com... On 20 May 2011 16:22, Geoff Lane ge...@gjctech.co.uk wrote: On Friday, May 20, 2011, João Cândido de Souza Neto wrote: What about using this: $date = DateTime::createFromFormat(Y-m-d, 2011-05-20); Hi João, and thanks for your help. FWIW, I thought about that but it didn't work for me. On further investigation, I'm now completely confused and suspect I've got a duff PHP installation. Thankfully, it's a virtual machine so it should be reasonable easy to 'vapourise' and start over (perhaps with CentOS rather than Ubuntu as the OS). Anyway, the following code produces the following result when the variable $str = '7 feb 2010': [code] echo pDate is $str/p\n; $date = DateTime::createFromFormat('d M Y', $str); echo pre; print_r($date); echo /pre\n; echo date('d M Y') . br / . date('d M Y', $date); [/code] [result] pDate is 7 feb 2010/p preDateTime Object ( [date] = 2010-02-07 15:11:34 [timezone_type] = 3 [timezone] = Europe/London ) /pre 20 May 2011br / [/result] This is pretty much as expected except that the second call to date() - i.e. date('d M Y', $date) - outputs nothing. date() takes an int as second parameter - a timestamp. Not an object. And from a quick test it doesn't look like DateTime has a __toString method. Also, AFAICT createFromFormat fails if the date is not formatted according to the first parameter. So, for example: $date = DateTime::createFromFormat('d M Y', '5/2/10') fails ... (at least, it does on my system :( ) I'm sorry for asking but what did you expect?? You're specifically calling a method that parses a string according to a given format. If it parsed the string according to any other format, that would be a huge WTF. Regards Peter -- hype WWW: plphp.dk / plind.dk LinkedIn: plind BeWelcome/Couchsurfing: Fake51 Twitter: kafe15 /hype -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Array Search
It´s a job to array_key_exists function. -- João Cândido de Souza Neto Ethan Rosenberg eth...@earthlink.net escreveu na mensagem news:0lim00hi3ihny...@mta4.srv.hcvlny.cv.net... Dear List - Here is a code snippet: $bla = array(g1 = $results[7][6], h1 = $results[7][7]); print_r($bla); $value = h1; $locate1 = array_search($value, $bla); echo This is locate ; print_r($locate1); if(in_array($value, $bla)) print_r($bla); Neither the array_search or the in_array functions give any results. I have tried it with both h1 and h1; $results[7][6] = Wn; $results[7][7] = Wr; This is a chess board where g1 and h1 are the coordinates and the results array contains the pieces at that coordinate. What am I doing wrong? Advice and comments please. Thanks. Ethan Rosenberg -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] First PHP job
It must be a big joke!!! -- João Cândido de Souza Neto Robert Cummings rob...@interjinn.com escreveu na mensagem news:4d2c997d.3010...@interjinn.com... On 11-01-11 12:15 PM, David Harkness wrote: On Tue, Jan 11, 2011 at 4:19 AM, Jay Blanchardjblanch...@pocket.comwrote: I am always looking for the $needle in the $haystack. Just sayin' I often find it faster to hire a bunch of horses to eat the $haystack, leaving the $needle behind and easy to find. My horse now has a perforated stomach and colon. Can I send you the veterinarian's bill? ;) Cheers, Rob. -- E-Mail Disclaimer: Information contained in this message and any attached documents is considered confidential and legally protected. This message is intended solely for the addressee(s). Disclosure, copying, and distribution are prohibited unless authorized. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Stripping carriage returns
What about trying str_replace(PHP_EOL, , $content); -- João Cândido de Souza Neto Richard S. Crawford rich...@underpope.com escreveu na mensagem news:aanlktimzfk+ku6dkvjmhekbsycuosn2tv+0txfsn9...@mail.gmail.com... I'm retrieving CLOB data from an Oracle database, and cleaning up the HTML in it. I'm using the following commands: $content = strip_tags($description-fields['CONTENT'],'polulli'); $content = preg_replace(/p.*/,p,$content); The second line is necessary because the p tag frequently comes with class or style descriptions that must be eliminated. This works on the whole except where the p tag with the style definition is broken up over two or more lines. In other words, something like: p class = bullettext style = line-height: normal border: 3; In this case, the second line of my code does not strip the class or style definitions from the paragraph tag. I've tried: $content = nl2br($content) and $content = str_replace(chr(13),$content) and $content = preg_replace(/[.chr(10).|.chr(13).]/,,$content) (I've read that Oracle uses chr(10) or chr(13) to represent line breaks internally, so I decided to give those a try as well.) and $content = str_replace(array('\n','\r','\r\n'),$content) all to no avail; these all leave the line break intact, which means my preg_replace('/p.*/','p',$content) line still breaks. Anyone have any ideas? -- Sláinte, Richard S. Crawford (rich...@underpope.com) http://www.underpope.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] HTML id attribute and arrays
How should I follow the HTML specification while having the passed parameters automatically converted to arrays in PHP? The name attribute, not the id attribute, is used as the key when submitting form values. The name and id attributes do not have to be the same. Thank you, I thought it should be the same (for same reason, maybe compatibility between XHTML and HTML). But could not find anything on the net which states this. So my memories might be corrupted :) Based on first tests, it works (but have not checked the W3C validator yet). Thanks, Martin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] HTML id attribute and arrays
How should I follow the HTML specification while having the passed parameters automatically converted to arrays in PHP? The name attribute, not the id attribute, is used as the key when submitting form values. The name and id attributes do not have to be the same. Thank you, I thought it should be the same (for same reason, maybe compatibility between XHTML and HTML). But could not find anything on the net which states this. So my memories might be corrupted :) Based on first tests, it works (but have not checked the W3C validator yet). Thanks, Martin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] HTML id attribute and arrays
The name and id attributes do not have to be the same. Thank you, I thought it should be the same You're probably thinking of: http://www.w3.org/TR/html401/struct/links.html#h-12.2.3 The id and name attributes share the same name space. This means that they cannot both define an anchor with the same name in the same document. It is permissible to use both attributes to specify an element's unique identifier for the following elements: A, APPLET, FORM, FRAME, IFRAME, IMG, and MAP. When both attributes are used on a single element, their values must be identical. Confusing, the name attribute on a form field (input, textarea, select, etc) is different to the name attribute on a a or form element, so this rule does not apply to it. Thank you, Benjamin, for clarification. This sounds like the source of my (bogus) feeling. Martin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] HTML id attribute and arrays
Hi, PHP converts x[a]=b parameter of the HTTP request as an array named x with its item named a set to value b. So, it seems possible to have the following (X)HTML code: input type=text name=x[a] id=x[a] value=b / Unfortunatelly, HTML specification does not allow neither [ nor ] inside the id attribute. Specifically: * Must begin with a letter A-Z or a-z * Can be followed by: letters (A-Za-z), digits (0-9), hyphens (-), underscores (_), colons (:), and periods (.) * Values are case-sensitive How should I follow the HTML specification while having the passed parameters automatically converted to arrays in PHP? Thank you for any tips, Martin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: How does one reply to messages on this list?
As I use outlook, I just hit Reply to Group. -- João Cândido de Souza Neto Sam Smith a...@itab.com escreveu na mensagem news:aanlktikarnvhn-gzexe8qedngeewgqqgs7cpchzav...@mail.gmail.com... If I just hit 'Reply' I'll send my reply to the individual who created the message. If I hit 'Reply All' my reply will be sent to: Govinda govinda.webdnat...@gmail.com, PHP-General List php-general@lists.php.net and the creator of the message. Neither option seems correct. What's up with that? Thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: use of ini vs include file for configuration
Agreed. -- João Cândido de Souza Neto Tamara Temple tamouse.li...@gmail.com escreveu na mensagem news:977f087c-bb11--b851-21616ae9e...@gmail.com... I'm curious what the lists' opinions are regarding the use of an .ini file versus an include configuration file in PHP code are? I can see uses for either (or both). To me, it seems that an .ini file would be ideal in the case where you want to allow a simpler interface for people installing your app to configure things that need configuring, and an included PHP code configuration file for things you don't necessarily want the average installer to change. What do you think? Tamara -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: which one is faster
As I can see, it´d be too much faster to decide by yourself than reading all theese answers and understanding their differences and taking people´s time for nothing. -- João Cândido de Souza Neto saeed ahmed saeed@gmail.com escreveu na mensagem news:aanlktikh6g5ilsz3hkxatg=h1wzobgoko7byngo0p...@mail.gmail.com... $a = 'hey'; $b = 'done'; $c = $a.$b; $c = $a$b; which one is faster for echo $c. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: json_encode() behavior and the browser
It can have something to do with your browser codification (UTF8, ISO-8859-???). -- João Cândido de Souza Neto Christoph Boget cbo...@hotmail.com escreveu na mensagem news:aanlkti=45-heto2myhq116gv6bfxvdba_yxfzjnqk...@mail.gmail.com... I'm curious if the behavior of json_encode() is influenced by the browser at all. I have a page that returns search results. If I access the page and perform a search using Chrome, the following error shows up in the log: PHP Warning: json_encode() [a href='function.json-encode'function.json-encode/a]: Invalid UTF-8 sequence in argument in [PAGE] on line [LINE] If I access the page and perform a search, the exact same search using the exact same parameters, using Firefox then I get the expected results. When I var_dump() the return value of json_encode(), I see that it is a null in the case where I accessed using chrome but the expected string in the case where I accessed using firefox. In both cases, the input array is identical. Given the identical input and different output, the only thing I can figure is that the headers sent to the server as part of the request figure in to how json_encode() behaves. Is that the case? Or am I barking up the wrong tree? To be clear, I'm not talking about how the browser ultimately handles the json encoded data. I know there can be issues with that. I'm talking about the process before the data is even shipped to the browser -- about how json_encode() behaves when executed as part of the PHP script. thnx, Christoph -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: json_encode() behavior and the browser
http://www.w3.org/TR/html4/charset.html I hope it can help you. PS: json_decode works only in utf8. -- João Cândido de Souza Neto Christoph Boget cbo...@hotmail.com escreveu na mensagem news:aanlktikpqdckrq7ctjwccgspz-c4fxpcnxxn_u48+...@mail.gmail.com... You should set the charset of your page by meta tag in its head. Do you have a source of reference to which you point me? thnx, Christoph -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: json_encode() behavior and the browser
Are you setting the charset in your html head? If not, its using the charset set in your browser, which can be different from one to another. In this case, you must set if via meta tag to avoid it. -- João Cândido de Souza Neto Christoph Boget cbo...@hotmail.com escreveu na mensagem news:aanlktimbfbgunifhthztp+2jnhzgmo8uqvwydq4vd...@mail.gmail.com... http://www.w3.org/TR/html4/charset.html I hope it can help you. PS: json_decode works only in utf8. I understand charsets. I understand the difference between the charsets. What I don't understand is how json_encode() is taking the *exact same input* and behaving differently (breaking in one case, working in another) depending on the browser being used. And taking your statement that json_encode() works only in utf-8 as a given, how can I guard against the different behaviors on the backend, where json_encode() is getting executed. Should I do some kind of header sniffing prior to every call to json_encode() and massage the data accordingly depending on what I find? That seems somewhat excessive. But based on what you are saying and based on what I'm witnessing, it seems like there is no other way around that. thnx, Christoph -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: json_encode() behavior and the browser
Sorry about the error: In this case, you must set IT via meta tag to avoid it. -- João Cândido de Souza Neto João Cândido de Souza Neto j...@consultorweb.cnt.br escreveu na mensagem news:16.27.07419.e0e5e...@pb1.pair.com... Are you setting the charset in your html head? If not, its using the charset set in your browser, which can be different from one to another. In this case, you must set if via meta tag to avoid it. -- João Cândido de Souza Neto Christoph Boget cbo...@hotmail.com escreveu na mensagem news:aanlktimbfbgunifhthztp+2jnhzgmo8uqvwydq4vd...@mail.gmail.com... http://www.w3.org/TR/html4/charset.html I hope it can help you. PS: json_decode works only in utf8. I understand charsets. I understand the difference between the charsets. What I don't understand is how json_encode() is taking the *exact same input* and behaving differently (breaking in one case, working in another) depending on the browser being used. And taking your statement that json_encode() works only in utf-8 as a given, how can I guard against the different behaviors on the backend, where json_encode() is getting executed. Should I do some kind of header sniffing prior to every call to json_encode() and massage the data accordingly depending on what I find? That seems somewhat excessive. But based on what you are saying and based on what I'm witnessing, it seems like there is no other way around that. thnx, Christoph -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: json_encode() behavior and the browser
In this case, you are right. It has nothing to do with the browser. You´ll need a more detailed debug so you can see excatly what´s happening. -- João Cândido de Souza Neto Christoph Boget cbo...@hotmail.com escreveu na mensagem news:aanlktikctht0nxz1hi0ezj=i2m3716wepd=deppke...@mail.gmail.com... Sorry about the error: In this case, you must set IT via meta tag to avoid it. Ok, let's try this using a different approach. Consider the following pseudo-code: ?php $result = mysql_query( 'SELECT name, date FROM table WHERE field = value' ); $array = array(); while( $row = mysql_fetch_assoc( $result )) { $array[] = $row; } $string = json_encode( $array ); ? Why does the charset of the browser matter one whit to the value of either $row['name'] or $row['date'] such that it would break json_encode() in one case and not the other. Is it that PHP is taking the string which is returned as part of the result set and encoding it to match the charset passed in from the browser? thnx, Christoph * Disclaimer : the actual code (and data repository) I am using is slightly different from the above but is similar enough so that it's a valid representation -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Removing link on the fly, but leave link text
Try this: $pattern = array( /a [^]/, //a/ ); preg_replace($pattern, , $text); -- João Cândido de Souza Neto Karl DeSaulniers k...@designdrumm.com escreveu na mensagem news:007bc8e1-b2c8-4dd5-9d18-eb07b0d55...@designdrumm.com... Hi, Say I have some text. $text = 'You can logon here: a href=http://website.com/shop/ index.php?username='.$username.'http://website.com/shop/index.php? username='.$username.'/a. This link will take you to your web browser to login.'.$eol; I want to be able to strip the a href=http://website.com/shop/ index.php?username='.$username.' and /a. Leaving just the http://website.com/shop/index.php?username='. $username.' text, so it would end up like. $text = 'You can logon here: http://website.com/shop/index.php? username='.$username.'. This link will take you to your web browser to login.'.$eol; I have tried MANY different ways and have no success. Can anyone help me? TIA Karl DeSaulniers Design Drumm http://designdrumm.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Variable in variable.
Really cool... Thanks and fogive me by my mistake. hehe -- João Cândido de Souza Neto Robert Cummings rob...@interjinn.com escreveu na mensagem news:4c76743a.2060...@interjinn.com... On 10-08-26 09:54 AM, João Cândido de Souza Neto wrote: I know that in PHP I can use this: $var1 = text; $var2 = '$var1'; 4cho $$var2; So it gives me text. It would if you didn't have typos and the wrong quotes in the above :) My question is, is there a way of doing it with constant like this? define(CONST, text); $test = CONST; echo $$test; So it gives me text. http://ca3.php.net/manual/en/function.constant.php Cheers, Rob. -- E-Mail Disclaimer: Information contained in this message and any attached documents is considered confidential and legally protected. This message is intended solely for the addressee(s). Disclosure, copying, and distribution are prohibited unless authorized. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Upload using FTP commands
A form sendind a file has nothing to do with FTP functions of PHP. You´ll still need to change de upload_max_filesize and so on in order to send such files to the server. -- João Cândido de Souza Neto Matthew Croud m...@obviousdigital.com escreveu na mensagem news:02f75bf6-9ec5-4456-9150-07042aeba...@obviousdigital.com... Hi, I want to give my client the ability to upload large files ( around 20MB ) to a webspace. I reckon that using the FTP commands of PHP would be the best bet, but is it possible to allow them to do this through an online form. This is my vision: the client logs in to a form that has an upload button, and the upload button uses the FTP commands to upload the file. Is that do-able in PHP ? Cheers! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Fatal error: Call to undefined method
Try this: ?php class PropertyMgmt { function PropertyMgmt() { global $complexes; /* yes I know using globals is dangerous, I will fix this soon! :-) */ } public function get_complexes() { /* null */ } } // end class -- João Cândido de Souza Neto TransientSeeker gritswa...@hotmail.com escreveu na mensagem news:29494740.p...@talk.nabble.com... Greetings, I'm having a very simple problem that I can't seem to find the solution to. I try and access a method in this class I made called MyPropertyManagement... the method is named get_complexes(). I try and strip down the entire class to just focus on this problem with the hopes of it making things simple enough that the error will become apparent, but unfortunately it has not. I am able to make a new instances of this class, add in some other methods and run/use them just fine. For some reason this method keeps erroring out saying it is undefined. I don't understand why? Can someone please shed some light on this subject please? The error is: Fatal error: Call to undefined method PropertyMgmt::get_complexes() in /usr/www/test/test2.php on line 6 The files are as follows: /*** /usr/www/test/inc/class/PropertyManagement.class.php ***/ ?php class PropertyMgmt { function PropertyMgmt() { global $complexes; /* yes I know using globals is dangerous, I will fix this soon! :-) */ } public function PropertyMgmt::get_complexes() { /* null */ } } // end class /*** /usr/www/test/test2.php ***/ ?php require_once('/usr/www/test/inc/class/PropertyMgmt.class.php'); $PM = new PropertyMgmt(); $PM-get_complexes(); die(); /* end test2.php / Thank you in advance... - ___ PHP 5.3.3 Apache 1.3.37 MySQL 5.0.24a FreeBSD 6.2-PRERELEASE -- View this message in context: http://old.nabble.com/Fatal-error%3A-Call-to-undefined-method-tp29494740p29494740.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
[PHP] hash problem.
I´ve got the setting in my /etc/login.defs file as bellow: # Use MD5 or DES to encrypt password? Red Hat use MD5 by default. MD5_CRYPT_ENAB no ENCRYPT_METHOD SHA512 So, when I try to get this: echo hash(sha512, $_POST[password]); It does not match the password the user´s got in /etc/shadow file. Anyone knows why? -- João Cândido de Souza Neto -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Regular Expression to get the whole Comma Separated String in Array Key
Not tested, but I think it should work: preg_match_all('/(\d+),/', $postText, $matches); -- João Cândido de Souza Neto Gaurav Kumar kumargauravjuke...@gmail.com escreveu na mensagem news:aanlktikdb_ismnkpomicxzsfzixg4dedznunrcimj...@mail.gmail.com... Hi All, Need help in resolving the below problem- I would like to get the whole comma separated string into an array value- 1. $postText = chapters 5, 6, 7, 8; OR 2. $postText = chapters 5, 6; OR 3. $postText = chapters 5, 6, 7; What i have done so far is- preg_match('/chapter[s]*[ ]*(\d+, \d+, \d+)/i', $postText, $matches); The above will exactly match the third value $postText = chapters 5, 6, 7; By Above $matches will contain a value of : $matches[1] = '5, 6, 7'; Now i need a SINGLE regular expression which can match first, second variable above or any number of comma separated string and IMPORTANTLY provide me that whole comma separated sting value (as above) in single array key element like below- $matches[1] = '5, 6, 7'; OR $matches[1] = '5, 6'; OR $matches[1] = '5, 6, 7, 8, 9'; Also I have to use regular expression only as the flow of the code does not permit to use any other method to get comma separated string from the master/base string. Thanks, Gaurav Kumar -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] file_get_contents limit
The characters are stripped off of the end of the file after that point. -- João Cândido de Souza Neto Ashley Sheridan a...@ashleysheridan.co.uk escreveu na mensagem news:1277841481.2253.39.ca...@localhost... On Tue, 2010-06-29 at 16:53 -0300, Jo?o C?ndido de Souza Neto wrote: Ive got a file with only one line 21917 characters long but when I read this file using $varData = file_get_contents(file.txt) it gets only 21504 characters. Anyone would know why does it happen? Thanks in advance. -- Joo Cndido de Souza Neto Are the characters stripped off of the end of the file after that point, or is the encoding not correctly determined and some characters are converted the wrong ones? Thanks, Ash http://www.ashleysheridan.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: stripping first comma off and everything after
Why not this? $var = explode(,,$entries[$i][dn]); $var = $var[0]; Adam Williams adam_willi...@bellsouth.net escreveu na mensagem news:4c1bcf62.5070...@bellsouth.net... I'm querying data and have results such as a variable named $entries[$i][dn]: CN=NTPRTPS3-LANIER-LD335c-LH107-PPRNP9A92,OU=XXf,OU=XX,OU=X,DC=,DC=xx,DC=xxx Basically I need to strip off the first command everything after, so that I just have it display CN=NTPRTPS3-LANIER-LD335c-LH107-PPRNP9A92. I tried echo rtrim($entries[$i][dn],,); but that doesn't do anything. Any ideas? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Test [don't read]
I couldn´t resist. tedd tedd.sperl...@gmail.com escreveu na mensagem news:p0624080cc832e662f...@[192.168.1.102]... -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Test [don't read]
I couldn´t resist. tedd tedd.sperl...@gmail.com escreveu na mensagem news:p0624080cc832e662f...@[192.168.1.102]... -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: what's the point of _autoload?
I use this in a different way so I think it can be useful for everyone avoiding long and complex codes. I´ve got a file called classes.php that looks like: ?php $Classes = new stdClass(); $Classes-Smarty = BASE_PATH.includes/Smarty/Smarty.class.php; $Classes-Mail = BASE_PATH.includes/mail/Mail.php; ? So my _autoload() looks like: function MY__autoload($className) { require_once(classes.php) require_once($Classes-$className); } if (function_exists(spl_autoload_register) ) { spl_autoload_register(MY__autoload); } else { function __autoload($className) { MY__autoload($className); } } Hope it can help you. Michael N. Madsen m...@criion.net escreveu na mensagem news:62.43.44964.9b05d...@pb1.pair.com... Since php started to support oop it has moved more and more features in that direction. This is good for me because I love oop. Then came _autoload() and I was rejoiced only to find that this (no fun)ction can't be used to it's fullest potential in oop unless I have all the files in the same directory. This is where you correct me and tell me how I can have a file structure in more then one level and still get the ripe juices of _autoload() (Please, I beg you!) I have looked at the comments on the doc page of the function and every single one comes with the addition of many, often complex lines of code that will only add more load on the server. If _autoload can't figure out the correct path to the file which defines the class, then what is the point from an oop pov? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Getting source from remote file
Hi guys and girls, okay, this is a dumbnut question I wouldn't bother asking but I really did hit a spot now where I am totally wedged up in my head and can't think straight anymore... so the, I bet easy, answer to my question escapes me. What I am trying to do is the following: Read the contents of a remote file via file() So I do $content = file($url); Now $content holds the HTML source of the page. Now this page has some DIVs in it with a class myclass123 (just for this purpose) Now I want to get the content of these divs into a variable / some variables. No more, no less. Can anybody please direct me towards the answer? Damn, I must sleep more at night, so I can think straight at work Any help is very much appreciated! Thanks! Chris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Getting source from remote file
On 6 May 2010 10:55, Peter Lind peter.e.l...@gmail.com wrote: You could parse the document with the DOM classes. Load as a DOMDocument, then grab what's needed with the relevant methods (you can use xpath to single out your divs with the right classes). http://dk2.php.net/domdocument Xpath is indeed the way to go. For example... /* .. your code.. */ $data = file_get_contents($url); $inDoc = new DOMDocument(); $inDoc-preserveWhiteSpace = false; @$inDoc-loadHTML($data); $xpath = new DOMXPath($inDoc); $xlinks = $xpath-query('//d...@class=b]/a'); for ($a = 0, $z = $xlinks-length; $a $z; ++$a) { $link = $xlinks-item($a); $href = $xlink-attributes-getNamedItem('href')-value; } To be safe, you should use an ID instead of a class, though. Michiel Hi all, and thanks a lot for your suggestions. It works well now. The only problem I do have are german Umlaute [äöü] when receiving the content of the remote page. It#s formatted in iso-8859-1 and I'd rather have it in UTF-8. But utf8_de/encode won't help me there, I'm afraid. Anyhow, thanks a lot for your help! Chris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Math Question....
for ($g = $maxpergroup; $g 0; $g++) { if ($items mod $g 0) continue; $Groups = $items div $g; } Maybe it can helps you. Dan Joseph dmjos...@gmail.com escreveu na mensagem news:q2oa20394491004220707x980cef5ej2b310c97d1230...@mail.gmail.com... Howdy, This is a math question, but I'm doing the code in PHP, and have expunged all resources... hoping someone can guide me here. For some reason, I can't figure this out. I want to take a group of items, and divide them into equal groups based on a max per group. Example. 1,252,398 -- divide into equal groups with only 30 items per group max. Can anyone guide me towards an algorithm or formula name to solve this? PHP code or Math stuff is fine. Either way... Thanks... -- -Dan Joseph www.canishosting.com - Unlimited Hosting Plans start @ $3.95/month. Promo Code NEWTHINGS for 10% off initial order http://www.facebook.com/canishosting http://www.facebook.com/originalpoetry -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: imagecopyresize
-Original Message- From: Karl DeSaulniers [mailto:k...@designdrumm.com] Sent: Tuesday, April 06, 2010 10:39 AM To: na...@alienworkers.com Cc: php-general@lists.php.net Subject: [PHP] Re: imagecopyresize Sweet deal. Thanks Nadim. I think I got my script to work finally, but if it proves to be a no-go. I will definately take a look. Thanks for sharing. Best, Karl On Apr 6, 2010, at 3:29 AM, Nadim Attari wrote: Hello Karl, Use the attached code i wrote myelf for my projects. You can upload and create images of other sizes. Hope it will be easy to use. Ese if you need help, come on MSN (my email address) Note that you will have to implement the watermark part - i'm providing you the upload and create codes only. regards, nadim attari mauritius (indian ocean) --- Hello Nadim, would you mind sharing this script with me / us, too? I'd love to have a look at it, if you don't mind :o) All the best Chris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Audiobooks for Developers
Good day all, since I am driving 2 hrs each day listening to either my radio or the songs on my USB drive, I was wondering whether there are some web dev related audio books for download out there. I have been searching the big G for this stuff, but haven't found anything. Do you guys know of any good resource? With best regards, Christian Hänsel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Audiobooks for Developers
Have you consider getting an ebook (preferably PDF as Windows' Narrator, if you're using Windows, works really well with Acrobat) on the subject you're interested then use a TTS, like Windows' Narrator, and record it on your system as an alternative solution? Using this approach would be more flexible to your selection of the subject matter. That might actually work. I will give that a shot. ;o) Thanks for this suggestion Cheers Chris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Audiobooks for Developers
-Original Message- From: Bob McConnell [mailto:r...@cbord.com] Sent: Wednesday, March 31, 2010 2:52 PM To: php-general@lists.php.net Subject: RE: [PHP] Audiobooks for Developers From: Auto-Deppe C. Hänsel since I am driving 2 hrs each day listening to either my radio or the songs on my USB drive, I was wondering whether there are some web dev related audio books for download out there. I have only one recommendation. DON'T DO IT! Driving a vehicle on public highways is dangerous enough without any significant distractions. You don't want to complicate it by adding a task that tempts you to focus on something other than the road, signals and other traffic. That is a good way to cause accidents. Bob McConnell -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Hi Bob, thanks for your advide, I understand your concern. I honestly do. Let me show you quickly the route I am driving every day: http://maps.google.de/maps?f=dsource=s_dsaddr=helpupdaddr=extertalhl=de; geocode=Fb3-GAMdIuyEACmdszYJpEC6RzERLZJMgvInJg%3BFetyGgMdDjuLACn7EwcOCWG6RzF 39JiIvP5PLAmra=lssll=51.151786,10.415039sspn=20.175322,57.084961ie=UTF8 t=hz=12 In the morning, it is SO boring I leave home at 5:30am, so not much traffic going on. In the afternoon, there is no way of driving fast enough to cause an accident *haha* Seriously though: I am always listening to audio books or the radio... but I do focus on the traffic rather than the audio. Believe me, I understand your concern. But still: I want audio books :o)) Chris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Microsoft outlook takes out all stressed letters on subject.
Yes, it does. Thanks. João Cândido Bob McConnell r...@cbord.com escreveu na mensagem news:ff8482a96323694490c194babeac24a0058c5...@email.cbord.com... From: João Cândido de Souza Neto When I send an e-mail from PHP (not using the mail function) everithing works fine, but when such e-mail´s got in Microsoft Outlook it takes out all stressed letters in mail´s subject what doesn´t happen in Outlook Express? My question is? Is there any header that can avoid it? What code page is Lookout using? Does that page have those letters in it? Does it use the same character encoding that the source did? Bob McConnell -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] JPGraph error.
Hey guys. In my system we´ve got an option of getting charts of some data and it´s many options. My problem is that it works fine on my test server but in my client´s server it gives me the following error as you can see. *** glibc detected *** /var/www/html/bin/httpd: munmap_chunk(): invalid pointer: 0x0a319b78 *** === Backtrace: = /lib/libc.so.6(cfree+0x1bb)[0x17d81b] /var/www/html/modules/libphp5.so(_efree+0x7e)[0x4bd35e] /var/www/html/modules/libphp5.so(zend_hash_destroy+0x5c)[0x4dbd7c] /var/www/html/modules/libphp5.so(_zval_dtor_func+0x55)[0x4d27e5] /var/www/html/modules/libphp5.so(_zval_ptr_dtor+0x4f)[0x4c7f0f] /var/www/html/modules/libphp5.so(zend_hash_destroy+0x36)[0x4dbd56] /var/www/html/modules/libphp5.so(destroy_zend_class+0x3a)[0x4cb86a] /var/www/html/modules/libphp5.so[0x4dba07] /var/www/html/modules/libphp5.so(zend_hash_reverse_apply+0x57)[0x4dbb47] /var/www/html/modules/libphp5.so(shutdown_executor+0x404)[0x4c85c4] /var/www/html/modules/libphp5.so(zend_deactivate+0x93)[0x4d2e83] /var/www/html/modules/libphp5.so(php_request_shutdown+0x1e0)[0x497bd0] /var/www/html/modules/libphp5.so[0x548927] /var/www/html/bin/httpd(ap_run_handler+0x59)[0x8074bf9] /var/www/html/bin/httpd(ap_invoke_handler+0x67)[0x8077d67] /var/www/html/bin/httpd(ap_process_request+0x178)[0x808e308] /var/www/html/bin/httpd[0x808b60b] /var/www/html/bin/httpd(ap_run_process_connection+0x59)[0x807bb19] /var/www/html/bin/httpd[0x80a1240] /var/www/html/bin/httpd[0x80a1537] /var/www/html/bin/httpd(ap_mpm_run+0x880)[0x80a1e90] /var/www/html/bin/httpd(main+0x845)[0x80629d5] /lib/libc.so.6(__libc_start_main+0xdc)[0x129f2c] /var/www/html/bin/httpd(apr_os_proc_mutex_put+0x5d)[0x8061be1] === Memory map: [Thu Feb 25 16:17:20 2010] [notice] child pid 2850 exit signal Aborted (6) Does anybody know why is it happening? Thanks in advance. João. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PLEASE, PLEASE, PLEASE - HELP ME GET OFF THIS LIST
PLEASE, PLEASE, PLEASE - HELP ME GET OFF THIS LIST --- YOU PEOPLE ARE DRIVING ME CRAZY1 Please unsubscribe: m...@honeyflowfarm.com, wschn...@mail.honeyflowfarm.com or anyone else @honeyflowfarm.com or wschn...@gm.com PLEASE At 08:32 AM 2/23/2010, you wrote: Hi! This is the ezmlm program. I'm managing the php-wind...@lists.php.net mailing list. I'm working for my owner, who can be reached ...snip... This was a request generated from the form at http://www.php.net/mailing-lists.php by 67.45.116.83. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Force-Saving an Audio File
Thanks Gaurav Shawn, I'll check into your suggestions. Thanks, c...@hosting4days.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Force-Saving an Audio File
Hi folks, I'm trying to force save .mp3 files so this is a test page (found on the net). It works fine when: $directory = ; // so the audio is in the same local directory but fails when I use a REAL web directory - (the audio file is here - http://mysite.com/test1/audio.mp3 ) $directory = http://mysite.com/test1/;; says - The file $file was not found. Q: Any ideas how to get it to download from the website? = ?php $file = 'audio1.mp3'; $directory = http://mysite.com/test1/;; //$directory = ; $path = $directory$file; if(ini_get('zlib.output_compression')) ini_set('zlib.output_compression', 'Off'); $file_extension = strtolower(substr(strrchr($path,.),1)); if( $file == ) { echo html head titleFile not found./title /head body File not found. /body /html; exit; } elseif (! file_exists( $path ) ) { echo html head titleThe file $file was not found./title /head body The file $file was not found.br / - path - $path /body /html;exit; }; switch( $file_extension ) { case pdf: $ctype=application/pdf; break; case zip: $ctype=application/zip; break; case doc: $ctype=application/msword; break; case xls: $ctype=application/vnd.ms-excel; break; case ppt: $ctype=application/vnd.ms-powerpoint; break; case gif: $ctype=image/gif; break; case png: $ctype=image/png; break; case jpeg: case jpg: $ctype=image/jpg; break; case wav: case mp3: $ctype=application/iTunes; break; default: $ctype=application/force-download; } header(Pragma: public); header(Expires: 0); header(Cache-Control: must-revalidate, post-check=0, pre-check=0); header(Cache-Control: private,false); header(Content-Type: $ctype); header(Content-Disposition: attachment; filename=\.basename ($path).\; ); header(Content-Transfer-Encoding: binary); header(Content-Length: .filesize($path)); readfile($path); exit(); ? Thanks, c...@hosting4days.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Best way to read first 20 characters of a string?
Have you tried tha substr PHP function? Chris Payne chris_pa...@danmangames.com escreveu na mensagem news:554f315f0912020711m5e0cc2e8qd6a1926a80590...@mail.gmail.com... Hi everyone, I'm pulling data from a mysql database, but need only the first 20 characters of each string for a short description, what is the best method to just grab the first 20 characters from a string regardless of whether they are letters or numbers? Chris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: [php] INSERT and immediately UPDATE
Use mysql_insert_id() instead of the select you´re using now. Allen McCabe allenmcc...@gmail.com escreveu na mensagem news:657acef20910281221y5ab6ab7t4882f4f00da2c...@mail.gmail.com... Hey everyone, I have an issue. I need my (employee) users to be able to insert shows into the our MySQL database and simultaneously upload an image file (and store the path in the table). I have accomplished this with a product-based system (adding products and uploading images of the product), and accomplished what I needed because the product name was unique; I used the following statements: $prodName = $_POST['prodName']; $prodDesc = $_POST['prodDesc']; $prodPrice = $_POST['prodPrice']; $query2 = INSERT INTO product (pID, pName) VALUES (NULL, '$prodName');; $result2 = mysql_query($query2) or die(mysql_error()); $query = SELECT pID FROM product WHERE pName = '$prodName';; $result = mysql_query($query) or die(mysql_error()); $row = mysql_fetch_array($result) or die (mysql_error()); $prodID = $row['pID']; I had to select the new product to get the product id to use in the new unique image name. The problem I am facing now, is that with the shows that my users add will have multitple show times; this means non-unique titles. In fact, the only unique identifier is the show id. How can I insert something (leaving the show_id field NULL so that it is auto-assigned the next ID number), and then immediately select it? PHP doesn't seem to be able to immediately select something it has just inserted, perhaps it needs time to process the database update. Here is the code I have now (which does not work): $query2 = INSERT INTO afy_show (show_id, show_title, show_day_w, show_month, show_day_m, show_year, show_time, show_price, show_description, show_comments_1, show_seats_reqd) VALUES (NULL, '{$show_title}', '{$show_day_w}', '{$show_month}', '{$show_day_m}', '{$show_year}', '{$show_time}', '{$show_price}', '{$show_description}', '{$show_comments_1}', '{$show_seats_reqd}');; $result2 = mysql_query($query2) or die(mysql_error()); $query3 = SELECT * FROM afy_show WHERE *show_id = '$id'*;; $result3 = mysql_query($query3) or die('Record cannot be located!' . mysql_error()); $row3 = mysql_fetch_array($result3); $show_id = $row3['show_id']; How do I select the item I just inserted to obtain the ID number?? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Plotting a Line Graph It seems that the google charts work from a url - so 500 points would be way to long for any url - so I guess that option is out.
I have a data file that stores about 500 numbers in a record - meant to plot a basic line graph (left to right). The numbers can be imported into a record with 500 fields or just stored in a text field - which ever is better. The user might want to pick a few random records and plot them together - so the line graph may compare the few records together. It seems that the google charts work from a url - so 500 points would be way to long for any url - so I guess that option is out. Q: what is the best way to create / display line graphs in with PHP? Thanks in advance for your help - dave Thanks, c...@hosting4days.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Plotting a Line Graph
Jim Lucas wrote: I would recommend http://www.rgraph.net/ It was written and is currently maintained by a member of this list. Jim Lucas Hi Jim, rgraph looks cool... most demos I see show just a few points - do you think this could display 500 points? (I'm looking through their docs now...) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: ternary operator sintax help
?= (isset($erros['anexo']) ? 'div class=mensagemErro'.$erros['anexo'].'/div' :''); ? MEM tal...@gmail.com escreveu na mensagem news:002401ca46b4$ed6ad6a0$c84083...@com... Hello all, I'm trying to display a div, only when some php value is set. Since this will be near html, I'd like to keep it on one line. So, I'd love to use shortcuts and a ternary operator for the effect. I'm having something like this right now, but the div still appears even if the error is NOT set. ?= (isset($erros['anexo'])) ? 'div class=mensagemErro' .$erros['anexo'].'/div' :''; ? :( Can I have your help with the right syntax ? Regards, The newbie on a Humpty Dumpty wall, Márcio -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Parse Question Using list()
newbie import csv question file is like: stuff1,stuff2,stuff3 stuff1,stuff2,stuff3 stuff1,stuff2,stuff3 stuff1,stuff2,stuff3 etc. Problem: when I try to parse out the 3 fields and display them using list() it just gets just 1st char of each field ... Q: How do I get it to set $col1 - 2 $col3 to the full contents of each for each line (not just 1st char)? ?php // on a mac but with windows linefeed returns in file $handle = fopen(file:///path/_impfool/test.csv, r); while (!feof ($handle)) { $line = fgets($handle); list($col1, $col2, $col3) = $line; echo $line.''.' linebr'; // this shows the whole line ok echo c1 is $col1 and c2 is $col2 and c3 is $col3.'br'; // this shows just 1st char of each field } ? Thanks, c...@hosting4days.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Parse Question Using list()
On Oct 1, 2009, at 5:02 PM, Ben Dunlap wrote: You could tackle this in a couple of different ways. Either split your string into an array first: $line = fgets($handle); $columns = explode(,, trim($line)); Thanks Ben - the explode() command worked great! - Now a bit of another problem I'm exporting from another database (mac) to a csv file then a quick import to excel 2004 (mac) for some cleaning... before the excel import, some date fields look like 2009-9-29 11:21:37 = good for sql import but excel does an auto reformat to 9/29/2009 11:21:37 AM = not good for sql import Q: any way to turn this auto reformat off in excel and keep it the way I had it? (I saw nothing in pref's) Thanks, c...@hosting4days.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Insert Symbol into Mysql
If he´s really using a any other charset instead of utf8 table, why not using utf8_decode and utf8_decode in his php files to solve this? Ashley Sheridan a...@ashleysheridan.co.uk escreveu na mensagem news:1253101315.2275.4.ca...@localhost... On Wed, 2009-09-16 at 17:00 +0530, Samrat Kar wrote: I want to insert symbols like degree, plusminus, currency along with string into Mysql database. Front is HTML form with javascript. Server side scripts are written in PHP. Please help. Regards, Samrat Kar Two ways to do this: 1. Insert the characters as their escaped HTML codes, e.g. #176; #177; #163; (for °, ± and £) 2. Set the DB to use a utf8 character set, and insert the characters directly as is, without escaping them Thanks, Ash http://www.ashleysheridan.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Mail Command Body Issue - Trying to use 'do while' loop
I'm having a problem with mail body issue trying to use 'do while' loop in the $mail_body var. this line: do { echo $row_get1['name'] } while ($row_get1 = mysql_fetch_assoc ($get1)) will show ok when it's on the page elsewhere (not in the $mail_body var) but typed like: --- ok on web page (not email) ?php do { echo $row_get1['vt_name']; } while ($row_get1 = mysql_fetch_assoc ($get1)); ? Q: i want TEXT LOOP TEXT - AM I MISSING some syntax characters like(; or??) somewhere or THANKS for your help - dave - full email code ?php $mail_body = test \n\n.test2.do { echo 'test' } while ($row_get1 = mysql_fetch_assoc($get1)).Thanks test xxx; ? ?php $Name = test; //senders name $email = t...@test.com; //senders e-mail adress $recipientname = t...@test.com; $recipient = t...@test.com; //recipient $subject = test. $header = From: . $Name . . $email . \r\n; //optional headerfields $fullto = $recipientname . . $recipient . ; //$fullto = $recipientname . . $recipient . ., .$recip2; ini_set('sendmail_from', 't...@test.com'); mail($fullto, $subject, $mail_body, $header); //mail command :) ? Thanks, c...@hosting4days.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Mail Command Body Issue - Trying to use 'do while' loop
On Sep 12, 2009, at 3:47 PM, c...@hosting4days.com wrote: I'm having a problem with mail body issue trying to use 'do while' loop in the $mail_body var. this line: do { echo $row_get1['name'] } while ($row_get1 = mysql_fetch_assoc ($get1)) will show ok when it's on the page elsewhere (not in the $mail_body var) but typed like: --- ok on web page (not email) ?php do { echo $row_get1['vt_name']; } while ($row_get1 = mysql_fetch_assoc ($get1)); ? Q: i want TEXT LOOP TEXT - AM I MISSING some syntax characters like(; or??) somewhere or THANKS for your help - dave I got it working like this ?php $loop1 = ''; do { $loop1 = $loop1.\n.$row_get1['vt_name'].' - '; } while ($row_get1 = mysql_fetch_assoc($get1)); $mail_body = test \n\n.test2 .$loop1.Thanks test xxx; ? Q: is this the best way? - full email code ?php $mail_body = test \n\n.test2.do { echo 'test' } while ($row_get1 = mysql_fetch_assoc($get1)).Thanks test xxx; ? ?php $Name = test; //senders name $email = t...@test.com; //senders e-mail adress $recipientname = t...@test.com; $recipient = t...@test.com; //recipient $subject = test. $header = From: . $Name . . $email . \r\n; //optional headerfields $fullto = $recipientname . . $recipient . ; //$fullto = $recipientname . . $recipient . ., .$recip2; ini_set('sendmail_from', 't...@test.com'); mail($fullto, $subject, $mail_body, $header); //mail command :) ? Thanks, c...@hosting4days.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Thanks, c...@hosting4days.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Odd Endless Loop with Explorer 8 (pc)
I have many of these tags on a site... They work well with all browsers i've tested - except explorer 8 (pc) ?php echo 'meta http-equiv=refresh content=0;page2.php'; ? It just goes into an endless loop but stays on the original page - never going to page2.php Q: Any idea how to fix this? Thanks, c...@hosting4days.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Odd Endless Loop with Explorer 8 (pc)
On Sep 12, 2009, at 7:57 PM, kranthi wrote: ?php echo 'meta http-equiv=refresh content=0;page2.php'; ? may b u should have ?php echo 'meta http-equiv=refresh content=0;url=page2.php'; ? Thanks kranthi HallMarc Websites url= ... - that did the trick! Thanks, c...@hosting4days.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Creating alphanumeric id for a table
I don´t know if it´d be the right way, but what about using trigger in this case? aveev nashrullah_a...@yahoo.com escreveu na mensagem news:25391939.p...@talk.nabble.com... I want to create user generated id like this : AAA0001 AAA0002 ... AAA0009 AAA0010 where the id consists of 3 alphanumeric characters and 4 numerical digits in the beginning (for numerical digit, it can grow like this AAA10001). I try to use php script to generate id like this, where I use the following script. ? function generate_id($num) { $start_dig = 4; $num_dig = strlen($num); $id = $num; if($num_dig = $start_dig) { $num_zero = $start_dig - $num_dig; for($i=0;$i $num_zero; $i++) { $id = '0' . $id; } } $id = 'AAA' . $id; return $id; } $app_id = generate_id(1); ? I assume that I can get increment value/sequence from db (I used harcoded increment value in the code above (generate_id(1))), but I don't know how I can get this incremental value from db.I use mysql 5.0. Or has anyone had another solution to create this alphanumeric id ? Any help would be much appreciated Thanks -- View this message in context: http://www.nabble.com/Creating-alphanumeric-id-for-a-table-tp25391939p25391939.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
[PHP] Re: ini files as config - hidden
I think a good solution is to put the ini file out of your html folder so only your scripts can read it. ? danondan...@gmail.com escreveu na mensagem news:907722000908141031v5b020fe0m5a3cc8a9dc196...@mail.gmail.com... I'm building a little framework for my self, The configuration of the framework is done in an ini file, How do you suggest to hide its contents? .htaccess wont be good (or atleast only htaccess) since if its turned off The file contains mysql password and important data. How should I make sure the file stays hidden from someone who might tries to access it? -- Use ROT26 for best security -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: ini files as config - hidden
A long time ago I worked in many shared servers, nowadays I´m not working with web sites, only systems, so my customers always has their own server. The question is: 1) The ini file you mentioned has ini extension? if yes, it must be out of the document root because if someone types its url, the browser will certainly show up its content. 2) Has it php extension? if yes, it can be inside the documento root because if someone types its url, PHP will show up only the result of its code.. Ben Dunlap bdun...@agentintellect.com escreveu na mensagem news:7997e80e0908141056i483f4e2h7dffe0c83b90d...@mail.gmail.com... 2009/8/14 João Cândido de Souza Neto j...@consultorweb.cnt.br: I think a good solution is to put the ini file out of your html folder so only your scripts can read it. I agree, and I try to do the same, but I've noticed that most open-source CMSes I've looked at (Drupal, Joomla, Textpattern, CMS Made Simple) have always stored database credentials inside of DocumentRoot, by default. Not sure if this is a compromise to allow ease-of-use by less-technical users, or if my insistence on putting this sort of file outside of DocumentRoot is just paranoia (and not the good kind). I'd definitely be interested to hear how others on the list approach this problem. And that's only one part of the equation, if you're on a shared-hosting platform. Are you, or do you have your own server? Ben -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: ini files as config - hidden
It´s a cool solution as well. Martin Scotta martinsco...@gmail.com escreveu na mensagem news:6445d94e0908141103l6710c766wcc89f05111a65...@mail.gmail.com... 2009/8/14 Ben Dunlap bdun...@agentintellect.com 2009/8/14 João Cândido de Souza Neto j...@consultorweb.cnt.br: I think a good solution is to put the ini file out of your html folder so only your scripts can read it. I agree, and I try to do the same, but I've noticed that most open-source CMSes I've looked at (Drupal, Joomla, Textpattern, CMS Made Simple) have always stored database credentials inside of DocumentRoot, by default. Not sure if this is a compromise to allow ease-of-use by less-technical users, or if my insistence on putting this sort of file outside of DocumentRoot is just paranoia (and not the good kind). I'd definitely be interested to hear how others on the list approach this problem. And that's only one part of the equation, if you're on a shared-hosting platform. Are you, or do you have your own server? Ben -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php A workaround to this is to simple let the browser get the ini as a php file. What? are you insane? no. it is really easy. 1) Name your ini files .php so, database.ini will be database.php 2) Put in the top of your script this line ;?php exit;? So, when the file is opened as an ini file the semilcolon indicates that it's a comment. But, when the browser call for this file... php just exit's in the first line. Our data will be safe as long as the first line will remains there. -- Martin Scotta -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Making several variables into 1 variable
Why not this: $pastDate = date(d/m/y, strtotime(-30 days)); Miller, Terion tmil...@springfi.gannett.com escreveu na mensagem news:c6946809.4183%kmille...@springfi.gannett.com... I need to take this: $pastDays = strtotime(-30 days); $past_day = date(d, $pastDays); $past_month = date(m, $pastDays); $past_year =date(y, $pastDays); And make it into one var to compare to a db field that is formatted like 00/00/00 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Argh Date problems
In mySql you have date_format which I think´ll solve your problem. Miller, Terion tmil...@springfi.gannett.com escreveu na mensagem news:c694bead.41f4%kmille...@springfi.gannett.com... Well I was going along smoothly from this morningbut it came down to having to change the field type to date in the mySQL..so now I have this which returns a scraped value formatted like this 0/00/00 m/d/y $inDate = $results[3][$i]; Which date function can I use to format for the db so that I will be able to use range references...there are so many get_date, date_modifyI'm lost... My full code is this: preg_match_all('/pfont size=2 face=Arial, Helvetica, sans-serif(.+)br(.+)br.+(\d+\/\d+\/\d+)\s(.+)br(.+)br.+Critical Violations Found:.+(\d+)(.+)Noncritical Violations Found:.+(\d+)/imsSU', utf8_encode($url), $results); for ($i=0; $i count($results[0]); $i++) { $name1 = strtolower($results[1][$i]); $name = ltrim($name1); $address = strtolower($results[2][$i]); $inDate = $results[3][$i]; $inType = $results[4][$i]; $notes = trim($results[5][$i]); $critical = trim($results[6][$i]); $cviolations = $results[7][$i]; $noncritical = $results[8][$i]; //trying to manipulate different field data $cleanViolations = str_replace('*', '', $cviolations); $ucName = ucwords($name); $ucAddress = ucwords($address); $mysql_name = mysql_escape_string($ucName); $mysql_address = mysql_escape_string($ucAddress); $mysql_inDate = mysql_escape_string($inDate); $mysql_inType = mysql_escape_string($inType); $mysql_notes = mysql_escape_string($notes); $mysql_critical = mysql_escape_string($critical); $mysql_cviolations = mysql_escape_string($cleanViolations); $mysql_noncritical = mysql_escape_string($noncritical); echo $ucName br; echo $ucAddress br; echo $inDate br; echo $inType br; echo $notes br; echo $critical br; //echo $cviolations br; echo $cleanViolations br; echo $noncritical brhr; -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] newbie - Is there a calendar module for date entry?
On Jul 21, 2009, at 6:17 PM, Jonathan Tapicer wrote: That is javascript thing, not PHP. The Yahoo UI has a nice one, here you have an example: http://developer.yahoo.com/yui/examples/calendar/ calcontainer_clean.html, and here the module reference: http://developer.yahoo.com/yui/calendar/ Jonathan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php The Yahoo UI looks great. On Jul 22, 2009, at 12:50 AM, Ashley Sheridan wrote: When I do these sorts of things, I tend to use Tigra calendar. They do two versions, the free and the pro version, but tbh, the free one does everything you need. It's very easy to set up too. Hi Ashley - the free one seems to be just the thing. - thanks Thanks to all - They both look good - I'm checking them out now! Another newbie question: storing dates and times... I'm trying to build a simple notepad page where I can attach a date and even time field. So this Tigra or yahoo calendar will be great date picker helper. This is for the US, so I'd like the user to see normal us formatting like: date field - 7/1/2009 and separate time field like: 11:30 AM mysql can use a DATE or TIME or datetime field type. and seems to use a different standard like: -MM-DD I want to to be able to do date calcs and such - so what is the best way (types) to store these fields in mysql and display them on the page with php? I do know about some of the cool php functions like: echo date('m-d-y g:i a', strtotime($row_this['myDate'])); so do I? ... store the date and time in separate fields then manipulate the display with php functions or??? - just looking for any favorite practices -- Thanks - RevDave Cool @ hosting4days . com [db-lists 09] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: newbie question - php parsing
You made a mistake in your code: ?php the_title(); ? must be: ?php echo the_title(); ? -- João Cândido de Souza Neto SIENS SOLUÇÕES EM GESTÃO DE NEGÓCIOS Fone: (0XX41) 3033-3636 - JS www.siens.com.br Sebastiano Pomata lafayett...@gmail.com escreveu na mensagem news:70fe20d60907221355m3fa49a75ua053d2f1b9aca...@mail.gmail.com... Hi all, A little doubt caught me while I was writing this snippet of code for a wordpress template: ?php if (the_title('','',FALSE) != 'Home') { ? h2 class=entry-header?php the_title(); ?/h2 ?php } ? I always thought that php was called only between the ?php ? tags, and I'm pretty sure that's right, while HTML code was simply wrote in document as is, without further logic. Now, I can't figure out how this snippet works: I mean, shouldn't HTML code be simply put on document, as it is outside php invoke? Effectively if the title of page is 'Home', the HTML part is totally skipped. Is the if construct that does all the magic inside? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] newbie - Is there a calendar module for date entry?
newbie ... - is there a calendar module for date fields? - so that a small calendar pops up - then you can click on a date, to add to a field - like google or yahoo calendars has...? BTW: I saw this - but it doesn't seem to be the right thing ( more meant for Converter issues) for what I'm looking for... http://us2.php.net/manual/en/intro.calendar.php -- Thanks - RevDave Cool @ hosting4days . com [db-lists 09] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Exception not being caught
So, I've got a little piece of code designed to play with catching the exception that's thrown when an object doesn't have a __toString method. ?php class A { } $a = new A(); // Ayn would be proud, right? try { echo a is ,$a,\n; } catch(Exception $e) { echo \nException Caught: ; echo $e, $n; } ? This does not run as expected. I'd think that when the implicit string conversion in the try block hits, the exception would be thrown, caught by the catch block, and relayed. Instead you don't ever see the words exception caught and you get Catchable fatal error: Object of class A could not be converted to string. If it's catchable, why isn't it caught in my example? Thanks, Weston -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] mod primary key field - newbie question
newbie question ... I have a MySQL table where I want to update (renumber) the primary numeric key field. - I successfully turned field off as a primary key index and UN auto incremented it - then created new sequential numbers for it - then turned back on primary key index and re added auto increment in BUT when I make a new record it does NOT start where new numbers stop last is 51 next should be 52 but jumps to 157 Q: is there a way to reset the NEXT SERIAL ID NUMBER somewhere? how do I fix this? -- Thanks - RevDave Cool @ hosting4days . com [db-lists 09]
[PHP] Add BCC parameter to mail()
Hi folks - Newbie question... Q: Is there a way to add BCC and/or CC parameters to this simple email function? If there is a better way to do this - please let me know Thanks in advance ?php $Name = test; //senders name $email = t...@test.com; //senders e-mail adress $recipientname = test; $recipient = j...@test.com; //recipient $mail_body = test; $subject = test; $header = From: . $Name . . $email . \r\n; //optional headerfields $fullto = $recipientname . . $recipient . ; ini_set('sendmail_from', 't...@test.com'); mail($fullto, $subject, $mail_body, $header); //mail command :) ? Thanks, c...@hosting4days.com
[PHP] Re: Push an Array, Comma separated.
May be array_merge($array, explode(,, $string)). -- João Cândido de Souza Neto SIENS SOLUÇÕES EM GESTÃO DE NEGÓCIOS Fone: (0XX41) 3033-3636 - JS www.siens.com.br Louie Miranda lmira...@gmail.com escreveu na mensagem news:5016fc50906300125s12389ae1v3323c63c30343...@mail.gmail.com... GPS Administrative Page v2.3.12 (BETA)My array: Array ( [0] = Demo2.txt [1] = Demo.txt [2] = Demo.txt ) How could I push the values as: - Demo2.txt, Demo.txt, Demo.txt? Not sure which approach is good. $saveFiles = array(); array_push($saveFiles, $ufName); Help -- Louie Miranda (lmira...@gmail.com) http://www.louiemiranda.net Quality Web Hosting - www.axishift.com Pinoy Web Hosting, Web Hosting Philippines -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Scope woe
I think the best way is passing the object instance as a parameter to the messwithotherthings method. -- João Cândido de Souza Neto SIENS SOLUÇÕES EM GESTÃO DE NEGÓCIOS Fone: (0XX41) 3033-3636 - JS www.siens.com.br Luke l...@blog-thing.com escreveu na mensagem news:17aa29670906300114t5b95c12dk9dfdfbdfdd7f0...@mail.gmail.com... Hello again guys, I was wondering the best way to tackle the following problem: I've got a class, containing a property which is another object. So from outside I should be able to do $firstobject-propertycontainingobject-methodinsidethatobject(); The $firstobject variable is in the global namespace (having been made with $firstobject = new FirstObject;), and I'm having a problem that I'm sure many people have when accessing it inside another class, so: class otherObject { static function messwithotherthings () { $firstobject-propertycontainingobject-methodinsidethatobject(); } } But $firstobject is blank, which makes sense because in there it is pointing to the local variable within the method. To solve this, I could add 'global $firstobject' inside every method, but this is very redundant and boring. I've tried a couple of things like adding: private $firstobject = $GLOBALS['firstobject']; But apparently that's bad syntax. I was just wondering the best way to get around this? Thanks a lot for your help, -- Luke Slater :O) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Same Page, Fundamentally Different Behavior OR is Firefox broken?
Matt Neimeyer a écrit : I'm at a complete loss... So I'm hoping someone can point me in the right direction to even start looking. We have an application written in PHP that lets users send out emails. The basic process is as follows. 1. Go to start screen. (This resets anything currently in process for the current logged in user) 2. Upload email addresses and other info (Names, etc) 3. Build Email 4. Send In Step 3 the user can click a Live Preview button to see what the email will look like with the merged data. Here's the problem, this works fine in all versions of IE, versions 1.5 or less of FireFox and versions 3 or less of Safari. However, starting in FireFox 2, and now Safari 4, when you get to step four OR click the live preview button in step three there is no more data in the merge. In those browsers the system is acting like the end user went BACK to the start page (in another window?) and reinitialized all the data. I immediately thought it might be pre-fetching so I tried using the system before and after toggling the network.prefetch-next setting in about:config with FireFox 2.0.0.20 and restarting the browser. No luck. So I added code to my reset function to email me the output of phpinfo() when the reset function is called. Using IE I get 1 notification. Using FF I get two notifications. This reinforces my theory that FireFox is prefetching the menu item to start a new mailing (just an a link...) from the top of the composer page. Even still... I've disabled prefetch so it SHOULDN'T even be considering those links right? I've also tried adding artificial ?now=timestamp fakes to the end of all menu links since I read somewhere (don't remember where) that FireFox only prefetches pages with no query section in the address. Has anyone run into this behavior before? Any recommendations on how to stop it? Preferably from the server with code of some sort... Thanks in advance. Matt Hi Matt, Have you tried to put this two lines in the HEAD section of your HTML pages : META http-equiv=Cache-Control content=no-cache META http-equiv=Pragma content=no-cache Hope it helps you. BR -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] socket_write return wrong data length
Hi all, I'm writting a little telnet client, but I've a problem with the socket_write function public function send($data){ $datalen = strlen($data); $datawritten = 0; do { $datawritten = socket_write($this-_tnsocket, $data, $datalen); if( $datawritten === FALSE) { echo __METHOD__. : .socket_strerror(socket_last_error()).\n; return (FALSE); } echo Bytes written : .$datawritten.\n; $data = substr($data, $datawritten); $datalen = strlen($data); } while($datawritten $datalen); return (TRUE); } When I use this function for writting a sample message of 4526 Bytes it returns : Bytes written : 4526 But it really wrotes only 1460 Bytes (verified with Wireshark). So my question is why socket_write returns me a wrong data length ? Thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Not a regular file?
I´m not sure, nut I think you cant put a file into a ftp server using http, you must use the $_SERVER[DOCUMENT_ROOT] to get the file you want to put. -- João Cândido de Souza Neto SIENS SOLUÇÕES EM GESTÃO DE NEGÓCIOS Fone: (0XX41) 3033-3636 - JS www.siens.com.br Miller, Terion tmil...@springfi.gannett.com escreveu na mensagem news:c64d4509.2be0%kmille...@springfi.gannett.com... Here is my code for the ftp_put $conn_id = ftp_connect($ftp_server);$login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass);$FilePath = http://localhost:/HarrisAutomate/output/WebImagesHiRes/$ImageName;; $remote_path = /httpdocs/Announcements/photos/obitsTest/; set_time_limit(120);ftp_pasv($conn_id, true);// upload a fileif (ftp_put($conn_id, $remote_path, $FilePath, FTP_BINARY)) {echo successfully uploaded $ImageName\n;} else { echo There was a problem while uploading n;} // close the connection ftp_close($conn_id); Since it is passing a full path I don't know how it can be only going to the directory? On 6/4/09 9:22 AM, haliphax halip...@gmail.com wrote: On Thu, Jun 4, 2009 at 9:07 AM, Miller, Terion tmil...@springfi.gannett.com wrote: I've never encountered this error: Warning: ftp_put() [function.ftp-put]: /httpdocs/Announcements/photos/obitsTest/: Not a regular file in /Applications/MAMP/htdocs/HarrisAutomate/ObitsTester.php on line 149 There was a problem while uploading 659428.jpg 658626 Can't find much info on how to correct it, anyone seen this? http://www.lmgtfy.com/?q=php+%22not+a+regular+file%22 Apparently, it's not actually a file in the first place. Just a guess--but most all incidents of ftp_put throwing this error that I've found in web searches point to someone using it on a directory/etc. -- // Todd -- 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] Using File_exists?
Try to define $FilePath as follows: $FilePath = $_SERVER[document_root]./HarrisAutomate/output/WebImagesHiRes/$ImageName; In this way it should work. -- João Cândido de Souza Neto SIENS SOLUÇÕES EM GESTÃO DE NEGÓCIOS Fone: (0XX41) 3033-3636 - JS www.siens.com.br Miller, Terion tmil...@springfi.gannett.com escreveu na mensagem news:c64c2fbf.2b80%kmille...@springfi.gannett.com... On 6/3/09 1:41 PM, Eddie Drapkin oorza...@gmail.com wrote: just initially, and this might be a typo but $FilePath = http://localhost:/HarrisAutomate/output/WebImagesHiRes/$ImageName;; //$BackupPath = http://localhost:/HarrisAutomate/WebImagesHiRes/output/backup/;; $FilePath has an /output/ that $BackupPath doesn't. Also, make sure you don't have safe_mode or open_basedir restricting the files php can see, although I'm reasonably sure the fact that it's an URL should nullify that. Also, make sure you have allow_url_fopen turned on. On Wed, Jun 3, 2009 at 2:31 PM, Miller, Terion tmil...@springfi.gannett.com wrote: I wrote this little script (part of a much much larger one I am working at) anyways, I am trying to get it to compare a file name from a db to an actual file in a folder and then tell me if it does or doesn't exist, the problem I have is that the files do exist, I echo them out, but it says file does not exist right after that it echos the file for me What do I have wrong? $FileName = $row['Image']; $ImageName = $row['Image']; $ImageName = str_replace(/, , $ImageName); $FilePath = http://localhost:/HarrisAutomate/output/WebImagesHiRes/$ImageName;; //$BackupPath = http://localhost:/HarrisAutomate/WebImagesHiRes/output/backup/;; if (file_exists($FilePath)) { echo The file $ImageName exists; } else { echo The file $ImageName does not exist . 'br /'; } $FileName = str_replace(/, , $FileName); $FileName = str_replace(.jpg, , $FileName); echo ($FileName) . 'br /'; echo 'img src=' . $FilePath .'' . 'br /'; == Thanks I went through and checked those suggestions and it wasn't any of them... What I am trying to do is to match a file name from a db to the file in the folder of images Which that part is working I can match them and display them, but it keeps telling me they aren't there ...right before it displays... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Using File_exists?
Sorry, I forgot only a single detail. It´s DOCUMENT_ROOT instead of document_root. Have you tried it? -- João Cândido de Souza Neto SIENS SOLUÇÕES EM GESTÃO DE NEGÓCIOS Fone: (0XX41) 3033-3636 - JS www.siens.com.br Miller, Terion tmil...@springfi.gannett.com escreveu na mensagem news:c64c3427.2b88%kmille...@springfi.gannett.com... Tried that too with no luck... On 6/3/09 2:01 PM, João Cândido de Souza Neto j...@consultorweb.cnt.br wrote: $_SERVER[document_root]./HarrisAutomate/output/WebImagesHiRes/$ImageName; -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Using File_exists? (RESOLVED)
Exactly. -- João Cândido de Souza Neto SIENS SOLUÇÕES EM GESTÃO DE NEGÓCIOS Fone: (0XX41) 3033-3636 - JS www.siens.com.br Shawn McKenzie nos...@mckenzies.net escreveu na mensagem news:95.f5.19828.e94d6...@pb1.pair.com... João Cândido de Souza Neto wrote: The var $_SERVER[DOCUMENT_ROOT] in your case contais /Applications/MAMP/htdocs/ so using it whenever you change your server, it´ll work without any change. Yes, moral of the story is: file_exists() is for use on a file system or using a wrapper that supports stat(), which HTTP does not. -- Thanks! -Shawn http://www.spidean.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: PHP, OOP and AJAX
Julian, could you please show us an example of this problem? -- João Cândido de Souza Neto SIENS SOLUÇÕES EM GESTÃO DE NEGÓCIOS Fone: (0XX41) 3033-3636 - JS www.siens.com.br Julian Muscat Doublesin opensourc...@gmail.com escreveu na mensagem news:5e0039ed0905280431o2e9d8036u217b0449eccd...@mail.gmail.com... Hi Everyone, This is the first time that I am posting in the PHP forum, so hope that I am osting in the right place. I would like to say that before submitting to this forum I have done some research looking for a solution without success. I had been programming in ASP.NET for years using Object Oriented Princeliness but decided to walk away from that. I am now researching and specialising in the open source world. I have started to develop a project using MySQL, PHP and OOP. So far I have succeed. However I got stuck once I started implement AJAX using the AJAX tutorial from w3schools.com. What I have discovered is: for some reason when you call a file that requires other fies using the REQUIRE or INCLUDE it just does not work. I can conform this as I have tested with out the the functions. Has anyone ever meet such a situation can you give me some feedback please. Thank you very much in advance for your support. Regards Julian -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: mysql create table with date or timestamp
If you need date and hour the best way is: CREATE TABLE diary ( iddiary int auto_increment not null, imepriimek varchar(50), when timestamp, action varchar(30), onfile varchar(100) unique id(iddiary) ); if you need only date you can use: CREATE TABLE diary ( iddiary int auto_increment not null, imepriimek varchar(50), when date, action varchar(30), onfile varchar(100) unique id(iddiary) ); To get formated date you should use: select date_format(when, %T%W%e%c%y) from diary; To put data in this field you can use: insert into diary (when) values (str_to_date(10:55:14Thursday28509, %T%W%e%c%y)); -- João Cândido de Souza Neto SIENS SOLUÇÕES EM GESTÃO DE NEGÓCIOS Fone: (0XX41) 3033-3636 - JS www.siens.com.br Grega Leskovsek mavri...@gmail.com escreveu na mensagem news:1df2d4810905280643y62a0f092p91fa2c57558d8...@mail.gmail.com... CREATE TABLE diary(iddiary int auto_increment not null, imepriimek varchar(50), when date(%T%W%e%c%y), action varchar(30), onfile varchar(100) unique id(iddiary)); I tried the above and it didn't work. What must I do to create a table with full time and date. If I should use timestamp how do I convert thee timestamp in php back to normal time? (I also tried the mysql command: when timestamp and when date in the above first mysql clause but it didnt work ) Please help me. Thanks in advance, -- When the sun rises I receive and when it sets I forgive - http://users.skavt.net/~gleskovs/ All the Love, Grega Leskov'sek -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: mysql create table with date or timestamp
It´s not auto_increment, it´s auto increment. -- João Cândido de Souza Neto SIENS SOLUÇÕES EM GESTÃO DE NEGÓCIOS Fone: (0XX41) 3033-3636 - JS www.siens.com.br Grega Leskovsek mavri...@gmail.com escreveu na mensagem news:1df2d4810905280748uec4f425kaf14b6410caa...@mail.gmail.com... I GOT THIS ERROR when I tried first sample with when timestamp; ERROR 1064 (42000): You have an error in your SQL syntax; check the manual thatcorresponds to your MySQL server version for the right syntax to use near 'id(iddiary) )' at line 1 2009/5/28 João Cândido de Souza Neto j...@consultorweb.cnt.br: If you need date and hour the best way is: CREATE TABLE diary ( iddiary int auto_increment not null, imepriimek varchar(50), when timestamp, action varchar(30), onfile varchar(100) unique id(iddiary) ); Please advice. Thanks in advance, Grega if you need only date you can use: CREATE TABLE diary ( iddiary int auto_increment not null, imepriimek varchar(50), when date, action varchar(30), onfile varchar(100) unique id(iddiary) ); To get formated date you should use: select date_format(when, %T%W%e%c%y) from diary; To put data in this field you can use: insert into diary (when) values (str_to_date(10:55:14Thursday28509, %T%W%e%c%y)); -- João Cândido de Souza Neto SIENS SOLUÇÕES EM GESTÃO DE NEGÓCIOS Fone: (0XX41) 3033-3636 - JS www.siens.com.br Grega Leskovsek mavri...@gmail.com escreveu na mensagem news:1df2d4810905280643y62a0f092p91fa2c57558d8...@mail.gmail.com... CREATE TABLE diary(iddiary int auto_increment not null, imepriimek varchar(50), when date(%T%W%e%c%y), action varchar(30), onfile varchar(100) unique id(iddiary)); I tried the above and it didn't work. What must I do to create a table with full time and date. If I should use timestamp how do I convert thee timestamp in php back to normal time? (I also tried the mysql command: when timestamp and when date in the above first mysql clause but it didnt work ) Please help me. Thanks in advance, -- When the sun rises I receive and when it sets I forgive - http://users.skavt.net/~gleskovs/ All the Love, Grega Leskov'sek -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- When the sun rises I receive and when it sets I forgive - http://users.skavt.net/~gleskovs/ All the Love, Grega Leskov'sek -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: table-less layouts; Ideas welcome
On Thu, 2009-05-21 at 09:54 -0400, tedd wrote: My thoughts are -- my understanding the reason why tables have received such bad-press is that designers have abused tables in holding designs together with nested tables AND in doing so made it difficult for the visually disabled to pull content from the site. Screen readers do not read the screen but rather read the source and pull out of it what they (the screen reader program) think is content. Translating nested tables becomes an impossible job for them. I've heard a rumor this is exaggerated, and I buy it to some extent. Lynx had an algorithm for distinguishing simple tabular data from more complex (and probably layout) tables back in 1999. I'd assume a serious screen reader with more development resources behind it could do better, and I don't think heuristics for working with this would even be particularly hard. This isn't to say tangled table markup is never a problem. It is, both for human and machine readers. But as much as I like CSS -- and as much as it simplifies many designs -- there are some cases for which table layouts are easier and/or more robust, so I almost just wish we'd accepted the horse was out of the barn and tried to figure out an easy way to signal distinctions between layout tables and semantic tabular data, rather than trying to get the entire internet to completely retool. A few years ago, I started marking my layout tables with class=layout. Not always a perfect solution, but makes the distinction easy (and turns out to be a useful styling convention as well), and if table-based layouts really are a significant obstacle to machine readers, my guess is something like this would get us over that hurdle a lot faster than waiting for everyone to give up those layouts. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Problems working with HTML using PHP's XML tools (placing mixed text/html into xpath-specified nodes...)
Is there a straightforward way (or, heck, any way) of placing mixed html/text content into xpath-specified nodes using any of PHP's XML tools? So far, I've tried SimpleXML and the DOM and things aren't coming out well. SimpleXML: /* $filename contains path to valid XML file, $xpathxpr contains valid XPath expression matching at least one document node, $fillval contains a mixed well-formed text/xhtml string to be pre-pended within each matching node */ $sx = simplexml_load_file($filename); $nodes = $sx-xpath($xpathxpr); foreach($nodes as $node) { $children = $node-children(); $children[0] = $fillval . $children[0]; } This only sortof works. I get $fillval appended before the original contents of each matching docment node but if I've put any markup in, it's all there as literal text (ie, a href=http://php.net;php.net/a wouldn't show up as a link, you'd see the actual markup when the document is rendered). A variation on this that I tried is creating a new SimpleXMLElement object, with the mixed text/markup string as an argument passed to the constructor, since the docs seem to indicate this is blessed. Weirdly, when I do this, it seems to actually be stripping out the markup and just giving the text. For example: $s = new SimpleXMLElement('a href=#Boo/a') echo $s; yields Boo (and echo $s-a yields nothing). This would be such a huge bug I have a hard time believing it, so I have to suspect there's a dance I'm not doing to make this work correctly. DOM XML: /* again, $filename contains path to valid XML file, $xpathxpr contains valid XPath expression matching at least one document node, $fillval contains a mixed well-formed text/xhtml string to be pre-pended within each matching node */ $domDoc = new DOMDocument(); $domDoc-loadHTML(file_get_contents($filename)); $search = new DOMXPath($domDoc); $nodes = $search-query($xpathxpr); foreach($nodes as $emt) { $f = $domDoc-createDocumentFragment(); $f-appendXML($fillval . $emt-nodeValue); $emt-nodeValue = ''; $emt-appendChild($f); } This also gets mixed results. It gets cranky and issues warnings about any HTML entities (despite that it seems it should be clear this is an HTML document given the invocation of loadHTML), and while I'm seeing some markup make it through, I'm not in other cases. I haven't quite figured out the difference. I can come up with some runnable tests if it will help, but I'm hoping someone's already familiar with the general issues with using PHP's XML tools to work with HTML that they can make some good commentary on the matter. Thanks, Weston -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: table-less layouts; Ideas welcome
On Thu, May 21, 2009 at 12:10 PM, tedd tedd.sperl...@gmail.com wrote: Could you be certain that your algorithm would figure out which way it needs to present the text to a blind person? My own experience browsing the web with Lynx (which for the most part, tends to ignore table layout, giving you the content of table cells in source order) suggests that order doesn't end up being a significant issue. The common layouts tend to read surprising well in source order. Navigation is usually at the top or the left, so you encounter it quickly. If there's any problem, most of the time it's that the page author has done something hideous with a lot of images with no alt text or abuse of HTML entitites, or part of the navigation structure is only accessible via javascript or flash or something like that... all separate issues from repurposing tabular markup. And when there *is* some kind of a layout issue, most of the time it's easy to adapt as a human reader by searching/scanning (sometimes easier than if you're looking at a bad visual layout). The tools that enhance accessibility on a page in these respects really don't have a lot to do with whether there's tabular markup -- if you want to enable easy access to page navigation, you can add semantic information about that regardless. In fact, that information is quite likely more important and less prevalent than what you end up with even most CSS-positioned sites, given that the vast majority of them simply provide stylesheets for the purposes of... visual layout, and what you're left with when a screen reader ignores them is linear source-ordered elements. None of this is to say that CSS can't be very useful in addressing this problem (and other problems), or that there aren't some problems with tabular markup. The presentation example you mentioned is actually going to be an issue with even real tabular data without some care taken in the markup. And I don't want to go back to coding 1999 markup for 1999 browsers. Mostly my point is that the problem with using tables is a bit more limited in size than it's often made out to be, there are other ways of dealing with the accessibility and semanticity issues involved, some of them potentially more effective. And for some cases, table layouts just work better. I think we'd be better off with a wide variety of professionals who can balance these different issues than with a tables considered harmful summary. Now compound that with cells holding images, place-holders, empty cells and cells with navigation elements, flash, videos, and such -- and you might have a better appreciation as to the problem screen readers face. These are actually some of the heuristic markers I believe some browsers actually use (and if they don't, they certainly could). If you have a table whose cells largely contain highly mixed markup, largely presentational elements, no alternative data, chances are pretty good that it isn't tabular data. And... Benjamin Hawkes-Lewis bhawkesle...@googlemail.com WCAG 1.0 ... explained how /authors/ could distinguish between layout tables and data tables: 1) When writing a presentational table, stick to the elements table, tr, td. Do not use the headers, scope, axis, or summary attributes. Make sure layout tables make sense when linearized. 2) When writing a data table, add the elements th, thead, tbody, tfoot, caption, and col and the attributes headers, scope, axis, and summary wherever appropriate. Exactly. These are great markers for distinguishing between where authors were using table markup semantically or presentationally. I think in practice there are probably many others available. Fast forward a decade, and authors are getting another tool in our toolbox, not a million miles away from your 'class=layout'. I don't think it's very well specified yet, but: http://www.w3.org/TR/wai-aria/#presentation I'm actually amazed... this is very nearly what I proposed in some discussions back in 2004. I eventually shifted to class=layout because it had some other practical benefits and everybody I talked to seemed to feel cluttering up the attribute space with yet another item was wrong (on top of this sortof general malaise about repurposed table markup), especially when considering how much semantic mileage you can get out of class attributes. I'd be totally happy to see anything like it adopted, though, and as I said before, think it'd push the semantic web forward faster than waiting for everyone to come around to doing things one blessed way. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Boolean Parameter to 3 Options?
Why not this: function doFooBar($doFoo = 0) { switch ($doFoo) { case 2: echo Did Baz; break; case 1: echo Did Foo; break; default: echo Did Bar; break; } } I think in this way you can avoid future problems in case you need to add other options in this param. Hope helps. Matt Neimeyer m...@neimeyer.org escreveu na mensagem news:9077339e0904290942y542c7978neb1cd92af5656...@mail.gmail.com... I have a function that currently takes a boolean value as a parameter. But now I want to expand it to 3 options... So if I have... function doFooBar($doFoo = false) { if($doFoo) { echo Did Foo; } else { echo Did Bar; } } Is it as simple as changing it like follows to avoid having to change existing code that won't use the new values. function doFooBar($doFoo = 0) { if($doFoo == 2) { echo Did Baz; } else if($doFoo == 1) { echo Did Foo; } else { echo Did Bar; } } Something about that disturbs me. Perhaps because any time I think Oh it will be as simple as... it usually isn't. Thanks in advance! Matt -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Strange result, 1 shows up
Try using only: include('box.inc.php'); instead of echo include('box.inc.php'); Gary gwp...@ptd.net escreveu na mensagem news:63.c9.24434.0b377...@pb1.pair.com... When I insert this code into a page, I get a 1 show up. Can anyone explain that and tell me how to get rid of it? Thanks for your help. Gary ?php //Chooses a random number $num = Rand (1,6); //Based on the random number, gives a quote switch ($num) { case 1: echo include('box.inc.php'); break; case 2: echo ; break; case 3: echo ; break; case 4: echo ; break; case 5: echo ; break; case 6: echo ; } ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: multi-dimensional arrays
I think the best way would be: $arrays = explode(PHP_EOL, $field); foreach ($arrays as $array) { $array = explode( , $array); } Not tested, but should work. Andres Gonzalez and...@packetstorm.com escreveu na mensagem news:49e38a9e.3090...@packetstorm.com... Hi, I am learning PHP and have a simple question. I have a input string in this form: xxx xx x xx xxx xx x x xxx xx xx . . . xx xxx xx xx xx each line has 6 words of various lengths, all separated by white space. the input string can have any number of lines I want to put this into a multi-dimensional array, each line an array that is an element of an outer array. I have tried various ways to do this--I have used explode() and array_filter() and can get a single line parsed and into an array but I am having problems getting a well formed 2 dim array. What is the easiest way to do this? With all of the PHP array functions, there should be an very straight forward way to do this. Any help would be appreciated. -Andres -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Multithreading in PHP
My suggestion is that you can start a second ajax as soon as the response about validating data is returned to process everithing you need and so your user wont wait until the process is finished. João Cândido Manoj Singh manojsingh2...@gmail.com escreveu na mensagem news:3859a530903170639m6c2af2b2s941446a31103c...@mail.gmail.com... Hi Alpar, Thanks for reply. Actually the form is submitted through ajax request and the validation is checking on the server side. So if any error occurs on submission of form, then we are displaying the errors to the user. And is there is no error, then the submitted page started processing. So here client has to wait until the page process completed or not. What i want here if possible, after validating the user input server sends the thanks response to the client so that cleint doesn't has to wait, then the server starts the processing. Please suggest if it is possible. Regards, Manoj On Tue, Mar 17, 2009 at 7:01 PM, Alpár Török torokal...@gmail.com wrote: 2009/3/17 Manoj Singh manojsingh2...@gmail.com: Hi Guys, I am creating a page which submits the form through Ajax request the submitted page is sending the mails to n number of users. Now until the mail sends or the page process completed the end user has to wait. Is it possible that server sends the response to the client then start processing so that the client doesn't have to wait for the server response. Please suggest. Regards, Manoj Since you are using Ajax requests, which by their nature are asynchronous , your user won't have to wait. You can write some JS code to let him know that the request was sent, and just let the ajax call run in the background. On the server side make sure to ignore user abort, just in case the user navigates away. -- Alpar Torok -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: PDO DBLIB does not support transaction
I´ve just solved it by myself by creating methods which executes BEGIN TRANSACTION, COMMIT TRANSACTION and ROLLBACK TRANSACTION directly. João Cândido de Souza Neto j...@consultorweb.cnt.br escreveu na mensagem news:1f.00.36931.96bba...@pb1.pair.com... Hi, I´m using PDO dblib to connect to a MSSQL server and now I figured out that this driver does not support transaction. Anyone here know any solution for this case? Thanks in advance. -- João Cândido de Souza Neto -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] sprintf thousand separator.
Chris, Thanks for your answer, but my real problem is to get thousand separator in jpgraph class which uses sprintf to display almost everithing; chris smith dmag...@gmail.com escreveu na mensagem news:3c1395330902110457i18cec69cy9818e08cdd3ff...@mail.gmail.com... 2009/2/11 João Cândido de Souza Neto j...@consultorweb.cnt.br: Hello everybody. I´d just like to know if there´s any way of defining a thousand separator to a currency value using sprintf. Use number_format instead of sprintf, it's designed to do what you want. -- Postgresql php tutorials http://www.designmagick.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] sprintf thousand separator.
No, I can´t, because if I do it how can jpgrhph render without numeric data? hehehe Richard Heyes rich...@php.net escreveu na mensagem news:af8726440902110523x63ce5485p6534d10063eb4...@mail.gmail.com... Thanks for your answer, but my real problem is to get thousand separator in jpgraph class which uses sprintf to display almost everithing; Can you format it first, and then pass it to JPGraph ? -- Richard Heyes HTML5 Canvas graphing for Firefox, Chrome, Opera and Safari: http://www.rgraph.org (Updated January 31st) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] sprintf thousand separator.
Ok, thanks. I´ll try to do it. As soon as I get it I´ll let you know. Thanks guys. Bruno Fajardo bsfaja...@gmail.com escreveu na mensagem news:eeb6980b0902110534p22a8c75eqd98cceaf3a150...@mail.gmail.com... Can you extend the JPGraph class, intercepting the desired method, formatting the output the way you need? 2009/2/11 João Cândido de Souza Neto j...@consultorweb.cnt.br No, I can´t, because if I do it how can jpgrhph render without numeric data? hehehe Richard Heyes rich...@php.net escreveu na mensagem news:af8726440902110523x63ce5485p6534d10063eb4...@mail.gmail.com... Thanks for your answer, but my real problem is to get thousand separator in jpgraph class which uses sprintf to display almost everithing; Can you format it first, and then pass it to JPGraph ? -- Richard Heyes HTML5 Canvas graphing for Firefox, Chrome, Opera and Safari: http://www.rgraph.org (Updated January 31st) -- 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] Architecture patterns in PHP
Nathan Nobbe wrote: Hey, How do you structure your web applications? I am thinking in terms of separating presentation and logic. How is that done in PHP? mvc is pretty popular, but php is so flexible you often don't need it for smaller applications. For example, if you take a page-controller approach, a php app is dead simple. You have a seperate entery point for evrything; login.php, register.php, etc could be considered controllers, then all your common logic comes in via some includes, hopefully files outside the webroot. then you have some template directory w/ files that are a mixture of php and html(for example). your 'controller' files include the library code, hit the db (if necc.) and then stuff data into the templates for output. if you want to see an exmple if a more traditional mvc there are scads of open source frameworks out there which use a front controller approach. Code igniter is really straight forward, you can probly learn quickly from it. Thanks for the reply. Does anyone know of a good written guide about patterns like Front controller, Page Controller, MVC etc. and how they are implemented in PHP? I found something about these patterns in a guide on MSDN called Enterprise Solution Patterns Using Microsoft .NET (http://msdn.microsoft.com/library/ms998516(en-us).aspx). It describes MVC, Page Controller, Front Controller and a lot of other patterns for ASP.NET applications. Something like this for PHP would be cool. Thanks Michael C. Yates -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Architecture patterns in PHP
Hey, How do you structure your web applications? I am thinking in terms of separating presentation and logic. How is that done in PHP? And how many architecture patterns are there? Thanks Micheal C. Yates -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Architecture patterns in PHP
dude, whatever Daniel Brown wrote: On Sat, Dec 27, 2008 at 18:40, Michael C. Yates quw...@gmail.com wrote: [snip!] Micheal C. Yates You mis-spelled your name, Michael. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] gethostbyaddr and IPv6
On 11/22/2008 02:17 AM, Lars Torben Wilson wrote: 2008/11/21 Glen Carreras[EMAIL PROTECTED]: On 11/22/2008 12:10 AM, Lars Torben Wilson wrote: Hi Glen, Works for me. IPv6 support was added in 2001. You didn't say what version of PHP you are having this problem with, so it's hard to say why yours doesn't have support for it. Perhaps it was configured with --disable-ipv6 for some reason, or compiled on a system without the necessary libraries installed (which would be somewhat surprising). Torben Thanks for the confirmation that it works Torben, This is version 5.2 (Windows binaries) and according to phpinfo ipv6 is enabled. Hmmm well, at least I now know for sure that it works for someone else and I can start exploring other avenues. I'm starting to think this is another problem resulting from Microsofts poor implementation of IPv6 on XP. Glen Hi Glen, I suspect that you may be correct--I generally don't run Windows (certainly not as a server) so I can't be sure; someone with more knowledge of Windows internals will have to field that one for you. With any luck you might find something in the user notes which leads you to a way to solve your problem using some other function or idea. Just for future reference, if you're having problems it will help people to answer your questions if you specify your PHP version and OS etc (where 'etc' means 'and all other relevant information, which of course won't be obvious--hehe) when writing the original question. I ain't tryin' to be some kind of netiquette freak here--just trying to help out. :) Anyway, good luck on your quest. Regards, Torben Torben.. Indeed, after re-reading my initial post I can see I was lacking a little in the information department. I appreciate your help. Just to follow-up on this. I installed PHP 5.3alpha as a test and the function does work as expected. (although there are other issues which preclude me from using that version at this time) I then tried 5.2.7RC4 and the function no longer worked. So it looks like a problem with that version series. I suppose I should raise a bug report and see if anything can be done while it's still in the RC phase. Thanks again, Glen -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] gethostbyaddr and IPv6
Hello, Does gethostbyaddr actually work for anyone while looking up an IPv6 address? I can't seem to get it to work. For example: echo gethostbyaddr ( '2001:470:0:64::2' ); should return ipv6.he.net but instead I get the following error: [21-Nov-2008 22:43:37] PHP Warning: gethostbyaddr() [a href='function.gethostbyaddr'function.gethostbyaddr/a]: Address is not in a.b.c.d form in C:\www\tests\saved\host.php on line 7 Google has not been my friend in this matter... Any insight? Thanks, Glen -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Manual Coding vs. CMS Systems
Hi all! And again, a slightly off topic subject for you all from yours truly :o) I have a customer (helicopter company) who is willing to give me some free flights for a small website. Now, I have been talking to my sister in law who is a designer (note: designer, not coder). She said I should be using Joomla or something of that sort and change it to fit my needs. I, on the other hand, am more into using my own code, starting with the first Hello World and ending up being a full fledged CMS with just the functions the customer needs. I have a lot of code in my code database already, so it would be a lot of copy and paste and a bit of coding. I think the whole thing will take about 60 work hours. I am into hand coding, to be honest. Using Joomla or other CMS systems is fine, but I want this to be a nice point on my CV if I ever need to get a new job. And, most important to me, it _feels_ much better to have it done from scratch all by yourself, doesn't it? So, I would love to hear your opinion on this. Sorry for being a bit off topic here as this is not 100% coding related, but I _had_ to get some feedback to backup my position ;o) Cheers! Chris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Manual Coding vs. CMS Systems
-:- -Original Message- -:- From: Jochem Maas [mailto:[EMAIL PROTECTED] -:- Sent: Thursday, August 28, 2008 1:46 PM -:- To: [EMAIL PROTECTED] -:- Cc: php-general@lists.php.net -:- Subject: Re: [PHP] Manual Coding vs. CMS Systems -:- -:- Auto-Deppe, C. Haensel schreef: -:- Hi all! -:- -:- And again, a slightly off topic subject for you all from -:- yours truly :o) -:- -:- I have a customer (helicopter company) who is willing -:- to give me some free -:- flights for a small website. -:- -:- Now, I have been talking to my sister in law who is a -:- designer (note: -:- designer, not coder). She said I should be using Joomla -:- or something of that -:- sort and change it to fit my needs. -:- -:- designers should keep their mouths shut when it comes to -:- code/coding ... -:- I don't care if she's your sister or the queen of england. -:- -:- do we tell them what to draw? not if your smart, if your -:- smart you'll only -:- ever tell them when something is impossible to implement -:- (this-is-the-web-not-a-sheet-of-A4), -:- or when something is not cost effective to implement (i.e. -:- the client will never -:- agree to pay for X) -:- -:- make your own mind up as to what is the most effective solution. -:- -:- I, on the other hand, am more into using my own code, -:- starting with the -:- first Hello World and ending up being a full fledged -:- CMS with just the -:- functions the customer needs. I have a lot of code in my -:- code database -:- already, so it would be a lot of copy and paste and a -:- bit of coding. I think -:- the whole thing will take about 60 work hours. -:- -:- Im guessing you'd spend that much time just implementing a -:- decent design into -:- a Joomla or whatever. I mean a design that doesn't look -:- like it was generated -:- by Frontpage. -:- -:- I am into hand coding, to be honest. Using Joomla or -:- other CMS systems is -:- fine, but I want this to be a nice point on my CV if I -:- ever need to get a -:- new job. And, most important to me, it _feels_ much -:- better to have it done -:- from scratch all by yourself, doesn't it? -:- -:- So, I would love to hear your opinion on this. Sorry for -:- being a bit off -:- topic here as this is not 100% coding related, but I -:- _had_ to get some -:- feedback to backup my position ;o) -:- -:- Cheers! -:- -:- -:- Chris -:- -:- -:- -:- -:- Hahaha.. THAT one told exactly what I feel! Thanks :o))) Also a big thanks to the others who already replied. Waiting for more on that Great one Jochem!! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] make install doesn't seem to work on downgrade on OS X -- anyone else seen this?
I recently downgraded from a build of 5.3 to 5.2.6 on OS X, and had a bit of time figuring out what was going on when make install didn't seem to actually copy the CLI binary and Apache SO to their target spots. Has anyone else seen this problem? What category would a bug report for this be under? It's a build/install issue, but there's no particular category for these beyond compile issues... Thanks, Weston -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] make install doesn't seem to work on downgrade on OS X -- anyone else seen this?
On Tue, Aug 19, 2008 at 9:43 AM, Jason Pruim [EMAIL PROTECTED] wrote: Is there a particular reason you are downgrading? I'm pretty happy with some of the features in 5.3, but have been asked to work with a codebase that turned out to have some issues under 5.3 that didn't show up under 5.2.x. I'd love to have the time to dig and give feedback on the issues for the improvement and quicker release of 5.3, but unfortunately work has to be a higher priority. :( -W -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Echo in __GET()
Is the a way to have an array, or use __get() to provide different data if you are echoing a variable, rather than if you are using it in a 'if' statement? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP Memory Management
is it possible because you can assign $func = foo and call $func() and it will call foo(), maybe that its creating an endless loop of assigning the function to itself? On Sun, Aug 3, 2008 at 11:17 AM, brian [EMAIL PROTECTED] wrote: Waynn Lue wrote: I've been running the script below: ?php $appIds = getLotsOfAppIds(); foreach ($appIds as $appId) { echo $appId\n; //echo memory_get_usage() . \n; try { $getBundles = getBundles($appId); $numBundles = count($registeredBundles); echo $numBundles . \n; continue; } } ? And I get PHP Fatal Error: Allowed Memory Size Exhausted after it runs for a bit. Looking at the memory usage, it's because $getBundles (an array) is huge, and keeps growing. What I'm confused by is why setting it to something else in the next iteration of the foreach loop doesn't free the previously allocated array, since there shouldn't be any more references to it. I've worked around it by explicitly calling unset($getBundles), but just wanted to understand why it's working the way it does. Aside from on the 1st iteration, each time getBundles() is called, it creates an array within its own scope. Until PHP assigns the returned array to $getBundles, there are two in memory. Maybe that's the problem. I don't know how you can stand naming structures or variables the same as functions, btw. That would drive me nuts. Where is this $registeredBundles coming from? Perhaps you meant: $registeredBundles = getBundles($appId); b -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- http://twit.tv - What I listen to All Week
[PHP] PHP 5 auto-htmlentitizing strings?
I just switched over an app from PHP 4 to PHP 5, and one of the weird things I'm noticing initially is that some of the html output seems to be html entitized. For example, a link that was showing up in html output as: a href=http://metaphilm.com/philm.php?id=29_0_2_0;Is Tyler Durden Hobbes?/a now gets transformed to: lt;a href=http://metaphilm.com/philm.php?id=29_0_2_0gt;Is Tyler Durden Hobbeslt;/agt; No other changes in the PHP source -- just a change in the interpreter. Any idea what could be causing this? Thanks, Weston -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Exposing PHP/errors on production vs. dev
Somehow .. I feel this isn't PHP Related. On Sat, Aug 2, 2008 at 11:08 AM, Robert Cummings [EMAIL PROTECTED]wrote: On Sat, 2008-08-02 at 14:01 -0400, Daniel Brown wrote: On Sat, Aug 2, 2008 at 1:58 PM, Robert Cummings [EMAIL PROTECTED] wrote: Sorry, I hired a profession for the chair throwing-- my bulldog Steve Ballmer! More wasteful spending by the Canadian. You know that he's just going to wind up finding a way to introduce new bugs into the act of domestic violence, right? Like fear that emits an unpleasant odor or bruises that cause herpes. Given the goal was to enact violence... I think fear and herpes would count as features! With respect to wasteful spending... I think you're forgetting that the US dollar is on target for devaluation similar to that of Zimbabwean currency. :B Cheers, Rob. -- http://www.interjinn.com Application and Templating Framework for PHP -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- http://twit.tv - What I listen to All Week