[PHP] Securing PHP Web Applications book
Hi, did anybody read the book Securing PHP Web Applications by Tricia Ballad William Ballad? (http://www.amazon.com/Securing-PHP-Applications-Tricia-Ballad/dp/0321534344/ref=sr_1_1?ie=UTF8s=booksqid=1256042083sr=8-1) Any opinions? L -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How to assign eval() to variable?
short hack works like a charm! :-) thanks! afan oorza...@gmail.com wrote: short hack, assuming your eval echo's out to the browser (which I can't see how else you'd expect something to 'return' from an eval'd statement ob_start(); eval($foo); $result = ob_get_clean(); On May 23, 2009 1:46am, Afan Pasalic a...@afan.net wrote: hi, I have on one website boxes with information, pulled from mysql. the content can be string, php code, url of other website or url to specific file etc. currently, I have something like this: // connect to db // mysql_query() to get box content and content_type switch($content_type) { case 'string': echo $content; break; case 'php_code': eval($content); break; case 'website': echo ''.$content.'; break; case 'file' require_once($file); echo $file_content; // etc. } but, now I have to change the code to assign content to variable and the variable will be printed later. I tried something like this: switch($content_type) { case 'string': $record = $content; break; case 'php_code': $record = eval($content); break; case 'website': $record = ''.$content.'; break; case 'file' require_once($file); $record = $file_content; // etc. } and it works - except eval() part. cant do $record = eval($content); ?!?!?!? thanks afan -- 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] How to assign eval() to variable?
hi, I have on one website boxes with information, pulled from mysql. the content can be string, php code, url of other website or url to specific file etc. currently, I have something like this: // connect to db // mysql_query() to get box content and content_type switch($content_type) { case 'string': echo $content; break; case 'php_code': eval($content); break; case 'website': echo 'iframe'.$content.'/iframe; break; case 'file' require_once($file); echo $file_content; // etc. } but, now I have to change the code to assign content to variable and the variable will be printed later. I tried something like this: switch($content_type) { case 'string': $record = $content; break; case 'php_code': $record = eval($content); break; case 'website': $record = 'iframe'.$content.'/iframe; break; case 'file' require_once($file); $record = $file_content; // etc. } and it works - except eval() part. cant do $record = eval($content); ?!?!?!? thanks afan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] password field validation
Andrew Ballard wrote: On Thu, Mar 12, 2009 at 3:05 PM, Jason Todd Slack-Moehrle mailingli...@mailnewsrss.com wrote: Hi All, I have an input field with type=password. I am trying to do some error checking to see if the user puts a value in after they submit the form (i.e not left it blank) Here is what I have: on form: Password: input id=PASSWORD name=PASSWORD type=password size=15 In PHP error checking: if (empty($_POST[PASSSWORD])) { $GERROR=TRUE;} even though I am putting characters in the field before I submit I am always getting TRUE returned. This same tactic works for other fields I have that I need to make sure they put values in, just I have never done this before with a password field. What am I doing wrong? I just want to make sure they put something there! -Jason If that's a direct copy/paste from your actual code, there is an extra S in PASSWORD. Also, you should enclose the array key in quotes: if (empty($_POST['PASSWORD'])) { $GERROR='TRUE'; } Andrew try if trim() gives you any different result: if (empty(trim($_POST['PASSWORD']))) { $GERROR='TRUE'; } afan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] password field validation
Jochem Maas wrote: Afan Pasalic schreef: Andrew Ballard wrote: On Thu, Mar 12, 2009 at 3:05 PM, Jason Todd Slack-Moehrle mailingli...@mailnewsrss.com wrote: Hi All, I have an input field with type=password. I am trying to do some error checking to see if the user puts a value in after they submit the form (i.e not left it blank) Here is what I have: on form: Password: input id=PASSWORD name=PASSWORD type=password size=15 In PHP error checking: if (empty($_POST[PASSSWORD])) { $GERROR=TRUE;} even though I am putting characters in the field before I submit I am always getting TRUE returned. This same tactic works for other fields I have that I need to make sure they put values in, just I have never done this before with a password field. What am I doing wrong? I just want to make sure they put something there! -Jason If that's a direct copy/paste from your actual code, there is an extra S in PASSWORD. Also, you should enclose the array key in quotes: if (empty($_POST['PASSWORD'])) { $GERROR='TRUE'; } Andrew try if trim() gives you any different result: if (empty(trim($_POST['PASSWORD']))) { $GERROR='TRUE'; } definitely gives a different result. $ php -r ' $r = ; var_dump(empty(trim($r)));' PHP Fatal error: Can't use function return value in write context in Command line code on line 2 you can only pass variables to empty() *not* expressions. :-) yup... didn't think that way... though, I was giving an idea $password = trim($_POST['PASSWORD']); if (empty($password) { $GERROR='TRUE'; } ;-) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] password field validation
haliphax wrote: On Thu, Mar 12, 2009 at 2:39 PM, Jason Todd Slack-Moehrle mailingli...@mailnewsrss.com wrote: if (empty($_POST[PASSSWORD])) { $GERROR=TRUE;} If that's a direct copy/paste from your actual code, there is an extra S in PASSWORD. Also, you should enclose the array key in quotes: if (empty($_POST['PASSWORD'])) { $GERROR='TRUE'; } It is official I am a DOPE! Thank you, yes, I did not see the SSS in an hour of looking! Why enclose in quotes? I have never done this! Because if it's not in quotes, you run the risk of colliding with one of PHP's reserved words/constants/etc. I would use $GERROR = false; if (empty($_POST['PASSWORD'])) { $GERROR = true;} -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] multiple choice dropdown box puzzle
PJ wrote: I think this is a tough one... and way above my head: PLEASE READ ALL OF THE ABOVE TO UNDERSTAND WHAT I AM TRYING TO DO. Having a bit of a rough time figuring out how to formulate php-mysql to insert data into fields using a multiple dropdown box in a form. to post I am using the following: snip... $categoriesIN = $_POST[categoriesIN]; ...snip... select name=$categoriesIN[] multiple=multiple OPTIONChoose Categories.../option OPTION VALUE=? echo $categoriesIN; ?1 OPTION VALUE=? echo $categoriesIN; ?2 OPTION VALUE=? echo $categoriesIN; ?3 OPTION VALUE=? echo $categoriesIN; ?4 OPTION VALUE=? echo $categoriesIN; ?5 /SELECT ...snip... $sql4 = FOR ( $ii = 0 ; $ii count($categoriesIN) ; $ii++ ) INSERT INTO temp (example) $categoriesIN[$ii] ; $result4 = mysql_query($sql4, $db); ...snip this does not work! The other posts work like a charm... but this... I cannot figure out what I should be entering where... I have tried several different configurations, but nothing seems to work... I found this as a model for entering the selections but can't figure out how to modify it for my needs: select name=branch_no[] multiple=multiple size=5 option Choose your location(s) /option option value=31003100/option option value=31053105/option option value=3503 3503/option option value=3504 3504/option /select What I would like to do is something like the following: select name=$categoriesIN[] multiple=multiple OPTIONChoose Categories.../option OPTION VALUE=1History OPTION VALUE=2Temples OPTION VALUE=2Pharaohs and Queens OPTION VALUE=4Cleopatra OPTION VALUE=4Mummies /SELECT and going further, I would like to be able to use a table that actually holds these values to feed them to the code above. I am sure this is possible but it must take some huge knowledge and experience to do it. BUT ... as I look at things, I am wondering if the FOR statement in the above should be used to do several INSERTs, that is, one $sql(number) per selected category... now, would that require many $sqls or many INSERTs within the $sql ? first, I think, $categoriesIN is string, but in the form you made it as an array $categoriesIN[]. I think you have to modify it a little bit, something like {$categoriesIN}.'[]' second, I think the php part FOR ( $ii = 0 ; $ii count($categoriesIN) ; $ii++ ) can't be part of the mysql statement, it should be outside the statement FOR ( $ii = 0 ; $ii count($categoriesIN) ; $ii++ ) { $sql4 = INSERT INTO temp (example) $categoriesIN[$ii] ; $result4 = mysql_query($sql4, $db); } afan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] is this use of subquery smart
What would be more appropriate way to create a query: Solution 1: select records from registrants table SELECT r.reg_id, r.date_registered, r.old_record FROM registrants r WHERE r.org_id=12 AND r.reg_status=0 AND r.reg_id=r.person_id # php validation if($old_record != 0) { SELECT CONCAT(people.last_name, ', ', people.first_name) FROM people, registrants WHERE people.instance_id=12 AND people.person_id=registrants.person_id AND registrants.reg_id=r.ghost_record } this way 2nd query will be executed only if old_record is zero (let's say 10% - 20% of all records) Solution 2: SELECT r.reg_id, r.date_registered, r.old_record, if(r.ghost_record!=0, (SELECT CONCAT(people.last_name, ', ', people.first_name) FROM people, registrants WHERE people.instance_id=12 and people.person_id=registrants.person_id AND registrants.reg_id=r.ghost_record), 'y') as registered_by_name FROM registrants r WHERE r.org_id=12 AND r.reg_status=0 AND r.reg_id=r.person_id this way subquery will be executed everytime, but I have everything on one place? thanks for any opinion... afan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Speed Opinion
PHP wrote: Hi all, I am seeking some knowledge, hopefully I explain this right. I am wondering what you think is faster. Say you have 1000 records from 2 different tables that you need to get from a MySQL database. A simple table will be displayed for each record, the second table contains related info for each record in table 1. Is if faster to just read all the records from both tables into two arrays, then use php to go through the array for table 1 and figure out what records from table 2 are related. Or, you dump all the data in table 1 into an array, then as you go through each record you make a database query to table 2. in general mysql is faster than php. do/select as much as you can in mysql. -afan PS: I know I can use a join, but I find anytime I use a join, the database query is extremely slow, I have tried it for each version of mysql and php for the last few years. The delay difference is in the order of 100x slower or more. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] developers life
Nathan Rixham wrote: well just for the hell of it; and because I'm feeling worn.. anybody else find the following true when you're a developer? - frequent bursts of side-tracking onto more interesting subjects - vast amount of inhuman focus, followed by inability to remain focussed - general tendancy to keep taking on projects, often for no good reason - inability to flip out of work mode at 5pm like the rest of the world -- [sub] not feeling normal unless worked you've extra; while other professions demand overtime as little as an extra 15 minutes - constant learning (positive thing) - unlimited skill scope, if its on a computer you'll give it a go - amazing ability to prioritise (the wrong things) - all projects suddenly become uninteresting and all motivation is lost at approx 65-85 percent completion - the code seems more important than the app (even though its not) - lots more but lost interest / focus You just described me! :-) afan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] search for person by comparing his data with data in mysql
hi, I have to build a little search form. a visitor enters his/her personal and work data (first name, last name, email, org. name, phones (home phone, work phone, cell) home address, work address) using a form, and then administrator has to compare these data with existing data in database (mysql). if record in database has the same first name as the visitor, the record will get 1 point. if the last name is the same - 3 points. if both names are the same - clearly 4 points. if email matches 7 points, phone number 4 points, etc. the list to be shown on the screen is list of all records they have at least 1 point. and the list has to be sorted by number of points. also, matching parts on the list have to be highlighted (with different background color, of the font different color). I did some testing and the code is really basic, using LIKE, and I'm assuming not so good way. first, I'll get all records from database. while reading I compare data from DB with visitor's data. my query (simplified) looks something like this $query = SELECT p.person_id, p.first_name, p.last_name, p.phone as phone_home, p.primary_org, p.address_id, p.email as personal_email, o.full_name, o.organization_id, o.phone as phone_work, o.address_id as org_address, a.address1, a.city, a.state, a.zip, a.county FROM people p LEFT JOIN organization o ON (o.instance=.$_SESSION['instance']. AND o.organization_id=p.organization_id) LEFT JOIN addresses a ON (a.entity_id=o.organization_id AND a.instance=.$_SESSION['instance'].) WHERE p.instance_id=.$_SESSION['instance']. AND m.instance_id=.$_SESSION['instance']. AND p.person_id = .$_SESSION['person_id']. AND o.active='Y' AND ( p.last_name LIKE '%.mysql_real_escape_string($person['last_name']).%' OR o.email_address = '.mysql_real_escape_string($person['email_address']).' OR p.email = '.mysql_real_escape_string($person['email']).' ; if (!empty($phone_home)) { $query .= OR p.phone = '.$person['phone'].'; } if (!empty($person['phone'])) { $query .= OR o.phone = '.$person['phone'].'; } if (!empty($person['org_name'])) { $query .= OR o.full_name LIKE '%.mysql_real_escape_string($person['org_name']).%'; } $query .= ) ORDER BY p.last_name ASC, p.first_name ASC ; $myquery = mysql_query($query); while($result = mysql_fetch_array($myquery)) { # I compare record with visitor's data and assign points to $RANK[$result['person_id']] # if there is at least one match assign the record to an array $RECORDS['person_id'] } then sort $RANK desc and then list sorted array $RANK on screen with matching $RECORDS elements. It works but it could take 10-15 seconds to create the list if database has e.g. 10,000 records anybody had the same or similar project? I'll appreciate any suggestion. how to setup database (mysql) and the best way to do the search code (php). thanks for any help. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Displaying information from table graphically
[EMAIL PROTECTED] wrote: I have a PHP application that accesses data from MySQL. There is table called rooms, and table called beds. There is another table called patients. Patients are being placed into beds, and beds are in the rooms. PHP application currently displays all information in textual mode via regular HTML tags. But I would like to have that information displayed in graphical mode instead of textual mode. Is there a way to display this information from the database graphically. Graphic would represent a room, and it would contain beds inside. You would be able to see visually which beds are occupied and which are free by looking at the graphics. User of the system wants pictures instead of text displayed via HTML tables as a list of entries. Anyone knows anything like this? Thanks, Dzenan general idea: in mysql you have marked beds with 0 not occupied and 1 occupied. then you have two images: bed_occupied_0.gif and bed_occupied_1.gif and, depending on record from mysql different image should be shown. same with number of beds in room. for example. there is 4 beds maximum per room. you have 5 images no_of_beds_0.gif (actually, this is a transparent 1x1 gif) images no_of_beds_1.gif images no_of_beds_2.gif images no_of_beds_3.gif images no_of_beds_4.gif $query = mysql_qurey(select no_of_beds from beds where room=123; $result = mysql_fetch_assoc($query); echo img src=images/no_of_beds_.$result['no_of_beds']..gif border=0 /; something like that. -afan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] how to kill a session by closing window or tab clicking on X?
hi. I'm sorry for posting this more javascript then php question, but it's somehow php related. here is the issue: very often people close the window/tab without logging out. I need solution how to recognize when [x] is clicked (or File Close) and kill the session before the window/tab is closed. few years ago, before firefox and tabs, I solved this by javascript and onClose() as a part of body tag. now, it doesn't work anymore. any suggestion/opinion/experience? thanks afan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] how to kill a session by closing window or tab clicking on X?
Stut wrote: On 27 Oct 2008, at 14:10, Afan Pasalic wrote: I'm sorry for posting this more javascript then php question, but it's somehow php related. here is the issue: very often people close the window/tab without logging out. I need solution how to recognize when [x] is clicked (or File Close) and kill the session before the window/tab is closed. few years ago, before firefox and tabs, I solved this by javascript and onClose() as a part of body tag. now, it doesn't work anymore. any suggestion/opinion/experience? That event should still fire regardless of whether it's a window, tab or iframe. It refers to the page closing, not the window. However, any event that fires when the user leaves a page (either by clicking on a link or closing the window) is likely to be prevented by popup blockers, so you can't rely on it working at all. A sensible session timeout is the only real solution to this issue, possibly aided by a periodic keepalive request. -Stut as you said, I was asked by pop-up blocker to allow this event. I can use it - in case there is no popup blocker but in general, as you said, can't rely on this. session timeout will do the jobe. not exactly the way I want but... thanks. afan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] web shot script
Andrew Barnett wrote: Hey Joey, I had a search, and from what I found, it would be very difficult unless you have root access to a server. Another way would be to create a HTML/CSS renderer using PHP, and then using that to take a screenshot. or, maybe, as an idea, save the page as pdf? A link from DigitalPoint http://forums.digitalpoint.com/showthread.php?t=76454 may provide some clues, or discouragement as I found. Let us know if you work out how to do it. I'd love to know. Andrew 2008/10/24 Joey [EMAIL PROTECTED] Hi Guys, Really I want to do this, not pay someone to do it via those services you linked to. So nobody has seen open source code for this? -Original Message- From: Joey [mailto:[EMAIL PROTECTED] Sent: Saturday, October 18, 2008 4:59 AM To: PHP Subject: [PHP] web shot script Hello All, Does anyone know of a script to capture web pages and store the image? Trying to see all of my sites screenshots and have it updated on occasion. Thanks! Joey -- 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] web shot script
Andrew Barnett wrote: Are you suggesting to create a PDF, and then convert from PDF to an image? I'm sorry. didn't get it has to be an image. Andrew 2008/10/24 Afan Pasalic [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] Andrew Barnett wrote: Hey Joey, I had a search, and from what I found, it would be very difficult unless you have root access to a server. Another way would be to create a HTML/CSS renderer using PHP, and then using that to take a screenshot. or, maybe, as an idea, save the page as pdf? A link from DigitalPoint http://forums.digitalpoint.com/showthread.php?t=76454 may provide some clues, or discouragement as I found. Let us know if you work out how to do it. I'd love to know. Andrew 2008/10/24 Joey [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] Hi Guys, Really I want to do this, not pay someone to do it via those services you linked to. So nobody has seen open source code for this? -Original Message- From: Joey [mailto:[EMAIL PROTECTED] mailto:[EMAIL PROTECTED]] Sent: Saturday, October 18, 2008 4:59 AM To: PHP Subject: [PHP] web shot script Hello All, Does anyone know of a script to capture web pages and store the image? Trying to see all of my sites screenshots and have it updated on occasion. Thanks! Joey -- 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: SESSION array problems UPDATE
Andrew Ballard wrote: On Thu, Oct 2, 2008 at 10:37 AM, tedd [EMAIL PROTECTED] wrote: To all: The code provided by nathan works for me as well. However, the problem is not easily explained, but I can demonstrate it -- try this: http://www.webbytedd.com/zzz/index.php * A complete listing of the code follows the demo. When the code is first loaded, the session variables are defined and populated. Proof of this is shown in the top left corner of the page, which reports: Cable Diane Ron Big Dirt Joe Now click the Continue button and you will be presented with the next step which shows a list of the SESSION variables in both the top left corner AND immediately below Step 2. Everything is righteous to there. However, the next portion of the code is the foreach loop where the first SESSION pair is output correctly, but the rest aren't. This is followed by another listing of the SESSION variables and this time is shows that they have completely disappeared. Okay gang -- what's up with that? Cut and paste the code and see for yourself. Cheers, tedd tedd, could you please in foreach loop (on your website) add one echo line: foreach( $_SESSION['user_id'] as $index = $value ) { echo '- '.$index.': '.$value.'br'; $last_name = $_SESSION['last_name'][$index]; $first_name = $_SESSION['first_name'][$index]; echo(p$index $last_name $first_name/p); } thanks -afan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] SESSION array problems [SOLVED]
tedd wrote: Hi gang: As strange as it may seem, but when session variables are passed to another page (i.e., used) you cannot extract ALL OF THEM using a loop when the variable names you are using are the same as the SESSION index's names. In other words, you cannot do this: for ($i = 0; $i $num_users; $i++) { $last_name = $_SESSION['last_name'][$i]; $first_name = $_SESSION['first_name'][$i]; echo(p$last_name $first_name/p); } But you can do this: for ($i = 0; $i $num_users; $i++) { $last = $_SESSION['last_name'][$i]; $first = $_SESSION['first_name'][$i]; echo(p$last $first/p); } See the difference? This was a crazy one. Now, someone show me where that is documented? Cheers, tedd hm. it doesn't make a sense... -afan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] SESSION array problems
tedd wrote: Hi gang: Apparently, there's something going on here that I don't understand -- this happens far too often these days. Here's a print_r($_SESSION); of the session arrays I'm using: [user_id] = Array ( [0] = 6156 [1] = 7030 [2] = 656 ) [first_name] = Array ( [0] = Diane [1] = Fred [2] = Helen ) [last_name] = Array ( [0] = Cable [1] = Cago [2] = Cahalan The following is how I tried to access the data contained in the $_SESSION arrays: $num_users = count($_SESSION['user_id']); for ($i = 0; $i $num_users; $i++) { $last_name = $_SESSION['last_name'][$i]; $first_name = $_SESSION['first_name'][$i]; echo(p$last_name, $first_name/p); } The only thing that came out correct was the first echo. The remaining echos had no values for $first_name or $last_name. What's happening here? Cheers, tedd PS: I'm open to other suggestions as to how to do this. hi tedd, if I may suggest this model $_SESSION { [6156] { [first_name]= Diane [last_name] = Cable } [7030] { [first_name]= Fred [last_name]= Cago } [656] { [first_name]= Helen [last_name]= Cahalan } } main reason - if you sort by first or last name you will lose index. this way is index always linked to first/last name. foreach ($_SESSION as $key = $value) { echo $_SESSION[$key]['last_name'].', '.$_SESSION[$key]['first_name'].'br'; } didn't test it, though :-) -afan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] SESSION array problems
tedd wrote: Hi gang: Apparently, there's something going on here that I don't understand -- this happens far too often these days. Here's a print_r($_SESSION); of the session arrays I'm using: [user_id] = Array ( [0] = 6156 [1] = 7030 [2] = 656 ) [first_name] = Array ( [0] = Diane [1] = Fred [2] = Helen ) [last_name] = Array ( [0] = Cable [1] = Cago [2] = Cahalan The following is how I tried to access the data contained in the $_SESSION arrays: $num_users = count($_SESSION['user_id']); for ($i = 0; $i $num_users; $i++) { $last_name = $_SESSION['last_name'][$i]; $first_name = $_SESSION['first_name'][$i]; echo(p$last_name, $first_name/p); } The only thing that came out correct was the first echo. The remaining echos had no values for $first_name or $last_name. What's happening here? Cheers, tedd PS: I'm open to other suggestions as to how to do this. just tested. works fine $_SESSION = array( '6156' = array( 'first_name'= 'Diane', 'last_name' = 'Cable'), '7030' = array( 'first_name'= 'Fred', 'last_name' = 'Cago'), '656' = array( 'first_name'= 'Helen', 'last_name' = 'Cahalan') ); echo 'pre'; print_r($_SESSION); foreach ($_SESSION as $key = $value) { echo $_SESSION[$key]['last_name'].', '.$_SESSION[$key]['first_name'].'br'; } -afan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: SESSION array problems
tedd wrote: What about: foreach ($_SESSION['user_id'] as $key = $value) { $last = $_SESSION['last_name'][$key]; $first = $_SESSION['first_name'][$key]; echo $last, $first; } Jay: Close, it produced: Array, Array Array, Array Array, Array Cheers, tedd then your $_SESSION is not what you think it is and print_r() output is not correct. :-) -afan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] SESSION array problems
tedd wrote: At 2:43 PM -0500 10/1/08, Afan Pasalic wrote: just tested. works fine $_SESSION = array( '6156' = array( 'first_name'= 'Diane', 'last_name' = 'Cable'), '7030' = array( 'first_name'= 'Fred', 'last_name' = 'Cago'), '656' = array( 'first_name'= 'Helen', 'last_name' = 'Cahalan') ); echo 'pre'; print_r($_SESSION); foreach ($_SESSION as $key = $value) { echo $_SESSION[$key]['last_name'].', '.$_SESSION[$key]['first_name'].'br'; } -afan -afan: That's fine, but that's not the problem. The problem is: $_SESSION['user_id'][] = '6156'; $_SESSION['first_name'][] = 'Diane'; $_SESSION['last_name'][]= 'Cable'; $_SESSION['user_id'][] = '1234'; $_SESSION['first_name'][] = 'Big'; $_SESSION['last_name'][]= 'Ron'; $_SESSION['user_id'][] = '8867'; $_SESSION['first_name'][] = 'Joe'; $_SESSION['last_name'][]= 'Dirt'; Now, how do you retrieve it? Cheers, tedd tedd, I just copied your code, created your sessions and - it works fine. http://afan.net/tedd.php code: ?php session_start(); $_SESSION['user_id'] = array(6156, 7030, 656); $_SESSION['first_name'] = array('Diane', 'Fred', 'Helen'); $_SESSION['last_name'] = array('Cable', 'Cago', 'Cahalan'); echo 'pre'; print_r($_SESSION); $num_users = count($_SESSION['user_id']); // --- this works (correct $num_users) echo ?: .$num_users.'brtable border=1'; for ($i = 0; $i $num_users; $i++) { $last_name = $_SESSION['last_name'][$i]; $first_name = $_SESSION['first_name'][$i]; echo(trtd$last_name/tdtd$first_name/td/tr); } echo '/table'; I think there is something outside your code. -afan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Robert Cummings
Daniel Brown wrote: All: What was pointed as a passing mention in one thread I thought was worth note in a thread of its own. As quoted by Rob: BTW, while we're off topic... my wife delivered our third child (second boy) 3 minutes after midnight yesterday :) I'd say that deserves a round of congratulations. Many - most, probably - of you know Rob from here, and have seen his help and dedication - as well as his annoying wit ;-P - offered to any and all on this list. Quite often, it's offered when you don't especially want it. Nonetheless, it's great news, and I think we should all take a moment and wonder: why the hell aren't you at the hospital with your wife and newborn son, Rob? ;-P Congrats to the Cummings family! Best wishes to whole Cummings family! Keep well, healthy and lot of fun! -afan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] how to recognize CSV file?
Ashley Sheridan wrote: On Fri, 2008-09-19 at 14:24 -0500, Afan Pasalic wrote: Eric Butera wrote: On Fri, Sep 19, 2008 at 3:14 PM, Afan Pasalic [EMAIL PROTECTED] wrote: Eric Butera wrote: On Fri, Sep 19, 2008 at 2:59 PM, Afan Pasalic [EMAIL PROTECTED] wrote: hi, I have form where administrator has toupload csv file to update dome data in mysql. I was trying to validate entered file but got some crazy stuff I don't understand: for the same uploaded csv file, in different browser I'll get different results: Windows machine and IE: $_FILES['UploadedFile']['type'] = 'text/plain' Windows machine and Firefox: $_FILES['UploadedFile']['type'] = 'application/octet-stream' Windows machine and Opera: $_FILES['UploadedFile']['type'] = 'comma-separated-values' Windows machine and Chrome: $_FILES['UploadedFile']['type'] = '' (doesn't show anything! empty?!?!!??) openSuse machine and Firefox: $_FILES['UploadedFile']['type'] = 'text/csv' openSuse machine and Opera: $_FILES['UploadedFile']['type'] = 'text/comma-separated-values' openSuse machine and Konqueror: $_FILES['UploadedFile']['type'] = 'text/csv' ok. what's CORRECT way to validate uploaded file? thanks. -afan Get the mime type of the uploaded tmp file, no what the browser sends. Fatal error: Call to undefined function mime_content_type() in /srv/www/... it looks like Mimetype is not installed on my server :-) Do you have fileinfo? It's a php5 pecl extension. Aside from that I'm not really sure. This is how I always test files since browser mime type is unreliable/spoofable. Fatal error: Call to undefined function finfo_open() in /srv/www/... no luck :-) If you don't have access to the functions, you could try reading the first line of the file to determine it's in the right format. could you please be more specific? I don't remember I ever saw file type when I was opening csv or txt or doc file? -afan Ash www.ashleysheridan.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] how to recognize CSV file?
hi, I have form where administrator has toupload csv file to update dome data in mysql. I was trying to validate entered file but got some crazy stuff I don't understand: for the same uploaded csv file, in different browser I'll get different results: Windows machine and IE: $_FILES['UploadedFile']['type'] = 'text/plain' Windows machine and Firefox: $_FILES['UploadedFile']['type'] = 'application/octet-stream' Windows machine and Opera: $_FILES['UploadedFile']['type'] = 'comma-separated-values' Windows machine and Chrome: $_FILES['UploadedFile']['type'] = '' (doesn't show anything! empty?!?!!??) openSuse machine and Firefox: $_FILES['UploadedFile']['type'] = 'text/csv' openSuse machine and Opera: $_FILES['UploadedFile']['type'] = 'text/comma-separated-values' openSuse machine and Konqueror: $_FILES['UploadedFile']['type'] = 'text/csv' ok. what's CORRECT way to validate uploaded file? thanks. -afan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] how to recognize CSV file?
Eric Butera wrote: On Fri, Sep 19, 2008 at 3:14 PM, Afan Pasalic [EMAIL PROTECTED] wrote: Eric Butera wrote: On Fri, Sep 19, 2008 at 2:59 PM, Afan Pasalic [EMAIL PROTECTED] wrote: hi, I have form where administrator has toupload csv file to update dome data in mysql. I was trying to validate entered file but got some crazy stuff I don't understand: for the same uploaded csv file, in different browser I'll get different results: Windows machine and IE: $_FILES['UploadedFile']['type'] = 'text/plain' Windows machine and Firefox: $_FILES['UploadedFile']['type'] = 'application/octet-stream' Windows machine and Opera: $_FILES['UploadedFile']['type'] = 'comma-separated-values' Windows machine and Chrome: $_FILES['UploadedFile']['type'] = '' (doesn't show anything! empty?!?!!??) openSuse machine and Firefox: $_FILES['UploadedFile']['type'] = 'text/csv' openSuse machine and Opera: $_FILES['UploadedFile']['type'] = 'text/comma-separated-values' openSuse machine and Konqueror: $_FILES['UploadedFile']['type'] = 'text/csv' ok. what's CORRECT way to validate uploaded file? thanks. -afan Get the mime type of the uploaded tmp file, no what the browser sends. Fatal error: Call to undefined function mime_content_type() in /srv/www/... it looks like Mimetype is not installed on my server :-) Do you have fileinfo? It's a php5 pecl extension. Aside from that I'm not really sure. This is how I always test files since browser mime type is unreliable/spoofable. Fatal error: Call to undefined function finfo_open() in /srv/www/... no luck :-) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Restore Leading Zeros in Zip Codes
tedd wrote: At 8:44 PM -0600 8/21/08, Keith Spiller wrote: Hi, RE: Restore Leading Zeros in Zip Codes Does anyone happen to have a script that will restore the leading zeros in a mixed data set of 5 digit zip codes and 10 digit zip+4 codes? Any suggestions? Thanks, Keith Keith: Why take them out in the first place? Keep the zip code as a string. After all, not all countries use just numbers. Cheers, tedd or, if you use US zip codes only, use ZEROFILL feature in mysql? -afan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] FCKEditor, TinyMCE, ... I need a light weight WYSIWYG HTML Editor
Warren Vail wrote: A textarea is a simple editor, I am assuming you want something better than that, or you wouldn't have looked further. I just tried Demo and got this: Sorry, you must have Internet Explorer 5.5 or higher to use the WYSIWYG editor ?!? I'm using FF. -afan Have you heard the expression (there is no free lunch), it applies here. Strictly speaking, a textarea is a wysiwyg editor, (what you see is what you get) you just don't see or get very much, one font, no formatting(other than what you can do with a carriage return, or a space bar). These editors can be very complex, but you do have some control in most of them to manage the complexity that you reveal to your users, and to do that you will have to know more about it than your users do (again, no free lunch). I like TinyMCE, it allows me to make sure that my users have a simple interface, and is real easy to setup (relative to developing the whole thing myself), but most of the ones you cite can probably fill that bill. Warren Vail -Original Message- From: mike [mailto:[EMAIL PROTECTED] Sent: Sunday, August 17, 2008 12:05 PM To: AmirBehzad Eslami Cc: php-general@lists.php.net Subject: Re: [PHP] FCKEditor, TinyMCE, ... I need a light weight WYSIWYG HTML Editor On 8/17/08, AmirBehzad Eslami [EMAIL PROTECTED] wrote: Dear list, I'm looking for a light weight WYSIWYG HTML Editor to allow users to send private messages to each other in a forum application. FCKEditor is too complex and very huge for my purposes. I want a simple editor. What do you recommend? WordPress has tweaked tinymce a lot to maintain p spacing and code snippets and embedded objects. We've tried both at my job with various configurations, both have had issues - but we've had the most success and our users have been happy with WordPress's configuration (which uses a couple custom javascript things + specific tinymce configuration) I've been trying to examine the differences so I can create a reusable standalone component we can use in all our various apps... but WP has hooked in a lot of custom code and it's been a bit annoying trying to split it out into a single reusable javascript file and stuff. Almost done though. I went overboard and tried to make it more generic by renaming and cleaning up the functions to not need any WordPress callbacks and stuff and wound up messing it up, so I have to go back again and probably re-create it from scratch.. Doh :) Honestly in a forum setting you can just give them a bbcode howto/link on the side and let them put in their own bbcode (which can be a strict subset of HTML) - or even just allow HTML tags and limit what they can do. Loading up a javascript-based thing even if it's pretty lightweight is still annoying and I could see that being overkill for a forum. -- 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] changing order of items
this one bugs me for a while. how to change order. I have a list of tasks. by status, task could be 1 (todo) or 0 (done) - status value stored in mysql. I can list tasks per status or all. order number is stored in mysql too. the easiest way to change order is to have form for each task where you will enter manually number and then submit (one submit button for whole form). but, if you change order number for any task you have to change then all order numbers below the task manually solution with arrows (or up/down buttons) where you click on arrow and the task switch the place with its neighbor is easy and fancy. Though, I get in trouble if, e.g. tasks 10, 11, 12, and 13 change status from 1 to 0 and I have to move task 14 to place 6. I have to click first 4 times (to switch places with tasks 13, 12, 11, and 10) - but nothing is actually happening on screen (of course) before start switching places with 9, 8, 7, and 6. how do you avoid this gap? what solution do you use at all? thanks for any help. -afan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] changing order of items
Iv Ray wrote: afan pasalic wrote: this one bugs me for a while. how to change order. I have a list of tasks. by status, task could be 1 (todo) or 0 (done) - status value stored in mysql. I can list tasks per status or all. order number is stored in mysql too. the easiest way to change order is to have form for each task where you will enter manually number and then submit (one submit button for whole form). but, if you change order number for any task you have to change then all order numbers below the task manually solution with arrows (or up/down buttons) where you click on arrow and the task switch the place with its neighbor is easy and fancy. Though, I get in trouble if, e.g. tasks 10, 11, 12, and 13 change status from 1 to 0 and I have to move task 14 to place 6. I have to click first 4 times (to switch places with tasks 13, 12, 11, and 10) - but nothing is actually happening on screen (of course) before start switching places with 9, 8, 7, and 6. how do you avoid this gap? what solution do you use at all? You have two different issues - a) how to execute the change, and b) what interface to provide. To execute the change, basically you have to reorder. The best algorithm is question of mathematics - you can implement something and improve it independently from the interface. As for the interface, the first is kind of the simplest, but somehow primitive. The second is a bit better, but you have noticed, not much better. The most elegant, considering the time we live in, would be drag drop AJAX (here - http://tool-man.org/examples/, there are excellent examples, perhaps there are more). It's also a question if tasks really need to be reordered manually. If all tasks have a deadline, you might sort them by date. If some don't, you can provide them unsorted, until they get one. Sorting tasks by moving them up/down works when you have 25 tasks, but it does not work when you have 50, 100, 1 000 (if you are a team leader and have 5-7 people team) - in that case sort by date might be better. If you get more advanced, and store time needed to complete a task, you could automatically shift all tasks (of a person) - when one gets delayed or takes longer, than planned. Hope that helps, Iv thanks Iv, though, in my case, the task list will never be more then 25 and we can talk about small list. and, I need to sort them by order_no (bitter to say priority_no) thanks for link. the Dag Drop sortable list is really cool! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] changing order of items
Eric Butera wrote: On Thu, May 15, 2008 at 2:49 PM, afan pasalic [EMAIL PROTECTED] wrote: Iv Ray wrote: afan pasalic wrote: this one bugs me for a while. how to change order. I have a list of tasks. by status, task could be 1 (todo) or 0 (done) - status value stored in mysql. I can list tasks per status or all. order number is stored in mysql too. the easiest way to change order is to have form for each task where you will enter manually number and then submit (one submit button for whole form). but, if you change order number for any task you have to change then all order numbers below the task manually solution with arrows (or up/down buttons) where you click on arrow and the task switch the place with its neighbor is easy and fancy. Though, I get in trouble if, e.g. tasks 10, 11, 12, and 13 change status from 1 to 0 and I have to move task 14 to place 6. I have to click first 4 times (to switch places with tasks 13, 12, 11, and 10) - but nothing is actually happening on screen (of course) before start switching places with 9, 8, 7, and 6. how do you avoid this gap? what solution do you use at all? You have two different issues - a) how to execute the change, and b) what interface to provide. To execute the change, basically you have to reorder. The best algorithm is question of mathematics - you can implement something and improve it independently from the interface. As for the interface, the first is kind of the simplest, but somehow primitive. The second is a bit better, but you have noticed, not much better. The most elegant, considering the time we live in, would be drag drop AJAX (here - http://tool-man.org/examples/, there are excellent examples, perhaps there are more). It's also a question if tasks really need to be reordered manually. If all tasks have a deadline, you might sort them by date. If some don't, you can provide them unsorted, until they get one. Sorting tasks by moving them up/down works when you have 25 tasks, but it does not work when you have 50, 100, 1 000 (if you are a team leader and have 5-7 people team) - in that case sort by date might be better. If you get more advanced, and store time needed to complete a task, you could automatically shift all tasks (of a person) - when one gets delayed or takes longer, than planned. Hope that helps, Iv thanks Iv, though, in my case, the task list will never be more then 25 and we can talk about small list. and, I need to sort them by order_no (bitter to say priority_no) thanks for link. the Dag Drop sortable list is really cool! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php I use this: http://developer.yahoo.com/yui/examples/dragdrop/dd-reorder.html This one is good too. But, actually, I need something more simple. Nothing fancy :D. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] transfer list in textarea to comma delimited string
hi, I have one textarea field in a registration form where visitor enters keywords. even there is a not next to the field please enter keywords as comma delimited string, they enter as a list, below each other. I tried to convert the list into comma delimited string with several solutions but non of them works: $keywords = eregi_replace('\n', '.', $keywords); $keywords = eregi_replace('\r', '.', $keywords); $keywords = eregi_replace('\n\r', '.', $keywords); $keywords = eregi_replace('br', '.', $keywords); any help here? thanks -afan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] transfer list in textarea to comma delimited string
Stut wrote: On 2 May 2008, at 16:22, afan pasalic wrote: I have one textarea field in a registration form where visitor enters keywords. even there is a not next to the field please enter keywords as comma delimited string, they enter as a list, below each other. I tried to convert the list into comma delimited string with several solutions but non of them works: $keywords = eregi_replace('\n', '.', $keywords); $keywords = eregi_replace('\r', '.', $keywords); $keywords = eregi_replace('\n\r', '.', $keywords); $keywords = eregi_replace('br', '.', $keywords); any help here? 1) str_replace is more than capable of doing this in a single statement - a regex is overkill. 2) You need to use double quotes around escape sequences (\n and \r) or they'll be ignored. $replacements = array(\r, \n, \n\r, 'br'); $keywords = str_replace($replacements, '.', $keywords); -Stut works like a charm! :D thanks stut! -afan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] check if any element of an array is not empty
hi, as a result of one calculation I'm receiving an array where elements could be 0 or date (as string -mm-dd hh:ii:ss). I have to check if any of elements of the array is date or if all elements of the array is 0? If I try array_sum($result) I'll get 0 no matter what (0 + $string = 0). I know I can do something like: foreach($result as $value) { if ($value !=0) { $alert = true; } } or if (in_array($result, '-')) { $alert = true; } but I was thinking if there is the function does that. thanks for any help. -afan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] check if any element of an array is not empty
yup! that's the one :D thanks richard Richard Heyes wrote: but I was thinking if there is the function does that. array_filter(). Note this: If no callback is supplied, all entries of input equal to FALSE (see converting to boolean) will be removed. http://uk3.php.net/manual/en/function.array-filter.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] need opinions regarding php.ini
That was my thought too, but, when I create new folder - it will automatically create php.ini inside and there is no point of deleting them. HOW insecure it is? Because, since you know there is php.ini you can easy open every of them (http://mydomain.com/gallery/images/php.ini) and look. Isn't is vulnerable point? -afan Daniel Brown wrote: On Jan 5, 2008 2:35 AM, Afan Pasalic [EMAIL PROTECTED] wrote: hi, after my host moved my account from old server (shared hosting) with php 4.4.7, mysql 4.x to new one with php 5.x and mysql 5.x. nice. they did it fast and without problems. but then I realized that every folder has it's own php.ini file?!? I talked to them (live chat) about this and they told me that is how our system is setup: ... afan [20:25]: why is now different then before? [20:25]: That is not different. That has always been the case. You may not have had a php.ini in every folder, but every folder still needed its own php.ini if you wanted to change the php settings. afan [20:27]: I don't understand why I should have php.ini in every folder? it's like having admin area for each folder? [20:28]: You don't have to if you don't want to, but that is how our system is setup, so unless you don't want to change settings for all of your folders, you'll want to leave those there. afan [20:29]: ok. in case I want to change something in php.ini, how to do it on all php.ini files? [20:29]: You would change one php.ini file, then visit the link I provided, and that will show you how to copy that to all folders. ... and I got the link with script how to change EVERY php.ini on my account (with over 10 addon domain). I still think that's not correct. I need your opinion. I'm not entirely sure why your host found it necessary to provide a php.ini file in every directory, but the fact is, it's safe to delete all of them if you want. They're just there to allow you to override certain settings (INI_PERDIR settings, for example). -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] function I created doesn't work
Daniel Brown wrote: On Jan 4, 2008 12:06 PM, afan pasalic [EMAIL PROTECTED] wrote: hi I have function function get_content($client_id, $form_id, $index1) { $query = mysql_query( SELECT content FROM infos WHERE client_id=.$client_id. AND form_id=.$form_id. AND index1='.$index1.'); if (mysql_num_rows($query) 0) { $result = mysql_fetch_assoc($query); return $result['content']; } else { get_content(0, 0, $index1); // get default value } } When I call it $CONTENT = get_content(12, 104, 'merchant'); echo $CONTENT; // empty, nothing But if I use global in the function function get_content($client_id, $form_id, $index1) { global $CONTENT; $query = mysql_query( SELECT content FROM infos WHERE client_id=.$client_id. AND form_id=.$form_id. AND index1='.$index1.'); if (mysql_num_rows($query) 0) { $result = mysql_fetch_assoc($query); $CONTENT = $result['content']; } else { get_content(0, 0, $index1); } } get_content(12, 104, 'merchant'); echo $CONTENT; # Shows correct. What's wrong with first solution? Thanks for any help. Functions only use variables within their own scope, unless explicitly told to consider a variable as a global (or if the variable is a SUPERGLOBAL). not quite sure I understand?!? :( -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] function I created doesn't work
hi I have function function get_content($client_id, $form_id, $index1) { $query = mysql_query( SELECT content FROM infos WHERE client_id=.$client_id. AND form_id=.$form_id. AND index1='.$index1.'); if (mysql_num_rows($query) 0) { $result = mysql_fetch_assoc($query); return $result['content']; } else { get_content(0, 0, $index1); // get default value } } When I call it $CONTENT = get_content(12, 104, 'merchant'); echo $CONTENT; // empty, nothing But if I use global in the function function get_content($client_id, $form_id, $index1) { global $CONTENT; $query = mysql_query( SELECT content FROM infos WHERE client_id=.$client_id. AND form_id=.$form_id. AND index1='.$index1.'); if (mysql_num_rows($query) 0) { $result = mysql_fetch_assoc($query); $CONTENT = $result['content']; } else { get_content(0, 0, $index1); } } get_content(12, 104, 'merchant'); echo $CONTENT; # Shows correct. What's wrong with first solution? Thanks for any help. -afan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] function I created doesn't work
Samuel Vogel wrote: Explanation of your code: $CONTENT = get_content(12, 104, 'merchant'); echo $CONTENT; This does not work, because you don't use a return in your function. This means that the function does not return a value. Now in the function you assign a value to $CONTENT. That works, as you pointed out with the second example. But after that the line above sets $CONTENT to the empty return value of the function. And therefore it is empty! so long, Samy Sorry for confusing with 2nd function. Let's take it out, forget about it. function get_content($client_id, $form_id, $index1) { $query = mysql_query( SELECT content FROM infos WHERE client_id=.$client_id. AND form_id=.$form_id. AND index1='.$index1.'); if (mysql_num_rows($query) 0) { $result = mysql_fetch_assoc($query); return $result['content']; } else { get_content(0, 0, $index1); // get default value } } $CONTENT = get_content(12, 104, 'merchant'); echo $CONTENT; // empty, nothing There is return, right after $result = mysql_fetch_assoc($query); Some additional info (hopefully will not confuse again :)) I'm pulling content from table infos for specific client, form and index1. If there is no record I'm using recursive part (inside else) to get the default value (client_id=0, form_id=0). When echo the content right before return I can see it. But can't see it in echo after calling the function?!?! thanks -afan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] function I created doesn't work
Daniel Brown wrote: On Jan 4, 2008 12:28 PM, afan pasalic [EMAIL PROTECTED] wrote: Daniel Brown wrote: On Jan 4, 2008 12:06 PM, afan pasalic [EMAIL PROTECTED] wrote: hi I have function function get_content($client_id, $form_id, $index1) { $query = mysql_query( SELECT content FROM infos WHERE client_id=.$client_id. AND form_id=.$form_id. AND index1='.$index1.'); if (mysql_num_rows($query) 0) { $result = mysql_fetch_assoc($query); return $result['content']; } else { get_content(0, 0, $index1); // get default value } } When I call it $CONTENT = get_content(12, 104, 'merchant'); echo $CONTENT; // empty, nothing But if I use global in the function function get_content($client_id, $form_id, $index1) { global $CONTENT; $query = mysql_query( SELECT content FROM infos WHERE client_id=.$client_id. AND form_id=.$form_id. AND index1='.$index1.'); if (mysql_num_rows($query) 0) { $result = mysql_fetch_assoc($query); $CONTENT = $result['content']; } else { get_content(0, 0, $index1); } } get_content(12, 104, 'merchant'); echo $CONTENT; # Shows correct. What's wrong with first solution? Thanks for any help. Functions only use variables within their own scope, unless explicitly told to consider a variable as a global (or if the variable is a SUPERGLOBAL). not quite sure I understand?!? :( The fundamentals of PHP (and general programming): working with globals. Specifically for PHP, some required reading: http://us.php.net/global I think you didn't understand my question: I know why the function work in 2nd example. My question was why I'm not getting the result in 1st example? What am I doing wrong. And, as far as I know, I think it doesn't have anything with GLOBALS (register_globals are anyway turned off). thanks -afan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] function I created doesn't work
Daniel Brown wrote: On Jan 4, 2008 12:52 PM, afan pasalic [EMAIL PROTECTED] wrote: I think you didn't understand my question: I know why the function work in 2nd example. My question was why I'm not getting the result in 1st example? What am I doing wrong. And, as far as I know, I think it doesn't have anything with GLOBALS (register_globals are anyway turned off). Also, keep in mind that, in the else{} clause of the first function, you're not using return; to send back the information. In my opinion, you shouldn't call a function from within its own definition because it can cause a loop if the conditions are met and the else{} clause is reached over and over again. If there is a situation where get_content(0, 0, $index1); doesn't return any rows, the function will loop eternally (that is, until PHP gets dizzy and gives up). that's recursive function and it can call itself (though, you're right, if you are not careful you can finish in loop :)). and I think I don't need return in else statement because the result to be send back is in if statement. -afan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] function I created doesn't work [SOLVED]
Daniel Brown wrote: On Jan 4, 2008 12:52 PM, afan pasalic [EMAIL PROTECTED] wrote: I think you didn't understand my question: I know why the function work in 2nd example. My question was why I'm not getting the result in 1st example? What am I doing wrong. And, as far as I know, I think it doesn't have anything with GLOBALS (register_globals are anyway turned off). Also, keep in mind that, in the else{} clause of the first function, you're not using return; to send back the information. In my opinion, you shouldn't call a function from within its own definition because it can cause a loop if the conditions are met and the else{} clause is reached over and over again. If there is a situation where get_content(0, 0, $index1); doesn't return any rows, the function will loop eternally (that is, until PHP gets dizzy and gives up). Actually, there were 2 misstakes: ?php function get_InfoContent($instance_id, $form_id, $InfoKey) { $query = mysql_query( SELECT instance_id, form_id, InfoContent FROM forms_single_info WHERE instance_id=.$instance_id. AND form_id=.$form_id. AND InfoKey='.$InfoKey.' ); if (mysql_num_rows($query) 0) { $result = mysql_fetch_assoc($query); $InfoContent = $result['InfoContent']; return $InfoContent; } else { $InfoContent = get_InfoContent(0, 0, $InfoKey); return $InfoContent; } } ? Yes, I ALSO need return in else statement because when I call the function 2nd time the first return will return to else and then the 2nd return will return to main code. :D And, I called the function 2nd time with get_InfoContent(0, 0, $InfoKey); and it should be $InfoContent = get_InfoContent(0, 0, $InfoKey); :D -afan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] function I created doesn't work
Jim Lucas wrote: afan pasalic wrote: Daniel Brown wrote: On Jan 4, 2008 12:52 PM, afan pasalic [EMAIL PROTECTED] wrote: I think you didn't understand my question: I know why the function work in 2nd example. My question was why I'm not getting the result in 1st example? What am I doing wrong. And, as far as I know, I think it doesn't have anything with GLOBALS (register_globals are anyway turned off). Also, keep in mind that, in the else{} clause of the first function, you're not using return; to send back the information. In my opinion, you shouldn't call a function from within its own definition because it can cause a loop if the conditions are met and the else{} clause is reached over and over again. If there is a situation where get_content(0, 0, $index1); doesn't return any rows, the function will loop eternally (that is, until PHP gets dizzy and gives up). that's recursive function and it can call itself (though, you're right, if you are not careful you can finish in loop :)). and I think I don't need return in else statement because the result to be send back is in if statement. -afan Trust me, you have to return in the else part, otherwise it isn't going to work! yup. you're right. didn't understand WHY I needed it there. now I got it. :D thanks jim. -afan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Posting Summary for Week Ending 4 January, 2008: php-general@lists.php.net
Guys, whatever you're doing, please stop. I'm getting tired deleting tons of emails for the last hour. If you testing something there is definitly other way than sending emails to all subscribers, right? Thanks. -afan PostTrack [Dan Brown] wrote: Posting Summary for PHP-General List Week Ending: Friday, 4 January, 2008 Messages| Bytes | Sender +-+-- 4 (100%) 4305 (100%) EVERYONE 2(0.5%) 1100(0.26%) Daniel Brown [EMAIL PROTECTED] 1(0.25%) 1532(0.36%) TG [EMAIL PROTECTED] 1(0.25%) 1673(0.39%) Miren Urkixo [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] need opinions regarding php.ini
hi, after my host moved my account from old server (shared hosting) with php 4.4.7, mysql 4.x to new one with php 5.x and mysql 5.x. nice. they did it fast and without problems. but then I realized that every folder has it's own php.ini file?!? I talked to them (live chat) about this and they told me that is how our system is setup: ... afan [20:25]: why is now different then before? [20:25]: That is not different. That has always been the case. You may not have had a php.ini in every folder, but every folder still needed its own php.ini if you wanted to change the php settings. afan [20:27]: I don't understand why I should have php.ini in every folder? it's like having admin area for each folder? [20:28]: You don't have to if you don't want to, but that is how our system is setup, so unless you don't want to change settings for all of your folders, you'll want to leave those there. afan [20:29]: ok. in case I want to change something in php.ini, how to do it on all php.ini files? [20:29]: You would change one php.ini file, then visit the link I provided, and that will show you how to copy that to all folders. ... and I got the link with script how to change EVERY php.ini on my account (with over 10 addon domain). I still think that's not correct. I need your opinion. Thanks. -afan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] handling ' with mysql/php insert and select
Adam Williams wrote: In my form, I am parsing all the text inputs through mysql_real_escape_string() before inserting the data. however, when I look at the SQL query in PHP, when I type the word blah's to my text box variable, and then insert it into mysql after being ran through mysql_real_escape_string(), it does: insert into contract (contract_id, responsibility) VALUES (15, 'blah\\\'s') and when I query the in mysql/PHP it shows: select responsibility from contract where contract_id = 15; ++ | responsibility | ++ | blah\'s| ++ 1 row in set (0.00 sec) and when I run that select statement in PHP it prints blah\'s on the screen. I want it to print back blah's without the \. So what are my options? run every variable through stripslashes(); before printing them to the screen? If you have access to php.ini turn the magic_quotes_gpc off. If not, then you have to use one of examples on http://us.php.net/manual/en/function.get-magic-quotes-gpc.php -afan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] First stupid post of the year.
tedd wrote: At 1:46 PM -0500 1/2/08, Nathan Nobbe wrote: On Jan 2, 2008 1:34 PM, tedd mailto:[EMAIL PROTECTED][EMAIL PROTECTED] wrote: nbsp; nbsp; nbsp; nbsp;Anbsp; nbsp; nbsp; nbsp; (it's there to make a submit button wider) why dont you just style the button w/ css? style=width:200px -nathan -nathan: Have you tried that? I have, and it don't work. I can create wider buttonwhatever/button but I cannot create a wider input type=submit value=A submit button. Cheers, tedd Yes you can: input type=submit value=A style=width: 25px; height: 10px; -afan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] First stupid post of the year.
Daniel Brown wrote: On Jan 2, 2008 2:05 PM, tedd [EMAIL PROTECTED] wrote: At 1:57 PM -0500 1/2/08, Daniel Brown wrote: On Jan 2, 2008 1:34 PM, tedd [EMAIL PROTECTED] wrote: from this: nbsp; nbsp; nbsp; nbsp;Anbsp; nbsp; nbsp; nbsp; to this A ? // Your existing code here $submit = trim(str_replace('nbsp;','',$submit); ? Even with adding an additional ), that didn't work either. :-) That was a typo on my part, but check it out here and you'll see it works (you can view full source there, too): http://pilotpig.net/code-library/tedds-button.php Since you don't use nbsp; any more input type=submit name=submit value=A style=width:160px;align:center;text-align:center; / you don't need $submit = trim(str_replace('nbsp;','',$submit)); right? Also (fine tuning :)), I think you don't need whole ... style=width:160px;align:center;text-align:center; / Just ... style=width:160px; / because it's form button and it's by default already centered. -afan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] email authentication
Hi, I have to develop a little registration form. after the form is submitted confirmation email has to be sent to registrant. I use this function to send an email: function send_plain_email($to, $subject, $body) { $headers =MIME-Versin: 1.0\n . Content-type: text/plain; charset=ISO-8859-1; format=flowed\n . Content-Transfer-Encoding: 8bit\n . Reply-To: Registration [EMAIL PROTECTED]\n. From: Registration [EMAIL PROTECTED]\n . X-Mailer: PHP . phpversion(); mail($to, $subject, $body, $headers) or die(mysql_errno()); } Though, I'm getting the following error: Warning: mail() [function.mail]: SMTP server response: 503 This mail server requires authentication when attempting to send to a non-local e-mail address. Please check your mail client settings or contact your administrator to verify that the domain or address is defined for this server. in D:\Sites\CWIPanel\Accounts\mydomain.com\wwwroot\reservation.php on line 34 Never get such a error using LAMP. Thanks for any help, -afan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Why I sart getting Fatal error: Allowed memory size... after php upgrade?
The hosting company I have one account (and several Add Domains) upgraded php on the server from 4.4.7 to 5.2.5. After the upgrade I start getting the error message: Fatal error: Allowed memory size of 8388608 bytes exhausted (tried to allocate 122880 bytes) in... on domains they use Gallery2 or are CMS (Joomla or Drupal) based. I contacted Tech. Support (Live Chat) and he told me I have to edit memory limit in php.ini (for each domain). I asked him why it started so suddenly, did upgrade caused the problem and I got as an answer: Your scripts have begun to use more memory. That would be the only reason for this error. It doesn't make a sense to me and sounds like let's blame something else type of answer. I'm going to edit php.ini though what if client doesn't have a clue what's php.ini or how to do it? I would like to hear your opinion what caused the problem. I'll edit php.ini, I'm not going to make a big deal of it, though, I just want to know why it happened. Thanks for help. -afan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Why I sart getting Fatal error: Allowed memory size... after php upgrade?
Richard Lynch wrote: On Thu, December 20, 2007 11:37 am, afan pasalic wrote: The hosting company I have one account (and several Add Domains) upgraded php on the server from 4.4.7 to 5.2.5. After the upgrade I start getting the error message: Fatal error: Allowed memory size of 8388608 bytes exhausted (tried to allocate 122880 bytes) in... on domains they use Gallery2 or are CMS (Joomla or Drupal) based. I contacted Tech. Support (Live Chat) and he told me I have to edit memory limit in php.ini (for each domain). I asked him why it started so suddenly, did upgrade caused the problem and I got as an answer: Your scripts have begun to use more memory. That would be the only reason for this error. It doesn't make a sense to me and sounds like let's blame something else type of answer. I'm going to edit php.ini though what if client doesn't have a clue what's php.ini or how to do it? I would like to hear your opinion what caused the problem. I'll edit php.ini, I'm not going to make a big deal of it, though, I just want to know why it happened. PHP 5 uses more RAM than PHP 4, both to start up, and on a script-for-script basis. It has more features, more OO complexity, and uses more RAM, plain and simple. The PHP Dev Team increased the default/recommended memory limit from 8 M to 16 M with the release of PHP 5. I think they even documented this change, but you'll have to dig that out for yourself. Your hosting company probably kept the old php.ini without realizing that they needed to read the docs and change it. ymmv Ok. Now is clear. I'll contact them as soon as possible. Thanks Richard for your help. -afan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Why I sart getting Fatal error: Allowed memory size... after php upgrade?
Stephen Johnson wrote: It sounds to me like the allowed memory size went back to the default after they upgraded php. I usually have to update some of my config files after an upgrade. Nothing seems strange to me here... But maybe I am missing something. I'm going to edit php.ini though what if client doesn't have a clue what's php.ini or how to do it? Your clients shouldn't have a clue about the php.ini file, nor should they ever have to worry about it. However, I assume you mean the clients of the hosting company, which would be you. It is my opinion that you, as a PHP developer, have a responsibility to understand what the php.ini file is, what it does, and how to change it if necessary and you should have this knowledge before you begin writing code that would be used by anyone but yourself. Yes, I use the service of the hosting company and I'm the client. :) Also, I have (some) knowledge of what php.ini is and what I can/have/dare to change. And it's not first time I had conflict with limited memory and every time I knew what caused and how to fix it. Also, the app is not written by me, it's Gallery2 (http://www.gallery2.org/) and they can't do wrong code :) Though, what if some guy signed up for an account, installed Gallery or Joomla or Drupal through Fantastico and - got his message? of course, support will help him (do it for him) to edit php.ini, but it shouldn't happen at the first time, right? And, as I said, I don't want to make a big deal for hosting company because they are good and this is first time something came up. Just want to know why happened, what caused the error. -afan -- Stephen Johnson c | eh The Lone Coder http://www.thelonecoder.com continuing the struggle against bad code http://www.thumbnailresume.com -- From: afan pasalic [EMAIL PROTECTED] Date: Thu, 20 Dec 2007 12:37:07 -0500 To: php-general php-general@lists.php.net Subject: [PHP] Why I sart getting Fatal error: Allowed memory size... after php upgrade? The hosting company I have one account (and several Add Domains) upgraded php on the server from 4.4.7 to 5.2.5. After the upgrade I start getting the error message: Fatal error: Allowed memory size of 8388608 bytes exhausted (tried to allocate 122880 bytes) in... on domains they use Gallery2 or are CMS (Joomla or Drupal) based. I contacted Tech. Support (Live Chat) and he told me I have to edit memory limit in php.ini (for each domain). I asked him why it started so suddenly, did upgrade caused the problem and I got as an answer: Your scripts have begun to use more memory. That would be the only reason for this error. It doesn't make a sense to me and sounds like let's blame something else type of answer. I'm going to edit php.ini though what if client doesn't have a clue what's php.ini or how to do it? I would like to hear your opinion what caused the problem. I'll edit php.ini, I'm not going to make a big deal of it, though, I just want to know why it happened. Thanks for help. -afan -- 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] [SOLVED] Why I sart getting Fatal error: Allowed memory size... after php upgrade?
Richard Lynch wrote: On Thu, December 20, 2007 11:37 am, afan pasalic wrote: The hosting company I have one account (and several Add Domains) upgraded php on the server from 4.4.7 to 5.2.5. After the upgrade I start getting the error message: Fatal error: Allowed memory size of 8388608 bytes exhausted (tried to allocate 122880 bytes) in... on domains they use Gallery2 or are CMS (Joomla or Drupal) based. I contacted Tech. Support (Live Chat) and he told me I have to edit memory limit in php.ini (for each domain). I asked him why it started so suddenly, did upgrade caused the problem and I got as an answer: Your scripts have begun to use more memory. That would be the only reason for this error. It doesn't make a sense to me and sounds like let's blame something else type of answer. I'm going to edit php.ini though what if client doesn't have a clue what's php.ini or how to do it? I would like to hear your opinion what caused the problem. I'll edit php.ini, I'm not going to make a big deal of it, though, I just want to know why it happened. PHP 5 uses more RAM than PHP 4, both to start up, and on a script-for-script basis. It has more features, more OO complexity, and uses more RAM, plain and simple. The PHP Dev Team increased the default/recommended memory limit from 8 M to 16 M with the release of PHP 5. I think they even documented this change, but you'll have to dig that out for yourself. Your hosting company probably kept the old php.ini without realizing that they needed to read the docs and change it. ymmv just talked to tech. support. actually, they didn't upgrade the server I was on the moved me completely to other server that use php5. they moved all my files - original php.ini as well. :) I'm going to to add domain in Addon Domains and then copy that php.ini on other Addon Domains. Thanks for help. -afan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] how to recognize ENUM column in table?
Jim Lucas wrote: Afan Pasalic wrote: hi, I use the code from http://www.php.net/manual/en/function.mysql-fetch-field (example #1) I'm getting everything I need but can't recognize if the column is ENUM() type? e.g. column status is ENUM('0','1') or ENUM('live','hidden','archive') or something like that. I want to recognize this column and then create a form with radio buttons o 0 o 1 or o live o hidden o archive is it possible? thanks. -afan Try something like this. my table structure was CREATE TABLE `cmsws_com`.`examples` ( `col1` ENUM( '0', '1' ) NOT NULL , `col2` ENUM( 'one', 'two', 'three' ) NOT NULL ) ENGINE = MYISAM ?php # setup your db connection and stuff... $result = mysql_query(SHOW COLUMNS FROM examples); if (!$result) { echo 'Could not run query: ' . mysql_error(); exit; } if (mysql_num_rows($result) 0) { while ($row = mysql_fetch_assoc($result)) { print_r($row); } } My results were Array ( [Field] = col1 [Type] = enum('0','1') [Null] = NO [Key] = [Default] = [Extra] = ) Array ( [Field] = col2 [Type] = enum('one','two','three') [Null] = NO [Key] = [Default] = [Extra] = ) Hope this fits the bill Thanks Jim. But, I was actually looking for column type is like ENUM, with some differences. And it's SET type. -afan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] how to recognize ENUM column in table?
Jim Lucas wrote: Afan Pasalic wrote: Jim Lucas wrote: Afan Pasalic wrote: hi, I use the code from http://www.php.net/manual/en/function.mysql-fetch-field (example #1) I'm getting everything I need but can't recognize if the column is ENUM() type? e.g. column status is ENUM('0','1') or ENUM('live','hidden','archive') or something like that. I want to recognize this column and then create a form with radio buttons o 0 o 1 or o live o hidden o archive is it possible? thanks. -afan Try something like this. my table structure was CREATE TABLE `cmsws_com`.`examples` ( `col1` ENUM( '0', '1' ) NOT NULL , `col2` ENUM( 'one', 'two', 'three' ) NOT NULL ) ENGINE = MYISAM ?php # setup your db connection and stuff... $result = mysql_query(SHOW COLUMNS FROM examples); if (!$result) { echo 'Could not run query: ' . mysql_error(); exit; } if (mysql_num_rows($result) 0) { while ($row = mysql_fetch_assoc($result)) { print_r($row); } } My results were Array ( [Field] = col1 [Type] = enum('0','1') [Null] = NO [Key] = [Default] = [Extra] = ) Array ( [Field] = col2 [Type] = enum('one','two','three') [Null] = NO [Key] = [Default] = [Extra] = ) Hope this fits the bill Thanks Jim. But, I was actually looking for column type is like ENUM, with some differences. And it's SET type. -afan I must be missing something else you haven't mentioned, AFAIK this gives you the information that you are asking for. The output shows that it is telling you Type = enum(...) Isn't that what you are asking for? If it were a set type column, then it would say Type = set(...) What are the differences that you speak of / request? Oh.I'm sorry Jim. Yes, you are right. This was my first email. After this one I asked other one where was looking for column type close to ENUM() and the answer was SET() and I was thinking you replied to that one. My bad. I apologize. -afan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] how to recognize ENUM column in table?
hi, I use the code from http://www.php.net/manual/en/function.mysql-fetch-field (example #1) I'm getting everything I need but can't recognize if the column is ENUM() type? e.g. column status is ENUM('0','1') or ENUM('live','hidden','archive') or something like that. I want to recognize this column and then create a form with radio buttons o 0 o 1 or o live o hidden o archive is it possible? thanks. -afan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] how to recognize ENUM column in table?
sounds like a solution! :) thanks andrew. -afan Andrew Ballard wrote: On Dec 6, 2007 1:38 PM, Afan Pasalic [EMAIL PROTECTED] wrote: hi, I use the code from http://www.php.net/manual/en/function.mysql-fetch-field (example #1) I'm getting everything I need but can't recognize if the column is ENUM() type? e.g. column status is ENUM('0','1') or ENUM('live','hidden','archive') or something like that. I want to recognize this column and then create a form with radio buttons o 0 o 1 or o live o hidden o archive is it possible? thanks. -afan The only way I've seen to do this is to first execute the query DESCRIBE `my_table` and then examine the value of the `Type` column that is returned for the row that represents the column you are examining in your regular query. You just have to strip the 'ENUM(' and ')' from the beginning and end and then split the remaining string. Andrew -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] checkbox unchecked
I did once, if I remember once, this strategy: input type=hidden name=R_a value=n input type=checkbox name=R_a value=y ?php echo $checked ? If checked, you will have value y. Though, if unchecked, or it was checked and visitor unchecked, the value should be n. ;) -afan Ronald Wiplinger wrote: I have now tried to add many of the security hints on a web page and come to a problem. I am checking if the allowed fields match the sent fields. From the database I get the information if a checkbox is checked or not: ?php if($DB_a ==y) { $checked=checked; } else { $checked=; } ? input type=checkbox name=R_a value=y ?php echo $checked ? If the user takes out the checkmark the value will become and the field will not submitted which results in a missing field. $allowed = array(); $allowed[]='form'; $allowed[]='R_a'; $allowed[]='R_b'; $sent = $array_keys($_POST); if($allowed == $sent) { ... do some checking ... } else { echo Expected input fields do not match!; } break; How can I force a n for not checked in the input field? or how can I solve that? bye Ronald -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] including parenthesis, space and dashes in a phone number
It's ok to store it this way, but it could be a little PITA when search. E.g., you store (123) 456-7890 and somebody search for 123-456-7890? Right? -afan Daevid Vincent wrote: The kind of opposite of this, is what I use, in that it ADDs the () and - if ((strlen($phone)) = 14) $phone = preg_replace(/[^0-9]*([0-9]{3})[^0-9]*([0-9]{3})[^0-9]*([0-9]{4}).*/, (\\1) \\2-\\3, $phone); -Original Message- From: afan pasalic [mailto:[EMAIL PROTECTED] Sent: Friday, November 30, 2007 5:45 AM To: php-general Subject: [PHP] excluding parenthesis, space and dashes from phone number hi, I store phone number in mysql as integer, e.g. (123) 456-7890 is stored as 1234567890. though, in search form they usually type in a phone number with parenthesis/space/dashes. I have to extract numbers before I search through mysql. currently, I use eregi_replace() function, several times, to do the job: eregi_replace(' ', '', $phone); eregi_replace('(', '', $phone); eregi_replace(')', '', $phone); eregi_replace('-', '', $phone); and it works fine. but, is there any better way? more fancy? :) thanks for any help. -afan -- 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] excluding parenthesis, space and dashes from phone number
Jochem Maas wrote: afan pasalic wrote: hi, I store phone number in mysql as integer, e.g. (123) 456-7890 is stored as 1234567890. though, in search form they usually type in a phone number with parenthesis/space/dashes. I have to extract numbers before I search through mysql. currently, I use eregi_replace() function, several times, to do the job: eregi_replace(' ', '', $phone); eregi_replace('(', '', $phone); eregi_replace(')', '', $phone); eregi_replace('-', '', $phone); side note: if you are doing simple string relacement (as in the code above) don't use regular expression functionality to do it, it a waste. the above code will work the same if you replace 'eregi_replace' with 'str_replace' and it works fine. but, is there any better way? more fancy? :) see TGs example. I recommend doing some study on regexps - knowing abit about them and how to write a basic regexp is an invaluable tool. Got it! Thanks guys for your help. -afan thanks for any help. -afan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] excluding parenthesis, space and dashes from phone number
hi, I store phone number in mysql as integer, e.g. (123) 456-7890 is stored as 1234567890. though, in search form they usually type in a phone number with parenthesis/space/dashes. I have to extract numbers before I search through mysql. currently, I use eregi_replace() function, several times, to do the job: eregi_replace(' ', '', $phone); eregi_replace('(', '', $phone); eregi_replace(')', '', $phone); eregi_replace('-', '', $phone); and it works fine. but, is there any better way? more fancy? :) thanks for any help. -afan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] ini_set('memory_limit', '16M')
Hi, On one script (pulling large amount of data from mysql) I'm getting error: Fatal error: Allowed memory size of 16777216 bytes exhausted... I put on the beginning of the page ini_set('memory_limit', '64M'); but I'm still getting the same error message?!? Any idea? Thanks for any help. -afan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] what is better way to write the query
let me write the questions again: what is the difference between these two queries? is there any situation when it's better to use first vs. second solution? is there any suggestion for the process of inserting up to 5K records at the time or this number is so small to consider any optimization? sorry for english :-) -afan afan pasalic wrote: hi, it's maybe more question for mysql list, but since php is involved too... :-) I have php script that inserts into mysql table couple hundreds of records. usually, it looks like: ?php // 1st record $query = INSERT INTO table (col_11, col_12, ... col_1n) VALUES ($value_11, $value_12,... $value_1n ); mysql_query($query) or die ($mysql_error()); // 2nd record $query = INSERT INTO table (col_21, col_22, ... col_2n) VALUES ($value_21, $value_22,... $value_2n ); mysql_query($query) or die ($mysql_error()); ... // last record $query = INSERT INTO table (col_m1, col_m2, ... col_mn) VALUES ($value_m1, $value_m2,... $value_mn ); mysql_query($query) or die ($mysql_error()); It also works this way: $query = INSERT INTO table (col_m1, col_m2, ... col_mn) VALUES; $query .= ($value_m1, $value_m2,... $value_mn ), ; $query .= ($value_21, $value_22,... $value_2n ), ; ... $query .= ($value_m1, $value_m2,... $value_mn ); mysql_query($query) or die ($mysql_error()); is what's the difference between these two queries? is there any situations when is better to use first vs. second? any suggestion for the process of inserting up to 5K records at the time or this number is so small to consider any optimization? thanks for any help. -afan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] what is better way to write the query
hi, it's maybe more question for mysql list, but since php is involved too... :-) I have php script that inserts into mysql table couple hundreds of records. usually, it looks like: ?php // 1st record $query = INSERT INTO table (col_11, col_12, ... col_1n) VALUES ($value_11, $value_12,... $value_1n ); mysql_query($query) or die ($mysql_error()); // 2nd record $query = INSERT INTO table (col_21, col_22, ... col_2n) VALUES ($value_21, $value_22,... $value_2n ); mysql_query($query) or die ($mysql_error()); ... // last record $query = INSERT INTO table (col_m1, col_m2, ... col_mn) VALUES ($value_m1, $value_m2,... $value_mn ); mysql_query($query) or die ($mysql_error()); It also works this way: $query = INSERT INTO table (col_m1, col_m2, ... col_mn) VALUES; $query .= ($value_m1, $value_m2,... $value_mn ), ; $query .= ($value_21, $value_22,... $value_2n ), ; ... $query .= ($value_m1, $value_m2,... $value_mn ); mysql_query($query) or die ($mysql_error()); is what's the difference between these two queries? is there any situations when is better to use first vs. second? any suggestion for the process of inserting up to 5K records at the time or this number is so small to consider any optimization? thanks for any help. -afan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] what is better way to write the query
Stut wrote: afan pasalic wrote: Stut wrote: Jim Lucas wrote: afan pasalic wrote: hi, it's maybe more question for mysql list, but since php is involved too... :-) I have php script that inserts into mysql table couple hundreds of records. usually, it looks like: ?php // 1st record $query = INSERT INTO table (col_11, col_12, ... col_1n) VALUES ($value_11, $value_12,... $value_1n ); mysql_query($query) or die ($mysql_error()); // 2nd record $query = INSERT INTO table (col_21, col_22, ... col_2n) VALUES ($value_21, $value_22,... $value_2n ); mysql_query($query) or die ($mysql_error()); ... // last record $query = INSERT INTO table (col_m1, col_m2, ... col_mn) VALUES ($value_m1, $value_m2,... $value_mn ); mysql_query($query) or die ($mysql_error()); It also works this way: $query = INSERT INTO table (col_m1, col_m2, ... col_mn) VALUES; $query .= ($value_m1, $value_m2,... $value_mn ), ; $query .= ($value_21, $value_22,... $value_2n ), ; ... $query .= ($value_m1, $value_m2,... $value_mn ); mysql_query($query) or die ($mysql_error()); is what's the difference between these two queries? is there any situations when is better to use first vs. second? any suggestion for the process of inserting up to 5K records at the time or this number is so small to consider any optimization? thanks for any help. -afan I would perform multiple inserts @ a time. This way you save yourself some time by not having mysql rebuild the indexes, if any exist, after each insert statement. Indeed, but bear in mind that there is a limit on the size of queries MySQL will accept. Look up the MySQL max_packet_size for details. -Stut I didn't find max_packet_size in my my.cnf, but found max_allowed_packet - that's the same, right? Indeed, my memory ain't what it used to be. under [mysqld] max_allowed_packet = 1M shouldn't be 1M enough for the query? Depends how big it's gonna get, which is for you to judge. -Stut I'll run some tests and find what would be the best value. But, multiple inserts (solution no. 2) is the answer, right? -afan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] what is better way to write the query
Stut wrote: Jim Lucas wrote: afan pasalic wrote: hi, it's maybe more question for mysql list, but since php is involved too... :-) I have php script that inserts into mysql table couple hundreds of records. usually, it looks like: ?php // 1st record $query = INSERT INTO table (col_11, col_12, ... col_1n) VALUES ($value_11, $value_12,... $value_1n ); mysql_query($query) or die ($mysql_error()); // 2nd record $query = INSERT INTO table (col_21, col_22, ... col_2n) VALUES ($value_21, $value_22,... $value_2n ); mysql_query($query) or die ($mysql_error()); ... // last record $query = INSERT INTO table (col_m1, col_m2, ... col_mn) VALUES ($value_m1, $value_m2,... $value_mn ); mysql_query($query) or die ($mysql_error()); It also works this way: $query = INSERT INTO table (col_m1, col_m2, ... col_mn) VALUES; $query .= ($value_m1, $value_m2,... $value_mn ), ; $query .= ($value_21, $value_22,... $value_2n ), ; ... $query .= ($value_m1, $value_m2,... $value_mn ); mysql_query($query) or die ($mysql_error()); is what's the difference between these two queries? is there any situations when is better to use first vs. second? any suggestion for the process of inserting up to 5K records at the time or this number is so small to consider any optimization? thanks for any help. -afan I would perform multiple inserts @ a time. This way you save yourself some time by not having mysql rebuild the indexes, if any exist, after each insert statement. Indeed, but bear in mind that there is a limit on the size of queries MySQL will accept. Look up the MySQL max_packet_size for details. -Stut I didn't find max_packet_size in my my.cnf, but found max_allowed_packet - that's the same, right? under [mysqld] max_allowed_packet = 1M shouldn't be 1M enough for the query? -afan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] problem calling functions
yup! it works perfect. obviously, it's MY fault. :-) thanks stut -afan Stut wrote: afan pasalic wrote: actually, what example you are talking about? I got jay's example only? http://dev.stut.net/php/varfunc.php -Stut -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] problem calling functions
why then the code doesn't work? the error I'm getting is: Fatal error: Call to undefined function solution1() in ... even the function itself is just above the line that calls function? -afan Stut wrote: Jay Blanchard wrote: I don't think you can put a function name in a variable and call it like $function($var). Yes you can - it's basically the same as variable variables. -Stut -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] problem calling functions
Jay Blanchard wrote: [snip] [snip] ?php function solution1($var1){ // some code } function solution2($var2){ // some code } function solution3($var3){ // some code } if ($function == 'solution1' or $function == 'solution2' or $function == 'solution3') { $my_solution = $function($var); # this supposed to call one of solution functions, right? } ? [/snip] I don't think you can put a function name in a variable and call it like $function($var). You'd be better of with a case statement in one function and call the proper solution (quick syntax, may need a little fixing; function my_solution($function, $var){ switch $function{ case function1: ...do stuff... break; case function1: etc. } } [/snip] And call it like this; my_solution('function1', $var); actually, I did a little bit different: switch($function) { case 'solution1': solution1($var1); break; case 'solution2': solution2($var2); break; case 'solution3': solution3($var3); break; } ;-) -afan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] problem calling functions
Robin Vickery wrote: On 19/10/2007, afan pasalic [EMAIL PROTECTED] wrote: hi I have a problem with calling functions: ?php function solution1($var1){ // some code } function solution2($var2){ // some code } function solution3($var3){ // some code } if ($function == 'solution1' or $function == 'solution2' or $function == 'solution3') { $my_solution = $function($var); # this supposed to call one of solution functions, right? } ? suggestions? suggestions for what? What is your problem? If you set $function to 'solution1' and run your code, it will indeed execute solution1(). -robin the problem is that this code doesn't work. and I was asking where is the problem, or can I do it this way at all. :-) -afan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] problem calling functions
Stut wrote: afan pasalic wrote: why then the code doesn't work? the error I'm getting is: Fatal error: Call to undefined function solution1() in ... even the function itself is just above the line that calls function? I can only guess that you're not showing us the code you're actually running. See the example I put in another reply - that works and is based on the code you sent. -Stut true. it's not original code than simplified one. let me try with one more time with your solution. -afan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] problem calling functions
hi I have a problem with calling functions: ?php function solution1($var1){ // some code } function solution2($var2){ // some code } function solution3($var3){ // some code } if ($function == 'solution1' or $function == 'solution2' or $function == 'solution3') { $my_solution = $function($var); # this supposed to call one of solution functions, right? } ? suggestions? thanks. -afan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] problem calling functions
Jay Blanchard wrote: [snip] ?php function solution1($var1){ // some code } function solution2($var2){ // some code } function solution3($var3){ // some code } if ($function == 'solution1' or $function == 'solution2' or $function == 'solution3') { $my_solution = $function($var); # this supposed to call one of solution functions, right? } ? [/snip] I don't think you can put a function name in a variable and call it like $function($var). You'd be better of with a case statement in one function and call the proper solution (quick syntax, may need a little fixing; function my_solution($function, $var){ switch $function{ case function1: ...do stuff... break; case function1: etc. } } that's exactly what I'm doing now. though, I was thinking if it's possible. :-( thanks jay -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] problem calling functions
actually, what example you are talking about? I got jay's example only? Stut wrote: afan pasalic wrote: why then the code doesn't work? the error I'm getting is: Fatal error: Call to undefined function solution1() in ... even the function itself is just above the line that calls function? I can only guess that you're not showing us the code you're actually running. See the example I put in another reply - that works and is based on the code you sent. -Stut -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Reload page after form submit
brian wrote: Instruct ICC wrote: From your rough code, I'd say the OP always needs the select block (just remove the else keyword and keep the block) for the current info at the present page refresh/load. But I'd like clarification on how the OP thinks about it. That's close, i think. But the select isn't necessary if the user has submitted a post because, either way, $first $last will be set to the latest values. The problem that i see is here: if (isset($_POST)) This will always return TRUE. It should rather be: if (isset($_POST['name_of_your_submit_btn'])) or some other form element, at least. I don't know if this was simply because it was a rough draft of the code or even if it's the cause of the problem (which i still don't quite understand) but, anyway ... brian nope. ONLY when form with method POST is submitted. if you open the page first time else block will be executed. though, I agree it's much better to have if(isset($_POST['SubmitForm']) and $_POST['SubmitForm'] == 'Submit') where input type=Submit name=SubmitForm value=Submit but, as I said earlier, it's not the code, just an idea. -afan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Reload page after form submit
rough code, to give you an idea: ?php if (isset($_POST)) { # after validation $first = $_POST['firs']; $last = $_POST['last']; mysql_query( insert into table (first, last) values ('.mysql_real_escape_string($first).', '.mysql_real_escape_string($last).') ); } else { $query = mysql_query( select first, last from table where id=xyz ); $result = mysql_fetch_array($query, MYSQL_ASSOC); $first = $result['first']; $last = $result['last']; } ? form method=POST action=?= $_SERVER['PHP_SELF'] ? First: input type=text name=first value=?= $first ?br Last: input type=text name=last value=?= $last ?br input type=submit value=submit /form -afan From: Wagner Garcia Campagner [EMAIL PROTECTED] Hello, I'm building a web page just like a blog... Where the user input some information... (name, website and comment) This information is stored in a file... And then the page displays it... When the user access the page the first time, the information is displayed correct... After the user submit the information, the page become outdated... without this last information the user submitted... Is there a way to tell PHP to reload the page after the user submit the information, so the page is always updated?? Thanks in advance, Wagner. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] OT- why is network solutions more than godaddy?
I'm with GoDaddy since 1999 and have over 60 domains. Never had a problem with them. -afan Stut wrote: blackwater dev wrote: I have to register a bunch of names and am trying to figure out why I would pay $35 when I can just pay $9 at godaddy. Does godaddy own it and I lease it from them??? Network Solutions are expensive, GoDaddy are cheap. That's all there is to it. In my experience customer service from both can be pretty shoddy or excellent depending on the day of the week and the phase of the moon. My advice is that if it's between the two, go with GoDaddy - you won't get any less for your money than you would with NetSol. -Stut -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] register_globals and magic_quotes_gpc (again)
Tijnema wrote: On 6/7/07, Afan Pasalic [EMAIL PROTECTED] wrote: hi, this question is already posted thousand times. but, after I tried for 2 hours to figure it out, I gave up and posted the question here. I'm rebuilding one site. php 4.4.4 as usual, register_globals on, as well as magic_quotes. I tried to turn it off using .htaccess but what ever I change in the (already existing) file, I would get 500 Internal Server Error this is content of the .htaccess file: # -FrontPage- IndexIgnore .htaccess */.??* *~ *# */HEADER* */README* */_vti* Limit GET POST order deny,allow deny from all allow from all /Limit Limit PUT DELETE order deny,allow deny from all /Limit AuthName mkl1332 AuthUserFile /u/web/afan/_vti_pvt/service.pwd AuthGroupFile /u/web/afan/_vti_pvt/service.grp and I tried to add php_flag register_globals Off and it doesn't work (500 internal server error) I tried with register_global 0 - same thing. could you please point me where to look after? thanks for any help. -afan Are you sure the rest of your .htaccess file is correct? And what does your Apache error log show you? there should be an error... Tijnema The .htaccess file is original, from hosting company, pre-installed. I can't access to apache error log. -afan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] register_globals and magic_quotes_gpc (again)
hi, this question is already posted thousand times. but, after I tried for 2 hours to figure it out, I gave up and posted the question here. I'm rebuilding one site. php 4.4.4 as usual, register_globals on, as well as magic_quotes. I tried to turn it off using .htaccess but what ever I change in the (already existing) file, I would get 500 Internal Server Error this is content of the .htaccess file: # -FrontPage- IndexIgnore .htaccess */.??* *~ *# */HEADER* */README* */_vti* Limit GET POST order deny,allow deny from all allow from all /Limit Limit PUT DELETE order deny,allow deny from all /Limit AuthName mkl1332 AuthUserFile /u/web/afan/_vti_pvt/service.pwd AuthGroupFile /u/web/afan/_vti_pvt/service.grp and I tried to add php_flag register_globals Off and it doesn't work (500 internal server error) I tried with register_global 0 - same thing. could you please point me where to look after? thanks for any help. -afan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: find (matching) person in other table
Jared Farrish wrote: On 5/30/07, Afan Pasalic [EMAIL PROTECTED] wrote: email has to match in total. [EMAIL PROTECTED] and [EMAIL PROTECTED] are NOT the same in my case. thanks jared, If you can match a person by their email, why not just SELECT by email only (and return the persons information)? 'cause some members can be added to database by administrator and maybe they don't have email address at all. or several memebers can use the same email address ([EMAIL PROTECTED]) and then macthing last name is kind of required. that's how it works now and can't change it. Consider, as well, that each time you're calling a database, you're slowing down the response of the page. So, while making a bunch of small calls might not seem like that much, consider: ||| x ||| ||| a ||| ||| b ||| Versus ||| x, a, b ||| The letters represent the request/response data (what you're giving to get, then get back), and the pipes (|) are the overhead to process, send, receive (on DB), process (on DB), send (on DB), receive, process, return to code. The overhead and latency used to complete one request makes it a quicker, less heavy operation. If you did the first a couple hundred or thousand times, I would bet your page would drag to a halt while it loads... agree. now, I have to figure it out HOW? :-) I was looking at levenshtein, though, I think the richard's solution is just enough: select member_id, first_name, last_name, email, ..., (5*(first_name='$first_name) + 2*(first_name='$first_name')) as score from members where score 0 though, I'm getting error: Unknown column 'score' in where clause?!? thanks jared. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: find (matching) person in other table
David Giragosian wrote: On 5/31/07, Afan Pasalic [EMAIL PROTECTED] wrote: Jared Farrish wrote: On 5/30/07, Afan Pasalic [EMAIL PROTECTED] wrote: email has to match in total. [EMAIL PROTECTED] and [EMAIL PROTECTED] are NOT the same in my case. thanks jared, If you can match a person by their email, why not just SELECT by email only (and return the persons information)? 'cause some members can be added to database by administrator and maybe they don't have email address at all. or several memebers can use the same email address ([EMAIL PROTECTED]) and then macthing last name is kind of required. that's how it works now and can't change it. Consider, as well, that each time you're calling a database, you're slowing down the response of the page. So, while making a bunch of small calls might not seem like that much, consider: ||| x ||| ||| a ||| ||| b ||| Versus ||| x, a, b ||| The letters represent the request/response data (what you're giving to get, then get back), and the pipes (|) are the overhead to process, send, receive (on DB), process (on DB), send (on DB), receive, process, return to code. The overhead and latency used to complete one request makes it a quicker, less heavy operation. If you did the first a couple hundred or thousand times, I would bet your page would drag to a halt while it loads... agree. now, I have to figure it out HOW? :-) I was looking at levenshtein, though, I think the richard's solution is just enough: select member_id, first_name, last_name, email, ..., (5*(first_name='$first_name) + 2*(first_name='$first_name')) as score from members where score 0 though, I'm getting error: Unknown column 'score' in where clause?!? thanks jared. Try using the keyword 'having' rather than 'where'. You can't use an alias in a where clause. David Yup. that works! :-) Thanks David -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] find (matching) person in other table
hi, the code I'm working on has to compare entered info from registration form with data in members table and list to administrator (my client) all matching people. admin then has to decide is person who registered already in database and assign his/her member_id or the registered person is new one and assign new member_id. I was thinking to assign points (percentage) to matching fields (last name, first name, email, phone, city, zip, phone) and then list people with more than 50%. e.g., if first and last name match - 75%, if only email match - 85%, if first name, last name and email match - 100%, if last name and phone match - 50%... etc. does anybody have any experience with such a problem? or something similar? thanks for any help. -afan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: find (matching) person in other table
Jared Farrish wrote: I was thinking to assign points (percentage) to matching fields (last name, first name, email, phone, city, zip, phone) and then list people with more than 50%. e.g., if first and last name match - 75%, if only email match - 85%, if first name, last name and email match - 100%, if last name and phone match - 50%... etc. does anybody have any experience with such a problem? or something similar? Although you should be able to do this with you SELECT (I guess, never have), since you posted this to a PHP mailing, you get a PHP answer! Look up Levinshtein in the php manual and start from there: http://us2.php.net/manual/en/function.levenshtein.php If you can do this on SELECT (using the db engine), I would suggest that, as that way you don't have to return a giant list to poke through. You can also use wildcards, and only select matches that have the first three characters: $lastname = strpos('Rogers',0,2); $firstname = strpos('Timothy',0,2); $select = SELECT `uid`,`LastName`,`FirstName` FROM `users` WHERE LastName='$lastname%' AND FirstName='$firstname%'; I haven't tested that, but I think it would work. You would need to work on a way to LIMIT the matches effectively. If that doesn't work, hey, this is a PHP list... yes. in one hand it's more for mysql list. though, I was thinking more if somebody had already something similar as a project. more as path I have to follow. e.g., in your example, in where clause AND doesn't work because bob could be robert too, right? and last name has to match 100%, right? (or I'm wrong?) how smart solution will be something like this: $query = my_query(select id from members where last_name='$last_name'); while($result = mysql_fetch_array($query)) { $MEMBERS[$result['id']] += 50; } $query = my_query(select id from members where first_name='$first_name'); while($result = mysql_fetch_array($query)) { $MEMBERS[$result['id']] += 10; } $query = my_query(select id from members where email='$email'); while($result = mysql_fetch_array($query)) { $MEMBERS[$result['id']] += 85; } etc. after last query I will have an array of people. and I'll list all person with score more than 50. or, since last name MUST match, I think it's better this way (just got in my head): $query = my_query(select id from members where last_name='$last_name'); while($result = mysql_fetch_array($query)) { $query = my_query(select id from members where first_name='$first_name'); while($result = mysql_fetch_array($query)) { $MEMBERS[$result['id']] += 10; } $query = my_query(select id from members where email='$email'); while($result = mysql_fetch_array($query)) { $MEMBERS[$result['id']] += 85; } etc. } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] find (matching) person in other table
Richard Lynch wrote: On Wed, May 30, 2007 3:30 pm, Afan Pasalic wrote: hi, the code I'm working on has to compare entered info from registration form with data in members table and list to administrator (my client) all matching people. admin then has to decide is person who registered already in database and assign his/her member_id or the registered person is new one and assign new member_id. I was thinking to assign points (percentage) to matching fields (last name, first name, email, phone, city, zip, phone) and then list people with more than 50%. e.g., if first and last name match - 75%, if only email match - 85%, if first name, last name and email match - 100%, if last name and phone match - 50%... etc. does anybody have any experience with such a problem? or something similar? I've played this game several times. You generally have to have a human override, because it will never be perfect, no mater how much you tweak it -- I mean, let the admin also just search for whatever they want to match up the new registration with the old person. yes. that's the plan. to show all matching people and admin will then decide who is REALLY the match (if any). You may have only the first name matching on somebody who got married and moved that won't score well... right. I forgot about this possibility :-( But you'll have 10 John Smith's in there. You can do it fairly easily building the query dynamically: ?php //find possible duplicates/existing members: $query = select member_id, name, address, phone, etc ; //all members get 0 points to start: $query .= 0 ; //add 5 points for last name matching: $query .= + 5 * (last_name = '$last_name') ; //add 1 point for first name matching: $query .= + (first_name = '$first_name') ; //and so on $query .= as score ; $query .= from member ; //maybe this has to be: HAVING score 0 $query .= where score 0 ; ? You can play all kinds of games with the numbers and weighting various bits of data -- but complicating it too much beyond the obvious natural choice rarely improves the success rate very much... A simple checkbox on the form: Are you already a member: will help provide an invaluable cross-check as to whether there SHOULD be a member record good point too! ;-) thanks. -afan
Re: [PHP] Re: find (matching) person in other table
Jared Farrish wrote: On 5/30/07, Afan Pasalic [EMAIL PROTECTED] wrote: yes. in one hand it's more for mysql list. though, I was thinking more if somebody had already something similar as a project. more as path I have to follow. e.g., in your example, in where clause AND doesn't work because bob could be robert too, right? and last name has to match 100%, right? (or I'm wrong?) You're right. Remember, that was an example of what you MIGHT do, not necessarily what you SHOULD do. sure. I just want to be sure you understand what I was thinking (because of my english :-) ) You could also situationally check the returned fields and if it's greater than, say, 25 or 50, re-run the query and change the letters matched to 4, for instance, and then add a link to get the greater total. You could also look at the search box suggestion code that's out there for a way to implement this on the server side. Don't know if that code will be optimized or not, but that's essentially what you're doing here. how smart solution will be something like this: $query = my_query(select id from members where last_name='$last_name'); while($result = mysql_fetch_array($query)) { $MEMBERS[$result['id']] += 50; } Well, see, if the match isn't exact, it won't return anything. Unless you know the exact name. You also may have to deal with someone misstyping their name(s). $query = my_query(select id from members where first_name='$first_name'); while($result = mysql_fetch_array($query)) { $MEMBERS[$result['id']] += 10; } $query = my_query(select id from members where email='$email'); while($result = mysql_fetch_array($query)) { $MEMBERS[$result['id']] += 85; } Why would you do that many SELECTs? (Also, if you cap the SQL commands, it's easier to read.) most likely because I was thinking that it shouldn't be big deal. but after your and richard's email - definitely have to try to make it as one query. etc. after last query I will have an array of people. and I'll list all person with score more than 50. This is a really roundabout way to do this. Look at the Levinshtein PHP manual page for some suggestions on how to calculate similarities. I *think* that should be better to do this: for ($i = 0; $i count($mysqlresultset); $i++) { $lev = levenshtein($mysqlresultset[$i][$firstname], $postedname); if ($lev 49) { $matches[] = $mysqlresultset[$i]; } } I'm just studying it. :-) or, since last name MUST match, I think it's better this way (just got in my head): $query = my_query(select id from members where last_name='$last_name'); while($result = mysql_fetch_array($query)) { $query = my_query(select id from members where first_name='$first_name'); while($result = mysql_fetch_array($query)) { $MEMBERS[$result['id']] += 10; } $query = my_query(select id from members where email='$email'); while($result = mysql_fetch_array($query)) { $MEMBERS[$result['id']] += 85; } etc. } There's a lot of unnecessary work you're making PHP and your database do. This is quite inefficient code. that's why I ask here - to learn. and I appreciate for any help. If you're trying to match the emails and whatnot, then combine all those queries together. SELECT them all together. It looks like what you're doing is weighting it by email address, which you can add to the SELECT I posted (although you need to think about how you use your wildcards for email addresses, such as maybe matching the beginning OR the end, for instance). It's even better if the person has to activate the account with an email link to activate, since then you'd know the email address existed (although it doesn't mean it isn't someone in the database that isn't already in there). email has to match in total. [EMAIL PROTECTED] and [EMAIL PROTECTED] are NOT the same in my case. thanks jared, -afan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] error_reporting(E_ALL) doesn't show anything
hi, in php.ini is error_reporting turned off. and, to see an error have to open error_log. though, for me is much easier to have it on and see the errors on the screen. while developing, of course. I put on the beginning of the file error_reporting(E_ALL) to overwrite php.ini but it doesn't work. still can't see anything. what am I doing wrong? thanks. -afan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] error_reporting(E_ALL) doesn't show anything
Stut wrote: Please include the list in replies. I'm sorry. Clicked on wrong Reply button :-) Afan Pasalic wrote: Stut wrote: Afan Pasalic wrote: in php.ini is error_reporting turned off. and, to see an error have to open error_log. though, for me is much easier to have it on and see the errors on the screen. while developing, of course. I put on the beginning of the file error_reporting(E_ALL) to overwrite php.ini but it doesn't work. still can't see anything. what am I doing wrong? Check the display_errors setting. -Stut I'm sorry, my bad. I was thinking one thing and writing other. :-) error_reporting is on (E_ALL ~E_NOTICE ~E_STRICT) and display_errors = off But, the result is the same: blank screen. :-) Try ini_set('display_errors', '1'); -Stut Yup. It works. Thanks Stut ;-) -afan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Need a new shared host with php
Edward Kay wrote: Al wrote: I'm looking for a shared host with an up-to-date php5, and one who at least tries to keep it relatively current. Needs are modest. Just need good ftp access, cgi-bin, shell, etc. Any suggestions. I'm looking at Host Monster, anyone have experience with them? Thanks... I use host monster for last year and never had a problem with them. Have one account with 8 domains/web sites. None has big traffic. Though, one of web sites is my personal site with Gallery2 installed. When uploading chunk of 10 or 20 images (king size) after is DONE I would get a message that I'm using processor more then I could and it will keep me out for couple minutes before I can continue. Though, my web site is still up, just I can't do anything. And, every time whole process was finished without interruption or with error. Strange thing (never had similar before) but it doesn't bother me a lot. Agree with Edward, VPS is better solution - if possible. I used pair.com for a while. Pricey but VERY GOOD. -afan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] isset
that was actually my point. :) -afan Stut wrote: tedd wrote: At 4:08 PM +0100 4/16/07, Stut wrote: Jim Lucas wrote: Richard Kurth wrote: What do you do when isset does not work? If I send data in a $_REQUEST['var'] like if (isset($_REQUEST['var'])) { } Put var has no data it still says it is set. Because $_REQUEST['var'] = and isset thinks is set I use this combination a lot: if ( isset($_GET['something']) !empty($_GET['something']) ) { // do something here with $_GET['something'] } The isset is a pointless waste of cycles. -Stut I've been accuse of that too, but what's your solution? In the above example, if (isset($_GET['something']) !empty($_GET['something'])) { is the same as... if (!empty($_GET['something'])) { So, in that particular line of code the isset is a pointless waste of cycles. -Stut -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] isset
Afan Pasalic wrote: Jochem Maas wrote: Richard Kurth wrote: What do you do when isset does not work? If I send data in a $_REQUEST['var'] like if (isset($_REQUEST['var'])) { } Put var has no data it still says it is set. Because $_REQUEST['var'] = and isset thinks is set php -r ' $r = array(foo = ); var_dump(isset($r[foo]),empty($r[foo]));' so empty() should give you the result your looking for ... some tips: 1. generally use $_GET or $_POST in preference to $_REQUEST 2. be specific about your input validation, e.g.: if (isset($_GET['var']) ($_GET['var'] == 'foo')) { echo got it!; } I always wondered about this. if $_GET['var'] == 'foo' is true, isn't automatically isset($_GET['var']) true too? I mean, isn't if ($_GET['var'] == 'foo') { echo got it!; } just enough? it doesn't cover the situation where $_GET['var'] doesn't exist, and using uninitialized var is not recommended. of course it's your call whether you write/run code that spits out E_NOTICEs all over the place due to usage of uninitialized vars. not quite sure. if $_GET['var'] doesn't exists it's DEFINITLY not equal to 'foo', right? how I understand: clause one: isset($_GET['var']) clause two: ($_GET['var'] == 'foo') if clause two is true, clause one MUST be true. if clause one is true, clause two could be true or false. means, if I look for solutions where ($_GET['var'] == 'foo') they wil lautomaticaly cover isset($_GET['var']) part. if ($_GET['var'] != 'foo') I erally do not care isset($_GET['var']) or !isset($_GET['var']). or I'm missing something here? I have E_NOTICE turned off. :) thanks. -afan -afan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] how to get var name and value from function?
Tijnema ! wrote: On 4/14/07, Afan Pasalic [EMAIL PROTECTED] wrote: hi, this one I can't figure out: I have to assign value of an array to variable named after key of the array several times in my project to , e.g. after I submit a form with personal info I have $_POST['name'] = 'john doe'; $_POST['address'] = '123 main st.'; $_POST['city'] = 'urbandale'; $_POST['zip'] = '12345'; $_POST['phone'] = '123-456-7980'; etc. Then I assign value to the var name: foreach ($_POST as $key = $value) { ${$key} = $value; } and then validate submitted. Are you sure you want to do this? You never know what a hacker inserts to your POST data, so he could easily define variables inside your script, especially when you're using more dangerous functions like system(). I do validation after this step. :) Though, to avoid writing all over again the same lines (even it's only 3 lines) I was thinking to create a function something like: function value2var($array, $print=0) { foreach ($_POST as $key = $value) I think you should change above line to : foreach ($array as $key = $value) yup! it's print error. I meant $array. { ${$key} = $value; echo ($print ==1) ? $key.': '.$value.'br'; // to test results and seeing array variables and values } } value2var($_POST, 1); but, I don't know how to get info from function back to script?!?!? :-( Uhm, it's not even possible when you don't know the keys i believe. after 2 hours of testing and research I realized this too, but want to be sure. :-( thanks. -afan Tijnema any help appreciated. -afan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] how to get var name and value from function?
hi, this one I can't figure out: I have to assign value of an array to variable named after key of the array several times in my project to , e.g. after I submit a form with personal info I have $_POST['name'] = 'john doe'; $_POST['address'] = '123 main st.'; $_POST['city'] = 'urbandale'; $_POST['zip'] = '12345'; $_POST['phone'] = '123-456-7980'; etc. Then I assign value to the var name: foreach ($_POST as $key = $value) { ${$key} = $value; } and then validate submitted. Though, to avoid writing all over again the same lines (even it's only 3 lines) I was thinking to create a function something like: function value2var($array, $print=0) { foreach ($_POST as $key = $value) { ${$key} = $value; echo ($print ==1) ? $key.': '.$value.'br'; // to test results and seeing array variables and values } } value2var($_POST, 1); but, I don't know how to get info from function back to script?!?!? :-( any help appreciated. -afan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP editor
On Apr 11, 2007, at 9:17 AM, Jochem Maas wrote: Jonathan Kahan wrote: Hi all, I beleive this is in the realm of php (I have learned my lesson from last time). Does anyone have recomendation for any free (I.E. permanently free not 30 day trial) of a good php editor. The ones i am seeing all only allow usage for a limited time. STFA, STFW, notepad, textpad, whateverpad. look what I find after googling for 5 seconds: http://www.php-editors.com/review/ *you* have to decide if you like an editor, nobody else can do it for you. this topic comes almost weekly and it's rather boring - go search and find *lots* of totally abitrary, rose-tinted opinions about what the best freaking editor is. Obviously some people think this is NOT in the realm of php. Nonetheless, I think it's a relevant question and others have answered it well. It's up to you to decide which suits you best... and Google, can probably help you with that. For Mac (my main platform), I use TextMate, but it's not free. For PC, I use Crimson Editor, and it is free. Hope that helps. ~Philip Kind Regards Jonathan Kahan Systems Developer Estrin Technologies, inc. 1375 Broadway, 3rd Floor, New York, NY, 10018 Email: [EMAIL PROTECTED] Web: http://www.estrintech.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php On both Win and Linux I use Zend Studio. Not free but it's worth every cent. Before I used HomeSite. Great tool too. If you use Linux Quanta+ is great tool too. Download EVERY editor you think and try it. What I like doesn't mean it's ok with you. Try even not free editors - it's worth testing, and you will find what do you really want from an editor. -afan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] mysql if empty
If I search for something in mysql that returns an empty result I cant get it to return No result found always returns Found even though the recoed does not exist... $sql = SELECT Client FROM booked WHERE Name = 'larry'; $result = mysql_query($sql); if ($result == ) { echo No result found; } echo Found; try this: $sql = SELECT Client FROM booked WHERE Name = 'larry'; $result = mysql_query($sql); if(mysql_num_rows($result) == 0) { echo No result found; } else { $myresults = mysql_fetch_array($result); } -afan - Original Message - From: Martin Marques martin@bugs.unl.edu.ar To: Stut [EMAIL PROTECTED] Cc: Tijnema ! [EMAIL PROTECTED]; tedd [EMAIL PROTECTED]; Peter Lauri [EMAIL PROTECTED]; Ólafur Waage [EMAIL PROTECTED]; php-general@lists.php.net Sent: Monday, April 09, 2007 9:45 PM Subject: Re: [PHP] Session Authentication Stut escribió: As with most things these days it probably breaches the DMCA. But frankly speaking, if doing that works then the developers of the application, and by extension the company, deserve everything they get. DMCA is a real piece of crap. -- select 'mmarques' || '@' || 'unl.edu.ar' AS email; - Martín Marqués | Programador, DBA Centro de Telemática | Administrador Universidad Nacional del Litoral - -- 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] PHP has encountered an Access Violation at 01F13157?!?!?!?
use IIS. Tijnema ! wrote: On 4/7/07, Afan Pasalic [EMAIL PROTECTED] wrote: hi, I just installed php 5.2.1-win32-installer on win box (XP). use IIS. created index.html file and localhost/index.html is ok. created phpinfo.php (with only phpinfo()) and was ok. then installed Zend 5.5.0 (try) and suddenly, IE is giving me blank screen. installed firefox 2 and got the error message from subject line. according google and php.net, it's bug?!? any idea? thanks for any help. -afan So, what are the error messages in your firefox? and do you have any error messages in your apache error log? Tijnema -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP has encountered an Access Violation at 01F13157?!?!?!?
already did. though, my expertize is telling me: install php4 instead php5 :D Tijnema ! wrote: On 4/7/07, Tijnema ! [EMAIL PROTECTED] wrote: On 4/7/07, Afan Pasalic [EMAIL PROTECTED] wrote: hi, I just installed php 5.2.1-win32-installer on win box (XP). use IIS. created index.html file and localhost/index.html is ok. created phpinfo.php (with only phpinfo()) and was ok. then installed Zend 5.5.0 (try) and suddenly, IE is giving me blank screen. installed firefox 2 and got the error message from subject line. according google and php.net, it's bug?!? any idea? thanks for any help. -afan So, what are the error messages in your firefox? and do you have any error messages in your apache error log? Tijnema I'm sorry, i didn't read your title, so i didn't know what your error was, but it is a bug. Take a look here: http://bugs.php.net/bug.php?id=40662 There hasn't been a solution posted, because there were no backtraces provided. If you could provide them, it might solve the bug. Also, this bug appeared in PHP5RC3 too, there was a fix, but link is dead, and the fix they tell is Use CVS snapshot., and of course that would worked then, but that's not relevant anymore, as the thead is from jun 2004, anyway if you want to read it: http://bugs.php.net/bug.php?id=29127 Tijnema -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Idea/Suggestion for PHP App
looks like I didn't get the question. I thought he's asking how to start a project. to start to learn php of course you don't need paper and pencil. books, online tutorials, php.net and time. though, for a new project (if you never did similar before and if you don't already have the code you can reuse), a sketch/outline of the application's architecture/structure with a paper and a pencil is time saving. :) -afan tedd wrote: At 9:59 PM +0200 4/5/07, [EMAIL PROTECTED] wrote: and yes, I (still) use paper and pencil because never find good app for it. if you can recommend - I'll be more than happy to use it and stop wasting paper (agree with you on poor tree :D) -afan Pencil and paper? What's that? I had a good friend who said -- A program is nothing more than three steps: input; calculation; and display. I've always found that's a good start. tedd -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP has encountered an Access Violation at 01F13157?!?!?!?
hi, I just installed php 5.2.1-win32-installer on win box (XP). use IIS. created index.html file and localhost/index.html is ok. created phpinfo.php (with only phpinfo()) and was ok. then installed Zend 5.5.0 (try) and suddenly, IE is giving me blank screen. installed firefox 2 and got the error message from subject line. according google and php.net, it's bug?!? any idea? thanks for any help. -afan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Idea/Suggestion for PHP App
first step is: take a paper and pen and start drawing your app structure in blocks. once you finished your app on the paper start drawing db structure. start coding after you have the solution for every situation. :D -afan Hey... I am new to the list so please forgive me if I say anything that might have already been discussed. So here we go... OK I am attempting to start a new application using PHP. I have started and stoped this application now 2 times cause I get moving then I stop realizing I should have done this work before hand and in a differant way. I was wondering does anyone have any places I can read on how develope a PHP Web application like what area should I start with first, what are somethings I need to think about before hand. The application I am working on is Database driven app. It will have data inserted into the DB from various data sources that are manually entered. However I need to develope the app as dynamic as possible for future add-ons... I know I am probably biting off more then I can chew at this time... So any pointers or exampled (which would be great) on how to start an app from scratch and also how to use OOP (Which I have a feeling is what I need to learn) would be wonderful. Thank you all for any help you can provide. Thanks, Billy S. -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. -- 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] Idea/Suggestion for PHP App
On Thu, 2007-04-05 at 21:36 +0200, [EMAIL PROTECTED] wrote: first step is: take a paper and pen and start drawing your app structure in blocks. once you finished your app on the paper start drawing db structure. start coding after you have the solution for every situation. You're kidding aren't you? Poor trees! BTW You will NEVER have the solution for every situation. nope. not at all. I always tried to draw/build whole app's structure first. or, at least closer I can get. it's also true, I never covered ALL situations, but to me is much easier to code after I have AS MUCH AS I CAN HAVE answers than start coding and then re-coding few days later because oops! I forgot that user can have two homes, not only one... :D and yes, I (still) use paper and pencil because never find good app for it. if you can recommend - I'll be more than happy to use it and stop wasting paper (agree with you on poor tree :D) -afan Cheers, Rob. -- .. | InterJinn Application Framework - http://www.interjinn.com | :: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php