Re: [PHP] If date is greater than

2013-10-20 Thread Tedd Sperling

On Oct 20, 2013, at 4:01 AM, Ashley Sheridan a...@ashleysheridan.co.uk wrote:

 Yes, I was going to ask, why are you storing your dates as strings?
 MySQL has a perfectly good DATE type. It's also generally faster
 comparing dates within a MySQL query than PHP code.
 
 Thanks,
 Ash
 http://www.ashleysheridan.co.uk

Agreed.

Plus, there are many date functions provided by MySQL that are easier 
(possibility faster) than what you can do in PHP.

Check these out:

http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html#function_date

tedd

___
tedd sperling
tedd.sperl...@gmail.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] https question

2013-09-25 Thread Tedd Sperling
Hi gang:

I have a client who had his entire site moved to another host -- no big problem.

However, the old site had a https directory, where I had secure scripts to do 
credit-card transactions, but the new site doesn't have a https directory -- in 
fact it doesn't even have a http directory at all. So, what options do I have 
to do secure transactions?

I remember someone saying that this could be done via a .htaccess file, but I 
don't have the code, nor am I positive this is the answer.

What do you recommend?

Thanks,

tedd
___
tedd sperling
t...@sperling.com






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



Re: [PHP] https question

2013-09-25 Thread Tedd Sperling
On Sep 25, 2013, at 1:58 PM, Joshua Kehn josh.k...@gmail.com wrote:

 On Sep 25, 2013, at 1:55 PM, Tedd Sperling t...@sperling.com wrote:
 
 Hi gang:
 
 I have a client who had his entire site moved to another host -- no big 
 problem.
 
 However, the old site had a https directory, where I had secure scripts to 
 do credit-card transactions, but the new site doesn't have a https directory 
 -- in fact it doesn't even have a http directory at all. So, what options do 
 I have to do secure transactions?
 
 I remember someone saying that this could be done via a .htaccess file, but 
 I don't have the code, nor am I positive this is the answer.
 
 What do you recommend?
 
 Thanks,
 
 tedd
 
 Did you setup the server (Apache / nginx) configuration? The entire site 
 should be served under https if you're doing CC processing
 
 Best,
 
 –Josh

I understand that cc processing should be done via https.

Normally, that means to me that I place my $ scripts in a https directory -- 
the problem is that I don't have one with this host.

So, I am asking how does one do that with a https directory?

Thanks,

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


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



Re: [PHP] jquery fill select option value

2013-09-22 Thread Tedd Sperling
On Sep 21, 2013, at 9:06 PM, iccsi inu...@gmail.com wrote:
 select id=mark name=mark
 option value=--/option
 option value=bmwBMW/option
 option value=audiAudi/option
 /select
 
 I use above code to have my select drop down on the form and would like to 
 use jQuery to fill option value on change event.
 I would like know is it possible to do, if yes, any hint or example code at 
 server site is appreciated,
 
 Your help and information is great appreciated,

While jQuery is great, you don't need jQuery for this -- a simple AJAX routine 
will do what you want. Here's an example:

http://php1.net/a/zipcode-states/

The ajax routine is there -- you can copy it.

The HTML is there -- you can copy that too.

The php script is a simple script that is triggered by an ajax script 
(triggered by the user via onchange() ) that then pulls whatever data is needed 
to populate the remaining option controls via a GET.

HTH's 

tedd

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



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



Re: [PHP] jquery fill select option value

2013-09-22 Thread Tedd Sperling

On Sep 22, 2013, at 12:47 PM, Jim Giner jim.gi...@albanyhandball.com wrote:

 On 9/22/2013 12:04 PM, Tedd Sperling wrote:
 On Sep 21, 2013, at 9:06 PM, iccsi inu...@gmail.com wrote:
 select id=mark name=mark
 option value=--/option
 option value=bmwBMW/option
 option value=audiAudi/option
 /select
 
 I use above code to have my select drop down on the form and would like to 
 use jQuery to fill option value on change event.
 I would like know is it possible to do, if yes, any hint or example code at 
 server site is appreciated,
 
 Your help and information is great appreciated,
 
 While jQuery is great, you don't need jQuery for this -- a simple AJAX 
 routine will do what you want. Here's an example:
 
 http://php1.net/a/zipcode-states/
 
 The ajax routine is there -- you can copy it.
 
 The HTML is there -- you can copy that too.
 
 The php script is a simple script that is triggered by an ajax script 
 (triggered by the user via onchange() ) that then pulls whatever data is 
 needed to populate the remaining option controls via a GET.
 
 HTH's
 
 tedd
 
 
 OH!!! So you want to populate another(!) select box after the user makes his 
 first selection.  You didn't say that.


Well... not meaning to disagree -- but he did say:

 I use above code to have my select drop down on the form and would like to 
 use jQuery to fill option value on change event.


I took that to mean fill another option control. Why would one want to change 
the values of the current one?

tedd

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


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



[PHP] Friday's Question

2013-09-20 Thread Tedd Sperling
Hi gang:

Do you use a Mousepad?

My reason for asking is that I've used a Mousepad ever since mice first came 
out (back when they had one ball).

Now that mice are optical (no balls), Mousepads are not really needed -- or so 
I'll told by the college -- you see, they don't provide Mousepads for their 
student's computers.

As such, I wondered what's the percentage of programmers still using a Mousepad?

Secondly, are Mousepads used primarily by older programmers (like me) while 
younger programmers don't use Mousepads, or what?

So -- please respond with:

Age: *
Mousepad: Yes/No

Thank you,

tedd

PS: * If you don't want to provide your actual age, then indicate your age by 
stating young, middle-age, old-age, ancient, or whatever term describes 
your age.

Alternate -- I claim that you can tell a man's age by ten-times the number of 
personal products he routinely uses, for example:

Years Old   - Personal Products
10  Toothpaste
20  Toothpaste, Deodorant
30  Toothpaste, Deodorant, Aftershave
40  Toothpaste, Deodorant, Aftershave, Minoxidil
50  Toothpaste, Deodorant, Aftershave, Minoxidil, Preparation-H
60  Toothpaste, Deodorant, Aftershave, Minoxidil, Preparation-H, Bag Bomb
70  Toothpaste, Deodorant, Aftershave, Minoxidil, Preparation-H, Bag Bomb, 
Fixodent

So, you could indicate age by stating Bag Bomb like me.

___
tedd sperling
t...@sperling.com






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



Re: [PHP] Friday's Question

2013-09-20 Thread Tedd Sperling
On Sep 20, 2013, at 1:25 PM, Larry Martell la...@software-horizons.com wrote:

 On Fri, Sep 20, 2013 at 11:20 AM, Jen Rasmussen j...@cetaceasound.com wrote:
 -Original Message-
 What in the heck is a Bag Bomb?
 
 It's a salve for cow udders. Not sure what a person would do with it.


Feet.

Wait until you have callus as feet.

tedd
___
tedd sperling
t...@sperling.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] PHP vs JAVA

2013-08-20 Thread Tedd Sperling
Hi guys:

A teacher at my college made the statement that JAVA for Web Development is 
more popular than PHP.

Where can I go to prove this right or wrong -- and/or -- what references do any 
of you have to support your answer? (sounds like a teacher, huh?)

Here are my two references:

http://w3techs.com/technologies/details/pl-php/all/all

http://w3techs.com/technologies/history_overview/programming_language/ms/y 

But I do not know how accurate they are.

What say you?

Cheers,


tedd

___
tedd sperling
t...@sperling.com






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



Re: [PHP] PHP vs JAVA

2013-08-20 Thread Tedd Sperling
On Aug 20, 2013, at 10:04 AM, Ashley Sheridan a...@ashleysheridan.co.uk wrote:
 Is he possibly getting confused with Javascript?
 
 Thanks,
 Ash

No, this guy is smarter than that -- he's pretty sharp -- so I listen to what 
he has to say.

Here's an interesting link:

http://www.sitepoint.com/best-programming-language-of-2013/

But the link does not divide languages between Web and Other -- other than 
Android Java, which I do not believe is also included in the above Java 
number.

I think there is more going on here than what I know.

For example, my college has numerous (over 3) JAVA classes filled to the max, 
whereas my PHP class was canceled due to lack of students. Granted the college 
could have advertised my PHP class more, but still there is an overwhelming 
demand for Java Programmers. My questions is Why?

Cheers,


tedd

___
tedd sperling
t...@sperling.com






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



Re: [PHP] PHP vs JAVA

2013-08-20 Thread Tedd Sperling
 The article very clearly says..
 
 No language can be considered as good just because there are more jobs for 
 the same.
 

Yes, but I am not making a value (good/bad) judgment -- Instead I am asking for 
references supporting which language (Java or PHP) as being the most popular 
for Web Development?

Do you have any?

Cheers,

tedd

___
tedd sperling
t...@sperling.com






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



Re: [PHP] PHP vs JAVA

2013-08-20 Thread Tedd Sperling
On Aug 20, 2013, at 10:29 AM, Sebastian Krebs krebs@gmail.com wrote:
 Just tell your teacher: Java isn't more popular than PHP as _web_-language ;)
 I think too, that he actually meant javascript, which is indeed a very 
 popular client-side language. But javascript and PHP has different use-cases, 
 thus saying one is more popular doesn't tell you anything about whether 
 they are in competition against each other, or not (hint: they arent : :D).

Two things:

1. He's not my teacher -- he is a fellow teacher AND a smart one! He knows the 
difference between Java and JavaScript.
2. In life, you will find that popularity (often over which is best) is the 
main reason why things prosper. 

Cheers,

tedd



___
tedd sperling
t...@sperling.com






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



Re: [PHP] PHP vs JAVA

2013-08-20 Thread Tedd Sperling
On Aug 20, 2013, at 10:36 AM, Liam l...@3sharpltd.com wrote:
 You do realise you are on a PHP based user subscription, so the vast
 majority will go with PHP, so you will get a one sided argument.
 
 Regards,
 Liam


I realize that many, maybe the majority, will be bias. HOWEVER -- there are 
professionals on this list that do know and it is to them I am asking. 
Remember, I am also asking for supporting documentation of their view. The 
people who respond with just their opinion are doing just that -- there is no 
support.

