[PHP] call function as variable

2003-08-15 Thread adam
Hi!

I have folowing function which they are a member in a class.

function foo(){
something
}
function zoo(){
something else
}
and i have a array such:

$test = array(1=>foo,2=zoo);

and i want to call the fuction foo() and zoo something like;

$object->$test[1]();

I have tried this this, it will not working. But is there any other way 
to do something like this!!

cheers

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


[PHP] test

2003-08-15 Thread adam
tst

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


Re: [PHP] How to get data from database with a click

2003-08-15 Thread Viraj Kalinga Abayarathna
try java scripts, there is a function called "onChange()", you can attach
this
with your combo box and can submit (SELF) the form upon the content change
in
combobox.

I have done this long time back, i'll send you the coding if still i have
that script in my
archives.

Viraj

- Original Message -
From: Subodh Gupta <[EMAIL PROTECTED]>
To: PHP General <[EMAIL PROTECTED]>
Sent: Friday, August 15, 2003 2:04 PM
Subject: [PHP] How to get data from database with a click


> Dear Friends,
>
> When we click a combo box, in a perticular file, the output from the
> database should display in the same screen, in a text box or a combo box
(We
> want this to happen without pressing the submit button).
>
> Any clue please
>
> Subodh
>
> -Original Message-
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
> Sent: Friday, August 15, 2003 1:27 PM
> To: [EMAIL PROTECTED]
> Subject: Re: [PHP] php, search engine that index via local filesystem?
>
>
> Hi,
>
> Do you want to provide a web interface to your local file system? well
> the easiest would then be to just exec locate, which will make use of
> the slocate db. Alternatively you can try to exec find. These can be
> done painlessly and you don't have to install any software.
>
> If you need a more sophisticated solution i belive htdig has the
> facility to index from local files.
>
> If you are looking to build a full fledged search engine aspseek and
> mnogosearch (both open source) are some of the best around.
>
> all the best
>
>
> Louie Miranda wrote:
>
> >Do you know any?
> >
> >
> >--- -
> >Thanks,
> >Louie Miranda
> >
> >
> >
> >
> >
> >
> >
>
>
> --
>
> Raditha Dissanayake
> -
> http://www.radinks.com/sftp/
> Lean and mean Secure FTP applet with Graphical User Inteface.
> just 150 Kilo Bytes
>
>
>
> --
> 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] How to write my own php extensions

2003-08-15 Thread Dennis Lee
Hi all :

I want to write my own php extensions , but I don't know how to start .

Please tell me where I can find some examples or resources such as tutorials
.

Thanks in advance .



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



Re: [PHP] How to write my own php extensions

2003-08-15 Thread [EMAIL PROTECTED]
There are some documents in the php source tarball itself. this is a 
good starting point. Then please goto zend.com you will see some 
fantastic articles.

all the best

Dennis Lee wrote:

Hi all :

I want to write my own php extensions , but I don't know how to start .

Please tell me where I can find some examples or resources such as tutorials
.
Thanks in advance .



 

--

Raditha Dissanayake
-
http://www.radinks.com/sftp/
Lean and mean Secure FTP applet with Graphical User Inteface.
just 150 Kilo Bytes


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


Re: [PHP] HOW DO U SPLIT UP LARGE STRINGS?

2003-08-15 Thread John Ryan
well, it must be big as it says 'mysql server gone away'

i cant open the file from mysql, i need to edit a few things each line. i
suppose i could open it, then save it to disk and then run that mysql
command

"[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> hello,
> you can use the split() method to break this up into pieces. Unless you
> are doing a large number of inserts on tables with several keys mysql
> will not be troubled too much by the number of queries you run.
>
>
> John Ryan wrote:
>
> >I've a string with a huge mySQL query, seperated by a semi-colon and then
> >line-break. You can't run this query staright to mySQL (and i dont want
to
> >try), so Im trying to split up the query into, say, 100 mysql commands at
a
> >time.
> >
> >Is it possible to split up a string every 100 semi-colons it finds??
> >
> >I input this string from a text file through fopen while(fgets)? Is it
> >easier to just read 100 lines at a time, run a query, and then read
another
> >100 lines from the text file?
> >
> >TIA
> >
> >
> >
> >
> >
>
>
> --
>
> Raditha Dissanayake
> -
> http://www.radinks.com/sftp/
> Lean and mean Secure FTP applet with Graphical User Inteface.
> just 150 Kilo Bytes
>
>



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



Re: [PHP] HOW DO U SPLIT UP LARGE STRINGS?

2003-08-15 Thread John W. Holmes
John Ryan wrote:

I've a string with a huge mySQL query, seperated by a semi-colon and then
line-break. You can't run this query staright to mySQL (and i dont want to
try), so Im trying to split up the query into, say, 100 mysql commands at a
time.
Is it possible to split up a string every 100 semi-colons it finds??

I input this string from a text file through fopen while(fgets)? Is it
easier to just read 100 lines at a time, run a query, and then read another
100 lines from the text file?
Maybe you should be using the LOAD_FILE() function in your query?

Quote:
LOAD_FILE(file_name)
Reads the file and returns the file contents as a string. The file 
must be on the server, you must specify the full pathname to the file, 
and you must have the FILE privilege. The file must be readable by all 
and be smaller than max_allowed_packet. If the file doesn't exist or 
can't be read due to one of the above reasons, the function returns NULL:

mysql> UPDATE tbl_name
   SET blob_column=LOAD_FILE("/tmp/picture")
   WHERE id=1;
--
---John Holmes...
Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/

PHP|Architect: A magazine for PHP Professionals – www.phparch.com





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


Re: [PHP] HOW DO U SPLIT UP LARGE STRINGS?

2003-08-15 Thread [EMAIL PROTECTED]
hello,
you can use the split() method to break this up into pieces. Unless you 
are doing a large number of inserts on tables with several keys mysql 
will not be troubled too much by the number of queries you run.

John Ryan wrote:

I've a string with a huge mySQL query, seperated by a semi-colon and then
line-break. You can't run this query staright to mySQL (and i dont want to
try), so Im trying to split up the query into, say, 100 mysql commands at a
time.
Is it possible to split up a string every 100 semi-colons it finds??

I input this string from a text file through fopen while(fgets)? Is it
easier to just read 100 lines at a time, run a query, and then read another
100 lines from the text file?
TIA



 



--

Raditha Dissanayake
-
http://www.radinks.com/sftp/
Lean and mean Secure FTP applet with Graphical User Inteface.
just 150 Kilo Bytes


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


[PHP] HOW DO U SPLIT UP LARGE STRINGS?

2003-08-15 Thread John Ryan
I've a string with a huge mySQL query, seperated by a semi-colon and then
line-break. You can't run this query staright to mySQL (and i dont want to
try), so Im trying to split up the query into, say, 100 mysql commands at a
time.

Is it possible to split up a string every 100 semi-colons it finds??

I input this string from a text file through fopen while(fgets)? Is it
easier to just read 100 lines at a time, run a query, and then read another
100 lines from the text file?

TIA



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



Re: [PHP] mysql_num_rows

2003-08-15 Thread John W. Holmes
John Taylor-Johnston wrote:

My question got buried on the bottom of the thread. Sorry for the repeat. I'm getting this message:

Warning: Supplied argument is not a valid MySQL result resource in /.../testals.php on line 189
Read with me. Supplied argument ($news) is not a valid MySQL result 
resource.

189>  if (mysql_num_rows($news) == 1)

Ideas?

$server = "localhost";
$user = "";
$pass = "";
$db = "redwards";
$table = "testals";
$myconnection = mysql_connect($server,$user,$pass);
mysql_select_db($db,$myconnection);
$news = mysql_query("select StudentId from $table where
StudentID = $StudentID");
$news is not valid, therefore your query failed. Use mysql_error() to 
find out why.

--
---John Holmes...
Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/

PHP|Architect: A 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] mysql_num_rows

2003-08-15 Thread John Taylor-Johnston
My question got buried on the bottom of the thread. Sorry for the repeat. I'm getting 
this message:

Warning: Supplied argument is not a valid MySQL result resource in /.../testals.php on 
line 189

189>  if (mysql_num_rows($news) == 1)

Ideas?

$server = "localhost";
$user = "";
$pass = "";
$db = "redwards";
$table = "testals";

$myconnection = mysql_connect($server,$user,$pass);
mysql_select_db($db,$myconnection);

$news = mysql_query("select StudentId from $table where
StudentID = $StudentID");

 if (mysql_num_rows($news) == 1)
  include ("./html/access_error.htm");
 else
  include ("./html/registration.htm");



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



[PHP] Installing How-To

2003-08-15 Thread Rodney Davis
Does anyone know of a good howto on installing php w/ GD and phplib etc on a
Redhat box?

Thanks,
Rodney


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



RE: [PHP] executing a shell command within a function

2003-08-15 Thread Mike Brum
Why don't you try to use mkdir() instead of shell commands?

http://us2.php.net/manual/en/function.mkdir.php

-M

-Original Message-
From: Sævar Öfjörð [mailto:[EMAIL PROTECTED] 
Sent: Friday, August 15, 2003 8:19 PM
To: [EMAIL PROTECTED]
Subject: [PHP] executing a shell command within a function


Hi,

I’m coding a function that will create a set of directories using execution
of shell commands within the function. Then the function saves different
sizes of images in each directory. Later in the function I open one of these
directories to list the content in them. The problem is that the directoris
don’t exist when the function is trying to list the content in them. When I
execute the function again with exactly the same parameters there is no
problem, then the directories exist!

I’m thinking that the shell commands are somehow set in some kind of buffer
or queue and are not executed until the rest of the php code is executed?
Could this be true? If anyone has anything to say on this I’d appreciate it.

BTW I'm using RH8.0 and PHP 4.2.2
 
Kveðja,
Sævar Öfjörð
[EMAIL PROTECTED]
þetta reddast - hönnunarlausnir
www.reddast.is



-- 
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] executing a shell command within a function

2003-08-15 Thread Sævar Öfjörð
Hi,

I’m coding a function that will create a set of directories using
execution of shell commands within the function. Then the function saves
different sizes of images in each directory. Later in the function I
open one of these directories to list the content in them. The problem
is that the directoris don’t exist when the function is trying to list
the content in them. When I execute the function again with exactly the
same parameters there is no problem, then the directories exist!

I’m thinking that the shell commands are somehow set in some kind of
buffer or queue and are not executed until the rest of the php code is
executed?
Could this be true? If anyone has anything to say on this I’d appreciate
it.

BTW I'm using RH8.0 and PHP 4.2.2
 
Kveðja,
Sævar Öfjörð
[EMAIL PROTECTED]
þetta reddast - hönnunarlausnir
www.reddast.is



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



RE: [PHP] Bug in Ereg?

2003-08-15 Thread Wouter van Vliet
ow .. this script won't work ..

checkboxes like this:


or var calling like this:
$_POST['checkbox']['colors']

would do better ;) of course :D:D

