php-general Digest 27 Jul 2008 18:50:28 -0000 Issue 5592

2008-07-27 Thread php-general-digest-help

php-general Digest 27 Jul 2008 18:50:28 - Issue 5592

Topics (messages 277367 through 277372):

Start/Stop Service from program php
277367 by: opc.orenses.com
277368 by: Micah Gersten
277371 by: Daniel Brown

Re: Regular Expression help need
277369 by: Richard Heyes
277370 by: James Dempster

SOLUTION [Fwd: Start/Stop Service from program php]
277372 by: opc.orenses.com

Administrivia:

To subscribe to the digest, e-mail:
[EMAIL PROTECTED]

To unsubscribe from the digest, e-mail:
[EMAIL PROTECTED]

To post to the list, e-mail:
[EMAIL PROTECTED]


--
---BeginMessage---
Hi

I try execute unsucesfull the next code from web page

?php
$cmd1 = shell_exec (sudo /sbin/service named stop);
echo $cmd1;
?

I need write a script execute some command, but try start or stop service
like named, network this don't work

I edit visudo and add the next lines

User_Alias MYGROUP = apache, xyz
Cmnd_Alias MYCOMMAND = /sbin/service
%MYGROUP ALL = MYCOMMAND
%MYGROUP ALL=(ALL) NOPASSWD: ALL

But don't work.

Suggest? Thanks ...
---End Message---
---BeginMessage---
Generally, apache runs as www-data.  What was the output of the command?

Thank you,
Micah Gersten
onShore Networks
Internal Developer
http://www.onshore.com


I need write a script execute some command, but try start or stop service
like named, network this don't work

I edit visudo and add the next lines

User_Alias MYGROUP = apache, xyz


[EMAIL PROTECTED] wrote:
 Hi

 I try execute unsucesfull the next code from web page

 ?php
 $cmd1 = shell_exec (sudo /sbin/service named stop);
 echo $cmd1;
 ?

 I need write a script execute some command, but try start or stop service
 like named, network this don't work

 I edit visudo and add the next lines

 User_Alias MYGROUP = apache, xyz
 Cmnd_Alias MYCOMMAND = /sbin/service
 %MYGROUP ALL = MYCOMMAND
 %MYGROUP ALL=(ALL) NOPASSWD: ALL

 But don't work.

 Suggest? Thanks ...

   
---End Message---
---BeginMessage---
On Sat, Jul 26, 2008 at 11:48 PM, Micah Gersten [EMAIL PROTECTED] wrote:
 Generally, apache runs as www-data.  What was the output of the command?

Actually, Apache generally runs (in order) as nobody, apache,
httpd, or daemon.  Some distros (such as Ubuntu) or control panel
installations (such as Plesk) change this default.  For example,
Ubuntu Feisty uses 'www-data', and Plesk uses a group of 'psacln'.

From PHP, if system access (i.e. - exec(), passthru(), etc.) is
allowed, the easiest way to find out which user you are with Apache on
*NIX is to run this file in a browser:

?php
echo `whoami`;
?

-- 
/Daniel P. Brown
Better prices on dedicated servers:
Intel 2.4GHz/60GB/512MB/2TB $49.99/mo.
Intel 3.06GHz/80GB/1GB/2TB $59.99/mo.
Dedicated servers, VPS, and hosting from $2.50/mo.
---End Message---
---BeginMessage---
 Before: phi strongRichard/strong,  good morninglt;/p
 After:   phi strongRichard/stronggt;, amp; good morninglt;/p

By the sounds of it negative look ahead assertions may be of some
help. Or look behind assertions.

