Re: [PHP] Spawning new pages

2004-11-30 Thread Jason Wong
On Wednesday 01 December 2004 15:02, Christopher Weaver wrote:
> Here's what I've got
>
> In first php file
>
> include second.php;
>
> createPage("withThis");
> createPage("withThat");

 ...

Of all the correct answers that you received you had to pick and use the wrong 
answer! PHP can't spawn new pages. Read your other responses.

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
--
/*
Carson's Observation on Footwear:
 If the shoe fits, buy the other one too.
*/

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



Re: [PHP] print_r() and SimpleXML

2004-11-30 Thread Rick Fletcher
[snip]
when using print_r on a SimpleXML object that has
attributes, the attributes are not shown.
I would propose that this is not the desired response. When using
print_r on an object, it should display all available information
(even, as the manual indicates, private and/or protected properties).
[snip]
Now, if people agree with me, that this is infact not the desired
response. Is this a 'bug' with SimpleXML or print_r?
On the SimpleXML->attributes documentation page 
(http://www.php.net/manual/en/function.simplexml-element-attributes.php) 
you'll find this note:

"SimpleXML has made a rule of adding iterative properties to most 
methods. They cannot be viewed using var_dump() or anything else which 
can examine objects."

A pain? Maybe. A bug? No.
There are a couple of user functions in the SimpleXML documentation 
comments that will convert a SimpleXML object to an array.  You can then 
pass that array to print_r for debugging.

Find the code here: http://www.php.net/manual/en/ref.simplexml.php
Cheers,
  Rick
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] regex issue

2004-11-30 Thread Rick Fletcher
[EMAIL PROTECTED] wrote:
All I want to do is capture the keyword (array, break, echo, etc) and color
it.

$txt = "this is an array('test')";
$pattern = "/(array|break|echo|continue)([\(.|\s.|\;.])/";
echo preg_replace($pattern, '$0', $txt);

This captures "array(" though and I just want "array".
That's because you're using $0 in the replacement.
The value of $0 is the entire string being matched by the regex.  In 
this case, "array(".  You only want to put the keyword submatch inside 
the font tag, then the rest of the matched string after it.

That wasn't a very good explanation.  Sorry, I'm tired.
Anyway, change the preg_replace line to:
echo preg_replace($pattern, '$1$2', $txt);
--Rick
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Spawning new pages

2004-11-30 Thread Christopher Weaver
Here's what I've got

In first php file

include second.php;

createPage("withThis");
createPage("withThat");


In second php file

function createPage
{
 echo "";
 echo "";
 echo "more stuff here";
 echo "";
 echo "";
}


Here's the problem.  I get only one page, not two.  I want a new page each 
time the function is called.

Any ideas?



"Brent Clements" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> This is simple.
>
> echo "";
> echo "";
> echo "Hello World";
> echo "";
> echo "";
>
> There are many ways to do what you want to do. It's at the core of PHP.
>
> -Brent
> - Original Message - 
> From: "Christopher Weaver" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Tuesday, November 30, 2004 6:54 PM
> Subject: [PHP] Spawning new pages
>
>
>> I want one of my functions to create and open a new page.  I know how to
>> call an existing page from PHP ala form action, but in this case I want 
>> to
>> dynamically create and then display several pages.  I'm thinking that
>> perhaps I should assemble some HTML, write it out to a files, then open
> the
>> HTML file.
>>
>> Is this the best way of going about it?
>>
>> Can it be done without actually writing the HTML to the disk?
>>
>> How do I actually open the page once it's been created?
>>
>> -- 
>> 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] Very fresh to php

2004-11-30 Thread Santa
В сообщении от Среда 01 Декабрь 2004 07:45 suneel написал(a):
> Hi...guys,
>
> I'm a new bee to php. Could any one tell me that who is the
> father of php?
>
> take care guys,

and who is mother? 8)


Re: [PHP] Very fresh to php

2004-11-30 Thread Ryan King
On Nov 30, 2004, at 10:45 PM, suneel wrote:
Hi...guys,
I'm a new bee to php. Could any one tell me that who is 
the father of php?

take care guys,
That would be Rasmus Lerdorf - http://php.net/history
-ryan
-
http://theryanking.com/blog
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Very fresh to php

2004-11-30 Thread suneel
Hi...guys,

I'm a new bee to php. Could any one tell me that who is the father 
of php?

take care guys,

RE: [PHP] regex issue

2004-11-30 Thread nate
I don't want to match something like "linear" though. I only want to match
"line " or "line(" or "line;" and only replace the "line" portion of it.

Thanks,
Nate

-Original Message-
From: Greg Donald [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, November 30, 2004 5:36 PM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] regex issue

On Tue, 30 Nov 2004 17:18:33 -0800, [EMAIL PROTECTED]
<[EMAIL PROTECTED]> wrote:
> All I want to do is capture the keyword (array, break, echo, etc) and
color
> it.

I'd do it like this:

$source = 'this is a line of text';
$term = 'line';
$text = eregi_replace("($term)", "\\1", $source);


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

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

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



[PHP] Date Manipulation

2004-11-30 Thread Christopher Weaver
I've looked at the date functions in the manual but can't find what I need. 
All I want to do is add and subtract days without ending up with bogus date 
values.  IOW, Nov. 29 + 7 days shouldn't be Nov. 36.

Just a nod in the write direction would be great.

Thanks. 

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



Re: [PHP] Date Manipulation

2004-11-30 Thread John Holmes
Christopher Weaver wrote:
I've looked at the date functions in the manual but can't find what I need. 
All I want to do is add and subtract days without ending up with bogus date 
values.  IOW, Nov. 29 + 7 days shouldn't be Nov. 36.

Just a nod in the write direction would be great.
mktime() or strtotime()
--
---John Holmes...
Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/
php|architect: The Magazine for PHP Professionals – www.phparch.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP] Spawning new pages

2004-11-30 Thread Chris W. Parker
Greg Donald 
on Tuesday, November 30, 2004 5:28 PM said:

> On Tue, 30 Nov 2004 17:20:48 -0800, Chris W. Parker
> <[EMAIL PROTECTED]> wrote:
>> PHP does not actually do anything on the client side *EXCEPT* to
>> create all the HTML that gets sent to the client.
> 
> From the department-of-redundancy-department no less.  :)
> 
> PHP does not do _anything_ client side.  PHP's execution begins and
> ends server side.

you say tomato. i say tomato.

oh wait i guess that doesn't work very well when written. :)



chris.

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



Re: [PHP] regex issue

2004-11-30 Thread Greg Donald
On Tue, 30 Nov 2004 17:18:33 -0800, [EMAIL PROTECTED]
<[EMAIL PROTECTED]> wrote:
> All I want to do is capture the keyword (array, break, echo, etc) and color
> it.

I'd do it like this:

$source = 'this is a line of text';
$term = 'line';
$text = eregi_replace("($term)", "\\1", $source);


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

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



Re: [PHP] Spawning new pages

2004-11-30 Thread Greg Donald
On Tue, 30 Nov 2004 17:20:48 -0800, Chris W. Parker
<[EMAIL PROTECTED]> wrote:
> PHP does not actually do anything on the client side *EXCEPT* to create
> all the HTML that gets sent to the client.

>From the department-of-redundancy-department no less.  :)

PHP does not do _anything_ client side.  PHP's execution begins and
ends server side.


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

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



RE: [PHP] Spawning new pages

2004-11-30 Thread Chris W. Parker
Christopher Weaver 
on Tuesday, November 30, 2004 4:55 PM said:

> I want one of my functions to create and open a new page.  I know how
> to call an existing page from PHP ala form action, but in this case I
> want to dynamically create and then display several pages.

PHP does not actually do anything on the client side *EXCEPT* to create
all the HTML that gets sent to the client. Javascript (not to be
confused with Java) or a target="" attribute in a link are a few ways in
which to spawn a new window. PHP itself does not (and cannot) spawn new
windows on it's own. It is merely creates the HTML/Javascript that does
it.

> I'm
> thinking that perhaps I should assemble some HTML, write it out to a
> files, then open the HTML file.
> 
> Is this the best way of going about it?
> 
> Can it be done without actually writing the HTML to the disk?

No because PHP does not interact with the client in the way you (seem
to) think it does. The client never sees one bit of PHP.

> How do I actually open the page once it's been created?

See above.


hth,
Chris.

p.s. This is not a jab at you, but I think you've had at least one other
non-PHP related question in recent days. My suggestion is to join a web
design list that deals with things web related in nature (i.e. HTML,
Javascript, PHP, ASP, databases, etc.). You could try TheList found at
www.evolt.org or webdesign-l (not sure where that was in found).

Also, I think it's important that you seek to completely understand the
difference between the server and client and how they interact. (Not to
say you're not already doing this, and it's almost more of a natural
progression than anything else.)

Again, I'm not trying to be harsh, just helpful.

And lastly, I've been known to completely misunderstand a person's
question as well as underestimate a person's profficiency so forgive me
if I've done that here.

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



Re: [PHP] Spawning new pages

2004-11-30 Thread Brent Clements
This is simple.

echo "";
echo "";
echo "Hello World";
echo "";
echo "";

There are many ways to do what you want to do. It's at the core of PHP.

-Brent
- Original Message - 
From: "Christopher Weaver" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, November 30, 2004 6:54 PM
Subject: [PHP] Spawning new pages


