Re: [PHP] solution

2010-04-19 Thread tedd

At 7:26 PM +0200 4/18/10, Michiel Sikma wrote:

On 17 April 2010 13:03, Paulo-WORK pauloworkm...@googlemail.com wrote:


 I have reached a solution for my problem with js.
 Following all the sugestions and using jquery turned out to be quite
 simple.
 using .hide( ) and .show( ) i am able to change the #div with Js enabled

  content and no js.




That's the best way to go. After all, the only real way to detect Javascript
is to *use* Javascript :)

Michiel


The best way is to *attempt* to use it thus providing progressive 
enhancement *if* it's there.


Cheers,

tedd

--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

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



Re: [PHP] solution

2010-04-18 Thread Michiel Sikma
On 17 April 2010 13:03, Paulo-WORK pauloworkm...@googlemail.com wrote:

 I have reached a solution for my problem with js.
 Following all the sugestions and using jquery turned out to be quite
 simple.
 using .hide( ) and .show( ) i am able to change the #div with Js enabled
 content and no js.



That's the best way to go. After all, the only real way to detect Javascript
is to *use* Javascript :)

Michiel


Re: [PHP] solution

2010-04-17 Thread lala

Paulo-WORK wrote:

I have reached a solution for my problem with js.
Following all the sugestions and using jquery turned out to be quite 
simple.
using .ide( ) and .show( ) i am able to change the #div with Js enabled 
content and no js.

So defining with css for example:

