Re: [PHP] Using Table prefixes

2013-06-10 Thread Tamara Temple
Julian Wanke  wrote:
> Facebook has 1,11 Billion Accounts. If we divide this through 1000
> members per data team member they need 1 Million data team mebers,
> each of them  has a salary which I would say is about 2000$.
> That means they have to pay 2 Billion US$ (!) per month to the data
> team which is very unrealistic.

I think, again, that people have *very* different concepts of what the
term 'client' means. I would never call Facebook's billion accounts
clients - they are users.

And, seriously, I think taking a concept to absurd lengths is just that,
absurd.

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



Re: [PHP] Using Table prefixes

2013-06-10 Thread Julian Wanke
There servers are so good configured, that they don't need much  
maintainance.
Facebook has 1,11 Billion Accounts. If we divide this through 1000 members  
per data team member they need 1 Million data team mebers, each of them  
has a salary which I would say is about 2000$.
That means they have to pay 2 Billion US$ (!) per month to the data team  
which is very unrealistic.


I know such great companies are a bad example but my opinion is that a  
system should be as scalable as possible.


Am 10.06.2013, 20:16 Uhr, schrieb Tedd Sperling :


Hi:

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

Cheers,

tedd

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





On Jun 10, 2013, at 2:11 PM, Julian Wanke  wrote:


Tell this the facebook, google or nsa data team ^^

Am 10.06.2013, 16:15 Uhr, schrieb Tedd Sperling  
:



On Jun 8, 2013, at 4:17 PM, Julian Wanke  wrote:

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


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

My thoughts:

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


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


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


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

Cheers,

tedd

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



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


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



Re: [PHP] Using Table prefixes

2013-06-10 Thread Tedd Sperling
Hi:

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

Cheers,

tedd

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





On Jun 10, 2013, at 2:11 PM, Julian Wanke  wrote:

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


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



Re: [PHP] Using Table prefixes

2013-06-10 Thread Julian Wanke

Tell this the facebook, google or nsa data team ^^

Am 10.06.2013, 16:15 Uhr, schrieb Tedd Sperling :


On Jun 8, 2013, at 4:17 PM, Julian Wanke  wrote:

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


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

My thoughts:

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


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


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


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

Cheers,

tedd

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


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



Re: [PHP] Using Table prefixes

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

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

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

My thoughts:

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

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

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

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

Cheers,

tedd

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



Re: [PHP] Using Table prefixes

2013-06-08 Thread Bastien


Bastien Koert

On 2013-06-08, at 5:56 PM, Tamara Temple  wrote:

> Tedd Sperling  wrote:
>> On Jun 8, 2013, at 3:00 PM, Ashley Sheridan  
>> wrote:
>> dealTek  wrote:
>>> 
 I can see the basic need for a table prefix in a case where you may use
 one mysql database for several projects at once so as to distinguish
 tables per project like...
 
 -snip-
 however I was told a long time ago to use a prefix "tbl_" like
 tbl_Mytable but I don't really see much need for this by itself ... Am
 I missing something?
>>> 
>>> I think that's a pattern that people use to distinguish their tables from 
>>> views, etc, but personally I find it a little pointless. It doesn't really 
>>> help in any way, and just means more typing.
>>> 
>>> Using a prefix for a set of tables in one db where you might have several 
>>> things using the db (i.e. some hosting limits the databases you can have) 
>>> makes sense, and especially so if you name it sensibly as in your first 
>>> example. 
>>> Thanks,
>>> Ash
>> 
>> I agree, but more than that I also set up databases specifically for clients 
>> such that all the tables in them are related to the client and not each 
>> other, such as:
>> 
>> client1_db
>> 
>> contacts
>> invoices
>> etc
>> 
>> and
>> 
>> client2_db
>> 
>> contacts
>> invoices
>> etc
>> 
>> As such, the "tbl_" prefix is not needed.
>> 
>> Cheers,
>> 
>> tedd
>> 
>> _
>> tedd.sperl...@gmail.com
>> http://sperling.com
>> -- 
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> In a multi-client situation like Tedd describes, it is rather more
> important to segregate client's data, otherwise you need to do a fair
> bit of permissions management to keep rogue employees/contractors at the
> various clients from snooping around. (It happens!)
> 
> OTOH, when it's your own apps, and you are db restricted as Ash
> mentions, the table prefix thing can be useful. Personally, I don't do
> that, but that's because I am rarely resource-bound in that way. One db
> per app, basically.
> 

I have run into situations where I prefix with the app name due to same table 
names in the same db. This was on a large db2 install. 



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



Re: [PHP] Using Table prefixes

2013-06-08 Thread Bastien


Bastien Koert

On 2013-06-08, at 5:58 PM, Tamara Temple  wrote:

> Julian Wanke  wrote:
>> A database for each client? Isn't that over-powered? If you have 1000
>> clients, you would loose the overview over your databases...
> 
> I believe what is being talked about is one DB per application install --
> 'client' can be a way-overloaded term.


Some projects or apps require one db per client. But it does become a pain to 
manage. 


Bastien

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



Re: [PHP] Using Table prefixes

2013-06-08 Thread Tamara Temple
Julian Wanke  wrote:
> A database for each client? Isn't that over-powered? If you have 1000
> clients, you would loose the overview over your databases...

I believe what is being talked about is one DB per application install --
'client' can be a way-overloaded term.


> 
> Am 08.06.2013, 21:46 Uhr, schrieb Tedd Sperling :
> 
> > On Jun 8, 2013, at 3:00 PM, Ashley Sheridan
> >  wrote:
> > dealTek  wrote:
> >>
> >>> I can see the basic need for a table prefix in a case where you may use
> >>> one mysql database for several projects at once so as to distinguish
> >>> tables per project like...
> >>>
> >>> -snip-
> >>> however I was told a long time ago to use a prefix "tbl_" like
> >>> tbl_Mytable but I don't really see much need for this by itself ... Am
> >>> I missing something?
> >>
> >> I think that's a pattern that people use to distinguish their
> >> tables from views, etc, but personally I find it a little
> >> pointless. It  doesn't really help in any way, and just means more
> >> typing.
> >>
> >> Using a prefix for a set of tables in one db where you might have
> >> several things using the db (i.e. some hosting limits the databases
> >> you  can have) makes sense, and especially so if you name it
> >> sensibly as in  your first example.
> >> Thanks,
> >> Ash
> >
> > I agree, but more than that I also set up databases specifically for
> > clients such that all the tables in them are related to the client
> > and  not each other, such as:
> >
> > client1_db
> >
> > contacts
> > invoices
> > etc
> >
> > and
> >
> > client2_db
> >
> > contacts
> > invoices
> > etc
> >
> > As such, the "tbl_" prefix is not needed.
> >
> > Cheers,
> >
> > tedd
> >
> > _
> > tedd.sperl...@gmail.com
> > http://sperling.com
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 

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



Re: [PHP] Using Table prefixes

2013-06-08 Thread Tamara Temple
Tedd Sperling  wrote:
> On Jun 8, 2013, at 3:00 PM, Ashley Sheridan  wrote:
> dealTek  wrote:
> > 
> >> I can see the basic need for a table prefix in a case where you may use
> >> one mysql database for several projects at once so as to distinguish
> >> tables per project like...
> >> 
> >> -snip-
> >> however I was told a long time ago to use a prefix "tbl_" like
> >> tbl_Mytable but I don't really see much need for this by itself ... Am
> >> I missing something?
> > 
> > I think that's a pattern that people use to distinguish their tables from 
> > views, etc, but personally I find it a little pointless. It doesn't really 
> > help in any way, and just means more typing.
> > 
> > Using a prefix for a set of tables in one db where you might have several 
> > things using the db (i.e. some hosting limits the databases you can have) 
> > makes sense, and especially so if you name it sensibly as in your first 
> > example. 
> > Thanks,
> > Ash
> 
> I agree, but more than that I also set up databases specifically for clients 
> such that all the tables in them are related to the client and not each 
> other, such as:
> 
> client1_db
> 
> contacts
> invoices
> etc
> 
> and
> 
> client2_db
> 
> contacts
> invoices
> etc
> 
> As such, the "tbl_" prefix is not needed.
> 
> Cheers,
> 
> tedd
> 
> _
> tedd.sperl...@gmail.com
> http://sperling.com
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 

In a multi-client situation like Tedd describes, it is rather more
important to segregate client's data, otherwise you need to do a fair
bit of permissions management to keep rogue employees/contractors at the
various clients from snooping around. (It happens!)

OTOH, when it's your own apps, and you are db restricted as Ash
mentions, the table prefix thing can be useful. Personally, I don't do
that, but that's because I am rarely resource-bound in that way. One db
per app, basically.



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



Re: [PHP] Using Table prefixes

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


Am 08.06.2013, 21:46 Uhr, schrieb Tedd Sperling :

On Jun 8, 2013, at 3:00 PM, Ashley Sheridan   
wrote:

dealTek  wrote:



I can see the basic need for a table prefix in a case where you may use
one mysql database for several projects at once so as to distinguish
tables per project like...

-snip-
however I was told a long time ago to use a prefix "tbl_" like
tbl_Mytable but I don't really see much need for this by itself ... Am
I missing something?


I think that's a pattern that people use to distinguish their tables  
from views, etc, but personally I find it a little pointless. It  
doesn't really help in any way, and just means more typing.


Using a prefix for a set of tables in one db where you might have  
several things using the db (i.e. some hosting limits the databases you  
can have) makes sense, and especially so if you name it sensibly as in  
your first example.

Thanks,
Ash


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


client1_db

contacts
invoices
etc

and

client2_db

contacts
invoices
etc

As such, the "tbl_" prefix is not needed.

Cheers,

tedd

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


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



Re: [PHP] Using Table prefixes

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

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

client1_db

contacts
invoices
etc

and

client2_db

contacts
invoices
etc

As such, the "tbl_" prefix is not needed.

Cheers,

tedd

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



Re: [PHP] Using Table prefixes

2013-06-08 Thread Ashley Sheridan


dealTek  wrote:

>Hi all,
>
>I can see the basic need for a table prefix in a case where you may use
>one mysql database for several projects at once so as to distinguish
>tables per project like...
>
>
>Project 1
>
>mysales_contacts
>mysales_invoices
>etc
>
>and
>
>jobs_contacts
>jobs_invoices
>
>however I was told a long time ago to use a prefix "tbl_" like
>tbl_Mytable but I don't really see much need for this by itself ... Am
>I missing something?
>
>
>
>--
>Thanks,
>Dave - DealTek
>deal...@gmail.com
>[db-3]

I think that's a pattern that people use to distinguish their tables from 
views, etc, but personally I find it a little pointless. It doesn't really help 
in any way, and just means more typing.

Using a prefix for a set of tables in one db where you might have several 
things using the db (i.e. some hosting limits the databases you can have) makes 
sense, and especially so if you name it sensibly as in your first example. 
Thanks,
Ash

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



[PHP] Using Table prefixes

2013-06-08 Thread dealTek
Hi all,

I can see the basic need for a table prefix in a case where you may use one 
mysql database for several projects at once so as to distinguish tables per 
project like...


Project 1

mysales_contacts
mysales_invoices
etc

and

jobs_contacts
jobs_invoices

however I was told a long time ago to use a prefix "tbl_" like tbl_Mytable but 
I don't really see much need for this by itself ... Am I missing something?



--
Thanks,
Dave - DealTek
deal...@gmail.com
[db-3]



Re: [PHP] Using PEAR and PHP

2012-08-23 Thread Matijn Woudt
On Thu, Aug 23, 2012 at 9:25 PM, Suraj Shah  wrote:
>
>
> On 23/08/2012 20:12, "Matijn Woudt"  wrote:
>
>
>
> On Thu, Aug 23, 2012 at 9:12 PM, Ashley Sheridan 
> wrote:
>
>
> On Thu, 2012-08-23 at 20:33 +0200, Matijn Woudt wrote:
>
>>
>> OK thanks Matijn.
>>
>> I’ll google it now and install it.
>>
>> There is a site.php as well as a config.php file in the sub-directory of
>> the
>> old server. I’ve copied these over but not sure why it still doesn’t
>> recognise it. I’ve amended the code to point to the new server as well.
>>
>> Suraj
>
> The old server has probably some freaky settings that make that
> directory automatically included, for example by modifing the php
> include dir in php.ini, or it is part of a package. You can open up
> this site.php file and look at the first lines, it might give you a
> hint if it's part of some package.
>
> - Matijn
>
>
> You just made me think actually, could it be an .htaccess file re-routing
> the file paths (different to URL re-routing)? Because of the way MacOS and
> Linux works, an .htaccess file would be hidden by default and therefore not
> necessarily copied across.
>
>
>
> That could be a possibility, though looking at the code Suraj send it's not
> very likely as there is path redirect magic in there. Most likely the web
> folder is named differently (it seems like it assumes the web files to be in
> public_html, which might not be the case in his new server.
>
> - Matijn
>
> You’re right Matijn.
>
> It’s currently pointing to a folder called ‘public_html’ where the index.php
> and the rest of the website is stored. I, first, tried configuring it so
> that on the new server, it was directly within the root server but this kept
> on bringing error messages.
>
> I then replicated the old server on the new server but am still getting
> these error messages as described earlier.
>
> Also, I have typed in ls  -a and it comes up with the directories, but there
> is no “such file” for .htaccess.
>
> Suraj

It's hard to say how the files should be stored and how it should be
configured, because it is specific to your old website.
All I can say now is, check the following:
1) Make sure you copied all files from the old server, so that all
files end up at the same place in the new server.
2) .htaccess files can also be stored in subdirectories, though that
doesn't seem likely here.
3) Check you old website virtual host config, this depends on which
webserver there is. In most (all?) webservers it is possibily to
specify URL redirects. For Apache on a Unix based server, check the
config files in /etc/apache (ubuntu has them in
/etc/apache/sites_enabled), Nginx would be in /etc/nginx (Ubuntu also
has them in /etc/nginx/sites_enabled). Other webservers probably also
have their config files in /etc//...

- Matijn

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



Re: [PHP] Using PEAR and PHP

2012-08-23 Thread Suraj Shah


On 23/08/2012 20:12, "Matijn Woudt"  wrote:



On Thu, Aug 23, 2012 at 9:12 PM, Ashley Sheridan  
wrote:

On Thu, 2012-08-23 at 20:33 +0200, Matijn Woudt wrote:
>
> OK thanks Matijn.
>
> I’ll google it now and install it.
>
> There is a site.php as well as a config.php file in the sub-directory of the
> old server. I’ve copied these over but not sure why it still doesn’t
> recognise it. I’ve amended the code to point to the new server as well.
>
> Suraj

The old server has probably some freaky settings that make that
directory automatically included, for example by modifing the php
include dir in php.ini, or it is part of a package. You can open up
this site.php file and look at the first lines, it might give you a
hint if it's part of some package.

- Matijn


You just made me think actually, could it be an .htaccess file re-routing the 
file paths (different to URL re-routing)? Because of the way MacOS and Linux 
works, an .htaccess file would be hidden by default and therefore not 
necessarily copied across.