My nature is to seek the truth regardless of my bias.

Cheers,

tedd


___
tedd sperling
t...@sperling.com



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



Re: [PHP] PHP vs JAVA

2013-08-20 Thread Tedd Sperling
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



Re: [PHP] PHP vs JAVA

2013-08-20 Thread Tedd Sperling
On Aug 20, 2013, at 12:24 PM, Pete Ford p...@justcroft.com wrote:
 tedd,
 
 Java is a meticulously-constructed language with very strict typing and a 
 large commercial organisation which purports to support and develop it.
 PHP is a scruffy heap of loosely typed cruft which is easy to knock together 
 and build big things from, but has a semi-commercial and community support 
 structure.

Thanks for the info. :-)

FYI -- I am teaching both PHP and JAVA at college level and have taught both 
for several years as well as other Web Languages.

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.

Thanks,

tedd

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


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



Re: [PHP] PHP vs JAVA

2013-08-20 Thread Tedd Sperling
On Aug 20, 2013, at 2:19 PM, Sebastian Krebs krebs@gmail.com wrote:
 Thats interesting. I am from Berlin and here, when you say you know PHP and a 
 little bit of one, or two frameworks, they will jump onto you 

I'll stay away from Berlin. :-)

tedd

___
tedd sperling
t...@sperling.com

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



Re: [PHP] How can I submit more than 2000 items of data?

2013-08-19 Thread Tedd Sperling
On Aug 19, 2013, at 11:32 AM, Stuart Dallas stu...@3ft9.com wrote:
 I wasn't speaking to his specific issue as that was solved by an earlier 
 response. I was just commenting that the implied intrinsic link between JSON 
 and Javascript in what he had said does not exist.
 
 -Stuart

This is similar JAVA and JavaScript confusion -- even the college where I teach 
didn't know the difference.

For example, several years ago, they asked me if I could teach Java-JavaScript 
and I answered Sure, which one? The administrator stood there like a dog who 
just heard a high note and replied Yes, we want you to teach Java-JavaScript.

After I explained the difference, her next comment was Which one are you 
certified in?

She went from not knowing the difference to knowing that certification was 
required to teach it (whatever it was).

It's a wonder that anyone receives an education these days.

Cheers,

tedd

___
tedd sperling
tedd.sperl...@gmail.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Why the difference in email transit times?

2013-08-13 Thread Tedd Sperling
Hi gang:

I'm using the class.phpmailer.php code to send email -- it works neat -- very 
classy (no pun intended).

I can send an email from my sperling.com domain and it arrives almost 
immediately.

However, when I use the exact same code (except for the FROM address) from 
kvyv.com (another domain I own), the email literally takes hours (up to 12) to 
arrive.

Any idea of why there is a difference of email transit times between the two 
domains?

Cheers,

tedd

PS: Note, my receiving email addresses are handled by gmail.com.

___
tedd sperling
t...@sperling.com






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



Re: [PHP] sessions working? not working?

2013-08-12 Thread Tedd Sperling
On Aug 12, 2013, at 4:27 AM, Clifford Shuker clifford.shu...@ntlworld.com 
wrote:
 Hi have the following (below) session code at the top of each page..  The
 'print_r' (development feature only) confirms that on one particular page I
 do log out as the session var = (). but, on testing that page via the URL I
 still get to see the page and all its contents - session var() -..  the page
 has the following  'session_start, DOCTYPE Info then htmlheadcontaining
 meta info  title/headbodycontaining style/tables/content//body/html
 // end of page.  I have copied the same page without the html content (i.e.
 a blank page) and I get to fully log out.. when this page is tested in the
 URL my warning comes up 'you need to login to see this page' which is what I
 want but, I've tried numerous avenues to reconcile my problem to no avail..
 I'm a novice so any help would be appreciated..   
 
 
 
 ?php
 
 session_start();
 
 error_reporting (E_ALL ^ E_NOTICE);
 
 $userid = $_SESSION['userid'];
 
 $username = $_SESSION['username'];
 
 print_r($_SESSION);
 
 ?
 

Ok, but when are you populating the SESSION's? Such as:

$_SESSION['userid'] = $userid;

Also, have a look at this:

http://sperling.com/php/authorization/log-on.php

It might help.

tedd

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




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



[PHP] Re: How to extract php source code from joomla

2013-07-23 Thread Tedd Sperling
On Jul 23, 2013, at 12:15 AM, elk dolk elkd...@yahoo.com wrote:

 I study for MSc degree at university.
 
  Are you in an advanced class?

Ok, congratulations -- you are studying for an MSc -- but that didn't answer 
the question.

So, let me repeat the question:

[1] Are you in an advanced PHP class?

[2] Or is this just an introductory class?


If [1], then the coursework might be understandable, but still very difficult.

If [2], that is far more than what I teach as an Introduction to PHP course.


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



Re: [PHP] /tmp/directory

2013-07-23 Thread Tedd Sperling
On Jul 23, 2013, at 9:55 AM, Daniel Brown danbr...@php.net wrote:
 
 
If it's /tmp, it's /tmp.  The leading slash indicates that it's in
 the filesystem root.  However, if it's just tmp, then it could - and
 probably is - under the client's home directory.  Unless they're
 chrooted; then it could be displayed as /tmp, but would actually be
 virtualized by the OS, where /tmp isn't really /tmp, but could be
 /var/virtfs/user/tmp.
 
Confusing?  Sure.  Off-topic for the list?  Sort of, but that's
 easy enough to change.
 
Since you can't use get_sys_temp_dir() on 4.3.10, you should
 instead see if $_ENV contains an array key for TMP, TMPDIR, or TEMP.
 Or, if you'd rather, you can use getenv('TMP') and the like.  It
 doesn't mean that you'll get any useful information back (or anything
 at all, necessarily), but it's another thing to try when using such an
 antiquated version (I believe it was released at the end of 2004).

Thanks Daniel.

tedd


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


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



Re: [PHP] /tmp/directory

2013-07-22 Thread Tedd Sperling
On Jul 22, 2013, at 11:20 AM, Tedd Sperling t...@sperling.com wrote
 Hi gang:
 
 I should know this, but I don't.
 
 Where is the /tmp/ directory?
 
 You see, I have a client where his host has apparently changed the /tmp/ 
 directory permissions such that old php/mysql scripts cannot write to the 
 /tmp/ directory anymore -- they did at one time.
 
 So, how do I fix it?
 
 Cheers,
 
 tedd

Let me add -- the PHP version I am working with is 4.3.10.

I know...

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



[PHP] /tmp/directory

2013-07-22 Thread Tedd Sperling
Hi gang:

I should know this, but I don't.

Where is the /tmp/ directory?

You see, I have a client where his host has apparently changed the /tmp/ 
directory permissions such that old php/mysql scripts cannot write to the /tmp/ 
directory anymore -- they did at one time.

So, how do I fix it?

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



Re: [PHP] /tmp/directory

2013-07-22 Thread Tedd Sperling
On Jul 22, 2013, at 12:02 PM, Larry Martell la...@software-horizons.com wrote:
 On Mon, Jul 22, 2013 at 9:59 AM, Larry Martell
 la...@software-horizons.com wrote:
 On Mon, Jul 22, 2013 at 9:50 AM, Tedd Sperling tedd.sperl...@gmail.com 
 wrote:
 On Jul 22, 2013, at 11:20 AM, Tedd Sperling t...@sperling.com wrote
 
 I should know this, but I don't.
 
 Where is the /tmp/ directory?
 
 Let me add -- the PHP version I am working with is 4.3.10.
 
 I know...
 
 df /tmp should show you where it's mounted.
 
 And sys_get_temp_dir() will tell you the path.
 
 # php
 ?
 print sys_get_temp_dir()
 ?

One might think that -- but no.

The version is dated.

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



Re: [PHP] /tmp/directory

2013-07-22 Thread Tedd Sperling
On Jul 22, 2013, at 4:10 PM, Matijn Woudt tijn...@gmail.com wrote:

 On Mon, Jul 22, 2013 at 5:20 PM, Tedd Sperling t...@sperling.com wrote:
 
 Hi gang:
 
 I should know this, but I don't.
 
 Where is the /tmp/ directory?
 
 You see, I have a client where his host has apparently changed the /tmp/
 directory permissions such that old php/mysql scripts cannot write to the
 /tmp/ directory anymore -- they did at one time.
 
 So, how do I fix it?
 
 Cheers,
 
 tedd
 
 
 Switch host? /tmp is required by the FHS and POSIX standards (writable for
 any user), any host changing that should have no customers.
 
 - Matijn


Good point -- we will add that reason to the many other reasons why we are 
changing host.

Keep in mind, the installed software worked for nearly a decade and now the 
host has changed something that caused this error, but the current host doesn't 
seem to know what happened.

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



Re: [PHP] How to extract php source code from joomla

2013-07-22 Thread Tedd Sperling
On Jul 22, 2013, at 3:49 PM, elk dolk elkd...@yahoo.com wrote:
 Thank you for the quick response ! What I am trying to do : I have to 
 complete two university projects for
 
  my professor !
 
 project One  : Make an online shop and must use the following components in 
 it 
 
 
 Shopping cart, Catalog of products, payment gateway , user login and user 
 activity log .
 
 
 project Two : Implementing of a B2B sell-side portal with negotiation 
 mechanism.
 
 As I am familiar with php and My.SQL and I have only 20 days to complete 
 those projects !  I thought it's 
 
 better to use Joomla I'll be grateful if you can give me an advice 
 
 
 thank you
 

Sounds more like a client than someone who teaches php.

I couldn't do that from scratch in 20 days and I teach php at college level. 
That's more than my entire 16 weeks course of introductory php. Are you in an 
advanced class?

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



[PHP] strip_tags

2013-07-20 Thread Tedd Sperling
Hi gang:

I've been using

$str = strip_tags($str, $allowable)

as it is described via the manuals:

http://php.net/manual/en/function.strip-tags.php

The problem I've found is the tags br and br / are not stripped.

How do you strip all tags, but leave some tags (such as b, i, and u -- I 
know these are depreciated, but my client wants them anyway).

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



Re: [PHP] strip_tags