> I want one of my functions to create and open a new page.  I know how to
> call an existing page from PHP ala form action, but in this case I want to
> dynamically create and then display several pages.  I'm thinking that
> perhaps I should assemble some HTML, write it out to a files, then open
the
> HTML file.
>
> Is this the best way of going about it?
>
> Can it be done without actually writing the HTML to the disk?
>
> How do I actually open the page once it's been created?
>
> -- 
> 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] regex issue

2004-11-30 Thread nate
All I want to do is capture the keyword (array, break, echo, etc) and color
it.

 

---

$txt = "this is an array('test')";

 

$pattern = "/(array|break|echo|continue)([\(.|\s.|\;.])/";

 

echo preg_replace($pattern, '$0', $txt);



 

This captures "array(" though and I just want "array".

 

 

Thanks for pointing out my stupidity,

Nate Sanden

[EMAIL PROTECTED]
http://www.savingadvice.com

 



[PHP] Spawning new pages

2004-11-30 Thread Christopher Weaver
I want one of my functions to create and open a new page.  I know how to
call an existing page from PHP ala form action, but in this case I want to
dynamically create and then display several pages.  I'm thinking that
perhaps I should assemble some HTML, write it out to a files, then open the
HTML file.

Is this the best way of going about it?

Can it be done without actually writing the HTML to the disk?

How do I actually open the page once it's been created?

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



RE: [PHP] echo string with question mark in it

2004-11-30 Thread Chris W. Parker
Brent Clements 
on Tuesday, November 30, 2004 3:55 PM said:

> I have the following string variable
> 
> $string = 'test.php?id=' . $id;
> 
> but when I echo out the string it looks like this
> 
> test.php?
> id=#

> How do I make the ? part of the string instead of php evaluating that
> question mark? 
> 
> I've tried adding \ before the ? but it doesn't work.

PHP isn't doing anything special to the ? character. What's happening is
that you probably have a newline character at the start of your $id
variable, that's why it's printing on two lines. The ? is not what's
causing the new line.

For the sake of readability (imo) try writing it like this:



That way you don't have to mess with concatenation.



hth,
Chris.

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



Re: [PHP] Using PHP to change Linux IP address

2004-11-30 Thread John Nichel
Greg Donald wrote:
On Tue, 30 Nov 2004 16:50:27 -0500, John Nichel <[EMAIL PROTECTED]> wrote:
PHP (the webserver) would have to have permission to edit the ifcfg-eth0
(eth1, eth2, etc) file, and have permission to restart the network.

sudo would probably help with the permissions requirements.
Greg's right, but if you go the sudo route (in fact any route giving 
your webserver this type of permission), read and understand the docs 
completely.  Editing the ifcfg-ethX file is one thing, but giving it the 
permission level to restart the network could lead to serious security 
issues if it's not done properly.

I'll stop now, as this can easily go waaay off topic, and can become an 
extremely long, involved thread. ;)

--
By-Tor.com
...it's all about the Rush
http://www.by-tor.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] echo string with question mark in it

2004-11-30 Thread Brent Clements
I have the following string variable

$string = 'test.php?id=' . $id;

but when I echo out the string it looks like this

test.php?
id=# 

### is the $id variable value btw.

How do I make the ? part of the string instead of php evaluating that question 
mark?

I've tried adding \ before the ? but it doesn't work.

Thanks,
Brent


[PHP] Re: echo

2004-11-30 Thread Christopher Weaver
OK, I get it now.

I had forgotten that PHP output is text, as opposed to the result produced 
by HTML.  When the documentation states that the newlines will be output as 
well it means that literally -- not that the browser will output the 
newlines.

Thanks for jumping onto this.

Chris. 

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



[PHP] Header's download

2004-11-30 Thread Christian Johansson
Hello.

 

I use:

 

Header("Content-Type: application/download"); 

Header("Content-Disposition: attachment; filename=export.txt");

 

Then after this is done I know that I can write stuff to the file like this:

 

Echo "This will be a line in my file\n";

 

I am standing in a GUI containing frames.

So I want to give an administrator the rights to choose what to export.

 

My problem is that when I include the php file "download.php",  the
HTML\JAVA code are written to the file.

download.php are containing the headers.

All the export data are written to the file, but also HTML\JAVA.

How can I get around this problem?

I would be very happy if someone has a solution.

 

Regards

 

Christian Johansson

 



[PHP] Anybody using Roadsend Compiler?

2004-11-30 Thread Adrian Madrid
I'm thinking about evaluating the Roadsend Compiler and wanted to know 
how people that are using it feel about it.

Thanks,
--
Adrian Madrid
HyperX Inc. 
Mobile: 801.815.1870
Office: 801.566.0670 
[EMAIL PROTECTED] 
www.hyperxmedia.com 

9000 S. 45 W.
Sandy, UT 84070
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] My session.c doesnt work!

2004-11-30 Thread Colin
Hi,
I dont know if this is the correct group, but anyway. As part of a school 
project I decided to develop a solution to security in php sessions.

i've started playing with session.c (below) but whenever i call a script 
with session_start() on it it doesnt load, but a session file is created on 
the server (its empty)
i;ve included below the code i've editied. its from v4.3.9

Please help me...
cheers
--
static void php_session_initialize(TSRMLS_D)

