RE: [PHP] ms-word reading from PHP on linux O.S

2009-02-23 Thread Bob McConnell
From: Srinivasa Rao D
> 
>  * How better, i can  read ms-word doc files  from PHP on LINUX
OS*.On
> searching I got *catdoc* softaware.By using this i can read word doc
data as
> a text.

It would be helpful to have a little more context. What do you want to
do with the text you read this way?

When I run across a MS-Word document, my browser is configured to
download it to disk. Then I open it with OpenOffice.write and extract
what I need.

Bob McConnell

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



RE: [PHP] Re: multiple choice dropdown box puzzle

2009-02-23 Thread Bob McConnell
From: PJ
> 
> Here's my test page and, so far, nothing works...

Please expound on "nothing works...". What do you see in the browser?
What do you see in the server logs?

>  

You at least need a space between http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] help installing phpDocumentor

2009-02-24 Thread Bob McConnell
From: Jim Lucas
> 
> I may be wrong, but I heard short tags were going the
>  way of the Dodo bird as of PHP6.

This is not surprising. With the advent of XHTML, the short tag option
collides with another valid tag, "http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] help installing phpDocumentor

2009-02-24 Thread Bob McConnell
From: Lewis Wright
> 
> Turn on notices and maybe even strict messages (in your development
> environment), and PHP should warn you of any deprecated code.

Easier said than done. I don't have an IDE available. I have tried the
Komodo editor and am now playing with Eclipse/PDT, but neither of those
comes with a local interpreter.

My workstation is Win-XPPro and the development/test server is Apache
2.0.55 running on a RHEL 5 VM in an ESX server farm. Each project gets a
set of virtual domains and matching directories. There is also a unique
base directory for each code release, so I don't even know if I can
figure out how to map a debugger into that environment.

Currently I use WinSCP to copy files to my home directory and log in
with Putty to move them to the target directory. But it is running PHP
5.2.3, which I don't think will tell me much about the newer releases.

I have asked, but we don't have a process in place to update that.
Sometime in the _near_ future I have to investigate whether there are
security fixes since then that we should get.

Bob McConnell

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



RE: [PHP] Web Development work

2009-02-26 Thread Bob McConnell
From: Ernie Kemp
> 
> It seems to me that there must to other places a freelance Web
Developer
> fines work.
> 
> How do you find work in PHP Web programming? 
> Work a company, through this site and from God.
> 
> I wish to know more than handing out a business card.

1. Create a personal/business page on a local server. That page serves
as an advertisement and a sample of what you can do. Include a data
entry form for prospects to request your services and make sure it's not
susceptible to HTML or SQL injection.

2. Check with any local ISP or web server providers. See if they have a
referral service or help wanted section for customers that want help
updating or creating pages. While you're talking to them, find out what
services they offer and what tools are available on their servers. Make
sure you know how to use them.

3. Talk to the folks at Kinko's, Staples, etc. to see if they get
requests for help with web pages. Possibly they can pass out your cards
for you.

In my case there were two events that directed me into web development.
First, about 15 years ago I helped two friends set up a web site with a
specific purpose. It was all Perl, CGI and flat files at the time, but
it was useful experience. The effort died after three years because we
couldn't figure out how to make it pay for itself.

Second, after 20 years of designing embedded communications devices and
programming credit card terminals, my employer decreed all of those
devices to be legacy. But they had started moving some of those same
services over to the web. So I became a web developer. I am now doing
OJT for XHTML, CSS, Postgres, PHP, PCI DSS, Apache and RedHat Linux; all
at the same time. I have done three releases of a product that was
already online, but still have a long way to go. I figure another two
years to complete my apprenticeship.

Bob McConnell

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



RE: [PHP] Web Development work

2009-02-26 Thread Bob McConnell
Ooops, I forgot one.

0. Invest some time studying the top 25 errors list from either SANS
<http://www.sans.org/top25errors/> or CWE <http://cwe.mitre.org/top25/>.
Make sure you don't have _any_ of them in your code. (This list includes
and extends the OWASP guidelines
<http://www.owasp.org/index.php/Main_Page>.)

Bob McConnell

-Original Message-----
From: Bob McConnell 
Sent: Thursday, February 26, 2009 8:58 AM
To: php-general@lists.php.net
Subject: RE: [PHP] Web Development work

From: Ernie Kemp
> 
> It seems to me that there must to other places a freelance Web
Developer
> fines work.
> 
> How do you find work in PHP Web programming? 
> Work a company, through this site and from God.
> 
> I wish to know more than handing out a business card.

1. Create a personal/business page on a local server. That page serves
as an advertisement and a sample of what you can do. Include a data
entry form for prospects to request your services and make sure it's not
susceptible to HTML or SQL injection.

2. Check with any local ISP or web server providers. See if they have a
referral service or help wanted section for customers that want help
updating or creating pages. While you're talking to them, find out what
services they offer and what tools are available on their servers. Make
sure you know how to use them.

3. Talk to the folks at Kinko's, Staples, etc. to see if they get
requests for help with web pages. Possibly they can pass out your cards
for you.

In my case there were two events that directed me into web development.
First, about 15 years ago I helped two friends set up a web site with a
specific purpose. It was all Perl, CGI and flat files at the time, but
it was useful experience. The effort died after three years because we
couldn't figure out how to make it pay for itself.

Second, after 20 years of designing embedded communications devices and
programming credit card terminals, my employer decreed all of those
devices to be legacy. But they had started moving some of those same
services over to the web. So I became a web developer. I am now doing
OJT for XHTML, CSS, Postgres, PHP, PCI DSS, Apache and RedHat Linux; all
at the same time. I have done three releases of a product that was
already online, but still have a long way to go. I figure another two
years to complete my apprenticeship.

Bob McConnell

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



RE: [PHP] "use strict" or similar in PHP?

2009-02-27 Thread Bob McConnell
From: Hans Schultz
> 
> Hahahah,I was thinking the same thing :D
> 
> --- On Fri, 2/27/09, Ashley Sheridan  wrote:
> From: Ashley Sheridan 
> Subject: Re: [PHP] "use strict" or similar in PHP?
> To: "Hans Schultz" 
> Cc: php-general@lists.php.net, "9el" 
> Date: Friday, February 27, 2009, 1:11 PM
> 
> On Fri, 2009-02-27 at 14:04 +0100, Hans Schultz wrote:
>> Sorry, I didn't want to offend anyone :-) It was just very weird
> argument  
>> - to quote:
>> "There is no "compile" time.  PHP is interpreted so it is
> compiled and  
>> then executed."
>> Sounds like contradiction in this very sentence :-).
>> 
>> My apologies
>> 
> But if it never compiles, it can never run, but it can't run without
> compiling? Arggh, my head. So does that mean if I go back in time and
> shoot my grandfather, then nobody is in the woods to hear PHP try to
> compile?

The compile process parses the text of the source file and translates it
into an alternate form. This can by byte code, ala Pascal and Java, or
executable code, ala COBOL and C. An interpreter, on the other hand,
simply parses the source file, line by line and executes each line as it
reads it, usually without saving it in an alternate form. This is the
way JavaScript works. Some languages, such as Perl, are somewhere
between the two. Perl parses the whole file, then executes only if it
did not find any syntax errors or undefined variables (if certain
strictures are turned on). Otherwise it prints out only the error
message.

>From what I have seen of PHP, it is strictly interpreted. i.e. a line is
read, and executed. Then the next line is read, and executed. etc. So
there is no way to get it to block execution from the beginning even
when there are fatal errors. It will already have printed out as much of
the page as it executed before it finds those errors. This works fine in
a development or test environment, but is a serious problem in
production.

So, I believe the question that was actually asked, is there any way to
induce PHP to completely parse the source file(s) and report any errors
before printing out anything, even the HTTP headers? Or can I set it to
redirect to an error page instead of sending an incomplete target page
with error messages that might reveal information I don't want exposed?

Bob McConnell

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



[PHP] Development methods (was: "use strict" or similar in PHP?)

2009-02-27 Thread Bob McConnell
From: Boyd, Todd M.
> Well, take care of all of your logic before you display anything. It's
> not that difficult, to be honest... especially if you're already using
> an MVC design pattern/framework or a template system.

That's an interesting string of buzzwords, but it carries no meaning for
me. Would you care to elucidate further?

As far as the code I am working with, I inherited over 160 files of
mixed HTML and PHP, where the logic and presentation are intermingled
(mangled) throughout. My initial toolset was TextPad4, WinSCP and Putty
on a WinXP workstation, with Apache on RHEL 5 as the server. (The
original coder used vi on a clone of the server until they took it away
from him.) The chances of re-implementing the entire project are roughly
equivalent to a zero with the edges rubbed out. I already have a six
month to-do list just adding the new features already requested by
current clients.

Bob McConnell

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



RE: [PHP] How important is your Express or Web Edition database? Please weigh in--

2009-02-27 Thread Bob McConnell
From: sstadel...@gmail.com
> 
> Answering these 10 multiple choice questions--should take about 90
> seconds--will help us understand what databases you need in your
> professional life, and how to deliver them to you.

Put it on a site that doesn't require blindly enabling JavaScript and I
might be able to help.

On the other hand, I had never heard of that product, so we're probably
not using it. We do currently support Sybase ASA, Oracle, PosgreSQL and
SQL Server.

Bob McConnell

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



RE: [PHP] Re: whoami explanation

2009-03-03 Thread Bob McConnell
From: PJ
> 
> What is not clear to me is why would I need to use a shell? What kind
of
> situations call for it's use?

It's a matter of expectations. I am still trying to figure out why
anyone would want a GUI on any version of Unix or Linux. They just slow
me down and make it very difficult to do any real work.

Bob McConnell

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



RE: [PHP] Sending out large amounts of email

2009-03-06 Thread Bob McConnell
From: Chris
> Brian Hansen wrote:
>> 2009/3/6 Chris mailto:dmag...@gmail.com>>
>>  
>> 
>> What about 10,000?
>> 
>> 
>> I haven't been able to send out more than 6000 at most. It is
proberly 
>> caused by a limit set in Postfix as you wrote.
> 
> If you're sending emails one by one in a mail() call there is no limit

> (one email per recipient)
> 
> If you're trying to cc or bcc the email addresses, then there probably

> is a limit.

You should also talk to your ISP and email admins to find out how to
avoid ending up on a SPAM blacklist after sending out that many emails.
You're likely to trigger more than one automatic listing with that many
messages.

Bob McConnell

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



RE: [PHP] Error in Building an XML File

2009-03-09 Thread Bob McConnell
From: Joe Harman
> 
> I am using PHP to build an XML file, but I keep on getting an XML
> error when open the file in Google Chrome.
>

-
> This page contains the following errors:
> 
> error on line 30 at column 318: Entity 'iuml' not defined
> Below is a rendering of the page up to the first error.
>


> 
> is this something to do with document encoding?

Entity errors are almost always caused by a bare ampersand in a URL. You
need to convert them to &. Since this error occurs, there may also
be other errors in the encoding. You need to read up on URL and HTML
sanitization.

Bob McConnell

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



RE: [PHP] Re: PHP includes

2009-03-09 Thread Bob McConnell
From: Gary
> 
> Thank you to everybody that replied...but it almost seems it is making
extra 
> work.
> 
> I can understand using an include for a menu, since they tend to
change 
> often and it is on every page, but the normal content I am not
understanding 
> the benefit.  If I have a page that has unique content on it, that is
to say 
> no other page has this content, why would I want to create a separate
file 
> to be included on the page, why would I not simple put the content
directly 
> on the page itself?
> 
> What is the best type of file to be used as an include (.txt, .php).
> 

We include template files for the  block, a banner across the top
of every page, the footer across the bottom, the menu and images in the
left sidebar, and the advertisement banners across the top and bottom.
Even the core section of each page is included from the initial file.
That way we can change the appearance, or modify the links to our
disclaimers and help files just once and every page gets updated. We
also have configuration flags to prevent some of those files from being
included in a specific virtual domain, so our clients can provide their
own templates instead of using ours.

File extensions for includes are up to you. Just make sure your
IDE/Editor know that they are PHP files. We use .lia for the libraries
of functions we use throughout the site. None of our files have .php as
the extension.

Bob McConnell

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



RE: Re: [PHP] stdin, stdout, stderr, 3

2009-03-09 Thread Bob McConnell
From: Per Jessen
> Daniel Brown wrote:
> 
>> On Sun, Mar 8, 2009 at 22:35, Richard Lynch  wrote:
>>> I have a program sending/receiving data to/from my CLI script using:
>>>
>>> 0 stdin
>>> 1 stdout
>>> 2 stderr
>>> 3 ??
>> 
>> UNIX Channel 3 is a non-standard stream resource, though I don't
>> believe it's even yet been given a name, so we'll have to change
that.
> 
> "UNIX Channel 3" ?? 
> It's just file descriptor 3, that's all. In the old days, it was
> occasionally called "stdaux", but AFAIK that's not used any more. 

AUX and PRN for 3 and 4 were standard for a serial port and printer
interface respectively on CP/M and then PC-DOS 1.0. Both were carried
through to later versions of MS-DOS, but not used nor referenced very
much. I don't recall seeing them in a Unix context at all.

Bob McConnell

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



RE: [PHP] Retrieving Image Location in PHP from MySQL

2009-03-09 Thread Bob McConnell
From: Sashikanth Gurram
> 
> Hi,
> Thanks a lot for all the patient replies. All the suggestions led me
in 
> a positive direction. Finally, instead of using the header() in my
main 
> PHP file (with HTML tags), I have used it in a secondary file and
called 
> it using  a tag. It is working fine. But, the 
> image I need to display is also dynamic and needs a user input. So, is

> there any way in which I can transfer a particular variable (the user 
> input) from my main php file (say A.php) to my secondary file
containing 
> the header () (say B.php)

Well, you are really trying to use one page to do two different tasks.
First to display the input form, then to show an image selected by that
input. So, either you need two code paths, or two pages. You can start
off by checking the input fields and if they are empty, simply display
the form. Then the next time through, when the fields are populated,
insert the selected image.

Bob McConnell

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



RE: [PHP] [PHP & MySQL] Introduction to using relational databases

2009-03-10 Thread Bob McConnell
From: Dirk
> Thilo Klein wrote:
>> Dear readers,
>> 
>>I am new to relational DB but not to MySQL & PHP in general. I 
>> created a RDB using  Struggling with the program's 
>> complexity I managed to create a set of databases being
interconnected 
>> via (foreign) keys.
>> 
>>What I want to know is how to use this database via php. How does
my 
>> ER-Diagram come into play? In other words I want to know more about a

>> general approach to using relational databases via php.
> 
> well you export the db you designed into ansi sql and use the cmdline 
> mysql client to create a db with it...
> 
> this guide
> 
>
<http://www.databasejournal.com/features/mysql/article.php/1469211/Using
-a-MySQL-database-with-PHP.htm>
> 
> seems ok on the first look..

Is there a Postgres translation of this or other DB articles available?

Bob McConnell

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



RE: [PHP] Include File Errors with Comments

2009-03-11 Thread Bob McConnell
From: Patrick Moloney
> 
> I have a simple web site with a simple page that all works well, 
> although I have had a similar problem a couple of times that seems to
be 
> caused by Comment Lines in the included files. I wonder if I have it 
> entirely right.
> All my files are .php files, but almost all the code is HTML.
> The file for my Web page is a complete HTML document, the file is
.php. 
> The web page file "Includes" a few other files by putting the Include 
> statement in PHP tags, all by itself. The problem file contains the
menu 
> as the include. I made a change to the menu, that works, but I added a

> line with a comment at the top, which causes problems. The menu is
read 
> like text.
> The first few lines in my menu file, menu.php, are comments using HTML

> syntax. The menu file has on UL and LI tags for the menu items - no 
> HTML, BODY etc. So I have a line of PHP in my web page file calling a 
> .php file where the first 2 lines are HTML comments. It was working
with 
> 2 comment lines, the failed with 3 lines. Even when it fails the 
> remainder of the page displays ok although it is down lower because of