That could be a possibility, though looking at the code Suraj send it's not 
very likely as there is path redirect magic in there. Most likely the web 
folder is named differently (it seems like it assumes the web files to be in 
public_html, which might not be the case in his new server.

- Matijn

You’re right Matijn.

It’s currently pointing to a folder called ‘public_html’ where the index.php 
and the rest of the website is stored. I, first, tried configuring it so that 
on the new server, it was directly within the root server but this kept on 
bringing error messages.

I then replicated the old server on the new server but am still getting these 
error messages as described earlier.

Also, I have typed in ls  -a and it comes up with the directories, but there is 
no “such file” for .htaccess.

Suraj


Re: [PHP] Using PEAR and PHP

2012-08-23 Thread Matijn Woudt
On Thu, Aug 23, 2012 at 9:12 PM, Ashley Sheridan
wrote:

> **
> On Thu, 2012-08-23 at 20:33 +0200, Matijn Woudt wrote:
>
> >
> > OK thanks Matijn.
> >
> > I’ll google it now and install it.
> >
> > There is a site.php as well as a config.php file in the sub-directory of the
> > old server. I’ve copied these over but not sure why it still doesn’t
> > recognise it. I’ve amended the code to point to the new server as well.
> >
> > Suraj
>
> The old server has probably some freaky settings that make that
> directory automatically included, for example by modifing the php
> include dir in php.ini, or it is part of a package. You can open up
> this site.php file and look at the first lines, it might give you a
> hint if it's part of some package.
>
> - Matijn
>
>
>
> You just made me think actually, could it be an .htaccess file re-routing
> the file paths (different to URL re-routing)? Because of the way MacOS and
> Linux works, an .htaccess file would be hidden by default and therefore not
> necessarily copied across.
>
>
>
That could be a possibility, though looking at the code Suraj send it's not
very likely as there is path redirect magic in there. Most likely the web
folder is named differently (it seems like it assumes the web files to be
in public_html, which might not be the case in his new server.

- Matijn


Re: [PHP] Using PEAR and PHP

2012-08-23 Thread Matijn Woudt
On Thu, Aug 23, 2012 at 9:14 PM, Suraj Shah  wrote:
>
>
>
> On 23/08/2012 20:12, "Ashley Sheridan"  wrote:
>
> On Thu, 2012-08-23 at 20:33 +0200, Matijn Woudt wrote:
>
>
>>
>> OK thanks Matijn.
>>
>> I’ll google it now and install it.
>>
>> There is a site.php as well as a config.php file in the sub-directory of
>> the
>> old server. I’ve copied these over but not sure why it still doesn’t
>> recognise it. I’ve amended the code to point to the new server as well.
>>
>> Suraj
>
> The old server has probably some freaky settings that make that
> directory automatically included, for example by modifing the php
> include dir in php.ini, or it is part of a package. You can open up
> this site.php file and look at the first lines, it might give you a
> hint if it's part of some package.
>
> - Matijn
>
>
> You just made me think actually, could it be an .htaccess file re-routing
> the file paths (different to URL re-routing)? Because of the way MacOS and
> Linux works, an .htaccess file would be hidden by default and therefore not
> necessarily copied across.
>
>
>
> Ok thanks Ashley.
>
> If this .htaccess file was hidden by default, how would I go about accessing
> it and copying or transferring it over?
>
> Suraj

On Linux systems (and probably Mac too), you can show if there are
hidden files by using ls -a.
You can just use cp .htaccess  to copy.

- Matijn

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



Re: [PHP] Using PEAR and PHP

2012-08-23 Thread Suraj Shah



On 23/08/2012 20:12, "Ashley Sheridan"  wrote:

On Thu, 2012-08-23 at 20:33 +0200, Matijn Woudt wrote:

>
> OK thanks Matijn.
>
> I’ll google it now and install it.
>
> There is a site.php as well as a config.php file in the sub-directory of the
> old server. I’ve copied these over but not sure why it still doesn’t
> recognise it. I’ve amended the code to point to the new server as well.
>
> Suraj

The old server has probably some freaky settings that make that
directory automatically included, for example by modifing the php
include dir in php.ini, or it is part of a package. You can open up
this site.php file and look at the first lines, it might give you a
hint if it's part of some package.

- Matijn


You just made me think actually, could it be an .htaccess file re-routing the 
file paths (different to URL re-routing)? Because of the way MacOS and Linux 
works, an .htaccess file would be hidden by default and therefore not 
necessarily copied across.


Ok thanks Ashley.

If this .htaccess file was hidden by default, how would I go about accessing it 
and copying or transferring it over?

Suraj


Re: [PHP] Using PEAR and PHP

2012-08-23 Thread Ashley Sheridan
On Thu, 2012-08-23 at 20:33 +0200, Matijn Woudt wrote:

> >
> > OK thanks Matijn.
> >
> > I’ll google it now and install it.
> >
> > There is a site.php as well as a config.php file in the sub-directory of the
> > old server. I’ve copied these over but not sure why it still doesn’t
> > recognise it. I’ve amended the code to point to the new server as well.
> >
> > Suraj
> 
> The old server has probably some freaky settings that make that
> directory automatically included, for example by modifing the php
> include dir in php.ini, or it is part of a package. You can open up
> this site.php file and look at the first lines, it might give you a
> hint if it's part of some package.
> 
> - Matijn
> 


You just made me think actually, could it be an .htaccess file
re-routing the file paths (different to URL re-routing)? Because of the
way MacOS and Linux works, an .htaccess file would be hidden by default
and therefore not necessarily copied across.

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




Re: [PHP] Using PEAR and PHP

2012-08-23 Thread Suraj Shah



On 23/08/2012 19:33, "Matijn Woudt"  wrote:

>>
>> OK thanks Matijn.
>>
>> I’ll google it now and install it.
>>
>> There is a site.php as well as a config.php file in the sub-directory of the
>> old server. I’ve copied these over but not sure why it still doesn’t
>> recognise it. I’ve amended the code to point to the new server as well.
>>
>> Suraj
>
> The old server has probably some freaky settings that make that
> directory automatically included, for example by modifing the php
> include dir in php.ini, or it is part of a package. You can open up
> this site.php file and look at the first lines, it might give you a
> hint if it's part of some package.
>
> - Matijn


This is currently what the first few lines of code say:



Re: [PHP] Using PEAR and PHP

2012-08-23 Thread Matijn Woudt
>
> OK thanks Matijn.
>
> I’ll google it now and install it.
>
> There is a site.php as well as a config.php file in the sub-directory of the
> old server. I’ve copied these over but not sure why it still doesn’t
> recognise it. I’ve amended the code to point to the new server as well.
>
> Suraj

The old server has probably some freaky settings that make that
directory automatically included, for example by modifing the php
include dir in php.ini, or it is part of a package. You can open up
this site.php file and look at the first lines, it might give you a
hint if it's part of some package.

- Matijn

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



Re: [PHP] Using PEAR and PHP

2012-08-23 Thread Suraj Shah



On 23/08/2012 19:26, "Matijn Woudt"  wrote:



On Thu, Aug 23, 2012 at 8:21 PM, Suraj Shah  wrote:



On 23/08/2012 19:11, "Matijn Woudt" http://tijn...@gmail.com> > wrote:

> On Thu, Aug 23, 2012 at 8:12 PM, Suraj Shah   > wrote:
>> Thanks for your reply Ashley.
>>
>> I’m getting the attached error message which I can’t seem to solve. If it’s
>> just a matter of adding code to use for a library, would this be possible?
>> How do I go about configuring it?
>>
>> Many thanks,
>> Suraj
>>
>
> Suraj,
>
> Attachments usually don't work at mailing lists, you should paste it
> in your mail, or use something like pastebin. Second, you should
> bottom post at this (and probably any) mailing list.
> About your question, you can install the php-pear package if you don't
> have it from your package manager, and then all you have to do is call
> pear install 
> and you're done.
>
> - Matijn


Thank you Matijn.

Please find below the message I get when loading the page:



As I am totally new to this, I am not sure how to get the package manager or to 
install this on my Mac.

Sorry.

Suraj

Hi,

I don't know much about PHP on Mac, though I think you'll find something useful 
on google with 'Install PEAR on Mac'.
Looking at the error, it might be pearweb, or is there a site.php file in your 
web folder on the old server?


- Matijn


OK thanks Matijn.

I’ll google it now and install it.

There is a site.php as well as a config.php file in the sub-directory of the 
old server. I’ve copied these over but not sure why it still doesn’t recognise 
it. I’ve amended the code to point to the new server as well.

Suraj


Re: [PHP] Using PEAR and PHP

2012-08-23 Thread Matijn Woudt
On Thu, Aug 23, 2012 at 8:21 PM, Suraj Shah  wrote:

>
>
>
> On 23/08/2012 19:11, "Matijn Woudt"  wrote:
>
> > On Thu, Aug 23, 2012 at 8:12 PM, Suraj Shah  wrote:
> >> Thanks for your reply Ashley.
> >>
> >> I’m getting the attached error message which I can’t seem to solve. If
> it’s
> >> just a matter of adding code to use for a library, would this be
> possible?
> >> How do I go about configuring it?
> >>
> >> Many thanks,
> >> Suraj
> >>
> >
> > Suraj,
> >
> > Attachments usually don't work at mailing lists, you should paste it
> > in your mail, or use something like pastebin. Second, you should
> > bottom post at this (and probably any) mailing list.
> > About your question, you can install the php-pear package if you don't
> > have it from your package manager, and then all you have to do is call
> > pear install 
> > and you're done.
> >
> > - Matijn
>
>
> Thank you Matijn.
>
> Please find below the message I get when loading the page:
>
>
>
> As I am totally new to this, I am not sure how to get the package manager
> or to install this on my Mac.
>
> Sorry.
>
> Suraj
>

Hi,

I don't know much about PHP on Mac, though I think you'll find something
useful on google with 'Install PEAR on Mac'.
Looking at the error, it might be pearweb, or is there a site.php file in
your web folder on the old server?


- Matijn


Re: [PHP] Using PEAR and PHP

2012-08-23 Thread Suraj Shah



On 23/08/2012 19:11, "Matijn Woudt"  wrote:

> On Thu, Aug 23, 2012 at 8:12 PM, Suraj Shah  wrote:
>> Thanks for your reply Ashley.
>>
>> I’m getting the attached error message which I can’t seem to solve. If it’s
>> just a matter of adding code to use for a library, would this be possible?
>> How do I go about configuring it?
>>
>> Many thanks,
>> Suraj
>>
>
> Suraj,
>
> Attachments usually don't work at mailing lists, you should paste it
> in your mail, or use something like pastebin. Second, you should
> bottom post at this (and probably any) mailing list.
> About your question, you can install the php-pear package if you don't
> have it from your package manager, and then all you have to do is call
> pear install 
> and you're done.
>
> - Matijn


Thank you Matijn.

Please find below the message I get when loading the page:

[cid:3428594509_2202610]

As I am totally new to this, I am not sure how to get the package manager or to 
install this on my Mac.

Sorry.

Suraj


Re: [PHP] Using PEAR and PHP

2012-08-23 Thread Ashley Sheridan
On Thu, 2012-08-23 at 19:12 +0100, Suraj Shah wrote:

> Thanks for your reply Ashley.
> 
> I’m getting the attached error message which I can’t seem to solve. If
> it’s just a matter of adding code to use for a library, would this be
> possible? How do I go about configuring it?
> 
> Many thanks,
> Suraj
> 
> 
> 
> On 23/08/2012 19:08, "Ashley Sheridan" 
> wrote:
> 
> 
> On Thu, 2012-08-23 at 18:42 +0100, Suraj Shah wrote: 
> 
> 
> Hi.
> 
> I am currently working on a website which uses PHP as
> an integral programming language as part of it.
> 
> I am trying to replicate the website’s contents from
> one ftp server to another but am encountering serious
> issues in doing so. I’ve spent two days trying to find
> out the reasons and now think its down to the PEAR
> installation.
> 
> This is therefore a question on if I want to transfer
> a website from one domain to another, then do I need
> to install PEAR and re-configure all the files? At the
> moment, all I can see within the ftp client regarding
> PEAR are the ‘Mail’ and ‘Mail_Mime’ components.
> 
> I am new to this so any help on this would be great.
> 
> Many thanks
> 
> Suraj
> 
> 
> Suraj Shah
> Online Marketing Executive
> 26 Throgmorton Street | London | EC2N 2AN
> t: 020 7826 9031
> e: su...@aifa.net
> w: www.aifa.net  
> 
> 
> That would depend. Some servers install Pear outside the web
> root but in a location the web server has access to so that it
> can be used within your own scripts. Most often though, I've
> just seen code use a library or two from Pear and include them
> like you can see from your FTP access.
> 
> What kinds of errors are you getting when you attempt to get
> the site running on the second server?
> 
> 
> Suraj Shah
> Online Marketing Executive
> 26 Throgmorton Street | London | EC2N 2AN
> t: 020 7826 9031
> e: su...@aifa.net
> w: www.aifa.net
> twitter: @official_AIFA


Sorry, attachments get removed on this mailing list. Could you please
paste it into the body of one of your replies.

Also, please try not to top-post.

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




Re: [PHP] Using PEAR and PHP

2012-08-23 Thread Lester Caine

Suraj Shah wrote:

I am currently working on a website which uses PHP as an integral programming 
language as part of it.

I am trying to replicate the website’s contents from one ftp server to another 
but am encountering serious issues in doing so. I’ve spent two days trying to 
find out the reasons and now think its down to the PEAR installation.

This is therefore a question on if I want to transfer a website from one domain 
to another, then do I need to install PEAR and re-configure all the files? At 
the moment, all I can see within the ftp client regarding PEAR are the ‘Mail’ 
and ‘Mail_Mime’ components.

I am new to this so any help on this would be great.


PEAR can be managed in a number of ways. You do not say what OS you are working 
on, but most linux distributions carry PEAR packages as additional packages you 
can download and install with the PHP setup. This is often the preferred way of 
doing things, so if those packages have not been installed on your target 
system, then there will obviously be problems.


What I have done for some time since I used to be working between Linux and 
Windows servers was include the PEAR packages that I use as extra libraries 
within the website itself. That way the correct version is always distributed 
with the website.


What you need to do will depend on how you are currently accessing PEAR 
packages, and also which packages you are using.


--
Lester Caine - G8HFL
-
Contact - http://lsces.co.uk/wiki/?page=contact
L.S.Caine Electronic Services - http://lsces.co.uk
EnquirySolve - http://enquirysolve.com/
Model Engineers Digital Workshop - http://medw.co.uk
Rainbow Digital Media - http://rainbowdigitalmedia.co.uk



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



Re: [PHP] Using PEAR and PHP

2012-08-23 Thread Matijn Woudt
On Thu, Aug 23, 2012 at 8:12 PM, Suraj Shah  wrote:
> Thanks for your reply Ashley.
>
> I’m getting the attached error message which I can’t seem to solve. If it’s 
> just a matter of adding code to use for a library, would this be possible? 
> How do I go about configuring it?
>
> Many thanks,
> Suraj
>

Suraj,

Attachments usually don't work at mailing lists, you should paste it
in your mail, or use something like pastebin. Second, you should
bottom post at this (and probably any) mailing list.
About your question, you can install the php-pear package if you don't
have it from your package manager, and then all you have to do is call
pear install 
and you're done.

- Matijn

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



Re: [PHP] Using PEAR and PHP

2012-08-23 Thread Suraj Shah
Thanks for your reply Ashley.

I’m getting the attached error message which I can’t seem to solve. If it’s 
just a matter of adding code to use for a library, would this be possible? How 
do I go about configuring it?

Many thanks,
Suraj



On 23/08/2012 19:08, "Ashley Sheridan"  wrote:

On Thu, 2012-08-23 at 18:42 +0100, Suraj Shah wrote:

Hi.

I am currently working on a website which uses PHP as an integral programming 
language as part of it.

I am trying to replicate the website’s contents from one ftp server to another 
but am encountering serious issues in doing so. I’ve spent two days trying to 
find out the reasons and now think its down to the PEAR installation.

This is therefore a question on if I want to transfer a website from one domain 
to another, then do I need to install PEAR and re-configure all the files? At 
the moment, all I can see within the ftp client regarding PEAR are the ‘Mail’ 
and ‘Mail_Mime’ components.

I am new to this so any help on this would be great.

Many thanks

Suraj


Suraj Shah
Online Marketing Executive
26 Throgmorton Street | London | EC2N 2AN
t: 020 7826 9031
e: su...@aifa.net
w: www.aifa.net 

That would depend. Some servers install Pear outside the web root but in a 
location the web server has access to so that it can be used within your own 
scripts. Most often though, I've just seen code use a library or two from Pear 
and include them like you can see from your FTP access.

What kinds of errors are you getting when you attempt to get the site running 
on the second server?

Suraj Shah
Online Marketing Executive
26 Throgmorton Street | London | EC2N 2AN
t: 020 7826 9031
e: su...@aifa.net
w: www.aifa.net
twitter: @official_AIFA


Re: [PHP] Using PEAR and PHP

2012-08-23 Thread Ashley Sheridan
On Thu, 2012-08-23 at 18:42 +0100, Suraj Shah wrote:

> Hi.
> 
> I am currently working on a website which uses PHP as an integral programming 
> language as part of it.
> 
> I am trying to replicate the website’s contents from one ftp server to 
> another but am encountering serious issues in doing so. I’ve spent two days 
> trying to find out the reasons and now think its down to the PEAR 
> installation.
> 
> This is therefore a question on if I want to transfer a website from one 
> domain to another, then do I need to install PEAR and re-configure all the 
> files? At the moment, all I can see within the ftp client regarding PEAR are 
> the ‘Mail’ and ‘Mail_Mime’ components.
> 
> I am new to this so any help on this would be great.
> 
> Many thanks
> 
> Suraj
> 
> 
> Suraj Shah
> Online Marketing Executive
> 26 Throgmorton Street | London | EC2N 2AN
> t: 020 7826 9031
> e: su...@aifa.net
> w: www.aifa.net


That would depend. Some servers install Pear outside the web root but in
a location the web server has access to so that it can be used within
your own scripts. Most often though, I've just seen code use a library
or two from Pear and include them like you can see from your FTP access.

What kinds of errors are you getting when you attempt to get the site
running on the second server?

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




[PHP] Using PEAR and PHP

2012-08-23 Thread Suraj Shah
Hi.

I am currently working on a website which uses PHP as an integral programming 
language as part of it.

I am trying to replicate the website’s contents from one ftp server to another 
but am encountering serious issues in doing so. I’ve spent two days trying to 
find out the reasons and now think its down to the PEAR installation.

This is therefore a question on if I want to transfer a website from one domain 
to another, then do I need to install PEAR and re-configure all the files? At 
the moment, all I can see within the ftp client regarding PEAR are the ‘Mail’ 
and ‘Mail_Mime’ components.

I am new to this so any help on this would be great.

Many thanks

Suraj


Suraj Shah
Online Marketing Executive
26 Throgmorton Street | London | EC2N 2AN
t: 020 7826 9031
e: su...@aifa.net
w: www.aifa.net


Re: [PHP] using phar and compression

2012-08-09 Thread Hajo Locke

Hello,

thanks, but i cant do this.
its just this problem: Should line
$compressed = $phar->convertToExecutable(Phar::TAR,Phar::GZ, '.phar.tgz');
create a ready to run executable or not .Its not about creating phar 
archives in optional way.

It is a special problem i try to find...

Thanks,
Hajo

- Original Message - 
From: "Alan Hoffmeister" 

To: "Hajo Locke" 
Sent: Wednesday, August 08, 2012 1:32 PM
Subject: Re: [PHP] using phar and compression



Why don't you use Phar::compress() instead of
Phar::convertToExecutable() and see what happens?
http://php.net/manual/en/phar.compress.php

--
Att,
Alan Hoffmeister


2012/8/8 Hajo Locke :

Hello,

i do some tests with phar. I have following script which is just adding 
some

file and index.php is echoing "hello";

buildFromDirectory(dirname(__FILE__) . '/web');
$phar->setStub($phar->createDefaultStub('index.php'));
$compressed = $phar->convertToExecutable(Phar::PHAR,Phar::GZ, 
'.phar.tgz');

?>

This is working and i can call resulting by: "php project.phar"
Now i change last line to:
$compressed = $phar->convertToExecutable(Phar::TAR,Phar::GZ, 
'.phar.tgz');


Now the final phar archive should be compressed with tar. Creating the
archive works without errors, but i cant run it.
Viewing file project.phar.tgz shows only binary-content, no php-header.
Running "php project.phar.tgz" shows no output.
As i understood i can run any phar archive, regardless of used
compressionmethod. Is this right? Am i using phar the correct way?

Thanks,
Hajo

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




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



[PHP] using phar and compression

2012-08-08 Thread Hajo Locke

Hello,

i do some tests with phar. I have following script which is just adding some 
file and index.php is echoing "hello";


buildFromDirectory(dirname(__FILE__) . '/web');
$phar->setStub($phar->createDefaultStub('index.php'));
$compressed = $phar->convertToExecutable(Phar::PHAR,Phar::GZ, '.phar.tgz');
?>

This is working and i can call resulting by: "php project.phar"
Now i change last line to:
$compressed = $phar->convertToExecutable(Phar::TAR,Phar::GZ, '.phar.tgz');

Now the final phar archive should be compressed with tar. Creating the 
archive works without errors, but i cant run it.
Viewing file project.phar.tgz shows only binary-content, no php-header. 
Running "php project.phar.tgz" shows no output.
As i understood i can run any phar archive, regardless of used 
compressionmethod. Is this right? Am i using phar the correct way?


Thanks,
Hajo 



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



Re: [PHP] Using named Pipes between PHP and ZIP

2012-07-09 Thread Matijn Woudt
On Mon, Jul 9, 2012 at 7:19 PM, Dennis Heck  wrote:
>
> Unfortunately it makes no difference if i use zip with 2 - or if I leave
> them ommited. The longer I guess about it, the more I think it might be a
> ZIP topic, namely how the stream to stdin needs to be like so zip will know
> the name of the file from it.
>
>
> Regards,
> Dennis

This is a known problem with zip, it's just not possible. Either you
select files, or you pass something on stdin (which will have no
filename). You will have to do the same trick with mkfifo, but you can
use the php function posix_mkfifo[1] for that.

- Matijn

[1] php.net/posix_mkfifo

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



Re: [PHP] Using named Pipes between PHP and ZIP

2012-07-09 Thread Dennis Heck


Unfortunately it makes no difference if i use zip with 2 - or if I leave 
them ommited. The longer I guess about it, the more I think it might be a 
ZIP topic, namely how the stream to stdin needs to be like so zip will know 
the name of the file from it.


Regards,
Dennis 



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



Re: [PHP] Using named Pipes between PHP and ZIP

2012-07-08 Thread tamouse mailing lists
≈On Sun, Jul 8, 2012 at 11:30 AM, Dennis Heck  wrote:
> Hello everyone,
>
> I'm looking for a solution for the following:
> 1) collecting data from a simple html form and send them to a php script
> 2) take the data and place them in a php-generated excel sheet
> 3) zip the excel sheet and password protect the zip file (standard
> encription will be sufficent, no AES needed)
> 4) send the zip file as an email attachment
> This kind of output is fixed, changing the output is not an option.
>
> I'm ok with building the excel sheet and sending the mail, but I'm still
> trying and error with the zip. Since I need password protection in the zip,
> I cannot use the php build in zip extension. I guess I will need to call ZIP
> on the shell. I'm aware I could first save the generated excel sheet to the
> filesystem and afterwards call the zip process on the file, putting the zip
> file also to the file system. But I wonder if there's an option to stream
> the data till they finally can be put to the multipart mail - without saving
> anything to the filesystem.
>
> Here is my first try, just a little modification of the example on proc_open
> in the php docu. To keep the test simple, I load a sample xls from the
> filesystem instead of generating from the php class and output it directly
> to the browser. The script works well except one point: the file contained
> in the zip will have no name an no file extension.
>
>header ('Content-type: application/zip');
>header ('Content-Disposition: attachment; filename="download.zip"');
>
>$descriptorspec = array(
>0 => array("pipe", "r"),
>   1 => array("pipe", "w"),
>   2 => array("file", "error-output.txt", "a")
>);
>
>$dateiname = 'xyz.xls';
>$file = fread(fopen($dateiname, "r"), filesize($dateiname));
>
>$process = proc_open('zip -P 1234', $descriptorspec, $pipes);
>
>if (is_resource($process)) {
>
>fwrite($pipes[0], $file);
>fclose($pipes[0]);
>
>$zip = stream_get_contents($pipes[1]);
>fclose($pipes[1]);
>
>$return_value = proc_close($process);
>}
>
>echo $zip;
>?>
>
> So I look for an option to get the name and extension in the zipfile. Here I
> found named pipes as an option. Calling via shell, tested with a textfile in
> order to use less
>
>mkfifo xyz.txt
>less readme.txt > xyz.txt & zip output.zip -FI xyz.txt -P 1234
>rm xyz.txt
>
> Now I get a pw protected zip file containing xyz.txt. Now how can I combine
> both? How can I tell php to use the named pipe instead of stdin in
> proc_open? Or any other idea to get the file in the zip the correct name and
> extension.
>
> Thanks in advance,
> Regards,
> Dennis
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