#main{display:none;}
#main_nojs{display:block;}
if js is enabled on load Jquery will .hide( #min_nojs) and -.show(#main) 
if is off #main is already defined as display:none and #main_nojs as 
display:block.

Paulo Carvalho



Here's how some others solved the problem.

http://thedailywtf.com/articles/bulletproof-javascript-detection.aspx

I took out all my money (both cents) and put it under my mattress ;D

Mike Wright


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



Re: [PHP] Solution

2010-04-13 Thread tedd

At 6:04 PM -0400 4/12/10, Gary wrote:

For those that were looking to see a solution, this is what I have come up
with.  It was pointed out on another board (MySQL) that inserting multiple
in one script is probably prohibited because of security reasons.

What I did was open the connection, insert into the table, close the
connection, close the php script, then start over again.  This is the code:

$dbc=mysqli_connect('localhost','root','','test')or die('Error connecting to
MySQL server');

$query=INSERT INTO name(fname, lname).VALUES('$fname','$lname');

$result=mysqli_query($dbc, $query)
or die('Error querying database.');

mysqli_close($dbc);
?

?php

$dbc=mysqli_connect('localhost','root','','test')or die('Error connecting to
MySQL server');
$query=INSERT INTO address (street, town, state,
zip).VALUES('$street','$town','$state','$zip');

$result=mysqli_query($dbc, $query)
or die('Error querying database.');

mysqli_close($dbc);

?

It seems a little redundant for PHP, however it seems to work.

Thank you to everyone that responded.  If by the way someone sees an issue
with this solution, I would love to read it.

Gary


Gary :

It not only looks redundant, but why two tables?

Why not customers or users or subscribers like so:

include(opendb.php);

$query=INSERT INTO users (first_name, last_name, street, town, state, zip)
VALUES('$first_name', '$last_name', $street', '$town', '$state', '$zip');

$result=mysqli_query($dbc, $query) or die('Error querying database.');

include(closedb.php);

I don't see any reason to separate the attributes of the person into 
two different tables. Why do that?


Cheers,

tedd

--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

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



Re: [PHP] Solution

2010-04-13 Thread Gary
Tedd

I had four tables.  name, (fname, lname) address(street, town, state, zip), 
contact(phone, fax, email), comments (comments).

It was done this way because it is strictly a learning exercise.  I had 
never created a DB with multiple tables, so I wanted to be able to contruct 
one using foreign keys, and be able to insert and retrieve from it.

But the experiment continues.  For whatever reason, scripts to query a DB 
that I have used for years are not working.  I am thinking it has something 
to do with that I switched engines to innodb.

So the lesson continues.

Gary

tedd tedd.sperl...@gmail.com wrote in message 
news:p06240804c7ea44eb9...@[192.168.1.102]...
 At 6:04 PM -0400 4/12/10, Gary wrote:
For those that were looking to see a solution, this is what I have come up
with.  It was pointed out on another board (MySQL) that inserting multiple
in one script is probably prohibited because of security reasons.

What I did was open the connection, insert into the table, close the
connection, close the php script, then start over again.  This is the 
code:

$dbc=mysqli_connect('localhost','root','','test')or die('Error connecting 
to
MySQL server');

$query=INSERT INTO name(fname, lname).VALUES('$fname','$lname');

$result=mysqli_query($dbc, $query)
or die('Error querying database.');

mysqli_close($dbc);
?

?php

$dbc=mysqli_connect('localhost','root','','test')or die('Error connecting 
to
MySQL server');
$query=INSERT INTO address (street, town, state,
zip).VALUES('$street','$town','$state','$zip');

$result=mysqli_query($dbc, $query)
or die('Error querying database.');

mysqli_close($dbc);

?

It seems a little redundant for PHP, however it seems to work.

Thank you to everyone that responded.  If by the way someone sees an issue
with this solution, I would love to read it.

Gary

 Gary :

 It not only looks redundant, but why two tables?

 Why not customers or users or subscribers like so:

 include(opendb.php);

 $query=INSERT INTO users (first_name, last_name, street, town, state, 
 zip)
 VALUES('$first_name', '$last_name', $street', '$town', '$state', '$zip');

 $result=mysqli_query($dbc, $query) or die('Error querying database.');

 include(closedb.php);

 I don't see any reason to separate the attributes of the person into two 
 different tables. Why do that?

 Cheers,

 tedd

 -- 
 ---
 http://sperling.com  http://ancientstones.com  http://earthstones.com

 __ Information from ESET Smart Security, version of virus 
 signature database 5025 (20100413) __

 The message was checked by ESET Smart Security.

 http://www.eset.com


 



__ Information from ESET Smart Security, version of virus signature 
database 5025 (20100413) __

The message was checked by ESET Smart Security.

http://www.eset.com





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



Re: [PHP] Solution

2010-04-13 Thread Jim Lucas
tedd wrote:
 
 I don't see any reason to separate the attributes of the person into two
 different tables. Why do that?
 

tedd,

Funny you ask this.  I have always thought the same thing.  Then just last week
I started listing to the Zend Dev Zone podcasts.  I came across this one and
thought it was very informative.

http://devzone.zend.com/article/4497-The-ZendCon-Sessions-Episode-17-SQL-Query-Tuning-The-Legend-of-Drunken-Query-Master

It is pretty long, but it contains a lot of good information.

Listen the part about how many records you can contain in memory.

-- 
Jim Lucas

   Some men are born to greatness, some achieve greatness,
   and some have greatness thrust upon them.

Twelfth Night, Act II, Scene V
by William Shakespeare

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



Re: [PHP] Solution

2010-04-13 Thread tedd

At 12:26 PM -0400 4/13/10, Gary wrote:

Tedd

I had four tables.  name, (fname, lname) address(street, town, state, zip),
contact(phone, fax, email), comments (comments).

It was done this way because it is strictly a learning exercise.  I had
never created a DB with multiple tables, so I wanted to be able to contruct
one using foreign keys, and be able to insert and retrieve from it.

But the experiment continues.  For whatever reason, scripts to query a DB
that I have used for years are not working.  I am thinking it has something
to do with that I switched engines to innodb.

So the lesson continues.

Gary


Gary:

One of the concepts in OOP is identifying an object in terms of it's 
attributes and functions. The concept of defining tables is very 
similar.


If you want to learn about foreign keys, then think of them as things 
that are foreign and not things that are similar.


For example, a user has name, address, height, weight, color, 
language, etc. Those things can be listed in a single table.


A item that can be purchased, like a chair has a title, description, 
weight, color, cost and such. Those things can also be listed in a 
single table.


If a person buys a chair and the seller wants to create a record of 
the purchase, then all the seller needs to do is to record the 
buyer's and the chair's attributes. Now, the seller can either write 
down all the attributes for each buyer/chair sale OR reference them 
using foreign keys.


User Table
id = 123
name = tedd
address = whatever

Item Table
id = 456
name = chair
color = whatever

Sales Table
item sold = 456
buyer = 123

Done!

Get the idea?

Cheers,

tedd


--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

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



Re: [PHP] Solution

2010-04-13 Thread Gary
Karl

Thanks for the reply, I copied your code and it did not work, tried a few 
variations and same result.

Gary
Karl DeSaulniers k...@designdrumm.com wrote in message 
news:e56be001-63f6-4df1-8c72-ad468c23e...@designdrumm.com...
 Hey Gary, instead try something like this maybe?


 $dbc=mysqli_connect('localhost','root','','test') or die('Error 
 connecting to MySQL server');

 $query_name=INSERT INTO name(fname='$fname', lname='$lname');
 $query_address=INSERT INTO address (street='$street', town='$town', 
 state='$state', zip='$zip');

 $result1=mysqli_query($dbc, $query_name) or die('Error querying  database 
 for name.');

 $result2=mysqli_query($dbc, $query_address) or die('Error querying 
 database for address.');

 echo Success!br /;

 ?

 HTH,

 Karl


 On Apr 12, 2010, at 5:16 PM, Peter Lind wrote:

 $dbc=mysqli_connect('localhost','root','','test')or die('Error 
 connecting to
 MySQL server');

 $query=INSERT INTO name(fname, lname).VALUES('$fname','$lname');

 $result=mysqli_query($dbc, $query)
 or die('Error querying database.');

 mysqli_close($dbc);
 ?

 ?php

 $dbc=mysqli_connect('localhost','root','','test')or die('Error 
 connecting to
 MySQL server');
 $query=INSERT INTO address (street, town, state,
 zip).VALUES('$street','$town','$state','$zip');

 $result=mysqli_query($dbc, $query)
 or die('Error querying database.');

 mysqli_close($dbc);

 ?

 Karl DeSaulniers
 Design Drumm
 http://designdrumm.com


 __ Information from ESET Smart Security, version of virus 
 signature database 5023 (20100412) __

 The message was checked by ESET Smart Security.

 http://www.eset.com


 



__ Information from ESET Smart Security, version of virus signature 
database 5026 (20100413) __

The message was checked by ESET Smart Security.

http://www.eset.com





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



Re: [PHP] Solution

2010-04-13 Thread Andrew Ballard
On Tue, Apr 13, 2010 at 2:50 PM, tedd tedd.sperl...@gmail.com wrote:
 For example, a user has name, address, height, weight, color, language, etc.
 Those things can be listed in a single table.

And now for the universal DBA answer - it depends. There are cases
where that information needs to be normalized to another table. A
person could have a billing address, a shipping address, a vacation
address, etc. Or the application may need to store multiple addresses
over time. The same person could have a home phone, office phone, fax,
mobile phone, pager, etc.

Andrew

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



Re: [PHP] Solution

2010-04-13 Thread Jim Lucas
Karl DeSaulniers wrote:
 Hey Gary, instead try something like this maybe?
 
 
 $dbc=mysqli_connect('localhost','root','','test') or die('Error
 connecting to MySQL server');
 
 $query_name=INSERT INTO name(fname='$fname', lname='$lname');
 $query_address=INSERT INTO address (street='$street', town='$town',
 state='$state', zip='$zip');

Their are a few syntax variations available, but the one that they used is not a
valid format.  The following are the insert statements written in a valid 
format.

$query_name = INSERT INTO name (
 fname,lname
   ) VALUES (
   '$fname', '$lname'
   );

$query_address = INSERT INTO address (
 street,town,state,zip
   ) VALUES {
   '$street', '$town', '$state', '$zip'
   );

Try this, it should work.

 
 $result1=mysqli_query($dbc, $query_name) or die('Error querying database
 for name.');
 
 $result2=mysqli_query($dbc, $query_address) or die('Error querying
 database for address.');
 
 echo Success!br /;
 
 ?
 
 HTH,
 
 Karl
 
 
 On Apr 12, 2010, at 5:16 PM, Peter Lind wrote:
 
 $dbc=mysqli_connect('localhost','root','','test')or die('Error
 connecting to
 MySQL server');

 $query=INSERT INTO name(fname, lname).VALUES('$fname','$lname');

 $result=mysqli_query($dbc, $query)
 or die('Error querying database.');

 mysqli_close($dbc);
 ?

 ?php

 $dbc=mysqli_connect('localhost','root','','test')or die('Error
 connecting to
 MySQL server');
 $query=INSERT INTO address (street, town, state,
 zip).VALUES('$street','$town','$state','$zip');

 $result=mysqli_query($dbc, $query)
 or die('Error querying database.');

 mysqli_close($dbc);

 ?
 
 Karl DeSaulniers
 Design Drumm
 http://designdrumm.com
 
 


-- 
Jim Lucas

   Some men are born to greatness, some achieve greatness,
   and some have greatness thrust upon them.

Twelfth Night, Act II, Scene V
by William Shakespeare

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



Re: [PHP] Solution

2010-04-13 Thread Jim Lucas
Andrew Ballard wrote:
 On Tue, Apr 13, 2010 at 2:50 PM, tedd tedd.sperl...@gmail.com wrote:
 For example, a user has name, address, height, weight, color, language, etc.
 Those things can be listed in a single table.
 
 And now for the universal DBA answer - it depends. There are cases
 where that information needs to be normalized to another table. A
 person could have a billing address, a shipping address, a vacation
 address, etc. Or the application may need to store multiple addresses
 over time. The same person could have a home phone, office phone, fax,
 mobile phone, pager, etc.
 
 Andrew
 

My business related example is our billing system in my office.

For each customer account we have a single Billing address but allow multiple
service, technical, administrative, etc... contact entries.  We must keep past
entries for historical purposes too.  This is achieved by having two separate
tables to hold the data.  It is a 1 to nth relationship.

PS: Gary, fix your mail server.  It is telling me that you don't exist.

-- 
Jim Lucas

   Some men are born to greatness, some achieve greatness,
   and some have greatness thrust upon them.

Twelfth Night, Act II, Scene V
by William Shakespeare

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



Re: [PHP] Solution

2010-04-13 Thread tedd

At 3:09 PM -0400 4/13/10, Andrew Ballard wrote:

On Tue, Apr 13, 2010 at 2:50 PM, tedd tedd.sperl...@gmail.com wrote:

 For example, a user has name, address, height, weight, color, language, etc.
 Those things can be listed in a single table.


And now for the universal DBA answer - it depends. There are cases
where that information needs to be normalized to another table. A
person could have a billing address, a shipping address, a vacation
address, etc. Or the application may need to store multiple addresses
over time. The same person could have a home phone, office phone, fax,
mobile phone, pager, etc.

Andrew



Andrew:

Of course.

Cheers.

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

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



Re: [PHP] Solution

2010-04-13 Thread Karl DeSaulniers

My mistake. You are correct.

Karl


On Apr 13, 2010, at 2:16 PM, Jim Lucas wrote:

Karl DeSaulniers wrote:

Hey Gary, instead try something like this maybe?


$dbc=mysqli_connect('localhost','root','','test') or die('Error
connecting to MySQL server');

$query_name=INSERT INTO name(fname='$fname', lname='$lname');
$query_address=INSERT INTO address (street='$street', town='$town',
state='$state', zip='$zip');


Their are a few syntax variations available, but the one that they  
used is not a
valid format.  The following are the insert statements written in a  
valid format.


$query_name = INSERT INTO name (
 fname,lname
   ) VALUES (
   '$fname', '$lname'
   );

$query_address = INSERT INTO address (
 street,town,state,zip
   ) VALUES {
   '$street', '$town', '$state', '$zip'
   );

Try this, it should work.



$result1=mysqli_query($dbc, $query_name) or die('Error querying  
database

for name.');

$result2=mysqli_query($dbc, $query_address) or die('Error querying
database for address.');

echo Success!br /;

?

HTH,

Karl


On Apr 12, 2010, at 5:16 PM, Peter Lind wrote:


$dbc=mysqli_connect('localhost','root','','test')or die('Error
connecting to
MySQL server');

$query=INSERT INTO name(fname, lname).VALUES('$fname','$lname');

$result=mysqli_query($dbc, $query)
or die('Error querying database.');

mysqli_close($dbc);
?

?php

$dbc=mysqli_connect('localhost','root','','test')or die('Error
connecting to
MySQL server');
$query=INSERT INTO address (street, town, state,
zip).VALUES('$street','$town','$state','$zip');

$result=mysqli_query($dbc, $query)
or die('Error querying database.');

mysqli_close($dbc);

?


Karl DeSaulniers
Design Drumm
http://designdrumm.com





--
Jim Lucas

   Some men are born to greatness, some achieve greatness,
   and some have greatness thrust upon them.

Twelfth Night, Act II, Scene V
by William Shakespeare

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


Karl DeSaulniers
Design Drumm
http://designdrumm.com


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



Re: [PHP] Solution

2010-04-12 Thread Peter Lind
On 13 April 2010 00:04, Gary gwp...@ptd.net wrote:
 For those that were looking to see a solution, this is what I have come up
 with.  It was pointed out on another board (MySQL) that inserting multiple
 in one script is probably prohibited because of security reasons.

 What I did was open the connection, insert into the table, close the
 connection, close the php script, then start over again.  This is the code:

 $dbc=mysqli_connect('localhost','root','','test')or die('Error connecting to
 MySQL server');

 $query=INSERT INTO name(fname, lname).VALUES('$fname','$lname');

 $result=mysqli_query($dbc, $query)
 or die('Error querying database.');

 mysqli_close($dbc);
 ?

 ?php

 $dbc=mysqli_connect('localhost','root','','test')or die('Error connecting to
 MySQL server');
 $query=INSERT INTO address (street, town, state,
 zip).VALUES('$street','$town','$state','$zip');

 $result=mysqli_query($dbc, $query)
 or die('Error querying database.');

 mysqli_close($dbc);

 ?

 It seems a little redundant for PHP, however it seems to work.

 Thank you to everyone that responded.  If by the way someone sees an issue
 with this solution, I would love to read it.

Off the top of my head: just reuse the connection. There's no need to
close it, then reopen it. The only security problem you're facing is
that you cannot send multiple queries in *the same string*[1]. So send
the queries one by one, but in the same script, using the same
connection.

1. The reason this is a security concern is that otherwise, should
someone manage to inject sql into your query, they could drop in a
semi-colon and then start a new query. By not allowing this, a lot of
bad injections are by default ruled out.

-- 
hype
WWW: http://plphp.dk / http://plind.dk
LinkedIn: http://www.linkedin.com/in/plind
Flickr: http://www.flickr.com/photos/fake51
BeWelcome: Fake51
Couchsurfing: Fake51
/hype

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



Re: [PHP] Solution

2010-04-12 Thread Karl DeSaulniers

Hey Gary, instead try something like this maybe?


$dbc=mysqli_connect('localhost','root','','test') or die('Error  
connecting to MySQL server');


$query_name=INSERT INTO name(fname='$fname', lname='$lname');
$query_address=INSERT INTO address (street='$street', town='$town',  
state='$state', zip='$zip');


$result1=mysqli_query($dbc, $query_name) or die('Error querying  
database for name.');


$result2=mysqli_query($dbc, $query_address) or die('Error querying  
database for address.');


echo Success!br /;

?

HTH,

Karl


On Apr 12, 2010, at 5:16 PM, Peter Lind wrote:

$dbc=mysqli_connect('localhost','root','','test')or die('Error  
connecting to

MySQL server');

$query=INSERT INTO name(fname, lname).VALUES('$fname','$lname');

$result=mysqli_query($dbc, $query)
or die('Error querying database.');

mysqli_close($dbc);
?

?php

$dbc=mysqli_connect('localhost','root','','test')or die('Error  
connecting to

MySQL server');
$query=INSERT INTO address (street, town, state,
zip).VALUES('$street','$town','$state','$zip');

$result=mysqli_query($dbc, $query)
or die('Error querying database.');

mysqli_close($dbc);

?


Karl DeSaulniers
Design Drumm
http://designdrumm.com


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



Re: [PHP] Solution for writing a function layer between pecl-memcache and PHP

2007-07-27 Thread Nathan Nobbe
judging by the method invocation you have shown

site::memcache($pointername, $dataset);

that indicates site is a class and memecahce is a method defined in site,
which is being invoked statically in this case.
and in the definition of memecache you showed, the definition does not have
the static keyword, therefore you
should not be invoking it from a static context.
from the documentation on the static keyword
Calling non-static methods statically generates an E_STRICT level warning.

its not a solution to your problem but it is a point on proper style.

-nathan

On 7/27/07, Sascha Braun - CEO @ Braun Networks [EMAIL PROTECTED]
wrote:

 Hi dear Sancar,

 you seem really the best man in place as what I see in the mailing
 list :)) Thats really lovely I would like to say.

 Now lets come to the solution I need:

 public function memcache($pointer, $data=, $compress=, $timeout=0)
 // store or load data from the memcache
 {
 if (MEMCACHE_SUPPORT == 'true') {
 $memcached_port = $_SESSION['memcache_port'];
 if (empty($memcached_port)) { $memcached_port = '9'; }
 $memcache = memcache_connect('localhost', $memcached_port);
 if ($memcache) {
 $memcache_pointer = PROJECT.$pointer;
 $cache = $memcache - get($memcache_pointer);
 if (!$cache) {
 $memcache-set($memcache_pointer,$data);
 $cache = $memcache - get($memcache_pointer);
 }
 return $cache;
 }
 }
 }

 This is the Funktion I use to load and write data to the memcache
 a write or restore looks like this here site::memcache('pointer',$data);

 This is working in many cases pretty fine.

 Now I have a codepart, where the 'pointer' is getting created dynamical-
 ly. Which means I do fx. a $content_id.'_'.$translation instead of wri-
 ting a simple 'pointer' as first parameter to the above function.

 When I now call my XML Parser, to store data in memcache, and try to
 recall, the data short after, it says:

 File not found: This file somewhere in the suburbs.

 But when I try to output the XML Object before the data is written to
 the cache, everything goes terribly fine.

 Now I figured out, that when I use static naming for the memcache data
 pointer 'pointer' everything goes fine.

 When I use the memcache directly, which means, I call the
 $memcache-set() and $memcache-get() function from where I store data
 everything goes fine again, even with dynamically created, variables.

 But as soon as I use my function layer, call a to
 site::memcache($pointername,$dataset); only  returnes bullshit.

 Mh, this makes me a little bit sad.

 Maybe somebody or even you, can help me :))

 Best Regards, and a baba Respect from Germany, Dear Sancar!

 Sascha

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




Re: [PHP] Solution for writing a function layer between pecl-memcache and PHP

2007-07-27 Thread Sascha Braun - CEO @ Braun Networks
Thank you very much Nathan.

You mean I should change the the method from public to static?
Is that right? I hope I was getting you right.

I now juggled around abit with the code, and as it happens most
of the time, in case I invoke the XML object, that the file
given was not read right.

When i invoke the object, just outside of the site::memcache()
function like

$xml_data = new xml_mm('/path/to/xml_file/xml_file.xml');

and put a 

echo pre;
print_r($xml_data);
echo /pre;

inbetween the output is correct.

But when I do a

site::memcache($memcache_pointer, $xml_data);
or a
$file_path = '/path/to/xml_file/xml_file.xml';
site::memcache($memcache_pointer, new xml_mm($file_path));

and do a

$xml_data = site::memcache($memcache_pointer);

The output is, file_not_found: /path/to/xml_file/xml_file.xml

Thats the main problem.

Am Freitag, den 27.07.2007, 14:38 -0400 schrieb Nathan Nobbe:
 judging by the method invocation you have shown
 
 site::memcache($pointername, $dataset);
 
 that indicates site is a class and memecahce is a method defined in site,
 which is being invoked statically in this case.
 and in the definition of memecache you showed, the definition does not have
 the static keyword, therefore you
 should not be invoking it from a static context.
 from the documentation on the static keyword
 Calling non-static methods statically generates an E_STRICT level warning.
 
 its not a solution to your problem but it is a point on proper style.
 
 -nathan
 
 On 7/27/07, Sascha Braun - CEO @ Braun Networks [EMAIL PROTECTED]
 wrote:
 
  Hi dear Sancar,
 
  you seem really the best man in place as what I see in the mailing
  list :)) Thats really lovely I would like to say.
 
  Now lets come to the solution I need:
 
  public function memcache($pointer, $data=, $compress=, $timeout=0)
  // store or load data from the memcache
  {
  if (MEMCACHE_SUPPORT == 'true') {
  $memcached_port = $_SESSION['memcache_port'];
  if (empty($memcached_port)) { $memcached_port = '9'; }
  $memcache = memcache_connect('localhost', $memcached_port);
  if ($memcache) {
  $memcache_pointer = PROJECT.$pointer;
  $cache = $memcache - get($memcache_pointer);
  if (!$cache) {
  $memcache-set($memcache_pointer,$data);
  $cache = $memcache - get($memcache_pointer);
  }
  return $cache;
  }
  }
  }
 
  This is the Funktion I use to load and write data to the memcache
  a write or restore looks like this here site::memcache('pointer',$data);
 
  This is working in many cases pretty fine.
 
  Now I have a codepart, where the 'pointer' is getting created dynamical-
  ly. Which means I do fx. a $content_id.'_'.$translation instead of wri-
  ting a simple 'pointer' as first parameter to the above function.
 
  When I now call my XML Parser, to store data in memcache, and try to
  recall, the data short after, it says:
 
  File not found: This file somewhere in the suburbs.
 
  But when I try to output the XML Object before the data is written to
  the cache, everything goes terribly fine.
 
  Now I figured out, that when I use static naming for the memcache data
  pointer 'pointer' everything goes fine.
 
  When I use the memcache directly, which means, I call the
  $memcache-set() and $memcache-get() function from where I store data
  everything goes fine again, even with dynamically created, variables.
 
  But as soon as I use my function layer, call a to
  site::memcache($pointername,$dataset); only  returnes bullshit.
 
  Mh, this makes me a little bit sad.
 
  Maybe somebody or even you, can help me :))
 
  Best Regards, and a baba Respect from Germany, Dear Sancar!
 
  Sascha
 
  --
  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] Solution for writing a function layer between pecl-memcache and PHP

2007-07-27 Thread Nathan Nobbe
ppp and static / non-static are unrelated topics.
the former is regarding access control or visibility into the members
(variables or methods) of a class.
the latter is regarding whether a member can be called from the context of
an instance or not.  essentially
static means to associate a function w/ a class.  this function need not use
the instance data in order to
complete its objective.  it is important to note that means static
methods cannot
have access to instance
data; ie a static method cannot use the $this keyword.  there are
staticvariables as well and they behave
in a similar manner.
for ppp the documentation on php.net should be sufficient.  regarding the
caching concept, what you would
cache is the values of instance variables in the object instances.  so the
number of lines in the file doesnt matter
much, because if you were to split the large class into several smaller
classes and use a caching approach you
would essentially be caching the same thing with the 2 implementations.  the
purpose of breaking down the classes
into a small number of lines is so that they are easy to maintain.  a design
principle is to separate the responsibilities
of each class so that they typically have only 1 responsibility.

-nathan

On 7/27/07, Sascha Braun - CEO @ Braun Networks [EMAIL PROTECTED]
wrote:

 I checked out the book from mister rethans and mister gutmans
 and mister bakken, mh, its seems easier to simply say how the
 book is named :))

 To check out, what exactly it means, to create static and public
 and so on methods. Yeah, I can easely call them static, as you
 prefered.

 But now there came up a new question in me.

 Is there a perforamce issue about using public privat static and
 so on methods. Will my application even start to run faster?

 And another question I would like to ask is, that one of my classes
 as prescribed is allready 400 KB in size, does it slow down the sys-
 tem more to load that class, into memcached, or additionally
 eaccelerator than splitting the class in a hole bunch of smaller
 classes, which are getting loaded, as needed too.

 Thanks you!

 Am Freitag, den 27.07.2007, 14:38 -0400 schrieb Nathan Nobbe:
  judging by the method invocation you have shown
 
  site::memcache($pointername, $dataset);
 
  that indicates site is a class and memecahce is a method defined in
 site,
  which is being invoked statically in this case.
  and in the definition of memecache you showed, the definition does not
 have
  the static keyword, therefore you
  should not be invoking it from a static context.
  from the documentation on the static keyword
  Calling non-static methods statically generates an E_STRICT level
 warning.
 
  its not a solution to your problem but it is a point on proper style.
 
  -nathan
 
  On 7/27/07, Sascha Braun - CEO @ Braun Networks 
 [EMAIL PROTECTED]
  wrote:
  
   Hi dear Sancar,
  
   you seem really the best man in place as what I see in the mailing
   list :)) Thats really lovely I would like to say.
  
   Now lets come to the solution I need:
  
   public function memcache($pointer, $data=, $compress=,
 $timeout=0)
   // store or load data from the memcache
   {
   if (MEMCACHE_SUPPORT == 'true') {
   $memcached_port = $_SESSION['memcache_port'];
   if (empty($memcached_port)) { $memcached_port = '9'; }
   $memcache = memcache_connect('localhost', $memcached_port);
   if ($memcache) {
   $memcache_pointer = PROJECT.$pointer;
   $cache = $memcache - get($memcache_pointer);
   if (!$cache) {
   $memcache-set($memcache_pointer,$data);
   $cache = $memcache - get($memcache_pointer);
   }
   return $cache;
   }
   }
   }
  
   This is the Funktion I use to load and write data to the memcache
   a write or restore looks like this here
 site::memcache('pointer',$data);
  
   This is working in many cases pretty fine.
  
   Now I have a codepart, where the 'pointer' is getting created
 dynamical-
   ly. Which means I do fx. a $content_id.'_'.$translation instead of
 wri-
   ting a simple 'pointer' as first parameter to the above function.
  
   When I now call my XML Parser, to store data in memcache, and try to
   recall, the data short after, it says:
  
   File not found: This file somewhere in the suburbs.
  
   But when I try to output the XML Object before the data is written to
   the cache, everything goes terribly fine.
  
   Now I figured out, that when I use static naming for the memcache data
   pointer 'pointer' everything goes fine.
  
   When I use the memcache directly, which means, I call the
   $memcache-set() and $memcache-get() function from where I store data
   everything goes fine again, even with dynamically created, variables.
  
   But as soon as I use my function layer, call a to
   site::memcache($pointername,$dataset); only  returnes bullshit.
  
   Mh, this makes me a little bit sad.
  
   Maybe somebody or even you, can help me :))
  
   Best Regards, and a baba Respect from Germany, Dear Sancar!
  
   Sascha
  
   --
   

Re: [PHP] Solution for writing a function layer between pecl-memcache and PHP

2007-07-27 Thread Sascha Braun - CEO @ Braun Networks
I checked out the book from mister rethans and mister gutmans
and mister bakken, mh, its seems easier to simply say how the
book is named :))

To check out, what exactly it means, to create static and public
and so on methods. Yeah, I can easely call them static, as you
prefered.

But now there came up a new question in me.

Is there a perforamce issue about using public privat static and
so on methods. Will my application even start to run faster?

And another question I would like to ask is, that one of my classes
as prescribed is allready 400 KB in size, does it slow down the sys-
tem more to load that class, into memcached, or additionally
eaccelerator than splitting the class in a hole bunch of smaller
classes, which are getting loaded, as needed too.

Thanks you!

Am Freitag, den 27.07.2007, 14:38 -0400 schrieb Nathan Nobbe:
 judging by the method invocation you have shown
 
 site::memcache($pointername, $dataset);
 
 that indicates site is a class and memecahce is a method defined in site,
 which is being invoked statically in this case.
 and in the definition of memecache you showed, the definition does not have
 the static keyword, therefore you
 should not be invoking it from a static context.
 from the documentation on the static keyword
 Calling non-static methods statically generates an E_STRICT level warning.
 
 its not a solution to your problem but it is a point on proper style.
 
 -nathan
 
 On 7/27/07, Sascha Braun - CEO @ Braun Networks [EMAIL PROTECTED]
 wrote:
 
  Hi dear Sancar,
 
  you seem really the best man in place as what I see in the mailing
  list :)) Thats really lovely I would like to say.
 
  Now lets come to the solution I need:
 
  public function memcache($pointer, $data=, $compress=, $timeout=0)
  // store or load data from the memcache
  {
  if (MEMCACHE_SUPPORT == 'true') {
  $memcached_port = $_SESSION['memcache_port'];
  if (empty($memcached_port)) { $memcached_port = '9'; }
  $memcache = memcache_connect('localhost', $memcached_port);
  if ($memcache) {
  $memcache_pointer = PROJECT.$pointer;
  $cache = $memcache - get($memcache_pointer);
  if (!$cache) {
  $memcache-set($memcache_pointer,$data);
  $cache = $memcache - get($memcache_pointer);
  }
  return $cache;
  }
  }
  }
 
  This is the Funktion I use to load and write data to the memcache
  a write or restore looks like this here site::memcache('pointer',$data);
 
  This is working in many cases pretty fine.
 
  Now I have a codepart, where the 'pointer' is getting created dynamical-
  ly. Which means I do fx. a $content_id.'_'.$translation instead of wri-
  ting a simple 'pointer' as first parameter to the above function.
 
  When I now call my XML Parser, to store data in memcache, and try to
  recall, the data short after, it says:
 
  File not found: This file somewhere in the suburbs.
 
  But when I try to output the XML Object before the data is written to
  the cache, everything goes terribly fine.
 
  Now I figured out, that when I use static naming for the memcache data
  pointer 'pointer' everything goes fine.
 
  When I use the memcache directly, which means, I call the
  $memcache-set() and $memcache-get() function from where I store data
  everything goes fine again, even with dynamically created, variables.
 
  But as soon as I use my function layer, call a to
  site::memcache($pointername,$dataset); only  returnes bullshit.
 
  Mh, this makes me a little bit sad.
 
  Maybe somebody or even you, can help me :))
 
  Best Regards, and a baba Respect from Germany, Dear Sancar!
 
  Sascha
 
  --
  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] Solution: [PHP] OOP slow -- am I an idiot?

2006-10-16 Thread Roman Neuhauser
# [EMAIL PROTECTED] / 2006-10-15 13:59:39 -0700:
 As I cannot think of a class-based way to build my report, I think
 I'll use a customer class everywhere BUT in the report.  Inside the
 report I'll just use one SQL statement instead of dozens
 of instances and hundreds of queries.
 
 I'll make a note inside the class that this and that method is not the
 only place the data is accessed, to also check inside the report.
 
 Sometimes, you've just gotta compromise to get the job done.  Most of
 the time, OOP is a good idea, but in this instance I don't think it's
 the best choice.
 
You're suffering because you're putting code that belongs in
a separate layer (data source) in the domain logic layer.
Don't blame classes for shortcomings in your design.

http://www.martinfowler.com/articles/dblogic.html

-- 
How many Vietnam vets does it take to screw in a light bulb?
You don't know, man.  You don't KNOW.
Cause you weren't THERE. http://bash.org/?255991

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



[PHP] Re: PHP solution for virtual folder management

2006-10-09 Thread Colin Guthrie
Angelo Zanetti wrote:
 Hi all,
 
 WE are developing a system and now we have to create our own folder
 management system, it however wont be physical folders on the hard drive
 but more database entries and then the user will view the output as if
 they were directories.
 
 So Im looking for possibly and open source solution that can manage that
 information/folder hierarchy. The user will be able to add, edit and
 delete folders but most importantly move a folder with all its contents
 to an exisisting folder.  The moving folder part is not easy. the other
 functions like add, edit and delete and list sub folders is pretty easy
 with the parentID pointing to the parent directory.
 
 if anyone has any links, or any thing that might help it would be
 greatly appreciated.

Try looking on pear.php.net for the VFS framework.

I've used if to FTP storage but it supports DB and filesystem backends too.

Docs are pretty crap, but hey ho.

Col.

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



Re: [PHP] [SOLUTION] Re: [PHP] Convert an array in an object instance

2004-10-27 Thread Francisco M. Marzoa Alonso
Erm... I've seen there're some aspects to perform... it fails because
the name of the members is changed during conversion to the array. It 
puts the class name using '\0' (0 is a zero, not a caps 'o') character 
as separator before member name in private and an '*' in protected.

It's not an unaffordable issue, because you still can modify array 
values having this in account. For example, if you want to modify the 
$One private member in the array, you cannot do:

$Clone['One']=5;
you should do
$Clone[\0TestClass\0One]=5;
instead.
Anyway I think it should be easily fixed (when I've time to do it, now I 
must work in another thing :-| )

Francisco M. Marzoa Alonso wrote:
Ok, I've write a function that emulates the Perl's bless one. It works 
pretty well.

The idea comes to me when Rob suggest to parse the serialized data. I 
think this is better -or at least faster- than parsing all serialized 
data to modify object values: Just convert the object to an array, 
modify whatever values you want -no matter about member visibility-, 
and then convert the array again in an object.

Note that you should NEVER modify private and protected members 
outside its visibility environment... well, never UNLESS you're 
writting your own serialization routines indeed (that's exactly 
because I need to do it ;-) )

?
function bless ( $Instance, $Class ) {
   $serdata = serialize ( $Instance );
   /* For an array serialized data seems to meant:
array_tag:array_count:{array_elems}
   array_tag is always 'a'
   array_count is the number of elements in the array
   array_elems are the elemens in the array
 For an object seems to meant:
 
object_tag:object_class_name_len:object_class_name:object_count:{object_members} 

   object_tag is always 'O'
   object_class_name_len is the length in chars of 
object_class_name string
   object_class_name is a string with the name of the class
   object_count is the number of object members
   object_members is the object_members itself (exactly equal to 
array_elems)
   */

   list ($array_params, $array_elems) = explode ('{', $serdata, 2);
   list ($array_tag, $array_count) = explode (':', $array_params, 3 );
   $serdata = O:.strlen 
($Class).:\$Class\:$array_count:{.$array_elems;

   $Instance = unserialize ( $serdata );
   return $Instance;
}
class TestClass {
   private $One=1;
   protected $Two=2;
   public $Three=3;
   public function sum() {
   return $this-One+$this-Two+$this-Three;
   }
}
$Obj = new TestClass ();
$Clone = (array) $Obj;
echo As an array:br;
print_r ($Clone);
bless ( $Clone, TestClass );
echo brbrAfter blessing as a TestClass instance:br;
print_r ($Clone);
echo brbrCalling sum method: ;
echo $Clone-sum();
echo brThe array was blessed! miracle!!! ;-)br;
?
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP] Solution to display the results of an exec/system + rsh command

2004-03-18 Thread Frédéric Martin
Hi guys,

With the help of a guy, we found the solution. So for information, this is
what you have to do to succeed such kind of command.
You have to use the same username in your webserver as the name of the
account in the remote machine you're trying to access with rsh.
typically if you want to do this:

$res = exec(rsh x.x.x.x -l TOTO ping x.x.x.x);
echo pre $res /pre;

The webserver user should be TOTO (you can change it in your httpd.conf file
on Linux box)
hope it will help!

fred

-Message d'origine-
De : Chris W. Parker [mailto:[EMAIL PROTECTED]
Envoyé : jeudi, 18. mars 2004 17:59
À : [EMAIL PROTECTED]; [EMAIL PROTECTED]
Objet : RE: [PHP] Problem to display the results of an exec + rsh
command




Frédéric Martin mailto:[EMAIL PROTECTED]
on Thursday, March 18, 2004 7:31 AM said:

 $res = exec(rsh x.x.x.x -l username ping x.x.x.x);
 echo pre $res /pre;

 I cannot display the result of the ping made in the remote host.
 any idea to fix that?
 thank you in advance for your tips ...

i don't have any idea why it's not working and i've never used exec(), but
maybe you'd have better luck with the back tick operator (at least i think
it's an operator)?

$res = `rsh x.x.x.x -l username ping x.x.x.x`;


chris.

--
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] Solution to register_globals=off existing code???

2002-07-03 Thread Kevin Stone

Or just use extract($HTTP_POST_VARS);  Same thing.  :)
-Kevin

- Original Message - 
From: PHPCoder [EMAIL PROTECTED]
To: php-general [EMAIL PROTECTED]
Sent: Wednesday, July 03, 2002 12:24 PM
Subject: [PHP] Solution to register_globals=off  existing code???


 Hi
 Already posted a question asking what to do with existing code that uses 
 register_globals=on and migrating to a new PHP with 
 register_globals=off; solution seemed to be have to re-code;
 I came up with this code, and am basically asking the more enlightened 
 if this might be a solution, ie, plug this code in at the top of all 
 form action pages written with the old style... It's crude, so be nice.
 
 
 if (isset($HTTP_POST_VARS)) {
 $type = $HTTP_POST_VARS;
 } elseif  (isset($HTTP_GET_VARS)) {
 $type = $HTTP_GET_VARS;
 }
 foreach ($type as $key = $val) {
 $string  = \$$key = \$val\;;
 eval($string);
  }
 
 
 If this will help, can it be written into a function? Is there a more 
 elegant way of doing the same?Will this actually work?
 
 Ta
 Petre
 
 
 
 
 
 -- 
 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] Solution to register_globals=off existing code???

2002-07-03 Thread PHPCoder

DOH!
Now you tell me!!! :-[
Hah, thanks man, should have known that there is always a simple 
solution in PHP, just need to know where to look for it...



Kevin Stone wrote:

Or just use extract($HTTP_POST_VARS);  Same thing.  :)
-Kevin

- Original Message - 
From: PHPCoder [EMAIL PROTECTED]
To: php-general [EMAIL PROTECTED]
Sent: Wednesday, July 03, 2002 12:24 PM
Subject: [PHP] Solution to register_globals=off  existing code???


Hi
Already posted a question asking what to do with existing code that uses 
register_globals=on and migrating to a new PHP with 
register_globals=off; solution seemed to be have to re-code;
I came up with this code, and am basically asking the more enlightened 
if this might be a solution, ie, plug this code in at the top of all 
form action pages written with the old style... It's crude, so be nice.


if (isset($HTTP_POST_VARS)) {
$type = $HTTP_POST_VARS;
} elseif  (isset($HTTP_GET_VARS)) {
$type = $HTTP_GET_VARS;
}
foreach ($type as $key = $val) {
$string  = \$$key = \$val\;;
eval($string);
 }


If this will help, can it be written into a function? Is there a more 
elegant way of doing the same?Will this actually work?

Ta
Petre





-- 
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] Solution to register_globals=off existing code???

2002-07-03 Thread 1LT John W. Holmes

Or just use import_request_variables(). You can do all of them at once. It's
only in PHP  4.1.0, though.

www.php.net/import_request_variables

---John Holmes...

- Original Message -
From: Kevin Stone [EMAIL PROTECTED]
To: php-general [EMAIL PROTECTED]
Sent: Wednesday, July 03, 2002 2:33 PM
Subject: Re: [PHP] Solution to register_globals=off  existing code???


 Or just use extract($HTTP_POST_VARS);  Same thing.  :)
 -Kevin

 - Original Message -
 From: PHPCoder [EMAIL PROTECTED]
 To: php-general [EMAIL PROTECTED]
 Sent: Wednesday, July 03, 2002 12:24 PM
 Subject: [PHP] Solution to register_globals=off  existing code???


  Hi
  Already posted a question asking what to do with existing code that uses
  register_globals=on and migrating to a new PHP with
  register_globals=off; solution seemed to be have to re-code;
  I came up with this code, and am basically asking the more enlightened
  if this might be a solution, ie, plug this code in at the top of all
  form action pages written with the old style... It's crude, so be
nice.
 
  
  if (isset($HTTP_POST_VARS)) {
  $type = $HTTP_POST_VARS;
  } elseif  (isset($HTTP_GET_VARS)) {
  $type = $HTTP_GET_VARS;
  }
  foreach ($type as $key = $val) {
  $string  = \$$key = \$val\;;
  eval($string);
   }
  
 
  If this will help, can it be written into a function? Is there a more
  elegant way of doing the same?Will this actually work?
 
  Ta
  Petre
 
 
 
 
 
  --
  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] Solution to headers already sent error.