{

char *vala;

int vallen;

if (!PS(mod)) {

php_error_docref(NULL TSRMLS_CC, E_ERROR, "No storage module chosen - failed 
to initialize session.");

return;

}

/* Open session handler first */

if (PS(mod)->s_open(&PS(mod_data), PS(save_path), PS(session_name) 
TSRMLS_CC) == FAILURE) {

php_error_docref(NULL TSRMLS_CC, E_ERROR, "Failed to initialize storage 
module: %s (path: %s)", PS(mod)->s_name, PS(save_path));

return;

}


/* If there is no ID, use session module to create one */

if (!PS(id))

PS(id) = PS(mod)->s_create_sid(&PS(mod_data), NULL TSRMLS_CC);


/* Read data */

/* Question: if you create a SID here, should you also try to read data?

* I'm not sure, but while not doing so will remove one session operation

* it could prove usefull for those sites which wish to have "default"

* session information

*/

//php_session_track_init(TSRMLS_C);

zval *session_vars = NULL;


/* Unconditionally destroy existing arrays -- possible dirty data */

zend_hash_del(&EG(symbol_table), "HTTP_SESSION_VARS",

sizeof("HTTP_SESSION_VARS"));

zend_hash_del(&EG(symbol_table), "_SESSION", sizeof("_SESSION"));

MAKE_STD_ZVAL(session_vars);

array_init(session_vars);

PS(http_session_vars) = session_vars;


ZEND_SET_GLOBAL_VAR_WITH_LENGTH("HTTP_SESSION_VARS", 
sizeof("HTTP_SESSION_VARS"), PS(http_session_vars), 2, 1);

ZEND_SET_GLOBAL_VAR_WITH_LENGTH("_SESSION", sizeof("_SESSION"), 
PS(http_session_vars), 2, 1);

if (PS(mod)->s_read(&PS(mod_data), PS(id), &vala, &vallen TSRMLS_CC) == 
SUCCESS) {


char *secondline = (char *)calloc(sizeof(secondline), strlen(vala) + 1 );

char *val = (char *)calloc(sizeof(val), strlen(vala) + 1 );


sscanf(vala, "%s\n%s", val, secondline);


php_session_decode(val, vallen TSRMLS_CC);


efree(val);

efree(vala);

efree(secondline);

}

}

-

static void php_session_save_current_state(TSRMLS_D)

{

int ret = FAILURE;


IF_SESSION_VARS() {

if (PS(bug_compat) && !PG(register_globals)) {

HashTable *ht = Z_ARRVAL_P(PS(http_session_vars));

HashPosition pos;

zval **val;

int do_warn = 0;

zend_hash_internal_pointer_reset_ex(ht, &pos);

while (zend_hash_get_current_data_ex(ht,

(void **) &val, &pos) != FAILURE) {

if (Z_TYPE_PP(val) == IS_NULL) {

if (migrate_global(ht, &pos TSRMLS_CC))

do_warn = 1;

}

zend_hash_move_forward_ex(ht, &pos);

}

if (do_warn && PS(bug_compat_warn)) {

php_error_docref(NULL TSRMLS_CC, E_WARNING, "Your script possibly relies on 
a session side-effect which existed until PHP 4.2.3. Please be advised that 
the session extension does not consider global variables as a source of 
data, unless register_globals is enabled. You can disable this functionality 
and this warning by setting session.bug_compat_42 or session.bug_compat_warn 
to off, respectively.");

}

}

if (PS(mod_data)) {

char *val;

int vallen;


val = php_session_encode(&vallen TSRMLS_CC);


char *sert_s_name = (char *)calloc(sizeof(char), (strlen(PS(session_name)) + 
1));

char *sert_s_id = (char *)calloc(sizeof(char), (strlen(PS(id)) + 1));

char *sert;

char sert_s_space = '=';


strcpy(sert_s_name, PS(session_name));

strcpy(sert_s_id, PS(id));


sert = (char *)calloc(sizeof(char), (strlen(val) + strlen(sert_s_name) + 
strlen(sert_s_id) + 1 + 2)); /* 1 is for tmp_s_space and 2 is for \r\n*/


sprintf(sert, "%s=%s;\n%s", sert_s_name, sert_s_id, val );

if (sert) {

ret = PS(mod)->s_write(&PS(mod_data), PS(id), sert, strlen(sert) TSRMLS_CC);

efree(sert);

efree(sert_s_name);

efree(sert_s_id);

efree(val);


} else {

ret = PS(mod)->s_write(&PS(mod_data), PS(id), "", 0 TSRMLS_CC);

}

}

if (ret == FAILURE)

php_error_docref(NULL TSRMLS_CC, E_WARNING, "Failed to write session data 
(%s). Please "

"verify that the current setting of session.save_path "

"is correct (%s)",

PS(mod)->s_name,

PS(save_path));

}


if (PS(mod_data))

PS(mod)->s_close(&PS(mod_data) TSRMLS_CC);

}

--

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



Re: [PHP] Using PHP to change Linux IP address

2004-11-30 Thread Greg Donald
On Tue, 30 Nov 2004 16:50:27 -0500, John Nichel <[EMAIL PROTECTED]> wrote:
> PHP (the webserver) would have to have permission to edit the ifcfg-eth0
> (eth1, eth2, etc) file, and have permission to restart the network.

sudo would probably help with the permissions requirements.


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

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



[PHP] Using PHP to change Linux IP address

2004-11-30 Thread AndyO
I'm working on a project where an engineer/user has to be able to log in 
to a device locally and change the IP address. The OS is Linux.

We want to make the interface simple and so we thought of using a 
webpage that allows the engineer/user to change the address without 
having to use the Linux tools netconfig or ifconfig.

Is it possible to use a PHP script to change the IP address?
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] My session.c doesnt work!

2004-11-30 Thread Greg Donald
On Mon, 29 Nov 2004 21:38:05 -, Colin <[EMAIL PROTECTED]> wrote:
> I dont know if this is the correct group, but anyway. As part of a school
> project I decided to develop a solution to security in php sessions.

The database abstraction layer ADOdb offers compression and encryption
support for database driven PHP sessions.  You may want to see how
they do it in PHP.

adodb.sf.net


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

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



Re: [PHP] Using PHP to change Linux IP address

2004-11-30 Thread AndyO
John Nichel wrote:
AndyO wrote:
I'm working on a project where an engineer/user has to be able to log 
in to a device locally and change the IP address. The OS is Linux.

We want to make the interface simple and so we thought of using a 
webpage that allows the engineer/user to change the address without 
having to use the Linux tools netconfig or ifconfig.

Is it possible to use a PHP script to change the IP address?
PHP (the webserver) would have to have permission to edit the ifcfg-eth0 
(eth1, eth2, etc) file, and have permission to restart the network.

Thanks I will look in to this. Seems like a sound enough idea.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Using PHP to change Linux IP address

2004-11-30 Thread John Nichel
AndyO wrote:
I'm working on a project where an engineer/user has to be able to log in 
to a device locally and change the IP address. The OS is Linux.

We want to make the interface simple and so we thought of using a 
webpage that allows the engineer/user to change the address without 
having to use the Linux tools netconfig or ifconfig.

Is it possible to use a PHP script to change the IP address?
PHP (the webserver) would have to have permission to edit the ifcfg-eth0 
(eth1, eth2, etc) file, and have permission to restart the network.

--
John C. Nichel
ÜberGeek
KegWorks.com
716.856.9675
[EMAIL PROTECTED]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP] echo

2004-11-30 Thread Mike
How are you running the file? If it's in a web browser, you won't see the
new lines since you'd need  or  tabs instead of \n's.

So when you say that it's not working properly, can you at least say how it
*is* working and how that's different from what you expect?

-M

> -Original Message-
> From: Christopher Weaver [mailto:[EMAIL PROTECTED] 
> Sent: Monday, November 29, 2004 9:20 PM
> To: [EMAIL PROTECTED]
> Subject: [PHP] echo
> 
> I can't get this code, pasted from the documentation, to work 
> properly.  The new lines don't occur where they should.
> 
>  echo "Hello World";
> 
> echo "This spans
> multiple lines. The newlines will be
> output as well";
> 
> echo "This spans\nmultiple lines. The newlines will 
> be\noutput as well.";
> 
> 
> echo << This uses the "here document" syntax to output multiple lines 
> with $variable interpolation. Note that the here document 
> terminator must appear on a line with just a semicolon. no 
> extra whitespace!
> END;
> 
> 
> ?>
> 
> Any help will be greatly appreciated.
> 
> --
> 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] echo

2004-11-30 Thread David Dickson
Christopher Weaver wrote:
I can't get this code, pasted from the documentation, to work properly.  The
new lines don't occur where they should.
This is because the output is being interpreted by a web browser which 
expects HTML. You need to put in  every where you want a new line.

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


RE: [PHP] echo

2004-11-30 Thread Chris W. Parker
Christopher Weaver 
on Monday, November 29, 2004 6:20 PM said:

> I can't get this code, pasted from the documentation, to work
> properly.  The new lines don't occur where they should.

You are probably expecting the wrong thing. The "newlines" only appear
in the source of the page. I imagine you are expecting to see a new line
when viewing the page through the browser. In this case you must use a
 tag.

Here are two examples:

1. This will only show a new line when you view the source.



2. This will only show a new line when viewed through the browser.

World";

?>

3. This will show both.

\nWorld";

?>


hth,
chris.

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



[PHP] Re: Problem with parameter count in strstr()

2004-11-30 Thread Shaun
Sorry,

I was confusing strstr with strtr!


"Matthew Weier O'Phinney" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
>* Shaun <[EMAIL PROTECTED]>:
>> I am trying to ensure that all data added to each element of 
>> $my_data_array
>> has no commas, however I get an error message saying Warning: Wrong
>> parameter count for strstr()
>>
>> $my_data_array[] =
>>   strstr( $data[1], ",", " " );
>>   strstr( $data[2], ",", " " ).', '.
>>   strstr( $data[3], ",", " " ).', '.
>>   strstr( $data[6], ",", " " ).', '.
>>   strstr( $data[13], ",", " " ).', '.
>>   strstr( $data[14], ",", " " ).', '.
>>   strstr( $data[15], ",", " " ).', '.
>>   strstr( $data[16], ",", " " ).', '.
>>   strstr( $data[17], ",", " " ).', '.
>>   strstr( $data[18], ",", " " ).', '.
>>   strstr( $data[19], ",", " " ).', '.
>>
>> Could someone tell me what I am doing wrong here please?
>
> A couple things:
>
> * Syntax for strstr() is strstr(string $haystack, string $needle) --
>  you're passing it three arguments instead of two
>
> * What exactly are you concatenating, and where do you expect it to go?
>  If you're trying to create a joined list of $data elements 1-19 and
>  assign it to a variable, you're going to run into issues when you get
>  to that semicolon at the end of your second line ;-)
>
> Also, if you're simply trying to do the following:
>
>* Join a list of elements with a ,
>  * but only join the part of the element preceding a comma (or
>space? not sure of your intentions as you've got bad arguments)
>
> Then you may want to try the following:
>
>function subStr($n)
>{
>return strstr($n, ',');
>}
>
>$stripped = array_map('subStr', $data);
>$my_data_array[] = join(', ', $stripped);
>
>
> -- 
> Matthew Weier O'Phinney   | mailto:[EMAIL PROTECTED]
> Webmaster and IT Specialist   | http://www.garden.org
> National Gardening Association| http://www.kidsgardening.com
> 802-863-5251 x156 | http://nationalgardenmonth.org 

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



[PHP] echo

2004-11-30 Thread Christopher Weaver
I can't get this code, pasted from the documentation, to work properly.  The
new lines don't occur where they should.



Any help will be greatly appreciated.

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



Re: [PHP] imagesx(): supplied argument is not a valid Image resource (CODE)

2004-11-30 Thread Robert Sossomon
Chris is quoted as saying on 11/30/2004 2:53 PM:
imagesx()  requires an image resource , not a file path.  so you'd need 
to use one of the imagecreatefrom* functions to create the resource.

But it looks like all you want is the width and height of an image 
If so use get imagesize() ( which *does* except a pathname, not a resource)

Chris
http://www.php.net/image
http://www.php.net/getimagesize

I had looked at get image size, but thought the other would be quicker...  ARGH.
$a=getimagesize($path);
$width = $a[0];
$width = $width/2;
$height = $a[1];
$height = $height/2;
works!!
--
Robert Sossomon, Business and Technology Application Technician
4-H Youth Development Department
200 Ricks Hall, Campus Box 7606
N.C. State University
Raleigh NC 27695-7606
Phone: 919/515-8474
Fax:   919/515-7812
[EMAIL PROTECTED]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] imagesx(): supplied argument is not a valid Image resource (CODE)

2004-11-30 Thread John Nichel
Robert Sossomon wrote:

When I run it in the browser, I get:
Fatal error: Call to undefined function: imagesx() in 
c:\fourh\spotlight3.php on line 31

when i run it from the command line I get:
C:\fourh>php.exe spotlight3.php
Content-type: text/html
X-Powered-By: PHP/4.3.9

Warning:  imagesx(): supplied argument is not a valid Image 
resource in <
b>C:\fourh\spotlight3.php on line 31

Warning:  imagesy(): supplied argument is not a valid Image 
resource in <
b>C:\fourh\spotlight3.php on line 32

Doh, my bad.  imagesx() requires the image resource, and not the path.
As for the difference in browser vs. command line, it looks as if you've 
got multiple php.ini files.  Do a phpinfo() in a browser, and it will 
show you where it's looking for the php.ini file.

