Re: [PHP] Problem with mbstring.internal_encoding, mcrypt and php-fpm

2013-09-23 Thread Condor

On 2013-09-23 15:42, Aziz Saleh wrote:

Hristo,

Try changing the php.ini config:

mbstring.func_overload 0

See if that helps your issue, more on what it does:
http://php.net/manual/en/mbstring.overload.php [3]

Aziz

On Mon, Sep 23, 2013 at 8:23 AM, Condor  wrote:


Hello,

from two days I have strange problem with this param
mbstring.internal_encoding on nginx and php-fpm.
I use php version 5.4.20 and when I setting
mbstring.internal_encoding I have a problem with mcrypt.

NOTICE: PHP message: PHP Warning:  mcrypt_generic_init(): Iv size
incorrect; supplied length: 12, needed: 8 in file.php

I setup php.ini file:

zend.multibyte = On
default_mimetype = "text/html"
default_charset = "UTF-8"
mbstring.internal_encoding = UTF-8

and here is function:

 85         private function decrypt($blob)
 86         {
 87                 $deckey = $_SESSION['key'];
 88                 $realkey = sha1($deckey, true);
 89                 $rawblob = hex2bin($blob); /* binary
blob */
 90                 $td =
mcrypt_module_open($this->CIPHER, "", MCRYPT_MODE_CFB, "");
 91                 $iv = mb_substr($rawblob, 0,
mcrypt_enc_get_iv_size($td)); /* IV */
 92                 if (mb_strlen($iv) <
mcrypt_enc_get_iv_size($td)) return FALSE;
 93                 $ct = mb_substr($rawblob,
mcrypt_enc_get_iv_size($td)); /* CipherText */
 94    --->         mcrypt_generic_init($td, $realkey, $iv);
 95                 $unblob = mdecrypt_generic($td, $ct);
 96                 mcrypt_generic_deinit($td);
 97                 $pt = mb_substr($unblob, 20);
 98                 $check = mb_substr($unblob, 0, 20);
 99                 if ($check != sha1($pt, true))
100                 {
101                         return FALSE;
102                 } else {
103                         return $pt;
104                 }
105         }

The same code with the same config options is worked fine with
apache httpd.

Any one can give me a little help ?
Thanks

Regards,
Hristo S.




Hello,

I just try and no effect after reload the php-fpm.

Regards,
Hristo S.

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



Re: [PHP] Problem with mbstring.internal_encoding, mcrypt and php-fpm

2013-09-23 Thread Aziz Saleh
Hristo,

Try changing the php.ini config:

mbstring.func_overload 0

See if that helps your issue, more on what it does:
http://php.net/manual/en/mbstring.overload.php

Aziz


On Mon, Sep 23, 2013 at 8:23 AM, Condor  wrote:

>
> Hello,
>
> from two days I have strange problem with this param
> mbstring.internal_encoding on nginx and php-fpm.
> I use php version 5.4.20 and when I setting mbstring.internal_encoding I
> have a problem with mcrypt.
>
> NOTICE: PHP message: PHP Warning:  mcrypt_generic_init(): Iv size
> incorrect; supplied length: 12, needed: 8 in file.php
>
> I setup php.ini file:
>
> zend.multibyte = On
> default_mimetype = "text/html"
> default_charset = "UTF-8"
> mbstring.internal_encoding = UTF-8
>
>
>
> and here is function:
>
>  85 private function decrypt($blob)
>  86 {
>  87 $deckey = $_SESSION['key'];
>  88 $realkey = sha1($deckey, true);
>  89 $rawblob = hex2bin($blob); /* binary blob */
>  90 $td = mcrypt_module_open($this->**CIPHER, "",
> MCRYPT_MODE_CFB, "");
>  91 $iv = mb_substr($rawblob, 0,
> mcrypt_enc_get_iv_size($td)); /* IV */
>  92 if (mb_strlen($iv) < mcrypt_enc_get_iv_size($td))
> return FALSE;
>  93 $ct = mb_substr($rawblob,
> mcrypt_enc_get_iv_size($td)); /* CipherText */
>  94---> mcrypt_generic_init($td, $realkey, $iv);
>  95 $unblob = mdecrypt_generic($td, $ct);
>  96 mcrypt_generic_deinit($td);
>  97 $pt = mb_substr($unblob, 20);
>  98 $check = mb_substr($unblob, 0, 20);
>  99 if ($check != sha1($pt, true))
> 100 {
> 101 return FALSE;
> 102 } else {
> 103 return $pt;
> 104 }
> 105 }
>
>
> The same code with the same config options is worked fine with apache
> httpd.
>
> Any one can give me a little help ?
> Thanks
>
> Regards,
> Hristo S.
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


[PHP] Problem with mbstring.internal_encoding, mcrypt and php-fpm

2013-09-23 Thread Condor


Hello,

from two days I have strange problem with this param 
mbstring.internal_encoding on nginx and php-fpm.
I use php version 5.4.20 and when I setting mbstring.internal_encoding I 
have a problem with mcrypt.


NOTICE: PHP message: PHP Warning:  mcrypt_generic_init(): Iv size 
incorrect; supplied length: 12, needed: 8 in file.php


I setup php.ini file:

zend.multibyte = On
default_mimetype = "text/html"
default_charset = "UTF-8"
mbstring.internal_encoding = UTF-8



and here is function:

 85 private function decrypt($blob)
 86 {
 87 $deckey = $_SESSION['key'];
 88 $realkey = sha1($deckey, true);
 89 $rawblob = hex2bin($blob); /* binary blob */
 90 $td = mcrypt_module_open($this->CIPHER, "", 
MCRYPT_MODE_CFB, "");
 91 $iv = mb_substr($rawblob, 0, 
mcrypt_enc_get_iv_size($td)); /* IV */
 92 if (mb_strlen($iv) < mcrypt_enc_get_iv_size($td)) 
return FALSE;
 93 $ct = mb_substr($rawblob, 
mcrypt_enc_get_iv_size($td)); /* CipherText */

 94---> mcrypt_generic_init($td, $realkey, $iv);
 95 $unblob = mdecrypt_generic($td, $ct);
 96 mcrypt_generic_deinit($td);
 97 $pt = mb_substr($unblob, 20);
 98 $check = mb_substr($unblob, 0, 20);
 99 if ($check != sha1($pt, true))
100 {
101 return FALSE;
102 } else {
103 return $pt;
104 }
105 }


The same code with the same config options is worked fine with apache 
httpd.


Any one can give me a little help ?
Thanks

Regards,
Hristo S.

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



[PHP] Problem with dba_open() on db4 database

2013-07-16 Thread Thorsten Göllner

Hi,

I am using a db4 database to store some values (on the local 
filesystem). Here the sample code:


$handle = dba_open("/var/cache/mydb.db", "cd", "db4");
[...]
$result = dba_replace($key, serialize($data), $handle);
[...]
dba_close($handle);

This Code is used in a CLI-Script (in an Asterisk-AGI-Script) and will 
be used by some processes in parallel. The online documentation 
(http://de1.php.net/manual/en/function.dba-open.php) shows, that the 
function should "wait" if more than a process has a lock on the 
database. This works fine if I use the script an execute it in differnt 
shells in parallel.


But SOMETIMES(!) I get (in the Asterisk-Environment) the following error 
message:
dba_open(/var/cache/mydb.db,cd): Driver initialization failed for 
handler: db4: Unable to establish lock (database file already open)


So it seems, that the function "dba_open()" returns immediatly without 
waiting for lock release. But I do not know why ... ?!


I am using the following versions:
Ubuntu 12.04. LTS (up to date) with PHP 5.3.10-1ubuntu3.6 with Suhosin-Patch

Any idea?

Thank in advance
-Thorsten-






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



Re: [PHP] Problem with variables

2013-06-28 Thread Tamara Temple
Fernando A  wrote:
> I am working with php and codeigniter, but I have not yet experienced.
> I need create a variable that is available throughout  system.
> This variable contains the number of company and can change.
> as I can handle this?

Hi, Fernando, welcome. I'm just a little unsure what you mean by "number
of company" -- is this a count, as in 10 companies, or is it a phone
number, or is it something else?

Jim's reply is workable -- storing session values is quite useful, but
sessions are tied to a specific browser client/ip, and I'm not sure
that's what you want/need here.

If you are looking for setting a global variable that will be available
everywhere in your application, you can use $GLOBALS, or set it from the
very top level context of the application. Given you're using
CodeIgniter, which sadly I am not versed in, you may need to set it with
$GLOBALS: 

$GLOBALS['my_var'] = 10; // whatever you need to do here

When you say it changes, how and when exactly does it change?


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



[PHP] Problem with variables

2013-06-25 Thread Fernando A
Hello,

I am working with php and codeigniter, but I have not yet experienced.
I need create a variable that is available throughout  system.
This variable contains the number of company and can change.
as I can handle this?

Thank you, very much!

Ferd


[PHP] Problem with soap - Error Fetching http headers

2013-03-28 Thread Radek Krejča
Hello,

I am starting to make my first soap server/client. I found nice tutorial 
(manual pages on PHP is not detailed) and I have this server script:

http://codeviewer.org/view/code:3131


boxing.wsdl looks:

http://codeviewer.org/view/code:3132

and client script looks 

http://codeviewer.org/view/code:3133 (I am trying to experiment with user_agent 
without success)

After running this I got 

http://codeviewer.org/view/code:3134 (full view)

message - "Error Fetching http headers"

What I have wrong? I am using lighttp with php-cgi and this test is possible to 
try on cutter.starnet.cz/soap.php (server) and 
cutter.starnet.cz/soap_client.php (client).

Thank you
Radek



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



Re: [PHP] problem with my login script

2012-10-02 Thread Maciek Sokolewicz

On 02-10-2012 11:59, Bálint Horváth wrote:

The problem was already solved. I forgot to send a copy to the list...

Rodrigo, break!? Ohh man, it's a crazy idea... A developer DOES NOT use
break at all (in a loop)... (switch is an exception)


I personally find this statement to be utter bullshit. There is nothing 
wrong with using break. There is a very good reason why it's available 
in the language. In very many cases, it costs a lot less code to add a 
break than to add additional clauses to your while-conditional.


You don't honestly believe that:
while(list($key,$user) = each(file('someUserList')) and $foundUser=false) {
   if($user == $usernameWeAreLookingFor) {
  $foundUser = true;
   }
}

looks oh so much better than a simple:

foreach(file('someUserList') as $key=>$val) {
   if($user == $usernameWeAreLookingFor) {
  break;
   }
}

Also do note that it is very hard to use your "do not use break, ever" 
when you want to use foreach and want to stop at the first find.


Seriously, stop giving advice to never use perfectly good code.

In very complicated, long, loops, I agree that using break in various 
places can make debugging difficult. The solution however is not to 
refrain from ever using break, but rather to change your code into a 
clearer format. This is like saying "you can make bombs from fertilizer, 
ergo fertilizer should not ever be used!". Everything has its use, and 
abuse. Same goes for goto, it can also be used for good.


In the other hand Thomas, you should use while and count the lines and u
need to test if username found...


Ehr, he could also use foreach, for or any other loop construct...

On a sidenote: please, please, please do not say "u need". There is no 
"u" in english, it's written (and pronounced) "you". Stick to that, you 
sound like a damned dumb teenager to me when using such needlessly 
abbreviated words.


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



Re: [PHP] problem with my login script

2012-10-02 Thread Rodrigo Silva dos Santos
Make sense, I haven't ever realizad how old the code appears like when it haves 
a break. Fell like C. Livin' n' learnin'. Thanks!


Enviado por Samsung Mobile

Bálint Horváth  escreveu:

"As a Oo developer, a run away from using switch" - I don't understand this: 
OOP and switch could be good together and I also prefer switch eg. at action or 
page selection...

break is an old stuff and not a nice solution (like "goto")... killing a 
procedure!? -means wrong planning of an app! (and jumping in the code with goto 
also like this)


On Tue, Oct 2, 2012 at 12:11 PM, Rodrigo Silva dos Santos 
 wrote:
Better solution than mine (that don't even make a code)

As a Oo developer, a run away from using switch, so I should never use break 
too... Good to know. By the way, what's the problem with it?


Enviado por Samsung Mobile



Bálint Horváth  escreveu:



The problem was already solved. I forgot to send a copy to the list...

Rodrigo, break!? Ohh man, it's a crazy idea... A developer DOES NOT use
break at all (in a loop)... (switch is an exception)

In the other hand Thomas, you should use while and count the lines and u
need to test if username found...

Yeah, this script is near to the good solution:


On Tue, Oct 2, 2012 at 8:52 AM, Thomas Conrad wrote:

> I'm currently learning php and as a challenge, I'm creating a login
> script using text files to store the information (until I learn how to
> handle databases with php).
> The problem I'm having is the if statement in my while loop is only
> evaluated on the last iteration of the while loop, so its only
> comparing the last username in the file and no others.
>
> Heres the code:
>
>  session_start();
>
> $users = file("../inc/users.inc.php");
>
> if($_POST['username'] && $_POST['password']){
>
> if(ereg("^[^@ ]+@[^@ ]+\.[^@ \.]+$",
> $_POST['username'])){
>
>
> while(list($id ,$username) = each($users)){
> if($_POST['username'] ==
> $username){
> $_SESSION['logged_in'] = 1;
> $_SESSION['username'] =
> $username;
>
> }
> }
> if($_SESSION['logged_in'] != 1){
> $error = "2";
> }
> }else{
> $error = "4";
> }
> }else{
> $error = "3";
> }
>
> if($error){
> header("Location:
> http://koopasforever.com/scripts/login.php?error=$error";);
> }else{
> header("Location: http://koopasforever.com/";);
> }
>
>
> ?>
>
> I have checked all my variables and they all contain the proper information
>
> Some help would be greatly appriciated, Thanks
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>



Re: [PHP] problem with my login script

2012-10-02 Thread Bálint Horváth
"As a Oo developer, a run away from using switch" - I don't understand
this: OOP and switch could be good together and I also prefer switch eg. at
action or page selection...

break is an old stuff and not a nice solution (like "goto")... killing a
procedure!? -means wrong planning of an app! (and jumping in the code with
goto also like this)


On Tue, Oct 2, 2012 at 12:11 PM, Rodrigo Silva dos Santos <
rodrigos.santo...@gmail.com> wrote:

> Better solution than mine (that don't even make a code)
>
> As a Oo developer, a run away from using switch, so I should never use
> break too... Good to know. By the way, what's the problem with it?
>
>
> Enviado por Samsung Mobile
>
>
>
> Bálint Horváth  escreveu:
>
>
>
> The problem was already solved. I forgot to send a copy to the list...
>
> Rodrigo, break!? Ohh man, it's a crazy idea... A developer DOES NOT use
> break at all (in a loop)... (switch is an exception)
>
> In the other hand Thomas, you should use while and count the lines and u
> need to test if username found...
>
> Yeah, this script is near to the good solution:
> 
> session_start();
>
> $users = file("users.inc.php");
>
> if (!empty($_POST['username']) && !empty($_POST['password'])) {
> if (filter_var($_POST['username'], FILTER_VALIDATE_EMAIL)) {
> $ui = 0;
> while ($ui < count($users) && $error != "0") {
> $user = explode(' ', trim($users[$ui]));
> if ($_POST['username'] == $user[1]) {
> $_SESSION['logged_in'] = 1;
> $_SESSION['username'] = $user[1];
> $error = "0";
> } else{
> $error = "2";
> }
> $ui++;
> }
> } else {
> $error = "4";
> }
> } else {
> $error = "3";
> }
>
> if ($error == "0") {
> print("redirecting");
> } else {
> print("error: " . $error);
> }
>
> ?>
>
> On Tue, Oct 2, 2012 at 8:52 AM, Thomas Conrad  >wrote:
>
> > I'm currently learning php and as a challenge, I'm creating a login
> > script using text files to store the information (until I learn how to
> > handle databases with php).
> > The problem I'm having is the if statement in my while loop is only
> > evaluated on the last iteration of the while loop, so its only
> > comparing the last username in the file and no others.
> >
> > Heres the code:
> >
> >  > session_start();
> >
> > $users = file("../inc/users.inc.php");
> >
> > if($_POST['username'] && $_POST['password']){
> >
> > if(ereg("^[^@ ]+@[^@ ]+\.[^@ \.]+$",
> > $_POST['username'])){
> >
> >
> > while(list($id ,$username) =
> each($users)){
> > if($_POST['username'] ==
> > $username){
> > $_SESSION['logged_in'] =
> 1;
> > $_SESSION['username'] =
> > $username;
> >
> > }
> > }
> > if($_SESSION['logged_in'] != 1){
> > $error = "2";
> > }
> > }else{
> > $error = "4";
> > }
> > }else{
> > $error = "3";
> > }
> >
> > if($error){
> > header("Location:
> > http://koopasforever.com/scripts/login.php?error=$error";);
> > }else{
> > header("Location: http://koopasforever.com/";);
> > }
> >
> >
> > ?>
> >
> > I have checked all my variables and they all contain the proper
> information
> >
> > Some help would be greatly appriciated, Thanks
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
>


Re: [PHP] problem with my login script

2012-10-02 Thread Rodrigo Silva dos Santos
Better solution than mine (that don't even make a code)

As a Oo developer, a run away from using switch, so I should never use break 
too... Good to know. By the way, what's the problem with it?


Enviado por Samsung Mobile

Bálint Horváth  escreveu:

The problem was already solved. I forgot to send a copy to the list...

Rodrigo, break!? Ohh man, it's a crazy idea... A developer DOES NOT use
break at all (in a loop)... (switch is an exception)

In the other hand Thomas, you should use while and count the lines and u
need to test if username found...

Yeah, this script is near to the good solution:


On Tue, Oct 2, 2012 at 8:52 AM, Thomas Conrad wrote:

> I'm currently learning php and as a challenge, I'm creating a login
> script using text files to store the information (until I learn how to
> handle databases with php).
> The problem I'm having is the if statement in my while loop is only
> evaluated on the last iteration of the while loop, so its only
> comparing the last username in the file and no others.
>
> Heres the code:
>
>  session_start();
>
> $users = file("../inc/users.inc.php");
>
> if($_POST['username'] && $_POST['password']){
>
> if(ereg("^[^@ ]+@[^@ ]+\.[^@ \.]+$",
> $_POST['username'])){
>
>
> while(list($id ,$username) = each($users)){
> if($_POST['username'] ==
> $username){
> $_SESSION['logged_in'] = 1;
> $_SESSION['username'] =
> $username;
>
> }
> }
> if($_SESSION['logged_in'] != 1){
> $error = "2";
> }
> }else{
> $error = "4";
> }
> }else{
> $error = "3";
> }
>
> if($error){
> header("Location:
> http://koopasforever.com/scripts/login.php?error=$error";);
> }else{
> header("Location: http://koopasforever.com/";);
> }
>
>
> ?>
>
> I have checked all my variables and they all contain the proper information
>
> Some help would be greatly appriciated, Thanks
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


Re: [PHP] problem with my login script

2012-10-02 Thread Bálint Horváth
The problem was already solved. I forgot to send a copy to the list...

Rodrigo, break!? Ohh man, it's a crazy idea... A developer DOES NOT use
break at all (in a loop)... (switch is an exception)

In the other hand Thomas, you should use while and count the lines and u
need to test if username found...

Yeah, this script is near to the good solution:


On Tue, Oct 2, 2012 at 8:52 AM, Thomas Conrad wrote:

> I'm currently learning php and as a challenge, I'm creating a login
> script using text files to store the information (until I learn how to
> handle databases with php).
> The problem I'm having is the if statement in my while loop is only
> evaluated on the last iteration of the while loop, so its only
> comparing the last username in the file and no others.
>
> Heres the code:
>
>  session_start();
>
> $users = file("../inc/users.inc.php");
>
> if($_POST['username'] && $_POST['password']){
>
> if(ereg("^[^@ ]+@[^@ ]+\.[^@ \.]+$",
> $_POST['username'])){
>
>
> while(list($id ,$username) = each($users)){
> if($_POST['username'] ==
> $username){
> $_SESSION['logged_in'] = 1;
> $_SESSION['username'] =
> $username;
>
> }
> }
> if($_SESSION['logged_in'] != 1){
> $error = "2";
> }
> }else{
> $error = "4";
> }
> }else{
> $error = "3";
> }
>
> if($error){
> header("Location:
> http://koopasforever.com/scripts/login.php?error=$error";);
> }else{
> header("Location: http://koopasforever.com/";);
> }
>
>
> ?>
>
> I have checked all my variables and they all contain the proper information
>
> Some help would be greatly appriciated, Thanks
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


Re: [PHP] problem with my login script

2012-10-02 Thread Rodrigo Silva dos Santos
Hello Thomas.

The if are being evaluated in all iterations of the while, the problem is you 
didn't stop the loop when it finds what it's searching for. Try putting a break 
in the end of the if, them, when the condition match, the while will stop.

And hey! You're using a lot of legacy code for one that is learning php. If you 
want, I can give you some tips to modernize your script ;)

Regards, Rodrigo Silva dos Santos.




Enviado por Samsung Mobile

Thomas Conrad  escreveu:

I'm currently learning php and as a challenge, I'm creating a login
script using text files to store the information (until I learn how to
handle databases with php).
The problem I'm having is the if statement in my while loop is only
evaluated on the last iteration of the while loop, so its only
comparing the last username in the file and no others.

Heres the code:

http://koopasforever.com/scripts/login.php?error=$error";);
}else{
header("Location: http://koopasforever.com/";);
}


?>

I have checked all my variables and they all contain the proper information

Some help would be greatly appriciated, Thanks

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



RE: [PHP] Problem with PHP in Moodle LMS

2012-09-27 Thread admin
> Has anyone ever heard of a problem with the Moodle LMS when trying to edit
an activity (quiz, resource) in which there is a timeout after only a few
seconds and a message saying something to the effect of > that the system is
sorry but there was a time out, please retry. When I look in the URL I see
the following after my domain name:
> 
> .../course/modeit.php
> 
> Is this purely a Moodle thing, or something someone can help me with.
(I've already searched the Moodle site for information about this error, but
can't see anything related to version 2.2.3, which I am 
> using.) Any help would be appreciated. I thought I might want to up the
timout figure in the php5.ini file in the root directory of my shared Linux
hosting with Godaddy, but I don't think that's really the > problem.
> Regards,
>
> Gary

Gary,
Yes Moodle has a configuration issue. I would switch it to Debug
mode and check the error logs it will tell you exactly what is going wrong.



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



[PHP] Problem with PHP in Moodle LMS

2012-09-27 Thread Gary Lebowitz
Has anyone ever heard of a problem with the Moodle LMS when trying to edit
an activity (quiz, resource) in which there is a timeout after only a few
seconds and a message saying something to the effect of that the system is
sorry but there was a time out, please retry. When I look in the URL I see
the following after my domain name:

.../course/modeit.php

Is this purely a Moodle thing, or something someone can help me with. (I've
already searched the Moodle site for information about this error, but
can't see anything related to version 2.2.3, which I am using.) Any help
would be appreciated. I thought I might want to up the timout figure in the
php5.ini file in the root directory of my shared Linux hosting with
Godaddy, but I don't think that's really the problem.

Regards,

Gary


[PHP] Problem with ssh2 public/private key connecting

2012-06-12 Thread Radek Krejča
Hi,

I have problem with ssh2_Auth_Pubkey_File. I have one server for
connecting to others. On all of theese is FreeBSD installed, but
different versions.

I am using dsa keys for connecting. From command line works everything
fine (with using the same key files). But from php I have problem - a
few servers with new version of FreeBSD dont accept connection.

On machine where is php installed I have this message in php errorlog:

[Tue Jun 12 12:15:37 2012] [error] [client ::1] PHP Warning:
ssh2_auth_pubkey_file(): Authentication failed for useruser using public
key: Username/PublicKey combination invalid in /usr/local/www/pokus.php
on line 119

and in auth.log on remote machine I have:

Jun 12 12:15:37 remote10 sshd[14012]: Did not receive identification
string from 92.62.224.xx

I thing, that problem is not in script - I am able to connect to some
machines. But where could be a problem, I dont know.

Here are methods, which I have to tried:

#private $_METHODS  = Array('hostkey' => 'ssh-dss');
private $_METHODS   = Array('kex' =>
'diffie-hellman-group1-sha1','hostkey' => 'ssh-dss','client_to_server'
=> Array('crypt' => '3des-cbc','mac' => 'hmac-md5','comp' =>
'none'),'server_to_client' => Array('crypt' => '3des-cbc','mac' =>
'hmac-md5','comp' => 'none'));


private function Set_Connection()
{
$this->_connection = ssh2_Connect($this->_device_hostname,
$this->_device_port, $this->_METHODS);
if(!$this->_connection)
{
$this->_connection = NULL;
return false;
}

if(!ssh2_Auth_Pubkey_File($this->_connection, $this->_USER,
$this->_PUBLIC_KEY_PATH, $this->_PRIVATE_KEY_PATH))
{
$this->_connection = NULL;
return false;
}

return true;
}

Thank you for any suggestion.
Radek


Re: [PHP] problem sending email

2012-05-24 Thread Matijn Woudt
On Thu, May 24, 2012 at 2:00 PM, As'ad Djamalilleil  wrote:
> hi all,i'm having this problem in sending email using pear.
> it just wont send :(
> here's the code ..
>
>     require_once 'Mail.php';
>
>    $from_name = "My Self";
>    $to_name = "My Friend";
>    $subject = "Sending Trial";
>    $mailmsg = "GOD please make it work";
>
>    $From = "From: ".$from_name." ";
>    $To = "To: ".$to_name." ";

Don't prefix with From: and To: here.

>    $recipients = "some...@yahoo.com";
>
>    $headers["From"] = $From;
>    $headers["To"] = $To;
>    $headers["Subject"] = $subject;
>    $headers["Content-Type"] = "text/plain; charset=iso-8859-1";
>
>    $smtpinfo["host"] = "smtp.gmail.com";
>    $smtpinfo["port"] = "465";
>    $smtpinfo["auth"] = true;
>    $smtpinfo["username"] = "mym...@gmail.com";
>    $smtpinfo["password"] = "mypassword";
>
>    $mail_object =& Mail::factory("smtp", $smtpinfo);
>
>    $mail_object->send($recipients, $headers, $mailmsg);
>
>    if (PEAR::isError($mail_object))
>      echo $mail_object->getMessage();
> ?>

Also, Gmail SMTP supports only SSL connections. I don't know this PEAR
module, but I think you need to host set to something like
ssl://smtp.gmail.com, to enforce SSL connection.

- Matijn

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



[PHP] problem sending email

2012-05-24 Thread As'ad Djamalilleil
hi all,i'm having this problem in sending email using pear.
it just wont send :(
here's the code ..

";
$To = "To: ".$to_name." ";
$recipients = "some...@yahoo.com";

$headers["From"] = $From;
$headers["To"] = $To;
$headers["Subject"] = $subject;
$headers["Content-Type"] = "text/plain; charset=iso-8859-1";

$smtpinfo["host"] = "smtp.gmail.com";
$smtpinfo["port"] = "465";
$smtpinfo["auth"] = true;
$smtpinfo["username"] = "mym...@gmail.com";
$smtpinfo["password"] = "mypassword";

$mail_object =& Mail::factory("smtp", $smtpinfo);

$mail_object->send($recipients, $headers, $mailmsg);

if (PEAR::isError($mail_object))
  echo $mail_object->getMessage();
?>


Re: [PHP] Problem with AssertTag: children count wrong

2012-05-02 Thread Michael Otteneder
Hi, sorry, I forgot to include the class definition:

class GeneratedFiltersTest extends PHPUnit_Framework_Testcase {

function testUnconfiguredFilter() {
 $matcher = array(
'tag' =>  'ul',
'children' =>  array(
'count' =>  3,
'only' =>  array('tag' =>  'li')
)
 );
$this->assertTag($matcher, $this->html, $message, $isHtml = FALSE);
}
}

I dont think that the problem is that $this does not exist. Other examples
of assertTag() and other assert* functions work perfectly well.
The only problem I have is when I use the 'children' option with assertTag,
because the count never hast the value it should have.

kind regards,
Michael
On Wed, May 2, 2012 at 9:22 PM, Jim Lucas  wrote:

> On 05/02/2012 10:55 AM, Michael Otteneder wrote:
>
>> Hi List!
>>
>> I'm trying to use phpUnit's AssertTag function to make sure that some html
>> code contains an ul element with exactly li items in it.
>>
>> My test looks like this:
>>
>>
>> function testUnconfiguredFilter() {
>>  $matcher = array(
>> 'tag' =>  'ul',
>> 'children' =>  array(
>> 'count' =>  3,
>> 'only' =>  array('tag' =>  'li')
>> )
>> );
>> $this->assertTag($matcher, $this->html, $message, $isHtml = FALSE);
>> }
>>
>> the value of $html is:
>>
>> 
>> unconfiguredFilter
>>
>> 
>>   FilterValue1  ()
>>   FilterValue2  ()
>>   FilterValue3  ()
>> 
>> 
>>
>> So I think the assertion SHOULD work - but it does not, no matter what I
>> use for count! Sadly PHPUnit's output ist not very helpful, all it gives
>> me
>> is:
>>
>> 1) GeneratedFiltersTest::**testUnconfiguredFilter
>> Failed asserting that false is true.
>>
>
> When dealing with classes, and specifically calling a static method within
> a class, the variable $this does not exist.  You must use 'self' instead.
>
> You would need to do this instead if you wanted to use the $this way of
> things
>
> $test = new GeneratedFiltersTest;
> $test->testUnconfiguredFilter(**);
>
> Plus, I am going to assume (since I don't see your code), that the method
> "assertTag()" is in a parent class that is inherited by the class
> GeneratedFiltersTest and again, since you are calling it via a static
> method, the inheritance would not have taken place.
>
>
>
>>
>> Has someone got an idea whats going on? This is really freakin me out,
>> could not find anything about it anywhere on the web.
>>
>> Kind regards,
>> Michael
>>
>>
>
> --
> Jim Lucas
>
> http://www.cmsws.com/
> http://www.cmsws.com/examples/
> http://www.bendsource.com/
>


Re: [PHP] Problem with AssertTag: children count wrong

2012-05-02 Thread Jim Lucas

On 05/02/2012 10:55 AM, Michael Otteneder wrote:

Hi List!

I'm trying to use phpUnit's AssertTag function to make sure that some html
code contains an ul element with exactly li items in it.

My test looks like this:


function testUnconfiguredFilter() {
  $matcher = array(
'tag' =>  'ul',
'children' =>  array(
'count' =>  3,
'only' =>  array('tag' =>  'li')
)
);
$this->assertTag($matcher, $this->html, $message, $isHtml = FALSE);
}

the value of $html is:


unconfiguredFilter


  FilterValue1  ()
  FilterValue2  ()
  FilterValue3  ()



So I think the assertion SHOULD work - but it does not, no matter what I
use for count! Sadly PHPUnit's output ist not very helpful, all it gives me
is:

1) GeneratedFiltersTest::testUnconfiguredFilter
Failed asserting that false is true.


When dealing with classes, and specifically calling a static method 
within a class, the variable $this does not exist.  You must use 'self' 
instead.


You would need to do this instead if you wanted to use the $this way of 
things


$test = new GeneratedFiltersTest;
$test->testUnconfiguredFilter();

Plus, I am going to assume (since I don't see your code), that the 
method "assertTag()" is in a parent class that is inherited by the class 
GeneratedFiltersTest and again, since you are calling it via a static 
method, the inheritance would not have taken place.





Has someone got an idea whats going on? This is really freakin me out,
could not find anything about it anywhere on the web.

Kind regards,
Michael




--
Jim Lucas

http://www.cmsws.com/
http://www.cmsws.com/examples/
http://www.bendsource.com/

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



[PHP] Problem with AssertTag: children count wrong

2012-05-02 Thread Michael Otteneder
Hi List!

I'm trying to use phpUnit's AssertTag function to make sure that some html
code contains an ul element with exactly li items in it.

My test looks like this:


function testUnconfiguredFilter() {
 $matcher = array(
'tag' => 'ul',
'children' => array(
'count' => 3,
'only' => array('tag' => 'li')
)
);
$this->assertTag($matcher, $this->html, $message, $isHtml = FALSE);
}

the value of $html is:


unconfiguredFilter


 FilterValue1 ()
 FilterValue2 ()
 FilterValue3 ()



So I think the assertion SHOULD work - but it does not, no matter what I
use for count! Sadly PHPUnit's output ist not very helpful, all it gives me
is:

1) GeneratedFiltersTest::testUnconfiguredFilter
Failed asserting that false is true.


Has someone got an idea whats going on? This is really freakin me out,
could not find anything about it anywhere on the web.

Kind regards,
Michael


[PHP] problem loading php extension: undefined reference to __gxx_personality_v0‏

2012-05-01 Thread Nathan Ridge

Hi,
 
I'm having trouble loading a PHP extension that I made. 
When starting PHP, I get the following error:
 
PHP Warning:  PHP Startup: Unable to load dynamic library 
'/usr/lib/php5/20090626/libtg.so' - /usr/lib/php5/20090626/libtg.so: undefined 
symbol: __gxx_personality_v0 in Unknown on line 0
 
libtg.so is my extension. It is a wrapper around a C++ library, made
using SWIG (http://www.swig.org/).
 
I know __gxx_personality_v0 is a symbol from libstdc++, but my extension,
libtg.so, is linked to libstdc++. I have confirmed this using ldd:
 
$ ldd libtg.so
linux-vdso.so.1 =>  (0x7fff5f932000)
libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x7f3fc937c000)
libm.so.6 => /lib/libm.so.6 (0x7f3fc90f9000)
libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x7f3fc8ee2000)
libc.so.6 => /lib/libc.so.6 (0x7f3fc8b5f000)
/lib64/ld-linux-x86-64.so.2 (0x7f3fc98fc000)
 
Any ideas as to why PHP is not finding this symbol, or how I can further 
diagnose the problem?
 
Thanks,
Nate  

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



Re: [PHP] problem about PHP-FPM in TCP socket and Unix socket

2012-03-02 Thread Daniel Fenn
Something else that should be said: You won't need to muck around with
firewall settings as well (that if your running a firewall on the same
box





On Sat, Mar 3, 2012 at 11:22 AM, Matijn Woudt  wrote:
> On Fri, Mar 2, 2012 at 5:56 PM, Yuchen Wang  wrote:
>> Hello all,
>>
>> I am trying to config some new server
>>
>> All of my servers are using TCP Socket(127.0.0.1:9000) between nginx and
>> php-fpm before
>>
>> But, I run ab(ab -n 2 -c50 http://192.168.74.130:81/) to test the
>> performance of Unix Socket and TCP Socket,
>> the result is Unix is little better than TCP
>>
>> Usually we run php and web server in the same server,
>> So, TCP socket and Unix socket
>> Which method do you prefer ?
>>
>> Thank you
>>
>> --
>> *Yuchen Wang*
>
> Always go for Unix sockets. TCP has quite a bit overhead which
> includes stuff you really don't need if two processes live on the same
> server. Think about error detection, flow control, congestion control,
> packet loss. None of these are needed if your system is functioning
> correctly.
>
> - Matijn
>
> --
> 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] problem about PHP-FPM in TCP socket and Unix socket

2012-03-02 Thread Matijn Woudt
On Fri, Mar 2, 2012 at 5:56 PM, Yuchen Wang  wrote:
> Hello all,
>
> I am trying to config some new server
>
> All of my servers are using TCP Socket(127.0.0.1:9000) between nginx and
> php-fpm before
>
> But, I run ab(ab -n 2 -c50 http://192.168.74.130:81/) to test the
> performance of Unix Socket and TCP Socket,
> the result is Unix is little better than TCP
>
> Usually we run php and web server in the same server,
> So, TCP socket and Unix socket
> Which method do you prefer ?
>
> Thank you
>
> --
> *Yuchen Wang*

Always go for Unix sockets. TCP has quite a bit overhead which
includes stuff you really don't need if two processes live on the same
server. Think about error detection, flow control, congestion control,
packet loss. None of these are needed if your system is functioning
correctly.

- Matijn

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



Re: [PHP] problem about PHP-FPM in TCP socket and Unix socket

2012-03-02 Thread Daniel Fenn
This how I would look at it, if it on the same box use socket, and yes
it is expected that socket is faster than TCP since (as far as I know)
you don't need to deal with the overhead of TCP.

Regards,
Daniel Fenn







On Sat, Mar 3, 2012 at 3:56 AM, Yuchen Wang  wrote:
> Hello all,
>
> I am trying to config some new server
>
> All of my servers are using TCP Socket(127.0.0.1:9000) between nginx and
> php-fpm before
>
> But, I run ab(ab -n 2 -c50 http://192.168.74.130:81/) to test the
> performance of Unix Socket and TCP Socket,
> the result is Unix is little better than TCP
>
> Usually we run php and web server in the same server,
> So, TCP socket and Unix socket
> Which method do you prefer ?
>
> Thank you
>
> --
> *Yuchen Wang*

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



[PHP] problem about PHP-FPM in TCP socket and Unix socket

2012-03-02 Thread Yuchen Wang
Hello all,

I am trying to config some new server

All of my servers are using TCP Socket(127.0.0.1:9000) between nginx and
php-fpm before

But, I run ab(ab -n 2 -c50 http://192.168.74.130:81/) to test the
performance of Unix Socket and TCP Socket,
the result is Unix is little better than TCP

Usually we run php and web server in the same server,
So, TCP socket and Unix socket
Which method do you prefer ?

Thank you

-- 
*Yuchen Wang*


RE: [PHP] Problem with date

2011-12-07 Thread admin

> -Original Message-
> From: Jack [mailto:jacklistm...@gmail.com]
> Sent: Wednesday, December 07, 2011 1:49 PM
> To: PHP
> Subject: [PHP] Problem with date
> 
> Hello All,
> 
> 
> 
> I have a problem where Dates are coming out as 12.31.1969 19:00:00
> which of
> course we didn't have PC's in 1969
> 
> I'm not able to see where the date is getting screwed up, any ideas??
> 
> 
> 
> //
> ###
> #
> #
> 
> function ShowFeed_RSS($XmlRoot) {
> 
>   $title = GetFirstChildContentByPath($XmlRoot, "channel/title");
> 
>   $link = GetFirstChildContentByPath($XmlRoot, "channel/link");
> 
>   $desc = GetFirstChildContentByPath($XmlRoot, "channel/description");
> 
> # Next 2 lines display the title of the feed, and feed description
> 
> 
> #  echo " href=\"$link\">$title\n";
> 
> #  echo "$desc";
> 
>   $nodelist = GetChildrenByPathAndName($XmlRoot, "channel", "item");
> 
>   if (!$nodelist) return 0;
> 
>   foreach ($nodelist as $nl) {
> 
> $title   = GetFirstChildContentByName($nl, "title");
> 
> $link= GetFirstChildContentByName($nl, "link");
> 
> $desc= GetFirstChildContentByName($nl, "description");
> 
> $creator = GetFirstChildContentByName($nl, "author");
> 
> 
> 
> #if (!$creator) $creator = GetFirstChildContentByName($nl,
> "dc:creator");
> 
> 
> 
> #   echo "JACK" . $nl . "";
> 
> #$pubdate = GetFirstChildContentByName($nl, "pubDate");
> 
> if (!isset($pubdate)) $pubdate = GetFirstChildContentByName($nl,
> "dc:date");
> 
> #if (!$pubdate) $pubdate = GetFirstChildContentByName($nl,
> "dc:date");
> 
> if (isset($pubdate)) $pubdate = strtotime($pubdate);
> 
> if (isset($pubdate)) $pubdate = strftime("%m.%d.%Y %H:%M:%S",
> $pubdate);
> 
> $out = $creator;
> 
> 
> 
> if ( ($creator != "") && ($pubdate != "") ) $out .= " @ ";
> 
> 
> $out .= $pubdate;
> 
> echo "$title";
> 
> echo "$out";
> 
> echo "$desc";
> 
> #   echo "This is not green";
> 
> 
> 
> }
> 
> #  this line is after each rss feed group
> 
> #  echo "\n";
> 
> 
> 
> }
> 
> 
> 
> 
> 
> 
> 
> Thanks!
> 
> Jack
> 
> 



Suggestion only.
if (isset($pubdate)) $pubdate = strtotime($pubdate);

if (isset($pubdate)) $pubdate = strftime("%m.%d.%Y %H:%M:%S", $pubdate);

could be 

if (isset($pubdate)) $pubdate = mktime("m d Y
H:i:s",strtotime($pubdate));
Reducing the code

I also changed this to MKtime from strftime because The %e modifier is not
supported in the Windows implementation of this function. To achieve this
value, the %#d modifier can be used instead. The example below  illustrates
how to write a cross platform compatible function. 

Please read on the MKTIME function
http://php.net/manual/en/function.mktime.php
















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



RE: [PHP] Problem with date

2011-12-07 Thread Jack
> To: PHP
> Subject: RE: [PHP] Problem with date
> 
> >
> >
> >   How about a little debugging here (and possibly elsewhere):
> >
> >   if (isset($pubdate) && ($pubdate >0)) {
> >  $pubdate=strtotime($pubdate);
> >   } else {
> >  die("Barf.  Can't run a string to time conversion on 0 or
-1.");
> >   }
> >
> 
> Thanks Kevin,
> 
> This bombs and gives me the BARF!
> 

FYI the date field is stored in a MySQL DB as a datetime type


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



RE: [PHP] Problem with date

2011-12-07 Thread Jack
> >   How about a little debugging here (and possibly elsewhere):
> >
> >   if (isset($pubdate) && ($pubdate >0)) {
> >  $pubdate=strtotime($pubdate);
> >   } else {
> >  die("Barf.  Can't run a string to time conversion on 0 or
-1.");
> >   }
> >
> 
Thanks Kevin,

This bombs and gives me the BARF!


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



RE: [PHP] Problem with date

2011-12-07 Thread Jack Sasportas
> 
> 
>   How about a little debugging here (and possibly elsewhere):
> 
>   if (isset($pubdate) && ($pubdate >0)) {
>  $pubdate=strtotime($pubdate);
>   } else {
>  die("Barf.  Can't run a string to time conversion on 0 or -1.");
>   }
> 

Thanks Kevin,

This bombs and gives me the BARF!

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



Re: [PHP] Problem with date

2011-12-07 Thread Jim Lucas
On 12/7/2011 10:48 AM, Jack wrote:
> Hello All,
> 
> I have a problem where Dates are coming out as 12.31.1969 19:00:00 which of
> course we didn't have PC's in 1969
> 
> I'm not able to see where the date is getting screwed up, any ideas??
> 
> //
> 
> #
> function ShowFeed_RSS($XmlRoot) {
>   $title = GetFirstChildContentByPath($XmlRoot, "channel/title");  
>   $link = GetFirstChildContentByPath($XmlRoot, "channel/link");  
>   $desc = GetFirstChildContentByPath($XmlRoot, "channel/description");
> # Next 2 lines display the title of the feed, and feed description
> #  echo " href=\"$link\">$title\n";
> #  echo "$desc";
>   $nodelist = GetChildrenByPathAndName($XmlRoot, "channel", "item");
>   if (!$nodelist) return 0;
>   foreach ($nodelist as $nl) {
> $title   = GetFirstChildContentByName($nl, "title");
> $link= GetFirstChildContentByName($nl, "link");
> $desc= GetFirstChildContentByName($nl, "description");
> $creator = GetFirstChildContentByName($nl, "author");
> #if (!$creator) $creator = GetFirstChildContentByName($nl,
> "dc:creator");
> #   echo "JACK" . $nl . "";
> #$pubdate = GetFirstChildContentByName($nl, "pubDate");
> if (!isset($pubdate)) $pubdate = GetFirstChildContentByName($nl,
> "dc:date");
> #if (!$pubdate) $pubdate = GetFirstChildContentByName($nl, "dc:date");
> if (isset($pubdate)) $pubdate = strtotime($pubdate);
> if (isset($pubdate)) $pubdate = strftime("%m.%d.%Y %H:%M:%S", $pubdate);
> $out = $creator;
> if ( ($creator != "") && ($pubdate != "") ) $out .= " @ ";
> $out .= $pubdate;
> echo "$title";
> echo "$out";
> echo "$desc";
> #   echo "This is not green";
> }
> #  this line is after each rss feed group
> #  echo "\n";
> }
> Thanks!
> Jack

Can you supply an example of the data you are feeding this.

-- 
Jim Lucas

http://www.cmsws.com/
http://www.cmsws.com/examples/
http://www.bendsource.com/

C - (541) 408-5189
O - (541) 323-9113
H - (541) 323-4219

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



Re: [PHP] Problem with date

2011-12-07 Thread Joshua Kehn
$pubdate is probably null or something.

Regards,

–Josh

Joshua Kehn | @joshkehn 
http://joshuakehn.com

On Dec 7, 2011, at 1:48 PM, Jack wrote:

> Hello All,
> 
> 
> 
> I have a problem where Dates are coming out as 12.31.1969 19:00:00 which of
> course we didn't have PC's in 1969
> 
> I'm not able to see where the date is getting screwed up, any ideas??
> 
> 
> 
> //
> 
> #
> 
> function ShowFeed_RSS($XmlRoot) {
> 
>  $title = GetFirstChildContentByPath($XmlRoot, "channel/title");  
> 
>  $link = GetFirstChildContentByPath($XmlRoot, "channel/link");  
> 
>  $desc = GetFirstChildContentByPath($XmlRoot, "channel/description");
> 
> # Next 2 lines display the title of the feed, and feed description
> 
> 
> #  echo " href=\"$link\">$title\n";
> 
> #  echo "$desc";
> 
>  $nodelist = GetChildrenByPathAndName($XmlRoot, "channel", "item");
> 
>  if (!$nodelist) return 0;
> 
>  foreach ($nodelist as $nl) {
> 
>$title   = GetFirstChildContentByName($nl, "title");
> 
>$link= GetFirstChildContentByName($nl, "link");
> 
>$desc= GetFirstChildContentByName($nl, "description");
> 
>$creator = GetFirstChildContentByName($nl, "author");
> 
> 
> 
> #if (!$creator) $creator = GetFirstChildContentByName($nl,
> "dc:creator");
> 
> 
> 
> #   echo "JACK" . $nl . "";
> 
> #$pubdate = GetFirstChildContentByName($nl, "pubDate");
> 
>if (!isset($pubdate)) $pubdate = GetFirstChildContentByName($nl,
> "dc:date");
> 
> #if (!$pubdate) $pubdate = GetFirstChildContentByName($nl, "dc:date");
> 
>if (isset($pubdate)) $pubdate = strtotime($pubdate);
> 
>if (isset($pubdate)) $pubdate = strftime("%m.%d.%Y %H:%M:%S", $pubdate);
> 
>$out = $creator;
> 
> 
> 
>if ( ($creator != "") && ($pubdate != "") ) $out .= " @ ";
> 
> 
>$out .= $pubdate;
> 
>echo "$title";
> 
>echo "$out";
> 
>echo "$desc";
> 
> #   echo "This is not green";
> 
> 
> 
> }
> 
> #  this line is after each rss feed group
> 
> #  echo "\n";
> 
> 
> 
> }
> 
> 
> 
> 
> 
> 
> 
> Thanks!
> 
> Jack
> 
> 
> 



[PHP] Problem with date

2011-12-07 Thread Jack
Hello All,

 

I have a problem where Dates are coming out as 12.31.1969 19:00:00 which of
course we didn't have PC's in 1969

I'm not able to see where the date is getting screwed up, any ideas??

 

//

#

function ShowFeed_RSS($XmlRoot) {

  $title = GetFirstChildContentByPath($XmlRoot, "channel/title");  

  $link = GetFirstChildContentByPath($XmlRoot, "channel/link");  

  $desc = GetFirstChildContentByPath($XmlRoot, "channel/description");

# Next 2 lines display the title of the feed, and feed description


#  echo "$title\n";

#  echo "$desc";

  $nodelist = GetChildrenByPathAndName($XmlRoot, "channel", "item");

  if (!$nodelist) return 0;

  foreach ($nodelist as $nl) {

$title   = GetFirstChildContentByName($nl, "title");

$link= GetFirstChildContentByName($nl, "link");

$desc= GetFirstChildContentByName($nl, "description");

$creator = GetFirstChildContentByName($nl, "author");

 

#if (!$creator) $creator = GetFirstChildContentByName($nl,
"dc:creator");

 

#   echo "JACK" . $nl . "";

#$pubdate = GetFirstChildContentByName($nl, "pubDate");

if (!isset($pubdate)) $pubdate = GetFirstChildContentByName($nl,
"dc:date");

#if (!$pubdate) $pubdate = GetFirstChildContentByName($nl, "dc:date");

if (isset($pubdate)) $pubdate = strtotime($pubdate);

if (isset($pubdate)) $pubdate = strftime("%m.%d.%Y %H:%M:%S", $pubdate);

$out = $creator;

 

if ( ($creator != "") && ($pubdate != "") ) $out .= " @ ";


$out .= $pubdate;

echo "$title";

echo "$out";

echo "$desc";

#   echo "This is not green";

 

}

#  this line is after each rss feed group

#  echo "\n";

 

}

 

 

 

Thanks!

Jack

 



Re: [PHP] problem with sending AT command in php

2011-11-18 Thread a dehqan
In The Name Of Allah

Thank you all for attentions ;
Weird but solved with using another symbolink of Device
Weird because other App in linux in the same time were using for example
/dev/ttyusb1 but php code works with /dev/ttyusb3 ..

Regards dehqan


On Tue, Nov 15, 2011 at 7:39 PM, Richard Quadling wrote:

> On 15 November 2011 15:12, Mike Mackintosh
>  wrote:
> >
> >
> > On Nov 15, 2011, at 8:25, Richard Quadling  wrote:
> >
> >> On 15 November 2011 11:50, a dehqan  wrote:
> >>> \n is for Linux
> >>> \r is for Windows
> >>>
> >>> On 11/14/11, Richard Quadling  wrote:
>  On 12 November 2011 20:02, a dehqan  wrote:
> > dio_write($handle, 'AT') & dio_write($handle, "AT") make firefox
> times out
> > on Waiting for localhost ... .
> > But dio_write($handle, "AT\n") makes it prints AT exactly the same
> command
> > or  A > A , ..
> >
> > On Sat, Nov 12, 2011 at 10:02 PM, Negin Nickparsa
> > wrote:
> >
> >> are you sure about ATD03518726535\n?
> >>
> >>  can you try if ( dio_write($handle, 'AT') )?
> >>
> >
> 
>  Don't use \n, use \r.
> 
>  http://en.wikipedia.org/wiki/AT_commands#Example_session
> 
> 
> 
>  --
>  Richard Quadling
>  Twitter : EE : Zend : PHPDoc : Fantasy Shopper
>  @RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY : bit.ly/lFnVea :
>  fan.sh/6/370
> 
> >>>
> >>
> >> No, \r is the requirement of the modem. Nothing to do with the OS.
> >>
> >> Windows uses \r\n as its line terminators, but when you talk to a
> >> modem, you use \r.
> >>
> >>
> >>
> >> --
> >> Richard Quadling
> >> Twitter : EE : Zend : PHPDoc : Fantasy Shopper
> >> @RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY : bit.ly/lFnVea :
> >> fan.sh/6/370
> >>
> >> --
> >> PHP General Mailing List (http://www.php.net/)
> >> To unsubscribe, visit: http://www.php.net/unsub.php
> >>
> >
> >
> > I've had better luck with PHP_EOL instead of \r or \n.
>
> I think I've not explained myself properly.
>
> The modem wants a carriage return. That is a \r.
>
> It doesn't matter what OS you are on. If you don't send the right
> string to the modem, then the modem won't process it properly.
>
> If your OS maps \r to PHP_EOL, then, obviously PHP_EOL will be just
> fine. But I would recommend ...
>
>  define('CR', chr(13));
> ?>
>
>
>
> --
> Richard Quadling
> Twitter : EE : Zend : PHPDoc : Fantasy Shopper
> @RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY : bit.ly/lFnVea :
> fan.sh/6/370
>


Re: [PHP] problem with sending AT command in php

2011-11-15 Thread Richard Quadling
On 15 November 2011 15:12, Mike Mackintosh
 wrote:
>
>
> On Nov 15, 2011, at 8:25, Richard Quadling  wrote:
>
>> On 15 November 2011 11:50, a dehqan  wrote:
>>> \n is for Linux
>>> \r is for Windows
>>>
>>> On 11/14/11, Richard Quadling  wrote:
 On 12 November 2011 20:02, a dehqan  wrote:
> dio_write($handle, 'AT') & dio_write($handle, "AT") make firefox times out
> on Waiting for localhost ... .
> But dio_write($handle, "AT\n") makes it prints AT exactly the same command
> or  A > A , ..
>
> On Sat, Nov 12, 2011 at 10:02 PM, Negin Nickparsa
> wrote:
>
>> are you sure about ATD03518726535\n?
>>
>>  can you try if ( dio_write($handle, 'AT') )?
>>
>

 Don't use \n, use \r.

 http://en.wikipedia.org/wiki/AT_commands#Example_session



 --
 Richard Quadling
 Twitter : EE : Zend : PHPDoc : Fantasy Shopper
 @RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY : bit.ly/lFnVea :
 fan.sh/6/370

>>>
>>
>> No, \r is the requirement of the modem. Nothing to do with the OS.
>>
>> Windows uses \r\n as its line terminators, but when you talk to a
>> modem, you use \r.
>>
>>
>>
>> --
>> Richard Quadling
>> Twitter : EE : Zend : PHPDoc : Fantasy Shopper
>> @RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY : bit.ly/lFnVea :
>> fan.sh/6/370
>>
>> --
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>
>
> I've had better luck with PHP_EOL instead of \r or \n.

I think I've not explained myself properly.

The modem wants a carriage return. That is a \r.

It doesn't matter what OS you are on. If you don't send the right
string to the modem, then the modem won't process it properly.

If your OS maps \r to PHP_EOL, then, obviously PHP_EOL will be just
fine. But I would recommend ...





-- 
Richard Quadling
Twitter : EE : Zend : PHPDoc : Fantasy Shopper
@RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY : bit.ly/lFnVea :
fan.sh/6/370

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



Re: [PHP] problem with sending AT command in php

2011-11-15 Thread Mike Mackintosh


On Nov 15, 2011, at 8:25, Richard Quadling  wrote:

> On 15 November 2011 11:50, a dehqan  wrote:
>> \n is for Linux
>> \r is for Windows
>> 
>> On 11/14/11, Richard Quadling  wrote:
>>> On 12 November 2011 20:02, a dehqan  wrote:
 dio_write($handle, 'AT') & dio_write($handle, "AT") make firefox times out
 on Waiting for localhost ... .
 But dio_write($handle, "AT\n") makes it prints AT exactly the same command
 or  A > A , ..
 
 On Sat, Nov 12, 2011 at 10:02 PM, Negin Nickparsa
 wrote:
 
> are you sure about ATD03518726535\n?
> 
>  can you try if ( dio_write($handle, 'AT') )?
> 
 
>>> 
>>> Don't use \n, use \r.
>>> 
>>> http://en.wikipedia.org/wiki/AT_commands#Example_session
>>> 
>>> 
>>> 
>>> --
>>> Richard Quadling
>>> Twitter : EE : Zend : PHPDoc : Fantasy Shopper
>>> @RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY : bit.ly/lFnVea :
>>> fan.sh/6/370
>>> 
>> 
> 
> No, \r is the requirement of the modem. Nothing to do with the OS.
> 
> Windows uses \r\n as its line terminators, but when you talk to a
> modem, you use \r.
> 
> 
> 
> -- 
> Richard Quadling
> Twitter : EE : Zend : PHPDoc : Fantasy Shopper
> @RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY : bit.ly/lFnVea :
> fan.sh/6/370
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 


I've had better luck with PHP_EOL instead of \r or \n.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] problem with sending AT command in php

2011-11-15 Thread Richard Quadling
On 15 November 2011 11:50, a dehqan  wrote:
> \n is for Linux
> \r is for Windows
>
> On 11/14/11, Richard Quadling  wrote:
>> On 12 November 2011 20:02, a dehqan  wrote:
>>> dio_write($handle, 'AT') & dio_write($handle, "AT") make firefox times out
>>> on Waiting for localhost ... .
>>> But dio_write($handle, "AT\n") makes it prints AT exactly the same command
>>> or  A > A , ..
>>>
>>> On Sat, Nov 12, 2011 at 10:02 PM, Negin Nickparsa
>>> wrote:
>>>
 are you sure about ATD03518726535\n?

  can you try if ( dio_write($handle, 'AT') )?

>>>
>>
>> Don't use \n, use \r.
>>
>> http://en.wikipedia.org/wiki/AT_commands#Example_session
>>
>>
>>
>> --
>> Richard Quadling
>> Twitter : EE : Zend : PHPDoc : Fantasy Shopper
>> @RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY : bit.ly/lFnVea :
>> fan.sh/6/370
>>
>

No, \r is the requirement of the modem. Nothing to do with the OS.

Windows uses \r\n as its line terminators, but when you talk to a
modem, you use \r.



-- 
Richard Quadling
Twitter : EE : Zend : PHPDoc : Fantasy Shopper
@RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY : bit.ly/lFnVea :
fan.sh/6/370

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



Re: [PHP] problem with sending AT command in php

2011-11-15 Thread a dehqan
\n is for Linux
\r is for Windows

On 11/14/11, Richard Quadling  wrote:
> On 12 November 2011 20:02, a dehqan  wrote:
>> dio_write($handle, 'AT') & dio_write($handle, "AT") make firefox times out
>> on Waiting for localhost ... .
>> But dio_write($handle, "AT\n") makes it prints AT exactly the same command
>> or  A > A , ..
>>
>> On Sat, Nov 12, 2011 at 10:02 PM, Negin Nickparsa
>> wrote:
>>
>>> are you sure about ATD03518726535\n?
>>>
>>>  can you try if ( dio_write($handle, 'AT') )?
>>>
>>
>
> Don't use \n, use \r.
>
> http://en.wikipedia.org/wiki/AT_commands#Example_session
>
>
>
> --
> Richard Quadling
> Twitter : EE : Zend : PHPDoc : Fantasy Shopper
> @RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY : bit.ly/lFnVea :
> fan.sh/6/370
>

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



Re: [PHP] problem with sending AT command in php

2011-11-14 Thread Richard Quadling
On 12 November 2011 20:02, a dehqan  wrote:
> dio_write($handle, 'AT') & dio_write($handle, "AT") make firefox times out
> on Waiting for localhost ... .
> But dio_write($handle, "AT\n") makes it prints AT exactly the same command
> or  A > A , ..
>
> On Sat, Nov 12, 2011 at 10:02 PM, Negin Nickparsa wrote:
>
>> are you sure about ATD03518726535\n?
>>
>>  can you try if ( dio_write($handle, 'AT') )?
>>
>

Don't use \n, use \r.

http://en.wikipedia.org/wiki/AT_commands#Example_session



-- 
Richard Quadling
Twitter : EE : Zend : PHPDoc : Fantasy Shopper
@RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY : bit.ly/lFnVea :
fan.sh/6/370

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



Re: [PHP] problem with sending AT command in php

2011-11-12 Thread a dehqan
dio_write($handle, 'AT') & dio_write($handle, "AT") make firefox times out
on Waiting for localhost ... .
But dio_write($handle, "AT\n") makes it prints AT exactly the same command
or  A > A , ..

On Sat, Nov 12, 2011 at 10:02 PM, Negin Nickparsa wrote:

> are you sure about ATD03518726535\n?
>
>  can you try if ( dio_write($handle, 'AT') )?
>


Re: [PHP] problem with sending AT command in php

2011-11-12 Thread Negin Nickparsa
are you sure about ATD03518726535\n?

 can you try if ( dio_write($handle, 'AT') )?


[PHP] problem with sending AT command in php

2011-11-12 Thread a dehqan
In The Name Of Allah The compassionate merciful

Hello ;
Am trying to send AT commands to my GSMmodem device , in linux with PHP
Am sure it is /dev/ttyusb1
But with [URL="http://pastebin.com/aut4ygXf"]this code[/URL] device respond
the same command and code prints that command
e.g if we send ATD00 it responds ATD00 , or with AT it responds AT instead
of Ok, why ?

Regards dehqan


[PHP] Problem of load balance among php-cgi process

2011-10-19 Thread Sean Chen
Hi,

 

I've got a problem when running PHP with nginx, there are several php-cgi
processes and only one is busy at one time, like this:

 

500  23868  0.0  0.0 209164 10948 ?S21:23   0:01
/usr/local/websrv/php/bin/php-cgi --fpm --fpm-config
/usr/local/websrv/php/etc/php-fpm.conf

500  23871  0.0  0.0 209136 10684 ?S21:23   0:01
/usr/local/websrv/php/bin/php-cgi --fpm --fpm-config
/usr/local/websrv/php/etc/php-fpm.conf

500  23872  0.0  0.0 209136 10732 ?S21:23   0:01
/usr/local/websrv/php/bin/php-cgi --fpm --fpm-config
/usr/local/websrv/php/etc/php-fpm.conf

500  23873  0.0  0.0 209136 10712 ?S21:23   0:01
/usr/local/websrv/php/bin/php-cgi --fpm --fpm-config
/usr/local/websrv/php/etc/php-fpm.conf

500  23874  0.0  0.0 209076 10576 ?S21:23   0:01
/usr/local/websrv/php/bin/php-cgi --fpm --fpm-config
/usr/local/websrv/php/etc/php-fpm.conf

500  23875  0.0  0.0 209136 10976 ?S21:23   0:01
/usr/local/websrv/php/bin/php-cgi --fpm --fpm-config
/usr/local/websrv/php/etc/php-fpm.conf

500  23876  0.0  0.0 209136 10796 ?S21:23   0:01
/usr/local/websrv/php/bin/php-cgi --fpm --fpm-config
/usr/local/websrv/php/etc/php-fpm.conf

500  23877  0.0  0.0 209136 11068 ?S21:23   0:01
/usr/local/websrv/php/bin/php-cgi --fpm --fpm-config
/usr/local/websrv/php/etc/php-fpm.conf

500  23878  0.0  0.0 209136 10708 ?S21:23   0:01
/usr/local/websrv/php/bin/php-cgi --fpm --fpm-config
/usr/local/websrv/php/etc/php-fpm.conf

500  23879  0.0  0.0 209136 10960 ?S21:23   0:01
/usr/local/websrv/php/bin/php-cgi --fpm --fpm-config
/usr/local/websrv/php/etc/php-fpm.conf

500  23880  0.0  0.0 209136 10832 ?S21:23   0:01
/usr/local/websrv/php/bin/php-cgi --fpm --fpm-config
/usr/local/websrv/php/etc/php-fpm.conf

500  27195 15.0  0.1 210196 12644 ?S23:02   0:02
/usr/local/websrv/php/bin/php-cgi --fpm --fpm-config
/usr/local/websrv/php/etc/php-fpm.conf

 

The red one is busy, and other php-cgi processes is cpu free, cpu load is
about 20% total, with lot of free memory, disk and network io status is
fine,

and mean time, response of HTTP request to this server is very slow.

 

The cpu load of php-cgi processes return normal when I restart the php-fpm
service (each process takes some cpu slice which means they are all working
I think). But, after several minutes, the problem appears again and again.

 

what's wrong with my php-cgi?

 

PS: how do I debug or monitor the php program running status when it goes
wrong?

 

versions:

php: 5.2.17

nginx: 5.8.55

OS: CentOS 5.6 64-bit

 

Regards

Sean

 



[PHP] Problem with base64_encode and openssl_verify

2011-10-11 Thread QI.VOLMAR QI
openssl_sign($dados, $signature, $pkeyid)); // return 1

$signatureValue = base64_encode($signature);

$funcionam = base64_decode($dados_que_nao);
$pubKey = file_get_contents('protected/models/nfe/certs/cert.pem');

openssl_verify($funcionam,$signature, $pubKey)); // return 0;

if I remove the de base64 encrypt and decrypt. It works fine. Can someone
helpme with this?


Fwd: [PHP] Problem with code...

2011-10-06 Thread tamouse mailing lists
On Thu, Oct 6, 2011 at 7:28 PM, Jason Pruim  wrote:
> Have a question about this block of code

I'm not seeing anything immediately standing out as a problem.

> Sometimes... It is dropping the last $mailmessage line... The payment method 
> in the actual email it sends...

Can you see if the last line is actually in $mailmessage before
sending the email? Maybe it's somehow getting truncated during the
mail step.

*Update:* I just noticed this. The last line has no \r\n termination.
I'm thinking that may be necessary for some mailers/transports/etc?

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



Re: [PHP] Problem with code...

2011-10-06 Thread tamouse mailing lists
On Thu, Oct 6, 2011 at 7:28 PM, Jason Pruim  wrote:
> Have a question about this block of code

I'm not seeing anything immediately standing out as a problem.

> Sometimes... It is dropping the last $mailmessage line... The payment method 
> in the actual email it sends...

Can you see if the last line is actually in $mailmessage before
sending the email? Maybe it's somehow getting truncated during the
mail step.

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



Re: [PHP] Problem with code...

2011-10-06 Thread Tommy Pham
On Thu, Oct 6, 2011 at 7:29 PM, Jason Pruim wrote:

>
> Jason Pruim
> li...@pruimphotography.com
>
>
>
> On Oct 6, 2011, at 9:04 PM, George Langley wrote:
>
> > On 2011-10-06, at 6:28 PM, Jason Pruim wrote:
> >>
> >>  >>
> >> //SETUP VARIABLES
> >>
> >> $mailTo = "li...@pruimphotography.com";
> >> $mailFrom = "li...@pruimphotography.com";
> >> //These 2 can be changed IF you know what you are doing and why!
> >> $returnPath = $mailFrom;
> >> $replyTo = $mailFrom;
> >> $mailSubject = "New Convention registration!";
> >>
> >> $message = "";
> >>
> >> //DO NOT CHANGE UNDER PENALITY OF BEING SLAPPED WITH A WET NOODLE!!!
> >>
> >> $headers = "From: ".$mailFrom."\n";
> >> $headers .= "Return-Path: ".$returnPath."\n";
> >> $headers .= "Reply-To: ".$replyTo."\n";
> >>
> >> function send_email($mailTo, $mailSubject, $mailMessage, $headers) {
> >>
> >>
> >>   if(mail( $mailTo, $mailSubject, $mailMessage, $headers )) {
> >>
> >>   $message = "Thank you for registering!";
> >>
> >>   }else {
> >>   echo "There was an issue with your registration.. Please try again
> later";
> >>   }
> >>
> >> }//Close Function
> >>
> >>
> >> if(!empty($errorCount)) {
> >>
> >>
> >>   }else {
> >>   //Build Email message
> >>   $mailmessage = "Full Name: " . $_POST['firstname'] . " " .
> $_POST['lastname'] . "\n\n";
> >>   $mailmessage .= "Address: " . $_POST['address'] . "\n\n";
> >>   $mailmessage .= "City, State, Zip: " . $_POST['city'] . " " .
> $_POST['state'] . " " . $_POST['zip'] . "\n\n";
> >>   $mailmessage .= "Phone: " . $_POST['phone'] . "\n\n";
> >>   $mailmessage .= "Email address: " . $_POST['email'] . "\n\n";
> >>   if($_POST['affiliation'] == "NFBOther") {
> >>   $mailmessage .= "Chapter Affiliation: " . $_POST['other']
> . "\n\n";
> >>   }else{
> >>   $mailmessage .= "Chapter Affiliation: " .
> $_POST['affiliation'] . "\n\n";
> >>   }
> >>   if($_POST['person'] =="Other"){
> >>   $mailmessage .= "Who will pick up the ticket? " .
> $_POST['Pfirstname'] . " " . $_POST['Llastname'] . "\n\n";
> >>
> >>   }else{
> >>   $mailmessage .= "Who will pick up the ticket? I will pick
> it up my self! \n\n";
> >>
> >>   }
> >>
> >> $mailmessage .= "Payment Method: " . $_POST['paymentMethod'];
> >>
> >>   send_email($mailTo, $mailSubject, $mailmessage, $headers);
> >>   }
> >>
> >> ?>
> >>
> >> Sometimes... It is dropping the last $mailmessage line... The payment
> method in the actual email it sends...
> >>
> >> Anyone have any ideas? I'm stumped
> > 
> >   Hi there. First thought is perhaps it is not getting a value for
> paymentMethod and if it doesn't exist, will the line still get added?
> >   I would always check to see if every post variable isset, before
> adding the line. Can write a default line in its place if missing.
>
> The variable is being set with a default value of nothing else... But for
> some reason it's not bringing it through when the form is submitted...
>
> Any other ideas? hehe :)
>
>
Have you tested with the same payment method to see if somewhere in your
code or a hiccup in the server is causing the problem?  Does that happen to
any or certain payment method (including blank entry)?  I'm guessing it may
happen with only certain payment method.  From the line
if(!empty($errorCount)) {, I presume you have a mechanism in place to
sanitize and validate inputs?  I'd suggest you start troubleshooting from
there.  If this is still development phase, try to bypass that mechanism for
a quick confirmation that is causing the problem.

Regards,
Tommy


Re: [PHP] Problem with code...

2011-10-06 Thread Jason Pruim

Jason Pruim
li...@pruimphotography.com



On Oct 6, 2011, at 9:04 PM, George Langley wrote:

> On 2011-10-06, at 6:28 PM, Jason Pruim wrote:
>> 
>> > 
>> //SETUP VARIABLES
>> 
>> $mailTo = "li...@pruimphotography.com";
>> $mailFrom = "li...@pruimphotography.com";
>> //These 2 can be changed IF you know what you are doing and why!
>> $returnPath = $mailFrom;
>> $replyTo = $mailFrom;
>> $mailSubject = "New Convention registration!";
>> 
>> $message = "";
>> 
>> //DO NOT CHANGE UNDER PENALITY OF BEING SLAPPED WITH A WET NOODLE!!!
>> 
>> $headers = "From: ".$mailFrom."\n";
>> $headers .= "Return-Path: ".$returnPath."\n";
>> $headers .= "Reply-To: ".$replyTo."\n";
>> 
>> function send_email($mailTo, $mailSubject, $mailMessage, $headers) {
>> 
>> 
>>   if(mail( $mailTo, $mailSubject, $mailMessage, $headers )) {
>> 
>>   $message = "Thank you for registering!";
>> 
>>   }else {
>>   echo "There was an issue with your registration.. Please try again 
>> later";
>>   }
>> 
>> }//Close Function
>> 
>> 
>> if(!empty($errorCount)) {
>> 
>> 
>>   }else {
>>   //Build Email message
>>   $mailmessage = "Full Name: " . $_POST['firstname'] . " " . 
>> $_POST['lastname'] . "\n\n";
>>   $mailmessage .= "Address: " . $_POST['address'] . "\n\n";
>>   $mailmessage .= "City, State, Zip: " . $_POST['city'] . " " . 
>> $_POST['state'] . " " . $_POST['zip'] . "\n\n";
>>   $mailmessage .= "Phone: " . $_POST['phone'] . "\n\n";
>>   $mailmessage .= "Email address: " . $_POST['email'] . "\n\n";
>>   if($_POST['affiliation'] == "NFBOther") {
>>   $mailmessage .= "Chapter Affiliation: " . $_POST['other'] . 
>> "\n\n";
>>   }else{
>>   $mailmessage .= "Chapter Affiliation: " . 
>> $_POST['affiliation'] . "\n\n";
>>   }
>>   if($_POST['person'] =="Other"){
>>   $mailmessage .= "Who will pick up the ticket? " . 
>> $_POST['Pfirstname'] . " " . $_POST['Llastname'] . "\n\n";
>> 
>>   }else{
>>   $mailmessage .= "Who will pick up the ticket? I will pick it 
>> up my self! \n\n";
>> 
>>   }
>> 
>> $mailmessage .= "Payment Method: " . $_POST['paymentMethod'];
>> 
>>   send_email($mailTo, $mailSubject, $mailmessage, $headers);
>>   }
>> 
>> ?>
>> 
>> Sometimes... It is dropping the last $mailmessage line... The payment method 
>> in the actual email it sends...
>> 
>> Anyone have any ideas? I'm stumped
> 
>   Hi there. First thought is perhaps it is not getting a value for 
> paymentMethod and if it doesn't exist, will the line still get added?
>   I would always check to see if every post variable isset, before adding 
> the line. Can write a default line in its place if missing.

The variable is being set with a default value of nothing else... But for some 
reason it's not bringing it through when the form is submitted...

Any other ideas? hehe :)



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



Re: [PHP] Problem with code...

2011-10-06 Thread George Langley
On 2011-10-06, at 6:28 PM, Jason Pruim wrote:
> 
>  
> //SETUP VARIABLES
> 
> $mailTo = "li...@pruimphotography.com";
> $mailFrom = "li...@pruimphotography.com";
> //These 2 can be changed IF you know what you are doing and why!
> $returnPath = $mailFrom;
> $replyTo = $mailFrom;
> $mailSubject = "New Convention registration!";
> 
> $message = "";
> 
> //DO NOT CHANGE UNDER PENALITY OF BEING SLAPPED WITH A WET NOODLE!!!
> 
> $headers = "From: ".$mailFrom."\n";
> $headers .= "Return-Path: ".$returnPath."\n";
> $headers .= "Reply-To: ".$replyTo."\n";
> 
> function send_email($mailTo, $mailSubject, $mailMessage, $headers) {
> 
> 
>if(mail( $mailTo, $mailSubject, $mailMessage, $headers )) {
> 
>$message = "Thank you for registering!";
> 
>}else {
>echo "There was an issue with your registration.. Please try again 
> later";
>}
> 
> }//Close Function
> 
> 
> if(!empty($errorCount)) {
> 
> 
>}else {
>//Build Email message
>$mailmessage = "Full Name: " . $_POST['firstname'] . " " . 
> $_POST['lastname'] . "\n\n";
>$mailmessage .= "Address: " . $_POST['address'] . "\n\n";
>$mailmessage .= "City, State, Zip: " . $_POST['city'] . " " . 
> $_POST['state'] . " " . $_POST['zip'] . "\n\n";
>$mailmessage .= "Phone: " . $_POST['phone'] . "\n\n";
>$mailmessage .= "Email address: " . $_POST['email'] . "\n\n";
>if($_POST['affiliation'] == "NFBOther") {
>$mailmessage .= "Chapter Affiliation: " . $_POST['other'] . 
> "\n\n";
>}else{
>$mailmessage .= "Chapter Affiliation: " . 
> $_POST['affiliation'] . "\n\n";
>}
>if($_POST['person'] =="Other"){
>$mailmessage .= "Who will pick up the ticket? " . 
> $_POST['Pfirstname'] . " " . $_POST['Llastname'] . "\n\n";
> 
>}else{
>$mailmessage .= "Who will pick up the ticket? I will pick it 
> up my self! \n\n";
> 
>}
> 
> $mailmessage .= "Payment Method: " . $_POST['paymentMethod'];
> 
>send_email($mailTo, $mailSubject, $mailmessage, $headers);
>}
> 
> ?>
> 
> Sometimes... It is dropping the last $mailmessage line... The payment method 
> in the actual email it sends...
> 
> Anyone have any ideas? I'm stumped

Hi there. First thought is perhaps it is not getting a value for 
paymentMethod and if it doesn't exist, will the line still get added?
I would always check to see if every post variable isset, before adding 
the line. Can write a default line in its place if missing.


George Langley
Interactive Developer

"RIP, Mr. Jobs."



[PHP] Problem with code...

2011-10-06 Thread Jason Pruim
Hi everyone,

Have a question about this block of code



Sometimes... It is dropping the last $mailmessage line... The payment method in 
the actual email it sends...

Anyone have any ideas? I'm stumped


Jason Pruim
li...@pruimphotography.com




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



Re: [PHP] Problem with inserting numbers...

2011-08-11 Thread Jim Lucas
On 8/11/2011 9:34 AM, Jason Pruim wrote:
> 
> Hey Jim,
> 
> Would that still hold true with inserting into a database which is the true 
> end of it? This is going to be a one time thing I'm doing and I'm trying to 
> make it a learning experience as I go since that's what everything should be 
> right?
> 

Yes, taking one of your other emails, you would do something like this.



You should see...

INSERT INTO Test (fullnumber) VALUES ('907-200-') VALUES ('907-200-0001')
VALUES ('907-200-0001') etc...

What this allows you to do is have one long string generated in memory then
inserted into the DB.  If you have any type of indexes on this table/column then
it would only require one re-indexing of the table for the single INSERT
statement vs 1 re-indexes for 1 separate INSERT statements.

Cuts the DB processing time down a lot.

Also, just so you know, if you place set_time_limit(0); at the top of the
script, it will allow the script to run as long as it needs to.

See: http://php.net/manual/en/function.set-time-limit.php

Jim Lucas

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



Re: [PHP] Problem with inserting numbers...

2011-08-11 Thread Jason Pruim

Jason Pruim
pru...@gmail.com


On Aug 11, 2011, at 11:52 AM, Jim Lucas wrote:

> On 8/10/2011 6:22 PM, Jason Pruim wrote:
>> So here I am attempting to generate some numbers to be inserted into a 
>> database... eventually they will make up a phone number (Which I've emailed 
>> about before and know about the bad ideas with it.. But it's the customer 
>> :)) 
>> 
>> Here is the code I am working with:
>> 
>> > function number_pad($number,$n) {
>> return str_pad((int) $number,$n,"0",STR_PAD_LEFT);
>> }
>> 
>> $SQL = "SELECT * FROM Test WHERE `areacode` = '907' AND `prefix` = '200' 
>> LIMIT 5";
>> 
>> $result = mysql_query($SQL);
>> //$num = "";
>> //foreach ($result as $key => $value) {
>> //echo $key . "-" . $value . "-" . number_pad($num, "4") . "";
>> //$num++;
>> //}
>> 
>> while ($num != "1") {
>>while($row = mysql_fetch_assoc($result)) {
>>$padnum = number_pad($num, "4");
>>echo $row['areacode'] . "-" . $row['prefix'] . "-" . $padnum . "";
>>$num++;
>>}
>> 
>> 
>> }
>> 
>> ?>
>> 
>> basically all I'm trying to do is generate the last 4 digits starting at 
>>  and going up to . for testing purposes I'm just echoing back but 
>> will eventually insert the complete number back into the database as a 7 
>> digit string.
>> 
>> The error I'm getting is:
>> 
>> Fatal error: Maximum execution time of 30 seconds exceeded in 
>> /home/pruimpho/public_html/jason/dev/clients/flewid/Phone/config/phoneareacodes.php
>>  on line25
>> 
>> which is where the second while starts...
>> 
>> Does anyone know a better way to do this? 
>> 
>> I'm off to finish searching google while waiting for some good news :)
>> 
>> Thanks Everyone!
>> 
>> 
>> Jason Pruim
>> pru...@gmail.com
>> 
>> 
>> 
> 
> Jason,
> 
> Here is my rendition of what you should do.
> 
>  
> $SQL = "SELECT  areacode, prefix
>FROMTest
>WHERE   `areacode` = '907'
>AND `prefix` = '200'";
> 
> $result = mysql_query($SQL);
> 
> $values = '';
> 
> while( $row = mysql_fetch_assoc($result) ) {
>  foreach ( range(0, ) AS $n ) {
>$values .= $row['areacode'] . '-' . $row['prefix'] . '-' .
>   str_pad($n, 4, '0', STR_PAD_LEFT);
>  }
> }
> 
> echo $values;
> 
> ?>
> 
> It will be much faster if you build the complete string in memory then echo 
> out
> the built string.

Hey Jim,

Would that still hold true with inserting into a database which is the true end 
of it? This is going to be a one time thing I'm doing and I'm trying to make it 
a learning experience as I go since that's what everything should be right?


> 
> Jim Lucas


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



Re: [PHP] Problem with inserting numbers...

2011-08-11 Thread Jason Pruim

Jason Pruim
pru...@gmail.com


On Aug 11, 2011, at 9:35 AM, Andrew Ballard wrote:

> On Wed, Aug 10, 2011 at 9:22 PM, Jason Pruim  wrote:
>> So here I am attempting to generate some numbers to be inserted into a 
>> database... eventually they will make up a phone number (Which I've emailed 
>> about before and know about the bad ideas with it.. But it's the customer :))
>> 
>> Here is the code I am working with:
>> 
>> > function number_pad($number,$n) {
>> return str_pad((int) $number,$n,"0",STR_PAD_LEFT);
>> }
>> 
>> $SQL = "SELECT * FROM Test WHERE `areacode` = '907' AND `prefix` = '200' 
>> LIMIT 5";
>> 
>> $result = mysql_query($SQL);
>> //$num = "";
>> //foreach ($result as $key => $value) {
>> //echo $key . "-" . $value . "-" . number_pad($num, "4") . "";
>> //$num++;
>> //}
>> 
>> while ($num != "1") {
>>while($row = mysql_fetch_assoc($result)) {
>>$padnum = number_pad($num, "4");
>>echo $row['areacode'] . "-" . $row['prefix'] . "-" . $padnum . "";
>>$num++;
>>}
>> 
>> 
>> }
>> 
>> ?>
>> 
>> basically all I'm trying to do is generate the last 4 digits starting at 
>>  and going up to . for testing purposes I'm just echoing back but 
>> will eventually insert the complete number back into the database as a 7 
>> digit string.
>> 
>> The error I'm getting is:
>> 
>> Fatal error: Maximum execution time of 30 seconds exceeded in 
>> /home/pruimpho/public_html/jason/dev/clients/flewid/Phone/config/phoneareacodes.php
>>  on line25
>> 
>> which is where the second while starts...
>> 
>> Does anyone know a better way to do this?
>> 
>> I'm off to finish searching google while waiting for some good news :)
>> 
>> Thanks Everyone!
>> 
>> 
>> Jason Pruim
>> pru...@gmail.com
> 
> You could always push it off to MySQL. I don't have a MySQL instance
> available to test right now, but I ran this on SQL Server and it
> should be generic enough to port without much change. Basically, you
> just load a table with a single tinyint column with the digits between
> 0 and 9, and then allow the database to cross join that table 4 times
> to get 1 resulting rows numbered  through .
> The cross join on this database server executes in around 44ms.
> 
> 
> -- Create a temporary table containing the digits 0 through 9
> CREATE TABLE Digits (
>n   tinyint NOT NULL PRIMARY KEY
>CHECK (n BETWEEN 0 AND 9)
> )
> 
> INSERT INTO Digits
> VALUES
> (0),
> (1),
> (2),
> (3),
> (4),
> (5),
> (6),
> (7),
> (8),
> (9)
> 
> 
> 
> -- Cross join the digits table 4 times to load into a table called numbers.
> 
> SELECT  CONVERT(char(1), Thousands.n) +
>CONVERT(char(1), Hundreds.n) +
>CONVERT(char(1), Tens.n) +
>CONVERT(char(1), Ones.n) AS Number
> INTONumbers
> FROMDigits AS Thousands,
>Digits AS Hundreds,
>Digits AS Tens,
>Digits AS Ones
> ORDER BY
>Thousands.n, Hundreds.n, Tens.n, Ones.n
> 
> 
> SELECT  *
> FROMNumbers
> 
> -- Drop the temporary digits table
> DROP TABLE Digits
> 
> 
> 
> Andrew

Hey Andrew,

Interesting idea... I'm so used to doing it all from PHP that I forget a 
database can be more then just a storage engine sometimes :)

I'll definitely give it a try tonight!

Thanks Andrew!

> 
> --
> 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] Problem with inserting numbers...

2011-08-11 Thread Jim Lucas
On 8/10/2011 6:22 PM, Jason Pruim wrote:
> So here I am attempting to generate some numbers to be inserted into a 
> database... eventually they will make up a phone number (Which I've emailed 
> about before and know about the bad ideas with it.. But it's the customer :)) 
> 
> Here is the code I am working with:
> 
>  function number_pad($number,$n) {
> return str_pad((int) $number,$n,"0",STR_PAD_LEFT);
> }
> 
> $SQL = "SELECT * FROM Test WHERE `areacode` = '907' AND `prefix` = '200' 
> LIMIT 5";
> 
> $result = mysql_query($SQL);
> //$num = "";
> //foreach ($result as $key => $value) {
> //echo $key . "-" . $value . "-" . number_pad($num, "4") . "";
> //$num++;
> //}
> 
> while ($num != "1") {
> while($row = mysql_fetch_assoc($result)) {
> $padnum = number_pad($num, "4");
> echo $row['areacode'] . "-" . $row['prefix'] . "-" . $padnum . "";
> $num++;
> }
> 
> 
> }
> 
> ?>
> 
> basically all I'm trying to do is generate the last 4 digits starting at  
> and going up to . for testing purposes I'm just echoing back but will 
> eventually insert the complete number back into the database as a 7 digit 
> string.
> 
> The error I'm getting is:
> 
> Fatal error: Maximum execution time of 30 seconds exceeded in 
> /home/pruimpho/public_html/jason/dev/clients/flewid/Phone/config/phoneareacodes.php
>  on line25
> 
> which is where the second while starts...
> 
> Does anyone know a better way to do this? 
> 
> I'm off to finish searching google while waiting for some good news :)
> 
> Thanks Everyone!
> 
> 
> Jason Pruim
> pru...@gmail.com
> 
> 
> 

Jason,

Here is my rendition of what you should do.



It will be much faster if you build the complete string in memory then echo out
the built string.

Jim Lucas

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



Re: [PHP] Problem with inserting numbers...

2011-08-11 Thread Andrew Ballard
On Wed, Aug 10, 2011 at 9:22 PM, Jason Pruim  wrote:
> So here I am attempting to generate some numbers to be inserted into a 
> database... eventually they will make up a phone number (Which I've emailed 
> about before and know about the bad ideas with it.. But it's the customer :))
>
> Here is the code I am working with:
>
>  function number_pad($number,$n) {
> return str_pad((int) $number,$n,"0",STR_PAD_LEFT);
> }
>
> $SQL = "SELECT * FROM Test WHERE `areacode` = '907' AND `prefix` = '200' 
> LIMIT 5";
>
> $result = mysql_query($SQL);
> //$num = "";
> //foreach ($result as $key => $value) {
> //    echo $key . "-" . $value . "-" . number_pad($num, "4") . "";
> //    $num++;
> //}
>
> while ($num != "1") {
>    while($row = mysql_fetch_assoc($result)) {
>        $padnum = number_pad($num, "4");
>        echo $row['areacode'] . "-" . $row['prefix'] . "-" . $padnum . "";
>        $num++;
>    }
>
>
> }
>
> ?>
>
> basically all I'm trying to do is generate the last 4 digits starting at  
> and going up to . for testing purposes I'm just echoing back but will 
> eventually insert the complete number back into the database as a 7 digit 
> string.
>
> The error I'm getting is:
>
> Fatal error: Maximum execution time of 30 seconds exceeded in 
> /home/pruimpho/public_html/jason/dev/clients/flewid/Phone/config/phoneareacodes.php
>  on line25
>
> which is where the second while starts...
>
> Does anyone know a better way to do this?
>
> I'm off to finish searching google while waiting for some good news :)
>
> Thanks Everyone!
>
>
> Jason Pruim
> pru...@gmail.com

You could always push it off to MySQL. I don't have a MySQL instance
available to test right now, but I ran this on SQL Server and it
should be generic enough to port without much change. Basically, you
just load a table with a single tinyint column with the digits between
0 and 9, and then allow the database to cross join that table 4 times
to get 1 resulting rows numbered  through .
The cross join on this database server executes in around 44ms.


-- Create a temporary table containing the digits 0 through 9
CREATE TABLE Digits (
n   tinyint NOT NULL PRIMARY KEY
CHECK (n BETWEEN 0 AND 9)
)

INSERT INTO Digits
VALUES
(0),
(1),
(2),
(3),
(4),
(5),
(6),
(7),
(8),
(9)



-- Cross join the digits table 4 times to load into a table called numbers.

SELECT  CONVERT(char(1), Thousands.n) +
CONVERT(char(1), Hundreds.n) +
CONVERT(char(1), Tens.n) +
CONVERT(char(1), Ones.n) AS Number
INTONumbers
FROMDigits AS Thousands,
Digits AS Hundreds,
Digits AS Tens,
Digits AS Ones
ORDER BY
Thousands.n, Hundreds.n, Tens.n, Ones.n


SELECT  *
FROMNumbers

-- Drop the temporary digits table
DROP TABLE Digits



Andrew

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



Re: [PHP] Problem with inserting numbers...

2011-08-11 Thread Ashley Sheridan


Jason Pruim  wrote:

>Replies below
>
>
>Jason Pruim
>li...@pruimphotography.com
>
>
>
>On Aug 10, 2011, at 11:08 PM, Ken Robinson wrote:
>
>> At 09:22 PM 8/10/2011, Jason Pruim wrote:
>>> So here I am attempting to generate some numbers to be inserted into
>a database... eventually they will make up a phone number (Which I've
>emailed about before and know about the bad ideas with it.. But it's
>the customer :))
>>>
>>> Here is the code I am working with:
>>>
>>> >> function number_pad($number,$n) {
>>> return str_pad((int) $number,$n,"0",STR_PAD_LEFT);
>>> }
>>>
>>> $SQL = "SELECT * FROM Test WHERE `areacode` = '907' AND `prefix` =
>'200' LIMIT 5";
>>>
>>> $result = mysql_query($SQL);
>>>
>>> while ($num != "1") {
>>>while($row = mysql_fetch_assoc($result)) {
>>>$padnum = number_pad($num, "4");
>>>echo $row['areacode'] . "-" . $row['prefix'] . "-" . $padnum
>. "";
>>>$num++;
>>>}
>>>
>>>
>>> }
>>>
>>> ?>
>>
>> Try to avoid putting a database query in a loop.
>
>But that's exactly what I need to do...  onceI have the code working
>with the echo I need to update the database with the numbers being
>displayed...
>
>$fullnumber = $row['areacode'].$row['prefix'].$padnum;
>
>$SQL = INSERT INTO Test ('fullnumber'( VALUES($fullnumber);
>
>
>So I want that to be in a loop since it will be inserting roughly
>10,000 records for every areacode/prefix combination :)
>
>
>> In the query only ask for the fields you are going to use, it's
>faster. Why use your own function to pad a string, when there is a
>built-in function?
>
>Because when I was doing my searching I came across the function I'm
>using before I saw the range function :)
>
>>
>> Try this code (untested):
>> > $nums = range(0,);
>> $q = "SELECT areacode, prefix FROM Test WHERE `areacode` = '907' AND
>`prefix` = '200' LIMIT 5";
>> $rs = mysql_query($q);
>> while ($row = mysql_fetch_assoc($rs)) {
>>foreach ($nums as $n) {
>>echo
>sprintf('%03d-%03d-%04d',$row['areacode'],$row['prefix'],$n) "\n";
>>}
>> }
>> ?>
>>
>
>I will try this later today after the day job gets done...
>
>Thanks for the help!
>
>
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, visit: http://www.php.net/unsub.php

You might need to insert 10,000 rows, but that doesn't mean you need to perform 
10,000 separate inserts. Use bulk inserts to ease the load. Also, try to run 
the script over the cli if you can, it will use less memory (no Apache and its 
posse) and it won't time out.

Thanks,
Ash
http://www.ashleysheridan.co.uk
--
Sent from my Android phone with K-9 Mail. Please excuse my brevity.

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



Re: [PHP] Problem with inserting numbers...

2011-08-11 Thread Florian Lemaitre

Le 11/08/2011 13:08, Tamara Temple a écrit :


On Aug 10, 2011, at 8:22 PM, Jason Pruim wrote:

while ($num != "1") {


Problem is here ^  You are testing a numeric $num with a string 
"1", which $num will *never* equal. Leave off the quotes on the 
number.



Hum, I suggest you read this page properly :
http://www.php.net/manual/en/types.comparisons.php

exemple :

print ($num != 2 ? "different" : "equal") . PHP_EOL . ($num != "2" ? 
"different" : "equal") . PHP_EOL;
print ($num !== 2 ? "different" : "equal") . PHP_EOL . ($num !== "2" ? 
"different" : "equal") . PHP_EOL;


result :

equal
equal
equal
different


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



Re: [PHP] Problem with inserting numbers...

2011-08-11 Thread Tamara Temple


On Aug 10, 2011, at 8:22 PM, Jason Pruim wrote:

So here I am attempting to generate some numbers to be inserted into  
a database... eventually they will make up a phone number (Which  
I've emailed about before and know about the bad ideas with it.. But  
it's the customer :))


Here is the code I am working with:

$SQL = "SELECT * FROM Test WHERE `areacode` = '907' AND `prefix` =  
'200' LIMIT 5";


$result = mysql_query($SQL);
//$num = "";
//foreach ($result as $key => $value) {
//echo $key . "-" . $value . "-" . number_pad($num, "4") . "";
//$num++;
//}

while ($num != "1") {


Problem is here ^  You are testing a numeric $num with a string  
"1", which $num will *never* equal. Leave off the quotes on the  
number.



   while($row = mysql_fetch_assoc($result)) {
   $padnum = number_pad($num, "4");
   echo $row['areacode'] . "-" . $row['prefix'] . "-" .  
$padnum . "";

   $num++;
   }


}

?>

basically all I'm trying to do is generate the last 4 digits  
starting at  and going up to . for testing purposes I'm just  
echoing back but will eventually insert the complete number back  
into the database as a 7 digit string.


The error I'm getting is:

Fatal error: Maximum execution time of 30 seconds exceeded in /home/ 
pruimpho/public_html/jason/dev/clients/flewid/Phone/config/ 
phoneareacodes.php on line25


which is where the second while starts...

Does anyone know a better way to do this?

I'm off to finish searching google while waiting for some good news :)

Thanks Everyone!


Jason Pruim
pru...@gmail.com





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



Re: [PHP] Problem with inserting numbers...

2011-08-11 Thread Jason Pruim
Replies below


Jason Pruim
li...@pruimphotography.com



On Aug 10, 2011, at 11:08 PM, Ken Robinson wrote:

> At 09:22 PM 8/10/2011, Jason Pruim wrote:
>> So here I am attempting to generate some numbers to be inserted into a 
>> database... eventually they will make up a phone number (Which I've emailed 
>> about before and know about the bad ideas with it.. But it's the customer :))
>> 
>> Here is the code I am working with:
>> 
>> > function number_pad($number,$n) {
>> return str_pad((int) $number,$n,"0",STR_PAD_LEFT);
>> }
>> 
>> $SQL = "SELECT * FROM Test WHERE `areacode` = '907' AND `prefix` = '200' 
>> LIMIT 5";
>> 
>> $result = mysql_query($SQL);
>> 
>> while ($num != "1") {
>>while($row = mysql_fetch_assoc($result)) {
>>$padnum = number_pad($num, "4");
>>echo $row['areacode'] . "-" . $row['prefix'] . "-" . $padnum . "";
>>$num++;
>>}
>> 
>> 
>> }
>> 
>> ?>
> 
> Try to avoid putting a database query in a loop.

But that's exactly what I need to do...  onceI have the code working with the 
echo I need to update the database with the numbers being displayed...

$fullnumber = $row['areacode'].$row['prefix'].$padnum;

$SQL = INSERT INTO Test ('fullnumber'( VALUES($fullnumber);


So I want that to be in a loop since it will be inserting roughly 10,000 
records for every areacode/prefix combination :)


> In the query only ask for the fields you are going to use, it's faster. Why 
> use your own function to pad a string, when there is a built-in function?

Because when I was doing my searching I came across the function I'm using 
before I saw the range function :)

> 
> Try this code (untested):
>  $nums = range(0,);
> $q = "SELECT areacode, prefix FROM Test WHERE `areacode` = '907' AND `prefix` 
> = '200' LIMIT 5";
> $rs = mysql_query($q);
> while ($row = mysql_fetch_assoc($rs)) {
>foreach ($nums as $n) {
>echo 
> sprintf('%03d-%03d-%04d',$row['areacode'],$row['prefix'],$n) "\n";
>}
> }
> ?>
> 

I will try this later today after the day job gets done...

Thanks for the help!



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



RE: [PHP] Problem with inserting numbers...

2011-08-11 Thread Dajka Tamás
While no tusing just one while loop?

$num = 0;
while ( ( $row = mysql_fetch_assoc($result) ) && $num++ <= 1000 ) {
//do whatever you want and you'll get all results or max. 1000 lines ( 
whatever comes first )
}

Cheers,

Tom

-Original Message-
From: Tim Streater [mailto:t...@clothears.org.uk] 
Sent: Thursday, August 11, 2011 11:22 AM
To: Jason Pruim
Cc: PHP General List
Subject: Re: [PHP] Problem with inserting numbers...

On 11 Aug 2011 at 02:22, Jason Pruim  wrote: 

> while ($num != "1") {
>while($row = mysql_fetch_assoc($result)) {
>$padnum = number_pad($num, "4");
>echo $row['areacode'] . "-" . $row['prefix'] . "-" . $padnum . "";
>$num++;
>}
>
>
> }

This is certain to fail. You've got the $num++ in the *inner* loop, and are 
checking its value in the *outer* loop. Think about it: suppose you enter the 
inner loop with $num being 9998. Suppose also that you then go round the inner 
loop 5 times. What is the value of $num when you then exit the inner loop in 
order to do the test against 1 in the outer loop?

You need to rework that logic.

--
Cheers  --  Tim



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



Re: [PHP] Problem with inserting numbers...

2011-08-11 Thread Tim Streater
On 11 Aug 2011 at 02:22, Jason Pruim  wrote: 

> while ($num != "1") {
>while($row = mysql_fetch_assoc($result)) {
>$padnum = number_pad($num, "4");
>echo $row['areacode'] . "-" . $row['prefix'] . "-" . $padnum . "";
>$num++;
>}
>
>
> }

This is certain to fail. You've got the $num++ in the *inner* loop, and are 
checking its value in the *outer* loop. Think about it: suppose you enter the 
inner loop with $num being 9998. Suppose also that you then go round the inner 
loop 5 times. What is the value of $num when you then exit the inner loop in 
order to do the test against 1 in the outer loop?

You need to rework that logic.

--
Cheers  --  Tim

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

Re: [PHP] Problem with inserting numbers...

2011-08-10 Thread Ken Robinson

At 09:22 PM 8/10/2011, Jason Pruim wrote:
So here I am attempting to generate some numbers to be inserted into 
a database... eventually they will make up a phone number (Which 
I've emailed about before and know about the bad ideas with it.. But 
it's the customer :))


Here is the code I am working with:

$SQL = "SELECT * FROM Test WHERE `areacode` = '907' AND `prefix` = 
'200' LIMIT 5";


$result = mysql_query($SQL);

while ($num != "1") {
while($row = mysql_fetch_assoc($result)) {
$padnum = number_pad($num, "4");
echo $row['areacode'] . "-" . $row['prefix'] . "-" . 
$padnum . "";

$num++;
}


}

?>


Try to avoid putting a database query in a loop. In the query only 
ask for the fields you are going to use, it's faster. Why use your 
own function to pad a string, when there is a built-in function?


Try this code (untested):
$q = "SELECT areacode, prefix FROM Test WHERE `areacode` = '907' AND 
`prefix` = '200' LIMIT 5";

$rs = mysql_query($q);
while ($row = mysql_fetch_assoc($rs)) {
foreach ($nums as $n) {
echo 
sprintf('%03d-%03d-%04d',$row['areacode'],$row['prefix'],$n) "\n";

}
}
?>

Ken 



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



Re: [PHP] Problem with inserting numbers...

2011-08-10 Thread 李白|字一日
when

 $num++;

executed

$num will never be '1';

you may change the while loop to

while ($num < 1) {
   while ($row = ...


2011/8/11 Jason Pruim 

> On Aug 10, 2011, at 9:36 PM, MUAD SHIBANI wrote:
>
> > Basically you can increase time limit for this file to handle your
> request by using
> > set_time_limit function ...
>
> Hi Maud,
>
> Looked into set_time_limit and even tried running it with a value of "120"
> but it didn't help...
>
> I'm affraid I have a problem with the way the 2 while loops are interacting
> and creating a infinite loop...
>
> BUT... I'm thinking there must be a better way... Maybe a while with a
> foreach? Now I'm just thinking outloud :)
>
> Jason Pruim
> pru...@gmail.com
>


Re: [PHP] Problem with inserting numbers...

2011-08-10 Thread Chris Stinemetz
>
> basically all I'm trying to do is generate the last 4 digits starting at  
> and going up to . for testing purposes I'm just echoing back but will 
> eventually insert the complete number back into the database as a 7 digit 
> string.
>
> The error I'm getting is:
>
> Fatal error: Maximum execution time of 30 seconds exceeded in 
> /home/pruimpho/public_html/jason/dev/clients/flewid/Phone/config/phoneareacodes.php
>  on line25
>

I'm not sure the to while loops is the best control structure.

Why not try the following and see if it gets you the results you want?

__untested__

while($row = mysql_fetch_assoc($result)) {
if ($num != "1") && $padnum = number_pad($num, "4")
{
echo $row['areacode'] . "-" . $row['prefix'] . "-" . $padnum . "";
$num++;
}

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



Re: [PHP] Problem with inserting numbers...

2011-08-10 Thread Jason Pruim
On Aug 10, 2011, at 9:36 PM, MUAD SHIBANI wrote:

> Basically you can increase time limit for this file to handle your request by 
> using 
> set_time_limit function ... 

Hi Maud,

Looked into set_time_limit and even tried running it with a value of "120" but 
it didn't help...

I'm affraid I have a problem with the way the 2 while loops are interacting and 
creating a infinite loop... 

BUT... I'm thinking there must be a better way... Maybe a while with a foreach? 
Now I'm just thinking outloud :)

Jason Pruim
pru...@gmail.com

[PHP] Problem with inserting numbers...

2011-08-10 Thread Jason Pruim
So here I am attempting to generate some numbers to be inserted into a 
database... eventually they will make up a phone number (Which I've emailed 
about before and know about the bad ideas with it.. But it's the customer :)) 

Here is the code I am working with:

 $value) {
//echo $key . "-" . $value . "-" . number_pad($num, "4") . "";
//$num++;
//}

while ($num != "1") {
while($row = mysql_fetch_assoc($result)) {
$padnum = number_pad($num, "4");
echo $row['areacode'] . "-" . $row['prefix'] . "-" . $padnum . "";
$num++;
}


}

?>

basically all I'm trying to do is generate the last 4 digits starting at  
and going up to . for testing purposes I'm just echoing back but will 
eventually insert the complete number back into the database as a 7 digit 
string.

The error I'm getting is:

Fatal error: Maximum execution time of 30 seconds exceeded in 
/home/pruimpho/public_html/jason/dev/clients/flewid/Phone/config/phoneareacodes.php
 on line25

which is where the second while starts...

Does anyone know a better way to do this? 

I'm off to finish searching google while waiting for some good news :)

Thanks Everyone!


Jason Pruim
pru...@gmail.com




Re: [PHP] problem installing CakePHP on Linux

2011-08-07 Thread Negin Nickparsa
Finally I solved my problem!
I have downloaded another version of cake that is less than 2 now it works
like a charm:)


Re: [PHP] problem installing CakePHP on Linux

2011-08-07 Thread Negin Nickparsa
cool I found this hidden file .htaccess:


   RewriteEngine on
   RewriteRule^$ app/webroot/[L]
   RewriteRule(.*) app/webroot/$1 [L]


well I don't know that this apache module is enabled or not I changed the
apache2 in /etc/sysconfig and add the rewrite in modules right here:

APACHE_MODULES="actions alias auth_basic authn_file authz_host
authz_groupfile authz_default authz_user authn_dbm autoindex cgi dir env
expires include log_config mime negotiation setenvif ssl suexec userdir php5
rewrite"


Re: [PHP] problem installing CakePHP on Linux

2011-08-07 Thread Negin Nickparsa
I have debugger.php in cake/libs I don't know why it doesn't access to this
file and tell me can't find the class


Re: [PHP] problem installing CakePHP on Linux

2011-08-07 Thread Negin Nickparsa
Thank you, I found that only the tmp directory must be writable then I used
this one:
also by right clicking and using wwwrun for user I tried to set them as you
told

chmod -R 0777 /srv/www/htdocs/first_app/app/tmp/

and the I get fatal Error:


    Fatal error: Class 'Debugger' not
found in /srv/www/htdocs/first_app/cake/libs/view/pages/home.ctp on line 26


Re: [PHP] problem installing CakePHP on Linux

2011-08-07 Thread Peet Grobler
On 8/7/2011 9:53 AM, Negin Nickparsa wrote:
> Hello List
> 
> I want to use Cake PHP ,I have downloaded it from it's site,rename the
> folder to first_app
> and copied it to
> /srv/www/htdocs
> 
> my root is here:
> 
> /srv/www/htdocs
> 
> by entering http://localhost/first_app/
> 
> it has some errors like these outputs:
> 
> Warning: _cake_core_ cache was unable to write 'default_en-us' to cache in
> /srv/www/htdocs/first_app/cake/libs/cache.php on line 295 Warning:
> _cake_core_ cache was unable to write 'default_en-us' to cache in
> /srv/www/htdocs/first_app/cake/libs/cache.php on line 295 Warning:
> /srv/www/htdocs/first_app/app/tmp/cache/persistent/ is not writable in
> /srv/www/htdocs/first_app/cake/libs/cache/file.php on line 299 Warning:
> /srv/www/htdocs/first_app/app/tmp/cache/models/ is not writable in
> /srv/www/htdocs/first_app/cake/libs/cache/file.php on line 299

Try
$ chown -R www-data:www-data /srv/www/htdocs/first_app

Replace www-data:www-data with what is appropriate on your system.

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



[PHP] problem installing CakePHP on Linux

2011-08-07 Thread Negin Nickparsa
Hello List

I want to use Cake PHP ,I have downloaded it from it's site,rename the
folder to first_app
and copied it to
/srv/www/htdocs

my root is here:

/srv/www/htdocs

by entering http://localhost/first_app/

it has some errors like these outputs:

Warning: _cake_core_ cache was unable to write 'default_en-us' to cache in
/srv/www/htdocs/first_app/cake/libs/cache.php on line 295 Warning:
_cake_core_ cache was unable to write 'default_en-us' to cache in
/srv/www/htdocs/first_app/cake/libs/cache.php on line 295 Warning:
/srv/www/htdocs/first_app/app/tmp/cache/persistent/ is not writable in
/srv/www/htdocs/first_app/cake/libs/cache/file.php on line 299 Warning:
/srv/www/htdocs/first_app/app/tmp/cache/models/ is not writable in
/srv/www/htdocs/first_app/cake/libs/cache/file.php on line 299

I wanted to identify another root in default-server I used this one:



AllowOverride All

Options FollowSymLinks

# Order deny,allow

# Deny from all



I restarted the apache but again the same warnings

then I changed httpd.conf too.

I tried hard to figure it out.

if it is about the permissions I tried this one:

chmod -R 0755 /srv/www/htdocs/first_app/

would you please tell me how to change the root correctly?
or if it is not related to it  What is the problem?


Thanks in Advance.


Re: [PHP] Problem with header("Location:" )...

2011-07-31 Thread Jason Pruim





On Jul 31, 2011, at 6:23 PM, Tamara Temple wrote:

> 
> On Jul 31, 2011, at 1:40 PM, Jason Pruim wrote:
> 
>> So I'm attempting to redirect back to the main site of a page after a 
>> successful insert into a database... Here's my code:
>> > 
>> if (!$resp->is_valid) {
>>   // What happens when the CAPTCHA was entered incorrectly
>>   die ("The reCAPTCHA wasn't entered correctly. Go back and try it again." .
>>"(reCAPTCHA said: " . $resp->error . ")");
>> } else {
>> 
>> $name = mysql_real_escape_string($_POST['txtName']);
>> $comment = mysql_real_escape_string($_POST['areaComment']);
>> $phonelink = mysql_real_escape_string($_POST['phonelink']);
>> $SQL = "INSERT INTO comments (name, comment, phonelink) VALUES ('$name', 
>> '$comment', '$phonelink')";
>> 
>> mysql_query($SQL) or die("Unable to insert at this time. Sorry for the 
>> inconvience");
>> //echo "Insert successful!";
>>   header("Location: 
>> HTTP://jason.pruimphotography.com/dev/clients/flewid/Phone/");
>> 
>> 
>> // Your code here to handle a successful verification
>> }
>> 
>> 
>> ?>
>> 
>> 
>> The insert happens, BUT it won't redirect back to the site  There isn't 
>> any reason I should be able to do a header() redirect at that point is there?
> 
> Since the echo is commented out, there shouldn't be any output if that is sum 
> total of the code executing on the http request. If this file is called from 
> some other script, you might check to see if any output is sent from there. 
> If display_errors is on, you should be getting something like "Unable to send 
> headers after output" or some such (I can't offhand think of the actual error 
> message).
> 
> You can keep the "error successful" message for verification if you write it 
> directly to the error log, via:
> 
>   error_log("Insert successful".PHP_EOL);
> 
> Sometimes, it's also nice to insert markers to let you know where the log is 
> emanating from:
> 
>   error_log(__FILE__.'@'.__LINE__.': '."Insert successful".PHP_EOL);
> 
> Sometimes, a vexing sort of error is a blank line at the top or bottom of a 
> file, outside the 

Just before I got your e-mail, I found there were 3 spaces at the very top of 
the file in front of my http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Problem with header("Location:" )...

2011-07-31 Thread Tamara Temple


On Jul 31, 2011, at 1:40 PM, Jason Pruim wrote:

So I'm attempting to redirect back to the main site of a page after  
a successful insert into a database... Here's my code:

is_valid) {
   // What happens when the CAPTCHA was entered incorrectly
   die ("The reCAPTCHA wasn't entered correctly. Go back and try it  
again." .

"(reCAPTCHA said: " . $resp->error . ")");
 } else {

 $name = mysql_real_escape_string($_POST['txtName']);
 $comment = mysql_real_escape_string($_POST['areaComment']);
 $phonelink = mysql_real_escape_string($_POST['phonelink']);
 $SQL = "INSERT INTO comments (name, comment, phonelink) VALUES  
('$name', '$comment', '$phonelink')";


 mysql_query($SQL) or die("Unable to insert at this time. Sorry  
for the inconvience");

 //echo "Insert successful!";
   header("Location: HTTP://jason.pruimphotography.com/dev/clients/flewid/Phone/ 
");



 // Your code here to handle a successful verification
 }


?>


The insert happens, BUT it won't redirect back to the site   
There isn't any reason I should be able to do a header() redirect at  
that point is there?


Since the echo is commented out, there shouldn't be any output if that  
is sum total of the code executing on the http request. If this file  
is called from some other script, you might check to see if any output  
is sent from there. If display_errors is on, you should be getting  
something like "Unable to send headers after output" or some such (I  
can't offhand think of the actual error message).


You can keep the "error successful" message for verification if you  
write it directly to the error log, via:


error_log("Insert successful".PHP_EOL);

Sometimes, it's also nice to insert markers to let you know where the  
log is emanating from:


error_log(__FILE__.'@'.__LINE__.': '."Insert successful".PHP_EOL);

Sometimes, a vexing sort of error is a blank line at the top or bottom  
of a file, outside the 




Or is there a better way to do it?

Thanks Everyone!


Jason Pruim
li...@pruimphotography.com




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




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



Re: [PHP] Problem with header("Location:" )...

2011-07-31 Thread Jason Pruim

Jason Pruim
li...@pruimphotography.com



On Jul 31, 2011, at 2:50 PM, Dajka Tamas wrote:

> Try lowercase 'http'. Anything in error log? Try turning on display_errors.

Tried both, upper and lower case http nothing changed... And nothing in the 
error log... I try a simple echo with a link and that works just fine... 

Starting to get frustrated with it



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



RE: [PHP] Problem with header("Location:" )...

2011-07-31 Thread Dajka Tamas
Try lowercase 'http'. Anything in error log? Try turning on display_errors.

Cheers,

Tamas

-Original Message-
From: Jason Pruim [mailto:li...@pruimphotography.com] 
Sent: Sunday, July 31, 2011 8:40 PM
To: 
Subject: [PHP] Problem with header("Location:" )...

So I'm attempting to redirect back to the main site of a page after a
successful insert into a database... Here's my code:
is_valid) {
// What happens when the CAPTCHA was entered incorrectly
die ("The reCAPTCHA wasn't entered correctly. Go back and try it again."
.
 "(reCAPTCHA said: " . $resp->error . ")");
  } else {

  $name = mysql_real_escape_string($_POST['txtName']);
  $comment = mysql_real_escape_string($_POST['areaComment']);
  $phonelink = mysql_real_escape_string($_POST['phonelink']);
  $SQL = "INSERT INTO comments (name, comment, phonelink) VALUES
('$name', '$comment', '$phonelink')";

  mysql_query($SQL) or die("Unable to insert at this time. Sorry for the
inconvience");
  //echo "Insert successful!";
header("Location:
HTTP://jason.pruimphotography.com/dev/clients/flewid/Phone/");

  
  // Your code here to handle a successful verification
  }


?>


The insert happens, BUT it won't redirect back to the site  There isn't
any reason I should be able to do a header() redirect at that point is
there?

Or is there a better way to do it?

Thanks Everyone!


Jason Pruim
li...@pruimphotography.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] Problem with header("Location:" )...

2011-07-31 Thread Jason Pruim
So I'm attempting to redirect back to the main site of a page after a 
successful insert into a database... Here's my code:
is_valid) {
// What happens when the CAPTCHA was entered incorrectly
die ("The reCAPTCHA wasn't entered correctly. Go back and try it again." .
 "(reCAPTCHA said: " . $resp->error . ")");
  } else {

  $name = mysql_real_escape_string($_POST['txtName']);
  $comment = mysql_real_escape_string($_POST['areaComment']);
  $phonelink = mysql_real_escape_string($_POST['phonelink']);
  $SQL = "INSERT INTO comments (name, comment, phonelink) VALUES ('$name', 
'$comment', '$phonelink')";

  mysql_query($SQL) or die("Unable to insert at this time. Sorry for the 
inconvience");
  //echo "Insert successful!";
header("Location: 
HTTP://jason.pruimphotography.com/dev/clients/flewid/Phone/");

  
  // Your code here to handle a successful verification
  }


?>


The insert happens, BUT it won't redirect back to the site  There isn't any 
reason I should be able to do a header() redirect at that point is there?

Or is there a better way to do it?

Thanks Everyone!


Jason Pruim
li...@pruimphotography.com




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



[PHP] problem with session_write_close

2011-07-14 Thread Tamara Temple
I'm having a problem with a brand new installation of pmwiki. I've not  
encountered this before so I'm unsure why this is happening. The  
following two warnings are presented at the top of each page:


Warning: session_write_close() [function.session-write-close]: open(/ 
var/lib/php/session/sess_sh3dvs4pgiuq04vmj1tfmkqvj1, O_RDWR) failed:  
Permission denied (13) in/var/www/vhosts/mouseha.us/httpdocs/ 
pmwiki-2.2.27/pmwiki.php on line 2012


Warning: session_write_close() [function.session-write-close]: Failed  
to write session data (files). Please verify that the current setting  
of session.save_path is correct (/var/lib/php/session) in/var/www/ 
vhosts/mouseha.us/httpdocs/pmwiki-2.2.27/pmwiki.php on line 2012


There are plenty of other session files in that directory with the  
owner/group apache:apache. I don't know why it can't deal with this.


(Cross-posted between pmwiki-users and php-general.)

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



Re: [PHP] Odd Apache2/PHP Problem

2011-06-03 Thread Daniel P. Brown
On Fri, Jun 3, 2011 at 15:12, Floyd Resler  wrote:
> I am having a really odd Apache2/PHP problem.  My employer set up a new Web 
> server to migrate our Web sites to.  One site requires a log in and I have 
> the ability to log in a someone else.  However, when I do this, Apache throws 
> a Segmentation fault error.  It's happening when it tries to get user 
> information from the database of the user I'm logged in as.  The data is 
> stored in a FoxPro database and is retrieved through ODBC.  What is really 
> odd is that the same functions work fine until I log in as someone. All this 
> does is swap my id with the person I'm logging in as in the session variable. 
>  I have no idea why this is happening.  So, I'm hoping someone may have some 
> ideas or point in the right direction to find answers.

A lot of times, this happens because of a bad module,
poorly-compiled core or extension, missing dependencies, or even
mismatched architecture (for example, trying to run x86_64 code on an
i386 platform).  Do you have the capability to recompile PHP and the
extensions?

Also, presuming the logs strictly show "segmentation fault" (which
is less than helpful, I know), are there any filesystem logs that
might give a hint, such as bad blocks on the drive?  Have you tried
running an fsck on the drive?

Finally, you may want to check your core dumps and see if you can
glean any hints from there.  The file sizes themselves may even be
helpful --- for example, are you running out of disk space or memory
on that box when the code is executing?


-- 

Dedicated Servers, Cloud and Cloud Hybrid Solutions, VPS, Hosting
(866-) 725-4321
http://www.parasane.net/

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



[PHP] Odd Apache2/PHP Problem

2011-06-03 Thread Floyd Resler
I am having a really odd Apache2/PHP problem.  My employer set up a new Web 
server to migrate our Web sites to.  One site requires a log in and I have the 
ability to log in a someone else.  However, when I do this, Apache throws a 
Segmentation fault error.  It's happening when it tries to get user information 
from the database of the user I'm logged in as.  The data is stored in a FoxPro 
database and is retrieved through ODBC.  What is really odd is that the same 
functions work fine until I log in as someone. All this does is swap my id with 
the person I'm logging in as in the session variable.  I have no idea why this 
is happening.  So, I'm hoping someone may have some ideas or point in the right 
direction to find answers.

Thanks!
Floyd


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



Re: [PHP] problem in onclick

2011-05-20 Thread Ashley Sheridan
On Sat, 2011-05-21 at 00:42 +0430, Negin Nickparsa wrote:

> why URL?


I've read over this thread and the other one you created earlier. I
really think you would do better if you took an hour or so to read over
how the typical client/server web model works, as this is leading to a
lot of confusion on your part.

-- 
Thanks,
Ash
http://www.ashleysheridan.co.uk




Re: [PHP] problem in onclick

2011-05-20 Thread Negin Nickparsa
why URL?


Re: [PHP] problem in onclick

2011-05-20 Thread Robert Cummings

On 11-05-20 03:27 PM, Negin Nickparsa wrote:

i want to click on the image then it stores the session so i can have many
different tables in another one unique page
suppose that i have A in my column when i click on image then it showed me
the table of A in another page
but if i click on the image of B then in the next page  it will show me the
B table
and the solution is by passing session


It sounds to me like you are trying to use the wrong tool for the job. 
This should probably be handled with a GET variable (via URL parameter):






Then in target.php you have something like the following:


Heck, you can even use this to set the SESSION variable if you want it 
for later:




Cheers,
Rob.
--
E-Mail Disclaimer: Information contained in this message and any
attached documents is considered confidential and legally protected.
This message is intended solely for the addressee(s). Disclosure,
copying, and distribution are prohibited unless authorized.

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



Re: [PHP] problem in onclick

2011-05-20 Thread Negin Nickparsa
it is the result!!!
Now = getdate(time()+TIMESEED*60); else $this->Now = getdate(($mode?
$dd:strtotime($dd))); $this->Now["fyday"] = ($this->Now["yday"]+287)%365;
if($this->Now["fyday"]==0) $this->Now["fyday"] = 365; } function
getFarsiDate($mode, $fa=true, $echo=true) { $varStr = ""; switch($mode) {
case 1: $varStr = $this->getDate()." ".$this->getMonth(true)."
".$this->getYear(); break; case 2: $varStr = $this->getDate($fa) ."/".
$this->getMonth(false, $fa) . "/". $this->getYear($fa); break; case 3:
$varStr = $this->getDay()." ".$this->getDate()." ".$this->getMonth(true)."
".$this->getYear(); break; case 4: $varStr =
$this->getYear(false).str_pad($this->getMonth(false, false), 2, "0",
STR_PAD_LEFT).str_pad($this->getDate(false), 2, "0", STR_PAD_LEFT); break; }
if($echo) echo $varStr; else return $varStr; } function Num2Fa($num) {
$repPat =
array("1"=>"١","2"=>"٢","3"=>"٣","4"=>"٤","5"=>"٥","6"=>"٦","7"=>"٧","8"=>"٨","9"=>"٩","0"=>"٠");
return strtr((string)$num, $repPat); } function getDay($trans=true) { return
$trans? ($this->Days[$this->Now['wday']]):($this->Now['wday']+1)%7; }
function getDate($trans=true) { $md = 31; $dd = $this->Now["fyday"];
if($dd>186) { $md = 30; $dd -= 186; } $Day = $dd%$md; if($Day==0) $Day =
$md; return $trans? $this->Num2Fa($Day):$Day; } function getMonth($tr=false,
$tr2=true) { $Month = 0; $md = 31; $dd = $this->Now["fyday"]; if($dd>186) {
$md = 30; $dd -= 186; $Month += 6; } $Month += ceil($dd/$md); return (($tr)?
$this->Months[$Month-1]:($tr2? $this->Num2Fa($Month):$Month)); } function
getYear($trans=true) { $year = $this->Now["year"] - ($this->Now["yday"]>79?
621:622); return $trans? $this->Num2Fa($year):$year; } } ?>


RE: [PHP] problem in onclick

2011-05-20 Thread admin
That is because you do not have jquery loaded.

Here you can link to googles jquery or download it to your server.
http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.js




Richard L. Buskirk


-Original Message-
From: Negin Nickparsa [mailto:nickpa...@gmail.com] 
Sent: Friday, May 20, 2011 3:46 PM
To: ad...@buskirkgraphics.com
Cc: Robert Cummings; Andre Polykanine; tedd; php-general@lists.php.net
Subject: Re: [PHP]  problem in onclick

i'm using http://localhost/
i don't have server like something.com
i wrote url:'loadsession.php'
instead of http://www.yourserver.com/loadsession.php',
and i deleted src="http://www.yourserver.com/js/jquery.js";
but it doesn't work what i must write in there?


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



Re: [PHP] problem in onclick

2011-05-20 Thread Negin Nickparsa
i'm using http://localhost/
i don't have server like something.com
i wrote url:'loadsession.php'
instead of http://www.yourserver.com/loadsession.php',
and i deleted src="http://www.yourserver.com/js/jquery.js";
but it doesn't work what i must write in there?


Re: [PHP] problem in onclick

2011-05-20 Thread Negin Nickparsa
i want to click on the image then it stores the session so i can have many
different tables in another one unique page
suppose that i have A in my column when i click on image then it showed me
the table of A in another page
but if i click on the image of B then in the next page  it will show me the
B table
and the solution is by passing session


Re: [PHP] problem in onclick

2011-05-20 Thread Robert Cummings

On 11-05-20 03:06 PM, Negin Nickparsa wrote:

Robert could u plz exactly tell me how i can work with GET and write my
SESSION i tried your code abt session but i didn't get it right but for
another ones i tried and it was right


Hi Negin,

What part are you having a problem with? The first part of your problem:

i want to when clicking on the image then go to other page

Just requires a link around your image:



Replace TARGET-PAGE.php with the actual page you want to go to.

If you want to set a session variable also then set it in TARGET-PAGE.php

If this doesn't help, please explain your problem with more detail.

Cheers,
Rob.
--
E-Mail Disclaimer: Information contained in this message and any
attached documents is considered confidential and legally protected.
This message is intended solely for the addressee(s). Disclosure,
copying, and distribution are prohibited unless authorized.

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



RE: [PHP] problem in onclick

2011-05-20 Thread tedd

At 2:57 PM -0400 5/20/11, HallMarc Websites wrote:

 > At 9:30 PM +0300 5/20/11, Andre Polykanine wrote:

 >Hi Richard, Tedd,
 >
 >Hey  guys,  you  did  understand  what I meant. I meant you
 >can't  just  go  and  write  a  session  variable  by onclicking it in
 >JavaScript. You need AJAX for that, don't you?

 AJAX = JavaScript.



 Not quite; AJAX is an acronym for Asynchronous JavaScript and XML
and I think this helps to clear it up
http://www.bestajaxscripts.com/ajax.html

Thank you,
Marc Hall


Only if you want to get all technical on me.

But, I can do "AJAX" without using XML, such as AHAH -- it's just 
that the term "AJAX" is better known so it's mentioned more often.


Cheers,

tedd
--
---
http://sperling.com/

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



Re: [PHP] problem in onclick

2011-05-20 Thread Negin Nickparsa
Robert could u plz exactly tell me how i can work with GET and write my
SESSION i tried your code abt session but i didn't get it right but for
another ones i tried and it was right


Re: [PHP] problem in onclick

2011-05-20 Thread Adam Richardson
On Fri, May 20, 2011 at 2:46 PM, tedd  wrote:

> At 9:30 PM +0300 5/20/11, Andre Polykanine wrote:
>
>> Hi Richard, Tedd,
>>
>>   Hey  guys,  you  did  understand  what I meant. I meant you
>> can't  just  go  and  write  a  session  variable  by onclicking it in
>> JavaScript. You need AJAX for that, don't you?
>>
>
> AJAX = JavaScript.
>
>
Well, no, Ajax is the combination of multiple technologies:
http://www.w3schools.com/ajax/default.asp

Adam

-- 
Nephtali:  A simple, flexible, fast, and security-focused PHP framework
http://nephtaliproject.com


RE: [PHP] problem in onclick

2011-05-20 Thread HallMarc Websites
> And there are some hosting companies that offer servers that run
JavaScript
> server side like Jaxer That is not an endorsement of any kind. I have yet
to
> sign up for an account. I do know that the idea of running JavaScript
server
> side has been kicked around since I think 1996.

I just took another look at Jaxer and it looks as if they are offering their
SSJS (Server Side JavaScript) as a download with instructions on how to
deploy it on your server. Sorry for the mix up. I'm fairly certain they used
to offer it as a hosted service.


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



Re: [PHP] problem in onclick

2011-05-20 Thread Robert Cummings

On 11-05-20 02:51 PM, HallMarc Websites wrote:

And there are some hosting companies that offer servers that run JavaScript
server side like Jaxer
That is not an endorsement of any kind. I have yet to sign up for an
account. I do know that the idea of running JavaScript server side has been
kicked around since I think 1996.


JavaScript can do anything:

http://bellard.org/jslinux/index.html

Cheers,
Rob.
--
E-Mail Disclaimer: Information contained in this message and any
attached documents is considered confidential and legally protected.
This message is intended solely for the addressee(s). Disclosure,
copying, and distribution are prohibited unless authorized.

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



RE: [PHP] problem in onclick

2011-05-20 Thread tedd

At 2:51 PM -0400 5/20/11, HallMarc Websites wrote:

And there are some hosting companies that offer servers that run JavaScript
server side like Jaxer
That is not an endorsement of any kind. I have yet to sign up for an
account. I do know that the idea of running JavaScript server side has been
kicked around since I think 1996.


Yeah, but that makes my head hurt.  :-)

Cheers,

tedd
--
---
http://sperling.com/

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



Re: [PHP] problem in onclick

2011-05-20 Thread Robert Cummings

On 11-05-20 02:30 PM, Andre Polykanine wrote:

Hi Richard, Tedd,

Hey  guys,  you  did  understand  what I meant. I meant you
can't  just  go  and  write  a  session  variable  by onclicking it in
JavaScript. You need AJAX for that, don't you?


You need a trip to the server whether it be using the a URL, POST, or 
any othe rmethod that informs the system of something. AJAX is just 
fancy wrapping around GET and POST. Back in the early days we used 
transparent pixel GIF images and JavaScript to do the same.


Cheers,
Rob.
--
E-Mail Disclaimer: Information contained in this message and any
attached documents is considered confidential and legally protected.
This message is intended solely for the addressee(s). Disclosure,
copying, and distribution are prohibited unless authorized.

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



RE: [PHP] problem in onclick

2011-05-20 Thread HallMarc Websites
> At 9:30 PM +0300 5/20/11, Andre Polykanine wrote:
> >Hi Richard, Tedd,
> >
> >Hey  guys,  you  did  understand  what I meant. I meant you
> >can't  just  go  and  write  a  session  variable  by onclicking it in
> >JavaScript. You need AJAX for that, don't you?
> 
> AJAX = JavaScript.


 Not quite; AJAX is an acronym for Asynchronous JavaScript and XML 
and I think this helps to clear it up
http://www.bestajaxscripts.com/ajax.html 

Thank you,
Marc Hall
HallMarc Websites
610.446.3346
http://www.hallmarcwebsites.com/ 

Spread the word about my services and earn money! 
Contact me for details.




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



RE: [PHP] problem in onclick

2011-05-20 Thread HallMarc Websites
And there are some hosting companies that offer servers that run JavaScript
server side like Jaxer
That is not an endorsement of any kind. I have yet to sign up for an
account. I do know that the idea of running JavaScript server side has been
kicked around since I think 1996.



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



Re: [PHP] problem in onclick

2011-05-20 Thread tedd

At 9:30 PM +0300 5/20/11, Andre Polykanine wrote:

Hi Richard, Tedd,

   Hey  guys,  you  did  understand  what I meant. I meant you
can't  just  go  and  write  a  session  variable  by onclicking it in
JavaScript. You need AJAX for that, don't you?


AJAX = JavaScript.

AJAX is simply JavaScript communicating with the server.

It's similar to saying "Use SESSIONS to hold values between pages 
instead of using PHP".


I did investigate this before, as seen here:

http://webbytedd.com/b1/ajax-js-dection/

As the the page loads, the SESSION variable is from "none" to "js", 
but you can't see it until you force a reload. So, JavaScript did 
chang the SESSION variable,.


Cheers,

tedd

--
---
http://sperling.com/

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



Re: [PHP] problem in onclick

2011-05-20 Thread Andre Polykanine
Hi Richard, Tedd,

   Hey  guys,  you  did  understand  what I meant. I meant you
can't  just  go  and  write  a  session  variable  by onclicking it in
JavaScript. You need AJAX for that, don't you?



-- 
With best regards from Ukraine,
Andre
Skype: Francophile
My blog: http://oire.org/menelion (mostly in Russian)
Twitter: http://twitter.com/m_elensule
Facebook: http://facebook.com/menelion

 Original message 
From: ad...@buskirkgraphics.com 
To: 'tedd'
Date created: , 9:19:15 PM
Subject: [PHP]  problem in onclick


  I use Jquery everyday to communicate with php files.
When I say every day I mean every day.

If I could not communicate from Javascript to PHP, Real time data analysts
would be NULL.
Tedd, could not be more correct in his example. 


Toot's the Tedd horn!!!


Richard L. Buskirk

-Original Message-
From: tedd [mailto:tedd.sperl...@gmail.com] 
Sent: Friday, May 20, 2011 2:10 PM
To: php-general@lists.php.net
Subject: Re: [PHP]  problem in onclick

At 6:41 PM +0300 5/20/11, Andre Polykanine wrote:
>that  is  completely  wrong.  You're  mixing  up  two things: PHP is a
>server-side language, JavaScript is a client-side language.

While that is true, it doesn't mean that the two languages can't
communicate.

Here's an example:

http://webbytedd.com/b/timed-php/

Cheers,

tedd

-- 
---
http://sperling.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 General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] problem in onclick

2011-05-20 Thread admin
I use Jquery everyday to communicate with php files.
When I say every day I mean every day.

If I could not communicate from Javascript to PHP, Real time data analysts
would be NULL.
Tedd, could not be more correct in his example. 


Toot's the Tedd horn!!!


Richard L. Buskirk

-Original Message-
From: tedd [mailto:tedd.sperl...@gmail.com] 
Sent: Friday, May 20, 2011 2:10 PM
To: php-general@lists.php.net
Subject: Re: [PHP]  problem in onclick

At 6:41 PM +0300 5/20/11, Andre Polykanine wrote:
>that  is  completely  wrong.  You're  mixing  up  two things: PHP is a
>server-side language, JavaScript is a client-side language.

While that is true, it doesn't mean that the two languages can't
communicate.

Here's an example:

http://webbytedd.com/b/timed-php/

Cheers,

tedd

-- 
---
http://sperling.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



  1   2   3   4   5   6   7   8   9   10   >