I *think* all you need in the first paramter to proc_open is :

zip -P password - -

The first - is the zip file -- which will be send to stdout.
The second - is the input -- which you should pipe your spreadsheet into.

Good luck!

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



[PHP] Using named Pipes between PHP and ZIP

2012-07-08 Thread Dennis Heck

Hello everyone,

I'm looking for a solution for the following:
1) collecting data from a simple html form and send them to a php script
2) take the data and place them in a php-generated excel sheet
3) zip the excel sheet and password protect the zip file (standard 
encription will be sufficent, no AES needed)

4) send the zip file as an email attachment
This kind of output is fixed, changing the output is not an option.

I'm ok with building the excel sheet and sending the mail, but I'm still 
trying and error with the zip. Since I need password protection in the zip, 
I cannot use the php build in zip extension. I guess I will need to call ZIP 
on the shell. I'm aware I could first save the generated excel sheet to the 
filesystem and afterwards call the zip process on the file, putting the zip 
file also to the file system. But I wonder if there's an option to stream 
the data till they finally can be put to the multipart mail - without saving 
anything to the filesystem.


Here is my first try, just a little modification of the example on proc_open 
in the php docu. To keep the test simple, I load a sample xls from the 
filesystem instead of generating from the php class and output it directly 
to the browser. The script works well except one point: the file contained 
in the zip will have no name an no file extension.


array("pipe", "r"),
  1 => array("pipe", "w"),
  2 => array("file", "error-output.txt", "a")
   );

   $dateiname = 'xyz.xls';
   $file = fread(fopen($dateiname, "r"), filesize($dateiname));

   $process = proc_open('zip -P 1234', $descriptorspec, $pipes);

   if (is_resource($process)) {

   fwrite($pipes[0], $file);
   fclose($pipes[0]);

   $zip = stream_get_contents($pipes[1]);
   fclose($pipes[1]);

   $return_value = proc_close($process);
   }

   echo $zip;
   ?>

So I look for an option to get the name and extension in the zipfile. Here I 
found named pipes as an option. Calling via shell, tested with a textfile in 
order to use less


   mkfifo xyz.txt
   less readme.txt > xyz.txt & zip output.zip -FI xyz.txt -P 1234
   rm xyz.txt

Now I get a pw protected zip file containing xyz.txt. Now how can I combine 
both? How can I tell php to use the named pipe instead of stdin in 
proc_open? Or any other idea to get the file in the zip the correct name and 
extension.


Thanks in advance,
Regards,
Dennis



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



Re: [PHP] Using default argument values in the middle of the argument list

2012-06-04 Thread ma...@behnke.biz


324...@mail.muni.cz hat am 1. Juni 2012 um 21:52 geschrieben:

> Hi,
>
> as I accidentally found out that PHP allows default argument values
> to occur not only at the end of parameter list:
>
> function ( Classname $a, Classname $b = null, Classname $c ) ...
>
> Unfortunately, documentation does not state what is supposed to happen in
> such situation.
> It appears $b can be an instance of Classname or a null.


You can find anything on that topic on the type hint section.
If you use type hinting:

Classname $a,

$a can only be instance of Classname, nothing else. But if you want to allow
null as well, you have to write

Classname $a = null,

Don't mistake this as default value! It is _meant_ as "Classname or null" are
allowed.

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



Re: [PHP] Using default argument values in the middle of the argument list

2012-06-03 Thread Matijn Woudt
On Sun, Jun 3, 2012 at 4:48 PM, oliver gondža  wrote:
> On Sat, 02 Jun 2012 21:35:28 +0200, Matijn Woudt  wrote:
>
>> It does not state it works only at the end of the list, it states that
>> it only makes sense to use it at the end of the argument list to be
>> able to call the function with less arguments. In case you want to use
>> it as suggested in [2], you can use it anywhere. You can rely on that
>> in any PHP version from 5 upwards, just because version 4 doesn't
>> support type hinting at all.
>>
>> - Matijn
>>
>> [2] http://php.net/manual/en/language.oop5.typehinting.php
>
>
> Wow that's great. Just to be sure are we talking about functions it's
> default arguments precedes its non-default arguments:
>
> function f ( Classname $a = null, Classname $b ) { ... }
>
> I believe it should be clearly stated in documentation that it is possible
> for several reasons.
>
> - I have never thought of using type hints and default arguments this way
> until I found it by accident.
> - I have never seen someone else using it (I've just search installed PEAR
> packages, codebase of Symphony2, Zend2 and several others and found *one*
> function definition taking advantage of this*).
> - As far as i know other languages that support default argument values
> allow specifying default arguments only for rightmost function arguments.
> - As far as i know the only part of documentation that illustrates function
> declarations having default argument preceding non-default arguments is the
> one titled: "Incorrect usage of default function arguments" in
> http://www.php.net/manual/en/functions.arguments.php.
>
> I just wanted to be sure this is haw it is supposed to be used.
>
> * DibiColumnInfo::__construct(IDibiReflector $reflector = NULL, array $info)
> in
> https://github.com/dg/dibi/blob/master/dibi/libs/DibiDatabaseInfo.php#L458
>
> -- Oliver

Yes, we're talking about the same thing. I guess the reason that you
don't see arguments with default values before other arguments is
because they are only useful in combination with type hinting a class.
And, even when using it in this combination, most of us will probably
prefer the argument with the default value at the end, so we can omit
this parameter when calling the function. It seems to me you might be
thinking a little bit too much inside a Java box ;)

- Matijn

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



Re: [PHP] Using default argument values in the middle of the argument list

2012-06-03 Thread oliver gondža

On Sat, 02 Jun 2012 21:35:28 +0200, Matijn Woudt  wrote:


It does not state it works only at the end of the list, it states that
it only makes sense to use it at the end of the argument list to be
able to call the function with less arguments. In case you want to use
it as suggested in [2], you can use it anywhere. You can rely on that
in any PHP version from 5 upwards, just because version 4 doesn't
support type hinting at all.

- Matijn

[2] http://php.net/manual/en/language.oop5.typehinting.php


Wow that's great. Just to be sure are we talking about functions it's  
default arguments precedes its non-default arguments:


function f ( Classname $a = null, Classname $b ) { ... }

I believe it should be clearly stated in documentation that it is possible  
for several reasons.


- I have never thought of using type hints and default arguments this way  
until I found it by accident.
- I have never seen someone else using it (I've just search installed PEAR  
packages, codebase of Symphony2, Zend2 and several others and found *one*  
function definition taking advantage of this*).
- As far as i know other languages that support default argument values  
allow specifying default arguments only for rightmost function arguments.
- As far as i know the only part of documentation that illustrates  
function declarations having default argument preceding non-default  
arguments is the one titled: "Incorrect usage of default function  
arguments" in http://www.php.net/manual/en/functions.arguments.php.


I just wanted to be sure this is haw it is supposed to be used.

* DibiColumnInfo::__construct(IDibiReflector $reflector = NULL, array  
$info) in  
https://github.com/dg/dibi/blob/master/dibi/libs/DibiDatabaseInfo.php#L458


-- Oliver

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



Re: [PHP] Using default argument values in the middle of the argument list

2012-06-02 Thread Matijn Woudt
On Sat, Jun 2, 2012 at 8:30 PM, oliver gondža  wrote:
> On Sat, 02 Jun 2012 17:13:55 +0200, Matijn Woudt  wrote:
>
>>
>> Hi Oliver,
>>
>> I think the example at [1] demonstrates that it is possible, but it
>> also notes that it is pretty useless. Why are you interested in this?
>>
>> - Matijn
>>
>> [1] http://www.php.net/manual/en/functions.arguments.php#example-153
>
>
> Hi,
>
> Thanx for your response.
>
> PHP class type hints are bit more restrictive than in say Java
> since it does not accept null as a value of a class. This provides
> great guarantees, however, sometimes it is desirable to allow null as well.
>
> This can be done using:
>
> function func ( Classname $a = null )
>
> Unfortunately, according to documentation this will work only at the end of
> parameter list. So this restriction force you to put nullable arguments at
> the end of argument list or not use type hints at all. In the worst case
> scenario you have to choose between use of illogical order of arguments,
> reimplementation of type hinting for arguments that comes after the
> nullable one or use no type hinting at all for nullable arguments:

It does not state it works only at the end of the list, it states that
it only makes sense to use it at the end of the argument list to be
able to call the function with less arguments. In case you want to use
it as suggested in [2], you can use it anywhere. You can rely on that
in any PHP version from 5 upwards, just because version 4 doesn't
support type hinting at all.

- Matijn

[2] http://php.net/manual/en/language.oop5.typehinting.php

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



Re: [PHP] Using default argument values in the middle of the argument list

2012-06-02 Thread oliver gondža

On Sat, 02 Jun 2012 17:13:55 +0200, Matijn Woudt  wrote:



Hi Oliver,

I think the example at [1] demonstrates that it is possible, but it
also notes that it is pretty useless. Why are you interested in this?

- Matijn

[1] http://www.php.net/manual/en/functions.arguments.php#example-153


Hi,

Thanx for your response.

PHP class type hints are bit more restrictive than in say Java
since it does not accept null as a value of a class. This provides
great guarantees, however, sometimes it is desirable to allow null as well.

This can be done using:

function func ( Classname $a = null )

Unfortunately, according to documentation this will work only at the end of
parameter list. So this restriction force you to put nullable arguments at
the end of argument list or not use type hints at all. In the worst case
scenario you have to choose between use of illogical order of arguments,
reimplementation of type hinting for arguments that comes after the
nullable one or use no type hinting at all for nullable arguments:

function func ( Classname $last, Classname $first = null ) {
  ...
}

or

function func ( Classname $first = null, Classname $last = null ) {
  if ( $last === null ) throw new InvalidArgumentException;
  ...
}

or

function func ( $first, Classname $last ) {
  if ( !( $first instanceof Classname ) ) throw new  
InvalidArgumentException;

  ...
}

This is not ideal especially if the desired solution seems to work:

function func ( Classname $first = null, Classname $last ) {
  ...
}

This function expects exactly two arguments. The second one is supposed to  
be an
instance of Classname and the first one may be an instance of Classname or  
null.


This might be useless for primitive values since any default value you can  
define
can be provided from the outside as well. But, it is definitely not  
useless for
objects since you can not pass null value as an argument that requires an  
object
of some class. As far as i can tell this can emulate Java style object  
type handling

when you needed it. I would be glad to rely on such a behavior.

-- Oliver

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



Re: [PHP] Using default argument values in the middle of the argument list

2012-06-02 Thread Matijn Woudt
On Fri, Jun 1, 2012 at 9:52 PM,  <324...@mail.muni.cz> wrote:
> Hi,
>
> as I accidentally found out that PHP allows default argument values
> to occur not only at the end of parameter list:
>
> function ( Classname $a, Classname $b = null, Classname $c ) ...
>
> Unfortunately, documentation does not state what is supposed to happen in
> such situation.
> It appears $b can be an instance of Classname or a null.
>
> I've draw up simple test case (https://gist.github.com/2829626) to verify my
> assumption
> and it seems to work at least since PHP 5.3.0. It is extremely useful to
> allow null
> value and retain the power of type hints at the same time.
>
> Is there anything else to test? Does it work for your setup? Can it be used
> that way?
> And if yes, can it be officially documented?
>
> Do not hesitate to prove I'm wrong.
>
> -- Oliver
>