2013-07-20 Thread Tedd Sperling

On Jul 20, 2013, at 5:34 PM, Frank Arensmeier farensme...@gmail.com wrote:

 20 jul 2013 kl. 18:25 skrev Tedd Sperling t...@sperling.com:
 
 Hi gang:
 
 I've been using
 
   $str = strip_tags($str, $allowable)
 
 as it is described via the manuals:
 
 http://php.net/manual/en/function.strip-tags.php
 
 The problem I've found is the tags br and br / are not stripped.
 
 How do you strip all tags, but leave some tags (such as b, i, and u -- 
 I know these are depreciated, but my client wants them anyway).
 
 From the manual:
 allowable_tags
 You can use the optional second parameter to specify tags which should not be 
 stripped.
 
 Note:
 HTML comments and PHP tags are also stripped. This is hardcoded and can not 
 be changed with allowable_tags.
 
 Note:
 This parameter should not contain whitespace. strip_tags() sees a tag as a 
 case-insensitive string between  and the first whitespace or . It means 
 that strip_tags(br/, br) returns an empty string.
 
 It's all there… ;-)
 
 Cheers,
 /frank
 

Yeah, but that wasn't the problem -- it was my mistake in coding.

In any event, I figured it out.

tedd


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

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



Re: [PHP] PHP and Powershell

2013-07-19 Thread Tedd Sperling
To all:

Sorry for top posting and sorry for sounding like the list-police, but you need 
to trim the excess from your post. Hitting reply without considering that other 
have to read through a bunch of old add-on email is not good.

So, please just trim your post to what is important.

Cheers,

tedd

On Jul 19, 2013, at 1:16 PM, Serge Fonville serge.fonvi...@gmail.com wrote:

 Thank you for your clarification.
 
 Have you considered placing the whole powershell -command parameter in a
 .ps1 script and executing that instead?
 
 The benefit would be that it is easier to read and test accordingly.
 
 HTH
 
 Kind regards/met vriendelijke groet,
 
 Serge Fonville

 --- BIG SNIP ---


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



Re: [PHP] pass parameter from client to server

2013-07-18 Thread Tedd Sperling




On Jul 18, 2013, at 6:07 PM, Daniel Brown danbr...@php.net wrote:

 On Thu, Jul 18, 2013 at 6:04 PM, iccsi inu...@gmail.com wrote:
 I have a select control on the form and need to pass value user select to my
 query parameter.
 I just realized that user entry value is client side and query parameter is
 server side.
 Are there any way to read client parameter to pass to server?
 
 You information and help is great appreciated,
 
Not from PHP unless you pass it via GET or POST, or as a cookie.
 You may want to look into JavaScript, jQuery, and AJAX for your
 specific needs, but that all gets beyond the scope of this list.

Daniel is right.

Here's my way to do what you are asking:

http://php1.net/a/ajax/

Please examine the javascript that accompanies the demo.

It simply sends GET values to a php script that changes the values in the GET 
Array without a refresh.

However, I would not provide such access to a db query without a great deal of 
cleaning.

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



Re: [PHP] pass parameter from client to server

2013-07-18 Thread Tedd Sperling

One additional comment.

Please change the javascript onclick to onchange -- that way the demo will work 
for Chrome as well as other Browsers.

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



[PHP] Error checking ON

2013-07-17 Thread Tedd Sperling
Hi gang:

Considering:

On Jul 17, 2013, at 11:41 AM, Jim Giner jim.gi...@albanyhandball.com wrote:

 Since you state that you haven't made any changes to the system (in general), 
 I'm going to guess that you modified an 'included' file and it has an error 
 in it, such as an unmatched curly brace.  As Dan said, turn on all error 
 checking and reporting and see what message you get.

This is what I do for error checking:

ini_set('error_reporting', E_ALL | E_STRICT);
ini_set('display_errors', 'On');
ini_set('log_errors', 'On');
ini_set('error_log', 'error_log');  

Is this:

1. Sufficient?

2. An overkill?

3. OK?

4. OR, better served with this (and provide an example).

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



Re: [PHP] Error checking ON

2013-07-17 Thread Tedd Sperling
On Jul 17, 2013, at 11:55 AM, Daniel Brown danbr...@php.net wrote:
 On Wed, Jul 17, 2013 at 11:49 AM, Tedd Sperling t...@sperling.com wrote:
 This is what I do for error checking:
 
ini_set('error_reporting', E_ALL | E_STRICT);
ini_set('display_errors', 'On');
ini_set('log_errors', 'On');
ini_set('error_log', 'error_log');
 
 Is this:
 
 1. Sufficient?
 
 2. An overkill?
 
 3. OK?
 
 4. OR, better served with this (and provide an example).
 
That's standard practice.  Sometimes, though, it isn't enough, and
 we find ourselves using Derick's Xdebug, mod_top, or performing an
 strace on either the execution or attached to a process.  For nearly
 all cases, though, that's sufficient without being overkill (except
 for production cases).
 

Daniel:

Thanks -- I always wondered about that.

Cheers,

tedd

PS: Of course, turned OFF for production. :-)

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

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



[PHP] htaccess

2013-07-07 Thread Tedd Sperling
Hi gang:

I have a client who has an account with GoDaddy (I know).

GoDaddy says they have PHP v 5.3 installed on the client's account, but 
phpinfo() says different, namely it reports 5.2.17.

After calling GoDaddy, they said the client has an htaccess file that makes 
everything 5.2 instead of 5.3.

Now, I'm not an expert on these things and the reason why I am asking here, but 
here are the two htaccess files I find at root level:

1. Named: .htaccess.bak_hosting_company_Apache24_compatibility_fix

Options +ExecCGI
AddType application/x-httpd-php .php .htm .html
AddHandler x-httpd-php5-cgi .php .htm .html
# AddHandler php5-script .php .html
# AddHandler x-httpd-php5 .php .html
ErrorDocument 404 /404.html
ErrorDocument 403 /403.html

AND

2. Named: .htacess

# The below FilesMatch stanza was added by your
#  hosting provider on 2013-06-27 11:05:33
#  to resolve a potential Apache 2.4
#  compatibility issue with your custom AddHandler(s)
#  for PHP.  If you feel this was in error, please
#  contact support and we will work to resolve the
#  issue.  Thanks!
FilesMatch \.(htm|html)$
  Options +ExecCGI
/FilesMatch

Options +ExecCGI
AddType application/x-httpd-php .php .htm .html
AddHandler x-httpd-php5-cgi .php .htm .html


Does anyone see a problem here?

OR -- a way to get PHP to version 5.3?

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



Re: [PHP] htaccess

2013-07-07 Thread Tedd Sperling
Simon:

Confirmed. Those two lines cause the problem.

However, commenting out those lines causes other problems.

Are there similar statements to these:

   AddType application/x-httpd-php .php .htm .html
   AddHandler x-httpd-php5-cgi .php .htm .html

That will allow for their function (whatever that may be), but not reduce PHP 
to version 5.2.17?

If these statement are for only the php interpreter to consider html prefixes, 
then I use the following on my main site:

# handler for phpsuexec. -- this makes these prefixes considered for php
FilesMatch \.(htm|html|css)$
 SetHandler application/x-httpd-php
/FilesMatch

And it works for me without the PHP version reduction.

What do you say?

And thanks...

Cheers,

tedd



On Jul 7, 2013, at 4:10 PM, Simon J Welsh si...@simon.geek.nz wrote:

 On 8/07/2013, at 8:06, Tedd Sperling t...@sperling.com wrote:
 
 Hi gang:
 
 I have a client who has an account with GoDaddy (I know).
 
 GoDaddy says they have PHP v 5.3 installed on the client's account, but 
 phpinfo() says different, namely it reports 5.2.17.
 
 After calling GoDaddy, they said the client has an htaccess file that makes 
 everything 5.2 instead of 5.3.
 
 Now, I'm not an expert on these things and the reason why I am asking here, 
 but here are the two htaccess files I find at root level:
 
 1. Named: .htaccess.bak_hosting_company_Apache24_compatibility_fix
 
 Options +ExecCGI
 AddType application/x-httpd-php .php .htm .html
 AddHandler x-httpd-php5-cgi .php .htm .html
 # AddHandler php5-script .php .html
 # AddHandler x-httpd-php5 .php .html
 ErrorDocument 404 /404.html
 ErrorDocument 403 /403.html
 
 AND
 
 2. Named: .htacess
 
 # The below FilesMatch stanza was added by your
 #  hosting provider on 2013-06-27 11:05:33
 #  to resolve a potential Apache 2.4
 #  compatibility issue with your custom AddHandler(s)
 #  for PHP.  If you feel this was in error, please
 #  contact support and we will work to resolve the
 #  issue.  Thanks!
 FilesMatch \.(htm|html)$
 Options +ExecCGI
 /FilesMatch
 
 Options +ExecCGI
 AddType application/x-httpd-php .php .htm .html
 AddHandler x-httpd-php5-cgi .php .htm .html
 
 
 Does anyone see a problem here?
 
 OR -- a way to get PHP to version 5.3?
 
 Cheers,
 
 tedd
 
 I don’t use GoDaddy, so this may not be entirely accurate.
 
 I’m guessing that it’s these two lines in .htaccess:
 AddType application/x-httpd-php .php .htm .html
 AddHandler x-httpd-php5-cgi .php .htm .html
 They’re changing the handler from PHP files from the default ones to 
 x-httpd-php5-cgi, which would cause PHP 5.2 to be used instead. Try 
 commenting out these two lines.
 
 ---
 Simon Welsh
 Admin of http://simon.geek.nz/
 
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 


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



Re: [PHP] Can this work?

2013-07-05 Thread Tedd Sperling
On Jul 5, 2013, at 9:56 AM, Karl-Arne Gjersøyen karlar...@gmail.com wrote:
 The lists look like this:
 
 form action=index.php
 view-source:http://localhost/%7Ekarl/kasen/io/kp/index.php
 method=postselect name=valgt_dynamit_polse_1-25kgoption
 value=1-25 selected=selected1-25/optionoption
 value=11/optionoption value=22/optionoption


Review this:

http://sperling.com/php/select/

Also, omit 'multiple' in the select statement.