-Oorspronkelijk bericht-
Van: Wouter van Vliet [mailto:[EMAIL PROTECTED]
Verzonden: zaterdag 16 augustus 2003 1:06
Aan: Kris Yates; [EMAIL PROTECTED]
Onderwerp: RE: [PHP] Bug in Ereg?


Hope I can be of any help again .. what you are doing seems rather
complicated... what if you have your checkboxes like:





and the recieving script just doing:

if (isset($_POST['colors']) && is_array($_POST['colors'])) $colors =
join(':', $_POST['colors']);

PHP will only register indexes in the $_POST['colors'] array for the boxes
that are checked, all your colors are in one array, so one simple join would
do the trick .. won't it? The if in front of it is just to prevent any
"undefined index" notices .. might you have E_ALL set as error level.

.. wait .. getting a message .. yeah, there's a better way

$colors = (isset($_POST['colors']) && is_array($_POST['colors'])) ? $colors
= join(':', $_POST['colors']) : '';

now your $colors variable will always be set with a string value.

Grtz,
Wouter

Ps. anybody knows when syntax highlighting is gonna be an option in MS
Outlook? Would be neat, wouldn't it?

-Oorspronkelijk bericht-
Van: Kris Yates [mailto:[EMAIL PROTECTED]
Verzonden: vrijdag 15 augustus 2003 23:53
Aan: [EMAIL PROTECTED]
Onderwerp: [PHP] Bug in Ereg?


Hi,

I have a form with checkboxes that POSTs to a PHP script.

What is posted [ from phpinfo() ]:

_POST["color-1"]on
_POST["color-4"]on
_POST["color-6"]on


Parser:
foreach($_POST as $ThisVar=>$ThisVal){
if(ereg("color-", $ThisVar) AND $ThisVal=="on" OR $ThisVal==1){
$newVarA=explode("-", $ThisVar);
$colors.="$newVarA[1]:";
}
}

Expected Output:

$colors="1:4:6:";

Real Output:

$colors=":1:4:6:";

I can work with the output I am getting, however, I am curious why I am
not getting the "expected output".  Can anyone shed light on this?  I am
using PHP 4.3.2 compiled under a unix environment.  Is this a bug in
ereg or am I just not seeing something obvious in my foreach?

Thanks,

Kris



--
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] Bug in Ereg?

2003-08-15 Thread Wouter van Vliet
Hope I can be of any help again .. what you are doing seems rather
complicated... what if you have your checkboxes like:





and the recieving script just doing:

if (isset($_POST['colors']) && is_array($_POST['colors'])) $colors =
join(':', $_POST['colors']);

PHP will only register indexes in the $_POST['colors'] array for the boxes
that are checked, all your colors are in one array, so one simple join would
do the trick .. won't it? The if in front of it is just to prevent any
"undefined index" notices .. might you have E_ALL set as error level.

.. wait .. getting a message .. yeah, there's a better way

$colors = (isset($_POST['colors']) && is_array($_POST['colors'])) ? $colors
= join(':', $_POST['colors']) : '';

now your $colors variable will always be set with a string value.

Grtz,
Wouter

Ps. anybody knows when syntax highlighting is gonna be an option in MS
Outlook? Would be neat, wouldn't it?

-Oorspronkelijk bericht-
Van: Kris Yates [mailto:[EMAIL PROTECTED]
Verzonden: vrijdag 15 augustus 2003 23:53
Aan: [EMAIL PROTECTED]
Onderwerp: [PHP] Bug in Ereg?


Hi,

I have a form with checkboxes that POSTs to a PHP script.

What is posted [ from phpinfo() ]:

_POST["color-1"]on
_POST["color-4"]on
_POST["color-6"]on


Parser:
foreach($_POST as $ThisVar=>$ThisVal){
if(ereg("color-", $ThisVar) AND $ThisVal=="on" OR $ThisVal==1){
$newVarA=explode("-", $ThisVar);
$colors.="$newVarA[1]:";
}
}

Expected Output:

$colors="1:4:6:";

Real Output:

$colors=":1:4:6:";

I can work with the output I am getting, however, I am curious why I am
not getting the "expected output".  Can anyone shed light on this?  I am
using PHP 4.3.2 compiled under a unix environment.  Is this a bug in
ereg or am I just not seeing something obvious in my foreach?

Thanks,

Kris



--
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] Bug in Ereg?

2003-08-15 Thread Marek Kilimajer
Kris Yates wrote:
   if(ereg("color-", $ThisVar) AND $ThisVal=="on" OR $ThisVal==1){
this condition reads
if( (ereg("color-", $ThisVar) AND $ThisVal=="on") OR $ThisVal==1)
It is called operator precedence.
www.php.net/manual/en/language.operators.html#language.operators.precedence
You have POST var with value of 1 somewhere before.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] If you ever had a Vic20

2003-08-15 Thread John Taylor-Johnston
:) Tried that:

Warning: Supplied argument is not a valid MySQL result resource in /.../testals.php on 
line 189
189>  if (mysql_num_rows($news) == 1)
John

> Matt> mysql_num_rows($news)

$server = "localhost";
$user = "";
$pass = "";
$db = "redwards";
$table = "testals";

$myconnection = mysql_connect($server,$user,$pass);
mysql_select_db($db,$myconnection);

$news = mysql_query("select StudentId from $table where StudentID = $StudentID");

 if (mysql_num_rows($news) == 1)
  include ("./html/access_error.htm");
 else
  include ("./html/registration.htm");



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



Re: [PHP] Bug in Ereg?

2003-08-15 Thread Curt Zirzow
* Thus wrote Kris Yates ([EMAIL PROTECTED]):
> Hi,
> 
> I have a form with checkboxes that POSTs to a PHP script.
> 
> What is posted [ from phpinfo() ]:
> 
> _POST["color-1"]  on
> _POST["color-4"]  on
> _POST["color-6"]  on

There is more post data than this.

> 
> 
> Parser:
>foreach($_POST as $ThisVar=>$ThisVal){
>if(ereg("color-", $ThisVar) AND $ThisVal=="on" OR $ThisVal==1){
>$newVarA=explode("-", $ThisVar);
>$colors.="$newVarA[1]:";
>}
>}

Your logic, as jennifer pointed, isn't probably what your
expecting. You're POST data has a value of 1 somewhere.

Also, ereg is very expensive for doing exact string matches like
you are doing there, best to use the str* functions avaible to do
tasks like this.  ie:

if ('color-' == substr($ThisVar, 0, 6))
 
And then no need to explode into an array and then extract the
value (more overhead).. since the format is known you can do
something like:

$colors .= substr($ThisVar, 6);

HTH,

Curt
-- 
"I used to think I was indecisive, but now I'm not so sure."

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



RE: [PHP] Bug in Ereg?

2003-08-15 Thread Jennifer Goodie
> What is posted [ from phpinfo() ]:
>
> _POST["color-1"]  on
> _POST["color-4"]  on
> _POST["color-6"]  on
>
>
> Parser:
> foreach($_POST as $ThisVar=>$ThisVal){
> if(ereg("color-", $ThisVar) AND $ThisVal=="on" OR $ThisVal==1){
> $newVarA=explode("-", $ThisVar);
> $colors.="$newVarA[1]:";
> }
> }
>
> Expected Output:
>
> $colors="1:4:6:";
>
> Real Output:
>
> $colors=":1:4:6:";

Do you have anything else in _POST that's equal to 1?  I didn't look up
order of operation, so I may be off here, but your if condition might not be
doing what you are expecting.  Try using parentheses to group it like this
if(ereg("color-", $ThisVar) AND ($ThisVal=="on" OR $ThisVal==1)){  (I'm
guessing that's what you want).  Why are you using ereg anyway?  You're not
using a regular expression so strstr would work just as well and be slightly
faster.


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



Re: [PHP] Bug in Ereg?

2003-08-15 Thread Kris Yates
Just an addendum..   My parser has $colors=""; right before the foreach 
loop.

Kris Yates wrote:

Hi,

I have a form with checkboxes that POSTs to a PHP script.

What is posted [ from phpinfo() ]:

_POST["color-1"] on
_POST["color-4"] on
_POST["color-6"] on
Parser:
   foreach($_POST as $ThisVar=>$ThisVal){
   if(ereg("color-", $ThisVar) AND $ThisVal=="on" OR $ThisVal==1){
   $newVarA=explode("-", $ThisVar);
   $colors.="$newVarA[1]:";
   }
   }
Expected Output:

$colors="1:4:6:";

Real Output:

$colors=":1:4:6:";

I can work with the output I am getting, however, I am curious why I 
am not getting the "expected output".  Can anyone shed light on this?  
I am using PHP 4.3.2 compiled under a unix environment.  Is this a bug 
in ereg or am I just not seeing something obvious in my foreach?

Thanks,

Kris





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


[PHP] Bug in Ereg?

2003-08-15 Thread Kris Yates
Hi,

I have a form with checkboxes that POSTs to a PHP script.

What is posted [ from phpinfo() ]:

_POST["color-1"]  on
_POST["color-4"]  on
_POST["color-6"]  on
Parser:
   foreach($_POST as $ThisVar=>$ThisVal){
   if(ereg("color-", $ThisVar) AND $ThisVal=="on" OR $ThisVal==1){
   $newVarA=explode("-", $ThisVar);
   $colors.="$newVarA[1]:";
   }
   }
Expected Output:

$colors="1:4:6:";

Real Output:

$colors=":1:4:6:";

I can work with the output I am getting, however, I am curious why I am 
not getting the "expected output".  Can anyone shed light on this?  I am 
using PHP 4.3.2 compiled under a unix environment.  Is this a bug in 
ereg or am I just not seeing something obvious in my foreach?

Thanks,

Kris



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


Re: [PHP] If you ever had a Vic20

2003-08-15 Thread Matt Babineau
mysql_num_rows($news)

On Fri, 2003-08-15 at 17:42, John Taylor-Johnston wrote:
> OK,
> I tried this, but am getting this error:
> Warning:  Wrong parameter count for mysql_num_rows() in /.../testals.php on line 189
> 189> if (mysql_num_rows() == 1)
> What's up?
> John
> 
> $myconnection = mysql_connect($server,$user,$pass);
> mysql_select_db($db,$myconnection);
> 
> $news = mysql_query("select StudentId from $table where StudentID = $StudentID");
> 
>  if (mysql_num_rows() == 1)
>   include ("./html/access_error.htm");
>  else
>   include ("./html/registration.htm");
> 
> 
> 


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



Re: [PHP] If you ever had a Vic20

2003-08-15 Thread John Taylor-Johnston
> I had a Vic20 sitting next to a Lisa... :)

The debate in them days was whether a timex-simplex would outlast. Commodore sold a 
lot but never went anywhere past high school labs. I knew a guy with a PC who laughed 
at every else. Funny how things turned out.



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



Re: [PHP] If you ever had a Vic20

2003-08-15 Thread John Taylor-Johnston
OK,
I tried this, but am getting this error:
Warning:  Wrong parameter count for mysql_num_rows() in /.../testals.php on line 189
189> if (mysql_num_rows() == 1)
What's up?
John

$myconnection = mysql_connect($server,$user,$pass);
mysql_select_db($db,$myconnection);

$news = mysql_query("select StudentId from $table where StudentID = $StudentID");

 if (mysql_num_rows() == 1)
  include ("./html/access_error.htm");
 else
  include ("./html/registration.htm");




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



[PHP] Re: Foreach POST VARS problem

2003-08-15 Thread Catalin Trifu
btw! if you use it inside a function, you need
to declare it as global!

Catalin

> Are you sure the data is posted from HTML
> through POST ? try adding the lines below:
>
> > $colors="";
> if(is_array($HTTP_POST_VARS) && !empty($HTTP_POST_VARS )) {
> > foreach($HTTP_POST_VARS as $ThisVar=>$ThisVal){
> > if(ereg("color-", $ThisVar) AND $ThisVal=="on" OR $ThisVal==1){
> > $newVarA=explode("-", $ThisVar);
> > $colors.="$newVarA[1]:";
> > }
> > }
> }
>
> Catalin
>
>



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



Re: [PHP] Foreach POST VARS problem

2003-08-15 Thread Curt Zirzow
* Thus wrote Kris Yates ([EMAIL PROTECTED]):
>
>foreach($HTTP_POST_VARS as $ThisVar=>$ThisVal){
> 
> ...
>
> *Warning*: Invalid argument supplied for foreach() in 
> */devda1/htdocs/2binteractive.com/htdocs/0new/content/lanskyShopAdmin.php* 
> on line 2
> 
> I guess I just need to know what this variable name has been changed 
> to.  I searched the PHP.NET manual for $HTTP_POST_VARS and got no results.
> 

$_POST;

Also it is now a superglobal in php 4.3 and doesn't need to be
global'ed inside of functions.


Curt
-- 
"I used to think I was indecisive, but now I'm not so sure."

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



[PHP] Re: Foreach POST VARS problem

2003-08-15 Thread Catalin Trifu
hi,

Are you sure the data is posted from HTML
through POST ? try adding the lines below:

> $colors="";
if(is_array($HTTP_POST_VARS) && !empty($HTTP_POST_VARS )) {
> foreach($HTTP_POST_VARS as $ThisVar=>$ThisVal){
> if(ereg("color-", $ThisVar) AND $ThisVal=="on" OR $ThisVal==1){
> $newVarA=explode("-", $ThisVar);
> $colors.="$newVarA[1]:";
> }
> }
}

Catalin



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



Re: [PHP] Segmentation Fault

2003-08-15 Thread Curt Zirzow
* Thus wrote Jackson Miller ([EMAIL PROTECTED]):
> I am running a PHP script from the command line that is returning 
> "Segmentation Fault".  I run a lot of script from the command line and have 
> never seen this before.  I don't even know where to begin.

http://bugs.php.net/how-to-report.php

> 
> I know that PHP is set up to run scripts from the command line and plent of 
> other scripts run.
> 
> This particular script is not doing anything out of the ordinary.  It is 
> opening a database connection, opening a .csv file and inserting rows into 
> the database.  How in the world could this Seg Fault?

Obtain a backtrace of the program (assuming your on unix):

Run gdb with php as the program:

> gdb /path/to/php


when the gdb prompt somes up type the word 'run' with the options
and filename you would normally would pass to php:

(gdb) run [options] phpfile.php

Once it finishes with your crash then type 'bt':

(gdb) bt


To kinda understand what this all means you can read this
documentation under 'Locating which function call cases fault':

http://bugs.php.net/bugs-generating-backtrace.php


HTH,

Curt
-- 
"I used to think I was indecisive, but now I'm not so sure."

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



Re: [PHP] PCRE regexp bug ?

2003-08-15 Thread Curt Zirzow
* Thus wrote [EMAIL PROTECTED] ([EMAIL PROTECTED]):
> 
> I believe I spoke too soon.  If I use isset() then even if I leave the
> field empty it still returns true.  I am trying to view the documentation for
> this function but php.net seems to be timing out now.

> > if (isset($_POST[MI]) && (preg_match('/^[[:alpha:]]{1,1}$/', $_POST[MI]) == 0))


That is because the browser is sending in the POST data:
MI=

Thus, php does set it to ''.

Use something like this instead:

  if (strlen($_POST['MI'])) ...


btw, you should really quote your array keys.

HTH,


Curt
-- 
"I used to think I was indecisive, but now I'm not so sure."

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



Re: [PHP] PCRE regexp bug ?

2003-08-15 Thread tpc

I believe I spoke too soon.  If I use isset() then even if I leave the
field empty it still returns true.  I am trying to view the documentation for
this function but php.net seems to be timing out now.

On Fri, 15 Aug 2003 [EMAIL PROTECTED] wrote:

>
> Thank you.  I did the following:
>
> if (isset($_POST[MI]) && (preg_match('/^[[:alpha:]]{1,1}$/', $_POST[MI]) == 0))
>
> and zero is caught.
>
> On Fri, 15 Aug 2003, CPT John W. Holmes wrote:
>
> > From: <[EMAIL PROTECTED]>
> >
> > > I use preg_match to validate the Middle Initial field of a form and so far
> > > it works, except yesterday a user submitted a "0" (zero) as a middle
> > > initial!  My regexp is:
> > >
> > > if (!empty($_POST[MI]) && (preg_match('/^[[:alpha:]]{1,1}$/', $_POST[MI])
> > == 0))
> > >
> > > I tested it with 0-9 and my regexp catches every digit except 0.
> > Curious...
> >
> > empty("0") is going to be true. So, !empty("0") is going to be false, so you
> > won't "catch" the zero.
> >
> > ---John Holmes...
> >
> >
>
>


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



Re: [PHP] Function arguments

2003-08-15 Thread Jim Lucas
Most of my program functions use the first approach

I have what ever must be given because the nature of the functions only
exists because it does certain things.

I then have the last argurment passed be an array.  This will contain all
the data that I might want to use inside the function other then the
required fields.

for example I have a 'BOXTOP()' and 'BOXBOTTOM()' function set.

for the 'BOXTOP()' function I require the first argument but after that is
an array.

with this, I can customize the with of my box and if it isn't given it
defaults to a predefined with.

I can do the same thing with themes, colors, borders, cellpadding,
cellspacing, etc...

Then it will pass this same information to the corresponding 'BOXBOTTOM()'
function.

This keeps things very nice and clean.

inside the 'BOXTOP()' function is a mess, but once it is how you want it,
you will find that it is very easy to work with functions formated like
this.


Jim Lucas

- Original Message - 
From: "Hardik Doshi" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, August 15, 2003 8:53 AM
Subject: [PHP] Function arguments


> Hi Group,
>
> I have a question on overloaded function.
>
> What is the best way to pass the arguments so it is
> easy to maintain in future if function behaviour
> changes by adding/removing one or more arguments?
>
> Currently i am passing arguments in array. But i think
> it is not the clean way to do it and another approach
> i am using is functionName(arg1, arg2='', arg3='') but
> here again i think it is not easy to maintain.
>
> Please let me know if you guys have other options or
> improved version of above options.
>
> Thanks
>
> Hardik
>
> __
> Do you Yahoo!?
> Yahoo! SiteBuilder - Free, easy-to-use web site design software
> http://sitebuilder.yahoo.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] Screen Resoultion

2003-08-15 Thread Kris Yates
Chris W. Parker wrote:

Kris Yates 
   on Friday, August 15, 2003 11:55 AM said:
 

However, I also have a PHP program which you can run and edit the
source code for the program inside the program itself, hit render and
all of a sudden you are running the new version of the program. It is
so cool that it is just plain sick.  I use this methodology all the
time - every day, everyone loves it, and my fridge has good food in
it as a result.
   

Hhmmm... tell us more.



c.

 

Basically it is just a lean and mean content editor I wrote that saves 
anything (html, php, yada yada-you-name-it) to a database.  I use it 
inside an "environment framework" system I created which controls 
logging in and using the editor. So you go to the 'site', log in, and 
then you can run the editor and whatever other apps you have been given 
user-level access to.  Your access level also determines what content 
you can access.  Low level access users can edit only their own 
content.  "Super elite" users can view/edit all content of all users, 
and as well can edit the HTML/PHP, etc. of the site itself.   As "super 
user elite", you can also select the content editor and edit the source 
code (PHP) of the content editor.  Really, you can edit any application 
that is inside the environment framework system.  ...hmmm.. Based on a 
setting defined for each peice of content in the database, when you 
click 'render', some PHP files may be written to a specified file system 
while other content 'chunks' stay in the database and never rendered out 
as files.  These chunk files can but do not contain PHP... this is used 
for just content or referencing actual content chunks.. so I created a 
very basic macro psuedo language using PHP.. I call it metaChunk but I 
imagine the name may already be taken, otherwise this email acts as my 
copyright to that name according to the Berne Copyright convention.  :)  
LOL ... An example of a content 'chunk' as seen in the editor (just an 
example that does not *really* exist - just typing junk from my head 
that would parse):

Hello !!$:varuser!!
You have logged in !!$:logins!! times
!!displayChunk:menu.js!!
!!displayChunk:userscreen!!
!!includefile:funk.php!!
The output is of course an HTML document that the end-user sees in ye 
olde browser.

This is all a couple of years old and since then I have found others 
that have developed similar things.. lots of CMS systems and macro 
languages.  someone said my metaChunk psuedo lang looks like 
"struts", which I have yet to see for myself or bother to read about.  
So Chunks can include and run PHP, display and render other chunks, and 
display variables.  One day I may expand it.  I'd like to release all 
this to open source but I just cant afford to do that yet, and a 
contract with my employer is another deterent.  I am guessing others out 
there are in the same boat.  I have been PHP'ing since late 98 but 
working on this stuff specifically since 2k.  In my 3 years of 
developing this stuff, I have made a point to not examine open source 
code so as to keep everything 'original'.  I am just an old school 
programmer/ex hacker from the 80's that refuses to rip others off as I 
have already been ripped off a time or two in the past both in the music 
biz and the technology biz, including *major* media companies to say the 
least

If you were to put  inside the database as a 
content 'chunk', it will just display the PHP to the web-browser instead 
of actually executing the code.  All in all this whole deal just makes 
my life easier since I dont need my users being able to exec any code.

Just FYI, this project started in late 2000 after my return from Los 
Angeles where I was recording at Paramount.  I bought a Commodore 64 SX 
at a yard sale for $5.00 US.  I got a copy of CNET 10.0 BBS out of a 
dusty old box and set it up for fun.  It became my reference point for 
the first few months to create a BBS like system for the web which was 
similar to the old days of BBS, unlike the majority of BBS type systems 
on the web today.  Just trying to be unique and different in my own 
old-school way.   I blab about all of this vaguely at my doomstar.com 
site, which implements these tools and my employer is also allowing me 
to reuse my codeBase in applications I develop for their clients.

Note to all:  please send private replies as any further discussion 
could quickly become 'off topic' for the php-general list.  I am 
interested in meeting other like minded people whom already know how to 
code and just want to throw ideas around for fun and inspiration.

Thanks for you interest in my work!  It is greatly appreciated.

Kris
http://doomstar.com/?target=me
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] PCRE regexp bug ?