Hi Oliver,

I think the example at [1] demonstrates that it is possible, but it
also notes that it is pretty useless. Why are you interested in this?

- Matijn

[1] http://www.php.net/manual/en/functions.arguments.php#example-153

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



[PHP] Using default argument values in the middle of the argument list

2012-06-01 Thread 324706

Hi,

as I accidentally found out that PHP allows default argument values
to occur not only at the end of parameter list:

function ( Classname $a, Classname $b = null, Classname $c ) ...

Unfortunately, documentation does not state what is supposed to happen in  
such situation.

It appears $b can be an instance of Classname or a null.

I've draw up simple test case (https://gist.github.com/2829626) to verify  
my assumption
and it seems to work at least since PHP 5.3.0. It is extremely useful to  
allow null

value and retain the power of type hints at the same time.

Is there anything else to test? Does it work for your setup? Can it be  
used that way?

And if yes, can it be officially documented?

Do not hesitate to prove I'm wrong.

-- Oliver

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



[PHP] Using a stream filter to do a search and replace on an XML file.

2012-03-19 Thread Richard Quadling
Hello.

Just learning about stream filtering and have 2 questions I hope
someone can give me some pointers on.


1 - Bucketing.

In reading a bit about how this works, the data is passed in chunks
through the filter - known as a bucket brigade.

How does this work if, for example, the search string is chopped by
the bucketing system? It would seem that you would end up with 2 parts
of the search element, neither would be matched for replacing and then
the whole element would be reconstituted in the output.

My filter method is ...

function filter($r_In, $r_Out, &$i_Consumed, $b_Closing)
{
while ($o_Bucket = stream_bucket_make_writeable($r_In))
{
$o_Bucket->data = preg_replace('`<(/?)(\d+)`', 
'<$1fixed_$2',
$o_Bucket->data);
$i_Consumed += $o_Bucket->datalen;
stream_bucket_append($r_Out, $o_Bucket);
}

return PSFS_PASS_ON;
}

This is working fine (so far as I can tell as SimpleXMLIterator is now
happy to read the XML file), but I'm guessing I'm missing something
here if my understanding is correct.




2 - Stream wrapping.

At the moment, we download a .gz file and decompress it into the .xml
file. I know I can use a zlib:// stream wrapper to save me having to
decode the .gz file first. This means smaller downloads and less
storage. We can even use the zlib:// filter on the URL, but we cache
the .gz file locally, so that isn't important.

But for a small set of files (their origin is known, so I can create a
rule for this issue), I have to expand the .gz file first and then fix
the file using the filter above. I then have two paths to load the xml
- either a zlib:// decompress stream or a straight local file.

I'd like to work out how to create a stream wrapper to allow me to say
SOMETHING like ...

$o_MySXI = new 
SimpleXMLIterator('xml.NoNumericTags://compress.zlib:///development/BadlyFormed.gz');

If this was possible, I'd be a LOT happier and could simply stream
from the .gz files without needing to hold onto anything.


Ideas/suggestions/examples/code gratefully received.

Regards,

Richard.

-- 
Richard Quadling
Twitter : EE : Zend : Fantasy Shopper
@RQuadling : http://e-e.com/M_248814.html : http://bit.ly/9O8vFY :
http://fan.sh/106/5tw

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



[PHP] Using SimpleXMLIterator with a Iterator Filter.

2011-11-15 Thread Richard Quadling
Hi.

I can never seem to get the SPL right in my head.

So, I hope someone can help.

I have many XML streams that I can use SimpleXMLIterator on.

Each streams is structured slightly differently.

Some streams contain unused data and may or may not hold the data at
the same level in the stream.

I need to be able to filter out specific nodes on a per stream basis.

So, for example, in 1 stream, I only want to examine the /entry nodes,
not the /title, /id nodes.

In another, only the /products/product nodes.

Currently, code along the lines of the snippet below is functional ...

xpath('/products'); }
... (repeat as required for each URL that requires it)

// Iterate the stream.
foreach($o_Stream as $s_Tag => $o_Element) {
 // Filter out the unwanted tags, based upon the stream url.
 if ('' === $s_URL && 'entry' === $s_Tag) {
  // Process $o_Element
  $o_Product = new \FS\Product();
  $o_Product->id = (string)$o_Element->id;
  ... (process the remaining properties of the element into the product).
 }
 ... (repeat the filtering of the tags for each stream url)
}
?>

Whilst the code above works it is unwieldy and is getting more and
more complex as new streams become available. And so I need to
refactor it.


I would like to remove the specifics of the filtering and the
processing to a point that I can take a feed URL and a filter and get
back Products, irrespective of the feed or filter. e.g.

getStreams() as $o_StreamInfo) {

  // Iterate the products for the URL (post filtering).
  foreach(new $o_StreamInfo->s_FilterClassName($o_StreamInfo->s_FeedUrl)
as $o_Product) {

// The product is standardised irrespective of the feed or the filter.

  }

}

?>

(As an aside, the
$o_StreamInfo->s_FilterClassName($o_StreamInfo->s_FeedUrl) line works
fine. A property of a class containing the name of a class to be
instantiated.)



I cannot work out do I use FilterIterator or RecursiveFilterIterator
or something other.

I expect to have at least 1 concrete class per filter - some will be
shared amongst multiple streams. There may be an abstract base class
to consolidate any duplication.

I may also need a mapper class to take the data from the stream and
present it as a standardised Product. I suppose they are 2 separate
concerns and could be treated as such. At the moment, I do not have a
need to have a mapper apply to different streams structures, so
combining the mapper and the filter into 1 entity does work with the
existing data I have. But I think having them separate will help in
the long run.


But I just can't seem to get my head around this.

I think applying a filter to the SimpleXMLIterator is causing the
filter to examine every node. This is not what I want.


Any ideas, suggestions, reading. I've got the manual but the iterator
documentation isn't great. I don't know who knows this stuff inside
out, or how to describe things in a useful way for the documentation.

So. Help!

Regards,

Richard Quadling.


-- 
Richard Quadling
Twitter : EE : Zend : PHPDoc : Fantasy Shopper
@RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY : bit.ly/lFnVea :
fan.sh/6/370

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



Re: [PHP] using passthru or system() even and passing the $_FILES array

2011-09-28 Thread tamouse mailing lists
On Wed, Sep 28, 2011 at 10:52 AM, Jim Lucas  wrote:
> On 9/28/2011 12:07 AM, Anton Heuschen wrote:
>> $command = '/usr/bin/php -f /var/www/details/Write.php '.$email.'
>> '.$actionDate.' '.$files.' >> php.log';
>> system($command,$return);
>
> At this point I would suggest that you echo $command before trying to execute 
> it.
>
> I think you might find that you are trying to pass characters that the cli are
> miss interpreting.

OP: Look at http://us2.php.net/manual/en/function.escapeshellarg.php
and http://us2.php.net/manual/en/function.escapeshellcmd.php

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



Re: [PHP] using passthru or system() even and passing the $_FILES array

2011-09-28 Thread Jim Lucas
On 9/28/2011 12:07 AM, Anton Heuschen wrote:
> Good day,
> 
> I have a question and something that either does not work, or I have not
> gotten it to work the way I want to.
> 
> I have a start page, which is a form, that takes 2 text fields and also a
> Attachment field. Then it calls the first page, which is supposed to spawn
> of a call to another page (I want to get the page to open server side see,
> to allow the user to close the window, and the process continues in the
> background) ...so I use either passthru or have now tried system().
> 
> The problem is that I can pass my 2 text fields as arguments to the call but
> I have a problem in accessing and using $_FILES now to handle the file
> defined.
> 
> I have tried to pass it to a $_SESSION["FILES"] , I have even tried to
> serialize the whole array and pass it also as argument and build a array on
> called php page, etc, but it does not seem to do anything, or handle the
> file?
> 
> 
> As further example, this is on the first page opened from the Form :
> 
> = php file 1 calling to file 2 =
> 
> session_start();
> $_SESSION["FILES"] = $_FILES;
> session_write_close();
> 
> $email  =   $_REQUEST['email'];
> $actionDate =   $_REQUEST['actiondate'];
> $files  =   serialize($_FILES);
> $command = '/usr/bin/php -f /var/www/details/Write.php '.$email.'
> '.$actionDate.' '.$files.' >> php.log';
> system($command,$return);

At this point I would suggest that you echo $command before trying to execute 
it.

I think you might find that you are trying to pass characters that the cli are
miss interpreting.


> 
> 
> 
> =
> 
> then in my called file
> 
> 
>  Write.php =
> 
> session_start();
> $FILES = $_SESSION['FILES'];
> 
> $files1 = $FILES["coms1_attachfile"];
> $filename1 = $files1;
> 
> ==

First, since you are calling this from the cli, their is no point in using
session_start().  session_start() has to do with running it in a web server not
from the cli.

Secondly, in file 1 you are using serialize() to package the $_FILES array.  Yet
in file 2 you are not using unserialize() to extract the data from the package.

I would suggest reading here http://php.net/manual/en/features.commandline.php
to get a better understanding of how to access the arguments that you are
passing on the cli.


> 
> $filename1 should now be recognized file name from a file provided in the
> first form, and if statement then runs the file to process to read the file,
> it seems here the process either does not get any file (so filename is never
> true) or the file process have no file to work with.

I'm curious as to what your initial HTML form looks like.

> 
> 
> So I am not really sure how passthru/system works with things like arrays
> and sessions and $_FILES array etc
> 

arrays, not via the cli argument list
serialized arrays, sure, but you have to escape any special chars that might
mess things up.
sessions, does not exist
$_FILES, no direct access

Jim

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



[PHP] using passthru or system() even and passing the $_FILES array

2011-09-28 Thread Anton Heuschen
Good day,

I have a question and something that either does not work, or I have not
gotten it to work the way I want to.

I have a start page, which is a form, that takes 2 text fields and also a
Attachment field. Then it calls the first page, which is supposed to spawn
of a call to another page (I want to get the page to open server side see,
to allow the user to close the window, and the process continues in the
background) ...so I use either passthru or have now tried system().

The problem is that I can pass my 2 text fields as arguments to the call but
I have a problem in accessing and using $_FILES now to handle the file
defined.

I have tried to pass it to a $_SESSION["FILES"] , I have even tried to
serialize the whole array and pass it also as argument and build a array on
called php page, etc, but it does not seem to do anything, or handle the
file?


As further example, this is on the first page opened from the Form :

= php file 1 calling to file 2 =

session_start();
$_SESSION["FILES"] = $_FILES;
session_write_close();

$email  =   $_REQUEST['email'];
$actionDate =   $_REQUEST['actiondate'];
$files  =   serialize($_FILES);
$command = '/usr/bin/php -f /var/www/details/Write.php '.$email.'
'.$actionDate.' '.$files.' >> php.log';
system($command,$return);



=

then in my called file


 Write.php =

session_start();
$FILES = $_SESSION['FILES'];

$files1 = $FILES["coms1_attachfile"];
$filename1 = $files1;

==

$filename1 should now be recognized file name from a file provided in the
first form, and if statement then runs the file to process to read the file,
it seems here the process either does not get any file (so filename is never
true) or the file process have no file to work with.


So I am not really sure how passthru/system works with things like arrays
and sessions and $_FILES array etc


Re: [PHP] Using stand-alone PHP scripts with Drupal

2011-08-24 Thread Florian Lemaitre

Le 24/08/2011 12:24, Geoff Shang a écrit :

Hi,

I know this is probably more a Drupal question, but I'm guessing some 
here have probably had to deal with this.


I've written some PHP code which works just fine on its own.  Now 
someone wants to include it in their Drupal site, with the regular 
headers and footers for their site surrounding the output from my 
scripts.


Is there an easy way to include the PHP in a page on their site?

Not sure which version of Drupal they're running, trying to find out.

Geoff.



Hi Geoff,

There's a mailing list for Drupal development questions : 
developm...@drupal.org


It depends of your script.
If it's just a set of functions that doesn't print directly to the 
screen but return elements that can be printing by another script it's 
ok. If that's the case, then you can create a custom module witch will 
include your code, define a block and output the result of your script 
in that block view.

Then you create a Panel and include that block in the panel.
(that's the proper way to do this, you might also find some freaking 
hacks that do that in a few lines)


What does your code do exactly ?

Sorry if I'm not clear.

Florian.


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



[PHP] Using stand-alone PHP scripts with Drupal

2011-08-24 Thread Geoff Shang

Hi,

I know this is probably more a Drupal question, but I'm guessing some here 
have probably had to deal with this.


I've written some PHP code which works just fine on its own.  Now someone 
wants to include it in their Drupal site, with the regular headers and 
footers for their site surrounding the output from my scripts.


Is there an easy way to include the PHP in a page on their site?

Not sure which version of Drupal they're running, trying to find out.

Geoff.


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



Re: [PHP] Using function prototypes in code

2011-08-10 Thread Simon J Welsh
On 10/08/2011, at 1:10 PM, Frank Thynne wrote:

> To confuse me a bit further, I can't find a definitive list of the
> basic type names. For example, is it "integer" or "int"?

Both. 
http://php.net/manual/en/language.types.type-juggling.php#language.types.typecasting
---
Simon Welsh
Admin of http://simon.geek.nz/


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



Re: [PHP] Using function prototypes in code

2011-08-10 Thread David Harkness
On Tue, Aug 9, 2011 at 6:10 PM, Frank Thynne  wrote:

> function integer int_func(string $s) {
>  // does something like, say, converting "five" to 5
> }
>

As Stuart pointed out, type-hinting currently only works for classes and
arrays. Scalar type-hinting is planned for the future, but for now you're
left with enforcing it in the function itself. You can create a class with
static helpers to make this easier if you're going to do it frequently.

As for documentation, go with the PHPDoc standard:

/**
 * Converts a spelled-out number to the equivalent integer.
 *
 * @param string $s must be a spelled out number, e.g. "five" rather than
"5".
 * @return int
 */
function int_func($s) { ... }

To confuse me a bit further, I can't find a definitive list of the
> basic type names. For example, is it "integer" or "int"?


I use "int" and "bool" with the rest spelled out which works with casting.

Peace,
David


Re: [PHP] Using function prototypes in code

2011-08-10 Thread Tim Streater
On 10 Aug 2011 at 02:10, Frank Thynne  wrote: 

> In the interest of clarity and maintainability I would like to be able
> to write code that makes it clear what kind of arguments a function
> expects and what it returns.

So add the appropriate comments to your functions.

> This is what I tried:
>
> function integer int_func(string $s) {
>  // does something like, say, converting "five" to 5
> }
>
> There are two problems:
> 1 The appearance of a type name before the function name is treated as
> a syntax error
> 2 Even if I forget about declaring the return type and code it instead
> as
>
> function int_func(string $s) {
> ...
> }
>
> I get a run-time error when I call the function with a string. (eg
> $var = int_func("five");) The error message says"Catchable fatal
> error: Argument 1 passed to int_func() must be an instance of string,
> string given".

Why are you doing this when the documentation clearly states that this is not 
how it works. Did you not read up about it first?

> It seems that basic data types cannot be specified in ths way although
> (intstances of) classes can. I have successfully used the technique to
> catch run-time errors of wrong object types when testing, but am
> surprised that I can't use it to trap unexpected basic types - or at
> least to document what is expected.

This is PHP, not FORTRAN IV.

Personally I see it as a great step forward that for the most part, I don't 
have to bother.

--
Cheers  --  Tim

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

Re: [PHP] Using function prototypes in code

2011-08-09 Thread Stuart Dallas
On 10 Aug 2011, at 02:10, Frank Thynne wrote:

> In the interest of clarity and maintainability I would like to be able
> to write code that makes it clear what kind of arguments a function
> expects and what it returns.
> 
> This is what I tried:
> 
> function integer int_func(string $s) {
> // does something like, say, converting "five" to 5
> }
> 
> There are two problems:
> 1 The appearance of a type name before the function name is treated as
> a syntax error
> 2 Even if I forget about declaring the return type and code it instead
> as
> 
> function int_func(string $s) {
> ...
> }
> 
> I get a run-time error when I call the function with a string. (eg
> $var = int_func("five");) The error message says"Catchable fatal
> error: Argument 1 passed to int_func() must be an instance of string,
> string given".
> 
> It seems that basic data types cannot be specified in ths way although
> (intstances of) classes can. I have successfully used the technique to
> catch run-time errors of wrong object types when testing, but am
> surprised that I can't use it to trap unexpected basic types - or at
> least to document what is expected.
> 
> To confuse me a bit further, I can't find a definitive list of the
> basic type names. For example, is it "integer" or "int"?

The manual says...

"Type Hints can only be of the object and array (since PHP 5.1) type. 
Traditional type hinting with int and string isn't supported."