Other than that, the demo shows how to gather the information you want.

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



Re: [PHP] Reseting the auto-increment number in a MySQL database.

2013-06-28 Thread Tedd Sperling
On Jun 27, 2013, at 8:47 PM, Paul M Foster pa...@quillandmouse.com wrote:

 On Thu, Jun 27, 2013 at 11:47:28PM +0200, adriano wrote:
 
 holes in sequence of auto increment happen using transaction for
 insert new record but you don't commit transaction itself
 it seems that the autoincrement is incremented anyway
 at least this is my case.
 
 I think what Tedd was referring to was something else. The hole was
 quite large. I've seen this behavior myself, in PostgreSQL. From one
 transaction to the next, there were over 10,000 skipped numbers, and
 only me and my wife on the system. Some sort of bug, like a spinlock
 that wasn't interrupted the way it should have been. I remember the
 system taking forever to calm down before it gave the next transaction a
 number way forward of the last one. I waited in front of my browser for
 quite some time. But I couldn't explain why.
 
 Paul

Yes, it was something like what Paul said -- it was not a transaction skip.

I don't know what to think about it -- no explanation.

But, the problem suddenly vanished -- very strange.

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



[PHP] Reseting the auto-increment number in a MySQL database.

2013-06-26 Thread Tedd Sperling
Hi gang:

I have a client where their next auto-increment number just jumped from 2300 to 
10 for reasons not understood. They want it set back.

Options such as dropping the primary key and rebuilding the index is NOT 
possible -- this is a relational table thing.

So, is there a way (programmatically) to set the next number in an 
auto-increment?

Something like:

alter table abc auto_increment = 2301;

Any ideas of why this happened?

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



Re: [PHP] Reseting the auto-increment number in a MySQL database.

2013-06-26 Thread Tedd Sperling
On Jun 26, 2013, at 1:13 PM, Stuart Dallas stu...@3ft9.com wrote:

 On Wednesday, 26 June 2013 at 18:07, Tedd Sperling wrote:
 Hi gang:
 
 I have a client where their next auto-increment number just jumped from 2300 
 to 10 for reasons not understood. They want it set back.
 
 Options such as dropping the primary key and rebuilding the index is NOT 
 possible -- this is a relational table thing.
 
 So, is there a way (programmatically) to set the next number in an 
 auto-increment?
 
 Something like:
 
 alter table abc auto_increment = 2301;
 
 
 ALTER TABLE tbl AUTO_INCREMENT = 2301;
 
 -Stuart

Thanks -- I needed confirmation on that.

It is something that i don't want to do.

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



[PHP] Last Record INSERT

2013-06-26 Thread Tedd Sperling
Hi gang:

What's the most-current way to get the ID of the last recorded inserted in a 
database?

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



Re: [PHP] Reseting the auto-increment number in a MySQL database.

2013-06-26 Thread Tedd Sperling
On Jun 26, 2013, at 1:32 PM, Jim Giner jim.gi...@albanyhandball.com wrote:

 But more importantly - don't you need to figure out why it happened?? As 
 well as correcting any inserts with the bogus id?


Yes, I would like to know -- I'm open for suggestions.

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



Re: [PHP] Last Record INSERT

2013-06-26 Thread Tedd Sperling
Gang:

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.

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



Re: [PHP] Last Record INSERT

2013-06-26 Thread Tedd Sperling
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



Re: [PHP] Last Record INSERT

2013-06-26 Thread Tedd Sperling
On Jun 26, 2013, at 2:10 PM, Dan Munro d...@danmunro.com wrote:

 Learning something new everyday is one of the joys of this profession. If you 
 learn two new things, consider yourself lucky :)

What if it's the same two things?

New just means I didn't remember it.


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



Re: [PHP] Reseting the auto-increment number in a MySQL database.

2013-06-26 Thread Tedd Sperling
On Jun 26, 2013, at 3:23 PM, Matijn Woudt tijn...@gmail.com wrote:
 
 What storage engine are you using? InnoDB is known for it's auto increment 
 holes, but I didn't expect the holes to be that big. 

I have no idea.

It's not my database. It's Constant Contact's -- I just put stuff in it as per 
client's needs.

However, all of a sudden, it's been fixed -- everything is back to normal -- 
very strange.

Thanks to everyone.

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



[PHP] A Strange Problem

2013-06-20 Thread Tedd Sperling
Hi gang:

I have a very strange problem.

I can use this statement in one folder:

$fcontents = file('docs/admin-email.txt');

But in a different folder with an exact path having 'docs/admin-email.txt', I 
get:

Warning: file(/docs/admin-email.txt) [function.file]: failed to open stream: No 
such file or directory in cut on line 83

This has got me really puzzled.

I have confirmed these are the exact same folders and files, except only in two 
different places on the server. Both are one level down from root.

Any ideas as to what is going on?

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



Re: [PHP] A Strange Problem

2013-06-20 Thread Tedd Sperling
Matijin:

My mistake in posting -- I have tried it several different ways including 
absolute.

Nothing works.

Cheers,

tedd

---
On Jun 20, 2013, at 1:43 PM, Matijn Woudt tijn...@gmail.com wrote:

 
 
 
 On Thu, Jun 20, 2013 at 7:39 PM, Tedd Sperling t...@sperling.com wrote:
 Hi gang:
 
 I have a very strange problem.
 
 I can use this statement in one folder:
 
 $fcontents = file('docs/admin-email.txt');
 
 But in a different folder with an exact path having 'docs/admin-email.txt', I 
 get:
 
 Warning: file(/docs/admin-email.txt) [function.file]: failed to open stream: 
 No such file or directory in cut on line 83
 
 
 Are you sure it is the same string? It looks like this one has an extra '/' 
 at the beginning?
  
 This has got me really puzzled.
 
 I have confirmed these are the exact same folders and files, except only in 
 two different places on the server. Both are one level down from root.
 
 Any ideas as to what is going on?
 
 Cheers,
 
 tedd
 
 
 
 Else it could be permission item, I think the user executing the PHP script 
 (www-user or such for apache), needs to have execute rights on all 
 directories up to the file, to be able to read the file listing.
 
 - Matijn 
 


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



Re: [PHP] A Strange Problem

2013-06-20 Thread Tedd Sperling
On Jun 20, 2013, at 1:44 PM, Bastien phps...@gmail.com wrote:
 
 It sounds like a current working directory issue. Try running a getcwd() in 
 both places to see how they are set
 
 Bastien

I think you have something, here's the reports:

Works:

/home/content/64/cut/html/sdi/tedd/php-mail

Does NOT work:

/home/content/64/cut/html/sdi

The one that does not work should be:

   /home/content/64/cut/html/sdi/includes/

How do I fix it?

Cheers,

tedd

PS: All cut's were identical.


_
t...@sperling.com
http://sperling.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] A Strange Problem

2013-06-20 Thread Tedd Sperling
Bastien:

You were right on - by changing the directory to what I needed, everything 
works.

My follow-up question is Why?

I have *never* had to specifically tell any script to chdir() -- why with that 
one?

Cheers and Thanks!

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



Re: [PHP] A Strange Problem

2013-06-20 Thread Tedd Sperling
Daniel:

I placed it at root and it reports:

/home/content/64/cut/html/sdi

That's the same path that had problems.

tedd

_
tedd.sperl...@gmail.com
http://sperling.com





On Jun 20, 2013, at 2:22 PM, Daniel Brown danbr...@php.net wrote:

 On Thu, Jun 20, 2013 at 2:14 PM, Tedd Sperling tedd.sperl...@gmail.com 
 wrote:
 Bastien:
 
 You were right on - by changing the directory to what I needed, everything 
 works.
 
 My follow-up question is Why?
 
 I have *never* had to specifically tell any script to chdir() -- why with 
 that one?
 
Sounds like either a chroot or virtual environment (such as,
 execution of the script in a separate directory) issue.  Check the
 output of this:
 
 ?php
 if (phpversion() = 5.3) {
echo __DIR__.PHP_EOL;
 } else {
echo getcwd().PHP_EOL;
 }
 ?
 
 --
 /Daniel P. Brown
 Network Infrastructure Manager
 http://www.php.net/


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



Re: [PHP] A Strange Problem

2013-06-20 Thread Tedd Sperling
On Jun 20, 2013, at 7:12 PM, Stuart Dallas stu...@3ft9.com wrote:
 Whatever the reason for this, I'd recommend you always specify a path 
 relative to the current script.
 
 In PHP 5.3+:
 
 $fcontents = file(__DIR__.'/docs/admin-email.txt');
 
 Prior to 5.3:
 
 $fcontents = file(dirname(__FILE__).'/docs/admin-email.txt');
 
 -Stuart

-Stuart:

Thats' an excellent idea -- I will do that.

I just don't know why after so many years this problem came up -- I never 
experienced it before -- AND when I am really up against it.

Maybe someone smarter than me (open to many) will explain why it happened.

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



[PHP] LightBox click detection

2013-06-14 Thread Tedd Sperling
Hi gang:

It's Friday so I am allowed to ask odd questions.

Here's the problem --  I need to count the number of times a user activates a 
LightBox -- how do you do that?

Here's a LightBox Example:

   http://www.webbytedd.com/c2/lightbox/

All the javascript is there (jQuery et al).

Ideally, I would like to have a php/javascript combination that would:

1. Detect when a user clicked the LightBox;
2. Pass that value to PHP so I can keep count.

Any ideas?

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



[PHP] htaccess to make html act as php suffixed files

2013-06-11 Thread Tedd Sperling
Hi gang:

To get html pages to use php scripts, I've used:

RewriteEngine on
# handler for phpsuexec. -- this makes these prefixes considered for php
FilesMatch \.(htm|html)$
 SetHandler application/x-httpd-php
/FilesMatch

In a .htaccess file.

However, it works on one site, but not on another -- any ideas as to why?

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



Re: [PHP] Using Table prefixes

2013-06-10 Thread Tedd Sperling
On Jun 8, 2013, at 4:17 PM, Julian Wanke jswp...@gmx.at wrote:

 A database for each client? Isn't that over-powered? If you have 1000 
 clients, you would loose the overview over your databases...

What -- people have more than one client?!?