> the menu being displayed as text. I remove the comment it works.
> 
> Does PHP preprocess the file but treat the comments as text because I 
> never said it was HTML? Would PHP comments have to be inside PHP tags?
> Am I correct in having just a fragment of HTML in the included file 
> without the entire HTML organization? I'd like to have comments in the
file.

This is one detail that I have not seen a good explanation for. When PHP
opens an included file, it defaults back to HTML mode. You must have the
PHP tags to force it into PHP mode. This is true no matter what file
extension you have on them. So if you want to use PHP style comments,
you must wrap them with the proper tags.

Bob McConnell

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



RE: [PHP] Knowledge Base software - looking for opinions

2009-03-13 Thread Bob McConnell
From: haliphax
> On Thu, Mar 12, 2009 at 3:44 PM, Paul M Foster
 wrote:
>> On Thu, Mar 12, 2009 at 12:55:54PM -0700, mike wrote:
>>
>>> http://puresw.com/products/lore/ - paid
>>> http://www.knowledgebase-script.com/ - paid
>>> http://68kb.com/ - free
>>>
>>> Free is good.
>>>
>>> Just needs to be basic, nothing crazy.
>>>
>>> A Wiki -almost- meets the needs but a) I hate wikis and b) they
don't
>>> match up 100%
>>
>> Out of curiosity, why do you dislike wikis?
> 
> It may be the lack of access permissions in a lot of the wiki systems
> out there right now... though some of them have an access control
> layer (such as TWiki).

Dokuwiki <http://wiki.splitbrain.org/wiki:dokuwiki> has an optional ACL
layer for access control. There are also several options for
authentication back ends. We used it in a grass roots project for over a
year before management decide it was a good idea and bought a site
license for Confluence as the official company wide knowledge base. I
was trying to get the LDAP interface working with Active Directory when
they informed me it was going to be phased out.

Bob McConnell

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



RE: [PHP] Smarty Tips and Techniques

2009-03-18 Thread Bob McConnell
That looks nice, but how do I get to the point where I can understand
how to use it?

I have also looked at the Smarty site <http://www.smarty.net/>, but
their documents assume significant experience in building and using
templates.

Where can I find guidance or tutorials on how to do all of this,
starting with only a rudimentary knowledge of HTML and PHP. It would be
best if they also focused on procedural rather than object oriented
code.

Bob McConnell

-Original Message-
From: Virgilio Quilario [mailto:virgilio.quila...@gmail.com] 
Sent: Wednesday, March 18, 2009 10:36 AM
To: php-general@lists.php.net
Subject: [PHP] Smarty Tips and Techniques

Hi list,

Just wanna share my collection of Smarty scripting tips and techniques.
Smarty is a template engine for PHP that you can use to separate data
and logic from web design.
This way programmers can work on the php scripts and designers can
work on the templates for the same web site.

Here is the link:
http://www.jampmark.com/php-programming/16-very-useful-smarty-scripting-
tips-and-techniques-to-make-templates-smarter.html

Hope you find it useful.

Virgil

-- 
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] Calendar/Date

2009-03-18 Thread Bob McConnell
From: Paul M Foster
> On Tue, Mar 17, 2009 at 08:52:11PM -0700, Jason Todd Slack-Moehrle
wrote:
> 
>> Hi All,
>>
>> Does anyone have code and/or advice for how to get get the current
>> week (with a passed current day, say) and what then end date is at
>> Saturday.
>>
>> So take today: Tuesday March 17, 2009
>>
>> I want to get:
>> Sunday March 15, 2009
>> Monday March 16, 2009
>> Tuesday March 17, 2009
>> Wednesday March 18, 2009
>> Thursday March 19, 2009
>> Friday March 20, 2009
>> Saturday March 21, 2009
> 
> I just answered a question similar to this. You might check the
> archives. In this case, you'll need to use the getdate() function (see
> php.net/manual/en/ for details) to get the array of values for today
> (like the day of the month, month number, year, etc.). The getdate()
> function returns an array, one of whose members is 'wday', which is
the
> day of the week, starting with 0 for Sunday. Use that number to
> determine how many days to go back from today. Then use mktime() to
get
> the timestamps for each day in turn. You feed mktime() values from the
> getdate() call. Then you can use strftime() or something else to print
> out the dates in whatever format, given the timestamps you got.
> 
> Be careful in feeding values to mktime(). If your week spans a
> month or year boundary, you'll need to compensate for it when giving
> mktime() month numbers, day numbers and year numbers.

You also need to be aware that on 32 bit Unix and Linux systems the
behavior of mktime() on dates after Jan 18, 2038 is undefined. The 32
bit counter overflows early on the 19th, so any value returned is
invalid. This is not a problem on 64 bit systems.

We ran into this recently because Support was defining "never expire" as
Today plus 30 years. A couple of sites started reporting problems about
two months ago.

Bob McConnell

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



RE: [PHP] Calendar/Date

2009-03-18 Thread Bob McConnell
From: Paul M Foster
> On Wed, Mar 18, 2009 at 11:46:31AM -0400, Bob McConnell wrote:
>> 
>>> You also need to be aware that on 32 bit Unix and Linux systems the
>> behavior of mktime() on dates after Jan 18, 2038 is undefined. The 32
>> bit counter overflows early on the 19th, so any value returned is
>> invalid. This is not a problem on 64 bit systems.
>> 
>> We ran into this recently because Support was defining "never expire"
as
>> Today plus 30 years. A couple of sites started reporting problems
about
>> two months ago.
> 
> This is why I normally never use the time functions in PHP. Instead, I
> wrote a date class that uses Julian days internally and doesn't
consult
> PHP time functions. When I need some odd thing (like the date for the
> end of the week), I just add it as a member to the date class. Plus,
> PHP's date objects are woefully unfeatureful. If someone asks on the
> list for a solution, I can use the PHP time functions for advising
them,
> but I don't personally use them.

Unfortunately, this code was initially inherited from another project
and already had mktime() based date calculations throughout (in 19 of
162 files). I'm the fourth programmer to work with this project and now
have to correct these problems. There are several other programmers who
have to correct it in their projects as well. None of us wrote the
original code, so we are all in the same boat. No matter what we want,
we can't just replace code wholesale because of the testing overhead and
other task priorities. We can only fix it after it becomes recognized as
a problem.

The other issue is that I don't do OOP. After 30 years of writing
procedural code, mostly assembler, PL/M and C, I simply don't see the
point of OO, nor can I justify the additional overhead. I have written
functions that others converted into methods, and occasionally re-use
functions that were written as methods, but have never used a whole
class.

Bob McConnell

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



RE: [PHP] Dynamic Form 'on The Fly'

2009-03-18 Thread Bob McConnell
From: revDAVE
> 
> Using a repeating region of a query, I want to generate a 'form on the
fly'
> 
> So for each repeat - I have an extra form input
> 
> Each input name = thisline
> 
> So it will make names like:
> 
> thisline1
> thisline2
> thisline3
> Etc.
> 
> For the form fields
> 
> -
> 
> $cnt = 1;
> 
> 
> Repeat.
>  
>  maxlength="5" />
> 
>  
> 
> Repeat..
> 
> 
> 
> Q: how do I code the POST line to READ this when processing this form?
> 
> like:
> 
> $cnt = 1;
> 
>    Doesn't work...?
>   Doesn't work...?
> 
> Not this either...
> $this = 'thisline'.$cnt;
> echo $_POST['$this'];
> 
> 
> $cnt++
> 
> Q: ANY Ideas?

For a text field, you use the name attribute (or id for xhtml), so how
about:

  $_POST['go'.$cnt]

I think $_POST['go$cnt'] might also work.

Bob McConnell

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



RE: [PHP] Smarty Tips and Techniques

2009-03-19 Thread Bob McConnell
From: Virgilio Quilario
>> That looks nice, but how do I get to the point where I can understand
>> how to use it?
>>
>> I have also looked at the Smarty site <http://www.smarty.net/>, but
>> their documents assume significant experience in building and using
>> templates.
>>
>> Where can I find guidance or tutorials on how to do all of this,
>> starting with only a rudimentary knowledge of HTML and PHP. It would
be
>> best if they also focused on procedural rather than object oriented
>> code.
> 
> 
> When I started learning smarty, I spent most of my time doing research
> and that's really tiresome and it is so hard to find examples.
> Experimented a lot and listed those what's possible, then applied them
> to my projects.
> 
> Now to make them handy I posted them to my site so i can have a look
> whenever and wherever.
>
http://www.jampmark.com/php-programming/16-very-useful-smarty-scripting-
tips-and-techniques-to-make-templates-smarter.html
> 
> As a first step, maybe you should see the crash course at smarty
> http://www.smarty.net/crashcourse.php

Hi Virgil,

After your last post here, I looked at your site, then the Smarty site.
That was what triggered this question. Templates are a black art to me.
I don't even know where to begin to understand them. Every reference I
have looked at so far assumes that I already understand the MVC pattern,
which is also one of the dark arts.

Let me put it simply. I can't grok OO. I tried to do OOP for several
years, but it simply does not make any sense to me. As a direct result,
I don't understand the concept nor application of patterns. So how do I
figure out how to use templates without having to absorb those first?
Can I learn enough this way to determine if a site can be converted from
the current state (PHP and XHTML spaghetti) into templates and begin
that transformation?

Thank you,

Bob McConnell

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



RE: [PHP] Smarty Tips and Techniques

2009-03-19 Thread Bob McConnell
From: Bastien Koert
> On Thu, Mar 19, 2009 at 11:06 AM, Bob McConnell  wrote:
> 
>   From: Virgilio Quilario
>   >> That looks nice, but how do I get to the point where I can
understand
>   >> how to use it?
>   >>
>   >> I have also looked at the Smarty site
<http://www.smarty.net/>, but
>   >> their documents assume significant experience in building and
using
>   >> templates.
>   >>
>   >> Where can I find guidance or tutorials on how to do all of
this,
>   >> starting with only a rudimentary knowledge of HTML and PHP.
It would
>   be
>   >> best if they also focused on procedural rather than object
oriented
>   >> code.
>   >
>   >
>   > When I started learning smarty, I spent most of my time doing
research
>   > and that's really tiresome and it is so hard to find examples.
>   > Experimented a lot and listed those what's possible, then
applied them
>   > to my projects.
>   >
>   > Now to make them handy I posted them to my site so i can have
a look
>   > whenever and wherever.
>   >
>
http://www.jampmark.com/php-programming/16-very-useful-smarty-scripting-
>   tips-and-techniques-to-make-templates-smarter.html
<http://www.jampmark.com/php-programming/16-very-useful-smarty-scripting
-tips-and-techniques-to-make-templates-smarter.html> 
>   >
>   > As a first step, maybe you should see the crash course at
smarty
>   > http://www.smarty.net/crashcourse.php
>   
>   Hi Virgil,
>   
>   After your last post here, I looked at your site, then the
Smarty site.
>   That was what triggered this question. Templates are a black art
to me.
>   I don't even know where to begin to understand them. Every
reference I
>   have looked at so far assumes that I already understand the MVC
pattern,
>   which is also one of the dark arts.
>   
>   Let me put it simply. I can't grok OO. I tried to do OOP for
several
>   years, but it simply does not make any sense to me. As a direct
result,
>   I don't understand the concept nor application of patterns. So
how do I
>   figure out how to use templates without having to absorb those
first?
>   Can I learn enough this way to determine if a site can be
converted from
>   the current state (PHP and XHTML spaghetti) into templates and
begin
>   that transformation?
> 
> Bob,
>  
> You really would need to learn those concepts first OOP / MVC. There
is
>  a learning curve, but you really don't need OOP to be able to do an
MVC
>  style application, but it does make the code neater. 
>  
> One of the books that really helped me grok OOP is Head First
OOP...another
> is Martin Fowlers Patterns of Enterprise Architecture. 
> 
> The MVC pattern is explained well in a number of places, but worth
>  checking out are both the cakephp framework site and the codeingniter
site.
>  
> You'll find that there are people from both camps here, pure OOP and
other
> just as happy with procedural coding styles. Many use both, using
objects
> to handle common tasks like DB interaction or filesystem processes.

Yes, I have to deal with both camps here as well. Of five developers
doing PHP at the moment, two are primarily using OOP. But I spent 3.5
years as part of a team developing MS-Windows services in C++. After all
that time, I was only able to write basic functions for others to
convert into methods or classes. I could eventually find my way around
in some of those classes, but it seemed that every time I figured out
what was where, somebody "refactored" a major component and I had to
start all over again. All I saw was a lot of unnecessary overhead and
obfuscation which made little sense in the long run and slowed down both
the development and the application. The result was a handful of DLLs
that are shared between several products, and each time anything is
changed in one of them, every product needs to be retested to make sure
nothing got broke and some have to be recertified for PCI-DSS as well.

So you are telling me that I can forget about trying to use templates.
Since I can not understand OOP, there is no chance I will be able to use
them.

Just knowing that will probably save me several weeks of frustration.

Thank you,

Bob McConnell

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



RE: [PHP] Smarty Tips and Techniques

2009-03-19 Thread Bob McConnell
From: Shawn McKenzie
> Bob McConnell wrote:
>> From: Virgilio Quilario
>>>> That looks nice, but how do I get to the point where I can
understand
>>>> how to use it?
>>>>
>>>> I have also looked at the Smarty site <http://www.smarty.net/>, but
>>>> their documents assume significant experience in building and using
>>>> templates.
>>>>
>>>> Where can I find guidance or tutorials on how to do all of this,
>>>> starting with only a rudimentary knowledge of HTML and PHP. It
would
>> be
>>>> best if they also focused on procedural rather than object oriented
>>>> code.
>>>
>>> When I started learning smarty, I spent most of my time doing
research
>>> and that's really tiresome and it is so hard to find examples.
>>> Experimented a lot and listed those what's possible, then applied
them
>>> to my projects.
>>>
>>> Now to make them handy I posted them to my site so i can have a look
>>> whenever and wherever.
>>>
>>
http://www.jampmark.com/php-programming/16-very-useful-smarty-scripting-
>> tips-and-techniques-to-make-templates-smarter.html
>>> As a first step, maybe you should see the crash course at smarty
>>> http://www.smarty.net/crashcourse.php
>> 
>> Hi Virgil,
>> 
>> After your last post here, I looked at your site, then the Smarty
site.
>> That was what triggered this question. Templates are a black art to
me.
>> I don't even know where to begin to understand them. Every reference
I
>> have looked at so far assumes that I already understand the MVC
pattern,
>> which is also one of the dark arts.
>> 
>> Let me put it simply. I can't grok OO. I tried to do OOP for several
>> years, but it simply does not make any sense to me. As a direct
result,
>> I don't understand the concept nor application of patterns. So how do
I
>> figure out how to use templates without having to absorb those first?
>> Can I learn enough this way to determine if a site can be converted
from
>> the current state (PHP and XHTML spaghetti) into templates and begin
>> that transformation?
> 
> You don't need OOP to use templates.  Smarty is OOP. but there are
some
> lighter faster template solutions, as well as just creating your own
> templates  that you either parse and replace vars in or just use PHP
> code.  As long as you keep the PHP in your templates display oriented
> and not business/app logic based then it should be a nice solution.
> 
> You might also look at a framework (codeignitor, cakephp) and go
through
> their tutorial, though these are undoubtedly MVC/OOP, it may make more
> sense once you start building something with it.

Well, I installed CodeIgniter on one of my home servers last night, but
have not yet started through the manual. That will be an interesting
experiment. I am hoping to create a simple recipe management system
there, similar to ReciPants, but in PHP.

At work the problem is more basic; 162 files of interleaved database
access, business logic and presentation, all written by a civil
engineering student with no software training at all. He has moved on,
but five of us working on three products are now dealing with the mess
he left behind.

Thank you,

Bob McConnell

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



RE: [PHP] Smarty Tips and Techniques