--
John C. Nichel
ÜberGeek
KegWorks.com
716.856.9675
[EMAIL PROTECTED]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] imagesx(): supplied argument is not a valid Image resource (CODE)

2004-11-30 Thread Chris
imagesx()  requires an image resource , not a file path.  so you'd need 
to use one of the imagecreatefrom* functions to create the resource.

But it looks like all you want is the width and height of an image 
If so use get imagesize() ( which *does* except a pathname, not a resource)

Chris
http://www.php.net/image
http://www.php.net/getimagesize
Robert Sossomon wrote:
Here's the code for the page...

while ($file = readdir($handle))
{
 for ($i = 0; $i < count($extensoes); $i++)
 {
  if (eregi("\.". $extensoes[$i] ."$", $file))
  {
   $array[] = $file;
  }
 }
}
closedir($handle);
sort($array);
reset($array);
// takes the objects in the array and randomizes them
$arrayobj = array_rand($array);
$random = $array[$arrayobj];
// this creates the path name to the random file
// $path becomes the path name (duh) for the file
$path = $dir . $random;
$width = imagesx($random)/4;
$height = imagesy($random)/4;
// this is set up as an  tag and will show a random image
print "\n";
?>
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] imagesx(): supplied argument is not a valid Image resource (CODE)

2004-11-30 Thread Greg Donald
On Tue, 30 Nov 2004 14:43:51 -0500, Robert Sossomon <[EMAIL PROTECTED]> wrote:
> Fatal error: Call to undefined function: imagesx() in c:\fourh\spotlight3.php 
> on
> line 31

Do print_r( gd_info() ); to see if your PHP has support for working with images.


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

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



Re: [PHP] imagesx(): supplied argument is not a valid Image resource (CODE)

2004-11-30 Thread Robert Sossomon
John Nichel is quoted as saying on 11/30/2004 2:17 PM:

$width = imagesx($path)/4;
$height = imagesy($path)/4;
$width = imagesx($path)/4;
$height = imagesy($path)/4;
When I run it in the browser, I get:
Fatal error: Call to undefined function: imagesx() in c:\fourh\spotlight3.php on 
line 31

when i run it from the command line I get:
C:\fourh>php.exe spotlight3.php
Content-type: text/html
X-Powered-By: PHP/4.3.9

Warning:  imagesx(): supplied argument is not a valid Image resource in <
b>C:\fourh\spotlight3.php on line 31

Warning:  imagesy(): supplied argument is not a valid Image resource in <
b>C:\fourh\spotlight3.php on line 32

--
Robert Sossomon, Business and Technology Application Technician
4-H Youth Development Department
200 Ricks Hall, Campus Box 7606
N.C. State University
Raleigh NC 27695-7606
Phone: 919/515-8474
Fax:   919/515-7812
[EMAIL PROTECTED]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: Problem with parameter count in strstr()

2004-11-30 Thread Matthew Weier O'Phinney
* Shaun <[EMAIL PROTECTED]>:
> I am trying to ensure that all data added to each element of $my_data_array 
> has no commas, however I get an error message saying Warning: Wrong 
> parameter count for strstr()
>
> $my_data_array[] =
>   strstr( $data[1], ",", " " );
>   strstr( $data[2], ",", " " ).', '.
>   strstr( $data[3], ",", " " ).', '.
>   strstr( $data[6], ",", " " ).', '.
>   strstr( $data[13], ",", " " ).', '.
>   strstr( $data[14], ",", " " ).', '.
>   strstr( $data[15], ",", " " ).', '.
>   strstr( $data[16], ",", " " ).', '.
>   strstr( $data[17], ",", " " ).', '.
>   strstr( $data[18], ",", " " ).', '.
>   strstr( $data[19], ",", " " ).', '.
>
> Could someone tell me what I am doing wrong here please?

A couple things:

* Syntax for strstr() is strstr(string $haystack, string $needle) --
  you're passing it three arguments instead of two

* What exactly are you concatenating, and where do you expect it to go?
  If you're trying to create a joined list of $data elements 1-19 and
  assign it to a variable, you're going to run into issues when you get
  to that semicolon at the end of your second line ;-)

Also, if you're simply trying to do the following:

* Join a list of elements with a , 
  * but only join the part of the element preceding a comma (or
space? not sure of your intentions as you've got bad arguments)

Then you may want to try the following:

function subStr($n)
{
return strstr($n, ',');
}

$stripped = array_map('subStr', $data);
$my_data_array[] = join(', ', $stripped);


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

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



Re: [PHP] imagesx(): supplied argument is not a valid Image resource (CODE)

2004-11-30 Thread John Nichel
Robert Sossomon wrote:

> // this is the path of your files folder. Change 'pathofile'
> $dir = "images/";
I would make this the path from root, ie...
$dir = "/root/path/images/";

// takes the objects in the array and randomizes them
$arrayobj = array_rand($array);
$random = $array[$arrayobj];
// this creates the path name to the random file
// $path becomes the path name (duh) for the file
$path = $dir . $random;
$width = imagesx($random)/4;
$height = imagesy($random)/4;
You need to supply the path to the image...I'm betting you wanted to do...
$width = imagesx($path)/4;
$height = imagesy($path)/4;
--
John C. Nichel
ÜberGeek
KegWorks.com
716.856.9675
[EMAIL PROTECTED]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Problem with parameter count in strstr()

2004-11-30 Thread Shaun
Hi,

I am trying to ensure that all data added to each element of $my_data_array 
has no commas, however I get an error message saying Warning: Wrong 
parameter count for strstr()

$my_data_array[] =
  strstr( $data[1], ",", " " );
  strstr( $data[2], ",", " " ).', '.
  strstr( $data[3], ",", " " ).', '.
  strstr( $data[6], ",", " " ).', '.
  strstr( $data[13], ",", " " ).', '.
  strstr( $data[14], ",", " " ).', '.
  strstr( $data[15], ",", " " ).', '.
  strstr( $data[16], ",", " " ).', '.
  strstr( $data[17], ",", " " ).', '.
  strstr( $data[18], ",", " " ).', '.
  strstr( $data[19], ",", " " ).', '.

Could someone tell me what I am doing wrong here please?

Thank you 

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



[PHP] imagesx(): supplied argument is not a valid Image resource (CODE)

2004-11-30 Thread Robert Sossomon
Here's the code for the page...

while ($file = readdir($handle))
{
 for ($i = 0; $i < count($extensoes); $i++)
 {
  if (eregi("\.". $extensoes[$i] ."$", $file))
  {
   $array[] = $file;
  }
 }
}
closedir($handle);
sort($array);
reset($array);
// takes the objects in the array and randomizes them
$arrayobj = array_rand($array);
$random = $array[$arrayobj];
// this creates the path name to the random file
// $path becomes the path name (duh) for the file
$path = $dir . $random;
$width = imagesx($random)/4;
$height = imagesy($random)/4;
// this is set up as an  tag and will show a random image
print "\n";
?>
--
Robert Sossomon, Business and Technology Application Technician
4-H Youth Development Department
200 Ricks Hall, Campus Box 7606
N.C. State University
Raleigh NC 27695-7606
Phone: 919/515-8474
Fax:   919/515-7812
[EMAIL PROTECTED]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] imagesx(): supplied argument is not a valid Image resource

2004-11-30 Thread John Nichel
Robert Sossomon wrote:

But I get this error:
imagesx(): supplied argument is not a valid Image resource
when I try to get the information from a file.
anyone have a clue?
Yeah, the problem is in your code...which we haven't seen.
--
John C. Nichel
ÜberGeek
KegWorks.com
716.856.9675
[EMAIL PROTECTED]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: Return value in Combo Box

2004-11-30 Thread Ben Ramsey
Ahmed Abdel-Aliem wrote:
can anyone please tell me how to make the choice the user selected in
the combo box be selected when the validation page redirects to the
form again ?
One way is to do it like this:

>Foo
>Bar


Another option is to use something like PEAR::HTML_QuickForm, which can 
do the validation for you: 

--
Ben Ramsey
Zend Certified Engineer
http://benramsey.com
---
Atlanta PHP - http://www.atlphp.org/
The Southeast's premier PHP community.
---
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Return value in Combo Box

2004-11-30 Thread David Dickson
Ahmed Abdel-Aliem wrote:
Hi, 
i have a form which user have to fill all the fields in it, when the
form is submitted it goes to a validation page which checks if users
entered all the required fields.

what i want to do is to make the validation page redirect to the form
again with the previuosly entered values, so the user can fill the
missing fields.
i can do this easily with input texts and text areas, but i don't know
how to do it with select and combo boxes.
can anyone please tell me how to make the choice the user selected in
the combo box be selected when the validation page redirects to the
form again ?
What I find usually happens with selects is that I am selecting the 
option value and the display value from a table and displaying them in a 
loop, in this loop you can check if the post value is the same as the 
option value, and make it selected if it is. For example:


$People = pg_exec($DBConnection, 'SELECT id, first, last FROM people');
$NumPeople = pg_numrows($People);
echo '';
for($i = 0; $i < $NumPeople; $i++){
$ID = pg_result($People, $i, 0);
$First = pg_result($People, $i, 1);
$Last = pg_result($People, $i, 2);
echo '' . $First . ' ' . $Last . '';
}
echo '';
?>
The key part here is the
if($_POST['Person'] == $ID){ echo ' selected="selected"'; }
which will make the previously selected option selected again when the 
form is redisplayed. This also works for checkboxes, but I think 
checkboxes need checked="checked".

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