My thoughts:

A client is like a girlfriend -- if you have too many, things can get real 
ugly, real fast.

If you have over 10 clients (let alone 1000), then you're probably overworked 
and not doing your best for each.

My advise -- raise your rates until you narrow those clients down to a 
manageable size. Both you and your clients will be happier.

At least, that's been my experience -- YMMV.

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



Re: [PHP] Using Table prefixes

2013-06-10 Thread Tedd Sperling
Hi:

I am sure they do not turn over a 1000 clients to a single person.

Cheers,

tedd

_
tedd.sperl...@gmail.com
http://sperling.com





On Jun 10, 2013, at 2:11 PM, Julian Wanke jswp...@gmx.at wrote:

 Tell this the facebook, google or nsa data team ^^
 
 Am 10.06.2013, 16:15 Uhr, schrieb Tedd Sperling tedd.sperl...@gmail.com:
 
 On Jun 8, 2013, at 4:17 PM, Julian Wanke jswp...@gmx.at wrote:
 
 A database for each client? Isn't that over-powered? If you have 1000 
 clients, you would loose the overview over your databases...
 
 What -- people have more than one client?!?
 
 My thoughts:
 
 A client is like a girlfriend -- if you have too many, things can get real 
 ugly, real fast.
 
 If you have over 10 clients (let alone 1000), then you're probably 
 overworked and not doing your best for each.
 
 My advise -- raise your rates until you narrow those clients down to a 
 manageable size. Both you and your clients will be happier.
 
 At least, that's been my experience -- YMMV.
 
 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


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



Re: [PHP] Using Table prefixes

2013-06-08 Thread Tedd Sperling
On Jun 8, 2013, at 3:00 PM, Ashley Sheridan a...@ashleysheridan.co.uk wrote:
dealTek deal...@gmail.com wrote:
 
 I can see the basic need for a table prefix in a case where you may use
 one mysql database for several projects at once so as to distinguish
 tables per project like...
 
 -snip-
 however I was told a long time ago to use a prefix tbl_ like
 tbl_Mytable but I don't really see much need for this by itself ... Am
 I missing something?
 
 I think that's a pattern that people use to distinguish their tables from 
 views, etc, but personally I find it a little pointless. It doesn't really 
 help in any way, and just means more typing.
 
 Using a prefix for a set of tables in one db where you might have several 
 things using the db (i.e. some hosting limits the databases you can have) 
 makes sense, and especially so if you name it sensibly as in your first 
 example. 
 Thanks,
 Ash

I agree, but more than that I also set up databases specifically for clients 
such that all the tables in them are related to the client and not each other, 
such as:

client1_db

contacts
invoices
etc

and

client2_db

contacts
invoices
etc

As such, the tbl_ prefix is not needed.

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



Re: [PHP] limit access to php page

2013-05-30 Thread Tedd Sperling
On May 29, 2013, at 11:05 PM, Paul M Foster pa...@quillandmouse.com wrote:
 http://sperling.com/php/authorization/log-on.php
 
 I realize this is example code.
 
 My question is, in a real application where that $_SESSION['auth'] token
 would be used subsequently to gain entry to other pages, what would you
 use instead of the simple TRUE/FALSE value? It seems that someone (with
 far more knowledge of hacking than I have) could rather easily hack the
 session value to change its value. But then again, I pretty much suck
 when it comes to working out how you'd hack (crack) things.
 
 Paul

Paul:

While the above link may be example code, it is still sound for production.

Keep in mind that everything in security comes down to a true/false condition. 
Do you let the person in or not!

Certainly there are attacks on session ids and one must deal with that. But 
that's the level of security we have today.

I could go through all the things you need to consider in protecting your 
session id (e.g., not accessing your bank accounts while having coffee at 
StartBucks) but that would defeat the purpose of attending one of my classes on 
the subject. :-)

If you are very concerned about security, then jump to a https protocol for 
those transactions; change session ids frequently; monitor the user's local 
environmental changes; time the session, and do a bunch of other stuff that 
will make it more and more difficult for your user to use your service. But for 
*most things* using a session id will  keep things relatively safe.

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



Re: [PHP] REQUEST

2013-05-29 Thread Tedd Sperling
On May 29, 2013, at 2:56 PM, Stuart Dallas stu...@3ft9.com wrote:
 Anyone who calls themselves a hacker in a public place such as this does so 
 with absolutely no clue what they're talking about, and that's without 
 getting in to the hacker vs. cracker debate. However, regardless of that I 
 tend not to judge people by the labels they give themselves, they're rarely 
 accurate, especially when they think they're the last and/or best of their 
 kind!
 
 -Stuart

I called myself a Fracker once, but that was when I worked in the oil industry.

Cheers,


tedd

PS: I think it probably best not to rise to the bait from people who forgot to 
turn off their cap's key.

_
tedd.sperl...@gmail.com
http://sperling.com

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



Re: [PHP] need some regex help to strip out // comments but not http:// urls

2013-05-29 Thread Tedd Sperling
On May 29, 2013, at 5:53 PM, Ashley Sheridan a...@ashleysheridan.co.uk wrote:
 Sometimes when all you know is regex, everything looks like a nail...
 
 Thanks,
 Ash
 

There are people who *know* regrex?

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



Re: [PHP] limit access to php page

2013-05-29 Thread Tedd Sperling
On May 29, 2013, at 7:11 PM, Tim Dunphy bluethu...@gmail.com wrote:

 Hello list,
 
 I've created an authentication page (index.php) that logs into an LDAP
 server, then points you to a second page that some folks are intended to
 use to request apache redirects from the sysadmin group (redirect.php).
 
 Everything works great so far, except if you pop the full URL of
 redirect.php into your browser you can hit the page regardless of the login
 process on index.php.
 
 How can I limit redirect.php so that it can only be reached once you login
 via the index page?
 
 Thank you!
 Tim
 
 -- 
 GPG me!!

Try this:

http://sperling.com/php/authorization/log-on.php

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



Re: [PHP] Random

2013-05-23 Thread Tedd Sperling
On May 23, 2013, at 4:54 PM, Daniel Brown danbr...@php.net wrote:

 On Thu, May 23, 2013 at 4:51 PM, Last Hacker Always onpoint
 lasthack...@gmail.com wrote:
 Hey I need code for random number 1-30 for my site.
 
You need to know that you've been removed from the list (but you'd
 still have to be subscribed to be able to read this).

:-)
_
tedd.sperl...@gmail.com
http://sperling.com

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



Re: [PHP] How do I remove a string from another string in a fuzzy way?

2013-05-21 Thread Tedd Sperling
On May 20, 2013, at 10:17 PM, Daevid Vincent dae...@daevid.com wrote:
Initially I was thinking that somehow I could use a simple regex on the
 needle and haystacks to strip out all white space and str_ireplace() them
 that way, but then I don't have a way to put the whitespace back that I can
 see.

Daevid:

Go ahead and strip out the whitespace, but replace it with a delimiter string 
that is unique and then don't consider that delimiter when comparing strings to 
strings.

Afterwards, if you want to keep the string (instead of deleting it), then 
reverse the process adding back in the whitespace and removing the delimiter.

Also, you may want to look into using array_unique() for comparing groupings of 
several strings (i.e., paragraphs) to other groupings. It works pretty slick 
for me.

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



[PHP] Symfony?

2013-05-20 Thread Tedd Sperling
Hi gang:

Who uses Symfony?

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



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

2013-05-19 Thread Tedd Sperling
On May 19, 2013, at 5:19 AM, mrfroasty mrfroa...@gmail.com wrote:

 On 05/16/2013 11:28 PM, Tedd Sperling wrote:
 So, if you find a good reference, please let me know.
 
 In my point of view, Interfaces and Abstracts are completely different stuffs 
 not related at all.Interface is a kind of a way of defining how all objects 
 should behave or written by developers (one has used a word contract or 
 agreement).
 
 For instance we are writting this huge application where hundreds of 
 developers are going to work together.We make an agreement all objects in 
 this application should provide a function for someone debug to see all the 
 contents or data in that object and call this method $this-debug();
 
 In order to guarantee that developers will have to obey this agreement, the 
 only way is to throw some bunch of exception when they do not.This can be 
 defined in an interface.Where everyone implimenting this interface (creating 
 objects) must have a function called debug().

I understand all of that -- but that's not the question I am asking.

Certainly, I can create an interface and if anyone wants to implement the 
interface, then they are forced to flesh-out the methods it contains. I 
understand that -- it's a contract.

But the other side of the argument is why would anyone want to do that other 
than to meet a design criteria?

It is very easy to understand double inheritance -- it is simply where a child 
can inherit methods from both parents. But in languages that do not support 
double inheritance, an Interface is offered as a solution -- and therein is my 
question.

So, in that regard how does an Interface provide methods to classes that 
implement the Interface?

Just show me a *simple* example (either php or Java will do).

Cheers,

tedd

PS: There have been people who have provided Interface examples, but none have 
demonstrated quasi-double inheritance.

_
tedd.sperl...@gmail.com
http://sperling.com

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



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

2013-05-19 Thread Tedd Sperling
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



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

2013-05-17 Thread Tedd Sperling
Nick:

I thank you for your addition, but what you provided did nothing to explain the 
difference between abstract and interface.

In your example:

An abstract Shape with Circle and Square inheriting.

OR

An interface Shape with Circle and Square implementing.

Does exactly the same thing -- so where's the difference?

Also, your:

Please make an effort to understand polymorphic concepts of OOP as
they are rudimentary. Without that one will never grasp OO Patterns
(Gang of Four).

Was more insulting than helpful.  Polymorphism was not the question asked.

Clearly the getArea() method is polymorphic and overridden in both Circle and 
Shape classes and also in BOTH abstract and interface examples.

Additionally, I'm not sure what:

 (int double side) 

means.

Cheers,

tedd


_
tedd.sperl...@gmail.com
http://sperling.com


-