2009-03-19 Thread Bob McConnell
From: Bastien Koert
> Just 162 files? I don't mean to sound condescending but if the code
> is that much trouble, chuck it out and start over.

Not going to happen. There are too many other tasks in the backlog that
are more important and will bring in real money as opposed to just
making the developers' lives easier. In addition, the current
application has already passed the PCI Level 1 audit, has been deployed
and is now handling a thousand transactions per day. If I can slip the
changes in piecemeal with those other tasks, fine, but starting over is
not even an option.

All three products combined are processing more than 10K transactions
per day. That spells success as far as management is concerned. With a
long list of client requested enhancements already assembled, code
maintenance issues are not even open for discussion.

Bob McConnell

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



RE: [PHP] Smarty Tips and Techniques

2009-03-19 Thread Bob McConnell
From: Robert Cummings
>On Thu, 2009-03-19 at 12:14 -0400, Bob McConnell wrote:
>> From: Bastien Koert
>> > On Thu, Mar 19, 2009 at 11:06 AM, Bob McConnell 
wrote:
>> > 
>> >From: Virgilio Quilario

Most discussion clipped for brevity

> // OOP
> 
> class DbFireman extends DbPerson
> {
> private $fireman;
> 
> function DbPerson( $id )
> {
> parent::__constructor( $id );
> $this->fireman = load_stuff_for_fireman_from_db();
> }
> 
> function getStationId()
> {
> return $this->fireman['stationId'];
> }
> 
> function setName( $name )
> {
> $this->fireman['stationId'] = $stationId;
> }
> }
> 
> $fireman = new DbFireman( 1234 );
> $fireman->setStationId( 'Bob' );
> echo $fireman->getStationId();
> 
> ?>
> 
> So as you can see they're almost identical except that the OOP version
> of fireman didn't need to redeclare functions. True you could have
> skipped doing that if you just used the person functions, but then you
> may introduce onconsistencies. Additionally, the class version ensures
> that the methods applied are those bleong to the concept of "fireman"
> whereas passing data structures around can easily get confusing,
> especially if you choose to allow the person functions to be applied
to
> the fireman. Going futher, using OOP let's you do all sorts of generic

Hi Rob,

Unfortunately, you still don't understand the problem I have. While it
takes a while to puzzle out the details, I don't have any trouble
reading, understanding or debugging code like this, even though you
skipped completely over several major components (*). I have even
modified existing methods and made minor adjustments to classes, _once
they have been written_.

What I can't do is take a problem description and turn it into classes
that will actually solve the problem. I can usually turn it into
procedures relatively quickly. I can and have built real-time,
multi-tasking and multi-threaded applications on a variety of kernels
and operating systems with no significant trouble. I have written device
drivers, interrupt service routines, message queues and I/O buffering
routines without spending a lot of time thinking about them.

But defining objects and then figuring out how to create and use them
completely escapes me. My mind simply won't map a problem into objects,
it only sees procedures. Even when I look at classes, they resolve only
as loose groupings of functions and variables, not as unified
components.

If anyone knows how to fix that, please tell me. In the meantime, in my
continuing effort to eschew obfuscation, I will stick with procedural
programming.

Bob McConnell

(*) For example, "$this->" suggests you have added an array of pointers.
Some are pointers to functions (aka methods) others are pointers to
variables (aka members). But there is no indication where this array
came from, what it means, nor how it affects the code structure. From
experience I know that "$this->" is not always needed, but the C++ rules
for when it is or isn't are neither clear nor consistent. There are no
declarations nor assignments for it. It simply adds another level of
obfuscated dereferencing that needs to be done in my head to understand
what is going on.

You also failed to explain what "new" does, or "parent::__constructor".
What is the relationship between a class and an object? I get frustrated
because of the extra overhead required to instantiate an object with its
members before they can be referenced, instead of simply being able to
use them at any time from anywhere in my code. Likewise, having to pass
a pointer for one object to another object before the second can call
the first is also counter-intuitive. They're all part of the same
application, why doesn't the compiler take care of those details like it
should?

Obviously, I don't expect answers for these questions, but hopefully
this will give you a better understanding of the greater issues
involved. This is a far cry from the Fortran IV I was taught in college
40 years ago. B.M.

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



RE: [PHP] Web Development/Application Analysis

2009-03-22 Thread Bob McConnell
From: Stuart
> 
> Now that's done, it's Mothers Day here in jolly old England, and I
> have a phonecall to make!

Hi Stuart,

Thank her for us while you're on that call. You turned out pretty well,
so I think she done good.

Bob McConnell

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



RE: [PHP] Proper code formatting

2009-03-23 Thread Bob McConnell
From: Michael A. Peters
> Angus Mann wrote:
>> Hi all, I'm fairly new to PHP so I don't have too many bad habits
yet.
>> 
>> I'm keen to make my code easy to read for me in the future, and for 
>> others as well.
>> 
>> Are there any rules or advice I can use for formatting (especially 
>> indenting) code?
>> 
>> for example how best to format / indent this ?
>> 

> 
> To each his own. Whatever floats your canoe.
> Just whatever you pick, stick to it throughout your code.
>> 
>> 
>> I'm using "PHP designer 2008" which does syntax coloring but if it
has 
>> something to automatically indent - I haven't found it yet.
> 
> It probably allows you to either set a specify a tab as a real tab or
a 
> specified number of spaces. Auto-indenting - this isn't python, the 
> compiler doesn't enforce it's way, you follow the convention of the 
> project you are working on - so I suspect many php editors tailored to

> php don't have an auto indent.
> 
> I've never of course tried that specific product. I use bluefish, vi, 
> and emacs.

To take this question a step further, is there a PHP best practices
document available? I am looking for one that I can give to a new
programmer and tell her "do it this way until you can explain to me why
you shouldn't."

Bob McConnell

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



RE: [PHP] Re: So called "PHP Expert"

2009-03-23 Thread Bob McConnell
From: Eduardo
> 
> No, please!
> In some districts of the world, "license" means "bribe".
 
You misspelled "most". In a lot of cases it is simply disguised as union
or association dues or as a fee or tax, but the effect is just the same.
The purpose is to protect the incumbents from too much competition which
might reduce their income.

Bob McConnell

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



RE: [PHP] Frameworks / obstinate?

2009-03-23 Thread Bob McConnell
From: Daniel Kolbo
> 
> P.P.P.S. What might be nice is to have an online repository of "PHP 
> community approved" classes, then programmers could mix and match 
> 'modules' as needed...well now I am sounding like that snake oil
salesman.

You mean something like CPAN over in the Perl arena? Or something more
along the lines of Bob Stout's Snippets ? Those
archives seem to have served their respective communities quite well,
and would be worth emulating. However, don't limit it to classes. There
are enough non-OO people that collections of usable function libraries
should also be worth assembling. I would also suggest including unit
test fixtures and utilities in any collection.

Bob McConnell

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



RE: [PHP] Regex

2009-03-27 Thread Bob McConnell
From: Nitsan Bin-Nun

> If you can point me on the character which control-z creates it would
make
> it easier, I have no idea of it ;)

On Thu, Mar 26, 2009 at 11:06 PM,  wrote:
>>
>> Thanks again. Sad to say, same result.
>>
>> The second option looped an error: Warning: preg_replace():
Compilation
>> failed: nothing to repeat at offset 17

The actual value is 0x1A, and it maps to the ASCII SUB (substitute)
control character. The carrot-Z (^Z) representation is how Unix CLI
software would display it. Many control codes that didn't actually do
anything were printed on the terminals with the carrot prefix. Sometimes
codes that did trigger a function in the terminal would be printed that
way to prevent the function from triggering.

Control-Z is a left over from the CP/M days. It was used to mark the end
of text files, since the original file allocation table (FAT) only
tracked the number of clusters assigned to a file. Some MS-DOS and
MS-Windows applications still tack it on to the end of files. I guess
that's their idea of backward compatibility.

Bob McConnell

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



RE: [PHP] Security Support

2009-03-31 Thread Bob McConnell
From: Grant Peel
> From: "Michael A. Peters" 
>> Grant Peel wrote:
>>> Good Morning / Afternoon,
>>>
>>> We run several of our own servers:
>>>
>>> - Dell Power Edge 1U, Pentium,
>>> - FreeBSD (6.x soon to be 7.x)
>>> - along with all the standard Web Application installation (PHP
Apache 
>>> Exim, Pop3, Proftp, MySQL etc etc).
>>>
>>> What I am asking here, is if any one in this community has the
knowledge 
>>> to act as a security consultant in an occasional, as required basis.

>>> Anyone interested should have expience with Apache, PHP, Perl on the

>>> FreeBSD platform.
>>
>> No experience with FreeBSD and probably not enough with Perl - but
whoever 
>> you hire, make sure they suggest your php build is hardened by
suhosin - 
>> both the core php patch and the loadable module.
>>
> 
> Hi Again all,
> 
> I am not sure what to make of all the chatter on this post 
> 
> To date, I have not recieved any sincere replies, which is a bit
suprising. 
> I am thinking that this job would be easy money for someone who
already 
> knows the ins and outs of php/Apache from a secuirty standpoint.
> 
> I already have sohosin patch applied (it is applied as part of the
default 
> FreeBSD - php port).
> 
> Anyways, the offer is still out there if anyone is interested.

Hi Grant,

First off, I believe you are asking on the wrong list. Server security
is an advanced topic, well outside the experience of most novice PHP
developers. You would be better off asking on some of the advanced
Apache or Perl Monks mailing lists.

Second, from your brief description, I can easily picture a full time
job with lots of overtime hours, not something most consultants will be
interested in. Security is not easy to do correctly, particularly if you
are not responsible and accountable for the outcome or don't have full
authority and management support. We currently have a team of five
people who are jointly responsible for the security of our servers and
networks. Each of them spends more than 20% of their time on that
portion of their job.

And finally, there are companies that do what you asked for. Gibson
Research(*) is the first one that comes to mind . They also
provide monitoring services to keep an eye out for intrusions on your
servers once they have been hardened. Foundstone(**) is another
.

Good luck,

Bob McConnell
Senior Software Engineer
The CBORD Group, Inc.
61 Brown Road
Ithaca NY, 14850
Phone 607 257-2410
FAX 607 257-1902
Email r...@cbord.com
Web www.cbord.com

(*) No relationship exists nor is implied, we're not even a customer. I
just like his style. Plus his Shields Up test gave my home firewall a
perfect score.

(**) We have occasionally hired these folks to do training and intrusion
audits.

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



RE: [PHP] Oracle's dump to MySQL

2009-04-03 Thread Bob McConnell
On Behalf Of 9el
> On Fri, Apr 3, 2009 at 5:21 PM, Phpster  wrote:
> 
>> Extract to csv/XML?
>>
> 
> My main goal is to import the data from Oracle DB to mySQL for a live
site I
> wrote in php. I dont know a better way to do that.

The strategy depends on how complicated the database is. If it is single
table, then Oracle can export that to a CSV file which MySQL can import.
You simply have to make sure the column types match. If it is more
complex, then you need to spend some time translating the relationships
from the Oracle schema into a MySQL schema. There is no one to one
correspondence here, in spite of the promises of the SQL standards. Once
you have done that, you may still be able to use the CSV files, but will
need to determine what order to import them and how to restore the
relevant indexes.

Bob McConnell

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



RE: [PHP] difficult select problem

2009-04-07 Thread Bob McConnell
From: PJ
> First, let me thank you all for responding and offering suggestions. I
> appreciate it and I am learning things.
> However, it looks like my message is not getting across:
> The problem is not to retrieve only the authors whose last names begin
> with A:

Actually, it appears you simply don't like the accurate answers you have
been given. 

> 1) which books have a second author?
> 2) who is the second author ?
> This is determined by table book_author column ordinal (which can be 1
> or 2) - if there is only 1 author for a book then there is no ordinal
2
> linked to book_author bookID and authID.

There is no way to do that in a single select. You need to have at least
two and possibly three queries to answer your question. First you get a
list of authors where their name begins with 'A'. Then you use that
result to select a list of all books with more than one author. Then you
can use that result to select all authors for them.

Everyone has told you this requires processing beyond what SQL can
provide. Why is that a problem?

Bob McConnell

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



RE: [PHP] Am I being hacked?

2009-04-08 Thread Bob McConnell
On Behalf Of Richard Heyes
>> I set up a simple form to save comments on my webpage, and after just
one
>> day of going live, i'm getting weird comments up like this
>>
>> declare @q varchar(8000) select @q =
>> 0x57414954464F522044454C4159202730303A30303A313027 exec(@q)
>>
>>
>> I don't recognise this code - is this an attempt to do something
nefarious,
>> or nothing I should worry about?
> 
> Looks like it may be. As long as you escape you SQL correctly using
> mysql_real_escape_string() or the equivalent, you should be OK.

Let me see if I got this right. The data you got from the form tries to
set up a local variable, assigns it a hex string as a value, then tries
to execute it. That definitely looks like an attempt to crack your
server. It looks like the semi-colons were removed somewhere, so none of
it actually runs. But you would probably need a set of dis-assemblers to
find out what CPU that code was written for and what it actually does.

Next question: You said there are multiple comments like this. How do
they differ, if they do? Possibly they are trying code for different
CPUs.

Did you trace these back to the logs to see if they all come from one IP
or subnet? Is there anywhere to report these attempts that would
actually do any good, or should you just ban that IP.

But this one goes into my journal as something to be prepared for.

Bob McConnell

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



RE: [PHP] Re: PHP and Send Mail

2009-04-09 Thread Bob McConnell
From: Michael A. Peters
> 9el wrote:
>> On Thu, Apr 9, 2009 at 7:19 AM, Shawn McKenzie 
wrote:
>>> Alejandro Esteban Galvez wrote:
>>>> Hi!, I am making a web system and i need known how send a mail
using PHP
>> Hi,
>> Use PHPmailer or PEAR:mail()
> 
> I second PHPmailer.
> It rocks!

Just be aware that it does have a few bugs you may need to work around
or patch. The SourceForge tracker is at
<http://sourceforge.net/tracker/?group_id=26031&atid=385707>. I
submitted two reports last year against 1.73 which the tracker says were
summarily closed with no comment and apparently no action. The first one
is listed as fixed in the change logs for 2.0.3 and 2.3, but that was
not recorded in the tracker.

1. Incorrect line ending character. RFC 2821 and 2822 require CR/LF line
endings. PHPMailer only puts in the LF. Just because most current
clients can handle the single character is no excuse for doing it wrong.

2. Invalid use of Return-path for Sender. When you request a Sender
header, the email is written with Return-path instead. According to
those RFCs, the latter is reserved for use by transport agents and may
be rewritten or replaced anywhere in the chain. It should insert a
Sender line instead.

Bob McConnell

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



RE: [PHP] A Tool For Building PHP Web Apps

2009-04-10 Thread Bob McConnell
From: Paul M Foster
> 
> Here's a hairbrained idea I was kicking around. I object to the idea
of
> including 15 or 30 files in a PHP application just to display one page
> on the internet. It makes the coding faster, but it makes the display
> slower and seems silly to me.
> 
> So what if you had a tool or a set of tools where you could write code
> snippets and such, and then hit a button or issue a command, and
> everything you specified got written into a single file? You'd specify
> that this page needs to read the config, set up a database connection,
> validate these fields, etc. When you were done, it would write all
this
> code to a *single* file, which the user would invoke by surfing to
that
> page. The resulting code would be *static*, not like what results from
> most templating systems. So rather than specify a specific variable
> value in the resulting file, it would embed the PHP code to display
the
> variable, etc.
> 
> What might be the liabilities of something like that? Would there be
> security issues? Would there be increased difficulty in debugging?
What
> can you think of?

Programs to do that used to be called compilers. There is an entire
branch of computer science and a lot of tools (lex, yacc, etc.)
dedicated to that topic.