2003-08-15 Thread tpc

Thank you.  I did the following:

if (isset($_POST[MI]) && (preg_match('/^[[:alpha:]]{1,1}$/', $_POST[MI]) == 0))

and zero is caught.

On Fri, 15 Aug 2003, CPT John W. Holmes wrote:

> From: <[EMAIL PROTECTED]>
>
> > I use preg_match to validate the Middle Initial field of a form and so far
> > it works, except yesterday a user submitted a "0" (zero) as a middle
> > initial!  My regexp is:
> >
> > if (!empty($_POST[MI]) && (preg_match('/^[[:alpha:]]{1,1}$/', $_POST[MI])
> == 0))
> >
> > I tested it with 0-9 and my regexp catches every digit except 0.
> Curious...
>
> empty("0") is going to be true. So, !empty("0") is going to be false, so you
> won't "catch" the zero.
>
> ---John Holmes...
>
>


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



Re: [PHP] How to get data from database with a click

2003-08-15 Thread Comex
<[EMAIL PROTECTED]>
Curt Zirzow:
> I'm confused, does this message have anything to do with what the
> original message, below, is asking?
I  it is the common mistake of pressing Reply instead of taking the
trouble to type in the [EMAIL PROTECTED]



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



RE: [PHP] Screen Resoultion

2003-08-15 Thread Chris W. Parker
Kris Yates 
on Friday, August 15, 2003 11:55 AM said:

> However, I also have a PHP program which you can run and edit the
> source code for the program inside the program itself, hit render and
> all of a sudden you are running the new version of the program. It is
> so cool that it is just plain sick.  I use this methodology all the
> time - every day, everyone loves it, and my fridge has good food in
> it as a result.

Hhmmm... tell us more.



c.

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



Re: [PHP] Screen Resoultion

2003-08-15 Thread Kris Yates
Leif K-Brooks wrote:

[EMAIL PROTECTED] wrote:

i didnt understand a word of that , please rephrase ??

ASP doesn't do an upload meter by magic. PHP can do anything ASP can 
do, it simply doesn't have built-in features for anything unessential.

So true.. I use PHP a lot to dynamically generate DHTML and JScript, 
which of course are tied to ways to get data back to PHP from 
jscript/dhtml results. My latest project is dynamically generating "cool 
menus" using Thomas Brattli's Coolmenus library (jscript/dhtml) with PHP 
and database results.

A while back, out of sheer boredom, I wrote a PHP script which 
dynamically generates a PHP script using database results, saves it to a 
database, and then
"grabs" and executes the new script.  I havent used that for anything 
except playing around and burning time/killing boredom.  However, I also 
have a PHP program which you can run and edit the source code for the 
program inside the program itself, hit render and all of a sudden you 
are running the new version of the program.  It is so cool that it is 
just plain sick.  I use this methodology all the time - every day, 
everyone loves it, and my fridge has good food in it as a result.  My 
point is that nothing is impossible, it is all just a matter of how you 
perceive things and how you react to these perceptions.  Free your mind 
and the paychecks will follow, not to mention good code will just flow 
from your fingertips.  :)

Kris
http://2binteractive.com
http://doomstar.com/?target=me


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


Re: [PHP] Checkboxes

2003-08-15 Thread Chris Boget
> It could be a solution but only working with a few items. My list(s)
> will be filled up with hundreds of items grabbed automatically out of
> another MySQL table... would it help too? Maybe naming the check
> boxes with each item own ID... anyone?

What you could do is this:

$query = "SELECT field_name FROM table"
$result = mysql( $dbname, $query );

while( $dataRow = mysql_fetch_assoc( $result )) {
  echo '';

}

On submission, all your checboxes will be here:

$_POST['checkboxes']

and you can iterate through that to see what fields/checkboxes
were set.  No fuss, no muss and no billion if( isset( $checkbox )).

Chris


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



Re: [PHP] Checkboxes

2003-08-15 Thread CPT John W. Holmes
You could name them as:



etc...

Then $_POST['choice'] will be an array of the boxes chosen.

$list = implode(',',$_POST['choice']);

will give you a comma separated list of all items chosen.

---John Holmes...

- Original Message - 
From: "Cesar Aracena" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, August 15, 2003 2:25 PM
Subject: [PHP] Checkboxes


Hi all,
 
I am wondering what would be the best way to handle checkboxes. I am
making a site that will display several items in a 20-items-per-page
format and each item will have a checkbox next to it for the user to
select them. Now, what I need to do is to record the items selected by
the user when clicking the "Next button" into a MySQL table. Should I
name all the checkboxes the same, using the item IDs as values and then
use an array to see which ones where selected or maybe another thing?
 
Thanks in advanced,
 
Cesar Aracena
  www.icaam.com.ar
Note: The information inside this message and also in the attached files
might be confidential. If you are not the desired receptor or the person
responsible of delivering the message, we notify you that it's copy,
distribution, keep or illegal use of the information it has it's
prohibited. Therefore we ask you to notify the sender by replying this
message immediately and then delete it from your computer.
 


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



RE: [PHP] Checkboxes

2003-08-15 Thread Wouter van Vliet
I think I'd just use like






then you can loop through it with foreach($_POST[box] as $BoxID => $Value)
.. I assume the recieving script knows what boxes it expects?