On May 16, 2013, at 8:47 PM, Nick Khamis sym...@gmail.com wrote:

 interface Shape {
 public double getArea();
 }
 
 class Circle implements Shape {
  double radius;
  public Circle(int double radius) {
this.radius = radius;
  }
 
  public double getArea() {
return (radius * radius * 3.1415);
  }
 
 }
 
 class Square implements Shape {
  double side;
 
  public Square(int double side) {
this.side = side;
  }
 
  double getArea() {
return (side * side);
  }
 }
 
 
 Please make an effort to understand polymorphic concepts of OOP as
 they are rudimentary. Without that one will never grasp OO Patterns
 (Gang of Four).
 
 Ninus.
 
 On 5/16/13, Tedd Sperling tedd.sperl...@gmail.com 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
 
 
 _
 tedd.sperl...@gmail.com
 http://sperling.com
 
 
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 


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



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

2013-05-17 Thread Tedd Sperling
Stuart:

You said:

 An interface does what it says on the tin: it describes an interface that a 
 class can then tell the world it implements.
 
 An abstract class provides functionality as well as an interface description. 
 An abstract class cannot be instantiated, it can only be extended.
 
 The logging example given by someone earlier in this thread is the most 
 common example given for interfaces. This is where the interface is defined 
 as an API for others to implement and/or use which then enables users to pick 
 and choose the combination of implementations they want to use based on their 
 requirements without needing to change any of the code of either class.

I understand the stated differences between abstract and interface. I can 
cite what the differences are, but I don't see the practical application 
differences. To me there is no difference between an abstract class (without 
method declarations) and an interface.

However, I view an interface as a statement (a contract) where IF you want 
someone to use your code you outline the methods you require them to flesh-out 
in their code  -- but I would like to see a simple example of that.

I vaguely get the logging example given by Larry, but I'm not good at abstract 
thinking -- I need a concrete simple example.

I tried to create a demo where I had a Toaster Class that contained 
breadNumber() and toastSetting() methods and then created an interface so my 
students could use the Toaster, but it didn't really hold up as well as I 
wanted.

So, can anyone give me a simple example where an interface is used so I can 
easily explain why they are important?

Thanks,

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



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

2013-05-16 Thread Tedd Sperling
-Dan:

I teach this stuff and still don't fully understand the why/when for interfaces.

Even the guru's I talk with can't give me a good explanation as to what the 
advantages are in using them. I've done a lot of experimenting and can't see 
any advantage for them other than grouping different classes together and 
creating a new data-tytpe.

Other than that, from my perspective interfaces are mythicode.
 
So, if you find a good reference, please let me know.

Cheers,

tedd


_
tedd.sperl...@gmail.com
http://sperling.com





On May 16, 2013, at 11:11 AM, Dan Joseph dmjos...@gmail.com wrote:

 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


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



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

2013-05-16 Thread Tedd Sperling
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


_
tedd.sperl...@gmail.com
http://sperling.com



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



Re: [PHP]

2013-05-08 Thread Tedd Sperling
On May 8, 2013, at 12:50 PM, Daniel Brown danbr...@php.net wrote:
If you're going to send hack attempts, at least adjust your clock
 so that it doesn't look like it took almost a month for your SPAM to
 get here.  We're not the Pony Express.  (And, no, PHP doesn't stand
 for Produced by Horses  Ponies.)
 
 On Thu, Apr 11, 2013 at 11:43 AM, Paul Novitski
 p...@juniperwebcraft.com wrote:
 http://www.shinwa-kensetsu.sakura.ne.jp/bth7rz.php

I'm not sure what's going on with Paul's account -- he doesn't normally do 
stuff like that.

I even bought his book.

Cheers,

tedd

PS: PHP +  Produced by Horses  Ponies. ? You got too much time on your 
hands Daniel.

As for me, I just wasted 20+ hours on a clueless client. It would be nice if 
people kept their word.

_
tedd.sperl...@gmail.com
http://sperling.com



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



Re: [PHP] generate onfly PDF