It's not a bad idea, but there is one precarious assumption that
underlies it. Can you absolutely guarantee there will never be a second,
or third, or more pages on that server that will need some of those
functions or classes? As soon as the site begins to evolve and grow, you
will have multiple copies of many of those snippets, and when (not if)
you need to modify them, you will have to find and change every single
copy.

So you need to ask yourself if this strategy is maintainable in your
case. And will it make any real difference in the end?

Bob McConnell

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



RE: [PHP] try - catch is not so clear to me...

2009-04-13 Thread Bob McConnell
From: Marc Steinert

> Basically try-catch gives you the ability to handle errors
> outside a class or method scope, by the 
> calling instance.
> This comes in handy, if you are programming in an object
> orientated way and thus enables you to 
> seperate error handling from the rest of your functionality.
> Means, your methods do only the things, they are meant to do,
> without bothering to handling occuring 
> errors.
> Hope, that made things clearer.

You know, this is the first explanation of exceptions I have seen that
actually makes sense. I could never figure out what they were and why
they were. It always looked like it was just a special subset of errors,
a distinction without a difference, as it were. But looking at them as a
technique to move the handlers out of the mainline code actually shines
some real light on the subject.

Thank you,

Bob McConnell

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



RE: [PHP] Let me google that for you.

2009-04-17 Thread Bob McConnell
From: tedd
At 5:19 PM +0100 4/17/09, Tom Chubb wrote:
>>
>> Shouldn't that be: http://lmgtfy.com/?q=php+function.str-replace.php
>>  ;)
> 
> I don't care what anybody says "Now that's funny!"
> 
> But what I would like to know is how you did that? That's mondo cool!
> 
> No hidden meaning, I would like really to know how you did that.

It does still need a bit of work. The HTML Parser plug-in for Firefox
shows 28 errors.

Bob McConnell

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



RE: [PHP] pup