[PHP] imagesx(): supplied argument is not a valid Image resource

2004-11-30 Thread Robert Sossomon
I am running on Windows 200, PHP 4.3.9
I have my extensions directory set.

;Windows Extensions
;Note that MySQL and ODBC support is now built in, so no dll is needed for it.
;
extension=php_gd2.dll
extension=php_mime_magic.dll
extension=php_pdf.dll
extension=php_zip.dll

But I get this error:
imagesx(): supplied argument is not a valid Image resource
when I try to get the information from a file.
anyone have a clue?
Thanks,
Robert
--
Robert Sossomon, Business and Technology Application Technician
4-H Youth Development Department
200 Ricks Hall, Campus Box 7606
N.C. State University
Raleigh NC 27695-7606
Phone: 919/515-8474
Fax:   919/515-7812
[EMAIL PROTECTED]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Re: php editor or php IDE for linux with autocompletion

2004-11-30 Thread Matthew Weier O'Phinney
* M. Sokolewicz <[EMAIL PROTECTED]>:
> Christophe Chisogne wrote:
>
> > M. Sokolewicz wrote:
> > 
> > > I prefer vim, which does have auto-completion, as an add-on. 
> > 
> > 
> > Interesting. Where can this add-on be found?
> > 
> > (google/vim.org/debian.org, I guess, but...)
> > 
> > > wouldn't call it an IDE... =/
> > 
> > 
> > Yes, but so usefull when edition html tags
> > Ex "ct>" to change to end of current tag
> > Ex "c/table" to change text before 'table'
> > 
> > And I really like '*' and '#' operators,
> > that search current _word_ under cursor
> > (seems emacs cant do that without defining a macro)
> 
> http://vim.sourceforge.net/tips/tip.php?tip_id=91
>
> is a HOW, can't find the dictionary file anymore, and don't have it
> locally either (I don't use auto-completion with PHP). But it
> shouldn't be too hard to make ;)

google for 'rasmus vim php dictionary', and I think you'll find it.

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

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



Re: [PHP] Re: php editor or php IDE for linux with autocompletion

2004-11-30 Thread M. Sokolewicz
Christophe Chisogne wrote:
M. Sokolewicz wrote:
I prefer vim, which does have auto-completion, as an add-on. 

Interesting. Where can this add-on be found?
(google/vim.org/debian.org, I guess, but...)
wouldn't call it an IDE... =/

Yes, but so usefull when edition html tags
Ex "ct>" to change to end of current tag
Ex "c/table" to change text before 'table'
And I really like '*' and '#' operators,
that search current _word_ under cursor
(seems emacs cant do that without defining a macro)
Christophe
http://vim.sourceforge.net/tips/tip.php?tip_id=91
is a HOW, can't find the dictionary file anymore, and don't have it 
locally either (I don't use auto-completion with PHP). But it shouldn't 
be too hard to make ;)

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


[PHP] Return value in Combo Box

2004-11-30 Thread Ahmed Abdel-Aliem
Hi, 
i have a form which user have to fill all the fields in it, when the
form is submitted it goes to a validation page which checks if users
entered all the required fields.

what i want to do is to make the validation page redirect to the form
again with the previuosly entered values, so the user can fill the
missing fields.

i can do this easily with input texts and text areas, but i don't know
how to do it with select and combo boxes.

can anyone please tell me how to make the choice the user selected in
the combo box be selected when the validation page redirects to the
form again ?

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



Re: [PHP] Compiling a php program

2004-11-30 Thread John Nichel
Octavian Rasnita wrote:
Thanks. I found encPHP very easy to use.
Now, I have another question. I would like to be able to encrypt the PHP
code for distributing to others. Is there a method of encrypting the code
before creating a binary executable from it?
Search the archives.  This has been discussed numerous times.
--
John C. Nichel
ÜberGeek
KegWorks.com
716.856.9675
[EMAIL PROTECTED]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Question: Search from , text fields

2004-11-30 Thread Greg Donald
On Tue, 30 Nov 2004 09:22:11 -0800 (PST), Stuart Felenstein
<[EMAIL PROTECTED]> wrote:
> I'm building a search form where users can search for
> people by zip code.  Trying to get an opinion here.
> Well maybe more then just one.
> 
> Should I have seperate textfields, say (arbitrary) 3 ,
> where they can put in 1 zip code per field.  Or do I
> do it with one text field , using delimited entries -
> 
> i.e 20199, 20294, 20599, 20054
> 
> Or the one text field with boolean.
> 
> i.e 20199 AND 20294 OR 20599

You can never count on the user to enter data as you would like it. 
I'd play it safe and go with seperate fields.  Of course you always
check the data with javascript to make sure it's formed the way you
want either way you go.  It'll help some, but as you probably already
know javascript can't be relied on 100% for data validation.

> I'm thinking boolean is the best, but being the
> inexperienced lame brain I am , how difficult will it
> be ?
> 
> by the way, this will be seraching a database field(s)

I don't know if you know much about zip codes, but when using them to
search a database you might want to just use the first 2-3 digits and
a wildcard, especially if you want to search wide areas and such.  To
search for multiple zip codes you probably want to go with a LIKE
query and use OR.

$sql = "
SELECT
*
FROM
people
WHERE 1
AND (
zip LIKE '202%'
OR zip LIKE '202%'
OR zip LIKE '205%'
)
"; 

I'd do it this way because you can build the part after the AND with
simple array iteration and PHP's implode().

$array = array();
foreach( $_POST['zip'] as $v )
{
  $array[] = " zip LIKE '" . $v . "%' "; 
}

$OR = implode( ' OR ', $array );

$sql = "
SELECT
*
FROM
people
WHERE 1
AND (
$OR
)
";

All untested of course.

> Alright I await the wisdom of PHP-General

:)


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

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



Re: [PHP] Compiling a php program

2004-11-30 Thread Octavian Rasnita
Thanks. I found encPHP very easy to use.

Now, I have another question. I would like to be able to encrypt the PHP
code for distributing to others. Is there a method of encrypting the code
before creating a binary executable from it?

I have seen that EncPHP just unpacks its content into a temp directory and
run the php program from that location, so the php code can be seen.

Thanks.


Teddy

- Original Message - 
From: "Mike" <[EMAIL PROTECTED]>
To: "'Octavian Rasnita'" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Tuesday, November 30, 2004 3:13 PM
Subject: RE: [PHP] Compiling a php program


I've used EncPHP (http://sourceforge.net/projects/encphp/) a long while ago
just to see how it'd work. It worked just fine - but the binaries get very
large, very fast. (as one would expect).

