Re: [PHP] Off the wall - sub-domain question

2013-08-22 Thread Dan McCullough
So its indexing http://www.domain.com/subdomain/page.php and you would
rather it index http://subdomain.domain.com/page.php.  If that is the case
then what Willie said holds true

User-agent: *
Disallow: /subdomain

Place a robots.txt in the domain.com public root directory.

To Googles indexer http://subdomain.domain.com/page.php and
http://www.domain.com/subdomain/page.php are totally different and
therefore blocking /subdomain will not affect subdomain.domain.com.

Sign up for Google Webmaster and add two sites subdomain.domain and
www.domain  that way you can delete improperly indexed pages.
Do some test scans and see if there are links on your www.domain that are
linked to www.domain.com/subdomain rather then subdomain.domain.com


On Thu, Aug 22, 2013 at 9:43 AM, Willie matthews.wil...@gmail.com wrote:

 The only way that I know of to take care of that is to put a file in your
 main directory called robots.txt. In that file you will put:


 User-agent: *
 Disallow: /FolderName



 On Thu, Aug 22, 2013 at 6:19 AM, Jim Giner jim.gi...@albanyhandball.com
 wrote:

  On 8/22/2013 8:05 AM, Curtis Maurand wrote:
 
 
 
 
  Is the subdomain also in a subfolder of the main domain?
 
  Jim Giner wrote:
 
  I have a main domain (of course) and a sub
 
  domain.  I'm really trying to
 
  steer my personal stuff away from
 
  the main one and have focused all of
 
  my php development to the
 
  sub-domain.
 
 
  Lately I noticed that google catalogs my
 
  sub-domain site stuff under the
 
  main domain name and the links
 
  that come up lead to that domain name
 
  with the path that takes
 
  the user to the sub-domain's home folder and
 
  beyond.
 
 
   Is there something that php (apache??) can do to control either
 
  google's
 
  robots or the user's view (url) so that it appears as a
 
  page of my
 
  sub-domain?  I'm really new at this stuff and know
 
  nothing.  I'm lucky
 
  that google is even finding my site!
 
  IN advance - I apologize for this off-topic question,
 
  but this place is
 
  a source of much knowledge, so I just threw in
 
  a quick interlude here to
 
  pick someone's brain.  :)
 
 
   --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 
 
 
   Yes - the sub is an add-on domain to my primary domain.  Hence the
  overlap and problem.
 
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 
 


 --

 Willie Matthews
 matthews.wil...@gmail.com




-- 
Thank you,

Dan

Cell:  484-459-2856

https://www.facebook.com/dpmccullough
http://www.linkedin.com/in/danmccullough


Re: [PHP] PHP vs JAVA

2013-08-20 Thread Dan Munro
 1. There are no statement terminators. Lose your indentation for ANY
 reason and your program is well and truly screwed, in ways you can't
 imagine.

 2. Python programs fail in the most ungraceful way I've ever seen in an
 interpreted programming language.

1. Indent properly. In php, if you put an open or close brace out of place
your code will break in unexpected ways as well. If it's hard to tell if
something is indented properly, your code should be refactored so that it
is.

2. In my experience this has a lot to do with how some people use python
and not python itself.