2009-04-17 Thread Bob McConnell
From: tedd
> At 10:43 PM -0700 4/16/09, Jim Lucas wrote:
>> Have your elements setup like such:
>> 
>>  Room #1
>>  Room #2
>>  Room #3
>>  Room #4
>>  Room #5
>> 
>> Then on your processing page, you know that you have 5 rooms, 1 - 5.
>> 
>> With this information you can check to make sure that something
exists
>> 
>> > $rooms = range(1,5);
>> for ( $i = 1; $i <= 5; $i++ ) {
>>  if ( isset( $_POST['reserve']['rm'.$i] ) {
>>  # Room was checked
>>  } else {
>>  # Room was NOT checked.
>>  }
>> }
>> ?>
> 
> Jim et al:
> 
> Try this:
> 
>  Room #1
>  Room #2
>  Room #3
>  Room #4
>  Room #5
> 
> 
> if (isset($_POST['reserve']) )
> {
> foreach ($_POST['reserve'] as $key => $a)
>{
>echo("$key $a ");
>}
> }
> 
> Here's the demo:
> 
> http://www.webbytedd.com//post-array1/index.php
> 

Don't forget the  on the end of those input lines. I've seen too
many pages already where I had to fix that problem.

Bob McConnell

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



RE: [PHP] 800 pound gorilla

2009-04-20 Thread Bob McConnell
From: Marc Christopher Hall
> 
> Sun buys MySQL and now Oracle buys Sun (not final, yet). What will
happen
> with the main db we PHP'ers have come to know and love especially
since v 5

Speak for yourself, I prefer PostgreSQL. But there are already two
announced forks of MySQL, created by developers that left after Sun
bought the company. So I don't think you'll be in any trouble. I did a
Google search last week on "executives departing MySQL" and found them.

Bob McConnell

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



RE: [PHP] 800 pound gorilla

2009-04-20 Thread Bob McConnell
From: Marc Christopher Hall
> From: Bob McConnell
>> From: Marc Christopher Hall
>>> 
>>> Sun buys MySQL and now Oracle buys Sun (not final, yet). What will
>> happen
>>> with the main db we PHP'ers have come to know and love especially
>> since v 5
>>
>> But there are already two
>> announced forks of MySQL, created by developers that left after Sun
>> bought the company. So I don't think you'll be in any trouble. I did
a
>> Google search last week on "executives departing MySQL" and found
them.
> 
> 
> These responses are what I was fishing for. My
> gut reaction was "Not again!" and this time I initially feared a
future axe
> to MySQL. Upon further thought (and a few deep breaths) I agree that
for the
> near future, an immediate canning of MySQL would not be in Oracle's
best
> interest. However, since Oracle has been the competition and (I had no
idea
> other developers had already begun a fork of MySQL) I believe that
Oracle
> will close the door on MySQL eventually.

I don't think it makes any difference what Oracle does with it. I
believe most or all of the core source is available under the GPL. So it
will always be available. There is certainly enough interest in the
application that it will attract a number of talented developers no
matter who manages the process. So even if Oracle dumps it, it will
continue to exist in one or more forks. The only business issue will be
who can use the trademark.

On the other hand, there are some closed source utilities and components
that may have to be recreated for any forked version. After all, it was
the "Enterprise" package that was generating the revenue. That is the
only part of the product that Sun or Oracle could really control.

Bob McConnell

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



RE: [PHP] Resampling images -- need lock ?

2009-04-20 Thread Bob McConnell
From: Martin Zvarík
> kranthi napsal(a):
>> yeh. if u want it to be on server side that is a good approach. but i
>> feel it'll be very easy to do it with javascript...
>>
>> but what i did not understand is: what should happen if the user
>> clicks ROTATE second time(when the script completed rotating say 5
>> images)?
>> 
> Well, few images (etc. 5) got rotated +90 deg. and then the script got 
> aborted, because of the second request, which will cause another +90 deg 
> rotation again on all images = meaning those 5 will be again rotated +90 
> = 180, the others stay 90.

That's what did happen. But what _should_ happen? Should it abort the first 
rotate, or finish all images then rotate each a second time? The code will have 
to be different depending on which option you want.

Bob McConnell

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



[PHP] Encrypting email

2009-04-21 Thread Bob McConnell
I have been asked by a product manager what our options are for
encrypting email messages with sensitive information. We are currently
using PHPMailer to send email. What can be done to encrypt those
messages? Can it be done without OOP?

Server configuration:
  RHEL 5
  Apache 2.0
  PHP 5.2.3
  PHPMailer 1.73

Thank you,

Bob McConnell

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



RE: [PHP] Encrypting email

2009-04-21 Thread Bob McConnell
From: tedd
> At 8:39 AM -0400 4/21/09, Bob McConnell wrote:
>>I have been asked by a product manager what our options are for
>>encrypting email messages with sensitive information. We are currently
>>using PHPMailer to send email. What can be done to encrypt those
>>messages? Can it be done without OOP?
> 
>  From within a php script, it's not a problem to encrypt a text string

> and send it as email. The sending of the email and the encrypting the 
> contents are two different issues. You may want to look at it that 
> way.

But can it be done so the recipient's email client will automatically
open and decrypt the message? How do you make it as seamless as possible
for them, preferably so they don't even realize the message was
encrypted?

Bob McConnell

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



RE: [PHP] Encrypting email

2009-04-21 Thread Bob McConnell
From: tedd [mailto:tedd.sperl...@gmail.com] 
> At 9:49 AM -0400 4/21/09, Bob McConnell wrote:
> >From: tedd
> >>  At 8:39 AM -0400 4/21/09, Bob McConnell wrote:
> >>>I have been asked by a product manager what our options are for
> >>>encrypting email messages with sensitive information. We are
currently
> >>>using PHPMailer to send email. What can be done to encrypt those
> >>>messages? Can it be done without OOP?
> >>
> >>   From within a php script, it's not a problem to encrypt a text
string
> >
> >>  and send it as email. The sending of the email and the encrypting
the
> >>  contents are two different issues. You may want to look at it that
> >>  way.
> >
> >But can it be done so the recipient's email client will automatically
> >open and decrypt the message? How do you make it as seamless as
possible
> >for them, preferably so they don't even realize the message was
> >encrypted?
> 
> At some point both parties (sender/receiver) must know (agree) what 
> the encrypting mechanism is.
> 
> If I was writing a script to do this for a client, I must have 
> control over both the send and receive scripts and then I could 
> deliver the email to the client seamlessly. They would never know 
> what happened in the background.
> 
> However, if your client wants to send stuff to anyone and have it 
> encrypted without knowing who the receiver is going to be, then there 
> is no way to do this. Both the sender and receiver must agree on the 
> encrypting mechanism either by providing passwords OR by you having 
> access to both the sending and receiving scripts. As I see it, there 
> is no other way.

These will be targeted emails for selected recipients, primarily in the
Security and Public Safety offices. But they will be sent via public
mail servers, so the content must be protected.

Knowing the first site where this would go for field trials, I suspect
most recipients are using some version of Microsoft Outlook. But other
sites down the road are likely to have different clients. That end is
completely outside of my control or influence. All I can do is recommend
packages for them to download and install. I already know I need to get
a public key from each recipient before I can encrypt their messages,
but that's as far as I have gotten. I did glance at the GPG site
earlier, and it appears they only support the version of Outlook in
Office 2003.

I have a feeling this is going to get messy, at least on the deployment
end.

Thanks for the pointers,

Bob McConnell

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



RE: [PHP] Unable to send mail from PHP to AT&T e-mail address

2009-04-23 Thread Bob McConnell
From: Chris
>>>> Any light anyone can throw on the 'nob...@myserver.com' address
would be
>>>> most welcome.
>>>
>>> It is using the apache user @ your host name as the default.  Try
this:
>>>
>>> ini_set('sendmail_from', 'whate...@wherever.com');
>> 
>> I will try this but I do not understand why it should work. I have a 
>> 'From:...' entry in my headers. Why is this not being used as the 
>> primary from address and why is 'nob...@myserver.com' being added 
>> instead as the first from address ? In other words, I can understand
if 
>> I supply no 'From:...' header entry that a default
'nob...@myserver.com' 
>> would be used but I do not understand why it is used even when I
supply 
>> a 'From:...' header entry.
>> 
> 
> "From: " is used by your mail client to show who it's from.
> 
> the ini_set (or you can set the 5th param to the mail() function) is a

> return-path. If the message bounces (recipient's mailbox full, server 
> down, whatever the reason) it gets delivered to that address. They
serve 
> different purposes.

The dirty little secret that nobody seems to know is that the RFCs
reserve Return-path for use by the MTA servers. It can be replaced by
any of them in the routing chain and is used when mail crosses into or
out of SMTP networks. If you want a return address other than From to
stick all the way through, you have to use the Reply-to and/or Sender
headers.

Bob McConnell

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



RE: [PHP] Unable to send mail from PHP to AT&T e-mail address

2009-04-24 Thread Bob McConnell
From: Chris

>>> the ini_set (or you can set the 5th param to the mail() function) is
a
>> 
>>> return-path. If the message bounces (recipient's mailbox full,
server 
>>> down, whatever the reason) it gets delivered to that address. They
>> serve 
>>> different purposes.
>> 
>> The dirty little secret that nobody seems to know is that the RFCs
>> reserve Return-path for use by the MTA servers. It can be replaced by
>> any of them in the routing chain and is used when mail crosses into
or
>> out of SMTP networks. If you want a return address other than From to
>> stick all the way through, you have to use the Reply-to and/or Sender
>> headers.
> 
> Emails don't bounce to those addresses though do they? I've always 
> thought the return-path is where an email is bounced to and reply-to
etc 
> are used by mail clients, not the mta's.

The way I read it, the return-path field is used to indicate a gateway
where the message entered the current email network. So a bounced
message has to be returned to that gateway to get back to the network
from whence it came. This is useful where traffic passes into an SMTP
network from a network with an older routing mechanism, or vice versa.
The intent is to return the bounce to the Sender or From address, in
that order.

But, since the RFC specifically says the field is reserved for use by
the MTAs, it is not proper behavior for an email client to add it to the
header.

Reply-to is a specific instruction to the recipients client software to
insert this address as To when a reply is composed. It is ignored by the
MTA.

If you don't want bounces to go to the From address, use Sender. It was
intended for mailing lists and administrative assistants to send mail on
behalf of someone else without having to forge their From address. It's
also useful when you have a web site running on a commercial server farm
outside your domain that has to send mail that acts like it came from
inside that domain. Many border filters will block mail when the From
line says it came from within their domain. So the From address can be
the web server (it doesn't even have to be a valid address) while Sender
indicates the address in the domain where any bounces need to be sent.

Bob McConnell

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



RE: [PHP] Self-Process php forms or not?

2009-04-24 Thread Bob McConnell
When you have it all in one file, the first thing you do is check to see if 
this request was submitted from the form. If not, you send the blank form. If 
it was, you validate all of the data. When a validation fails, you add error 
messages and resend the form with any fields that passed the validation already 
filled in. When validation succeeds, process and move on. No muss, no fuss.

Bob McConnell

-Original Message-
From: Sándor Tamás (HostWare Kft.) [mailto:sandorta...@hostware.hu] 
Sent: Friday, April 24, 2009 8:53 AM
To: 'PHP-General List'
Subject: Re: [PHP] Self-Process php forms or not?

I think the main advantage is that if something goes wrong processing the 
datas, you can show the form again without redirecting again.

And if you have to change the behavior of the page, you have to change only 
one file instead of two.

SanTa

- Original Message - 
From: "MEM" 
To: "'PHP-General List'" 
Sent: Friday, April 24, 2009 2:34 PM
Subject: [PHP] Self-Process php forms or not?


I'm trying to understand the advantages behind opting by using a
Self-Process PHP Form, instead of having a form and then point the action of
the form to another .php page.

Can anyone point me some resources about this. Why using one instead of
another. What are the main advantages?



Regards,
Márcio


-- 
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] E-Mail Verification - Yes, I know....

2009-04-29 Thread Bob McConnell
From: Simon
> 
> There is no way to verify (without sending an email) if the email will
> be received in a mailbox.

Even that is not a valid test. Most spam filters will discard messages
silently, that is without notifying either sender or recipient. So the
only real verification is when you receive an actual reply from the
recipient.

Bob McConnell

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



RE: [PHP] Software to read/write Excel to CD?

2009-05-15 Thread Bob McConnell
From: Bastien Koert
> On Fri, May 15, 2009 at 12:35 PM, Michael A. Peters 
wrote:
>> Paul M Foster wrote:
>>> On Fri, May 15, 2009 at 10:21:22AM +0100, Peter Ford wrote:
>>>
>>>  Matt Graham wrote:
>>>>
>>>
>>
>>>> But why write an Excel spreadsheet - why not save the data in
something
>>>> more
>>>> portable like CSV that ExCel and read and write to once you are
back at
>>>> base?
>>>>
>>>>
>>> CSV doesn't export *formulas*, just the visible numbers.
>>>
>>
>> gnumeric handles everything excel that I have ever needed, and is
FOSS.
>> I believe OpenOffice also does very well.
>>
>> That being said, you are more likely to find excel installed than
either of
>> those, excel is the spreadsheet standard at this point, and both
those
>> products mentioned handle most excel files, so saving as excel should
(in
>> most cases) be plenty portable.
> 
> unless you run into xlsx format office 2007...

>From what I have heard so far, OOo.org is better at reading and writing
xlsx than Office 2007 SP2 is with ODF. Early reviews suggest that
Microsoft has shot themselves in the foot, again.

But what does this have to do with PHP?

Bob McConnell

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



RE: [PHP] Shopping Cart

2009-05-20 Thread Bob McConnell
They are all going to the same place, so what is wrong?

To address your question, credit cards are not easy. As soon as you set
up a site to accept them you must conform to a number of security and
interface requirements. If you have never done it before, either hire
someone that knows what they are doing, or hire someone to train you how
to do it. The other option is to find a hosting site that provides both
secure servers and credit card authorization services and put your web
site on their servers.

It took us nearly two years to get certification that our servers and
software comply with all of the relevant PCI standards. We have two
projects that are still being evaluated and don't expect final approval
on them until August. There are four people here that are tasked with
monitoring and managing that process.

Bob McConnell

-Original Message-
From: Gary [mailto:gwp...@ptd.net] 
Sent: Wednesday, May 20, 2009 8:44 AM
To: php-general@lists.php.net
Subject: [PHP] Shopping Cart

Sorry, the first three post was put in the wrong place...

Not sure this is a direct PHP question, however I know I will get some
answers here.  I have a customer that I am bidding a small project for.
They want to be able to accept credit card payments for enrollment into
a
class. Their customer will fill out a form and pay via CC on the site.
Is
this something that I should just look to the host for whatever shopping
cart they have or is there an easy to administer software package that I
should look into. Or since it is a one item cart, is this something that
I
could code?

Thanks for your help.

Gary




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


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



RE: [PHP] PHP vs ASP.NET

2009-05-28 Thread Bob McConnell
No.

Bob McConnell

-Original Message-
From: Olexandr Heneralov [mailto:ohenera...@gmail.com] 
Sent: Thursday, May 28, 2009 9:21 AM
To: php-general@lists.php.net
Subject: [PHP] PHP vs ASP.NET

Hi!
Guys, you of course, know that  ASP.NET becomes more and more popular in
the
world.
I have a question for everyone:
Can it happen so that PHP will be replaced with ASP.NET?

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



RE: [PHP] recipes anyone?

2009-05-29 Thread Bob McConnell
From: PJ
> 
> I'd like to get some input on how to deal with recipes.
> use html pages to store and display, XML or db or... ? And what about
> clips, like flvs ? TIA.
> 

There are as many ways to do cookbooks as there are cooks. I am familiar
with half a dozen, without counting the professional packages put out by
another department here where I work.

RecipeML is one option, but it is seriously incomplete if you need to
include nutritional information.

Qookbooks, Gormet (Gnome), Krecipes (KDE) MealMaster, Master Cook,
Recipants, etc. all have different storage formats and display formats.
Some are well documented, some are buried in the code, and some are
still kept secret. You can take your pick, or combine them and roll your
own.

A bigger issue is how to import existing recipe files. I have several
years of messages collected from newsgroups like rec.food.recipes,
r.f.cooking, r.f.baking, etc. that I would like to put into a usable,
and searchable format. But there are too many variations in the formats
and naming conventions used to be able to write a single routine to
handle them all. It is much easier just to use those already published
in MealMaster formats. At least that one is documented clearly now that
they are out of business.

Bob McConnell

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



RE: [PHP] recipes anyone?

2009-05-29 Thread Bob McConnell
From: PJ
> Bob McConnell wrote:
>> From: PJ
>>   
>>> I'd like to get some input on how to deal with recipes.
>>> use html pages to store and display, XML or db or... ? And what
about
>>> clips, like flvs ? TIA.
>>>
>>> 
>>
>> There are as many ways to do cookbooks as there are cooks. I am
familiar
>> with half a dozen, without counting the professional packages put out
by
>> another department here where I work.
>>
>> RecipeML is one option, but it is seriously incomplete if you need to
>> include nutritional information.
>>
>> Qookbooks, Gormet (Gnome), Krecipes (KDE) MealMaster, Master Cook,
>> Recipants, etc. all have different storage formats and display
formats.
>> Some are well documented, some are buried in the code, and some are
>> still kept secret. You can take your pick, or combine them and roll
your
>> own.
>>
>> A bigger issue is how to import existing recipe files. I have several
>> years of messages collected from newsgroups like rec.food.recipes,
>> r.f.cooking, r.f.baking, etc. that I would like to put into a usable,
>> and searchable format. But there are too many variations in the
formats
>> and naming conventions used to be able to write a single routine to
>> handle them all. It is much easier just to use those already
published
>> in MealMaster formats. At least that one is documented clearly now
that
>> they are out of business.
>>
>> Bob McConnell
>>   
> Thank you gentlemen. Basically, that's what I figured. But this does
> give me some more stuff to mull over. The only thing I'm really
> wondering is if it's worth doing anything with XML.
> I do have a number of recipes already in HTML; probably will try to
> re-use them and modify/or adapt with CSS.
> Thanks, again.

A lot depends on what you are actually going to do with them. If you
need output in several different forms, then XML/XSLT might be the best
way to go. But, I have seen an automated translation of the RecipeML DTD
into an SQL schema, and it was not pretty. Unless you are very familiar
with XML, or just want some practice, I wouldn't go there.

I have been looking at this idea for some time, and have pretty much
decided on a Postgres server for the back end with a custom schema.
There are several features I want that are not all available in any of
the consumer grade packages I have seen; like a web based front end,
exclusion of specific ingredients due to allergies and being able to
attach dated notes about alterations or substitutions I try each time I
prepare a recipe. I just need to sit down with my collected notes and a
few days to patch it together. But lately I have been spending most of
my time with our grandchildren instead of the computer.

Good luck,

Bob McConnell

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



RE: [PHP] PCI compliance issue

2009-06-02 Thread Bob McConnell
From: Skip Evans

> --
> The reason why this issue is being flagged is simply that both 
> links should bring you to the same page but if look at the 
> HTTP header response (http://www.ranghart.com/cgi-bin/?D=A) it 
> returns a 403 forbidden even though it still takes you to the 
> main site page, with the other URL 
> (http://www.ranghart.com/cgi-bin/%3fD=A) it is returning a 200 
> OK when it is the same page as the URL that is returning a 
> 403. You will need to make sure that the pages are responding 
> in the same way to correct this issue.
> -

My first reaction is that there is a problem with the way your server is
parsing the URLs. Because it responded differently to the encoded
question mark than it did with the actual question mark, there may be a
bug in that parser. Now whether that bug is exploitable is another
matter and is not even questioned here. But its very existence is of
concern when you are working with PCI.

One other note I would make here. We believe that the PCI requirements
were devised to protect the credit card companies from liability. They
do very little to protect you or your employer. We treat them as only
the minimum requirements for any site or product, whether it has to go
through their certification process or not.

Bob McConnell

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



RE: [PHP] MySQL after oracle, still Wise?, was Web application design .......

2009-06-03 Thread Bob McConnell
From: Sancar Saran

> And if you so much thinking about future DB change. Just wrote
compatible sql 
> and use multi drive layer (phpADO db).
> 
> And you are problem free

I have some questions about this suggestion. We currently have
production systems using Postgres, Sybase ASA, Oracle and MS SQL Server.
Only one product currently supports more than one, it can be installed
with ASA or connect to an existing Oracle server. This unfortunate mix
was brought about by several acquisitions over the past ten years. We
also have a group talking about using MySQL for a portal project. One
product did use MySQL prior to their switch to per server license fees,
which made them far too expensive for the distributed system they were
used in. So that project switched to Postgres.

But what is the ADO layer going to look like in order to support any or
all combinations of these back ends? How much of a kludge will it have
to become?

Is there any code out there that will support most of these, or do we
have to write it all ourselves?

Most of my SQL experience has been with Sybase ASA. I am playing with
Postgres a little bit now, and the differences can be both subtle and
glaring. But I don't know either one well enough to understand how to
design an ADO interface, let alone how to bring in the other options.

Thank you,

Bob McConnell

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



RE: [PHP] html and password management

2009-06-04 Thread Bob McConnell
From: Andrew Ballard 
> On Thu, Jun 4, 2009 at 12:33 PM, Michael A. Peters 
wrote:
>> Andrew Ballard wrote:
>>
>>>
>>>
>>> I just thought I'd toss this out there. Do you know that there is an
>>> effort to remove browser support this attribute (or at least give
the
>>> user a browser configuration option to ignore it)?
>>>
>>> http://article.gmane.org/gmane.org.w3c.whatwg.discuss/3054
>>>
>>> This article discusses some of the issues involved.
>>>
>>>
https://wiki.mozilla.org/The_autocomplete_attribute_and_web_documents_us
ing_XHTML
>>
>> That page says:
>>
>> "When writing HTML, such authors should declare and validate against
a
>> custom doctype including the autocomplete attribute (example HTML
document).
>>
>> However, there is currently no way to trigger the same user agent
>> functionality with an attribute in XHTML. This constitutes an
unnecessary
>> obstacle to the adoption of XML-based markup."
>>
>> That page is wrong.
>> It took me 10 minutes in google to find a way to do it in xhtml and
have the
>> xhtml validate. And I didn't have to use a custom DTD. Only thing I
had to
>> do is send the application/xhtml+xml header - which I already send,
as
>> that's the proper way to serve xhtml 1.1.
>>
> I wasn't really taking a position on the issue. I just thought it
> worth noting that there seems to be a contingent that wants to remove
> the attribute. From what I read, they have already conceded to
> language that says a user-agent may choose to implement it, but is not
> required to do so.

There is nothing to remove. It is a proprietary extension and not likely
to ever be accepted as part of the W3C standards. As such, it won't be
in any W3C DTD, but will always require a custom DTD be supplied
locally. Each browser supplier must decide whether to support it or
leave it out.

>From my viewpoint, the bigger need is to educate administrators of
publicly available computers to disable autocomplete in the browser
configuration. If they would do that, when you go to the workstation in
the library, you can't see the credentials of the last user, and the
next user won't be able to retrieve yours.

Bob McConnell

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



RE: [PHP] Preventing XSS Attacks

2009-06-15 Thread Bob McConnell
From: Ashley Sheridan
> On Wed, 2009-06-10 at 18:28 +0200, Nitsan Bin-Nun wrote:
>> mysql_real_escape_string() only sanitise the input. I would
personally
>> only allow [a-zA-Z0-9-_] in search string but that's just me ;)
>> Validate the input in some way, or make extra sanitisation of it
>> before running the search query.
>> 
>> Regarding the HTML output, just entities() it and you'll be good :)
>> 
>> On Wed, Jun 10, 2009 at 6:32 PM, Ashley Sheridan
>>  wrote:
>> 
>> On Wed, 2009-06-10 at 18:18 +0200, Nitsan Bin-Nun wrote:
>> > As far for the output, just html entities () it and you
will
>> be good.
>> >
>> > You better check the search query for sql injection, which
>> is more
>> > dangerous.
>> >
>> > HTH
>> > Nitsan
>> >
>> > On Wed, Jun 10, 2009 at 6:19 PM, Ashley Sheridan
>> >  wrote:
>> > Hi all,
>> >
>> > I'm looking at adding a new search feature to my
>> site, and one
>> > of the
>> > elements of this is to echo back in the search
>> results page,
>> > the
>> > original string the user searched for. Up until
now,
>> XSS
>> > hasn't (afaik)
>> > been an issue for my site, but I can see from a
mile
>> off this
>> > will be.
>> > What would you guys recommend to avoid this?
>> >
>> > I'd thought initially of using a mixture of
>> > html_special_chars() and a
>> > regex (as yet not sure what I'll be stripping out
>> with this)
>> > to sanitise
>> > the output for display on the results page, but is
>> this
>> > enough?
>> >
>> 
>> I always use mysql_real_escape_string() for that sort of
>> thing, not had
>> a problem with it, but is there anything you think I should
be
>> wary of?
>> 
> 
> Well, I don't understand, what is the problem with
> mysql_real_escape_string() for sanitising input to use for a search?
It
> should escape anything out so that the query can't be used in ways
that
> I don't want no?
> 
> I'd thought about using a whitelist-only regex, but that seems a
little
> limiting tbh, and as my site contains code, it's not unreasonable to
> expect some people might want to search for particular code excerpts.

What if we don't use MySQL? We are using Postgres on our web servers.
None of the MySQL libraries are available. I am currently reviewing a
half-dozen different and incomplete black-list sanitization functions
that don't to a very good job while removing characters that we need to
be able to use. I need to identify a clean strategy to replace or
restructure them.

Bob McConnell

Sorry for posting this so late, I just got back from a week of vacation.
bm

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



RE: [PHP] Multi-Sort -- how to do this?

2009-06-18 Thread Bob McConnell
From: Ashley Sheridan
> On Wed, 2009-06-17 at 19:27 -0400, tedd wrote:
>> At 10:54 PM +0100 6/17/09, Ashley Sheridan wrote:
>> >I'd probably go with some sort of custom bubble sorting function.
Base
>> >the sorting on your $d array, and then update the other arrays as
>> >necessary. Should be OK if they all have the same index, like in
your
>> >example. If you were using keys, could you maybe join all the arrays
>> >using some sort of serialisation, sort, then unserialise into the
>> >separate arrays?
>> >
>> Ash:
>> 
>> You missed the point. I could use the built-in sort (i.e., sort() ) 
>> and sort the $d array. However, I would like the indexes of the other

>> arrays to match the new sort.
>> 
> 
> I think I might need a for-instance here, as you lost me!
> 

He is emulating a four column table using four arrays. He wants to sort
the table on one of the columns.

Bob McConnell

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



RE: [PHP] Multi-Sort -- how to do this?

2009-06-18 Thread Bob McConnell
From: Ashley Sheridan
> On Wed, 2009-06-17 at 19:27 -0400, tedd wrote:
>> At 10:54 PM +0100 6/17/09, Ashley Sheridan wrote:
>> >I'd probably go with some sort of custom bubble sorting function.
Base
>> >the sorting on your $d array, and then update the other arrays as
>> >necessary. Should be OK if they all have the same index, like in
your
>> >example. If you were using keys, could you maybe join all the arrays
>> >using some sort of serialisation, sort, then unserialise into the
>> >separate arrays?
>> >
>> Ash:
>> 
>> You missed the point. I could use the built-in sort (i.e., sort() ) 
>> and sort the $d array. However, I would like the indexes of the other

>> arrays to match the new sort.
>> 
> 
> I think I might need a for-instance here, as you lost me!
> 

He is emulating a four column table using four arrays. He wants to sort
the whole table on one of the columns.

Bob McConnell

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



RE: [PHP] I've some doubts if I should go with 5.2 or go already with 5.3 (for a course)

2009-06-23 Thread Bob McConnell
From: Michael A. Peters
> Manuel Aude wrote:
>> I'm giving a PHP course next semester (3 hours all saturdays for 22
weeks)
>> and I just realized that PHP 5.3 is coming very soon (2 days now!).
So, my
>> plans of teaching PHP 5.2 are starting to change, and I think it's a
good
>> idea to teach them 5.3 already.
>> 
>> While the majority of the students use Windows, I'm aware that a vast
amount
>> will be using Ubuntu/Debian (and some use Gentoo, Fedora and Arch)
>> distributions of Linux, so I'm hoping there won't be too many
problems on
>> installation. I don't want to waste the entire first class fixing
>> installation problems, because that kills the student's motivation.
>> 
>> The course starts on August, but I'm preparing it during the last two
weeks
>> of July. You think that installation packages will be bulletproof by
then?
>> Or should I just teach 5.2 and wait for another semester before
starting on
>> 5.3? I mean, most hosts will remain with PHP 5.2 for the rest of the
year,
>> so I'm a bit confused on what I should do.
>> 
>> I'm just a university student that wants to spread PHP, for I've been
using
>> it for many years now =)
> 
> Many hosts are still on php 5.1.x (IE RHEL based hosts).
> I would be worried that many popular classes and apps might be quirky 
> under 5.3.
> 
> I've not played with it at all, and probably won't for some time, but 
> I've been bitten by that more than once.
> 
> Nice thing about 5.2.x as far as linux goes anyway, installing it is 
> cake from the package repositories. Using package repositories for php

> installs is suggested as security fixes can be updated with ease.
> 
> As someone running a newer version of php (5.2.9) than what my distro 
> ships with, here are some of the issues:

Manuel,

You might want to check on the release schedules for PHP 5.3(.1?) by the
major distributions. Even if they are close to the end of your class
schedule, will they be deployed that quickly to sites your students
could be working on? Or will they still be working with 5.2 for the
foreseeable future?

I have recently been told that we are switching from compiling Apache,
PHP and PostgreSQL ourselves to only using the official RedHat RPMs on
our production servers[*]. This is coupled with a move to a managed
hosting service. But since RH is not even shipping the most recent
version of 5.2, I don't expect to see a 5.3 RPM for some time. Maybe it
will have enough improvements to trigger an early update from them, but
who knows. After they release it, it will still be a while before we
pick it up, test it and deploy it. So even though I like some of the
changes in 5.3, I am stuck with 5.2 for at least another year, maybe
two.

Bob McConnell

[*] No, I don't like this at all. I see it as the antithesis of both the
Open Source and Free Software philosophies. It means we give up control
of some of the options we were selecting at compile time and have to
settle for somebody else's idea of the perfect server. I fully expect it
will come back to bite us at some point.

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



[PHP] Explode-update-implode not working

2009-06-23 Thread Bob McConnell
At least not the way I expected it to. Apparently I am doing something
wrong, but I can't find anything specific that explains it. This is in
PHP 5.2.6.

Here is the sequence I am trying to implement without the database
portion. (This is typed in since the VNC I am using doesn't support
pasting from a Linux client to a MS-Windows server.)

-
$buff = "key1|value1~key2|value2";

$lines = explode ("~", $buff);

foreach ($lines as $kvpair) {
   $line = explode ("|", $kvpair);
   if ($line[0] == "key1") {
  $line[1] = "value3";
  $kvpair = implode ("|", $line);
  break;
   }
}
$newbuff = implode ("~", $lines);
-

$kvpair is modified, but that change is ignored by implode() with
$newbuff still containing "key1|value1".

So why doesn't the change to $kvpair get brought in by implode? What
should I do to update that value?

Bob McConnell

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



RE: [PHP] Explode-update-implode not working

2009-06-23 Thread Bob McConnell
Doh! I knew it would be something simple that I had overlooked. I recall 
reading that note last week and telling myself I would need to remember it. But 
that was then ...

Thank you, the code is working better now. I just wish I were.

Bob McConnell

-Original Message-
From: Andrew Ballard [mailto:aball...@gmail.com] 
Sent: Tuesday, June 23, 2009 12:25 PM
To: Bob McConnell
Cc: php-general@lists.php.net
Subject: Re: [PHP] Explode-update-implode not working

On Tue, Jun 23, 2009 at 12:11 PM, Bob McConnell wrote:
> At least not the way I expected it to. Apparently I am doing something
> wrong, but I can't find anything specific that explains it. This is in
> PHP 5.2.6.
>
> Here is the sequence I am trying to implement without the database
> portion. (This is typed in since the VNC I am using doesn't support
> pasting from a Linux client to a MS-Windows server.)
>
> -
> $buff = "key1|value1~key2|value2";
>
> $lines = explode ("~", $buff);
>
> foreach ($lines as $kvpair) {
>   $line = explode ("|", $kvpair);
>   if ($line[0] == "key1") {
>      $line[1] = "value3";
>      $kvpair = implode ("|", $line);
>      break;
>   }
> }
> $newbuff = implode ("~", $lines);
> -
>
> $kvpair is modified, but that change is ignored by implode() with
> $newbuff still containing "key1|value1".
>
> So why doesn't the change to $kvpair get brought in by implode? What
> should I do to update that value?
>
> Bob McConnell
>

See the second note at
http://www.php.net/manual/en/control-structures.foreach.php

Either of these should do what you want:



 $kvpair) {
  $line = explode ("|", $kvpair);
  if ($line[0] == "key1") {
 $line[1] = "value3";
 $lines[$key] = implode ("|", $line);
 break;
  }
}
$newbuff = implode ("~", $lines);
?>