-Oorspronkelijk bericht-
Van: Cesar Aracena [mailto:[EMAIL PROTECTED]
Verzonden: vrijdag 15 augustus 2003 20:38
Aan: [EMAIL PROTECTED]
Onderwerp: RE: [PHP] Checkboxes
Urgentie: Hoog


It could be a solution but only working with a few items. My list(s)
will be filled up with hundreds of items grabbed automatically out of
another MySQL table... would it help too? Maybe naming the checkboxes
with each item own ID... anyone?

Thanks,

Cesar Aracena
www.icaam.com.ar

> -Mensaje original-
> De: Matt Babineau [mailto:[EMAIL PROTECTED]
> Enviado el: Viernes, 15 de Agosto de 2003 12:34 p.m.
> Para: Cesar Aracena
> CC: [EMAIL PROTECTED]
> Asunto: Re: [PHP] Checkboxes
>
> You could try this:
>
> 
> 
>
> So basically when it get submitted, you'll have either a 0 or 1
response
> to know whether or not it has been checked.
>
> Does this help?
>
> Matt
>
> On Fri, 2003-08-15 at 14:25, Cesar Aracena wrote:
> > Hi all,
> >
> > I am wondering what would be the best way to handle checkboxes. I am
> > making a site that will display several items in a 20-items-per-page
> > format and each item will have a checkbox next to it for the user to
> > select them. Now, what I need to do is to record the items selected
by
> > the user when clicking the Next button into a MySQL table. Should I
> > name all the checkboxes the same, using the item IDs as values and
then
> > use an array to see which ones where selected or maybe another
thing?
> >
> > Thanks in advanced,
> >
> > Cesar Aracena
> >   www.icaam.com.ar
> > Note: The information inside this message and also in the attached
files
> > might be confidential. If you are not the desired receptor or the
person
> > responsible of delivering the message, we notify you that it's copy,
> > distribution, keep or illegal use of the information it has it's
> > prohibited. Therefore we ask you to notify the sender by replying
this
> > message immediately and then delete it from your computer.
> >




--
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] Checkboxes

2003-08-15 Thread Cesar Aracena
It could be a solution but only working with a few items. My list(s)
will be filled up with hundreds of items grabbed automatically out of
another MySQL table... would it help too? Maybe naming the checkboxes
with each item own ID... anyone?

Thanks,

Cesar Aracena
www.icaam.com.ar

> -Mensaje original-
> De: Matt Babineau [mailto:[EMAIL PROTECTED]
> Enviado el: Viernes, 15 de Agosto de 2003 12:34 p.m.
> Para: Cesar Aracena
> CC: [EMAIL PROTECTED]
> Asunto: Re: [PHP] Checkboxes
> 
> You could try this:
> 
> 
> 
> 
> So basically when it get submitted, you'll have either a 0 or 1
response
> to know whether or not it has been checked.
> 
> Does this help?
> 
> Matt
> 
> On Fri, 2003-08-15 at 14:25, Cesar Aracena wrote:
> > Hi all,
> >
> > I am wondering what would be the best way to handle checkboxes. I am
> > making a site that will display several items in a 20-items-per-page
> > format and each item will have a checkbox next to it for the user to
> > select them. Now, what I need to do is to record the items selected
by
> > the user when clicking the Next button into a MySQL table. Should I
> > name all the checkboxes the same, using the item IDs as values and
then
> > use an array to see which ones where selected or maybe another
thing?
> >
> > Thanks in advanced,
> >
> > Cesar Aracena
> >   www.icaam.com.ar
> > Note: The information inside this message and also in the attached
files
> > might be confidential. If you are not the desired receptor or the
person
> > responsible of delivering the message, we notify you that it's copy,
> > distribution, keep or illegal use of the information it has it's
> > prohibited. Therefore we ask you to notify the sender by replying
this
> > message immediately and then delete it from your computer.
> >




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



Re: [PHP] Checkboxes

2003-08-15 Thread Matt Babineau
You could try this:




So basically when it get submitted, you'll have either a 0 or 1 response
to know whether or not it has been checked.

Does this help?

Matt

On Fri, 2003-08-15 at 14:25, Cesar Aracena wrote:
> Hi all,
>  
> I am wondering what would be the best way to handle checkboxes. I am
> making a site that will display several items in a 20-items-per-page
> format and each item will have a checkbox next to it for the user to
> select them. Now, what I need to do is to record the items selected by
> the user when clicking the Next button into a MySQL table. Should I
> name all the checkboxes the same, using the item IDs as values and then
> use an array to see which ones where selected or maybe another thing?
>  
> Thanks in advanced,
>  
> Cesar Aracena
>   www.icaam.com.ar
> Note: The information inside this message and also in the attached files
> might be confidential. If you are not the desired receptor or the person
> responsible of delivering the message, we notify you that it's copy,
> distribution, keep or illegal use of the information it has it's
> prohibited. Therefore we ask you to notify the sender by replying this
> message immediately and then delete it from your computer.
>  


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



[PHP] Checkboxes

2003-08-15 Thread Cesar Aracena
Hi all,
 
I am wondering what would be the best way to handle checkboxes. I am
making a site that will display several items in a 20-items-per-page
format and each item will have a checkbox next to it for the user to
select them. Now, what I need to do is to record the items selected by
the user when clicking the “Next button” into a MySQL table. Should I
name all the checkboxes the same, using the item IDs as values and then
use an array to see which ones where selected or maybe another thing?
 
Thanks in advanced,
 
Cesar Aracena
  www.icaam.com.ar
Note: The information inside this message and also in the attached files
might be confidential. If you are not the desired receptor or the person
responsible of delivering the message, we notify you that it's copy,
distribution, keep or illegal use of the information it has it's
prohibited. Therefore we ask you to notify the sender by replying this
message immediately and then delete it from your computer.
 


RE: [PHP] Segmentation Fault

2003-08-15 Thread Jay Blanchard
[snip]
I am running a PHP script from the command line that is returning 
"Segmentation Fault".  I run a lot of script from the command line and
have 
never seen this before.  I don't even know where to begin.

I know that PHP is set up to run scripts from the command line and plent
of 
other scripts run.

This particular script is not doing anything out of the ordinary.  It is

opening a database connection, opening a .csv file and inserting rows
into 
the database.  How in the world could this Seg Fault?
[/snip]

segmentation fault: n.
[Unix] 

1. [techspeak] An error in which a running program attempts to access
memory not allocated to it and core dumps with a segmentation violation
error. This is often caused by improper usage of pointers in the source
code, dereferencing a null pointer, or (in C) inadvertently using a
non-pointer variable as a pointer.

This script has no doubt worked before, so some other codition exists.
Things like this are generally created by infinite loops or improper
variables.

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



Re: [PHP] Function arguments

2003-08-15 Thread Mike Migurski
>What is the best way to pass the arguments so it is easy to maintain in
>future if function behaviour changes by adding/removing one or more
>arguments?
>
>Currently i am passing arguments in array. But i think it is not the
>clean way to do it and another approach i am using is functionName(arg1,
>arg2='', arg3='') but here again i think it is not easy to maintain.

According to http://php.net/manual/en/functions.arguments.php,

Variable-length argument lists

PHP 4 has support for variable-length argument lists in
user-defined functions. This is really quite easy, using the
func_num_args(), func_get_arg(), and func_get_args() functions.

No special syntax is required, and argument lists may still be
explicitly provided with function definitions and will behave as normal.

-
michal migurski- contact info and pgp key:
sf/cahttp://mike.teczno.com/contact.html


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



Re: [PHP] how to disable html postings?

2003-08-15 Thread Leif K-Brooks
Merlin wrote:

I am wondering how to prevent that users can post html through a form. I
process the form with php and save the date to a db.
There are a couple of sites I have already seen such thing. No matter what
you do, it is not possible to submit html commands.
Thats exacly what I want to do for my site.
Can anybody point me into the right direction on how to "disable" that?

If you want to display the tags (actually show ), use 
htmlentities(). If you want to remove the tags, use striptags().

--
The above message is encrypted with double rot13 encoding.  Any unauthorized attempt 
to decrypt it will be prosecuted to the full extent of the law.


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


[PHP] Segmentation Fault

2003-08-15 Thread Jackson Miller
I am running a PHP script from the command line that is returning 
"Segmentation Fault".  I run a lot of script from the command line and have 
never seen this before.  I don't even know where to begin.

I know that PHP is set up to run scripts from the command line and plent of 
other scripts run.

This particular script is not doing anything out of the ordinary.  It is 
opening a database connection, opening a .csv file and inserting rows into 
the database.  How in the world could this Seg Fault?

-Jackson


-- 
jackson miller
 
cold feet creative
615.321.3300 / 800.595.4401
[EMAIL PROTECTED]
 
 
cold feet presents Emma
the world's easiest email marketing
Learn more @  http://www.myemma.com

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



RE: [PHP] redhat 8: upgrade php from 4.2.2 to 4.3.2

2003-08-15 Thread Chris W. Parker
Cesar Cordovez 
on Friday, August 15, 2003 11:01 AM said:

> You can use apachetoolbox.com to install apache and php...

Does this require that I uninstall everything I've already got?


Chris.

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



RE: [PHP] how to disable html postings?

2003-08-15 Thread Jay Blanchard
[snip]
I am wondering how to prevent that users can post html through a form. I
process the form with php and save the date to a db.
There are a couple of sites I have already seen such thing. No matter
what
you do, it is not possible to submit html commands.
Thats exacly what I want to do for my site.

Can anybody point me into the right direction on how to "disable" that?
[/snip]

You will want to use regular expressions and functions associated with
regex (such as ereg) to match the tags and remove them from the posts.
Start here http://us2.php.net/manual/en/ref.regex.php

Have a productive and positve day

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



[PHP] how to disable html postings?

2003-08-15 Thread Merlin
Hi there,

I am wondering how to prevent that users can post html through a form. I
process the form with php and save the date to a db.
There are a couple of sites I have already seen such thing. No matter what
you do, it is not possible to submit html commands.
Thats exacly what I want to do for my site.

Can anybody point me into the right direction on how to "disable" that?

Thanx for your help,

Merlin



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



[PHP] Foreach POST VARS problem

2003-08-15 Thread Kris Yates
It seems to me that this used to work but I guess something has changed 
somewhere between PHP 4.2 and 4.3?

I am running PHP 4.3.2 as an Apache DSO on an FBSD box.  If it is not 
obvious, I am trying to parse checkbox form POST results as seen below:

   $colors="";
   foreach($HTTP_POST_VARS as $ThisVar=>$ThisVal){
   if(ereg("color-", $ThisVar) AND $ThisVal=="on" OR $ThisVal==1){
   $newVarA=explode("-", $ThisVar);
   $colors.="$newVarA[1]:";
   }
   }
*Warning*: Invalid argument supplied for foreach() in 
*/devda1/htdocs/2binteractive.com/htdocs/0new/content/lanskyShopAdmin.php* 
on line 2

I guess I just need to know what this variable name has been changed 
to.  I searched the PHP.NET manual for $HTTP_POST_VARS and got no results.

Thanks in advance & sorry for the dumb question..

Kris

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


Re: [PHP] redhat 8: upgrade php from 4.2.2 to 4.3.2

2003-08-15 Thread Cesar Cordovez
You can use apachetoolbox.com to install apache and php...

Chris W. Parker wrote:
I want to upgrade my php install from 4.2.2 to 4.3.2. I'm pretty new to
linux so I don't know how to install from source and I haven't been able
to find any Redhat 8 rpm's.


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


[PHP] preg_match issue

2003-08-15 Thread Pascal S.
I have a function that checks the syntax of a string using preg_match. This
function is used in a loop and always hangs on the same string (7 out of
many more).

However, the function acts as expected when used individually on that string
(ie when the array of strings to loop on is reduced to just the "problem
string".

The string and the preg_match are:

$text = 'C56_3, C55_3, C57_3, C59_3, C58_3, C52_3, C50_3, C53_3, C54_3,
C51_3, C60_3, C2_3, C3_2, C7_2, C8_2, C5_2, C64_3, C61_3, C65_3, C67_3,
C66_3, C28_3, C29_3, C26_3, C27_3, C32_3, C33_3, C30_3, C31_3, C1_2, C4_2,
C6_2, C9_3, C24_3, C25_3, C22_3, C23_3, C44_3, C45_3, C42_3, C43_3, C48_3,
C49_3, C46_3, C47_3, C36_3, C37_3, C34_3, C35_3, C40_3, C41_3, C38_3, C39_3,
C41_2, C40_2, C43_2, C42_2, C39_2, C36_2, C35_2, C38_2, C37_2, C7_0, C48_2,
C11_0, C16_0, C47_2, C18_0, C44_2, C46_2, C45_2, C4_1, C27_2, C8_1, C3_1,
C26_2, C1_1, C23_2, C25_2, C24_2, C32_2, C31_2, C34_2, C33_2, C30_2, C6_1,
C28_2, C29_2, C5_1, C10_0, C19_0, C21_0, C22_0, C23_0, C59_2, C56_2, C55_2,
C58_2, C57_2, C66_2, C65_2, C1_0, C67_2, C64_2, C60_2, C20_0, C61_2, C15_0,
C12_0, C13_0, C17_0, C6_0, C14_0, C8_0, C9_0, C2_0, C3_0, C24_0, C52_2,
C54_2, C53_2, C51_2, C5_0, C4_0, C50_2, C49_2, C47_1, C48_1, C45_1, C46_1,
C49_1, C52_1, C53_1, C50_1, C51_1, C44_1, C37_1, C38_1, C35_1, C36_1, C39_1,
C42_1, C43_1, C40_1, C41_1, C5_3, C6_3, C66_1, C67_1, C8_3, C1_3, C7_3,
C3_3, C4_3, C65_1, C56_1, C57_1, C54_1, C55_1, C58_1, C61_1, C64_1, C59_1,
C60_1, C27_1, C26_1, C25_1, C28_1, C2_2, C30_1, C29_1, C2_1, C9_2, C7_1,
C22_1, C24_1, C23_1, C22_2, C31_1, C32_1, C33_1, C9_1, C34_1';
var_dump(preg_match('/^\W*(?:[A-Z]{1,4}\d{1,3}(?:_\d{1,2})?(?(?!\Z)\W+))+$/'
, $text));

Does anybody have any tips on what to try/look for?

Thanks,
Pascal



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



Re: [PHP] Category and sub-category logic

2003-08-15 Thread CPT John W. Holmes
From: "Richard Baskett" <[EMAIL PROTECTED]>


> Wouldn¹t it just be easier to do a relationship table as in
>
> Personnel
> emp  ID   parent
> 
> 'Albert'  1 0
> 'Bert'2 1
> 'Chuck'   3 1
> 'Donna'   4 0
> 'Eddie'   5 4
> 'Fred'6 0
> 'Joe' 7 6
>
> This way you know the ID of the person and the parentID if they have one,
> otherwise they are a 0 which means they are the parent..  Seems like this
> would be a much easier way of doing it doesn¹t it?  And only one SQL
> query...

Possibly. It depends on what you're trying to model. We're getting way off
topic for PHP, though.

What you gave above is called an adjacency list model and the other example
given was a nested set (or tree) model. Each has it's advantages and
disadvantages. I recommend counsulting your good friend Google if you're
interested in the details. :)

---John Holmes...


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



Re: [PHP] Acessing session vars

2003-08-15 Thread CPT John W. Holmes
From: "Ed Curtis" <[EMAIL PROTECTED]>
>  I just started using sessions and am having some trouble understanding
how
> to pull values out of sessions to use in another page.
>
> I set the values as:
>
> session_start();
> session_register{'magazine');
> session_register('company');
>
> The data is saved as a session because I can read the file located in my
> /tmp directory.
>
> Now I click on a link and go to a different page and I do:
>
> session_start()
>
> Magazine: 
>
> Company: 
>
> Should I be able to retrieve the values in this fashion? I'm using php
> 4.1.2.

As you sit there and wait for us to answer, you could have taken the 5
second to run this yourself and test it.

If register_globals is ON, then yes, that's how you do it. You may want to
actually assign a value to $magazine and $company in the first script,
though, if you want to see any results.

If register_globals is OFF, then you should do it this way:

Page 1:
session_start();
$_SESSION['magazine'] = 'some value';
$_SESSION['company'] = 'some other value';

Page 2:

Magazine: 
Company: 

---John Holmes...


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



RE: Re: [PHP] PHP.ini file and register_globals

2003-08-15 Thread Jay Blanchard
[snip]
Is the change in the php.ini file the only thing that I need to change
to turn on register_globals?
[/snip]

Yes

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



Re: [PHP] PHP.ini file and register_globals

2003-08-15 Thread Jonatan Pugliese.
yes you must to restart your webserver !!
type  /etc/init.d/httpd restart

- Original Message - 
From: "Jay Blanchard" <[EMAIL PROTECTED]>
To: "Jonatan Pugliese." <[EMAIL PROTECTED]>; "Ben C."
<[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Friday, August 15, 2003 2:18 PM
Subject: RE: [PHP] PHP.ini file and register_globals


> [snip]
> never reboot !!
> is not necessary !
> [/snip]
>
> But you might want to restart your web server.
>
> -- 
> 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: Re: [PHP] PHP.ini file and register_globals

2003-08-15 Thread Ben C .
Is the change in the php.ini file the only thing that I need to change to turn on 
register_globals?

> 
> From: "Jonatan Pugliese." <[EMAIL PROTECTED]>
> Date: 2003/08/15 Fri PM 01:18:01 EDT
> To: "Ben C." <[EMAIL PROTECTED]>,  <[EMAIL PROTECTED]>
> Subject: Re: [PHP] PHP.ini file and register_globals
> 
> never reboot !!
> is not necessary !
> - Original Message - 
> From: "Ben C." <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Friday, August 15, 2003 2:14 PM
> Subject: [PHP] PHP.ini file and register_globals
> 
> 
> > I have a quick simple question.  I am using PHP 4.2.3 on Linux.  I am
> trying to turn register_globals from off to on.  Is all that I need to do
> change it from off to on in the php.ini file?  Do you I need to reboot to
> have the changes go into effect?  Sorry for a simple question but I am new
> at configuring PHP.  Thanks for the help.
> >
> >
> > -- 
> > 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: Re: [PHP] PHP.ini file and register_globals

2003-08-15 Thread Ben C .
Is the change in the php.ini file the only thing that I need to change to turn on 
register_globals?

> 
> From: "Jonatan Pugliese." <[EMAIL PROTECTED]>
> Date: 2003/08/15 Fri PM 01:18:01 EDT
> To: "Ben C." <[EMAIL PROTECTED]>,  <[EMAIL PROTECTED]>
> Subject: Re: [PHP] PHP.ini file and register_globals
> 
> never reboot !!
> is not necessary !
> - Original Message - 
> From: "Ben C." <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Friday, August 15, 2003 2:14 PM
> Subject: [PHP] PHP.ini file and register_globals
> 
> 
> > I have a quick simple question.  I am using PHP 4.2.3 on Linux.  I am
> trying to turn register_globals from off to on.  Is all that I need to do
> change it from off to on in the php.ini file?  Do you I need to reboot to
> have the changes go into effect?  Sorry for a simple question but I am new
> at configuring PHP.  Thanks for the help.
> >
> >
> > -- 
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 


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



RE: [PHP] PHP.ini file and register_globals

2003-08-15 Thread Jay Blanchard
[snip]
never reboot !!
is not necessary !
[/snip]

But you might want to restart your web server.

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



Re: [PHP] PHP.ini file and register_globals

2003-08-15 Thread Jonatan Pugliese.
never reboot !!
is not necessary !
- Original Message - 
From: "Ben C." <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, August 15, 2003 2:14 PM
Subject: [PHP] PHP.ini file and register_globals


> I have a quick simple question.  I am using PHP 4.2.3 on Linux.  I am
trying to turn register_globals from off to on.  Is all that I need to do
change it from off to on in the php.ini file?  Do you I need to reboot to
have the changes go into effect?  Sorry for a simple question but I am new
at configuring PHP.  Thanks for the help.
>
>
> -- 
> 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] PHP.ini file and register_globals

2003-08-15 Thread Ben C .
I have a quick simple question.  I am using PHP 4.2.3 on Linux.  I am trying to turn 
register_globals from off to on.  Is all that I need to do change it from off to on in 
the php.ini file?  Do you I need to reboot to have the changes go into effect?  Sorry 
for a simple question but I am new at configuring PHP.  Thanks for the help.


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



[PHP] cron

2003-08-15 Thread Richard Lynch
Not specific to PHP really, but it all started with a simple PHP script I
was automating...

I've used cron/crontab on a zillion machines, and it always worked
flawlessly.

Well, once I'd get the actual shell commands and permissions right anyway.

But this time...

The cron jobs just aren't having any effect.

crond is running, and has been /etc/rc.d/init.d/crond restart 'ed
tail /var/log/crond shows the jobs happening
/etc/cron.allow and /etc/cron.deny did not exist
adding the user to /etc/cron.allow had no effect
The 'root' user is being used
MAILTO= is set, with no output

Using the simplest stupidest cronline:
0 * * * * echo -e ".\n" | mail -s test [EMAIL PROTECTED]
it doesn't work.

There are no 'bounced' emails for the 'root' user on this box.

It's as if some higher power is intercepting any cron job and killing it
without letting cron know about it.  Weird.

The machine is a dual 64-bit (quad?) CPU, which I guess I've never used
before, but I'll be damned if I can see how that would screw up cron...

Linux localhost.localdomain 2.4.20-19.8smp #1 SMP Tue Jul 15 15:01:43 EDT
2003 i686 i686 i386 GNU/Linux

RedHat 8.0, with all (?) up2date's

I'm bemused and defuddled.

Any ideas?


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



[PHP] Re: cookies and redirection

2003-08-15 Thread Joaco
Ok, I have changed my code so the headers are sent as:

header("HTTP/1.0 302 Redirect");
header("Location: index2.php");
header("Set-Cookie: USER_COOKIE=$sUser");

I have changed the file name to nph-unsecure.php

It successfully sends me to the index2.php page, but no cookie... any ideas
  "Joaco" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED]
  I have a small problem was wondering if anyone out there knew anyhting about
  this. I set a cookie in my code and then redirect the user using a header
  function. When I do this, my cookie is not created. If i remove the header
  function, then it is. Is there a way around this?



[PHP] Acessing session vars

2003-08-15 Thread Ed Curtis

 I just started using sessions and am having some trouble understanding how
to pull values out of sessions to use in another page.

I set the values as:

session_start();
session_register{'magazine');
session_register('company');

The data is saved as a session because I can read the file located in my
/tmp directory.

Now I click on a link and go to a different page and I do:

session_start()

Magazine: 

Company: 

Should I be able to retrieve the values in this fashion? I'm using php
4.1.2. 

Thanks,

Ed


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



Re: [PHP] PCRE regexp bug ?

2003-08-15 Thread Curt Zirzow
* Thus wrote Curt Zirzow ([EMAIL PROTECTED]):
> * Thus wrote [EMAIL PROTECTED] ([EMAIL PROTECTED]):
> > 
> > I use preg_match to validate the Middle Initial field of a form and so far
> > it works, except yesterday a user submitted a "0" (zero) as a middle
> > initial!  My regexp is:
> > 
> > if (!empty($_POST[MI]) && (preg_match('/^[[:alpha:]]{1,1}$/', $_POST[MI]) == 0))
> > 
> > I tested it with 0-9 and my regexp catches every digit except 0.  Curious...
> 
> actaually 0-9 will never match that regexp.

Oops after reading my post to your post I see that is what you
wanted.  sorry.

the 0 problem can be fixed by checking strlen($_POST[MI]) or
isset() instead of !empty().


Curt
-- 
"I used to think I was indecisive, but now I'm not so sure."

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



[PHP] redhat 8: upgrade php from 4.2.2 to 4.3.2

2003-08-15 Thread Chris W. Parker
Hello eveyone.

I want to upgrade my php install from 4.2.2 to 4.3.2. I'm pretty new to
linux so I don't know how to install from source and I haven't been able
to find any Redhat 8 rpm's.

Can someone please give me instructions as to what I should do? (Maybe
links to a site where I can find the correct rpm file or instructions on
how to install a new version of php from source.. etc.)


Thanks a lot!
Chris.

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



Re: [PHP] Category and sub-category logic

2003-08-15 Thread Mark
--- "CPT John W. Holmes" <[EMAIL PROTECTED]> wrote:
> From: "Mark" <[EMAIL PROTECTED]>
> 
> 
> > I'm trying to get a handle on this algorithm as well. If you add
> > additional children to a parent record, doesn't that require
> > renumbering all the rgt and lft values in the lineage? For
> example
> > (table shamelessly stolen from a website):
> >
> > Personnel
> >  emp lft  rgt
> >  ==
> >  'Albert'  1   12
> >  'Bert'23
> >  'Chuck'   4   11
> >  'Donna'   56
> >  'Eddie'   78
> >  'Fred'9   10
> >
> > If I want to add 'Joe' as a subordinate to 'Fred', doesn't that
> mean
> > I have to change the lft values for Fred, Chuck, and Albert? Yes,
> > deleting definitely seems easier. I'm curious about adding...
> 
> Yes, you will have to update all of the right and left numbers to
> the right
> (or higher) than the node where you are inserting. Deleting is
> basically the
> same method done in reverse, but can get complicated when you
> delete a node
> and have to determine what to do with the children.
> 
> I'd recommend, if you're really interested in this, to do some
> searching on
> nested set tutorials. You could specifically search for Joe Celko
> who has
> written a lot of information on the topic.

Thanks. I'll take a look. I'm considering changing to this algorithm
from my basic parent-ID table.

> 
> While it seems like a big deal to have to update all of the
> numbers, it's
> really not. It can be done with a single query (with subselects).
> Yes, it's
> more costly than inserting a name into an adjacentcy list model,
> but it's
> worth it for all that you gain from the nested set model.
> 
> ---John Holmes...
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 


=
Mark Weinstock
[EMAIL PROTECTED]
***
You can't demand something as a "right" unless you are willing to fight to death to 
defend everyone else's right to the same thing.
***

__
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com

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



Re: [PHP] How to get data from database with a click

2003-08-15 Thread Curt Zirzow
* Thus wrote Subodh Gupta ([EMAIL PROTECTED]):
> Dear Friends,
> 
> When we click a combo box, in a perticular file, the output from the
> database should display in the same screen, in a text box or a combo box (We
> want this to happen without pressing the submit button).
> 
> Any clue please
> 

I'm confused, does this message have anything to do with what the
original message, below, is asking?

> Subodh
> 
> -Original Message-
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
> Sent: Friday, August 15, 2003 1:27 PM
> To: [EMAIL PROTECTED]
> Subject: Re: [PHP] php, search engine that index via local filesystem?

> 
> 
> Hi,
> 
> Do you want to provide a web interface to your local file system? well


Curt
-- 
"I used to think I was indecisive, but now I'm not so sure."

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



Re: [PHP] ereg & preg

2003-08-15 Thread Curt Zirzow
* Thus wrote Eddy-Das ([EMAIL PROTECTED]):
> is there any syntax difference between
> ereg() and preg() except preg needs / and /?

There are a lot of differences in syntax.


Curt
-- 
"I used to think I was indecisive, but now I'm not so sure."

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



Re: [PHP] PCRE regexp bug ?

2003-08-15 Thread Curt Zirzow
* Thus wrote [EMAIL PROTECTED] ([EMAIL PROTECTED]):
> 
> I use preg_match to validate the Middle Initial field of a form and so far
> it works, except yesterday a user submitted a "0" (zero) as a middle
> initial!  My regexp is:
> 
> if (!empty($_POST[MI]) && (preg_match('/^[[:alpha:]]{1,1}$/', $_POST[MI]) == 0))
> 
> I tested it with 0-9 and my regexp catches every digit except 0.  Curious...

actaually 0-9 will never match that regexp.

print preg_match('/^[[:alpha:]]{1,1}$/', '1');

yields: 0

The reason is that 0-9 is not alpha. You should use [[:alnum:]]
instead. Or better yet /^\w{1,1}$/


HTH,

Curt
-- 
"I used to think I was indecisive, but now I'm not so sure."

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



Re: [PHP] Category and sub-category logic

2003-08-15 Thread Richard Baskett
Wouldn¹t it just be easier to do a relationship table as in

Personnel 
emp  ID   parent

'Albert'  1 0
'Bert'2 1
'Chuck'   3 1
'Donna'   4 0
'Eddie'   5 4
'Fred'6 0
'Joe' 7 6

This way you know the ID of the person and the parentID if they have one,
otherwise they are a 0 which means they are the parent..  Seems like this
would be a much easier way of doing it doesn¹t it?  And only one SQL
query...

Rick

"The only way to have a friend is to be one." - Ralph Waldo Emerson

> From: Mark <[EMAIL PROTECTED]>
> Date: Fri, 15 Aug 2003 07:18:41 -0700 (PDT)
> To: "Chris W. Parker" <[EMAIL PROTECTED]>
> Cc: [EMAIL PROTECTED]
> Subject: RE: [PHP] Category and sub-category logic
> 
> I'm trying to get a handle on this algorithm as well. If you add
> additional children to a parent record, doesn't that require
> renumbering all the rgt and lft values in the lineage? For example
> (table shamelessly stolen from a website):
> 
> Personnel 
> emp lft  rgt
> ==
> 'Albert'  1   12
> 'Bert'23
> 'Chuck'   4   11
> 'Donna'   56
> 'Eddie'   78
> 'Fred'9   10
> 
> If I want to add 'Joe' as a subordinate to 'Fred', doesn't that mean
> I have to change the lft values for Fred, Chuck, and Albert? Yes,
> deleting definitely seems easier. I'm curious about adding...
> 
> Mark
> 
> 
> 
> --- "Chris W. Parker" <[EMAIL PROTECTED]> wrote:
>> David Otton 
>> on Thursday, August 14, 2003 4:58 PM said:
>> 
>>> The advantage of doing it this way is that your tree structure is
>>> generic and can have many levels. The disadvantage is that you
>> may
>>> need many SQL queries to fully traverse the tree (though people
>>> rarely want to do this, and sub-selects, clever joins or
>> post-query
>>> processing can reduce the overhead).
>> 
>> Which is why you should use the Modified Preorder Tree Traversal
>> method
>> instead. With that method you've got one table that defines the
>> categories AND their relationships to each other.
>> 
>> Your SQL queries end up looking something like this.
>> 
>> SELECT name
>> FROM categories
>> WHERE lft >= x
>> AND rgt <= y
>> 
>> 
>> 
>> Chris.
>> 
>> --
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>> 
> 
> 
> =
> Mark Weinstock
> [EMAIL PROTECTED]
> ***
> You can't demand something as a "right" unless you are willing to fight to
> death to defend everyone else's right to the same thing.
> ***
> 
> __
> Do you Yahoo!?
> Yahoo! SiteBuilder - Free, easy-to-use web site design software
> http://sitebuilder.yahoo.com
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 


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



[PHP] howto set locale only once

2003-08-15 Thread Martin Leja
Hi,

setting locale with setlocale() to subsequently get localized time strings
e.g. works fine. But this way the setlocale function gets executed every
time. How can i set the locale only once?
Can i specify the locale in the config file php.ini?

I'm using php as apache module on a linux debian system.

--
Regards, martin



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



Re: [PHP] Function arguments

2003-08-15 Thread [EMAIL PROTECTED]
Hello,
If you are worried about this issue your best option is to switch to an 
object oriented approach.

all the best

Hardik Doshi wrote:

Hi Group,

I have a question on overloaded function. 

What is the best way to pass the arguments so it is
easy to maintain in future if function behaviour
changes by adding/removing one or more arguments?
Currently i am passing arguments in array. But i think
it is not the clean way to do it and another approach
i am using is functionName(arg1, arg2='', arg3='') but
here again i think it is not easy to maintain.
Please let me know if you guys have other options or
improved version of above options.
Thanks

Hardik

__
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com
 



--

Raditha Dissanayake
-
http://www.radinks.com/sftp/
Lean and mean Secure FTP applet with Graphical User Inteface.
just 150 Kilo Bytes


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


[PHP] Function arguments

2003-08-15 Thread Hardik Doshi
Hi Group,

I have a question on overloaded function. 

What is the best way to pass the arguments so it is
easy to maintain in future if function behaviour
changes by adding/removing one or more arguments?

Currently i am passing arguments in array. But i think
it is not the clean way to do it and another approach
i am using is functionName(arg1, arg2='', arg3='') but
here again i think it is not easy to maintain.

Please let me know if you guys have other options or
improved version of above options.

Thanks

Hardik

__
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com

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



[PHP] ereg & preg

2003-08-15 Thread Eddy-Das
is there any syntax difference between
ereg() and preg() except preg needs / and /?


-- 

- Eddy Wong
__
inframatrix internet solutions
http://www.inframatrix.com/


   ¥¿¤KEddy
Regular Octa-Eddy
[EMAIL PROTECTED]@
[EMAIL PROTECTED]@¡½¢ª¢©
[EMAIL PROTECTED]@[EMAIL PROTECTED]@¡½ É\¿ß¡G [EMAIL PROTECTED]
[EMAIL PROTECTED]@¡½ É\¨¦¡G news://news.fixip.net/chat.ed
[EMAIL PROTECTED]@[EMAIL PROTECTED]@¡½ É\®Þ¤Æ¡G news://news.fixip.net/
[EMAIL PROTECTED]@¡½¢¨¢«
[EMAIL PROTECTED]@



RE: [PHP] Determining where a function is called from..

2003-08-15 Thread Wouter van Vliet
WHOW .. what a great new function in PHP4.3 .. I now have my errorlog
populated with stuff like:

[Fri 15 Aug 2003 17:34] [error] [database] You have an error in your SQL
syntax near 'DELETESBLAH' at line 1
-- -> database->execute() @ HTML/tmp/test.php line 3
 -> database->dberror() @ lib/class.database.inc.php line 63
-- -> logging->error() @ lib/class.database.inc.php line 173

only 'bad' thing is that it converts my function names to all lowercase ..
logging->error() should actually be Logging->Error() .. well, think I'll
have to live with that :(

Thanks you all !
Wouter

Ps. invoking phpinfo() on a production website? I don't think so ;P

-Oorspronkelijk bericht-
Van: Jaap van Ganswijk [mailto:[EMAIL PROTECTED]
Verzonden: vrijdag 15 augustus 2003 16:51
Aan: [EMAIL PROTECTED]
Onderwerp: RE: [PHP] Determining where a function is called from..


At 2003-08-15 16:35 +0200, Wouter van Vliet wrote:
>I noticed the __LINE__ and __FUNCTION__ magic constants too, but they don't
>really contain the values I was looking for, as they have the current
>function and line in it. But what I want my Logging class (I have one too
>:D) to display is what I am about to illustrate with an example:
>
>script: index.php
>-
>01  $Database->connect('host', 'database', 'username',
'password');
>(...)
>20  $Database->execute('DELETE news WHERE id IN ()');
>
>-> this would produce an error in my Database class, error in sql
syntax
>
>...etc.

Have you studied this:
http://www.php.net/manual/en/function.debug-backtrace.php

You may also want to invoke phpinfo() at the place the
error is occuring.

There are more nice functions on:
http://www.php.net/manual/en/ref.errorfunc.php

Greetings,
Jaap


--
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] Determining where a function is called from..

2003-08-15 Thread Wouter van Vliet
Nope .. I hadn't studiet the ref.errorfunc.php in this search.. I did some
other time and the backtrace function didn't stick around in my head.

Thank you all for helping me .. of course, debug_backtrace() was what I
needed ;) .. what a magnificent new function in PHP4.3 that is.. Only too
bad my vim syntax file doesn't yet recognize it..

Wouter


-Oorspronkelijk bericht-
Van: Jaap van Ganswijk [mailto:[EMAIL PROTECTED]
Verzonden: vrijdag 15 augustus 2003 16:51
Aan: [EMAIL PROTECTED]
Onderwerp: RE: [PHP] Determining where a function is called from..


At 2003-08-15 16:35 +0200, Wouter van Vliet wrote:
>I noticed the __LINE__ and __FUNCTION__ magic constants too, but they don't
>really contain the values I was looking for, as they have the current
>function and line in it. But what I want my Logging class (I have one too
>:D) to display is what I am about to illustrate with an example:
>
>script: index.php
>-
>01  $Database->connect('host', 'database', 'username',
'password');
>(...)
>20  $Database->execute('DELETE news WHERE id IN ()');
>
>-> this would produce an error in my Database class, error in sql
syntax
>
>...etc.

Have you studied this:
http://www.php.net/manual/en/function.debug-backtrace.php

You may also want to invoke phpinfo() at the place the
error is occuring.

There are more nice functions on:
http://www.php.net/manual/en/ref.errorfunc.php

Greetings,
Jaap


--
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] PCRE regexp bug ?

2003-08-15 Thread CPT John W. Holmes
From: <[EMAIL PROTECTED]>

> I use preg_match to validate the Middle Initial field of a form and so far
> it works, except yesterday a user submitted a "0" (zero) as a middle
> initial!  My regexp is:
>
> if (!empty($_POST[MI]) && (preg_match('/^[[:alpha:]]{1,1}$/', $_POST[MI])
== 0))
>
> I tested it with 0-9 and my regexp catches every digit except 0.
Curious...

empty("0") is going to be true. So, !empty("0") is going to be false, so you
won't "catch" the zero.

---John Holmes...


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



Re: [PHP] PCRE regexp bug ?

2003-08-15 Thread Marek Kilimajer
Not an answer but
'/^[[:alpha:]]{1,1}$/'
could be writen as
'/^[[:alpha:]]$/'
[EMAIL PROTECTED] wrote:

I use preg_match to validate the Middle Initial field of a form and so far
it works, except yesterday a user submitted a "0" (zero) as a middle
initial!  My regexp is:
if (!empty($_POST[MI]) && (preg_match('/^[[:alpha:]]{1,1}$/', $_POST[MI]) == 0))

I tested it with 0-9 and my regexp catches every digit except 0.  Curious...




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


Re: [PHP] logging data to xml

2003-08-15 Thread Curt Zirzow
* Thus wrote Jay Blanchard ([EMAIL PROTECTED]):
> A couple of things occured to me, but I am not sure that they're
> desirable...
> 
> With  being the last tag (does it occupy its own line?) you could
> (pseudo-code, not tested and certain to be incomplete)...
> 
> while(!feof($theXMLLogFile)){
>   $theXMLLine = fgets($theXMLLogFile, 255);
>   if($theXMLLine == ""){
>   $theNewLogLine = "stuff you need to write \n ";
>   ereg_replace("", "$theNewLogLine",
> $theXMLLogFile);
>   }
> }

A little quicker:

fseek($fh, -(strlen("")), SEEK_END);
fwrite($fh, $yourdata);
fwrite($fh, "\n");



Curt
-- 
"I used to think I was indecisive, but now I'm not so sure."

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



Re: [PHP] Category and sub-category logic

2003-08-15 Thread CPT John W. Holmes
From: "Mark" <[EMAIL PROTECTED]>


> I'm trying to get a handle on this algorithm as well. If you add
> additional children to a parent record, doesn't that require
> renumbering all the rgt and lft values in the lineage? For example
> (table shamelessly stolen from a website):
>
> Personnel
>  emp lft  rgt
>  ==
>  'Albert'  1   12
>  'Bert'23
>  'Chuck'   4   11
>  'Donna'   56
>  'Eddie'   78
>  'Fred'9   10
>
> If I want to add 'Joe' as a subordinate to 'Fred', doesn't that mean
> I have to change the lft values for Fred, Chuck, and Albert? Yes,
> deleting definitely seems easier. I'm curious about adding...

Yes, you will have to update all of the right and left numbers to the right
(or higher) than the node where you are inserting. Deleting is basically the
same method done in reverse, but can get complicated when you delete a node
and have to determine what to do with the children.

I'd recommend, if you're really interested in this, to do some searching on
nested set tutorials. You could specifically search for Joe Celko who has
written a lot of information on the topic.

While it seems like a big deal to have to update all of the numbers, it's
really not. It can be done with a single query (with subselects). Yes, it's
more costly than inserting a name into an adjacentcy list model, but it's
worth it for all that you gain from the nested set model.

---John Holmes...


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



Re: [PHP] PCRE regexp bug ?

2003-08-15 Thread Greg Wiley
- Original Message - 
From: <[EMAIL PROTECTED]>
>
> I use preg_match to validate the Middle Initial field of a form and so far
> it works, except yesterday a user submitted a "0" (zero) as a middle
> initial!  My regexp is:
>
> if (!empty($_POST[MI]) && (preg_match('/^[[:alpha:]]{1,1}$/', $_POST[MI])
== 0))
>
> I tested it with 0-9 and my regexp catches every digit except 0.
Curious...
>
Maybe it thinks it's the letter O, have you tried using a font that puts a
line through the zero;-)