-- 
Richard Heyes
http://www.phpguru.org
---End Message---
---BeginMessage---
On Fri, Jul 25, 2008 at 1:08 PM, Shelley [EMAIL PROTECTED] wrote:

 Hi Richard,

 Not exactly actually.

 What I mean is:
 Before: phi strongRichard/strong,  good morninglt;/p
 After:   phi strongRichard/stronggt;, amp; good morninglt;/p

 I hope it's clear now.

 On Fri, Jul 25, 2008 at 7:53 PM, Richard Heyes [EMAIL PROTECTED]
 wrote:

   How can I make a string with  (NOT amp;, gt;, lt; or quot;), , 
  xml
   compatible?
   What is the expression to use?
 
  Not entirely sure what you're after (try posting some before and after
  snippets), but by the sounds of it you don't need a regular expression
  - strtr() will work for you. Or str_replace().
 
  --
  Richard Heyes
  http://www.phpguru.org
 



 --
 Regards,
 Shelley



Is it possible for you to use a mixture of html_entity_decode, htmlentities
e.g.

?php
$content = html_entity_decode(',  good morninglt;');
echo 'phi strongRichard/strong'.htmlentities($content).'/p';

/James
---End Message---
---BeginMessage---
In the /var/log/secure i can see

sudo: apache : sorry, you must have a tty to run sudo; TTY:unknown

So, i edit line and comment in visudo to next

### Default requiretty

And, eureka, work fine from a web page

Thanks all

 Mensaje original 
Asunto: Start/Stop Service from program php
De: [EMAIL PROTECTED]
Fecha:  Sab, 26 de Julio de 2008, 11:02 pm
Para:   [EMAIL PROTECTED]
--

Hi

I try execute unsucesfull the next code from web page

?php
$cmd1 = shell_exec (sudo /sbin/service named stop);
echo $cmd1;
?

I need write a script execute some command, but try start or stop service
like named, network this don't work

I edit visudo and add the next lines


Re: [PHP] Regular Expression help need

2008-07-27 Thread Richard Heyes
 Before: phi strongRichard/strong,  good morninglt;/p
 After:   phi strongRichard/stronggt;, amp; good morninglt;/p

By the sounds of it negative look ahead assertions may be of some
help. Or look behind assertions.

-- 
Richard Heyes
http://www.phpguru.org

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



Re: [PHP] Regular Expression help need

2008-07-27 Thread James Dempster
On Fri, Jul 25, 2008 at 1:08 PM, Shelley [EMAIL PROTECTED] wrote:

 Hi Richard,

 Not exactly actually.

 What I mean is:
 Before: phi strongRichard/strong,  good morninglt;/p
 After:   phi strongRichard/stronggt;, amp; good morninglt;/p

 I hope it's clear now.

 On Fri, Jul 25, 2008 at 7:53 PM, Richard Heyes [EMAIL PROTECTED]
 wrote:

   How can I make a string with  (NOT amp;, gt;, lt; or quot;), , 
  xml
   compatible?
   What is the expression to use?
 
  Not entirely sure what you're after (try posting some before and after
  snippets), but by the sounds of it you don't need a regular expression
  - strtr() will work for you. Or str_replace().
 
  --
  Richard Heyes
  http://www.phpguru.org
 



 --
 Regards,
 Shelley



Is it possible for you to use a mixture of html_entity_decode, htmlentities
e.g.

?php
$content = html_entity_decode(',  good morninglt;');
echo 'phi strongRichard/strong'.htmlentities($content).'/p';

/James


Re: [PHP] Start/Stop Service from program php

2008-07-27 Thread Daniel Brown
On Sat, Jul 26, 2008 at 11:48 PM, Micah Gersten [EMAIL PROTECTED] wrote:
 Generally, apache runs as www-data.  What was the output of the command?

Actually, Apache generally runs (in order) as nobody, apache,
httpd, or daemon.  Some distros (such as Ubuntu) or control panel
installations (such as Plesk) change this default.  For example,
Ubuntu Feisty uses 'www-data', and Plesk uses a group of 'psacln'.

From PHP, if system access (i.e. - exec(), passthru(), etc.) is
allowed, the easiest way to find out which user you are with Apache on
*NIX is to run this file in a browser:

