RE: [PHP] Re: OOP methodology

2004-02-02 Thread chris . neale
Thanks - very useful way of looking at things. I think I'll opt for applying
this principle to the way I plan to improve my system. Currently far too
bulky. Of course, now the project has progresse, finding time to refactor
and effectively build most of it from scratch, is quite hard.

Cheers

Chris

-Original Message-
From: Justin Patrin [mailto:[EMAIL PROTECTED]
Sent: 30 January 2004 17:19
To: [EMAIL PROTECTED]
Subject: [PHP] Re: OOP methodology


Wow, that's a lot of stuff in one class. Personally, I've started using 
the MVC (Model, View, Controller) architecture. Basically what it does 
is seperates Data logic from Display logic and Control logic. Here's how 
I've been using it.

Model: Holds and deals with all data for the program, such as database 
connections / queries, session data, data consistency. I am currently 
using classes which use PEAR DB_DataObject for DB connections, querying, 
and data storage.

View: Deals with displaying of data from model. ONLY does displaying, no 
processing. Very minimal logic only associated with outputting. 
Currently, I am using Smarty entirely for the view. Little no no PHP 
code, only Smarty. The View in this case is just a smarty template file.

Controller: Handles requests from the browser. Instantiates Model and 
View, calls functions in Model to alter its state (updating from 
$_REQUEST vars, for instance). Chooses a view and then tells the view to 
display. For me, this is all home-grown PHP.

This architecture can be much more complicated in, say, a C++ program, 
but the Server/Client pattern built into web programs makes it much more 
simple. The reason that I use this particular architecture is that it 
factors all of the pieces of your program very nicely. Later, if you do 
things right, you can use a single screen from one program in another 
with minimal editing.

Here's a few pages that discuss MVC:
http://ootips.org/mvc-pattern.html
http://st-www.cs.uiuc.edu/users/smarch/st-docs/mvc.html

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
 
If you are not the intended recipient of this e-mail, please preserve the
confidentiality of it and advise the sender immediately of any error in
transmission. Any disclosure, copying, distribution or action taken, or
omitted to be taken, by an unauthorised recipient in reliance upon the
contents of this e-mail is prohibited. Somerfield cannot accept liability
for any damage which you may sustain as a result of software viruses so
please carry out your own virus checks before opening an attachment. In
replying to this e-mail you are granting the right for that reply to be
forwarded to any other individual within the business and also to be read by
others. Any views expressed by an individual within this message do not
necessarily reflect the views of Somerfield.  Somerfield reserves the right
to intercept, monitor and record communications for lawful business
purposes.

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



[PHP] Flash interface to CLI PHP Script vs GTK

2004-02-02 Thread chris . neale
I'm sure people have had wilder ideas, but this is what I'm trying to do.

I'm disappointed by the lack of clear documentation and examples for GTK and
the strange way the package insists on using its own binary php.exe (for
win32) instead of being just a simple extension. And I've yet to find a way
to put 2 buttons on the new window. I tried this 6 months ago, can't
remember the detail but remember thinking at the time, stuff this! Never
again etc. The documentation wasn't clear to me, so I'm not sure what I've
said is strictly true.

I've written an application which iterates through a database, performing
various functions along the way, and at each step there are about 20
variables which I'd like to see. These are output to the console at such
speed that it's hard to see what's going on unless it crashes and you can
look at the error log. I'd like to have a basic GUI for outputting this
information and it occurred to me that I could use PHP's COM functionality
to create a Shockwave Flash object (as I have done in Excel VBA for example)
and then pass data from PHP, through to the custom fields in a custom made
flash object. My application runs in the CLI version of PHP 5. I've tried to
instantiate the flash object, but it doesn't recognise the term Shockwave
Flash Object when I try to create it. Am I just trying to create the object
using the wrong object name?

Or is this because it's a plugin? And if so, how come it works when I
created a test in Excel VBA (where I managed to interact with a flash object
from within a VBA script).

My only other option is to create a Internet Explorer object, load a
document with an embedded flash object and then reference it from there, but
that sounds even more 'cowboy-coder' to me.

My thinking is that if it's easy to talk to a flash object (and I believe
it's possible for a COM object to talk back to PHP) then it strikes me that
a flash file would be an improved interface to PHP than GTK - it looks nicer
for starters, smooth fonts and animation not as hard to implement.

Failing this, I'm considering writing a PHP script with socket support which
can talk to a Flash object in a client-server manner.

Anyone got any thoughts on this?

Thanks

Chris
 
If you are not the intended recipient of this e-mail, please preserve the
confidentiality of it and advise the sender immediately of any error in
transmission. Any disclosure, copying, distribution or action taken, or
omitted to be taken, by an unauthorised recipient in reliance upon the
contents of this e-mail is prohibited. Somerfield cannot accept liability
for any damage which you may sustain as a result of software viruses so
please carry out your own virus checks before opening an attachment. In
replying to this e-mail you are granting the right for that reply to be
forwarded to any other individual within the business and also to be read by
others. Any views expressed by an individual within this message do not
necessarily reflect the views of Somerfield.  Somerfield reserves the right
to intercept, monitor and record communications for lawful business
purposes.

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



RE: [PHP] The PHP Problem

2004-02-02 Thread chris . neale
I was in the same shoes a few years ago and used this.

http://www.net-language.com/workshops/Default.asp?workshop=21

It's a good guide, shows you how to set up a web server, php and mysql on
your own PC (win32). As it's for a slightly older version of PHP some parts
of the guide don't no longer hold true, but for the most part you shouldn't
have any problems; you should have it all up and running in a few hours.
You'll have an ideal test system to start trying out your code, and should
learn a bit about how to administrate MySQL databases and Apache web servers
in the process.

Hope that helps.

Chris

ps. Recommend you write notes for yourself as you install and setup. eg.
you'll probably only have to do one or two MySQL grant statements to get it
running, which if your like me you'll forget as soon as it works. Every time
I install it I waste 2 hours trawling through manuals trying to get the
syntax right, promising myself Next Time I'll Take Notes. I never do.

-Original Message-
From: Ash [mailto:[EMAIL PROTECTED]
Sent: 30 January 2004 18:52
To: [EMAIL PROTECTED]
Subject: [PHP] The PHP Problem


Hi,
I am totally new to PHP and dont know a thing. I tried looking through the
articles but they were of no use. My Question is:
How can I just write php in a text editor, save it as a .php, and view it in
internet explorer, offline? I have tried everything and it just wont work.
I tried the code:

?php
echo Hi, I'm a PHP script!;
?

in a .php file and nothing happened. Nothing will work, help!

I dont have a website, I just want to write and use the code.

Tnaks   from Ashley Williams

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
 
If you are not the intended recipient of this e-mail, please preserve the
confidentiality of it and advise the sender immediately of any error in
transmission. Any disclosure, copying, distribution or action taken, or
omitted to be taken, by an unauthorised recipient in reliance upon the
contents of this e-mail is prohibited. Somerfield cannot accept liability
for any damage which you may sustain as a result of software viruses so
please carry out your own virus checks before opening an attachment. In
replying to this e-mail you are granting the right for that reply to be
forwarded to any other individual within the business and also to be read by
others. Any views expressed by an individual within this message do not
necessarily reflect the views of Somerfield.  Somerfield reserves the right
to intercept, monitor and record communications for lawful business
purposes.

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



[PHP] OOP methodology

2004-01-30 Thread Chris Neale
This is a long one - I'm trying to get to grips with my understanding of 
OOP.

I'm not sure that I understand object oriented programming as well as I 
could to benefit from using it in PHP. Although I've used it to produce 
working applications, of the few objects I've produced nearly all have 
carried too much weight and functionality (one object for both HTML 
generation and DB interaction etc) and several have been extensions of the 
others. 

I was hoping someone might be able to check my logic. 

One of the main functions of the application I'm working on at the moment, 
my first use of OOP in PHP, is to iterate through a hierarchy of retail 
outlets and extract information from a database based on each location in 
the hierarchy. A template SQL statement is parsed and parts are replaced 
with information from the hierarchy. This query is then executed, and the 
results are placed in a table within a static HTML file stored in a 
directory structure which mirrors the structure of the retail outlet 
hierarchy. I've done it this way because the traffic to the site is 
expected to be high and the information changes infrequently, so static 
pages will ensure good performance.

The way I've written the application isn't up to much IMO, using objects in 
a primitive way akin to a PC newbie using the CD ROM drive as a coffee cup 
holder - ie. does the job but it's not quite how it was intended to be 
used.

I've got one big object (treeMapper) that does everything, which includes 
(over and above the database functions, file input and output, HTML 
generation and string formatting). It has two main methods. Process() and 
taskMaster(). The first method iterates one unit through the hierarchy and 
then calls taskMaster() which takes values Process() has changed in the 
object and uses them to query the database and to format the results into 
an HTML table and output to a file (as described above). 

In the code for the class, taskmaster() is empty. When I want to use the 
class, I create a new class which extends treeMapper and then overrides the 
taskMaster function. In this way I get an object which I can reuse for any 
report which needs to be made for every store. It works and it's fast, but 
this method seems really WRONG! 

I started developing this six months ago as a first project in OOP in PHP, 
and am starting to see it's limitations - for instance, I need to use the 
DB functions for other small tasks on the site, which involves 
instantiating a new treeMapper (which is highly inefficient as I won't need 
the other 20 methods.). I've also got some handy string manipulation 
routines which can't be used without instantiating a treeMapper. So I want 
to break it up into smaller chunks, smaller objects which can talk to each 
other.

From what I've read, I think I should be using an iterator pattern to 
design an object which JUST does the iteration, a database object which 
JUST does queries from the database, another iterator object which JUST 
does iteration through database results and another object which draws 
graphs based on results from the database. 

My question is (I know you've been waiting) how best to connect up these 
objects, as I only really need one instance of each object for my 
application. PHP 5 objects seem easier to deal with (none of this 
incomprehensible  notation) and I want to know whether the following is a 
good way of doing it and how other people might go about this.

class dbObj
{
var $results;
function dbObj()
{//set up DB con}
function execQuery()
{//ODBC query exec - results put in $this-results}
}

class iterator
{
var $currentPos
function iterator()
{//loads data into iterator}
function reset()
{//Resets pointer}
function next()
{//steps forward one item, changes $this-currentPos to whatever.}
}

class HTMLGenerator
{
function HTMLGenerator($dbObj, $iterator)
{
$this-dbObj = $dbObj;
$this-iterator = $iterator;
}
function MakeHTML()
{// as you'd expect.
// refers to $dbObj and $iterator (objects passed by reference in
// PHP 5)
// $iterator-currentPos used to parse SQL query
// eg. $dbObj-execQuery(select...);
// eg. $dbObj-results used to make HTML;

// }
function outputToFile()
{//Saves to File}
}

The main application would then do this:

$q = new dbObj;
$x = new iterator;
$y = new HTMLGenerator($q, $x)

while ($x-next())
{
$y-MakeHTML();
$y-outputToFile();
}

Anyone got any thoughts about whether this is a good way to do it? I was 
wondering whether instantiating objects should be done within other objects 
that need them - if this can be done - but I would only do that in cases 
where (for instance) an HTMLGenerator object is instantiated without any 
parameters, in which case some logic could be added to do this.

Thanks!

Chris

-- 
PHP General Mailing List (http://www.php.net/)

RE: [PHP] I need answers for the questions

2003-11-18 Thread chris . neale
Ha ha. This looks like your homework. At school some people used to pay
money for other people to do their homework for them (which may have
inspired 'sub-contracting' and consultancy).

Minimal research will get you the answers. RTFM, look on Google, buy a book,
try it for yourself, use your initiative.

C


-Original Message-
From: Arivazhagi Govindarajan [mailto:[EMAIL PROTECTED]
Sent: 18 November 2003 07:12
To: [EMAIL PROTECTED]
Subject: [PHP] I need answers for the questions


PHP Questions

1. Explain about session management and cookies ? In PHP how we can maintain

a session

2. What is HTTP tunneling

3. How to enable PHP in Apache server manually?

4. When we upload a file using INPUT tag of the type FILE what are global 
variables become available for use in PHP

5. Explain SQL injections ? How we can avoid this

6. Write a small script to connect a MYSQL server in PHP

7. Given a class B network with subnet mask of 255.255.248.0 and a packet 
addressed to 130.40.32.16 whatis subnet address

8. Using single Apache server can we host multiple sites . If yes how can we

do this if no why it is not possible

9. what is search engine optimization ? In HTML using which tag we can 
attain this?

10. Write a function in PHP script to check whether string is a valid email 
id or not?

_
Garfield on your mobile. Download now. http://server1.msn.co.in/sp03/gprs/ 
How cool can life get?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
 
If you are not the intended recipient of this e-mail, please preserve the
confidentiality of it and advise the sender immediately of any error in
transmission. Any disclosure, copying, distribution or action taken, or
omitted to be taken, by an unauthorised recipient in reliance upon the
contents of this e-mail is prohibited. Somerfield cannot accept liability
for any damage which you may sustain as a result of software viruses so
please carry out your own virus checks before opening an attachment. In
replying to this e-mail you are granting the right for that reply to be
forwarded to any other individual within the business and also to be read by
others. Any views expressed by an individual within this message do not
necessarily reflect the views of Somerfield.  Somerfield reserves the right
to intercept, monitor and record communications for lawful business
purposes.

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



RE: [PHP] Microsoft .NET arguement

2003-11-17 Thread chris . neale
I agree. I've found MS SQL (and MS Access databases) to be extremely fast
when well optimised, even with massive databases. As you can interface with
them using ODBC I prefer to use MS database backends when my clients already
have them installed alongside PHP for Win32.

C



-Original Message-
From: Dan Joseph [mailto:[EMAIL PROTECTED]
Sent: 17 November 2003 16:26
To: [EMAIL PROTECTED]
Subject: RE: [PHP] Microsoft .NET arguement


Hi,

From my experiences, your coworkers are somewhat correct.  I found
MySQL to
be as fast in most cases, however in databases with millions of records,
MySQL started slowing down before the MS SQL did.

As for PHP being slower to program, I disagree.  Its about the same,
and in
some cases, PHP might have a few more shortcuts.

Maybe they're using some visual editors to speed them up?

-Dan Joseph

 -Original Message-
 From: Mike R [mailto:[EMAIL PROTECTED]
 Sent: Monday, November 17, 2003 11:07 AM
 To: [EMAIL PROTECTED]
 Subject: [PHP] Microsoft .NET arguement



 I have someone here at my desk arguing that Microsoft's .NET is
 better than
 PHP - faster to process, easier and quicker to program, etc.

 They also (claim) that Microsoft's SQL is much faster and such vs. MySQL.

 Any comments to help me defend PHP or to educate me?

 :)

 -Mike

 --
 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
 
If you are not the intended recipient of this e-mail, please preserve the
confidentiality of it and advise the sender immediately of any error in
transmission. Any disclosure, copying, distribution or action taken, or
omitted to be taken, by an unauthorised recipient in reliance upon the
contents of this e-mail is prohibited. Somerfield cannot accept liability
for any damage which you may sustain as a result of software viruses so
please carry out your own virus checks before opening an attachment. In
replying to this e-mail you are granting the right for that reply to be
forwarded to any other individual within the business and also to be read by
others. Any views expressed by an individual within this message do not
necessarily reflect the views of Somerfield.  Somerfield reserves the right
to intercept, monitor and record communications for lawful business
purposes.

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



RE: [PHP] Change text size with GD

2003-10-27 Thread chris . neale
I use the function imageTTFtext allows you to specify a string with a font
and a font point size.

Hope that helps.

Chris

-Original Message-
From: Cranky [mailto:[EMAIL PROTECTED]
Sent: 27 October 2003 10:16
To: [EMAIL PROTECTED]
Subject: [PHP] Change text size with GD


Hello,
I would like to draw text in a rectangle on an image.
The text must take all the place in the rectangle.

The trouble is that with imagestring(), there are only 5 fonts (1, 2, 3, 
4, 5) and the bigger (5) is still too smaller for my rectangle.

Is there another way to change the size of the text ?

Thanks a lot

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
 
If you are not the intended recipient of this e-mail, please preserve the
confidentiality of it and advise the sender immediately of any error in
transmission. Any disclosure, copying, distribution or action taken, or
omitted to be taken, by an unauthorised recipient in reliance upon the
contents of this e-mail is prohibited. Somerfield cannot accept liability
for any damage which you may sustain as a result of software viruses so
please carry out your own virus checks before opening an attachment. In
replying to this e-mail you are granting the right for that reply to be
forwarded to any other individual within the business and also to be read by
others. Any views expressed by an individual within this message do not
necessarily reflect the views of Somerfield.  Somerfield reserves the right
to intercept, monitor and record communications for lawful business
purposes.

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



RE: [PHP] php header function

2003-10-24 Thread chris . neale
http://uk.php.net/header

Have a look at that. As it says, sends an HTTP header. Useful if you want to
specify content type in the page that isn't HTML (maybe an image or a pdf).

Read the above for more info.

Regards

Chris

-Original Message-
From: Shaun van den Berg [mailto:[EMAIL PROTECTED]
Sent: 24 October 2003 09:47
To: [EMAIL PROTECTED]
Subject: [PHP] php header function


Hi

I have tried the net , googling ect. but i cannot get a good description of
what the header function is al about ? Can anyone please define the header
function.

Thanks
Shaun

--
Novtel Consulting
Tel: +27 21 9822373
Fax: +27 21 9815846
Please visit our website:
www.novtel.co.za

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
 
If you are not the intended recipient of this e-mail, please preserve the
confidentiality of it and advise the sender immediately of any error in
transmission. Any disclosure, copying, distribution or action taken, or
omitted to be taken, by an unauthorised recipient in reliance upon the
contents of this e-mail is prohibited. Somerfield cannot accept liability
for any damage which you may sustain as a result of software viruses so
please carry out your own virus checks before opening an attachment. In
replying to this e-mail you are granting the right for that reply to be
forwarded to any other individual within the business and also to be read by
others. Any views expressed by an individual within this message do not
necessarily reflect the views of Somerfield.  Somerfield reserves the right
to intercept, monitor and record communications for lawful business
purposes.

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



[PHP] Calling object variables is untidy and lengthy - any other ideas?

2003-10-20 Thread chris . neale
Here's the problem. I have a php script which generates a Year-on-Year
change graph, works fine, does the job. I want to turn it into an object.
Unfortunately I have to rename all references to variables in the object to
$this-width for example. Is there a way I can just refer to them as before.
With plenty of complex formulas in it, having $this- everywhere makes it a
mess to look at and a nightmare to debug.

Any thoughts?

Chris
 
If you are not the intended recipient of this e-mail, please preserve the
confidentiality of it and advise the sender immediately of any error in
transmission. Any disclosure, copying, distribution or action taken, or
omitted to be taken, by an unauthorised recipient in reliance upon the
contents of this e-mail is prohibited. Somerfield cannot accept liability
for any damage which you may sustain as a result of software viruses so
please carry out your own virus checks before opening an attachment. In
replying to this e-mail you are granting the right for that reply to be
forwarded to any other individual within the business and also to be read by
others. Any views expressed by an individual within this message do not
necessarily reflect the views of Somerfield.  Somerfield reserves the right
to intercept, monitor and record communications for lawful business
purposes.

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



[PHP] Building associative arrays

2003-10-03 Thread chris . neale
I'm stuck.

I'm trying to build an associative array from a database result. How can I
assign a new key and value pair

eg

mysql_fetch_row etc
{
dbRowCol1 = myarray(key)
dbRowCol2 = myarray(value)
}

You get the general idea. Can't find any examples. I'm trying to lookup a
key and retrieve the corresponding value.

Any ideas?

Thanks

Chris
 
If you are not the intended recipient of this e-mail, please preserve the
confidentiality of it and advise the sender immediately of any error in
transmission. Any disclosure, copying, distribution or action taken, or
omitted to be taken, by an unauthorised recipient in reliance upon the
contents of this e-mail is prohibited. Somerfield cannot accept liability
for any damage which you may sustain as a result of software viruses so
please carry out your own virus checks before opening an attachment. In
replying to this e-mail you are granting the right for that reply to be
forwarded to any other individual within the business and also to be read by
others. Any views expressed by an individual within this message do not
necessarily reflect the views of Somerfield.  Somerfield reserves the right
to intercept, monitor and record communications for lawful business
purposes.

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



RE: [PHP] How to swap the table's bg color with php

2003-10-03 Thread chris . neale
Try using stylesheets instead of javascript. I think you need to use :hover
on either the td element and then specify a style. background-color I think
it is.

I haven't got my HTML reference handy and can't remember the specifics, but
that's the general idea.

Hope that's of some use.

Regards

Chris

-Original Message-
From: Jack [mailto:[EMAIL PROTECTED]
Sent: 03 October 2003 10:12
To: [EMAIL PROTECTED]
Subject: [PHP] How to swap the table's bg color with php


Dear all
I had write a script using php,which will pull the values from a mysql table
to display in HTML.
now i want to add a function which when the mouse had move over a table
cell, the background of the table cell will turn to other color!

Is anyone know how i can perform this task?
Thx alot!
Jack

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
 
If you are not the intended recipient of this e-mail, please preserve the
confidentiality of it and advise the sender immediately of any error in
transmission. Any disclosure, copying, distribution or action taken, or
omitted to be taken, by an unauthorised recipient in reliance upon the
contents of this e-mail is prohibited. Somerfield cannot accept liability
for any damage which you may sustain as a result of software viruses so
please carry out your own virus checks before opening an attachment. In
replying to this e-mail you are granting the right for that reply to be
forwarded to any other individual within the business and also to be read by
others. Any views expressed by an individual within this message do not
necessarily reflect the views of Somerfield.  Somerfield reserves the right
to intercept, monitor and record communications for lawful business
purposes.

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



RE: [PHP] Building associative arrays

2003-10-03 Thread chris . neale
Perfect. Thanks for that. I can't think associative arrays first thing in
the morning. Seems a bit clearer now...

C

-Original Message-
From: Eugene Lee [mailto:[EMAIL PROTECTED]
Sent: 03 October 2003 12:07
To: [EMAIL PROTECTED]
Subject: Re: [PHP] Building associative arrays


On Fri, Oct 03, 2003 at 10:22:55AM +0100, [EMAIL PROTECTED]
wrote:
: 
: I'm trying to build an associative array from a database result. How can I
: assign a new key and value pair
: 
: eg
: 
: mysql_fetch_row etc
: {
: dbRowCol1 = myarray(key)
: dbRowCol2 = myarray(value)
: }
: 
: You get the general idea. Can't find any examples. I'm trying to lookup a
: key and retrieve the corresponding value.

If you really want your table's field names returned as keys, try using
mysql_fetch_assoc().

http://www.php.net/manual/en/function.mysql-fetch-row.php

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
 
If you are not the intended recipient of this e-mail, please preserve the
confidentiality of it and advise the sender immediately of any error in
transmission. Any disclosure, copying, distribution or action taken, or
omitted to be taken, by an unauthorised recipient in reliance upon the
contents of this e-mail is prohibited. Somerfield cannot accept liability
for any damage which you may sustain as a result of software viruses so
please carry out your own virus checks before opening an attachment. In
replying to this e-mail you are granting the right for that reply to be
forwarded to any other individual within the business and also to be read by
others. Any views expressed by an individual within this message do not
necessarily reflect the views of Somerfield.  Somerfield reserves the right
to intercept, monitor and record communications for lawful business
purposes.

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



RE: [PHP] Compare dates

2003-09-29 Thread chris . neale
I always use Unix timestamps until I need to format it to a (what's the
word) date for presentation.

Then you can just to a if $x  $y then it happened before $y.

look for mktime(), time(), date() in the manual.

C

-Original Message-
From: Shaun [mailto:[EMAIL PROTECTED]
Sent: 29 September 2003 10:52
To: [EMAIL PROTECTED]
Subject: [PHP] Compare dates


Hi,

How can I compare two dates with PHP, to see if one date occurred before the
other?

Thanks for your help

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
 
If you are not the intended recipient of this e-mail, please preserve the
confidentiality of it and advise the sender immediately of any error in
transmission. Any disclosure, copying, distribution or action taken, or
omitted to be taken, by an unauthorised recipient in reliance upon the
contents of this e-mail is prohibited. Somerfield cannot accept liability
for any damage which you may sustain as a result of software viruses so
please carry out your own virus checks before opening an attachment. In
replying to this e-mail you are granting the right for that reply to be
forwarded to any other individual within the business and also to be read by
others. Any views expressed by an individual within this message do not
necessarily reflect the views of Somerfield.  Somerfield reserves the right
to intercept, monitor and record communications for lawful business
purposes.

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



RE: [PHP] MerlinWork PHP Framework

2003-09-29 Thread chris . neale
I like I like.

Look like it might cut a lot of tedious leg-work out.

Regards

Chris

-Original Message-
From: Fabrizio Balliano [mailto:[EMAIL PROTECTED]
Sent: 29 September 2003 12:37
To: [EMAIL PROTECTED]
Subject: [PHP] MerlinWork PHP Framework


Hi to all,
I'd like to present show you a PHP framework written by my company:
MerlinWork.

Its built with the concept of allowing developers to build a web
application like they would do with a client application developing
environment.

The result is a stateful application, managed by events.
Developer has a set of widget to use, like tables, fields, buttons etc.

It's distribuited under the GPL licence and it's available at
http://merlinwork.sourceforge.net.

An interactive (easy development) demo is available at
http://merlinwork-demo.crealabs.it.

Its core features are:
- strongly object oriented
- stateful
- many usable and customizable objects
- self installing
- no database required

Feel free to download and try it and make me know what do you think
about it.
Regards

-- 
Fabrizio Balliano


CREALABS
Viale dei Mughetti, 13/A - 10151 Torino - Italy
Tel. +39-011-735645 - Fax +39-011-735645
http://www.crealabs.it - mailto:[EMAIL PROTECTED]

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
 
If you are not the intended recipient of this e-mail, please preserve the
confidentiality of it and advise the sender immediately of any error in
transmission. Any disclosure, copying, distribution or action taken, or
omitted to be taken, by an unauthorised recipient in reliance upon the
contents of this e-mail is prohibited. Somerfield cannot accept liability
for any damage which you may sustain as a result of software viruses so
please carry out your own virus checks before opening an attachment. In
replying to this e-mail you are granting the right for that reply to be
forwarded to any other individual within the business and also to be read by
others. Any views expressed by an individual within this message do not
necessarily reflect the views of Somerfield.  Somerfield reserves the right
to intercept, monitor and record communications for lawful business
purposes.

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



RE: [PHP] PHP coders spare time [OT}

2003-09-29 Thread chris . neale
And possibly the best looking site I've seen in years. Colours, curves -
bring it on

PLENTY of spare time I think...

C

-Original Message-
From: Jay Blanchard [mailto:[EMAIL PROTECTED]
Sent: 29 September 2003 13:00
To: Justin French; Curt Zirzow
Cc: [EMAIL PROTECTED]
Subject: RE: [PHP] PHP coders spare time [OT}


[snip]
 http://zirzow.dyndns.org/html/mlists/php_general/

The fact that you're the top responder in the last 30 days pretty much 
confirms you have too much spare time Curt!
[/snip]

LOL! Very revealing and funny stuff 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
 
If you are not the intended recipient of this e-mail, please preserve the
confidentiality of it and advise the sender immediately of any error in
transmission. Any disclosure, copying, distribution or action taken, or
omitted to be taken, by an unauthorised recipient in reliance upon the
contents of this e-mail is prohibited. Somerfield cannot accept liability
for any damage which you may sustain as a result of software viruses so
please carry out your own virus checks before opening an attachment. In
replying to this e-mail you are granting the right for that reply to be
forwarded to any other individual within the business and also to be read by
others. Any views expressed by an individual within this message do not
necessarily reflect the views of Somerfield.  Somerfield reserves the right
to intercept, monitor and record communications for lawful business
purposes.

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



RE: [PHP] RE : [PHP] PHP Rading excel files

2003-09-29 Thread chris . neale
I'd consider using COM to work with Excel files if you can't find another
way to get the information out. The PHP Handbook (O'Reilly) has a good
chapter on that sort of thing. Then you can just refer to a cell as you
would in Excel VBA.

Sorry I can't think of anything better!

C

-Original Message-
From: BENARD Jean-philippe
[mailto:[EMAIL PROTECTED]
Sent: 29 September 2003 13:24
To: 'Kevin Bruce'
Cc: [EMAIL PROTECTED]
Subject: [PHP] RE : [PHP] PHP  Rading excel files


I know exporting xls file to csv (or other tagged export) is not very
difficult but in order to make a « all-users » application we must
accept xls files.

 

Cordialement,
Jean-Philippe BENARD
Consultant STERIA Infogérance
([EMAIL PROTECTED]) 

-Message d'origine-
De : Kevin Bruce [mailto:[EMAIL PROTECTED] 
Envoyé : lundi 29 septembre 2003 14:40
À : BENARD Jean-philippe
Objet : Re: [PHP] PHP  Rading excel files

 

I created a database dump that accepts tab delimited files. You'd have
to export your xls file to a tab delimited file (which is a no-brainer).

Here is the code (it was made to import into a user database, change it
to suite your purposes):

?

if(!$dump)
{
?
  There are currently b?php echo $total ?/b
entries in the 
  ?php echo $user_admin ? database.br
  Choose your ?php echo $mod_name ? Admin action from
the above 
  menu. /font/p
h1font size=2Database Import/font/h1
font size=2 
form action=?php echo $_SERVER[PHP_SELF]
??dump=predumpcategory=?php echo $category ? method=post
enctype=multipart/form-data name=form1
  font size=2 Tab Delimited File Database Import 
  input type=file name=file accesskey=1/label
  input name=user_level type=hidden id=user_level
value=?php echo $category ?
  br
  input type=submit name=Submit value=Submit
  /font 
/form
?php
}

if($dump == predump)
{
if(!$file_name)
{
echo File did not upload! Please hit your back button and
upload your import file.;
}
else
{
//read file
$fp = fopen($file, r);
$data = fread($fp, filesize($file));
fclose($fp);
$fileC = explode(\r, $data);
flush();

//get the 1st line, which usually contains the field names
$sample = $fileC[0];

//get the longest entry as a sample of all fields, just in
case the first line doesn't contain the field names
$sample2 = max($fileC);
$samplenum = explode(\t,$sample);
$numfields = count($samplenum);
$sample = td .
str_replace(\t,nbsp;/tdtd,$sample) . nbsp;/td\n;
$sample2 = td .
str_replace(\t,nbsp;/tdtd,$sample2) . nbsp;/td\n;

//set the form variable to carry over into next form
$import = implode($fileC,|);
?
form name=form2 method=post action=?php echo
$_SERVER[PHP_SELF] ??dump=dumpcategory=?php echo $category ?
  input name=category type=hidden value=?php echo
$category ?
  ?php 
$fieldrop = fieldrop($dbh,$DBname,$tablename);
?
  table  border=1 cellpadding=5 cellspacing=0
bordercolor=#CC summary=Match up the database fields with the
sample entry form this import
caption align=top
Match up the database fields with the sample entry
form this 
import br
There are ?php echo $numfields - 1; ?-?php echo
$numfields; ? entries in this import.
/caption
tr bgcolor=#CC 
  ?php
for($n=0;$n$numfields;$n++)
{
  echo td 
div align=\center\ 
  select name=\field[$n]\ id=\field[$n]\

echo $fieldrop
  /select
/div/td;
} 
?
/tr
tr class=fonty ?php echo $sample ? /tr
tr class=fonty ?php echo $sample2 ? /tr
tr bgcolor=#CC 
  td colspan=15 div align=centerfont
size=2 
  input name=numfields type=hidden
value=?php echo $numfields; ?
  input name=import type=hidden
value=?php echo base64_encode($import) ?
  /font/div
div align=centerfont size=2font
size=2 br
label
input name=notify type=checkbox
value=1 checked
Send welcome email to imported entries.
(choosing this means it will take appximately ?php 

RE: [PHP] RE : [PHP] PHP Rading excel files

2003-09-29 Thread chris . neale
Just thought that it might be worth considering putting some functionality
into the Excel spreadsheet to trigger the PHP application.

I've created Excel spreadsheets in the past with a VBA macro or two in it
which allows users to update information on a intranet site from the
spreadsheet. They update their spreadsheet as normal and then press a button
which opens up a web browser control and passes the information to the
server in a get statement. Page reloads, capture the return message from the
server and show to user who never sees the web browser.

I don't know exactly what you're developing so can't be sure if this will be
of any use.

Regards

Chris



-Original Message-
From: Marek Kilimajer [mailto:[EMAIL PROTECTED]
Sent: 29 September 2003 13:41
To: BENARD Jean-philippe
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] RE : [PHP] PHP  Rading excel files


Given that excel (and generaly any microsoft app/bloatware) puts so much 
junk into the files that sometimes excel itself cannot read it it is 
virtualy impossible to write a pure php solution. The easiest path is to 
use COM and run excel on the server, but this rules out any non windows 
server. Or try to dig into openoffice and wrap its excel routines in a 
php extension.

BENARD Jean-philippe wrote:

 I know exporting xls file to csv (or other tagged export) is not very
 difficult but in order to make a « all-users » application we must
 accept xls files.
 
  
 
 Cordialement,
 Jean-Philippe BENARD
 Consultant STERIA Infogérance
 ([EMAIL PROTECTED]) 
 
 -Message d'origine-
 De : Kevin Bruce [mailto:[EMAIL PROTECTED] 
 Envoyé : lundi 29 septembre 2003 14:40
 À : BENARD Jean-philippe
 Objet : Re: [PHP] PHP  Rading excel files
 
  
 
 I created a database dump that accepts tab delimited files. You'd have
 to export your xls file to a tab delimited file (which is a no-brainer).
 
 Here is the code (it was made to import into a user database, change it
 to suite your purposes):
 
 ?
 
 if(!$dump)
 {
 ?
   There are currently b?php echo $total ?/b
 entries in the 
   ?php echo $user_admin ? database.br
   Choose your ?php echo $mod_name ? Admin action from
 the above 
   menu. /font/p
 h1font size=2Database Import/font/h1
 font size=2 
 form action=?php echo $_SERVER[PHP_SELF]
 ??dump=predumpcategory=?php echo $category ? method=post
 enctype=multipart/form-data name=form1
   font size=2 Tab Delimited File Database Import 
   input type=file name=file accesskey=1/label
   input name=user_level type=hidden id=user_level
 value=?php echo $category ?
   br
   input type=submit name=Submit value=Submit
   /font 
 /form
 ?php
 }
 
 if($dump == predump)
 {
 if(!$file_name)
 {
 echo File did not upload! Please hit your back button and
 upload your import file.;
 }
 else
 {
 //read file
 $fp = fopen($file, r);
 $data = fread($fp, filesize($file));
 fclose($fp);
 $fileC = explode(\r, $data);
 flush();
 
 //get the 1st line, which usually contains the field names
 $sample = $fileC[0];
 
 //get the longest entry as a sample of all fields, just in
 case the first line doesn't contain the field names
 $sample2 = max($fileC);
 $samplenum = explode(\t,$sample);
 $numfields = count($samplenum);
 $sample = td .
 str_replace(\t,nbsp;/tdtd,$sample) . nbsp;/td\n;
 $sample2 = td .
 str_replace(\t,nbsp;/tdtd,$sample2) . nbsp;/td\n;
 
 //set the form variable to carry over into next form
 $import = implode($fileC,|);
 ?
 form name=form2 method=post action=?php echo
 $_SERVER[PHP_SELF] ??dump=dumpcategory=?php echo $category ?
   input name=category type=hidden value=?php echo
 $category ?
   ?php 
 $fieldrop = fieldrop($dbh,$DBname,$tablename);
 ?
   table  border=1 cellpadding=5 cellspacing=0
 bordercolor=#CC summary=Match up the database fields with the
 sample entry form this import
 caption align=top
 Match up the database fields with the sample entry
 form this 
 import br
 There are ?php echo $numfields - 1; ?-?php echo
 $numfields; ? entries in this import.
 /caption
 tr bgcolor=#CC 
   ?php
 for($n=0;$n$numfields;$n++)
 {
   echo td 
 div align=\center\ 
   select name=\field[$n]\ id=\field[$n]\
 
   

RE: [PHP] How to accept file through http from curl c program??

2003-09-26 Thread chris . neale
At a first glance:

  $fp=fopen(brianLog1, w+);

brianlog1 should either be in quotes if that's the name of the file and the
file doesn't have an extension. Or maybe it's a variable in which case
you'll need to put the $ in front of it..

Hope that helps

Regards

Chris



-Original Message-
From: Brian Moynihan [mailto:[EMAIL PROTECTED]
Sent: 26 September 2003 10:25
To: [EMAIL PROTECTED]
Subject: [PHP] How to accept file through http from curl c program??


Hi there,

Hopefully someone can shed some light for us on this.

We have a client who is sending us a file through a C program which uses
Curl. At our end we have a php script to accept the file passed through the
form. This php script works fine using a browser however, it does not pick
up what the C program sends to us.

Our php is below, $_FILES contains zilch!! Any ideas?:

  foreach( $_FILES as $varname = $fileinfo ){
$filename = $fileinfo[name];
$tmpname  = $fileinfo[tmp_name];
  }

  $uploaddir = '/usr/local/nameofdir/;
  $uploadfile = $uploaddir. $_FILES['filename']['name'];

  if (move_uploaded_file($_FILES['filename']['tmp_name'], $uploadfile)) {

$fp=fopen(brianLog1, w+);
$string = HTTPS POST of Purchase Order SUCCESSFUL. File
Name: .$_FILE['filename']['name'].\n;
fwrite($fp, $string);
  }
  else {
$fp=fopen(brianLog2, w+);
$string = HTTPS POST Failed !* File Name:
.$_FILES['filename']['name'].\nTmp Name: 
.$_FILES['filename']['tmp_name'];
fwrite($fp, $string);

  }
?
 
If you are not the intended recipient of this e-mail, please preserve the
confidentiality of it and advise the sender immediately of any error in
transmission. Any disclosure, copying, distribution or action taken, or
omitted to be taken, by an unauthorised recipient in reliance upon the
contents of this e-mail is prohibited. Somerfield cannot accept liability
for any damage which you may sustain as a result of software viruses so
please carry out your own virus checks before opening an attachment. In
replying to this e-mail you are granting the right for that reply to be
forwarded to any other individual within the business and also to be read by
others. Any views expressed by an individual within this message do not
necessarily reflect the views of Somerfield.  Somerfield reserves the right
to intercept, monitor and record communications for lawful business
purposes.

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



RE: [PHP] Databases

2003-09-25 Thread chris . neale
You find a reasonable example if you go googling for 'PHP tutorial' and then
sit down for an evening and read the manual. 

C

-Original Message-
From: Shaun van den Berg [mailto:[EMAIL PROTECTED]
Sent: 25 September 2003 07:14
To: [EMAIL PROTECTED]
Subject: [PHP] Databases


Hi

Im kinda new to php. I have a linux server witch has our website on it. I
want to make a download page. If a person clicks on a link , they must be
able to download from our server. How difficult is this , can you send me an
example ?

Thanks
Shaun van den Berg

--
Novtel Consulting
Tel: +27 21 9822373
Fax: +27 21 9815846
Please visit our website:
www.novtel.co.za

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
 
If you are not the intended recipient of this e-mail, please preserve the
confidentiality of it and advise the sender immediately of any error in
transmission. Any disclosure, copying, distribution or action taken, or
omitted to be taken, by an unauthorised recipient in reliance upon the
contents of this e-mail is prohibited. Somerfield cannot accept liability
for any damage which you may sustain as a result of software viruses so
please carry out your own virus checks before opening an attachment. In
replying to this e-mail you are granting the right for that reply to be
forwarded to any other individual within the business and also to be read by
others. Any views expressed by an individual within this message do not
necessarily reflect the views of Somerfield.  Somerfield reserves the right
to intercept, monitor and record communications for lawful business
purposes.

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



RE: [PHP] Refresh php section

2003-09-25 Thread chris . neale
Consider 4 IFRAMEs on one page, with meta refreshes in each header which
point to your php script with a get parameter of whichever 'section' you're
dealing with.

Regards

Chris

-Original Message-
From: ascll [mailto:[EMAIL PROTECTED]
Sent: 25 September 2003 08:48
To: [EMAIL PROTECTED]
Subject: [PHP] Refresh php section


= start Test.php =
// Section-A
?php
...
?

// Section-B
?php
...
?

// Section-C
?php
...
?

// Section-D
?php
...
?
= end Test.php =

Greetings,

It that a way for me to reload Section-A's php codes every 1-second and
Section-D's php codes every 5-second, that belongs to the SAME php file, say
test.php?

Thanks in advance.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
 
If you are not the intended recipient of this e-mail, please preserve the
confidentiality of it and advise the sender immediately of any error in
transmission. Any disclosure, copying, distribution or action taken, or
omitted to be taken, by an unauthorised recipient in reliance upon the
contents of this e-mail is prohibited. Somerfield cannot accept liability
for any damage which you may sustain as a result of software viruses so
please carry out your own virus checks before opening an attachment. In
replying to this e-mail you are granting the right for that reply to be
forwarded to any other individual within the business and also to be read by
others. Any views expressed by an individual within this message do not
necessarily reflect the views of Somerfield.  Somerfield reserves the right
to intercept, monitor and record communications for lawful business
purposes.

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



RE: [PHP] Am stuck

2003-09-25 Thread chris . neale
Try Str_len and str_pad

Regards

Chris

-Original Message-
From: Chris Grigor [mailto:[EMAIL PROTECTED]
Sent: 25 September 2003 13:10
To: php
Subject: [PHP] Am stuck 


Good day all

I have a txt file that has values from various strings written to it.

What Im looking for is the following

$name = Chris';

I need to do a count on $name so that it returns 5 letters. Then before
writing it to the output file I
know that it has to be 40 charecters long before it gets written.

So I know its 5 now I need automatically add another 35 empty spaces to it
to make it 40 so that it makes the 
$name like this 

$name = Chris;    if I do a
count on this it should be 40 charecters long


Can anyone help out here???

Chris
 
If you are not the intended recipient of this e-mail, please preserve the
confidentiality of it and advise the sender immediately of any error in
transmission. Any disclosure, copying, distribution or action taken, or
omitted to be taken, by an unauthorised recipient in reliance upon the
contents of this e-mail is prohibited. Somerfield cannot accept liability
for any damage which you may sustain as a result of software viruses so
please carry out your own virus checks before opening an attachment. In
replying to this e-mail you are granting the right for that reply to be
forwarded to any other individual within the business and also to be read by
others. Any views expressed by an individual within this message do not
necessarily reflect the views of Somerfield.  Somerfield reserves the right
to intercept, monitor and record communications for lawful business
purposes.

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



RE: [PHP] Add a leading zero

2003-09-24 Thread chris . neale
Maybe use strlen to check the length of the $i then if it's less than 2 do
$i = 0.$i

Quick and dirty, but I've done that trick myself in the past. 

C

-Original Message-
From: Marek Kilimajer [mailto:[EMAIL PROTECTED]
Sent: 24 September 2003 12:43
To: Shaun
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] Add a leading zero


www.php.net/str_pad

Shaun wrote:

 Hi,
 
 How can i add a leading zero to the first result of this loop so that i
get
 00, 15, 30, 45?
 
 select name=start_date_minute
  ?php
   $i = 0;
   while ($i = 45){
echo 'option value='.$i.''.$i.'/option';
$i+=15;
   }
  ?
 
 Thanks for your help
 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
 
If you are not the intended recipient of this e-mail, please preserve the
confidentiality of it and advise the sender immediately of any error in
transmission. Any disclosure, copying, distribution or action taken, or
omitted to be taken, by an unauthorised recipient in reliance upon the
contents of this e-mail is prohibited. Somerfield cannot accept liability
for any damage which you may sustain as a result of software viruses so
please carry out your own virus checks before opening an attachment. In
replying to this e-mail you are granting the right for that reply to be
forwarded to any other individual within the business and also to be read by
others. Any views expressed by an individual within this message do not
necessarily reflect the views of Somerfield.  Somerfield reserves the right
to intercept, monitor and record communications for lawful business
purposes.

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



RE: [PHP] Add a leading zero

2003-09-24 Thread chris . neale
Duh

Sorry didn't realise I was replying to a reply to the original message. And
to add insult to injury str_pad looks like it does the job a lot better...

C

-Original Message-
From: Marek Kilimajer [mailto:[EMAIL PROTECTED]
Sent: 24 September 2003 12:43
To: Shaun
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] Add a leading zero


www.php.net/str_pad

Shaun wrote:

 Hi,
 
 How can i add a leading zero to the first result of this loop so that i
get
 00, 15, 30, 45?
 
 select name=start_date_minute
  ?php
   $i = 0;
   while ($i = 45){
echo 'option value='.$i.''.$i.'/option';
$i+=15;
   }
  ?
 
 Thanks for your help
 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
 
If you are not the intended recipient of this e-mail, please preserve the
confidentiality of it and advise the sender immediately of any error in
transmission. Any disclosure, copying, distribution or action taken, or
omitted to be taken, by an unauthorised recipient in reliance upon the
contents of this e-mail is prohibited. Somerfield cannot accept liability
for any damage which you may sustain as a result of software viruses so
please carry out your own virus checks before opening an attachment. In
replying to this e-mail you are granting the right for that reply to be
forwarded to any other individual within the business and also to be read by
others. Any views expressed by an individual within this message do not
necessarily reflect the views of Somerfield.  Somerfield reserves the right
to intercept, monitor and record communications for lawful business
purposes.

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



RE: [PHP] 3 mins of your time please...logic problem

2003-09-24 Thread chris . neale
You could take it further and only allow one vote per user and then log
their IP address as well.

There won't be many people who are determined to sway the vote by going
through the hassle of creating a new user and then voting again. But there
may be some. You can weed these out by looking through all the votes,
usernames and ip addresses and then disregard votes which come from the same
IP address from users who've only signed up minutes before voting. While
they might think that they've beaten the system, you can clearly see from
your table of users, registration dates, IP address and Voting Times that
they're bogus. But it's a bit laborious to do this.

Alternatively, once you've stored the first vote from a user in your
database, let them vote again, give them the 'Thank you for your vote'
message but disregard it from the server side. They'll think they're getting
somewhere when in fact they're wasting their time (like those morons you see
at pedestrian crossings who stab the button repeatedly, with the belief that
it might make the lights change faster). And they probably won't try
anything else which saves you having to delete a whole pile of junk user
accounts. Just make sure you only show your users the poll result as a
percentage without the 'x number of people have voted' or you'll be sussed.

Would anyone really want to frig a forum poll anyway? Surely nobody's that
sad!

C

-Original Message-
From: CPT John W. Holmes [mailto:[EMAIL PROTECTED]
Sent: 24 September 2003 17:54
To: Ryan A; [EMAIL PROTECTED]
Subject: Re: [PHP] 3 mins of your time please...logic problem


From: Ryan A [EMAIL PROTECTED]

 Basically trying to limit the vote to just 1 per person, first am
checking
 if the the person with username has voted, if that comes back as false
then
 am checking his ip (because i dont know if  the person changed his
username
 and is trying to vote again) now its allowing me to vote twice and on the
 third time its restricting me.

Just get rid of the check for IP address. All you're going to do is restrict
a bunch of people that actually haven't voted just because they have the
same IP address as someone else. Some ISPs have it so that all requests look
like they are coming from the same IP address while it's actually different
people.

If your poll is really so important that you need to limit people from
voting twice, then make them log in and only allow one vote per username.

---John Holmes...

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
 
If you are not the intended recipient of this e-mail, please preserve the
confidentiality of it and advise the sender immediately of any error in
transmission. Any disclosure, copying, distribution or action taken, or
omitted to be taken, by an unauthorised recipient in reliance upon the
contents of this e-mail is prohibited. Somerfield cannot accept liability
for any damage which you may sustain as a result of software viruses so
please carry out your own virus checks before opening an attachment. In
replying to this e-mail you are granting the right for that reply to be
forwarded to any other individual within the business and also to be read by
others. Any views expressed by an individual within this message do not
necessarily reflect the views of Somerfield.  Somerfield reserves the right
to intercept, monitor and record communications for lawful business
purposes.

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



RE: [PHP] Mail problem

2003-09-22 Thread chris . neale
Have you timed it? You might want to check it doesn't take longer than the
max_execution_time directive in php.ini allows (you'll have to check if
that's the correct name for it). I've also used set_time_limit(0) at the top
of my scripts when I know it's going to take a while...

Regards


Chris

-Original Message-
From: Trevor Dowling [mailto:[EMAIL PROTECTED]
Sent: 22 September 2003 16:46
To: [EMAIL PROTECTED]
Subject: [PHP] Mail problem


PHP Version 4.3.2
I am having problems sending a large number of emails from a mail list held
in a database. I don't belive that the database has anything to do with the
problem.

I have about 9000 addresses and can only successfully send about 2000 mails
before the page say complete/done.

Below is the code that I am running, no error messages are returned from the
mail function, it just stops. About 2000 mails are sent OK.

Anyone know what the problem is?

Trevor


 $query_string = SELECT DISTINCT email FROM [user];
 $result = odbc_exec ($odbc_connection, $query_string);

 $Message = Mail Text;

 $Index = 0;

 while (odbc_fetch_row ($result))
 {

  $EmailAddress = trim (odbc_result ($result, 'email'));

flush();
@mail ($EmailAddress, Support, $Message);

  $Index++;

  echo (BREmail Address: $EmailAddress);  // DEBUG
  echo (BRErrorCode: ${ErrorCode});  // DEBUG
  echo (.${Index}); // DEBUG
 }

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
 
If you are not the intended recipient of this e-mail, please preserve the
confidentiality of it and advise the sender immediately of any error in
transmission. Any disclosure, copying, distribution or action taken, or
omitted to be taken, by an unauthorised recipient in reliance upon the
contents of this e-mail is prohibited. Somerfield cannot accept liability
for any damage which you may sustain as a result of software viruses so
please carry out your own virus checks before opening an attachment. In
replying to this e-mail you are granting the right for that reply to be
forwarded to any other individual within the business and also to be read by
others. Any views expressed by an individual within this message do not
necessarily reflect the views of Somerfield.  Somerfield reserves the right
to intercept, monitor and record communications for lawful business
purposes.

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



[PHP] Ways to connect to Access DB without using ODBC?

2003-09-17 Thread chris . neale
Has anyone got any idea how I might be able to connect to an access database
without using the ODBC drivers? I logged a bug with the PHP developers
(#25472) about a problem I've been having with memory leaks when using them
for looping through hundreds of queries in sequence.

Does anyone have any suggestions for other methods of connecting to an
Access database, which is at least as fast as ODBC and more stable.

Thanks...

Chris
 
If you are not the intended recipient of this e-mail, please preserve the
confidentiality of it and advise the sender immediately of any error in
transmission. Any disclosure, copying, distribution or action taken, or
omitted to be taken, by an unauthorised recipient in reliance upon the
contents of this e-mail is prohibited. Somerfield cannot accept liability
for any damage which you may sustain as a result of software viruses so
please carry out your own virus checks before opening an attachment. In
replying to this e-mail you are granting the right for that reply to be
forwarded to any other individual within the business and also to be read by
others. Any views expressed by an individual within this message do not
necessarily reflect the views of Somerfield.  Somerfield reserves the right
to intercept, monitor and record communications for lawful business
purposes.

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



RE: [PHP] Object in session and include

2003-09-17 Thread chris . neale
I was under the impression that if you used include_once then the script
would only include the class definition if it was required within the
script.

You might want to check the manaul or get a second opinion on that, but
that's what I've always done.

Regards

Chris

-Original Message-
From: Marco Schuler [mailto:[EMAIL PROTECTED]
Sent: 17 September 2003 10:45
To: [EMAIL PROTECTED]
Subject: [PHP] Object in session and include


Hi

I have to serialize an object in a session. Generally there is no
problem with this if the class-definition file(s) are included _before_
starting the session, as explained in the php-manual:

quoting

 It is strongly recommended that you include the class definitions of
all such registered objects on all of your pages, even if you do not
actually use these classes on all of your pages. If you don't and an
object is being unserialized without its class definition being present,
it will lose its class association and become an object of class
stdClass without any functions available at all, that is, it will become
quite useless.

/quoting

I am using PEAR classes for my project. If I want to store such an
object in a session, I would have to include all the class-definitions
that are included within the class that I am using. There can be a lot
of included classes or also dynamically incldued classes.

Has somebody got an idea or an acceptable solution to handle this
without including all the class-definitions?

--
Cheers!
 Marco

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
 
If you are not the intended recipient of this e-mail, please preserve the
confidentiality of it and advise the sender immediately of any error in
transmission. Any disclosure, copying, distribution or action taken, or
omitted to be taken, by an unauthorised recipient in reliance upon the
contents of this e-mail is prohibited. Somerfield cannot accept liability
for any damage which you may sustain as a result of software viruses so
please carry out your own virus checks before opening an attachment. In
replying to this e-mail you are granting the right for that reply to be
forwarded to any other individual within the business and also to be read by
others. Any views expressed by an individual within this message do not
necessarily reflect the views of Somerfield.  Somerfield reserves the right
to intercept, monitor and record communications for lawful business
purposes.

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



RE: [PHP] consistent PHP function names?

2003-09-17 Thread chris . neale
The English language can be just as confusing at times, and is full of
exceptions to rules - people just get used to them. The same can apply to a
programming language. I'm not of why PHP's naming conventions are like this,
but I can only assume it's to do with the way the language has evolved,
perhaps inheriting naming conventions from other languages. I can't imagine
there are any plans to standardise it.

In practice, I find that all my code is wrapped up in custom functions and
objects anyway - I name those quite carefully to avoid confusing myself and
others, but don't need to worry too much about the naming conventions of the
functions inside. When writing complicated scripts, I  often find choosing
variable / function naming conventions takes a long time.

I've got used to the quirks of PHP, but can see your point.

Chris


-Original Message-
From: Eugene Lee [mailto:[EMAIL PROTECTED]
Sent: 17 September 2003 10:51
To: [EMAIL PROTECTED]
Subject: [PHP] consistent PHP function names?


One thing that's always bothered me about PHP is that the function names
are not terribly consistent.  For example, when are underscores okay?
strip_tags() has an underscore but stripslashes() does not.  Also,
should inverse functions be named appropriately?  htmlentities() and
html_entity_decode() are inverse functions.  But seems to make more
sense to rename htmlentities() to html_entity_encode().  Something like
a class[_subclass1[_subclass2[...]]]_method nomenclature makes sense.

Then you have really weird stuff.  For example, md5() is listed as a
string function since it takes a string, calculates the MD5 hash, and
returns said hash.  Makes sense.  Then you have md5_file(), which takes
a filename, calculates the MD5 hash of the file's contents, and returns
said hash.  But md5_file() is listed as a string function.  To me, it
makes more sense to be classified as a filesystem function, and maybe
even rename the function to file_md5().

Thoughts?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
 
If you are not the intended recipient of this e-mail, please preserve the
confidentiality of it and advise the sender immediately of any error in
transmission. Any disclosure, copying, distribution or action taken, or
omitted to be taken, by an unauthorised recipient in reliance upon the
contents of this e-mail is prohibited. Somerfield cannot accept liability
for any damage which you may sustain as a result of software viruses so
please carry out your own virus checks before opening an attachment. In
replying to this e-mail you are granting the right for that reply to be
forwarded to any other individual within the business and also to be read by
others. Any views expressed by an individual within this message do not
necessarily reflect the views of Somerfield.  Somerfield reserves the right
to intercept, monitor and record communications for lawful business
purposes.

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



RE: [PHP] Branching to a page

2003-09-15 Thread chris . neale
I don't understand what this achieves? Tell me more...

C

-Original Message-
From: Todd Cary [mailto:[EMAIL PROTECTED]
Sent: 15 September 2003 03:30
To: [EMAIL PROTECTED]
Subject: [PHP] Branching to a page


Back in the earlier days of PHP, pages were not cached so I developed a 
method of branching to a page by opening a new socket.  Since it has 
worked over the years in quite a variety of applications, I have not 
changed...but maybe I should.  Are there any glaring deficiencies with 
doing this:

  // Verify the Session ID
  if ($session_id) {
  ...
  } else {
bounce_post($server, $path, $url, abort.php, );
exit;
  }

Where bounce is defined as

  function bounce_post($server, $path, $url, $page, $info) {
$http = new http;

$fp = $http-http_fpost($server, $path . $page, $info);
if($fp) {
  print 'BASE HREF=' . $url . $page . 'p';
  fpassthru($fp);
};
  }

Todd

-- 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
 
If you are not the intended recipient of this e-mail, please preserve the
confidentiality of it and advise the sender immediately of any error in
transmission. Any disclosure, copying, distribution or action taken, or
omitted to be taken, by an unauthorised recipient in reliance upon the
contents of this e-mail is prohibited. Somerfield cannot accept liability
for any damage which you may sustain as a result of software viruses so
please carry out your own virus checks before opening an attachment. In
replying to this e-mail you are granting the right for that reply to be
forwarded to any other individual within the business and also to be read by
others. Any views expressed by an individual within this message do not
necessarily reflect the views of Somerfield.  Somerfield reserves the right
to intercept, monitor and record communications for lawful business
purposes.

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



RE: [PHP] Mailing List Programme

2003-09-11 Thread chris . neale
I've used the following line in some of my scripts, some of which run for 10
or 15 minutes.

set_time_limit(0);

The server won't time out, but it takes a while to get anything back to the
browser. It's not ideal, because it takes some time before anything gets
sent back to the browser, but it does the trick.

Kind regards

Chris Neale
Somerfield Stores Ltd.

-Original Message-
From: Sheni R. Meledath [mailto:[EMAIL PROTECTED]
Sent: 11 September 2003 13:23
To: PHP Masters
Subject: [PHP] Mailing List Programme 


Hello:

I have created an application to read email addresses from a list and to 
send emails. The problem now I am facing is, if the list is very long then 
I am getting an error message in the browser Server Timed Out. How can I 
display a confirmation message and continue sending the emails from the 
server? That is, trigger a separate script (not related to browser) on the 
server which handles the emails and then return a success message. Can 
anybody help me to find out a logic or script on this.


Sheni R Meledath
[EMAIL PROTECTED] 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
 
If you are not the intended recipient of this e-mail, please preserve the
confidentiality of it and advise the sender immediately of any error in
transmission. Any disclosure, copying, distribution or action taken, or
omitted to be taken, by an unauthorised recipient in reliance upon the
contents of this e-mail is prohibited. Somerfield cannot accept liability
for any damage which you may sustain as a result of software viruses so
please carry out your own virus checks before opening an attachment. In
replying to this e-mail you are granting the right for that reply to be
forwarded to any other individual within the business and also to be read by
others. Any views expressed by an individual within this message do not
necessarily reflect the views of Somerfield.  Somerfield reserves the right
to intercept, monitor and record communications for lawful business
purposes.

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



RE: [PHP] Mailing List Programme

2003-09-11 Thread chris . neale
With max_execution_time directive in PHP.ini? I suppose I must have changed
that at some point too. I've tried using flush() before but without much
luck, and from what I've read in the manual I think it might be because I'm
running my setup on a Windows machine with IE6. A problem with client-side
buffering...

C

-Original Message-
From: Jay Blanchard [mailto:[EMAIL PROTECTED]
Sent: 11 September 2003 13:36
To: Neale Chris; [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: RE: [PHP] Mailing List Programme 


[snip]
I've used the following line in some of my scripts, some of which run
for 10
or 15 minutes.
set_time_limit(0);

The server won't time out, but it takes a while to get anything back to
the
browser. It's not ideal, because it takes some time before anything gets
sent back to the browser, but it does the trick.
[/snip]

Your server timeout would have to be ramped up too. And you can get
output to the browser...let's say you are looping

while($foo is good){
   get data
   process date
   flush(information)
}

http://www.php.net/flush sends info to browser

Anyone sense a theme here for me this morning?!?
 
If you are not the intended recipient of this e-mail, please preserve the
confidentiality of it and advise the sender immediately of any error in
transmission. Any disclosure, copying, distribution or action taken, or
omitted to be taken, by an unauthorised recipient in reliance upon the
contents of this e-mail is prohibited. Somerfield cannot accept liability
for any damage which you may sustain as a result of software viruses so
please carry out your own virus checks before opening an attachment. In
replying to this e-mail you are granting the right for that reply to be
forwarded to any other individual within the business and also to be read by
others. Any views expressed by an individual within this message do not
necessarily reflect the views of Somerfield.  Somerfield reserves the right
to intercept, monitor and record communications for lawful business
purposes.

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



RE: [PHP] storing quotes into a variable

2003-09-11 Thread chris . neale
$perf_mod = 'a href=# onclick=popWindow(\'popup.php\')';

using \ to escape the '

\ escapes special characters. See the manual.

Regards

Chris

-Original Message-
From: Doug Parker [mailto:[EMAIL PROTECTED]
Sent: 11 September 2003 15:44
To: [EMAIL PROTECTED]
Subject: [PHP] storing quotes into a variable


isn't there a function that allows me to store a string with a bunch of
quotes in it (like an html tag) into a variable?

for example, i need something like:  $perf_mod = a href=#
onclick=popWindow('popup.php')

thanks...

--




http://www.phreshdesign.com

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
 
If you are not the intended recipient of this e-mail, please preserve the
confidentiality of it and advise the sender immediately of any error in
transmission. Any disclosure, copying, distribution or action taken, or
omitted to be taken, by an unauthorised recipient in reliance upon the
contents of this e-mail is prohibited. Somerfield cannot accept liability
for any damage which you may sustain as a result of software viruses so
please carry out your own virus checks before opening an attachment. In
replying to this e-mail you are granting the right for that reply to be
forwarded to any other individual within the business and also to be read by
others. Any views expressed by an individual within this message do not
necessarily reflect the views of Somerfield.  Somerfield reserves the right
to intercept, monitor and record communications for lawful business
purposes.

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



[PHP] Memory leak in PHP 5 / ODBC?

2003-09-10 Thread chris . neale
I'm having memory problems running a script in PHP 5 Beta on WINNT SP6a.

I am trying to generate 600 static HTML pages each containing a table of
data. I've taken out all the table formatting routines out the code below,
but it still replicates the same fault. The loop appends the SQL string with
the loop value and then calls ODBC_DO.

When I run it, PHP.exe shows up in task manager, eating away at memory fast
- about 1 meg every second gets consumed and it generates about 7000 page
faults every second too. [I've no idea what page faults are but there's lots
of them...]. But it still works, and the information comes out as expected.
The memory is then freed when PHP exits.

Here's the code.

$dbCon = odbc_connect('Test2', '', '');

for ($nval=1;$nval=700;$nval++)
{
$query = SELECT * from [tablename] where ID = .$nval;
odbc_do($dbCon, $query);
}

odbc_close($dbCon); 

I've run this code not only from a web page, but also from the command line
with some additional code which waits for a user keystroke before continuing
to the next loop iteration, to slow down the process. But the same problem
occurred, so I think I've ruled out some kind of bottleneck. 

I expected the memory to remain fairly constant throughout execution, but it
keeps on rising and not always at a constant rate.

Can anyone shed any light on this? Is this a bug in PHP?

Kind regards,


Chris Neale
Contract Developer
Somerfield Stores Ltd.
 
If you are not the intended recipient of this e-mail, please preserve the
confidentiality of it and advise the sender immediately of any error in
transmission. Any disclosure, copying, distribution or action taken, or
omitted to be taken, by an unauthorised recipient in reliance upon the
contents of this e-mail is prohibited. Somerfield cannot accept liability
for any damage which you may sustain as a result of software viruses so
please carry out your own virus checks before opening an attachment. In
replying to this e-mail you are granting the right for that reply to be
forwarded to any other individual within the business and also to be read by
others. Any views expressed by an individual within this message do not
necessarily reflect the views of Somerfield.  Somerfield reserves the right
to intercept, monitor and record communications for lawful business
purposes.

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