[PHP] Error Trapping
I'm having a hard time getting my head around this problem. I have to connect to a FoxPro database using an ODBC driver. Sometimes when I connect I get an error. The error doesn't occur all the time and usually another connect attempt works. I can trap the error through an error handler. However, I use a class to connect to the database. What I want to do is to check for that error and, if it occurs, try to connect again. Since the error handler is outside the class, how can I create the object again and make sure it gets passed back to my script that called it? I hope that made sense! Thanks! Floyd -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Error Trapping
Eddie, Thanks for the tip. It suddenly occurred to me what I was doing wrong. I do use an error trap but I was telling my script to stop running after the error. So, now I ignore it and continue through the loop you suggested. I guess it was working exactly the way I had written it! Thanks! Floyd On Jul 10, 2009, at 11:23 AM, Eddie Drapkin wrote: On Fri, Jul 10, 2009 at 10:56 AM, Floyd Reslerintl.com> wrote: I'm having a hard time getting my head around this problem. I have to connect to a FoxPro database using an ODBC driver. Sometimes when I connect I get an error. The error doesn't occur all the time and usually another connect attempt works. I can trap the error through an error handler. However, I use a class to connect to the database. What I want to do is to check for that error and, if it occurs, try to connect again. Since the error handler is outside the class, how can I create the object again and make sure it gets passed back to my script that called it? I hope that made sense! Thanks! Floyd Why is the error outside the class? If you connect with a class, something like: public function __construct() { $this->handle = false; while($this->handle === false) { $this->handle == odbc_connect(); } } ought to work fine. Alternatively, you could check out PDO, which is supposed to be the next generation of database connections in PHP, and won't create an object without a connection. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] mod primary key field - newbie question
Sounds like you want to set the auto increment. To do that, use this query: alter table `table_name` auto_increment 1; That will reset it to one. Although I've never tried it, I assume you can give it another value. Take care, Floyd On Jul 13, 2009, at 5:35 PM, c...@hosting4days.com wrote: newbie question ... I have a MySQL table where I want to update (renumber) the primary numeric key field. - I successfully turned field off as a primary key index and UN auto incremented it - then created new sequential numbers for it - then turned back on primary key index and re added auto increment in BUT when I make a new record it does NOT start where new numbers stop last is 51 next should be 52 but jumps to 157 Q: is there a way to reset the NEXT SERIAL ID NUMBER somewhere? how do I fix this? -- Thanks - RevDave Cool @ hosting4days . com [db-lists 09] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Back from the dead with a racing question!
On Jul 17, 2009, at 1:54 PM, Jason Pruim wrote: On Jul 17, 2009, at 11:56 AM, Bastien Koert wrote: On Fri, Jul 17, 2009 at 11:51 AM, tedd wrote: At 11:12 AM -0400 7/17/09, Jason Pruim wrote: Hi everyone! So some of you may have noticed that I have been away for quite awhile... Been trying to get settled (Moved across the country) and getting a job. And now that that is done I have a question about a project that I might be doing for my current employer and want to do it properly. If all goes through, I'll be writing an online database that upwards of 10 people will be using at various times through out the day. Basically, in a form they fill out a model number, customer name, phone number etc. etc.. And then submit the form. After submitting they need to write the log number on some paperwork. If I have 2 people submit the form at the same time, I'm thinking I could end up with a race condition and they might get the wrong log number (The log number is simply a consecutive record number) Do I need to be reading up on locking tables/rows? Or in my situation as I've briefly described it do I not have to worry about it? Or is there a third door with the magic bullet that will solve all my problems? :) Any advice is greatly appreciated as always, RTFMing is good as well, as long as M is defined :) I'm not afraid of google either, just need the right terms to hit it with so I don't go into "search overload" as the commercials for a rival search engine claim :) Thanks Everyone! Jason: Welcome back. Clearly if you have two or more people checkout the same record at the same time and each edits the record then you ARE going to have problems when each updates the record. You can solve this problem by using transactions -- here's a link: http://dev.mysql.com/doc/refman/5.0/en/lock-tables-and-transactions.html When someone is editing a record, you also need to be able to show the next person(s) that the record they want is currently busy and not available. However, I'm not sure as to how to notify the next user that the table is locked via php. Perhaps a table status might provide that information. If so, then use that to notify the next user. As for your log of activity, just create a another record (with an auto_increment index) in your activity log table and update that record with the data you need to record, such as user id, timestamp, what record they accessed and whatever else you want after the transaction is completed. Cheers, tedd -- --- http://sperling.com http://ancientstones.com http:// earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php As a further note to tedd's reply on transactions, you will need to use the INNODB engine in mysql should you want to use transactions. Transactions here are done a row locking level not table so you should have fewer issues. I also just found out that unless I can convince them to host it off site, it'll be on a windows machine So php & mssql... Does that change alot? To answer some of the other questions the Log number is currently just an auto incrementing consuctive number. So an auto+increment would work perfectly. What I'm trying to avoid is: User1 User2 User1 submits to log number 12345 User2 submits to log number 12346 User1 is told their log number is 12346 User2 is told their log number is 12346 But User1 & User2 are on different computers... And if it's as easy as using the equivelant for: SELECT * FROM table WHERE UserID="User1" ORDER BY lognumber desc LIMIT 1; Then I'm good... I know how to proceed with writing it... Just need to figure out how to bill/sell it! ;) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Here's something I do. One of our clients likes to see job numbers instead of record numbers. So, I simply convert the record number into a job number. It begins with the current year and then I pad it out to 10 characters. So, record number 72 becomes job number 200972. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP and FoxPro
We currently use the Easysoft ODBC Bridge to connect to a remote FoxPro database. The problem is that the bridge, after a while, starts consuming a ton of system resources and we have to reboot the machine. Afterwards, it can take upwards to two hours before everything is running quickly again. We need another solution. Does anyone know of a any other way to connect to a remote FoxPro database (or any ODBC source that isn't a database server)? Thanks! Floyd -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP and FoxPro
Paul, Believe me I would like nothing more that to get rid of FoxPro and convert it to MySQL. Sadly, that's not possible right now. I'll check into dBase. Thanks! Floyd On Jul 19, 2009, at 4:53 PM, Paul M Foster wrote: On Sun, Jul 19, 2009 at 09:00:49AM -0400, Floyd Resler wrote: We currently use the Easysoft ODBC Bridge to connect to a remote FoxPro database. The problem is that the bridge, after a while, starts consuming a ton of system resources and we have to reboot the machine. Afterwards, it can take upwards to two hours before everything is running quickly again. We need another solution. Does anyone know of a any other way to connect to a remote FoxPro database (or any ODBC source that isn't a database server)? No way to convert the FoxPro to PostgreSQL or MySQL? FoxPro is ancient and decrepit (I used to code in FoxPro). There is a dBase module for PHP. I don't know if it handles generic xBase files. I don't know much about the module, but you could check it out. Paul -- Paul M. Foster -- 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 and FoxPro
Matt, Thanks for the information. I'll look into using ODBTP. I noticed you mentioned the problem with memos. I currently have that problem with the set up we're using and it is a pain! Thanks! Floyd On Jul 20, 2009, at 3:22 PM, Matt Neimeyer wrote: We currently use the Easysoft ODBC Bridge to connect to a remote FoxPro database. The problem is that the bridge, after a while, starts consuming a ton of system resources and we have to reboot the machine. Afterwards, it can take upwards to two hours before everything is running quickly again. We need another solution. Does anyone know of a any other way to connect to a remote FoxPro database (or any ODBC source that isn't a database server)? We've had a LOT a luck using ODBTP. Which can be found at http://odbtp.sourceforge.net Here's the rough outline... 1. Install Visual FoxPro odbc driver (or whatever drivers you want) on a Windows machine. 2. Install the ODBTP Server on the windows machine 3. Install a PHP module in your php. (Common ones included in the download) 4. Once you connect the functions are ALMOST exactly the same in usage as the mysql_xyz functions. A couple gotchas: 1. If you need to compile the PHP ODBTP module from source on x64 (OS X Leopard at least) it can be a pain. 2. The VFP 6.0 ODBC driver (not sure about higher versions) does not allow more than 250 odd characters to be inserted at a single time so memo's can be a PAIN. 3. It does require a port be opened on the Windows machine's firewall... (Uses TCP/IP for communication) 4. By default the ODBTP server can use up to 32 threads. The VFP ODBC driver is by nature single threaded. We've never had a problem with that directly but I assume it is what causes threads to slowly hang and disappear... eventually a message comes up "Unable to create thread". At that point you simply need to restart the ODBTP service in the Windows Services Control Panel. The bigger the tables and the more heavily used it is the more often this will happen. Other than that... Works like a charm. Looking forward, once you bite the bullet and convert to MySQL (at least for us) you can almost change odbtp_ to mysql_ and be up and running. (Assuming you limit yourself to "pure" SQL and not invoke VFP functions.) Matt -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP and FoxPro
Matt, Thanks for the tip on handling memos. I always thought, "If I could just append to the end of the existing string..." but never figured out how to do it. I'll give your method a shot. Thanks! Floyd On Jul 21, 2009, at 2:04 PM, Matt Neimeyer wrote: What I did to handle memos... and it's a HACK... was to create a function DoMemo that took as arguments the table, the primary key field of the table, the value of said pk, the field to update, and the string. Take the first 200 characters of the string. Replace all newlines in that substring with "+CHR(13)+" (Or CHR(13)+CHR(10)?) Then do something like: UPDATE table SET field=First200 WHERE pk=pkvalue Then take the next 200 characters of the string. Replace all newlines as above Do something like: UPDATE table SET field=ALLTRIM(field)+Next200 WHERE pk=pkvalue Repeat until you've "consumed" the entire string. This works because you never put in more that 250 odd characters at a time. It can still fail though if you have enough newlines to push your 200 characters up over the 250 odd character limit. It DOES work if you use RECNO() as the pk field and the appropriate recno() that you would get if you did something like SELECT recno() AS myrecno,* FROM sometable (I use the myrecno because otherwise you get some weird exp_1 field name) It just popped into my head... I wonder if something like this would work... UPDATE sometable SET a=1,a=a+1,a=a+1,a=a+1 WHERE x=y You might be able to limit the total number of calls to the database that way... If I wasn't in the process of migrating to MySQL I might give it a whirl... :) Hope this helps whatever you decide to do. On Tue, Jul 21, 2009 at 8:27 AM, Floyd Resler wrote: Matt, Thanks for the information. I'll look into using ODBTP. I noticed you mentioned the problem with memos. I currently have that problem with the set up we're using and it is a pain! Thanks! Floyd On Jul 20, 2009, at 3:22 PM, Matt Neimeyer wrote: We currently use the Easysoft ODBC Bridge to connect to a remote FoxPro database. The problem is that the bridge, after a while, starts consuming a ton of system resources and we have to reboot the machine. Afterwards, it can take upwards to two hours before everything is running quickly again. We need another solution. Does anyone know of a any other way to connect to a remote FoxPro database (or any ODBC source that isn't a database server)? We've had a LOT a luck using ODBTP. Which can be found at http://odbtp.sourceforge.net Here's the rough outline... 1. Install Visual FoxPro odbc driver (or whatever drivers you want) on a Windows machine. 2. Install the ODBTP Server on the windows machine 3. Install a PHP module in your php. (Common ones included in the download) 4. Once you connect the functions are ALMOST exactly the same in usage as the mysql_xyz functions. A couple gotchas: 1. If you need to compile the PHP ODBTP module from source on x64 (OS X Leopard at least) it can be a pain. 2. The VFP 6.0 ODBC driver (not sure about higher versions) does not allow more than 250 odd characters to be inserted at a single time so memo's can be a PAIN. 3. It does require a port be opened on the Windows machine's firewall... (Uses TCP/IP for communication) 4. By default the ODBTP server can use up to 32 threads. The VFP ODBC driver is by nature single threaded. We've never had a problem with that directly but I assume it is what causes threads to slowly hang and disappear... eventually a message comes up "Unable to create thread". At that point you simply need to restart the ODBTP service in the Windows Services Control Panel. The bigger the tables and the more heavily used it is the more often this will happen. Other than that... Works like a charm. Looking forward, once you bite the bullet and convert to MySQL (at least for us) you can almost change odbtp_ to mysql_ and be up and running. (Assuming you limit yourself to "pure" SQL and not invoke VFP functions.) Matt -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Doubt regarding session_destroy() in PHP 5
Keep in mind that sessions are based on the domain. I've run into situations where someone will be working in several different sites that we host. Each site is accessed via http://domain/site. Each site has it's own database, users, etc. However, because they all hang off the same domain, they get one session. That can really mess things up for the users as they go from site to site. I got around this by using MySQL-based sessions. It keeps things nice and separated. Take care, Floyd On Jul 21, 2009, at 4:14 PM, Devendra Jadhav wrote: Yes. You are right. Session variables are associated with the session id so only that appropriate website's session variables will get destroyed. You can try it in your local system. On Wed, Jul 22, 2009 at 12:42 AM, Guruprasad wrote: Hi all, I have a doubt with creating and destroying sessions in PHP using session_destroy(). Supposing there is a PHP-based website hosted on a web server. Now I add another site that I developed using PHP on that web server using virtualhost. I destroy a session in my website using session_destroy() which will destroy all the session variables associated with my website. What will happen if I have the other website in another tab with similar session variable names? Will the session variables of that website be destroyed too? Or will the session variables be associated with the session id so that only the appropriate website's session variables will get destroyed? Thanks in advance. Regards, Guruprasad -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Devendra Jadhav -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Doubt regarding session_destroy() in PHP 5
You can do so much more with storing sessions in a database. For example, I can determine which of my users is currently on by looking in the sessions table. Not only does using a database for sessions offer more security, it also offers more flexibility. Take care, Floyd On Jul 22, 2009, at 5:13 AM, Ashley Sheridan wrote: On Wed, 2009-07-22 at 16:07 +0700, Lenin wrote: On Wed, Jul 22, 2009 at 2:46 PM, Ashley Sheridan wrote: On Wed, 2009-07-22 at 03:45 +0700, Lenin wrote: As Floyd suggested keeping your sessions in the DB will give you better session management and security as well. Why would putting the session data in a database offer more security? I'm not meaning to try and poke holes in your idea, I genuinely don't know the answer! *Storing Session Data In A Database *When you use on-disk files to store session data, those files must be readable and writeable by PHP. On a multi-user hosting system, it is possible for other users to access your session data through the PHP process (but see the commentary on open_basedir in part 5 of this series. The best way to secure your session data is to store it in a database. source: http://www.acunetix.com/websitesecurity/php-security-6.htm I have also studied Zend Certification Study guide by Davey Shafik and Ben Ramsey who said similar things in the book. Lenin http://twitter.com/nine_L And is the database not readable and writeable by PHP? Just seems that this sort of thing could be properly sorted by the right permissions level on the file, as I assume you'd be protecting the database in a similar manner by locking down that to specific users, and determining what they could and couldn't do. Thanks Ash www.ashleysheridan.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Doubt regarding session_destroy() in PHP 5
With proper permissions I'm not sure that it's any more secure but it certainly is a whole lot more scalable. And it is very easy to set up. A web search will yield a lot of examples of using a database. I use a PHP class which I really like. Take care, Floyd On Jul 22, 2009, at 8:36 AM, Ashley Sheridan wrote: On Wed, 2009-07-22 at 08:32 -0400, Floyd Resler wrote: You can do so much more with storing sessions in a database. For example, I can determine which of my users is currently on by looking in the sessions table. Not only does using a database for sessions offer more security, it also offers more flexibility. Take care, Floyd On Jul 22, 2009, at 5:13 AM, Ashley Sheridan wrote: On Wed, 2009-07-22 at 16:07 +0700, Lenin wrote: On Wed, Jul 22, 2009 at 2:46 PM, Ashley Sheridan wrote: On Wed, 2009-07-22 at 03:45 +0700, Lenin wrote: As Floyd suggested keeping your sessions in the DB will give you better session management and security as well. Why would putting the session data in a database offer more security? I'm not meaning to try and poke holes in your idea, I genuinely don't know the answer! *Storing Session Data In A Database *When you use on-disk files to store session data, those files must be readable and writeable by PHP. On a multi-user hosting system, it is possible for other users to access your session data through the PHP process (but see the commentary on open_basedir in part 5 of this series. The best way to secure your session data is to store it in a database. source: http://www.acunetix.com/websitesecurity/php-security-6.htm I have also studied Zend Certification Study guide by Davey Shafik and Ben Ramsey who said similar things in the book. Lenin http://twitter.com/nine_L And is the database not readable and writeable by PHP? Just seems that this sort of thing could be properly sorted by the right permissions level on the file, as I assume you'd be protecting the database in a similar manner by locking down that to specific users, and determining what they could and couldn't do. Thanks Ash www.ashleysheridan.co.uk But *how* does it offer more security? You've not actually mentioned that! Thanks Ash www.ashleysheridan.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Doubt regarding session_destroy() in PHP 5
The nice thing about the database, though, is that you can specify which MySQL user has access to the sessions table. That way you can really lock it down by giving access to only INSERT, SELECT, UPDATE, and DELETE just for that table. Thanks! Floyd On Jul 22, 2009, at 9:36 AM, Andrew Ballard wrote: On Wed, Jul 22, 2009 at 8:36 AM, Ashley Sheridan wrote: But *how* does it offer more security? You've not actually mentioned that! One way would be to encapsulate data access in stored procedures and deny direct table access on the session data. That way, even though the PHP account has access to the database where all sessions are stored, it can only call a ReadSession procedure that requires the session_id() as a parameter. That way, PHP would have to know the ID of the session and could not simply SELECT * FROM sessions. However, I haven't found many examples that use stored procedures. Most just use regular INSERT/SELECT/UPDATE/DELETE statements, which means that the PHP user has full access to the entire table. In that case, it's no more trivial to scan the session table than it is to scan the session save path looking for interesting stuff. Andrew -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Structure of PHP files
When I first started programming in PHP I used the second method you mentioned. I had a single file I called utils.php and it contained all the functions I could possibly need throughout my site. Unfortunately, this file grew to be over 10,000 lines and most of the time I only needed a couple of functions for each script I loaded. I have now abandoned that method and use a more modular approach. I have a lib folder that contains much smaller and specialized scripts (mainly classes). Now I only include what I need. I found it much easier to maintain than having a single file. Take care, Floyd On Jul 23, 2009, at 5:36 AM, Sándor Tamás (HostWare Kft.) wrote: Hi, It isn't really a programming question, but rather a structural. Let's suppose I have a PHP page, which is built by other PHP files' includes. Which is the better approach: in a switch-like statement I include the required PHP files, which contain all the functions, and the HTML code to provide the functionality, or create a base PHP file which contains all the funcionality, and the PHP files only contain calls for these functions, and the HTML code? I think the previous method gives more control and it is more repairable, but the later method gives more modularity. With your experiences, what method gives the better overall usability? Thanks, SanTa -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Structure of PHP files
'Tis true. I just find dealing with the smaller files much easier. At the time I was using Komodo IDE and it would get very sluggish with the larger files. Take care, Floyd On Jul 23, 2009, at 9:34 AM, Robert Cummings wrote: Floyd Resler wrote: When I first started programming in PHP I used the second method you mentioned. I had a single file I called utils.php and it contained all the functions I could possibly need throughout my site. Unfortunately, this file grew to be over 10,000 lines and most of the time I only needed a couple of functions for each script I loaded. I have now abandoned that method and use a more modular approach. I have a lib folder that contains much smaller and specialized scripts (mainly classes). Now I only include what I need. I found it much easier to maintain than having a single file. Not that I disagree with your methodology at this time, but you could have just made that single big file, include all those little files and still had a single load statement in each of your consumer source files. With compile caches the burden of loading all that code at startup is rather negligible :) Cheers, Rob. -- http://www.interjinn.com Application and Templating Framework for PHP -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Making several variables into 1 variable
On Jul 28, 2009, at 9:55 AM, Miller, Terion wrote: On 7/28/09 8:52 AM, "Ashley Sheridan" wrote: On Tue, 2009-07-28 at 06:46 -0700, Miller, Terion wrote: On 7/28/09 8:44 AM, "Ashley Sheridan" wrote: On Tue, 2009-07-28 at 09:42 -0400, Miller, Terion wrote: On 7/28/09 8:35 AM, "Ashley Sheridan" wrote: $pastDays = strtotime("-30 days"); $date = date("d/m/y", $pastDays); Well I tried and got no results from my query and I know there results with date ranges in the last 30 days, I basically need to count backward from now() 30 days I thought strtotime() would work well..but the fields in the db are varchar not date fields they are all formatted the same though 00/00/00: $sql = "SELECT DISTINCT restaurants.ID, name, address, inDate FROM restaurants, inspections WHERE restaurants.name != '' AND inspections.inDate <= $date GROUP BY restaurants.ID ORDER BY 'name' "; I believe the query is suspect. From memory, don't you need to enclose dates in single quotes in MySQL statements? Also, I believe it uses American data format, so you might have to put the month before the day like was in Richards example. Thanks, Ash http://www.ashleysheridan.co.uk Ah ha bet that's it didn't notice the euro/brit date formatting there. Lol thanks guys! Euro/Brit date formatting? Nah, it's proper data formatting, not what you crazy Yanks do! ;) Thanks, Ash http://www.ashleysheridan.co.uk LOL I know we yanks bastardize everything...anyways it still didn't work...argh...so the boss thought he'd give me something harder...lovely, now I have to figure out how to reverse publish things to quarkget ready guys I may be blowing the list up soon with questions (like I don't already) Terion -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php You can also do this right within MySQL without needing to create a variable. This should work: $sql = "SELECT DISTINCT restaurants.ID, name, address, inDate FROM restaurants, inspections WHERE restaurants.name != '' AND datediff(curdate(),inspections.inDate)>=30 GROUP BY restaurants.ID ORDER BY 'name' "; Take care, Floyd -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Message Board Recommendations
On Jul 29, 2009, at 8:44 AM, Al wrote: tedd wrote: Hi gang: I have a client who is looking for a "Message Board for Subscribers" to be installed on his site -- one with a good admin. Any recommendations? Thanks, tedd If your request is for a forum type, then SMF is super http://www.simplemachines.org If the need is for a communications registry, then my MiniRegDB might fit the bill, using the Private/Secure mode. http://ridersite.org/MiniRegDBdemo/MiniRegDBoverview.php If neither of these fits the need, describe it in more detail. Al. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php I've always liked phpBB3. Take care, Floyd -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Locating Bad Image Files
I use convert to create thumbnail images. However, we have several PDFs that convert doesn't seem to like. Even though it produced error messages it still creates the thumbnail which doesn't display an image. Is there an easy way for me to identify those bad image files somehow in PHP by examining the content? Thanks! Floyd -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] OUCH (RESOLVED)
Terion, I've been sitting in the background watching all this unfold and thought I would chime in. I passed along your "all caps" email to a co-worker of mine (she programs in FoxPro) and she said she could definitely relate to what you were going through! As for people being honest (especially Shawn), of all the bosses I've had, the one that I respect most was the one that was the hardest on me and, at times, seemingly unfair. But because of her being hard on me I grew. So, hang in there. The more you figure out these problems the better you'll get. Take care, Floyd On Aug 5, 2009, at 11:19 AM, Miller, Terion wrote: Thank you all for being so brutally honest, I am doing my best, and yes I do get hung up on syntax errors, I mean who doesn't stare at code looking for a misplaced or missing ; or . For what seems like hours with a boss asking repeatedly "is it done, is it done" before freaking out and asking for more eyes to help look, so yes I am totally guilty of that, unfortunately I don't work on a team, so I have no one live in person to ask, and my company training consisted of 2 books but no training time as in small projects, just 2 books and big projects. For the record I have asked to be transferred back to graphics/front end production as soon as a full time position opens back up there, I don't seem to have a knack or logic for back end programming wish I did, but like I said in a previous email to Shawn it's very left brained and I'm very right brained. I will do my best to not use the list, and if I do I thank you thank you thank you for the kind heartedness of Ash, Bastian, Jim and even Shawn (who rails me out first) who continue to help me, and to the few others that still find it good karma whose names I may have left off. Good things happen to those who do Good things. Peace and Happy Wednesday Terion -- 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] Pattern Matching
I need some assistance in pattern matching. I want allow the admin user to enter a pattern to be matched in my order form editor. When someone then places an order I want to do a match based on that pattern. Some of the examples I thought for the patterns are: - must be numeric and 8 digits AA - must be alpha and 6 characters #A? - must be alphanumeric any length ##-A#A - must have two numbers, a dash, a letter, a number, and a letter I'm sure regular expressions are the answers but I am not well-versed in those at all and I'm not sure how to make the above patterns work in or even they are the best examples to use. Any help would be greatly appreciated. Thanks! Floyd -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Pattern Matching
Thanks to Martin's answer to my question (giving me the regular expressions to my patterns) I can convert the patterns the admin users enter into regular expressions. Thanks! Floyd On Aug 6, 2009, at 6:19 PM, Ben Dunlap wrote: I need some assistance in pattern matching. I want allow the admin user to enter a pattern to be matched in my order form editor. When someone then places an order I want to do a match based on that pattern. Will your admin users know how to use regular expressions? If not, can you reasonably anticipate the kinds of patterns the admins might want to create, ahead of time? Or do you need to give them a really flexible way to build any sort of pattern they please? Ben -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Pattern Matching
Martin, Thanks! Not only did that help tremendously but it also gave me a better understand of regular expressions. Thanks! Floyd On Aug 6, 2009, at 6:15 PM, Martin Scotta wrote: here you have the regexp's = \d{8} AA = \w{6} #A? = [\w\d]* (change the * for + to require at least 1 character) ##-A#A = \d\d-\w\d\w On Thu, Aug 6, 2009 at 6:57 PM, Floyd Resler wrote: I need some assistance in pattern matching. I want allow the admin user to enter a pattern to be matched in my order form editor. When someone then places an order I want to do a match based on that pattern. Some of the examples I thought for the patterns are: - must be numeric and 8 digits AA - must be alpha and 6 characters #A? - must be alphanumeric any length ##-A#A - must have two numbers, a dash, a letter, a number, and a letter I'm sure regular expressions are the answers but I am not well- versed in those at all and I'm not sure how to make the above patterns work in or even they are the best examples to use. Any help would be greatly appreciated. Thanks! Floyd -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Martin Scotta
Re: [PHP] Is select_db necessary?
mysql_select_db is not necessary but it does make writing queries easier since you don't have to specify which database in each query. Take care, Floyd On Aug 11, 2009, at 11:23 PM, Allen McCabe wrote: I have seen different scripts for working with SQL, and most follow the same method with on difference. Variables are defined (host, password, etc.) mysql_connect command //then, the difference mysql_select_db command //back to common $sql = "SELECT ... " $result = mysql_query($ql) Is the database selection necessary, or is that implied with a SELECT or other SQL command? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Re: Re: Design Patterns
I use a combination of procedural and OOP for my scripts. Mainly because I have a lot of old code I wrote before I understood OOP. Now that I do it makes my life so much easier because of the organizational and reusability benefits. In today's world I will gladly trade a little overhead for fasting coding. At work we have a quad processor IBM server with 4GB of RAM - no speed problems there. At home I use a 1.25GHz Mac Mini and no speed problems there either. Take care, Floyd On Aug 13, 2009, at 11:17 AM, Jaime Jose Perera Merino wrote: Hi Ralph, Sorry, I haven't understand your question. Do you think OOP isn't usefull for PHP? The PHP task is just to output a text file but the process might involve a lot of work: database access, communication with web services, etc. Do you think duplicate code is better than use more memory? What is your proposal? I'm very interested in more opinions. 2009/8/13 Ralph Deffke Thanks Jaime, very nice, but I'm a programmer since 1982 and into OOP since 1988 with the outcome if IBM's C++ compiler on the OS2 platform. Don't u think it could be reasonable to ask if such an overhead IN PHP is necessary? does anybody agree that PHP might be the wrong language to accomplish such a designpattern. Specialy if I find classes about interpreting things. Don't u think to blow up a servers memonry just to have a nice little framework could be ask? Don't u think it makes sence to remember that PHP is just to output a simple text file? Has inbedween all the OOP ability everybody forgotten that this is the simple purpose? Are there anybody who understands that PHP is an INTERPRETING language and has anybody an idear what is the amount of code running to do a simple $something = new object(); versus echo $something Design pattern are very good, standarizing even better. but would u agree that, out of Martins presented work, u can not see the how AND how fast the code is created to output the header the head and body and all other tags. What I can see, the result will be a lot of code, lots of includes for a view bytes. For me, wrong language with unneccesary overhead. as i can see there must be some more folks out there thinking a bit similar, or why is the feetback so relatively poor. and at least u create design pattern for a PURPOSE. so again for what pupose are this overhead in PHP As long as nobody tells me for what benefit this work is done I would say the design pattern should be done in other packages ready made for that with an PHP output. this would not affect any server resources. now after more then 25 years behind the keyboard I got possibly a bit thumb. lets open the discussion. ralph_def...@yahoo.de "Jaime Jose Perera Merino" wrote in message news:62f65ec80908130320t70078242y65308d2ef0288...@mail.gmail.com... Hi Ralph. If u want to understand the Martin's job u need to read about design patterns. A good place to start? Wikipedia ( http://en.wikipedia.org/wiki/Design_Patterns). The use of Design patterns is an advanced programming method. It helps us to improve our object oriented programation. I hope this helps you, Jaime -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Jaime J. Perera Merino Aplicaciones Informáticas. Desarrollo y Formación jaimejper...@gmail.com - 655460979 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] DB Question | A hotel reservation scenario
I would create a room history table that contained three fields: room number, status, date stamp. Each time the status of a room changes insert a new record into the table with the current status and date/ time. Take care, Floyd On Aug 18, 2009, at 10:45 AM, Behzad wrote: Dear list, e-Greetings! I'm faced with an interesting and challenging problem. Consider a database, designed for a hotel. At any given time, each room has a different status: It's Busy or Reserved, or Free. It's easy to retrieve number of Free rooms at the current time. But how can I count the number of rooms that were busy during the last week ? I would appreciate if you take a brief moment of your time and share your opinion. Thank you in advance, -b -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PDF Width
Does anyone know how I can find the width of a PDF in PHP? Thanks! Floyd -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] SESSIONS lost sometimes
Leon, Sessions are used on a per-domain basis. So, no matter how many windows or tabs you have open for mydomain.com it will be the same session for all. Having a different session start up for each window or tab would be a major pain. If you needed to keep track of a user ID, for example, you wouldn't be able to. As already mentioned you can use different browsers. You can also set up sub-domains which would each have their own sessions. Take care, Floyd On Aug 20, 2009, at 4:26 AM, Leon du Plessis wrote: ">> It's not an issue, it's a feature." Thanks Arno...but it is a pain also. If I work with user A in Tab1 (window1), I want to work with user B separately in Tab2. When user in Tab2 logs off, I still want user A to work, and not suddenly have to re-login. Same with bank. If I work with my company account, then my personal account must not become an issue because I am on the same machine and site. I have no issue with using FF and IE to do testing as that takes care of browser compatibility testing at the same time :-), but I think when you start a new session with new values, it should be kept under that window/tab alone. Cookies can take care of more details, but my opinion is data should never be affected across windows/tabs unless the same user is logged in on botheven then I would expect PHP to keep data per session. Maybe it goes beyond being an IE or FF issue..the questiojn is...will PHP allow variables from session A become corrupted when session B is in progress when they should actually be handled seperately? In the end I think it is something I do wrong in PHP with the SESSION variables and how I clear themif so...I don't think PHP should allow clearing SESSION variables from other sessions. -Original Message- From: Arno Kuhl [mailto:ak...@telkomsa.net] Sent: 20 August 2009 10:03 AM To: 'Leon du Plessis'; php-general@lists.php.net Subject: RE: [PHP] SESSIONS lost sometimes -Original Message- From: Leon du Plessis [mailto:l...@dsgnit.com] Sent: 20 August 2009 09:44 AM To: php-general@lists.php.net Subject: RE: [PHP] SESSIONS lost sometimes Since we are on the subject: I have the following similar problem: When testing page on internet explorer, I find that one tab's variables can affect another tab's variables. Thus when having the same web-site open and using SESSION variables but for different users, Internet explorer can become "disorientated". This also "sometimes" happen when I have two separate browsing windows open with Internet Explorer for the same site. I have yet to determine if this is an internet explorer, or PHP or combination of the two that is causing this condition. To my understanding _SESSION variables should be maintained per session, tab or window. If this has been addressed already, my apologies, but thought it worthwhile to mention. If someone perhaps have a solution or can confirm this as a known issue and maybe is the same or related to Angelo's problem? If different browser windows/tabs on the same client-side computer didn't share session info then you'd get the effect of being able to log onto a site with one browser window, but find in a second browser window that you were not yet logged on. Experience will tell you that you're logged on in both browser windows (try it with your online bank). It's not an issue, it's a feature. If you want to be able to use different browser windows as though they were different users then use different browsers e.g. IE and FF on the same client-side computer will look like two separate end users to the server, and they don't share session info or cookies. Cheers Arno -- 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
[PHP] String Formulas
How can I take a mathematical formula that is in a string and have the result, product, sum, etc. returned? I did a search on the Web and couldn't find any suitable solutions. Thanks! Floyd -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] String Formulas
Wow, I would never have even thought of that! Thanks! Take care, Floyd On Aug 26, 2009, at 12:08 PM, Ashley Sheridan wrote: On Wed, 2009-08-26 at 12:03 -0400, Floyd Resler wrote: How can I take a mathematical formula that is in a string and have the result, product, sum, etc. returned? I did a search on the Web and couldn't find any suitable solutions. Thanks! Floyd eval() Thanks, Ash http://www.ashleysheridan.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Error when execute header('location: otherpage.php') after email been sent out. Any Workaround?
Another solution would be to use JavaScript. In your process.php script you could do this: print<< window.location.href="index.php" here; Not strictly a PHP solution but it works. Take care, Floyd On Aug 28, 2009, at 5:34 AM, Ashley Sheridan wrote: On Fri, 2009-08-28 at 17:32 +0800, Keith wrote: I have a user sign up page that collects sign up information from user with form. This form will then be submitted to another process.php page for setting up the user account and send email to the user. After the email been sent out, the user will be directed back to homepage with header("location: index.php"). However, error happen with warning: [Cannot modify header information - headers already sent by...] Any workaround for this? Thanks for help! Keith You don't need a workaround. The header("Location...") thing will only work if you have not sent any content to the browser yet. That includes even a single space or newline. It looks like in your process.php page, something is being output to the browser. Are you able to do a code dump of that page? Thanks, Ash http://www.ashleysheridan.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Renaming a Directory
How can I rename a directory with files in it? The rename function gives me a "directory not empty" error. I know I could do it be creating the directory, moving the files, and then deleting the old one. Is there an easier way? Thanks! Floyd -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Renaming a Directory
Nope, nothing wrong with that at all. Just didn't think of it! Thanks! Floyd On Sep 8, 2009, at 5:46 PM, Eddie Drapkin wrote: On Tue, Sep 8, 2009 at 5:39 PM, Floyd Resler wrote: How can I rename a directory with files in it? The rename function gives me a "directory not empty" error. I know I could do it be creating the directory, moving the files, and then deleting the old one. Is there an easier way? Thanks! Floyd -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Is there something wrong with `system("mv $oldName $newName");` ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] strtotime strangeness
For some reason the strtotime is no longer returning the year portion. For example, strtotime("10/04/2009") will result in a date of -10-04. This started happening recently and I haven't done any updates other than the normal OS updates. I am running Mac OS X 10.5.8. Does anyone have any ideas or do I just need to install the latest version of PHP? Thanks! Floyd -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] strtotime strangeness
I couldn't find anything in the php.ini file to account for this. I am running PHP 5.2.10. I've never actually updated it myself so the software updater updated it at some point. I did a little test and found out that date(:Y",$timestamp) returns . However, date("y", $timestamp) returns the two digit year properly. So it seems there is an issue with the four digit year. Thanks! Floyd On Oct 4, 2009, at 2:14 PM, Andrea Giammarchi wrote: Did the OS update changed the default locale settings or the default date format? > From: fres...@adex-intl.com > To: php-general@lists.php.net > Date: Sun, 4 Oct 2009 14:05:05 -0400 > Subject: [PHP] strtotime strangeness > > For some reason the strtotime is no longer returning the year > portion. For example, strtotime("10/04/2009") will result in a date > of -10-04. This started happening recently and I haven't done any > updates other than the normal OS updates. I am running Mac OS X > 10.5.8. Does anyone have any ideas or do I just need to install the > latest version of PHP? > > Thanks! > Floyd > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > Windows Live: Make it easier for your friends to see what you’re up to on Facebook.
Re: [PHP] strtotime strangeness
Yeah, the ;Y" was a typo in my email. That's what happens while trying to type while watching my Colts play! Thanks! Floyd On Oct 4, 2009, at 3:06 PM, Tommy Pham wrote: - Original Message ---- From: Floyd Resler To: Andrea Giammarchi Cc: php-general@lists.php.net Sent: Sun, October 4, 2009 12:01:30 PM Subject: Re: [PHP] strtotime strangeness I couldn't find anything in the php.ini file to account for this. I am running PHP 5.2.10. I've never actually updated it myself so the software updater updated it at some point. I did a little test and found out that date(:Y",$timestamp) returns . However, date("y",$timestamp) returns the two digit year properly. So it seems there is an issue with the four digit year. Thanks! Floyd i hope :Y" is a typo in the email and not in your code. -- 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] strtotime strangeness
Sorry to hear that! I live in Cincinnati so I normally don't get to watch the Colts play when they are on at the same time as the Bengals. But this week I did and, best of all, they won! On Oct 4, 2009, at 3:24 PM, Eddie Drapkin wrote: On Sun, Oct 4, 2009 at 3:22 PM, Floyd Resler wrote: Yeah, the ;Y" was a typo in my email. That's what happens while trying to type while watching my Colts play! Thanks! Floyd Go Colts! At least you get to watch it, I have to follow along on sports sites! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] strtotime strangeness
Well that's odd. locale_get_default() gave me an undefined function error. Apparently this year problem has been reported as a bug on bugs.php.net but the status for it (and everything else) is Bogus. I'm not sure if that means anything or not but hopefully a fix will be coming soon. Thanks! Floyd On Oct 5, 2009, at 9:54 AM, Daniel Brown wrote: On Sun, Oct 4, 2009 at 17:00, Floyd Resler wrote: Sorry to hear that! I live in Cincinnati so I normally don't get to watch the Colts play when they are on at the same time as the Bengals. But this week I did and, best of all, they won! Yeah, well, the Browns sure didn't, so bite me. I've got the Vikes tonight, though going to be awesome! In any case, as Andrea suggested, make sure your locale settings haven't changed. Check: and -- daniel.br...@parasane.net || danbr...@php.net http://www.parasane.net/ || http://www.pilotpig.net/ Check out our great hosting and dedicated server deals at http://twitter.com/pilotpig -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Please don't kick me!
Phillip, I use ezpdf (http://www.ros.co.nz/pdf/). I've been using it for years and have found it very capable of making any PDF I want. Take care, Floyd On Oct 19, 2009, at 4:47 PM, Philip Thompson wrote: Hi all. I know this question has been asked a thousand times on the list, but my searches in the archives are not being nice to me. So... please don't kick me. Currently, we use DOMPDF to generate PDFs from HTML. However, it's no longer maintained and it has a few bugs that we just can no longer live with. What PDF generating software do you use? It does not have to be free, but it must run on linux and may be command line or run through code. Some of the ones I have researched are... html2pdf html2ps html2fpdf xhtml2pdf fpdf tcpdf You're thoughts would be appreciated. Oh, my preference would be to send HTML/CSS to a script and it just automagically convert to PS/PDF. Thanks, ~Philip -- 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] Please don't kick me!
Nope. I've never had any troubles with it. I've been able to produce all kinds of PDFs including loan agreements, inventory pick lists with barcodes, and various others. I find it incredibly powerful and easy to use. Take care, Floyd On Oct 19, 2009, at 5:17 PM, Philip Thompson wrote: On Oct 19, 2009, at 3:52 PM, Floyd Resler wrote: Phillip, I use ezpdf (http://www.ros.co.nz/pdf/). I've been using it for years and have found it very capable of making any PDF I want. Take care, Floyd This one seems fairly neat. However, it appears as though the author no longer keeps up with it - last entry on 6/17/2006. Have you ever run into any problems or setbacks with it? Thanks, ~Philip -- 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] Please don't kick me!
As far as I know ezPDF can't do what you want it to do. Of course, you could always modify the code the suite your needs. Since it already draws tables it probably wouldn't be too difficult to modify it draw row backgrounds of different colors. Take care, Floyd On Oct 20, 2009, at 3:25 PM, Philip Thompson wrote: On Oct 19, 2009, at 4:21 PM, Floyd Resler wrote: Nope. I've never had any troubles with it. I've been able to produce all kinds of PDFs including loan agreements, inventory pick lists with barcodes, and various others. I find it incredibly powerful and easy to use. Take care, Floyd Sorry if this is slightly OT. I've been messing around with ezPdf for a little bit and it doesn't appear to be able to allow for custom background colors or borders on a per-row basis. Meaning, I have the option to color every other line a single color... but I can't color every line a different color if I want. Am I missing something here? Basically, with the reports I'm currently generating, every row could be a different color than the previous - it depends on various factors. This is easy to accomplish with HTML/CSS. If this isn't possible (or at least easily-accomplishable), then ezPdf may not be for me. Thanks, ~Philip -- 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] Text File Busy
For some reason I'm getting a Text file busy error when I try to execute PHP scripts from the command line now. It used to work, but now it doesn't. I do have #!/usr/bin/php at the top of my script. If I feed the file to php (i.e. /usr/bin/php -f filename.php) it works. Of course, I can use this method but I was curious if anyone else has had similar problems and what the solution was. I'm guessing that something I installed is messing it up. Thanks! Floyd -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Text File Busy
It happens on any file I try so there must be something else going on. Thanks! Floyd On Oct 21, 2009, at 4:17 PM, Shawn McKenzie wrote: Floyd Resler wrote: For some reason I'm getting a Text file busy error when I try to execute PHP scripts from the command line now. It used to work, but now it doesn't. I do have #!/usr/bin/php at the top of my script. If I feed the file to php (i.e. /usr/bin/php -f filename.php) it works. Of course, I can use this method but I was curious if anyone else has had similar problems and what the solution was. I'm guessing that something I installed is messing it up. Thanks! Floyd The file is open somewhere most likely. Try: lsof | grep filename.php -- Thanks! -Shawn http://www.spidean.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] [php] INSERT and immediately UPDATE
Allen, Use mysql_insert_id(). This will return the id of the last record inserted. Take care, Floyd On Oct 28, 2009, at 3:21 PM, Allen McCabe wrote: Hey everyone, I have an issue. I need my (employee) users to be able to insert shows into the our MySQL database and simultaneously upload an image file (and store the path in the table). I have accomplished this with a product-based system (adding products and uploading images of the product), and accomplished what I needed because the product name was unique; I used the following statements: $prodName = $_POST['prodName']; $prodDesc = $_POST['prodDesc']; $prodPrice = $_POST['prodPrice']; $query2 = "INSERT INTO product (pID, pName) VALUES (NULL, '$prodName');"; $result2 = mysql_query($query2) or die(mysql_error()); $query = "SELECT pID FROM product WHERE pName = '$prodName';"; $result = mysql_query($query) or die(mysql_error()); $row = mysql_fetch_array($result) or die (mysql_error()); $prodID = $row['pID']; I had to select the new product to get the product id to use in the new unique image name. The problem I am facing now, is that with the shows that my users add will have multitple show times; this means non-unique titles. In fact, the only unique identifier is the show id. How can I insert something (leaving the show_id field NULL so that it is auto-assigned the next ID number), and then immediately select it? PHP doesn't seem to be able to immediately select something it has just inserted, perhaps it needs time to process the database update. Here is the code I have now (which does not work): $query2 = "INSERT INTO afy_show (show_id, show_title, show_day_w, show_month, show_day_m, show_year, show_time, show_price, show_description, show_comments_1, show_seats_reqd) VALUES (NULL, '{$show_title}', '{$show_day_w}', '{$show_month}', '{$show_day_m}', '{$show_year}', '{$show_time}', '{$show_price}', '{$show_description}', '{$show_comments_1}', '{$show_seats_reqd}');"; $result2 = mysql_query($query2) or die(mysql_error()); $query3 = "SELECT * FROM afy_show WHERE *show_id = '$id'*;"; $result3 = mysql_query($query3) or die('Record cannot be located!' . mysql_error()); $row3 = mysql_fetch_array($result3); $show_id = $row3['show_id']; How do I select the item I just inserted to obtain the ID number?? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Best ajax library
I've always been a big fan of prototype which does AJAX plus a whole lot more. Take care, Floyd On Dec 12, 2009, at 7:00 AM, Ali Asghar Toraby Parizy wrote: > Hi friends. > What ajax library do you suggest for php developers? > Can i use gwt with php, or It is compatible only with java web applications? > > -- > 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] Strange MySQL Problem
You're missing a tick in the query. There should be a tick before the $_POST[ISBN]. Take care, Floyd On Dec 14, 2009, at 3:41 AM, Parham Doustdar wrote: > Hello there, > Here's a short PHP script a friend has written, and given to me to test. > However, I am getting a MySQL error saying that the syntax error, on the > line that contains mysql_connect(); is wrong, near '')' > (note that it is not a PHP error, but a MySQL error.) > Here's the code: > > [code] > $username = "root"; > $password = "abc"; > $con = mysql_connect("", $username, $password); > mysql_select_db ("test", $con); > $sql = "INSERT INTO BOOK(bookname, authorsname, ISBN) VALUES > ('$_POST[bookname]', '$_POST[authorsname]', $_POST[ISBN]')"; > if (!mysql_query($sql, $con)) > { > die( 'error: ' . mysql_error()); > } > echo "1 record added"; > mysql_close($con) > ?> > [/code] > > > > > -- > 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] Fixe Point Decimal Data type
I may be over-simplifying or not completely understanding fixed point decimals, but would number_format work? Take care, Floyd On Dec 17, 2009, at 9:21 AM, Raymond Irving wrote: > Hello, > > Is there a way to represent numeric values as fixed point decimals in PHP? If > not, why was this datatype not added? > > I think is very important to have fixed point decimals when working with > money values. This would make it much easy than having to use the BCMath > functions. > > If PHP had support for operator overloading then we could have easily > implemented this datatype as a class: > > $a = new FixPoint(34.56, 2); > $b = new FixPoint(34.55, 2); > > $c = $a-$b; > echo ($c); > > $c+= 3; > echo $c; -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] SQL Queries
You should be able to do this from within the query. Try the following query: DELETE users.* FROM users LEFT JOIN notes USING(user_id) WHERE notes.note_id IS NULL Take care, Floyd On Dec 20, 2009, at 4:30 PM, דניאל דנון wrote: > Hey, Lets assume I got a table named "users". > It contains id & name. > > I have another table called "notes" - which contains id, user_id, contents > > > I want to delete all users from table "users" that don't have notes (SELECT > ... FROM notes WHERE user_id=ID) returns empty result. > > > What is the fastest way to do it? > > -- > Use ROT26 for best security -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Object Oriented Programming question
Ben, I use a combination of procedural and OOP in my scripts. It depends on my needs. As an example, I use OOP for gathering order information. I created a class which gathers all the order information allowing me to easily access any piece of data in the order. I could do this with a bunch of individual functions but it's easier and more logical to group them all together in a single class. When I first started working with classes, I used them sparingly. Now I find myself using them more and more. Take care, Floyd On Jan 19, 2010, at 10:11 AM, Ben Stones wrote: > Hi, > > I've been learning about object oriented programming for the past few weeks > and I've understood it pretty well, but I have one question. Usually with > PHP scripts I make, all the functionality for a specific page is in the > actual PHP file, and I'd use PHP functions in a separate directory which > would be included in whichever PHP file needs specific functions I have > created. The functions would be for the specific things in my script, such > as validation checks, functionality that will be used/repeated a lot > throughout my script, etc. What I don't understand about OOP is what its > primary purpose is for. Do I use OOP for all the functionality of my > application, in separate directories, and include these specific class files > and call the methods to complete specific functionality needed for whatever > PHP file I'm working on, or is OOP used for specific functionality like I > would with functions? Essentially what I'm asking is what is the primary > purpose for OOP? Hope you understand. > > Thanks, -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Storing time in mysql prior to 1970
Haig, What kind of problems are you having? I do this by using the date function to convert to the -MM-DD format for MySQL. I've had no problems with birth dates prior to 1970. Take care, Floyd On Jan 27, 2010, at 5:58 PM, Haig Davis wrote: > Hi Everyone, > > I'm sure I'm missing something simple. I'm trying to store dates of birth > prior to 1970 in mysql. I've tried mysql's date_format but am hitting a > wall. I'm chasing my tail and was hoping for the best practice. > > Many Thanks > > Haig -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Accessing Windows File Comments
One of my users has asked if I can display comments with a file list on their site. So I thought I might be able to use the comments from the properties of the file. Is there any way I can access this from PHP? The files are actually stored on a Linux box. Thanks! Floyd -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Drawing Images Without Writing To a File
I want to draw tabs in a tab bar without having to actually write the images to a file. Is it possible to generate the image and send the data back and make the browser think it's loading an image file? I know this can be done by sending the proper headers back for an entire page, but I just want to do basically the same thing for just part of the page. Thanks! Floyd -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Drawing Images Without Writing To a File
Ken, That's exactly what I want and it works beautifully! I wish I had asked this question a long time ago since, in the past, I have been creating the files and wind up with a bunch of image files hanging around. When building this new site I thought there must be a better way! Thanks! Floyd On Mar 11, 2010, at 10:40 AM, Ken Sande wrote: > Floyd Resler wrote: >> I want to draw tabs in a tab bar without having to actually write the images >> to a file. Is it possible to generate the image and send the data back and >> make the browser think it's loading an image file? I know this can be done >> by sending the proper headers back for an entire page, but I just want to do >> basically the same thing for just part of the page. >> Thanks! >> Floyd > > I do something similar with my googled webcam :) Then you just use the script > as the source for your image (i.e. src="img.php?arguments"). Hopefully this > is what you are looking for. (Note, this uses the processor pretty heavily > when I run 100 images or so). > If you are going to reuse the images for many clients, it may be a better > alternative to reuse the generated image. > > > header("Content-type: image/jpeg"); > $file = $_GET[src]; //"img/south-lawn1.jpg"; > $imgfile = "img/" . $file; > $fsize = filesize($file); > $string = "South Lawn @ " . date("Y-m-d H:i:s", filemtime($file)); > > $im = imagecreatefromjpeg($file); > $color = imagecolorallocate($im, 240, 240, 0); > $px = (imagesx($im) - 9.5 * strlen($string)); > $py = (imagesy($im) - 24); > imagestring($im, 5, $px, $py, $string, $color); > imagestring($im, 5, 10, $py, $file, $color); > imagestring($im, 5, 10, $py - 16, round(( $fsize / 1024 ),1) . "kB", $color); > > imagejpeg($im); > imagedestroy($im); > > ?> > > === > > 73, > Ken Sande/KC8QNI-T -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Top vs. Bottom Posting.
Absolutely top posting is the most efficient way of doing it! If I need to see what the thread is all about, I have no problems starting from the bottom and working my way up. It would be nice if everyone adopted top posting, though. Trying to read threads where postings are at the top and bottom makes it really difficult to follow! Take care, Floyd On Mar 24, 2010, at 9:34 PM, Daevid Vincent wrote: > ...and where's the stupid little netiquette link about hijacking another > thread? ;-) > oh, here it is: > http://en.wikipedia.org/wiki/User:DonDiego/Thread_hijacking > http://linux.sgms-centre.com/misc/netiquette.php#threading > > That bottom posting crap is so antiquated and outdated my dinosaur doesn't > even follow it. > > Top posting is efficient and useful for everyone involved in the thread. > > If someone is not smart enough to realize they're reading the end of the > thread, and have to scroll to the bottom of it one time to catch up, then > to me that's natural selection and they just don't deserve to be > participating. Go read a coloring book or watch WoW!Wow!Wubbzy! or > something equally trite because clearly their brain can't grasp basic > concepts even. > > > _ > > From: Yousif Masoud [mailto:yousif.mas...@gmail.com] > Sent: Wednesday, March 24, 2010 6:27 PM > To: Daevid Vincent > Cc: php-general@lists.php.net > Subject: Re: [PHP] Will PHP ever "grow up" and have threading? > > > > P.S. I HATE bottom posting. WTF do I have to scroll all the way down past > hundreds of useless lines just to read a "me too" or some other comment. If > it's at the top, I can simply just keep moving from header to header in > Outlook (or your email GUI of choice). DELETE as I go. Easy. Simple. > Efficient. > > > > http://www.netmeister.org/news/learn2quote.html > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Top vs. Bottom Posting.
On Mar 25, 2010, at 9:48 AM, Lester Caine wrote: > Floyd Resler wrote: >> Absolutely top posting is the most efficient way of doing it! If I need to >> see what the thread is all about, I have no problems starting from the >> bottom and working my way up. It would be nice if everyone adopted top >> posting, though. Trying to read threads where postings are at the top and >> bottom makes it really difficult to follow! > > So you claim, I find that it is most UNPRODUCTIVE! > > But as we have already said - the RULE for this list is bottom posting since > as you rightly say mixing it up is making things even more unproductive. If > you must campain for a CHANGE to the rules please at least be courteous and > follow the rules until there IS a consensus to change that rule. But the > current consensus IS to stop debating it at all and leave the rule in place :) > Sounds good to me! Take care, Floyd -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] MySQL: Return Number of Matched Rows
On Mar 25, 2010, at 5:10 PM, James Colannino wrote: > Hey everyone, > > I have a question. If I do a mysql query that updates a column in a row > to the same value, I get 0 rows affected. However, I also get 1 or more > matched rows. Is there a way that I can return the number of matched > rows, rather than the number of rows affected? > > I'm trying to get something done with as few SQL queries as possible. > Thanks! > > James > As for as I know, MySQL simply just doesn't report a row as being affected if nothing has changed in it. To get the number of matched rows, try doing a SELECT query before you do the UPDATE query. I don't know if that will produce the results you're looking for, but it might. Take care, Floyd -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Server-side postscript-to-PDF on-the-fly conversion
On Mar 27, 2010, at 12:41 AM, Rob Gould wrote: Is there a free solution out there that will enable me to take a PHP- generated postscript output file, and dynamically, on-the-fly convert it to a PDF document and send to the user as a download when the user clients on a link? More description of what I'm trying to do: 1) I've got a web-page that accepts some user input 2) They hit SUBMIT 3) I've got a PHP file that takes that input and generates a custom Postscript file from it, which I presently serve back to the user. On a Mac, Safari and Firefox automatically take the .ps output and render it in Preview. 4) However, in the world of Windows, it seems like it'd be better to just convert it on-the-fly into a PDF, so that the user doesn't need to worry about having a post-script viewer app installed. Is there a particular reason why you need to use Postscript? Can you output it directly to PDF? Take care, Floyd Sent from my iPhone -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Determining Top # from MySQL
On Apr 10, 2010, at 10:02 PM, Ashley M. Kirchner wrote: > > > Given a MySQL query like this $q = "select num from table", I get a result > like this: > > > > +---+ > > |num| > > +---+ > > | 1| > > | 4| > > | 6| > > | 2| > > | 4| > > | 5| > > | 3| > > | 2| > > | 4| > > | 2| > > | 3| > > | 3| > > | 2| > > | 1| > > +---+ > > > > What I want is a listing of numbers sorted by the amount of times they > appear (so I can take a top 5, or top 10): > > > > +---+-+ > > |num|count| > > +---+-+ > > | 2|4| > > | 3|3| > > | 4|3| > > | 1|2| > > | 5|1| > > | 6|1| > > +---+-+ > > > > Is this a query that I can feed to MySQL, or is this something I need to > sort out in PHP? > This query should do it for you: SELECT num, COUNT(num) AS total FROM table GROUP BY num ORDER BY COUNT(num) DESC LIMIT 10 Take care, Floyd -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Date Math
I need to get the difference in months between two dates. The dates could be as much as 60 months apart. Is there any easy way to do this either through PHP or MySQL? I know how I can do it through code but thought there might be a simple one or two line option. Thanks! Floyd -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Date Math
On Apr 21, 2010, at 5:39 AM, Michiel Sikma wrote: > On 20 April 2010 17:40, Floyd Resler wrote: > >> I need to get the difference in months between two dates. The dates could >> be as much as 60 months apart. Is there any easy way to do this either >> through PHP or MySQL? I know how I can do it through code but thought there >> might be a simple one or two line option. >> >> Thanks! >> Floyd >> >> > You're best off doing this in MySQL. > Something like select timestampdiff(month, '2010-01-01', '2010-05-22'); > should work. > > Michiel Perfect! That's exactly what I was looking for! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Multiple Login in a single PC should not be possible
On May 14, 2010, at 3:18 AM, Jagdeep Singh wrote: > Hi All! > > I am looking for a solution, I want a user to do a single Login only on a PC > . > > E.g. If a User has logged on my website website.com in Internet explorer, > then he cant login on same website in another browser like Firefox etc with > same loginid or another. > > Can I trace MAC address of a single machine to solve this issue? > > Or is there a concept of GLOBAL COOKIE / Cross Browser Cookie which will > work for all browsers in a single machine.. > > I hope You will help me out > > > Regards > > Jagdeep Singh > +91 9988009272 If you store sessions in a MySQL table you could access that table to see if the user is still logged in and when the last time the session data was updated. Take care, Floyd -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] authentication issue...
On May 28, 2010, at 9:43 PM, Jason Pruim wrote: Hey Everyone, So I'm sitting here on a friday night trying to figure out how in the world I'm going to fix an issue that should probably be simple to me but is escaping me at the moment Take this authentication function: $loginQuery = "SELECT * FROM {$cfgtableAuth} WHERE userLogin='".$authUser."' AND userPass='".$md5pass."' LIMIT 0,1;"; $loginResult = mysql_query($loginQuery) or die("Wrong data supplied or database error" .mysql_error()); $row1 = mysql_fetch_assoc($loginResult); if($row1['access'] == "500"){ foreach (array_keys($_SESSION) as $key) unset($_SESSION[$key]); die('account disabled'); } if(is_array($row1)){ $_SESSION['userInfo'] = array( "userLogin" => $row1['userName'], "loggedin" => TRUE, "userName" => $row1['userName'], "userPermission" => $row1['userPermission']); error_log("User has logged in: ". $row1['userLogin']); }else{ //$_SESSION['userInfo'] =array("loggedin" => FALSE); die('authentication failed'); } return TRUE; } ?> Here is how I am displaying the login form: CSS; include("nav.php"); if ($_SESSION['userInfo']['loggedin'] == TRUE) { MAIN PAGE DISPLAY HERE }else{ //Display login info echo << You must login to proceed! User Name: Password: FORM; if(isset($_POST['txtUser'])) { $authUser = $_POST['txtUser']; $authPass = $_POST['txtPass']; $auth = authentication($authUser, $authPass, $cfgtableAuth); } } ?> Now... the authentication actually works, and it logs me in properly, but I have to click the login button twice Ideally I should just do it once, so I'm wondering if anyone can spot my grievous misstep here? Thanks in advance for the help and pointers I am bound to receive from this list! :) Your problem kind of made me laugh. Not because you're having this problem but because the problem you're having that you want to correct is something a co-worker of mine did by design. She writes in FoxPro and on her login page you actually have to click the login button twice in order to log in! She did it that way because she has a profile button on the login page. Still, clicking on a login button twice is annoying! :) Take care, Floyd -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Another RegEx Question
I need to test for the existence of at least one punctuation (@#$%') character in a string. What would my regular expression be? Thanks! Floyd -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] is
On Jun 10, 2010, at 8:53 PM, Daevid Vincent wrote: I use them ALL the time. MUCH cleaner IMHO than the alternatives. And *IF* someday it is ever depricated, it's trival to: s/ -Original Message- From: Ahmed Mohsen [mailto:mre...@gmail.com] Sent: Thursday, June 10, 2010 3:35 PM To: php-general@lists.php.net Subject: [PHP] is but i want to know if its good to use this tag instead of -- 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 I have to agree that as well. Take care, Floyd -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Invoice Software
Now that I'm finally landing some freelance PHP work, I am in need of some software that I can add clients, enter estimates, keep track of hours, and create invoices with. I'd like it to be Web-based. I could write my own, of course, but why do it if it's already done?! Does anyone know of such a package? Thanks! Floyd -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Invoice Software
On Jun 23, 2010, at 11:24 AM, Bastien Koert wrote: > On Wed, Jun 23, 2010 at 10:01 AM, Daniel P. Brown > wrote: >> On Wed, Jun 23, 2010 at 09:52, Floyd Resler wrote: >>> Now that I'm finally landing some freelance PHP work, I am in need of some >>> software that I can add clients, enter estimates, keep track of hours, and >>> create invoices with. I'd like it to be Web-based. I could write my own, >>> of course, but why do it if it's already done?! Does anyone know of such a >>> package? >> >>Tons. I'd personally start by checking SourceForge, finding >> something that matches closely what you're trying to do, and then >> modifying it to match entirely. >> >> -- >> >> UNADVERTISED DEDICATED SERVER SPECIALS >> SAME-DAY SETUP >> Just ask me what we're offering today! >> daniel.br...@parasane.net || danbr...@php.net >> http://www.parasane.net/ || http://www.pilotpig.net/ >> >> -- >> PHP General Mailing List (http://www.php.net/) >> To unsubscribe, visit: http://www.php.net/unsub.php >> >> > > freshbooks.com also handles that if you want to use a service > > -- > > Bastien > Fresbooks is perfect! Thanks! Floyd -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Making a Password Confirmation in PHP
On Jun 24, 2010, at 2:22 PM, Michael Calkins wrote: > > This is very straight forward, if password a and b are not equal to each > other, how can I let the user know that with out losing all of the entered > information on the registration form? > I was trying this: > ---$p1 = ""; > $p2 = ""; > // if they didn't match return > $p1 = "";--- > I was trying to change the value of the variable which shows the input field > to have the password already in it. > and either one would just be echo'd depending on the result. > Any ideas please? > > From,Michael calkinsmichaelcalk...@live.com > > If you aren't opposed to using JavaScript, I'd do it there. If you don't want to use JavaScript then you can load the form data from the $_POST (or $_GET) array that was passed back to your script. Take care, Floyd -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] State and City Database
On Jul 9, 2010, at 1:58 PM, Jim Lucas wrote: > Paul M Foster wrote: >> On Fri, Jul 09, 2010 at 10:43:09AM -0400, tedd wrote: >> >> >> >> >>> Here's an example of my copy working: >>> >>> http://php1.net/b/zipcode-states/index.php >> >> Problem: the city and state select drop-downs won't stay dropped for me, >> and won't accept anything but Lansing, Michigan. They don't drop down >> long enough for me to select anything else. Zip drop down appears to >> work okay. >> >> Paul >> > > Similar issue here too. But I can at least select a state (if I'm quick) and > then when I click on the city, the list blinks and then deletes the contents > of > the state and zip code dropdown menus. > > System: Windows XP SP3 + FF v3.5.3 w/Firebug > > Checking with my Opera 9.24 install, seems to do something similar. Timer is > very fast and it doesn't allow for me to click on anything. > > -- > Jim Lucas > I tried it in Safari and it works just fine. Take care, Floyd -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] State and City Database
On Jul 9, 2010, at 2:32 PM, Jim Lucas wrote: > Floyd Resler wrote: >> On Jul 9, 2010, at 1:58 PM, Jim Lucas wrote: >> >>> Paul M Foster wrote: >>>> On Fri, Jul 09, 2010 at 10:43:09AM -0400, tedd wrote: >>>> >>>> >>>> >>>> >>>>> Here's an example of my copy working: >>>>> >>>>> http://php1.net/b/zipcode-states/index.php >>>> Problem: the city and state select drop-downs won't stay dropped for me, >>>> and won't accept anything but Lansing, Michigan. They don't drop down >>>> long enough for me to select anything else. Zip drop down appears to >>>> work okay. >>>> >>>> Paul >>>> >>> Similar issue here too. But I can at least select a state (if I'm quick) >>> and >>> then when I click on the city, the list blinks and then deletes the >>> contents of >>> the state and zip code dropdown menus. >>> >>> System: Windows XP SP3 + FF v3.5.3 w/Firebug >>> >>> Checking with my Opera 9.24 install, seems to do something similar. Timer >>> is >>> very fast and it doesn't allow for me to click on anything. >>> >>> -- >>> Jim Lucas >>> >> >> I tried it in Safari and it works just fine. >> >> Take care, >> Floyd >> >> >> > > Just for giggles, I downloaded and installed Safari just now v5.0 (7533.16) > and > tried it. > > The page is non functional. The drop down menus exist, but when I select the > state in the state list, it doesn't update the city list or zip code list. > And > when I change the city, it doesn't update the zip code field. > > -- > Jim Lucas > That's weird. I just tried again just to make sure I wasn't seeing things. I selected Indiana and the city list populated with the cities from Indiana. I then chose Indianapolis and the zip codes list populated with Indianapolis zip codes. I'm using Safari 5 on the Mac. I just tried in in Firefox 3.6.6 on my Mac and experienced the same thing you did - the state drop-down doesn't stay opened. Really kind of odd, isn't it?! Take care, Floyd -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Serial Numbers
On Jul 12, 2010, at 2:52 PM, Gary wrote: > I'm sure it is possible, but I am unsure how to do this. I have created a > Sale coupon that I was going to put up on a site that I manage, for visitors > to print out and bring to the store. The coupon is currently a .png, however > I was planning on converting to a pdf. I would like to put on the coupon a > serial number that increases by 1 everytime the page is viewed. I dont > really care if someone refreshes the page and skews the numbers. > > Is this possible and could someone give me some help? > > Thanks > > Gary > Is there any particular reason you need it to be a PDF? If not and the GD library is installed in your PHP, I would suggest using the GD library to draw your serial number on the coupon. As for keeping track of the counter I would do it either in a database table or save the number to file. Take care, Floyd -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Serial Numbers
On Jul 12, 2010, at 3:22 PM, Ashley Sheridan wrote: > On Mon, 2010-07-12 at 15:17 -0400, Floyd Resler wrote: >> >> On Jul 12, 2010, at 2:52 PM, Gary wrote: >> >> > I'm sure it is possible, but I am unsure how to do this. I have created a >> > Sale coupon that I was going to put up on a site that I manage, for >> > visitors >> > to print out and bring to the store. The coupon is currently a .png, >> > however >> > I was planning on converting to a pdf. I would like to put on the coupon >> > a >> > serial number that increases by 1 everytime the page is viewed. I dont >> > really care if someone refreshes the page and skews the numbers. >> > >> > Is this possible and could someone give me some help? >> > >> > Thanks >> > >> > Gary >> > >> >> Is there any particular reason you need it to be a PDF? If not and the GD >> library is installed in your PHP, I would suggest using the GD library to >> draw your serial number on the coupon. As for keeping track of the counter >> I would do it either in a database table or save the number to file. >> >> Take care, >> Floyd >> >> > > I can think of a good reason for making it as a PDF. A PDF is built for > printing to scale exactly as you need, whereas a bitmap is very different. > Traditionally, GD creates screen images, which are 72dpi, whereas print > usually uses 300dpi bitmaps, and they generally don't scale well. > > Having said that, writing it in GD will be a fair bit easier! > > Thanks, > Ash > http://www.ashleysheridan.co.uk > > > "Having said that, writing it in GD will be a fair bit easier!" Yep, that's why I was asking! :) Take care, Floyd
Re: [PHP] handing over data between two PHP connections
On Jul 18, 2010, at 3:27 PM, tobias.muelle...@web.de wrote: Hello everybody For a science project I am working on a mechanism that hands over data from a smartphone to a web-browser (=Internet PC). Both connect to a PHP server. The PHP server has to receive the data (=some kind of an URL) on the smartphone end and deliver it to the browser end. Up to now there have been two (working) implementations. One using the filesystem the other one using a MySQL Database. The data coming up from the smartphone is stored in a file/table and some seconds later sent down to the browser. My question: is it possible to implement this mechanisms just with PHP methods? I can't think of such a method but need to be sure. Tank you in advance. Have a good evening, Tobias ___ Neu: GMX De-Mail - Einfach wie E-Mail, sicher wie ein Brief! Jetzt De-Mail-Adresse reservieren: http://portal.gmx.net/de/go/demail -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php What I would do is have the smartphone send some unique identifier along with its data. For the browser I would have the page refresh at certain time interval, calling a PHP script to see if any data is available for the smartphone's ID. If you did want the page to keep reloading, you could use AJAX. Take care, Floyd -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP database interface layer
On Jul 22, 2010, at 3:14 PM, Marc Guay wrote: >> i recommend propel >> http://www.propelorm.org/ > > Holy Moses that thing is a monster. It requires installing extra > libraries (Phing) in order to create an XML schema reverse-engineered > from my existing database. The code looks simple enough but that > installation is brutal. Any other suggestions? I'm thinking of > sticking with good ol' hand coding and a few helper classes. > > Marc > I kind of had the same reaction when I saw it! I started playing around with it and realized that if I ever make any database changes I'm going to have to regenerate everything! Seems a bit cumbersome to me but I'm an "good ol' hand coding and a few helper classes" programmer myself! I wound up creating a very light-weight yet flexible framework that has served me well over the past few years. I've been thinking about releasing it but it doesn't follow the traditional model of most of the MVC frameworks I've seen. Take care, Floyd -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Quotes vs. Single Quote
On Aug 6, 2010, at 8:08 AM, tedd wrote: > At 10:10 PM -0400 8/5/10, Rick Dwyer wrote: >> 2nd question, in the 3 [2] lines below: >> >> $checkstat = "select field from table where fieldid = $field_id"; >> $result1 = @mysql_query($checkstat,$connection) or die("Couldn't execute >> query"); >> >> If I were to recode in the latter style, should they not look like this: >> >> $checkstat = 'select field from table where fieldid = "'.$field_id.'"'; >> $result1 = @mysql_query($checkstat,$connection) or die('Couldn\'t execute >> query'); > > Rick: > > Others gave you good advice on quotes, but I'll address your second question > on database queries. > > The following is in the form of what I normally do: > > $query = "SELECT field FROM table WHERE field_id = '$field_id' "; > $result = mysql_query($query) or die("Couldn't execute query"); > > Please note these are my preferences (others may have different preferences): > > 1. I use UPPERCASE for all MySQL syntax. > > 2. I do not use the @ before mysql_query because that suppresses errors. I > prefer to see errors and fix them. > > 3. It's not necessary to include the second argument (i.e., $connection) in > mysql_query. > > 4. IMO, a query should be named $query and a result should be named $result. > If I have several results, then I use $result1, $result2, $result3, and so on. > > 5. I try to match MySQL field names to PHP variable names, such as field_id = > '$field_id'. This makes it easier for me to read and debug. > > 6. Also note that the PHP variable $field_id is enclosed in single quotes > within the query. > > 7. For sake of readability, in the query I also place a space after the last > single quote and before the ending double quote, such as field_id = > '$field_id' ". -- I do not like, nor is it readable, to have a singledouble > quote (i.e., '"). > > There is one additional thing that I do, but it requires an included > function. For your kind review, in my query I do this: > > $result = mysql_query($query) or die(report($query,__LINE__,__FILE__))); > > and the report function I include to the script is: > > // show dB errors == > > function report($query, $line, $file) > { > echo($query . '' .$line . '' . $file . '' . mysql_error()); > } > ?> > > That way, if something goes wrong, the report function will show in what file > and at what line number the error occurred. Now, this is OK for development, > but for production you should comment out the echo so you don't report errors > publicly. Besides, you should have all the errors fixed before your script > becomes production anyway, right? :-) > > HTH, > > tedd > Tedd, Well said! I pretty much follow those same standards as well. Especially with the naming of variables to match field names. I also make sure that any form field names match my database names. It makes updating and inserting records so much easier! I've written a database class that allows me to update and insert records as easily as this: $db->insert("table_name",$_POST); $db->update("table_name","id_field_name",$id,$_POST); And, yes, I do sanitize the data to make sure it doesn't do bad things to my database! :) Take care, Floyd -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] imagettftext Angle Problem
I'm trying to draw text at a 90 degree angle, reading from bottom to top. For some reason, all of the letters are aligning to the top (i.e. the left side) of the text. It looks really odd! Has anyone else experienced this before? Thanks! Floyd -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] imagettftext Angle Problem
On Aug 12, 2010, at 10:42 AM, Ashley Sheridan wrote: > On Thu, 2010-08-12 at 10:40 -0400, Floyd Resler wrote: > >> I'm trying to draw text at a 90 degree angle, reading from bottom to top. >> For some reason, all of the letters are aligning to the top (i.e. the left >> side) of the text. It looks really odd! Has anyone else experienced this >> before? >> >> Thanks! >> Floyd >> > > > Do you have a code example and maybe a screenshot/image online somewhere > that we can see. I can't really understand exactly what the problem is > without one or both of those. > > Thanks, > Ash > http://www.ashleysheridan.co.uk > > Certainly. You can see a screen shot at https://adexfulfillment.com/adex/images/problem.png. The code I use to generate it: foreach($headers as $header) { if($header!="Client" && $header!="Show" && $count<19) { $angle=90; } else { $angle=0; } $sizes=imagettfbbox(10,$angle,$ttf,$header); $height=abs($sizes[5]); if($angle==0) { $width=abs($sizes[2])+5; $top=$height-1; $left=0; } else { $width=abs($sizes[4])+5; $height+=15; $top=$height-2; $left=0; } $image=imagecreate($width,$height); $white=imagecolorallocate($image,255,255,255); $black=imagecolorallocate($image,0,0,0); imagefilledrectangle($image,0,0,$width,$height,$white); imagettftext($image,10,$angle,$left,$top,$black,$ttf,$header); $count++; $number=rand(1,10); $path="../../../../tmp/report_$number.png"; imagepng($image,$path); $newHeaders[]=""; } Thanks! Floyd -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] imagettftext Angle Problem
On Aug 12, 2010, at 11:50 AM, tedd wrote: >> On Thu, 2010-08-12 at 10:40 -0400, Floyd Resler wrote: >> >>> I'm trying to draw text at a 90 degree angle, reading from bottom to top. >>> For some reason, all of the letters are aligning to the top (i.e. the left >>> side) of the text. It looks really odd! Has anyone else experienced this >>> before? >>> >>> Thanks! >>> Floyd > > Floyd: > > Yes, that is odd -- try this: > > Header ("Content-type: image/gif"); > $im = imagecreate (400, 400); > $background = imagecolorallocate ($im, 238, 238, 238); > $text_color = imagecolorallocate ($im, 00, 51, 102); > imagettftext ($im, 10, 90, 200, 200, $text_color, "arial.ttf", "Hello > World..."); > imagegif ($im); > imagedestroy ($im); > > You must use arial.ttf for the above -- in fact, that might be your problem, > the font you are using may be that way. > > Here's an example of this working: > > http://webbytedd.com/b/timed-php/ > > Cheers, > > tedd Well, whatever the problem is it is definitely related only to my system. I tried your code and had the same results (https://adexfulfillment.com/adex/tests/test.php). I tried different fonts as well. The fonts I'm using were exported from FontBook on my Mac. I wonder if that might have something to do with it. Anyway you could pass along the arial font you're using so I can test that possibility? Thanks! Floyd -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] imagettftext Angle Problem
On Aug 12, 2010, at 12:17 PM, Ashley Sheridan wrote: > On Thu, 2010-08-12 at 12:14 -0400, Floyd Resler wrote: > >> On Aug 12, 2010, at 11:50 AM, tedd wrote: >> >>>> On Thu, 2010-08-12 at 10:40 -0400, Floyd Resler wrote: >>>> >>>>> I'm trying to draw text at a 90 degree angle, reading from bottom to top. >>>>> For some reason, all of the letters are aligning to the top (i.e. the >>>>> left side) of the text. It looks really odd! Has anyone else >>>>> experienced this before? >>>>> >>>>> Thanks! >>>>> Floyd >>> >>> Floyd: >>> >>> Yes, that is odd -- try this: >>> >>> Header ("Content-type: image/gif"); >>> $im = imagecreate (400, 400); >>> $background = imagecolorallocate ($im, 238, 238, 238); >>> $text_color = imagecolorallocate ($im, 00, 51, 102); >>> imagettftext ($im, 10, 90, 200, 200, $text_color, "arial.ttf", "Hello >>> World..."); >>> imagegif ($im); >>> imagedestroy ($im); >>> >>> You must use arial.ttf for the above -- in fact, that might be your >>> problem, the font you are using may be that way. >>> >>> Here's an example of this working: >>> >>> http://webbytedd.com/b/timed-php/ >>> >>> Cheers, >>> >>> tedd >> >> Well, whatever the problem is it is definitely related only to my system. I >> tried your code and had the same results >> (https://adexfulfillment.com/adex/tests/test.php). I tried different fonts >> as well. The fonts I'm using were exported from FontBook on my Mac. I >> wonder if that might have something to do with it. Anyway you could pass >> along the arial font you're using so I can test that possibility? >> >> Thanks! >> Floyd >> >> >> > > > The Arial font should be available on every system by default. I believe > the Linux equivalent is LiberationSans, and possibly Helvetica on a Mac, > but essentially they are considered similar enough equivalents for > rendering things like this. If in doubt, try playing about with > different fonts. Just a quick question, but the headings are all being > created as whole headings and not individual letters yeah? > > Thanks, > Ash > http://www.ashleysheridan.co.uk > > Yep, I'm rendering the entire header not individual letters. I just tried it using a font that came with my Ubuntu install and it still does the same thing. So, I guess I'll need to do a little more digging. Thankfully it is just for us internally so none of our clients will see it! Thanks! Floyd -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] a test (list is too quite)
On Sep 4, 2010, at 1:00 PM, tedd wrote: At 12:47 PM -0400 9/4/10, chris h wrote: Evidently all is well in the world of php... :) If it was so, we would all be out of work. Instead, I think it's the lull before the storm. I'll ask a question to stir things up. :-) Cheers, tedd Good idea. Here's my question: How can I make javascript communicate with MySQL using FTP while sending a proxy through HTML that utilizes XML and SMTP? :) Take care, Floyd -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Adjusting Session Times
We just got a client whose requirement is that user sessions expire after 30 minutes of inactivity. Our other clients are happy with not having their sessions expire during the work day (i.e. life is 8 hours). I am using a MySQL database to store the session data. My thought is to adjust the session expiration in the table based on the client currently logged in. Is this a good approach or would there be better ways to do it? And just to clarify: all clients use the same Web site. Thanks! Floyd -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Adjusting Session Times
Tedd, I really like your solution. The idea of storing the expiration in the SESSION makes it easier for me and makes it more flexible. Someone else had provided a solution that would actually allow me to take it down to a user level if I needed to. I loved the idea for flexibility but would have required a major rewrite. Your idea gives me the flexibility and doesn't require any major rewriting - just a little tweaking. Thanks! Floyd On Sep 14, 2010, at 12:58 PM, tedd wrote: > At 10:26 AM -0400 9/14/10, Floyd Resler wrote: >> We just got a client whose requirement is that user sessions expire after 30 >> minutes of inactivity. Our other clients are happy with not having their >> sessions expire during the work day (i.e. life is 8 hours). I am using a >> MySQL database to store the session data. My thought is to adjust the >> session expiration in the table based on the client currently logged in. Is >> this a good approach or would there be better ways to do it? And just to >> clarify: all clients use the same Web site. >> >> Thanks! >> Floyd > > Floyd: > > I don't know how others solve this, but my solution is pretty straightforward > (see code below). > > I require this code for every script that is in the secured area. Simply put, > if the user runs a script, then this script is also run. > > As a result, if the user is not logged in they are directed to the login > script. If the user is logged in, but has exceeded the expiration time due to > inactivity, then the user is redirected to the same login script with a GET > value to trigger the login script to report that they timed out due to > inactivity. > > I find it bad practice to tell a user that they are not logged in when they > did log in. It's better to explain why they have to log on again. > > Now, with respect to your storing the expiration time in the database, that > could be done easily enough by this script accessing the database, getting, > and setting the time-limit -- OR -- at the start of any logon have the script > pull the time-limit from the database and store that value in a SESSION. > Either way would work. > > In any event, this is what I do. > > Cheers, > > tedd > > == code > > > $redirect = 'http://yourdomain.com/admin/logon.php'; > > // standard security > > $secure = isset($_SESSION['security']) ? $_SESSION['security'] : 0; > > if ($secure == 0) // if admin is not logged in -- then redirect to the admin > logon > { > header("location:$redirect"); > exit(); > } > > // timed security > > $_SESSION['start'] = isset($_SESSION['start']) ? $_SESSION['start'] : 0; > > $timelimit = 15 * 60; // 15 minutes > $now = time(); > > if($now > $_SESSION['start'] + $timelimit) > { > logOff(); > $t = '?t=1'; > header("location:$redirect$t"); > exit(); > } > > $_SESSION['start'] = time(); > > // properly logged on pass here > > ?> > > > // to destroy the current session > > function logOff() > { > $_SESSION = array(); > > if(isset($_COOKIE[session_name()])) > { > setcookie(session_name(), '', time()-86400, '/'); > } > session_destroy(); > } > > -- > --- > http://sperling.com/ > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Sending Encrypted Email
This is kind of both on and off topic. I need to send encrypted email. I have found code to do this but I'm not sure which certificate file to use. Can I use our server's signed certificate we use for Apache? Does anyone know of a clear, step-by-step tutorial? Thanks! Floyd -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Interacting With Shell
I need to run a Linux command from within PHP but the command has interaction. At one point I need to enter a password. Is this type of interaction possible inside a PHP script? Thanks! Floyd smime.p7s Description: S/MIME cryptographic signature
[PHP] PHP Warning
I'm getting the following warning when running PHP scripts from the command line: PHP Warning: Module 'mcrypt' already loaded in Unknown on line 0 How can I get rid of this? My error report directives are: error_reporting = E_COMPILE_ERROR|E_RECOVERABLE_ERROR|E_ERROR|E_CORE_ERROR Thanks! Floyd -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP Warning
Thanks for the help. The culprit was in my cli/php.ini file. Thanks! Floyd On Sep 17, 2010, at 10:53 AM, Daniel Brown wrote: > On Fri, Sep 17, 2010 at 10:35, Floyd Resler wrote: >> I'm getting the following warning when running PHP scripts from the command >> line: >> PHP Warning: Module 'mcrypt' already loaded in Unknown on line 0 >> >> How can I get rid of this? My error report directives are: >> error_reporting = E_COMPILE_ERROR|E_RECOVERABLE_ERROR|E_ERROR|E_CORE_ERROR > >It's a startup error. Check your php.ini and any other > configuration files being loaded and made sure to remove one of the > mcrypt extension entries. You can see all of the files being loaded, > including which files (by location), by checking your phpinfo() > output. > > -- > > Network Infrastructure Manager > Documentation, Webmaster Teams > http://www.php.net/ > > -- > 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: Sending Encrypted Email
On Sep 21, 2010, at 1:00 AM, Erik L. Arneson wrote: > On Thu, 16 Sep 2010, Nathan Rixham wrote: >> Floyd Resler wrote: >>> I need to send encrypted email. Can I use our server's signed certificate >>> we use for Apache? >> >> Yes you can use the servers certificate, you can use any x509 >> certificate you like - however, I'd recommend checking out >> startssl.org who will give you a free smime certificate. > > But that is probably just for *signing* the email. If you'd like to > encrypt email, you will need a public key or shared secret from the > email recipient. > > -- > Erik Arneson > GPG Key ID : 1024D/62DA1D25 BitCoin : 1LqvuGUqJ4ZUSoE7YE9ngETjwp4yZ2uSdP > Office : +1.541.291.9776Skype : callto://pymander >http://www.leisurenouveau.com/ > > I got it all figured out. The part I was missing was combining the certificate with the key and giving it to the end-user to install on their system. I was able to use the Web server's certificate for the encryption. The interesting thing is that the client wants ALL passwords sent via encrypted email. Of course, they need the P12 file installed in order to view the email and that requires a password to install it. So, obviously, I can't send that password encrypted. So, my solution is to provide a Web page that the user gets to by an emailed link that has a unique identifier and the user must enter a piece of personal information for verification (in this case, ZIP code). Once verified, they are shown the password on the page. That's the only way I can think of to do it. Is that a good solution or does someone have a better way? Thanks! Floyd -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Sending Encrypted Email
On Sep 21, 2010, at 11:15 AM, Erik L. Arneson wrote: > On Tue, 21 Sep 2010, Floyd Resler wrote: >> I got it all figured out. The part I was missing was combining the >> certificate with the key and giving it to the end-user to install on >> their system. I was able to use the Web server's certificate for the >> encryption. The interesting thing is that the client wants ALL >> passwords sent via encrypted email. Of course, they need the P12 file >> installed in order to view the email and that requires a password to >> install it. > > Wait, you didn't send the webserver's certificate to the user, did you? > That's a bad idea. The email recipient should have her own certificate, > which has both a private and a public part. > > The webserver's certificate (presumably the one you have signed by the > CA), especially the private key, needs to be kept *private*, and not > sent all over the place. Using the same private/public key pair on both > endpoints defeats the purpose of PKI. You would be better off using > plain old symmetric encryption. > >> So, obviously, I can't send that password encrypted. So, my solution >> is to provide a Web page that the user gets to by an emailed link that >> has a unique identifier and the user must enter a piece of personal >> information for verification (in this case, ZIP code). Once verified, >> they are shown the password on the page. That's the only way I can >> think of to do it. Is that a good solution or does someone have a >> better way? > > I'm sure there are some good products out there to handle this. > Personally, for email encryption I always prefer the OpenPGP family of > tools (including GnuPG and commercial PGP). End-users can install PGP > on their systems, generate public keys, and then send them to the > webserver. No passwords need to be handed out---they will come up with > their own passphrases when they generate their public/private key pairs. > > -- > Erik Arneson > GPG Key ID : 1024D/62DA1D25 BitCoin : 1LqvuGUqJ4ZUSoE7YE9ngETjwp4yZ2uSdP > Office : +1.541.291.9776Skype : callto://pymander >http://www.leisurenouveau.com/ > > I used OpenSSL to generate the P12 file (I haven't actually sent this to anyone since I'm still testing). So, I assumed that it was okay for distribution. Perhaps not. At any rate, I like the idea of the OpenPGP better. I'll see how to do that. Thanks! Floyd -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Friday's Post
On Oct 1, 2010, at 12:04 PM, Paul M Foster wrote: > I'll be politically incorrect and say that it's evil. It's funny you should say that because years ago I did a short video called "PHP Commando". PHP Commando was battling the evil forces of Dr. Dot Net and his sidekick, Macro Mae. Leave it to me to do a parody of a parody! Take care, Floyd -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Google Calendar
I am attempting to use the Zend Gdata framework to communicate with Google Calendars and am having a problem. If I start a new event like this: $event=$gcal->newEventEntry(), nothing happens. My code simply stops executing at that call. If I replace it with this: $event=new Zend_Gdata_Calendar_EventEntry() my code doesn't stop but I get the an error with this: $event->title = $gcal->newTitle($row->title); The error is "Zend/Gdata/Calendar/Extension/Title.php - no such file or directory". I don't know enough about the Zend Framework to figure this one out! Thanks! Floyd -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Google Calendar
I turned on E_ALL & E_STRICT and I still don't receive any type of error message. My code simply stops. I'm not sure what the problem is but I found a Google Calendar wrapper that suits my needs and doesn't require Zend. Thanks! Floyd On Oct 12, 2010, at 10:22 PM, Kranthi Krishna wrote: > The exact error message will help understand your situation > > Most probable reason is Zend is not included in your include path > > develop with error_reporting set to E_ALL & E_STRICT that will help > you understand many trivial errors -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Eclipse, Komodo, Netbeans, Zend Studio, PHP Storm, other?
On Oct 13, 2010, at 12:58 PM, Hansen, Mike wrote: > I'm about to do a lot of work on an existing code base and I think I'd like > to try an IDE. I currently use VIM for most editing. > > What IDE are you using? > > What do you like about the one you are using? > > Which ones have you tried? > > Mike > Good question. I've tried Zend Studio Beta 8, Eclipse, Komodo, and Netbeans on my MacBook Pro. Netbeans is probably the only one that I haven't gotten very frustrated with. They are all very good but eventually all but Netbeans starts to grind to a halt. I love the layout of the Eclipsed-based ones and would love to use Zend Studio or Eclipse. But, when I spend more time waiting for the busy cursor to go away than coding, those nice tools don't do me any good! That being said, does anyone else use a Mac and have similar problems? Take care, Floyd -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Eclipse, Komodo, Netbeans, Zend Studio, PHP Storm, other?
On Oct 13, 2010, at 2:20 PM, Ashley Sheridan wrote: > On Wed, 2010-10-13 at 14:09 -0400, Floyd Resler wrote: > >> On Oct 13, 2010, at 12:58 PM, Hansen, Mike wrote: >> >>> I'm about to do a lot of work on an existing code base and I think I'd like >>> to try an IDE. I currently use VIM for most editing. >>> >>> What IDE are you using? >>> >>> What do you like about the one you are using? >>> >>> Which ones have you tried? >>> >>> Mike >>> >> >> Good question. I've tried Zend Studio Beta 8, Eclipse, Komodo, and Netbeans >> on my MacBook Pro. Netbeans is probably the only one that I haven't gotten >> very frustrated with. They are all very good but eventually all but >> Netbeans starts to grind to a halt. I love the layout of the Eclipsed-based >> ones and would love to use Zend Studio or Eclipse. But, when I spend more >> time waiting for the busy cursor to go away than coding, those nice tools >> don't do me any good! >> >> That being said, does anyone else use a Mac and have similar problems? >> >> Take care, >> Floyd >> >> > > Netbeans is the only IDE I've used, but I have to say, it does what I > need with a minimal of fuss. It has great integration with SVN (via a > downloadable plugin if you're unfortunate enough to still be using > Windows to develop) and the only slowdowns I've seen were where the SVN > server was difficult to reach. > > I like the fact that it has good front-end integration too, and not only > recognises and code hints for those, but it also recognises things like > jQuery. > > Also, it can automatically insert phpDoc comments with a prompt, which > makes it easy to produce standard project documentation. > > Aside from Netbeans, Kate as a text editor is very good. It's part of > the KDE package, and you can get it on Windows as well (although not > sure about MacOS) > > Thanks, > Ash > http://www.ashleysheridan.co.uk > > Another cool thing about Netbeans is that it can connect to a bugzilla service and you can view bug reports right within the IDE. Where's the phpDoc comments ability? I haven't run across that yet. Thanks! Floyd -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Calendar Logic Help
I'm having problems getting my head around some login for a calendar. Specifically, the problem is drawing weekly views for events that span multiple days. I've gotten it so that if an event starts in the week being viewed, the days draw correctly for the remainder of the week. However, if the event goes into the next week, its start date is now outside my date range and so it doesn't display. I know how to say the logic, I'm not sure how to write it! The logic would be: if any date between the start and end dates of the event are within the week being displayed, show the event. I'd like to put the logic into my MySQL query so I don't have to get all events from the calendar to see what should be displayed. Any ideas? Thanks! Floyd -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Calendar Logic Help
On Oct 20, 2010, at 12:47 PM, Tommy Pham wrote: >> -Original Message- >> From: Floyd Resler [mailto:fres...@adex-intl.com] >> Sent: Wednesday, October 20, 2010 9:17 AM >> To: PHP >> Subject: [PHP] Calendar Logic Help >> >> I'm having problems getting my head around some login for a calendar. >> Specifically, the problem is drawing weekly views for events that span >> multiple days. I've gotten it so that if an event starts in the week > being >> viewed, the days draw correctly for the remainder of the week. However, > if >> the event goes into the next week, its start date is now outside my date >> range and so it doesn't display. I know how to say the logic, I'm not > sure >> how to write it! The logic would be: if any date between the start and > end >> dates of the event are within the week being displayed, show the event. > I'd >> like to put the logic into my MySQL query so I don't have to get all > events >> from the calendar to see what should be displayed. Any ideas? >> >> Thanks! >> Floyd >> > > It's hard to give you hints without knowing some actual PHP code and SQL > table columns but here goes: > > PHP logic: $event['startDate'] <= $weekEnd && $event['endDate'] >= > $weekStart > > Query logic: SELECT * FROM event_table WHERE `start_date` <= @weekEnd and > `end_date` >= @weekStart > > week* is the week being viewed. You may have to use the DateTime class or > one of the date_* functions to compare the date for the PHP logic. @ is the > input query parameter. This assumes you have table columns for the event: > start_date & end_date. Adjust the query as needed for multi table joins. > > Regards, > Tommy > That worked perfect! Thanks! Floyd -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Forcing Download - IE Issue
I'm trying to force a download using the following code: header('Content-type: text/calendar'); header('Content-Disposition: attachment; filename="calendar.ics"'); echo $calendar; It works great in all browsers except IE. In IE, the window opens and then closes without ever display the download save window. I'm not sure why it isn't working in IE. Thanks! Floyd -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] form post question
On Oct 28, 2010, at 10:12 AM, Jack wrote: > I have a form which has the following: ( quick clip ) > > > > action="http://www.abc.com/processing/process_form.php"; onSubmit="return > preSubmit();"> > > > > > > value="Peer Guide" /> > >Peer Guide > > > > > > > > > > When the form runs process_form.php it emails the content and has several > other fields from the form, but I have some fields like the one above that > don't show up in the result. The script that builds the message looks like > the below > > > > $temp_message .= "Area(s) of Interest: ". > $_POST['area_interest'] ."\n"; > > > > Is there anything obvious that I am missing? > > > > Is there a way for me to show all the fields from the form, and their field > names which are received by process_form? > > > > > > Thanks! > > Jack If it's a single checkbox and it's not not checked, nothing will come through. However, if it is a series of checkbox with the same name then you will need to do this: Notice I changed area_interest to area_interest[]. This way any checkboxes that are checked will be passed as an array. Take care, Floyd -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Barcode Reader
Does anyone know of a class that can extract information from a barcode image? Thanks! Floyd -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Barcode Reader
They're 2d barcodes. I did a Google search and really couldn't find anything. After talking with my boss, though, we decided that this project would probably take too much time and be frustrating for the users. We're trying to decode barcodes from pictures taken with cell phones. In testing the images are blurry and probably wouldn't be able to be read. However, if you happen to know of PHP class that could decode 2d barcodes, I'd still be interested in checking it out just in case my boss wants to revisit it. Thanks! Floyd On Dec 6, 2010, at 11:35 AM, Jason Pruim wrote: > What kind of barcode? > > Most of the barcodes I work with only store text that doesn't mean much > unless you have the decode algorithm... In other words you need to know where > the info is coming from to be able to determine what is stored in the > barcode. > > > > Jason Pruim > > On Dec 6, 2010, at 11:21 AM, Floyd Resler wrote: > >> Does anyone know of a class that can extract information from a barcode >> image? >> >> Thanks! >> Floyd >> >> >> -- >> 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] Sorting Help
I need to sort the following array: { [Smith, Bob]=>array(137.5,125.5), [Jones, Robert]=>array(132.7,128.2) } The array needs to be sorted by the first number (i.e. 137.5) and then the second in descending order. I looked at array_multisort but couldn't figure out how to make work for my needs. Thanks! Floyd -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Sorting Help
On Apr 11, 2012, at 1:11 PM, admin wrote: > > > -Original Message- > From: Floyd Resler [mailto:fres...@adex-intl.com] > Sent: Wednesday, April 11, 2012 11:26 AM > To: PHP > Subject: [PHP] Sorting Help > > I need to sort the following array: > { > [Smith, Bob]=>array(137.5,125.5), > [Jones, Robert]=>array(132.7,128.2) > } > > The array needs to be sorted by the first number (i.e. 137.5) and then the > second in descending order. I looked at array_multisort but couldn't figure > out how to make work for my needs. > > Thanks! > Floyd > > > > Here is what I did to your array > > $test = array("Smith, Bob"=>array(137.5,125.5),"Jones > Robert"=>array(132.7,128.2)); > asort($test); > print_r(''); > print_r($test); > > That almost worked. I did an arsort() and got the following: Array ( [Guy, Matt] => Array ( [0] => 164.67 [1] => 135.67 ) [Smith, Toby] => Array ( [0] => 159.33 [1] => 132.33 ) [Young, Matt] => Array ( [0] => 157.67 [1] => 131.67 ) [Shobe, Dale ] => Array ( [0] => 157.67 [1] => 128.67 ) [King, Derrick] => Array ( [0] => 155.67 [1] => 126.67 ) [Reynolds, Jeff] => Array ( [0] => 155.67 [1] => 133.67 ) [Bobo, Tom] => Array ( [0] => 152.33 [1] => 124.33 ) [Henderson, Cody] => Array ( [0] => 150.33 [1] => 121.33 ) [McGuffin, Jimmy] => Array ( [0] => 145.67 [1] => 118.67 ) [Stone, Richard] => Array ( [0] => 145 [1] => 119.00 ) [Biggerstaff, David ] => Array ( [0] => 142.33 [1] => 115.33 ) [Dennis, Daymon] => Array ( [0] => 142 [1] => 114.00 ) [Bush, Duke] => Array ( [0] => 141 [1] => 121.00 ) } That's not the entire array but it sorts just fine except for two entries. For some reason these two aren't sorting in descending order of the second element: [King, Derrick] => Array ( [0] => 155.67 [1] => 126.67 ) [Reynolds, Jeff] => Array ( [0] => 155.67 [1] => 133.67 ) Everything else sorts just fine. I'm not sure why that is. Thanks! Floyd
Re: [PHP] sms class
On Apr 17, 2012, at 5:11 PM, Mike Mackintosh wrote: > In reality, a SMS messages are transported the SS7 network, or voice network. > To make the digital transition, carriers use a box called an SMPP gateway. To > get access to this box, is by contract and terms of he carrier, and most > commonly forbidden. As a result, the best bet is to use a SMS Aggregator. > Once you subscribe to their service, they usually offer an API. > > -- > Mike Mackintosh > www.HighOnPHP.com > > > On Tuesday, April 17, 2012 at 15:50, Lester Caine wrote: > >> DZvonko Nikolov wrote: >>> I need a class that sends sms messages to list of numbers. >>> I'm quite new to that issue, so I need to know what I need >>> more. Thanks in advance. >>> >> >> >> Ignoring the wallies >> >> Simply sending an SMS message is something rather more difficult that just >> needing a class to do it. >> Google will give you a hell of a lot of crap and no real answers - I know - >> I've >> been through a lot of it! >> >> The bottom line is that we need to be able to send the message TO the mobile >> phone network, and while in theory it should be simple to do that by >> accessing >> your own mobile phone, the providers tend to block such activity. I'm STILL >> trying to get a SIM card I can use to send my own messages via the mobile >> modem >> that I HAVE got full access to, but none of the UK providers will oblige >> with >> one that has this function enabled. Even though I will be paying for the >> 'airtime' ... >> >> The only way currently to do this is to sign up to a service that you pay to >> send each messages. So what you need to look for is a suitable text sending >> service in your area. Some have free setup and provide a few free messages, >> then >> charge based on your volume of messages. Many of these provide a web based >> service to which you can submit your traffic, but that area is another >> variable. >> I'm using http://www.textlocal.com/ at the moment just to get things running. >> >> -- >> Lester Caine - G8HFL >> - >> Contact - http://lsces.co.uk/wiki/?page=contact >> L.S.Caine Electronic Services - http://lsces.co.uk >> EnquirySolve - http://enquirysolve.com/ >> Model Engineers Digital Workshop - http://medw.co.uk// >> Firebird - http://www.firebirdsql.org/index.php >> >> -- >> PHP General Mailing List (http://www.php.net/) >> To unsubscribe, visit: http://www.php.net/unsub.php >> >> > > I use Tropo (tropo.com) myself. It is easy to use and the support is great! Take care, Floyd -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Session Checking
I want to have an alert pop up to let the user know their session is about to expire. Would the best approach be to do a timer in Javascript or check it in PHP. I'm storing session data in a MySQL database so I can know when a session will expire. If I check it through PHP will the session expiration refresh when I check it? Thanks! Floyd BTW, is Arby's having a roast beef sale or something? Everyone on the list seems to be gone! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php