[sorry couldn't resist]

Cheers, Greg.



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



RE: [PHP] Determining where a function is called from..

2003-08-15 Thread Jaap van Ganswijk
At 2003-08-15 16:35 +0200, Wouter van Vliet wrote:
>I noticed the __LINE__ and __FUNCTION__ magic constants too, but they don't
>really contain the values I was looking for, as they have the current
>function and line in it. But what I want my Logging class (I have one too
>:D) to display is what I am about to illustrate with an example:
>
>script: index.php
>-
>01  $Database->connect('host', 'database', 'username', 'password');
>(...)
>20  $Database->execute('DELETE news WHERE id IN ()');
>
>-> this would produce an error in my Database class, error in sql syntax
>
>...etc.

Have you studied this:
http://www.php.net/manual/en/function.debug-backtrace.php

You may also want to invoke phpinfo() at the place the
error is occuring.

There are more nice functions on:
http://www.php.net/manual/en/ref.errorfunc.php

Greetings,
Jaap


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



Re: [PHP] Determining where a function is called from..

2003-08-15 Thread Marek Kilimajer
Use debug_backtrace():

if($error=mysql_error()) {
$bt=debug_backtrace();
echo $bt[0]['file'].':'.$bt[0]['line'].''
.$error.''.$query;
}
hope i got everything right

Wouter van Vliet wrote:

Thanks David,

I noticed the __LINE__ and __FUNCTION__ magic constants too, but they don't
really contain the values I was looking for, as they have the current
function and line in it. But what I want my Logging class (I have one too
:D) to display is what I am about to illustrate with an example:
script: index.php
-
01  $Database->connect('host', 'database', 'username', 'password');
(...)
20  $Database->execute('DELETE news WHERE id IN ()');
	-> this would produce an error in my Database class, error in sql syntax

script: class.database.inc.php
--
  2 class Database {
  3
  4 var $C; # Connection resource
  5 var $S; # Settings
  6 var $L; # Log Object
  7 var $R; # Result
  8
  9 function Database($Host, $Database, $Username, $Password) {
 10 global $Log;
 11
 12 $this->S = Array( 'host'=> $Host,
 13   'database'=> $Database,
 14   'username'=> $Username,
 15   'password'=> $Password
 16   );
 17
 18 $this->L = $Log;
 19
 20 return true;
 21 }
(...)
 55 function execute() {
 56 $this->connect(false);
 57
 58 # Prepare
 59 $Query = $this->prepare(func_get_args());
 60 $this->dblog($Query);
 61
 62 # Execute the query
 63 $this->R['resource'] = @mysql_query($Query,
$this->C) or $this->dberror();
 64 $this->R['affectedrows'] =
@mysql_affected_rows($this->C) or $this->dberror();
 65
 66 return $this->R['affectedrows'];
 67 }
(...)
171 function dberror() {
172 if ($String = mysql_error($this->C)) {
173 $OldType = $this->L->setLogType(L_STDOUT);
174 $this->L->Error('[database] '.$String);
175 $this->L->setLogType($OldType);
176 };
177 }
178 };
I could fairly live with passing __LINE__ and __FUNCTION__ at some places,
but not in my index.php (seperating front- and backend). What I want
dberror() to pass to my logging module is something like "You have an error
in your sql syntax at line 1, called from index.php on line 20". The first
part being just the mysql error, after the comma from where the errorfull
query was called ..
Thanks once more,
Wouter
Ps. or am I really wanting too much now?

-Oorspronkelijk bericht-
Van: David Otton [mailto:[EMAIL PROTECTED]
Verzonden: vrijdag 15 augustus 2003 16:13
Aan: Wouter van Vliet
Onderwerp: Re: [PHP] Determining where a function is called from..
On Fri, 15 Aug 2003 16:02:24 +0200, you wrote:


I've got this problem .. not really a problem but still some thing to my
disliking. For a project I wrote some database handling class, no big deal.
When a function from this module is called with a query containing an
error,

or some other error occurs inside this class it reports to my that an error
occured inside that class. "Line blabla of class.database.inc.php". But
what

I really want to know is on what line the $Database->select() or such was
called so that I can effectively trace the error.
So, for effective error reporting I would like to know if there are
functions or constants containing
- the script-name a user-function is called from
- the linenumber of this script a user-function is called from
- And maybe it would even be doable to get an entire stack-trace of files
and lines and functions to the point an error (or any other thing I would
like to trace to) occurrs.


It's just about possible, but you have to do it by hand. You need the
__LINE__ and __FUNCTION__ magic constants. Eg
function makeerror ($errorstring, $function, $line)
{
die ("Error: $errorstring on line $line in $function");
}
makeerror("Can't connect to database", __FUNCTION__, __LINE__);

I have a fairly standard way of handling errors in classes that I can
discuss in more detail, if you want.





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


[PHP] PCRE regexp bug ?

2003-08-15 Thread tpc

I use preg_match to validate the Middle Initial field of a form and so far
it works, except yesterday a user submitted a "0" (zero) as a middle
initial!  My regexp is:

if (!empty($_POST[MI]) && (preg_match('/^[[:alpha:]]{1,1}$/', $_POST[MI]) == 0))

I tested it with 0-9 and my regexp catches every digit except 0.  Curious...


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



RE: [PHP] Re: regex problem

2003-08-15 Thread Wouter van Vliet
So, what you want is to pretty much use this regex

/^(.*)([^\/]+)\/([^\/]+)$/

when matched on this URI, the backreferences will contain

\\1 partner/
\\2 name
\\3 contact.html
\\4 .html

> > partner/name/contact.html

I have not tested it, but I just guess it will work ;) Wanna know why? I'll
tell you :D

- It first looks at the beginning of the string and will go on untill a the
next pair of () start (partner/)
- That happens there where there is a string containing any character, but
not a slash (partner)
- as a seperator another slash is added
- it starts to match the last part of the url and looks up untill the end.
Again a string containing no slashes

Hope it does do what I expect it to do .. ;)