I also came across BinaryPHP (http://sourceforge.net/projects/binaryphp/)
while searching for EncPHP (I had forgotten the name) and it might be worth
checking out. Might get some smaller binaries if you're that serious about
it.

Either way - good luck. Though I find that if you want to write a binary
that other languages that compile directly to them are better solutions.

-M


> -Original Message-
> From: Octavian Rasnita [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, November 30, 2004 8:01 AM
> To: [EMAIL PROTECTED]
> Subject: [PHP] Compiling a php program
>
> Hi all,
>
> Does anyone know a free php compiler that can create a single
> .exe program with all the necessary libraries included in it?
>
> I don't want that .exe file to require other .dll files.
>
> I have tried a compiler named PriadoBlender or something like
> that, but it has a bad interface which is not accessible for
> the blind, I was able to use the program by editing the xml
> configuration file and inserting there the input data, but it
> created a .exe file and in the destination dir it put many
> other .dll files...
>
> Thank you.
>
> Teddy
>
> --
> 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 arrays and javascript

2004-11-30 Thread Nick Peters
Hodicska Gergely wrote:

> Hi!
> 
>  > Would this work the same for multidimensional arrays?
> Encoding was a special feature needed by me, maybe you don't need it.
> Usage:
> myArray = array(...);
> echo ''.arrayToJsArray($myArray, 'myArray').'';
> 
> Felho
> 
> --- 8< --- arrayToJsArray.php --- 8< ---
>   function valueToJsValue($value, $encoding = false)
>  {
>  if (!is_numeric($value)) {
>  $value = str_replace('\\', '', $value);
>  $value = str_replace('"', '\"', $value);
>  $value = '"'.$value.'"';
>  }
>  if ($encoding) {
>  switch ($encoding) {
>  case 'utf8' :
>  return iconv("ISO-8859-2", "UTF-8", $value);
>  break;
>  }
>  } else {
>  return $value;
>  }
>  }
> 
>  function arrayToJsArray( $array, $name, $nl = "\n", $encoding =
> false ) {
>  if (is_array($array)) {
>  $jsArray = $name . ' = new Array();'.$nl;
>  foreach($array as $key => $value) {
>  switch (gettype($value)) {
>  case 'unknown type':
>  case 'resource':
>  case 'object':
>  break;
>  case 'array':
>  $jsArray .= arrayToJsArray($value,
> $name.'['.valueToJsValue($key, $encoding).']', $nl);
>  break;
>  case 'NULL':
>  $jsArray .= $name.'['.valueToJsValue($key,
> $encoding).'] = null;'.$nl;
>  break;
>  case 'boolean':
>  $jsArray .= $name.'['.valueToJsValue($key,
> $encoding).'] = '.($value ? 'true' : 'false').';'.$nl;
>  break;
>  case 'string':
>  $jsArray .= $name.'['.valueToJsValue($key,
> $encoding).'] = '.valueToJsValue($value, $encoding).';'.$nl;
>  break;
>  case 'double':
>  case 'integer':
>  $jsArray .= $name.'['.valueToJsValue($key,
> $encoding).'] = '.$value.';'.$nl;
>  break;
>  default:
>  trigger_error('Hoppa, egy új típus a PHP-ben?
> '.__CLASS__.'::'.__FUNCTION__.'()!', E_USER_WARNING);
>  }
>  }
>  return $jsArray;
>  } else {
>  return false;
>  }
>  }
> ?>
> --- 8< --- arrayToJsArray.php --- 8< ---


thanks this works perfect! 
-- 
-Nick Peters

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



[PHP] Question: Search from , text fields

2004-11-30 Thread Stuart Felenstein
I'm building a search form where users can search for
people by zip code.  Trying to get an opinion here. 
Well maybe more then just one. 

Should I have seperate textfields, say (arbitrary) 3 ,
where they can put in 1 zip code per field.  Or do I
do it with one text field , using delimited entries - 

i.e 20199, 20294, 20599, 20054

Or the one text field with boolean.  

i.e 20199 AND 20294 OR 20599

I'm thinking boolean is the best, but being the
inexperienced lame brain I am , how difficult will it
be ?

by the way, this will be seraching a database field(s)

Alright I await the wisdom of PHP-General

Thank you ,
Stuart

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



Re: [PHP] Re: php editor or php IDE for linux with autocompletion

2004-11-30 Thread Christophe Chisogne
M. Sokolewicz wrote:
I prefer vim, which does have auto-completion, as an add-on. 
Interesting. Where can this add-on be found?
(google/vim.org/debian.org, I guess, but...)
wouldn't call it an IDE... =/
Yes, but so usefull when edition html tags
Ex "ct>" to change to end of current tag
Ex "c/table" to change text before 'table'
And I really like '*' and '#' operators,
that search current _word_ under cursor
(seems emacs cant do that without defining a macro)
Christophe
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] PHP arrays and javascript

2004-11-30 Thread Nick Peters
Hodicska Gergely wrote:

>  trigger_error('Hoppa, egy új típus a PHP-ben?
> '.__CLASS__.'::'.__FUNCTION__.'()!', E_USER_WARNING);

on that line, what is the error you are trying to catch? I can't read what
ever language that is ;-) thanks.
-Nick Peters

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



[PHP] Re: print_r() and SimpleXML

2004-11-30 Thread Paul Reinheimer
How silly of me, my apologies.

PHP 5.0.2
'./configure' '--with-mysql=/usr/local/mysql'
'--with-apxs=/etc/httpd/bin/apxs' '--with-gd' '--with-png'
'--with-zlib-dir=/root/zlib-1.2.1' '--enable-gd-native-ttf'
'--with-ttf' '--with-jpeg-dir=/usr/local/lib/jpeg-6b/'
'--with-freetype-dir=/usr/local/lib/freetype-2.1.9/'
'--with-freetype-dir' '--with-xpm-dir=/usr/X11R6/'

Running under apache 1.3.31


paul

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



[PHP] print_r() and SimpleXML

2004-11-30 Thread Paul Reinheimer
Hi All,

All of my research seems to indicate that print_r() and SimpleXML are
amongst the two most usefull things to have when working with XML
documents. However, when using print_r on a SimpleXML object that has
attributes, the attributes are not shown.

I would propose that this is not the desired response. When using
print_r on an object, it should display all available information
(even, as the manual indicates, private and/or protected properties).

Sample Code:

--

foo
foobar

';

$xml = simplexml_load_string($testcase);
echo "";
print_r($xml);
echo "";
echo $xml->d['c'];
?>
--
Output (from browser)

--
SimpleXMLElement Object
(
[b] => foo
[c] => foobar
[d] => SimpleXMLElement Object
(
)

)

foobar
--


Expected output (fictional):
--
SimpleXMLElement Object
(
[b] => foo
[c] => foobar
[d] => SimpleXMLElement Object
(
 [c] => foobar
)

)

foobar
--

Now, if people agree with me, that this is infact not the desired
response. Is this a 'bug' with SimpleXML or print_r?


thanks
paul


-- 
Paul Reinheimer
Zend Certified Engineer

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



RE: [PHP] Re: php editor or php IDE for linux with autocompletion

2004-11-30 Thread Dustin Wish with INDCO Networks
Speaking of IDE's, does anyone know if Codeweavers has ported Dreamweaver to
Linux? It is my favorite IDE for programming web apps.

-Original Message-
From: M. Sokolewicz [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, November 30, 2004 9:38 AM
To: [EMAIL PROTECTED]
Subject: [PHP] Re: php editor or php IDE for linux with autocompletion

[EMAIL PROTECTED] wrote:
> Hi.
> 
> We use linux as default development system.
> 
> Does anyboy know about a linux based php editor with autocompletion? Must 
> be open source free software (free as in speech, not beer).
> 
> We like quanta and kate, but there is no autocompletion.
> 
> Does anyone know about a php IDE?
> 
> I got a look at the php editors page, but the things I found there did not
> match the requirements. 
> 
> Thanks in advance.
I prefer vim, which does have auto-completion, as an add-on. But I 
wouldn't call it an IDE... =/

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

---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.802 / Virus Database: 545 - Release Date: 11/26/2004
 

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.802 / Virus Database: 545 - Release Date: 11/26/2004
 

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



Re: [PHP] php editor or php IDE for linux with autocompletion

2004-11-30 Thread Steve Brown
> > Does anyboy know about a linux based php editor with autocompletion? Must
> > be open source free software (free as in speech, not beer).

I use the PHPEclipse add on for the Eclipse IDE.  Eclipse provides a
fantastic suite of tools for coding in almost any language.  The
PHPEclipse add-ons provide some things that are specific to PHP. 
Eclipse is java based, so it works on any platform.

Eclipse: http://www.eclipse.org/
PHPEclipse: http://www.phpeclipse.de/

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



Re: [PHP] php editor or php IDE for linux with autocompletion

2004-11-30 Thread Jason Wong
On Tuesday 30 November 2004 23:18, [EMAIL PROTECTED] wrote:

> Does anyboy know about a linux based php editor with autocompletion? Must
> be open source free software (free as in speech, not beer).
>
> We like quanta and kate, but there is no autocompletion.

What version of quanta are you using? Autocompletion was available quite a 
while ago.

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
--
/*
 Leela: I love his boyish charm, but I hate his childishness.
*/

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



[PHP] Re: php editor or php IDE for linux with autocompletion

2004-11-30 Thread M. Sokolewicz
[EMAIL PROTECTED] wrote:
Hi.
We use linux as default development system.
Does anyboy know about a linux based php editor with autocompletion? Must 
be open source free software (free as in speech, not beer).

We like quanta and kate, but there is no autocompletion.
Does anyone know about a php IDE?
I got a look at the php editors page, but the things I found there did not
match the requirements. 

Thanks in advance.
I prefer vim, which does have auto-completion, as an add-on. But I 
wouldn't call it an IDE... =/

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


[PHP] Re: cannot send mail through localhost

2004-11-30 Thread Manuel Lemos
Hello,
On 11/30/2004 12:42 AM, Ross Hulford wrote:
I am trying to test my form locally, however it doesn't get picked up  my
mailbox.
The form is fine and I even set the access in IIS to 127.0.0.1 so the relay
error is not a porblem anymore. This must be a setup problem.
The mail is a standard mailform. I just use IIS thought a mail server is in
place when Iinstalled it.
I get no errors. Telnet is working on port 23 "microsofts esmtp service
ready..."
Do I have to start the mail server as a service? If so how do Ido this?
Maybe PHP is not configured properly or the message is being bounced to 
some address that you are not aware.

You may want to try this class that comes with a wrapper function named 
smtp_mail(). It works like the mail() function but lets you configure 
the SMTP server that you want to use. You can also set the bounce 
address setting the Return-Path header. If the message is not accepted, 
you may want to enable dubug output to see the SMTP dialog and maybe 
understand what may be the problem from the protocol messages that are 
exchanged:

http://www.phpclasses.org/mimemessage
You also need this class:
http://www.phpclasses.org/smtpclass
--
Regards,
Manuel Lemos
PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/
PHP Reviews - Reviews of PHP books and other products
http://www.phpclasses.org/reviews/
Metastorage - Data object relational mapping layer generator
http://www.meta-language.net/metastorage.html
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] php editor or php IDE for linux with autocompletion

2004-11-30 Thread [EMAIL PROTECTED]
Hi.

We use linux as default development system.

Does anyboy know about a linux based php editor with autocompletion? Must 
be open source free software (free as in speech, not beer).

We like quanta and kate, but there is no autocompletion.

Does anyone know about a php IDE?

I got a look at the php editors page, but the things I found there did not
match the requirements. 

Thanks in advance.

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



[PHP] Re: HTTP Authenticate via PHP

2004-11-30 Thread Manuel Lemos
Hello,
On 11/30/2004 04:13 AM, Jeffery Fernandez wrote:
I am trying to find out if its possible to authenticate a page against 
an HTTP authentication. Basically what I am trying to do is make 
available the stats page of the Cpanel to the admin interface of a site. 
When accessing the stats via the cpanel the user needs to login via http 
authentication.

Is it possible for me to store the username password credentials within 
the php page and pass that across via headers to authenticate the page 
for viewing the stats. The main purpose is to make the webstats 
transparent to the admin user so they don't have to enter any 
username/password. I tried putting the username:[EMAIL PROTECTED] into the 
url of an iframe page(session controlled) but stupid IE spits the 
authentication as a pop-up (login window). Hope I have explained well 
enough.
It depends on the type of authentication that is really being requested. 
If it is not accepting HTTP authentication, maybe it is session based 
authentication with cookies or something like that.

In any case, you may want to try this HTTP client class that can handle 
any case.

http://www.phpclasses.org/httpclient
--
Regards,
Manuel Lemos
PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/
PHP Reviews - Reviews of PHP books and other products
http://www.phpclasses.org/reviews/
Metastorage - Data object relational mapping layer generator
http://www.meta-language.net/metastorage.html
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] load word document with php

2004-11-30 Thread Richard Davey
Hello Thomas,

Tuesday, November 30, 2004, 1:35:10 PM, you wrote:

TF> $word=new COM("word.application") or die("Cannot start word for you");
TF>$word->visible = 1 ;
TF>$word->Documents->Open("Test.doc");
TF>$word->Selection->TypeText("Hello World");
TF>$word->Documents[1]->SaveAs("New Test.doc");
TF>$word->ActiveDocument->Close(false);
TF>$word->Quit(false);
TF>$word->Release();
TF>$word = null;
?>>

TF>  No error occurs and the new word Document is saved with the changes, but i
TF> don't see the document within the webbrowser.

Redirect to the newly modified .doc file (or do a file passthru -
whatever, just send it to the browser somehow) and then of course pray
to the browser Gods that the end users browser has been configured to
display Word files rather than save them (read: will only work in IE,
if at all).

Best regards,

Richard Davey
-- 
 http://www.launchcode.co.uk - PHP Development Services
 "I am not young enough to know everything." - Oscar Wilde

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



Re: [PHP] load word document with php

2004-11-30 Thread Jason Wong
On Tuesday 30 November 2004 21:35, Thomas Franz wrote:

> i hope this is the right newsgroup.
> I start working with php. Now, i want loading worddocuments  into the with
> php, change/add some text and save this changes. I found following simple
> example.
>
> $word=new COM("word.application") or die("Cannot start word for you");
>$word->visible = 1 ;
>$word->Documents->Open("Test.doc");
>$word->Selection->TypeText("Hello World");
>$word->Documents[1]->SaveAs("New Test.doc");
>$word->ActiveDocument->Close(false);
>$word->Quit(false);
>$word->Release();
>$word = null;
> ?>
>  No error occurs and the new word Document is saved with the changes, but i
> don't see the document within the webbrowser.
>
> What is wrong.

How are you trying to view the document in the browser?

I've no experience with programming COM objects under Windows but it looks 
(obvious?) to me that there is no code there to output the saved document to 
the browser.

To output an arbitary file to the browser you can use fopen() and fpassthru(). 
But for the browser to make some sense of it you should use header() to 
output the appropriate headers - see manual for examples (and look at the 
user contributed notes on the online manual for even more examples).

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
--
/*
Live from New York ... It's Saturday Night!
*/

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



Re: [PHP] HTTP Authenticate via PHP

2004-11-30 Thread Jason Wong
On Tuesday 30 November 2004 14:13, Jeffery Fernandez wrote:

> Is it possible for me to store the username password credentials within
> the php page and pass that across via headers to authenticate the page
> for viewing the stats. The main purpose is to make the webstats
> transparent to the admin user so they don't have to enter any
> username/password. 

You can use something like:

$doo = file_get_contents('http://user:[EMAIL PROTECTED]/secure-page.html');
echo $doo;

This should work fine if there no further interaction on secure-page.html, 
however if secure-page.html allows the user to interact with it you would 
have to intercept and interpret those interactions so that you can forward 
them appropriately.

> I tried putting the username:[EMAIL PROTECTED] into the 
> url of an iframe page(session controlled) but stupid IE spits the
> authentication as a pop-up (login window). Hope I have explained well
> enough.

I believe this behaviour/functionality was removed in response to the spate of 
phishing epidemics.

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
--
/*
No man is useless who has a friend, and if we are loved we are indispensable.
  -- Robert Louis Stevenson
*/

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



[PHP] load word document with php

2004-11-30 Thread Thomas Franz
Hello,

i hope this is the right newsgroup.
I start working with php. Now, i want loading worddocuments  into the with
php, change/add some text and save this changes. I found following simple
example.

visible = 1 ;
   $word->Documents->Open("Test.doc");
   $word->Selection->TypeText("Hello World");
   $word->Documents[1]->SaveAs("New Test.doc");
   $word->ActiveDocument->Close(false);
   $word->Quit(false);
   $word->Release();
   $word = null;
?>
 No error occurs and the new word Document is saved with the changes, but i
don't see the document within the webbrowser.

What is wrong.

Thanks for help

Thomas

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



Re: [PHP] Messengers libraries?

2004-11-30 Thread Raditha Dissanayake
Octavian Rasnita wrote:
Hi all,
Does anyone know if there are free php libraries for creating MSN or Yahoo
or Skype or AOL Messenger clients?
 

You might want to look at the php interface to jabber available at 
jabberstudio

Thanks.
Teddy
Teddy
 


--
Raditha Dissanayake.
--
http://www.radinks.com/print/card-designer/ | Card Designer Applet
http://www.radinks.com/upload/  | Drag and Drop Upload 

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


Re: [PHP] HTTP Authenticate via PHP

2004-11-30 Thread Raditha Dissanayake
Jeffery Fernandez wrote:
Hi,
I am trying to find out if its possible to authenticate a page against 
an HTTP authentication. Basically what I am trying to do is make 
available the stats page of the Cpanel to the admin interface of a 
site. When accessing the stats via the cpanel the user needs to login 
via http authentication.

Is it possible for me to store the username password credentials 
within the php page and pass that across via headers to authenticate 
the page for viewing the stats. The main purpose is to make the 
webstats transparent to the admin user so they don't have to enter any 
username/password. I tried putting the username:[EMAIL PROTECTED] into 
the url of an iframe page(session controlled) but stupid IE spits the 
authentication as a pop-up (login window). Hope I have explained well 
enough.

One option is to send an authorization header.  (exaple: "Authorization: 
Basic "  . credentials) more details are available in the RFC 2616 but 
the disadvantage is that you would not be able to make use of the 
fopen() method. My understanding however is that the url of the type 
that you described about should work. CPanel and other virtual hosting 
schemes have an '@' sign in the username that probably caused the 
hiccups you should try urlencoding the username and password.

cheers,
Jeffery

--
Raditha Dissanayake.
--
http://www.radinks.com/print/card-designer/ | Card Designer Applet
http://www.radinks.com/upload/  | Drag and Drop Upload 

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


RE: [PHP] Compiling a php program

2004-11-30 Thread Mike
I've used EncPHP (http://sourceforge.net/projects/encphp/) a long while ago
just to see how it'd work. It worked just fine - but the binaries get very
large, very fast. (as one would expect).

I also came across BinaryPHP (http://sourceforge.net/projects/binaryphp/)
while searching for EncPHP (I had forgotten the name) and it might be worth
checking out. Might get some smaller binaries if you're that serious about
it.

Either way - good luck. Though I find that if you want to write a binary
that other languages that compile directly to them are better solutions.

-M


> -Original Message-
> From: Octavian Rasnita [mailto:[EMAIL PROTECTED] 
> Sent: Tuesday, November 30, 2004 8:01 AM
> To: [EMAIL PROTECTED]
> Subject: [PHP] Compiling a php program
> 
> Hi all,
> 
> Does anyone know a free php compiler that can create a single 
> .exe program with all the necessary libraries included in it?
> 
> I don't want that .exe file to require other .dll files.
> 
> I have tried a compiler named PriadoBlender or something like 
> that, but it has a bad interface which is not accessible for 
> the blind, I was able to use the program by editing the xml 
> configuration file and inserting there the input data, but it 
> created a .exe file and in the destination dir it put many 
> other .dll files...
> 
> Thank you.
> 
> Teddy
> 
> --
> 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] Messengers libraries?

2004-11-30 Thread Octavian Rasnita
Hi all,

Does anyone know if there are free php libraries for creating MSN or Yahoo
or Skype or AOL Messenger clients?

Thanks.

Teddy

Teddy

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



[PHP] Compiling a php program

2004-11-30 Thread Octavian Rasnita
Hi all,

Does anyone know a free php compiler that can create a single .exe program
with all the necessary libraries included in it?

I don't want that .exe file to require other .dll files.

I have tried a compiler named PriadoBlender or something like that, but it
has a bad interface which is not accessible for the blind, I was able to use
the program by editing the xml configuration file and inserting there the
input data, but it created a .exe file and in the destination dir it put
many other .dll files...

Thank you.

Teddy

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



[PHP] RE: [SOLVED][PHP] Have I learned nothing .> Foreach()

2004-11-30 Thread Stuart Felenstein

--- Graham Cossey <[EMAIL PROTECTED]> wrote:

How embarassing. I had a typo 
elements were School
variables were school

Stuart

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



RE: [PHP] Have I learned nothing .> Foreach()

2004-11-30 Thread Stuart Felenstein

--- Graham Cossey <[EMAIL PROTECTED]> wrote:

> You have got session_start(); at the top of each
> script haven't you?

Absolutely,  And the other variables are all working.

> Is the SID being passed down the chain of scripts? 
> Is this done by cookie or url?
> 
cookie -or session. 

Stuart

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



RE: [PHP] Have I learned nothing .> Foreach()

2004-11-30 Thread Graham Cossey
[snip]
> > > Then finally on the transaction page, some pages
> > down
> > > the road:
> > > 
> > 
> > and also print_r($_SESSION['schools']); here
> > 
> > > foreach($_SESSION['schools'] as $school)
> > > {
>  
> > What have you find out?
> > 
> They don't exist.  
[snip]

You have got session_start(); at the top of each script haven't you?

Is the SID being passed down the chain of scripts? 
Is this done by cookie or url?

Graham.


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



Re: [PHP] Parse a url for a specific string

2004-11-30 Thread Richard Davey
Hello web_singer,

Tuesday, November 30, 2004, 11:57:33 AM, you wrote:

w> I would like to parse a url which is submitted to me for a link to
w> check if it already has a link to my site on it. Does anyone know
w> if php has a function which would allow me to do this relatively
w> easily?

You could use a regular expression, but strpos will work just as well:

$my_url = 'www.blah.com';
$test = strpos($their_url, $my_url);
if ($test === false)
{
   echo 'No link';
}
else
{
   echo 'Link is in there somewhere';
}

Best regards,

Richard Davey
-- 
 http://www.launchcode.co.uk - PHP Development Services
 "I am not young enough to know everything." - Oscar Wilde

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



Re: [PHP] Have I learned nothing .> Foreach()

2004-11-30 Thread John Holmes
Stuart Felenstein wrote:
--- Marek Kilimajer <[EMAIL PROTECTED]> wrote:

print_r($_SESSION['schools']); here
Then finally on the transaction page, some pages
down the road:
and also print_r($_SESSION['schools']); here
foreach($_SESSION['schools'] as $school)

What have you find out?
They don't exist.  
Then print_r($_POST) or print_r($_POST['schools']) and see what they 
contain. Are you sure you're using POST and not GET? Are you actually 
selecting any "schools" when you submit the form? If you aren't, then 
$_POST['schools'] won't exist.

--
---John Holmes...
Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/
php|architect: The Magazine for PHP Professionals – www.phparch.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Have I learned nothing .> Foreach()

2004-11-30 Thread Richard Davey
Hello Stuart,

Tuesday, November 30, 2004, 11:49:32 AM, you wrote:

SF> I can't for the life of me find the issue here.
SF> Any pointers / help would be greatly appreciated.

Nothing wrong with the technique really, you can place an array into a
session variable quite happily.

Suggest you check the obvious - have you started the session
(session_start()) before using it, etc? Run some print_r dumps on the
session and post data to see what gets filled in (or not as the case
may be).

Best regards,

Richard Davey
-- 
 http://www.launchcode.co.uk - PHP Development Services
 "I am not young enough to know everything." - Oscar Wilde

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



Re: [PHP] Display only one filed of the repeated records

2004-11-30 Thread Ed Curtis


On Tue, 30 Nov 2004, Ahmed Abdel-Aliem wrote:

> Hi,
> i have a tables in database which fields is
> id - title - category
>
> what i want to do is to display the categories entered in the
> categories fields, without repeating any of them
> for eample if the records is like follow
>
> ID  Title   Cattegory
> 1Matrix   Sci-Fi
> 2Spartacus History
> 3Alexander History
> 4whatever   Horror
>
> i want to list the categories only like this
>
> Sci-Fi - History - Horror
>
> can anyone help me throught this please ?

 Use DISTINCT in your query, maybe?

 SELECT DISTINCT Cattegory from tablename;

 Hope that helps.

Ed

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



[PHP] Re: Display only one filed of the repeated records

2004-11-30 Thread Red Wingate
Hi Ahmed,

hope this helps:

$ary = array() ;
$sql = "SELECT COUNT(*), category FROM movies GROUP BY category" ;
$res = mysql_query ( $sql ) ;

while ( $line = mysql_fetch_assoc ( $res ) ) {
$ary[] = $line[ 'category' ] ;
}

echo implode ( " - " , $ary ) ;

 -- red

Ahmed Abdel-Aliem wrote:

> ID  Title   Cattegory
> 1Matrix   Sci-Fi
> 2Spartacus History
> 3Alexander History
> 4whatever   Horror
> 
> i want to list the categories only like this
> 
> Sci-Fi - History - Horror

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



Re: [PHP] Have I learned nothing .> Foreach()

2004-11-30 Thread Stuart Felenstein

--- Marek Kilimajer <[EMAIL PROTECTED]> wrote:

 
> print_r($_SESSION['schools']); here
> 
> > 
> > Then finally on the transaction page, some pages
> down
> > the road:
> > 
> 
> and also print_r($_SESSION['schools']); here
> 
> > foreach($_SESSION['schools'] as $school)
> > {
 
> What have you find out?
> 
They don't exist.  

Stuart

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



Re: [PHP] Display only one filed of the repeated records

2004-11-30 Thread Richard Davey
Hello Ahmed,

Tuesday, November 30, 2004, 11:47:40 AM, you wrote:

AAA> i want to list the categories only like this

AAA> Sci-Fi - History - Horror

This is a MySQL (or whatever DB you are using) question, but if it is
MySQL look at the DISTINCT and GROUP BY select elements, i.e.

SELECT DISTINCT(category) FROM blah WHERE blah ...

Best regards,

Richard Davey
-- 
 http://www.launchcode.co.uk - PHP Development Services
 "I am not young enough to know everything." - Oscar Wilde

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



Re: [PHP] Display only one filed of the repeated records

2004-11-30 Thread Marek Kilimajer
Ahmed Abdel-Aliem wrote:
Hi, 
i have a tables in database which fields is 
id - title - category

what i want to do is to display the categories entered in the
categories fields, without repeating any of them
for eample if the records is like follow
ID  Title   Cattegory
1Matrix   Sci-Fi
2Spartacus History
3Alexander History
4whatever   Horror
i want to list the categories only like this 

Sci-Fi - History - Horror
can anyone help me throught this please ?
This is an SQl question, but anyway:
select distinct Cattegory from table
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Have I learned nothing .> Foreach()

2004-11-30 Thread Marek Kilimajer
Stuart Felenstein wrote:
I thought this one was under my control.  Apparently
not.  

I'm getting a "Warning: Invalid argument supplied for
foreach() in /home/mysite/public_html/mypage.php on
line 143
First, I have 3 form elements 
school[]
school[]
school[]

Here is how I initialize the session variable (after
user it's submit): 

$_SESSION['schools'] = $_POST['school'];
print_r($_SESSION['schools']); here
Then finally on the transaction page, some pages down
the road:
and also print_r($_SESSION['schools']); here
foreach($_SESSION['schools'] as $school)
{
$query = "INSERT INTO mytable (ProfileID, School)
VALUES ($LID, '$school')";
$res6 = run_query($query);
}
What have you find out?
I can't for the life of me find the issue here.
Any pointers / help would be greatly appreciated.
Stuart
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Parse a url for a specific string

2004-11-30 Thread web_singer
I would like to parse a url which is submitted to me for a link to check if
it already has a link to my site on it. Does anyone know if php has a
function which would allow me to do this relatively easily?
Thanks in advance
Jenn


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.801 / Virus Database: 544 - Release Date: 11/24/2004

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



[PHP] Have I learned nothing .> Foreach()

2004-11-30 Thread Stuart Felenstein
I thought this one was under my control.  Apparently
not.  

I'm getting a "Warning: Invalid argument supplied for
foreach() in /home/mysite/public_html/mypage.php on
line 143

First, I have 3 form elements 
school[]
school[]
school[]

Here is how I initialize the session variable (after
user it's submit): 

$_SESSION['schools'] = $_POST['school'];

Then finally on the transaction page, some pages down
the road:

foreach($_SESSION['schools'] as $school)
{
$query = "INSERT INTO mytable (ProfileID, School)
VALUES ($LID, '$school')";
$res6 = run_query($query);
}

I can't for the life of me find the issue here.

Any pointers / help would be greatly appreciated.

Stuart

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



[PHP] Display only one filed of the repeated records

2004-11-30 Thread Ahmed Abdel-Aliem
Hi, 
i have a tables in database which fields is 
id - title - category

what i want to do is to display the categories entered in the
categories fields, without repeating any of them
for eample if the records is like follow

ID  Title   Cattegory
1Matrix   Sci-Fi
2Spartacus History
3Alexander History
4whatever   Horror

i want to list the categories only like this 

Sci-Fi - History - Horror

can anyone help me throught this please ?

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



[PHP] php extension problem

2004-11-30 Thread php

Hi folks,

well, I hope you can help me out. I have a Windows XP machine running
Apache 2.x and Php 5.x. So far, everything works fine. I have placed
the php5ts.dll file in my System32 directory, kopied the php.ini file
in the Windows root directory and loaded the apache module for php5. So
far, the apache server with the php5 module is running fine.

Then, I've installed PEAR. Also, without any problems. But, when I tried
a test run I get the message that PEAR cannot find a extension.

Well, I altered my php.ini file and activated the php_mysql.dll
extension. I also specified the extension_dir. BUT, when I try to
restart the server I get the warning that Apache was not able to find
the specified module. In the alert-window, showing me the message with
the spcified path, I cannot find any mistakes. It is an absolute path
to e.g. "C:\php\ext" .

Any suggestions?

Thanks in advance.

Marcel

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