2013-05-04 Thread Tedd Sperling
On May 4, 2013, at 5:00 PM, Ashley Sheridan a...@ashleysheridan.co.uk wrote:
 Rafnews raf.n...@gmail.com wrote:
 Is there a solution to generate onfly PDF from HTML page, and from data
 
 user typed in form (let's say like a template) without using PECL ?
 i read that is hosting does not allow such extension, we can not 
 generate PDF, so i would rather get a solution without such library.
 
 Moreover i'm searching a solution free and that i can supply with my
 web 
 components.
 I created a component that should be able to generate PDF files quite 
 often as service for user.
 
 Have a look at fpdf, its a class that doesn't need any special server-side 
 support. Its basic, but is pretty good.
 
 Thanks,
 Ash

Ash is right, here's an example I provide my students:

http://rebel.lcc.edu/sperlt/citw185/examples/pdf/

Everything is there.

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



Re: [PHP] mysql_connect noob question

2013-04-23 Thread Tedd Sperling
On Apr 21, 2013, at 3:33 PM, Glob Design Info i...@globdesign.com wrote:

 What question did I not answer?


That proves that you're not listening -- you are total waste of time for anyone 
trying to help.

Welcome to my ignore file.

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



Re: [PHP] mysql_connect noob question

2013-04-21 Thread Tedd Sperling
On Apr 21, 2013, at 9:32 AM, Stuart Dallas stu...@3ft9.com wrote:
 However, a more important question for me is why you are doing this. You say 
 you are aware of the security implications, and that you'll deal with that 
 later, but I question how you're going to deal with it. What exactly are you 
 developing that requires DB credentials to come from a form on a web page?
 
 -Stuart

You and I are asking the same question, but I am afraid the poster is not 
listening. Instead, he is pursuing a course of action that simply repeats his 
problem. His focus is on a specific tree instead of the forest. He doesn't want 
to widen his view.

Until the poster answers our question, I'm afraid our recommendations will fall 
on deaf ears.

Some days you can help and some days you can't.

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



Re: [PHP] mysql_connect noob question

2013-04-20 Thread Tedd Sperling
On Apr 19, 2013, at 4:43 PM, Glob Design Info i...@globdesign.com wrote:

 I know this has probably been answered already.
 
 When I pass a user name and password from a form to my PHP script and then 
 pass those to mysql_connect it doesn't connect. When I paste those exact same 
 values into mysql_connect as string literals it works.
 
 Can anyone tell me why this happens?
 
 I know the strings are identical to the literals I try in a test but they 
 don't work when submitted via form.
 
 $form_user = $_POST[ 'user' ];
 $form_pass = $_POST[ 'password' ];
 
 # Connect to remote DB
 
 $LINK = mysql_connect( $host, $form_user, $form_pass );
 
 And yes, my $host param is correct.
 
 Thanks,


Why are you allowing anyone to connect to your database from a form?

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



Re: [PHP] mysql_connect noob question

2013-04-20 Thread Tedd Sperling
On Apr 20, 2013, at 11:44 AM, Stuart Dallas stu...@3ft9.com wrote:

 On 20 Apr 2013, at 16:25, Jim Giner jim.gi...@albanyhandball.com wrote:
 
 Why are you allowing anyone to connect to your database from a form?
 
 A little OT, but...
 What do you mean by this question?  How do you check someone's credentials 
 if not by connecting to a db to verify the login?  Cause I'm doing the same 
 kind of thing all over the place.  With good practices on validation and 
 such before doing my query of course.
 
 I'm pretty sure that's not what tedd meant. The code is logging in to the 
 database server using the username and password from the form. There are very 
 few legitimate reasons to be doing this, so the question is well worth asking.
 
 -Stuart

Stuart is exactly right.

If you are checking someone's credentials to access your site, such as a user, 
then giving them the keys to the kingdom is a bit of an overkill.

My advice, set up user_id and password fields in a user table for users 
you want to access some portion of your site, here's the code to do that:

http://sperling.com/php/authorization/log-on.php

Where I have said // define your user id here is the place to actually open 
your database and access your user table to gather the correct user_id and 
password.

I also suggest that when you open the database you only use literals from a 
config.php file ($dbhost,$dbuser,$dbpass) for accessing the actual database and 
then check the user_id and password before giving them authorization to private 
areas.

Keep the private stuff private!

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



Re: [PHP] webform spam prevention

2013-04-06 Thread Tedd Sperling
On Apr 4, 2013, at 5:02 AM, Ashley Sheridan a...@ashleysheridan.co.uk wrote:
  or you can't see at all) then you have to fall back to the audio
 replacement offered by the captcha. I've tried listening to some, and
 they are awful.
 
 
 Thanks,
 Ash

Ash:

How about the second one down? Can you hear this one clear enough?

I like the circle one. I can place the circle anywhere on the page and ask the 
user to click it, but you have to be able to see it.

The third one is simple enough.

The forth one is bot proof, but a bit difficult for some to figure out and for 
the blind to see.

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



Re: [PHP] Testing

2013-03-08 Thread Tedd Sperling
On Mar 8, 2013, at 1:20 PM, Dustin L dustinlob...@gmail.com wrote:

 This is my first time using a list. Can anyone confirm I'm doing this 
 correctly?
 
 
 Thanks,
 
 
 Dustin L.

Oh, now you did it!

There will be dogs and cats in the streets.

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



Re: [PHP] Open form in new window

2013-03-06 Thread Tedd Sperling
On Mar 5, 2013, at 10:12 PM, Jim Giner jim.gi...@albanyhandball.com wrote
 On 3/5/2013 7:32 PM, Tedd Sperling wrote:
 On Mar 4, 2013, at 12:54 PM, John Taylor-Johnston 
 john.taylor-johns...@cegepsherbrooke.qc.ca wrote:
 
 If you want to open a new page in response to a submit button press (using 
 PHP) you may be out of luck. I don't know of a way to do it without 
 involving another language. Opening a different page in the *same* window, 
 yes. Otherwise, no. But watch the other replies. Maybe someone knows 
 something I don't. Paul
 Nope. Out of luck.
 
 You mean opening a new page while keeping the current page open?
 
 Because clicking a form submit *can* open a new page as per the form's 
 action= attribute.
 
 If you want the current page to remain open while another page opens, then 
 you'll need a javascript routine to do it.
 
 Cheers,
 
 tedd
 
 _
 t...@sperling.com
 http://sperling.com
 
 
 No - you meant to say per the form's TARGET attribute


No, I meant to say exactly what I said, namely ACTION.

The Target attribute deals with frames -- I have not done frames since 1995.

For a more in-depth Target explanation, please review:

http://www.htmlcodetutorial.com/forms/_FORM_TARGET.html

However, I do not think that is what is being discussed here -- at least it is 
not what I was talking about.

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



Re: [PHP] Open form in new window

2013-03-05 Thread Tedd Sperling

On Mar 4, 2013, at 3:17 PM, Paul M Foster pa...@quillandmouse.com wrote:

 On Mon, Mar 04, 2013 at 05:39:00PM +, Tim Streater wrote:
 
 On 04 Mar 2013 at 17:10, John Taylor-Johnston 
 john.taylor-johns...@cegepsherbrooke.qc.ca wrote: 
 
 button type=button onclick=OpenWindow()Submit/button will not
 submit the form contents.
 
 Nothing to stop your OpenWindow() function doing a submit as in:
 
 button type=button onclick=OpenWindow(this.form)Submit/button
 
 
 function OpenWindow (formPtr)
 {
 
 // Some actions
 
 formPtr.submit ();
 
 }
 
 
 
 Personally I never submit forms. I use ajax to communicate with PHP
 scripts and do something with the data that is returned by the script.
 You can see a simple example at http://www.clothears.org.uk
 
 --
 Cheers  --  Tim
 
 
 I'm trying to figure out where the net gain in that is. The PHP file
 being called via AJAX is doing its processing on the server either way.
 So it appears the only difference is an asynchronous Javascript/AJAX
 call or a synchronous PHP call (on a standard PHP form submission). What
 am I missing?
 
 Paul
 

Yes, I agree with Paul -- how about an example?

That way we can see what you are trying to do.

You see, I use ajax all the time to send all sorts of things to the server 
without refresh, but I am at a lost to figure out what you are doing.

Cheers,

tedd


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



Re: [PHP] PHP Web Developer Opportunity

2013-03-05 Thread Tedd Sperling

On Mar 4, 2013, at 3:10 PM, Allison Garcia agar...@smallworldlabs.com wrote:

 *SMALL WORLD LABS is looking for a PHP WEB DEVELOPER *
 
 Small World Labs is looking for a PHP Web Developer to be a part of our
 team. The position is focused on managing, supporting and expanding the
 Small World Labs social collaboration and online community platform. This
 role will interface with the product, support, professional services and
 client teams to provide technical guidance and drive future platform
 expansion. You will be responsible for both front  back-end development
 for the Small World Labs platform.
 
 We are looking for an intelligent, fast learner who can thrive in a high
 energy environment. Strong knowledge of PHP and the ability to work in a
 dynamic team are required.
 
 *Technical Background:*
 - PHP (the primary development language)
 - CSS, MYSQL, DHTML, Javascript, JQuery, AJAX
 - Web Services using SOAP or RESTful API
 - Mobile development
 - Understanding of version control systems
 - Familiarity with Linux or another UNIX OS is preferred
 
 *Required Experience:*
 - At least 3 years successful technical development experience
 - Proven ability to manage multiple projects in a fast paced environment
 - Ability to take ownership over development projects
 - Knowledge of online social and professional networks and developer
 interfaces
 - Strong communication skills, both written and verbal
 - Experience with requirements gathering
 
 *Education:*
 - Bachelors or graduate degree
 
 *Location:*
 - Austin, Texas
 
 Interested parties, please email your resume with the subject line PHP Web
 Developer to j...@smallworldlabs.com.
 
 *About Small World Labs*
 Small World Labs is an experienced provider of an online community and
 social collaboration platform that enables organizations to connect with
 their constituents in new ways. We help non-profit organizations understand
 how to engage with their members to drive loyalty, create opportunities,
 ignite conversations, distribute knowledge, and share experiences.

What are you offering?

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



Re: [PHP] Open form in new window

2013-03-05 Thread Tedd Sperling


On Mar 4, 2013, at 12:54 PM, John Taylor-Johnston 
john.taylor-johns...@cegepsherbrooke.qc.ca wrote:

 If you want to open a new page in response to a submit button press (using 
 PHP) you may be out of luck. I don't know of a way to do it without involving 
 another language. Opening a different page in the *same* window, yes. 
 Otherwise, no. But watch the other replies. Maybe someone knows something I 
 don't. Paul 
 Nope. Out of luck.

You mean opening a new page while keeping the current page open?

Because clicking a form submit *can* open a new page as per the form's 
action= attribute.

If you want the current page to remain open while another page opens, then 
you'll need a javascript routine to do it.

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



Re: [PHP] PHP Web Developer Opportunity

2013-03-05 Thread Tedd Sperling

On Mar 5, 2013, at 7:18 PM, Matijn Woudt tijn...@gmail.com wrote:
On Wed, Mar 6, 2013 at 1:16 AM, Tedd Sperling t...@sperling.com wrote:
 On Mar 4, 2013, at 3:10 PM, Allison Garcia agar...@smallworldlabs.com wrote:
 -snip-
 What are you offering?
 
 $2/hr.
 
 Oh, It's not Friday.. 

Is it more on Friday?

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



Re: [PHP] Introduction ... !

2013-03-02 Thread Tedd Sperling
On Mar 2, 2013, at 11:25 AM, Jay Blanchard jay.blanch...@sigmaphinothing.org 
wrote:

 No - Tedd is old. The rest of us are just Spring chickens.



Hey, let's watch that... a, what? What the hell was I saying???

Awww .. forget it.

Did I tell you about when I programed with rocks? That was before someone 
invented the absence of rock (a really abstract idea) and then things got mondo 
weird. We were finally able to build things that didn't always look like 
pyramids. You see, we had been stuck in Oh Oh Pyramids days, which we called 
OOP.

The more things change...

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



Re: [PHP] Introduction ... !

2013-03-02 Thread Tedd Sperling
On Mar 2, 2013, at 11:26 AM, Stuart Dallas stu...@3ft9.com wrote:
 On 2 Mar 2013, at 16:25, Jay Blanchard jay.blanch...@sigmaphinothing.org 
 wrote:
 
 No - Tedd is old. The rest of us are just Spring chickens.
 
 Speak for yourself, I'm an autumn turkey!
 
 -Stuart

What's this autumn nonsense?

tedd


_
t...@sperling.com
http://sperling.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Introduction ... !

2013-03-02 Thread Tedd Sperling
On Mar 2, 2013, at 2:20 PM, tamouse mailing lists tamouse.li...@gmail.com 
wrote:
 See, you can't really call yourself old until that's pooping and cramping...

That reminds me -- a couple of my older friends and I were discussing getting 
old.

One friend said At 8:00 am I have a terrible time taking a poop.

My other friend said -- At 8:00 am my problem is taking a piss.

I replied -- At 8:00 am I crap like a goose and piss like a race hoarse.

Both friends said: That doesn't sound bad -- what's the problem?

I told them Yeah, but I wake up at 9:00 am.

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



Re: [PHP] Finding an Address

2013-03-01 Thread Tedd Sperling
On Feb 28, 2013, at 12:36 PM, Floyd Resler fres...@adex-intl.com wrote:

 I have a project where my client would like to find the nearest street 
 address from where he current is.  Getting the longitude and latitude is easy 
 enough but I'm having a hard time finding out how to get the nearest house.  
 I have found a lot of solutions for addresses maintained in a database but 
 these addresses won't be in a database.  I thought about just querying Google 
 for each longitude and latitude within in a small circle but my math skills 
 are nowhere near good enough to accomplish that.  Anyone have any ideas?
 
 Thanks!
 Floyd

What about using zip codes?

Like so:

http://php1.net/a/zipcode/

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



Re: [PHP] if (empty versus if (isset

2013-02-20 Thread Tedd Sperling
On Feb 20, 2013, at 9:10 AM, Jim Giner jim.gi...@albanyhandball.com wrote:

 Basically it tells a savvy programmer whether or not his logic has caused the 
 var in question to exist.  Many times it is important simply to know that, 
 not what the var contains, which can lead to an error in processing.
 
 The isset() will tell you that yes, I have this variable, letting you then 
 correctly interpret the contents.  If a $_POST var is not set (meaning the 
 user made no input to it), the use of empty() will insist on telling you that 
 the var is empty even tho it really was not provided by the user (assuming 
 that you don't get an error msg for having an invalid index in the POST 
 array).
 
 They seem to be needlessly redundant, but in fact do provide knowledge for 
 those seeking it.
 

That's one of the reason why I recommend using a Ternary Operator to check the 
POST array, such as:

$submit = isset($_POST['submit']) ? $_POST['submit'] : null;

That way, you never encounter an error looking for something that is not there.

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



Re: [PHP] phpinfo()

2013-02-20 Thread Tedd Sperling
On Feb 19, 2013, at 7:57 PM, John Taylor-Johnston 
john.taylor-johns...@cegepsherbrooke.qc.ca wrote:

 I cannot find button2 in phpinfo() when I click it. I was hoping to find a 
 $_POST[button2] value.
 What am I doing wrong?
 
 input type=button name=button2 id=button2 value=Print Mode 
 onclick=formSubmit()
 
 I really wanted to use a button to pass a different condition than a input 
 type=submit

Lot's of different ways to pass values via forms.

Try using :

input type=hidden name=button2 value=2

Then check the button2 value via a:

$button2 = isset($_POST['button2']) ? $_POST['button2'] : null;

That's one way -- there are many more.

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



Re: [PHP] parsing select multiple=multiple

2013-02-20 Thread Tedd Sperling
On Feb 18, 2013, at 7:54 PM, John Taylor-Johnston 
john.taylor-johns...@cegepsherbrooke.qc.ca wrote:

 I am capable with select name=DPRpriority. (I suppose I did it correctly? 
 :p )
 But I haven't the first clue how to parse a select multiple and multiply 
 select name=DPRtype.
 Would anyone give me a couple of clues please? :)
 Thanks,
 John

John:

A clue? How about an example? 

See here:

http://sperling.com/php/select/index.php

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



Re: [PHP] phpinfo()

2013-02-20 Thread Tedd Sperling
On Feb 20, 2013, at 2:31 PM, Stuart Dallas stu...@3ft9.com wrote:
 You were given the answer, did you not try it?
 
 Starting with the code in your original post:
 
 1) Change the type to submit.
 2) Remove the onclick.
 3) Job done!
 
 -Stuart