Wouter


-Oorspronkelijk bericht-
Van: Merlin [mailto:[EMAIL PROTECTED]
Verzonden: vrijdag 15 augustus 2003 16:21
Aan: [EMAIL PROTECTED]
Onderwerp: [PHP] Re: regex problem


Good idea,

but does not work either - surprisingly! -

There should be a clean way with regex for this task.


Andy regex expert in here?

Merlin



"Kae Verens" <[EMAIL PROTECTED]> schrieb im Newsbeitrag
news:[EMAIL PROTECTED]
> Merlin wrote:
> > ufff.. sorry guys, but I have to explain that better. I appreciate your
> > help, maybe I did not give enough info.
> >
> > I am trying to redirect with apache modrewrite. To do this you have to
use
> > regex (not if functions:-)
> >
> > My problem is, that there are member accounts which look like that:
> >
> > membername/contact.html
> >
> > and there are partner accounts which look like this:
> >
> > partner/name/contact.html
> >
> > The goal is to redirect only if it is a member account. If I put a
> > (.*)/contact.html it also matches the partner/
> > I tryed putting a root / infront, but there is not / root for the url
from
> > apaches point of view.
> >
> > So I would need a regex which will match the member account, but if the
> > first word is "partner" it should
> > not terminate.
> >
> > This seems to be a tough one!
> >
>
> ah - maybe a chain of rewrites would do?
>
> send all matches of /^partner\/(.*)\/contact.html$/ to partner\/\1\/blah
> send all matches of /^(.*)\/contact.html$/ to NEWLOCATION
> send all matches of /^partner\/(.*)\/blah$/ to partner\/\1\/contact.html
>
> Kae
>



--
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] Re: How can I load load Additional extensions ?