?php
echo `whoami`;
?

-- 
/Daniel P. Brown
Better prices on dedicated servers:
Intel 2.4GHz/60GB/512MB/2TB $49.99/mo.
Intel 3.06GHz/80GB/1GB/2TB $59.99/mo.
Dedicated servers, VPS, and hosting from $2.50/mo.

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



[PHP] SOLUTION [Fwd: Start/Stop Service from program php]

2008-07-27 Thread opc
In the /var/log/secure i can see

sudo: apache : sorry, you must have a tty to run sudo; TTY:unknown

So, i edit line and comment in visudo to next

### Default requiretty

And, eureka, work fine from a web page

Thanks all

 Mensaje original 
Asunto: Start/Stop Service from program php
De: [EMAIL PROTECTED]
Fecha:  Sab, 26 de Julio de 2008, 11:02 pm
Para:   php-general@lists.php.net
--

Hi

I try execute unsucesfull the next code from web page

?php
$cmd1 = shell_exec (sudo /sbin/service named stop);
echo $cmd1;
?

I need write a script execute some command, but try start or stop service
like named, network this don't work

I edit visudo and add the next lines

User_Alias MYGROUP = apache, xyz
Cmnd_Alias MYCOMMAND = /sbin/service
%MYGROUP ALL = MYCOMMAND
%MYGROUP ALL=(ALL) NOPASSWD: ALL

But don't work.

Suggest? Thanks ...


+-
Ing. Oswaldo Peñaloza C.
EMPSETEL CIA. LTDA. - ORENSES.COM
Proveedor Autorizado de Servicios de Internet
Recaudación y Ventas: 9 de Mayo # 2011 e/ Bolívar y Pichincha
Tlf. 07-2923-958
Nodo: 5ta Norte # 509 e/ Buenavista y Colón
Tlf. 07-2922-396
Soporte Técnico: 093-310-310
Machala - Ecuador


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



[PHP] Problem with using array_diff and array_combine

2008-07-27 Thread Richard Kurth

I hope I can explain what I am trying to do.

I have two tables the first one has the custom form elements


formelements_id formelements_field_type formelements_field_caption 
members_id

35  texttest8
36  texttest2   8


The second one has the customer id and the field value withe the field
name



dbelements_field_name   dbelements_field_value  members_id  customer_id
35  Test This Field 8   346
36  8   346
36   Test2  8   347


If you look at the second table you will see that one field name is
related to two different  customers
and one field name on relates to one customer.

I am trying to look at these two tables and find customer that do not
have a row for each field name.
I have been trying with
array_combine($dbelements_field_array,$dbelements_id_array)
and also
array_diff($customf_array,$dbelements_field_array)

This are the tables  I /am using to create the arrays

/$contactsql = SELECT * FROM contacts WHERE members_id = '8';
$contact_result = |mysql_query|($contactsql);
while($contact_row=mysql_fetch_array($contact_result)){
$contactid_array[] = $contact_row['id'];
}
$sql1 = SELECT * FROM dbelements WHERE members_id = '8';
$sql_result1 = |mysql_query|($sql1);
while($row1=mysql_fetch_array($sql_result1)){
$dbelements_field_array[]=$row1[customer_id];
$dbelements_field_array[].=$row1[dbelements_field_name];
}

$sql2 = SELECT * FROM customformelements WHERE members_id = '8';
$sql_result2 =  |mysql_query|($sql2);
while($row2=mysql_fetch_array($sql_result2)){
$customf_array[]=$row2[formelements_id];
}

Could somebody get me going in the right directions




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



RE: [PHP] get current php locale

2008-07-27 Thread Jay Blanchard
[snip]
is there a way to get the current locale being used by php and the
encoding
it uses?
[/snip]

Do you mean the locale where the computer connecting to the service is
using PHP? Remember, PHP is server side and has no way of gathering data
from a 'local' machine unless coupled with something like JavaScript.



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