[PHP] About sessions and subdomains
Hi everyone, Sorry, this might be a stupid question, but still. Once upon a time I had done so my sessions were handled on all subdomains of my website (shame on me for doing so!). Now, when I comment out the line session_set_cookie_params(0, /, .oire.org); in my header file, I got an empty $_SESSION array after submitting every single form on my website. For sure, signing out and back in, as well as cookie removing, were tried several times. Thanks in advance! -- With best regards from Ukraine, Andre Skype: Francophile Blog: http://oire.org/menelion Twitter: http://twitter.com/m_elensule Facebook: http://facebook.com/menelion -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Need Part-time Coder
Hello Paul, PH for($i = 0, $ln = sizeof($a); $i $ln; ++$i) { echo $a[$i]; } foreach ($a as $v) { echo $v; } :P ;-) -- With best regards from Ukraine, Andre Skype: Francophile My blog: http://oire.org/menelion (mostly in Russian) Twitter: http://twitter.com/m_elensule Facebook: http://facebook.com/menelion -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Help on number matching function
Hello Dare, DW I need a Function of any category in either PHP or MySQL RDBMS DW customize Function, Class, Methods or anything that could help me DW compare a particular set of number and return their matching DW result. consider using array_intersect(). -- With best regards from Ukraine, Andre Skype: Francophile My blog: http://oire.org/menelion (mostly in Russian) Twitter: http://twitter.com/m_elensule Facebook: http://facebook.com/menelion -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] concatenating
Hello Chris, CS Is it possible to concatenate a string and an element from a CS mysql_fetch_assoc array? I haven't had much luck searching google. CS Such as concatenating results with ' . $posts_row['store_tptest'] . CS ' so that if there are no elements returned nothing will be displayed? if (!empty($posts_row['store_tptest'])) $str=results .$posts_rows['store_tptest']; -- With best regards from Ukraine, Andre Skype: Francophile My blog: http://oire.org/menelion (mostly in Russian) Twitter: http://twitter.com/m_elensule Facebook: http://facebook.com/menelion -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] A php bug or?..
Hi everyone, As we all know, count() returns 1 if the variable is not an array. Question is: why in the world does it this? If a variable is *notA* an array, it contains *zero* array elements. You can answer: but no, man, you can say $x=world; $y=$x{3}; // $y=l so the variable is treated or can be treated as an array. Well. If strings are treated like arrays, why count($x) doesn't return 5 instead of 1? Just asking. -- With best regards from Ukraine, Andre Skype: Francophile Blog: http://oire.org/menelion Twitter: http://twitter.com/m_elensule Facebook: http://facebook.com/menelion -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] A php bug or?..
Hello Daniel, DPB does it return the number of characters within a string --- instead, DPB as you likely know, you'd use strlen(). For sure. But I'm asking: why it doesn't return 0 if it is not an array? Logically: no array - no items! -- With best regards from Ukraine, Andre Skype: Francophile My blog: http://oire.org/menelion (mostly in Russian) Twitter: http://twitter.com/m_elensule Facebook: http://facebook.com/menelion -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Login with Remember me Feature
Hello alekto, I've got several notes to point out: 1. You can't do neither a header(), nor a SetCookie() after any echo on the page. The out-of-php pieces of the page included. 2. Don't, please please don't store raw passwords in the database! Hash them, better even adding a salt. The guy who had been writing code of our project before me stored raw passwords, and I lost an amount of time to encrypt them live so users wouln't notice anything happening. Please don't repeat this mistake) 3. Don't store passwords in the cookies, they can be easily stolen. the username is quite enough: if it is there and it is not empty, then you can verify if such a user exists. -- With best regards from Ukraine, Andre Skype: Francophile My blog: http://oire.org/menelion (mostly in Russian) Twitter: http://twitter.com/m_elensule Facebook: http://facebook.com/menelion -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Login with Remember me Feature
Hello Richard, RR See ob_start and family. Alekto doesn't use them in that code. -- With best regards from Ukraine, Andre Skype: Francophile My blog: http://oire.org/menelion (mostly in Russian) Twitter: http://twitter.com/m_elensule Facebook: http://facebook.com/menelion -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Best editor?
Hi, Notepad!!! LOL.. I use netbeans but eclipse is nice. A lot of it is personal opinion. I have been using Notepad since... oh, since 2007, I believe). And it's my editor of choice :-). Actually now I'm using AkelPad because of the unicode issues (I need to save without a bit order mark). -- With best regards from Ukraine, Andre Skype: Francophile My blog: http://oire.org/menelion (mostly in Russian) Twitter: http://twitter.com/m_elensule Facebook: http://facebook.com/menelion -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Studying mcrypt
Hello Php, It's my first time I use mcrypt. I've done everything like it's written in the php manuals, here is the code: ?php $d=mcrypt_module_open(rijndael-256, , ofb, ); $iv=mcrypt_create_iv(mcrypt_enc_get_iv_size($d), MCRYPT_DEV_RANDOM); $ks=mcrypt_enc_get_key_size($d); $key=substr(md5(Secret key), 0, $ks); mcrypt_generic_init($d, $key, $iv); $cpass=mcrypt_generic($d, $_POST['opass']); mcrypt_generic_deinit($d); mcrypt_module_close($d); ? And here's what I get: Original password: asdfasdfasdf Encrypted password: Q�j�* Question: Is it normal to have such strange characters in the encrypted string? I'm hosted at http://godaddy.com/, shared hosting, if it does matter. Thanks! -- With best regards from Ukraine, Andre Skype: Francophile Twitter: http://twitter.com/m_elensule Facebook: http://facebook.com/menelion -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Studying mcrypt
Hello Alex, Thanks for the tip. I'm not storing it in the database (you see, it's asdfasdf and the key string is secret key), I'm just studying mcrypt's possibilities :-). -- With best regards from Ukraine, Andre Skype: Francophile My blog: http://oire.org/menelion (mostly in Russian) Twitter: http://twitter.com/m_elensule Facebook: http://facebook.com/menelion Original message From: Alex Nikitin niks...@gmail.com To: Andre Polykanine Date created: , 9:27:42 PM Subject: [PHP] Studying mcrypt Yes, since it's trying to represent in characters some purely binary data, it is not unlikely that you will get VERY weird characters (and you do). Also you shouldn't actually encrypt passwords, the proper way to store them is hashed, so that if someone grabs your database, they dont have your passwords, even if they have the key. Best way to check is to decrypt it and verify... -- The trouble with programmers is that you can never tell what a programmer is doing until it’s too late. ~Seymour Cray On Wed, Aug 3, 2011 at 12:40 PM, Andre Polykanine an...@oire.org wrote: Hello Php, It's my first time I use mcrypt. I've done everything like it's written in the php manuals, here is the code: ?php $d=mcrypt_module_open(rijndael-256, , ofb, ); $iv=mcrypt_create_iv(mcrypt_enc_get_iv_size($d), MCRYPT_DEV_RANDOM); $ks=mcrypt_enc_get_key_size($d); $key=substr(md5(Secret key), 0, $ks); mcrypt_generic_init($d, $key, $iv); $cpass=mcrypt_generic($d, $_POST['opass']); mcrypt_generic_deinit($d); mcrypt_module_close($d); ? And here's what I get: Original password: asdfasdfasdf Encrypted password: Q� j�* Question: Is it normal to have such strange characters in the encrypted string? I'm hosted at http://godaddy.com/, shared hosting, if it does matter. Thanks! -- With best regards from Ukraine, Andre Skype: Francophile Twitter: http://twitter.com/m_elensule Facebook: http://facebook.com/menelion -- 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] Studying mcrypt
Hi Ash, Please don't top-post :) *Huge sigh* OK, OK! But still it's too uncomfortable to read bottom-posting! :P You can use base64_encode() on it to convert it into something that's printable and storable in the DB without having to resort to a binary blob Thanks, will try!) -- With best regards from Ukraine, Andre Skype: Francophile My blog: http://oire.org/menelion (mostly in Russian) Twitter: http://twitter.com/m_elensule Facebook: http://facebook.com/menelion -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Studying mcrypt
Hello Alex, I have a neat class you can play with... Could you give me the link, please?) -- With best regards from Ukraine, Andre Skype: Francophile My blog: http://oire.org/menelion (mostly in Russian) Twitter: http://twitter.com/m_elensule Facebook: http://facebook.com/menelion -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Best editor?
Hello Ricardo, RM i was using notepad a lot of years, nowdays i use gedit (@linux ) i think RM that gedit is avaible for windows too. Unfortunately, it isn't accessible for visually impaired users. -- With best regards from Ukraine, Andre Skype: Francophile My blog: http://oire.org/menelion (mostly in Russian) Twitter: http://twitter.com/m_elensule Facebook: http://facebook.com/menelion -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Session treating
Hi guys and girls, I'm completely stuck at a really stupid thing. For some reason my session id doesn't pass through the links. Here is the code: index.php: ?php // Checking if the admin was ever authorized if ($_SESSION['PSS']!=session_id()) $auth=0; else $auth=1; if ($_SESSION['Editor']!=Voice of Istanor) $auth=0; else $auth=1; if ($auth==0) { if (!@$_POST) { // If there's no POST values, including the login form include login.php; // For debugging only, outputs: Session name: PHPSESSID, session id: ; printf(Session name: %s, Session Id: %s, session_name(), session_id()); } else { // Here go real values if (($_POST['uname']!=Tralala) || (sha1($_POST['upass'])!=abcdeftralala)) { echo h3Invalid login or password!/h3; include login.php; } else { // Attention! session_name(PalantirSessId); session_start(); // Everything goes Ok here printf(Session name: %s, Session Id: %s, session_name(), session_id()); $_SESSION['PSS']=session_id(); $_SESSION['Editor']=$_POST['uname']; $auth=1; } } } if ($auth==1) { echo !DOCTYPE HTMLhtml head meta charset=\utf-8\ /head body bgcolor=#CCBBFF; include header.html; // Still ok! the same name, the same Id printf(Session name: %s, Session Id: %s, session_name(), session_id()); end of code. But now go the links such as a href=articles.phpArticles management/a And there, in the articles.php, I write the following: ?php session_name(PalantirSessId); session_start(); printf(Session name: %s, Session Id: %s, session_name(), session_id()); And here (!) the session name is correct, but the session id is changed. My question is: why? Thanks! -- With best regards from Ukraine, Andre Skype: Francophile Twitter: http://twitter.com/m_elensule Facebook: http://facebook.com/menelion -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Session treating
Hello Ashley, One thing sticks out a little bit to me. In your index.php file, you're accessing an element of the $_SESSION array, but without calling session_start() first. I believe this may be causing the issue you are seeing. I tried using it without success. I'm having now 3 separate session IDs: 1. Before the login form is processed, 2. After the login form is processed, 3. When clicking the Articles link, on the articles.php page. -- With best regards from Ukraine, Andre Skype: Francophile My blog: http://oire.org/menelion (mostly in Russian) Twitter: http://twitter.com/m_elensule Facebook: http://facebook.com/menelion -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: [PHP-DB] Re: radio form submission
Hello Chris, Maybe I'm off topic, but wouldn't you consider JavaScript form validation? That will make your task easier and the user will see his/her error much earlier, before he/she submits the form. -- With best regards from Ukraine, Andre Skype: Francophile My blog: http://oire.org/menelion (mostly in Russian) Twitter: http://twitter.com/m_elensule Facebook: http://facebook.com/menelion Original message From: Chris Stinemetz chrisstinem...@gmail.com To: rquadl...@gmail.com Date created: , 9:44:05 PM Subject: [PHP] Re: [PHP-DB] Re: radio form submission radio select validation What I am doing wrong? I want to make sure a radio button is selected, but my current code allows insertion even when radio button isn't selected. My code is: //Generating radio buttons for store type with array echo 'Store type:br /br /'; $choices = array('corporate' = 'Cricket owned | ', 'premier' = 'Premier dealer'); foreach ($choices as $key = $choice) { echo input type='radio' name='store_type' value='$key'/ $choice \n; } //Validate the radio button submission if (!array_key_exists($_POST['store_type'], $choices)) { echo You must select a valid choice.; } Thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Ftp upload
Hi everyone, I would like to have a possibility to upload really large files to the website. As we all know, the post_max_size parameter is set to 8Mb by default. However, I see that the ftp_put() function has a local filepath parameter. And the question is: how can I retrieve the local filepath if a user browses to the file from his/her PC? Thanks! -- With best regards from Ukraine, Andre Skype: Francophile Twitter: http://twitter.com/m_elensule Facebook: http://facebook.com/menelion -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Ftp upload
Hi Richard, Thanks a lot! So can I let them upload, say, a 700 Mb file via POST or should I consider connecting to FTP? -- With best regards from Ukraine, Andre Skype: Francophile My blog: http://oire.org/menelion (mostly in Russian) Twitter: http://twitter.com/m_elensule Facebook: http://facebook.com/menelion Original message From: ad...@buskirkgraphics.com ad...@buskirkgraphics.com To: 'Andre Polykanine' Date created: , 3:41:59 PM Subject: [PHP] Ftp upload Andre, I have checked the $_POST, and THE $_FILES. I am pretty sure the actual path is not passed. Now you can find the path on the server in the tmp_name of the $_FILES array. I have read a few DOM related issue concerning the PATH of the file uploaded in mulitpart/form-data. Microsoft: Internet Explorer 7 and later. By default, Internet Explorer does not include folder or directory path information when uploading files to sites. So this means the Clients Browser is passing the file name NOT the path. I am sure if you dig around in JavaScript you may find a way to see the value of that attribute on submit or click. I have never wanted to know the actual file path from the end user, nor has it ever been a request for me to do so. You can however change the ini for upload_max_filesize and post_max_size inside of your php script at the top. html head titleA file upload script/title /head ?php ini_set('upload_max_filesize', 800); ini_set(post_max_size, 30M); $file_dir = .; $file_url = .; if ( isset( $fupload ) ){ print path: $fuploadbr\n; print name: $fupload_namebr\n; print size: $fupload_size bytesbr\n; print type: $fupload_typep\n\n; if ( $fupload_type == image/gif ){ copy ( $fupload, $file_dir/$fupload_name) or die (Couldn't copy); print img src=\$file_url/$fupload_name\p\n\n; } } ? body form enctype=multipart/form-data action=?php print $PHP_SELF? method=POST input type=hidden name=MAX_FILE_SIZE value=51200 input type=file name=fupload input type=submit value=Send file! /form /body /html Richard L. Buskirk -Original Message- From: Andre Polykanine [mailto:an...@oire.org] Sent: Tuesday, June 14, 2011 7:38 AM To: Php General Subject: [PHP] Ftp upload Hi everyone, I would like to have a possibility to upload really large files to the website. As we all know, the post_max_size parameter is set to 8Mb by default. However, I see that the ftp_put() function has a local filepath parameter. And the question is: how can I retrieve the local filepath if a user browses to the file from his/her PC? Thanks! -- With best regards from Ukraine, Andre Skype: Francophile Twitter: http://twitter.com/m_elensule Facebook: http://facebook.com/menelion -- 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] Ftp upload
Hi Richard, So, say, they make audiobooks or movies and they want them to be available as (paid) download. How should they upload it so they would be in the catalog? -- With best regards from Ukraine, Andre Skype: Francophile My blog: http://oire.org/menelion (mostly in Russian) Twitter: http://twitter.com/m_elensule Facebook: http://facebook.com/menelion Original message From: ad...@buskirkgraphics.com ad...@buskirkgraphics.com To: 'Andre Polykanine' Date created: , 5:46:00 PM Subject: [PHP] Ftp upload Andre, Anything over 7 MB to me should be done with FTP. You have a lot of issues with file corruption, length of upload, and bandwidth on each end. But you have to remember, I am crazy in the head. I think that customer satisfaction is key!!! Richard L. Buskirk -Original Message- From: Andre Polykanine [mailto:an...@oire.org] Sent: Tuesday, June 14, 2011 10:02 AM To: ad...@buskirkgraphics.com Cc: 'Php General' Subject: Re: [PHP] Ftp upload Hi Richard, Thanks a lot! So can I let them upload, say, a 700 Mb file via POST or should I consider connecting to FTP? -- With best regards from Ukraine, Andre Skype: Francophile My blog: http://oire.org/menelion (mostly in Russian) Twitter: http://twitter.com/m_elensule Facebook: http://facebook.com/menelion Original message From: ad...@buskirkgraphics.com ad...@buskirkgraphics.com To: 'Andre Polykanine' Date created: , 3:41:59 PM Subject: [PHP] Ftp upload Andre, I have checked the $_POST, and THE $_FILES. I am pretty sure the actual path is not passed. Now you can find the path on the server in the tmp_name of the $_FILES array. I have read a few DOM related issue concerning the PATH of the file uploaded in mulitpart/form-data. Microsoft: Internet Explorer 7 and later. By default, Internet Explorer does not include folder or directory path information when uploading files to sites. So this means the Clients Browser is passing the file name NOT the path. I am sure if you dig around in JavaScript you may find a way to see the value of that attribute on submit or click. I have never wanted to know the actual file path from the end user, nor has it ever been a request for me to do so. You can however change the ini for upload_max_filesize and post_max_size inside of your php script at the top. html head titleA file upload script/title /head ?php ini_set('upload_max_filesize', 800); ini_set(post_max_size, 30M); $file_dir = .; $file_url = .; if ( isset( $fupload ) ){ print path: $fuploadbr\n; print name: $fupload_namebr\n; print size: $fupload_size bytesbr\n; print type: $fupload_typep\n\n; if ( $fupload_type == image/gif ){ copy ( $fupload, $file_dir/$fupload_name) or die (Couldn't copy); print img src=\$file_url/$fupload_name\p\n\n; } } ? body form enctype=multipart/form-data action=?php print $PHP_SELF? method=POST input type=hidden name=MAX_FILE_SIZE value=51200 input type=file name=fupload input type=submit value=Send file! /form /body /html Richard L. Buskirk -Original Message- From: Andre Polykanine [mailto:an...@oire.org] Sent: Tuesday, June 14, 2011 7:38 AM To: Php General Subject: [PHP] Ftp upload Hi everyone, I would like to have a possibility to upload really large files to the website. As we all know, the post_max_size parameter is set to 8Mb by default. However, I see that the ftp_put() function has a local filepath parameter. And the question is: how can I retrieve the local filepath if a user browses to the file from his/her PC? Thanks! -- With best regards from Ukraine, Andre Skype: Francophile Twitter: http://twitter.com/m_elensule Facebook: http://facebook.com/menelion -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Suggestion needed: Internet store script
Hi everyone, I'm making a website for a small company. The site itself is quite easy to accomplish, but there are two problems: i18n and the store. So I would like to have your suggestions about the store. Here are the requirements: 1. Basic functionality (possibility to purchase without authorization, maybe no basket). 2. Accessibility and usability by visually impaired persons, for the admin part included (that means, no complicated flash content and such features). 3. I18n capabilities (unicode of course). We need it to be in English, Russian, and Swedish since it's a Swedish company. 4. It should be freeware (or, if it's really impossible, not expensive). 5. It should be Php+MySql. Thanks! -- With best regards from Ukraine, Andre Skype: Francophile Twitter: http://twitter.com/m_elensule Facebook: http://facebook.com/menelion -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] iPhone sadness
Hello Lester, Sorry, I don't get what you mean by bottom posting but here is my complains: most of you post your messages *after* the quotes. It's really not comfortable: I use screenreading software here and I need to scroll with my down arrow key before I see the actual message. -- With best regards from Ukraine, Andre Skype: Francophile My blog: http://oire.org/menelion (mostly in Russian) Twitter: http://twitter.com/m_elensule Facebook: http://facebook.com/menelion Original message From: Lester Caine les...@lsces.co.uk To: php-general@lists.php.net Date created: , 9:44:59 AM Subject: [PHP] iPhone sadness Paul M Foster wrote: There IS no right way - but it IS polite to follow the rules even if it is a little more difficult doing it from your chosen software. Rather than apologising or simply ignoring the guide lines. I would imagine that interleaved replies or bottom posting will never be considered offensive on any list. Whereas we all know that top posting can often be considered offensive, depending on the list. By the way, bottom posting only really becomes offensive when you fail to trim as needed. Surely that is 'top posting' ? But trimming IS the main complaint with ANY posting. I don't particularly object TO top posting, but 99% of the time there is NO need to have quoting switched on at all. I've seen my sig included here several times when any decent client will respect the 'sig' flag. Perhaps THAT is the default which needs looking at? OK on smart phones 'select' is a pain in the posterior, but that at least is probably the best reason for nicely threading email clients. My SMS messages get threaded - so why not emails as well so that quotes are only needed when actually addressing key points. Oh for a perfect world :) -- Lester Caine - G8HFL - Contact - http://lsces.co.uk/wiki/?page=contact L.S.Caine Electronic Services - http://lsces.co.uk EnquirySolve - http://enquirysolve.com/ Model Engineers Digital Workshop - http://medw.co.uk// Firebird - http://www.firebirdsql.org/index.php -- 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] iPhone sadness
Hello Lester, Actually, I get what you're saying. But it's true if you read a message like an Html page. then you have to press one or two keys and here you are. But for some reasons even now we are required to quote the messages at the bottom. Be saying we I mean those who work for companies making the accessibility solutions. And, BTW, this bottom posting has started just two or three years ago when Thunderbird came in place. But I'll make a template that inserts the text below the quotes if you want :-). -- With best regards from Ukraine, Andre Skype: Francophile My blog: http://oire.org/menelion (mostly in Russian) Twitter: http://twitter.com/m_elensule Facebook: http://facebook.com/menelion Original message From: Lester Caine les...@lsces.co.uk To: php-general@lists.php.net Date created: , 4:15:12 PM Subject: [PHP] iPhone sadness Andre Polykanine wrote: Hello Lester, Sorry, I don't get what you mean by bottom posting but here is my complains: most of you post your messages*after* the quotes. It's really not comfortable: I use screenreading software here and I need to scroll with my down arrow key before I see the actual message. Then you need a better screen reading software - the ones I have seen will jump correctly to the first 'non-quoted' item, then you can scroll back up to the related item if you need to review it. Putting comments BEFORE the quote is simply the wrong way around and is a lot more difficult to follow how ever you access it conventionally. The 'prefered' method for this list is in-line or bottom posting and the requests to change that have been rejected by the majority of users to date. I develop systems that are used by visually impaired users and in general the norm is for correctly ordered messaging - not reverse ordered ones -- Lester Caine - G8HFL - Contact - http://lsces.co.uk/wiki/?page=contact L.S.Caine Electronic Services - http://lsces.co.uk EnquirySolve - http://enquirysolve.com/ Model Engineers Digital Workshop - http://medw.co.uk// Firebird - http://www.firebirdsql.org/index.php -- 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] phpsadness
Hello Lester, Actually, many of the points are not important for me so far, however this one really drives me mad: http://phpsadness.com/?page=sad/35 (can't explode() by an empty string) Besides that, he says nothing about unicode issues. I love PHP (I really do, it's a neat language, as for me!), but it *should* be unicode by default. If you ever read my code when I try to make and strtr() with a unicode string, you'll understand me because I do an iconv(), then strtr() and then an iconv() back to unicode. That is not a good coding practice, is it? -- With best regards from Ukraine, Andre Skype: Francophile My blog: http://oire.org/menelion (mostly in Russian) Twitter: http://twitter.com/m_elensule Facebook: http://facebook.com/menelion Original message From: Lester Caine les...@lsces.co.uk To: php-general@lists.php.net Date created: , 10:49:28 AM Subject: [PHP] phpsadness Daevid Vincent wrote: A friend sent me this URL today. While amusing, he's got many valid points and I certainly share in his frustration. http://www.phpsadness.com I'd take him a bit more seriously if he used a real name ;) But many of the points I looked at simply reflect that he has yet to take advantage of any of the free development tools that highlight problems even before you try and run the code? Of cause what would be really useful would be a comment section on each page so that they CAN be corrected, or linked to the discussion on the pro's and con's on making changes to them. But on the whole PHP is no more 'inconsistent' than any other language? Many of the things I learnt to do in Algol all those years ago are now done differently, and no doubt things will change again - next version of PHPX :) I've just wasted the last two days trying to get a C++ program that I've been using for 15 years even to compile in the latest iteration of the old Borland tool set and I had to pay lots of pennies for the privilege to even try! -- Lester Caine - G8HFL - Contact - http://lsces.co.uk/wiki/?page=contact L.S.Caine Electronic Services - http://lsces.co.uk EnquirySolve - http://enquirysolve.com/ Model Engineers Digital Workshop - http://medw.co.uk// Firebird - http://www.firebirdsql.org/index.php -- 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] phpsadness
Hello Peter, It's not unicode... :-(( Yepp, I saw this thing in notes with array_map, array_chunk and array_something_else but it's still too slow, on my opinion. -- With best regards from Ukraine, Andre Skype: Francophile My blog: http://oire.org/menelion (mostly in Russian) Twitter: http://twitter.com/m_elensule Facebook: http://facebook.com/menelion Original message From: Peter Lind peter.e.l...@gmail.com To: Andre Polykanine Date created: , 12:37:18 PM Subject: [PHP] phpsadness On May 28, 2011 11:27 AM, Andre Polykanine an...@oire.org wrote: Hello Lester, Actually, many of the points are not important for me so far, however this one really drives me mad: http://phpsadness.com/?page=sad/35 (can't explode() by an empty string) http://www.php.net/manual/en/function.str-split.php Regards -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] phpsadness
Hello Nathan, Do you mean $x{8}? That is good but not for all situations. I need sometimes to make an array with letters as keys and numbers as values, like this (I give English alphabet just as an example, so please don't suggest str_split): $alphabet=abcdefghijklmnopqrstuvwxyz; // I wish that worked $alphabet_array=explode('', $alphabet); $letter_numbers=array_flip($alphabet_array); this is just one case I encountered some time ago. Yes, I made this by separating letters with commas... but it's not the unique case when I need it. -- With best regards from Ukraine, Andre Skype: Francophile My blog: http://oire.org/menelion (mostly in Russian) Twitter: http://twitter.com/m_elensule Facebook: http://facebook.com/menelion Original message From: Nathan Nobbe quickshif...@gmail.com To: Robert Cummings Date created: , 7:33:08 PM Subject: [PHP] phpsadness On Sat, May 28, 2011 at 4:33 AM, Robert Cummings rob...@interjinn.comwrote: On 11-05-28 05:26 AM, Andre Polykanine wrote: Hello Lester, Actually, many of the points are not important for me so far, however this one really drives me mad: http://phpsadness.com/?page=sad/35 (can't explode() by an empty string) Besides that, he says nothing about unicode issues. I love PHP (I really do, it's a neat language, as for me!), but it *should* be unicode by default. If you ever read my code when I try to make and strtr() with a unicode string, you'll understand me because I do an iconv(), then strtr() and then an iconv() back to unicode. That is not a good coding practice, is it? Isn't explode() with an empty string akin to division by zero? Strings are already accessible through array notation anyway, seems like ol dude may benefit from a php-general membership as well. -nathan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] simple question abt convert to integer
Hello Negin, $query1=select * from patient where id=.$_POST['txt']; $result1=mysql_query($query1); $rows=mysql_num_rows($result1); Note: you *didn't* execute the query by calling mysql_query on it. -- With best regards from Ukraine, Andre Skype: Francophile My blog: http://oire.org/menelion (mostly in Russian) Twitter: http://twitter.com/m_elensule Facebook: http://facebook.com/menelion Original message From: Negin Nickparsa nickpa...@gmail.com To: php-general@lists.php.net Date created: , 7:05:18 AM Subject: [PHP] simple question abt convert to integer my code is this: $query1=select * from patient where id=.$_POST['txt']; it works but i think because i have error in next line: *Warning*: mysql_num_rows() expects parameter 1 to be resource, boolean given $num2=Mysql_num_rows($result1); i echoed $ query1 and the result was this=select * from patient where id=1 maybe it can't convert $_POST['txt'] from String to integer and then it can't get my $num it is int in my mysql how can i correct $query1? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHPCaptcha / Securimage 2.0.2 - Authentication Bypass - SOS-11-007
Hello Lists, Sorry for my rude words but... there are already too many websites that either don't give us a possibility to get an audio file instead of those damned captcha images; there are lots of others (such as Msn) where the audio is too distorted to be heard. It's not my f***ing problem that you can't protect your audio against spammers. I'm blind, you know, and I *can't* see the image, because I have no sight at all! And I'm not alone, there are thousands of us only in the USA. So make conclusions: if you make a popular site, one day you might have deep problems and maybe even lawsuits from people. Sorry again, it's been just a really painful thing for us for years. -- With best regards from Ukraine, Andre Skype: Francophile My blog: http://oire.org/menelion (mostly in Russian) Twitter: http://twitter.com/m_elensule Facebook: http://facebook.com/menelion Original message From: Lists li...@senseofsecurity.com To: php-general@lists.php.net Date created: , 1:03:06 AM Subject: [PHP] PHPCaptcha / Securimage 2.0.2 - Authentication Bypass - SOS-11-007 Sense of Security - Security Advisory - SOS-11-007 Release Date. 20-May-2011 Last Update.- Vendor Notification Date. 04-Apr-2011 Product.Securimage / PHPCaptcha Platform. PHP Affected versions. 1.0.4 - 2.0.2 Severity Rating.Medium Impact. Authentication bypass Attack Vector. Remote without authentication Solution Status.Vendor workaround (remove securimage_play.php) CVE reference. Not yet assigned Details. PHPCaptcha, also known as Securimage, is a popular Open Source PHP CAPTCHA library. It is also used in popular WordPress plugins such as the 'Fast Secure Contact Form'. Insufficient distortion in the audio version of the CAPTCHA allows an attacker to quickly decode the CAPTCHA by performing basic binary analysis of the generated audio file. The issue is compounded by the fact that even if the audio feature of the CAPTCHA has been disabled, it can still be accessed by forceful browsing to the /secure_play.php URI. Proof of Concept. Proof of concept code that works against the example_form.php page and the MP3 file format provided with the standard PHPCaptcha package available from www.phpcaptcha.org is available at: http://www.senseofsecurity.com.au/advisories/SOS-11-007.zip Proof of concept code is only available for the MP3 version of the audio, however the WAV audio format is also affected by the same vulnerability. Solution. Remove the script securimage_play.php and disable the use of the Audio CAPTCHA. Discovered by. Phil Taylor from Sense of Security Labs. About us. Sense of Security is a leading provider of information security and risk management solutions. Our team has expert skills in assessment and assurance, strategy and architecture, and deployment through to ongoing management. We are Australia's premier application penetration testing firm and trusted IT security advisor to many of the country's largest organisations. Sense of Security Pty Ltd Level 8, 66 King St Sydney NSW 2000 AUSTRALIA T: +61 (0)2 9290 F: +61 (0)2 9290 4455 W: http://www.senseofsecurity.com.au E: i...@senseofsecurity.com.au Twitter: @ITsecurityAU The latest version of this advisory can be found at: http://www.senseofsecurity.com.au/advisories/SOS-11-007.pdf Other Sense of Security advisories can be found at: http://www.senseofsecurity.com.au/research/it-security-advisories.php -- 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] img src ..... problem in onclick
Hello Negin, that is completely wrong. You're mixing up two things: PHP is a server-side language, JavaScript is a client-side language. onClickis client-side, so you can't say onClick=?php something();? because onclick is performed *after* the PHP script something();?is *completely* formed and sent to the user's browser. What you can do is changing your PHP variables by using AJAX. Consider reading about jQuery in general and $.ajax in particular. -- With best regards from Ukraine, Andre Skype: Francophile My blog: http://oire.org/menelion (mostly in Russian) Twitter: http://twitter.com/m_elensule Facebook: http://facebook.com/menelion Original message From: Negin Nickparsa nickpa...@gmail.com To: php-general@lists.php.net Date created: , 4:05:34 PM Subject: [PHP] img src . problem in onclick i want to when clicking on the image then go to other page or set my $_SESSION i have this in php code: echoimg src=' ' onclick='$_SESSION['s1']=12(i mean a number)';/; how can i correct this or if it is completely wrong how 2 solve it? i tried to set header in onclick too but i think it can't do because header is function of php and i echoed the html tag -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] A Review Request
Hello tedd, Oh, I liked what you've said about a website like a house. May I translate this into Russian and quote you in my blog? I'll place the copyright :-). Actually, what I would like to learn is how to break things. No, I don't gonna be a hacker (I don't want to go to a jail!), but as a web developer, I would like to know how a really bad guy can break my sites and prevent him to do this :-). Thanks! -- With best regards from Ukraine, Andre Skype: Francophile My blog: http://oire.org/menelion (mostly in Russian) Twitter: http://twitter.com/m_elensule Facebook: http://facebook.com/menelion Original message From: tedd tedd.sperl...@gmail.com To: PHP General Date created: , 9:12:06 PM Subject: [PHP] A Review Request At 11:11 AM -0400 5/20/11, Alex Nikitin wrote: Also to tedd, i would say that you should make it a series of tutorials of how to make simple user auth progressively more and more secure, i would say that would be a good learning experience for someone. Start with your basic code, introduce new concepts that will teach novice a little bit more about how the internet works, how sessions work, how it can all be exploited conceptually, and introduce ways to fix those issues with progressively more hardened code...? I think that that would be a great way of learning for a novice, i would say maybe 3 more tutorials, each progressively more secure; suggesting next one to introduce hashing, cleaning the code, and some of the initial concepts outlined above, then a system setup for https, going over tls renegotiation, setting up rewriting rules, etc, and changing the code with securing the session code and introducing login limits, and finally perhaps how to take make all of this system a bit more web 2.0 with jquery, ajax, and perhaps use that as the introduction of the next set of tuts of how to do this same thing with a database back end with references back to this auth system? I would have certainly liked to read a tutorial like that when i was starting out... And, i'm up to help, i'm sure others as well would not mind chiming in their $.02 :) Well... that's where I intend to go, namely, start with the basics and continue with progressive disclosure. However, there is lot to address here. As I often explain to my students, a web site is like a house: 1. There's the foundation, flooring, walls, and roof, which is the structure -- that's HTML; 2. There's the outside covering (paint, bricks, siding) and the inside covering (paint, carpet, wallpaper), which makes the presentation -- that's CSS; 3. There's the inside works, such as the plumbing, furnace, air conditioning, and electrical, which provides functionality -- that's PHP; 4. And there's the light-switches that turn on/off, doors and windows that open/close, rheostats that go up/down, faucets that turn on/off, and door bells that remain silent or ring, which allows behavior -- that's JavaScript. You put all of these items together and the entire house can do more than any one of them can do by themselves, namely make a home. Additionally, how you arrange and combine these things together and have them interact with each other is a topic of study that far exceeds the knowledge of any one of them. Furthermore, if you include these things with how people react with web sites (what makes people do things) then you'll have an excellent introduction into problems in creating a good web site -- and that's my ultimate goal. However, my first step is to put various things up for peer review and listen/adapt to the feedback. That's what I'm doing. Cheers, tedd -- --- http://sperling.com/ -- 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] img src ..... problem in onclick
Hi Richard, Tedd, Hey guys, you did understand what I meant. I meant you can't just go and write a session variable by onclicking it in JavaScript. You need AJAX for that, don't you? -- With best regards from Ukraine, Andre Skype: Francophile My blog: http://oire.org/menelion (mostly in Russian) Twitter: http://twitter.com/m_elensule Facebook: http://facebook.com/menelion Original message From: ad...@buskirkgraphics.com ad...@buskirkgraphics.com To: 'tedd' Date created: , 9:19:15 PM Subject: [PHP] img src . problem in onclick I use Jquery everyday to communicate with php files. When I say every day I mean every day. If I could not communicate from Javascript to PHP, Real time data analysts would be NULL. Tedd, could not be more correct in his example. Toot's the Tedd horn!!! Richard L. Buskirk -Original Message- From: tedd [mailto:tedd.sperl...@gmail.com] Sent: Friday, May 20, 2011 2:10 PM To: php-general@lists.php.net Subject: Re: [PHP] img src . problem in onclick At 6:41 PM +0300 5/20/11, Andre Polykanine wrote: that is completely wrong. You're mixing up two things: PHP is a server-side language, JavaScript is a client-side language. While that is true, it doesn't mean that the two languages can't communicate. Here's an example: http://webbytedd.com/b/timed-php/ Cheers, tedd -- --- http://sperling.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Filtering data not with mysql...
Hi Richard, Oh my... I hate those pdf's :-(( Could someone tell me in some words what do I need to do beside mysql_real_escape_string() and Html input sanitizing? Thanks and sorry for the inconvenience) -- With best regards from Ukraine, Andre Skype: Francophile My blog: http://oire.org/menelion (mostly in Russian) Twitter: http://twitter.com/m_elensule Facebook: http://facebook.com/menelion Original message From: ad...@buskirkgraphics.com ad...@buskirkgraphics.com To: 'Jason Pruim' Date created: , 4:17:55 AM Subject: [PHP] Filtering data not with mysql... To quote Jonathan Well, mysql_real_escape_string doesn't protect against sql injections more than addslashes, but that's not the reason you use it. addslashes() was from the developers of PHP whereas mysql_real_escape_string uses the underlying MySQL C++ API (i.e. from the developers of MySQL). mysql_real_escape_string escapes EOF chars, quotes, backslashes, carriage returns, nulls, and line feeds. There is also the charset aspect. However, it is a common thought among a lot of PHP programmers (beginning and even more advanced) that SQL injections are the only thing to guard against with sanitizing user input using it in a query. That, actually, is incorrect. If you only rely on *_escape_string and addslashes because you are only thinking about injections, you leave yourself vulnerable to attacks from users. http://dev.mysql.com/tech-resources/articles/guide-to-php-security-ch3.pdf It's a nice read, especially if you like reading articles about PHP programming (*guilty*). Scroll down to page 78 where they talk about LIKE attacks. Richard L. Buskirk -Original Message- From: Jason Pruim [mailto:li...@pruimphotography.com] Sent: Wednesday, May 18, 2011 9:19 PM To: php-general@lists.php.net Subject: [PHP] Filtering data not with mysql... Hey Everyone, Probably a simple question but I wanted to make sure I was right before I got to far ahead of my self I have a form that I am working on and this form will be emailed to the recipient for processing (Not stored in a database). When I store in a database, I simply run all the data through mysql_real_escape_string() and it's all good... Without the database, is it just as easy as addslashes($var)? or is there more that needs to be done? In the end, the info will be echoed back out to the user to be viewed but not edited and emailed to someone to add the registration collect money, etc etc. Am I on the right track or do I need to rethink my whole process? :) Thanks Everyone! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] A Review Request
Hello Alex, Two (stupid?) questions: 1. Why PHP_SELF is better than SCRIPT_NAME? 2. Why strcmp() is better than just comparing? -- With best regards from Ukraine, Andre Skype: Francophile My blog: http://oire.org/menelion (mostly in Russian) Twitter: http://twitter.com/m_elensule Facebook: http://facebook.com/menelion Original message From: Alex Nikitin niks...@gmail.com To: PHP General Date created: , 9:29:35 PM Subject: [PHP] A Review Request I will try to respond to the original question. Note: this is constructive criticism, so i wont do much in terms of praising the good parts It works, its very primitive, in some ways its pretty insecure, for example it provides no session hijacking protection, it's not written with the better of standards in mind, for one if you do store your password in code, you shouldn't store your password in clear text, that way if say i was able to bypass php execution and dumped that file out, i would still not have a useable password, so use a hash. There is no timing out or attempt management, for example i can write a 5 line-long brute script that will just pound your script with user ids and passwords, you should make it at least somewhat difficult for me to do that ;) Also don't declare a bunch of needless variables for their one-time use, don't compare unsanitized strings with a binary unsafe operator, server variables contain link to current script, here are examples of what i mean: -$self = basename($_SERVER['SCRIPT_NAME']); +$self = $_SERVER['PHP_SELF']; -$submit = isset($_POST['submit']) ? $_POST['submit'] : null; -if($submit == 'Submit') +if($_POST) -$pw = 'pw'; // define your password here -$user_id = isset($_POST['user_id']) ? $_POST['user_id'] : null; -$password = isset($_POST['password']) ? $_POST['password'] : null; -if (($user_id == $id) AND ($password== $pw)) +$pw='1a91d62f7ca67399625a4368a6ab5d4a3baa6073'; //sha1 hash of the password: php -r echo sha1(\pw\); +if (@strcmp($id, $_POST['user_id']) == 0 strcmp($pw, sha1($_POST['password'])) == 0) -- Alex -- -- The trouble with programmers is that you can never tell what a programmer is doing until it’s too late. ~Seymour Cray On Wed, May 18, 2011 at 3:22 PM, tedd t...@sperling.com wrote: Hi gang: I am considering providing PHP code to the general public via my website This is my first attempt: http://sperling.com/php/authorization/ What do you people think? Cheers, tedd -- --- http://sperling.com/ -- 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] Warning: session_start()
Hello Nazish, Try to delete your HTML comments before the ?php starting tag. So remove *anything* before ?php. -- With best regards from Ukraine, Andre Skype: Francophile My blog: http://oire.org/menelion (mostly in Russian) Twitter: http://twitter.com/m_elensule Facebook: http://facebook.com/menelion Original message From: Nazish naz...@jhu.edu To: php-general@lists.php.net Date created: , 9:15:37 PM Subject: [PHP] Warning: session_start() Hi everyone, I recently uploaded my website files to a server. When I tried to log into my website, I received these error messages: *Warning*: session_start() [function.session-starthttp://www.myparcoasis.com/function.session-start]: Cannot send session cookie - headers already sent by (output started at /home2/myparcoa/public_html/index.php:10) in * /home2/myparcoa/public_html/includes/login_form.php* on line *33* *Warning*: session_start() [function.session-starthttp://www.myparcoasis.com/function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home2/myparcoa/public_html/index.php:10) in * /home2/myparcoa/public_html/includes/login_form.php* on line *33* *Warning*: Cannot modify header information - headers already sent by (output started at /home2/myparcoa/public_html/index.php:10) in* /home2/myparcoa/public_html/includes/login_form.php* on line *36* * * The website worked fine on the Apache localhost server (I could log in), so I'm not sure what's wrong with the code which is creating the error on the online server. Any ideas? I've highlighted the two error lines (31 34). I'd appreciate any insight! Thnx! !--- WHEN USER CLICKS 'ENTER' TO LOGIN ! ?php $submit = ($_POST['submit']); if ($submit) // If user clicks the 'ENTER' button to login { // Connect to server and select database include (includes/mysql_connect.inc); include (includes/connect_res_directory.php); // define login variables $login = mysql_real_escape_string($_POST['login']); $password = mysql_real_escape_string($_POST['password']); $check_login = mysql_query(SELECT * FROM unit_info WHERE login = '$login' AND password = '$password'); $data = mysql_fetch_assoc($check_login); // Are all the fields filled? if($login $password) { // If fields are entered, verify username and password in mysql database if (mysql_num_rows($check_login)) // If the login and password exists { //Login * session_start();* $_SESSION ['login'] = $data['login']; *header (Location: index_test.php); // webpage for correct login* exit; } else { // Invalid username/password echo div class='alert'The username or password you entered is incorrect./div; } } else echo div class='alert'Please enter all the fields!/div; } ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How to enable UTF-8 Subject String ? Only Body is set ok
Hello Eli, I'm using this code: private function HeaderEncode ($str) { // For the compatibility with PHP versions lower than 5.3.0 if (!function_exists ('quoted_printable_encode')) { function quoted_printable_encode ($str) { $res=str_replace (+, _, str_replace (%, =, urlencode($str))); return $res; } } $result='=?utf-8?Q?'.quoted_printable_encode($str).'?='; return $result; } If you want to send mail through an SMTP server, consider using a class written by myself :-): http://hkc.im/Y The class is documented and ships with examples. -- With best regards from Ukraine, Andre Skype: Francophile My blog: http://oire.org/menelion (mostly in Russian) Twitter: http://twitter.com/m_elensule Facebook: http://facebook.com/menelion Original message From: Eli Orr (Office) eli@logodial.com To: php-general@lists.php.net Date created: , 5:59:26 PM Subject: [PHP] How to enable UTF-8 Subject String ? Only Body is set ok Hi, I'm trying to enable a whole Email as UTF-8 - The Body is OK but the Subject remains ANSI - Please help $headers = From:$from. \r\n . Reply-To:$from . \r\n . *Content-type:text/html;charset=utf-8;*.\r\n . X-Mailer: PHP/.phpversion(); -- Best Regards, *Eli Orr* CTO Founder *LogoDial Ltd.* M:+972-54-7379604 O:+972-74-703-2034 F: +972-77-3379604 Plaut 10, Rehovot, Israel Email: _Eli.Orr@LogoDial.com_ Skype: _eliorr.com_ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Functions/methods aliases in PHp 5.2
Hi everyone, Is there any possibility to make a method or function alias in PHP? Yes, I know I can do the following: ?php function foo_bar($x) { // And so we code... return $result; } function FooBar($x) { return foo_bar($x); } But maybe there is a more elegant solution? Thanks! -- With best regards from Ukraine, Andre Skype: Francophile Twitter: http://twitter.com/m_elensule Facebook: http://facebook.com/menelion -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Functions/methods aliases in PHp 5.2
Hello Richard, I'd like to make a database wrapping class (yet another one, aha!) as flexible, as possible. So I'd like to make possible to call, for example, $db-num_rows($result) and $db-NumRows($result) And was just wondering :-). -- With best regards from Ukraine, Andre Skype: Francophile My blog: http://oire.org/menelion (mostly in Russian) Twitter: http://twitter.com/m_elensule Facebook: http://facebook.com/menelion Original message From: Richard Quadling rquadl...@gmail.com To: Andre Polykanine Date created: , 12:48:30 AM Subject: [PHP] Functions/methods aliases in PHp 5.2 On 15 May 2011 21:45, Andre Polykanine an...@oire.org wrote: Hi everyone, Is there any possibility to make a method or function alias in PHP? Yes, I know I can do the following: ?php function foo_bar($x) { // And so we code... return $result; } function FooBar($x) { return foo_bar($x) } But maybe there is a more elegant solution? Thanks! Whilst you can do class_alias() - something I use to hide the long class name for soap services - there isn't a function alias. But, if you are creating your own functions, then you could use a closure and that can be assigned to a variable ... $fn_FooBar = function() { ... }; $fn_FooBar($a, $b, $c); or someFunc($fn_FooBar) { ... } Closures are ideal for callbacks. Why do you want to alias functions? Is it to obscure the existing name? If so, take a look at using an encoder. This uses the compiled code rather than the source to run. It is faster to run as there is no compile phase and the code isn't very easy to reverse. -- Richard Quadling Twitter : EE : Zend @RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY -- 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] Short tag: why is it bad practice?
Hello, So, as I've understood, the only issue with ? // blah-blah ? is the ?xml version 1.0? thing? Thanks! -- With best regards from Ukraine, Andre Skype: Francophile My blog: http://oire.org/menelion (mostly in Russian) Twitter: http://twitter.com/m_elensule Facebook: http://facebook.com/menelion Original message From: Daevid Vincent dae...@daevid.com To: php-general@lists.php.net Date created: , 9:55:23 PM Subject: [PHP] Short tag: why is it bad practice? -Original Message- From: Joshua Kehn [mailto:josh.k...@gmail.com] Sent: Tuesday, May 10, 2011 8:19 AM To: Andre Polykanine Cc: php-general@lists.php.net Subject: Re: [PHP] Short tag: why is it bad practice? On May 10, 2011, at 11:11 AM, Andre Polykanine wrote: Hi everyone, Many times I heard that the following two peaces of code are written in a bad manner: 1. ? echo Hello, world!; ? 2. form action=script.php method=post pYour e-mail: input type=text id=uemail name=uemail value=?=$f['Email']?/p ... /form As for now, I use both quite often. Why is this considered not kosher, I mean, good coding practice? Thanks! -- With best regards from Ukraine, Andre Skype: Francophile Twitter: http://twitter.com/m_elensule Facebook: http://facebook.com/menelion Because short tags aren't always enabled and can cause things to break when deploying code to different environments. Best practice dictates that your code should be as environmentally independent as possible. It's another few characters, why neglect it? This is always a source of confusion. http://www.bin-co.com/php/articles/using_php_short_tags.php ?= $foo ? is generally NOT what the short tags controversy are about. It's the use of ? Some php here ? vs. ?php some php here ? While it is true that the 'short_open_tag' directive enables both (for some stupid reason), the issue is that it's poor form to use JUST ? And not ?php just as it's a bad idea to use % % (asp tags). Using ?= is perfectly fine and in my personal and professional opinion, preferred to the uglier ?php echo $foo; ? way This topic was very heated when the core PHP developers were going to remove the ? Form all together in future PHP 6 versions and everyone got their panties in a bunch because they assumed it meant the ?= form too (which it did not). http://php.net/manual/en/ini.core.php http://www.php.net/~derick/meeting-notes.html#remove-support-for-and-script- language-php-and-add-php-var -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Short tag: why is it bad practice?
Hi everyone, Many times I heard that the following two peaces of code are written in a bad manner: 1. ? echo Hello, world!; ? 2. form action=script.php method=post pYour e-mail: input type=text id=uemail name=uemail value=?=$f['Email']?/p ... /form As for now, I use both quite often. Why is this considered not kosher, I mean, good coding practice? Thanks! -- With best regards from Ukraine, Andre Skype: Francophile Twitter: http://twitter.com/m_elensule Facebook: http://facebook.com/menelion -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Bold links
Hello tedd, I'm standing up and applauding you. Really, I'm... quite touched. There are too few people that care about us, I mean, JAWS users. Of course, we, my wife and I, develop accessible websites ourselves but... there is lots of inaccessible stuff out there. -- With best regards from Ukraine, Andre Skype: Francophile My blog: http://oire.org/menelion (mostly in Russian) Twitter: http://twitter.com/m_elensule Facebook: http://facebook.com/menelion Original message From: tedd tedd.sperl...@gmail.com To: ad...@buskirkgraphics.com Date created: , 12:56:34 AM Subject: [PHP] Bold links At 1:39 PM -0400 5/7/11, ad...@buskirkgraphics.com wrote: ?php global $current_user; get_currentuserinfo(); echo 'Welcome nbsp;B' . $current_user-user_firstname . /B\n; echo 'B' . $current_user-user_lastname . /B\n; ? Richard L. Buskirk Really? How does the blind via readers, such as JAWS, understand what a B is? First, never use B -- or I for that matter. Second, use strong or em instead. Readers can understand and render STRONG and EMPHASIZED text, but not B and I text -- those tags mean nothing and that's the reason why they are not encouraged for use and even removed from XHTML. Third, if neither of those tags (i.e., strong or em ) work for you, they try using a class (or an id) with a css rule of: .whatever { font-weight: bold; } or #whatever { font-weight: bold; } Cheers, tedd -- --- http://sperling.com/ -- 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] mysql error
Hello Grega, What do you mean by uniqueid(idlog)? -- With best regards from Ukraine, Andre Skype: Francophile My blog: http://oire.org/menelion (mostly in Russian) Twitter: http://twitter.com/m_elensule Facebook: http://facebook.com/menelion Original message From: Grega Leskovšek legr...@gmail.com To: php-general Date created: , 5:29:44 PM Subject: [PHP] mysql error Can smbd please look at this sentence - I got an error and do not know how to fix it - I am still very unfamiliar with MYSQL: CREATE TABLE log ( idlog int auto_increment not null, imepriimek varchar(50), clock timestamp, action varchar(30), onfile varchar(100), filesize float(6,2), uniqueid(idlog) ); ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '(idlog) )' at line 1 -- When the sun rises I receive and when it sets I forgive - http://moj.skavt.net/gleskovs/ Always in Heart, Grega Leskovšek -- 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] Custom function
Hello Ashley, By the way, the non-last optional parameter can't be missed, am I right? In some languages we could write something like: function test ($a, $foo=50, $bar=true) { // ... } Then call it like this: $m=test(blah, , false); meaning $m=test(blah, 50, false); This is impossible in PHP, isn't it? Thanks! -- With best regards from Ukraine, Andre Skype: Francophile My blog: http://oire.org/menelion (mostly in Russian) Twitter: http://twitter.com/m_elensule Facebook: http://facebook.com/menelion Original message From: Ashley Sheridan a...@ashleysheridan.co.uk To: Ron Piggott Date created: , 1:37:59 AM Subject: [PHP] Custom function On Mon, 2011-05-02 at 18:28 -0400, Ron Piggott wrote: On Mon, May 2, 2011 at 3:16 PM, Ron Piggott ron.pigg...@actsministries.org wrote: Is it possible to write a function with an optional flag? What would the syntax look like? So far I have: function load_advertisement( $web_page_reference , $web_advertising_sizes_reference ) { Hi Ron: I'm not sure what you mean by optional flag? Do you mean an optional parameter? Richard Correct Richard. Ron function load_advertisement( $web_page_reference , $web_advertising_sizes_reference=default_value) This sets a default value for a parameter, which you can check for within the function itself and use it if it differs from what you set. Set it to something that it shouldn't be, like null or something. Also note that these parameters have to occur after any that don't have a default value -- Thanks, Ash http://www.ashleysheridan.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Why Constants could Not be Array?
Hello Walkinraven, I use serialize for that. define(MY_CONSTANT, serialize(array(1, 2, hello))); -- With best regards from Ukraine, Andre Skype: Francophile My blog: http://oire.org/menelion (mostly in Russian) Twitter: http://twitter.com/m_elensule Facebook: http://facebook.com/menelion Original message From: Walkinraven walkinra...@gmail.com To: php-general@lists.php.net Date created: , 12:51:15 PM Subject: [PHP] Why Constants could Not be Array? For needing a constants=array, I have to use 'public static $a = array(...)' instead. Why the language could not relax the restriction of constants? -- 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] dynamic copyright in page footer?
Hello Dave, echo pCopyright © Dave Mehler, 2011 — .date(Y)./p; -- With best regards from Ukraine, Andre Skype: Francophile My blog: http://oire.org/menelion (mostly in Russian) Twitter: http://twitter.com/m_elensule Facebook: http://facebook.com/menelion Original message From: David Mehler dave.meh...@gmail.com To: php-general Date created: , 2:06:17 PM Subject: [PHP] dynamic copyright in page footer? Hello, I am trying to use php to put a copyright notice in a page footer. I'm using the date function with the Y value for the year. Here's the code: ?php echo date ('Y'); ? This works great for a site done in 2011 but next year I'm going to want to have 2011 and 2012 in the copyright notice, adding an additional year the site's up. I'd appreciate some suggestions i'm very likely overthinking this. Thanks. Dave. -- 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] Wiki formatting class or something similar
Hello Peter, And what would you recommend as an Html sanitizing tool? -- With best regards from Ukraine, Andre Skype: Francophile My blog: http://oire.org/menelion (mostly in Russian) Twitter: http://twitter.com/m_elensule Facebook: http://facebook.com/menelion Original message From: Peter Lind peter.e.l...@gmail.com To: Stuart Dallas Date created: , 4:26:41 PM Subject: [PHP] Wiki formatting class or something similar On 30 April 2011 15:13, Stuart Dallas stu...@3ft9.com wrote: On Friday, 29 April 2011 at 22:04, Andre Polykanine wrote: Hi everyone, I allow my users to put some Html into their blogs. I filter it using a great tool called HtmLawed and written by Dr. Santosh Patnaik (if you're reading this, many thanks to you!). However, I would like to give them a possibility to mark-up their text in a more convenient way for beginners (such as Wiki or something similar). I searched through http://phpclasses.org/ but didn't find anything. Could you suggest me something? And one more question: maybe some of you already have a handy solution to process smilies? Say, a user writes :) and this is replaced by an image in my directory. Thanks in advance! Markdown is a pretty good option for a wiki: http://michelf.com/projects/php-markdown/ Textile is another option (and supports tables which markdown does not): http://textile.thresholdstate.com/ MarkItUp is a favourite plugin editor of mine - will allow you to work with a lot of different syntaxes and users don't need to know them. http://markitup.jaysalvat.com/home/ If you're considering sanitizing html instead of using a markup language to convert into html, I'd read http://blog.astrumfutura.com/2010/08/html-sanitisation-the-devils-in-the-details-and-the-vulnerabilities/ before settling on any tool to do the job. Far as I can tell, HtmLawed isn't actually capable of sanitizing properly, according to the author - unless it's since been updated to fix the problems mentioned in the blog. 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] Wiki formatting class or something similar
Hi everyone, I allow my users to put some Html into their blogs. I filter it using a great tool called HtmLawed and written by Dr. Santosh Patnaik (if you're reading this, many thanks to you!). However, I would like to give them a possibility to mark-up their text in a more convenient way for beginners (such as Wiki or something similar). I searched through http://phpclasses.org/ but didn't find anything. Could you suggest me something? And one more question: maybe some of you already have a handy solution to process smilies? Say, a user writes :) and this is replaced by an image in my directory. Thanks in advance! -- With best regards from Ukraine, Andre Skype: Francophile Twitter: http://twitter.com/m_elensule Facebook: http://facebook.com/menelion -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] What's faster using if else or arrays?
Hello Dholmes1031, I would write it like this: switch($foo) { case 5: $dothis; break; case 3: $dothat; break; default: $donothing; break; } -- With best regards from Ukraine, Andre Skype: Francophile My blog: http://oire.org/menelion (mostly in Russian) Twitter: http://twitter.com/m_elensule Facebook: http://facebook.com/menelion Original message From: dholmes1...@gmail.com dholmes1...@gmail.com To: php-general@lists.php.net Date created: , 12:30:31 AM Subject: [PHP] What's faster using if else or arrays? I'm working on a project and I was wondering if I should use if else's or arrays ?? Example If($foo= 5) { $dothis } ElseIf($foo= 3) { $dothis } Else{ $donothing } Or put it in some short of arrays and pregmatch what would be the best to use and easiest to read Sent via BlackBerry from T-Mobile -- 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] Re: What's faster using if else or arrays?
Hello Jim, I heard of arrays in the following context: if (($foo==5) || ($foo==orange) || ($foo==88) .. So *that* would be done much better and cleaner with arrays. $FoosArray=array(5, orange, 88); if (in_array($foo, $FoosArray)) { ... } -- With best regards from Ukraine, Andre Skype: Francophile My blog: http://oire.org/menelion (mostly in Russian) Twitter: http://twitter.com/m_elensule Facebook: http://facebook.com/menelion Original message From: Jim Giner jim.gi...@albanyhandball.com To: php-general@lists.php.net Date created: , 12:36:26 AM Subject: [PHP] Re: What's faster using if else or arrays? how many entries are you talking about, ie., how many conditions? Obviously if you have more than 4-5 it's going to be easier to code up as a case statement (?) rather than an if/else. Never in all my days have I ever heard of using an array for such a determination though. (remainder deleted for all reader's sakes :) ) -- 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] Destroying cookies... not working
Hello Rick, Pay attention how you did set the cookie. When I tried to unset the cookie using only three parameters, I got no luck because I had set it using five: setCookie (mycookie, , time()-32557600, '/', '.oire.org'); -- With best regards from Ukraine, Andre Skype: Francophile My blog: http://oire.org/menelion (mostly in Russian) Twitter: http://twitter.com/m_elensule Facebook: http://facebook.com/menelion Original message From: Rick Dwyer rpdw...@earthlink.net To: php-general@lists.php.net Date created: , 2:16:43 AM Subject: [PHP] Destroying cookies... not working Hello all. I have a logout page that should be destroying cookies when loaded... but it is not. setcookie(mycookie, False, time() - 3600, /); However, I can still pull values stored in the cookie and I can still see the cookie in my browser's Show Cookies window. So I tried the following: setcookie('mycookie','',time()-3600); unset($_COOKIE['mycookie']); Still no luck. Any help with this is appreciated. --Rick -- 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] the best 1 book for php
Hello Kirk, Php manual from php.net :-). -- With best regards from Ukraine, Andre Skype: Francophile My blog: http://oire.org/menelion (mostly in Russian) Twitter: http://twitter.com/m_elensule Facebook: http://facebook.com/menelion Original message From: Kirk Bailey kbai...@howlermonkey.net To: PHP General Date created: , 7:15:40 AM Subject: [PHP] the best 1 book for php If I only had 1 book on php, what would it be? -- end Very Truly yours, - Kirk Bailey, Largo Florida kniht +-+ | BOX | +-+ think -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Config files: what is best? (was: Re: [PHP] XML... Useful or another layer of complexity?)
Hello Peter, Just because you mentioned config files. What would you suggest me as better format for them? Database is not available yet since I need to make a config file before creating a database. -- With best regards from Ukraine, Andre Skype: Francophile My blog: http://oire.org/menelion (mostly in Russian) Twitter: http://twitter.com/m_elensule Facebook: http://facebook.com/menelion Original message From: Peter Lind peter.e.l...@gmail.com To: Per Jessen Date created: , 10:27:09 PM Subject: [PHP] XML... Useful or another layer of complexity? Like every other technology, XML needs to have a use before it becomes a useful tool. Just using XML because it's available quickly leads to headaches, as it isn't the best tool for all scenarios (config files written in XML for instance). That said, XML is awesome for a lot of things ... however, without having a better grasp of XML you're unlikely to know whether it'll fit your needs. If for no other reason, learning XML and related technologies is worth it simply because the rest of the world uses it. So get to know it, then you'll be able to actually judge if your project can benefit from it. 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 General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Resizing an image
Hi everyone, Image processing is a part of Php language completely unknown to me :-(. So there is my task: I need to process an uploaded image. We allow uploading of gif, jpeg, and png images. If an image is wider than 600px, it should be proportionally resized to the width of 600px. Yes, I've just read about ImageCopyResampled(). My questions are: 1. what are the restrictions of ImageCopyResampled()? Can I make a jpg image from a jpg one, and a png image from a png one? And what about gif's? 2. I don't need to output the image as the script output, I need to upload it as a file (replacing the uploaded larger file). Could I make it with fwrite and then copy it to the server? All of the examples give header(image/jpeg)... Thanks! -- With best regards from Ukraine, Andre Skype: Francophile Twitter: http://twitter.com/m_elensule Facebook: http://facebook.com/menelion -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] mysql_num_rows()
Hello Gary, Please wrap $i in braces in your variable variable: if ( isset($_POST[county{$i}] ) ) { echo You have chosen . $_POST[county{$i}]. br/; -- With best regards from Ukraine, Andre Skype: Francophile My blog: http://oire.org/menelion (mostly in Russian) Twitter: http://twitter.com/m_elensule Facebook: http://facebook.com/menelion Original message From: Gary gp...@paulgdesigns.com To: php-general@lists.php.net Date created: , 7:40:48 AM Subject: [PHP] mysql_num_rows() Can someone tell me why this is not working? I do not get an error message, the results are called and echo'd to screen, the count does not work, I get a 0 for a result... $result = mysql_query(SELECT * FROM `counties` WHERE name = 'checked') or die(mysql_error()); if ( isset($_POST['submit']) ) { for($i=1; $i=$_POST['counties']; $i++) { if ( isset($_POST[county$i] ) ) { echo You have chosen . $_POST[county$i]. br/; } } } $county_total=mysql_num_rows($result); while($row = mysql_fetch_array($result)) {$i++; echo $row['name']; } $county_total=mysql_num_rows($result); echo $county_total; echo 'You Have ' . $county_total . ' Counties '; ? -- Gary __ Information from ESET Smart Security, version of virus signature database 5894 (20110221) __ The message was checked by ESET Smart Security. http://www.eset.com -- 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] Submitting data to MySQL database using HTML/PHP form
Hello Nazish, Try to do the following in your login.php: ?php print_r($_POST); // assign your variables echo br$loginbr$passwordbr$insertbr; So we'll see the result. -- With best regards from Ukraine, Andre Skype: Francophile My blog: http://oire.org/menelion (mostly in Russian) Twitter: http://twitter.com/m_elensule Facebook: http://facebook.com/menelion Original message From: Nazish naz...@gmail.com To: php-general@lists.php.net Date created: , 10:04:07 PM Subject: [PHP] Submitting data to MySQL database using HTML/PHP form Thanks everyone! However, when I click the submit button, the url simply moves to http://localhost/login.php (from home.php) and it is a blank page (apart from asking whether it should remember the password for future use). The values still do not move to the database. I included most of your suggestions a) added mysql _error() b) different names for the variables c) removed double quotes d) changed ? (silly error!) e) modified the $insert query The code now looks like this: ?php // Connect to server and select database. $host = localhost; $user = root; $mysql_pass = abc; $db = directory; mysql_connect($host, $user, $mysql_pass) or die(mysql_error()); mysql_select_db($db) or die(mysql_error()); // username and password sent to mysql database $login = $_POST['login']; $password = $_POST['password']; $insert = INSERT INTO user_info (login, password) VALUES ('.mysql_real_escape_string($login).','.mysql_real_escape_string($password).'); mysql_query($insert) or die (Unable to add user to the database:.mysql_error()); ? I could insert the values using the command line, and it was updated in MySQL, but it doesn't work through the form... it just goes to a blank page on login.php. I'd appreciate any insights on why that's happening. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Submitting data to MySQL database using HTML/PHP form
Hello Nazish, Echo the $insert variable. -- With best regards from Ukraine, Andre Skype: Francophile My blog: http://oire.org/menelion (mostly in Russian) Twitter: http://twitter.com/m_elensule Facebook: http://facebook.com/menelion Original message From: Nazish naz...@gmail.com To: php-general@lists.php.net Date created: , 10:53:35 PM Subject: [PHP] Submitting data to MySQL database using HTML/PHP form Update: I added echo statements after mysql_connect and mysql_select_db to check where the code was broken. These statements show up on the login.php page after submitting the form, which means the MySQL connection works. So, the problem seems to lie with the *$insert *query... ideas? On Sun, Feb 20, 2011 at 3:04 PM, Nazish naz...@gmail.com wrote: Thanks everyone! However, when I click the submit button, the url simply moves to http://localhost/login.php (from home.php) and it is a blank page (apart from asking whether it should remember the password for future use). The values still do not move to the database. I included most of your suggestions a) added mysql _error() b) different names for the variables c) removed double quotes d) changed ? (silly error!) e) modified the $insert query The code now looks like this: ?php // Connect to server and select database. $host = localhost; $user = root; $mysql_pass = abc; $db = directory; mysql_connect($host, $user, $mysql_pass) or die(mysql_error()); mysql_select_db($db) or die(mysql_error()); // username and password sent to mysql database $login = $_POST['login']; $password = $_POST['password']; $insert = INSERT INTO user_info (login, password) VALUES ('.mysql_real_escape_string($login).','.mysql_real_escape_string($password).'); mysql_query($insert) or die (Unable to add user to the database:.mysql_error()); ? I could insert the values using the command line, and it was updated in MySQL, but it doesn't work through the form... it just goes to a blank page on login.php. I'd appreciate any insights on why that's happening. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Submitting data to MySQL database using HTML/PHP form
Hello Tamara, :-)) I assume that was a testcase... -- With best regards from Ukraine, Andre Skype: Francophile My blog: http://oire.org/menelion (mostly in Russian) Twitter: http://twitter.com/m_elensule Facebook: http://facebook.com/menelion Original message From: Tamara Temple tamouse.li...@gmail.com To: PHP General Date created: , 12:27:46 AM Subject: [PHP] Submitting data to MySQL database using HTML/PHP form I'm wondering if anyone is going to comment on the transmittal and storage of plain text passwords -- 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] Howdy (new in here)
Hello Micky, And I prefer this: if ($foo==$baz) :-). I don't know if it's kosher not to put spaces around the == but still... -- With best regards from Ukraine, Andre Skype: Francophile My blog: http://oire.org/menelion (mostly in Russian) Twitter: http://twitter.com/m_elensule Facebook: http://facebook.com/menelion Original message From: Micky Hulse rgmi...@gmail.com To: php-general@lists.php.net Date created: , 3:43:57 AM Subject: [PHP] Howdy (new in here) On Tue, Feb 15, 2011 at 2:00 PM, David Harkness davi...@highgearmedia.com wrote: I use KR. I started with it just as shown but as monitors increased in size I stopped cuddling the else so it's now on its own line, aligning the if, elseif, and else nicely. One of the developers at my company uses the truly abominable Horstmann style which makes moving code around a serious KR here, unless existing guidelines are in place... CodeIgniter framework and ExpressionEngine wants folks to use Allman. I use a programming lang called Objectscript at work, and it will give an error if there is not space between the if and the first (... For example: if(...) -- errors out. I have had to learn to put a space in there: if (...) So I don't forget, I do this for everything now... I actually kinda like the breathing room now. Speaking of spaces, I am not a fan of putting spaces around the argument: if ( foo == baz ) { I definitely prefer this: if (foo == baz) { More on spaces: I am so glad that most PHP folks I know use tabs for indentation and not spaces! Oops, did I just go there? Oh no I didn't! Good thread! Thanks for that link Tedd! Cheers, Micky -- 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] errors after upgrade vom 5.2.10 to 5.3.0 howto solve or hide?
Hello Fotoo, ? error_reporting(0); -- With best regards from Ukraine, Andre Skype: Francophile My blog: http://oire.org/menelion (mostly in Russian) Twitter: http://twitter.com/m_elensule Facebook: http://facebook.com/menelion Original message From: fo...@gmx.de fo...@gmx.de To: php-general@lists.php.net Date created: , 11:12:13 AM Subject: [PHP] errors after upgrade vom 5.2.10 to 5.3.0 howto solve or hide? Hi everyone! after upgrading vomn php 5.2.10 to 5.3.0 I get a lot of errors. I changed already in some files ereg_replace() to preg_replace(), but it generates more errors as you can see. The typo3 installation ins still working. So - how can I prevent php from printing out this errors on the beginning at the website? display_errors = Off in php.ini Any Ideas? Greetz. Warning: preg_replace() [function.preg-replace]: Delimiter must not be alphanumeric or backslash in /typo3_src-3.8.1/t3lib/class.t3lib_page.php on line 436 Warning: preg_replace() [function.preg-replace]: Delimiter must not be alphanumeric or backslash in /typo3_src-3.8.1/t3lib/class.t3lib_page.php on line 438 Warning: preg_replace() [function.preg-replace]: Delimiter must not be alphanumeric or backslash in /typo3_src-3.8.1/t3lib/class.t3lib_page.php on line 441 Deprecated: Function ereg_replace() is deprecated in /typo3_src-3.8.1/t3lib/class.t3lib_matchcondition.php on line 527 Deprecated: Function ereg_replace() is deprecated in /typo3_src-3.8.1/t3lib/class.t3lib_matchcondition.php on line 527 Deprecated: Function ereg() is deprecated in /typo3_src-3.8.1/t3lib/class.t3lib_div.php on line 801 Deprecated: Function ereg() is deprecated in /typo3_src-3.8.1/t3lib/class.t3lib_div.php on line 809 Deprecated: Function ereg() is deprecated in /typo3_src-3.8.1/t3lib/class.t3lib_div.php on line 801 Deprecated: Function ereg() is deprecated in /typo3_src-3.8.1/t3lib/class.t3lib_div.php on line 809 Deprecated: Function ereg() is deprecated in /typo3_src-3.8.1/t3lib/class.t3lib_div.php on line 801 Deprecated: Function ereg() is deprecated in /typo3_src-3.8.1/t3lib/class.t3lib_div.php on line 809 Deprecated: Function ereg() is deprecated in /typo3_src-3.8.1/typo3/sysext/cms/tslib/class.tslib_content.php on line 2748 Deprecated: Function ereg() is deprecated in /typo3_src-3.8.1/typo3/sysext/cms/tslib/class.tslib_content.php on line 2752 Deprecated: Function ereg() is deprecated in /typo3_src-3.8.1/t3lib/class.t3lib_div.php on line 801 Deprecated: Function ereg() is deprecated in /typo3_src-3.8.1/t3lib/class.t3lib_div.php on line 809 Deprecated: Function ereg() is deprecated in /typo3_src-3.8.1/t3lib/class.t3lib_stdgraphic.php on line 2097 Deprecated: Function ereg() is deprecated in /typo3_src-3.8.1/t3lib/class.t3lib_stdgraphic.php on line 2164 Deprecated: Function ereg() is deprecated in /typo3_src-3.8.1/t3lib/class.t3lib_div.php on line 801 Deprecated: Function ereg() is deprecated in /typo3_src-3.8.1/t3lib/class.t3lib_div.php on line 809 Deprecated: Function ereg() is deprecated in /typo3_src-3.8.1/t3lib/class.t3lib_stdgraphic.php on line 2097 Deprecated: Function ereg() is deprecated in /typo3_src-3.8.1/t3lib/class.t3lib_stdgraphic.php on line 2164 Deprecated: Function spliti() is deprecated in /typo3_src-3.8.1/t3lib/class.t3lib_parsehtml.php on line 227 Deprecated: Function eregi_replace() is deprecated in /typo3_src-3.8.1/t3lib/class.t3lib_div.php on line 1583 Deprecated: Function eregi_replace() is deprecated in /typo3_src-3.8.1/t3lib/class.t3lib_div.php on line 1585 Deprecated: Function split() is deprecated in /typo3_src-3.8.1/t3lib/class.t3lib_div.php on line 1598 Deprecated: Function ereg_replace() is deprecated in /typo3_src-3.8.1/t3lib/class.t3lib_div.php on line 1558 Deprecated: Function eregi_replace() is deprecated in /typo3_src-3.8.1/t3lib/class.t3lib_div.php on line 1583 Deprecated: Function eregi_replace() is deprecated in /typo3_src-3.8.1/t3lib/class.t3lib_div.php on line 1585 Deprecated: Function split() is deprecated in /typo3_src-3.8.1/t3lib/class.t3lib_div.php on line 1598 Deprecated: Function ereg_replace() is deprecated in /typo3_src-3.8.1/t3lib/class.t3lib_div.php on line 1558 Deprecated: Function eregi_replace() is deprecated in /typo3_src-3.8.1/t3lib/class.t3lib_div.php on line 1583 Deprecated: Function eregi_replace() is deprecated in /typo3_src-3.8.1/t3lib/class.t3lib_div.php on line 1585 Deprecated: Function split() is deprecated in /typo3_src-3.8.1/t3lib/class.t3lib_div.php on line 1598 Deprecated: Function split() is deprecated in /typo3_src-3.8.1/t3lib/class.t3lib_div.php on line 1598 Deprecated: Function ereg_replace() is deprecated in /typo3_src-3.8.1/t3lib/class.t3lib_div.php on line 1558 Deprecated: Function ereg_replace() is deprecated in /typo3_src-3.8.1/t3lib/class.t3lib_div.php on line 1558 Deprecated: Function eregi_replace() is deprecated in
Re: [PHP] Custom function
Hello Peter, So is func_get_args() the unique way? -- With best regards from Ukraine, Andre Skype: Francophile My blog: http://oire.org/menelion (mostly in Russian) Twitter: http://twitter.com/m_elensule Facebook: http://facebook.com/menelion Original message From: Peter Lind peter.e.l...@gmail.com To: Dan Schaefer Date created: , 10:21:20 PM Subject: [PHP] Custom function On 16 February 2011 21:00, Dan Schaefer d...@performanceadmin.com wrote: In my code, I set the optional parameter to NULL and check for triple equals === or !== to see if the variable has been passed with a value. IMO, this is the safest way. function MyFunction($x, $y, $z=NULL) { if ($z !== NULL) { // Do Something } } In case you're actually trying to test if a variable was passed or not that doesn't work (as it doesn't detect NULL passed in). Use func_get_args() as that gives you any and all arguments passed to the function, excluding defaults. That said, if you're making use of optional parameters and need to check if anything was passed in, you're almost certainly doing things wrong. 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 General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Howdy (new in here)
Hello David, As for me, I use KR style, also. I find it the most readable, accessible and maintainable. -- With best regards from Ukraine, Andre Skype: Francophile My blog: http://oire.org/menelion (mostly in Russian) Twitter: http://twitter.com/m_elensule Facebook: http://facebook.com/menelion Original message From: David Harkness davi...@highgearmedia.com To: sstap...@mnsi.net Date created: , 12:00:52 AM Subject: [PHP] Howdy (new in here) On Tue, Feb 15, 2011 at 1:08 PM, Steve Staples sstap...@mnsi.net wrote: My personal bracing style is the Allman Style. I use KR. I started with it just as shown but as monitors increased in size I stopped cuddling the else so it's now on its own line, aligning the if, elseif, and else nicely. One of the developers at my company uses the truly abominable Horstmann style which makes moving code around a serious PITA. :( David -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Custom function
Hello Ron, Give it a default (possible empty) value: function MyFunction($x, $y, $z=) { // function goes here if (!empty($z)) { // The optional parameter is given } } -- With best regards from Ukraine, Andre Skype: Francophile My blog: http://oire.org/menelion (mostly in Russian) Twitter: http://twitter.com/m_elensule Facebook: http://facebook.com/menelion Original message From: Ron Piggott ron.pigg...@actsministries.org To: php-general@lists.php.net Date created: , 1:32:16 AM Subject: [PHP] Custom function Is there a way to make an optional flag in a custom function --- 2 parameters required, 1 optional? Ron The Verse of the Day “Encouragement from God’s Word” http://www.TheVerseOfTheDay.info -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Custom function
Hello Mark, Hm... will if ($z) evaluate to true if $z==0? I thought no... Actually, we can use if (isset($z)) -- With best regards from Ukraine, Andre Skype: Francophile My blog: http://oire.org/menelion (mostly in Russian) Twitter: http://twitter.com/m_elensule Facebook: http://facebook.com/menelion Original message From: Mark Kelly p...@wastedtimes.net To: php-general@lists.php.net Date created: , 2:21:36 AM Subject: [PHP] Custom function Hi. On Tuesday 15 Feb 2011 at 23:41 Andre Polykanine wrote: Give it a default (possible empty) value: function MyFunction($x, $y, $z=) { // function goes here if (!empty($z)) { // The optional parameter is given } } Using an empty string and the empty() function in this way can lead to subtle and hard to find bugs - for example if $z = 0, the code will not be executed. Note the list of things that are considered empty: http://uk.php.net/manual/en/function.empty.php Instead, consider setting the default value for $z to boolean false: function MyFunction ($x, $y, $z = FALSE) { if ($z) { // do stuff with $z } } In this way almost any value in $z will trigger the conditional code, including 0 or an empty string. The exceptions are FALSE and NULL. If you explicitly need to react to a NULL value, use is_null() to detect it. Cheers, Mark -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Simplifying MySql queries
Hi all, I'm using in my PHP script the following four MySql queries: $q1=mysql_query(SELECT *FROM`CandidateQuestions`WHERE `Category`='1' ORDER BY RAND() LIMIT 1); $q2=mysql_query(SELECT *FROM`CandidateQuestions`WHERE `Category`='2' ORDER BY RAND() LIMIT 1); $q3=mysql_query(SELECT *FROM`CandidateQuestions`WHERE `Category`='3' ORDER BY RAND() LIMIT 1); $q4=mysql_query(SELECT *FROM`CandidateQuestions`WHERE `Category`='4' ORDER BY RAND() LIMIT 1); and here goes the question: is there a way to make these four in one so strictly one random question is selected from all of the four categories? Thanks! -- With best regards from Ukraine, Andre Skype: Francophile Twitter: http://twitter.com/m_elensule Facebook: http://facebook.com/menelion -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] email address syntax checker
Hej Nisse, Me thinks it isn't a valid address :-). -- With best regards from Ukraine, Andre Skype: Francophile My blog: http://oire.org/menelion (mostly in Russian) Twitter: http://twitter.com/m_elensule Facebook: http://facebook.com/menelion Original message From: Nisse Engström news.nospam.0ixbt...@luden.se To: php-general@lists.php.net Date created: , 2:25:01 AM Subject: [PHP] email address syntax checker On Thu, 20 Jan 2011 19:03:22 +0530, Nilesh Govindarajan wrote: Well, I had created an email validator long ago, after a neat research on Google, reading RFCs, etc. I don't guarantee that it's without bugs, but it has been correct for me in all valid invalid email addresses I used for test. Code: ?php function checkMail($mail) { if(strlen($mail) = 0) { return false; } $split = explode('@', $mail); if(count($split) 2) { return false; } @@example.com is not a valid address? /Nisse -- 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] empty() in email message
Hello Gary, Try using this: if (!empty($beefolives)) $msg.=Order: beef olives; or: $msg.=empty($beefolives)? : Order: beef olives; -- With best regards from Ukraine, Andre Skype: Francophile Twitter: http://twitter.com/m_elensule Facebook: http://facebook.com/menelion - Original message - From: Gary gp...@paulgdesigns.com To: php-general@lists.php.net php-general@lists.php.net Date: Monday, December 13, 2010, 7:47:49 PM Subject: [PHP] empty() in email message I have an email message $msg = 'Name: $fname ' . ' $lname\n' . Phone: $phone\n . Email: $email\n and it works fine, however in this message there are about 30 variables that are being called...as such . Order: beefschnitzel $beefschnitzel\n . Order: beefstrips $beefstrips\n . Order: cheesesausage $cheesesausage\n . Order: crumbedsausage $crumbedsausage\n . Order: chucksteak $chucksteak\n . Order: cornedbeef $cornedbeef\n . Order: dicedsteak $dicedsteak\n . Order: filletmignon $filletmignon\n I want to only send the message if the submitter enters an amount in the form for the corresponding variable, instead of having a bunch of empty messages. So I have been trying to use the empty() function as such: . if empty($beefolives){''} elseif (isset($beefolives)) { 'Order: beefolives $beefolives\n'} But I am getting the error Parse error: syntax error, unexpected T_IF Can someone point me in the right direction? Thank you -- Gary __ Information from ESET Smart Security, version of virus signature database 5699 (20101213) __ The message was checked by ESET Smart Security. http://www.eset.com -- 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[2]: [PHP] Redirect output to a file on the web server
Hello Steve, Btw, the built-in mail() function is to slow to send such amount of mail. Consider using SMTP (if you don't). -- With best regards from Ukraine, Andre Skype: Francophile Twitter: http://twitter.com/m_elensule Facebook: http://facebook.com/menelion - Original message - From: Steve Staples sstap...@mnsi.net To: php-general@lists.php.net php-general@lists.php.net Date: Monday, December 6, 2010, 6:41:34 PM Subject: [PHP] Redirect output to a file on the web server On Mon, 2010-12-06 at 16:19 +, Richard Quadling wrote: On 6 December 2010 15:46, Ferdi ferdinan...@printo.in wrote: On 6 December 2010 20:47, Steve Staples sstap...@mnsi.net wrote: On Mon, 2010-12-06 at 20:29 +0530, Ferdi wrote: Greetings List members, I have a script that takes quite a while to run, one or two hours, I wish to redirect the normal php output to a file on the webserver itself. I don't mind if in the process, the browser displays a blank page. The reason I want to do this is that if the script crashes or the browser Is closed by mistake, I have absolutely no record of where the script stopped running. I could use code like below At the beginning of the script: ob_start(); At the end of the script: $page = ob_get_contents(); ob_end_flush(); $fp = fopen(output.html,w); fwrite($fp,$page); fclose($fp); However, I see some problems with this: I'm not too sure of the size of the output. It may balloon to over the buffering limit (in PHP? Apache?) and then what happens? Secondly, if the script crashes before the end, I won't get any output. Finally, I am using a library in the script that outputs status and error messages of its own. So, if I manually opened a file and used fwrite() alongside echo for my messages, I would lose out on those messages. Anybody has any pointers on how you could send the output not only to a browser, but also to a file on the webserver? If not, at least to a file? Thanks and regards, Ferdi Just curious, but if it takes that long to run, why are you running it from a browser? why not run it from the commandline, that way you dont have to change your php.ini for the webserver (increasing the timeout, memory limits, etc etc... you can change those for the CLI only? 2 hours is a long time to hope that the browser doesn't close, or connectivity doesn't get interupted for even 1 microsecond... if the script has breaks in it, where it starts to do something else, you can put in an email to yourself, to say hey, we're HERE now but i would look into running it from the CLI over the webserver, you would be less likely to run into issues on something that takes that amount of time to run. If you needed the output to be displayed on a webpage, you can write the progress to a file, and then have a php webpage that reads the file, and using ajax or whatever, refresh the content. good luck in your script, and if you still run it from the browser, and need to output to a file, then i would continually be writing content to that file, every time you do soemthing, or start another part of the script so you know EXACTLY where you are, at all times... Steve Hi Steve, Thanks for the tips. To answer your queries, I don't mind using CLI. How do I then ensure the messages, error or otherwise, output by the library I use, show up in the file I'm outputting to? Please note that I only make calls to the functions and object methods from this library and error or success messages are probably echo'd by the code from the library. I believe some context is in order. I am actually sending an email to a large number of our customers (around 10,000), each with the customer's name. My script does output a simple success or failure message. The library outputs more technical info. All I would like to know is which email got sent and which one failed. As you point out, I could write the success / failure messages to a file, but, I would also like to capture the messages output by the library. Thanks and regards, Ferdi I would log the success/failure with the data (assuming it is coming from a DB). If not, you could use a simple file_put_contents($filename, date('r') . $text . PHP_EOL, FILE_APPEND); That would append 1 line of text at a time to the file. Using tail on that file would show you the last work done (and when it was done). -- Richard Quadling Twitter : EE : Zend @RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY if you're using a linux based server, you could log (like Richard said) each success / failure to the file, or each to its own success / failure file, and then if you want to watch the, you could just do a tail -f of the file, to see what is it doing (sometimes having it scroll is pretty handy i find)... it wouldn't be hard to write a web-based 'tail -f' page, so you
Re: [PHP] rewriteTextLinks.php - make URLs in plain text clickable
Hello Yermo, thanks a lot! I will try this on my project (http://oire.org/) and I'll inform you if I modify it somehow. -- With best regards from Ukraine, Andre Skype: Francophile Twitter: http://twitter.com/m_elensule Facebook: http://facebook.com/menelion - Original message - From: Yermo y...@dtlink.com To: php-general@lists.php.net php-general@lists.php.net Date: Tuesday, November 23, 2010, 1:04:19 AM Subject: [PHP] rewriteTextLinks.php - make URLs in plain text clickable I'm posting this in the hopes that it will be of some use to someone. I've put together a little regex function for finding and transforming links in blocks of plain text into clickable links while applying some heuristics to handle the more common edge cases. Unlike so many solutions I've found online this one handles more edge cases including periods and commas at the end, surrounding parentheses, trailing periods on only the domain part, etc. etc. http://formvista.com/fv-b-12-170/rewriteTextLinks-a-function-to-make-links-in-blocks-of-text--quot-clickable-quot-.html --- Yermo LamersDTLink, LLC Software Developerhttp://www.dtlink.com http://miles-by-motorcycle.comFor Motorcycle Travellers http://formvista.comEntrepreneurs CMS and Business Platform --- -- 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] mysql help (sorry, a bit OT)
Hello Gary, Actually, what I do here is the following: I create a subdomain called beta.mysite.com (for me it's http://beta.oire.org/ and http://beta.gviragon.org/ :-)). There I have a copy of my database and all of my files. The only difference is the mysql_select_db in the connect.php file. There I can easily test everything I need (including PHP files and MySql queries) without any danger to crash the main release). -- With best regards from Ukraine, Andre Skype: Francophile Twitter: http://twitter.com/m_elensule Facebook: http://facebook.com/menelion - Original message - From: Gary php-gene...@garydjones.name To: php-general@lists.php.net php-general@lists.php.net Date: Tuesday, November 16, 2010, 3:35:12 PM Subject: [PHP] mysql help (sorry, a bit OT) Is there a way to check the syntax of a query, short of running it? I've got an insert to do (but of course it's a valid question for any query that changes the db contents) and would like to know that the sql I am generating (in php - see! not so off-topic!) is correct. What I don't want to do is run it for testing (live system *sigh*) and find out it is correct (it will change the db), but... I have to test it to check that the syntax (at least) *is* correct. -- 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] question about preventing polling for more than once
Hello ??, Try to clean up your cookies. Maybe they set a cookie on your computer. -- With best regards from Ukraine, Andre Skype: Francophile Twitter: http://twitter.com/m_elensule Facebook: http://facebook.com/menelion - Original message - From: ?? xiaohan2...@gmail.com To: php-general@lists.php.net php-general@lists.php.net Date: Friday, November 12, 2010, 5:14:49 PM Subject: [PHP] question about preventing polling for more than once I noticed that some websites such as polldaddyhttp://polldaddy.com/account/home.php has fascinating poll service. And I am just curious about how it prevents user from polling the same poll for more than once. Or more accurately, I am a dynamic IP user. And I found that if I have polled once for a certain poll and after some time, I changed my IP when I got connected to the Internet again, I cannot poll the previous one for the second time. So I am confused how polldaddy http://polldaddy.com/account/home.php can figure out that I have polled even if I had changed my IP. Is there any way to achieve that? Thanks in advance. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Open Source PHP/ mySQL Project Management
Hello Don, I would suggest Trac. It is written in Python, however I haven't seen anything better for a while. -- With best regards from Ukraine, Andre Skype: Francophile Twitter: http://twitter.com/m_elensule Facebook: http://facebook.com/menelion - Original message - From: Don Wieland d...@dwdataconcepts.com To: php-general@lists.php.net php-general@lists.php.net Date: Friday, November 12, 2010, 12:23:11 AM Subject: [PHP] Open Source PHP/ mySQL Project Management Hi gang, I am looking into Project Management apps for my projects. Any suggestions: I am interested in tracking Projects, Milestones, Tickets, Files, Discussions, Documents, Time Tracking, etc... Also, would like to have the system have robust email integration Reminders, Email Ticket echos (where a user can reply it will post back into the PM system and echo back email to assigned users - with file attachments) Suggestions? Thanks! Don -- 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[2]: [PHP] Open Source PHP/ mySQL Project Management
Hello Jonathan, I tried to use Mantis, however it didn't send e-mails properly so I gave up. -- With best regards from Ukraine, Andre Skype: Francophile Twitter: http://twitter.com/m_elensule Facebook: http://facebook.com/menelion - Original message - From: Jonathan Tapicer tapi...@gmail.com To: Don Wieland d...@dwdataconcepts.com Date: Friday, November 12, 2010, 3:00:32 AM Subject: [PHP] Open Source PHP/ mySQL Project Management Hi, I don't know if it meets all of the features you enumerated but Mantis (http://www.mantisbt.org/) is very good, and it is PHP+MySQL (or Postgres, or MSSQL). Jonathan On Thu, Nov 11, 2010 at 7:23 PM, Don Wieland d...@dwdataconcepts.com wrote: Hi gang, I am looking into Project Management apps for my projects. Any suggestions: I am interested in tracking Projects, Milestones, Tickets, Files, Discussions, Documents, Time Tracking, etc... Also, would like to have the system have robust email integration Reminders, Email Ticket echos (where a user can reply it will post back into the PM system and echo back email to assigned users - with file attachments) Suggestions? Thanks! Don -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] questions about if statements regarding a checkbox
Hello Ben, You should use isset: if (isset($_POST['check'])) { // The checkbox is checked } else { // It's unchecked } -- With best regards from Ukraine, Andre Skype: Francophile Twitter: http://twitter.com/m_elensule Facebook: http://facebook.com/menelion - Original message - From: Ben Brentlinger b...@benbrent.com To: php-general@lists.php.net php-general@lists.php.net Date: Sunday, October 31, 2010, 4:05:06 AM Subject: [PHP] questions about if statements regarding a checkbox hello, I'd like to know the proper code to use in a php script that processes a form with a checkbox in order to send one email if the checkbox has been checked and another email if the checkbox hasn't. I tried if($check == true) and I tried putting the word true in double quotes, and both of them caused the unexpected variable syntax error. The only problem is, all I could think to use was that line of code I just used, I'm not sure what the proper syntax is for checkbox when using the if statement to send one email when the checkbox is checked and a different email when it's not checked. I'm wanting to send an email to the site admin with the information given by the person who filled out the form that contains the checkbox. Thanks, Ben -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] RegExp question: how to add a number?
Hi everyone, I hope you're doing well (haven't written here for a long time :-)). The question is as follows: I have a regexp that would do the following. If the string begins with Re:, it will change the beginning to Re[2]:; if it doesn't, then it would add Re: at the beginning. But (attention, here it is!) if the string starts with something like Re[4]:, it should replace it by Re[5]:. Here's the code: $start=mb_strtolower(mb_substr($f['Subject'], 0, 3)); if ($start==re:) { $subject=preg_replace(/^re:(.+?)$/usi, re[2]:$1, $f['Subject']); } elseif ($start==re[) { // Here $1+1 doesn't work, it returns Re[4+1]:! $subject=preg_replace(/^re\[(\d+)\]:(.+?)$/usi, re[$1+1]:$2, $f['Subject']); } else { $subject=Re: .$f['Subject']; } I know there actually exists a way to do the numeral addition (Re[5]:, not Re[4+1]:). How do I manage to do this? Thanks! -- With best regards from Ukraine, Andre Skype: Francophile Twitter: http://twitter.com/m_elensule Facebook: http://facebook.com/menelion -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Making multiple RSS feeds for the blog website
Hello Michelle, Hm. link rel=alternate... that's a good one, thanks (btw, you say me that I should RTFM, but if I knew what to read). Now there are two questions: 1. How do I do those .RSS files with PHP? All of mmy blog entries and other stuff are in MySql. There are classes that can echo the appropriate data as RSS, but there will be more .PHP files, not .RSS/.XML ones. So how do we manage that? 2. Should I make a separate .RSS file for each type of feeds (blog feed, comments feed, timeline feed, news feed)? thanks! -- With best regards from Ukraine, Andre Skype: Francophile Twitter: http://twitter.com/m_elensule Facebook: http://facebook.com/menelion - Original message - From: Michelle Konzack linux4miche...@tamay-dogan.net To: php-general@lists.php.net php-general@lists.php.net Date: Friday, August 27, 2010, 3:31:58 AM Subject: [PHP] Re: Making multiple RSS feeds for the blog website Hello Andre Polykanine, Am 2010-08-27 02:52:48, hacktest Du folgendes herunter: Hi everyone, We are developing a blog service website. Very interesting ;-) Question: how do we do that with PHP? By reading the Documentation... :-D html head titleBlubber Blog/title link rel=alternate type=application/rss+xml title=RSS href=index.rss / link rel=alternate type=application/rss+xml title=Foo href=foo.rss / link rel=alternate type=application/rss+xml title=Bar href=bar.rss / /head body Thanks, Greetings and nice Day/Evening Michelle Konzack -- # Debian GNU/Linux Consultant ## Development of Intranet and Embedded Systems with Debian GNU/Linux itsyst...@tdnet France EURL itsyst...@tdnet UG (limited liability) Owner Michelle KonzackOwner Michelle Konzack Apt. 917 (homeoffice) 50, rue de Soultz Kinzigstraße 17 67100 Strasbourg/France 77694 Kehl/Germany Tel: +33-6-61925193 mobil Tel: +49-177-9351947 mobil Tel: +33-9-52705884 fix http://www.itsystems.tamay-dogan.net/ http://www.flexray4linux.org/ http://www.debian.tamay-dogan.net/ http://www.can4linux.org/ Jabber linux4miche...@jabber.ccc.de ICQ#328449886 Linux-User #280138 with the Linux Counter, http://counter.li.org/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Making multiple RSS feeds for the blog website
Hi everyone, We are developing a blog service website. What we need now is the ability to make multiple RSS feeds from several pages (an RSS of each user's blog, a feed from each timeline - timelines are our representation of users' favorites; a feed filled with comments to a separate entry, etc.). What would be great is the following: a user enters, say, in my blog and sees the mark that there are RSS feeds. Then he/she clicks the mark or presses a keystroke (Alt+J in IE8, for instance), finds the feed and double-clicks on it. Then he/she can either read the feed or subscribe to it. The feeds have usually file extensions of .rss or .xml. Question: how do we do that with PHP? Thanks! -- With best regards from Ukraine, Andre Skype: Francophile Twitter: http://twitter.com/m_elensule Facebook: http://facebook.com/menelion -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: How safe is a .htaccess file?
Hello Nathan, Sorry, could you provide any links to read for a security noob?) Actually, I know that the md5 is decryptable (there are bases with words encrypted in md5), but I thought the SHA1 was secure... -- With best regards from Ukraine, Andre Skype: Francophile Twitter: http://twitter.com/m_elensule Facebook: http://facebook.com/menelion - Original message - From: Nathan Rixham nrix...@gmail.com To: tedd t...@sperling.com Date: Thursday, August 19, 2010, 12:03:12 PM Subject: [PHP] Re: How safe is a .htaccess file? tedd wrote: Hi gang: The subject line says it all. How secure is a .htaccess file to store passwords and other sensitive stuff? Can a .htaccess file be viewed remotely? Semi-safe, .htaccess is prevented from being served by configuration options (which come as default), however these can be overwritten so best to check by doing a GET on the resource URI. This doesn't prevent them from being exposed via other processes though, for instance a poorly coded 'download.php?path=/path/to/.htaccess' could still expose the file. Typically, its obviously better to store only a hash of a password rather than the pass in plain text, choosing the strongest algorithm you can; password security is of course relative though, a sha-512 of 'password1' is far from secure. A good way to approach encryption for files is to openssl_seal them using a public key which is only available to your application - this doesn't negate insecure code, but it at least ensures the raw files are encrypted securely enough to negate any of these worries. (just keep your private key safe, preferably in a pkcs12 w/a strong 64char+ pass) Best, Nathan -- 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] PHP Reference
Hello Karl, If I understood you properly, try this: ?SomeFunction();? -- With best regards from Ukraine, Andre Skype: Francophile Twitter: http://twitter.com/m_elensule Facebook: http://facebook.com/menelion - Original message - From: Karl DeSaulniers k...@designdrumm.com To: php-general php-general@lists.php.net Date: Saturday, August 14, 2010, 9:08:20 AM Subject: [PHP] PHP Reference Hello all, I was wondering, can you reference php in a url string like you can javascript. EG: javascript:someFunction() Can you do something similar in php like php:someFunction() I am thinking that you can not do this, but was wondering if there was something like that. Thanks, 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[2]: [PHP] Do you have some standard for defined the variable in program language?
Hello viraj, As for classes, it's suggested to start a class name with a capital: class MyBestClass { ... } As for functions and class methods, there are lots of people who name them like this: function the_greatest_function_in_the_world () { ... } Maybe it's readable and great, but I have a little problem: I'm using a screenreader, so the word underscore (and its Russian equivalent) is too long for me. So I prefer function TheGreatestFunctionInTheWorld () { ... } However, just discussed it with my wife. She prefers the same method as me, though she doesn't use any screenreading software for developing. -- With best regards from Ukraine, Andre Skype: Francophile Twitter: http://twitter.com/m_elensule - Original message - From: viraj kali...@gmail.com To: a...@ashleysheridan.co.uk a...@ashleysheridan.co.uk Date: Tuesday, July 27, 2010, 12:42:36 PM Subject: [PHP] Do you have some standard for defined the variable in program language? $firstName is the most readable.. for variables. does anybody have negative thoughts on using the same naming format for method/function and for class names? i guess it's worth sharing! many thanks! ~viraj On Tue, Jul 27, 2010 at 3:02 PM, Ashley Sheridan a...@ashleysheridan.co.uk wrote: On Tue, 2010-07-27 at 10:10 +0200, Jordan Jovanov wrote: Hello Everybody I start to write PHP script and all veritable a defined without some rules. I want to ask to you somebody know how is correct do different some variable. Like from next three variable who is correct: $firstname $FirstName $firstName $first_name etc. I know that from this variable can work all, but i want to know how is use in company. Do you have some standard for defined the variable in program language? (like ISO9001, ISO14001) Best Regard, Jordan Jovanov There is no enforced standard on how you define your variable names in PHP. However, you should try and remain consistent with whichever way you decide to use. Personally, I find the $firstName style the best of the four examples you gave. It's easily readable when I look over code at a later date, and slightly faster to type than $first_name (although even if only by a mere fraction of a second!) Some existing codebases might use a particular method though, and if you're working on a project with a team, then it really helps to all be using the same convention of naming variables. At the end of the day, this is all down to preference, along with code indentation and layout. 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 General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re[2]: [PHP] opening link in new window
Hi Rob and all, Btw, is there a way to do window.close without any questions of a browser? I know the only one: the window is generated via window.open. -- With best regards from Ukraine, Andre Skype: Francophile; WlmMSN: arthaelon @ yandex.ru; Jabber: arthaelon @ jabber.org Yahoo! messenger: andre.polykanine; ICQ: 191749952 Twitter: m_elensule - Original message - From: Robert Cummings rob...@interjinn.com To: Adam Richardson simples...@gmail.com Date: Saturday, July 24, 2010, 5:20:03 PM Subject: [PHP] opening link in new window On 10-07-24 04:19 AM, Adam Richardson wrote: Code that resembled the below is how I used to open new windows before I started using jQuery Note, this completely avoids use of the target attribute. function wireNewWindows(){ if(document.getElementsByTagName){ var anchors = document.getElementsByTagName(a); for(var i = 0; i anchors.length; i++){ var node = anchors[i]; if(node.getAttribute('rel') == 'external' || node.getAttribute('rel') == 'nofollow'){ node.onclick = function(){ var url = this.href; window.open( url, 'newWin','width=700,height=500,Menubar=yes,Toolbar=no,Location=no' ); return false; } } } } } I try to avoid window.open() due to the proliferation of popup blocking. 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 General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Login form + User level access
Hello Carlos, Something like this (assuming that the field with the type of the user - admin, sales, etc. - is called `Status`, and the table is called `Users`): $f=mysql_fetch_assoc(mysql_query(SELECT `Status`, COUNT(*) AS `UserExists` FROM `Users` WHERE `Name`='.$_POST['name'].' AND `Password`='.md5($_POST['pass']).')); if ($f['UserExists']0) { // name and password are correct switch ($f['Status']) { case 'ADMIN': include adminmenu.php; break; case 'SALES': include salesmenu.php; break; // ... } } else { die (You entered either an incorrect login or an incorrect password.); } I assume you store crypted passwords in your database, and the algorythm is md5 (there are better solutions, but I used it simply for this example). -- With best regards from Ukraine, Andre Skype: Francophile; WlmMSN: arthaelon @ yandex.ru; Jabber: arthaelon @ jabber.org Yahoo! messenger: andre.polykanine; ICQ: 191749952 Twitter: m_elensule - Original message - From: Carlos Sura carlos_s...@hotmail.com To: php-general@lists.php.net php-general@lists.php.net Date: Tuesday, June 29, 2010, 10:46:14 PM Subject: [PHP] Login form + User level access Hello everyone. I have this question: I'm developing a login system but what I need is to do is access levels I mean, in my database I have this users: Admin Superusers sales purchase etc So, What I do basically need is, when a user from sales log in.. I want him to see just the menu from SALES, He cannot see others menu options, and he can't get access, I was reading that I can do that with Switch, but really I have no idea about it... Any help? Thank you. Carlos Sura. _ http://clk.atdmt.com/UKM/go/19780/direct/01/ Do you have a story that started on Hotmail? Tell us now -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re[2]: [PHP] Login form + User level access
Hello Carlos, What I forgot to add is the following: I'd suggest you to put in the integers and not the strings (1 instead of PURCHASER, 2 instead of SALES etc.). It will quicken the process. -- With best regards from Ukraine, Andre Skype: Francophile; WlmMSN: arthaelon @ yandex.ru; Jabber: arthaelon @ jabber.org Yahoo! messenger: andre.polykanine; ICQ: 191749952 Twitter: m_elensule - Original message - From: Andre Polykanine an...@oire.org To: Carlos Sura carlos_s...@hotmail.com Date: Tuesday, June 29, 2010, 11:04:53 PM Subject: [PHP] Login form + User level access Hello Carlos, Something like this (assuming that the field with the type of the user - admin, sales, etc. - is called `Status`, and the table is called `Users`): $f=mysql_fetch_assoc(mysql_query(SELECT `Status`, COUNT(*) AS `UserExists` FROM `Users` WHERE `Name`='.$_POST['name'].' AND `Password`='.md5($_POST['pass']).')); if ($f['UserExists']0) { // name and password are correct switch ($f['Status']) { case 'ADMIN': include adminmenu.php; break; case 'SALES': include salesmenu.php; break; // ... } } else { die (You entered either an incorrect login or an incorrect password.); } I assume you store crypted passwords in your database, and the algorythm is md5 (there are better solutions, but I used it simply for this example). -- With best regards from Ukraine, Andre Skype: Francophile; WlmMSN: arthaelon @ yandex.ru; Jabber: arthaelon @ jabber.org Yahoo! messenger: andre.polykanine; ICQ: 191749952 Twitter: m_elensule - Original message - From: Carlos Sura carlos_s...@hotmail.com To: php-general@lists.php.net php-general@lists.php.net Date: Tuesday, June 29, 2010, 10:46:14 PM Subject: [PHP] Login form + User level access Hello everyone. I have this question: I'm developing a login system but what I need is to do is access levels I mean, in my database I have this users: Admin Superusers sales purchase etc So, What I do basically need is, when a user from sales log in.. I want him to see just the menu from SALES, He cannot see others menu options, and he can't get access, I was reading that I can do that with Switch, but really I have no idea about it... Any help? Thank you. Carlos Sura. _ http://clk.atdmt.com/UKM/go/19780/direct/01/ Do you have a story that started on Hotmail? Tell us now -- 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[4]: [PHP] Login form + User level access
Hello Carlos, Yes, it would be the same. You'll have some double info in your DB, though. -- With best regards from Ukraine, Andre Skype: Francophile; WlmMSN: arthaelon @ yandex.ru; Jabber: arthaelon @ jabber.org Yahoo! messenger: andre.polykanine; ICQ: 191749952 Twitter: m_elensule - Original message - From: Carlos Sura carlos_s...@hotmail.com To: an...@oire.org an...@oire.org Date: Tuesday, June 29, 2010, 11:13:08 PM Subject: [PHP] Login form + User level access Hello Andre, Thank you so much, Now I really get the idea. Oh, can I replace that adding inthe table of access_level a field called: 'level_numbers' ?? would it be the same thing?? Carlos Sura. Date: Tue, 29 Jun 2010 23:08:51 +0300 From: an...@oire.org To: an...@oire.org CC: carlos_s...@hotmail.com; php-general@lists.php.net Subject: Re[2]: [PHP] Login form + User level access Hello Carlos, What I forgot to add is the following: I'd suggest you to put in the integers and not the strings (1 instead of PURCHASER, 2 instead of SALES etc.). It will quicken the process. -- With best regards from Ukraine, Andre Skype: Francophile; WlmMSN: arthaelon @ yandex.ru; Jabber: arthaelon @ jabber.org Yahoo! messenger: andre.polykanine; ICQ: 191749952 Twitter: m_elensule - Original message - From: Andre Polykanine an...@oire.org To: Carlos Sura carlos_s...@hotmail.com Date: Tuesday, June 29, 2010, 11:04:53 PM Subject: [PHP] Login form + User level access Hello Carlos, Something like this (assuming that the field with the type of the user - admin, sales, etc. - is called `Status`, and the table is called `Users`): $f=mysql_fetch_assoc(mysql_query(SELECT `Status`, COUNT(*) AS `UserExists` FROM `Users` WHERE `Name`='.$_POST['name'].' AND `Password`='.md5($_POST['pass']).')); if ($f['UserExists']0) { // name and password are correct switch ($f['Status']) { case 'ADMIN': include adminmenu.php; break; case 'SALES': include salesmenu.php; break; // ... } } else { die (You entered either an incorrect login or an incorrect password.); } I assume you store crypted passwords in your database, and the algorythm is md5 (there are better solutions, but I used it simply for this example). -- With best regards from Ukraine, Andre Skype: Francophile; WlmMSN: arthaelon @ yandex.ru; Jabber: arthaelon @ jabber.org Yahoo! messenger: andre.polykanine; ICQ: 191749952 Twitter: m_elensule - Original message - From: Carlos Sura carlos_s...@hotmail.com To: php-general@lists.php.net php-general@lists.php.net Date: Tuesday, June 29, 2010, 10:46:14 PM Subject: [PHP] Login form + User level access Hello everyone. I have this question: I'm developing a login system but what I need is to do is access levels I mean, in my database I have this users: Admin Superusers sales purchase etc So, What I do basically need is, when a user from sales log in.. I want him to see just the menu from SALES, He cannot see others menu options, and he can't get access, I was reading that I can do that with Switch, but really I have no idea about it... Any help? Thank you. Carlos Sura. _ http://clk.atdmt.com/UKM/go/19780/direct/01/ Do you have a story that started on Hotmail? Tell us now -- 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 _ http://clk.atdmt.com/UKM/go/19780/direct/01/ Do you have a story that started on Hotmail? Tell us now -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Inserting, storing, outputting dates and selections
Hi Dave, Let's look and see) 1. You can re-format your date so that it will fit the needed format for MySql: $_POST['EndDate']=date(Y-m-d, $_POST['EndDate']); 2. There's a PHP function called isset() that checks whether a variable is set. But you probably will find this one much handier: if (!empty($_POST['EndDate'])) { // blahblah, inserting into database } 3. This is quite simple, I think. You write: optionChoice 1/option What would you like PHP to write in the DB? It has nothing to write at all) You should do this instead: option value=1Choice 1/option option value=2Choice 2/option So now you have values to insert) Hope I could help you!) -- With best regards from Ukraine, Andre Skype: Francophile; WlmMSN: arthaelon @ yandex.ru; Jabber: arthaelon @ jabber.org Yahoo! messenger: andre.polykanine; ICQ: 191749952 Twitter: m_elensule - Original message - From: David Mehler dave.meh...@gmail.com To: php-general php-general@lists.php.net Date: Wednesday, June 2, 2010, 11:20:55 PM Subject: [PHP] Inserting, storing, outputting dates and selections Hello, I've got two questions which are probably fairly simple, my issue is i'm staring at this so long it's blurring together. I'm working on a form to insert data in to a mysql database. I've got a startdate and and enddate field in the database both of type DATE, i'm needing this as i'm wanting to do a calculation against the date and only display records greater than or equal to the current date. My understanding is dates have to be entered as 2010-06-02 with this format. I'm having several issues: the first of which is I entered a date as probably a user would as June 2, 2010 and on the display page got all zeroes, is there a way i can be more flexible with my data entry, enter it, then store it in the format mysql needs? My second issue is that the startdate field is NOT NULL while the enddate field is. On submission I only want those forms that are actually in the post data to get inserted in to the database, and displayed, i.e. if enddate was not entered I shouldn't see all zeroes in the field in the database, if using the mysql commandline client, or all zeroes in displayed output. I'm not sure how to conditionally insert or display a field based on whether it's set. My last issue, not on dates, is on a selection box. I've got two choices to choose from, choice1 and choice2 just for this example. If a user goes through and selects nothing I want choice1 to be automatically selected on form submission, if a user selects choice2 then the form should go with that. Here's my code. div label for=txtchooseChoose*:/label select name=Choice for Selection option - choice1 - /option option - choice2 - /option /select /div On form submission the php script processes it and enters an empty field in the database if the user doesn't select an option. Thanks. Dave. -- 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] Parse info from 1,000 files to file
Hello Sam, Consider using opendir(), readdir(), fopen(), file_get_contents(), fwrite(). -- With best regards from Ukraine, Andre Skype: Francophile; WlmMSN: arthaelon @ yandex.ru; Jabber: arthaelon @ jabber.org Yahoo! messenger: andre.polykanine; ICQ: 191749952 Twitter: m_elensule - Original message - From: Sam Smith s...@ssmith.com To: php-general@lists.php.net php-general@lists.php.net Date: Wednesday, June 2, 2010, 9:24:20 PM Subject: [PHP] Parse info from 1,000 files to file Can someone briefly point me to the functions I'll need to parse some information from thousands of files in a single directory and then prepare the extracted info into a single file for SQL import? Like file() or readfile() and some regex and writefile?? Thanks -- 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[2]: [PHP] One more time about regexes
Hello Adam, You did understand me exactly and perfectly). Ordering arrays is a good idea but I don't know how to do that exactly. For instance, there's a cypher called Polybius square. You write in the alphabet in a grid like this: 1 a b c d e 2 f g h i j 3 k l m n o 4 p q r s t 5 u v w x y 6 z There is a way where i/j are equal to make a 5 by 5 square but for me it's equal since I'm working with a 33-letter Russian alphabet, so no way to make it a perfect square. Anyway, a letter has two coordinates and is represented by a two-digit number. For example, E is 15, K is 21, Z is 61 and so on. So we have a word, say, PHP. It will look like this: 412341. What does preg_replace do? Exactly, it's searching 41, then 12, then 23, and so on. I tried to make a loop: $length=mb_strlen($str); for ($i=0; $i$length; $i+=2) { $pair=mb_substr($str, $i, 2); $pair=preg_replace($numbers, $letters, $str); } It already smells something not good, but anyway. If I do that, I have one more problem: say, we have a phrase PHP is the best. So we crypt it and get: 412341 2444 452315 12154445 Then the parser begins: 41=p, 23=h, 41=p, (attention!) \s2= I marked a whitespace as \s so you see what happens. I might split the string by spaces but I can't imagine what a user inputs: it might be a dash, for example... Sorry for such a long message but I'm really annoyed with this preg_replace's behavior. And it's not the only one task to accomplish... Thanks a lot! -- With best regards from Ukraine, Andre Skype: Francophile; WlmMSN: arthaelon @ yandex.ru; Jabber: arthaelon @ jabber.org Yahoo! messenger: andre.polykanine; ICQ: 191749952 Twitter: m_elensule - Original message - From: Adam Richardson simples...@gmail.com To: php-general@lists.php.net php-general@lists.php.net Date: Thursday, May 27, 2010, 7:56:28 AM Subject: [PHP] One more time about regexes On Wed, May 26, 2010 at 11:10 PM, Nilesh Govindarajan li...@itech7.comwrote: -- Forwarded message -- From: Nilesh Govindarajan li...@itech7.com Date: Thu, May 27, 2010 at 8:40 AM Subject: Re: [PHP] One more time about regexes To: Andre Polykanine an...@oire.org On Thu, May 27, 2010 at 3:33 AM, Andre Polykanine an...@oire.org wrote: Hello everyone, Sorry, but I'm asking one more time (since it's really annoying me and I need to apply some really dirty hacks): Is there a way making preg_replace() pass through the regex one single time searching from left to right and not to erase what it has already done? I can give you a real task I'm accomplishing but the tasks requiring that tend to multiply... Thanks a lot! -- With best regards from Ukraine, Andre Http://oire.org/ - The Fantasy blogs of Oire Skype: Francophile; WlmMSN: arthaelon @ yandex.ru; Jabber: arthaelon @ jabber.org Yahoo! messenger: andre.polykanine; ICQ: 191749952 Twitter: http://twitter.com/m_elensule -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php If you don't want to replace the stuff it has searched then use preg_match ! -- Nilesh Govindarajan Facebook: nilesh.gr Twitter: nileshgr Website: www.itech7.com -- Nilesh Govindarajan Facebook: nilesh.gr Twitter: nileshgr Website: www.itech7.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php If I'm understanding correctly, Andre, you want to perform a replace operation, but you're observing that there's an element of recursion happening (e.g., you replace one item with its replacement, and then the new replacement is also replaced.) To my knowledge, this won't happen with a standard preg_replace(): $string = 'Bil Tom Phil'; $pattern = '//'; $replacement = 'amp;'; // outputs Bil amp; Tom amp; Phil echo preg_replace($pattern, $replacement, $string); However, if you're using arrays to pass in the patterns and replacements, then one array item could later be replaced by another (see comment and example on this page by info at gratisrijden dot nl): http://php.net/manual/en/function.preg-replace.php If that's the case, you have to carefully structure the order of the array items so-as to preclude one replacement having the opportunity to override a subsequent replacement. Sorry if I misunderstood. You might want to create a simple example of code showing what you're working through. Adam -- Nephtali: PHP web framework that functions beautifully http://nephtaliproject.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Convert UTF-8 to PHP defines
Hello Guus, Actually, we are using the same method here on http://oire.org/. We have all of the language files in UTF8 format and everything seems to be OK. Yes, unicode support in PHp laisse à désirer, like the French say, but it does support UTF8 files. -- With best regards from Ukraine, Andre Skype: Francophile; WlmMSN: arthaelon @ yandex.ru; Jabber: arthaelon @ jabber.org Yahoo! messenger: andre.polykanine; ICQ: 191749952 Twitter: m_elensule - Original message - From: Guus Ellenkamp ellenkamp_g...@hotmail.com To: php-general@lists.php.net php-general@lists.php.net Date: Wednesday, May 26, 2010, 5:20:59 PM Subject: [PHP] Convert UTF-8 to PHP defines We use PHP defines for defining text in different languages. As far as I know PHP files are supposed to be ASCII, not UTF-8 or something like that. What I want to make is a conversion program that would convert a given UTF-8 file with the format definetext1=this is a text in random UTF-8, probably arabic or similar text definetext2=this is another text in random UTF-8, probably arabic or similar text into a file with the following defines define('definetext1',chr(t_value).chr(h_value).chr(i_value)...chr(x_value).chr(t_value)); define('definetext2,chr(t_value).chr(h_value).chr(i_value)...chr(x_value).chr(t_value)); Not sure if I'm using the correct chr/ord function, but I hope the above is clear enough to make clear what I'm looking for. Basically the output file should be ascii and not contain any utf-8. Any advise? The html_special_chars did not seem to work for Vietnamese text I tried to convert, so something seems to get wrong with just reading an array of strings and converting the strings and putting them in defines. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] One more time about regexes
Hello everyone, Sorry, but I'm asking one more time (since it's really annoying me and I need to apply some really dirty hacks): Is there a way making preg_replace() pass through the regex one single time searching from left to right and not to erase what it has already done? I can give you a real task I'm accomplishing but the tasks requiring that tend to multiply... Thanks a lot! -- With best regards from Ukraine, Andre Http://oire.org/ - The Fantasy blogs of Oire Skype: Francophile; WlmMSN: arthaelon @ yandex.ru; Jabber: arthaelon @ jabber.org Yahoo! messenger: andre.polykanine; ICQ: 191749952 Twitter: http://twitter.com/m_elensule -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re[6]: [PHP] preg_replace: avoiding double replacements
Ash, Actually it's not the Caesar cypher itself (see http://en.wikipedia.org/wiki/Temurah_(Kabbalah), third method), but your way of transformation seems to me the best for a while) Thanks! -- With best regards from Ukraine, Andre Skype: Francophile; WlmMSN: arthaelon @ yandex.ru; Jabber: arthaelon @ jabber.org Yahoo! messenger: andre.polykanine; ICQ: 191749952 Twitter: m_elensule - Original message - From: Ashley Sheridan a...@ashleysheridan.co.uk To: Peter Lind peter.e.l...@gmail.com Date: Tuesday, May 18, 2010, 2:32:11 PM Subject: [PHP] preg_replace: avoiding double replacements On Tue, 2010-05-18 at 13:09 +0200, Peter Lind wrote: On 18 May 2010 12:35, Andre Polykanine an...@oire.org wrote: Hello Peter, Hm... I see I need to specify what I'm really doing. Actually, I need to change the letters in the text. It's a famous and ancient crypting method: you divide the alphabet making two parts, then you change the letters of one part with letters for other part (so A becomes N, B becomes O, etc., and vice versa). it works fine and slightly with strtr or str_replace... but only if the text is not in utf-8 and it doesn't contain any non-English letters such as Cyrillic what I need. What my regex does is the following: it sees an A, well it changes it to N; then it goes through the string and sees an N... what does it do? Surely, it changes it back to A! I hoped (in vain) that there exists a modifier preventing this behavior... but it seems that it's false( Thanks! Hmmm, what comes to mind is using your string as an array and translating one character after another, building your output string using a lookup table. Not entirely sure how that will play with utf8 characters, you'd have to try and see. I don't think you'll get any of PHPs string functions to do the work for you - they'll do the job in serial, not parallel. Regards Peter -- hype WWW: http://plphp.dk / http://plind.dk LinkedIn: http://www.linkedin.com/in/plind Flickr: http://www.flickr.com/photos/fake51 BeWelcome: Fake51 Couchsurfing: Fake51 /hype If you're wanting to use the Caesar cypher (for that's what it is) then why not just modify the entire string, character by character, to use a character code n characters ahead. For example, a capital A is ascii 65, you want to change it to an N to add 14 to that. Just keep n the same throughout and it's easy to convert back. Thanks, Ash http://www.ashleysheridan.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re[2]: [PHP] preg_replace: avoiding double replacements
Hello Jim, That might work for that particular example, but I have utf-8 strings containing different characters of different alphabets, so neither str_replace nor strtr work... Thanks! -- With best regards from Ukraine, Andre Skype: Francophile; WlmMSN: arthaelon @ yandex.ru; Jabber: arthaelon @ jabber.org Yahoo! messenger: andre.polykanine; ICQ: 191749952 Twitter: m_elensule - Original message - From: Jim Lucas li...@cmsws.com To: Andre Polykanine an...@oire.org Date: Tuesday, May 18, 2010, 3:33:09 AM Subject: [PHP] preg_replace: avoiding double replacements Andre Polykanine wrote: Hello everyone, Sorry for bothering you again. Today I met a problem exactly described by a developer in users' notes that follow the preg_replace description in the manual: info at gratisrijden dot nl 02-Oct-2009 02:48 if you are using the preg_replace with arrays, the replacements will apply as subject for the patterns later in the array. This means replaced values can be replaced again. Example: ?php $text = 'We want to replace BOLD with the boldtag and OLDTAG with the newtag'; $patterns = array( '/BOLD/i', '/OLDTAG/i'); $replacements = array( 'boldtag', 'newtag'); echo preg_replace ($patterns, $replacements, $text); ? Output: We want to replace bnewtag with the bnewtagtag and newtag with the newtag Look what happend with BOLD. Is there any solution to this besides any two-step sophisticated trick like case changing? Thanks! -- With best regards from Ukraine, Andre Http://oire.org/ - The Fantasy blogs of Oire Skype: Francophile; WlmMSN: arthaelon @ yandex.ru; Jabber: arthaelon @ jabber.org Yahoo! messenger: andre.polykanine; ICQ: 191749952 Twitter: http://twitter.com/m_elensule Well, for the example you gave, why use regex? Check this out as an example. plaintext?php $text = 'We want to replace BOLD with the boldtag and OLDTAG with the newtag'; $regex = array( '/BOLD/i', '/OLDTAG/i', ); $oldtags = array( 'BOLD', 'OLDTAG', ); $replacements = array( 'boldtag', 'newtag', ); # Original String echo $text.\n; # After regex is applied echo preg_replace($regex, $replacements, $text).\n; # After plain tag replacement happens echo str_replace($oldtags, $replacements, $text).\n; ? See if that works for you. -- Jim Lucas Some men are born to greatness, some achieve greatness, and some have greatness thrust upon them. Twelfth Night, Act II, Scene V by William Shakespeare -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re[4]: [PHP] preg_replace: avoiding double replacements
Hello Peter, Hm... I see I need to specify what I'm really doing. Actually, I need to change the letters in the text. It's a famous and ancient crypting method: you divide the alphabet making two parts, then you change the letters of one part with letters for other part (so A becomes N, B becomes O, etc., and vice versa). it works fine and slightly with strtr or str_replace... but only if the text is not in utf-8 and it doesn't contain any non-English letters such as Cyrillic what I need. What my regex does is the following: it sees an A, well it changes it to N; then it goes through the string and sees an N... what does it do? Surely, it changes it back to A! I hoped (in vain) that there exists a modifier preventing this behavior... but it seems that it's false( Thanks! -- With best regards from Ukraine, Andre Skype: Francophile; WlmMSN: arthaelon @ yandex.ru; Jabber: arthaelon @ jabber.org Yahoo! messenger: andre.polykanine; ICQ: 191749952 Twitter: m_elensule - Original message - From: Peter Lind peter.e.l...@gmail.com To: Andre Polykanine an...@oire.org Date: Tuesday, May 18, 2010, 10:19:51 AM Subject: [PHP] preg_replace: avoiding double replacements On 18 May 2010 09:04, Andre Polykanine an...@oire.org wrote: [snip] Andre Polykanine wrote: Hello everyone, Sorry for bothering you again. Today I met a problem exactly described by a developer in users' notes that follow the preg_replace description in the manual: info at gratisrijden dot nl 02-Oct-2009 02:48 if you are using the preg_replace with arrays, the replacements will apply as subject for the patterns later in the array. This means replaced values can be replaced again. Example: ?php $text = 'We want to replace BOLD with the boldtag and OLDTAG with the newtag'; $patterns = array( '/BOLD/i', '/OLDTAG/i'); $replacements = array( 'boldtag', 'newtag'); echo preg_replace ($patterns, $replacements, $text); ? Output: We want to replace bnewtag with the bnewtagtag and newtag with the newtag Look what happend with BOLD. Is there any solution to this besides any two-step sophisticated trick like case changing? Thanks! Use better regexes: either match for word endings or use a delimiter in your markers (i.e. ###BOLD### instead of BOLD). Regards Peter -- hype WWW: http://plphp.dk / http://plind.dk LinkedIn: http://www.linkedin.com/in/plind Flickr: http://www.flickr.com/photos/fake51 BeWelcome: Fake51 Couchsurfing: Fake51 /hype -- 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[6]: [PHP] preg_replace: avoiding double replacements
Hello Peter, Good point. And more than that, I make a decrypting script, also... so gibberish defenitely is an issue) -- With best regards from Ukraine, Andre Skype: Francophile; WlmMSN: arthaelon @ yandex.ru; Jabber: arthaelon @ jabber.org Yahoo! messenger: andre.polykanine; ICQ: 191749952 Twitter: m_elensule - Original message - From: Peter Lind peter.e.l...@gmail.com To: a...@ashleysheridan.co.uk a...@ashleysheridan.co.uk Date: Tuesday, May 18, 2010, 3:00:56 PM Subject: [PHP] preg_replace: avoiding double replacements On 18 May 2010 13:43, Ashley Sheridan a...@ashleysheridan.co.uk wrote: On Tue, 2010-05-18 at 13:46 +0200, Peter Lind wrote: On 18 May 2010 13:32, Ashley Sheridan a...@ashleysheridan.co.uk wrote: On Tue, 2010-05-18 at 13:09 +0200, Peter Lind wrote: On 18 May 2010 12:35, Andre Polykanine an...@oire.org wrote: Hello Peter, Hm... I see I need to specify what I'm really doing. Actually, I need to change the letters in the text. It's a famous and ancient crypting method: you divide the alphabet making two parts, then you change the letters of one part with letters for other part (so A becomes N, B becomes O, etc., and vice versa). it works fine and slightly with strtr or str_replace... but only if the text is not in utf-8 and it doesn't contain any non-English letters such as Cyrillic what I need. What my regex does is the following: it sees an A, well it changes it to N; then it goes through the string and sees an N... what does it do? Surely, it changes it back to A! I hoped (in vain) that there exists a modifier preventing this behavior... but it seems that it's false( Thanks! Hmmm, what comes to mind is using your string as an array and translating one character after another, building your output string using a lookup table. Not entirely sure how that will play with utf8 characters, you'd have to try and see. I don't think you'll get any of PHPs string functions to do the work for you - they'll do the job in serial, not parallel. Regards Peter -- hype WWW: http://plphp.dk / http://plind.dk LinkedIn: http://www.linkedin.com/in/plind Flickr: http://www.flickr.com/photos/fake51 BeWelcome: Fake51 Couchsurfing: Fake51 /hype If you're wanting to use the Caesar cypher (for that's what it is) then why not just modify the entire string, character by character, to use a character code n characters ahead. For example, a capital A is ascii 65, you want to change it to an N to add 14 to that. Just keep n the same throughout and it's easy to convert back. Thanks, Ash http://www.ashleysheridan.co.uk You probably overlooked the part where the OP points out he's not using ascii but utf8. If it was just ascii, using str_rot13() would be the weapon of choice I'd say (note that adding 14 to every character of an ascii string will turn lots of it into gibberish - you have to wrap round when you reach a certain point). Regards Peter -- hype WWW: http://plphp.dk / http://plind.dk LinkedIn: http://www.linkedin.com/in/plind Flickr: http://www.flickr.com/photos/fake51 BeWelcome: Fake51 Couchsurfing: Fake51 /hype I gave the example as Ascii because I knew the code for A off the top of my head, I don't see a reason why it won't work for utf, the characters still have incremental codes. Also, is gibberish really an issue to worry about? The Caesar cypher is already rendering the string unreadable. You normally want output in the same range that you encode from (i.e. you're remapping within the alphabet, not within the entire range of printable characters) if you're doing a caesar/rot13. Regards Peter -- hype WWW: http://plphp.dk / http://plind.dk LinkedIn: http://www.linkedin.com/in/plind Flickr: http://www.flickr.com/photos/fake51 BeWelcome: Fake51 Couchsurfing: Fake51 /hype -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] A simple question, however it's urgent
Hello everyone, Just can't imagine what happens. There is the simplest function in the world: function LineBreaks ($str) { $what=array(\r\n, \n, \r); $with=array(br); $str=str_replace($what, $with, $str); return $str; } And... it does work on one site and doesn't on another. Same hosting provider, same settings, all the same. When I call $_POST['uwork']=LineBreaks($_POST['uwork']); Nothing happens. Yes, it does see \r\n's but it doesn't replace them with br's. Tried built-in nl2br(), but no result... Thank you!.. -- With best regards from Ukraine, Andre Http://oire.org/ - The Fantasy blogs of Oire Skype: Francophile; WlmMSN: arthaelon @ yandex.ru; Jabber: arthaelon @ jabber.org Yahoo! messenger: andre.polykanine; ICQ: 191749952 Twitter: http://twitter.com/m_elensule -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re[2]: [PHP] A simple question, however it's urgent
Hey Ash, I do a print_r($_POST) and see there the \r\n's. Please don't pay attention to question marks, there is some Cyrillic here: Original POST: Array ( [uwork] = asdfsadf\r\nasdfasdf\r\nasdfasdf\r\nasdfasdf\r\nasdfasdf\r\nasdf [lid] = 23 [stud] = 1587 [sfac] = 3 [stid] = 9 [report] = 0 [Add] = ? ?? ) Modified POST: Array ( [uwork] = asdfsadf\r\nasdfasdf\r\nasdfasdf\r\nasdfasdf\r\nasdfasdf\r\nasdf [lid] = 23 [stud] = 1587 [sfac] = 3 [stid] = 9 [report] = 0 [Add] = ? ?? ) -- With best regards from Ukraine, Andre Skype: Francophile; WlmMSN: arthaelon @ yandex.ru; Jabber: arthaelon @ jabber.org Yahoo! messenger: andre.polykanine; ICQ: 191749952 Twitter: m_elensule - Original message - From: Ashley Sheridan a...@ashleysheridan.co.uk To: Andre Polykanine an...@oire.org Date: Monday, May 17, 2010, 3:24:37 PM Subject: [PHP] A simple question, however it's urgent On Mon, 2010-05-17 at 15:26 +0300, Andre Polykanine wrote: Hello everyone, Just can't imagine what happens. There is the simplest function in the world: function LineBreaks ($str) { $what=array(\r\n, \n, \r); $with=array(br); $str=str_replace($what, $with, $str); return $str; } And... it does work on one site and doesn't on another. Same hosting provider, same settings, all the same. When I call $_POST['uwork']=LineBreaks($_POST['uwork']); Nothing happens. Yes, it does see \r\n's but it doesn't replace them with br's. Tried built-in nl2br(), but no result... Thank you!.. -- With best regards from Ukraine, Andre Http://oire.org/ - The Fantasy blogs of Oire Skype: Francophile; WlmMSN: arthaelon @ yandex.ru; Jabber: arthaelon @ jabber.org Yahoo! messenger: andre.polykanine; ICQ: 191749952 Twitter: http://twitter.com/m_elensule If nl2br() doesn't even work, are you really sure that those character exist in the string? Just for our own sake, could you demonstrate how you determine that the carriage return and line break characters exist in the string? Thanks, Ash http://www.ashleysheridan.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re[4]: [PHP] A simple question, however it's urgent
Ash, Magic quotes are disabled: http://gviragon.org/study/php.php Any ideas? Thanks a lot! -- With best regards from Ukraine, Andre Skype: Francophile; WlmMSN: arthaelon @ yandex.ru; Jabber: arthaelon @ jabber.org Yahoo! messenger: andre.polykanine; ICQ: 191749952 Twitter: m_elensule - Original message - From: Ashley Sheridan a...@ashleysheridan.co.uk To: Andre Polykanine an...@oire.org Date: Monday, May 17, 2010, 3:34:07 PM Subject: [PHP] A simple question, however it's urgent On Mon, 2010-05-17 at 15:36 +0300, Andre Polykanine wrote: Hey Ash, I do a print_r($_POST) and see there the \r\n's. Please don't pay attention to question marks, there is some Cyrillic here: Original POST: Array ( [uwork] = asdfsadf\r\nasdfasdf\r\nasdfasdf\r\nasdfasdf\r\nasdfasdf\r\nasdf [lid] = 23 [stud] = 1587 [sfac] = 3 [stid] = 9 [report] = 0 [Add] = ? ?? ) Modified POST: Array ( [uwork] = asdfsadf\r\nasdfasdf\r\nasdfasdf\r\nasdfasdf\r\nasdfasdf\r\nasdf [lid] = 23 [stud] = 1587 [sfac] = 3 [stid] = 9 [report] = 0 [Add] = ? ?? ) -- With best regards from Ukraine, Andre Skype: Francophile; WlmMSN: arthaelon @ yandex.ru; Jabber: arthaelon @ jabber.org Yahoo! messenger: andre.polykanine; ICQ: 191749952 Twitter: m_elensule - Original message - From: Ashley Sheridan a...@ashleysheridan.co.uk To: Andre Polykanine an...@oire.org Date: Monday, May 17, 2010, 3:24:37 PM Subject: [PHP] A simple question, however it's urgent On Mon, 2010-05-17 at 15:26 +0300, Andre Polykanine wrote: Hello everyone, Just can't imagine what happens. There is the simplest function in the world: function LineBreaks ($str) { $what=array(\r\n, \n, \r); $with=array(br); $str=str_replace($what, $with, $str); return $str; } And... it does work on one site and doesn't on another. Same hosting provider, same settings, all the same. When I call $_POST['uwork']=LineBreaks($_POST['uwork']); Nothing happens. Yes, it does see \r\n's but it doesn't replace them with br's. Tried built-in nl2br(), but no result... Thank you!.. -- With best regards from Ukraine, Andre Http://oire.org/ - The Fantasy blogs of Oire Skype: Francophile; WlmMSN: arthaelon @ yandex.ru; Jabber: arthaelon @ jabber.org Yahoo! messenger: andre.polykanine; ICQ: 191749952 Twitter: http://twitter.com/m_elensule If nl2br() doesn't even work, are you really sure that those character exist in the string? Just for our own sake, could you demonstrate how you determine that the carriage return and line break characters exist in the string? Thanks, Ash http://www.ashleysheridan.co.uk You shouldn't actually be able to see the \ chracters, so I would assume that you're escaping them somehow and magic quotes are getting in the way on the live server with the problems. Have you checked the magic quotes settings on both servers. Also, as a general rule of thumb, if something stops working on a new server, check to see if the setup is the same. Compare the output of phpinfo() on both of them first, as that will show you any obvious differences. 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] preg_replace: avoiding double replacements
Hello everyone, Sorry for bothering you again. Today I met a problem exactly described by a developer in users' notes that follow the preg_replace description in the manual: info at gratisrijden dot nl 02-Oct-2009 02:48 if you are using the preg_replace with arrays, the replacements will apply as subject for the patterns later in the array. This means replaced values can be replaced again. Example: ?php $text = 'We want to replace BOLD with the boldtag and OLDTAG with the newtag'; $patterns = array( '/BOLD/i', '/OLDTAG/i'); $replacements = array( 'boldtag', 'newtag'); echo preg_replace ($patterns, $replacements, $text); ? Output: We want to replace bnewtag with the bnewtagtag and newtag with the newtag Look what happend with BOLD. Is there any solution to this besides any two-step sophisticated trick like case changing? Thanks! -- With best regards from Ukraine, Andre Http://oire.org/ - The Fantasy blogs of Oire Skype: Francophile; WlmMSN: arthaelon @ yandex.ru; Jabber: arthaelon @ jabber.org Yahoo! messenger: andre.polykanine; ICQ: 191749952 Twitter: http://twitter.com/m_elensule -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re[2]: [PHP] Inserting rows with missing IDs
Hello Richard, Thanks, will try this!) -- With best regards from Ukraine, Andre Skype: Francophile; WlmMSN: arthaelon @ yandex.ru; Jabber: arthaelon @ jabber.org Yahoo! messenger: andre.polykanine; ICQ: 191749952 Twitter: m_elensule - Original message - From: Richard Quadling rquadl...@googlemail.com To: Andre Polykanine an...@oire.org Date: Tuesday, May 4, 2010, 6:08:28 PM Subject: [PHP] Inserting rows with missing IDs On 3 May 2010 14:34, Andre Polykanine an...@oire.org wrote: Hello everyone, It's not a strictly PHP question, however since I use that with PHP, I'm asking it there. How can I accomplish the task of inserting rows into MySql database with missing IDs? Say, I have rows with IDs 1, 2, 3, 5, 9, 12, 17, and 195. How do I make the check that allows to insert firstly the missing IDs and only then apply the auto-increment? Thanks! Using PHP, you could find the missing IDs by using the following steps. 1 - Get the current maximum ID. SELECT max(ID) as Max FROM table If you aren't interested in the ones before the first valid ID then also retrieve the min(ID). So you end up with $MinID = 1, $MaxID = 195. 2 - Get all the current IDs. SELECT ID FROM table So you end up with $KnownIDs = array(1,2,3,5,9,12,17,195); 3 - Use the range() function in PHP to build an array from the lowest id (or 1) to the highest id. $RangeIDs = range($MinID, $MaxID); 4 - Use array_diff($RangeIDs, $KnownIDs); to find the missing IDs. So ... ?php $MinID = 1; $MaxID = 30; // Edited to suit output $KnownIDs = array(1,2,3,5,9,12,17,30); // Edited to suit output $RangeIDs = range($MinID, $MaxID); print_r(array_diff($RangeIDs, $KnownIDs)); ? outputs ... Array ( [3] = 4 [5] = 6 [6] = 7 [7] = 8 [9] = 10 [10] = 11 [12] = 13 [13] = 14 [14] = 15 [15] = 16 [17] = 18 [18] = 19 [19] = 20 [20] = 21 [21] = 22 [22] = 23 [23] = 24 [24] = 25 [25] = 26 [26] = 27 [27] = 28 [28] = 29 ) -- - Richard Quadling Standing on the shoulders of some very clever giants! EE : http://www.experts-exchange.com/M_248814.html EE4Free : http://www.experts-exchange.com/becomeAnExpert.jsp Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731 ZOPA : http://uk.zopa.com/member/RQuadling -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Inserting rows with missing IDs
Hello everyone, It's not a strictly PHP question, however since I use that with PHP, I'm asking it there. How can I accomplish the task of inserting rows into MySql database with missing IDs? Say, I have rows with IDs 1, 2, 3, 5, 9, 12, 17, and 195. How do I make the check that allows to insert firstly the missing IDs and only then apply the auto-increment? Thanks! -- With best regards from Ukraine, Andre Http://oire.org/ - The Fantasy blogs of Oire Skype: Francophile; WlmMSN: arthaelon @ yandex.ru; Jabber: arthaelon @ jabber.org Yahoo! messenger: andre.polykanine; ICQ: 191749952 Twitter: http://twitter.com/m_elensule -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re[2]: [PHP] Inserting rows with missing IDs
Hello Bob, Nope; they're not. They are blog entries that were deleted along with their comments. I'm just thinking about doing this when the amount of entries exceeds a reasonable number. -- With best regards from Ukraine, Andre Skype: Francophile; WlmMSN: arthaelon @ yandex.ru; Jabber: arthaelon @ jabber.org Yahoo! messenger: andre.polykanine; ICQ: 191749952 Twitter: m_elensule - Original message - From: Bob McConnell r...@cbord.com To: Andre Polykanine an...@oire.org Date: Monday, May 3, 2010, 4:40:18 PM Subject: [PHP] Inserting rows with missing IDs From: Andre Polykanine It's not a strictly PHP question, however since I use that with PHP, I'm asking it there. How can I accomplish the task of inserting rows into MySql database with missing IDs? Say, I have rows with IDs 1, 2, 3, 5, 9, 12, 17, and 195. How do I make the check that allows to insert firstly the missing IDs and only then apply the auto-increment? Why are they missing? Were they present at one time then deleted? If so, were they used as foreign keys from another table or referenced in queries for other data that may still reference those empty rows? Think about the ramifications of old data in other tables that may be inherited when new rows are assigned a deleted ID. Bob McConnell -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Joomla FrameWork ::
Hello Nick, That means that the function SetVar is situated in the jRequest class. So if you want to modify the function, for example, you need to know where the class jRequest is situated. -- With best regards from Ukraine, Andre Skype: Francophile; WlmMSN: arthaelon @ yandex.ru; Jabber: arthaelon @ jabber.org Yahoo! messenger: andre.polykanine; ICQ: 191749952 Twitter: m_elensule - Original message - From: Nick Balestra n...@beyounic.com To: php-general@lists.php.net php-general@lists.php.net Date: Sunday, May 2, 2010, 5:41:07 PM Subject: [PHP] Joomla FrameWork :: I am trying to understand how the joomla framework works, i see an heavy usage of:: in its code, here an example: function edit () { JRequest::setVar('view, 'single'); $this -display(); } from my really basic php understanding in the function edit i call a function setVar() and i pass the paramter 'view' and 'single' in it then the output ($this) is passed to the display() function. My question is what does :: means? an more precisely referring to the example: JRequest::setVar('view, 'single'); how do you read it and how do you manage it? Cheers, Nick -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] A stupid question about classes
Hello everyone, Just a basic question. I have my class starting like this: Class OireMail { // these are required public $smtp_server=; public $domain=; public $from=; public $login=; public $pass=; And then go the function themselves. I was told that it's better to put the initial variables in the __construct() function. What are the advantages of doing that and if I need to do it, how would I call the class from another file then? Thanks! -- With best regards from Ukraine, Andre Http://oire.org/ - The Fantasy blogs of Oire Skype: Francophile; WlmMSN: arthaelon @ yandex.ru; Jabber: arthaelon @ jabber.org Yahoo! messenger: andre.polykanine; ICQ: 191749952 Twitter: http://twitter.com/m_elensule -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php