2001-06-20 Thread Jens Nedal

Hy there 8)

This one is easy...
The thing  IS that when you use the header statement there is absolutly NO
OUTPUt like echo(); inside the PHP-brackets allowed AND NO OUTPUT allowed
outside the PHP-Brackets, before the first header statement appears!
Not even simple linebreaks or anything!

So watch out for any linebreaks or tabs or spaces outside the php-brackets
before the first header statment or any echo or print inside php-brackets
before the first header-statement.

regards, Jens

on 19.06.2001 0:28 Uhr, Merio, Quinn at [EMAIL PROTECTED] wrote:

 So, during the time the lists were down, i was banging my head over a
 seemingly impossible error message.
 
 This was the error message:
 
 Warning: Cannot send session cache limiter - headers already sent
 
 What?! I exlaimed.. the first line in my page registered the session
 variable i was using, so what was the deal.  I turned out to be one measly
 little space in front of my ?php tag.
 
 If you are registering a session variable, it seems you cant have ANY
 whitespace in the page before you register the session variable.
 
 Figured i would share that nugget, cus man did it ever drive me nuts, and i
 saw no reference to it at all in the manuals.
 
 Quinn Merio
 Vice President
 Vir2lAlliance Inc.
 www.vr2a.com
 




Re: [PHP] Solution to headers already sent error.