Andrew

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



[PHP] Unit test platform

2009-06-25 Thread Bob McConnell
I need some guidance. I have looked over the PHP site and don't see any
hints about using PHP interpreters for unit testing. I would like to
know if this idea has any chance of working.

I want to set up the development and build machines with PHP
interpreters to do automated unit tests. Because we use PostgreSQL, I
want to set up those boxes without any Postgres libraries and substitute
FIT test stubs in their place.

1. I have to use MS-Windows as my development platform. Currently I have
XP-Pro with NetBeans 6.5.1. I have played with Eclipse and Komodo
Editor, which remain as possible options. I need a PHP interpreter that
will allow me to write and debug FIT tests for functions already in use,
as well as new code that I write or modify.

2. The production server is RHEL ES 5 with Apache 2 and PostgreSQL. I
cannot make any changes to this platform.

3. The build machine is running Fedora Core (version unknown), also with
Apache and PostgreSQL installed as it is also used for integration
testing. I want to change this to remove the Postgres libraries so they
can be replaced with the FIT back end. Integration testing would require
a separate server which would also solve some other QA issues we have.
We currently do both development and QA testing on this box, releasing a
set of RPM files to production once they have been run through the
wringer.

Is this a reasonable plan?

Where can I find PHP interpreters for MS-Windows and FC that will
support this?

Thank you,

Bob McConnell

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



RE: [PHP] Unit test platform

2009-06-25 Thread Bob McConnell
From: Bastien Koert
> On Thu, Jun 25, 2009 at 10:00 AM, Bob McConnell wrote:
>> I need some guidance. I have looked over the PHP site and don't see
any
>> hints about using PHP interpreters for unit testing. I would like to
>> know if this idea has any chance of working.
>>
>> I want to set up the development and build machines with PHP
>> interpreters to do automated unit tests. Because we use PostgreSQL, I
>> want to set up those boxes without any Postgres libraries and
substitute
>> FIT test stubs in their place.
>>
>> 1. I have to use MS-Windows as my development platform. Currently I
have
>> XP-Pro with NetBeans 6.5.1. I have played with Eclipse and Komodo
>> Editor, which remain as possible options. I need a PHP interpreter
that
>> will allow me to write and debug FIT tests for functions already in
use,
>> as well as new code that I write or modify.
>>
>> 2. The production server is RHEL ES 5 with Apache 2 and PostgreSQL. I
>> cannot make any changes to this platform.
>>
>> 3. The build machine is running Fedora Core (version unknown), also
with
>> Apache and PostgreSQL installed as it is also used for integration
>> testing. I want to change this to remove the Postgres libraries so
they
>> can be replaced with the FIT back end. Integration testing would
require
>> a separate server which would also solve some other QA issues we
have.
>> We currently do both development and QA testing on this box,
releasing a
>> set of RPM files to production once they have been run through the
>> wringer.
>>
>> Is this a reasonable plan?
>>
>> Where can I find PHP interpreters for MS-Windows and FC that will
>> support this?
> 
> 
> http://www.phpunit.de/ ?

We have looked at that and it does not appear to be a workable option.
Near as I can tell it can only test OO code already organized as
classes. But...

1. None of the code I need to test is OO. The system was originally
written as PHP 4 procedures and has not been significantly changed since
then. Rewriting it as OOP has been discussed, but will not likely happen
in the next two or three years.

2. I don't do objects. After 40 years of procedural programming, with
the last 20 in low level embedded devices, I just cannot think that way.
In addition, I learned to program using "eschew obfuscation" as my
primary guideline. To me, OOP appears to be obfuscation taken to an
absurd level. I'm more into the concrete and have a real problem with
abstraction. So it takes me longer to read and understand other
programmers' objects than to write the same functions myself as
procedural code.

Now, is there any support to implement unit testing without objects?
Does my plan outline above have any merit?

Bob McConnell

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



[PHP] Problems with unit tests

2009-07-01 Thread Bob McConnell
I am using test-harness.php (PHP TAP Test Harness 1_0_0_BETA) and
test-more.php to write some unit tests for several libraries of
functions. These tests need to run from a MS-Windows CLI so they can be
run on our desktops for now and can be added to the automated build
process later.

I have written my first tests using test-more.php to generate TAP
compliant results, and they work as expected (see below - yes, both
tests should fail). But when I run them with test-harness.php, the
reported results are wrong (also below). The harness reports all tests
passed, even if they didn't.

After doing some digging, I found Bug #44908, which seems to be related.
It appears the interpreter on MS-Windows is not creating the pipe file
for STDOUT, so the harness never sees the results from the actual tests.
I also tried using the Perl Test::Harness to run the scripts and get the
same error message there. Both harnesses appear to ignore the error
count returned as the process exit value as well. But I am not sure if
that is true or they just never saw it.

Has any workaround been identified for this problem?

Is there another mailing list that might be a more appropriate forum for
this issue?

Thank you,

Bob McConnell

--9<-

D:\project\workspace\t>ver

Microsoft Windows XP [Version 5.1.2600] <<- XP Pro 2002 w/SP2

D:\project\workspace\t>php -v
PHP 5.2.10 (cli) (built: Jun 17 2009 16:16:57)
Copyright (c) 1997-2009 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2009 Zend Technologies

D:\project\workspace\t>php testSessionKV.php
1..2
not ok 1 - Should fail
# Failed test (D:\project\workspace\t\testSessionKV.php at line 13)
not ok 2 - Old KV pair
# Failed test (D:\project\workspace\t\testSessionKV.php at line 24)
# Looks like you failed 2 tests of 2.

D:\project\workspace\t>php test-harness.php -v
testSessionKV.php.ok
Could not open input file: D:

All test scripts passed!  All subtests passed!

D:\project\workspace>ren testSessionKV.php testSessionKV.t

D:\project\workspace>cd ..

D:\MMID\workspace\t>perl -v

This is perl, v5.10.0 built for MSWin32-x86-multi-thread  <<- Camelbox

Copyright 1987-2007, Larry Wall

D:\project\workspace>set HARNESS_PERL=php

D:\project\workspace>perl -MTest::Harness -e "@ARGV= map glob, @ARGV
if  $^O =~ /^MSWin/; runtests @ARGV;" t/*.t
t/testSessionKVCould not open input file: print join qq[\n], @INC
FAILED before any test output arrived
FAILED--1 test script could be run, alas--no output ever seen

--9<-

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



[PHP] Resources for unit tests

2009-07-06 Thread Bob McConnell
I am using Mike Lively's test-harness.php
<http://www.digitalsandwich.com/test-harness.php> with test-more.php
from Apache::Test for my unit test framework. I have also begun writing
stubs for PostgreSQL functions to run behind that. These tests will be
run on our function libraries as part of the build process just after
code is checked out from the VCS system (Perforce), but before creating
the installation RPMs. i.e. if a unit test fails, report the error and
don't build the RPM.

I am having some difficulty with the Postgres stubs that we don't have
the experience to figure out. Some functions return a resource, which
appears to be a complex form of array. Is there any way to build one
through PHP code, or do I even need to. Since these resources will only
be passed back into a later database call, can I simply replace them in
the stubs with an array? We don't expect to dereference them anyway.

Thank you,

Bob McConnell

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



RE: [PHP] Simple login form with cookies

2009-07-08 Thread Bob McConnell
From: Tony Marston

> I do not follows rules which cannot be justified beyond the expression
"It 
> is there, so obey it!" Why is it there? What are the alternatives?
What harm 
> does it do? What happens if the rule is disobeyed? Top posting existed
in 
> the early days of the internet, and for a logical reason. Then some
arrogant 
> prat came along and said "I don't like this, so I am going to make a
rule 
> which forbids it!". I don't like this rule, so I choose to disobey it.

Daniel already explained to you why it is there. Long threads get too
confusing with top posting. When posted correctly they read
chronologically from top to bottom so they can be followed and
understood when referenced a year or two later.

Top posting did not exist in the early days of the Internet. I was
active on email listserves and Usenet newsgroups 18 years ago, long
before Microsoft discovered them and decided that top posting should be
the norm. All of the other news and email clients I have ever used
defaulted to bottom posting. It was only in Outlook 2003 that Microsoft
finally removed that option completely. Previous versions allowed bottom
posting and even handled the attribution markup correctly.

Bob McConnell

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



RE: [PHP] Obeying the rules (was Simple login form with cookies)

2009-07-09 Thread Bob McConnell
A quick search on Google indicates this argument has been active in
various forums for over ten years, so I don't expect it to be resolved
here.

While ego is the most apparent motivator in these discussions I suspect,
but have no way to confirm, that the two camps are divided by how their
[email|news] client posts by default. GroupWise was the first
significant email client I am aware of that top posted replies. Since
that was the competitive target Outlook was created to eliminate,
Outlook also top posted by default. But prior to the Office 2003 release
it could still be configured to both bottom post and automatically
insert the line prefixes for attribution.

At the office I have to use Outlook. I hate it. Not only do I have to
hand edit every message to construct the replay, there are many other
problems that make it totally unsuitable for intelligent users.
Unfortunately, that description fits far too few of the actual users.

Bob McConnell

A: Maybe because some people are too annoyed by top-posting.
Q: Why do I not get an answer to my question(s)?
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on Usenet?

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



RE: [PHP] Obeying the rules (was Simple login form with cookies)

2009-07-09 Thread Bob McConnell
From: HallMarc Websites
>  
> Having just come in to the particular thread, I actually have work
that
> keeps me away from here, I'm wondering why this is worth the energy
and time
> I have seen wasted on this subject. Seems to me everyone needs to take
a
> deep breath and a step back. As far as anyone going against
convention,
> seems to me that people who think outside the box, go against
convention,
> break the rules, whatever are the ones who keep life interesting and
> occasionally help us find something new. I would hate to live in a
real life
> "Stepford Wives" existence.

Actually, I found it quite amusing to watch Tony paint himself into a
corner and try to defend his indefensible position. He reminds me of a
number of individuals, and not a few institutions, whose attitude is
"I've already made up my mind, don't try to confuse me with facts."
Plus, it has been a timely and welcome diversion from other more
pressing issues. Who needs the Comedy channel when we have this?

It will be even more interesting to see if anyone on this list pays any
attention to him in the future.

Bob McConnell

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



RE: [PHP] Establishing PHP Session From a Different Host