On Tue, Aug 20, 2013 at 12:12 PM, Tedd Sperling tedd.sperl...@gmail.comwrote:

 On Aug 20, 2013, at 12:24 PM, Paul M Foster pa...@quillandmouse.com
 wrote:

  On Tue, Aug 20, 2013 at 05:09:37PM +0100, Lester Caine wrote:
 
  shiplu wrote:
  During PHPvsPython search I found this info graphic
  https://www.udemy.com/blog/modern-language-wars/#. Some of the
  statistics contain Java too. Also you can search PHP and Web
  Development in big job sites and compare with same search but with
  Java.
 
  'Python is arguably the most readable programming language' probably
  says it all? Personally I find it almost impossible to understand
  when coming in cold to someone elses code ... Java is not much
  better ... but I still have to persist with both since some key
  elements of a usable PHP IDE now rely on both :(
 
  Python may be most readable, but it's a huge fail for two reasons:
 
  1. There are no statement terminators. Lose your indentation for ANY
  reason and your program is well and truly screwed, in ways you can't
  imagine.
 
  2. Python programs fail in the most ungraceful way I've ever seen in an
  interpreted programming language.

 And no ternary operator.

 tedd

 ___
 tedd sperling
 tedd.sperl...@gmail.com


 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php




-- 
From the desk of Dan Munro


Re: [PHP] PHP vs JAVA

2013-08-20 Thread Dan Munro
 in my opinion, that would be like asking how big is the internet?.

http://www.washingtonpost.com/blogs/the-switch/wp/2013/08/18/heres-what-you-find-when-you-scan-the-entire-internet-in-an-hour/


On Tue, Aug 20, 2013 at 1:08 PM, Sebastian Krebs krebs@gmail.comwrote:

 2013/8/20 Steven Staples sstap...@mnsi.net

   My recent question was simply an attempt to get documentation to
 support
   which server-side Web Language is the most popular. Both PHP and Java
 can
   be used server-side.
  
   I also realize that Java is used for native Android because I also
 teach
   Mobile Application Development (MAD -- I even coined the name). So, I
 am
  up
   to my butt in languages (and people who think different than me) -- I'm
   just trying to get documentation to back up my what I think I know.
 
  Well, technically any language can be used server side, it is all on how
  you
  set up your server, no?
 

 No. But since node.js I lack an example :D But of course you need the
 link between the language and the network.


 
  I would tend to think that the biggest out there, is
 html/php/javascript...
  and next to that, would be asp, and then java.   Do I have proof of this?
  No, can I get proof, I doubt it, and are there stats on this? To be
 honest,
  in my opinion, that would be like asking how big is the internet?.  It
 is
  virtually an immeasurable object.  There are so many websites out there,
  that you can't search them all...
 

 Of course you cannot search them _all_, but again the link:
 http://w3techs.com/technologies/overview/programming_language/all
 There are good hints, how the internet looks like. For example a hoster
 can simply look at the products he sell. Services like w3techs.com use the
 reports from the server themself (in most cases the headers), or the
 file-ending (doesn't work anymore that good, since most sites hide them ;))
 and extrapolate this.
 Of course they are not exact, but I think they show the direction quite
 accurate.


 
  PHP is simple, and yet powerful to use, and is pretty much the standard
 for
  all hosting companies.
 
  Now, there is this link...
  http://www.tiobe.com/index.php/content/paperinfo/tpci/index.html
 
  It shows Java as #1, and php as #5, but this is also for PROGRAMMING,
 does
  not specify web based programming vs desktop vs MAD (thanks tedd ;) ) so
  the
  numbers do not really speak out in this application.
 

 Also it is the Tiobe-Index. Although it is widely-referenced, the way it
 calculates their rankings is ... interesting. In fact it only tells you how
 loud a community around a specific language is. So for example maybe Java
 is #1, because it is so complex, that it leads to many questions in forums
 and on stackoverflow. Or PHP is only #5, because most communication is on
 IRC, or mailinglists. (disclaimer: Of course I faked this examples.
 Actually I have no idea how the communities around Java and PHP as a
 whole interacts primary, but I don't think, that they are all equal).
 I just think, that the Tiobe-Index has a completely different view on what
 is a popular language, than I have.


 
  Does it really matter?   PHP is very huge, widely used, and I would even
 go
  so far as to say the 'norm' for website developers, and hosting
 providers.
 

 Nope, it doesn't matter :)


 
  But that is my $0.02, and for me, I have been with PHP for 7 years
  professionally, and in college I took VB.net, ASP.net, C++, JAVA and PHP.
  Only recently have I gotten into C# for desktop applications.
 
 
 
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 
 


 --
 github.com/KingCrunch




-- 
From the desk of Dan Munro


Re: [PHP] PHP vs JAVA

2013-08-20 Thread Dan Munro
Zmap works by being stateless, so while nmap records which requests go out,
zmap fires and forgets, and encodes the request in such a way that the
response can provide whatever details it needs to continue the scan. No
magic here.


On Tue, Aug 20, 2013 at 2:28 PM, Lester Caine les...@lsces.co.uk wrote:

 Tedd Sperling wrote:

 I'm just trying to get documentation to back up my what I think I know.


 http://en.wikipedia.org/wiki/**Programming_languages_used_in_**
 most_popular_websiteshttp://en.wikipedia.org/wiki/Programming_languages_used_in_most_popular_websitesmay
  be a better starting point, but there are no citations to the facts,
 they are a little dated, and some sites are a little biased in their
 choices? Move to the top 40 sites and PHP fares a little better -
 http://rogchap.com/2011/09/06/**top-40-website-programming-**languages/http://rogchap.com/2011/09/06/top-40-website-programming-languages/but
  but this data is a little dataed now.   Personally I've always used the
 W3techs figures when I'm doing talks as it is the only consistent source
 I've found. The netcraft figures would be nice but they only run this
 intermittently, and last January's figure of 244 million sites at 39% of
 machines seems a little at odds with the W3techs ones? http://w3techs.com/
 **technologies/history_overview/**programming_languagehttp://w3techs.com/technologies/history_overview/programming_languagecontinues
  to show PHP rising at the expense of ASP and Java with Perl, Ruby
 and Python having trouble to stay above 1% combined over the last year.


 --
 Lester Caine - G8HFL
 -
 Contact - 
 http://lsces.co.uk/wiki/?page=**contacthttp://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
 Rainbow Digital Media - 
 http://rainbowdigitalmedia.co.**ukhttp://rainbowdigitalmedia.co.uk


 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php




-- 
From the desk of Dan Munro


[PHP] Re: zend framework getIdentity

2013-07-19 Thread Dan Joseph
On Wed, Jul 17, 2013 at 5:54 PM, Dan Joseph dmjos...@gmail.com wrote:

 Fatal error: Uncaught exception 'Zend_Session_Exception' with message
 'Zend_Session::start() -
 /product/Messenger-dev/Messenger/library/Zend/Session.php(Line:480): Error
 #2 Class __PHP_Incomplete_Class has no unserializer Array' in
 /product/Messenger-dev/Messenger/library/Zend/Session.php:493


I see I've stumped everyone here, so I wanted to post a reply on what I
found is the root cause of this.

Somewhere in all the code, there's a session_start happening.  Then
elsewhere that our other developer is working, there was another
introduced.  This appears to be the trigger for this error.

Hope this helps someone in the future!

-- 
-Dan Joseph

http://www.danjoseph.me
http://www.dansrollingbbq.com
http://www.youtube.com/DansRollingBBQ


[PHP] zend framework getIdentity

2013-07-17 Thread Dan Joseph
Hey Folks,

Getting a weird error...

Fatal error: Uncaught exception 'Zend_Session_Exception' with message
'Zend_Session::start() -
/product/Messenger-dev/Messenger/library/Zend/Session.php(Line:480): Error
#2 Class __PHP_Incomplete_Class has no unserializer Array' in
/product/Messenger-dev/Messenger/library/Zend/Session.php:493
Stack trace:
#0
/product/Messenger-dev/Messenger/library/Zend/Session/Namespace.php(143):
Zend_Session::start(true)
#1
/product/Messenger-dev/Messenger/library/Zend/Auth/Storage/Session.php(87):
Zend_Session_Namespace-__construct('Zend_Auth')
#2 /product/Messenger-dev/Messenger/library/Zend/Auth.php(91):
Zend_Auth_Storage_Session-__construct()
#3 /product/Messenger-dev/Messenger/library/Zend/Auth.php(151):
Zend_Auth-getStorage()
#4
/product/Messenger-dev/Messenger/library/Messenger/Core/Db/Profiler/Log.php(53):
Zend_Auth-getIdentity()
#5
/product/Messenger-dev/Messenger/library/Lm/Application/Resource/Config.php(18):
Messenger_Core_Db_Profiler_Log-__construct()
#6 /product/Messenger-dev/Messenger/library/Zend/Application/Bootstr in
/product/Messenger-dev/Messenger/library/Zend/Session.php on line 493

This seems to be triggered by:

 $this-_identity = Zend_Auth::getInstance()-getIdentity();


Has anyone seen this error before?  Its throwing me for a loop

-- 
-Dan Joseph

http://www.danjoseph.me
http://www.dansrollingbbq.com
http://www.youtube.com/DansRollingBBQ


Re: [PHP] Last Record INSERT

2013-06-26 Thread Dan Munro
Learning something new everyday is one of the joys of this profession. If
you learn two new things, consider yourself lucky :)


On Wed, Jun 26, 2013 at 11:03 AM, Samuel Lopes Grigolato 
samuel.grigol...@gmail.com wrote:

 AFAIK mysql_[...] is deprecated in favor of mysqli_[...] correspondent
 functions, there's nothing to do specifically with mysql[i]_insert_id.


 On Wed, Jun 26, 2013 at 3:01 PM, Tedd Sperling tedd.sperl...@gmail.com
 wrote:

  On Jun 26, 2013, at 1:56 PM, Stuart Dallas stu...@3ft9.com wrote:
   On Wednesday, 26 June 2013 at 18:39, Tedd Sperling wrote:
   Let me add, currently I am inserting an email address into a database.
  
   To find which record was created, I ask for the record number (ID)
 back.
  
   I am asking simply because mysql_insert_id() is deprecated.
 
  Now you tell me. :-)
 
  I learn something new every day of my life... and I'm getting damned
 tried
  of it.
 
  Back to the books.
 
  Thanks.
 
  Cheers,
 
  tedd
 
  _
  tedd.sperl...@gmail.com
  http://sperling.com
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 
 




-- 
From the desk of Dan Munro


Re: [PHP] A Good OOP Tutorial/Read?

2013-05-21 Thread Dan Joseph
Hey guys, thanks again for the talk and education.  I've purchased the
book, and started reading thru the links given.  Take care!

-Dan


On Sun, May 19, 2013 at 12:28 PM, Tedd Sperling t...@sperling.com wrote:

 To all:

 Thanks to Stuart, I finally got it.

 The concept of Interface is a bit difficult to explain, but his excellent
 console made the concept clear.

 Many thanks to all for their efforts to educate me.

 Cheers,

 tedd


 _
 t...@sperling.com
 http://sperling.com


 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php




-- 
-Dan Joseph

http://www.danjoseph.me
http://www.dansrollingbbq.com
http://www.youtube.com/DansRollingBBQ


[PHP] A Good OOP Tutorial/Read?

2013-05-16 Thread Dan Joseph
Hey Folks,

I'm looking to refine my PHP 5 OOP skills.  I know the basics, understand
patterns, but have clearly missed a few things along the way.

Do any of you have some real good PHP 5 OOP tutorials/reads bookmarked you
could share?  Something other than php.net/oop5.

Thanks!

-- 
-Dan Joseph

http://www.danjoseph.me
http://www.dansrollingbbq.com
http://www.youtube.com/DansRollingBBQ


Re: [PHP] A Good OOP Tutorial/Read?

2013-05-16 Thread Dan Joseph
Thanks!  This looks like a good start.  Covers some things I have questions
on.  I like his approach.

Now I just need something advanced to continue on after this.  I'd like to
learn more about extending, interfaces, abstracts, and why/when they should
be used.

Appreciate it!

-Dan


On Thu, May 16, 2013 at 11:01 AM, Francisco C Soares dotjun...@gmail.comwrote:

  On 05/16/2013 11:55 AM, Dan Joseph wrote:

 Hey Folks,

 I'm looking to refine my PHP 5 OOP skills.  I know the basics, understand
 patterns, but have clearly missed a few things along the way.

 Do any of you have some real good PHP 5 OOP tutorials/reads bookmarked you
 could share?  Something other than php.net/oop5.

  Try,
 Tente,

 http://www.killerphp.com/tutorials/object-oriented-php/

 Success!
 Sucesso!

 ___
 Francisco C Soares ( *Junior* )
 403790c89847cdbe5a262146de8fb93139c4

 BLOG dotjunior.blogspot.com




-- 
-Dan Joseph

http://www.danjoseph.me
http://www.dansrollingbbq.com
http://www.youtube.com/DansRollingBBQ


Re: [PHP] A Good OOP Tutorial/Read?

2013-05-16 Thread Dan Joseph
Hey Guys,

Thanks for all this good information so far.  I'll keep you posted on my
edumacation!

-Dan


On Thu, May 16, 2013 at 11:16 PM, Larry Garfield la...@garfieldtech.comwrote:

 On 05/16/2013 06:45 PM, Tedd Sperling wrote:

 Thanks to both Bastien and Sebastian:

 While I understand that an interface is like an abstract Class, in that
 you don't have to flesh-out your methods, but rather where you define
 exactly how Classes who implement that interface will be required to
 flesh-out those methods. But so what? What's the point?

 Without giving me complicated examples, just give me one simple example
 that illustrates the advantage of using an interface over writing a new
 Class where you flesh-out whatever methods you want. After all, an
 interface requires the same thing, does it not?

 As such, I just don't see the advantage interfaces bring.

 Cheers,

 tedd


 Practical example, PSR-3:

 https://github.com/php-fig/**fig-standards/blob/master/**
 accepted/PSR-3-logger-**interface.mdhttps://github.com/php-fig/fig-standards/blob/master/accepted/PSR-3-logger-interface.md

 Say you're writing a stand-alone library, maybe a Twitter-connecting
 library.  You want to be able to log stuff, but don't want to have to deal
 with opening log files yourself.  You also want to allow your library to be
 used by people running Symfony, Code Igniter, Drupal, Zend Framework, or
 PHPBB, all of which have their own logging systems in place that may talk
 to syslog, a database, files on disk, or whatever.  People using those
 frameworks don't want your library spewing log files all over their file
 system.

 Instead, you simply support the PSR-3 logging interface.  You accept an
 object that implements that interface in your constructor, and then write
 to it.  What happens on the other side?  Who gives a damn!

 For your own testing, you can write a simple class that implements that
 interface and dumps log messages to disk.

 When someone uses your library with Symfony, they just pass in a Monolog
 object (the logging system used by Symfony), and your code is now logging
 errors to whatever they have Monolog configured to do.

 When someone uses your library with Drupal, they just pass in the Drupal
 Watchog logger object (which is being rewritten to use PSR-3 as we speak),
 and now your library is logging errors to Drupal's logging system (which
 could be syslog or a DB table, depending on how the user has their site
 configured).

 And you don't give a damn about any of that.  All you care about is that
 you support any object that matches this interface.  What that object
 does with the messages you send it, and where that object came from, you
 don't have to give a crap about.

 Now take that same concept and apply it at a smaller scale, within your
 own project.  Swap out your database-based cache system for a
 memcache-based one.  Your code doesn't change, because it's writing to an
 interface, not to the database.  Swap out your data store with one that is
 used just for testing.  Etc.

 That's what interfaces give you.  Loose coupling, and the ability to
 divide-and-conquer... and even let someone else solve problems for you. :-)

 --Larry Garfield


 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php




-- 
-Dan Joseph

http://www.danjoseph.me
http://www.dansrollingbbq.com
http://www.youtube.com/DansRollingBBQ


Re: [PHP] FW:

2013-05-08 Thread Dan Joseph
Yo,

  (And, no, PHP doesn't stand
 for Produced by Horses  Ponies.)


This is completely devastating

-- 
-Dan Joseph

http://www.danjoseph.me
http://www.dansrollingbbq.com
http://www.youtube.com/DansRollingBBQ


Re: FW: [PHP] Accessing Files Outside the Web Root

2013-03-13 Thread Dan McCullough
Web bots can ignore the robots.txt file, most scrapers would.
On Mar 13, 2013 4:59 PM, Jen Rasmussen j...@cetaceasound.com wrote:

 -Original Message-
 From: Dale H. Cook [mailto:radiot...@plymouthcolony.net]
 Sent: Wednesday, March 13, 2013 3:38 PM
 To: php-general@lists.php.net
 Subject: [PHP] Accessing Files Outside the Web Root

 Let me preface my question by noting that I am virtually a PHP novice.
 Although I am a long-time webmaster, and have used PHP for some years to
 give visitors access to information in my SQL database, this is my first
 attempt to use it for another purpose. I have browsed the mailing list
 archives and have searched online but have not yet succeeded in teaching
 myself how to do what I want to do. This need not provoke a lengthy
 discussion or involve extensive hand-holding - if someone can point to an
 appropriate code sample or online tutorial that might do the trick.

 I am the author of a number of PDF files that serve as genealogical
 reference works. My problem is that there are a number of sites which are
 posing as search engines and which display my PDF files in their entirety
 on
 their own sites. These pirate sites are not simply opening a window that
 displays my files as they appear on my site. They are using Google Docs to
 display copies of my files that are cached or stored elsewhere online. The
 proof of that is that I can modify one of my files and upload it to my
 site.
 The file, as seen on my site, immediately displays the modification. The
 same file, as displayed on the pirate sites, is unmodified and may remain
 unmodified for weeks.

 It is obvious that my files, which are stored under public_html, are being
 spidered and then stored or cached. This displeases me greatly. I want my
 files, some of which have cost an enormous amount of work over many years,
 to be available only on my site. Legitimate search engines, such as Google,
 may display a snippet, but they do not display the entire file - they link
 to my site so the visitor can get the file from me.

 A little study has indicated to me that if I store those files in a folder
 outside the web root and use PHP to provide access they will not be
 spidered. Writing a PHP script to provide access to the files in that
 folder
 is what I need help with. I have experimented with a number of code samples
 but have not been able to make things work. Could any of you point to code
 samples or tutorials that might help me? Remember that, aside from the code
 I have written to handle my SQL database I am a PHP novice.

 Dale H. Cook, Member, NEHGS and MA Society of Mayflower Descendants;
 Plymouth Co. MA Coordinator for the USGenWeb Project Administrator of
 http://plymouthcolony.net


 --
 PHP General Mailing List (http://www.php.net/) To unsubscribe, visit:
 http://www.php.net/unsub.php


 Have you tried keeping all of your documents in one directory and blocking
 that directory via a robots.txt file?

 Jen





 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Your Amazon.com order confirmation.

2012-06-08 Thread Dan McCullough
I was hoping for a TV

On Fri, Jun 8, 2012 at 10:19 AM,  wrote:

   Your Order with Amazon.com

Thanks for your order,
 php-db-h...@lists.php.net!Did you know you can
 view and edit your  orders online, 24 hours a day?
 Visit Your Account.

Order Information:


   E-mail
 Address:   php-db-h...@lists.php.net


BillingAddress:
 Av.
GAHANNAUnited States
  Phone: 1-747-517-7595



   Order Grand
  Total:  $60.99





  Earn 3%
 rewards on yourAmazon.com orders with
 the AmazonVisa Card. Learn
  More


 Order Summary:


   Details:



   Order #:
  Y09-7318668-6213012
 Subtotal of items:
  $ 60.99

 --
   Total before tax:
$ 60.99

 Tax Collected:
$0.00
 --

   Grand Total:
$ 60.00
   Gift Certificates:
$ 0.99

 --
   Total for this
Order:$ 60.99

 The
 following item is auto-delivered to your  Kindle or
 other device. You can view more  information about
 this order by clicking on  the title on the Manage
 Your Kindle page at Amazon.com.

The Witness by
  Nora Roberts [Kindle Edition] $ 60.99
  Sold By: Random House
Digital, Inc.

  You can review
 your orders in Your Account.  If you've explored
 the links on that page but  still have a question,
 please visit our online  Help Department.
  Please note: This e-mail was sent from
 a  notification-only address that cannot accept
  incoming e-mail. Please do not reply to this
message.Thanks again for shopping
 with us.Amazon.com
Earth's Biggest SelectionPrefer
 not to receive HTML mail? Click here





-- 
Thank you,

Dan

Cell:  484-459-2856

https://www.facebook.com/dpmccullough
http://www.linkedin.com/in/danmccullough


[PHP] PDF Form Field

2012-05-03 Thread Dan Joseph
Hi,

I've spent hours researching this with no luck.  I have a PDF with a form
field that I want to populate and output the PDF.  Can someone point me in
the right direction?  Can FPDF do this natively, or I need something else?
 My host doesn't have PDFLib installed, so that's not an option.  Thanks.

-- 
-Dan Joseph

http://www.danjoseph.me


Re: [PHP] PDF Form Field

2012-05-03 Thread Dan Joseph
On Thu, May 3, 2012 at 9:13 PM, David OBrien dgobr...@gmail.com wrote:

 I just found fpdfi using Google. It looks like what you need


Wow, you said the key phrase in your last e-mail, 'text on top'.  I didn't
think of that.  fpdi/fpdf does that like a charm, thanks!

-- 
-Dan Joseph

http://www.danjoseph.me


Re: [PHP] function

2012-05-03 Thread Dan Joseph
On Thu, May 3, 2012 at 10:12 PM, Ron Piggott ron.pigg...@actsministries.org
 wrote:

 I need to access a FUNCTION I programmed within a different FUNCTION.  Are
 these able to be passed like a variable?  Or are they able to become like a
 $_SESSION variable in nature?  How am I able to do this?

 I am essentially programming:

 ===
 function name( $flag1, $flag2 ) {

 # some PHP

 echo name_of_a_different_function( $flag1 , $flag2 );

 }
 ===

 The error I am receiving is “Call to undefined function
 name_of_a_different_function”


Are these inside classes or anything?  If they're just functions, they
should work fine together, example of 2 working functions together:

?php

hellotwo();

function helloone()
{
echo hi 1;
}

function hellotwo()
{
helloone();
}

?

This results in hi 1 being echoed to the screen.

-- 
-Dan Joseph

http://www.danjoseph.me


Re: [PHP] PDF Printing instead?

2012-01-05 Thread Dan Joseph
On Thu, Jan 5, 2012 at 3:14 PM, Jim Giner jim.gi...@albanyhandball.comwrote:

 ok - somebody has advised that I should not be trying to print to a printer
 from my website php script.

 The suggestion of creating a pdf and sending to the client was made.  How
 do
 I install the pdf functions?  I've never had to install a package before or
 is that something my hoster does?


If you're on shared hosting, it'd be something your hosting company does.
I used fpdf for my last pdf job.  Although, I personally do not see a
problem with having people just print a nicely formatted web page out.

-- 
-Dan Joseph

http://www.danjoseph.me


Re: [PHP] json_encode confusion

2011-11-10 Thread Dan Schaefer

On 11/10/2011 09:45 AM, Bastien Koert wrote:

Morning all,

I've been having some fun with converting a text data file import into
a json object for storage.

I have a text file that is pipe delimited coming in via an upload. The
first row is the headers and the second row is the data.

Using this code:

$data = file(inline_Nov_8_2011.txt);

if(count($data)==2){

$keys   = explode(|, $data[0]);
$fields = explode(|, $data[1]); 

$combine = array_combine($keys, $fields);

$json = json_encode($combine);
}

After the combine, I get an array that looks like this

Array
(
 ['Legal Last Name '] =  Andros
 ['Legal Middle Initial '] =
 ['Legal First Name '] =  Marisa
 ['Maiden/Other Name '] =
 ['Social Insurance No. '] =  123456789
 ['Date of Birth '] =  2/1/1988
 ['Gender '] =  Female
)

But the json encoded value looks like this (there are way more
elements but this should be enough to represent what I need to do).

{null:Andros,null:,null:Marisa,null:,null:123456789,null:2\/1\/1988,null:Female}

I have been googling for info about allowed values for the json keys,
but can't seem to find a clear doc on what is allowed and what isn't.
I have tried unquoted keys, replaced the spaced with underscores but
nothing I do seems to help.

When I echo out the json encoded data, the keys are all nulls.

Can someone point me in the correct direction? It may be that I need
to manually create the key names as an array first, which I was hoping
to avoid since the file format coming from the client is still in some
flux.

Just a thought: Try removing the spaces altogether, not by replacing 
them with underscores.


--
Dan


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] 3.1.9 build of APC win 64

2011-08-01 Thread Dan Baughman
Does anyone know where you can download a 64 bit build of apc 3.1.9?

I want to take advantage of some of the stuff they've pushed out since 3.1.8
for windows, but can't find a 64 bit binary to save my life.


Re: [PHP] 3.1.9 build of APC win 64

2011-08-01 Thread Dan Baughman
Thank you.

On Mon, Aug 1, 2011 at 9:20 AM, Lester Caine les...@lsces.co.uk wrote:

 Dan Baughman wrote:

 Does anyone know where you can download a 64 bit build of apc 3.1.9?

 I want to take advantage of some of the stuff they've pushed out since
 3.1.8
 for windows, but can't find a 64 bit binary to save my life.


 http://www.anindya.com/php-5-**3-6-x64-64-bit-for-windows/http://www.anindya.com/php-5-3-6-x64-64-bit-for-windows/is
  still 3.1.6, and while I expect Anindya will be running a 5.3.7 soon with
 the later libraries, but I've dropped a comment asking if 3.1.9 will build
 for use with 5.3.6 and Anindya is normally quite quick responding if
 requests are simple.

 --
 Lester Caine - G8HFL
 -
 Contact - 
 http://lsces.co.uk/wiki/?page=**contacthttp://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.phphttp://www.firebirdsql.org/index.php

 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] PHP runs but apache says its a faulting module every so often

2011-07-30 Thread Dan Baughman
Hi list,

I have my php and apache running on windows just fine, but consistently
enough to cause me big problems apache hangs up and stops servicing
requests, and I get a bunch of these in the log:


Faulting application path: D:\Apache\bin\httpd.exe
Faulting module path: D:\PHP\php5ts.dll

Is there a way to turn on logging such that you can see what module is
failing?

Thanks in advance,
Dan


Re: [PHP] Cwtc

2011-06-14 Thread Dan Joseph
On Tue, Jun 14, 2011 at 10:58 AM, Daniel Brown danbr...@php.net wrote:

 On Tue, Jun 14, 2011 at 04:00,  scarab...@crcvms.unl.edu wrote:
  Dear user php-general@lists.php.net,
 
  Your account has been used to send a huge amount of junk e-mail messages
 during this week.
  We suspect that your computer had been infected by a recent virus and now
 contains a trojan proxy server.
 
  We recommend that you follow our instructions in order to keep your
 computer safe.
 
  Have a nice day,
  The lists.php.net support team.

Pffft!  Nice try.


You don't think the mailing list software fell for it?

-- 
-Dan Joseph


Re: [PHP] date problem

2011-04-02 Thread Dan Dan
It seems different php versions have different outputs for this code:

Fedora Core 14 (x86):

first: 01-03-2011 00:00:00
second: 08-03-2011 00:00:00
third: 22-03-2011 00:00:00
fourth: 22-03-2011 00:00:00
fifth: 29-03-2011 00:00:00

Fedora Core11 (x86_64):

first: 31-12-1969 16:00:00
second: 31-12-1969 16:00:00
third: 22-03-2011 00:00:00
fourth: 31-12-1969 16:00:00
fifth: 31-12-1969 16:00:00

However it works if reorder Year and Month like:

echo first: .date(d-m-Y H:i:s,strtotime('2011 March first
wednesday')).\n;
echo second: .date(d-m-Y H:i:s,strtotime('2011 March second
wednesday')).\n;
echo third: .date(d-m-Y H:i:s,strtotime('2011 March third
wednesday')).\n;
echo fourth: .date(d-m-Y H:i:s,strtotime('2011 March fourth
wednesday')).\n;
echo fifth: .date(d-m-Y H:i:s,strtotime('2011 March fifth
wednesday')).\n;

first: 02-03-2011 00:00:00
second: 09-03-2011 00:00:00
third: 16-03-2011 00:00:00
fourth: 23-03-2011 00:00:00
fifth: 30-03-2011 00:00:00

Thanks
-dani


On Sat, Apr 2, 2011 at 1:17 AM, Louis Huppenbauer 
louis.huppenba...@gmail.com wrote:

 Just try of March. Worked for me.


 print first: .date(d-m-Y H:i:s,strtotime('first Tuesday of March
 2011')).\n;
 print second: .date(d-m-Y H:i:s,strtotime('second Tuesday of March
 2011')).\n;
 print third: .date(d-m-Y H:i:s,strtotime('third Tuesday of March
 2011')).\n;
 print fourth: .date(d-m-Y H:i:s,strtotime('fourth Tuesday of March
 2011')).\n;
 print fifth: .date(d-m-Y H:i:s,strtotime('fifth Tuesday of March
 2011')).\n;


 2011/4/2 Dan Dan dani.mani...@gmail.com:
  I removed the day (1 before the March), but its still giving the same
  result, i.e. different days of month with and without the 'first'. Any
  further help ?
 
  print first Tuesday :.date(d-m-Y H:i:s,strtotime('March 2011
  Tuesday')).\n;
  print first: .date(d-m-Y H:i:s,strtotime('March 2011 first
  Tuesday')).\n;
  print second: .date(d-m-Y H:i:s,strtotime('March 2011 second
  Tuesday')).\n;
  print third: .date(d-m-Y H:i:s,strtotime('March 2011 third
  Tuesday')).\n;
  print fourth: .date(d-m-Y H:i:s,strtotime('March 2011 fourth
  Tuesday')).\n;
 
  first Tuesday :01-03-2011 00:00:00
  first: 08-03-2011 00:00:00
  second: 15-03-2011 00:00:00
  third: 22-03-2011 00:00:00
  fourth: 29-03-2011 00:00:00
 
  Thanks
  -dani
 
 
 
  On Fri, Apr 1, 2011 at 9:37 AM, Daniel Brown danbr...@php.net wrote:
 
  On Fri, Apr 1, 2011 at 12:35, Dan Dan dani.mani...@gmail.com wrote:
   Hi Folks,
  
   I am trying to get the day of month for a particular day of week (e.g.
   Tuesday) for the first, second, third, fourth week in a month. The
 code i
   have seems issues in March, but works e.g. in April:
  
   print date(d-m-Y H:i:s,strtotime('1 March 2011 Tuesday'));
   01-03-2011 00:00:00
  
   print date(d-m-Y H:i:s,strtotime('1 March 2011 first Tuesday'));
   08-03-2011 00:00:00
  
   While in April, I have
  
   print date(d-m-Y H:i:s,strtotime('1 April 2011 Tuesday'));
   05-04-2011 00:00:00
  
   print date(d-m-Y H:i:s,strtotime('1 April 2011 first Tuesday'));
   05-04-2011 00:00:00
  
   Could someone help whats wrong with the technique i am trying to find
  that
   day of month. Is there any better way ?
 
  Because you're combining the date with the day of the week.  It so
  happens that 1 March was a Tuesday, but today - 1 April - is a Friday.
   Pick one or the other, not both.
 
  --
  /Daniel P. Brown
  Network Infrastructure Manager
  http://www.php.net/
 
 



Re: [PHP] date problem

2011-04-01 Thread Dan Dan
I removed the day (1 before the March), but its still giving the same
result, i.e. different days of month with and without the 'first'. Any
further help ?

print first Tuesday :.date(d-m-Y H:i:s,strtotime('March 2011
Tuesday')).\n;
print first: .date(d-m-Y H:i:s,strtotime('March 2011 first
Tuesday')).\n;
print second: .date(d-m-Y H:i:s,strtotime('March 2011 second
Tuesday')).\n;
print third: .date(d-m-Y H:i:s,strtotime('March 2011 third
Tuesday')).\n;
print fourth: .date(d-m-Y H:i:s,strtotime('March 2011 fourth
Tuesday')).\n;

first Tuesday :01-03-2011 00:00:00
first: 08-03-2011 00:00:00
second: 15-03-2011 00:00:00
third: 22-03-2011 00:00:00
fourth: 29-03-2011 00:00:00

Thanks
-dani



On Fri, Apr 1, 2011 at 9:37 AM, Daniel Brown danbr...@php.net wrote:

 On Fri, Apr 1, 2011 at 12:35, Dan Dan dani.mani...@gmail.com wrote:
  Hi Folks,
 
  I am trying to get the day of month for a particular day of week (e.g.
  Tuesday) for the first, second, third, fourth week in a month. The code i
  have seems issues in March, but works e.g. in April:
 
  print date(d-m-Y H:i:s,strtotime('1 March 2011 Tuesday'));
  01-03-2011 00:00:00
 
  print date(d-m-Y H:i:s,strtotime('1 March 2011 first Tuesday'));
  08-03-2011 00:00:00
 
  While in April, I have
 
  print date(d-m-Y H:i:s,strtotime('1 April 2011 Tuesday'));
  05-04-2011 00:00:00
 
  print date(d-m-Y H:i:s,strtotime('1 April 2011 first Tuesday'));
  05-04-2011 00:00:00
 
  Could someone help whats wrong with the technique i am trying to find
 that
  day of month. Is there any better way ?

 Because you're combining the date with the day of the week.  It so
 happens that 1 March was a Tuesday, but today - 1 April - is a Friday.
  Pick one or the other, not both.

 --
 /Daniel P. Brown
 Network Infrastructure Manager
 http://www.php.net/



Re: [PHP] PHP session replication

2011-03-17 Thread Dan Joseph
On Thu, Mar 17, 2011 at 12:06 AM, Alessandro Ferrucci 
alessandroferru...@gmail.com wrote:

 I'm curious, what are the most popular methods to perform session
 replication across http servers in PHP?


I personally just use MySQL and the session_set_save_handler() stuff
attached to a class.  Many of the frameworks, such as Zend, also support
Database Sessions.

-- 
-Dan Joseph


Re: [PHP] Zend Framework - getParam() Question

2011-03-12 Thread Dan Joseph
Howdy,

Mid, Net, thanks for the tips!  I actually didn't have the proper .htaccess
settings that ZF wanted, and I needed to add a router :)

Thank you both!

-Dan

On Sat, Mar 12, 2011 at 12:48 AM, Midhun Girish midhungir...@gmail.comwrote:

 You can also try routing in zend..
 http://codeutopia.net/blog/2007/11/16/routing-and-complex-urls-in-zend-framework/

 Midhun Girish



 On Sat, Mar 12, 2011 at 11:16 AM, NetEmp net.ser...@gmail.com wrote:

 Hi Dan

 One method for this is to use URL Rewriting (which can be implemented on
 Apache using htaccess).

 Through URL Rewriting you can first make the following URL:

 http://www.website.com/article-clean-url

 http://www.website.com/article-clean-urlto internally behave as the
 following:

 http://www.website.com/index/user/ http://www.website.com/index/user/11


 http://www.website.com/index/user/1and then you can use the same
 getParam
 method to grab the value and carry out further processing.

 Hope this helps.

 Cheers

 NetEmp

 On Sat, Mar 12, 2011 at 10:04 AM, Dan Joseph dmjos...@gmail.com wrote:

  Hi Everyone,
 
  Zend Framework getParam question
 
  I'm trying to get a value from the url...
 
  I know how to grab:
 
  http;//www.website.com/index/user/1
 
  that's the index controller, $this-_getParam('user'); (value = 1)..
 
  What I'd like to be able to grab is just off one thing from the url...
  example..  I want to give an article a unique/clean url... so, when I go
  to:
 
  http://www.website.com/article-clean-url
 
  I can somehow grab that 'article-clean-url' as a value and use it for a
  lookup in the database.
 
  I've tried everything and search all over the place.  I can't find the
  answer.  Can someone tell me how this is done?  Thanks...
 
  --
  -Dan Joseph
 





-- 
-Dan Joseph


[PHP] Zend Framework - getParam() Question

2011-03-11 Thread Dan Joseph
Hi Everyone,

Zend Framework getParam question

I'm trying to get a value from the url...

I know how to grab:

http;//www.website.com/index/user/1

that's the index controller, $this-_getParam('user'); (value = 1)..

What I'd like to be able to grab is just off one thing from the url...
example..  I want to give an article a unique/clean url... so, when I go to:

http://www.website.com/article-clean-url

I can somehow grab that 'article-clean-url' as a value and use it for a
lookup in the database.

I've tried everything and search all over the place.  I can't find the
answer.  Can someone tell me how this is done?  Thanks...

-- 
-Dan Joseph


Re: [PHP] Custom function

2011-02-16 Thread Dan Schaefer
In my code, I set the optional parameter to NULL and check for triple equals === or !== to see 
if the variable has been passed with a value. IMO, this is the safest way.


function MyFunction($x, $y, $z=NULL) {
if ($z !== NULL) {
// Do Something
}
}

Dan Schaefer
Web Developer/Systems Analyst
Performance Administration Corp.


On 2-15-2011 6:32 PM, Ron Piggott wrote:

Is there a way to make an optional flag in a custom function --- 2 parameters 
required, 1 optional?  Ron

The Verse of the Day
“Encouragement from God’s Word”
http://www.TheVerseOfTheDay.info



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Under which distribution(s) is PHP developed, compiled, and tested?

2010-12-15 Thread Dan Schaefer

Background (some of these facts may be well-known, and for that I apologize):
I'm running CentOS 5.5 on all servers, which only supports PHP 5.1.6
CentOS 5.5 is based off RHEL 5.5
Redhat has released RHEL 6 which supports PHP 5.3
CentOS has not released even a beta 6 version yet that supports PHP 5.2+


I was having a discussion with my bosses about what PHP release we are running on our systems. We 
have a few applications and packages that require and/or will work better with PHP 5.2+. I 
understand that no matter what Linux distribution I have, I can always download the source, compile, 
and install manually. My question is, when The PHP Group develops, compiles, and tests PHP for a 
release, what distribution(s) and versions do they use? And of those, which distribution is the most 
commonly used throughout the development team? What Internet references are there, if any, that show 
the major and/or minor Linux distributions that support which version of PHP?


FTR, I couldn't find an answer to these questions by Googling or in the 
php-general archives.

--
Dan Schaefer
Web Developer/Systems Analyst
Performance Administration Corp.


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] My project requires creating office documents on PHP. Any recommendations on what to use?

2010-11-20 Thread Dan


On Nov 20, 2010, at 1:10 AM, chetan ahuja chetanahuj...@gmail.com wrote:

 My project requires creating office documents on PHP. Any recommendations on
 what to use?

When you say office documents do you mean you have to create them using 
Microsoft office? Or just need to replicate current paper documents?

If you need to replicate current paper documents into an electronic version 
that can automatically be filled in by using PHP, I would recommend FPDF.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] time zone ignored (both via ini or in code)

2010-11-02 Thread Dan Yost
On Tue, Nov 2, 2010 at 12:29 AM, Nathan Nobbe quickshif...@gmail.com wrote:
 a few thoughts,
 1. set error_reporting to E_ALL to see if the engine is trying to tell you
 something you may be overlooking


Sorry, failed to mention that I did this, and it says nothing.


 2. for grins, maybe see if the TZ environment variable is set on your system
     var_dump(getenv('TZ'));


I didn't post the phpinfo() output originally but had checked and no,
TZ isn't set.


 3. another test would be to set date.timezone to something else and see if
 date_default_timezone_get() returns that new value, which would indicate
 it's falling through to the third option in the precedence chain.


AHA!

I had tried checking validity by setting a BOGUS time zone (which
showed that it was taking effect), but I had not tried checking by
setting an alternate VALID time zone.

Guess what? It works. If I set it to America/Denver, I get correct output.

Thus, something is corrupt in the timezone DB itself (which I believe
is internal to PHP from what I understand from the threads I've read).

America/Chicago is completely broken but America/Denver works just fine.

Incidentally, I have noticed that CentOS is completely broken in their
tz distro. Every time it updates, it includes a US/Central file that
is completely invalid. This has persisted for months--at the OS level
I've fixed it by copying in a valid US/Central file from another box.
But doing that does not fix PHP (tried that just now)--which again I'd
expect it not to anyway, since I believe PHP (as of PHP5) has an
internal timezone DB. But I tried it just in case.

So now I suppose the thread becomes: how do I get a valid US/Central
(America/Chicago) timezone in PHP5?

Thanks much,
Dan

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] time zone ignored (both via ini or in code)

2010-11-02 Thread Dan Yost
On Tue, Nov 2, 2010 at 9:19 AM, Nathan Nobbe quickshif...@gmail.com wrote:
 On Tue, Nov 2, 2010 at 7:52 AM, Dan Yost yod...@gmail.com wrote:

 So now I suppose the thread becomes: how do I get a valid US/Central
 (America/Chicago) timezone in PHP5?

 give the timezonedb extension a shot
 http://pecl.php.net/package/timezonedb


Tried it, no change. It is still impossible to get simple CENTRAL
timezone output. This is maddening.

Dan

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] time zone ignored (both via ini or in code)

2010-11-02 Thread Dan Yost
On Tue, Nov 2, 2010 at 11:02 AM, Nathan Nobbe quickshif...@gmail.com wrote:
 
  So now I suppose the thread becomes: how do I get a valid US/Central
  (America/Chicago) timezone in PHP5?
 
  give the timezonedb extension a shot
  http://pecl.php.net/package/timezonedb


 Tried it, no change. It is still impossible to get simple CENTRAL
 timezone output. This is maddening.

 That's really weird since I'm sure php has its own timezone db, and it
 sounds like that's where PHP is getting it if you saw the correct output
 after switching date.timezone to America/Denver.  What about trying
 date_default_timezone_set() ?


I had tried that originally too. It does set the timezone correctly,
but then again so does the ini set. So the timezone does get set to
America/Chicago with a date_default_timezone_set(), and then PHP
shanks from there, showing UTC. It seems certain that the timezone
*does* get set to America/Chicago (via multiple methods), and that
America/Chicago *itself* is corrupt in PHP--and that's even with
timezonedb installed. Now everybody knows Chicago is full of
corruption, but at least the clocks aren't, right?

Surely there are bizillions of others out there running this
combination of software in the Central time zone! Yet it's as if
nobody else has corrupt timezone DB records (be they internal or via
timezonedb) except me. And I can't help but notice how CentOS (tzdata
package) is also corrupt, every single time it gets updated, on the
Central zone but no others. Obviously these should be entirely
separate issues, but somebody out there has it out for the Central
time zone. Probably a Yankees fan.

Dan

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] time zone ignored (both via ini or in code)

2010-11-02 Thread Dan Yost
On Tue, Nov 2, 2010 at 11:37 AM, Nathan Nobbe quickshif...@gmail.com wrote:

 dude at this point i dont want to sound too much like a troll, but php 5.1
 is some really old software.  frankly this is why i chose not to run on
 centos during my evaluation of it.  i understand the concept behind running
 proven stable software, but i think centos is taking that notion to the
 extreme.  i would probly try building a more recent version of php from
 source and see if that helps.


That's OK, I knew this was coming. It's been a real struggle to be
deploying something so old, yet CentOS insists on nothing but 5.1 in
the packages unless you resort to some volatile repositories, which
kind of defeats the purpose (in my case, that is). I used to always go
with source directly but was really hoping to go the
somewhat-brainless auto-update route, sticking to yum packages and
all that.

At risk of sending this thread too far down an OS-specific path, can
anybody in the CentOS+PHP world comment on yum packages, 5.1, and this
actual issue?

(In the very beginning I scoured the Net, thinking surely 5.1.6 can't
be the standard on CentOS, but kept running into the either go from
source yourself or use volatile repositories claims, which aren't
good in an enterprise case, though I realize using source isn't bad
from that standpoint).

Dan

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] time zone ignored (both via ini or in code)

2010-11-01 Thread Dan Yost
Greetings,

I've looked through a number of different archived threads (some
rather heated) and samples as well, but clearly I'm just missing
something.

PHP 5.1.6
CentOS release 5.5 (Final)

My server is in Central Time (US). We do observe DST. I noticed
functions like strftime() display UTC time. So I undertook fixing
this.

I read several threads about setting date.timezone in php.ini, and
arguments for/against different timezone methods. But in my case I see
no reason why setting the timezone in php.ini would hurt us--we can
live with that. And yet:

[...@ez2 html 13:47:20]$ date
Mon Nov  1 13:50:05 CDT 2010

Good.

[...@ez2 html 13:50:05]$ grep -i timezone /etc/php.ini
date.timezone = America/Chicago

Good--and yes, Apache was restarted. So far, we're Central, life is good.

Let's hit PHP now:


?
if (date_default_timezone_get()) {
echo 'date_default_timezone_get: ' . date_default_timezone_get() . 'br /';
}

if (ini_get('date.timezone')) {
echo 'date.timezone: ' . ini_get('date.timezone');
}

echo Br;

$localtime = localtime();
$localtime_assoc = localtime(time(), true);
print_r($localtime);
print_r($localtime_assoc);


echo Br . strftime(%D %T %z %Z) . br;

?



Which produces:


date_default_timezone_get: America/Chicago
date.timezone: America/Chicago
Array ( [0] = 14 [1] = 51 [2] = 18 [3] = 1 [4] = 10 [5] = 110
[6] = 1 [7] = 304 [8] = 0 ) Array ( [tm_sec] = 14 [tm_min] = 51
[tm_hour] = 18 [tm_mday] = 1 [tm_mon] = 10 [tm_year] = 110
[tm_wday] = 1 [tm_yday] = 304 [tm_isdst] = 0 )
11/01/10 18:51:14 + UTC


Timezone is America/Chicago, yet date functions completely ignore this
and continue to display UTC.

Please help me understand where I'm blind here.

Thanks,
Dan

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Upload using FTP commands

2010-08-26 Thread Dan McCullough
Take a look here:
http://us.php.net/manual/en/ref.ftp.php

You might have some issues with the memory limit in PHP so that might have
to be boosted for 20MB files.

On Thu, Aug 26, 2010 at 12:24 PM, Matthew Croud m...@obviousdigital.comwrote:


 Hi,

 I want to give my client the ability to upload large files ( around 20MB )
 to a webspace.
 I reckon that using the FTP commands of PHP would be the best bet, but is
 it possible to allow them to do this through an online form.

 This is my vision: the client logs in to a form that has an upload button,
 and the upload button uses the FTP commands to upload the file.

 Is that do-able in PHP ?

 Cheers!







 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Video lessons

2010-07-23 Thread Dan Joseph
On Thu, Jul 22, 2010 at 10:04 AM, Jordan Jovanov jovanovj...@gmail.comwrote:

 Im thing that I'm little layse, Do you somebody know PHP VIDEO LESSONS?


I'm not sure exactly what you're meaning there, but check out www.lynda.com

-- 
-Dan Joseph

http://www.canishosting.com - Unlimited Hosting Plans start @ $3.95/month.
Promo Code NEWTHINGS for 10% off initial order -- Reseller Plans also
available!

http://www.facebook.com/canishosting
http://www.facebook.com/originalpoetry
http://www.facebook.com/teaserleaguehttp://www.facebook.com/apps/application.php?id=135491833139465


[PHP] Image Replication

2010-07-20 Thread Dan Joseph
Hi,

I'm wondering how you all are doing image replication between servers.  I've
got some things in mind, but I'd like to see how others have done it.

We have a PHP application that accepts an image upload, then we want it to
show up on the other 2 web servers.  We have 3 in a load balanced cluster.
Linux servers.

How did you go about it?

-- 
-Dan Joseph

http://www.canishosting.com - Unlimited Hosting Plans start @ $3.95/month.
Promo Code NEWTHINGS for 10% off initial order -- Reseller Plans also
available!

http://www.facebook.com/canishosting
http://www.facebook.com/originalpoetry


Re: [PHP] Dynamic menu

2010-07-19 Thread Dan Joseph
On Sat, Jul 17, 2010 at 5:17 PM, jordan jovanovj...@gmail.com wrote:

 I am new in this group and first whant to say hello to all.
 Need me menu who have different link if user is login or logout, something
 like dynamic menu. Somebody can tall me how can i use and create this 
 menu.http://www.php.net/unsub.php


Well, your basic logic is:

if ( they have a session )
{
   //output the menu
}
else
{
  //output the other menu
}

-- 
-Dan Joseph

http://www.canishosting.com - Unlimited Hosting Plans start @ $3.95/month.
Promo Code NEWTHINGS for 10% off initial order -- Reseller Plans also
available!

http://www.facebook.com/canishosting
http://www.facebook.com/originalpoetry


Re: [PHP] Finding a font.

2010-06-09 Thread Dan Joseph
On Wed, Jun 9, 2010 at 11:14 AM, tedd tedd.sperl...@gmail.com wrote:


 I came in late on this thread, so please forgive me if I don't hit the
 mark.

 Whenever I need to find the name of a font, I use this:

 http://new.myfonts.com/WhatTheFont/


Wow  I just tried this out...  I uploaded an image, it looked at it, and
told me what fonts the letters were using.  Thanks Tedd!

-- 
-Dan Joseph

www.canishosting.com - Unlimited Hosting Plans start @ $3.95/month.  Promo
Code NEWTHINGS for 10% off initial order

http://www.facebook.com/canishosting
http://www.facebook.com/originalpoetry


[PHP] PHP app Server Load

2010-06-08 Thread Dan Joseph
Hi,

This is slightly OT...

We're wrapping up a new PHP/MySQL driven web site built on the Zend
Framework.  We're anticipating a couple hundred thousand members with
several thousand of them coming to the site at once.  I'm trying to figure
out how to determine how many servers we need to support the load.

I've done initial testing on a Xeon 3220 server, but we're looking at an i7
cpu based server now.

Anyone know a good way to estimate load based on actually numbers compared
to benchmark results from intel on a faster server?

-- 
-Dan Joseph

www.canishosting.com - Unlimited Hosting Plans start @ $3.95/month.  Promo
Code NEWTHINGS for 10% off initial order

http://www.facebook.com/canishosting
http://www.facebook.com/originalpoetry


Re: [PHP] PHP app Server Load

2010-06-08 Thread Dan Joseph
On Tue, Jun 8, 2010 at 12:19 PM, Daniel Brown danbr...@php.net wrote:

 On Tue, Jun 8, 2010 at 12:12, Dan Joseph dmjos...@gmail.com wrote:
 
  Anyone know a good way to estimate load based on actually numbers
 compared
  to benchmark results from intel on a faster server?

 Run a DDoS-style (but not legitimate DDoS attack) load-balance
 simulator against your site and see where the bottlenecks lie.  The
 biggest problems are general filesystem writes (including sessions)
 and database queries.

If you have multiple servers from which you can run test scripts,
 do that (preferrably from various networks).  If not, do what you can
 with what you have.  Make sure your testing system simulates the
 traffic in the manner you expect (clicking links before the page fully
 loads, closing the connection and immediately refreshing it, et
 cetera).

Tools of the trade:

top/htop (for general system process watching)
mtop (for MySQL)
mod-top (for PHP process watching)
apachetop (for Apache)

And invaluable things to remember with regard to MySQL:

The 'log-slow-queries' option
The SQL statement: SHOW PROCESSLIST;

 --
 /Daniel P. Brown
 daniel.br...@parasane.net || danbr...@php.net
 http://www.parasane.net/ || http://www.pilotpig.net/
 We now offer SAME-DAY SETUP on a new line of servers!



Thanks, some of those I wasn't aware of.  I've got them setup now and I'm
going to try and test on the server I have again.

As for estimating how things would run on a better server.  There are
benchmarks that score the CPUs.  Let's say one scored 5500, and one scored
1100, is it safe to say the higher one can handle 5x the load?

-- 
-Dan Joseph

www.canishosting.com - Unlimited Hosting Plans start @ $3.95/month.  Promo
Code NEWTHINGS for 10% off initial order

http://www.facebook.com/canishosting
http://www.facebook.com/originalpoetry


Re: [PHP] php accelorator

2010-06-02 Thread Dan Joseph
Cool, thanks for the tips, I am going to check them out.


-- 
-Dan Joseph

www.canishosting.com - Unlimited Hosting Plans start @ $3.95/month.  Promo
Code NEWTHINGS for 10% off initial order

http://www.facebook.com/canishosting
http://www.facebook.com/originalpoetry


Re: [PHP] Another NetBeans Question

2010-06-01 Thread Dan Joseph
On Tue, Jun 1, 2010 at 11:25 AM, tedd t...@sperling.com wrote:

 How do you turn off the automatic insertion of quotes when you're editing?

 For example, when I type div id=content, I end up with div
 id=content. The editor see's me type a quote and then automatically
 inserts another quote.



I can't find where to turn it off either, but I did notice when you type
something like that, when you type in the content in the  , when you type
the last , it overwrites the end quote, so you don't end up with two.
phped works this way too.  Helps me at least.

-- 
-Dan Joseph

www.canishosting.com - Unlimited Hosting Plans start @ $3.95/month.  Promo
Code NEWTHINGS for 10% off initial order

http://www.facebook.com/canishosting
http://www.facebook.com/originalpoetry


[PHP] php accelorator

2010-06-01 Thread Dan Joseph
Hi,

Are any of you using any of the php accelorators such as Zend, Ioncube, or
any others? Any idea which is the best?

-- 
-Dan Joseph

www.canishosting.com - Unlimited Hosting Plans start @ $3.95/month.  Promo
Code NEWTHINGS for 10% off initial order

http://www.facebook.com/canishosting
http://www.facebook.com/originalpoetry


Re: [PHP] “五-连-贯”股|权-激|励-法

2010-05-06 Thread Dan Joseph
2010/5/6 Ashley Sheridan a...@ashleysheridan.co.uk

 [/snip]

 If only I could speak Chinese and was gullible I'd love to take them up
 on the offer for whatever it is.



 I wonder if we're missing out on the billion $ prize...

-- 
-Dan Joseph

www.canishosting.com - Unlimited Hosting Plans start @ $3.95/month.  Promo
Code NEWTHINGS for 10% off initial order

http://www.facebook.com/canishosting
http://www.facebook.com/originalpoetry


Re: [PHP] simplexml choking on apparently valid XML

2010-05-06 Thread Dan Joseph
On Thu, May 6, 2010 at 8:02 PM, Brian Dunning br...@briandunning.comwrote:

 Hey all -

 I'm using simplexml-load-string just to validation a string of XML, and
 libxml-get-errors to return any errors. It's always worked before, but today
 it's choking on this line in the XML:

 client_orderitem_numberBasketball Personalized Notebook -
 Jeffapos;s/client_orderitem_number

 It's returning Premature end of data in tag client_orderitem_number line
 90 but as far as I can tell, Jeffapos;s is properly XML encoded. I can't
 debug this. Any suggestions?

 I have run the XML through a couple of online validators and it does come
 back as valid with no errors found. http://www.php.net/unsub.php


I had this problem  It turned out to be some special characters in the
tags or data that I had to strip out first, then load it thru the simplexml
parser.  I will have to check my code when I get back to the office in the
AM and I'll let you know what it was if you haven't figured it out by then.
But that might get you started in fixing it.

-- 
-Dan Joseph

www.canishosting.com - Unlimited Hosting Plans start @ $3.95/month.  Promo
Code NEWTHINGS for 10% off initial order

http://www.facebook.com/canishosting
http://www.facebook.com/originalpoetry


Re: [PHP] Can't find my error

2010-05-05 Thread Dan Joseph
On Wed, May 5, 2010 at 12:55 PM, David McGlone da...@dmcentral.net wrote:

 26. if(isset($_GET['ProductID']))
 27. $this-mSelectedProduct = (init)$_GET['ProductID'];


You've got (init) instead of (int).  Its always those little characters
causing trouble!

-- 
-Dan Joseph

www.canishosting.com - Unlimited Hosting Plans start @ $3.95/month.  Promo
Code NEWTHINGS for 10% off initial order

http://www.facebook.com/canishosting
http://www.facebook.com/originalpoetry


Re: [PHP] Can't find my error

2010-05-05 Thread Dan Joseph
On Wed, May 5, 2010 at 1:06 PM, David McGlone da...@dmcentral.net wrote:

 On Wednesday 05 May 2010 12:59:07 Dan Joseph wrote:
  On Wed, May 5, 2010 at 12:55 PM, David McGlone da...@dmcentral.net
 wrote:
   26. if(isset($_GET['ProductID']))
   27. $this-mSelectedProduct = (init)$_GET['ProductID'];
 
  You've got (init) instead of (int).  Its always those little characters
  causing trouble!

 Tell me about it. I kept telling myself for the last 4 hours I can find
 it, I
 can find it I don't need to ask the list Huh! I was wrong!





LOL sometimes a second set of eyes is required.  We've all been in your
shoes!

-- 
-Dan Joseph

www.canishosting.com - Unlimited Hosting Plans start @ $3.95/month.  Promo
Code NEWTHINGS for 10% off initial order

http://www.facebook.com/canishosting
http://www.facebook.com/originalpoetry


Re: [PHP] What's your game? (X-PHP)

2010-04-27 Thread Dan Joseph
On Tue, Apr 27, 2010 at 9:24 AM, Programming Guides 
programming.gui...@gmail.com wrote:

 I've played and still play StarCraft: Brood War a lot. StarCraft 2 is now
 available for pre-order and the beta is active. I'm looking forward to it
 but I'm not looking forward to how much time I'll sink into it :)

 --
 Viktor
 http://programming-guides.com



I am amazed at how long Starcraft has lasted, and how popular it still is.
Is the MMORPG version Starcraft 2?  Or is that yet another one?


-- 
-Dan Joseph

www.canishosting.com - Unlimited Hosting Plans start @ $3.95/month.  Promo
Code NEWTHINGS for 10% off initial order

http://www.facebook.com/canishosting
http://www.facebook.com/originalpoetry


Re: [PHP] What's your game? (X-PHP)

2010-04-26 Thread Dan Joseph
On Sun, Apr 25, 2010 at 9:16 AM, tedd t...@sperling.com wrote:

 My gamer tag is special tedd


Hey Tedd, I'm 'jakmo' on Live.  I'll have to give you an add next time I
jump on.

I've been playing Dragon Age and Lost Odyssey.  Both are great.

-- 
-Dan Joseph

www.canishosting.com - Unlimited Hosting Plans start @ $3.95/month.  Promo
Code NEWTHINGS for 10% off initial order

http://www.facebook.com/canishosting
http://www.facebook.com/originalpoetry


Re: [PHP] What's your game? (X-PHP)

2010-04-26 Thread Dan Joseph
On Mon, Apr 26, 2010 at 7:48 AM, Richard Quadling
rquadl...@googlemail.comwrote:

 On 25 April 2010 14:16, tedd t...@sperling.com wrote:
  What's your game?

 My wife and I play enjoy Baulder's Gate on the PS2 and I like the Lego
 (Star Wars, Batman, etc.) games on the PSP.

 The kids like to play Ice Age and Cars but crash a lot and end up
 shouting at each other.

Ice Age was a fine game!  I played that one a few years ago.  I'd like to
see another Diablo styled game come out in the modern setting.

-- 
-Dan Joseph

www.canishosting.com - Unlimited Hosting Plans start @ $3.95/month.  Promo
Code NEWTHINGS for 10% off initial order

http://www.facebook.com/canishosting
http://www.facebook.com/originalpoetry


Re: [PHP] What's your game? (X-PHP)

2010-04-26 Thread Dan Joseph
On Mon, Apr 26, 2010 at 12:36 PM, Ashley Sheridan
a...@ashleysheridan.co.ukwrote:



 Diablo 3 is out soon...


   Thanks,
 Ash
 http://www.ashleysheridan.co.uk



oh cool, I did not realize.. have they set a release date yet?  I didn't see
one on gamestop.com...


-- 
-Dan Joseph

www.canishosting.com - Unlimited Hosting Plans start @ $3.95/month.  Promo
Code NEWTHINGS for 10% off initial order

http://www.facebook.com/canishosting
http://www.facebook.com/originalpoetry


Re: [PHP] What's your game? (X-PHP)

2010-04-26 Thread Dan Joseph
On Mon, Apr 26, 2010 at 12:52 PM, Ashley Sheridan
a...@ashleysheridan.co.ukwrote:

 Not yet, but there's trailers on YouTube and it looks good so far. A few
 more classes, different mobs, it looks good!



The screenshots look great as well.  I am going to check YouTube for
trailers.  Maybe after they get Starcraft going they'll get this out.

-- 
-Dan Joseph

www.canishosting.com - Unlimited Hosting Plans start @ $3.95/month.  Promo
Code NEWTHINGS for 10% off initial order

http://www.facebook.com/canishosting
http://www.facebook.com/originalpoetry


Re: [PHP] Re: replying to list (I give up)

2010-04-23 Thread Dan Joseph
On Fri, Apr 23, 2010 at 1:51 PM, Adam Richardson simples...@gmail.comwrote:

  Contrary to my experiences a few years ago, there is no real loser
 anymore,
 they all are very nice and have their advantages.


Well, I still believe that Linux is the better suitor for a server, but some
companies don't.  So you really just have to adjust to their requirements
and needs.  You're right tho, they all have their advantages.

-- 
-Dan Joseph

www.canishosting.com - Unlimited Hosting Plans start @ $3.95/month.  Promo
Code NEWTHINGS for 10% off initial order

http://www.facebook.com/canishosting
http://www.facebook.com/originalpoetry


Re: [PHP] Re: replying to list (I give up)

2010-04-23 Thread Dan Joseph
On Fri, Apr 23, 2010 at 2:12 PM, Tommy Pham tommy...@gmail.com wrote:

   As a desktop system, it's my personal choice. Both KDE 4 and Gnome 3
  (released in Sept 2010) offer better flashiness than Windows 7 and
  arguably better than the latest Mac OSX too, and the tools are as stable
  as anything I've ever used before.

 Is there an actual WoW client for Linux or you run in Wine like
 environment?


I used Cedega for WoW years ago, but I think it runs under wine just fine.

I personally am using Windows for my desktop these days.  I have needs for
windows, such as Flash development.  Plus my PhpED license is for the
Windows client, so I feel kind of trapped there :)

-- 
-Dan Joseph

www.canishosting.com - Unlimited Hosting Plans start @ $3.95/month.  Promo
Code NEWTHINGS for 10% off initial order

http://www.facebook.com/canishosting
http://www.facebook.com/originalpoetry


Re: [PHP] Re: replying to list (I give up)

2010-04-23 Thread Dan Joseph
On Fri, Apr 23, 2010 at 6:17 PM, Ashley Sheridan
a...@ashleysheridan.co.ukwrote:

 I run it under Wine. Wine has come a long way since my first encounters
 with it a few years back and run a surprising amount of Windows-based
 software. I don't know how far its support for Flash has come, but I do
 remember running a version of Flash under Wine before. It was a bit
 buggy (some dialogues didn't always work) and crashed more than it might
 have normally on Windows, but it was OK at a push to get work done.
 Nowadays I don't really do anything with Flash, as it's a pita to get it
 optimised for search engines, accessibility just isn't up to scratch,
 and it takes a lot longer to build a whole dynamic site with it.



Yah, I'd never use it for a whole web site build either.  Heck, probably
wouldn't even use it for an image carosel.  We were building games with it,
which was really a no brainer to use flash.  I didn't want to get into
Java.

I'll have to try it under wine sometime.  I didn't even think about that.
But then again, my work machine is windows anyway.

-- 
-Dan Joseph

www.canishosting.com - Unlimited Hosting Plans start @ $3.95/month.  Promo
Code NEWTHINGS for 10% off initial order

http://www.facebook.com/canishosting
http://www.facebook.com/originalpoetry


[PHP] Math Question....

2010-04-22 Thread Dan Joseph
Howdy,

This is a math question, but I'm doing the code in PHP, and have expunged
all resources... hoping someone can guide me here.  For some reason, I can't
figure this out.

I want to take a group of items, and divide them into equal groups based on
a max per group.  Example.

1,252,398 -- divide into equal groups with only 30 items per group max.

Can anyone guide me towards an algorithm or formula name to solve this?  PHP
code or Math stuff is fine.  Either way...

Thanks...

-- 
-Dan Joseph

www.canishosting.com - Unlimited Hosting Plans start @ $3.95/month.  Promo
Code NEWTHINGS for 10% off initial order

http://www.facebook.com/canishosting
http://www.facebook.com/originalpoetry


Re: [PHP] Math Question....

2010-04-22 Thread Dan Joseph
On Thu, Apr 22, 2010 at 10:12 AM, Stephen stephe...@rogers.com wrote:

 1,252,398 DIV 30 = 41,746 groups of 30.

 1,252,398 MOD 30 = 18 items in last group

Well, the only problem with going that route, is the one group is not
equally sized to the others.  18 is ok for a group in this instance, but if
it was a remainder of only 1 or 2, there would be an issue.  Which is where
I come to looking for a the right method to break it equally.

-- 
-Dan Joseph

www.canishosting.com - Unlimited Hosting Plans start @ $3.95/month.  Promo
Code NEWTHINGS for 10% off initial order

http://www.facebook.com/canishosting
http://www.facebook.com/originalpoetry


Re: [PHP] Math Question....

2010-04-22 Thread Dan Joseph
On Thu, Apr 22, 2010 at 10:29 AM, Richard Quadling rquadl...@googlemail.com
 wrote:

  
  It sounds like you are looking for factors.
 
 
 http://www.algebra.com/algebra/homework/divisibility/factor-any-number-1.solver
 
  Solution by Find factors of any number
 
  1252398 is NOT a prime number: 1252398 = 2 * 3 * 7 * 29819
  Work Shown
 
  1252398 is divisible by 2: 1252398 = 626199 * 2.
  626199 is divisible by 3: 626199 = 208733 * 3.
  208733 is divisible by 7: 208733 = 29819 * 7.
  29819 is not divisible by anything.
 
  So 29819 by 42 (7*3*2)
 
  would be a route.

 Aha. Missed the 30 bit.

 So, having found the factors, you would need to process them to find
 the largest combination under 30.

 2*3
 2*3*7
 2*7
 3*7

 are the possibilities (ignoring any number over 30).

 Of which 3*7 is the largest.

 So, 1,252,398 divided by 21 = 59,638


 Is that the sort of thing you are looking for?



Yes, that looks exactly what like what I'm looking for.  I'm going to try
and wake up the algebra side of my brain that hasn't been used in years and
see if I can digest all this.

For the 2, 3, and 7, that is based solely on the last number being divisible
by a prime number?

Joao, Jason, thanks for the code.

-- 
-Dan Joseph

www.canishosting.com - Unlimited Hosting Plans start @ $3.95/month.  Promo
Code NEWTHINGS for 10% off initial order

http://www.facebook.com/canishosting
http://www.facebook.com/originalpoetry


Re: [PHP] Math Question....

2010-04-22 Thread Dan Joseph
On Thu, Apr 22, 2010 at 12:16 PM, Richard Quadling rquadl...@googlemail.com
 wrote:

  On 22 April 2010 14:48, Dan Joseph dmjos...@gmail.com wrote:
 This seems to be working ...

 ?php
 function findBestFactors($Value, $GroupSize, array $Factors = null)
{
$Factors = array();
foreach(range(1, ceil(sqrt($Value))) as $Factor)
{
if (0 == ($Value % $Factor))
{
if ($Factor = $GroupSize)
{
$Factors[] = $Factor;
}
if ($Factor != ($OtherFactor = ($Value / $Factor))
  $OtherFactor
 = $GroupSize)
{
$Factors[] = $OtherFactor;
}
}

if ($Factor = $GroupSize)
{
break;
}
}

rsort($Factors);

return reset($Factors);
}

 echo findBestFactors($argv[1], $argv[2], $Factors), PHP_EOL;
 ?


 factors 1252398988 5000

 outputs  ...

 4882

 and 21 for your value 1252398



Wow!  thanks...  I just plopped it into phped and fired off some tests, and
I agree, seems to work fine.  I appreciate your help today.  I am still
looking over the algebra stuff, and am now comparing it to your code.  This
will get me moving forward better in my project.  Thank you!

-- 
-Dan Joseph

www.canishosting.com - Unlimited Hosting Plans start @ $3.95/month.  Promo
Code NEWTHINGS for 10% off initial order

http://www.facebook.com/canishosting
http://www.facebook.com/originalpoetry


Re: [PHP] replying to list (I give up)

2010-04-21 Thread Dan Joseph
On Wed, Apr 21, 2010 at 9:33 AM, David McGlone da...@dmcentral.net wrote:

 I'm not passing judgment, It just saddens me that I have to send
 multiple messages and this isn't because of anyone, it's because of my
 lack of knowledge on how to reply to lists that are set up in this way.
 But I think the reply to list like ash suggested solves the multiples
 problem.

 And on a positive note, If I wouldn't have brought this discussion up, I
 would have never known. Pretty sure I do now.




Every couple years this discussion comes up.  Cracks me up every time.

When you hit reply all, just take out all the other addresses and leave the
list one in there.  The list was setup like this years ago on purpose, and
they've stated in the past they don't want to change it..

-- 
-Dan Joseph

www.canishosting.com - Unlimited Hosting Plans start @ $3.95/month.  Promo
Code NEWTHINGS for 10% off initial order

http://www.facebook.com/canishosting
http://www.facebook.com/originalpoetry


Re: [PHP] Re: Re: replying to list (I give up)[SOLVED TO A DEGREE]

2010-04-21 Thread Dan Joseph
My goodness, are you people still going on about all this?  LOL... let it
go... it is what it is.

-- 
-Dan Joseph

www.canishosting.com - Unlimited Hosting Plans start @ $3.95/month.  Promo
Code NEWTHINGS for 10% off initial order

http://www.facebook.com/canishosting
http://www.facebook.com/originalpoetry


Re: [PHP] Hello everybody - php newbie from switzerland

2010-04-21 Thread Dan Joseph
On Wed, Apr 21, 2010 at 6:21 PM, Brandon Rampersad brandon.add...@gmail.com
 wrote:

 What's wrong with asking if PHP supports threading?


Nothing?  PHP itself does not.  You can check out fork though.  I've never
personally used it with PHP, but I did for a Perl project years ago.  I
guess it worked ok.

http://us3.php.net/manual/en/function.pcntl-fork.php

-- 
-Dan Joseph

www.canishosting.com - Unlimited Hosting Plans start @ $3.95/month.  Promo
Code NEWTHINGS for 10% off initial order

http://www.facebook.com/canishosting
http://www.facebook.com/originalpoetry


Re: [PHP] Hello everybody - php newbie from switzerland

2010-04-21 Thread Dan Joseph
On Wed, Apr 21, 2010 at 8:09 PM, David McGlone da...@dmcentral.net wrote:

 On Wed, 2010-04-21 at 18:21 -0400, Brandon Rampersad wrote:
  What's wrong with asking if PHP supports threading?

 Nothing really, I was just kidding.



 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php


lol..  I didn't see your email where you said not to ask

-- 
-Dan Joseph

www.canishosting.com - Unlimited Hosting Plans start @ $3.95/month.  Promo
Code NEWTHINGS for 10% off initial order

http://www.facebook.com/canishosting
http://www.facebook.com/originalpoetry


Re: [PHP] Hello everybody - php newbie from switzerland

2010-04-21 Thread Dan Joseph
On Wed, Apr 21, 2010 at 8:38 PM, David McGlone da...@dmcentral.net wrote:


 Are we gonna have to have a discussion on the use of threading? LOL



We just might.  Personally, I use it to sow holes in the toe of my socks.

-- 
-Dan Joseph

www.canishosting.com - Unlimited Hosting Plans start @ $3.95/month.  Promo
Code NEWTHINGS for 10% off initial order

http://www.facebook.com/canishosting
http://www.facebook.com/originalpoetry


Re: [PHP] Date Math

2010-04-20 Thread Dan Joseph
On Tue, Apr 20, 2010 at 11:40 AM, Floyd Resler fres...@adex-intl.comwrote:

 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.


check out:
http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html

-- 
-Dan Joseph

www.canishosting.com - Unlimited Hosting Plans start @ $3.95/month.  Promo
Code NEWTHINGS for 10% off initial order

http://www.facebook.com/canishosting
http://www.facebook.com/originalpoetry


Re: [PHP] Excel Report Formatting

2010-04-20 Thread Dan Joseph
Its good to see we're all playing nice today!

-- 
-Dan Joseph

www.canishosting.com - Unlimited Hosting Plans start @ $3.95/month.  Promo
Code NEWTHINGS for 10% off initial order

http://www.facebook.com/canishosting
http://www.facebook.com/originalpoetry


Re: [PHP] Hello everybody - php newbie from switzerland

2010-04-20 Thread Dan Joseph
On Tue, Apr 20, 2010 at 6:08 PM, Nick Balestra n...@beyounic.com wrote:

 I am NIck, from Locarno (southern switzerland) i am getting into php
 development for my own start-up company, maybe there are other people near
 me that would be nice to know for networking and alike. I will post here all
 my questions if i don't find any answer already on this list.


Hi Nick,

Welcome to the community!

-- 
-Dan Joseph

www.canishosting.com - Unlimited Hosting Plans start @ $3.95/month.  Promo
Code NEWTHINGS for 10% off initial order

http://www.facebook.com/canishosting
http://www.facebook.com/originalpoetry


Re: [PHP] Saving form data into session before leaving a page

2010-04-13 Thread Dan Joseph
On Tue, Apr 13, 2010 at 12:19 PM, tedd tedd.sperl...@gmail.com wrote:

 So, OP explain what you are trying to do?

 Cheers,

 tedd


Sorta looks to me like he's in a situation where users are fleeing the form,
and wondering why its not filled in when they go back.  The natural reaction
for this would be to call it abnormal, and tell them to learn how to use a
web page, but we all know how the real world is.

I like the original ideas from Peter and Ashley.  Store a session or cookie,
use ajax to periodically update a database table with the information, then
re-populate it if/when they come back.

I kinda like that word Paradigm.  Rolls off the tongue nicely.  I'm going to
use it 3 times today before I leave the office.

-- 
-Dan Joseph

www.canishosting.com - Unlimited Hosting Plans start @ $3.95/month.  Promo
Code NEWTHINGS for 10% off initial order

http://www.facebook.com/canishosting
http://www.facebook.com/originalpoetry


Re: [PHP] Saving form data into session before leaving a page

2010-04-13 Thread Dan Joseph
On Tue, Apr 13, 2010 at 12:40 PM, Robert Cummings rob...@interjinn.comwrote

 I had a pair-a-dimes one time. Unfortunately I was a nickel short of a
 quarter to put in the slot.

 But the question is... were they outside the box?

-- 
-Dan Joseph

www.canishosting.com - Unlimited Hosting Plans start @ $3.95/month.  Promo
Code NEWTHINGS for 10% off initial order

http://www.facebook.com/canishosting
http://www.facebook.com/originalpoetry


Re: [PHP] Saving form data into session before leaving a page

2010-04-13 Thread Dan Joseph
On Tue, Apr 13, 2010 at 12:48 PM, Kevin Kinsey k...@daleco.biz wrote:

 Nah, the question is, since the slot was intended to accept a quarter,
 why the heck didn't it take two dimes and a nickel ... or just two dimes,
 and throw a nickel in gratis?

 I must be getting old.  We have toilets that flush themselves now.
 WTF happened to grown up being equal to taking responsibility
 for things?


I think you've found the answer to the great question of why people don't
take responsibility anymore...  it all started with the toilet!

-- 
-Dan Joseph

www.canishosting.com - Unlimited Hosting Plans start @ $3.95/month.  Promo
Code NEWTHINGS for 10% off initial order

http://www.facebook.com/canishosting
http://www.facebook.com/originalpoetry


Re: [PHP] Saving form data into session before leaving a page

2010-04-13 Thread Dan Joseph
On Tue, Apr 13, 2010 at 1:46 PM, Robert Cummings rob...@interjinn.comwrote:


 Toilets flush themselves so that we don't need to touch what someone else
 touched... very likely after *cough* wiping up.



They have a cure for having to life a finger and wipe also  but I won't
continue lol

-- 
-Dan Joseph

www.canishosting.com - Unlimited Hosting Plans start @ $3.95/month.  Promo
Code NEWTHINGS for 10% off initial order

http://www.facebook.com/canishosting
http://www.facebook.com/originalpoetry


Re: [PHP] another useless message.

2010-04-09 Thread Dan Joseph
On Fri, Apr 9, 2010 at 6:28 AM, Peter Lind peter.e.l...@gmail.com wrote:

 That said, there can be little doubt that the response you got went a
 tad too far - some netiquette lessons would be useful, I think.



In defense of the people that react harshly, there has been a lot of people
who just spam the list over the years.  Its a natural reaction.

You may want to put that kind of thing in your signature also.  Rather than
making announcements that bother people, when you participate, your message
will go out.  Although, don't make it 100 lines long...

-- 
-Dan Joseph

www.canishosting.com - Unlimited Hosting Plans start @ $3.95/month.  Promo
Code NEWTHINGS for 10% off initial order

http://www.facebook.com/canishosting
http://www.facebook.com/originalpoetry


[PHP] Zend DB Table - WHERE as OR?

2010-04-09 Thread Dan Joseph
Hi Everyone,

I'm trying to figure out if something is even an option with the Zend
Framework.  We use the DB Table stuff.  I don't see it in the manual, so I
figured I'd ask you all...

I have:

$select = $table-select()-where( home_team_id = ?, $home_team_id )
  -where( away_team_id = ?, $away_team_id
);

This translates the where's to home_team_id = 12 AND away_team_id = 15...

What I'd like to have is home_team_id = 12 OR away_team_id = 15.

Is this possible?  Or would I just need to build them all into a single
where() manually?

-- 
-Dan Joseph

www.canishosting.com - Unlimited Hosting Plans start @ $3.95/month.  Promo
Code NEWTHINGS for 10% off initial order

http://www.facebook.com/canishosting
http://www.facebook.com/originalpoetry


Re: [PHP] Zend DB Table - WHERE as OR?

2010-04-09 Thread Dan Joseph
On Fri, Apr 9, 2010 at 3:25 PM, Andrew Ballard aball...@gmail.com wrote:

 Try this:

 ?php
 $select = $table-select()-where( home_team_id = ?, $home_team_id )
 -orWhere( away_team_id = ?,
 $away_team_id );


Perfect...thank you!

-- 
-Dan Joseph

www.canishosting.com - Unlimited Hosting Plans start @ $3.95/month.  Promo
Code NEWTHINGS for 10% off initial order

http://www.facebook.com/canishosting
http://www.facebook.com/originalpoetry


Re: [PHP] Little php code - error

2010-04-08 Thread Dan Joseph
On Thu, Apr 8, 2010 at 10:21 AM, Juan j...@rodriguezmonti.com.ar wrote:

 Hi guys,
 I'm having trouble with the following little php code [0]. The output
 from the server is : 
 * Parse error: syntax error, unexpected '{' in file.php on line 27 *

 Let's assume that file.php is the file that is giving me some troubles.

 The structure is pretty easy to understand, however I'm not able to
 solve this. Could you tell me why I'm not able to run this code.

 I'm running PHP5, Apache2, and Ubuntu 9.10 with sqlite, as you could see.



Its your if's, elseif's, else's.  You have and, change that to .

-- 
-Dan Joseph

www.canishosting.com - Unlimited Hosting Plans start @ $3.95/month.  Promo
Code NEWTHINGS for 10% off initial order

http://www.facebook.com/canishosting
http://www.facebook.com/originalpoetry


Re: [PHP] Little php code - error

2010-04-08 Thread Dan Joseph
On Thu, Apr 8, 2010 at 10:21 AM, Juan j...@rodriguezmonti.com.ar wrote:

 Hi guys,
 I'm having trouble with the following little php code [0]. The output
 from the server is : 
 * Parse error: syntax error, unexpected '{' in file.php on line 27 *


Sorry, I gave you bad information...

Its the else line.  else doesn't take a condition after it.  it should just
be else {.

-- 
-Dan Joseph

www.canishosting.com - Unlimited Hosting Plans start @ $3.95/month.  Promo
Code NEWTHINGS for 10% off initial order

http://www.facebook.com/canishosting
http://www.facebook.com/originalpoetry


Re: [PHP] contant /

2010-04-08 Thread Dan Joseph
On Thu, Apr 8, 2010 at 12:26 PM, Jack jacklistm...@gmail.com wrote:

 I get a couple of errors like this one for undefined variable:

 PHP Notice:  Undefined variable: s_company_name

 And this one for undefined contstant

 PHP Notice:  Use of undefined constant account_type - assumed
 'account_type'


f_put_cookie($auth[user_name],$auth[user_email],$auth[account_type],$auth[co
mpany_name]);

That's your culprit.  You'll need quotes around those.  $auth[username],
user_email, account_type, company_name

Otherwise, it thinks they are constants that haven't been defined:
php.net/define

-- 
-Dan Joseph

www.canishosting.com - Unlimited Hosting Plans start @ $3.95/month.  Promo
Code NEWTHINGS for 10% off initial order

http://www.facebook.com/canishosting
http://www.facebook.com/originalpoetry


Re: [PHP] stat(), NFS shares and local files timeout

2010-04-07 Thread Dan Joseph
On Wed, Apr 7, 2010 at 10:27 AM, Igor Feghali igor.fegh...@gmail.comwrote:

 I am running with an issue with remote filesystems (mounted via NFS)
 and PHP's stat() / filemtime().

 Sometimes when the remote filesystem (NFS share) is busy, my PHP
 daemon just hangs forever on a filemtime() call to a file inside this
 FS. I failed to find a proper way of setting a timeout for that kind
 of operation. Everything I can think of is related to remote files
 (URLs) and/or content operations (read/write). Streams for example,
 don't even have any options for local files and
 default_socket_timeout directive is applicable only for sockets.

 I could fork my daemon just to do a stat() call and control the
 running time (timeout) inside the parent process, but I usually stat
 60 files / second, so that would be a lot of forking. I prefer to go
 another way. anyone has a clue ?

What if you simply set the script to time out?  Is it ignoring that too?
set_time_limit( seconds )

-- 
-Dan Joseph

www.canishosting.com - Unlimited Hosting Plans start @ $3.95/month.  Promo
Code NEWTHINGS for 10% off initial order

http://www.facebook.com/canishosting
http://www.facebook.com/originalpoetry


Re: [PHP] SimpleXMLElement occasionally fails to parse gb2312 or big5 feeds

2010-04-06 Thread Dan Joseph
On Fri, Apr 2, 2010 at 10:28 AM, Peter Pei peterpei...@hotmail.com wrote:


 I use the following code to get rss and parse it, but the code occasionally
 have issues with gb2312 or big-5 encoded feeds, and fails to parse them.
 However other times may appear just okay. Any thoughts? Maybe
 SimpleXMLElement is simply not meant for other language encodings...

$page = file_get_contents($rss);
try {
$feed = new SimpleXMLElement($page);



I've been learning a bit about SimpleXML today myself.  It seems that it
misses a lot of things when it comes to complex, or abnormal XML.  Abnormal
being what you're describing and whatnot.  I don't really have a solid
answer for you (Just noticed no one  responded), but I think you're running
into what I was...  Its just built to be Simple, not expand its mind.

Hope that helps!

-- 
-Dan Joseph

www.canishosting.com - Unlimited Hosting Plans start @ $3.95/month.  Promo
Code NEWTHINGS for 10% off initial order

http://www.facebook.com/canishosting
http://www.facebook.com/originalpoetry


Re: [PHP] blog design issue...

2010-03-20 Thread Dan McCullough
Table is the way to go for all the reasons that Rob mentioned.


  This is going to be a small blog to start, but I guess I should always  be
 looking at performance, security,  maintainability right?



Good way to start is start small and build a strong base around a good
database, good performance practices and tight security you can then build
the cool features as you see fit.

Good thing about performance and security is that there are a ton of site
that outline best practices which means you wont have to re-invent the
wheel.

GL


[PHP] PHP to answer HEAD requests

2009-12-18 Thread Dan Field
Is it possible to use PHP to answer HEAD http requests? Is it as  
simple as doing something like:


header('blah')
exit;

I'd expect PHP to produce a full page rather than just a header though.

--
Dan Field d...@llgc.org.uk   Ffôn/Tel. +44 1970 632 582
Peiriannydd Meddalwedd  Senior Software Engineer
Llyfrgell Genedlaethol Cymru   National Library of Wales






Re: [PHP] Change styling depending on var value

2009-11-20 Thread Dan McCullough
To add to what Ashley said about $row[3],  remember that when you are
returning from the db the counter for fields will start at 0 not 1, so if
its the 3rd field that will be $row[2].  You might also want to do switch
rather then elseif but thats always a good debate.

On Fri, Nov 20, 2009 at 3:16 PM, Ashley Sheridan
a...@ashleysheridan.co.ukwrote:

 On Fri, 2009-11-20 at 15:11 -0500, Phil Matt wrote:

  Ashley Sheridan wrote:
 
   Well, you're main problem here is that you are only using a single =
   character. What that is saying to PHP is: if you let me assign the
   value of $beverage to $row[3] then do this next bit, but what I think
   you wanted it to say was if $row[3] is the same as $beverage then do
   this next bit, which would need == instead of =
  
 
  Thanks, Ashley. I don't do enough PHP to get used to the syntax.
 
  I changed the operators to ==, but my conditional apparently isn't
  working correctly. I checked to make sure the values in the cells were
  the strings as I've specified them, but the resultant formatting always
  defaults to the ELSE color.
 
  Must be something very simple, but I'm just not getting it.
 
  Cheers --- Phil


 Don't forget to reply to all!

 Just a quick question, what do you get if you do:

 print $row[3];

 Does it contain a string like you expect?

 Thanks,
 Ash
 http://www.ashleysheridan.co.uk





[PHP] sessions and email

2009-11-12 Thread Dan Shirah
All,

I am using sessions for my application to verify a user has logged in:

// Verify the user is logged in.
if (!isset($_SESSION['basic_is_logged_in'])
|| $_SESSION['basic_is_logged_in'] !== true) {
// If not logged in, redirect to the login page.
header('Location: login.php');
exit;
}

If anyone tries to go to any page in the application via the address bar,
they are correctly redirected to the login page.

However, if someone that is currently logged into the application using I.E.
goes to File - Send - Page by Email, the person they email the link to can
open it and use the application without logging in and the address bar uses
a local path like: C:\Documents and Settings\my_name\Local
Settings\Temporary Internet Files\OLK18\My Page (2).htm

How can I prevent the emailed pages from being able to access the
application if it is a local path or the user hasn't logged in?


Re: [PHP] What PHP version are you using?

2009-10-29 Thread Dan McCullough
Like Israel it depends on the client I am doing several projects for a
client now that the hosting company is still using 4.0.6 - and its been a
headache.  Most of the personal projects and many of my other clients are on
5.1 or higher.

On Thu, Oct 29, 2009 at 12:22 PM, Tom Barrett t...@miramedia.co.uk wrote:

 2009/10/29 Israel Ekpo israele...@gmail.com

  Hi Guys,
 
  I just want to conduct a quick survey to find out what version of PHP
  people
  are using in their production environments.
 
  I have a PHP extension for Solr that I have set the minimum required
  version
  as 5.2.11.
 
 [snip]

  I cannot go below 5.2.0 though but I am thinking about starting at 5.2.4
  and
  newer.
 
  I would really appreciate some feedback as it will be useful in helping
 me
  determine which PHP version numbers to do my regression tests against.
 

  cat /etc/redhat-release
 Red Hat Enterprise Linux Server release 5.3 (Tikanga)

  php -v
 PHP 5.1.6 (cli) (built: Feb 26 2009 07:01:12)
 Copyright (c) 1997-2006 The PHP Group
 Zend Engine v2.1.0, Copyright (c) 1998-2006 Zend Technologies

  yum list php
 Loaded plugins: downloadonly, rhnplugin, security
 Excluding Packages in global exclude list
 Finished
 Installed Packages
 php.x86_64
 5.1.6-23.2.el5_3
 installed

 I wouldn't have thought this to be too uncommon.

 HTH



Re: [PHP] Web Service Server in PHP

2009-10-21 Thread Dan McCullough
I believe NuSoap is still available
source: http://sourceforge.net/projects/nusoap/
http://greghuet.blogspot.com/2007/12/soap-php5-and-nusoapphp.html

You can also look here at PHPs SOAP functions
http://php.net/manual/en/refs.webservice.php

On Wed, Oct 21, 2009 at 9:26 PM, Daniel Echalar dany...@gmail.com wrote:

 Hi,

 Does anybody knows a web services server based on PHP?

 The only one a see is Nusoap, but even for this one i can't find the
 webpage
 to see the documentation.

 by the way, i'm trying to develop an application using web services in PHP,
 any start point suggestion will be appreciated.

 thanks for the anwers!



[PHP] NULLS vs Empty result in PHP

2009-09-23 Thread Dan Shirah
Morning!

Just a quick question.

Say I have a column in my database that could contain NULLS, empty spaces,
or an actual value.

If I do:

$my_query = SELECT my_column FROM my_database WHERE 1 = 1;
$my_result = ifx_query($my_query, $connect_id);

while($row = ifx_fetch_row($my_result)) {
  $my_column = trim($row['my_column']);

  if ($my_column != ) {
   echo Test;
  }
}

The way PHP assigns the query results to the $my_column variable, wouldn't;
if ($my_column != )  not do anything for the rows that contained NULLS or
empty spaces?


Re: [PHP] Re: NULLS vs Empty result in PHP

2009-09-23 Thread Dan Shirah

 using empty() is ´the right way to check a var for NULL or 

 however, it also depends what MySQL has got as setuo definition for empty
 fields. on textfields u can define an epmty string as default.

 So say these are the first three results of my query:

some text //The column actually has data
   //The column contains a series of spaces
NULL   //The column contains a NULL value

As long as I trim() the result, if (!empty()) would skip any results where
the column containsOR NULL, correct?


Re: [PHP] Date +30 comparison

2009-09-01 Thread Dan Shirah

 I'm really struggling with dates in PHP. (Yes, I tried reading the
 manual)...

 Can someone provide code that does this:

 Takes current date, assigns it to a variable (let's say $today)
 Then adds 30 days to $today variable
 Takes a string ($nexteval) like '8/26/2009' and compare it to $today.

 The variable $nexteval must be greater than $today (which is today + 30
 days) or a message is echoed.

 I'm finding this difficult to do, but I'm coming from an ASP background.

 Any help appreciated.

David,

Look up date() and mktime() in the manual.

To get today's date is easy: date('m/d/Y');

But when wanting to add days/months/years to a date, you need to use
mktime()

mktime() breaks apart a date into hours/minutes/seconds/months/days/years.

Therefore I always break up my date into these types fo sections.

$month = date('m');
$day = date('d');
$year = date('Y');

Now that I have them seperated I create a variable $future_date and assign
it the value I want. In your case, 30 days in the future.

$future_date = mktime(0,0,0,date($month),date($day)+30,date($year));

Now I put it back into a date format.

$future_date = date('m/d/Y',$future_date);

echo $future_date;

Today is September 1st and the value of $future_date is October 1st because
there are 30 days in Spetember.

Now you can compare your dates.

if ($nexteval  $future_date) {
  echo This date has already passed;
} else {
  *do some processing*
}

Hope that helps.

Dan


[PHP] File Open Prompt?

2009-08-28 Thread Dan Shirah
Greetings,

I'm having a problem trying to get a file download prompt.

Basically I have a page with image links.

When the link is clicked, the user is directed to another page I have. That
page finds the image path based on the image ID from the previous page.

Once the image path is found I copy the image to the local webserver and
rename the proprietary extension, .0D9 to .tif

Once the file is renamed to .tif I want the download prompt to come up.  You
know, where it says, Open Save Cancel.

I've tried using:

$fp = fopen($new_file,r) ;
header(Content-Type: image/tif);
while (! feof($fp)) {
   $buff = fread($fp,filesize($new_file));
   print $buff;
   }

But that just gives me heiroglyphics on the screen instead of prompting the
user to download.

Here is my code that copies and renames the file:

if ($page !=  || $page !=  ) {
 exec(xcopy .$page. .$topage.);
}
$orig_file = $topage.\\.$objectid..0D9;
//echo $orig_file;
$new_file = $topage.\\.$objectid..tif;
//echo $new_file;

rename($orig_file,$new_file);

Any ideas on how to make the browser give the download prompt for $new_file?

Thanks,
Dan


Re: [PHP] File Open Prompt?

2009-08-28 Thread Dan Shirah

 You will need to add some headers to the page to popup the prompt, at least
 with
 these.

 $filename = 'somefile.tif';
 $filesize = filesize($filename);

 header('Content-Type: application/force-download');
 header('Content-disposition: attachement; filename=' . $filename);
 header('Content-length: ' . $filesize);

 Eric



I don't know what I'm doing wrong.  I've tried:

header('Content-Description: File Transfer');
header('Content-Type: application/force-download');
header('Content-Length: ' . filesize($filename));
header('Content-Disposition: attachment; filename=' . basename($file));
readfile($file);
AND

if (file_exists($new_file)) {
header('Content-Description: File Transfer');
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename='.basename($new_file
));
header('Content-Transfer-Encoding: binary');
header('Expires: 0');
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Pragma: public');
header('Content-Length: ' . filesize($new_file));
ob_clean();
flush();
readfile($new_file);
exit;
}

But everything I do just sends heiroglyphics to the screen instead of giving
the download box.


Re: [PHP] Freeing Memory

2009-07-31 Thread Dan Shirah

 How does that work considering that mysql_query() only
 returns true or false on INSERT? I'd expect the script
 to fail on $result not being a valid resource.


I don't know about mysql as I work with MSSQL Server and Informix, but for
me it works like this:

   $insert = ifx_prepare(INSERT INTO my_table
  VALUES ('0'), $connect_id);
   ifx_do($insert) or die (Query failed);
   ifx_free_result($insert);

By using PREPARE and DO to execute the queries it allows ifx_free_result to
release those resources.


Re: [PHP] Freeing Memory

2009-07-30 Thread Dan Shirah

 How  would you go about ensuring the memory is not exhausted when running a
 script ?

 I have a script, which to make it basic ... reads values from files, I
 create an array of values per file then with a foreach insert values into a
 table, I have added a line to echo the memory use after each array is done
 (after insert is done and the foreach is complete for the file) with: -
 echo Mem SQL: .memory_get_usage() . \n;

 It gave me this result below:

 Mem SQL: 8341312
 Mem SQL: 8461856
 Mem SQL: 8693440
 Mem SQL: 9327008
 Mem SQL: 9798952
 Mem SQL: 10238392
 Mem SQL: 10604776

 As can be seen the mem usage simply grows,

 I have added a line after each iteration of the foreach is complete to
 unset
 the vars and array ... thinking this would basically clear up the allocated
 memmory used by the array ... and it would start at 0 again for the next
 array looped, but obviously this is not quite the answer.

 The question is then how do you clear  memmory then ?


I don't know what version of SQL you are using, but I have found that using:

mysql_free_result($result);
mssql_free_result($result);
ifx_free_result($result);

Helped my queries run much faster and use less resources. I had something
similar to your script where I would read lines from a huge file and then
insert the contents into my database.  Before adding the above the process
would take 20-30 minutes.  After freeing the results after each insert my
script completed in about 5-8 minutes.

Just add that within your foreach loop after you execute your query that
inserts the info.

Hope that helps.

Dan


Re: [PHP] Search Query on two tables not working

2009-07-21 Thread Dan Shirah

 Why isn't this working for searching?

   // Run query on submitted values. Store results in $SESSION and redirect
 to restaurants.php$sql = SELECT name, address, inDate, inType,
 notes, critical, cviolations, noncritical FROM restaurants, inspections
 WHERE restaurants.name  '' AND restaurant.ID = inspection.ID;if
 ($searchName){ $sql .= AND restaurants.name LIKE '%.
 mysql_real_escape_string($name) .%' ;if(count($name2) == 1){
  $sql .= AND restaurants.name LIKE '%.
 mysql_real_escape_string($name2[1]) .%' ;}else{
  foreach($name2 as $namePart){$sql .= AND
 restaurants.name LIKE '%. mysql_real_escape_string($namePart) .%' ;
}}}if ($searchAddress) {$sql .= AND
 restaurants.address LIKE '%. mysql_real_escape_string($address) .%' ;
  }   $sql .= ORDER BY restaurants.name;;
  $result = mysql_query($sql);

I'm not sure about MySQL, but in Informix my queries will crash when trying
to just append the ORDER BY clause by itself.

$sql .= ORDER BY restaurants.name;;

Also, you have a semi colon before and after the ending quote.

TRY

$sql .= AND 1 = 1
ORDER BY restaurants.name;


Re: [PHP] Search Query on two tables not working

2009-07-21 Thread Dan Shirah
On Tue, Jul 21, 2009 at 12:41 PM, Miller, Terion 
tmil...@springfi.gannett.com wrote:

 Turned off the redirects on the whole script and tried to the the query to
 echo and these are the errors I got:

 Notice: Undefined offset: 1 in /var/www/vhosts/
 getpublished.news-leader.com/httpdocs/ResturantInspections/processRestaurantSearch.phpon
  line 89

 Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result
 resource in /var/www/vhosts/
 getpublished.news-leader.com/httpdocs/ResturantInspections/processRestaurantSearch.phpon
  line 119


 On 7/21/09 11:32 AM, Kevin Smith ke...@netsmith.ltd.uk wrote:

 Can you supply the actual generated SQL, I can potentially see a
 problem, but need to see the final SQL statement.

 print_r($sql);


[PHP] dictionary/spell check...

2009-07-16 Thread Dan Joseph
Hi Everyone,

This is slightly off topic...  We're building an application, and have a
need for an opensource dictionary.  Basically a way to match words against a
dictionary to see if they are valid, and what type of word they are. noun,
adv, etc..

Can anyone point me in the right direction?  Yes.. I did google already...

-- 
-Dan Joseph

www.canishosting.com - Plans start @ $1.99/month.


Re: [PHP] dictionary/spell check...

2009-07-16 Thread Dan Joseph
On Thu, Jul 16, 2009 at 3:51 PM, Robert Cummings rob...@interjinn.comwrote:

 Aspell.

 Can anyone point me in the right direction?  Yes.. I did google already...



Thanks!

-- 
-Dan Joseph

www.canishosting.com - Plans start @ $1.99/month.


Re: [PHP] Alphabetical pagination

2009-07-14 Thread Dan Shirah

 I am trying to make a page that displays a-z like a b c d e etc as links
 then when you click open one it reloads itself and shows only the query
 results that go with that letter...i'm not getting itI get a page that
 says ARRAY over and over...

 What I have so far:
 ?php

 if(!isset($_SESSION['RestaurantList']))

 {
  // List not grabbed yet, so run
 query and store in $_SESSION

$sql = SELECT
 DISTINCT name FROM restaurants  GROUP BY name DESC;

 $result = mysql_query($sql) or die(mysql_error()) ;

 $count = mysql_num_rows($result);

 echo $count;


 while($row = mysql_fetch_array($result)) {



 $name=array($row['name'],0,1);

 //$name = array('name');

echo a
 href=\page.php?name= .$name. \ $name/a\n;

 }


}



 $alphabet = range('A', 'Z');

 foreach ($alphabet as $letter) {

 echo 'a href=' . $_SERVER['PHP_SELF']

 . '?letter=' . $letter . '' . $letter . '/a';

 }






 ?


Well, are you opposed to using Javascript?

//javascript function
script language=JavaScript
!--
function searchLetter(letter) {
document.my_form.letter.value=letter;
document.my_form.submit();
}
//--
/script

//You could make a hidden form field to store the value of the letter
selected.
form name=my_form method=POST action=?php echo $_SERVER['PHP_SELF'];
?
input type=hidden name=letter value=?php echo $_POST['letter']; ?
/form

//Perform your query and search only for the letter if it isn't blank.
?php
$selected_letter = $_POST['letter'];
if ($select_letter != ) {
$sql = SELECT DISTINCT name FROM restaurants WHERE name LIKE
'$letter%' GROUP BY name DESC;
}
?
//Print out all your letters
?php
$alphabet = range('A', 'Z');

foreach ($alphabet as $letter) {
?
//Have the links call a javascript function that updates the letter selected
and resubmits the form to perform your new query
a href=javascript:searchLetter('?php echo $letter; ?')$letter/a
?php
}
?

Something like that. I haven't tested any of that code just typed it up real
quick to give you an idea of one way to possibly do it.

Hope that helps.

Dan


  1   2   3   4   5   6   7   8   9   10   >