Re: [PHP] Problem with code
On Dec 5, 2004, at 9:05 PM, Richard Kurth wrote: I am having a problem with the code below it provides the first page with out any problem but when I select the next page it shows all the results from the first page and the results from the second page. It does the same thing on the third page also. I have been looking at it for two days and can not fined the error in the code ?php include(include/common.php); include($config[template_path]/user_top.html); I don't see where you set $page. And I'm betting that you don't. Variables are not persistent from one page-load to the next. try adding this line in here: $page = $_GET['page']; // If current page number, use it // if not, set one! if(!isset($page)){ $page = 1; } else { $page = $page; } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Links displaying in Table cells
Dear All, After clicking on a link of a menu in a PHP page, I want to display that link in cell of a table. Please let me know how to open this link in a table cell. Thanking in anticipation. Thanks and Regards, Rajeev Tomar -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Sessions and multiple windows
Hi List I am afraid that this is going to be a long complicated question. And to start off with I have RTFM, STFA, STFW - and have yet to find the answer I am looking for - unless, perhaps I am asking the wrong question? But back to the subject - I have an app that allows users to open multiple windows to perform certain tasks. Even though the user has multiple windows, from the point of view of the app it is classified as a single session. For this app I have an object stored in a session variable that I use to administer logins, permissions etc. - call it $_SESSION['policeman']. This object stores information that is common to all windows (e.g. path to common error logging, current user id etc). A simpler version fo this app did not allow for the opening of multiple windows and I needed to check if the user was logged in every time he/she went to a new page. I did this by putting a call to the checkLogin method inside $_SESSION['policeman']'s __wakeup method. Then , every time PHP unserialized $_SESSION['policeman'] it checked for the login. I would like to do a similar thing with the more complex apps, but i do not know enough to be sure that it won't cause a problem and to be quite honest, I am not even entirely sure how to test it. My problen lies in a scenario such as this: User clicks through to page_3.php from page_2.php. Page_3.php starts, unserializes $_SESSION['policeman'], and begins a lengthy SQL query that will take a few minutes to complete. The user wants to do something else so he\she opens a new window for page_9.php (at this point page_3.php has yet to complete). Now, the question is, what will PHP do when it starts with page_9? Will it unserialize $_SESSION['policeman'] again, even though it already has an unserialized instance of $_SESSION['policeman']? If it does unserialize, does that mean that it creates a second instance of $_SESSION['policeman'], thereby breaking the common link that I am trying to provide? I hope someone will be able to point me in the right direction... TIA -- Rory McKinley Nebula Solutions +27 21 555 3227 - office +27 21 551 0676 - fax +27 82 857 2391 - mobile www.nebula.co.za -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] FCK Editor
Hey all, I came accross this free dhtml editor while browsing the net for popular projects, anybody else using FCK Editor? If yes, any problems? if no, heres the url 'case you want to check it out yourself: http://www.fckeditor.net/ Cheers, Ryan -- No virus found in this outgoing message. Checked by AVG Anti-Virus. Version: 7.0.289 / Virus Database: 265.4.6 - Release Date: 12/5/2004 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Magic Quotes Issue
Hi, I have been investigating the problem of apostrphes in a mysql insert / update. I use a db_query function for all my queries: function db_query($query) { $qid = mysql_query($query); return $qid; } It appears after some research that the best way around the problem is to check whether magic_qoutes_gpc is off and if so use addslashes(). I have altered the function to this: function db_query($query) { if(!magic_quotes_gpc()){ $qid = mysql_query(addslashes($query)); } else { $qid = mysql_query($query); } return $qid; } But this adds too many slashes! Has anyone come to a better solution regarding this? Thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Sessions and multiple windows
On Tuesday 07 December 2004 20:50, Rory McKinley wrote: User clicks through to page_3.php from page_2.php. Page_3.php starts, unserializes $_SESSION['policeman'], and begins a lengthy SQL query that will take a few minutes to complete. When Page_3.php does its business it will have locked the session data file and only that instance of Page_3.php will have access to it. It will automatically release the lock when the page finishes executing or when you explicitly issue a session_write_close(). The user wants to do something else so he\she opens a new window for page_9.php (at this point page_3.php has yet to complete). Now, the question is, what will PHP do when it starts with page_9? As Page_3.php is still doing its business the session data file is locked and when page_9.php tries to session_start() and finds it has no access to it will suspend execution until the lock is relinquished by Page_3.php. Will it unserialize $_SESSION['policeman'] again, Yes ... even though it already has an unserialized instance of $_SESSION['policeman']? ... because by the time it has access to the session data that unserialized instance of $_SESSION['policeman'] has already gone ... If it does unserialize, does that mean that it creates a second instance of $_SESSION['policeman'], thereby breaking the common link that I am trying to provide? Only one instance of $_SESSION['policeman'] can be in existence for a particular session_id. -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-general -- /* rcw liiwi: printk(CPU0 on fire ); */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Magic Quotes Issue
Try $string = mysql_real_escape_string($string); On 7 Dec 2004, at 14:12, Shaun wrote: Hi, I have been investigating the problem of apostrphes in a mysql insert / update. I use a db_query function for all my queries: function db_query($query) { $qid = mysql_query($query); return $qid; } It appears after some research that the best way around the problem is to check whether magic_qoutes_gpc is off and if so use addslashes(). I have altered the function to this: function db_query($query) { if(!magic_quotes_gpc()){ $qid = mysql_query(addslashes($query)); } else { $qid = mysql_query($query); } return $qid; } But this adds too many slashes! Has anyone come to a better solution regarding this? Thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Sessions and multiple windows
To view the terms under which this email is distributed, please go to http://disclaimer.leedsmet.ac.uk/email.htm On 07 December 2004 12:50, Rory McKinley wrote: [] Page_3.php starts, unserializes $_SESSION['policeman'], and begins a lengthy SQL query that will take a few minutes to complete. The user wants to do something else so he\she opens a new window for page_9.php (at this point page_3.php has yet to complete). Now, the question is, what will PHP do when it starts with page_9? Will it unserialize $_SESSION['policeman'] again, even though it already has an unserialized instance of $_SESSION['policeman']? If it does unserialize, does that mean that it creates a second instance of $_SESSION['policeman'], thereby breaking the common link that I am trying to provide? Basically, this is a that's not how it works answer. The fundamental point you have to realise is that every php page is completely independent, and nothing you can do in one can directly affect anything in another (even if they use the same script to generate their output). The ways of sending information from one (invocation of a) script to another all use some external medium: POST or GET variables, a SESSION, a database, or COOKIES. Of these, only the database is purely server-side; the session very nearly is, maintaining only the session id client-side; whilst GET, POST and COOKIES all involve a full round-trip to the client. (On the client side, of course, you can use JavaScript to affect multiple windows, but that has nothing to do with server-side PHP.) So the answers to your specific questions are: yes, page_9 will unserialize again (because it knows nothing of the page_3 instance -- whatever the it is you're thinking of that already has an unserialized instance, it doesn't exist); and yes, a second, completely independent, instance will be created, because there is no such common link in the way you appear to be thinking of it. Another kicker is that only one script can access the session data at any one time -- in your scenario, page_9 will stall at session_start() until page_3 releases the session lock. This will be at the end of the page_3 script, unless you explicitly release it earlier with a session_write_close(), for example. If you do this, and the page_9 script starts before the page_3 script has finished, you will have two, completely separate, local instances of $_SESSION['policeman']. Cheers! Mike - Mike Ford, Electronic Information Services Adviser, Learning Support Services, Learning Information Services, JG125, James Graham Building, Leeds Metropolitan University, Headingley Campus, LEEDS, LS6 3QS, United Kingdom Email: [EMAIL PROTECTED] Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Sessions and multiple windows
Jason Wong wrote: On Tuesday 07 December 2004 20:50, Rory McKinley wrote: snip As Page_3.php is still doing its business the session data file is locked and when page_9.php tries to session_start() and finds it has no access to it will suspend execution until the lock is relinquished by Page_3.php. snip ... because by the time it has access to the session data that unserialized instance of $_SESSION['policeman'] has already gone ... snip Hi Jason Thanks for the rapid response. So if I understand you correctly if the first page takes a half hour to complete its queries, then the second page is going to sit for a half an hour before it can access the session variables? So the only way for the user to be able to do anything while the first page is at work is to get a new session id for each new window? In such a case, is there any way to pass information between sets of session variables in such a case? (I.e from $_SESSION['policeman'] of session number 1 and $_SESSIOn['policeman'] of session number 2) TIA -- Rory McKinley Nebula Solutions +27 21 555 3227 - office +27 21 551 0676 - fax +27 82 857 2391 - mobile www.nebula.co.za -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] searching with mutable criteria
I am having a problem with this script what it does is write the sql needed to search for data based on mutable criteria. It works fine if you search with all the different fields but if you only search with one or two of the fields it creates a sql that looks like this SELECT * FROM listing WHERE state = 'WA' AND LIMIT 0,5 It adds the AND before the limit if you use all three fields it does not add the AND. How can I change this so it will not add the AND if there is only a search on one or two of the fields $cond = AND; $sql = 'SELECT * FROM listing '; if($_POST[state] != || $_POST[types] != || $_POST[county] != ){$sql .= WHERE ; if($_POST[state] != ){ $sql .= state = '. $_POST[state] .'; if($_POST[state] != || $_POST[types] != || $_POST[county] != ){$sql .= $cond ;} } if($_POST[type] != ){ $sql .= types = '. $_POST[types] .'; if($_POST[state] != || $_POST[types] != || $_POST[county] != ) {$sql .= $cond ;} } if($_POST[county] != ){ $sql .= county = '. $_POST[county] .'; if($_POST[state] != || $_POST[types] != || $_POST[county] != ){$sql.= $cond ; } } ) $sql .= LIMIT . $from . , . $max_results; echo $sql -- Best regards, Richard mailto:[EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Links displaying in Table cells
you should add a iframe into your table cell and load the target page (link) into that iframe. maybe some javacsript could create the iframe for you and set its width and height. I Never did this, so this is purely a suggestion Vincent -Original Message- From: Tomar Rajeev (ext) [mailto:[EMAIL PROTECTED] Sent: mardi 7 décembre 2004 11:17 To: '[EMAIL PROTECTED]' Subject: [PHP] Links displaying in Table cells Dear All, After clicking on a link of a menu in a PHP page, I want to display that link in cell of a table. Please let me know how to open this link in a table cell. Thanking in anticipation. Thanks and Regards, Rajeev Tomar -- 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] searching with mutable criteria
An easy way to fix that problem would be to, instead of checking every time if one of the others also is not empty would be to do something like this (havn't tested this code, so no guarantees there's no typos). $sqlCondition = ; if($_POST[state] != || $_POST[types] != || $_POST[county] != ) { if($_POST[state] != ) { if($sqlCondition == ) { $sqlCondition .= SELECT * FROM listing WHERE state = '$_POST[state]' ; } else { $sqlCondition .= AND state = '$_POST[state]' ; } } if($_POST[types] != ) { if($sqlCondition == ) { SELECT * FROM listing WHERE types = '$_POST[types]' ; } else { $sqlCondition .= AND types = '$_POST[types]' ; } } $sqlCondition .= LIMIT . $from . , . $max_results; } Do the same thing for all of your conditions, and that should fix your error... On Tue, 7 Dec 2004 07:52:07 -0800, Richard Kurth [EMAIL PROTECTED] wrote: I am having a problem with this script what it does is write the sql needed to search for data based on mutable criteria. It works fine if you search with all the different fields but if you only search with one or two of the fields it creates a sql that looks like this SELECT * FROM listing WHERE state = 'WA' AND LIMIT 0,5 It adds the AND before the limit if you use all three fields it does not add the AND. How can I change this so it will not add the AND if there is only a search on one or two of the fields $cond = AND; $sql = 'SELECT * FROM listing '; if($_POST[state] != || $_POST[types] != || $_POST[county] != ){$sql .= WHERE ; if($_POST[state] != ){ $sql .= state = '. $_POST[state] .'; if($_POST[state] != || $_POST[types] != || $_POST[county] != ){$sql .= $cond ;} } if($_POST[type] != ){ $sql .= types = '. $_POST[types] .'; if($_POST[state] != || $_POST[types] != || $_POST[county] != ) {$sql .= $cond ;} } if($_POST[county] != ){ $sql .= county = '. $_POST[county] .'; if($_POST[state] != || $_POST[types] != || $_POST[county] != ){$sql.= $cond ; } } ) $sql .= LIMIT . $from . , . $max_results; echo $sql -- Best regards, Richard mailto:[EMAIL PROTECTED] -- 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] session question
Hi, I've looked at the php session documentation, and it doesn't look like there's any way to run code when a session expires. I'd like to do some cleanup when a user's session expires, is there any way to trap this? Thanks. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] html parser tutorial
Doesn anyone plz knows a good tutorial for parsing html files ? i have a html page and i want to parse information from it to insert it into mysql. i have a good experience in php, but i didn't write a parser before. can anyone help plz ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] html parser tutorial
On Tuesday 07 December 2004 19:09, Ahmed Abdel-Aliem wrote: Doesn anyone plz knows a good tutorial for parsing html files ? i have a html page and i want to parse information from it to insert it into mysql. Check out: http://0x00.org/php/phpHTMLparse/index.php -Stathis -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] session question
On Tue, 7 Dec 2004 11:50:58 -0500, Josh Howe [EMAIL PROTECTED] wrote: I've looked at the php session documentation, and it doesn't look like there's any way to run code when a session expires. I'd like to do some cleanup when a user's session expires, is there any way to trap this? Thanks. You can define your own session handling functions with and override PHP's default session handling with session_set_save_handler(). One of the functions you would define would be the garbage collection function. Once created you can call this function whenever you like. I wrote a drop-in replacement for PHP sessions that gives you what I just described, it uses MySQL: http://destiney.com/pub/php_db_sessions.tar.gz There's also the database abstraction layer ADOdb which gives you callback functionality in garbage collection: http://adodb.sf.net/ The db driven, encrypted and bzip'd sessions are pretty nice too. -- Greg Donald Zend Certified Engineer http://gdconsultants.com/ http://destiney.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] html parser tutorial
Ahmed Abdel-Aliem wrote: Doesn anyone plz knows a good tutorial for parsing html files ? i have a html page and i want to parse information from it to insert it into mysql. i have a good experience in php, but i didn't write a parser before. can anyone help plz ? TidyHTML is supposed to be good at that. Never actually tried it, but John Coggeshall's presentation a few months ago at the Chicago PHP User Group meeting was pretty compelling. If you only need a few small bits of information from web pages whose format doesn't change often, you can maybe get it done really fast and easy with http://php.net/explode. I've scraped a lot of stuff that way myself. You simply have to search the HTML for a distinctive tag that is unlikely to change often and is shortly before the content you want. Then use http://php.net/explode with that tag. For example, on a site with calendar events, you might use: ?php $file = file('http://example.com/'); $html = implode('', $file); $parts = explode('td class=event_date', $html); while (list(, $event) = each($parts)){ list($date, $speaker, $description) = explode('/td', $event); //Prepend td because we stripped it off in 'explode' 3 lines above $date = strip_tags(td $date); $speaker = strip_tags($speaker); $description = strip_tags($description); //Double-check the data as a valid date, //maybe even speaker/description as non-empty //and either log error or insert to your database } ? MOST sites with content you want to scrape on a routine basis are pretty predictable. CSS classes can be particularly useful to find the right bits you want to scrap. Occasionally I run across one where it's hand-edited and completely unpredictable -- and usually not worth scraping, in my experience. -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Links displaying in Table cells
After clicking on a link of a menu in a PHP page, I want to display that link in cell of a table. Please let me know how to open this link in a table cell. You mean like this? HTMLBODY A HREF=?=$PHP_SELF??target=http://php.net;PHP/A TABLE TRTD?=isset($_GET['target']) ? $_GET['target'] : ''?/TD/TR /TABLE /BODY/HTML You may also want to consider not using PHP at all, but using JavaScript and 'innerHTML' property of a table cell. Hard to tell from your question. -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Sessions and multiple windows
So if I understand you correctly if the first page takes a half hour to complete its queries, then the second page is going to sit for a half an hour before it can access the session variables? So the only way for the user to be able to do anything while the first page is at work is to get a new session id for each new window? In such a case, is there any way to pass information between sets of session variables in such a case? (I.e from $_SESSION['policeman'] of session number 1 and $_SESSIOn['policeman'] of session number 2) If you don't *NEED* the session data to change for the most part of the end of that half hour, you can close the session before you start doing whatever takes half an hour. If you do *NEED* the results of the half-hour of work, then you're kind of stuck waiting for it to finish, aren't you? You *could* transfer the 'policeman' (and other) settings in $_GET or $_POST and put them into new sessions, but that would be much more confusing than just using the PHP function to indicate that you have finished all your session work, and are now just delivering content to the user. I forget the function name, but it's something like session_close. -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Sessions and multiple windows
external medium: POST or GET variables, a SESSION, a database, or COOKIES. Of these, only the database is purely server-side; the session very nearly is, maintaining only the session id client-side; whilst GET, POST and COOKIES all involve a full round-trip to the client. (On the client side, of course, you can use JavaScript to affect multiple windows, but that has nothing to do with server-side PHP.) There is also the remote possibility that what you need here is Shared Memory http://php.net/shmget I believe. NOTE: This is NOT for the faint of heart to use. There are some very subtle and complex issues involved in shared memory, so unless it's the ONLY way to do what you want, don't do it. If two PHP scripts depend on each other that much, maybe they shouldn't be different scripts. :-) -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Magic Quotes Issue
Shaun wrote: function db_query($query) { if(!magic_quotes_gpc()){ $qid = mysql_query(addslashes($query)); } else { $qid = mysql_query($query); } return $qid; } But this adds too many slashes! Has anyone come to a better solution regarding this? Can you give us some examples of your input data, and what you think is too many slashes?... Because if the above isn't doing what you want, then something is very wrong somewhere else. -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] FCK Editor
There is another similar editor called htmlarea. http://www.interactivetools.com/freescripts/ My impression was that htmlarea might be a little more extensible. (Image manager, Table Managers, Multiple languages, etc). Warren Vail -Original Message- From: Ryan A [mailto:[EMAIL PROTECTED] Sent: Tuesday, December 07, 2004 5:12 AM To: [EMAIL PROTECTED] Subject: [PHP] FCK Editor Hey all, I came accross this free dhtml editor while browsing the net for popular projects, anybody else using FCK Editor? If yes, any problems? if no, heres the url 'case you want to check it out yourself: http://www.fckeditor.net/ Cheers, Ryan -- No virus found in this outgoing message. Checked by AVG Anti-Virus. Version: 7.0.289 / Virus Database: 265.4.6 - Release Date: 12/5/2004 -- 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] Sessions and multiple windows
Now, the question is, what will PHP do when it starts with page_9? Will it unserialize $_SESSION['policeman'] again, even though it already has an unserialized instance of $_SESSION['policeman']? If it does unserialize, does that mean that it creates a second instance of $_SESSION['policeman'], thereby breaking the common link that I am trying to provide? page_9 does not have an unserialized instance of anything. It is completely independent of page_2. The $_SESSION variable is being shared, however, in some sense. Probably the best solution here is to *NOT* store the unserialized 'policeman' in $_SESSION. Set up a second array for your unserialized stuff, and write a function to get/set it. function get_session_data($field){ global $_UNSERIALIZED; if (!isset($_UNSERIALIZED[$field])){ $_UNSERIALIZED[$field] = unserialize($_SESSION[$field]); } return $_UNSERIALIZED[$field]; } function set_session_data($field, $value){ global $_UNSERIALIZED; $_UNSERIALIZED[$field] = $value; //$_SESSION[$field] = serialize($value); } You can either write a function you call at the end of every script to serialize everything and put it into $_SESSION, or you can un-comment the line above. Depends how much you shuffle in and out of serialized data. Bottom line: Don't confuse $_SESSION values by sometimes having serialized data, and sometimes not in it. -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PEAR performance/overhead
I was told that PEAR has too much overhead to be considered for a large scale site. Does any one feel the same? Is this an outrageous comment? I would like to hear comments from people who are using PEAR, or people who have considered PEAR but decided not to use it and your reasons. The packages I am particularly interested in are HTML_QuickForm and DB. Thanks -- David Dickson -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] inserting html within a mail body
I am using the mail() function in php andI am looking for a quick and easy way to make the mail_body of an auto response email with HTML tags in it so I can add some style to it. Don't. I, and others, will immediately delete your HTML enhanced (cough, cough) email without opening it. If you MUST do this, search here for one of the umpteen existing solutions: http://phpclasses.org -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Random data loss.
2wsxdr5 wrote: With out posting any code I was wondering if anyone here has been experiencing this kind of problem. I have a standard web from that PHP code then reads and saves the data into a MySQL DB. The problem is some of my users have had data lost somewhere in this process. The web site is www.thewishzone.com. It is a wish list site and the data that seems to be getting lost is the price of an item a user adds to their wish list. I can't seem to duplicate it here. However one user did have it happen twice in a short time period. They enter a valid price and after the record posts the price goes to zero. Any ideas? How do you determine a valid price? Do you allow the $ to be in it? Cuz MySQL sure won't take that. Very common mistake. Are you checking mysql result for error in your INSERT and UPDATE statements. MySQL should not be losing data without SOME kind of message... -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] FCK Editor
Hey, Thanks for replying. Sounds good, have you used it yourself in any real life projects? or extended it in any way? Cheers, Ryan On 12/7/2004 7:29:07 PM, Vail, Warren ([EMAIL PROTECTED]) wrote: There is another similar editor called htmlarea. http://www.interactivetools.com/freescripts/ My impression was that htmlarea might be a little more extensible. (Image manager, Table Managers, Multiple languages, etc). Warren Vail -Original Message- From: Ryan A [mailto:[EMAIL PROTECTED] Sent: Tuesday, December 07, 2004 5:12 AM To: [EMAIL PROTECTED] Subject: [PHP] FCK Editor Hey all, I came accross this free dhtml editor while browsing the net for popular projects, anybody else using FCK Editor? If yes, any problems? if no, heres the url 'case you want to check it out yourself: http://www.fckeditor.net/ Cheers, Ryan -- No virus found in this outgoing message. Checked by AVG Anti-Virus. Version: 7.0.289 / Virus Database: 265.4.6 - Release Date: 12/5/2004 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www. -- No virus found in this outgoing message. Checked by AVG Anti-Virus. Version: 7.0.289 / Virus Database: 265.4.6 - Release Date: 12/5/2004 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] FCK Editor
Sure, I added it to a PHPNuke site (among others). Check out http://www.phppilot.com/nuke/html/modules.php?name=Submit_News Warren Vail -Original Message- From: Ryan A [mailto:[EMAIL PROTECTED] Sent: Tuesday, December 07, 2004 10:56 AM To: Vail, Warren Cc: [EMAIL PROTECTED] Subject: RE: [PHP] FCK Editor Hey, Thanks for replying. Sounds good, have you used it yourself in any real life projects? or extended it in any way? Cheers, Ryan On 12/7/2004 7:29:07 PM, Vail, Warren ([EMAIL PROTECTED]) wrote: There is another similar editor called htmlarea. http://www.interactivetools.com/freescripts/ My impression was that htmlarea might be a little more extensible. (Image manager, Table Managers, Multiple languages, etc). Warren Vail -Original Message- From: Ryan A [mailto:[EMAIL PROTECTED] Sent: Tuesday, December 07, 2004 5:12 AM To: [EMAIL PROTECTED] Subject: [PHP] FCK Editor Hey all, I came accross this free dhtml editor while browsing the net for popular projects, anybody else using FCK Editor? If yes, any problems? if no, heres the url 'case you want to check it out yourself: http://www.fckeditor.net/ Cheers, Ryan -- No virus found in this outgoing message. Checked by AVG Anti-Virus. Version: 7.0.289 / Virus Database: 265.4.6 - Release Date: 12/5/2004 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www. -- No virus found in this outgoing message. Checked by AVG Anti-Virus. Version: 7.0.289 / Virus Database: 265.4.6 - Release Date: 12/5/2004 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] FCK Editor
Just checked and it doesn't work on my Firefox 1.0 nor Netscape 7.1. On IE works just fine. Guys from InteractiveTools buit beta version 3 that covers most of browsers (didn't check/use). FCKeditor has some bugs on FireFox as well. Didn't check on Netscape. -afan Vail, Warren wrote: Sure, I added it to a PHPNuke site (among others). Check out http://www.phppilot.com/nuke/html/modules.php?name=Submit_News Warren Vail -Original Message- From: Ryan A [mailto:[EMAIL PROTECTED] Sent: Tuesday, December 07, 2004 10:56 AM To: Vail, Warren Cc: [EMAIL PROTECTED] Subject: RE: [PHP] FCK Editor Hey, Thanks for replying. Sounds good, have you used it yourself in any real life projects? or extended it in any way? Cheers, Ryan On 12/7/2004 7:29:07 PM, Vail, Warren ([EMAIL PROTECTED]) wrote: There is another similar editor called htmlarea. http://www.interactivetools.com/freescripts/ My impression was that htmlarea might be a little more extensible. (Image manager, Table Managers, Multiple languages, etc). Warren Vail -Original Message- From: Ryan A [mailto:[EMAIL PROTECTED] Sent: Tuesday, December 07, 2004 5:12 AM To: [EMAIL PROTECTED] Subject: [PHP] FCK Editor Hey all, I came accross this free dhtml editor while browsing the net for popular projects, anybody else using FCK Editor? If yes, any problems? if no, heres the url 'case you want to check it out yourself: http://www.fckeditor.net/ Cheers, Ryan -- No virus found in this outgoing message. Checked by AVG Anti-Virus. Version: 7.0.289 / Virus Database: 265.4.6 - Release Date: 12/5/2004 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www. -- No virus found in this outgoing message. Checked by AVG Anti-Virus. Version: 7.0.289 / Virus Database: 265.4.6 - Release Date: 12/5/2004 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] FCK Editor
I believe they this particular editor uses a html rendering and editing control that is a part of IE and windows (probably .net, but not sure). Probably won't work in these other browsers, because they are committed to their own editor. If you don't have IE, then you are stuck with the textarea and coding your own html. I know this list includes lots of individuals who like to remain off the beaten path (sometimes myself), but you sometimes pay a price for that. http://www.phpnuke.org/modules.php?name=Statistics PHP Nuke's statistics page shows percentages of visits using various editors, you may find interesting. Good luck, Warren Vail -Original Message- From: Afan Pasalic [mailto:[EMAIL PROTECTED] Sent: Tuesday, December 07, 2004 11:10 AM Cc: [EMAIL PROTECTED] Subject: Re: [PHP] FCK Editor Just checked and it doesn't work on my Firefox 1.0 nor Netscape 7.1. On IE works just fine. Guys from InteractiveTools buit beta version 3 that covers most of browsers (didn't check/use). FCKeditor has some bugs on FireFox as well. Didn't check on Netscape. -afan Vail, Warren wrote: Sure, I added it to a PHPNuke site (among others). Check out http://www.phppilot.com/nuke/html/modules.php?name=Submit_News Warren Vail -Original Message- From: Ryan A [mailto:[EMAIL PROTECTED] Sent: Tuesday, December 07, 2004 10:56 AM To: Vail, Warren Cc: [EMAIL PROTECTED] Subject: RE: [PHP] FCK Editor Hey, Thanks for replying. Sounds good, have you used it yourself in any real life projects? or extended it in any way? Cheers, Ryan On 12/7/2004 7:29:07 PM, Vail, Warren ([EMAIL PROTECTED]) wrote: There is another similar editor called htmlarea. http://www.interactivetools.com/freescripts/ My impression was that htmlarea might be a little more extensible. (Image manager, Table Managers, Multiple languages, etc). Warren Vail -Original Message- From: Ryan A [mailto:[EMAIL PROTECTED] Sent: Tuesday, December 07, 2004 5:12 AM To: [EMAIL PROTECTED] Subject: [PHP] FCK Editor Hey all, I came accross this free dhtml editor while browsing the net for popular projects, anybody else using FCK Editor? If yes, any problems? if no, heres the url 'case you want to check it out yourself: http://www.fckeditor.net/ Cheers, Ryan -- No virus found in this outgoing message. Checked by AVG Anti-Virus. Version: 7.0.289 / Virus Database: 265.4.6 - Release Date: 12/5/2004 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www. -- No virus found in this outgoing message. Checked by AVG Anti-Virus. Version: 7.0.289 / Virus Database: 265.4.6 - Release Date: 12/5/2004 -- 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] Sessions and multiple windows
Richard Lynch wrote: Now, the question is, what will PHP do when it starts with page_9? Will it unserialize $_SESSION['policeman'] again, even though it already has an unserialized instance of $_SESSION['policeman']? If it does unserialize, does that mean that it creates a second instance of $_SESSION['policeman'], thereby breaking the common link that I am trying to provide? page_9 does not have an unserialized instance of anything. It is completely independent of page_2. The $_SESSION variable is being shared, however, in some sense. Probably the best solution here is to *NOT* store the unserialized 'policeman' in $_SESSION. Set up a second array for your unserialized stuff, and write a function to get/set it. function get_session_data($field){ global $_UNSERIALIZED; if (!isset($_UNSERIALIZED[$field])){ $_UNSERIALIZED[$field] = unserialize($_SESSION[$field]); } return $_UNSERIALIZED[$field]; } function set_session_data($field, $value){ global $_UNSERIALIZED; $_UNSERIALIZED[$field] = $value; //$_SESSION[$field] = serialize($value); } You can either write a function you call at the end of every script to serialize everything and put it into $_SESSION, or you can un-comment the line above. Depends how much you shuffle in and out of serialized data. Bottom line: Don't confuse $_SESSION values by sometimes having serialized data, and sometimes not in it. Thanks Richard, Mike and Jason I think I will need to sit down and sift through all the gen you guys have given me, and decide which solution works best for me. -- Rory McKinley Nebula Solutions +27 21 555 3227 - office +27 21 551 0676 - fax +27 82 857 2391 - mobile www.nebula.co.za -- Rory McKinley Nebula Solutions +27 21 555 3227 - office +27 21 551 0676 - fax +27 82 857 2391 - mobile www.nebula.co.za -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] FCK Editor
It worked on my IE and I don't have .NET Framework installed, so guess it's not a .NET specific thing. Did not work on my Firefox (as it was advertised not to). I havn't looked at the code, but it's not a matter of the module doing a browser detect and 'downshifting' if it didn't detect a genuine IE browser is it? Firefox and the other big name browsers can do most of what IE can do, but I can still see that some internal controls might be outside of their reach. Just a thought. -TG *** new email address [EMAIL PROTECTED] *** old email address [EMAIL PROTECTED] (dead) = = = Original message = = = I believe they this particular editor uses a html rendering and editing control that is a part of IE and windows (probably .net, but not sure). Probably won't work in these other browsers, because they are committed to their own editor. If you don't have IE, then you are stuck with the textarea and coding your own html. I know this list includes lots of individuals who like to remain off the beaten path (sometimes myself), but you sometimes pay a price for that. http://www.phpnuke.org/modules.php?name=Statistics PHP Nuke's statistics page shows percentages of visits using various editors, you may find interesting. Good luck, Warren Vail ___ Sent by ePrompter, the premier email notification software. Free download at http://www.ePrompter.com. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Random data loss.
I think I need to give more details. The data loss happens somewhere between the form post button press and the data being inserted into the DB. It is a simple sql insert statement on a table with auto increment keys. The price should be entered as a floating point number and that is what my user who had the problem happen did. 34.72 in one case. The price that ended up in the DB was zero. I tried to see if maybe there was a mistake by putting in two periods but that just makes it store 34.00 instead. I tried spaces around the numbers and that didn't have any effect. In every case where this has happened the user was able to use the web form for modifying the data and changed the price back, post the form which then executes an update sql statement and that corrected the data. The only thing I can think might be the cause is the data is actually stored in 2 tables. The first table, Gift, stores the basic information about the Gift you want and the second table, Vendor, stores the information about where to get it as well as the price. I am including the the queries below. A quick not the Gift table is a double key table on UserKey and GiftKey and the Vendor table is a triple key table on UserKey, GiftKey and VendorKey. It was set up this way to allow a one to many relationship between Gift and Vendor, however at this time the relationship is always a one to one. $query = INSERT INTO Gift Values \n('$UserKey', NULL, '$Description', '$Qty', '0',\n; $query .= '$Manufacturer', '$ModelNum', '$InfoURL', '$ImageURL', '$Category',\n; $query .= '$Priority', '$AddDate', '$ExpireDate'\n); $result = mysql_query($query); if(! $result){ $ErrorMsg = I'm sorry, there was a database error, please try again later.BR\n . mysql_error(); include 'AddGiftForm.php'; exit; } $GiftKey = mysql_insert_id($link); $query1 = INSERT INTO Vendor Values \n('$UserKey', '$GiftKey', NULL, '$Price', '$VName', '$VURL',\n; $query1 .= '$VStreetAddress', '$VCity', '$VState', '$VZIP', '$Phone'); $result = mysql_query($query1); if(! $result){ $ErrorMsg = I'm sorry, there was a database error, please try again later.BR\n . mysql_error(); include 'AddGiftForm.php'; exit; } Chris W Gift Giving Made Easy Get the gifts you want give the gifts they want this holiday season http://thewishzone.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] FCK Editor
Ah yes, I had fogotten, I did write that code myself to limit it to IE and my modifications have not been updated for a while. You might checkout the source site for htmlarea to see about compatibility. http://www.htmlarea.com/ I suppose if it had more capability, it probably wouldn't be free, and that would be a shame. Warren Vail -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Tuesday, December 07, 2004 11:37 AM To: [EMAIL PROTECTED] Cc: Vail, Warren Subject: RE: [PHP] FCK Editor It worked on my IE and I don't have .NET Framework installed, so guess it's not a .NET specific thing. Did not work on my Firefox (as it was advertised not to). I havn't looked at the code, but it's not a matter of the module doing a browser detect and 'downshifting' if it didn't detect a genuine IE browser is it? Firefox and the other big name browsers can do most of what IE can do, but I can still see that some internal controls might be outside of their reach. Just a thought. -TG *** new email address [EMAIL PROTECTED] *** old email address [EMAIL PROTECTED] (dead) = = = Original message = = = I believe they this particular editor uses a html rendering and editing control that is a part of IE and windows (probably .net, but not sure). Probably won't work in these other browsers, because they are committed to their own editor. If you don't have IE, then you are stuck with the textarea and coding your own html. I know this list includes lots of individuals who like to remain off the beaten path (sometimes myself), but you sometimes pay a price for that. http://www.phpnuke.org/modules.php?name=Statistics PHP Nuke's statistics page shows percentages of visits using various editors, you may find interesting. Good luck, Warren Vail ___ Sent by ePrompter, the premier email notification software. Free download at http://www.ePrompter.com. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re:[PHP] Magic-quotes
Jeff McKeon wrote: So now the big question which will undoubtly spark a lot of opinions (I hope). We use apache/php/mysql based sites for internal management of our systems and would now like to give our customers direct access to manage their accounts via the web. Naturally this raises security concerns. From the PHP perspective, is Apache/PHP(as Module)/MySQL a secure enough platform to use for a public website that will access a production database? Opinions? Thoughts? Let me re-phrase your question: We normally do inside Sales and B2B Sales. We're about to open a StoreFront. Is that secure enough? :-) One useful tidbit, however: If you have a bunch of tables/data in MySQL that do *NOT* need to be publicly accessible, consider setting up a replication setup where only *some* of the tables are on the public site. That, however, is an all-MySQL issue. http://mysql.com -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Sessions and multiple windows
On Tuesday 07 December 2004 21:48, Rory McKinley wrote: So if I understand you correctly if the first page takes a half hour to complete its queries, then the second page is going to sit for a half an hour before it can access the session variables? In theory yes. But most likely your browser would have timed out by then, and whether the second page continues to execute after browser has timed out depends on the ignore_user_abort setting. So the only way for the user to be able to do anything while the first page is at work is to get a new session id for each new window? Depends on how you structure your application. You're using the session data to keep track of the state of your application? For that to be feasible the state can only be changed by one process at any one time. PHP's session handling takes care of that little detail for you. What you need to do is to minimise the time that your application spends in-between states ie where the state is undefined. The state is undefined when the session is open (ie session_start()) and will remain so until you have finalised it by writing what you need into the $_SESSION and doing session_write_close(). So, if your lengthy processing bit is not related to your application state then do your application state stuff first, update $_SESSION, close session, then do your lengthy processing. Now if you need to update $_SESSION after your lengthy process you can always do another session_start(). However if your other pages depends on the result of the lengthy process then this is no getting around the fact that access to those pages have to be blocked until the process is finished. In such a case, is there any way to pass information between sets of session variables in such a case? (I.e from $_SESSION['policeman'] of session number 1 and $_SESSIOn['policeman'] of session number 2) It's easier to share information than to 'pass'. You can store shared info in a database. If you really really want to pass info, you have to be more specific on how, where and when you want this 'passing' to take place. -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-general -- /* Any given program will expand to fill available memory. */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Drawing checkboxes
Hello, I am having a hard time figuring this one out, maybe someone here (with fresh eyes) can offer a suggestion? Here is the function... // Draw Checkbox Menu function draw_checkbox_menu($name, $values, $default = false, $parameters = false) { for ($i=0; $isizeof($values); $i++) { $field .= 'input type=checkbox name='.$name.' value=' . $values[$i]['id'] . ''; if(strstr($default, $values[$i]['id'])) { $field .= ' CHECKED'; } $field .= ' ' . $values[$i]['text'] . 'br '; } return $field; } This function is passed the name of the checkbox list($name), the values that are available($values = array) along with the ones that should be checked ($default). Parameters too , but not important. The problem is this. The Values are formatted like this... value1|value2|value3...etc... I use the strstr() function to check against the $default so I can check it if so. Well it works great..BUT, lets say the product has a category of Coffee Pots, but the one of the values available is Coffee. In this case both Coffee AND Coffee Pots get checked when only Coffee Pots should. What can I do to this function eliminate this? Thanks ++ Mike Yrabedra [EMAIL PROTECTED] Your Mac Intelligence Resource ++ W: http://www.macagent.com/ E: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] FCK Editor
Vail, Warren wrote: I believe they this particular editor uses a html rendering and editing control that is a part of IE and windows (probably .net, but not sure). Probably won't work in these other browsers, because they are committed to their own editor. If you don't have IE, then you are stuck with the textarea and coding your own html. I know this list includes lots of individuals who like to remain off the beaten path (sometimes myself), but you sometimes pay a price for that. http://www.phpnuke.org/modules.php?name=Statistics PHP Nuke's statistics page shows percentages of visits using various editors, you may find interesting. [soapbox, not directed at Warran, Afan, or anybody in particular] How to lie with statistics 101. Ya know, I get more and more irked every day by the repeated use of low percentages of browser users as a reason for non-standard usage. The fact is, if you multiply that percentage by the number of page views, suddenly it's a different scenario! Also, every person I see who pulls out these stats does so because their site doesn't support other browsers. Well, duh. If your site doesn't work with my browser, I go away, and you get a lot less page views from my browser. But let's assume that reliable percentages for standards-compliant works-in-all-browsers sites were actually available, and matched those percentages posted. Bottom Line: Translate percentages into numbers of user, and then decide. You'll make a different choice. .2% is nothing. .2% of 102369726 is quite a lot. -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Php in Cgi
I am learning Php and have a web site host where scripts have to be in the cgi-bin. What is put in the original web page to call a script from the cgi-bin? The info from the web host is below. Thanks, Peter Does your webserver support PHP? Yes, our webserver does support PHP version 4. What is PHP? PHP (recursive acronym for PHP: Hypertext Preprocessor) is a widely-used Open Source general-purpose scripting language that is especially suited for Web development and can be embedded into HTML. How do I use PHP? You need to upload your PHP scripts to the cgi-bin directory in your web space. The script needs to be saved in UNIX format with the extension of .php. All scripts need to have the following permissions. (You should consult your FTP client documentation for information on changing permissions). The first line of each PHP file must start with: #!/usr/bin/php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP Security
I subscribe to a number of security mailing lists as I suspect many of you do, being developers and all. The other day a post came across one of those mailing lists discussing PHP security. One of the posters was describing how insecure PHP's file upload functionality is and went on to explain a simple method of attaching exploit code to the end of a jpeg or other image format, then proceeding in uploading the image to the target site that accepted image uploads. The code would be executed as PHP in spite of the file type detection. I'd think there would be no need to parse a jpeg as PHP, right? Needless to say this discussion quickly caught my attention and I began to defend PHP explaining how the unsafe functions could be disabled via the php.ini and so forth. But then I began to wonder.. surely if an exploit were possible the PHP folks would have been informed and the source would have been patched by now, right? I guess my question is.. is PHP's file upload functionality really safe? I myself have a lot at stake if it's not. I don't know much about writing exploits, I just try to keep up to date on security patches and bulletins and all. But these security guys really seem to think PHP is insecure as far as file uploading, so now I'm wondering about it all. Chris has excellent info on general PHP security (http://shiflett.org/php-security.pdf) and I re-read it today before posting. But how does one go about filtering a jpeg for exploit code? Seems the only winning move is to not play. -- Greg Donald Zend Certified Engineer http://gdconsultants.com/ http://destiney.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Drawing checkboxes
Mike mailto:[EMAIL PROTECTED] on Tuesday, December 07, 2004 12:11 PM said: I use the strstr() function to check against the $default so I can check it if so. Well it works great..BUT, lets say the product has a category of Coffee Pots, but the one of the values available is Coffee. In this case both Coffee AND Coffee Pots get checked when only Coffee Pots should. What can I do to this function eliminate this? don't look for merely the existence of Coffee but instead look for an exact match. Change: if(strstr($default, $values[$i]['id'])) { $field .= ' CHECKED'; } Into: if($default == $values[$i]['id']) { $field .= ' CHECKED'; } ?? That will work unless I'm not understanding how $default and $values[$i]['id'] are defined. hth, Chris. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Drawing checkboxes
Thanks Chris, but the $default variable is a string of values separated by pipe delimiters. Like so 'value1|value2|value3' So 'value1' should be true Whereas 'val' should not be. Make sense? on 12/7/04 3:54 PM, Chris W. Parker at [EMAIL PROTECTED] wrote: Mike mailto:[EMAIL PROTECTED] on Tuesday, December 07, 2004 12:11 PM said: I use the strstr() function to check against the $default so I can check it if so. Well it works great..BUT, lets say the product has a category of Coffee Pots, but the one of the values available is Coffee. In this case both Coffee AND Coffee Pots get checked when only Coffee Pots should. What can I do to this function eliminate this? don't look for merely the existence of Coffee but instead look for an exact match. Change: if(strstr($default, $values[$i]['id'])) { $field .= ' CHECKED'; } Into: if($default == $values[$i]['id']) { $field .= ' CHECKED'; } ?? That will work unless I'm not understanding how $default and $values[$i]['id'] are defined. hth, Chris. ++ Mike Yrabedra [EMAIL PROTECTED] Your Mac Intelligence Resource ++ W: http://www.macagent.com/ E: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Drawing checkboxes
If I understand you, calling the function like so : /**/ $value1 = coffee; $value2 = coffee pots; $returned = estrstr($value1, $value2); /**/ returns the string coffee. Well, I just ran that exact piece of code you see above, and received the expected NULL value. I don't see how you are getting what you are getting. If, one the other hand, you are searching for value coffee expecting to get back only coffee pots, then you misunderstand how the function works. Hope this helps, Scott -Original Message- From: Mike [mailto:[EMAIL PROTECTED] Sent: Tuesday, December 07, 2004 3:11 PM To: PHP List Subject: [PHP] Drawing checkboxes Hello, I am having a hard time figuring this one out, maybe someone here (with fresh eyes) can offer a suggestion? Here is the function... // Draw Checkbox Menu function draw_checkbox_menu($name, $values, $default = false, $parameters = false) { for ($i=0; $isizeof($values); $i++) { $field .= 'input type=checkbox name='.$name.' value=' . $values[$i]['id'] . ''; if(strstr($default, $values[$i]['id'])) { $field .= ' CHECKED'; } $field .= ' ' . $values[$i]['text'] . 'br '; } return $field; } This function is passed the name of the checkbox list($name), the values that are available($values = array) along with the ones that should be checked ($default). Parameters too , but not important. The problem is this. The Values are formatted like this... value1|value2|value3...etc... I use the strstr() function to check against the $default so I can check it if so. Well it works great..BUT, lets say the product has a category of Coffee Pots, but the one of the values available is Coffee. In this case both Coffee AND Coffee Pots get checked when only Coffee Pots should. What can I do to this function eliminate this? Thanks ++ Mike Yrabedra [EMAIL PROTECTED] Your Mac Intelligence Resource ++ W: http://www.macagent.com/ E: [EMAIL PROTECTED] -- 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] Drawing checkboxes
A few notes that may help you. first.on strstri would use strpos instead for a simple checkso if(strstr($default, $values[$i]['id'])) { $field .= ' CHECKED'; } would become if(strpos($default, $values[$i]['id']) !== false) { $field .= ' CHECKED'; } note the double equals...not a mistakesee note in php docs about that...the reason for using strpos is that strstr is a much longer check than needed.anyways...on to your problem. there is a slight logic issue (i think) lets say your values are $values = foo bar|foo; this test (i think) should return true if(strstr(foo, $values)) because it just looks for the first occurence of the string to fix this. I would change it to this. $checkValues = array() $checkValues = explode(|, $values[$i]['id']); if(in_array($default, $checkValues)) { $field .= ' CHECKED'; } there may be a better/faster way to do this, but this should work hope this helps, chris On Tue, 07 Dec 2004 15:10:59 -0500, Mike [EMAIL PROTECTED] wrote: Hello, I am having a hard time figuring this one out, maybe someone here (with fresh eyes) can offer a suggestion? Here is the function... // Draw Checkbox Menu function draw_checkbox_menu($name, $values, $default = false, $parameters = false) { for ($i=0; $isizeof($values); $i++) { $field .= 'input type=checkbox name='.$name.' value=' . $values[$i]['id'] . ''; if(strstr($default, $values[$i]['id'])) { $field .= ' CHECKED'; } $field .= ' ' . $values[$i]['text'] . 'br '; } return $field; } This function is passed the name of the checkbox list($name), the values that are available($values = array) along with the ones that should be checked ($default). Parameters too , but not important. The problem is this. The Values are formatted like this... value1|value2|value3...etc... I use the strstr() function to check against the $default so I can check it if so. Well it works great..BUT, lets say the product has a category of Coffee Pots, but the one of the values available is Coffee. In this case both Coffee AND Coffee Pots get checked when only Coffee Pots should. What can I do to this function eliminate this? Thanks ++ Mike Yrabedra [EMAIL PROTECTED] Your Mac Intelligence Resource ++ W: http://www.macagent.com/ E: [EMAIL PROTECTED] -- 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] Drawing checkboxes
Chris, Good idea, but $default is the value with pipe delimiters. on 12/7/04 4:11 PM, Christopher Fulton at [EMAIL PROTECTED] wrote: A few notes that may help you. first.on strstri would use strpos instead for a simple checkso if(strstr($default, $values[$i]['id'])) { $field .= ' CHECKED'; } would become if(strpos($default, $values[$i]['id']) !== false) { $field .= ' CHECKED'; } note the double equals...not a mistakesee note in php docs about that...the reason for using strpos is that strstr is a much longer check than needed.anyways...on to your problem. there is a slight logic issue (i think) lets say your values are $values = foo bar|foo; this test (i think) should return true if(strstr(foo, $values)) because it just looks for the first occurence of the string to fix this. I would change it to this. $checkValues = array() $checkValues = explode(|, $values[$i]['id']); if(in_array($default, $checkValues)) { $field .= ' CHECKED'; } there may be a better/faster way to do this, but this should work hope this helps, chris On Tue, 07 Dec 2004 15:10:59 -0500, Mike [EMAIL PROTECTED] wrote: Hello, I am having a hard time figuring this one out, maybe someone here (with fresh eyes) can offer a suggestion? Here is the function... // Draw Checkbox Menu function draw_checkbox_menu($name, $values, $default = false, $parameters = false) { for ($i=0; $isizeof($values); $i++) { $field .= 'input type=checkbox name='.$name.' value=' . $values[$i]['id'] . ''; if(strstr($default, $values[$i]['id'])) { $field .= ' CHECKED'; } $field .= ' ' . $values[$i]['text'] . 'br '; } return $field; } This function is passed the name of the checkbox list($name), the values that are available($values = array) along with the ones that should be checked ($default). Parameters too , but not important. The problem is this. The Values are formatted like this... value1|value2|value3...etc... I use the strstr() function to check against the $default so I can check it if so. Well it works great..BUT, lets say the product has a category of Coffee Pots, but the one of the values available is Coffee. In this case both Coffee AND Coffee Pots get checked when only Coffee Pots should. What can I do to this function eliminate this? Thanks ++ Mike Yrabedra [EMAIL PROTECTED] Your Mac Intelligence Resource ++ W: http://www.macagent.com/ E: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php ++ Mike Yrabedra [EMAIL PROTECTED] Your Mac Intelligence Resource ++ W: http://www.macagent.com/ E: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Drawing checkboxes
so switch the two things. I would change it to this. $checkValues = array() $checkValues = explode(|, $default); if(in_array($values[$i]['id'], $checkValues)) { $field .= ' CHECKED'; } i could be misinterpreting ya, but i think that would work...actually...if default is going to be the same...i would pull the checkValues part out of the loop, so you don't perform the explode for every valuebut, that would work (i think?) -chris On Tue, 07 Dec 2004 16:21:15 -0500, Mike [EMAIL PROTECTED] wrote: Chris, Good idea, but $default is the value with pipe delimiters. on 12/7/04 4:11 PM, Christopher Fulton at [EMAIL PROTECTED] wrote: A few notes that may help you. first.on strstri would use strpos instead for a simple checkso if(strstr($default, $values[$i]['id'])) { $field .= ' CHECKED'; } would become if(strpos($default, $values[$i]['id']) !== false) { $field .= ' CHECKED'; } note the double equals...not a mistakesee note in php docs about that...the reason for using strpos is that strstr is a much longer check than needed.anyways...on to your problem. there is a slight logic issue (i think) lets say your values are $values = foo bar|foo; this test (i think) should return true if(strstr(foo, $values)) because it just looks for the first occurence of the string to fix this. I would change it to this. $checkValues = array() $checkValues = explode(|, $values[$i]['id']); if(in_array($default, $checkValues)) { $field .= ' CHECKED'; } there may be a better/faster way to do this, but this should work hope this helps, chris On Tue, 07 Dec 2004 15:10:59 -0500, Mike [EMAIL PROTECTED] wrote: Hello, I am having a hard time figuring this one out, maybe someone here (with fresh eyes) can offer a suggestion? Here is the function... // Draw Checkbox Menu function draw_checkbox_menu($name, $values, $default = false, $parameters = false) { for ($i=0; $isizeof($values); $i++) { $field .= 'input type=checkbox name='.$name.' value=' . $values[$i]['id'] . ''; if(strstr($default, $values[$i]['id'])) { $field .= ' CHECKED'; } $field .= ' ' . $values[$i]['text'] . 'br '; } return $field; } This function is passed the name of the checkbox list($name), the values that are available($values = array) along with the ones that should be checked ($default). Parameters too , but not important. The problem is this. The Values are formatted like this... value1|value2|value3...etc... I use the strstr() function to check against the $default so I can check it if so. Well it works great..BUT, lets say the product has a category of Coffee Pots, but the one of the values available is Coffee. In this case both Coffee AND Coffee Pots get checked when only Coffee Pots should. What can I do to this function eliminate this? Thanks ++ Mike Yrabedra [EMAIL PROTECTED] Your Mac Intelligence Resource ++ W: http://www.macagent.com/ E: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php ++ Mike Yrabedra [EMAIL PROTECTED] Your Mac Intelligence Resource ++ W: http://www.macagent.com/ E: [EMAIL PROTECTED] -- 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] Re: PEAR performance/overhead
* David Dickson [EMAIL PROTECTED]: I was told that PEAR has too much overhead to be considered for a large scale site. Does any one feel the same? Is this an outrageous comment? I would like to hear comments from people who are using PEAR, or people who have considered PEAR but decided not to use it and your reasons. I would ask for specifics -- what is perceived as overhead? what kind of performance degradation is witnessed? does the loss in performance outweigh the benefits to development (i.e., does it cost more to pay a programmer than to purchase hardware/bandwidth?)? Benchmark some code yourself, as well. Write a sample application using PEAR -- and then an equivalent version without. Compare the amount of time it took to develop each. Then benchmark each piece of code on the webserver. For what it's worth, we've decided that the benefits of PEAR -- standard resources, standard error handling, database agnosticism, and more -- coupled with a development model that heavily utilizes inheritance (so we don't have to reimplement code all over the place, which makes bugfixes nightmarish) -- far outweigh any performance issues. And that's without doing benchmarking. Our time is simply too valuable. -- Matthew Weier O'Phinney | mailto:[EMAIL PROTECTED] Webmaster and IT Specialist | http://www.garden.org National Gardening Association| http://www.kidsgardening.com 802-863-5251 x156 | http://nationalgardenmonth.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP Security
--- Greg Donald [EMAIL PROTECTED] wrote: The other day a post came across one of those mailing lists discussing PHP security. One of the posters was describing how insecure PHP's file upload functionality is and went on to explain a simple method of attaching exploit code to the end of a jpeg or other image format, then proceeding in uploading the image to the target site that accepted image uploads. The code would be executed as PHP in spite of the file type detection. I would challenge him to provide an example exploit. That will probably end the debate, but just in case he actually knows what he's talking about, it gives him an opportunity to clarify his point. I'd think there would be no need to parse a jpeg as PHP, right? Apache (and I assume most any HTTP server) uses the file extension to determine the content type, so anything named foo.jpg will not be parsed by the PHP engine (unless, for some crazy reason, you specifically configure Apache to do so, or you mistakenly use ForceType incorrectly). If you let someone upload a file, and you let them choose the name, and you put that file within document root, then yes, you have a pretty serious vulnerability. But, that's just stupid. You can be stupid in any language. :-) Needless to say this discussion quickly caught my attention and I began to defend PHP explaining how the unsafe functions could be disabled via the php.ini and so forth. But then I began to wonder.. surely if an exploit were possible the PHP folks would have been informed and the source would have been patched by now, right? Most likely. It's unfortunate, but most people who raise concerns like this have no idea what they're talking about. The reason I find it unfortunate is that realistic concerns can be lost in the crowd. This could be a realistic concern, but I'd need more details to determine that. I guess my question is.. is PHP's file upload functionality really safe? I myself have a lot at stake if it's not. I would say it's no more or less safe than most mechanisms. PHP provides you with information about an uploaded file in the $_FILES superglobal array. What you do with it is up to you. You can certainly write code that trusts information sent by the client, but you shouldn't. My only complaint (it's minor) with PHP's implementation is that a developer can't easily determine what data in $_FILES comes from the client. Because some of the information therein is provided by PHP (and therefore reliable), it's not like $_GET where you can safely assume that everything comes from the client. This lack of distinction makes it a bit more difficult to be a security-conscious developer. I don't know much about writing exploits, I just try to keep up to date on security patches and bulletins and all. But these security guys really seem to think PHP is insecure as far as file uploading, so now I'm wondering about it all. PHP gets a bad rap because of the multitude of insecure applications written in the language, and (more importantly) the tendency to name applications PHP something. This means that those who keep up with things like Security Focus see PHP mentioned all the time, and they have a poor opinion of it. Of course, in reality, what they see are names like phpBB and PHP-Nuke, not PHP itself. Chris has excellent info on general PHP security (http://shiflett.org/php-security.pdf) and I re-read it today before posting. But how does one go about filtering a jpeg for exploit code? Seems the only winning move is to not play. Thanks for the kind words. While I stand behind everything within that PDF, I don't want anyone to think that it's anywhere near complete. It began as a companion to my OSCON talk on PHP security (and it's changed very little since), so it only covers the topics that I chose for a 3 hour talk. File uploads were not part of that. I did write a Security Corner (my column in php|architect) on file uploads in the October issue, but that is not available for free yet (it won't be until April). Sorry that I don't have a better resource for you - I've always felt that file uploads weren't as common as most of the other topics that I frequently write about. Hope that helps. Chris = Chris Shiflett - http://shiflett.org/ PHP Security - O'Reilly HTTP Developer's Handbook - Sams Coming Soon http://httphandbook.org/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] ini_set doesn't work
hello, what do I have to change in php.ini, to allow thr ini_set(memory_limit,-1); command? It doesn't work in my script... regards Joerg -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] eBay API?
never tried it, looks intense though http://pear.php.net/package/Services_Ebay Hi, Is anyone use eBay API? or REST only? What i want to do is searching items from eBay and store those data in my own database. Anybody did this before? -- 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 display the content step by step
Just like many applications, I want to display my main content table a sector after a sector, may be row ater row. Coz the html may wait until the whole table be downloaded then to show it, but I see some application like the Web calendar http://www.k5n.us/webcalendar.php?topic=Demo Anyone here know about this? Best wishes, Yangshiqi
[PHP] eBay API?
Hi, Is anyone use eBay API? or REST only? What i want to do is searching items from eBay and store those data in my own database. Anybody did this before? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Desparate
Best groupmember, I just moved to Bangkok and have a huge problem. My ISP does not provide a news-server. For the news.php.net there is no problem, but I can not locate any other discussion groups. Is there any open news-servers that can be used instead of ISP-connected news-server? Ex: news.opennewsserver.com I know that this is not supposed to be posted in this group, not relevant to the subject, sorry about that. But I have tried to find a solution for two weeks now. -- - Best Of Times /Peter Lauri -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] ini_set doesn't work
Try ini_set(memory_limit, -1); regards Assey On Wed, 8 Dec 2004, Joerg P wrote: hello, what do I have to change in php.ini, to allow thr ini_set(memory_limit,-1); command? It doesn't work in my script... regards Joerg -- 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] OT Re: Desparate
On Wed, 8 Dec 2004 16:31, Peter Lauri wrote: Best groupmember, I just moved to Bangkok and have a huge problem. My ISP does not provide a news-server. For the news.php.net there is no problem, but I can not locate any other discussion groups. Is there any open news-servers that can be used instead of ISP-connected news-server? Ex: news.opennewsserver.com I know that this is not supposed to be posted in this group, not relevant to the subject, sorry about that. But I have tried to find a solution for two weeks now. Try something from here: http://directory.google.com/Top/Computers/Usenet/Public_News_Servers/ Google is your friend -- David Robley Thesaurus: ancient reptile with an excellent vocabulary. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php