2009-07-13 Thread Bob McConnell
From: Daniel Kolbo
> Daniel Brown wrote:
>> On Sun, Jul 12, 2009 at 12:37, Daniel Kolbo wrote:
>>> Hello,
>>>
>>> How does one continue a php session on a different domain (domain B)
>>> than the domain (domain A) that started the session?
>> 
>> Simple answer: you don't.
>> 
> 
> Thanks for the responses.
> 
> Re: Simple answer
> I thought of another example.  My bank's website.  I sign-in and
> authenticate with "bank.com".  Then, i click credit card from bank.com
> and i'm redirected to "creditcard.com" without me having to reinput
> user/pass.  They clearly do it (granted they have a lot more resources
> then I do, but i'd still like to know how they are doing it).

My bank also does this, but it only works if Javascript is enabled when
I first log in. Otherwise the initial login fails and I do it again on
the second site. I haven't actually looked at the page sources to see
what they do. But I have NoScript configured to block all JS by default
so the initial login attempt always fails. It also reports blocked XSS
attempts on both pages. So whatever they are doing does not appear to be
very safe.

Bob McConnell

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



RE: [PHP] Need Help.

2009-07-14 Thread Bob McConnell
From: Martin Scotta
> 
> hahahahahaha
> 
> How are you to delete my history?
> The fact that you "develop" a website does not allow you to take the
> control of my browser.
> 
> But you can avoid the history to be populated by using javascript
> 
> 
>  Click to lalalal
> 

That would prevent me from navigating the site since I won't enable
JavaScript in my browser until I have trust in your website not to allow
any installation of malware on my computer. That trust must be earned by
you, since trust is not associative. Yes, there are a lot of sites that
I can't visit because of that. Right now I won't even enable JS for
either my bank or credit card issuer since neither has demonstrated the
knowledge, desire or ability to protect their servers or my browser.

Bob McConnell

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



RE: [PHP] Weird domain seting in setcookie()

2009-07-14 Thread Bob McConnell
From: Michelle Konzack
> 
> on two websites I have encountered that cookies are not working
properly
> and are accesibel from other subdomains which I do not  want.  The
line
> is:
> 
> setcookie('AdminOnCrack', $drug, $timeout, '/',
$_SERVER['HTTP_HOST']);
> 
> but the "domain" is always prefixed with a ".".
> 
> OK, now I have tested it using:
> 
> setcookie('AdminOnCrack', $drug, $timeout, '/', 'myspace.tdwave.net');
> 
> but with the same problem. I do not want that the cookies are
available
> in <*.myspace.tdwave.net>.
> 
> Any suggestions?

In Firefox 3.0 under Tools->Options->Privacy, uncheck "Accept
third-party cookies".

Bob McConnell

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



[PHP] Inverting a dependency list

2009-07-16 Thread Bob McConnell
I recall, years ago, having a set of utilities that would build a call
tree from application code written in C. This was useful for figuring
out dependencies in code that someone else had written. I would like to
do something similar with a large PHP application I am now maintaining,
but with a slightly different emphasis.

This application includes several library files which contain more than
400 function declarations. I need to determine how many of those
functions are actually used by the application and which can be culled
from the code base. Is there an easy way to determine which of them are
called somewhere and then work through the call tree to identify the
orphans?

Bob McConnell

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



RE: [PHP] Syntax Snag need extra eyes

2009-07-16 Thread Bob McConnell
From: Miller, Terion

> I'm almost there with my little pagination script but now I'm hung on
the
> "Unexpected T_Variable" error...which in the past has been a
semi-colon
> missing so I'm not sure why this is throwing it...eyes please:
> 
>  printf('
href="view.php?name=$row['name']">%s%s',$row['na
me']
> ,$row['address']);

It looks like you have nested single quotes. You probably need to escape
the inside set.

Bob McConnell

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



RE: [PHP] Compare PHP settings of two different servers

2009-07-23 Thread Bob McConnell
From: Dave M G

> Thank you for replying.
>> Just diff the HTML. 
> 
> Unfortunately it is not that easy. Even if the same PHP modules are 
> present, if they are written into the page in a different place, they 
> show up as differences. The same goes for all the HTML tags and 
> everything else, so what I end up with is a ton of text, no more 
> streamlined or easy to analyze than the original output from
phpinfo().
> 
> I'm hoping there's a way more targeted way of discerning what settings

> one server may have that another server might not.

Save each page to a text file.
Sort the two text files.
Run 'diff -iw' on the sorted files.
Add additional flags to diff as needed.

If you need more than that, you will probably have to write your own
utility to handle it.

You should also get copies of httpd.conf and php.ini from each server
and compare them. They will affect how some of those modules behave.

Bob McConnell

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



RE: [PHP] Compare PHP settings of two different servers

2009-07-23 Thread Bob McConnell
From: Dave M G

> I'm currently having a problem with PHP writing text to a PNG image on

> one server.
> 
> I have various web sites hosted on various servers, and on most of
them, 
> the script that generates the image is writing text properly. I have 
> ensured that the same fonts are available on all the servers.

Another thought comes to mind. What text encoding are you using and what
are the locale settings on those servers?

Bob McConnell

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



RE: [PHP] open source forum

2009-07-27 Thread Bob McConnell
From: mrfroasty

> I need some advice in picking a PHP forum for a group of people, I
know
> there are couple of them but could somebody from here give advice on
> which one to choose.

Your request is a bit open ended. Are you looking for blogs, wiki,
message based, or what?

A couple of years ago we set up Dokuwiki as a grass roots effort in the
development group. In just over a year we had 1100 pages created. It was
so popular that management got into the act and decided to replace it
with an officially supported Confluence server. Very few of us
considered that an upgrade, but that's what happens when the PHB's get
involved.

I maintained the Dokuwiki server on a Red Hat system. It took about 30
minutes a week to keep up. It's all PHP, with numerous add-on features
and capabilities.

Bob McConnell

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



RE: [PHP] Single Quotes in Form Inputs

2009-07-27 Thread Bob McConnell
From: Yuri Yarlei

> I think mysql_real_escape_string()  is work well, but if
> you are use mysql db, if you are using another db, the best
> function is addslashes but for another special charactes
> you will need treat them with another ways

Slashes are the wrong character to use. The official SQL escape is a
single quote character. Some database managers accept either, but using
slashes can cause more problems than they solve. Find the correct
escape_string function for your database and use it.

Bob McConnell

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



RE: [PHP] Making several variables into 1 variable

2009-07-28 Thread Bob McConnell
From: Ashley Sheridan
> On Tue, 2009-07-28 at 09:32 -0400, Miller, Terion wrote:
>> I need to take this:
>> 
>>$pastDays = strtotime("-30 days");
>> 
>> 
>> 
>> $past_day = date("d", $pastDays);
>> 
>> $past_month = date("m", $pastDays);
>> 
>> $past_year =date("y", $pastDays);
>> 
>> 
>> And make it into one var to compare to a db field that is formatted
like
>> 00/00/00 
>> 
>> 
> Erm, why don't you do this:
> 
> $pastDays = strtotime("-30 days");
> $date = date("d/m/y", $pastDays);
> 
> The date() function allows you to mix in all sorts of characters into
> the output it formats, and you can escape characters that have special
> meaning with a slash '\' character.

The problem with that is if that field is a string, and not formatted as
YY/MM/DD, then a simple compare won't work in January. You have to break
it down into the three components and compare each one in turn.

Bob McConnell

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



RE: [PHP] Making several variables into 1 variable

2009-07-28 Thread Bob McConnell
From: Miller, Terion
On 7/28/09 8:35 AM, "Ashley Sheridan"  wrote:

> $pastDays = strtotime("-30 days");
> $date = date("d/m/y", $pastDays);
> 
> Well I tried and got no results from my query and I know there
> results with date ranges in the last 30 days, I basically need
> to count backward from now() 30 days I thought strtotime() would
> work well..but the fields in the db are varchar not date fields
> they are all formatted the same though 00/00/00:

If the dates are really stored as varchar, you are doing a lexical
comparison on a field that is meaningless in that context. You will need
to break the string down somewhere and do three separate comparisons.

Bob McConnell

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



RE: [PHP] Font problem

2009-07-28 Thread Bob McConnell
From: Ashley Sheridan
> On Tue, 2009-07-28 at 08:52 -0700, Jim Lucas wrote:
>> Dušan Novaković wrote:
>> > Hi,
>> > 
>> > Is there a possibility that if there is no font installed on client
>> > side somehow browser finds it and redirect that font form server to
>> > client machine. For example: I have site that use Microsoft font and
>> > that font is not available on Linux distributions. So when u open page
>> > in FF on some Linux u get some default font (because browser doesn't
>> > recognize that font). I hope that I've managed to explane a problem
>> > :-) Does anyone has any solution for this problem??? Please it's very
>> > urgent
>> 
>> It is possible, but you have to use the proper type of font file.
>> 
>> It is usually referred to as "Font Embedding" or "Embedding Fonts" using CSS
>> 
> Basically, there is no way to guarantee what it will look like, which is
> annoying really. Wait a bit until all the browsers support it and are in
> common use.

If you really need this level of control HTML is the wrong medium. You should 
be using PDF, page sized images or other locked down formats. HTML was designed 
so the browser and user have ultimate control over layout, appearance, fonts, 
colors and other details. Nothing you can do should ever make any difference 
there.

Bob McConnell

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



RE: [PHP] Getting rid of extra lines

2009-07-29 Thread Bob McConnell
From: Miller, Terion

/* snip */

Before anyone can tell you how to fix it, you need to find out what is
causing that white space. is it empty lines, vertical tabs, thousands of
spaces, ...? Once you find that out, it is pretty easy to decide how to
get rid of them. Can you save the output to a file and open it with a
hex viewer?

Bob McConnell

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



RE: [PHP] fileinfo returning wrong mime type for Excel files

2009-07-30 Thread Bob McConnell
From: Christoph Boget

>> Have you tried using 'file -i' from the command line: after all you
are looking
>> for a MIME type with your fileinfo...
>> Having said that, with file -i on my system, Word documents are
>> 'application/msword' and Excel files are 'application/octet-stream'
> 
> $ file -i excel.xls
> excel.xls: application/msword
> 
> The xls file I am using was generated with Excel (of Office 2007) for
> the Mac.  So either you have a different magic file (assuming that's
> what the file command uses) than I do or different versions of excel
> contain different information.

Those two statements are not mutually exclusive. Both may be true.

Bob McConnell

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



RE: [PHP] issue with mail function

2009-08-04 Thread Bob McConnell
From: Allen McCabe

> I have recently been working a lot lately with arrays and printing
them into
> html tables for email (like a user survey for example). I have been
seeing
> odd things with the table lately, each unique to it's sending php
file. I
> will get a space in a random spot. In one, I used an array to rename
the
> Name values of input fields to more readable ones, "whatadd" becomes
"What
> to Add", only the word 'Add' is spelled 'Ad d'. With my recent mail
script
> (submitting a customer profile change), I get it in a similar area, a
Name
> value renamed and I get "Emp loyee" in the table cell. The adjacent
cell is
> fine though, reading "Needs Handicap Accommodations". I will post some
of my
> code to show that I haven't misplaced a space:

How far apart are these spaces? Is something on your server injecting
new lines on lines of text it thinks are too long? This would be
displayed by the browser as a space. View source at the browser to see
what was actually added. If this is the case, I suspect you are running
on a Microsoft platform and forgot to set binary mode somewhere.

Bob McConnell

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



RE: [PHP] "PHP 6 and MySQL 5 for Dynamic Web Sites" Book

2009-08-06 Thread Bob McConnell
From: sono...@fannullone.us

>   Has anyone read this book by Larry Ullman yet?  If so, what do
you  
> think about it?  I'm looking for a well-rounded book that covers PHP  
> for e-commerce websites and from what little I've been able to find  
> online, it looks pretty good.  Or would you recommend another book?

Like all books with MySQL in the title, I'm waiting for it to be
translated into PostgreSQL.

We used to have MySQL in our systems, but when they changed to the
per-server license fee structure we had to change to PostgreSQL. Two
proposals we had in progress for distributed systems would have ended up
with 80% of the price being passed through as fees to MySQL AB.

Bob McConnell

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



RE: [PHP] Displaying user data and picture

2009-08-07 Thread Bob McConnell
From: Ralph Deffke

> however there are some reasonable reasons to store a
> image in the database.
> 1. if u have no access to write files to the disk this
> is the case in most free hosting services they give u
> php and mysql and thats it
> 2. if u want some access control to the image, e.g. login
> controlled. server admins dont like u playing arround
> with the htaccess file
> 3. its easy in those and other cases
> 4. image directores are public, and apear in search engines

5. There is a natural relationship between the images and other data
already in the database, such as ID photos linked to employee numbers.

Bob McConnell

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



RE: [PHP] DB Question | A hotel reservation scenario

2009-08-19 Thread Bob McConnell
From: Ashley Sheridan
> On Tue, 2009-08-18 at 19:15 +0430, Behzad wrote:
>> 
>> I'm faced with an interesting and challenging problem.
>> 
>> Consider a database, designed for a hotel.
>> At any given time, each room has a different status: It's Busy or
Reserved,
>> or Free.
>> 
>> It's easy to retrieve number of Free rooms at the current time.
>> But how can I count the number of rooms that were busy during the
last week
>> ?
>> 
>> I would appreciate if you take a brief moment of your time and share
your
>> opinion.
> 
> Keep a table that lists all the rooms along with their current status
> 
> Keep another table that has these fields:
>   * room_id (the id from above table)
>   * status (enumerated value - 'busy','reserved')
>   * start_date
>   * end_date
> 
> Then you perform your query using a join of these two tables, within a
> particular date range. I've left out 'free' from the second table
> because there's no point updating the table for a period if a room is
> not being used.
> 
> You could also have start_date and end_date as datetime fields, as
every
> hotel i've ever been in has a set time for check-in and another for
> check-out.

It would be easier if you kept a record of the status changes to and
from busy (check-in and check-out) as a transaction log. Then you can
scan the log to see the status changes for any time period. But you
still have to deal with a room that stayed busy for the entire period.

First question, does busy include the time needed by housekeeping to
clean the room after checkout? You might want to consider a separate
status for that.

Second question, does the system keep track of when each room is
reserved? If one is reserved for three nights beginning Friday, can it
still be used Wednesday for a one or two night stay?

Bob McConnell

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



RE: [PHP] Re: PHP and CGI

2009-08-19 Thread Bob McConnell
From: sono...@fannullone.us
> On Aug 18, 2009, at 7:13 PM, Shawn McKenzie wrote:

> P.S.  Does anyone know of a good Perl mailing list?

beginn...@perl.org

Or you can try www.perlmonks.org.

Bob McConnell

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



RE: [PHP] PHP/Ajax Framework - Call for Developers & Testers

2009-08-21 Thread Bob McConnell
From: Raymond Irving

> Hi Nathan,
> 
> I agree with you, and I believe that there are many persons
> who don't like the idea of hosting all their applications on
> a third party server. IMO there are some advantages and
> disadvantages to doing so but that's a discussion in itself.

Hosted servers are basically a trade off between doing it yourself and
paying someone else to do it. The initial choice is between installing
your own servers or spend the money to rent servers from someone else.
Most of the time it is actually the network bandwidth issue that decides
this. Can you afford a network connection that will handle the peak
loads but be unused most of the time?

But once you decide to pay someone else, you have another set of trade
offs to negotiate. What services do they provide? What systems do they
offer? How do they manage version control and updates? Are they PCI
compliant? There are a wide range of options available in the market.
Not all of them will fit your specific needs.

We just moved most of our servers from a physical hosting service to a
managed service. Where we used to maintain the OS and all software on
the server, the new service now handles that for us. The trade off is
that now we have to settle for the server package they offer. That means
we get the versions of Apache, PHP and PostgreSQL that were included in
the last production release of RHEL. If we want a newer version of PHP,
we have to take over maintenance of that component. It becomes our
responsibility to install the updates, patches, etc., for that
component.

Once you get beyond a private web site these types of decisions become
part of the management process, just as make or buy decisions are part
of the hardware procurement process. There are people out there making a
good living just guiding companies through this decision making process.

Bob McConnell

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



RE: [PHP] Re: page works on public web site, but not on my computer

2009-08-26 Thread Bob McConnell
I recommend you start by replacing Vista. There are so many problems
with it that Microsoft is rushing to ship a replacement as soon as
possible. It remains to be seen whether Windows 7 is a real fix or
merely more of the same problems.

I am not aware of any serious developers writing code specifically for
Vista. We only test our products on it enough to decide if we will
support each product on that OS. If they don't work out of the box, we
don't support them nor recommend our clients install them on Vista.
There are no copies of Vista installed in the company outside of the ESX
servers used for testing.

I would recommend Red Hat as the replacement.

Bob McConnell

-Original Message-
From: mike bode [mailto:mikebo...@hotmail.com] 
Sent: Tuesday, August 25, 2009 11:41 PM
To: php-general@lists.php.net
Subject: [PHP] Re: page works on public web site, but not on my computer

I just de-installed, then re-installed MySQL, Apache and PHP 5.3. No 
changes. The script does not work on my computer.

Now I get in addition to the error message below this:

[Tue Aug 25 21:29:11 2009] [error] [client 127.0.0.1] PHP Deprecated: 
Function eregi() is deprecated in
C:\\webdev\\rmv3\\album\\getalbumpics.php 
on line 11, referer: http://localhost/album.php

Don't know if those warnings would stop the execution of the php script.