2003-08-15 Thread Comex
<[EMAIL PROTECTED]>
Leif K-Brooks:
> Dennis Lee wrote:
>
>> Why it is wrong when I run php as module under apache 2.0.46 ?
>>
> PHP and Apache 2 are currently unstable together.

They might crash on any high traffic, but they start fine, at least when
I've tried it.



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



Re: [PHP] Graduated fills using PHP Images

2003-08-15 Thread Jaap van Ganswijk
At 2003-08-15 08:14 -0400, Adrian wrote:
>Is it possible to have PHP creates an image that graduates 1 color to
>another, such as create and images 100 pixels wide and in height which
>fades red to green top to bottom?

It's possible. I have just been experimenting with
it using ImageCreateTrueColor().

See the manual:
http://www.php.net/manual/en/function.imagecreatetruecolor.php

You still have to use ImageColorAllocate() to get
a color but you can deallocate it right after usage
and you can use as many colors as you like (whereas
with normal 256 color images you can't use more
than 256). The process didn't noticably slow my
1 Ghz PC down.

I made some nice fades in two directions too:
http://www.chipdir.nl/adprov/adb/cdb/468_60/08en.png

BTW. I made it look like the upper text has been pressed
downward into the material and the lower text has been
pressed upward out of the material. (Using alpha
channel coloring.)

Let me know if you want to see the source code...




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



RE: [PHP] Determining where a function is called from..

2003-08-15 Thread Wouter van Vliet
Thanks David,

I noticed the __LINE__ and __FUNCTION__ magic constants too, but they don't
really contain the values I was looking for, as they have the current
function and line in it. But what I want my Logging class (I have one too
:D) to display is what I am about to illustrate with an example:

script: index.php
-
01  $Database->connect('host', 'database', 'username', 'password');
(...)
20  $Database->execute('DELETE news WHERE id IN ()');

-> this would produce an error in my Database class, error in sql syntax

script: class.database.inc.php
--
  2 class Database {
  3
  4 var $C; # Connection resource
  5 var $S; # Settings
  6 var $L; # Log Object
  7 var $R; # Result
  8
  9 function Database($Host, $Database, $Username, $Password) {
 10 global $Log;
 11
 12 $this->S = Array( 'host'=> $Host,
 13   'database'=> $Database,
 14   'username'=> $Username,
 15   'password'=> $Password
 16   );
 17
 18 $this->L = $Log;
 19
 20 return true;
 21 }
(...)
 55 function execute() {
 56 $this->connect(false);
 57
 58 # Prepare
 59 $Query = $this->prepare(func_get_args());
 60 $this->dblog($Query);
 61
 62 # Execute the query
 63 $this->R['resource'] = @mysql_query($Query,
$this->C) or $this->dberror();
 64 $this->R['affectedrows'] =
@mysql_affected_rows($this->C) or $this->dberror();
 65
 66 return $this->R['affectedrows'];
 67 }
(...)
171 function dberror() {
172 if ($String = mysql_error($this->C)) {
173 $OldType = $this->L->setLogType(L_STDOUT);
174 $this->L->Error('[database] '.$String);
175 $this->L->setLogType($OldType);
176 };
177 }
178 };

I could fairly live with passing __LINE__ and __FUNCTION__ at some places,
but not in my index.php (seperating front- and backend). What I want
dberror() to pass to my logging module is something like "You have an error
in your sql syntax at line 1, called from index.php on line 20". The first
part being just the mysql error, after the comma from where the errorfull
query was called ..

Thanks once more,
Wouter

Ps. or am I really wanting too much now?

