Re: [PHP] [NOT FIXED] Re: [PHP] strip out wierd characters in a string

2004-10-19 Thread Curt Zirzow
* Thus wrote Brent Clements:
 Ok, I still have the problem.
 
 If I echo the string to a webpage, it still contains the ?
 
 So I viewed the source in a notepad, and the thing that shows up next to
 string is a TM.
 
 I tried using htmlentities on the string that I'm echoing but the question
 mark/tm is still there.
 
 Anybody know how to fix this?

The ? you are seeing is because the charset doesn't know what to do
with the ascii value that is contained there.

You have a couple of options to let the browser know exactly what
you mean by that character:

If before any output you specify:

  header('Content-Type: text/html; charset=iso-8859-1');

will let the browser know you want a charset that defines
what that ascii value means

Or

Because there is no entity defined the htmlentities() for 'tm' you
have to convert it yourself using the numeric entity for it:

echo str_replace(\x99, #153;, $a);


Then, your 'tm' will get displayed insted of '?'.


Curt
-- 
Quoth the Raven, Nevermore.

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



Re: [PHP] Apache segmentation faults

2004-10-19 Thread Curt Zirzow
* Thus wrote Bostjan Skufca @ domenca.com:
 Is there any special apache/php compile option needed to generate core files 
 on linux? 

No, its really up to the OS to figure out what to do whan a
segfault happens.

 
 I have seen few segfaults and i have set CoreDumpDirectory to /tmp/httpd.core 
 which has correct permissions but no core file gets generated. Are core files 
 generated only when apache parent process segfaults?

You can try finding it by issuing:

$ locate httpd.conf

or if that doesnt result with anything:

$ find / -name httpd.conf


If no results are found in either one of those, I would suspect
your system isn't generating .core files.

Curt
-- 
Quoth the Raven, Nevermore.

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



[PHP] Oracle Connection

2004-10-19 Thread Syed
Hi All,
(B
(Bwill anybody tell me how to connect oracle database using php script.
(B
(BThanx
(B
(BSyed

Re: [PHP] Fwd:

2004-10-19 Thread Robin Vickery
 Original-Recipient: rfc822;[EMAIL PROTECTED]

It's whoever's subscribed under the address [EMAIL PROTECTED] - I
tried complaining to them a couple of weeks ago but got no response.

One of the few times I *haven't* got a response from them in fact.

  -robin

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



[PHP] Optimized GIF animations created on the fly (patch included)

2004-10-19 Thread Jaakko Hyvätti

  Hi all,

  Now as gif support is again in, I revised my patches for GIF creation
for gd-2.0.28 and PHP.  My patches may make it into gd-2.0.29, possibly
modified, so the interface may still change if Thomas Boutell has better
ideas for it.  But anyway, here are patches for gd-2.0.28, php-5.0.2 and
perl module GD-2.16 for optimized gif animation functions:

http://www.iki.fi/hyvatti/sw/

  Using the functions is not easy, as you need to take into account a lot
of things when preparing the images and parameters for the functions.
Still, the functions make it possible to generate pretty well optimized
images without calling external programs and without using too much
resources.

  I hope people can test this patch and suggest improvements, and that
eventually the patch makes it into php-4 and php-5.  I'll try to include
examples and updated manual patches for the new functions on that page
later.  Please do not hesitate to contact me for any questions or
suggestions!

Jaakko

-- 
Foreca Ltd   [EMAIL PROTECTED]
Pursimiehenkatu 29-31 B, FIN-00150 Helsinki, Finland http://www.foreca.com

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



[PHP] Help: Suggestions for multi page form validation

2004-10-19 Thread Stuart Felenstein
I have a multi-page form that ends in the last page as
a transaction to mysql.  In the transaction there are
a number of steps, i.e.

query1 = Insert into ..
run query1
query2 = Insert into .
run query 2
query3 = Insert into ..
run query 3

Then an if / else statement that checks if all queries
were sucessful (commit) or else (rollback)

I need to add server side validation 
So my thoughts are :

1- Do it on a page by page (form by form) basis,
meaning user can't go past page1 if there are form
error.  I'm just not sure in this case where the
validation would go.  Since 1st page is set on submit
to go to 2nd page. Would I put the validations on
page/form2 and then it would print out errors
directing back to form1 ?

2- Last page validation - waiting till the transaction
page to do validation. Should I set this up as one
block on top that checks all the submitted form
values, or pepper throughout all the transactions ?  

Hope my question is clear and am open to  any
suggestions or ideas.

Thank you ,
Stuart

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



Re: [PHP] 'Intelligently' truncate string?

2004-10-19 Thread Chris Dowell
You could also try a combination of html_entity_decode to change all 
entities back, then truncate it, then use html_entities to get back to 
the encoded string.

Hope this helps
Cherrs
Chris
Robert Cummings wrote:
On Mon, 2004-10-18 at 14:35, Murray @ PlanetThoughtful wrote:
Hi All,
I'm working on a page where I'm attempting to display article titles in a
relatively narrow area. To save from ugly wrap-arounds in the links, I've
decided to truncate the article title string at 20 chars. This works well
except where the truncate occasionally falls in the middle of a HTML entity
reference (eg nbsp; or copy; etc).

after you do your usual truncation just add the following:
$truncated = ereg_replace( '[[:alpha:]]*$', '', $truncated );
You may need to replace alpha with alnum since I can't remember if there
are any entities with digits :)
Cheers,
Rob.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP] Help: Suggestions for multi page form validation

2004-10-19 Thread Stuart Felenstein
If it's okay I'll throw out two more questions then.

1-Probably a silly question, but is a faux pas if I
don't do client side [javascript] validations ? 

2a-  Textboxes - provided I'm not allowing special
characters (only alphanumeric) does this alone protect
me from things like sql injections ?

2b- Do selects (menus, dropdowns) need to be validated
for string content.  aka, can crafty hackers turn
these into a way to enter some funky data ?

Thank you ,
Stuart


--- Graham Cossey [EMAIL PROTECTED] wrote:

 Personally I would do as you suggest in 1. I would
 think your users would
 get rather annoyed if they had gone through several
 form pages to be told at
 the end of an error in form page1.
 
 So, page2 validates page1 etc. I would assume that
 page2 already does some
 processing of page1 anyway, as I believe you are
 adding the for.

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



RE: [PHP] Help: Suggestions for multi page form validation

2004-10-19 Thread Graham Cossey
I do not do any javascript validation, and try to avoid it if at all
possible as you cannot guarantee that the client has JavaScript enabled,
much like relying on cookies.

If you are concerned about 'crafty hackers' you'll probably need to check
every form element. You probably also want to check somehow that page2.php
is actually being called from page1.php and not by any other means.

Others on the list are much better equipped to deal with these matters than
I, as I don't currently lock down my application to this degree.

If you have not already, get along to Chris Shiflett's site, it's got some
great info.

http://shiflett.org especially: http://shiflett.org/articles

HTH
Graham

 -Original Message-
 From: Stuart Felenstein [mailto:[EMAIL PROTECTED]
 Sent: 19 October 2004 10:26
 To: Graham Cossey; [EMAIL PROTECTED]
 Subject: RE: [PHP] Help: Suggestions for multi page form validation


 If it's okay I'll throw out two more questions then.

 1-Probably a silly question, but is a faux pas if I
 don't do client side [javascript] validations ?

 2a-  Textboxes - provided I'm not allowing special
 characters (only alphanumeric) does this alone protect
 me from things like sql injections ?

 2b- Do selects (menus, dropdowns) need to be validated
 for string content.  aka, can crafty hackers turn
 these into a way to enter some funky data ?

 Thank you ,
 Stuart


 --- Graham Cossey [EMAIL PROTECTED] wrote:

  Personally I would do as you suggest in 1. I would
  think your users would
  get rather annoyed if they had gone through several
  form pages to be told at
  the end of an error in form page1.
 
  So, page2 validates page1 etc. I would assume that
  page2 already does some
  processing of page1 anyway, as I believe you are
  adding the for.


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



Re: [PHP] Mixing classes

2004-10-19 Thread Davy Obdam
Hi Tomi,
You could create an object of the Database class in your Auth class like 
this and then use your Datebase class with your Auth class:

?php
require_once(Database/Database.php);
class Auth
{
var $dbObject = ;
function Auth ()
{
   //Create an instance of you database class
   $this-dbObject = new Database($arg1, $arg2, $etc);
}
function doSomething()
{
   // Execute a query
   $this-dbObject-query($sql);
  
}

}
?
I hope this helps
Best regards,
Davy Obdam
Tomi Kaistila wrote:
Hey!
I've written several general classes, much as tools. One manages 
databases, one authenticates users, etc. I'm trying to bring all of 
these together into one sorta like a CMS, but the problem is that I 
can't find a way to have the different classes take advantage of each 
other; for example, a function in the auth class needs to contact the 
database, so it needs the query() function from the database class, 
but the objects are created on the index.php and as such are not in 
the scope of the functions in the classes.

Would anyone have any ideas or suggestions how to solve this issue? 
I've looked for a solution for some time now, to no result.

My PHP version is 4.3.8.
--
Davy Obdam
mailto:[EMAIL PROTECTED]
web: http://www.davyobdam.com
A conclusion is the place where you get tired of thinking. 
(Arthur Bloch)



smime.p7s
Description: S/MIME Cryptographic Signature


RE: [PHP] Help: Suggestions for multi page form validation

2004-10-19 Thread Stuart Felenstein
Yes, this is a great reminder, as I thought about it.

Man, can one form be so time consuming ? :)

Stuart
--- Graham Cossey [EMAIL PROTECTED] wrote:

 You probably also want to check
 somehow that page2.php
 is actually being called from page1.php and not by
 any other means.
 
 
 HTH
 Graham
 
  -Original Message-
  From: Stuart Felenstein
 [mailto:[EMAIL PROTECTED]
  Sent: 19 October 2004 10:26
  To: Graham Cossey; [EMAIL PROTECTED]
  Subject: RE: [PHP] Help: Suggestions for multi
 page form validation
 
 
  If it's okay I'll throw out two more questions
 then.
 
  1-Probably a silly question, but is a faux pas
 if I
  don't do client side [javascript] validations ?
 
  2a-  Textboxes - provided I'm not allowing special
  characters (only alphanumeric) does this alone
 protect
  me from things like sql injections ?
 
  2b- Do selects (menus, dropdowns) need to be
 validated
  for string content.  aka, can crafty hackers turn
  these into a way to enter some funky data ?
 
  Thank you ,
  Stuart

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



[PHP] PHP Configuration Error

2004-10-19 Thread Mulley, Nikhil
 
 
Hi All,
 
 
When I am compiling php4.3.8 with mysql,apxs and snmp  on a -Linux Build i386 GNU/Linux
 
I am getting this error  Can some body please help me
I have PHP already installed but I want to reconfigure it to work with snmp 
 
 
Here is the End of the configuration message

 
checking base type of last arg to accept... (cached) socklen_t
checking return type of qsort... (cached) void
configure: error: Cannot find MySQL header files under /usr/local/mysql/bin/
 
 
Nikhil


Re: [PHP] Mixing classes

2004-10-19 Thread Tomi Kaistila
Hi!
Thanks for the idea, hadn't actually thought of it that way. I had 
thought of passing objects (instance the db object to the auth object) 
by reference, but when thinking that while one class might only need the 
help of one other class, another class might need the help of four 
classes. Would make the constructor look a bit ugly.

The approuch you suggest is good, for most of the classes. For example, 
although I create an instance of the db class on the web site, it 
doesn't harm to create another inside the auth class. But there are some 
classes that are not suited to be created that way. For example, the 
Core class, which for one thing, reads the configuration file from the 
include path and sets a load of values which each class should then use. 
For example, the db class needs values such as the username, password, 
hostname, port, etc. It wouldn't be advisable read the configuration 
file more than once.

I'm not sure, but could an instance of a class be pass as reference with 
the Global keyword? Like so;

?php
class auth {
var $dbObject = ;
function auth () {
//Create an instance of you database class
global $dbobject;
$this-dbObject = $dbobject;
}
function doSomething() {
// Execute a query
$this-dbObject-query($sql);
}
}
?
Davy Obdam wrote:

Hi Tomi,
You could create an object of the Database class in your Auth class like 
this and then use your Datebase class with your Auth class:

?php
require_once(Database/Database.php);
class Auth
{
var $dbObject = ;
function Auth ()
{
   //Create an instance of you database class
   $this-dbObject = new Database($arg1, $arg2, $etc);
}
function doSomething()
{
   // Execute a query
   $this-dbObject-query($sql);
  }
}
?
I hope this helps
Best regards,
Davy Obdam
Tomi Kaistila wrote:
Hey!
I've written several general classes, much as tools. One manages 
databases, one authenticates users, etc. I'm trying to bring all of 
these together into one sorta like a CMS, but the problem is that I 
can't find a way to have the different classes take advantage of each 
other; for example, a function in the auth class needs to contact the 
database, so it needs the query() function from the database class, 
but the objects are created on the index.php and as such are not in 
the scope of the functions in the classes.

Would anyone have any ideas or suggestions how to solve this issue? 
I've looked for a solution for some time now, to no result.

My PHP version is 4.3.8.


--
developer  programmer
me tomi kaistila
home http://www.datamike.org
gnupg 0xFA63E4C7
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: Oracle Connection

2004-10-19 Thread David Robley
On Tue, 19 Oct 2004 16:20, Syed wrote:

 Hi All,
 
 will anybody tell me how to connect oracle database using php script.
 
 Thanx
 
 Syed

Start at http://php.net/oracle

-- 
David Robley

If winning isn't important then why keep score?

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



[PHP] Re: PHP Configuration Error

2004-10-19 Thread David Robley
On Tue, 19 Oct 2004 20:48, Nikhil Mulley wrote:

  
  
 Hi All,
  
  
 When I am compiling php4.3.8 with mysql,apxs and snmp  on a -Linux Build
 i386 GNU/Linux
  
 I am getting this error  Can some body please help me
 I have PHP already installed but I want to reconfigure it to work with
 snmp 
  
  
 Here is the End of the configuration message
 
  
 checking base type of last arg to accept... (cached) socklen_t
 checking return type of qsort... (cached) void
 configure: error: Cannot find MySQL header files under
 /usr/local/mysql/bin/

Which implies that your mysql header files are not in /usr/local/mysql/bin/

Try /usr/local/mysql if that is the top level of your mysql installation.

-- 
David Robley

I don't have a boyfriend, said Mary guilelessly.

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



Re: [PHP] PHP Configuration Error

2004-10-19 Thread bbonkosk
It can't find your mysql stuff to link in.
What does your configuration command look like?
you might have to specify the path to mysql, i.e. --with-mysql=/path/to/mysql

-Brad

- Original Message -
From: Mulley, Nikhil [EMAIL PROTECTED]
Date: Tuesday, October 19, 2004 7:18 am
Subject: [PHP] PHP Configuration Error

 
 
 Hi All,
 
 
 When I am compiling php4.3.8 with mysql,apxs and snmp  on a -Linux 
 Build i386 GNU/Linux
 
 I am getting this error  Can some body please help me
 I have PHP already installed but I want to reconfigure it to work 
 with snmp 
 
 
 Here is the End of the configuration message
 
 
 checking base type of last arg to accept... (cached) socklen_t
 checking return type of qsort... (cached) void
 configure: error: Cannot find MySQL header files under 
 /usr/local/mysql/bin/ 
 
 Nikhil
 

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



[PHP] @session_start generates a new session_id

2004-10-19 Thread Mark-Walter
Hi,

I made an update to Apache/1.3.31 (Unix) PHP/4.3.9 and
before this everythings works fine.

The problem is that a following page generates a new
session stored under the session.save_path and the
stored variable e.g. $_SESSION['SESS_CUS'] is not
valid anymore due the SID entry.

On both pages I use this to start:

@session_start();
session_name(userauth);
$_SESSION['SESS_CUS'] = $user_id;

to verify the $USER_ID in conjunction with the actual 
valid session value.

I tried already a form with a hidden field to overgive
the session which works fine in the former version:

form method=post action=\./MyFILE.php?USERNAME=$realnameUSER_ID=$user_id\
INPUT TYPE=\hidden\ NAME=\session_name();\ value=\session_id();\
INPUT TYPE=\submit\ VALUE=\Login for the board\   
/form

But this doesn't work anymore ...

The new LAMP system generates everytime after calling
@session_start(); a new session. Either on the same
page or a following one.

How can I prevent this behavior by using the PHP session 
management function ?

-- 
Best Regards,

Mark

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



Re: [PHP] Mixing classes

2004-10-19 Thread Davy Obdam
Hi
Maybe you could make most class childs of the Core class... well at 
least the classes that need values from you config file.

class Database extends Core
{
 
}

}
I dont know if this is gonna work in your set up, but since this Core 
class reads the config file, now you can just creat an object from the 
database class anywhere and alread have those variables available.

Best regards,
Davy
Tomi Kaistila wrote:
Hi!
Thanks for the idea, hadn't actually thought of it that way. I had 
thought of passing objects (instance the db object to the auth object) 
by reference, but when thinking that while one class might only need 
the help of one other class, another class might need the help of four 
classes. Would make the constructor look a bit ugly.

The approuch you suggest is good, for most of the classes. For 
example, although I create an instance of the db class on the web 
site, it doesn't harm to create another inside the auth class. But 
there are some classes that are not suited to be created that way. For 
example, the Core class, which for one thing, reads the configuration 
file from the include path and sets a load of values which each class 
should then use. For example, the db class needs values such as the 
username, password, hostname, port, etc. It wouldn't be advisable read 
the configuration file more than once.

I'm not sure, but could an instance of a class be pass as reference 
with the Global keyword? Like so;

?php
class auth {
var $dbObject = ;
function auth () {
//Create an instance of you database class
global $dbobject;
$this-dbObject = $dbobject;
}
function doSomething() {
// Execute a query
$this-dbObject-query($sql);
}
}
?
Davy Obdam wrote:

Hi Tomi,
You could create an object of the Database class in your Auth class 
like this and then use your Datebase class with your Auth class:

?php
require_once(Database/Database.php);
class Auth
{
var $dbObject = ;
function Auth ()
{
   //Create an instance of you database class
   $this-dbObject = new Database($arg1, $arg2, $etc);
}
function doSomething()
{
   // Execute a query
   $this-dbObject-query($sql);
  }
}
?
I hope this helps
Best regards,
Davy Obdam
Tomi Kaistila wrote:
Hey!
I've written several general classes, much as tools. One manages 
databases, one authenticates users, etc. I'm trying to bring all of 
these together into one sorta like a CMS, but the problem is that I 
can't find a way to have the different classes take advantage of 
each other; for example, a function in the auth class needs to 
contact the database, so it needs the query() function from the 
database class, but the objects are created on the index.php and as 
such are not in the scope of the functions in the classes.

Would anyone have any ideas or suggestions how to solve this issue? 
I've looked for a solution for some time now, to no result.

My PHP version is 4.3.8.


--
Davy Obdam
mailto:[EMAIL PROTECTED]
web: http://www.davyobdam.com
The media finally figured out that their paying customers 
(i.e. advertisers) don't WANT an intelligent, thoughtful 
audience.  And they no longer have one. (Rich Tietjens)



smime.p7s
Description: S/MIME Cryptographic Signature


RE: [PHP] Re: Oracle Connection

2004-10-19 Thread Ford, Mike
To view the terms under which this email is distributed, please go to 
http://disclaimer.leedsmet.ac.uk/email.htm



On 19 October 2004 13:19, David Robley wrote:

 On Tue, 19 Oct 2004 16:20, Syed wrote:
 
  Hi All,
  
  will anybody tell me how to connect oracle database using php
  script. 
  
  Thanx
  
  Syed
 
 Start at http://php.net/oracle

No, don't -- not unless you're using a really old version of Oracle 
version 7.

Instead, start here:  http://php.net/oci8

Cheers!

Mike

-
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning  Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Headingley Campus, LEEDS,  LS6 3QS,  United Kingdom
Email: [EMAIL PROTECTED]
Tel: +44 113 283 2600 extn 4730  Fax:  +44 113 283 3211 

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



Re: [PHP] people/projects looking for developers...

2004-10-19 Thread Philip Thompson
On Oct 18, 2004, at 9:06 PM, bruce wrote:
interesting...
for the most part, people have responded with contract resource 
sites...
(guru.com/elance.com/etc)

no one has mentioned any kind of site specifically geared towards 
people who
want to come together to kind of build applications. ala the old
garage/basement type of process were you get a few guys together with 
a few
sales guys, and they build/start to sale the app, and create a biz...

so my question i guess, is why the hell isn't there more of an 
interest in
this kind of atmosphere..

have people just been too dam* burned too many times, or are people 
really
just satisfied with their jobs
What'd you have in mind? I'm freshly out of college and would be up for 
most things...

~Philip
interesting...
thanks
-bruce
-Original Message-
From: Dan Joseph [mailto:[EMAIL PROTECTED]
Sent: Monday, October 18, 2004 6:57 PM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] people/projects looking for developers...

a question for consideration. are there sites set up for people who 
have
ideas/projects, who are looking for developers. or vice versa, are 
there
sites for developers who are looking to be part of projects.

i'm not referring to open source projects, rather projects that are
intended
to be revenue generating businesses.
www.itmoonlighter.com is one that I use to use.  It has both companies
looking to find developers for their projects, and developers looking
for extra work.  I'm sure there are other sites, but I can't think of
'em.
-Dan Joseph
--
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


[PHP] Extracting relevant text from a text file

2004-10-19 Thread Stuart Felenstein
Best way for me to explain this is by example - 
I just applied for a job and cut and past my resume
into a textarea.
After submitting it had extracted all the information
and placed them into textfields.  So my first name was
now in the first name textfield, city was in the city
field.
Also , work experience and companies were also
extracted to certain areas.

How sophisticted a search is this and are there
functions within PHP that make this accomplishable ?
I'm not entirely sure how it's done.  I'm assuming
searches are run looking for certain strings, name
though ? is there a way to search for pronouns.  

Last, I guess if I had an un-average formatted resume
it would not work as well.

Stuart

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



Re: [PHP] people/projects looking for developers...

2004-10-19 Thread Greg Donald
On Tue, 19 Oct 2004 08:28:17 -0500, Philip Thompson [EMAIL PROTECTED] wrote:
  so my question i guess, is why the hell isn't there more of an
  interest in
  this kind of atmosphere..

php-general is a place where PHP users come to get coding assistance
and to discuss PHP code in general.  I suspect most of us already have
paying jobs or are actively seeking that end.  And those of us who
_have_ any spare time probably already have hobby projects going.  I
know I do.  Getting involved in yet another PHP project simply
wouldn't be realistic because of time constraints.  I'm not sure this
is the best forum to begin seeking members for a new business.


-- 
Greg Donald
Zend Certified Engineer
http://gdconsultants.com/
http://destiney.com/

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



Re: [PHP] sql trim problem

2004-10-19 Thread Greg Donald
On Mon, 18 Oct 2004 21:43:18 -0700, Dale Hersowitz
[EMAIL PROTECTED] wrote:
 Recently, I had to format my db server and when I re-attached the database,
 I noticed some unusal behavior. I have some fields in certain tables with a
 width of 60. When I would extract data from the table for that specific
 field, the data would contain extra blank chars. As a result, I am forced to
 use the trim function to get rid of the extra chars. This problem has never
 occured before and I now find it quite annoying. Does anybody have any
 ideas?

This question would be more appropriate for php-db or the mailing list
for the database you are using, if one exists.

Fixed length fields often have 'filler' data at the end of the field. 
I suspect this the case with your data.


-- 
Greg Donald
Zend Certified Engineer
http://gdconsultants.com/
http://destiney.com/

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



Re: [PHP] Optimized GIF animations created on the fly (patch included)

2004-10-19 Thread Greg Donald
On Tue, 19 Oct 2004 10:32:01 +0300 (EEST), Jaakko Hyvätti
[EMAIL PROTECTED] wrote:
   I hope people can test this patch and suggest improvements, and that
 eventually the patch makes it into php-4 and php-5.  I'll try to include
 examples and updated manual patches for the new functions on that page
 later.  Please do not hesitate to contact me for any questions or
 suggestions!

You probably want to post this info to php-dev.  php-general is for
users of PHP, not necessarily the actual PHP developers.


-- 
Greg Donald
Zend Certified Engineer
http://gdconsultants.com/
http://destiney.com/

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



Re: [PHP] Add to regex help

2004-10-19 Thread Silvio Porcellana
Uhm, I guess you are looking for links (following a 'href') in your HTML page, so why 
don't you just do something like:

preg_match_all('/href=[\\']?([^\\'\s]*)[\\']?/i', $url, $matches)
(note the '\s' added inside the bracket that should match the link, as you could have:
a href=pippo.com target=_blank - that is, a link terminated by a white space)
HTH, cheers!
Silvio
Mag wrote:
Hi,
Quite some time back I modified a regex (to the one
below) to work with my script:
if (preg_match_all('/a\s+.*?href=[\\']?([^\\'
]*)[\\']?[^]*.*?\/a/i', $url, $matches))
{
   foreach($matches as $match){$links[] = $match;}
}
Problem is, I dont really know REGEXs properly and
dont remember how I modified it and it completly
ignores the below: 

area shape=rect coords=95,8,242,145
href=2/FIVE.MPG
because its a map and I guess it does not start with
a and does not end with /a
but I need to make sure it catches even the above...
Can someone help me add to the above regex please?
Thanks,
Mag
=
--
- The faulty interface lies between the chair and the keyboard.
- Creativity is great, but plagiarism is faster!
- Smile, everyone loves a moron. :-)

___
Do you Yahoo!?
Declare Yourself - Register online to vote today!
http://vote.yahoo.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP] Re: ' (Single Quotes) in user inputs

2004-10-19 Thread Gryffyn, Trevor
Also, you probably want to do a string replace of some kind and make the
single quote a double single-quote   ' to ''   

I don't know if that's how MySQL does it, but that's how SQL Server
escapes single quotes and I believe other DBs do as well.

Just something to look into because I think the \' might not work on DBs
that use ''.

-TG

 -Original Message-
 From: John Holmes [mailto:[EMAIL PROTECTED] 
 Sent: Monday, October 18, 2004 8:59 PM
 To: Jerry Swanson
 Cc: Christian Jul Jensen; [EMAIL PROTECTED]
 Subject: Re: [PHP] Re: ' (Single Quotes) in user inputs
 
 
 Jerry Swanson wrote:
  I'm not sure that stripslashes() are used for input. 
 
 If you want to redisplay the input, then it would be used.
 
  addslashes() - to insert data into database
  stripslashes() - to get data from database and print it.
 
 You don't need stripslashes when pulling data unless you have 
 magic_quotes_runtime enabled. If you find that you need to call 
 stripslashes on your data, then you're escaping it twice before you 
 insert it.
 
 -- 
 
 ---John Holmes...
 
 Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/
 
 php|architect: The Magazine for PHP Professionals - www.phparch.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] @session_start generates a new session_id

2004-10-19 Thread Matt M.
 @session_start();
 session_name(userauth);
 $_SESSION['SESS_CUS'] = $user_id;


I am not 100% sure what the problem is, but if you are trying to
change the session name to userauth, I think you need to do that
before session_start

http://us2.php.net/session_name

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



Re: [PHP] @session_start generates a new session_id

2004-10-19 Thread Mark-Walter
Hi Matt,

  @session_start();
  session_name(userauth);
  $_SESSION['SESS_CUS'] = $user_id;
 
 I am not 100% sure what the problem is, but if you are trying to
 change the session name to userauth, I think you need to do that
 before session_start

session_name() works ok so far.

For example:
?
@session_start;
$session = session_id();  /* index.php */
$_SESSION['SESS_CUS'] == $user_id;
echo $session; 
?

OUTPUT in the browser:

34f321149ee49d20e0e223f3020c1f77

In the case a new page is loaded it changes to a new value:

?
$session = session_id();  /* userauth.php */
echo PHPSESSID: $session;
echo SESSION:.$_SESSION['SESS_CUS'];
?

OUTPUT in the browser:

PHPSESSID: b65de73df8d327a4e15627ccfd14968d
SESSION:  

A new request over http generates a new session and 
$_SESSION['XYZ'] is not available anymore.

-- 
Best Regards,

Mark

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



[PHP] fputcsv() error message

2004-10-19 Thread Steven
Fatal error: Call to undefined function: fputcsv() in
/home/webdev/sites/tracking_site/scripts/report.php on line 19

Is there something that I am missing?  The code that I had entered in:

?php

$list = array (
   'aaa,bbb,ccc,',
   '123,456,789',
   'aaa,bbb'
);

$fp = fopen('file.csv', 'w');

foreach ($list as $line) {
   fputcsv($fp, split(',', $line));
}

fclose($fp);
?

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



Re: [PHP] fputcsv() error message

2004-10-19 Thread Greg Donald
On Tue, 19 Oct 2004 12:37:02 -0500, Steven [EMAIL PROTECTED] wrote:
 Fatal error: Call to undefined function: fputcsv() in
 /home/webdev/sites/tracking_site/scripts/report.php on line 19

php.net/fputcsv

(no version information, might be only in CVS)



-- 
Greg Donald
Zend Certified Engineer
http://gdconsultants.com/
http://destiney.com/

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



Re: [PHP] problem with array

2004-10-19 Thread Minuk Choi
You say you have a database with many CHAR(60) fields?
Have you considered changing those to VARCHAR(60)?
This isn't PHP and is probably inappropriate solution(since it is not PHP 
related), but I believe a CHAR(60) defines the field as a fixed length 
character string, meaning no matter what you want to store, it is 60 
lengths.

VARCHAR(60) is a variable length(still fixed, since you have a maximum) 
length field type.

My SQL datatypes may be rusty, but try converting a small portion of your db 
to VARCHAR(60) and try pulling data off those fields.  Let me know how it 
turns out.

-Minuk
- Original Message - 
From: Dale Hersowitz [EMAIL PROTECTED]
To: 'Minuk Choi' [EMAIL PROTECTED]
Sent: Tuesday, October 19, 2004 12:38 AM
Subject: RE: [PHP] problem with array


Minuk,
After much searching and asking, I found the answer to my problem. It 
turns
out that after re-attaching my db and re-formatting the server, the db has
been slightly adjusted. Let me explain. Many of my fields are set to char
with a width of 60. As a result, when I extract data from the db, it has
extra chars or blank spaces attached to it. I am finding myself to have to
use the trim function everywhere. If you have a fix to this problem it 
would
be greatly appreciated.

Thx.
Dale
Hersh Corporation
2250 E. Imperial Hwy., 2nd Fl.
El Segundo, CA 90245 USA
Phone: (310) 563-2155 Fax: (310) 563-2101
E-mail: [EMAIL PROTECTED]
Web Site: www.hershonline.com
E-Mail Disclaimer
NOTE: This e-mail message and all attachments thereto (this message)
contain confidential information intended for a specific addressee and
purpose. If you are not the addressee (a) you may not disclose, copy,
distribute or take any action based on the contents hereof; (b) kindly
inform the sender immediately and destroy all copies thereof. Any copying,
publication or disclosure of this message, or part thereof, in any form
whatsoever, without the sender's express written consent,is prohibited. No
opinion expressed or implied by the sender necessarily constitutes the
opinion of Hersh Corporation. This message does not constitute a guarantee
or proof of the facts mentioned therein. Hersh Corporation accepts no
responsibility or liability in respect of (a) any opinion or guarantee of
fact, whether express or implied; or (b) any action or failure to act as a
result of any information contained in this message, unless such 
information
or opinion has been confirmed in writing by an authorized Hersh 
Corporation
partner or employee.
-Original Message-
From: Minuk Choi [mailto:[EMAIL PROTECTED]
Sent: Friday, October 15, 2004 5:16 PM
To: Dale Hersowitz
Subject: Re: [PHP] problem with array

Hmm... okay,
Now,  is the output you gave me the last row?  That is, that's the row you
have errors?
According to the output, it should work, since
$row['selectedCol'] exists
and $row['selectedCol'] = col0
and $row['col0'] exists.
How about this approach,  tell me what it is you are trying to accomplish
from the block of code.
In particular, explain to me what
$selectedCol=$row[selectedCol];
 echo $selectedCol;
$selectedColName=$row[$selectCol];   //--- PLEASE NOTE THIS 
SPECIFIC
is supposed to prove.
--your code--

  $query=SELECT * FROM customizeViewClients WHERE employeeNum =
$employeeNum;
  $results=mssql_query($query, $connection) or die(Couldn't execute
query);
  $numRows=mssql_num_rows($results);
   if($numRows0)
  {
$row=mssql_fetch_array($results);
   }
$selectedCol=$row[selectedCol];
 echo $selectedCol;
$selectedColName=$row[$selectCol];   //--- PLEASE NOTE THIS 
SPECIFIC

- Original Message - 
From: Dale Hersowitz [EMAIL PROTECTED]
To: 'Minuk Choi' [EMAIL PROTECTED]
Sent: Friday, October 15, 2004 1:29 PM
Subject: RE: [PHP] problem with array


Minuk,
I add that line of code and here is what came out:
selectedCol : col0  Array
(
   [0] = 1
   [employeeNum] = 1
   [1] = clientName
   [col0] = clientName
   [2] = city
   [col1] = city
   [3] = telephoneNum
   [col2] = telephoneNum
   [4] = telephoneNum2
   [col3] = telephoneNum2
   [5] = cp1FirstName
   [col4] = cp1FirstName
   [6] = 1
   [col0Active] = 1
   [7] = 1
   [col1Active] = 1
   [8] = 1
   [col2Active] = 1
   [9] = 1
   [col3Active] = 1
   [10] = 1
   [col4Active] = 1
   [11] = col0
   [selectedCol] = col0
   [12] = ASC
   [selectionType] = ASC
)
Thx.
Dale
-Original Message-
From: Minuk Choi [mailto:[EMAIL PROTECTED]
Sent: Thursday, October 14, 2004 9:04 PM
To: Dale Hersowitz
Subject: Re: [PHP] problem with array
$row['selectedCol'] returns 'clientName'???
let me guess, $row should have a column named 'clientName'?
try this and tell me the output.
  $query=SELECT * FROM customizeViewClients WHERE employeeNum =
$employeeNum;
  $results=mssql_query($query, $connection) or die(Couldn't execute
query);
  $numRows=mssql_num_rows($results);
   if($numRows0)
  {
$row=mssql_fetch_array($results);
   }
$selectedCol=$row[selectedCol];

[PHP] Square brackets tags

2004-10-19 Thread Marco Bambini
Hi All,
I need to write a PHP extension or a PHP template system (this is the 
question) to parse some commands enclosed in square brackets inside web 
pages. Please note that the commands are in the form [command1] and not 
?php [command1] ?.
I want use PHP because these commands needs to be remapped with a web 
oriented language.

Is it technically possible to remap these square brackets tags to php?
And if yes, what is the best way? A custom template system or a C PHP 
extension?

Thanks a lot.
Best regards,
Marco Bambini
Italy
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Square brackets tags

2004-10-19 Thread Greg Donald
On Tue, 19 Oct 2004 20:13:23 +0200, Marco Bambini [EMAIL PROTECTED] wrote:
 I need to write a PHP extension or a PHP template system (this is the
 question) to parse some commands enclosed in square brackets inside web
 pages. Please note that the commands are in the form [command1] and not
 ?php [command1] ?.
 I want use PHP because these commands needs to be remapped with a web
 oriented language.
 
 Is it technically possible to remap these square brackets tags to php?
 And if yes, what is the best way? A custom template system or a C PHP
 extension?

Why not just write PHP code normally and use eval() to parse it out?


-- 
Greg Donald
Zend Certified Engineer
http://gdconsultants.com/
http://destiney.com/

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



RE: [PHP] fputcsv() error message

2004-10-19 Thread Steven
Crapola.

I guess that means a recompile...

T.T``

Steven Altsman 

-Original Message-
From: Greg Donald [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, October 19, 2004 12:59 PM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] fputcsv() error message

On Tue, 19 Oct 2004 12:37:02 -0500, Steven [EMAIL PROTECTED]
wrote:
 Fatal error: Call to undefined function: fputcsv() in
 /home/webdev/sites/tracking_site/scripts/report.php on line 19

php.net/fputcsv

(no version information, might be only in CVS)



-- 
Greg Donald
Zend Certified Engineer
http://gdconsultants.com/
http://destiney.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] new connection with pg_pconnect

2004-10-19 Thread Jonathan Villa
 [snip]
 I then have the page main.php which has

 ?php
 global $sys_dbhost,$sys_dbuser,$sys_dbpasswd;
 $dbconn = pg_connect(user=$sys_dbuser dbname=bisprojects
 host=$sys_dbhost password=$sys_dbpasswd); echo '-'.$dbconn.'-'; ?

 the scripts just dies whenever I include the pg_connect function... if I
 change

 echo '-'.$dbconn.'-';
 to
 echo '-==='.$dbconn.'-';

 I'll still see -- on my page
 if I remove the pg_connect function, I'll see
 -===-;

 Basically, no changes to the page take effect when I have the pg_connect
 function in place... it just dies or something...
 [/snip]

 Hmmm, strange.

 I used your code, exactly as it is above (but with my username,
 password, db and server info) and it works fine.

 Check your error logs and see if there's anything showing up there and
 let us know what you find.

 Pablo



Thanks for the reply... I checked apache's error logs and it's given a
Segmentation fault when trying to connect

[Tue Oct 19 14:11:29 2004] [notice] child pid 28586 exit signal
Segmentation fault (11)

Just to recap, I already have an existing pg_pconnect[ion] open and am
trying to open a new one...

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



[PHP] Session

2004-10-19 Thread Deleo Paulo Ribeiro Junior
Hello!

I am trying to make my pages last for only 1 minute but I am not been successfull.

I have already changed session.cache_expire = 1 in php.ini (USING RedHat) but nothing 
happens.

I would like the pages to last only for 1 minute, this means that if the user do not 
use the site within 1 minute all the session variables will be lost and he will have 
to log on again (I am using session variables to store name and password).

Can anyone help me?

Thank you

Deleo


Re: [PHP] Session

2004-10-19 Thread Matt M.
 I am trying to make my pages last for only 1 minute but I am not been successfull.
 
 I have already changed session.cache_expire = 1 in php.ini (USING RedHat) but 
 nothing happens.
 
 I would like the pages to last only for 1 minute, this means that if the user do not 
 use the site within 1 minute all the session variables will be lost and he will have 
 to log on again (I am using session variables to store name and password).
 
 Can anyone help me?

you will have to expire the session manually.

keep track of the last time they access the site in a session
variable.  Check that variable every request they make.  If it is
longer than a minute, expire the session.

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



[PHP] Re: Session

2004-10-19 Thread Matthew Weier O'Phinney
* Deleo Paulo Ribeiro Junior [EMAIL PROTECTED]:
 I am trying to make my pages last for only 1 minute but I am not been =
 successfull.

 I have already changed session.cache_expire =3D 1 in php.ini (USING =
 RedHat) but nothing happens.

You may also need to set session.cookie_lifetime (if 
session.use_cookies == 1) and I've also found that the
session.gc_maxlifetime variable can often have an effect on these
issues.

Also... Did you restart apache?

-- 
Matthew Weier O'Phinney   | mailto:[EMAIL PROTECTED]
Webmaster and IT Specialist   | http://www.garden.org
National Gardening Association| http://www.kidsgardening.com
802-863-5251 x156 | http://nationalgardenmonth.org

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



Re: [PHP] Square brackets tags

2004-10-19 Thread Marco Bambini
On 19/ott/04, at 20:34, Greg Donald wrote:
On Tue, 19 Oct 2004 20:13:23 +0200, Marco Bambini 
[EMAIL PROTECTED] wrote:
I need to write a PHP extension or a PHP template system (this is the
question) to parse some commands enclosed in square brackets inside 
web
pages. Please note that the commands are in the form [command1] and 
not
?php [command1] ?.
I want use PHP because these commands needs to be remapped with a web
oriented language.

Is it technically possible to remap these square brackets tags to php?
And if yes, what is the best way? A custom template system or a C PHP
extension?
Why not just write PHP code normally and use eval() to parse it out?
I can't alter the code. I need PHP to execute these commands but I 
can't write PHP code inside that pages.

Any help?
Thanks,
Marco Bambini
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Session

2004-10-19 Thread Chris Dowell
Deleo
We had an interesting conversation on this last just last week regarding 
the length of sessions.

The title of the thread is [PHP]Sessions not destroyed. Try searching 
the archives with that text.

I believe Marek's and my own messages may have the information you're 
looking for - basically, PHP doesn't provide a mechanism to *guarantee* 
expiry of sessions - only to deal with garbage-collecting defunkt ones. 
Any explicit session-expiry will have to be implemented by the end-user; 
i.e. you.

Hope this helps
Cheers
Chris
Deleo Paulo Ribeiro Junior wrote:
Hello!
I am trying to make my pages last for only 1 minute but I am not been successfull.
I have already changed session.cache_expire = 1 in php.ini (USING RedHat) but nothing 
happens.
I would like the pages to last only for 1 minute, this means that if the user do not 
use the site within 1 minute all the session variables will be lost and he will have 
to log on again (I am using session variables to store name and password).
Can anyone help me?
Thank you
Deleo
 

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


[PHP] CPU usage @5% during 2 minutes

2004-10-19 Thread Janke Dávid
Dear php list!

I have a real big and strange problem I ran into few weeks ago.
One of my clients complained, that the intranet software began to run
very slow, almost unusable.
Since then I have almost tried everything to get the thing work.

The facts:
On P3 architecture systems (I have tried 3, including the server at the
clients office) runs very slow and with about 0-5% of CPU usage. The
code needs about 2 minutes to get completed.
On a P4 it is ready in 2 seconds with 100% CPU usage.

I have placed a debug function into the code. It is a string that
collects unix microtime each time within the loop. This loop has approx.
10k cycles. The loop does nothing than echoing a row. Sometimes there is
a 4 second gap between two cycles, sometime only a few microseconds.

The original system was installed from Debian Woody, but the problem
appears on a Sarge system, and when using apachephp compiled by me.
No configuration file fine tuning seems to work.

The most strange thing is, that the problem appeared at a time, when no
changes to the program was made.

ANYBODY RAN INTO SOME SIMILAR THING?

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



Re: [PHP] Square brackets tags

2004-10-19 Thread GH
I am thinking in theory include() the file in to a wrapper php file
that can then do as Marco says evaluate or do a series of
str_replaces?

[quote from previous emails]

I'm sure there are. For example you can convert the string using
htmlspecialchars, and then convert only allowed tags back:

$text = htmlspecialchars($_POST['text']);

$replace_to = array('b', '/b');

$replace_from = array();
foreach($replace_to as $tag) {
  $replace_from[] = htmlspecialchars($tag);
}

$text = str_replace($replace_from, $replace_to, $text);


Or you can install pear in your account, just unpack the archive and set
include_path.


 Matthew Fonda  to GH, php-general 
  More options  Sep 29 

Typically people use BBCode to do this.
This mean the user will enter something like
[b]this is bold[/b] or [i]italic[/u] and the BBCode will be parsed and
transformed into HTML when the page is displayed. There are many parsers
already written to do this, or you could make your own, or use PEAR:
http://pear.php.net/package/HTML_BBCodeParser




[/quote]


On Tue, 19 Oct 2004 22:09:31 +0200, Marco Bambini [EMAIL PROTECTED] wrote:
 
 On 19/ott/04, at 20:34, Greg Donald wrote:
 
  On Tue, 19 Oct 2004 20:13:23 +0200, Marco Bambini
  [EMAIL PROTECTED] wrote:
  I need to write a PHP extension or a PHP template system (this is the
  question) to parse some commands enclosed in square brackets inside
  web
  pages. Please note that the commands are in the form [command1] and
  not
  ?php [command1] ?.
  I want use PHP because these commands needs to be remapped with a web
  oriented language.
 
  Is it technically possible to remap these square brackets tags to php?
  And if yes, what is the best way? A custom template system or a C PHP
  extension?
 
  Why not just write PHP code normally and use eval() to parse it out?
 
 I can't alter the code. I need PHP to execute these commands but I
 can't write PHP code inside that pages.
 
 Any help?
 
 Thanks,
 Marco Bambini
 
 
 
 --
 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] CPU usage @5% during 2 minutes

2004-10-19 Thread Ed Lazor
 The most strange thing is, that the problem appeared at a 
 time, when no
 changes to the program was made.
 
 ANYBODY RAN INTO SOME SIMILAR THING?

I haven't run into this, but it'll be easier to help troubleshoot this if
you could post sample code.

Ed Lazor, President
http://RPGStore.com
Up to 50% off.  Over 20,000 items in stock 

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



RE: [PHP] 'Intelligently' truncate string?

2004-10-19 Thread Ed Lazor
 -Original Message-
 I'm wondering if anyone else on the list has worked out a way of
 intelligently truncating a string to take these kinds of 
 occurrences into
 account? I don't mind, in these situations if the truncation 
 takes place
 before or after the entity, since when displayed it will only 
 equate to one
 character more or less.

Check out the user contributed notes in manual for substr.  There's an
example there of how to keep words intact and it sounds like it might apply
to your situation.

Ed Lazor, President
http://RPGStore.com
Up to 50% off.  Over 20,000 items in stock 

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



Re: [PHP] Square brackets tags

2004-10-19 Thread Sam Smith

I was just reading a little on this. This is the way you build a template
system. Smarty uses { }. Maybe you could check out the Smarty page and get
an idea. http://smarty.php.net/

Or maybe you could just use Smarty, you can change the { } to anything you
want.


 Hi All,
 
 I need to write a PHP extension or a PHP template system (this is the
 question) to parse some commands enclosed in square brackets inside web
 pages. Please note that the commands are in the form [command1] and not
 ?php [command1] ?.
 I want use PHP because these commands needs to be remapped with a web
 oriented language.
 
 Is it technically possible to remap these square brackets tags to php?
 And if yes, what is the best way? A custom template system or a C PHP
 extension?

Get Smarty.

If you get into Smarty could you let us know how 'steep' it was? 


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



RE: [PHP] CPU usage @5% during 2 minutes

2004-10-19 Thread Janke Dávid
The sample code (in seperate, this piece of code runs with normal speed,
but it is this part which runs slowly when executed as a whole,
everything else is fast):


$sqlquery = SELECT sh_Number, sh_Status FROM service_sheet ORDER BY
sh_Number DESC;
$result = mysql_query($sqlquery)
or die (mysql_error().brbr._ERROR_QUERY.: .$sqlquery);
echo  SELECT onchange=\this.form.service_sheet_worknum.value =
this.value;\ class=\service_sheet_list\ name=\service_sheet\;
while (list($shID, $shStatus, $shWNum, $custName) =
mysql_fetch_row($result)) {
switch ($shStatus) {
case 1:
$option_class = status_1;
break;
case 2:
$option_class = status_2;
break;
case 3:
$option_class = status_3;
break;
case 4:
$option_class = status_4;
break;
case 5:
$option_class = status_5;
break;
}
echo OPTION class=\$option_class\ value=\$shID\$shID/OPTION;
}
 echo /SELECTnbsp;nbsp;nbsp;nbsp;._OR;?

 

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



RE: [PHP] CPU usage @5% during 2 minutes

2004-10-19 Thread Jennifer Goodie
-- Original message from Janke Dávid : -- 

 The sample code (in seperate, this piece of code runs with normal speed, 
 but it is this part which runs slowly when executed as a whole, 
 everything else is fast): 
 
 
 $sqlquery = SELECT sh_Number, sh_Status FROM service_sheet ORDER BY 
 sh_Number DESC; 
 $result = mysql_query($sqlquery) 
 or die (mysql_error().

Are you sure it is not the query that is running slow?  Have you looked to see what 
mysql is doing when the application hangs?  What processes does top show as running 
and using resources?  Has the mysql config recently changed?  What does an explain on 
that query show?

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



RE: [PHP] CPU usage @5% during 2 minutes

2004-10-19 Thread Janke Dávid
How any rows are you pulling from the database?  
aprrox. 12.000 but there are only around 50-100 new rows at a maximum
within a day, and there were almost as many before the problem appeared.

What's the very last part of the code:  .$_OR? 

There is a switch, some echoes and a db_close;


Have you tried this code in a separate script to test it's performance
individually?
Yes, then it performs good.
This seems to be strange and irrelevant to me, because placing a 
$tmpsting .= microtime().br\n; into each loop and then echoing it
shows, that there are randomly processing gaps between two cycles when
running as a part of the whole.



 -Original Message-
 
 The sample code (in seperate, this piece of code runs with 
 normal speed,
 but it is this part which runs slowly when executed as a whole,
 everything else is fast):
 
 
   $sqlquery = SELECT sh_Number, sh_Status FROM 
 service_sheet ORDER BY
 sh_Number DESC;
   $result = mysql_query($sqlquery)
   or die (mysql_error().brbr._ERROR_QUERY.: .$sqlquery);
   echo  SELECT 
 onchange=\this.form.service_sheet_worknum.value =
 this.value;\ class=\service_sheet_list\ name=\service_sheet\;
   while (list($shID, $shStatus, $shWNum, $custName) =
 mysql_fetch_row($result)) {
   switch ($shStatus) {
   case 1:
   $option_class = status_1;
   break;
   case 2:
   $option_class = status_2;
   break;
   case 3:
   $option_class = status_3;
   break;
   case 4:
   $option_class = status_4;
   break;
   case 5:
   $option_class = status_5;
   break;
   }
   echo OPTION class=\$option_class\ 
 value=\$shID\$shID/OPTION;
   }
echo /SELECTnbsp;nbsp;nbsp;nbsp;._OR;?
 

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



RE: [PHP] CPU usage @5% during 2 minutes

2004-10-19 Thread Janke Dávid
2004-10-19, k keltezssel 23:38-kor Jennifer Goodie ezt rta:
 -- Original message from Janke Dvid : -- 
 
  The sample code (in seperate, this piece of code runs with normal speed, 
  but it is this part which runs slowly when executed as a whole, 
  everything else is fast): 
  
  
  $sqlquery = SELECT sh_Number, sh_Status FROM service_sheet ORDER BY 
  sh_Number DESC; 
  $result = mysql_query($sqlquery) 
  or die (mysql_error().
 
 Are you sure it is not the query that is running slow?  Have you looked to see what 
 mysql is doing when the application hangs?  What processes does top show as running 
 and using resources?  Has the mysql config recently changed?  What does an explain 
 on that query show?

Yes. And although I don't like mysql I must say, that the query runs
damned fast. 11341 rows in 0.23 seconds.

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



RE: [PHP] CPU usage @5% during 2 minutes

2004-10-19 Thread Ed Lazor
 How any rows are you pulling from the database?  
 aprrox. 12.000 but there are only around 50-100 new rows at a maximum
 within a day, and there were almost as many before the 
 problem appeared.

You're creating a form with over 12,000 options in a select statement?


 
 What's the very last part of the code:  .$_OR? 
 
 There is a switch, some echoes and a db_close;

Maybe the ._OR at the end of your echo is just a copy / paste issue.

 Have you tried this code in a separate script to test it's 
 performance
 individually?
 Yes, then it performs good.
 This seems to be strange and irrelevant to me, because placing a 
 $tmpsting .= microtime().br\n; into each loop and then echoing it
 shows, that there are randomly processing gaps between two cycles when
 running as a part of the whole.

Have you tried to increase the amount of memory available to this script?

-Ed

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



RE: [PHP] CPU usage @5% during 2 minutes

2004-10-19 Thread Janke Dávid
2004-10-20, sze keltezssel 00:19-kor Ed Lazor ezt rta:
  How any rows are you pulling from the database?  
  aprrox. 12.000 but there are only around 50-100 new rows at a maximum
  within a day, and there were almost as many before the 
  problem appeared.
 
 You're creating a form with over 12,000 options in a select statement?

Unfortunately yes. This is a serial code from a paper form. Because they
want to be able to select each form individually from on page there is
no other way.
(maybe I should implement an archivating function)


 Have you tried to increase the amount of memory available to this script?

Yes.
I have set it to 64M, but it didn't seem to work.
It is strange, that now I have set it to -1 (according to the php doc
this is the value for unlimited memory access). Now it is faster. But by
now I can't say how fast it really is. The customer will say it
tomorrow.

Thanks very much for the help by now

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



[PHP] header problem for mobile browser

2004-10-19 Thread QT
Hi,

I want to make a php file for download a jad file. I am using following
script to let browser understand that jad file is coming and download it.

But I have very interesting problem. If user open browser and write correct
addres following script let the download file.

But if the user open browser and write wrong addres and get some error.
After write correct address, still getting same error.

I think following script can not reset the previos header and browser still
using previous header and bring back an error.

What should I do, for this problem, any idea

$SRC_FILE = $file;
 $download_size = filesize($SRC_FILE);
 $filename = basename($SRC_FILE);
 header(Content-Type: text/vnd.sun.j2me.app-descriptor);
 header(Content-Disposition: attachment; filename=$filename);
 header(Accept-Ranges: bytes);
 header(Content-Length: $download_size);
 @readfile($SRC_FILE);

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



[PHP] permission for file creating script

2004-10-19 Thread Padi
Q: Why can't userX in groupY write on a file with chmod 0664 and chown
userY:groupY?

Summary: I use php 4.3.9 on an apache webserver
I always got permission errors, when scripts tried to use mkdir() and the
kind.
So I chowned all files and folders to apache:apache and made my standard
user on that box also member of that group(I did that with kusers in kde),
all files now were on chmod 0664 and all directories on 0775.
But my user didn't have write permission, this doesn't go into my head.

Thanks for your appreciation

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



Re: [PHP] CPU usage @5% during 2 minutes

2004-10-19 Thread raditha dissanayake
Janke Dávid wrote:
Dear php list!
I have a real big and strange problem I ran into few weeks ago.
One of my clients complained, that the intranet software began to run
very slow, almost unusable.
Since then I have almost tried everything to get the thing work.
 

Install xdebug. It will help you identify where the problem is.
--
Raditha Dissanayake.

http://www.radinks.com/sftp/ | http://www.raditha.com/megaupload
Lean and mean Secure FTP applet with | Mega Upload - PHP file uploader
Graphical User Inteface. Just 128 KB | with progress bar.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] header problem for mobile browser

2004-10-19 Thread raditha dissanayake
QT wrote:
Hi,
I want to make a php file for download a jad file. I am using following
script to let browser understand that jad file is coming and download it.
 

Not sure If I have understood your question correctly but surely it 
would be easier for you to just add the following lines to your 
.htaccess file  and give a direct download link instead of trying to 
deliver through a php script.

addtype application/java-archive jar
addtype text/vnd.sun.j2me.app-descriptor jad
if you do deliver through a php script, the phone will follow up with a 
request for the jar file when it has recieved the jad file, your script 
needs to be able to handle that as well.

But I have very interesting problem. If user open browser and write correct
addres following script let the download file.
But if the user open browser and write wrong addres and get some error.
After write correct address, still getting same error.
I think following script can not reset the previos header and browser still
using previous header and bring back an error.
 

you cannot reset headers once they have been sent.  The headers you use 
seem ok but i would add a no-cache header as well.

header('Pragma: no-cache');
What should I do, for this problem, any idea
$SRC_FILE = $file;
$download_size = filesize($SRC_FILE);
$filename = basename($SRC_FILE);
header(Content-Type: text/vnd.sun.j2me.app-descriptor);
header(Content-Disposition: attachment; filename=$filename);
header(Accept-Ranges: bytes);
header(Content-Length: $download_size);
@readfile($SRC_FILE);
 


--
Raditha Dissanayake.

http://www.radinks.com/sftp/ | http://www.raditha.com/megaupload
Lean and mean Secure FTP applet with | Mega Upload - PHP file uploader
Graphical User Inteface. Just 128 KB | with progress bar.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP] Help With Error

2004-10-19 Thread php-list
Pablo,

Thanks for responding. I found out what the problem was. There was an
argument that was empty (i.e. empty string) in the add_cat() method. Thanks
for your help, I really appreciate it.  :)

[snip]
Notice: Undefined index: 0 in
L:\localhost\catalog\catalog_0.1.0\includes\classes\tree.class.php on line
77
[/snip]

It's telling you that $data['0'], which is used twice in your query, is not
a valid index (ie. it doesn't exist) for the $data array.

Why don't you dump the $data array after it is set to see where the problem
is:

$data = $this-get_cat_coord($child);
print_r($data);
die();

Take a look at what comprises the $data array and you should find your
problem.

HTH,

Pablo

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
Sent: Sunday, October 17, 2004 8:31 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Help With Error

Hello Everyone,

I keep getting the following errors in my class and I don't know why. Maybe
something has changed in PHP 5.x that I don't know about? Here are the
errors and the methods of that class:

---
Notice: Undefined index: 0 in
L:\localhost\catalog\catalog_0.1.0\includes\classes\tree.class.php on line
77

Notice: Undefined index: 0 in
L:\localhost\catalog\catalog_0.1.0\includes\classes\tree.class.php on line
77

Fatal error: Cannot use object of type DB_Error as array in
L:\localhost\catalog\catalog_0.1.0\includes\classes\tree.class.php on line
46
---


Line 77 is the 5th line of the following function:


---
function get_ancestors($child) {
// get child's lft  rgt values
$data = $this-get_cat_coord($child);
// get ancestors of child based on child's lft and rgt values
$tree = $this-fetch('SELECT * FROM tree WHERE lft 
'.$data['0']['lft'].' AND rgt  '.$data['0']['rgt'].' ORDER BY lft ASC');
return $tree;
}
---


Line 46 is the 3rd line of the following function


---
function get_parent($child) {
$parent = $this-get_ancestors($child);
$parent = $parent[count($parent)-1];
if (count($parent)  0) {
return $parent;
} else {
return 0;
}
}
---


I am calling the following function which calls the other two child
functions above:


---
function add_cat($cat, $addAfterCat_name='', $addAfterCat_lft='') {
if (!$this-exists_in_category($cat, $addAfterCat_name)) {
$db = $this-dbconnect();
if ($cat != ''  $addAfterCat_lft != '') {
$db-query(UPDATE tree SET rgt=rgt+2 WHERE
rgt.$addAfterCat_lft);
$db-query(UPDATE tree SET lft=lft+2 WHERE
lft.$addAfterCat_lft);
$add_query = INSERT INTO tree SET lft=';
$add_query .= $addAfterCat_lft+1;
$add_query .= ', rgt=';
$add_query .= $addAfterCat_lft+2;
$add_query .= ', category='$cat';
echo $add_query;
$db-query($add_query);
$message = 'Category Added To Tree';
} elseif ($cat != ''  $addAfterCat_lft == '') {
$message = 'Please Input A Category To Add';
} elseif ($cat == ''  $addAfterCat_lft != '') {
$message = 'Please Choose A Category To Add This Category
To';
}
} else {
$message = 'Category Already Exists In The Parent Category';
}
return $message;
}
---

What am I doing wrong?

-- 
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] Automatic Form processor

2004-10-19 Thread Lone Wolf
I've googled for this one and so far have come up empty handed.

I am in need of a PHP script that will take any POST data and parse it into
a file and email it out to users.  The data needs to be completely
changeable, whether I have 20 items or 400, I just want to throw everything
to the script via POST and let it take the POST information and manipulate
it.

IE:

form method=post action=parse.php
input type=text name=question_1
input type=text name=question_2
input type=text name=question_3
input type=text name=question_4
input type=text name=question_5
...
input type=text name=question_69
input type=text name=question_70

input type=submit

---
//parse.php

?php
.
//append to file

//create mail body
...
//mail to recipients
...
?

Thanks,
Robert

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.778 / Virus Database: 525 - Release Date: 10/15/2004
 

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



Re: [PHP] Automatic Form processor

2004-10-19 Thread Dan Joseph
 I am in need of a PHP script that will take any POST data and parse it into
 a file and email it out to users.  The data needs to be completely
 changeable, whether I have 20 items or 400, I just want to throw everything
 to the script via POST and let it take the POST information and manipulate
 it.
 
 IE:
 
 form method=post action=parse.php
 input type=text name=question_1
 input type=text name=question_2
 input type=text name=question_3
 input type=text name=question_4
 input type=text name=question_5
 ...
 input type=text name=question_69
 input type=text name=question_70
 
 input type=submit
 

You could use a foreach...

foreach ( $_POST as $key = $value )
{
   if ( substr( $key, 0, 4 ) == quest )
  echo $value: $key\n;
}

-Dan Joseph

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



Re: [PHP] @session_start generates a new session_id

2004-10-19 Thread Sadeq Naqashzade
Hi,
Check your PHP config file. You may enable auto session start. I think
this is the reasone of problem.

Sadeq


On Tue, 19 Oct 2004 18:21:29 +0200, [EMAIL PROTECTED]
[EMAIL PROTECTED] wrote:
 Hi Matt,
 
   @session_start();
   session_name(userauth);
   $_SESSION['SESS_CUS'] = $user_id;
 
  I am not 100% sure what the problem is, but if you are trying to
  change the session name to userauth, I think you need to do that
  before session_start
 
 session_name() works ok so far.
 
 For example:
 ?
 @session_start;
 $session = session_id();  /* index.php */
 $_SESSION['SESS_CUS'] == $user_id;
 echo $session;
 ?
 
 OUTPUT in the browser:
 
 34f321149ee49d20e0e223f3020c1f77
 
 In the case a new page is loaded it changes to a new value:
 
 ?
 $session = session_id();  /* userauth.php */
 echo PHPSESSID: $session;
 echo SESSION:.$_SESSION['SESS_CUS'];
 ?
 
 OUTPUT in the browser:
 
 PHPSESSID: b65de73df8d327a4e15627ccfd14968d
 SESSION:
 
 A new request over http generates a new session and
 $_SESSION['XYZ'] is not available anymore.
 
 --
 Best Regards,
 
 Mark
 
 
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 


-- 
-
Yazd, 8917954894

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



[PHP] Reverse (or backward?) Infinity Loop

2004-10-19 Thread Bruno B B Magalhães
Hi guys,
I have a normal categories table:
catId
catParentId
catName
catStatus
But I want when a user enters on:
http://hostname/site/products/catId1/catId7/catId13/../../contentId.html
A listing should apear like that:
 Category 1
  Category 7
   Category 13
 Category 2
 Category 3
 Category 4
 Category 5
A reverse (or backward) loop! We need to get the last category and then 
follow the ParentId until the 0 ParentId. Have anybody made this before 
(I hope so)?

Many Thanks,
Bruno B B Magalhaes
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Automatic Form processor

2004-10-19 Thread Justin French
On 20/10/2004, at 12:42 PM, Lone Wolf wrote:
I am in need of a PHP script that will take any POST data and parse it 
into
a file and email it out to users.  The data needs to be completely
changeable, whether I have 20 items or 400, I just want to throw 
everything
to the script via POST and let it take the POST information and 
manipulate
it.
As Dan has already said, something like this is what you need:
foreach ( $_POST as $key = $value )
{
   if ( substr( $key, 0, 4 ) == quest )
  echo $value: $key\n;
}
HOWEVER, this leaves your script wide open to security issues, because 
you're placing all the power in the HTML form, rather than on the 
sever-side PHP script.

Since your PHP script has no idea what sort of data it will receive, 
you can't do any validation of the content, so you're assuming whatever 
data the form submits cam be trusted.  The problem with assumptions is 
that they're nearly always flawed.

For example, I could write my own form which POSTs to your PHP script 
with my own field names and fill it with all sorts of garbage, hack 
attempts, and whatever else... your PHP script would trust it all, 
and them send it out to a bunch of people via email without any 
checking whatsoever.

I'm not enough of a security expert to offer any working examples, but 
for starters, it sounds like a nice way for a spammer to reach your 
recipient list.

So, what can you do about it?
Perhaps nothing -- it depends on how much work you want to put in, and 
what sort of security return you'll get for your time.  Matt's 
FormMail.pl script is one of the most popular scripts running on the 
web, and was designed to allow the HTML form to drive the Perl script.  
It has some huge glaring security holes in it which are well documented 
over the web, and widely abused by spammers -- you might want to 
read-up on it before walking down the same path.

The way I see it, you have the same problem -- the HTML form is driving 
the PHP script, rather than the other way around.  If it was me, and I 
wanted everything locked down as much as possible, I'd keep a PHP array 
for each form which describes the expected fields and what sort of 
values are expected (like limiting the number of characters).

If you don't want the form author to have to write PHP arrays, then 
you'd need a bad-ass HTML parser which parsed the form to learn what 
was expected and allowed -- lots of work though.

If the HTML writer can be bothered writing a few lines of PHP, you 
could get a lot more secure.

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


[PHP] Help! No output from PHP CLI

2004-10-19 Thread Warren Guy
Hi all,
I'm having a strange problem with command line PHP. Scripts seem to 
function fine, however with no output.

[EMAIL PROTECTED]:~ php
? echo moocows\n; ?
^D
[EMAIL PROTECTED]:~
However works fine on another machine with a seemingly identical php.ini
[EMAIL PROTECTED]:~ php
? echo moocows\n; ?
^D
moocows
[EMAIL PROTECTED]:~
Any ideas or suggestions greatly appreciated.
Regards,
--
Warren Guy [EMAIL PROTECTED]
System Administrator, Family Health Network
Phone: +61 8 9389 8777 Fax: +61 8 9389 8444
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP] Reverse (or backward?) Infinity Loop

2004-10-19 Thread trenton
This does not generate the exact look you are asking for, but can easily
be modified by changing the dashes to spaces etc.  I also left my naming
convention in, so that would have to be altered to your fields as well. 
It may not be the cleanest code, but it does work.

?php
$query = SELECT * FROM categories WHERE ca_caidParent = 0;
$result = mysql_query($query);
while ($row = mysql_fetch_object($result)) {
 recursive($row-ca_caid,$row-ca_category,0,1);
}

function recursive ($id,$element,$tabs,$y) {
$dashes = str_repeat(---, $tabs);
echo $dashes$element\n;
$result = result$y;
$row = row$y;
$$query = SELECT * FROM categories WHERE ca_caidParent='$id';
$$result = mysql_query($$query);
while ($$row = mysql_fetch_object($$result)) {
$tabs++;
$y++;
recursive($$row-ca_caid,$$row-ca_category,$tabs,$y);
$tabs--;
$y--;
$result = result$y;
$row = row$y;
}
}

?

Trenton

-Original Message-
From: Bruno B B Magalhães [mailto:[EMAIL PROTECTED]
Sent: Tuesday, October 19, 2004 8:47 PM
To: [EMAIL PROTECTED]; php-db
Subject: [PHP] Reverse (or backward?) Infinity Loop

Hi guys,

I have a normal categories table:

catId
catParentId
catName
catStatus

But I want when a user enters on:

http://hostname/site/products/catId1/catId7/catId13/../../contentId.html

A listing should apear like that:

• Category 1
  • Category 7
   • Category 13
• Category 2
• Category 3
• Category 4
• Category 5


A reverse (or backward) loop! We need to get the last category and then
follow the ParentId until the 0 ParentId. Have anybody made this before
(I hope so)?

Many Thanks,
Bruno B B Magalhaes

-- 
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] Re: Help! No output from PHP CLI

2004-10-19 Thread Warren Guy
Warren Guy wrote:
Hi all
Probably should mention we are running PHP 4.3.7
--
Warren Guy [EMAIL PROTECTED]
System Administrator, Family Health Network
Phone: +61 8 9389 8777 Fax: +61 8 9389 8444
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Help! No output from PHP CLI

2004-10-19 Thread Matthew Sims
 Hi all,

 I'm having a strange problem with command line PHP. Scripts seem to
 function fine, however with no output.

 [EMAIL PROTECTED]:~ php
 ? echo moocows\n; ?
 ^D
 [EMAIL PROTECTED]:~

 However works fine on another machine with a seemingly identical php.ini

 [EMAIL PROTECTED]:~ php
 ? echo moocows\n; ?
 ^D
 moocows
 [EMAIL PROTECTED]:~

 Any ideas or suggestions greatly appreciated.

 Regards,

 --
 Warren Guy [EMAIL PROTECTED]
 System Administrator, Family Health Network
 Phone: +61 8 9389 8777 Fax: +61 8 9389 8444

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




Isn't there a --enable-cli option when compiling PHP for command line? If
so, was that included as part of the install?

I saw this site:
http://www.devarticles.com/c/a/PHP/PHP-CLI-and-Cron

-- 
--Matthew Sims
--http://killermookie.org

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



Re: [PHP] Mixing classes

2004-10-19 Thread Tomi Kaistila
Hi!
A good idea, which I have used for some classes, like the Journal class 
(error handling) which fits in with the Core class. Unfortunantly I have 
too many classes to make them all into a chain of child classes. And 
also I have an ambition to write these classes in sorta seperate tools, 
which I can then use in other projects with no altering of the code.

The database (mysql) class is such a class, which is in use in almost 
every project I work at.

Would it be possible to create a member variable to a class on the fly, 
without specifically creating it when you write the class? Something 
like this:

?php
class MyClass {
var $MemberVar1 = ;
var $MemberVar1 = ;
function MyClass() {
//constructor
}
function MkMemVar($newmemvar, $memvarval) {
$this-newmemvar = $memvarval;
// this is just an example, don't know it would actually be done so
// but you get the idea: the $newmemvar would be the name of the new
// member variable and $memvarval would be the value for the new
// member variable.
}
?
Or could it even be possible to do this outside of a class? So that I 
wouldn't have to specify a seperate function for it in my classes?

This way I could make an instance of another class inside any class on 
the need-bases and it would solve my problem. Is there anyway to 
accomplish this? I couldn't find any immediately solution by looking at 
the php manual, but it doesn't mean it's not there.

Davy Obdam wrote:
Hi
Maybe you could make most class childs of the Core class... well at 
least the classes that need values from you config file.

class Database extends Core
{
 
}

}
I dont know if this is gonna work in your set up, but since this Core 
class reads the config file, now you can just creat an object from the 
database class anywhere and alread have those variables available.

Best regards,
Davy
Tomi Kaistila wrote:
Hi!
Thanks for the idea, hadn't actually thought of it that way. I had 
thought of passing objects (instance the db object to the auth object) 
by reference, but when thinking that while one class might only need 
the help of one other class, another class might need the help of four 
classes. Would make the constructor look a bit ugly.

The approuch you suggest is good, for most of the classes. For 
example, although I create an instance of the db class on the web 
site, it doesn't harm to create another inside the auth class. But 
there are some classes that are not suited to be created that way. For 
example, the Core class, which for one thing, reads the configuration 
file from the include path and sets a load of values which each class 
should then use. For example, the db class needs values such as the 
username, password, hostname, port, etc. It wouldn't be advisable read 
the configuration file more than once.

I'm not sure, but could an instance of a class be pass as reference 
with the Global keyword? Like so;

?php
class auth {
var $dbObject = ;
function auth () {
//Create an instance of you database class
global $dbobject;
$this-dbObject = $dbobject;
}
function doSomething() {
// Execute a query
$this-dbObject-query($sql);
}
}
?
Davy Obdam wrote:

Hi Tomi,
You could create an object of the Database class in your Auth class 
like this and then use your Datebase class with your Auth class:

?php
require_once(Database/Database.php);
class Auth
{
var $dbObject = ;
function Auth ()
{
   //Create an instance of you database class
   $this-dbObject = new Database($arg1, $arg2, $etc);
}
function doSomething()
{
   // Execute a query
   $this-dbObject-query($sql);
  }
}
?
I hope this helps
Best regards,
Davy Obdam
Tomi Kaistila wrote:
Hey!
I've written several general classes, much as tools. One manages 
databases, one authenticates users, etc. I'm trying to bring all of 
these together into one sorta like a CMS, but the problem is that I 
can't find a way to have the different classes take advantage of 
each other; for example, a function in the auth class needs to 
contact the database, so it needs the query() function from the 
database class, but the objects are created on the index.php and as 
such are not in the scope of the functions in the classes.

Would anyone have any ideas or suggestions how to solve this issue? 
I've looked for a solution for some time now, to no result.

My PHP version is 4.3.8.



--
developer  programmer
me tomi kaistila
home http://www.datamike.org
gnupg 0xFA63E4C7
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Mixing classes

2004-10-19 Thread Thomas Goyne
On Wed, 20 Oct 2004 08:09:53 +0300, Tomi Kaistila  
[EMAIL PROTECTED] wrote:

Hi!
A good idea, which I have used for some classes, like the Journal class  
(error handling) which fits in with the Core class. Unfortunantly I have  
too many classes to make them all into a chain of child classes. And  
also I have an ambition to write these classes in sorta seperate tools,  
which I can then use in other projects with no altering of the code.

The database (mysql) class is such a class, which is in use in almost  
every project I work at.

Would it be possible to create a member variable to a class on the fly,  
without specifically creating it when you write the class? Something  
like this:

?php
class MyClass {
 var $MemberVar1 = ;
 var $MemberVar1 = ;
function MyClass() {
 //constructor
}
function MkMemVar($newmemvar, $memvarval) {
 $this-newmemvar = $memvarval;
 // this is just an example, don't know it would actually be done so
 // but you get the idea: the $newmemvar would be the name of the new
 // member variable and $memvarval would be the value for the new
 // member variable.
}
?
Or could it even be possible to do this outside of a class? So that I  
wouldn't have to specify a seperate function for it in my classes?

This way I could make an instance of another class inside any class on  
the need-bases and it would solve my problem. Is there anyway to  
accomplish this? I couldn't find any immediately solution by looking at  
the php manual, but it doesn't mean it's not there.


http://www.phppatterns.com/index.php/article/articleview/6/1/1/
The approach I generally take is to have a factory class store the  
singleton instance of each class which may need to be called by others,  
and create a reference to each needed class in the constructor.  E.g.

class DBase {
function getUser($UserID) { return new User; }
}
class Output {
function displayStr($str) { echo $str; }
}
class Factory {
function getDbase() {
static $instance;
if(!isset($instance))
$instance = new DBase;
return $instance;
}
function getOutput() {
static $instance;
if(!isset($instance))
$instance = new Output;
return $instance;
}
}
class DoStuff {
private $db;
private $out;
function __constructor() {
$db = Factory::getDbase();
$out = Factory::getOutput();
}
function doStuff() {
$out-displayStr($db-getUser(0)-Name);
}
}
--
Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/
http://www.smempire.org
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Mixing classes

2004-10-19 Thread M. Sokolewicz
Thomas Goyne wrote:
On Wed, 20 Oct 2004 08:09:53 +0300, Tomi Kaistila  
[EMAIL PROTECTED] wrote:

Hi!
A good idea, which I have used for some classes, like the Journal 
class  (error handling) which fits in with the Core class. 
Unfortunantly I have  too many classes to make them all into a chain 
of child classes. And  also I have an ambition to write these classes 
in sorta seperate tools,  which I can then use in other projects with 
no altering of the code.

The database (mysql) class is such a class, which is in use in almost  
every project I work at.

Would it be possible to create a member variable to a class on the 
fly,  without specifically creating it when you write the class? 
Something  like this:

?php
class MyClass {
 var $MemberVar1 = ;
 var $MemberVar1 = ;
function MyClass() {
 //constructor
}
function MkMemVar($newmemvar, $memvarval) {
 $this-newmemvar = $memvarval;
 // this is just an example, don't know it would actually be done so
 // but you get the idea: the $newmemvar would be the name of the new
 // member variable and $memvarval would be the value for the new
 // member variable.
}
?
possible.
Or could it even be possible to do this outside of a class? So that I  
yes, that is possible.
wouldn't have to specify a seperate function for it in my classes?

This way I could make an instance of another class inside any class 
on  the need-bases and it would solve my problem. Is there anyway to  
accomplish this? I couldn't find any immediately solution by looking 
at  the php manual, but it doesn't mean it's not there.


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