2001-06-19 Thread Ethan Schroeder

(PHP4) In your php.ini file: output_buffering = On
Now you can send header calls and session calls whenever you want.  Also,
take a look at: http://www.php.net/manual/en/ref.outcontrol.php

Ethan

- Original Message -
From: Alexander Wagner [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Monday, June 18, 2001 3:54 PM
Subject: Re: [PHP] Solution to headers already sent error.


 Hiho,

 Merio, Quinn wrote:
  So, during the time the lists were down, i was banging my head over a
  seemingly impossible error message.
 
  Warning: Cannot send session cache limiter - headers already sent
 
  What?! I exlaimed.. the first line in my page registered the session
  variable i was using, so what was the deal.  I turned out to be one
measly
  little space in front of my ?php tag.

 Well, reading the complete message should have helped, which goes like
this:

 Warning: Cannot add header information - headers already sent by (output
 started at /foo/foo.php3:2) in /foo/bar.php3 on line 399

 The message tells you in which file and on which line the output was
started.
 With PHP 4 it does, anyway.

  Figured i would share that nugget, cus man did it ever drive me nuts,
and i
  saw no reference to it at all in the manuals.

 Not in the session-section, no. But the description of the
header()-function
 (http://php.net/header) contains this paragraph:

 Remember that the header() function must be called before any actual
output
 is sent, either by normal HTML tags blank lines in a file, or from PHP. It
is
 a very common error to read code with include(), or require(), functions,
or
 another file access function, and have spaces or empty lines that will
output
 before header() is called. The same problem exists when using a single
 PHP/HTML file.

 Of course, this is hard to find when you're browsing through the
 session-functions. A link might be useful. Something like This function
 needs to send a HTTP-Header, so you ... as with the header()-function.

 regards
 Wagner

 --
 Isn't it strange? The same people who laugh at gypsy fortune tellers take
 economists seriously.
  - Cincinnati Enquirer





Re: [PHP] Solution to headers already sent error.

2001-06-18 Thread Alexander Wagner

Hiho,

Merio, Quinn wrote:
 So, during the time the lists were down, i was banging my head over a
 seemingly impossible error message.

 Warning: Cannot send session cache limiter - headers already sent

 What?! I exlaimed.. the first line in my page registered the session
 variable i was using, so what was the deal.  I turned out to be one measly
 little space in front of my ?php tag.

Well, reading the complete message should have helped, which goes like this:

Warning: Cannot add header information - headers already sent by (output 
started at /foo/foo.php3:2) in /foo/bar.php3 on line 399

The message tells you in which file and on which line the output was started. 
With PHP 4 it does, anyway.

 Figured i would share that nugget, cus man did it ever drive me nuts, and i
 saw no reference to it at all in the manuals.

Not in the session-section, no. But the description of the header()-function 
(http://php.net/header) contains this paragraph:

Remember that the header() function must be called before any actual output 
is sent, either by normal HTML tags blank lines in a file, or from PHP. It is 
a very common error to read code with include(), or require(), functions, or 
another file access function, and have spaces or empty lines that will output 
before header() is called. The same problem exists when using a single 
PHP/HTML file.

Of course, this is hard to find when you're browsing through the 
session-functions. A link might be useful. Something like This function 
needs to send a HTTP-Header, so you ... as with the header()-function.

regards
Wagner

-- 
Isn't it strange? The same people who laugh at gypsy fortune tellers take 
economists seriously.
 - Cincinnati Enquirer   



RE: [PHP] Solution for PHP - IMAP - WAP ?

2001-05-09 Thread Valter Santos

Hi Nikolajsu and PHPers!

I am now working in a complete solution for Web/WAP/PDA,
with content management + portal services (chat, forum, email, etc...)

But I think that you will have to wait until July 2001 for the
first public release.

The solution is a complete platform for deploy a Portal or Site in
all the available protocols but managed only by a powerfull backoffice
solution.

For now, it will support HTTP (Web/WAP), SMS, MMS, SMTP, IMAP, LDAP, and so
on...

For all of you that want to became beta testers please replay to me!

Best regards!



Valter Santos
WEB/WAP Consultant



 -Original Message-
 From: Nikolajus Krauklis [mailto:[EMAIL PROTECTED]]
 Sent: Tuesday, May 08, 2001 11:54 AM
 To: [EMAIL PROTECTED]
 Subject: [PHP] Solution for PHP - IMAP - WAP ?


 Hi,

 Maybe somebody knows solution for PHP IMAP and WAP?

 How hard will be complete this products?




 -
 Nikolajus Krauklis :: [metasite]
 E-mail: [EMAIL PROTECTED]



 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] solution

2001-02-06 Thread Nick Talbott

We have implemented this using AliasMatch directives in the Apache
configuration file.

Here is our recipe:

AliasMatch ^/.+/(.+)\.php /website/$1.php
AliasMatch ^/(.+)\.php /website/$1.php
AliasMatch ^/.* /website/start.php

What this achieves is that any specific reference to a PHP script (even if
apparently buried down in a subdirectory) is actually served by a PHP script
in the document root of the site.  Any reference that is not explicitly to a
PHP script is served by the start.php script.

The start.php script looks at the actual URL asked for (using the
$REQUEST_URI variable) and does some database lookups to generate the pages.
So the request for a "page" such as
http://www.pco.powys.org.uk/cap/page2.html is translated by the PHP scripts
to a database lookup for page 2 for user "cap"

You can see this in operation at http://www.pco.powys.org.uk/

If you want any more information, please contact me off the list.

Kind regards

Nick Talbott
IT Policy and Strategy Manager, Powys County Council, UK

email [EMAIL PROTECTED]
FAX +44 (0) 1597 824781
web http://www.powys.gov.uk and http://www.powysweb.co.uk

-Original Message-
From: andreas (@work) [EMAIL PROTECTED]
To: [EMAIL PROTECTED] [EMAIL PROTECTED]
Date: 06 February 2001 07:23
Subject: [PHP] solution


hi all,

we need to have a solution for the following stuff:

each member of the community should get his own page

something like

www.domain.com/tacco
www.domain.com/micco
www.domain.com/sicco


.


and we dont liek to build this structure as webfolders


so what we are thinking of is:

a 404 php-file which extracts the path  and generates a page for that out
of
mysql


so, if someone likes to access

www.domain.com/tacco

theres no file but our 404php document will extract

tacco

and generate the page tacco from the database


===

possible ?

or is there a better solution out there ?


greetings

andreas


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]





-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] solution

2001-02-05 Thread Chris Adams

On 5 Feb 2001 23:31:17 -0800, andreas \(@work\) [EMAIL PROTECTED] wrote:
a 404 php-file which extracts the path  and generates a page for that out of
mysql

or is there a better solution out there ?

This approach can work and, properly done, work fairly well. However, a more
elegant approach might be using mod_rewrite on Apache. You could write a regex
that would convert addresses of the form /~username into
/users/homepage.php?User=username internally. This would also have the
advantage of leaving your existing 404 handling unchanged.

Chris

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]