-Oorspronkelijk bericht-
Van: David Otton [mailto:[EMAIL PROTECTED]
Verzonden: vrijdag 15 augustus 2003 16:13
Aan: Wouter van Vliet
Onderwerp: Re: [PHP] Determining where a function is called from..


On Fri, 15 Aug 2003 16:02:24 +0200, you wrote:

>I've got this problem .. not really a problem but still some thing to my
>disliking. For a project I wrote some database handling class, no big deal.
>When a function from this module is called with a query containing an
error,
>or some other error occurs inside this class it reports to my that an error
>occured inside that class. "Line blabla of class.database.inc.php". But
what
>I really want to know is on what line the $Database->select() or such was
>called so that I can effectively trace the error.
>
>So, for effective error reporting I would like to know if there are
>functions or constants containing
>   - the script-name a user-function is called from
>   - the linenumber of this script a user-function is called from
>
>   - And maybe it would even be doable to get an entire stack-trace of files
>and lines and functions to the point an error (or any other thing I would
>like to trace to) occurrs.

It's just about possible, but you have to do it by hand. You need the
__LINE__ and __FUNCTION__ magic constants. Eg

function makeerror ($errorstring, $function, $line)
{
die ("Error: $errorstring on line $line in $function");
}

makeerror("Can't connect to database", __FUNCTION__, __LINE__);

I have a fairly standard way of handling errors in classes that I can
discuss in more detail, if you want.




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



Re: [PHP] configure smtp error

2003-08-15 Thread Mark

--- Jackson Miller <[EMAIL PROTECTED]> wrote:
> It looks like sendmail_from should be an smtp server, not an email
> address.
> 
> Try setting it to your outgoing mail server that you use with your
> email 
> client (i.e. Outlook).  If you can send email from your email
> client then the 
> firewall will have no bearing.
> 
> -Jackson
> 
> 
> On Thursday 14 August 2003 11:24, merryE wrote:
> > I am using LAN in my college and there is firewall. will it
> effect my mail
> > function in php.
> >
> > I configure my server name as localhost at apache http.conf. and
> inphp.ini
> > i configure my SMTP like this:
> >
> > [mail function]
> >
> > ; For Win32 only.
> >
> > SMTP= POP ; for Win32 only

This should be the fully qualified domain name or IP address ofhte
SMTP server that you want to use. If you look in your configuration
in Outlook, you should be able to find the SMTP server that you have
access to. But note that if that server requires SMTP AUTH (username
and password to send mail), you can;t use PHP's mail function
directly,. You'll need to use one of the mail classes.

> >
> > ; For Win32 only.
> >
> > sendmail_from= [EMAIL PROTECTED] ; for Win32 only

This is correct. It should be the email address from which teh mail
should be sent. I beleive PHP uses this as the SMTP MAIL FROM
parameter (not to be confused with the From: mail header ).

> >
> > but i got warning: mail(): Failed to connect to mailserver at
> "POP" port
> > 25, verify your "SMTP" and "smtp_port" setting in php.ini or use
> ini_set()
> > in c:\program files\apache group\apache\htdocs\do_feedback.php on
> line 12
> 
> -- 
> jackson miller
>  
> cold feet creative
> 615.321.3300 / 800.595.4401
> [EMAIL PROTECTED]
>  
>  
> cold feet presents Emma
> the world's easiest email marketing
> Learn more @  http://www.myemma.com
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 


=
Mark Weinstock
[EMAIL PROTECTED]
***
You can't demand something as a "right" unless you are willing to fight to death to 
defend everyone else's right to the same thing.
***

__
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com

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



Re: [PHP] Re: regex problem

2003-08-15 Thread Curt Zirzow
* Thus wrote Kae Verens ([EMAIL PROTECTED]):
> Jay Blanchard wrote:
> >if($string == 'test/contact.html')
> 
> >it could be
> >
> >if($string == "test/contact.html")
> 
> not to start a flame war or anything, but isn't the apostrophe version 
> quicker, as it doesn't ask the server to parse the string?

heh, that is true. Although I havn't benched marked it but it
prolly is somewhere around .01 difference :)

your not the one that needs to be flamed, it seems that everytime a
topic of 'regex' is posted there is always 20+ in the thread with
101% of them not doing what the person wants. Not to mention the
OT'ness of the post.

cheers,

Curt
-- 
"I used to think I was indecisive, but now I'm not so sure."

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



Re: [PHP] Re: regex problem

2003-08-15 Thread Curt Zirzow
* Thus wrote Merlin ([EMAIL PROTECTED]):
> ufff.. sorry guys, but I have to explain that better. I appreciate your
> help, maybe I did not give enough info.
> 
> I am trying to redirect with apache modrewrite. To do this you have to use
> regex (not if functions:-)

I'm not sure what you expect since this *is* a php mailing list.

> 
> My problem is, that there are member accounts which look like that:
> 
> membername/contact.html
> 
> and there are partner accounts which look like this:
> 
> partner/name/contact.html
> 
> The goal is to redirect only if it is a member account. If I put a
> (.*)/contact.html it also matches the partner/
> I tryed putting a root / infront, but there is not / root for the url from
> apaches point of view.
> 
> So I would need a regex which will match the member account, but if the
> first word is "partner" it should
> not terminate.
> 
> This seems to be a tough one!

Mod rewrite is a powerful tool and you can accomplish what you are
doing several different ways.  As you can tell most people have
been giving attempts to fix your problem without success. This is
because it is not entirely clear what you need done.


Curt
-- 
"I used to think I was indecisive, but now I'm not so sure."

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



[PHP] Re: regex problem

2003-08-15 Thread Merlin
Good idea,

but does not work either - surprisingly! -

There should be a clean way with regex for this task.


Andy regex expert in here?

Merlin



"Kae Verens" <[EMAIL PROTECTED]> schrieb im Newsbeitrag
news:[EMAIL PROTECTED]
> Merlin wrote:
> > ufff.. sorry guys, but I have to explain that better. I appreciate your
> > help, maybe I did not give enough info.
> >
> > I am trying to redirect with apache modrewrite. To do this you have to
use
> > regex (not if functions:-)
> >
> > My problem is, that there are member accounts which look like that:
> >
> > membername/contact.html
> >
> > and there are partner accounts which look like this:
> >
> > partner/name/contact.html
> >
> > The goal is to redirect only if it is a member account. If I put a
> > (.*)/contact.html it also matches the partner/
> > I tryed putting a root / infront, but there is not / root for the url
from
> > apaches point of view.
> >
> > So I would need a regex which will match the member account, but if the
> > first word is "partner" it should
> > not terminate.
> >
> > This seems to be a tough one!
> >
>
> ah - maybe a chain of rewrites would do?
>
> send all matches of /^partner\/(.*)\/contact.html$/ to partner\/\1\/blah
> send all matches of /^(.*)\/contact.html$/ to NEWLOCATION
> send all matches of /^partner\/(.*)\/blah$/ to partner\/\1\/contact.html
>
> Kae
>



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



Re: [PHP] Re: regex problem

2003-08-15 Thread Merlin
does not work. Is there not a way to exclude the word "partner" like you
triede with !(partner) ?

merlin



"Marek Kilimajer" <[EMAIL PROTECTED]> schrieb im Newsbeitrag
news:[EMAIL PROTECTED]
> So
> ^[^/]+/[^/]*
>
> or
>
> ^!(partner/)
>
> Merlin wrote:
>
> > ufff.. sorry guys, but I have to explain that better. I appreciate your
> > help, maybe I did not give enough info.
> >
> > I am trying to redirect with apache modrewrite. To do this you have to
use
> > regex (not if functions:-)
> >
> > My problem is, that there are member accounts which look like that:
> >
> > membername/contact.html
> >
> > and there are partner accounts which look like this:
> >
> > partner/name/contact.html
> >
> > The goal is to redirect only if it is a member account. If I put a
> > (.*)/contact.html it also matches the partner/
> > I tryed putting a root / infront, but there is not / root for the url
from
> > apaches point of view.
> >
> > So I would need a regex which will match the member account, but if the
> > first word is "partner" it should
> > not terminate.
> >
> > This seems to be a tough one!
> >
> > Thanx for any help,
> >
> > Merlin
> >
> > "Kae Verens" <[EMAIL PROTECTED]> schrieb im Newsbeitrag
> > news:[EMAIL PROTECTED]
> >
> >>Merlin wrote:
> >>
> ^\/test\/contact.html$
> >>>
> >>>
> >>>does not work. I am sorry, I just found that
> >>>
> >>>it has to be:
> >>>test/contact.html
> >>>
> >>>and not
> >>>dir/test/contact.html
> >>>
> >>>there is no leading slash.
> >>>
> >>>Do you have any other suggestion?
> >>>
> >>
> >>*sigh*
> >>
> >>^test\/contact.html$
> >>
> >>Kae
> >>
> >
> >
> >
> >
>



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



RE: [PHP] Category and sub-category logic

2003-08-15 Thread Mark
I'm trying to get a handle on this algorithm as well. If you add
additional children to a parent record, doesn't that require
renumbering all the rgt and lft values in the lineage? For example
(table shamelessly stolen from a website):

Personnel 
 emp lft  rgt 
 ==
 'Albert'  1   12 
 'Bert'23 
 'Chuck'   4   11 
 'Donna'   56 
 'Eddie'   78 
 'Fred'9   10 

If I want to add 'Joe' as a subordinate to 'Fred', doesn't that mean
I have to change the lft values for Fred, Chuck, and Albert? Yes,
deleting definitely seems easier. I'm curious about adding...

Mark



--- "Chris W. Parker" <[EMAIL PROTECTED]> wrote:
> David Otton 
> on Thursday, August 14, 2003 4:58 PM said:
> 
> > The advantage of doing it this way is that your tree structure is
> > generic and can have many levels. The disadvantage is that you
> may
> > need many SQL queries to fully traverse the tree (though people
> > rarely want to do this, and sub-selects, clever joins or
> post-query
> > processing can reduce the overhead).
> 
> Which is why you should use the Modified Preorder Tree Traversal
> method
> instead. With that method you've got one table that defines the
> categories AND their relationships to each other.
> 
> Your SQL queries end up looking something like this.
> 
> SELECT name
> FROM categories
> WHERE lft >= x
>   AND rgt <= y
> 
> 
> 
> Chris.
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 


=
Mark Weinstock
[EMAIL PROTECTED]
***
You can't demand something as a "right" unless you are willing to fight to death to 
defend everyone else's right to the same thing.
***

__
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com

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



[PHP] Determining where a function is called from..

2003-08-15 Thread Wouter van Vliet
Howdy Fellas,

I've got this problem .. not really a problem but still some thing to my
disliking. For a project I wrote some database handling class, no big deal.
When a function from this module is called with a query containing an error,
or some other error occurs inside this class it reports to my that an error
occured inside that class. "Line blabla of class.database.inc.php". But what
I really want to know is on what line the $Database->select() or such was
called so that I can effectively trace the error.

So, for effective error reporting I would like to know if there are
functions or constants containing
- the script-name a user-function is called from
- the linenumber of this script a user-function is called from

- And maybe it would even be doable to get an entire stack-trace of files
and lines and functions to the point an error (or any other thing I would
like to trace to) occurrs.

Thanks,
Wouter

ps. or do I want too much now?



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



Re: [PHP] Re: regex problem

2003-08-15 Thread Marek Kilimajer
So
^[^/]+/[^/]*
or

^!(partner/)

Merlin wrote:

ufff.. sorry guys, but I have to explain that better. I appreciate your
help, maybe I did not give enough info.
I am trying to redirect with apache modrewrite. To do this you have to use
regex (not if functions:-)
My problem is, that there are member accounts which look like that:

membername/contact.html

and there are partner accounts which look like this:

partner/name/contact.html

The goal is to redirect only if it is a member account. If I put a
(.*)/contact.html it also matches the partner/
I tryed putting a root / infront, but there is not / root for the url from
apaches point of view.
So I would need a regex which will match the member account, but if the
first word is "partner" it should
not terminate.
This seems to be a tough one!

Thanx for any help,

Merlin

"Kae Verens" <[EMAIL PROTECTED]> schrieb im Newsbeitrag
news:[EMAIL PROTECTED]
Merlin wrote:

^\/test\/contact.html$


does not work. I am sorry, I just found that

it has to be:
test/contact.html
and not
dir/test/contact.html
there is no leading slash.

Do you have any other suggestion?

*sigh*

^test\/contact.html$

Kae







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


[PHP] Re: regex problem

2003-08-15 Thread Kae Verens
Merlin wrote:
ufff.. sorry guys, but I have to explain that better. I appreciate your
help, maybe I did not give enough info.
I am trying to redirect with apache modrewrite. To do this you have to use
regex (not if functions:-)
My problem is, that there are member accounts which look like that:

membername/contact.html

and there are partner accounts which look like this:

partner/name/contact.html

The goal is to redirect only if it is a member account. If I put a
(.*)/contact.html it also matches the partner/
I tryed putting a root / infront, but there is not / root for the url from
apaches point of view.
So I would need a regex which will match the member account, but if the
first word is "partner" it should
not terminate.
This seems to be a tough one!

ah - maybe a chain of rewrites would do?

send all matches of /^partner\/(.*)\/contact.html$/ to partner\/\1\/blah
send all matches of /^(.*)\/contact.html$/ to NEWLOCATION
send all matches of /^partner\/(.*)\/blah$/ to partner\/\1\/contact.html
Kae

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


Re: [PHP] Turck MMCache Feedback, Please

2003-08-15 Thread Jason Sheets
Hello Andrei,

I've been using Turck MMCache for over 6 months now.  I use it on 
several severs including FreeBSD (2), Windows (1) and Linux (3).  I've 
been very happy with Turck MMCache and as of the last few releases it is 
actually faster than Zend's product though not by very much (granted 
could be within margin of error but it is still very nice and neat). 

Turck also has the Turck Loader for clients that don't want the full 
power of Turck MMCache but need to be able to run Turck MMCache encoded 
scripts.

You can use the command line php file to encode scripts  or I also wrote 
Turck MMCache PHPCoder, a web based front end to Turck MMCache that also 
allows you to restrict execution and prepend/append code to each file 
such as licensing control code or copyright stuff 
(http://phpcoder.shadonet.com).

Bottom line I don't have a machine running PHP I don't have Turck 
MMCache installed on and I have aeen a tremendous performance increase 
since I installed it. 

Jason

Andrei Verovski (aka MacGuru) wrote:

Hi,

I am going to use Turck MMCache with Encoder. Anyone on the list have 
used it on Linux, MacOS X, Windows?

Any caveats and/or side effect?

Your feedback will be greatly appreciated. Thanks in advance.

*
*   Best Regards   ---   Andrei Verovski
*
*   Personal Home Page
*   http://snow.prohosting.com/guru4mac
*   Mac, Linux, DTP, Development, IT WEB Site
*



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


  1   2   >