Re: [PHP] Commands which call exec() or shell_exec() ??

2013-04-09 Thread El Ale...
you probe command system()?



2013/4/9 Ken Kixmoeller phph...@comcast.net

 Yes --- it worked. Thank you so very much. I had searched the heck out of
 this to no avail.

 This is why I think developer communities are so great -- always someone
 smarter than me (not that it is a high bar s) and willing to help.




 On Tue, Apr 9, 2013 at 3:05 PM, Ken Kixmoeller phph...@comcast.net
 wrote:

  Yes -- Thanks Matjen and Daniel ---
 
  There *was* a stray backtick in there. Weird that we haven't run into it
  before.
 
  Testing now.
 
 
  On Tue, Apr 9, 2013 at 2:41 PM, Matijn Woudt tijn...@gmail.com wrote:
 
 
 
 
  On Tue, Apr 9, 2013 at 9:11 PM, Ken Kixmoeller phph...@comcast.net
 wrote:
 
  Hi -- -
 
  Strange problem. One of my applications was just moved to a new server.
  The
  new server has php configured to blacklist some functions (using
  disable_functions=). One of the banned functions is exec().
 
  The error log is reporting shell_exec() has been disabled for security
  reasons  --- but exec() or shell_exec() are not in my code *anywhere*.
  The
  program and line number being reported makes absolutely no sense.
 
  Are there other php commands that really call exec() or shell_exec()
 ???
  Any clues how this could happen? Fixes (other than un-blacklisting the
  command, of course)?
 
  Many thanks,
 
  Ken
 
 
  The back tick(`) operator is also used for that same purpose. Maybe
  that's in your code?
 
  - Matijn
 
 
 



[PHP] output command and php

2012-09-28 Thread El Ale...
People good afternoon am using a system called the collects gammu sms my
cell with a command gammu getallsms sms me when I pick up the following:

gammu getallsms messages.txt

and I keep it in a text file with the following format:

messages.txt

folder, input code, tray

number: +54025487555
SCMD number: 000
no coding
Date: 25/02/2012


hello this is a test message

sms January 1

How could I give a more ordered format command output with php?

My idea is to get him into this mysql table but I can not understand how to
format it to work on it I could lend a hand?.

Greetings to all and thanks!


[PHP] Re: bucle while for to msqyl

2012-09-17 Thread El Ale...
Good people i finish thanks everyone!! this script finished:

?

include(tempconex.php);

$stop = SELECT estado FROM mensajes WHERE estado is NOT NULL;

do {

### comienzo script de conexion ###

$queEmp = SELECT numero, mensaje FROM mensajes WHERE estado is NULL;
$resEmp = mysql_query($queEmp, $conexion) or die(mysql_error());
if ($resEmp == true) {
 while ($rowEmp = mysql_fetch_assoc($resEmp)) {
 $numero = $rowEmp['numero'];
 $mensaje  = $rowEmp['mensaje'];

### comienza el break  ###

 }
 sleep(13);
 $comando = exec('datos.log | grep Error 500');

 if($comando == TRUE){
 echo  error encontrado NO SE ENVIA! SE BORRA Y PAUSA 30 SEG | ;
 #mysql_query(UPDATE mensajes SET estado = 'no enviado', date = NOW()
WHERE numero = $numero, ($conexion));
 exec('cat /dev/null  datos.log');
 sleep(30);
 echo  se reanuda | ;

### termina el break ###

 }
 else
 {

### comienza el envio de el mensaje ya que no se encontro ningun error en
los logs ###

 echo  Se prepara | ;
 exec(comando de envio);
 echo  ya se envio (no se encontro ningun error) | ;
 #mysql_query(UPDATE mensajes SET estado = 'enviado', date = NOW()
WHERE numero = $numero, ($conexion));


### finaliza el envio ###

}
   }

### fin script de conexion ###

} while ($stop == true);
continue;
break;
?

its run good!, but i have one last problem, i cant if while is true
: SELECT estado FROM mensajes WHERE estado is NOT NULL play if false not
run this, im need if estado from mensajes is true loop the script but if
not break this.

I tried:

$stop = SELECT estado FROM mensajes WHERE estado is NOT NULL;

y el while:

} while ($stop == true);
continue;
break;

but not run.

Thanks everyone!!

2012/9/16 El Ale... alexissauc...@gmail.com

 hi! im new in this forum, i not speak very good english, apologise im
 spanish.
 I have a problem, need one infinit bucle to mysql only true if false
 break this, for example:

 prueba.php:

 ?
 include(conexion.php);

 do {


 echo $numero;
 sleep(1);


 if ($numero == 1)
 reset;
 continue;
 break;
 } while (true);

 ?

 3

 connect to mysql

 conexion.php:

 ?

 $conexion = mysql_connect(localhost, alexis, 123456);
 mysql_select_db(probando, $conexion);
 $queEmp = SELECT n FROM numero WHERE n LIKE 1;
 $resEmp = mysql_query($queEmp, $conexion) or die(mysql_error());
 $totEmp = mysql_num_rows($resEmp);
 if ($totEmp 0) {
  while ($rowEmp = mysql_fetch_assoc($resEmp)) {
  $numero = $rowEmp['n'];

 }
 echo $numero;
 }
 mysql_close($conexion);
 ?

 What I do is to run the loop as long as the value $ number is equal to
 1 in mysql I have a single field called n with the value 1 and runs,
 now the problem is the next, I run the loop with the value 1 in mysql and
 it runs fine but when I go to mysql and change the value to 2 (which
 would be an incorrect and should leave) the loop ignores him and continues
 running, I was reading a lot about the loops but I can not make it work in
 this way could you please give me a hand with this? or if I'm wrong What
 else I can do an infinite command if it fulfills a function and if they do
 not?.

 Best regards



[PHP] bucle while for to msqyl

2012-09-16 Thread El Ale...
hi! im new in this forum, i not speak very good english, apologise im
spanish.
I have a problem, need one infinit bucle to mysql only true if false
break this, for example:

prueba.php:

?
include(conexion.php);

do {


echo $numero;
sleep(1);


if ($numero == 1)
reset;
continue;
break;
} while (true);

?

3

connect to mysql

conexion.php:

?

$conexion = mysql_connect(localhost, alexis, 123456);
mysql_select_db(probando, $conexion);
$queEmp = SELECT n FROM numero WHERE n LIKE 1;
$resEmp = mysql_query($queEmp, $conexion) or die(mysql_error());
$totEmp = mysql_num_rows($resEmp);
if ($totEmp 0) {
 while ($rowEmp = mysql_fetch_assoc($resEmp)) {
 $numero = $rowEmp['n'];

}
echo $numero;
}
mysql_close($conexion);
?

What I do is to run the loop as long as the value $ number is equal to
1 in mysql I have a single field called n with the value 1 and runs,
now the problem is the next, I run the loop with the value 1 in mysql and
it runs fine but when I go to mysql and change the value to 2 (which
would be an incorrect and should leave) the loop ignores him and continues
running, I was reading a lot about the loops but I can not make it work in
this way could you please give me a hand with this? or if I'm wrong What
else I can do an infinite command if it fulfills a function and if they do
not?.

Best regards


Re: [PHP] bucle while for to msqyl

2012-09-16 Thread El Ale...
2012/9/16 El Ale... alexissauc...@gmail.com

 Im sorry reset; is not, this is:

 ?
 include(conexion.php);

 do {


 echo $numero;
 sleep(1);


 if ($numero == 1)

 continue;
 break;
 } while (true);

 ?

 Thanks!


 2012/9/16 Serge Fonville serge.fonvi...@gmail.com

 Hi,

 if ($numero == 1)
 reset;
 continue;
 break;
 } while (true);


 If the $numero is equal to 1 reset seems odd
 reset is a function.and requires an array
 Based on your code, this would run indefintely
 Since there are no braces after the if statement, only the first
 statement is executed when $numero equals 1

 Also, is this your actual code?

 If not and possible please add that

 HTH

 Kind regards/met vriendelijke groet,

 Serge Fonville

 http://www.sergefonville.nl

 Convince Microsoft!
 They need to add TRUNCATE PARTITION in SQL Server

 https://connect.microsoft.com/SQLServer/feedback/details/417926/truncate-partition-of-partitioned-table



 2012/9/16 El Ale... alexissauc...@gmail.com

 hi! im new in this forum, i not speak very good english, apologise im
 spanish.
 I have a problem, need one infinit bucle to mysql only true if false
 break this, for example:

 prueba.php:

 ?
 include(conexion.php);

 do {


 echo $numero;
 sleep(1);


 if ($numero == 1)
 reset;
 continue;
 break;
 } while (true);

 ?

 3

 connect to mysql

 conexion.php:

 ?

 $conexion = mysql_connect(localhost, alexis, 123456);
 mysql_select_db(probando, $conexion);
 $queEmp = SELECT n FROM numero WHERE n LIKE 1;
 $resEmp = mysql_query($queEmp, $conexion) or die(mysql_error());
 $totEmp = mysql_num_rows($resEmp);
 if ($totEmp 0) {
  while ($rowEmp = mysql_fetch_assoc($resEmp)) {
  $numero = $rowEmp['n'];

 }
 echo $numero;
 }
 mysql_close($conexion);
 ?

 What I do is to run the loop as long as the value $ number is equal to
 1 in mysql I have a single field called n with the value 1 and
 runs,
 now the problem is the next, I run the loop with the value 1 in mysql
 and
 it runs fine but when I go to mysql and change the value to 2 (which
 would be an incorrect and should leave) the loop ignores him and
 continues
 running, I was reading a lot about the loops but I can not make it work
 in
 this way could you please give me a hand with this? or if I'm wrong What
 else I can do an infinite command if it fulfills a function and if they
 do
 not?.

 Best regards






Re: [PHP] bucle while for to msqyl

2012-09-16 Thread El Ale...
yes it 1 = 1 its (true) bucle's run, but! if 1 is not same  1 bucle break.
when consulted database and this value is 1, the loop continues, but when
changing the value of the database for example value 2, the loop should
stop because 1 is not equal to 2 but not Doing so ignores it and segue
running as if the value is one, that's the problem

Thank you!

2012/9/16 Serge Fonville serge.fonvi...@gmail.com

 Also, if $numero equals 1, it always prints 1.
 Is that the expected behaviour?

 When it does not match 1, it does nothing except it echos 1 twice, first
 in the  conexion.php and second in the first iteration of the while loop

 Kind regards/met vriendelijke groet,

 Serge Fonville

 http://www.sergefonville.nl

 Convince Microsoft!
 They need to add TRUNCATE PARTITION in SQL Server

 https://connect.microsoft.com/SQLServer/feedback/details/417926/truncate-partition-of-partitioned-table



 2012/9/16 El Ale... alexissauc...@gmail.com



 2012/9/16 El Ale... alexissauc...@gmail.com

 Im sorry reset; is not, this is:

 ?
 include(conexion.php);

 do {


 echo $numero;
 sleep(1);


 if ($numero == 1)

 continue;
 break;
 } while (true);

 ?

 Thanks!


 2012/9/16 Serge Fonville serge.fonvi...@gmail.com

 Hi,

 if ($numero == 1)
 reset;
 continue;
 break;
 } while (true);


 If the $numero is equal to 1 reset seems odd
 reset is a function.and requires an array
 Based on your code, this would run indefintely
 Since there are no braces after the if statement, only the first
 statement is executed when $numero equals 1

 Also, is this your actual code?

 If not and possible please add that

 HTH

 Kind regards/met vriendelijke groet,

 Serge Fonville

 http://www.sergefonville.nl

 Convince Microsoft!
 They need to add TRUNCATE PARTITION in SQL Server

 https://connect.microsoft.com/SQLServer/feedback/details/417926/truncate-partition-of-partitioned-table



 2012/9/16 El Ale... alexissauc...@gmail.com

 hi! im new in this forum, i not speak very good english, apologise im
 spanish.
 I have a problem, need one infinit bucle to mysql only true if
 false
 break this, for example:

 prueba.php:

 ?
 include(conexion.php);

 do {


 echo $numero;
 sleep(1);


 if ($numero == 1)
 reset;
 continue;
 break;
 } while (true);

 ?

 3

 connect to mysql

 conexion.php:

 ?

 $conexion = mysql_connect(localhost, alexis, 123456);
 mysql_select_db(probando, $conexion);
 $queEmp = SELECT n FROM numero WHERE n LIKE 1;
 $resEmp = mysql_query($queEmp, $conexion) or die(mysql_error());
 $totEmp = mysql_num_rows($resEmp);
 if ($totEmp 0) {
  while ($rowEmp = mysql_fetch_assoc($resEmp)) {
  $numero = $rowEmp['n'];

 }
 echo $numero;
 }
 mysql_close($conexion);
 ?

 What I do is to run the loop as long as the value $ number is equal
 to
 1 in mysql I have a single field called n with the value 1 and
 runs,
 now the problem is the next, I run the loop with the value 1 in
 mysql and
 it runs fine but when I go to mysql and change the value to 2 (which
 would be an incorrect and should leave) the loop ignores him and
 continues
 running, I was reading a lot about the loops but I can not make it
 work in
 this way could you please give me a hand with this? or if I'm wrong
 What
 else I can do an infinite command if it fulfills a function and if
 they do
 not?.

 Best regards








Re: [PHP] bucle while for to msqyl

2012-09-16 Thread El Ale...
How could I?, should use another command? I need to do that if the value of
the script is the same as the database and repeat but stops.

greetings!

2012/9/16 Serge Fonville serge.fonvi...@gmail.com

 Since the value is never changed inside the loop, it will run indefintely
 or stop immediately.

 You need to re-request the value from the database to change $numero to a
 possible other value.

 Kind regards/met vriendelijke groet,

 Serge Fonville

 http://www.sergefonville.nl

 Convince Microsoft!
 They need to add TRUNCATE PARTITION in SQL Server

 https://connect.microsoft.com/SQLServer/feedback/details/417926/truncate-partition-of-partitioned-table



 2012/9/16 El Ale... alexissauc...@gmail.com

 yes it 1 = 1 its (true) bucle's run, but! if 1 is not same  1 bucle break.
 when consulted database and this value is 1, the loop continues, but when
 changing the value of the database for example value 2, the loop should
 stop because 1 is not equal to 2 but not Doing so ignores it and segue
 running as if the value is one, that's the problem

 Thank you!


 2012/9/16 Serge Fonville serge.fonvi...@gmail.com

 Also, if $numero equals 1, it always prints 1.
 Is that the expected behaviour?

 When it does not match 1, it does nothing except it echos 1 twice, first
 in the  conexion.php and second in the first iteration of the while loop

 Kind regards/met vriendelijke groet,

 Serge Fonville

 http://www.sergefonville.nl

 Convince Microsoft!
 They need to add TRUNCATE PARTITION in SQL Server

 https://connect.microsoft.com/SQLServer/feedback/details/417926/truncate-partition-of-partitioned-table



 2012/9/16 El Ale... alexissauc...@gmail.com



 2012/9/16 El Ale... alexissauc...@gmail.com

 Im sorry reset; is not, this is:

 ?
 include(conexion.php);

 do {


 echo $numero;
 sleep(1);


 if ($numero == 1)

 continue;
 break;
 } while (true);

 ?

 Thanks!


 2012/9/16 Serge Fonville serge.fonvi...@gmail.com

 Hi,

 if ($numero == 1)
 reset;
 continue;
 break;
 } while (true);


 If the $numero is equal to 1 reset seems odd
 reset is a function.and requires an array
 Based on your code, this would run indefintely
 Since there are no braces after the if statement, only the first
 statement is executed when $numero equals 1

 Also, is this your actual code?

 If not and possible please add that

 HTH

 Kind regards/met vriendelijke groet,

 Serge Fonville

 http://www.sergefonville.nl

 Convince Microsoft!
 They need to add TRUNCATE PARTITION in SQL Server

 https://connect.microsoft.com/SQLServer/feedback/details/417926/truncate-partition-of-partitioned-table



 2012/9/16 El Ale... alexissauc...@gmail.com

 hi! im new in this forum, i not speak very good english, apologise im
 spanish.
 I have a problem, need one infinit bucle to mysql only true if
 false
 break this, for example:

 prueba.php:

 ?
 include(conexion.php);

 do {


 echo $numero;
 sleep(1);


 if ($numero == 1)
 reset;
 continue;
 break;
 } while (true);

 ?

 3

 connect to mysql

 conexion.php:

 ?

 $conexion = mysql_connect(localhost, alexis, 123456);
 mysql_select_db(probando, $conexion);
 $queEmp = SELECT n FROM numero WHERE n LIKE 1;
 $resEmp = mysql_query($queEmp, $conexion) or die(mysql_error());
 $totEmp = mysql_num_rows($resEmp);
 if ($totEmp 0) {
  while ($rowEmp = mysql_fetch_assoc($resEmp)) {
  $numero = $rowEmp['n'];

 }
 echo $numero;
 }
 mysql_close($conexion);
 ?

 What I do is to run the loop as long as the value $ number is
 equal to
 1 in mysql I have a single field called n with the value 1 and
 runs,
 now the problem is the next, I run the loop with the value 1 in
 mysql and
 it runs fine but when I go to mysql and change the value to 2
 (which
 would be an incorrect and should leave) the loop ignores him and
 continues
 running, I was reading a lot about the loops but I can not make it
 work in
 this way could you please give me a hand with this? or if I'm wrong
 What
 else I can do an infinite command if it fulfills a function and if
 they do
 not?.

 Best regards










Re: [PHP] bucle while for to msqyl

2012-09-16 Thread El Ale...
?

$conexion = mysql_connect(localhost, usuario, 123456);
mysql_select_db(probando, $conexion);

function updateNumero() {

$queEmp = SELECT n FROM numero WHERE n LIKE 1;
$resEmp = mysql_query($queEmp, $conexion) or die(mysql_error());
$totEmp = mysql_num_rows($resEmp);
if ($totEmp 0) {
 while ($rowEmp = mysql_fetch_assoc($resEmp)) {
$numero = $rowEmp['n'];
}
}
return $numero;
}
?

in this way?

I do not understand is where the loop would do, what I need to remember is
that if it is true to repeat the condition and if false stops.

Thanks!

2012/9/16 Serge Fonville serge.fonvi...@gmail.com

 If you wrap the query inside your while loop at the point where you want
 to check for a change of the value it will change at every iteration.


 For ease of use, it would be better to create  a function around the data
 gathering part, i.e.

 function updateNumero() {

 $queEmp = SELECT n FROM numero WHERE n LIKE 1;
 $resEmp = mysql_query($queEmp, $conexion) or die(mysql_error());
  $totEmp = mysql_num_rows($resEmp);
 if ($totEmp 0) {
  while ($rowEmp = mysql_fetch_assoc($resEmp)) {
  $numero = $rowEmp['n'];
 }
 }
  return $numero;
 }


 Kind regards/met vriendelijke groet,

 Serge Fonville

 http://www.sergefonville.nl

 Convince Microsoft!
 They need to add TRUNCATE PARTITION in SQL Server

 https://connect.microsoft.com/SQLServer/feedback/details/417926/truncate-partition-of-partitioned-table



 2012/9/16 El Ale... alexissauc...@gmail.com

 How could I?, should use another command? I need to do that if the value
 of the script is the same as the database and repeat but stops.

 greetings!


 2012/9/16 Serge Fonville serge.fonvi...@gmail.com

 Since the value is never changed inside the loop, it will run
 indefintely or stop immediately.

 You need to re-request the value from the database to change $numero to
 a possible other value.

 Kind regards/met vriendelijke groet,

 Serge Fonville

 http://www.sergefonville.nl

 Convince Microsoft!
 They need to add TRUNCATE PARTITION in SQL Server

 https://connect.microsoft.com/SQLServer/feedback/details/417926/truncate-partition-of-partitioned-table



 2012/9/16 El Ale... alexissauc...@gmail.com

 yes it 1 = 1 its (true) bucle's run, but! if 1 is not same  1 bucle
 break.
 when consulted database and this value is 1, the loop continues, but
 when changing the value of the database for example value 2, the loop
 should stop because 1 is not equal to 2 but not Doing so ignores it and
 segue running as if the value is one, that's the problem

 Thank you!


 2012/9/16 Serge Fonville serge.fonvi...@gmail.com

 Also, if $numero equals 1, it always prints 1.
 Is that the expected behaviour?

 When it does not match 1, it does nothing except it echos 1 twice,
 first in the  conexion.php and second in the first iteration of the
 while loop

 Kind regards/met vriendelijke groet,

 Serge Fonville

 http://www.sergefonville.nl

 Convince Microsoft!
 They need to add TRUNCATE PARTITION in SQL Server

 https://connect.microsoft.com/SQLServer/feedback/details/417926/truncate-partition-of-partitioned-table



 2012/9/16 El Ale... alexissauc...@gmail.com



 2012/9/16 El Ale... alexissauc...@gmail.com

 Im sorry reset; is not, this is:

 ?
 include(conexion.php);

 do {


 echo $numero;
 sleep(1);


 if ($numero == 1)

 continue;
 break;
 } while (true);

 ?

 Thanks!


 2012/9/16 Serge Fonville serge.fonvi...@gmail.com

 Hi,

 if ($numero == 1)
 reset;
 continue;
 break;
 } while (true);


 If the $numero is equal to 1 reset seems odd
 reset is a function.and requires an array
 Based on your code, this would run indefintely
 Since there are no braces after the if statement, only the first
 statement is executed when $numero equals 1

 Also, is this your actual code?

 If not and possible please add that

 HTH

 Kind regards/met vriendelijke groet,

 Serge Fonville

 http://www.sergefonville.nl

 Convince Microsoft!
 They need to add TRUNCATE PARTITION in SQL Server

 https://connect.microsoft.com/SQLServer/feedback/details/417926/truncate-partition-of-partitioned-table



 2012/9/16 El Ale... alexissauc...@gmail.com

 hi! im new in this forum, i not speak very good english, apologise
 im
 spanish.
 I have a problem, need one infinit bucle to mysql only true if
 false
 break this, for example:

 prueba.php:

 ?
 include(conexion.php);

 do {


 echo $numero;
 sleep(1);


 if ($numero == 1)
 reset;
 continue;
 break;
 } while (true);

 ?

 3

 connect to mysql

 conexion.php:

 ?

 $conexion = mysql_connect(localhost, alexis, 123456);
 mysql_select_db(probando, $conexion);
 $queEmp = SELECT n FROM numero WHERE n LIKE 1;
 $resEmp = mysql_query($queEmp, $conexion) or die(mysql_error());
 $totEmp = mysql_num_rows($resEmp);
 if ($totEmp 0) {
  while ($rowEmp = mysql_fetch_assoc($resEmp)) {
  $numero = $rowEmp['n'];

 }
 echo $numero;
 }
 mysql_close($conexion

[PHP] Re: bucle while for to msqyl

2012-09-16 Thread El Ale...
Now what I need is a loop that fence mysql collecting and updating
information automatically and when no more data to update not run more as I
show in the first script, try to do with this do while loop but it works
for me as it reads the first data and others do not follow, is as to ignore
the other data and only read the first but the condition is false. I hope
to be clear and thousand apologies if it were not so

this other example this is a script for masive sms sender:

mysql database: prueba

table: sms
date1: number
date2: message
date43condition

insert into sms:

0383315681515;this is a test;1

0383315681515: it s phone number
this is a test: message
condition =
1: its for send
2:send
3:not send



my script send sms:

?php
include(conexion.php);

do {
{
echo 'message send':
exec('sender.py'); ///this a command to ejectute sms
mysql_query(UPDATE message SET condition = '2'  WHERE number = $number,
($conexion));
}
else
{
echo 'message not send';
mysql_query(UPDATE menssage SET condition = '3' WHERE number = $number,
($conexion));

if($totEmp == TRUE)

continue;
  break;

}while(true);

?



my script conexion.php:

?

$conexion = mysql_connect(localhost, alexis, 1234555);
mysql_select_db(prueba, $conexion);
$queEmp = SELECT number, message FROM sms WHERE condition LIKE 1;
$resEmp = mysql_query($queEmp, $conexion) or die(mysql_error());
$totEmp = mysql_num_rows($resEmp);
if ($totEmp 0) {
 while ($rowEmp = mysql_fetch_assoc($resEmp)) {
 $number = $rowEmp['number'];
 $message = $rowEmp['message'];
}
   }

mysql_close($conexion);
?