http://php.net/language.oop5.typehinting

-Stuart

-- 
Stuart Dallas
3ft9 Ltd
http://3ft9.com/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Using function prototypes in code

2011-08-09 Thread Frank Thynne

In the interest of clarity and maintainability I would like to be able
to write code that makes it clear what kind of arguments a function
expects and what it returns.

This is what I tried:

function integer int_func(string $s) {
 // does something like, say, converting "five" to 5
}

There are two problems:
1 The appearance of a type name before the function name is treated as
a syntax error
2 Even if I forget about declaring the return type and code it instead
as

function int_func(string $s) {
...
}

I get a run-time error when I call the function with a string. (eg
$var = int_func("five");) The error message says"Catchable fatal
error: Argument 1 passed to int_func() must be an instance of string,
string given".

It seems that basic data types cannot be specified in ths way although
(intstances of) classes can. I have successfully used the technique to
catch run-time errors of wrong object types when testing, but am
surprised that I can't use it to trap unexpected basic types - or at
least to document what is expected.

To confuse me a bit further, I can't find a definitive list of the
basic type names. For example, is it "integer" or "int"?

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



RE: [PHP] using pg_query in a function not working

2011-08-05 Thread Marc Fromm
Thanks! Sometimes I'm blind.

-Original Message-
From: Jim Lucas [mailto:li...@cmsws.com] 
Sent: Friday, August 05, 2011 1:01 PM
To: Marc Fromm
Cc: php-general@lists.php.net
Subject: Re: [PHP] using pg_query in a function not working

On 8/5/2011 12:08 PM, Marc Fromm wrote:
> 
> I have to sql statements in functions to use in my code. Even though the echo 
> statements show the sql is valid the sql does not seem to execute and I get 
> the error, "PHP Warning:  pg_fetch_object() expects parameter 1 to be 
> resource, boolean given in . . . line 154 . . ."
> Line 154: while($val = pg_fetch_object($student))
> 

$conn is not in scope

> 
> Marc Fromm
> Information Technology Specialist II
> Financial Aid Department
> Western Washington University
> Phone: 360-650-3351
> Fax:   360-788-0251
> 



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



Re: [PHP] using pg_query in a function not working

2011-08-05 Thread Jim Lucas
On 8/5/2011 12:08 PM, Marc Fromm wrote:
> 
> I have to sql statements in functions to use in my code. Even though the echo 
> statements show the sql is valid the sql does not seem to execute and I get 
> the error, "PHP Warning:  pg_fetch_object() expects parameter 1 to be 
> resource, boolean given in . . . line 154 . . ."
> Line 154: while($val = pg_fetch_object($student))
> 

$conn is not in scope

> 
> Marc Fromm
> Information Technology Specialist II
> Financial Aid Department
> Western Washington University
> Phone: 360-650-3351
> Fax:   360-788-0251
> 


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



[PHP] using pg_query in a function not working

2011-08-05 Thread Marc Fromm

I have to sql statements in functions to use in my code. Even though the echo 
statements show the sql is valid the sql does not seem to execute and I get the 
error, "PHP Warning:  pg_fetch_object() expects parameter 1 to be resource, 
boolean given in . . . line 154 . . ."
Line 154: while($val = pg_fetch_object($student))

##

Function Calls:

$insert = recordSentList($empid, $list, "printed"); // No record gets inserted 
into the table

$student = getStudent($list);
while($val = pg_fetch_object($student)) //No records get listed
{

##

Functions:

function recordSentList($empid, $list, $method){
$today = date("m/d/Y", strtotime("now"));
$sql = "INSERT INTO lists_sent (
   
lists_sent_employers_id,
lists_sent_type,
lists_sent_date,

lists_sent_method)
VALUES (
'$empid',
'$list',
'$today',
'$method')";
echo "$sql"; // slq statement looks accurate
$result = pg_query($conn,$sql);
echo "Insert Errors: " . pg_errormessage($conn) . ""; 
//No errors are reported
return $result;
}

function getStudent($list){
$removaldate = date("m/d/Y",mktime(0, 0, 0, date("m")-3, 
date("d")-7,  date("Y")));
$sql = "SELECT * FROM students WHERE ";
if($list == "child_care_list"){
$sql .= "child_care_list > '" . $removaldate . 
"' ";
$sql .= "AND child_care_list IS NOT NULL ";
$sql .= "ORDER BY student_lname ASC, 
student_fname ASC";
} elseif ($list == "day_labor_list") {
$sql .= "day_labor_list > '" . $removaldate . 
"' ";
$sql .= "AND day_labor_list IS NOT NULL ";
$sql .= "ORDER BY student_lname ASC, 
student_fname ASC";
} else {
$sql .= "tutor_list > '" . $removaldate . "' ";
$sql .= "AND tutor_list IS NOT NULL ";
$sql .= "ORDER BY student_lname ASC, 
student_fname ASC";
}
echo "$sql"; // slq statement looks accurate
$result = pg_query($conn,$sql);
echo "Select Errors: " . pg_errormessage($conn) . "";//No 
errors are reported
echo "Rows: " . pg_num_rows($result) . "";//No number is 
displayed
if ((!$result) or (empty($result))){
return false;
 }
return $result;
}

Marc Fromm
Information Technology Specialist II
Financial Aid Department
Western Washington University
Phone: 360-650-3351
Fax:   360-788-0251


Re: [PHP] using wget in shell for download(snort)

2011-07-11 Thread Negin Nickparsa
I appreciate your attention,thank you very much

I have some problems like interdict in my country access that I can't access
the whole sites like this one
I have VPN that I use in my home but not in another locations like here.

I'll try it in another situation

BTW thank you very much Stuart


Re: [PHP] using wget in shell for download(snort)

2011-07-11 Thread Negin Nickparsa
I mean it was my own oinkcode I was a registered user


Re: [PHP] using wget in shell for download(snort)

2011-07-11 Thread Negin Nickparsa
I logined in there and I used my oinkcode I tried to download just one rule
I mean *.rules
It worked I can download one by one but not the group of them

maybe their files are corrupted

see here that I downloaded:

 wget http://cvs.snort.org/viewcvs.cgi/snort/rules/dos.rules
--12:09:32--  http://cvs.snort.org/viewcvs.cgi/snort/rules/dos.rules
   => `dos.rules'
Resolving cvs.snort.org... 64.214.53.20
Connecting to cvs.snort.org|64.214.53.20|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [text/html]

[<=>  ] 88,85819.99K/s

12:09:40 (19.98 KB/s) - `dos.rules' saved [88858]


Re: [PHP] using wget in shell for download(snort)

2011-07-11 Thread Stuart Dallas
On Mon, Jul 11, 2011 at 8:31 AM, Negin Nickparsa wrote:

> I'm in opensuse I tried wget url for another site it is working
> there(without -O)
>
> for example I can have this:
>
> wget http://library.linode.com/assets/695-wget-example.txt
>
> and it is working it will be downloaded on /root
>
> but I'm so confused about snort rules that why I can't download them
> I also tried this without -o:
>
>
>
> wget
> http://www.snort.org/reg-rules/snortrules-snapshot-2900.tar./c0e9480af637e53c7aae823a40a131edc1343db5
> --11:32:01--
> http://www.snort.org/reg-rules/snortrules-snapshot-2900.tar.gz/c9480af637e53c7aae823a40a131edc1343db5
>   => `c0e9480af637e53c7aae823a40a131edc1343db5'
> Resolving www.snort.org... 68.177.102.20
> Connecting to www.snort.org|68.177.102.20|:80... connected.
> HTTP request sent, awaiting response... 302 Found
> Location:
> http://s3.amazonaws.com/snort-org/www/rules/20110208/snortrules-snapot-2900.tar.gz?AWSAccessKeyId=AKIAJJSHU7YNPLE5MKOQ&Expires=1310368612&Signatur4%2FmK3rg3f%2FXFi5VhOm%2FjCW%2BcBSM%3D
> [following]
> --11:32:04--
> http://s3.amazonaws.com/snort-org/www/rules/20110208/snortrules-apshot-2900.tar.gz?AWSAccessKeyId=AKIAJJSHU7YNPLE5MKOQ&Expires=1310368612&Signure=4%2FmK3rg3f%2FXFi5VhOm%2FjCW%2BcBSM%3D
>   =>
> `snortrules-snapshot-2900.tar.gz?AWSAccessKeyId=AKIAJJSHU7YNPLE5OQ&Expires=1310368612&Signature=4%2FmK3rg3f%2FXFi5VhOm%2FjCW+cBSM='
> Resolving s3.amazonaws.com... 72.21.214.143
> Connecting to s3.amazonaws.com|72.21.214.143|:80... connected.
> HTTP request sent, awaiting response... 403 Forbidden
> 11:32:10 ERROR 403: Forbidden.
>
> again error the file is empty
>

It says it right there... ERROR 403: Forbidden.

According to http://www.snort.org/snort-rules you need to be a subscriber or
registered user to download the rules, so there is some form of validation
on the download URL. In the example you give I'm guessing it's
the c0e9480af637e53c7aae823a40a131edc1343db5. That means you can't simply
download from that URL, you'll need to programatically log into the website,
find the link and then do the download.

-Stuart

-- 
Stuart Dallas
3ft9 Ltd
http://3ft9.com/


Re: [PHP] using wget in shell for download(snort)

2011-07-11 Thread Stuart Dallas
On Mon, Jul 11, 2011 at 9:10 AM, Negin Nickparsa wrote:

> Sorry that I disssturbed you
> I appologize you,ok I will solve my problem in another mailing list
>

I'm not disturbed (well, maybe a little :D), just pointing out that since
your issue is to do with Snort and not PHP you might get a better response
from a more relevant mailing list.

my application is in php
> I simplified using snort by writing an application
> but in the updating part of files I wanted to automatically download the
> files
> which user will have nothing to do in shell just clicking on the sub button
> my task:by executing in PHP (doing updates)
> they have their downloaded files more easily
>

I just perused the Snort site and saw this...

"Users may opt to manually download and updates rules files, however most
Snort users automate the process using
PulledPork,
an open source perl script. If you plan on using PulledPork to manage VRT
Rules updates you'll need to login to snort.org and generate an
Oinkcode to
properly configure Oinkmaster."

Why don't you use PulledPork to update the rules since it seems to be the
officially supported method? PHP can shell out to a Perl script in exactly
the same way it can shell out to wget.

-Stuart

-- 
Stuart Dallas
3ft9 Ltd
http://3ft9.com/


Re: [PHP] using wget in shell for download(snort)

2011-07-11 Thread Negin Nickparsa
Sorry that I disssturbed you
I appologize you,ok I will solve my problem in another mailing list


my application is in php
I simplified using snort by writing an application
but in the updating part of files I wanted to automatically download the
files
which user will have nothing to do in shell just clicking on the sub button
my task:by executing in PHP (doing updates)
they have their downloaded files more easily


Re: [PHP] using wget in shell for download(snort)

2011-07-11 Thread Stuart Dallas
On Mon, Jul 11, 2011 at 8:57 AM, Negin Nickparsa wrote:

> I logined in there and I used my oinkcode I tried to download just one rule
> I mean *.rules
> It worked I can download one by one but not the group of them
>
> maybe their files are corrupted
>
> see here that I downloaded:
>
>  wget http://cvs.snort.org/viewcvs.cgi/snort/rules/dos.rules
> --12:09:32--  http://cvs.snort.org/viewcvs.cgi/snort/rules/dos.rules
>=> `dos.rules'
> Resolving cvs.snort.org... 64.214.53.20
> Connecting to cvs.snort.org|64.214.53.20|:80... connected.
> HTTP request sent, awaiting response... 200 OK
> Length: unspecified [text/html]
>
> [<=>  ] 88,85819.99K/s
>
> 12:09:40 (19.98 KB/s) - `dos.rules' saved [88858]
>

The URL you are requesting there gives you the changelog for the file. Did
you even look at the contents of the file you downloaded? If you want to
download the actual file, try
http://cvs.snort.org/viewcvs.cgi/*checkout*/snort/rules/dos.rules?rev=HEAD&content-type=text/plain-
this will give you the latest version in CVS which may or may not be
what
you want.

This has nothing to do with PHP (did it ever?), so I suggest you find a
snort mailing list and ask there.

-Stuart

-- 
Stuart Dallas
3ft9 Ltd
http://3ft9.com/


Re: [PHP] using wget in shell for download(snort)

2011-07-11 Thread Negin Nickparsa
I'm in opensuse I tried wget url for another site it is working
there(without -O)

for example I can have this:

wget http://library.linode.com/assets/695-wget-example.txt

and it is working it will be downloaded on /root

but I'm so confused about snort rules that why I can't download them
I also tried this without -o:



wget 
http://www.snort.org/reg-rules/snortrules-snapshot-2900.tar./c0e9480af637e53c7aae823a40a131edc1343db5
--11:32:01--  
http://www.snort.org/reg-rules/snortrules-snapshot-2900.tar.gz/c9480af637e53c7aae823a40a131edc1343db5
   => `c0e9480af637e53c7aae823a40a131edc1343db5'
Resolving www.snort.org... 68.177.102.20
Connecting to www.snort.org|68.177.102.20|:80... connected.
HTTP request sent, awaiting response... 302 Found
Location: 
http://s3.amazonaws.com/snort-org/www/rules/20110208/snortrules-snapot-2900.tar.gz?AWSAccessKeyId=AKIAJJSHU7YNPLE5MKOQ&Expires=1310368612&Signatur4%2FmK3rg3f%2FXFi5VhOm%2FjCW%2BcBSM%3D
[following]
--11:32:04--  
http://s3.amazonaws.com/snort-org/www/rules/20110208/snortrules-apshot-2900.tar.gz?AWSAccessKeyId=AKIAJJSHU7YNPLE5MKOQ&Expires=1310368612&Signure=4%2FmK3rg3f%2FXFi5VhOm%2FjCW%2BcBSM%3D
   => 
`snortrules-snapshot-2900.tar.gz?AWSAccessKeyId=AKIAJJSHU7YNPLE5OQ&Expires=1310368612&Signature=4%2FmK3rg3f%2FXFi5VhOm%2FjCW+cBSM='
Resolving s3.amazonaws.com... 72.21.214.143
Connecting to s3.amazonaws.com|72.21.214.143|:80... connected.
HTTP request sent, awaiting response... 403 Forbidden
11:32:10 ERROR 403: Forbidden.

again error the file is empty


Re: [PHP] using wget in shell for download(snort)

2011-07-10 Thread Richard Quadling
On 10 July 2011 11:38, Negin Nickparsa  wrote:
> I want to make a batch file and then exec it in php

You say "Batch"  file.

Are you using Windows?

If so, try "double quotes". That is the norm for windows.

And you can either use a space or change it to %20 in the URL.

Make sure the URL is correct by using it in a browser.

I tried 
http://www.snort.org/reg-rules/snortrules-snapshot-2900.tar.gz/c0e9480af637e53c7aae823a40a131edc1343db5%20-Osnortrules-snapshot-2900.tar.gz
and it failed.



-- 
Richard Quadling
Twitter : EE : Zend : PHPDoc
@RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY : bit.ly/lFnVea

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



Re: [PHP] using wget in shell for download(snort)

2011-07-10 Thread Torsten Rosenberger
Hello

Try wget 'url'

BR
-- 
Diese Nachricht wurde von meinem Android-Mobiltelefon mit K-9 Mail gesendet.



Re: [PHP] using wget in shell for download(snort)

2011-07-10 Thread Geoff Shang

On Sun, 10 Jul 2011, Tamara Temple wrote:


On Jul 10, 2011, at 5:38 AM, Negin Nickparsa wrote:


I want to make a batch file and then exec it in php
I have a problem in batch file
wget have been installed in Yast I want to download a RuleFile from
snort.org

I used this on shell:

$ wget
http://www.snort.org/reg-rules/snortrules-snapshot-2900.tar.gz/c0e9480af637e53c7aae823a40a131edc1343db5\-O
snortrules-snapshot-2900.tar.gz

that string is an oinkcode from the site

this commandline has error and I don't know why


What is the error?

This: "b5\-O" at the end of URL looks suspicious.


That's the problem.  The "\" should be a space.

Geoff.


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



Re: [PHP] using wget in shell for download(snort)

2011-07-10 Thread Tamara Temple


On Jul 10, 2011, at 5:38 AM, Negin Nickparsa wrote:


I want to make a batch file and then exec it in php
I have a problem in batch file
wget have been installed in Yast I want to download a RuleFile from
snort.org

I used this on shell:

$ wget
http://www.snort.org/reg-rules/snortrules-snapshot-2900.tar.gz/c0e9480af637e53c7aae823a40a131edc1343db5 
\-O

snortrules-snapshot-2900.tar.gz

that string is an oinkcode from the site

this commandline has error and I don't know why


What is the error?

This: "b5\-O" at the end of URL looks suspicious.

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



[PHP] using wget in shell for download(snort)

2011-07-10 Thread Negin Nickparsa
I want to make a batch file and then exec it in php
I have a problem in batch file
wget have been installed in Yast I want to download a RuleFile from
snort.org

I used this on shell:

$ wget
http://www.snort.org/reg-rules/snortrules-snapshot-2900.tar.gz/c0e9480af637e53c7aae823a40a131edc1343db5\-O
snortrules-snapshot-2900.tar.gz

that string is an oinkcode from the site

this commandline has error and I don't know why


Re: [PHP] using XHTML FRAMESET with Zend Layout on Zend_App (MVC)

2011-05-04 Thread Bjoern Bartels

hello Dare!

it seems you got something wrong there...
the .phtml files are not meant to be called directly.
for the frames' src-attributes you'll have to provide a full URI calling
another controller's/module's action to output the frame content.


YT
BB



[ Björn Bartels   ]

[ email :  bart...@dragon-projects.de ]
[ home  :   http://dragon-projects.de ]
[ skype :  bb-drummer ]
[ icq   :   283827160 ]
[ --- ]
Diese E-Mail könnte vertrauliche und/oder rechtlich geschützte  
Informationen enthalten. Wenn Sie nicht der richtige Adressat sind  
oder diese E-Mail irrtümlich erhalten haben, informieren Sie bitte  
sofort den Absender und vernichten Sie diese Mail. Das unerlaubte  
Kopieren sowie die unbefugte Weitergabe dieser Mail sind nicht  
gestattet.


This e-mail may contain confidential and/or privileged information. If  
you are not the intended recipient (or have received this e-mail in  
error) please notify the sender immediately and destroy this e-mail.  
Any unauthorised copying, disclosure or distribution of the material  
in this e-mail is strictly forbidden.


[ --- ]


Am 04.05.2011 um 14:04 schrieb Dare Williams:


Dear Developer,
Can anybody help with tips on how to implement a XHTML1_FRAMESET  
type on a Zend_Layout API in a Zend_Application(MVC).
example.in your bootstrap resources plugin  
(setting.ini).resources.layout.layout =  
"main"resources.layout.layoutPath = "/path/to/layout"
then on main.phtml you have this codeDocType() ; ?>"http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd 
">http://www.w3.org/1999/xhtml";>>HeadMeta ; ?>HeadTitle ; ?>HeadScript; ?>$this->HeadLink; ?>
framespacing="0">  scrolling="No" noresize="noresize" id="topFrame" title="topFrame" / 
>  framespacing="0">scrolling="No" noresize="noresize" id="leftFrame" title="leftFrame" / 
>title="mainFrame" />  noframes>
While mainDisplay.phtml stands as your main script that should load  
the Layout Content variable i.e layout()->content; ?>
My main question is how do you make layout()->content; ?>  
works on the external script(src="mainDisplay.phtml") that is called  
on main.phtml on mainFrameset .

Thank you.



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



Re: [PHP] Using SQLite without hosting support

2011-05-03 Thread Paul M Foster
On Tue, May 03, 2011 at 02:14:17PM -0400, ad...@buskirkgraphics.com wrote:

> 
> -Original Message-
> From: Paul M Foster [mailto:pa...@quillandmouse.com] 
> Sent: Tuesday, May 03, 2011 12:36 PM
> To: php-general@lists.php.net
> Subject: [PHP] Using SQLite without hosting support
> 
> Assume you have a hosting account with PHP5 support, but no SQLite
> support. Yes, supposedly SQLite support is standard for PHP5, but
> there's no law that keeps someone from compiling PHP5 without SQLite
> support.
> 
> So assuming that's the case, given that SQLite is a pretty simple
> product, is it possible to run PHP5 and use SQLite, even if support for
> it is not built in? The dl() function has some restrictions on it which
> might prohibit its use, so is there some way to use SQLite in this
> situation without resorting to using the dl() function?
> 
>
>
> Paul,
>   I could be wrong on this but unless you have a dedicated server, you
> do not have the recompilation rights if the hosting company is worth
> anything.

No, of course not. I have no desire to recompile PHP. But the hosting
company is entirely capable of recompiling PHP without support for
SQLite, if that's their preference.

Paul

-- 
Paul M. Foster
http://noferblatz.com
http://quillandmouse.com

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



RE: [PHP] Using SQLite without hosting support

2011-05-03 Thread admin
Paul,
I could be wrong on this but unless you have a dedicated server, you
do not have the recompilation rights if the hosting company is worth
anything.




Richard L. Buskirk


-Original Message-
From: Paul M Foster [mailto:pa...@quillandmouse.com] 
Sent: Tuesday, May 03, 2011 12:36 PM
To: php-general@lists.php.net
Subject: [PHP] Using SQLite without hosting support

Assume you have a hosting account with PHP5 support, but no SQLite
support. Yes, supposedly SQLite support is standard for PHP5, but
there's no law that keeps someone from compiling PHP5 without SQLite
support.

So assuming that's the case, given that SQLite is a pretty simple
product, is it possible to run PHP5 and use SQLite, even if support for
it is not built in? The dl() function has some restrictions on it which
might prohibit its use, so is there some way to use SQLite in this
situation without resorting to using the dl() function?

Paul

-- 
Paul M. Foster
http://noferblatz.com
http://quillandmouse.com

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


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



[PHP] Using SQLite without hosting support

2011-05-03 Thread Paul M Foster
Assume you have a hosting account with PHP5 support, but no SQLite
support. Yes, supposedly SQLite support is standard for PHP5, but
there's no law that keeps someone from compiling PHP5 without SQLite
support.

So assuming that's the case, given that SQLite is a pretty simple
product, is it possible to run PHP5 and use SQLite, even if support for
it is not built in? The dl() function has some restrictions on it which
might prohibit its use, so is there some way to use SQLite in this
situation without resorting to using the dl() function?

Paul

-- 
Paul M. Foster
http://noferblatz.com
http://quillandmouse.com

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



[PHP] Re: PHP -- using without installing

2011-02-15 Thread Michelle Konzack
Hello Steve Staples,

Am 2011-02-14 12:32:51, hacktest Du folgendes herunter:
> Is there such a thing?  or will I have to have a pre-req of "php and
> php-cgi must be installed on linux" disclaimer?

If you are a OVER-GEEK, youc can compile the "php"  and  "php-cli"  100%
static, which I have done some years agao with "php4" du  to  a  special
requirement

But believe it you executable will be 20 or more MByte because you  need
libc6 and other things to be compiled into!  :-D

Thanks, Greetings and nice Day/Evening
Michelle Konzack

-- 
# Debian GNU/Linux Consultant ##
   Development of Intranet and Embedded Systems with Debian GNU/Linux

itsystems@tdnet France EURL   itsystems@tdnet UG (limited liability)
Owner Michelle KonzackOwner Michelle Konzack

Apt. 917 (homeoffice)
50, rue de Soultz Kinzigstraße 17
67100 Strasbourg/France   77694 Kehl/Germany
Tel: +33-6-61925193 mobil Tel: +49-177-9351947 mobil
Tel: +33-9-52705884 fix

  
 

Jabber linux4miche...@jabber.ccc.de
ICQ#328449886

Linux-User #280138 with the Linux Counter, http://counter.li.org/


signature.pgp
Description: Digital signature


Re: [PHP] using BOTH GET and POST in the same page.

2011-02-15 Thread tedd

At 4:32 PM -0500 2/14/11, Paul M Foster wrote:


Understood. It sounded like you were saying you could only get back POST
or GET values from a page, which isn't true. The form itself, yes, can
only have one or the other method attribute.


What it sounded like was:


What others have not addressed is that the form used to send
variables will send only GET OR POST method variables, but not both
at the same time.


I still stand by that statement. A form can only send variables 
through the method stated in the form.


The "action" value of the form is not data provided by a POST-method 
form -- it simply uses the address provided by the coder. If you want 
to add GET data to the action value, then that's your call, but the 
POST method form will do nothing to the action value data. However, a 
GET-method form will change the action value.


Try this as an experiment. Use a GET form with the action value 
containing get type data (?id=1234) and see what happens to that data.


If you do, then you'll have a better idea of what you can/can't do with a form.

Cheers,

tedd
--
---
http://sperling.com/

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



Re: [PHP] PHP -- using without installing

2011-02-14 Thread Richard Quadling
On 14 February 2011 21:50, Steve Staples  wrote:
> On Mon, 2011-02-14 at 16:10 -0500, Paul M Foster wrote:
>> On Mon, Feb 14, 2011 at 12:32:51PM -0500, Steve Staples wrote:
>>
>> > Hi!
>> >
>> > I've been developing this stand alone application, found the webserver
>> > that I am going to use (it is written in php) and all is good... on
>> > windows.
>> >
>> > I can get the php.exe and php-cgi.exe running no issue on windows
>> > without "installing" them... even tested on 3 machines (developed on
>> > Vista, sent to my friend on W7, and my GF on XP Home) and they all work
>> > fine... now I was trying to port it over to linux, and I can't find
>> > anything that I can use :(
>> >
>> > Is there such a thing?  or will I have to have a pre-req of "php and
>> > php-cgi must be installed on linux" disclaimer?
>> >
>> > Any help, or pointers to where my google-fu has failed me would be
>> > appreciated :)
>>
>> I don't know if there's a web server under Linux which is written in
>> PHP. But I imagine you'd be hard pressed to find a Linux distribution
>> which does not come with several web servers and PHP either already
>> installed or easily installable. After all, most of the web is running
>> on Linux servers.
>>
>> Paul
>>
>> --
>> Paul M. Foster
>> http://noferblatz.com
>>
>>
>
> it's not that I dont want to have a webserver installed, it is a
> standalone app, that doesn't require apache or any other httpd server
> running... for people who want to run this on their windows, or linux,
> or slackware servers and have no use for an "apache" server running for
> just this.
>
> i've got it working for windows, where i didn't have to install
> anything, was just looking for something for a "*nix" distribution that
> will do it too.
>
> the webserver i am using, is 'nanserv', which works perfectly for what I
> need it to do, and running under linux, it's very fast (windows is a bit
> slow, but that's windows for ya)
>
> I guess I am just going to have to say that having PHP installed is a
> pre-req for the app (i just dont want to go installing software on
> people's computers)
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

What you are looking for is php cli.
http://docs.php.net/manual/en/install.unix.commandline.php contains
scant information about this.

But, a common mechanism (and as a windows only user, I'm 50% guessing
here) in getting a "file" to run it's handler is to add a line to the
top of the file which the shell you are running uses to determine the
program responsible for handling it.

On Windows, this is a combination of the extension and the registry
(controlled by assoc and ftype). On *nix, the line at the top of the
script seems to to a similar thing.

#!/usr/bin/php

http://articles.sitepoint.com/article/php-command-line-1 seems like a
good place to start.


There may be some issue with the line. The install may be in a
different location or have a different name (#!/usr/local/bin/php-cgi
for example).

Richard.

-- 
Richard Quadling
Twitter : EE : Zend
@RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY

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



Re: [PHP] PHP -- using without installing

2011-02-14 Thread Steve Staples
On Mon, 2011-02-14 at 16:10 -0500, Paul M Foster wrote:
> On Mon, Feb 14, 2011 at 12:32:51PM -0500, Steve Staples wrote:
> 
> > Hi!
> > 
> > I've been developing this stand alone application, found the webserver
> > that I am going to use (it is written in php) and all is good... on
> > windows.
> > 
> > I can get the php.exe and php-cgi.exe running no issue on windows
> > without "installing" them... even tested on 3 machines (developed on
> > Vista, sent to my friend on W7, and my GF on XP Home) and they all work
> > fine... now I was trying to port it over to linux, and I can't find
> > anything that I can use :(
> > 
> > Is there such a thing?  or will I have to have a pre-req of "php and
> > php-cgi must be installed on linux" disclaimer?
> > 
> > Any help, or pointers to where my google-fu has failed me would be
> > appreciated :)
> 
> I don't know if there's a web server under Linux which is written in
> PHP. But I imagine you'd be hard pressed to find a Linux distribution
> which does not come with several web servers and PHP either already
> installed or easily installable. After all, most of the web is running
> on Linux servers.
> 
> Paul
> 
> -- 
> Paul M. Foster
> http://noferblatz.com
> 
> 

it's not that I dont want to have a webserver installed, it is a
standalone app, that doesn't require apache or any other httpd server
running... for people who want to run this on their windows, or linux,
or slackware servers and have no use for an "apache" server running for
just this.

i've got it working for windows, where i didn't have to install
anything, was just looking for something for a "*nix" distribution that
will do it too.

the webserver i am using, is 'nanserv', which works perfectly for what I
need it to do, and running under linux, it's very fast (windows is a bit
slow, but that's windows for ya)

I guess I am just going to have to say that having PHP installed is a
pre-req for the app (i just dont want to go installing software on
people's computers)


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



Re: [PHP] using BOTH GET and POST in the same page.

2011-02-14 Thread Paul M Foster
On Mon, Feb 14, 2011 at 12:30:56PM -0500, tedd wrote:

> >At 11:58 PM -0500 2/13/11, Paul M Foster wrote:
> >On Sun, Feb 13, 2011 at 02:25:45PM -0500, tedd wrote:
> >
> > > At 10:53 AM +0530 2/12/11, Ashim Kapoor wrote:
> > > >Dear All,
> > > >
> > > >I am reading "PHP5 and MySQL Bible". Chapter 7 of the book says
> >that PHP can
> > > >use GET and POST in the SAME page! Also it says that we can use
> the SAME
> > > >variables in GET and POST variable sets and that conflict
> >resolution is done
> > > >by variable_order option in php.ini Can some one write a small
> program to
> > > >illustrate the previous ideas?  It is not clear to me as to how
> >to implement
> > > >this.
> > > >
> > > >Many thanks,
> > > >Ashim.
> > >
> > > Ashim:
> > >
> > > What others have not addressed is that the form used to send
> > > variables will send only GET OR POST method variables, but not both
> > > at the same time.
> >
> >-snip-
> >
> >It sounds like you're saying this isn't possible, yet it is. So what am
> >I missing? Is there an error in my code?
> >
> >Paul
> >
> >--
> >Paul M. Foster
> >http://noferblatz.com
> 
> 
> Paul:
> 
> What I am saying is your form is a POST-method-form and it will only
> send variables via the POST method. If you change the form's method
> to GET, then the variables from the form will be sent via the GET
> method.
> 
> Remember, there is ONLY ONE form being used per Submit action -- it
> can either be a POST method or a GET method, but it can not be both.
> 
> This does not mean that you can't send both POST and GET variables
> together via the same Submit action, but it does mean that the *form*
> will only send it's contents via one method or the other.
> 
> Here's a demo:
> 
> http://php1.net/c/post-get
> 
> Please note that the POST method form will send only POST data and
> the GET method form will send only GET data. However, you can force a
> POST method *form* via the action attribute value to also include a
> GET variable (see Submit POST w/GET) -- BUT -- that does not come
> from the form's input but rather from the action attribute. Do you
> see what I mean?
> 
> The code is shown.

Understood. It sounded like you were saying you could only get back POST
or GET values from a page, which isn't true. The form itself, yes, can
only have one or the other method attribute.

> 
> Also, please note interaction between the GET/POST/REQUEST re the
> variable 'alfa' and you will get an idea of why REQUEST may pose a
> problem.

This is why I don't use the REQUEST variable.

Paul

-- 
Paul M. Foster
http://noferblatz.com


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



Re: [PHP] PHP -- using without installing

2011-02-14 Thread Paul M Foster
On Mon, Feb 14, 2011 at 12:32:51PM -0500, Steve Staples wrote:

> Hi!
> 
> I've been developing this stand alone application, found the webserver
> that I am going to use (it is written in php) and all is good... on
> windows.
> 
> I can get the php.exe and php-cgi.exe running no issue on windows
> without "installing" them... even tested on 3 machines (developed on
> Vista, sent to my friend on W7, and my GF on XP Home) and they all work
> fine... now I was trying to port it over to linux, and I can't find
> anything that I can use :(
> 
> Is there such a thing?  or will I have to have a pre-req of "php and
> php-cgi must be installed on linux" disclaimer?
> 
> Any help, or pointers to where my google-fu has failed me would be
> appreciated :)

I don't know if there's a web server under Linux which is written in
PHP. But I imagine you'd be hard pressed to find a Linux distribution
which does not come with several web servers and PHP either already
installed or easily installable. After all, most of the web is running
on Linux servers.

Paul

-- 
Paul M. Foster
http://noferblatz.com


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



[PHP] PHP -- using without installing

2011-02-14 Thread Steve Staples
Hi!

I've been developing this stand alone application, found the webserver
that I am going to use (it is written in php) and all is good... on
windows.

I can get the php.exe and php-cgi.exe running no issue on windows
without "installing" them... even tested on 3 machines (developed on
Vista, sent to my friend on W7, and my GF on XP Home) and they all work
fine... now I was trying to port it over to linux, and I can't find
anything that I can use :(

Is there such a thing?  or will I have to have a pre-req of "php and
php-cgi must be installed on linux" disclaimer?

Any help, or pointers to where my google-fu has failed me would be
appreciated :)

TIA!

Steve


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



Re: [PHP] using BOTH GET and POST in the same page.

2011-02-14 Thread tedd

At 10:31 PM -0500 2/13/11, Robert Cummings wrote:

On 11-02-13 02:25 PM, tedd wrote:

At 10:53 AM +0530 2/12/11, Ashim Kapoor wrote:

Dear All,

I am reading "PHP5 and MySQL Bible". Chapter 7 of the book says that PHP can
use GET and POST in the SAME page! Also it says that we can use the SAME
variables in GET and POST variable sets and that conflict resolution is done
by variable_order option in php.ini Can some one write a small program to
illustrate the previous ideas?  It is not clear to me as to how to implement
this.

Many thanks,
Ashim.


Ashim:

What others have not addressed is that the form used to send
variables will send only GET OR POST method variables, but not both
at the same time.

Using REQUEST will show the values of the variables sent, but will
not show what method was used (not addressing COOKIE) and that is the
reason why it's not the best idea to use REQUEST.

Furthermore, as you point out, conflict resolution is done in
accordance with variable order as set in the php.ini file and that
can be different between different environments. As such, a script
can act differently and there in lies the problem.

Now, I have used scripts that may receive POST or GET variables and
act accordingly, but you will never (except possibly AJAX) have a
situation where a script will receive both sets of variables at the
same time. So, I don't think one can write a small simple script that
can demonstrate this.


This is terribly wrong... any drupal site (or probably any front 
controller based CMS) will use GET variables to route to the correct 
page which may have a form which will capture the POSTed data. I've 
seen POST and GET often in the same page.


Cheers,
Rob.


Rob:

Understood, but that is not what I am addressing. A form can only 
send data it has collected via it's declared method and the choices 
are POST or GET, but not both.


Please review the post I made to Paul on this subject -- that 
explains this concept better.


Cheers,

tedd

--
---
http://sperling.com/

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



Re: [PHP] using BOTH GET and POST in the same page.

2011-02-14 Thread tedd

At 11:58 PM -0500 2/13/11, Paul M Foster wrote:
On Sun, Feb 13, 2011 at 02:25:45PM -0500, tedd wrote:

 > At 10:53 AM +0530 2/12/11, Ashim Kapoor wrote:
 > >Dear All,
 > >
 > >I am reading "PHP5 and MySQL Bible". Chapter 7 of the book says 
that PHP can

 > >use GET and POST in the SAME page! Also it says that we can use the SAME
 > >variables in GET and POST variable sets and that conflict 
resolution is done

 > >by variable_order option in php.ini Can some one write a small program to
 > >illustrate the previous ideas?  It is not clear to me as to how 
to implement

 > >this.
 > >
 > >Many thanks,
 > >Ashim.
 >
 > Ashim:
 >
 > What others have not addressed is that the form used to send
 > variables will send only GET OR POST method variables, but not both
 > at the same time.

-snip-

It sounds like you're saying this isn't possible, yet it is. So what am
I missing? Is there an error in my code?

Paul

--
Paul M. Foster
http://noferblatz.com



Paul:

What I am saying is your form is a POST-method-form and it will only 
send variables via the POST method. If you change the form's method 
to GET, then the variables from the form will be sent via the GET 
method.


Remember, there is ONLY ONE form being used per Submit action -- it 
can either be a POST method or a GET method, but it can not be both.


This does not mean that you can't send both POST and GET variables 
together via the same Submit action, but it does mean that the *form* 
will only send it's contents via one method or the other.


Here's a demo:

http://php1.net/c/post-get

Please note that the POST method form will send only POST data and 
the GET method form will send only GET data. However, you can force a 
POST method *form* via the action attribute value to also include a 
GET variable (see Submit POST w/GET) -- BUT -- that does not come 
from the form's input but rather from the action attribute. Do you 
see what I mean?


The code is shown.

Also, please note interaction between the GET/POST/REQUEST re the 
variable 'alfa' and you will get an idea of why REQUEST may pose a 
problem.


Cheers,

tedd

--
---
http://sperling.com/

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



Re: [PHP] using BOTH GET and POST in the same page.

2011-02-13 Thread Paul M Foster
On Sun, Feb 13, 2011 at 02:25:45PM -0500, tedd wrote:

> At 10:53 AM +0530 2/12/11, Ashim Kapoor wrote:
> >Dear All,
> >
> >I am reading "PHP5 and MySQL Bible". Chapter 7 of the book says that PHP can
> >use GET and POST in the SAME page! Also it says that we can use the SAME
> >variables in GET and POST variable sets and that conflict resolution is done
> >by variable_order option in php.ini Can some one write a small program to
> >illustrate the previous ideas?  It is not clear to me as to how to implement
> >this.
> >
> >Many thanks,
> >Ashim.
> 
> Ashim:
> 
> What others have not addressed is that the form used to send
> variables will send only GET OR POST method variables, but not both
> at the same time.
> 
> Using REQUEST will show the values of the variables sent, but will
> not show what method was used (not addressing COOKIE) and that is the
> reason why it's not the best idea to use REQUEST.
> 
> Furthermore, as you point out, conflict resolution is done in
> accordance with variable order as set in the php.ini file and that
> can be different between different environments. As such, a script
> can act differently and there in lies the problem.
> 
> Now, I have used scripts that may receive POST or GET variables and
> act accordingly, but you will never (except possibly AJAX) have a
> situation where a script will receive both sets of variables at the
> same time. So, I don't think one can write a small simple script that
> can demonstrate this.

I'm sure I must be misunderstanding something here. The following is a
script which will show both GET and POST being received by the script,
and with the same variable names but different values:

=-=-=-=-=-=-=-=-=-

\n";
print_r($_GET);
print "\n";
print "POST:\n";
print_r($_POST);
 
?>






=-=-=-=-=-=-=-=-=-=

Call this script via test.php?alfa=1234
Call it the first time this way and leave that in the location bar of
your browser. Now fill in the value in the blank with the value 4567.
Press the "submit" button. You will see that $_POST['alfa'] returns
4567, while $_GET['alfa'] returns 1234.

It sounds like you're saying this isn't possible, yet it is. So what am
I missing? Is there an error in my code?

Paul

-- 
Paul M. Foster
http://noferblatz.com


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



Re: [PHP] using BOTH GET and POST in the same page.

2011-02-13 Thread Robert Cummings

On 11-02-13 02:25 PM, tedd wrote:

At 10:53 AM +0530 2/12/11, Ashim Kapoor wrote:

Dear All,

I am reading "PHP5 and MySQL Bible". Chapter 7 of the book says that PHP can
use GET and POST in the SAME page! Also it says that we can use the SAME
variables in GET and POST variable sets and that conflict resolution is done
by variable_order option in php.ini Can some one write a small program to
illustrate the previous ideas?  It is not clear to me as to how to implement
this.

Many thanks,
Ashim.


Ashim:

What others have not addressed is that the form used to send
variables will send only GET OR POST method variables, but not both
at the same time.

Using REQUEST will show the values of the variables sent, but will
not show what method was used (not addressing COOKIE) and that is the
reason why it's not the best idea to use REQUEST.

Furthermore, as you point out, conflict resolution is done in
accordance with variable order as set in the php.ini file and that
can be different between different environments. As such, a script
can act differently and there in lies the problem.

Now, I have used scripts that may receive POST or GET variables and
act accordingly, but you will never (except possibly AJAX) have a
situation where a script will receive both sets of variables at the
same time. So, I don't think one can write a small simple script that
can demonstrate this.


This is terribly wrong... any drupal site (or probably any front 
controller based CMS) will use GET variables to route to the correct 
page which may have a form which will capture the POSTed data. I've seen 
POST and GET often in the same page.


Cheers,
Rob.
--
E-Mail Disclaimer: Information contained in this message and any
attached documents is considered confidential and legally protected.
This message is intended solely for the addressee(s). Disclosure,
copying, and distribution are prohibited unless authorized.

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



Re: [PHP] using BOTH GET and POST in the same page.

2011-02-13 Thread tedd

At 10:53 AM +0530 2/12/11, Ashim Kapoor wrote:

Dear All,

I am reading "PHP5 and MySQL Bible". Chapter 7 of the book says that PHP can
use GET and POST in the SAME page! Also it says that we can use the SAME
variables in GET and POST variable sets and that conflict resolution is done
by variable_order option in php.ini Can some one write a small program to
illustrate the previous ideas?  It is not clear to me as to how to implement
this.

Many thanks,
Ashim.


Ashim:

What others have not addressed is that the form used to send 
variables will send only GET OR POST method variables, but not both 
at the same time.


Using REQUEST will show the values of the variables sent, but will 
not show what method was used (not addressing COOKIE) and that is the 
reason why it's not the best idea to use REQUEST.


Furthermore, as you point out, conflict resolution is done in 
accordance with variable order as set in the php.ini file and that 
can be different between different environments. As such, a script 
can act differently and there in lies the problem.


Now, I have used scripts that may receive POST or GET variables and 
act accordingly, but you will never (except possibly AJAX) have a 
situation where a script will receive both sets of variables at the 
same time. So, I don't think one can write a small simple script that 
can demonstrate this.


Cheers,

tedd

--
---
http://sperling.com/

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



Re: [PHP] using BOTH GET and POST in the same page.

2011-02-12 Thread Jim Lucas

On 2/11/2011 9:23 PM, Ashim Kapoor wrote:

Dear All,

I am reading "PHP5 and MySQL Bible". Chapter 7 of the book says that PHP can
use GET and POST in the SAME page! Also it says that we can use the SAME
variables in GET and POST variable sets and that conflict resolution is done
by variable_order option in php.ini Can some one write a small program to
illustrate the previous ideas?  It is not clear to me as to how to implement
this.

Many thanks,
Ashim.




But basically, the short of it is this.


  
  

  

  Name:

  
  
  

  
  
  

  


When submitted with data to this:



Will result in this:

Array
(
[page_id] => 22
[action] => AddUser
)
Array
(
[action] => DelUser
[FullName] => Jim Lucas
)
Array
(
[page_id] => 22
[action] => DelUser
[FullName] => Jim Lucas
)

Check out the example that I wrote here http://www.cmsws.com/?page_id=5

Jim Lucas

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



[PHP] using BOTH GET and POST in the same page.

2011-02-11 Thread Ashim Kapoor
Dear All,

I am reading "PHP5 and MySQL Bible". Chapter 7 of the book says that PHP can
use GET and POST in the SAME page! Also it says that we can use the SAME
variables in GET and POST variable sets and that conflict resolution is done
by variable_order option in php.ini Can some one write a small program to
illustrate the previous ideas?  It is not clear to me as to how to implement
this.

Many thanks,
Ashim.


Re: [PHP] Using fopen or SQL to check image

2010-06-26 Thread Karl Cifius
Thanks Ashley and Peter for your suggestions, I've definitely learned  
some new stuff here.


Best,
Karl


On 25 jun 2010, at 21.07, Peter Lind  wrote:

On 25 June 2010 21:02, Ashley Sheridan   
wrote:


On Fri, 2010-06-25 at 21:01 +0200, Peter Lind wrote:

On 25 June 2010 20:59, Ashley Sheridan   
wrote:


On Fri, 2010-06-25 at 20:57 +0200, Peter Lind wrote:

On 25 June 2010 19:35, Ashley Sheridan   
wrote:

On Fri, 2010-06-25 at 19:31 +0200, Karl Cifius wrote:


Hi,

I'm making a Facebook application that can generate images to  
user's
albums. To publish a story a thumbnail of this image is stored  
on my
server. Since this server currently is very limited I want to be  
able

to clean these thumbnails pretty often.

To not get broken links in older facebook stories the address to  
the
thumbnail is a php script that checks if the thumbnail is  
available

and returns it, or otherwise returns a default thumbnail.

I have solved this using the following code:

$tImage = $_GET['i'];
$tURL   = "upload/$tImage.jpg";
if(!($fp=fopen($tURL,"rb"))){
   header("Location: thumb.jpg");
}else{
   header("Location: upload/$tImage.jpg");
   fclose($fp);
}

My question is if it would be better to have a mysql database with
information about the thumbnail and check if the image is there,
instead of checking if the image file can be loaded? What is the  
most

optimized approach if I start to gain traffic?


Thanks,

/Karl




I think checking for the existence of a file is probably going to  
be the
quicker approach. Unless you have a server with loads of RAM and  
your DB
is very small, it's unlikely your DB will exist entirely in  
memory, so
you will at some point have to access the files that the DB uses,  
even

though this is done by the server automatically.

On another note, I would try to sanitise that $_GET variable a  
bit, as
it could lead to issues down the line later. Maybe limit the  
string to

patterns you expect for an image URL.

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



Might be quicker to do with a .htaccess file - you can avoid  
loading php at all.


Regards
Peter



PHP can do things that .htaccess can't, like verify a specific ID  
has access to an image, etc.




I must've missed the part in the code where the ID was checked ...
Nope, still can't find it.

Regards
Peter


--

WWW: http://plphp.dk / http://plind.dk
LinkedIn: http://www.linkedin.com/in/plind
BeWelcome/Couchsurfing: Fake51
Twitter: http://twitter.com/kafe15


It wasn't in the example, but generally I've found the only reason  
someone ever thinks of doing something like this rather than  
directly link to the image is for some sort of validation reason. I  
assumed it was a slimmed-down code sample that only showed us what  
we needed.




Ahh, I see. I assumed the OP would have told us if that was the case -
I prefer answering the stated questions instead of guessing at what
they are.

Regards
Peter

--

WWW: http://plphp.dk / http://plind.dk
LinkedIn: http://www.linkedin.com/in/plind
BeWelcome/Couchsurfing: Fake51
Twitter: http://twitter.com/kafe15



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



Re: [PHP] Using fopen or SQL to check image

2010-06-25 Thread Peter Lind
On 25 June 2010 21:02, Ashley Sheridan  wrote:
>
> On Fri, 2010-06-25 at 21:01 +0200, Peter Lind wrote:
>
> On 25 June 2010 20:59, Ashley Sheridan  wrote:
> >
> > On Fri, 2010-06-25 at 20:57 +0200, Peter Lind wrote:
> >
> > On 25 June 2010 19:35, Ashley Sheridan  wrote:
> > > On Fri, 2010-06-25 at 19:31 +0200, Karl Cifius wrote:
> > >
> > >> Hi,
> > >>
> > >> I'm making a Facebook application that can generate images to user's
> > >> albums. To publish a story a thumbnail of this image is stored on my
> > >> server. Since this server currently is very limited I want to be able
> > >> to clean these thumbnails pretty often.
> > >>
> > >> To not get broken links in older facebook stories the address to the
> > >> thumbnail is a php script that checks if the thumbnail is available
> > >> and returns it, or otherwise returns a default thumbnail.
> > >>
> > >> I have solved this using the following code:
> > >>
> > >> $tImage = $_GET['i'];
> > >> $tURL   = "upload/$tImage.jpg";
> > >> if(!($fp=fopen($tURL,"rb"))){
> > >>    header("Location: thumb.jpg");
> > >> }else{
> > >>    header("Location: upload/$tImage.jpg");
> > >>    fclose($fp);
> > >> }
> > >>
> > >> My question is if it would be better to have a mysql database with
> > >> information about the thumbnail and check if the image is there,
> > >> instead of checking if the image file can be loaded? What is the most
> > >> optimized approach if I start to gain traffic?
> > >>
> > >>
> > >> Thanks,
> > >>
> > >> /Karl
> > >>
> > >
> > >
> > > I think checking for the existence of a file is probably going to be the
> > > quicker approach. Unless you have a server with loads of RAM and your DB
> > > is very small, it's unlikely your DB will exist entirely in memory, so
> > > you will at some point have to access the files that the DB uses, even
> > > though this is done by the server automatically.
> > >
> > > On another note, I would try to sanitise that $_GET variable a bit, as
> > > it could lead to issues down the line later. Maybe limit the string to
> > > patterns you expect for an image URL.
> > >
> > > Thanks,
> > > Ash
> > > http://www.ashleysheridan.co.uk
> > >
> >
> > Might be quicker to do with a .htaccess file - you can avoid loading php at 
> > all.
> >
> > Regards
> > Peter
> >
> >
> >
> > PHP can do things that .htaccess can't, like verify a specific ID has 
> > access to an image, etc.
> >
>
> I must've missed the part in the code where the ID was checked ...
> Nope, still can't find it.
>
> Regards
> Peter
>
>
> --
> 
> WWW: http://plphp.dk / http://plind.dk
> LinkedIn: http://www.linkedin.com/in/plind
> BeWelcome/Couchsurfing: Fake51
> Twitter: http://twitter.com/kafe15
> 
>
> It wasn't in the example, but generally I've found the only reason someone 
> ever thinks of doing something like this rather than directly link to the 
> image is for some sort of validation reason. I assumed it was a slimmed-down 
> code sample that only showed us what we needed.
>

Ahh, I see. I assumed the OP would have told us if that was the case -
I prefer answering the stated questions instead of guessing at what
they are.

Regards
Peter

--

WWW: http://plphp.dk / http://plind.dk
LinkedIn: http://www.linkedin.com/in/plind
BeWelcome/Couchsurfing: Fake51
Twitter: http://twitter.com/kafe15


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



Re: [PHP] Using fopen or SQL to check image

2010-06-25 Thread Ashley Sheridan
On Fri, 2010-06-25 at 21:01 +0200, Peter Lind wrote:

> On 25 June 2010 20:59, Ashley Sheridan  wrote:
> >
> > On Fri, 2010-06-25 at 20:57 +0200, Peter Lind wrote:
> >
> > On 25 June 2010 19:35, Ashley Sheridan  wrote:
> > > On Fri, 2010-06-25 at 19:31 +0200, Karl Cifius wrote:
> > >
> > >> Hi,
> > >>
> > >> I'm making a Facebook application that can generate images to user's
> > >> albums. To publish a story a thumbnail of this image is stored on my
> > >> server. Since this server currently is very limited I want to be able
> > >> to clean these thumbnails pretty often.
> > >>
> > >> To not get broken links in older facebook stories the address to the
> > >> thumbnail is a php script that checks if the thumbnail is available
> > >> and returns it, or otherwise returns a default thumbnail.
> > >>
> > >> I have solved this using the following code:
> > >>
> > >> $tImage = $_GET['i'];
> > >> $tURL   = "upload/$tImage.jpg";
> > >> if(!($fp=fopen($tURL,"rb"))){
> > >>header("Location: thumb.jpg");
> > >> }else{
> > >>header("Location: upload/$tImage.jpg");
> > >>fclose($fp);
> > >> }
> > >>
> > >> My question is if it would be better to have a mysql database with
> > >> information about the thumbnail and check if the image is there,
> > >> instead of checking if the image file can be loaded? What is the most
> > >> optimized approach if I start to gain traffic?
> > >>
> > >>
> > >> Thanks,
> > >>
> > >> /Karl
> > >>
> > >
> > >
> > > I think checking for the existence of a file is probably going to be the
> > > quicker approach. Unless you have a server with loads of RAM and your DB
> > > is very small, it's unlikely your DB will exist entirely in memory, so
> > > you will at some point have to access the files that the DB uses, even
> > > though this is done by the server automatically.
> > >
> > > On another note, I would try to sanitise that $_GET variable a bit, as
> > > it could lead to issues down the line later. Maybe limit the string to
> > > patterns you expect for an image URL.
> > >
> > > Thanks,
> > > Ash
> > > http://www.ashleysheridan.co.uk
> > >
> >
> > Might be quicker to do with a .htaccess file - you can avoid loading php at 
> > all.
> >
> > Regards
> > Peter
> >
> >
> >
> > PHP can do things that .htaccess can't, like verify a specific ID has 
> > access to an image, etc.
> >
> 
> I must've missed the part in the code where the ID was checked ...
> Nope, still can't find it.
> 
> Regards
> Peter
> 
> 
> --
> 
> WWW: http://plphp.dk / http://plind.dk
> LinkedIn: http://www.linkedin.com/in/plind
> BeWelcome/Couchsurfing: Fake51
> Twitter: http://twitter.com/kafe15
> 


It wasn't in the example, but generally I've found the only reason
someone ever thinks of doing something like this rather than directly
link to the image is for some sort of validation reason. I assumed it
was a slimmed-down code sample that only showed us what we needed.

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




Re: [PHP] Using fopen or SQL to check image

2010-06-25 Thread Peter Lind
On 25 June 2010 20:59, Ashley Sheridan  wrote:
>
> On Fri, 2010-06-25 at 20:57 +0200, Peter Lind wrote:
>
> On 25 June 2010 19:35, Ashley Sheridan  wrote:
> > On Fri, 2010-06-25 at 19:31 +0200, Karl Cifius wrote:
> >
> >> Hi,
> >>
> >> I'm making a Facebook application that can generate images to user's
> >> albums. To publish a story a thumbnail of this image is stored on my
> >> server. Since this server currently is very limited I want to be able
> >> to clean these thumbnails pretty often.
> >>
> >> To not get broken links in older facebook stories the address to the
> >> thumbnail is a php script that checks if the thumbnail is available
> >> and returns it, or otherwise returns a default thumbnail.
> >>
> >> I have solved this using the following code:
> >>
> >> $tImage = $_GET['i'];
> >> $tURL   = "upload/$tImage.jpg";
> >> if(!($fp=fopen($tURL,"rb"))){
> >>    header("Location: thumb.jpg");
> >> }else{
> >>    header("Location: upload/$tImage.jpg");
> >>    fclose($fp);
> >> }
> >>
> >> My question is if it would be better to have a mysql database with
> >> information about the thumbnail and check if the image is there,
> >> instead of checking if the image file can be loaded? What is the most
> >> optimized approach if I start to gain traffic?
> >>
> >>
> >> Thanks,
> >>
> >> /Karl
> >>
> >
> >
> > I think checking for the existence of a file is probably going to be the
> > quicker approach. Unless you have a server with loads of RAM and your DB
> > is very small, it's unlikely your DB will exist entirely in memory, so
> > you will at some point have to access the files that the DB uses, even
> > though this is done by the server automatically.
> >
> > On another note, I would try to sanitise that $_GET variable a bit, as
> > it could lead to issues down the line later. Maybe limit the string to
> > patterns you expect for an image URL.
> >
> > Thanks,
> > Ash
> > http://www.ashleysheridan.co.uk
> >
>
> Might be quicker to do with a .htaccess file - you can avoid loading php at 
> all.
>
> Regards
> Peter
>
>
>
> PHP can do things that .htaccess can't, like verify a specific ID has access 
> to an image, etc.
>

I must've missed the part in the code where the ID was checked ...
Nope, still can't find it.

Regards
Peter


--

WWW: http://plphp.dk / http://plind.dk
LinkedIn: http://www.linkedin.com/in/plind
BeWelcome/Couchsurfing: Fake51
Twitter: http://twitter.com/kafe15


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



Re: [PHP] Using fopen or SQL to check image

2010-06-25 Thread Ashley Sheridan
On Fri, 2010-06-25 at 20:57 +0200, Peter Lind wrote:

> On 25 June 2010 19:35, Ashley Sheridan  wrote:
> > On Fri, 2010-06-25 at 19:31 +0200, Karl Cifius wrote:
> >
> >> Hi,
> >>
> >> I'm making a Facebook application that can generate images to user's
> >> albums. To publish a story a thumbnail of this image is stored on my
> >> server. Since this server currently is very limited I want to be able
> >> to clean these thumbnails pretty often.
> >>
> >> To not get broken links in older facebook stories the address to the
> >> thumbnail is a php script that checks if the thumbnail is available
> >> and returns it, or otherwise returns a default thumbnail.
> >>
> >> I have solved this using the following code:
> >>
> >> $tImage = $_GET['i'];
> >> $tURL   = "upload/$tImage.jpg";
> >> if(!($fp=fopen($tURL,"rb"))){
> >>header("Location: thumb.jpg");
> >> }else{
> >>header("Location: upload/$tImage.jpg");
> >>fclose($fp);
> >> }
> >>
> >> My question is if it would be better to have a mysql database with
> >> information about the thumbnail and check if the image is there,
> >> instead of checking if the image file can be loaded? What is the most
> >> optimized approach if I start to gain traffic?
> >>
> >>
> >> Thanks,
> >>
> >> /Karl
> >>
> >
> >
> > I think checking for the existence of a file is probably going to be the
> > quicker approach. Unless you have a server with loads of RAM and your DB
> > is very small, it's unlikely your DB will exist entirely in memory, so
> > you will at some point have to access the files that the DB uses, even
> > though this is done by the server automatically.
> >
> > On another note, I would try to sanitise that $_GET variable a bit, as
> > it could lead to issues down the line later. Maybe limit the string to
> > patterns you expect for an image URL.
> >
> > Thanks,
> > Ash
> > http://www.ashleysheridan.co.uk
> >
> 
> Might be quicker to do with a .htaccess file - you can avoid loading php at 
> all.
> 
> Regards
> Peter
> 
> 


PHP can do things that .htaccess can't, like verify a specific ID has
access to an image, etc.

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




Re: [PHP] Using fopen or SQL to check image

2010-06-25 Thread Peter Lind
On 25 June 2010 19:35, Ashley Sheridan  wrote:
> On Fri, 2010-06-25 at 19:31 +0200, Karl Cifius wrote:
>
>> Hi,
>>
>> I'm making a Facebook application that can generate images to user's
>> albums. To publish a story a thumbnail of this image is stored on my
>> server. Since this server currently is very limited I want to be able
>> to clean these thumbnails pretty often.
>>
>> To not get broken links in older facebook stories the address to the
>> thumbnail is a php script that checks if the thumbnail is available
>> and returns it, or otherwise returns a default thumbnail.
>>
>> I have solved this using the following code:
>>
>> $tImage = $_GET['i'];
>> $tURL   = "upload/$tImage.jpg";
>> if(!($fp=fopen($tURL,"rb"))){
>>    header("Location: thumb.jpg");
>> }else{
>>    header("Location: upload/$tImage.jpg");
>>    fclose($fp);
>> }
>>
>> My question is if it would be better to have a mysql database with
>> information about the thumbnail and check if the image is there,
>> instead of checking if the image file can be loaded? What is the most
>> optimized approach if I start to gain traffic?
>>
>>
>> Thanks,
>>
>> /Karl
>>
>
>
> I think checking for the existence of a file is probably going to be the
> quicker approach. Unless you have a server with loads of RAM and your DB
> is very small, it's unlikely your DB will exist entirely in memory, so
> you will at some point have to access the files that the DB uses, even
> though this is done by the server automatically.
>
> On another note, I would try to sanitise that $_GET variable a bit, as
> it could lead to issues down the line later. Maybe limit the string to
> patterns you expect for an image URL.
>
> Thanks,
> Ash
> http://www.ashleysheridan.co.uk
>

Might be quicker to do with a .htaccess file - you can avoid loading php at all.

Regards
Peter


-- 

WWW: http://plphp.dk / http://plind.dk
LinkedIn: http://www.linkedin.com/in/plind
BeWelcome/Couchsurfing: Fake51
Twitter: http://twitter.com/kafe15


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



Re: [PHP] Using fopen or SQL to check image

2010-06-25 Thread Ashley Sheridan
On Fri, 2010-06-25 at 19:31 +0200, Karl Cifius wrote:

> Hi,
> 
> I'm making a Facebook application that can generate images to user's  
> albums. To publish a story a thumbnail of this image is stored on my  
> server. Since this server currently is very limited I want to be able  
> to clean these thumbnails pretty often.
> 
> To not get broken links in older facebook stories the address to the  
> thumbnail is a php script that checks if the thumbnail is available  
> and returns it, or otherwise returns a default thumbnail.
> 
> I have solved this using the following code:
> 
> $tImage = $_GET['i'];
> $tURL   = "upload/$tImage.jpg";
> if(!($fp=fopen($tURL,"rb"))){
>header("Location: thumb.jpg");
> }else{
>header("Location: upload/$tImage.jpg");
>fclose($fp);
> }
> 
> My question is if it would be better to have a mysql database with  
> information about the thumbnail and check if the image is there,  
> instead of checking if the image file can be loaded? What is the most  
> optimized approach if I start to gain traffic?
> 
> 
> Thanks,
> 
> /Karl
> 


I think checking for the existence of a file is probably going to be the
quicker approach. Unless you have a server with loads of RAM and your DB
is very small, it's unlikely your DB will exist entirely in memory, so
you will at some point have to access the files that the DB uses, even
though this is done by the server automatically.

On another note, I would try to sanitise that $_GET variable a bit, as
it could lead to issues down the line later. Maybe limit the string to
patterns you expect for an image URL.

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




[PHP] Using fopen or SQL to check image

2010-06-25 Thread Karl Cifius


Hi,

I'm making a Facebook application that can generate images to user's  
albums. To publish a story a thumbnail of this image is stored on my  
server. Since this server currently is very limited I want to be able  
to clean these thumbnails pretty often.


To not get broken links in older facebook stories the address to the  
thumbnail is a php script that checks if the thumbnail is available  
and returns it, or otherwise returns a default thumbnail.


I have solved this using the following code:

$tImage = $_GET['i'];
$tURL   = "upload/$tImage.jpg";
if(!($fp=fopen($tURL,"rb"))){
  header("Location: thumb.jpg");
}else{
  header("Location: upload/$tImage.jpg");
  fclose($fp);
}

My question is if it would be better to have a mysql database with  
information about the thumbnail and check if the image is there,  
instead of checking if the image file can be loaded? What is the most  
optimized approach if I start to gain traffic?



Thanks,

/Karl



[PHP] Using LDAPS with PHP / certificates

2010-06-11 Thread Jérémy ESCOLANO
Hi,

I'm trying to contact an openLDAP from Apache server (on windows) using PHP
using LDAPS

Here is my sample code :

$host="ldaps://srvLDAP";
$port="636";
$ds=ldap_connect($host,$port);
ldap_set_option($ds,LDAP_OPT_PROTOCOL_VERSION,3);
$r=ldap_bind($ds,"cn=admin,o=exemple,dc=fr","exemple" );
$sr=ldap_search($ds,"o=exemple,dc=fr",("objectClass=exemple" ));
$info=ldap_get_entries($ds,$sr);
print $info["count"]." enregistrements trouvés.";


I passed lot of time trying configuring my servers and here is what i have
done :

First i configured my openLDAP server :

slapd.conf:
#cert requested for the ldapserver
TLSCertificateFile  ./ssl2/srvLDAP.cer
TLSCertificateKeyFile   ./ssl2/srvLDAP.key
#CA cert
TLSCACertificateFile./ssl2/cacert.cer
TLSVerifyClient never

ldap.conf:
TLS_CACERT  ./ssl2/cacert.cer
TLS_REQCERT never

On my apache server i created a folder C:\openldap\sysconf
and created a file ldap.conf :

TLS_CACERT  ./ssl/cacert.cer
TLS_REQCERT never

(I also created a folder c:\openldap\sysconf\ssl and put my CA certificate
inside it)
(of course I activated ldap and ssl in my php.ini)

>From now it DOES work BUT it doesn't verify any certificate.

I want now to make it verifying the certificate. I know i have to
change TLS_REQCERT never to TLS_REQCERT demand on openldap server
and apache server. I tryed but it doesn't work. I can't contact ldap server..

On the openLDAP I have this following error:

connection_read(1176): checking for input on id=0
TLS trace: SSL_accept:before/accept initialization
TLS trace: SSL_accept:SSLv3 read client hello A
TLS trace: SSL_accept:SSLv3 write server hello A
TLS trace: SSL_accept:SSLv3 write certificate A
TLS trace: SSL_accept:SSLv3 write certificate request A
TLS trace: SSL_accept:SSLv3 flush data
TLS trace: SSL_accept:error in SSLv3 read client certificate A
TLS trace: SSL_accept:error in SSLv3 read client certificate A
connection_get(1176): got connid=0
connection_read(1176): checking for input on id=0
TLS trace: SSL3 alert write:fatal:handshake failure
TLS trace: SSL_accept:error in SSLv3 read client certificate B
TLS: can't accept.
TLS: error:140890C7:SSL routines:SSL3_GET_CLIENT_CERTIFICATE:peer did not
return
 a certificate s3_srvr.c:2471
connection_read(1176): TLS accept error error=-1 id=0, closing
connection_closing: readying conn=0 sd=1176 for close
connection_close: conn=0 sd=1176


That means that the openLDAP can't check the client certificate cuz PHP and
Apache don't send any to it.

I heard about a ldaprc file but I can't find any information about it...

Is there somebody who can help me with this ?

Thank you very much in advance.


Re: [PHP] Using if(isset()) with $_GET and switch and default

2010-05-22 Thread MuFei
Yes, I got it now.
Thanks Daniel
Thanks everyone!


On Sat, May 22, 2010 at 12:08 AM, Daniel P. Brown
 wrote:
> On Fri, May 21, 2010 at 17:02, MuFei  wrote:
>> Hi Ashley,
>> Your way works also great, But I have some question thought:
>> When I only use the first half of the code you suggested:
>> $question = (isset($_GET['question']));
>> then use the $question in the switch it works as I want it.
>> If I use the whole code( $question =
>> (isset($_GET['question']))?$_GET['question']:'some default value
>> here';), the results also are the same.
>> My question is:
>> What is the code from the "?"sign to the end for?
>
>    Ash gave you a ternary operator example.
>
>        http://php.net/manual/en/language.operators.comparison.php
>
> --
> 
> daniel.br...@parasane.net || danbr...@php.net
> http://www.parasane.net/ || http://www.pilotpig.net/
> We now offer SAME-DAY SETUP on a new line of servers!
>

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



Re: [PHP] Using if(isset()) with $_GET and switch and default

2010-05-21 Thread Daniel P. Brown
On Fri, May 21, 2010 at 17:02, MuFei  wrote:
> Hi Ashley,
> Your way works also great, But I have some question thought:
> When I only use the first half of the code you suggested:
> $question = (isset($_GET['question']));
> then use the $question in the switch it works as I want it.
> If I use the whole code( $question =
> (isset($_GET['question']))?$_GET['question']:'some default value
> here';), the results also are the same.
> My question is:
> What is the code from the "?"sign to the end for?

Ash gave you a ternary operator example.

http://php.net/manual/en/language.operators.comparison.php

-- 

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

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



  1   2   3   4   5   6   7   8   9   10   >