Sometimes you just can't help.


 Sent from my leaf blower  :-)

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



Re: [PHP] Affordable low-fee e-commerce - DIY?

2013-02-18 Thread Tedd Sperling
On Feb 18, 2013, at 1:26 PM, George Langley george.lang...@shaw.ca wrote:

 Hi all. Am wanting to build a site where people can donate $1.00 but is not 
 for charity or other non-profit per se. So if I use PayPal, with their 2.9% + 
 .30 per transaction fee, that equals .33 cents for each dollar - that's a 
 full third of the amount the people would be giving. Credit cards appear to 
 be similar, with some percantage and about .22 cents per transactions.
 Am wondering what other options I'm missing, that won't take such a chunk out 
 of the low price? Is it easy enough to code to some other API for free (or at 
 least cheaper)?
 Thanks.
 
 
 George Langley
 Interactive Developer

I don't have any problems with people paying me via PayPal -- PayPal provides a 
service and they deserve a piece of the action.

In fact, I never have problems with people donating $5 to my cause (me) via my 
site -- and it happens. For example, I had one guy donate $100.

I'm waiting for someone to better that. :-)

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



Re: [PHP] Is header() malfunction due to PHP5.3.3 - 5.4.11 transition?

2013-02-09 Thread Tedd Sperling
On Feb 9, 2013, at 2:00 PM, Jonathan Eagle jeo...@attglobal.net wrote:

 I'm having a problem with a very straightforward routine; 


Jonathan:

No offense to your routine, but you may want to review this:

http://sperling.com/php/authorization/log-on.php

If anyone finds an error, please post.

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



[PHP] Strip emails from a document

2013-01-26 Thread Tedd Sperling
Hi gang:

I thought I had a function to strip emails from a document, but I can't find it.

So, before I start writing a common script, do any of you have a simple script 
to do this?

Here's an example of the problem:

Before:

Will Alex ale...@cit.msu.edu;Moita Zact za...@cit.msu.edu;Bob Arms 
ar...@cit.msu.edu;Meia Terms term...@cit.msu.edu;

After:

ale...@cit.msu.edu
za...@cit.msu.edu
ar...@cit.msu.edu
term...@cit.msu.edu

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



Re: [PHP] Strip emails from a document

2013-01-26 Thread Tedd Sperling

On Jan 26, 2013, at 12:20 PM, Daniel Brown danbr...@php.net wrote:
 
It's imperfect, but will work for the majority of emails:
 
 ?php
 function scrape_emails($input) {

 preg_match_all(/\b([a-z0-9%\._\+\-]+@[a-z0-9-\.]+\.[a-z]{2,6})\b/Ui,$input,$matches);
return $matches;
 }
 ?

It works imperfectly enough for me. :-)

Here's the result:

http://www.webbytedd.com/aa/strip-email/index.php

Thanks to all.

Cheers,

tedd

PS: Yes, 'extract is what I meant and more correct than 'strip' as I said.

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

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



Re: [PHP] Strip emails from a document

2013-01-26 Thread Tedd Sperling

On Jan 26, 2013, at 12:48 PM, shiplu shiplu@gmail.com wrote:

 What is your input?
 


Check my first email in this thread.

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



Re: [PHP] Pear Page2

2013-01-06 Thread Tedd Sperling
On Jan 5, 2013, at 4:24 PM, Silvio Siefke siefke_lis...@web.de wrote:
 
 What should me say this two words? You not use nano, ok. Editors enough
 on earth. Or you not write manually? Then share the way! Or use a CMS?

 Silvio:

You said --

 1.) All websites are created manually. (nano + html/css Tags)

-- and I replied Not mine. In other words, some of my web-sites are NOT 
created manually. They are dynamically generated from user input.

For example:

http://ancientstones.com

For the exception of the static First page, FAQ page, and Contact page, all 
other pages are generated from user input/direction.

I don't use nano (I don't even know what that is), but what I do is to create 
pages that pass W3C compliance and follow best practices. From what I've 
gathered from most frameworks I've reviewed, they have problems (similar to 
ASP) in mixing different languages in ways such that compliance with W3C and 
accessibility issues are difficult, if not impossible, to achieve.

Even CMS's have difficulty with compliance and accessibility issues because of 
the lack of knowledge of the user/client. I have clients who insist on CMS's, 
but then are clueless as to user issues and difficulties..

So, where does that leave a Web Developer? It leaves them with the 
responsibility to learn and apply what they learned to their craft. Is there an 
easy way out, such as to use a certain framework, or CMS, or other such 
attempts at minimizing the work involved? The answer is a simple  No.

Instead, you have to spend every waking hour learning and applying that 
knowledge with openness to the possibility that you still don't understand the 
problems involved -- it's a never ending battle to educate yourself.

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



Re: [PHP] Pear Page2

2013-01-06 Thread Tedd Sperling
On Jan 6, 2013, at 12:52 PM, Silvio Siefke siefke_lis...@web.de wrote:
 On Sun, 6 Jan 2013 11:36:39 -0500
 Tedd Sperling t...@sperling.com wrote:
 So, where does that leave a Web Developer? It leaves them with the 
 responsibility to learn and apply what they learned to their craft. 
 Is there an easy way out, such as to use a certain framework, or CMS, 
 or other such attempts at minimizing the work involved? The answer is 
 a simple  No.
 
 I simply asked a question, nothing more, nothing less. I looked for an 
 alternative. I do not need a web developer. I'm not a web developer. 
 I manage a few sites, most of my Customers are hosting customers.

No offense meant, but therein lies the problem. Two fold:

1. You asked a question without the intent to learn and practice.

2. By your own admission, you are not a web developer and as such you cannot 
use our advice.

This is similar to me asking about brain-surgery -- I don't know much about it, 
but I would be very reluctant to operate.

You also said:

 I'm just wondering, why write an email to the matter is insignificant.

On that point, I must agree -- I probably should not have answered. I should 
have seen you were having difficulties understanding what was being offered and 
passed on my contribution -- my apologies.

I also realize there is a language problem here -- while I cannot speak your 
language, what you say in mine and my replies, may be misinterpreted -- but in 
any case, no offense was meant.

I wish you well.

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



Re: [PHP] Pear Page2

2013-01-05 Thread Tedd Sperling
On Jan 5, 2013, at 3:11 PM, Silvio Siefke siefke_lis...@web.de wrote:
 On Sat, 05 Jan 2013 17:21:05 +
 Ashley Sheridan a...@ashleysheridan.co.uk wrote:
 
 If the pages are already written, why do you want to start changing 
 the way they've been built?
 
 1.) All websites are created manually. (nano + html/css Tags)
 

Not mine.

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



Re: [PHP] Boolean type forced on string assignment inside if statement

2013-01-03 Thread Tedd Sperling
On Jan 3, 2013, at 11:49 AM, Marc Guay marc.g...@gmail.com wrote:

 I just ran this:
 
 if (($a = foo) || ($b = bar)){
echo $a.br /.$b;
 }
 
 and it only spat out foo so I'm guessing things have changed.  :)
 
 Marc

Marc et al:

I joined late into this conversation, so I may be missing the point, but you 
want to discus strangeness try this:

?php

if (($a = 'foo') | ($b = 'bar'))// -- note the single pipe ( | 
)
{
echo $a br  $b;
}
else
{
echo 'Neither are populated';
}
?

However, the above practice of using one '=' is questionable -- the following 
is better.

?php

$a = 'foo';
$b = 'bar';

if (($a == 'foo') | ($b == 'bar'))
{
echo $a br  $b;
}
else
{
echo 'Neither are populated';
}

?

Comment out the variables to see how things work. Also change the number of 
pipes to see how things change.

To the more accomplished programmers reading this, here's a question:

What's the difference between using one pipe or two in an 'if' statement?  :-)

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



Re: [PHP] Boolean type forced on string assignment inside if statement

2013-01-03 Thread Tedd Sperling
On Jan 3, 2013, at 12:09 PM, David OBrien dgobr...@gmail.com wrote:
 From what I understood about || is once it sees a true the whole statement
 is regarded as true so nothing else following matters so PHP ignores
 everything in the conditional after it evaluates as true...
 and once it sees a false the whole statement is regarded as false so
 nothing else following matters again

You are correct with regard to the double pipe ( || ).

The double pipe means simply that if the first expression is true, then the 
second expression will not be considered.

Whereas, a single pipe ( | ) means that both expressions will be evaluated.

Now, I am not sure as to where that would mean anything. Can anyone provide an 
example where using a single pipe would produce different results than using a 
double pipe?

IOW, why is there a difference?

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



Re: [PHP] Nested loopa

2012-12-27 Thread Tedd Sperling
On Dec 26, 2012, at 10:09 AM, Jim Giner jim.gi...@albanyhandball.com wrote:

 While I fully understand the purpose of the do...while construct, I just 
 never get used to seeing it used. (in other langs I had to deal with a 
 'repeat...until construct and dis-liked that also).  I pretty much know if 
 I'm going to have to deal with a run at least once when I'm coding and 
 therefore code appropriately, altho I don't know in what ways I've handled it 
 at this very moment.
 -snip-
 To me - so much easier to comprehend at first glance.  As soon as my eye 
 comes to a block of code starting with a conditional like 'while', I readily 
 see what makes it tick.  Again I see the potential usefulness of doing it the 
 other way as you did in your example, but in your case there wasn't a need 
 for using 'do...while' since you structured it so that there was never a case 
 where you had to force the loop to happen regardless of conditions.

I too used while's instead of do's for the same reason.

However, in my class I had a student show be the light (one can always learn 
from beginners).

Think of it this way, you travel into the code knowing that at some point 
you're going to repeat the block of code IF a condition is going to be met 
within the block of code. With that consideration, the 'do/while()' works.

Using just a 'while()' for everything means you must determine the what the 
truth of the 'while()' is going to be AND set that value before the loop. 
Whereas, using a 'do/while()', you don't need to set the truth until the block 
of code has been implemented AND at that point determine the truth of the block 
of code.

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



  1   2   3   4   5   6   7   8   9   10   >