""mike bode""  wrote in message 
news:99.f2.08117.ccf74...@pb1.pair.com...
>I have posted the question in another thread a bit down, but only
buried 
>within the thread, so please excuse me when I ask again.
>
> I want to use some PHP code from a web site 
> (http://www.dynamicdrive.com/dynamicindex4/php-photoalbum.htm), and I
am 
> following their instruction how to implement it. I was not able to get
it 
> to work. Then I uploaded the code to a server, and lo and behold, it
does 
> work on the server. On the public site you see thumbnails of images
(never 
> mind the junk above them), when I run the SAME html and php code on my

> omputer, I get a blank white page.
>
> The error log has several entries, but they are all warnings:
>
> [Tue Aug 25 18:12:00 2009] [error] [client 127.0.0.1] PHP Warning: 
> date(): It is not safe to rely on the system's timezone settings. You
are 
> *required* to use the date.timezone setting or the 
> date_default_timezone_set() function. In case you used any of those 
> methods and you are still getting this warning, you most likely
misspelled 
> the timezone identifier. We selected 'America/Denver' for '-6.0/DST' 
> instead in C:\\webdev\\rmv3\\album\\getalbumpics.php on line 11,
referer: 
> http://localhost/album.htm
>
> (this error is repeated for as many images I have in the directory
that 
> the php script is reading).
>
> Between php.ini, httpd.conf, and Windows Vista, I can't figure out
where 
> to start to diagnose this, and how. Anybody out there who can give me
a 
> pointer on how to roubleshoot this issue? I am almost ready to throw
in 
> the towel and either start from scratch (although this is alrady the 
> second time that I have uninstalled and re-installed everything), or 
> simply forget about php altogether. that would be a shame, though... 


-- 
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] Sockets (reading)

2009-08-26 Thread Bob McConnell
From: Philip Thompson
> 
> During a socket read, why would all the requested number of bytes not

> get sent? For example, I request 1000 bytes:
> 
>  $data = @socket_read ($socket, 2048, PHP_BINARY_READ);
> ?>
> 
> This is actually in a loop, so I can get all the data if split up. So,

> for example, here's how the data split up in 3 iterations (for 1000  
> bytes):
> 
> 650 bytes
> 200 bytes
> 150 bytes
> 
> But if I can accept up to 2048 bytes per socket read, why would it not

> pull all 1000 bytes initially in 1 step? Any thoughts on this would be

> greatly appreciated!

Because that's the way TCP/IP works, by design. TCP is a stream
protocol. It guarantees all of the bytes written to one end of the pipe
will come out the other end in the same order, but not necessarily in
the same groupings. There are a number of buffers along the way that
might split them up, as well as limits on packet sizes in the various
networks it passed through. So you get what is available in the last
buffer when a timer expires, no more, and no less.

If you have serialized data that needs to be grouped in specific blocks,
your application will need to keep track of those blocks, reassembling
or splitting the streamed data as necessary. You could use UDP which
does guarantee that packets will be kept together, but that protocol
doesn't guarantee delivery.

Bob McConnell

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



RE: [PHP] Sockets (reading)

2009-08-26 Thread Bob McConnell
From: Shawn McKenzie
> Bob McConnell wrote:
>> From: Philip Thompson
>>> During a socket read, why would all the requested number of bytes
not
>> 
>>> get sent? For example, I request 1000 bytes:
>>>
>>> >> $data = @socket_read ($socket, 2048, PHP_BINARY_READ);
>>> ?>
>>>
>>> This is actually in a loop, so I can get all the data if split up.
So,
>> 
>>> for example, here's how the data split up in 3 iterations (for 1000

>>> bytes):
>>>
>>> 650 bytes
>>> 200 bytes
>>> 150 bytes
>>>
>>> But if I can accept up to 2048 bytes per socket read, why would it
not
>> 
>>> pull all 1000 bytes initially in 1 step? Any thoughts on this would
be
>> 
>>> greatly appreciated!
>> 
>> Because that's the way TCP/IP works, by design. TCP is a stream
>> protocol. It guarantees all of the bytes written to one end of the
pipe
>> will come out the other end in the same order, but not necessarily in
>> the same groupings. There are a number of buffers along the way that
>> might split them up, as well as limits on packet sizes in the various
>> networks it passed through. So you get what is available in the last
>> buffer when a timer expires, no more, and no less.
>> 
>> If you have serialized data that needs to be grouped in specific
blocks,
>> your application will need to keep track of those blocks,
reassembling
>> or splitting the streamed data as necessary. You could use UDP which
>> does guarantee that packets will be kept together, but that protocol
>> doesn't guarantee delivery.
> 
> I'm not sure this has much to do with the OP's problem, but this part
is
> backwards.  TCP is connection oriented and tracks segments by sequence
> number for each connection.  This enables the stack to pass the data
in
> order to the higher layers.  UDP is connectionless and has no way to
> determine what datagram was sent before the other one, so it is up to
> the higher layers to reassemble.  As for IP in general, if packets
need
> to be fragmented along the way by a router in order to fit the MTU of
a
> different network, then the IP stack on the receiving end will
> reassemble the fragments based upon information that the router
injects
> into the fragments.

Shawn,

You're looking at it inside out. Yes, the individual packets are tracked
by the stack, to make sure they arrive in the correct order. But the
size and fragmentation of those packets have no relationship at all to
any data structure the application layer may imply. They simply
implement a communications stream to reliably move octets from one point
to another. If the application needs structure, it has to manage that
for itself.

For UDP, if you write a 32 byte packet, the matching read will get a 32
byte packet, if it arrived at the receiving stack. Missed data detection
and retry requests are left up to the application.

Bob McConnell

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



RE: [PHP] Sockets (reading)

2009-08-26 Thread Bob McConnell
From: Philip Thompson
> On Aug 26, 2009, at 11:56 AM, Bob McConnell wrote:
>> From: Philip Thompson
>>>
>>> During a socket read, why would all the requested number of bytes
not
>>> get sent? For example, I request 1000 bytes:
>>>
>>> >> $data = @socket_read ($socket, 2048, PHP_BINARY_READ);
>>> ?>
>>>
>>> This is actually in a loop, so I can get all the data if split up.  
>>> So,
>>> for example, here's how the data split up in 3 iterations (for 1000
>>> bytes):
>>>
>>> 650 bytes
>>> 200 bytes
>>> 150 bytes
>>>
>>> But if I can accept up to 2048 bytes per socket read, why would it  
>>> not
>>> pull all 1000 bytes initially in 1 step? Any thoughts on this would

>>> be
>>> greatly appreciated!
>>
>> Because that's the way TCP/IP works, by design. TCP is a stream
>> protocol. It guarantees all of the bytes written to one end of the  
>> pipe
>> will come out the other end in the same order, but not necessarily in
>> the same groupings. There are a number of buffers along the way that
>> might split them up, as well as limits on packet sizes in the various
>> networks it passed through. So you get what is available in the last
>> buffer when a timer expires, no more, and no less.
>>
>> If you have serialized data that needs to be grouped in specific  
>> blocks,
>> your application will need to keep track of those blocks,
reassembling
>> or splitting the streamed data as necessary. You could use UDP which
>> does guarantee that packets will be kept together, but that protocol
>> doesn't guarantee delivery.
> 
> Thank you for your input.
> 
> Is it guaranteed that at least 1 byte will be sent each time? For  
> example, if I know the data length...
> 
>  $input = '';
> 
> for ($i=0; $i<$dataLength; $i++) {
>  // Read 1 byte at a time
>  if (($data = @socket_read ($socket, 1, PHP_BINARY_READ)) !==  
> false) {
>  $input .= $data;
>  }
> }
> 
> return $input;
> ?>
> 
> Or is this a completely unreasonable and unnecessary way to get the  
> data?

While I have written a lot of code to manage sockets over the years, and
coded a UDP/IP stack, I have never done it in PHP. And unfortunately, I
don't have time to experiment right now. My boss is waiting for the next
product release from me.

Getting one byte at a time is somewhat wasteful, as it requires more
system calls than necessary. That's a lot of wasted overhead.

Whether you always get one or more bytes depends on a number of factors,
including whether the calls PHP uses are blocking or non-blocking, plus
there may be ways to switch the socket back and forth.

Have you tried doing a Google search on the group of PHP functions you
expect to use. That should come up with some sample code to look at.

Bob McConnell

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



RE: [PHP] phpmailer send() always return true even the email address is invalid

2009-08-27 Thread Bob McConnell
From: Ashley Sheridan
> On Thu, 2009-08-27 at 20:38 +0800, Keith wrote:
>> Due to my web hosting server implement SMTP authentication, I
couldn't do it 
>> with PHP mail() function, so I opt for PHPMailer.
>> However, the $mail->Send() method always return true even I've set
the 
>> $mail->AddAddress with invalid email address.
>> I've tried with valid address. It's good and I've received the email.
>> Then I set it with invalid x...@gmail.com, the return value is true,
and I 
>> have received email from mailer daemon that gmail has rejected the
email.
>> Then I set the $mail->Address with invalid name & invalid domain.
This time, 
>> the $mail->Send() still return as true, however, I didn't receive
email from 
>> mailer daemon this time.
>> 
>> Any idea why this happened? Any solution for me or suggestion to use
other 
>> send mail class/function that support SMTP authentication?
>> 
> The return code only informs you that the mail was sent successfully,
> not that it was received, so you can have invalid email addresses and
> still have the function return true.

The return code only tells you the local server accepted the mail. It is
unlikely that server knows the address is invalid since it can only
validate the domain portion of the address. Only the destination server
can validate the user name, and most are now configured not to report
mail sent to invalid addresses due to spam. They will silently discard
the message.

Bob McConnell

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



RE: [PHP] phpmailer send() always return true even the emailaddress is invalid

2009-08-27 Thread Bob McConnell
From: Paul M Foster

> On Thu, Aug 27, 2009 at 09:00:24AM -0400, Bob McConnell wrote:
>> 
>> The return code only tells you the local server accepted the mail. It
is
>> unlikely that server knows the address is invalid since it can only
>> validate the domain portion of the address. Only the destination
server
>> can validate the user name, and most are now configured not to report
>> mail sent to invalid addresses due to spam. They will silently
discard
>> the message.
>> 
> 
> It used to be that internet mail servers would deny an email address
as
> invalid while the SMTP conversation was going on. Then, because of
> services with millions of addresses, like Yahoo, they stopped doing
> this, and instead would bounce the messages back some time later.
> 
> I recently had a conversation with a guy who's heavily involved in
> internet email. His view echoed what you're saying-- it does spammers
a
> favor to bounce messages to bad addresses. But I got the impression
that
> his view was a minority one.
> 
> It sounds like you're saying his view has become the majority view.
Does
> your job put you in a position to confirm this with authority?

No, it doesn't. However, as part of my job I have monitored several
security lists. When SPAM generators, that had been widely deployed by
virus, started sending mail with random return addresses, they forced
another change in the email admin best practices discussion. For a short
while the network became clogged in bounce messages sent to both valid
and invalid addresses. Some of the invalid addresses even triggered
infinite loops of error messages. None of the servers I am familiar with
send bounce messages reporting invalid addresses any more. Our own
servers won't even tell us internally when they discard incoming
messages. SPAM quarantine is a thing of the past.

Bob McConnell

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



RE: [PHP] Re: page works on public web site, but not on my computer

2009-08-27 Thread Bob McConnell
Mike,

It's not MS-Windows, it's just Vista. Vista was designed and distributed
for use as a home entertainment center. It was loaded with DRM and other
restrictions to entice the RIAA and MPAA to use it as their primary
platform for distributing music and movies, respectively. That pretty
much broke it for any serious uses.

If you can't avoid MS-Windows, at least upgrade to XP.

Bob McConnell

-Original Message-
From: mike bode [mailto:mikebo...@hotmail.com] 
Sent: Thursday, August 27, 2009 10:49 AM
To: php-general@lists.php.net
Subject: Re: [PHP] Re: page works on public web site, but not on my
computer

I understand, but that's not an option. I am not interested in getting
into 
a Linux vs. Windows fight here, let's just say that I am stuck with
Windows.

Now, somthing's gotta be seriously wrong here. I have tried now 4 or 5 
different scripts for the photo gallery that I am trying to implement
and 
NONE of them has worked. I have enabled all extensions and loaded all 
modules in Apache and php -- still nothing.

I can't believe that the Apache Society out there simply ignores the 80%
or 
so that use Windows. Can anybody point me to a group that deals with
Apache 
(PHP) on Windows?  Thanks.

mike

"Ashley Sheridan"  wrote in message 
news:1251290333.27899.27.ca...@localhost...
> On Wed, 2009-08-26 at 08:27 -0400, Bob McConnell wrote:
>> I recommend you start by replacing Vista. There are so many problems
>> with it that Microsoft is rushing to ship a replacement as soon as
>> possible. It remains to be seen whether Windows 7 is a real fix or
>> merely more of the same problems.
>>
>> I am not aware of any serious developers writing code specifically
for
>> Vista. We only test our products on it enough to decide if we will
>> support each product on that OS. If they don't work out of the box,
we
>> don't support them nor recommend our clients install them on Vista.
>> There are no copies of Vista installed in the company outside of the
ESX
>> servers used for testing.
>>
>> I would recommend Red Hat as the replacement.
>>
>> Bob McConnell
>>
>> -Original Message-
>> From: mike bode [mailto:mikebo...@hotmail.com]
>> Sent: Tuesday, August 25, 2009 11:41 PM
>> To: php-general@lists.php.net
>> Subject: [PHP] Re: page works on public web site, but not on my
computer
>>
>> I just de-installed, then re-installed MySQL, Apache and PHP 5.3. No
>> changes. The script does not work on my computer.
>>
>> Now I get in addition to the error message below this:
>>
>> [Tue Aug 25 21:29:11 2009] [error] [client 127.0.0.1] PHP Deprecated:
>> Function eregi() is deprecated in
>> C:\\webdev\\rmv3\\album\\getalbumpics.php
>> on line 11, referer: http://localhost/album.php
>>
>> Don't know if those warnings would stop the execution of the php
script.
>>
>>
>> ""mike bode""  wrote in message
>> news:99.f2.08117.ccf74...@pb1.pair.com...
>> >I have posted the question in another thread a bit down, but only
>> buried
>> >within the thread, so please excuse me when I ask again.
>> >
>> > I want to use some PHP code from a web site
>> > (http://www.dynamicdrive.com/dynamicindex4/php-photoalbum.htm), and
I
>> am
>> > following their instruction how to implement it. I was not able to
get
>> it
>> > to work. Then I uploaded the code to a server, and lo and behold,
it
>> does
>> > work on the server. On the public site you see thumbnails of images
>> (never
>> > mind the junk above them), when I run the SAME html and php code on
my
>>
>> > omputer, I get a blank white page.
>> >
>> > The error log has several entries, but they are all warnings:
>> >
>> > [Tue Aug 25 18:12:00 2009] [error] [client 127.0.0.1] PHP Warning:
>> > date(): It is not safe to rely on the system's timezone settings.
You
>> are
>> > *required* to use the date.timezone setting or the
>> > date_default_timezone_set() function. In case you used any of those
>> > methods and you are still getting this warning, you most likely
>> misspelled
>> > the timezone identifier. We selected 'America/Denver' for
'-6.0/DST'
>> > instead in C:\\webdev\\rmv3\\album\\getalbumpics.php on line 11,
>> referer:
>> > http://localhost/album.htm
>> >
>> > (this error is repeated for as many images I have in the directory
>> that
>> > the php script is reading).
>> >
>> > Between php.ini, httpd.conf, and Windows Vista, I can't figure out
>> whe

RE: [PHP] Re: unset() something that doesn't exist

2009-08-27 Thread Bob McConnell
From: Ben Dunlap

>> ISTR the Royal Air Force has a "Specialist Aircrew" track where the
really good
>> pilots, who wanted to fly planes rather than desks, could be promoted
to
>> "management" ranks but avoid the management duties.
> 
> They had a position like this at the first big company I worked for --
> "Member of the Technical Staff". These folks were very good at what
> they did, but again, not interested in, or perhaps not suited for,
> management.

The US military structure calls these technical specialists Warrant
Officers. But there are very few positions that qualify. There is one
retired WO down the hall from me. He flew "sky hook" style helicopters
for the US Army.

There have been numerous discussions over the years about how to reward
people who know how to manage information and knowledge better than they
can manage people. There have been Staff Scientists at some companies
which were actually senior engineers. Bob Pease at National
Semiconductor is one example. But this only seems to work at large
companies. I think the biggest problem is that HR types don't want to
acknowledge these types of people exist. It doesn't fit their nice
little arrangement of pigeon holes.

Bob McConnell

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



  1   2   3   >