Re: [PHP] Re: Can javascript or php help with this

2013-05-26 Thread Jim Giner

On 5/25/2013 9:11 PM, dealTek wrote:


On May 25, 2013, at 4:30 PM, Jim Giner jim.gi...@albanyhandball.com wrote:




So - create another field on your form.  Add an onclick event to your submit 
button.  Have it run a js function that takes the two fields and places them 
into the new field.

function combineFields()
{
  var mm = document.getElementById(monthfld).value;
  var yy = document.getElementById('yearfld).value;
  document.getElementByID(mmyy).value = +mm+yy;
  return true;
}

Might have to play with this syntax to avoid the values being arithmetically 
added instead of concatenated, but this is one way.

And of course - you could try posting on a js site instead of a php one.




Thanks so much Jim - I will check into this (and I did just join a 
javascript list)


--
Thanks,
Dave - DealTek
deal...@gmail.com
[db-3]



HTH.
BTW - I see a small typo in my concat statement - 'Id', not 'ID'.

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



Re: [PHP] Can javascript or php help with this

2013-05-26 Thread dealTek

On May 26, 2013, at 5:48 AM, Jim Giner jim.gi...@albanyhandball.com wrote:

 On 5/25/2013 9:11 PM, dealTek wrote:
 
 On May 25, 2013, at 4:30 PM, Jim Giner jim.gi...@albanyhandball.com wrote:
 
 
 So - create another field on your form.  Add an onclick event to your 
 submit button.  Have it run a js function that takes the two fields and 
 places them into the new field.
 
 function combineFields()
 {
  var mm = document.getElementById(monthfld).value;
  var yy = document.getElementById('yearfld).value;
  document.getElementByID(mmyy).value = +mm+yy;
  return true;
 }
 
 Might have to play with this syntax to avoid the values being 
 arithmetically added instead of concatenated, but this is one way.
 
 And of course - you could try posting on a js site instead of a php one.
 

 
 HTH.
 BTW - I see a small typo in my concat statement - 'Id', not 'ID'.
 
 -- 

AHA - at first it was not working but now it works like a charm - THANKS Jim - 
this really helps a lot!!!



--
Thanks,
Dave - DealTek
deal...@gmail.com
[db-3]



[PHP] Can javascript or php help with this

2013-05-25 Thread dealTek
Hi all,

I have a php form that has a pull down select for MONTH and one for YEAR

- usually when the form is submitted you would combine them at the other end 
like 0517 (like credit card exp date) - but in this case I need to combine them 
prior to submitting the form...

I don't know javascript but I'm curious if someone might know a way to use 
javascript (or some other method) to set another input field - EXPDATE - to 
contain the value MONTH  YEAR combined prior to submitting the form?

... and in this case the form is going outside my site and other reasons so 
it's best to set this up prior to submitting the form.

 
--
Thanks,
Dave - DealTek
deal...@gmail.com
[db-3]


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



[PHP] Re: Can javascript or php help with this

2013-05-25 Thread Jim Giner

On 5/25/2013 4:33 PM, dealTek wrote:

Hi all,

I have a php form that has a pull down select for MONTH and one for YEAR

- usually when the form is submitted you would combine them at the other end 
like 0517 (like credit card exp date) - but in this case I need to combine them 
prior to submitting the form...

I don't know javascript but I'm curious if someone might know a way to use javascript (or 
some other method) to set another input field - EXPDATE - to contain the value MONTH 
 YEAR combined prior to submitting the form?

... and in this case the form is going outside my site and other reasons so 
it's best to set this up prior to submitting the form.


--
Thanks,
Dave - DealTek
deal...@gmail.com
[db-3]

So - create another field on your form.  Add an onclick event to your 
submit button.  Have it run a js function that takes the two fields and 
places them into the new field.


function combineFields()
{
  var mm = document.getElementById(monthfld).value;
  var yy = document.getElementById('yearfld).value;
  document.getElementByID(mmyy).value = +mm+yy;
  return true;
}

Might have to play with this syntax to avoid the values being 
arithmetically added instead of concatenated, but this is one way.


And of course - you could try posting on a js site instead of a php one.

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



[PHP] Re: Can javascript or php help with this

2013-05-25 Thread Jim Giner

On 5/25/2013 4:33 PM, dealTek wrote:

Hi all,

I have a php form that has a pull down select for MONTH and one for YEAR

- usually when the form is submitted you would combine them at the other end 
like 0517 (like credit card exp date) - but in this case I need to combine them 
prior to submitting the form...

I don't know javascript but I'm curious if someone might know a way to use javascript (or 
some other method) to set another input field - EXPDATE - to contain the value MONTH 
 YEAR combined prior to submitting the form?

... and in this case the form is going outside my site and other reasons so 
it's best to set this up prior to submitting the form.


--
Thanks,
Dave - DealTek
deal...@gmail.com
[db-3]

So - create another field on your form.  Add an onclick event to your 
submit button.  Have it run a js function that takes the two fields and 
places them into the new field.


function combineFields()
{
  var mm = document.getElementById(monthfld).value;
  var yy = document.getElementById('yearfld).value;
  document.getElementByID(mmyy).value = +mm+yy;
  return true;
}

Might have to play with this syntax to avoid the values being 
arithmetically added instead of concatenated, but this is one way.


And of course - you could try posting on a js site instead of a php one.

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



Re: [PHP] Re: Can javascript or php help with this

2013-05-25 Thread dealTek

On May 25, 2013, at 4:30 PM, Jim Giner jim.gi...@albanyhandball.com wrote:
 
 
 So - create another field on your form.  Add an onclick event to your submit 
 button.  Have it run a js function that takes the two fields and places them 
 into the new field.
 
 function combineFields()
 {
  var mm = document.getElementById(monthfld).value;
  var yy = document.getElementById('yearfld).value;
  document.getElementByID(mmyy).value = +mm+yy;
  return true;
 }
 
 Might have to play with this syntax to avoid the values being arithmetically 
 added instead of concatenated, but this is one way.
 
 And of course - you could try posting on a js site instead of a php one.
 


Thanks so much Jim - I will check into this (and I did just join a 
javascript list)


--
Thanks,
Dave - DealTek
deal...@gmail.com
[db-3]



Re: [PHP] Help using PHP 5.3.3 mail() with Apache James

2012-10-25 Thread Maciek Sokolewicz

On 23-10-2012 23:54, Steven Pogue wrote:

Dan,
I assume you meant to add a system() call into it...if so, here is what
was presented.

-rwxrwxrwx. 1 root root 3878 Sep  6 14:45 /opt/james-2.3.2/bin/sendmail.py
-rwxrwxrwx. 1 root root 3878 Sep  6 14:45 /opt/james-2.3.2/bin/sendmail.py


Steve


Hey Steve,

first of all: don't top-post.
Secondly: no, he didn't. Dan used the backtick operator (`) which is the 
same as calling system on its parameter.


ie:
`ls -l`
is equal to writing
shell_exec('ls -l')

( http://www.php.net/manual/en/language.operators.execution.php )


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



Re: [PHP] Help using PHP 5.3.3 mail() with Apache James

2012-10-25 Thread tamouse mailing lists
On Thu, Oct 25, 2012 at 5:32 AM, Maciek Sokolewicz
maciek.sokolew...@gmail.com wrote:
 On 23-10-2012 23:54, Steven Pogue wrote:

 Dan,
 I assume you meant to add a system() call into it...if so, here is what
 was presented.

 -rwxrwxrwx. 1 root root 3878 Sep  6 14:45 /opt/james-2.3.2/bin/sendmail.py
 -rwxrwxrwx. 1 root root 3878 Sep  6 14:45 /opt/james-2.3.2/bin/sendmail.py


 Steve

 Hey Steve,

 first of all: don't top-post.
 Secondly: no, he didn't. Dan used the backtick operator (`) which is the
 same as calling system on its parameter.

 ie:
 `ls -l`
 is equal to writing
 shell_exec('ls -l')

 ( http://www.php.net/manual/en/language.operators.execution.php )

I have lost the backtick operator so many times, I've stopped using
it, using shell_exec instead.

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



[PHP] Help using PHP 5.3.3 mail() with Apache James

2012-10-23 Thread Steven Pogue
Has anyone been successful at using the above on a RHEL 6.2 environment? I 
am able to use Postfix using the php.ini SENDMAIL_PATH but when I bring 
down PostFix, start Apache James and switch the sendmail_path value to 
point to the Apache James 2.3.2 provided wrapper 
(/opt/james-2.3.2/bin/sendmail.py) the return code on mail() indicates it 
failed and no record of the wrapper being invoked.

Calling the wrapper directly from the command-line works as expected so 
the problem is somewhere between PHP and the sendmail_path invocation.


Thanks,
Steve

Re: [PHP] Help using PHP 5.3.3 mail() with Apache James

2012-10-23 Thread Daniel Brown
On Tue, Oct 23, 2012 at 5:00 PM, Steven Pogue spo...@us.ibm.com wrote:
 Has anyone been successful at using the above on a RHEL 6.2 environment? I
 am able to use Postfix using the php.ini SENDMAIL_PATH but when I bring
 down PostFix, start Apache James and switch the sendmail_path value to
 point to the Apache James 2.3.2 provided wrapper
 (/opt/james-2.3.2/bin/sendmail.py) the return code on mail() indicates it
 failed and no record of the wrapper being invoked.

 Calling the wrapper directly from the command-line works as expected so
 the problem is somewhere between PHP and the sendmail_path invocation.

What is the output of the following code?

?php
echo 'pre'.PHP_EOL;
echo trim(`ls -al /opt/james-2.3.2/bin/sendmail.py`).PHP_EOL;
echo '/pre'.PHP_EOL;
?

-- 
/Daniel P. Brown
Network Infrastructure Manager
http://www.php.net/

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



Re: [PHP] Help using PHP 5.3.3 mail() with Apache James

2012-10-23 Thread Steven Pogue
Dan,
I assume you meant to add a system() call into it...if so, here is what 
was presented.

-rwxrwxrwx. 1 root root 3878 Sep  6 14:45 /opt/james-2.3.2/bin/sendmail.py
-rwxrwxrwx. 1 root root 3878 Sep  6 14:45 /opt/james-2.3.2/bin/sendmail.py


Steve



From:
Daniel Brown danbr...@php.net
To:
Steven Pogue/Raleigh/IBM@IBMUS
Cc:
php-general@lists.php.net
Date:
10/23/2012 05:24 PM
Subject:
Re: [PHP] Help using PHP 5.3.3 mail() with Apache James
Sent by:
paras...@gmail.com



On Tue, Oct 23, 2012 at 5:00 PM, Steven Pogue spo...@us.ibm.com wrote:
 Has anyone been successful at using the above on a RHEL 6.2 environment? 
I
 am able to use Postfix using the php.ini SENDMAIL_PATH but when I bring
 down PostFix, start Apache James and switch the sendmail_path value to
 point to the Apache James 2.3.2 provided wrapper
 (/opt/james-2.3.2/bin/sendmail.py) the return code on mail() indicates 
it
 failed and no record of the wrapper being invoked.

 Calling the wrapper directly from the command-line works as expected so
 the problem is somewhere between PHP and the sendmail_path invocation.

What is the output of the following code?

?php
echo 'pre'.PHP_EOL;
echo trim(`ls -al /opt/james-2.3.2/bin/sendmail.py`).PHP_EOL;
echo '/pre'.PHP_EOL;
?

-- 
/Daniel P. Brown
Network Infrastructure Manager
http://www.php.net/




[PHP] Help with MSSQL and Stored Procs

2012-08-29 Thread Phillip Baker
I am trying to access a MSSQL DB on another system.
I am having trouble executed a stored proc and debugging the problem./

I have included the code below.
I can connect to the DB just fine.
I also can run regular queries on the DB and get a result set.
We can also run the stored proc manually with the data in $xmlstring and
that runs fine.

However the mssql_execute is failing.
I am getting the Execute failed die message however I am not getting
anything for mssql_get_last_message

So I have no idea what is happening.
And ideas for solutions or at least to get more debugging information would
be awesome.

I know SQLSRV is a more recent option however we do not have it installed
on the server and will likely not get that to happen so I need to get this
debugged.

$link = mssql_connect($myServer, $myUser, $myPass)
or die(Couldn't connect to SQL Server on $myServer);
mssql_select_db($myDB, $link)
or die(Couldn't select database $myDB);
if(!$link){
die('Error connecting to MSSQL database at '.$myServer);
} else {
$version = mssql_query('SELECT @@VERSION');
$row = mssql_fetch_array($version);
mssql_free_result($version);

echo $row[0].'br /br /';
}
$storedproc = Sp_DialerValidLead;
$param = ValidLeadText;

$stmt = mssql_init('Sp_DialerValidLead', $link)
or die(Unable to initialize);

mssql_bind($stmt, @.$param, $xmlstring, SQLVARCHAR)
or die(Unable to bind
@ValidLeadText:$storedprocbr.mssql_get_last_message());

$result = mssql_execute($stmt)
or die (Execute failed. Message:.mssql_get_last_message());

var_dump($result);


Blessed Be

Phillip

In the Jim Crow South, for example, government failed and indeed refused
to protect blacks from extra-legal violence. Given our history, it's
stunning we fail to question those who would force upon us a total reliance
on the state for defense.
-- Robert J. Cottrol


Re: [PHP] Help with MSSQL and Stored Procs

2012-08-29 Thread Andrew Ballard
On Wed, Aug 29, 2012 at 3:14 PM, Phillip Baker phil...@freewolf.net wrote:
 I am trying to access a MSSQL DB on another system.
 I am having trouble executed a stored proc and debugging the problem./

 I have included the code below.
 I can connect to the DB just fine.
 I also can run regular queries on the DB and get a result set.
 We can also run the stored proc manually with the data in $xmlstring and
 that runs fine.

 However the mssql_execute is failing.
 I am getting the Execute failed die message however I am not getting
 anything for mssql_get_last_message

 So I have no idea what is happening.
 And ideas for solutions or at least to get more debugging information would
 be awesome.

 I know SQLSRV is a more recent option however we do not have it installed
 on the server and will likely not get that to happen so I need to get this
 debugged.

 $link = mssql_connect($myServer, $myUser, $myPass)
 or die(Couldn't connect to SQL Server on $myServer);
 mssql_select_db($myDB, $link)
 or die(Couldn't select database $myDB);
 if(!$link){
 die('Error connecting to MSSQL database at '.$myServer);
 } else {
 $version = mssql_query('SELECT @@VERSION');
 $row = mssql_fetch_array($version);
 mssql_free_result($version);

 echo $row[0].'br /br /';
 }
 $storedproc = Sp_DialerValidLead;
 $param = ValidLeadText;

 $stmt = mssql_init('Sp_DialerValidLead', $link)
 or die(Unable to initialize);

 mssql_bind($stmt, @.$param, $xmlstring, SQLVARCHAR)
 or die(Unable to bind
 @ValidLeadText:$storedprocbr.mssql_get_last_message());

 $result = mssql_execute($stmt)
 or die (Execute failed. Message:.mssql_get_last_message());

 var_dump($result);


 Blessed Be

 Phillip

I had to go to an old server that we are phasing out to find something
that had php_mssql installed on it, but once I got everything set up
it everything worked fine for me. I tested it with everything correct
as well as with a variety of forced errors (procedure doesn't exist,
user does not have permission to execute, parameter name different
than passed by PHP, etc.) and they all displayed error messages using
the code you posted above.

The server is running PHP 5.2.12, and this one can only connect to our
SQL Server 2000 instance, so I can't test it against SQL 2008.

Andrew

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



[PHP] help with query

2012-06-07 Thread Jack
Hello All,

 

I have this string defined for my query and it shows the different types of
categories fine, but when I change a.categoryid = c.categoryid to
a.categoryid = 1 which is only one of the categories

It shows me the same record twice.

 

$query = select a.startdate, a.articleid, c.name, a.title, a.intro,
a.datecreated from articles as a, categories as c where (a.startdate = -1 or
a.startdate = {$now}) and (a.enddate = -1 or a.enddate = {$now}) and
a.categoryid = c.categoryid order by a.startdate DESC;

 

 

while ( $row = mysql_fetch_array($res) ) {

$tpldata['articles'][] = array(

'title' = $row['title'],

'intro' = makeLinks($row['intro']),

'id'= $row['articleid'],

'categoryname'  = $row['name'],

'created'   = date('n/j/Y',
$row['datecreated'])

);

//echo $row['datecreated'];

}

 

Any Ideas???

 

 

Thanks!

 



Re: [PHP] help with query

2012-06-07 Thread Ashley Sheridan


Jack jacklistm...@gmail.com wrote:

Hello All,



I have this string defined for my query and it shows the different
types of
categories fine, but when I change a.categoryid = c.categoryid to
a.categoryid = 1 which is only one of the categories

It shows me the same record twice.



$query = select a.startdate, a.articleid, c.name, a.title, a.intro,
a.datecreated from articles as a, categories as c where (a.startdate =
-1 or
a.startdate = {$now}) and (a.enddate = -1 or a.enddate = {$now}) and
a.categoryid = c.categoryid order by a.startdate DESC;





while ( $row = mysql_fetch_array($res) ) {

$tpldata['articles'][] = array(

'title' = $row['title'],

'intro' = makeLinks($row['intro']),

'id'= $row['articleid'],

'categoryname'  = $row['name'],

'created'   = date('n/j/Y',
$row['datecreated'])

);

//echo $row['datecreated'];

}



Any Ideas???





Thanks!


How many entries in total are in your categories table? You're joining the 
table but not putting any kind of constraint on the joined tables, so its doing 
a join on all the rows. You can either add an extra clause on the join, leave 
the original join and limit with a where clause, or use a group by on that 
field.

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

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



Re: [PHP] help with query

2012-06-07 Thread Jim Lucas

On 06/07/2012 09:37 AM, Jack wrote:

$query = select a.startdate, a.articleid, c.name, a.title, a.intro,
a.datecreated from articles as a, categories as c where (a.startdate = -1 or
a.startdate= {$now}) and (a.enddate = -1 or a.enddate= {$now}) and
a.categoryid = c.categoryid order by a.startdate DESC;


$query = 
SELECT  a.startdate,
a.articleid,
c.name,
a.title,
a.intro,
a.datecreated
FROMarticles as a,
categories as c
WHERE   (
a.startdate = -1
OR
a.startdate = {$now}
)
AND (
a.enddate = -1
OR
a.enddate = {$now}
)
-- This line must stay, it is limiting the combination of the data from
-- both tables
AND a.categoryid = c.categoryid
-- You need to add this line to make it work, but keep the previous line
AND a.categoryid = 1

ORDER BY a.startdate DESC
;

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



RE: [PHP] help with query

2012-06-07 Thread Jack Sasportas
Thanks Jim, worked like a charm.

 -Original Message-
 From: Jim Lucas [mailto:li...@cmsws.com]
 Sent: Thursday, June 07, 2012 4:08 PM
 To: Jack
 Cc: PHP
 Subject: Re: [PHP] help with query
 
 On 06/07/2012 09:37 AM, Jack wrote:
  $query = select a.startdate, a.articleid, c.name, a.title, a.intro,
  a.datecreated from articles as a, categories as c where (a.startdate =
  -1 or a.startdate= {$now}) and (a.enddate = -1 or a.enddate= {$now})
  and a.categoryid = c.categoryid order by a.startdate DESC;
 
 $query = 
   SELECT  a.startdate,
   a.articleid,
   c.name,
   a.title,
   a.intro,
   a.datecreated
   FROMarticles as a,
   categories as c
   WHERE   (
   a.startdate = -1
   OR
   a.startdate = {$now}
   )
   AND (
   a.enddate = -1
   OR
   a.enddate = {$now}
   )
 -- This line must stay, it is limiting the combination of the data from
 -- both tables
   AND a.categoryid = c.categoryid
 -- You need to add this line to make it work, but keep the previous line
   AND a.categoryid = 1
 
   ORDER BY a.startdate DESC
 ;
 
 --
 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



Re: [PHP] help with preg_match

2012-06-04 Thread Chris Purves
On 2012-06-03 22:37, Robert Williams wrote:
 On Jun 3, 2012, at 17:28, Chris Purvesch...@northfolk.ca  wrote:
 
 I know that the text ends 'end', but I don't know what the Something,
 something is.  I am using preg_match as follows:

 preg_match('/[^]*end/',$curl_response,$matches);

 I want to match 'end' and everything before it that is not ''.
 
 You need to match something at the beginning. Try this:
 
 preg_match('/([^]*end)/', $curl_response, $matches);
 
 Assuming a match, you can then look to $matches[1] for your content.
 

That did it.  In my case, I know that the first letter is capitalized, so I 
used:

preg_match('/[A-Z][^]*end/', $curl_response, $matches);

Thanks for your help.


-- 
Chris Purves

The eyes are the groin of the head. Dwight Schrute

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



[PHP] help with preg_match

2012-06-03 Thread Chris Purves

Hello,

I am trying to use preg_match to match something from an html file. 
Within the html file is some text that looks like:


spanSomething, something end/span

I know that the text ends 'end', but I don't know what the Something, 
something is.  I am using preg_match as follows:


preg_match('/[^]*end/',$curl_response,$matches);

I want to match 'end' and everything before it that is not ''.

The problem appears to be with the ''.  I have tried escaping (\), but 
it didn't make a difference.  The php script hangs when it tries to run 
this function.



--
Chris Purves

There's a time to think, and a time to act. And this, gentlemen, is no 
time to think. - Sheriff Bud B. Boomer


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



Re: [PHP] help with preg_match

2012-06-03 Thread Robert Williams
On Jun 3, 2012, at 17:28, Chris Purves ch...@northfolk.ca wrote:

 I know that the text ends 'end', but I don't know what the Something,
 something is.  I am using preg_match as follows:

 preg_match('/[^]*end/',$curl_response,$matches);

 I want to match 'end' and everything before it that is not ''.

You need to match something at the beginning. Try this:

preg_match('/([^]*end)/', $curl_response, $matches);

Assuming a match, you can then look to $matches[1] for your content.


--
Bob Williams

Notice: This communication, including attachments, may contain information that 
is confidential. It constitutes non-public information intended to be conveyed 
only to the designated recipient(s). If the reader or recipient of this 
communication is not the intended recipient, an employee or agent of the 
intended recipient who is responsible for delivering it to the intended 
recipient, or if you believe that you have received this communication in 
error, please notify the sender immediately by return e-mail and promptly 
delete this e-mail, including attachments without reading or saving them in any 
manner. The unauthorized use, dissemination, distribution, or reproduction of 
this e-mail, including attachments, is prohibited and may be unlawful. If you 
have received this email in error, please notify us immediately by e-mail or 
telephone and delete the e-mail and the attachments (if any).

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



RE: [PHP] help with preg_match

2012-06-03 Thread admin


-Original Message-
From: Chris Purves [mailto:ch...@northfolk.ca] 
Sent: Sunday, June 03, 2012 8:26 PM
To: php-general General
Subject: [PHP] help with preg_match

Hello,

I am trying to use preg_match to match something from an html file. 
Within the html file is some text that looks like:

spanSomething, something end/span

I know that the text ends 'end', but I don't know what the Something,
something is.  I am using preg_match as follows:

preg_match('/[^]*end/',$curl_response,$matches);

I want to match 'end' and everything before it that is not ''.

The problem appears to be with the ''.  I have tried escaping (\), but it
didn't make a difference.  The php script hangs when it tries to run this
function.


--
Chris Purves

There's a time to think, and a time to act. And this, gentlemen, is no time
to think. - Sheriff Bud B. Boomer

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

You could try this

preg_match_all('/(span[^]**)(.*)(/span[^]*)/is',$curl_response,$matc
hes);
print_r($matches);



Rick


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



Re: [PHP] Help! Having trouble getting one XML field from this feed reliably

2012-02-09 Thread Yared Hufkens
I wonder why you use cURL as SimpleXML itself can load URLs:

$vastdata = new
SimpleXMLElement('http://afe.specificclick.net/?l=32259t=xrnd=123456',0,true);

See http://de.php.net/manual/en/simplexmlelement.construct.php


Am 09.02.2012 04:44, schrieb Rob Gould:
 Can anyone tell me what I'm doing wrong here?  I'm trying to get the 
 VASTAdTagURI field from the XML data at this url:

 http://afe.specificclick.net/?l=32259t=xrnd=123456




 Here's my code.  (below).  It works maybe 30% of the time, but most of the 
 time it just returns nothing from that field.  Yet when I go to the above url 
 in Firefox, I always see the data.  This is very strange.





 // Lets get the ad!

 $curl_handle=curl_init();
 curl_setopt($curl_handle,CURLOPT_URL,'http://afe.specificclick.net/?l=32259t=xrnd=123456');
 curl_setopt($curl_handle,CURLOPT_CONNECTTIMEOUT,2);
 curl_setopt($curl_handle,CURLOPT_RETURNTRANSFER,1);
 $buffer = curl_exec($curl_handle);
 curl_close($curl_handle);

 $vastdata = new SimpleXMLElement($buffer);

 $vasturi = $vastdata-Ad-Wrapper-VASTAdTagURI;

 echo If the script works, vasturi =  . $vasturi;

 echo brbrbr;

 print_r($vastdata);








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



Re: [PHP] Help! Having trouble getting one XML field from this feed reliably

2012-02-09 Thread Adam Richardson
On Thu, Feb 9, 2012 at 9:10 AM, Yared Hufkens y4...@yahoo.de wrote:

 I wonder why you use cURL as SimpleXML itself can load URLs:

 $vastdata = new
 SimpleXMLElement('http://afe.specificclick.net/?l=32259t=xrnd=123456
 ',0,true);

 See http://de.php.net/manual/en/simplexmlelement.construct.php


It is pretty convenient that SimpleXMLElement allows you to grab URL's, but
curl allows me to manually set a timeout limit (along with many other
things, although they're not necessarily needed in Rob's example), so I
tend to use curl in this type situation, too.

Adam

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


[PHP] Help! Having trouble getting one XML field from this feed reliably

2012-02-08 Thread Rob Gould
Can anyone tell me what I'm doing wrong here?  I'm trying to get the 
VASTAdTagURI field from the XML data at this url:

http://afe.specificclick.net/?l=32259t=xrnd=123456




Here's my code.  (below).  It works maybe 30% of the time, but most of the time 
it just returns nothing from that field.  Yet when I go to the above url in 
Firefox, I always see the data.  This is very strange.





// Lets get the ad!

$curl_handle=curl_init();
curl_setopt($curl_handle,CURLOPT_URL,'http://afe.specificclick.net/?l=32259t=xrnd=123456');
curl_setopt($curl_handle,CURLOPT_CONNECTTIMEOUT,2);
curl_setopt($curl_handle,CURLOPT_RETURNTRANSFER,1);
$buffer = curl_exec($curl_handle);
curl_close($curl_handle);

$vastdata = new SimpleXMLElement($buffer);

$vasturi = $vastdata-Ad-Wrapper-VASTAdTagURI;

echo If the script works, vasturi =  . $vasturi;

echo brbrbr;

print_r($vastdata);







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



Re: [PHP] Help! Having trouble getting one XML field from this feed reliably

2012-02-08 Thread Adam Richardson
On Wed, Feb 8, 2012 at 10:44 PM, Rob Gould gould...@mac.com wrote:

 Can anyone tell me what I'm doing wrong here?  I'm trying to get the
 VASTAdTagURI field from the XML data at this url:

 http://afe.specificclick.net/?l=32259t=xrnd=123456




 Here's my code.  (below).  It works maybe 30% of the time, but most of the
 time it just returns nothing from that field.  Yet when I go to the above
 url in Firefox, I always see the data.  This is very strange.





 // Lets get the ad!

 $curl_handle=curl_init();
 curl_setopt($curl_handle,CURLOPT_URL,'
 http://afe.specificclick.net/?l=32259t=xrnd=123456');
 curl_setopt($curl_handle,CURLOPT_CONNECTTIMEOUT,2);
 curl_setopt($curl_handle,CURLOPT_RETURNTRANSFER,1);
 $buffer = curl_exec($curl_handle);
 curl_close($curl_handle);

 $vastdata = new SimpleXMLElement($buffer);

 $vasturi = $vastdata-Ad-Wrapper-VASTAdTagURI;

 echo If the script works, vasturi =  . $vasturi;

 echo brbrbr;

 print_r($vastdata);


I'd try adding some error checks to see what issues curl may be having:

$str = curl_exec($ch);
$error_no = curl_errno($ch);
curl_close ($ch);

if ($error_no != 0)
throw new Exception('There was an error retrieving the string contents
of the url \''.$url.'\'. CURL error number:'.$error_no);

I wonder if you transaction is timing out, which you can set as below:

curl_setopt($ch, CURLOPT_TIMEOUT, $transaction_timeout = 2);

Adam


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


Re: [PHP] Help with redeclare error

2011-10-28 Thread Ashley Sheridan
On Thu, 2011-10-27 at 17:40 -0700, UltraMega Admin wrote:

 On 10/27/2011 5:33 PM, Daniel Brown wrote:
  On Thu, Oct 27, 2011 at 20:06, Jason Pruimli...@pruimphotography.com  
  wrote:
  Most likely you have in included in 2 files... Look into it from that 
  angle... It only needs to be included in 1 file to work throughout all the 
  files.
   Prune is spot-on.  That error generally happens when you include a
  file that has already been included, which contains function
  definitions.  Look at the code in the files the error mentions, on the
  lines it specifies, and - most likely - you'll see an include.
  Changing them to include_once instead will resolve the issue, as PHP
  will just skip the order if it's already been done within the
  execution of the code.
 
 
 A function with that name already exists in PHP as of 5.3.0. You'll have 
 to rename it or something.
 
 http://us2.php.net/manual/en/function.date-diff.php
 



Or wrap it inside a function_exists() call assuming that both your
function and the internal one do the same thing.

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




RE: [PHP] Help with redeclare error

2011-10-28 Thread Jack
 
 A function with that name already exists in PHP as of 5.3.0. You'll have
to
 rename it or something.
 
 http://us2.php.net/manual/en/function.date-diff.php
 

That looks like what happened that new function was added and we had written
one with the same name from the stone age...

Thanks!


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



[PHP] Help with redeclare error

2011-10-27 Thread Jack
Hello All,

 

I have some code that just broke with a PHP upgrade, the error says:

PHP Fatal error:  Cannot redeclare date_diff() the line of the error is the
close bracket of the function which is below.

Any ideas what's going on, I'm stuck?

 

 

 

function date_diff($start_time, $stop_time) {

 $seconds   = strtotime($stop_time)-strtotime($start_time);

$days  = intval($seconds/86400);

$seconds  -= $days*86400;

$hours = sprintf(%02d,intval($seconds/3600));

$seconds  -= $hours*3600;   

 $minutes   = sprintf(%02d,intval($seconds/60));

$seconds  -= sprintf(%02d,$minutes*60);   

 

# $time_diff = Days= . $days .   Hours= . $hours .   Minutes= .
$minutes .   Seconds= . $seconds;

$time_diff = $hours . : . $minutes;

 return($time_diff); 

}

 

 

Everywhere I call the function it looks like this:

date_diff($fldstart_time,$fldstop_time);

 

 

 

 

Thanks!

Jack

 



Re: [PHP] Help with redeclare error

2011-10-27 Thread Jason Pruim

Jason Pruim
li...@pruimphotography.com



On Oct 27, 2011, at 7:55 PM, Jack wrote:

 Hello All,
 
 
 
 I have some code that just broke with a PHP upgrade, the error says:
 
 PHP Fatal error:  Cannot redeclare date_diff() the line of the error is the
 close bracket of the function which is below.
 
 Any ideas what's going on, I'm stuck?

Most likely you have in included in 2 files... Look into it from that angle... 
It only needs to be included in 1 file to work throughout all the files.



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



Re: [PHP] Help with redeclare error

2011-10-27 Thread Daniel Brown
On Thu, Oct 27, 2011 at 20:06, Jason Pruim li...@pruimphotography.com wrote:

 Most likely you have in included in 2 files... Look into it from that 
 angle... It only needs to be included in 1 file to work throughout all the 
 files.

Prune is spot-on.  That error generally happens when you include a
file that has already been included, which contains function
definitions.  Look at the code in the files the error mentions, on the
lines it specifies, and - most likely - you'll see an include.
Changing them to include_once instead will resolve the issue, as PHP
will just skip the order if it's already been done within the
execution of the code.

-- 
/Daniel P. Brown
Network Infrastructure Manager
http://www.php.net/

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



Re: [PHP] Help with redeclare error

2011-10-27 Thread UltraMega Admin

On 10/27/2011 5:33 PM, Daniel Brown wrote:

On Thu, Oct 27, 2011 at 20:06, Jason Pruimli...@pruimphotography.com  wrote:

Most likely you have in included in 2 files... Look into it from that angle... 
It only needs to be included in 1 file to work throughout all the files.

 Prune is spot-on.  That error generally happens when you include a
file that has already been included, which contains function
definitions.  Look at the code in the files the error mentions, on the
lines it specifies, and - most likely - you'll see an include.
Changing them to include_once instead will resolve the issue, as PHP
will just skip the order if it's already been done within the
execution of the code.



A function with that name already exists in PHP as of 5.3.0. You'll have 
to rename it or something.


http://us2.php.net/manual/en/function.date-diff.php

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



Fwd: [PHP] Help on number matching function

2011-09-17 Thread tamouse mailing lists
 Notice: This communication, including attachments, may contain
 information that is confidential. It constitutes non-public information
 intended to be conveyed only to the designated recipient(s). If the
 reader or recipient of this communication is not the intended
 recipient, an employee or agent of the intended recipient who is
 responsible for delivering it to the intended recipient, or if you
 believe that you have received this communication in error, please
 notify the sender immediately by return e-mail and promptly delete
 this e-mail, including attachments without reading or saving them
 in any manner. The unauthorized use, dissemination, distribution,
 or reproduction of this e-mail, including attachments, is prohibited
 and may be unlawful. If you have received this email in error,
 please notify us immediately by e-mail or telephone and delete the
 e-mail and the attachments (if any).

Not another one...

Sending e-mail to a public mailing list MUST be intended for the public.

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



[PHP] Help on number matching function

2011-09-16 Thread Dare Williams
Dear PHP Group,

I need a Function of any category in  either PHP or MySQL RDBMS customize 
Function, Class, Methods or anything that could help me compare a particular 
set of number and return their matching result. e.g If I have a 5 Digits set of 
number  and need to match it with another set of five  digits and return how 
many number are match and the figures that are match. 

1.    (62,39,47,25,14) - (14,39,62,25,47) - match 5 (all)
2.    (55,11,27,62,39) - (66,39,12,13,27) - match 2 (27,39)
3.    (20,04,56,17,16) - (16,01,17,04,79) - match 3 (16,17,04)

Any Help will be appreciated.

Thank you.


Re: [PHP] Help on number matching function

2011-09-16 Thread Robert Williams
On Sep 16, 2011, at 6:02, Dare Williams darrenwi...@yahoo.com wrote:


  I have a 5 Digits set of number  and need to match it with another set of 
 five  digits and return how many number are match and the figures that are 
 match.


Check out array_intersect().

http://us.php.net/manual/en/function.array-intersect.php

--
Bob Williams

Notice: This communication, including attachments, may contain information that 
is confidential. It constitutes non-public information intended to be conveyed 
only to the designated recipient(s). If the reader or recipient of this 
communication is not the intended recipient, an employee or agent of the 
intended recipient who is responsible for delivering it to the intended 
recipient, or if you believe that you have received this communication in 
error, please notify the sender immediately by return e-mail and promptly 
delete this e-mail, including attachments without reading or saving them in any 
manner. The unauthorized use, dissemination, distribution, or reproduction of 
this e-mail, including attachments, is prohibited and may be unlawful. If you 
have received this email in error, please notify us immediately by e-mail or 
telephone and delete the e-mail and the attachments (if any).

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



Re: [PHP] Help on number matching function

2011-09-16 Thread Ken Robinson

At 08:36 AM 9/16/2011, Dare Williams wrote:
Dear PHP Group, I need a Function of any category in  either PHP or 
MySQL RDBMS customize Function, Class, Methods or anything that 
could help me compare a particular set of number and return their 
matching result. e.g If I have a 5 Digits set of number  and need to 
match it with another set of five  digits and return how many number 
are match and the figures that are match. 1.(62,39,47,25,14) - 
(14,39,62,25,47) - match 5 (all) 2.(55,11,27,62,39) - 
(66,39,12,13,27) - match 2 (27,39) 3.(20,04,56,17,16) - 
(16,01,17,04,79) - match 3 (16,17,04) Any Help will be appreciated. Thank you.


Turn your sets of number into an array and then use the function 
array_intersect, http://php.net/array_intersect


Ken



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



Re: [PHP] Help on number matching function

2011-09-16 Thread Andre Polykanine

Hello Dare,

  

DW I need a Function of any category in  either PHP or MySQL RDBMS
DW customize Function, Class, Methods or anything that could help me
DW compare a particular set of number and return their matching
DW result.

consider using array_intersect().


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


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



Re: [PHP] Help on number matching function

2011-09-16 Thread Mattias Thorslund
If one or both of your data sets are in MySQL already, there may be no 
need to do the comparison in PHP. Just use IN() or INNER JOIN. Or is 
there some particular reason why neither of these will work in your case?


Cheers,

Mattias

On 09/16/2011 05:36 AM, Dare Williams wrote:

Dear PHP Group,

I need a Function of any category in  either PHP or MySQL RDBMS customize 
Function, Class, Methods or anything that could help me compare a particular 
set of number and return their matching result. e.g If I have a 5 Digits set of 
number  and need to match it with another set of five  digits and return how 
many number are match and the figures that are match.

1.(62,39,47,25,14) - (14,39,62,25,47) - match 5 (all)
2.(55,11,27,62,39) - (66,39,12,13,27) - match 2 (27,39)
3.(20,04,56,17,16) - (16,01,17,04,79) - match 3 (16,17,04)

Any Help will be appreciated.

Thank you.





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



[PHP] help for memcached Segmentation fault

2011-06-27 Thread xucheng
Hi all,
   I wrap pecl-memcache into a class used as a sigleton class .
the code is :
==code===
   class Mem{

private static $_instance = null ;//singlton object instance

private function __construct(){

global $config ;
$servers = $config['memcached'] ;
$mem = new Memcache ;
foreach($servers as $server){
$mem-addServer($server['host'],
$server['port'], intval($server['persistent'])  0 ? 1 : 0,
intval($server['weight'])  0 ? intval($server['weight']) : 1 ) ;
}
return $mem ;

}

private static function getInstance(){

if(self::$_instance === null || !(
self::$_instance instanceof Mem ) ){

self::$_instance = new Mem() ;

}

return true ;

}

public static function get($key){

self::getInstance() ;
return self::$_instance-get(md5(strtolower($key))) ;

}

public static function set($key, $value, $ttl=0){
self::getInstance() ;
$compress = (is_bool($value) || is_int($value)
|| is_float($value)) ? false : MEMCACHE_COMPRESSED ;
return
self::$_instance-set(md5(strtolower($key)), $value, $compress, $ttl)
;

}

public static function rm($key){
self::getInstance() ;
return
self::$_instance-delete(md5(strtolower($key)),0) ;
}
}

===code==

and $config['memcached'] is an array contains info about the server .
$config['memcached'] = array('host'='localhost', port=11211,
persistent=1,weight=1) ;

when i run this , i got Segmentation fault ! I cannot figure out
what's the problem . any commet appreciate .

and i used memcached 1.4.5 , and libevent-1.4.13-1
php 5.2.16

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



[PHP] help with an array if its possible!

2011-06-22 Thread Adam Preece
Hi Gang!

i have 2 assoc arrays from 2 querys, 

first one is page categorys it consists of:
id
name

second is pages
name
cat_id

now, i am using smarty, so i pass arrays into the view. this i would like to 
pass to the view and display within a html select element.

select id=name
option value=CAT_IDCAT NAME
option disabled=disabledPAGE NAME ASSOCIATED TO THE 
CAT NAME/option
/option
/select

and i cannot think of how i can structure an array to pass in to achieve this 
and/or is it even possible :-/.

i hope this makes sense.

i'm truly stuck!

kind regards

Adam Preece

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



Re: [PHP] help with an array if its possible!

2011-06-22 Thread Daniel P. Brown
On Wed, Jun 22, 2011 at 18:43, Adam Preece a...@blueyonder.co.uk wrote:
 Hi Gang!

 i have 2 assoc arrays from 2 querys,

 first one is page categorys it consists of:
        id
        name

 second is pages
        name
        cat_id

 now, i am using smarty, so i pass arrays into the view. this i would like to 
 pass to the view and display within a html select element.

        select id=name
                option value=CAT_IDCAT NAME
                        option disabled=disabledPAGE NAME ASSOCIATED TO 
 THE CAT NAME/option
                /option
        /select

 and i cannot think of how i can structure an array to pass in to achieve this 
 and/or is it even possible :-/.

 i hope this makes sense.

 i'm truly stuck!

If I'm understanding you correctly, this should get you started:

?php

$arr = array(
  'inventory_100' = 'apples',
  'inventory_101' = 'oranges',
  'inventory_102' = 'pears',
  'inventory_103' = 'bananas',
);

echo 'select id=inventory_items'.PHP_EOL;

foreach ($arr as $k = $v) {
  echo '  option value='.$k.''.$v.'/option'.PHP_EOL;
}

echo '/select'.PHP_EOL;
?

You can copy and paste that code (though I just typed it in here,
it should work) and it should illustrate the point.

-- 
/Daniel P. Brown
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



Re: [PHP] help with an array if its possible!

2011-06-22 Thread Jim Lucas
On 6/22/2011 3:43 PM, Adam Preece wrote:
 Hi Gang!
 
 i have 2 assoc arrays from 2 querys, 
 
 first one is page categorys it consists of:
   id
   name
 
 second is pages
   name
   cat_id
 
 now, i am using smarty, so i pass arrays into the view. this i would like to 
 pass to the view and display within a html select element.
 
   select id=name
   option value=CAT_IDCAT NAME
   option disabled=disabledPAGE NAME ASSOCIATED TO THE 
 CAT NAME/option
   /option
   /select
 
 and i cannot think of how i can structure an array to pass in to achieve this 
 and/or is it even possible :-/.
 
 i hope this makes sense.
 
 i'm truly stuck!
 
 kind regards
 
 Adam Preece
   

I see that you have a nested option ... tag.  Maybe you are looking for the
optgroup tag.

select
  optgroup label=Swedish Cars
option value=volvoVolvo/option
option value=saabSaab/option
  /optgroup
  optgroup label=German Cars
option value=mercedesMercedes/option
option value=audiAudi/option
  /optgroup
/select

?php

$categories[] = array('id' = 1, 'name' = 'cars');
$categories[] = array('id' = 2, 'name' = 'trucks');
$categories[] = array('id' = 3, 'name' = 'motorcycles');

$pages[] = array('id' = 1, 'name' = 'Neon', 'cat_id' = 1);
$pages[] = array('id' = 2, 'name' = 'Saturn', 'cat_id' = 1);
$pages[] = array('id' = 3, 'name' = 'F150', 'cat_id' = 2);
$pages[] = array('id' = 4, 'name' = 'Ram 2500', 'cat_id' = 2);
$pages[] = array('id' = 5, 'name' = 'Suzuki', 'cat_id' = 2);
$pages[] = array('id' = 6, 'name' = 'Honda', 'cat_id' = 3);

echo select id=\page_id\\n;

foreach ($categories AS $cat) {
  $c_cat_name = htmlspecialchars($cat['name']);
  echo \toptgroup label=\{$c_cat_name}\\n;

  foreach ($pages AS $page) {
if ( $page['cat_id'] == $cat['id'] ) {
  $c_page_id = htmlspecialchars((int)$page['id']);
  $c_page_name = htmlspecialchars($page['name']);
  echo \t\toption value=\{$c_page_id}\{$c_page_name}/option\n;
}
  }
  # Reset pages so you can loop through it again
  reset($pages);
  echo \t/optgroup\n;
}

echo /select\n;
?

All the above is untested, but should get you very close to what I think you are
trying to accomplish.

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



Re: [PHP] Help needed with php.ini

2011-06-06 Thread Joe Francis
I remember that there's 2 php.ini in Fedora, one is for SAPI like apache or
other CGIServer, and another is for CLI.

Can you confirm that you edited  a right config file?

On Mon, Jun 6, 2011 at 4:55 AM, Camilo Sperberg unrea...@gmail.com wrote:

 On 05-06-2011, at 10:31, Adam Tong adam.to...@gmail.com wrote:

  Hi,
 
  I can't set correctly the error display and reporting properties. I
  don't know what i'm doing wrong.
 
  Here is the section that i modified in php.ini:
  -
  display_errors = On
  ;   Default Value: On
  ;   Development Value: On
  ;   Production Value: Off
 
  display_startup_errors = On
  ;   Default Value: Off
  ;   Development Value: On
  ;   Production Value: Off
 
  error_reporting = E_ALL | E_STRICT
  ;   Default Value: E_ALL  ~E_NOTICE
  ;   Development Value: E_ALL | E_STRICT
  ;   Production Value: E_ALL  ~E_DEPRECATED
  
 
  And here is the output of phpinfo():
  -
  display_errorsOffOff
  display_startup_errorsOffOff
  doc_rootno valueno value
  docref_extno valueno value
  docref_rootno valueno value
  enable_dlOffOff
  error_append_stringno valueno value
  error_logno valueno value
  error_prepend_stringno valueno value
  error_reporting22527 22527
  -
 
  I'm using a default installation (using yum) of php on Fedora14. This
  is my development environment, and want to see all the errors on
  standard output.
 
  Thank you
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 


 Have you modified the example values instead of the ones mid-way php.ini?
 If so, scroll down to check. The latest settings should override the
 previous one.

 Have you restarted apache with service httpd restart or /etc/init.d/httpd
 restart? (or apachectl restart)

 In your php script or htaccess file, do you override those values?

 Sent from my iPhone 5 Beta [Confidential use only]
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php




-- 
Powered By Francis™.
Welcome to my website: http://www.francistm.com
Rewrite to francis...@gmail.com please.


[PHP] Help needed with php.ini

2011-06-05 Thread Adam Tong
Hi,

I can't set correctly the error display and reporting properties. I
don't know what i'm doing wrong.

Here is the section that i modified in php.ini:
-
 display_errors = On
;   Default Value: On
;   Development Value: On
;   Production Value: Off

 display_startup_errors = On
;   Default Value: Off
;   Development Value: On
;   Production Value: Off

 error_reporting = E_ALL | E_STRICT
;   Default Value: E_ALL  ~E_NOTICE
;   Development Value: E_ALL | E_STRICT
;   Production Value: E_ALL  ~E_DEPRECATED


And here is the output of phpinfo():
-
display_errors  Off Off
display_startup_errors  Off Off
doc_rootno valueno value
docref_ext  no valueno value
docref_root no valueno value
enable_dl   Off Off
error_append_string no valueno value
error_log   no valueno value
error_prepend_stringno valueno value
error_reporting 22527   22527
-

I'm using a default installation (using yum) of php on Fedora14. This
is my development environment, and want to see all the errors on
standard output.

Thank you

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



Re: [PHP] Help needed with php.ini

2011-06-05 Thread Richard Quadling
 

 And here is the output of phpinfo():
 -

In the same phpinfo() output, what is the path/location of the php.ini
file you are using?

Loaded Configuration File   D:\PHP\INI\php-cgi-fcgi.ini

for example.


-- 
Richard Quadling
Twitter : EE : Zend : PHPDoc
@RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY : bit.ly/lFnVea

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



Re: [PHP] Help needed with php.ini

2011-06-05 Thread Camilo Sperberg
On 05-06-2011, at 10:31, Adam Tong adam.to...@gmail.com wrote:

 Hi,
 
 I can't set correctly the error display and reporting properties. I
 don't know what i'm doing wrong.
 
 Here is the section that i modified in php.ini:
 -
 display_errors = On
 ;   Default Value: On
 ;   Development Value: On
 ;   Production Value: Off
 
 display_startup_errors = On
 ;   Default Value: Off
 ;   Development Value: On
 ;   Production Value: Off
 
 error_reporting = E_ALL | E_STRICT
 ;   Default Value: E_ALL  ~E_NOTICE
 ;   Development Value: E_ALL | E_STRICT
 ;   Production Value: E_ALL  ~E_DEPRECATED
 
 
 And here is the output of phpinfo():
 -
 display_errorsOffOff
 display_startup_errorsOffOff
 doc_rootno valueno value
 docref_extno valueno value
 docref_rootno valueno value
 enable_dlOffOff
 error_append_stringno valueno value
 error_logno valueno value
 error_prepend_stringno valueno value
 error_reporting2252722527
 -
 
 I'm using a default installation (using yum) of php on Fedora14. This
 is my development environment, and want to see all the errors on
 standard output.
 
 Thank you
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 


Have you modified the example values instead of the ones mid-way php.ini? If 
so, scroll down to check. The latest settings should override the previous one.

Have you restarted apache with service httpd restart or /etc/init.d/httpd 
restart? (or apachectl restart)

In your php script or htaccess file, do you override those values?

Sent from my iPhone 5 Beta [Confidential use only]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] help with _get error

2011-03-23 Thread Jack
Hello All,

 

I'm having a problem with this line of code which worked fine for years:

$l_url2 = ..$_GET[SERVER_NAME];

 

Here is the error:

[Wed Mar 23 13:33:49 2011] [error] [client 16.139.201.61] PHP Notice:  Use
of undefined constant SERVER_NAME - assumed 'SERVER_NAME' in
/home//modules/jack.php on line 322 

 

Thanks!

J

 



Re: [PHP] help with _get error

2011-03-23 Thread Donovan Brooke

Jack wrote:

Hello All,



I'm having a problem with this line of code which worked fine for years:

$l_url2 = ..$_GET[SERVER_NAME];



Here is the error:

[Wed Mar 23 13:33:49 2011] [error] [client 16.139.201.61] PHP Notice:  Use
of undefined constant SERVER_NAME - assumed 'SERVER_NAME' in
/home//modules/jack.php on line 322



Thanks!

J



You need to learn the differences in error reporting levels. My guess is 
you changed hosts recently. ;-)


Donovan




--
D Brooke

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



Re: [PHP] help with a safe mode snag

2011-03-15 Thread Daniel Brown
On Mon, Mar 14, 2011 at 21:12, Jack jacklistm...@gmail.com wrote:
 Hello All,



 Im writing a script that creates a temp file which it then encrypts and
 sends out in an email.

 This works 100% on servers that don't have safe mode, but this server with
 safe mode doesn't understand it's all the same user.

 Error:

 Mon Mar 14 21:10:11 2011] [error] [client 14.18.8.43] PHP Warning:  fopen()
 [a href='function.fopen'function.fopen/a]: SAFE MODE Restriction in
 effect.  The script whose uid is 50069 is not allowed to access
 /tmp/A1_mYM5q5 owned by uid 48 in



 Any suggestions?

1.) Write to a local directory (though, if it's UID 48, that's
probably httpd, apache, or nobody anyway, so it still may not work).
2.) Write to a database.
3.) Don't write anything at all, and work entirely from memory.
4.) Move to a different web host (unless this is a script you're
distributing, whereby that may not be a viable option).

-- 
/Daniel P. Brown
Network Infrastructure Manager
http://www.php.net/

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



[PHP] help with a safe mode snag

2011-03-14 Thread Jack
Hello All,

 

Im writing a script that creates a temp file which it then encrypts and
sends out in an email.

This works 100% on servers that don't have safe mode, but this server with
safe mode doesn't understand it's all the same user. 

Error:

Mon Mar 14 21:10:11 2011] [error] [client 14.18.8.43] PHP Warning:  fopen()
[a href='function.fopen'function.fopen/a]: SAFE MODE Restriction in
effect.  The script whose uid is 50069 is not allowed to access
/tmp/A1_mYM5q5 owned by uid 48 in

 

Any suggestions?

 

Thanks!



[PHP] Help for pear

2011-03-13 Thread Alejandro Crosa
HiI try execute the go-pear.bat file to open the pear set up, but I get the 
error messaje
 
The go-pear.phar.dll is not a valid image of windows.
 
Any help is very important form me.
 
Thanks 


  

Re: [PHP] Help translating PHP5 code to PHP4.

2011-03-09 Thread Richard Quadling
On 7 March 2011 17:29, Marc Guay marc.g...@gmail.com wrote:
 Hi Richard,

 It's not a SOAP service, and I've actually decided to have ask the
 client to upgrade their server software before continuing.  But for
 the sake of study:

 Depending upon your requirement, you could use simplexml_load_string()  to 
 convert an XML string into a native PHP object rather than manually parsing 
 the text of the XML string.

 I looked up simplexml_load_string() and the manual seems to say that
 it's only available in PHP5.  Can you clarify?

 Marc

Ah. I see that you are trying to port TO V4 ...

(Yes, simplexml is PHP5+ only).

PHP4 is end of life and though I have my ZCE which was gained based
upon PHP4, I've not really used it for the last many years (looking
back it is probably 5 years or so).

Depending upon their hosting, I would recommend one of the following options.

1 - Upgrade to PHP 5.3.5
2 - Dual install PHP 5.3.5
3 - Create a new vhost with PHP 5.3.5

I'm guessing upgrading straight away is a no-no.

Running PHP4 and PHP5 SxS is very simple (I used to run PHP4 ISAPI,
PHP5 CGI and PHP6-dev CGI - on the same Sambar Server - on Windows
too!).

The ease I had in running multiple versions of PHP on Windows would
suggest it should be pretty easy to do for non-windows.

Richard.

-- 
Richard Quadling
Twitter : EE : Zend
@RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY

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



Re: [PHP] Help translating PHP5 code to PHP4.

2011-03-09 Thread Marc Guay
 The ease I had in running multiple versions of PHP on Windows would
 suggest it should be pretty easy to do for non-windows.

Funny and true.  Thanks for the tips Richard, I've suggested that they
upgrade their hosting package.

Marc

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



Re: [PHP] Help translating PHP5 code to PHP4.

2011-03-08 Thread Jim Lucas
On 3/7/2011 8:16 AM, Marc Guay wrote:
 Hi folks,
 
 I've stumbled into a project involving a server running PHP4 without
 cURL.  The script fetches data from an XML webservice and deals with
 it.  Is http://ca2.php.net/xml_parser_create the place to start?  Any
 tips (besides updating PHP)?
 
 Here's an example of the PHP5 code:
 
 $url = http://www.domain.com/webservice.php?var=foo;;
 $ch = curl_init($url);
 curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
 $val = curl_exec($ch);
 curl_close($ch);
 libxml_use_internal_errors(true);
 $xml = simplexml_load_string($val);
 $errors = libxml_get_errors();
 
 if (!($errors)){
   $myvariable = $xml-attributes()-value;
 }
 else{
   // deal with errors 
 }
 

Here is an example that is in the PHP manual

http://us.php.net/manual/en/function.xml-parser-create.php#38739

The only modification that you will probably have to make is to set the
following in your php.ini file.

allow_url_include = On
and/or
allow_url_fopen = On

This would allow fopen to open the external URL and grab the data returned.

Jim Lucas

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



[PHP] Help translating PHP5 code to PHP4.

2011-03-07 Thread Marc Guay
Hi folks,

I've stumbled into a project involving a server running PHP4 without
cURL.  The script fetches data from an XML webservice and deals with
it.  Is http://ca2.php.net/xml_parser_create the place to start?  Any
tips (besides updating PHP)?

Here's an example of the PHP5 code:

$url = http://www.domain.com/webservice.php?var=foo;;  
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$val = curl_exec($ch);
curl_close($ch);
libxml_use_internal_errors(true);
$xml = simplexml_load_string($val);
$errors = libxml_get_errors();

if (!($errors)){
$myvariable = $xml-attributes()-value;
}
else{
// deal with errors 
}

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



Re: [PHP] Help translating PHP5 code to PHP4.

2011-03-07 Thread sexyprout
Just take another web host.

2011/3/7 Marc Guay marc.g...@gmail.com

 Hi folks,

 I've stumbled into a project involving a server running PHP4 without
 cURL.  The script fetches data from an XML webservice and deals with
 it.  Is http://ca2.php.net/xml_parser_create the place to start?  Any
 tips (besides updating PHP)?

 Here's an example of the PHP5 code:

 $url = http://www.domain.com/webservice.php?var=foo;;
 $ch = curl_init($url);
 curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
 $val = curl_exec($ch);
 curl_close($ch);
 libxml_use_internal_errors(true);
 $xml = simplexml_load_string($val);
 $errors = libxml_get_errors();

 if (!($errors)){
$myvariable = $xml-attributes()-value;
 }
 else{
// deal with errors
 }

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




-- 
sexyprout


Re: [PHP] Help translating PHP5 code to PHP4.

2011-03-07 Thread Richard Quadling
On 7 March 2011 16:16, Marc Guay marc.g...@gmail.com wrote:
 Hi folks,

 I've stumbled into a project involving a server running PHP4 without
 cURL.  The script fetches data from an XML webservice and deals with
 it.  Is http://ca2.php.net/xml_parser_create the place to start?  Any
 tips (besides updating PHP)?

 Here's an example of the PHP5 code:

 $url = http://www.domain.com/webservice.php?var=foo;;
 $ch = curl_init($url);
 curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
 $val = curl_exec($ch);
 curl_close($ch);
 libxml_use_internal_errors(true);
 $xml = simplexml_load_string($val);
 $errors = libxml_get_errors();

 if (!($errors)){
        $myvariable = $xml-attributes()-value;
 }
 else{
        // deal with errors
 }

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



Is it a SOAP service? If so, PHP supports SOAP natively using
SOAPClient (and you can create your own SOAPServers too).

Depending upon your requirement, you could use simplexml_load_string()
to convert an XML string into a native PHP object rather than manually
parsing the text of the XML string.

Can you give any more details?

Richard.

-- 
Richard Quadling
Twitter : EE : Zend
@RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY

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



Re: [PHP] Help translating PHP5 code to PHP4.

2011-03-07 Thread Marc Guay
Hi Richard,

It's not a SOAP service, and I've actually decided to have ask the
client to upgrade their server software before continuing.  But for
the sake of study:

 Depending upon your requirement, you could use simplexml_load_string()  to 
 convert an XML string into a native PHP object rather than manually parsing 
 the text of the XML string.

I looked up simplexml_load_string() and the manual seems to say that
it's only available in PHP5.  Can you clarify?

Marc

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



Re: [PHP] Help! Made a boo-boo encrypting credit cards

2011-03-03 Thread Brian Dunning
My merchant provider levies monthly fines based on how many of their security 
restrictions you fail to follow. I follow as many as are reasonably practical, 
but I think it's virtually impossible to follow them all, such as absurdly 
expensive (and probably unnecessary) hardware. IMHO, some of the restrictions 
are based less on reality and more on their security consulting firm's ability 
to frighten them. Their consulting firm's disclosed commissions on the fines 
creates an inherent conflict of interest. 

Goofily, my provider's fine structure does not differentiate between 
transactions that are merely processed on my server with no storage, and 
transactions originating from a card number stored on my server. 

So I have to constantly weigh the monthly fines vs. the cost of the upgrades 
vs. the amount of money that my various services bring in. There is no perfect 
solution.

Nevertheless, I'm very open to any suggestions people have for transactions 
requiring that I keep the card number (in this case, recurring monthly charges 
where the customers choose not to use PayPal etc. and where too many customers 
would flake or get frustrated if forced to re-enter their card info every month 
for an annoyingly small transaction).

Sorry this is getting a little off-topic for PHP.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Help! Made a boo-boo encrypting credit cards

2011-03-03 Thread Brian Dunning
That's a great suggestion. I will try this and report back. It's also been 
suggested to me that I should have base64_encoded the encryptions before 
storing them in MySQL, so I'll try this option at the same time.

On Mar 1, 2011, at 2:04 PM, Ashley Sheridan wrote:

 Onto the problem of the data you already have. Do you have a test-case that 
 causes the problem? Try running a bunch of fictitious numbers against your 
 code and store the results in your DB. For a decent test, you'll want to test 
 it against a lot of numbers, store each one in plain format in the DB (use 
 the same character encoding as you already have to see if that's part of the 
 issue) alongside the encrypted version, then retrieve the encrypted value and 
 test it against the original. It may take only a few dozen numbers to show 
 the problem, it may take a thousand, but just let it run until it finds a 
 problem.



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



RE: [PHP] Help! Made a boo-boo encrypting credit cards

2011-03-03 Thread Bob McConnell
From: Brian Dunning

 My merchant provider levies monthly fines based on
 how many of their security restrictions you fail to
 follow. I follow as many as are reasonably practical,
 but I think it's virtually impossible to follow them
 all, such as absurdly expensive (and probably unnecessary)
 hardware. IMHO, some of the restrictions are based less
 on reality and more on their security consulting firm's
 ability to frighten them. Their consulting firm's
 disclosed commissions on the fines creates an inherent
 conflict of interest. 
 
 Goofily, my provider's fine structure does not
 differentiate between transactions that are merely
 processed on my server with no storage, and
 transactions originating from a card number stored
 on my server. 
 
 So I have to constantly weigh the monthly fines vs.
 the cost of the upgrades vs. the amount of money that
 my various services bring in. There is no perfect
 solution.
 
 Nevertheless, I'm very open to any suggestions
 people have for transactions requiring that I
 keep the card number (in this case, recurring
 monthly charges where the customers choose not to
 use PayPal etc. and where too many customers would
 flake or get frustrated if forced to re-enter their
 card info every month for an annoyingly small
 transaction).
 
 Sorry this is getting a little off-topic for PHP.

Seems to me we have had similar discussions in the past, and not
necessarily on Friday.

First of all, you probably want to talk to your lawyer about the
potential conflict of interest. That may need to be forwarded to a
regulatory office or Attorney General for investigation.

Second, do their rules conform to the OWASP recommendations and standard
PCI guidelines? If they are deviating from those, or adding ridiculous
requirements simply to squeeze a few extra pesos out of you, you might
also want to ask your lawyer about them.

Next, do they have a storage vault for credit card numbers that you can
access. There shouldn't be any need for you to store them. We put
numbers in our processor's vault and they give us a hash index to access
them in the future. We use that for recurring charges and as a
convenience so customers don't have to enter them every time they make a
payment.

And finally, even if they do follow the PCI regulations, you have to
remember that the primary purpose of those regulations is to deflect
liability from them to you when there is a problem. All they need to do
is document one instance where you don't follow the rules and they are
off the hook for damages. Guess where that puts you.

Bob McConnell

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



Re: [PHP] Help needed with mysql import

2011-03-02 Thread Alex
You shouldn't have a default value in an auto increment field. You can set 
AUTO_INCREMENT to 0 and start with 1, but as auto increment is a unique field 
and its automagically incremented, you should not set a default value on it...
-- 
Sent from my Android phone with K-9 Mail. Please excuse my brevity.

Thijs Lensselink d...@lenss.nl wrote:

-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 03/02/2011 07:56 AM, Ashim 
Kapoor wrote:  Dear all,   I am trying to make a website with php and I 
found the following code in a  book and I am trying to import it. The 
following are the beginning of the  file i am trying to import with the 
command   mysql -u root -pmypassword certainty  dump   I get the following 
error : ERROR 1067 (42000) at line 9: Invalid default  value for 'id'   but 
when I see line 9 i see the value '0' for id which seems ok to me, I  also 
tried removing the quotes but same error.   Can someone guide me ?   Thank 
you,  Ashim   # MySQL dump 7.1  #  # Host: [host deleted] Database: 
certainty  #_
 # Server version 3.22.32  #  # Table structure for table 'high_scores'  # 
  CREATE TABLE high_scores (  id int(11) DEFAULT '0' NOT NULL 
 auto_increment,  name varchar(30),  answer_count int(11),  credit 
 double(16,4),  PRIMARY KEY (id)  );  It's not really a PHP question. But 
 here goes. Your first field id is an auto_increment field this means the 
 counter goes up by every insert. Normally this will start at 1 not 0. So 
 either change the 0 to a higher number or remove the auto_increment part 
 before you import change the 0 after and alter the table to put back 
 auto_increment -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.10 
 (GNU/Linux) iQIcBAEBAgAGBQJNbfOvAAoJEMffsHAOnubXC7UP/1k5qA4TDxDnUKrYZLV/rl9s 
 bLRPTQ21riFMIzt0ne14No4+MTwjNtfVAdSnjpCWEZP+Y2MEixaiz8gIcOt9GIOD 
 f9QPJZFEIcVADs3lqeS88eqdgRBNiYy3x2PHyslR3jtuaeFrRvxOLBTgBISq6Ih4 
 Dd5nRCbo6WObQ5e26HhbDeMJDAnOw4iQMjpoxc6UD9syxkJrORYw6XFvEmJA/QNF 
 RDTNIO7P62ROamGor8urmPdfIemFLyqjD5YAQ64O6aWVHp0ehjO4l1xPWCeI84sV
2g8C3yqi06UjYOE8NHrf64VYcQtvLFkJbzGT6mmPwEP0gBdqX6o2YDwnudv7+APN 
F5zoVBv/7wygFaP+P0zgJ+EWVML35VfJFuq5VCH3CUk1hROS4X/JtsNXdVkAbaFA 
BpEhQ4jN0x/34HrI1cWjEUwaUuU6m9XoMIuO+1tQRLFatEW9I5z1c3hrJsPUNImX 
qSxEGLAZyA7tex++4YFn8DZXWz4mdllI7yejRe0nl1vl4Nn1+t2se/vF0TfZAGdB 
HgDeUWTdY/N2KeT4z9gPjGEDlRp8Wqo13Sv1yVhzWDdAJQdWaH8+Kk0GCI0jBrgT 
Pthmjr0e4bKCW19SJtL7/mTRU12qX/kbjMG5JqIh1ixn72qgqcvkTjgvEeQ1Y0DM 
xBBFUUedwoKevRJI05/2 =mdri -END PGP SIGNATURE- -- PHP General Mailing 
List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php 



Re: [PHP] Help needed with mysql import

2011-03-02 Thread Jim Lucas
On 3/2/2011 4:25 AM, Alex wrote:
 You shouldn't have a default value in an auto increment field. You can 
 set AUTO_INCREMENT to 0 and start with 1, but as auto increment is a
 unique field and its automagically incremented, you should not set a
 default value on it...

This is fine and dandy until you want to do a restore of your data.

With a restore, you will probably want to retain your auto-increment IDs since
they are probably used else where in your DB.

Jim

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



Re: [PHP] Help needed with mysql import

2011-03-02 Thread Jim Lucas
On 3/2/2011 9:48 AM, Ashley Sheridan wrote:
 Jim Lucas li...@cmsws.com wrote:
 
 On 3/2/2011 4:25 AM, Alex wrote:
 You shouldn't have a default value in an auto increment field. You
 can 
 set AUTO_INCREMENT to 0 and start with 1, but as auto increment is a
 unique field and its automagically incremented, you should not set a
 default value on it...

 This is fine and dandy until you want to do a restore of your data.

 With a restore, you will probably want to retain your auto-increment
 IDs since
 they are probably used else where in your DB.

 Jim

 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 
 Restoring data wouldn't need default values though, would it. You can just 
 perform a regular insert statement and update the next id value to be used if 
 necessary.
 
 Also, I'm not 100% sure on this one, but I thought that some versions of 
 Mysql had problems with a 0 in an auto_inc field?
 
 
 Thanks
 Ash

Ash,

Sorry, I didn't mean to imply that the AUTO_INCREMENT set to 0 is fine.

Doing an export of the table structure for one of my smaller tables (that is
empty), I see that the AUTO_INCREMENT value is set to 1 by default.


CREATE TABLE IF NOT EXISTS `ajax_products` (
  `id` int(11) NOT NULL auto_increment,
  `name` varchar(64) NOT NULL default '',
  `version` tinytext NOT NULL,
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

It doesn't show a default value, but rather a default starting point for the
AUTO_INCREMENT

OP: Show us an export of your db table structure.

Jim

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



Fwd: [PHP] Help needed with mysql import

2011-03-02 Thread Ashim Kapoor
-- Forwarded message --
From: Ashim Kapoor ashimkap...@gmail.com
Date: Thu, Mar 3, 2011 at 7:22 AM
Subject: Re: [PHP] Help needed with mysql import
To: Jim Lucas li...@cmsws.com



CREATE TABLE IF NOT EXISTS `ajax_products` (
  `id` int(11) NOT NULL auto_increment,
  `name` varchar(64) NOT NULL default '',
  `version` tinytext NOT NULL,
  PRIMARY KEY  (`id`)
 ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

 It doesn't show a default value, but rather a default starting point for
 the
 AUTO_INCREMENT

 OP: Show us an export of your db table structure.

 Dear Jim,
 I read this in a book.  I dont have the table to show you.

Thank you,
Ashim


Re: [PHP] Help! Made a boo-boo encrypting credit cards

2011-03-01 Thread Brian Dunning
I just wanted to ping this, as it's becoming a serious problem. I hope someone 
can help.


On Feb 11, 2011, at 2:42 PM, Brian Dunning wrote:

 Hey all -
 
 I'm using mcrypt to store credit cards into MySQL. About 90% of them decrypt 
 fine, but about 10% decrypt as nonsense (b1�\�JEÚU�A��� is a good example). 
 Maybe there is a character that appears in about 10% of my encryptions that's 
 not being encoded properly???
 
 // Encryption is set up at the top of the script:
 $crypto = mcrypt_module_open('rijndael-256', '', 'ofb', '');
 $iv = mcrypt_create_iv(mcrypt_enc_get_iv_size($crypto), MCRYPT_DEV_RANDOM);
 $ks = mcrypt_enc_get_key_size($crypto);
 $key = substr(md5('my_funky_term'), 0, $ks);
 
 // When the card number is collected by the form, it's encrypted:
 $cc_number = addslashes($_POST['cc_number']);
 mcrypt_generic_init($crypto, $key, $iv);
 $cc_encrypt = mcrypt_generic($crypto, $cc_number);
 mcrypt_generic_deinit($crypto);
 
 // This is written to the database:
 $query = update accounts set cc_encrypt='$cc_encrypt', encrypt_iv='$iv', 
 other_fields='$other_stuff' where id='$account_id' limit 1;
 $result = mysql_query($query) or die(mysql_error());
 
 Both the cc_encrypt and encrypt_iv fields are tinytext, latin1_swedish_ci, 
 MyISAM, MySQL 5.0.91
 
 In another script, when I retrieve, I first set it up at the top of the 
 script exactly like step #1 above, then retrieve it like this:
 
 mcrypt_generic_init($crypto, $key, $row['encrypt_iv']);
 $cc_number = trim(mdecrypt_generic($crypto, $row['cc_encrypt']));
 mcrypt_generic_deinit($crypto);
 
 Most of them are good, a few of them are bad. Can anyone see anything I'm 
 doing wrong or a case I'm not covering? Thanks much.
 
 
 --
 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] Help! Made a boo-boo encrypting credit cards

2011-03-01 Thread Bastien Koert
On Tue, Mar 1, 2011 at 12:34 PM, Brian Dunning br...@briandunning.com wrote:
 I just wanted to ping this, as it's becoming a serious problem. I hope 
 someone can help.


 On Feb 11, 2011, at 2:42 PM, Brian Dunning wrote:

 Hey all -

 I'm using mcrypt to store credit cards into MySQL. About 90% of them decrypt 
 fine, but about 10% decrypt as nonsense (b1�\�JEÚU�A��� is a good 
 example). Maybe there is a character that appears in about 10% of my 
 encryptions that's not being encoded properly???

 // Encryption is set up at the top of the script:
 $crypto = mcrypt_module_open('rijndael-256', '', 'ofb', '');
 $iv = mcrypt_create_iv(mcrypt_enc_get_iv_size($crypto), MCRYPT_DEV_RANDOM);
 $ks = mcrypt_enc_get_key_size($crypto);
 $key = substr(md5('my_funky_term'), 0, $ks);

 // When the card number is collected by the form, it's encrypted:
 $cc_number = addslashes($_POST['cc_number']);
 mcrypt_generic_init($crypto, $key, $iv);
 $cc_encrypt = mcrypt_generic($crypto, $cc_number);
 mcrypt_generic_deinit($crypto);

 // This is written to the database:
 $query = update accounts set cc_encrypt='$cc_encrypt', encrypt_iv='$iv', 
 other_fields='$other_stuff' where id='$account_id' limit 1;
 $result = mysql_query($query) or die(mysql_error());

 Both the cc_encrypt and encrypt_iv fields are tinytext, latin1_swedish_ci, 
 MyISAM, MySQL 5.0.91

 In another script, when I retrieve, I first set it up at the top of the 
 script exactly like step #1 above, then retrieve it like this:

 mcrypt_generic_init($crypto, $key, $row['encrypt_iv']);
 $cc_number = trim(mdecrypt_generic($crypto, $row['cc_encrypt']));
 mcrypt_generic_deinit($crypto);

 Most of them are good, a few of them are bad. Can anyone see anything I'm 
 doing wrong or a case I'm not covering? Thanks much.


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



Could it be that the addslashes is creating a \0 (null) value? That
might screw up the decryption routine.

-- 

Bastien

Cat, the other other white meat

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



Re: [PHP] Help! Made a boo-boo encrypting credit cards

2011-03-01 Thread Ken Kixmoeller
On Fri, Feb 11, 2011 at 4:42 PM, Brian Dunning br...@briandunning.com wrote:
 Hey all -

 I'm using mcrypt to store credit cards into MySQL. About 90% of them decrypt 
 fine, but about 10% decrypt as nonsense (b1�\�JEÚU�A��� is a good example). 
 Maybe there is a character that appears in about 10% of my encryptions that's 
 not being encoded properly???

 // Encryption is set up at the top of the script:
 $crypto = mcrypt_module_open('rijndael-256', '', 'ofb', '');
 $iv = mcrypt_create_iv(mcrypt_enc_get_iv_size($crypto), MCRYPT_DEV_RANDOM);
 $ks = mcrypt_enc_get_key_size($crypto);
 $key = substr(md5('my_funky_term'), 0, $ks);

 // When the card number is collected by the form, it's encrypted:
 $cc_number = addslashes($_POST['cc_number']);
 mcrypt_generic_init($crypto, $key, $iv);
 $cc_encrypt = mcrypt_generic($crypto, $cc_number);
 mcrypt_generic_deinit($crypto);

 // This is written to the database:
 $query = update accounts set cc_encrypt='$cc_encrypt', encrypt_iv='$iv', 
 other_fields='$other_stuff' where id='$account_id' limit 1;
 $result = mysql_query($query) or die(mysql_error());

 Both the cc_encrypt and encrypt_iv fields are tinytext, latin1_swedish_ci, 
 MyISAM, MySQL 5.0.91

 In another script, when I retrieve, I first set it up at the top of the 
 script exactly like step #1 above, then retrieve it like this:

 mcrypt_generic_init($crypto, $key, $row['encrypt_iv']);
 $cc_number = trim(mdecrypt_generic($crypto, $row['cc_encrypt']));
 mcrypt_generic_deinit($crypto);

 Most of them are good, a few of them are bad. Can anyone see anything I'm 
 doing wrong or a case I'm not covering? Thanks much.

Just a WAG, but when I first was working with mcrypt, it would append
spaces to the encrypted value. I would have to TRIM() everything for
processing or decryption. BTW, we also elected *not* to store card
numbers, only the last 4 digits.

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



[PHP] Help needed with mysql import

2011-03-01 Thread Ashim Kapoor
Dear all,

I am trying to make a website with php and I found the following code in a
book and I am trying to import it. The following are the beginning of the
file i am trying to import with the command

mysql -u root -pmypassword certainty  dump

I get the following error : ERROR 1067 (42000) at line 9: Invalid default
value for 'id'

but when I see line 9 i see the value '0' for id which seems ok to me, I
also tried removing the quotes but same error.

Can someone guide me ?

Thank you,
Ashim

# MySQL dump 7.1
#
# Host: [host deleted] Database: certainty
#
# Server version 3.22.32
#
# Table structure for table 'high_scores'
#
CREATE TABLE high_scores (
id int(11) DEFAULT '0' NOT NULL auto_increment,
name varchar(30),
answer_count int(11),
credit double(16,4),
PRIMARY KEY (id)
);


Re: [PHP] Help needed with mysql import

2011-03-01 Thread Thijs Lensselink
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On 03/02/2011 07:56 AM, Ashim Kapoor wrote:
 Dear all,
 
 I am trying to make a website with php and I found the following code in a
 book and I am trying to import it. The following are the beginning of the
 file i am trying to import with the command
 
 mysql -u root -pmypassword certainty  dump
 
 I get the following error : ERROR 1067 (42000) at line 9: Invalid default
 value for 'id'
 
 but when I see line 9 i see the value '0' for id which seems ok to me, I
 also tried removing the quotes but same error.
 
 Can someone guide me ?
 
 Thank you,
 Ashim
 
 # MySQL dump 7.1
 #
 # Host: [host deleted] Database: certainty
 #
 # Server version 3.22.32
 #
 # Table structure for table 'high_scores'
 #
 CREATE TABLE high_scores (
 id int(11) DEFAULT '0' NOT NULL auto_increment,
 name varchar(30),
 answer_count int(11),
 credit double(16,4),
 PRIMARY KEY (id)
 );
 

It's not really a PHP question. But here goes.

Your first field id is an auto_increment field this means the counter
goes up by every insert. Normally this will start at 1 not 0. So either
change the 0 to a higher number or remove the auto_increment part before
you import change the 0 after and alter the table to put back auto_increment
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.10 (GNU/Linux)

iQIcBAEBAgAGBQJNbfOvAAoJEMffsHAOnubXC7UP/1k5qA4TDxDnUKrYZLV/rl9s
bLRPTQ21riFMIzt0ne14No4+MTwjNtfVAdSnjpCWEZP+Y2MEixaiz8gIcOt9GIOD
f9QPJZFEIcVADs3lqeS88eqdgRBNiYy3x2PHyslR3jtuaeFrRvxOLBTgBISq6Ih4
Dd5nRCbo6WObQ5e26HhbDeMJDAnOw4iQMjpoxc6UD9syxkJrORYw6XFvEmJA/QNF
RDTNIO7P62ROamGor8urmPdfIemFLyqjD5YAQ64O6aWVHp0ehjO4l1xPWCeI84sV
2g8C3yqi06UjYOE8NHrf64VYcQtvLFkJbzGT6mmPwEP0gBdqX6o2YDwnudv7+APN
F5zoVBv/7wygFaP+P0zgJ+EWVML35VfJFuq5VCH3CUk1hROS4X/JtsNXdVkAbaFA
BpEhQ4jN0x/34HrI1cWjEUwaUuU6m9XoMIuO+1tQRLFatEW9I5z1c3hrJsPUNImX
qSxEGLAZyA7tex++4YFn8DZXWz4mdllI7yejRe0nl1vl4Nn1+t2se/vF0TfZAGdB
HgDeUWTdY/N2KeT4z9gPjGEDlRp8Wqo13Sv1yVhzWDdAJQdWaH8+Kk0GCI0jBrgT
Pthmjr0e4bKCW19SJtL7/mTRU12qX/kbjMG5JqIh1ixn72qgqcvkTjgvEeQ1Y0DM
xBBFUUedwoKevRJI05/2
=mdri
-END PGP SIGNATURE-

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



Re: [PHP] Help! Made a boo-boo encrypting credit cards

2011-02-14 Thread Brian Dunning
On Feb 13, 2011, at 12:44 AM, Richard Quadling wrote:

 You are
 using addslashes($_POST['cc_number']). Considering a credit card
 number is purely numeric, the addslashes would seem to be redundant as
 you don't need to escape numbers.

I do that routinely to all input fields as one additional layer of protection 
against injection attacks.


 And you can run a Luhn10 check
 against the card number to make sure it is valid before storing it.

I do that as well.


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



Re: [PHP] Help! Made a boo-boo encrypting credit cards

2011-02-13 Thread Richard Quadling
On 11 February 2011 22:42, Brian Dunning br...@briandunning.com wrote:
 Hey all -

 I'm using mcrypt to store credit cards into MySQL. About 90% of them decrypt 
 fine, but about 10% decrypt as nonsense (b1�\�JEÚU�A��� is a good example). 
 Maybe there is a character that appears in about 10% of my encryptions that's 
 not being encoded properly???

Unrelated to the code, but considering the frequency of credit card
theft from big sites, is it really safe to store CC details, even if
they are encrypted? Considering the site's code CAN decrypt it, it
wouldn't be that difficult to use your code to get the card details.

Sure, having the details is a benefit to the client in terms of saving
them the hassle of entering the card details for each purchase/usage,
but how secure is it overall?

Related to the code, do you validate the card details first? You are
using addslashes($_POST['cc_number']). Considering a credit card
number is purely numeric, the addslashes would seem to be redundant as
you don't need to escape numbers. And you can run a Luhn10 check
against the card number to make sure it is valid before storing it.

Richard.


-- 
Richard Quadling
Twitter : EE : Zend
@RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY

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



[PHP] Help! Made a boo-boo encrypting credit cards

2011-02-11 Thread Brian Dunning
Hey all -

I'm using mcrypt to store credit cards into MySQL. About 90% of them decrypt 
fine, but about 10% decrypt as nonsense (b1�\�JEÚU�A��� is a good example). 
Maybe there is a character that appears in about 10% of my encryptions that's 
not being encoded properly???

// Encryption is set up at the top of the script:
$crypto = mcrypt_module_open('rijndael-256', '', 'ofb', '');
$iv = mcrypt_create_iv(mcrypt_enc_get_iv_size($crypto), MCRYPT_DEV_RANDOM);
$ks = mcrypt_enc_get_key_size($crypto);
$key = substr(md5('my_funky_term'), 0, $ks);

// When the card number is collected by the form, it's encrypted:
$cc_number = addslashes($_POST['cc_number']);
mcrypt_generic_init($crypto, $key, $iv);
$cc_encrypt = mcrypt_generic($crypto, $cc_number);
mcrypt_generic_deinit($crypto);

// This is written to the database:
$query = update accounts set cc_encrypt='$cc_encrypt', encrypt_iv='$iv', 
other_fields='$other_stuff' where id='$account_id' limit 1;
$result = mysql_query($query) or die(mysql_error());

Both the cc_encrypt and encrypt_iv fields are tinytext, latin1_swedish_ci, 
MyISAM, MySQL 5.0.91

In another script, when I retrieve, I first set it up at the top of the script 
exactly like step #1 above, then retrieve it like this:

mcrypt_generic_init($crypto, $key, $row['encrypt_iv']);
$cc_number = trim(mdecrypt_generic($crypto, $row['cc_encrypt']));
mcrypt_generic_deinit($crypto);

Most of them are good, a few of them are bad. Can anyone see anything I'm doing 
wrong or a case I'm not covering? Thanks much.


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



Re: [PHP] Help: Validate Domain Name by Regular Express

2011-01-09 Thread Ashley Sheridan
On Sun, 2011-01-09 at 11:44 +0800, WalkinRaven wrote:

 Right, RFC 1034 allow valid endless . parts, till the sum length is over 
 255.
 
 On 01/09/2011 01:21 AM, TR Shaw wrote:
  On Jan 8, 2011, at 12:09 PM, Ashley Sheridan wrote:
 
  On Sat, 2011-01-08 at 16:55 +0800, WalkinRaven wrote:
 
  PHP 5.3 PCRE
 
  Regular Express to match domain names format according to RFC 1034 -
  DOMAIN NAMES - CONCEPTS AND FACILITIES
 
  /^
  (
 [a-z] |
 [a-z] (?:[a-z]|[0-9]) |
 [a-z] (?:[a-z]|[0-9]|\-){1,61} (?:[a-z]|[0-9]) ) # One 
  label
 
  (?:\.(?1))*+# More labels
  \.? # Root domain name
  $/iDx
 
  This rule matches onlylabel  andlabel. but notlabel.label...
 
  I don't know what wrong with it.
 
  Thank you.
 
 
 
  I think trying to do all of this in one regex will prove more trouble
  than it's worth. Maybe breaking it down into something like this:
 
  ?php
  $domain = www.ashleysheridan.co.uk;
  $valid = false;
 
  $tlds = array('aero', 'asia', 'biz', 'cat', 'com', 'coop', 'edu', 'gov',
  'info', 'int', 'jobs', 'mil', 'mobi', 'museum', 'name', 'net', 'org',
  'pro', 'tel', 'travel', 'xxx', 'ac', 'ad', 'ae', 'af', 'ag', 'ai', 'al',
  'am', 'an', 'ao', 'aq', 'ar', 'as', 'at', 'au', 'aw', 'ax', 'az', 'ba',
  'bb', 'bd', 'be', 'bf', 'bg', 'bh', 'bi', 'bj', 'bm', 'bn', 'bo', 'br',
  'bs', 'bt', 'bv', 'bw', 'by', 'bz', 'ca', 'cc', 'cd', 'cf', 'cg', 'ch',
  'ci', 'ck', 'cl', 'cm', 'cn', 'co', 'cr', 'cu', 'cv', 'cx', 'cy', 'cz',
  'de', 'dj', 'dk', 'dm', 'do', 'dz', 'ec', 'ee', 'eg', 'er', 'es', 'et',
  'eu', 'fi', 'fj', 'fk', 'fm', 'fo', 'fr', 'ga', 'gb', 'gd', 'ge', 'gf',
  'gg', 'gh', 'gi', 'gl', 'gm', 'gn', 'gp', 'gq', 'gr', 'gs', 'gt', 'gu',
  'gw', 'gy', 'hk', 'hm', 'hn', 'hr', 'ht', 'hu', 'id', 'ie', 'il', 'im',
  'in', 'io', 'iq', 'ir', 'is', 'it', 'je', 'jm', 'jo', 'jp', 'ke', 'kg',
  'kh', 'ki', 'km', 'kn', 'kp', 'kr', 'kw', 'ky', 'kz', 'la', 'lb', 'lc',
  'li', 'lk', 'lr', 'ls', 'lt', 'lu', 'lv', 'ly', 'ma', 'mc', 'md', 'me',
  'mg', 'mh', 'mk', 'ml', 'mm', 'mn', 'mo', 'mp', 'mq', 'mr', 'ms', 'mt',
  'mu', 'mv', 'mw', 'mx', 'my', 'mz', 'na', 'nc', 'ne', 'nf', 'ng', 'ni',
  'nl', 'no', 'np', 'nr', 'nu', 'nz', 'om', 'pa', 'pe', 'pf', 'pg', 'ph',
  'pk', 'pl', 'pm', 'pn', 'pr', 'ps', 'pt', 'pw', 'py', 'qa', 're', 'ro',
  'rs', 'ru', 'rw', 'sa', 'sb', 'sc', 'sd', 'se', 'sg', 'sh', 'si', 'sj',
  'sk', 'sl', 'sm', 'sn', 'so', 'sr', 'st', 'su', 'sv', 'sy', 'sz', 'tc',
  'td', 'tf', 'tg', 'th', 'tj', 'tk', 'tl', 'tm', 'tn', 'to', 'tp', 'tr',
  'tt', 'tv', 'tw', 'tz', 'ua', 'ug', 'uk', 'us', 'uy', 'uz', 'va', 'vc',
  've', 'vg', 'vi', 'vn', 'vu', 'wf', 'ws', 'ye', 'yt', 'za', 'zm',
  'zw', );
 
 
  if(strlen($domain= 253))
  {
 $labels = explode('.', $domain);
 if(in_array($labels[count($labels)-1], $tlds))
 {
 for($i=0; $icount($labels) -1; $i++)
 {
 if(strlen($labels[$i])= 63  
  (!preg_match('/^[a-z0-9][a-z0-9
  \-]*?[a-z0-9]$/', $labels[$i]) || preg_match('/^[0-9]+$/',
  $labels[$i]) ))
 {
 $valid = false;
 break;  // no point continuing if one label is 
  wrong
 }
 else
 {
 $valid = true;
 }
 }
 }
  }
 
  var_dump($valid);
 
 
  This matches the last label with a TLD, and each label thereafter
  against the standard a-z0-9 and hyphen rule as indicated in the
  preferred characters allowed in a label (LDH rule), with the start and
  end character in a label isn't a hyphen (oddly enough it doesn't mention
  starting with a digit!)
 
  Also, each label is checked to ensure it doesn't run over 63 characters,
  and the whole thing isn't over 253 characters. Lastly, each label is
  checked to ensure it doesn't completely consist of digits.
 
  I've tested it only with my domain so far, but it should work fairly
  well. As I said before, I couldn't think of a way to do it all with one
  regex. It could probably be done, but would you really want to create a
  huge and difficult to read/understand expression just because it's
  possible?
  Ash
 
  I doubt its possible since the ccTLD's have valid 3 and more dotted domain 
  names. You should see .us And .uk doesn't follow the ccTLS rules for .tk 
  for example.
 
  Now, if the purpose is to write a regex for a host name then that's a 
  different story.
 
  Tom
 


Which is what my code does too, while also checking for label length.

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




Re: [PHP] Help: Validate Domain Name by Regular Express

2011-01-08 Thread Ashley Sheridan
On Sat, 2011-01-08 at 16:55 +0800, WalkinRaven wrote:

 PHP 5.3 PCRE
 
 Regular Express to match domain names format according to RFC 1034 - 
 DOMAIN NAMES - CONCEPTS AND FACILITIES
 
 /^
 (
[a-z] |
[a-z] (?:[a-z]|[0-9]) |
[a-z] (?:[a-z]|[0-9]|\-){1,61} (?:[a-z]|[0-9]) ) # One 
 label
 
 (?:\.(?1))*+# More labels
 \.? # Root domain name
 $/iDx
 
 This rule matches only label and label. but not label.label...
 
 I don't know what wrong with it.
 
 Thank you.
 



I think trying to do all of this in one regex will prove more trouble
than it's worth. Maybe breaking it down into something like this:

?php
$domain = www.ashleysheridan.co.uk;
$valid = false;

$tlds = array('aero', 'asia', 'biz', 'cat', 'com', 'coop', 'edu', 'gov',
'info', 'int', 'jobs', 'mil', 'mobi', 'museum', 'name', 'net', 'org',
'pro', 'tel', 'travel', 'xxx', 'ac', 'ad', 'ae', 'af', 'ag', 'ai', 'al',
'am', 'an', 'ao', 'aq', 'ar', 'as', 'at', 'au', 'aw', 'ax', 'az', 'ba',
'bb', 'bd', 'be', 'bf', 'bg', 'bh', 'bi', 'bj', 'bm', 'bn', 'bo', 'br',
'bs', 'bt', 'bv', 'bw', 'by', 'bz', 'ca', 'cc', 'cd', 'cf', 'cg', 'ch',
'ci', 'ck', 'cl', 'cm', 'cn', 'co', 'cr', 'cu', 'cv', 'cx', 'cy', 'cz',
'de', 'dj', 'dk', 'dm', 'do', 'dz', 'ec', 'ee', 'eg', 'er', 'es', 'et',
'eu', 'fi', 'fj', 'fk', 'fm', 'fo', 'fr', 'ga', 'gb', 'gd', 'ge', 'gf',
'gg', 'gh', 'gi', 'gl', 'gm', 'gn', 'gp', 'gq', 'gr', 'gs', 'gt', 'gu',
'gw', 'gy', 'hk', 'hm', 'hn', 'hr', 'ht', 'hu', 'id', 'ie', 'il', 'im',
'in', 'io', 'iq', 'ir', 'is', 'it', 'je', 'jm', 'jo', 'jp', 'ke', 'kg',
'kh', 'ki', 'km', 'kn', 'kp', 'kr', 'kw', 'ky', 'kz', 'la', 'lb', 'lc',
'li', 'lk', 'lr', 'ls', 'lt', 'lu', 'lv', 'ly', 'ma', 'mc', 'md', 'me',
'mg', 'mh', 'mk', 'ml', 'mm', 'mn', 'mo', 'mp', 'mq', 'mr', 'ms', 'mt',
'mu', 'mv', 'mw', 'mx', 'my', 'mz', 'na', 'nc', 'ne', 'nf', 'ng', 'ni',
'nl', 'no', 'np', 'nr', 'nu', 'nz', 'om', 'pa', 'pe', 'pf', 'pg', 'ph',
'pk', 'pl', 'pm', 'pn', 'pr', 'ps', 'pt', 'pw', 'py', 'qa', 're', 'ro',
'rs', 'ru', 'rw', 'sa', 'sb', 'sc', 'sd', 'se', 'sg', 'sh', 'si', 'sj',
'sk', 'sl', 'sm', 'sn', 'so', 'sr', 'st', 'su', 'sv', 'sy', 'sz', 'tc',
'td', 'tf', 'tg', 'th', 'tj', 'tk', 'tl', 'tm', 'tn', 'to', 'tp', 'tr',
'tt', 'tv', 'tw', 'tz', 'ua', 'ug', 'uk', 'us', 'uy', 'uz', 'va', 'vc',
've', 'vg', 'vi', 'vn', 'vu', 'wf', 'ws', 'ye', 'yt', 'za', 'zm',
'zw', );


if(strlen($domain = 253))
{
$labels = explode('.', $domain);
if(in_array($labels[count($labels)-1], $tlds))
{
for($i=0; $icount($labels) -1; $i++)
{
if(strlen($labels[$i]) = 63  
(!preg_match('/^[a-z0-9][a-z0-9
\-]*?[a-z0-9]$/', $labels[$i]) || preg_match('/^[0-9]+$/',
$labels[$i]) ))
{
$valid = false;
break;  // no point continuing if one label is 
wrong
}
else
{
$valid = true;
}
}
}
}

var_dump($valid);


This matches the last label with a TLD, and each label thereafter
against the standard a-z0-9 and hyphen rule as indicated in the
preferred characters allowed in a label (LDH rule), with the start and
end character in a label isn't a hyphen (oddly enough it doesn't mention
starting with a digit!)

Also, each label is checked to ensure it doesn't run over 63 characters,
and the whole thing isn't over 253 characters. Lastly, each label is
checked to ensure it doesn't completely consist of digits.

I've tested it only with my domain so far, but it should work fairly
well. As I said before, I couldn't think of a way to do it all with one
regex. It could probably be done, but would you really want to create a
huge and difficult to read/understand expression just because it's
possible?

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




Re: [PHP] Help: Validate Domain Name by Regular Express

2011-01-08 Thread TR Shaw

On Jan 8, 2011, at 12:09 PM, Ashley Sheridan wrote:

 On Sat, 2011-01-08 at 16:55 +0800, WalkinRaven wrote:
 
 PHP 5.3 PCRE
 
 Regular Express to match domain names format according to RFC 1034 - 
 DOMAIN NAMES - CONCEPTS AND FACILITIES
 
 /^
 (
   [a-z] |
   [a-z] (?:[a-z]|[0-9]) |
   [a-z] (?:[a-z]|[0-9]|\-){1,61} (?:[a-z]|[0-9]) ) # One 
 label
 
 (?:\.(?1))*+# More labels
 \.? # Root domain name
 $/iDx
 
 This rule matches only label and label. but not label.label...
 
 I don't know what wrong with it.
 
 Thank you.
 
 
 
 
 I think trying to do all of this in one regex will prove more trouble
 than it's worth. Maybe breaking it down into something like this:
 
 ?php
 $domain = www.ashleysheridan.co.uk;
 $valid = false;
 
 $tlds = array('aero', 'asia', 'biz', 'cat', 'com', 'coop', 'edu', 'gov',
 'info', 'int', 'jobs', 'mil', 'mobi', 'museum', 'name', 'net', 'org',
 'pro', 'tel', 'travel', 'xxx', 'ac', 'ad', 'ae', 'af', 'ag', 'ai', 'al',
 'am', 'an', 'ao', 'aq', 'ar', 'as', 'at', 'au', 'aw', 'ax', 'az', 'ba',
 'bb', 'bd', 'be', 'bf', 'bg', 'bh', 'bi', 'bj', 'bm', 'bn', 'bo', 'br',
 'bs', 'bt', 'bv', 'bw', 'by', 'bz', 'ca', 'cc', 'cd', 'cf', 'cg', 'ch',
 'ci', 'ck', 'cl', 'cm', 'cn', 'co', 'cr', 'cu', 'cv', 'cx', 'cy', 'cz',
 'de', 'dj', 'dk', 'dm', 'do', 'dz', 'ec', 'ee', 'eg', 'er', 'es', 'et',
 'eu', 'fi', 'fj', 'fk', 'fm', 'fo', 'fr', 'ga', 'gb', 'gd', 'ge', 'gf',
 'gg', 'gh', 'gi', 'gl', 'gm', 'gn', 'gp', 'gq', 'gr', 'gs', 'gt', 'gu',
 'gw', 'gy', 'hk', 'hm', 'hn', 'hr', 'ht', 'hu', 'id', 'ie', 'il', 'im',
 'in', 'io', 'iq', 'ir', 'is', 'it', 'je', 'jm', 'jo', 'jp', 'ke', 'kg',
 'kh', 'ki', 'km', 'kn', 'kp', 'kr', 'kw', 'ky', 'kz', 'la', 'lb', 'lc',
 'li', 'lk', 'lr', 'ls', 'lt', 'lu', 'lv', 'ly', 'ma', 'mc', 'md', 'me',
 'mg', 'mh', 'mk', 'ml', 'mm', 'mn', 'mo', 'mp', 'mq', 'mr', 'ms', 'mt',
 'mu', 'mv', 'mw', 'mx', 'my', 'mz', 'na', 'nc', 'ne', 'nf', 'ng', 'ni',
 'nl', 'no', 'np', 'nr', 'nu', 'nz', 'om', 'pa', 'pe', 'pf', 'pg', 'ph',
 'pk', 'pl', 'pm', 'pn', 'pr', 'ps', 'pt', 'pw', 'py', 'qa', 're', 'ro',
 'rs', 'ru', 'rw', 'sa', 'sb', 'sc', 'sd', 'se', 'sg', 'sh', 'si', 'sj',
 'sk', 'sl', 'sm', 'sn', 'so', 'sr', 'st', 'su', 'sv', 'sy', 'sz', 'tc',
 'td', 'tf', 'tg', 'th', 'tj', 'tk', 'tl', 'tm', 'tn', 'to', 'tp', 'tr',
 'tt', 'tv', 'tw', 'tz', 'ua', 'ug', 'uk', 'us', 'uy', 'uz', 'va', 'vc',
 've', 'vg', 'vi', 'vn', 'vu', 'wf', 'ws', 'ye', 'yt', 'za', 'zm',
 'zw', );
 
 
 if(strlen($domain = 253))
 {
   $labels = explode('.', $domain);
   if(in_array($labels[count($labels)-1], $tlds))
   {
   for($i=0; $icount($labels) -1; $i++)
   {
   if(strlen($labels[$i]) = 63  
 (!preg_match('/^[a-z0-9][a-z0-9
 \-]*?[a-z0-9]$/', $labels[$i]) || preg_match('/^[0-9]+$/',
 $labels[$i]) ))
   {
   $valid = false;
   break;  // no point continuing if one label is 
 wrong
   }
   else
   {
   $valid = true;
   }
   }
   }
 }
 
 var_dump($valid);
 
 
 This matches the last label with a TLD, and each label thereafter
 against the standard a-z0-9 and hyphen rule as indicated in the
 preferred characters allowed in a label (LDH rule), with the start and
 end character in a label isn't a hyphen (oddly enough it doesn't mention
 starting with a digit!)
 
 Also, each label is checked to ensure it doesn't run over 63 characters,
 and the whole thing isn't over 253 characters. Lastly, each label is
 checked to ensure it doesn't completely consist of digits.
 
 I've tested it only with my domain so far, but it should work fairly
 well. As I said before, I couldn't think of a way to do it all with one
 regex. It could probably be done, but would you really want to create a
 huge and difficult to read/understand expression just because it's
 possible?

Ash

I doubt its possible since the ccTLD's have valid 3 and more dotted domain 
names. You should see .us And .uk doesn't follow the ccTLS rules for .tk for 
example.

Now, if the purpose is to write a regex for a host name then that's a different 
story.

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



Re: [PHP] Help: Validate Domain Name by Regular Express

2011-01-08 Thread WalkinRaven

On 01/09/2011 01:09 AM, Ashley Sheridan wrote:

On Sat, 2011-01-08 at 16:55 +0800, WalkinRaven wrote:


PHP 5.3 PCRE

Regular Express to match domain names format according to RFC 1034 -
DOMAIN NAMES - CONCEPTS AND FACILITIES

/^
(
[a-z] |
[a-z] (?:[a-z]|[0-9]) |
[a-z] (?:[a-z]|[0-9]|\-){1,61} (?:[a-z]|[0-9])  ) # One 
label

(?:\.(?1))*+# More labels
\.? # Root domain name
$/iDx

This rule matches onlylabel  andlabel. but notlabel.label...

I don't know what wrong with it.

Thank you.





I think trying to do all of this in one regex will prove more trouble
than it's worth. Maybe breaking it down into something like this:

?php
$domain = www.ashleysheridan.co.uk;
$valid = false;

$tlds = array('aero', 'asia', 'biz', 'cat', 'com', 'coop', 'edu', 'gov',
'info', 'int', 'jobs', 'mil', 'mobi', 'museum', 'name', 'net', 'org',
'pro', 'tel', 'travel', 'xxx', 'ac', 'ad', 'ae', 'af', 'ag', 'ai', 'al',
'am', 'an', 'ao', 'aq', 'ar', 'as', 'at', 'au', 'aw', 'ax', 'az', 'ba',
'bb', 'bd', 'be', 'bf', 'bg', 'bh', 'bi', 'bj', 'bm', 'bn', 'bo', 'br',
'bs', 'bt', 'bv', 'bw', 'by', 'bz', 'ca', 'cc', 'cd', 'cf', 'cg', 'ch',
'ci', 'ck', 'cl', 'cm', 'cn', 'co', 'cr', 'cu', 'cv', 'cx', 'cy', 'cz',
'de', 'dj', 'dk', 'dm', 'do', 'dz', 'ec', 'ee', 'eg', 'er', 'es', 'et',
'eu', 'fi', 'fj', 'fk', 'fm', 'fo', 'fr', 'ga', 'gb', 'gd', 'ge', 'gf',
'gg', 'gh', 'gi', 'gl', 'gm', 'gn', 'gp', 'gq', 'gr', 'gs', 'gt', 'gu',
'gw', 'gy', 'hk', 'hm', 'hn', 'hr', 'ht', 'hu', 'id', 'ie', 'il', 'im',
'in', 'io', 'iq', 'ir', 'is', 'it', 'je', 'jm', 'jo', 'jp', 'ke', 'kg',
'kh', 'ki', 'km', 'kn', 'kp', 'kr', 'kw', 'ky', 'kz', 'la', 'lb', 'lc',
'li', 'lk', 'lr', 'ls', 'lt', 'lu', 'lv', 'ly', 'ma', 'mc', 'md', 'me',
'mg', 'mh', 'mk', 'ml', 'mm', 'mn', 'mo', 'mp', 'mq', 'mr', 'ms', 'mt',
'mu', 'mv', 'mw', 'mx', 'my', 'mz', 'na', 'nc', 'ne', 'nf', 'ng', 'ni',
'nl', 'no', 'np', 'nr', 'nu', 'nz', 'om', 'pa', 'pe', 'pf', 'pg', 'ph',
'pk', 'pl', 'pm', 'pn', 'pr', 'ps', 'pt', 'pw', 'py', 'qa', 're', 'ro',
'rs', 'ru', 'rw', 'sa', 'sb', 'sc', 'sd', 'se', 'sg', 'sh', 'si', 'sj',
'sk', 'sl', 'sm', 'sn', 'so', 'sr', 'st', 'su', 'sv', 'sy', 'sz', 'tc',
'td', 'tf', 'tg', 'th', 'tj', 'tk', 'tl', 'tm', 'tn', 'to', 'tp', 'tr',
'tt', 'tv', 'tw', 'tz', 'ua', 'ug', 'uk', 'us', 'uy', 'uz', 'va', 'vc',
've', 'vg', 'vi', 'vn', 'vu', 'wf', 'ws', 'ye', 'yt', 'za', 'zm',
'zw', );


if(strlen($domain= 253))
{
$labels = explode('.', $domain);
if(in_array($labels[count($labels)-1], $tlds))
{
for($i=0; $icount($labels) -1; $i++)
{
if(strlen($labels[$i])= 63  
(!preg_match('/^[a-z0-9][a-z0-9
\-]*?[a-z0-9]$/', $labels[$i]) || preg_match('/^[0-9]+$/',
$labels[$i]) ))
{
$valid = false;
break;  // no point continuing if one label is 
wrong
}
else
{
$valid = true;
}
}
}
}

var_dump($valid);


This matches the last label with a TLD, and each label thereafter
against the standard a-z0-9 and hyphen rule as indicated in the
preferred characters allowed in a label (LDH rule), with the start and
end character in a label isn't a hyphen (oddly enough it doesn't mention
starting with a digit!)

Also, each label is checked to ensure it doesn't run over 63 characters,
and the whole thing isn't over 253 characters. Lastly, each label is
checked to ensure it doesn't completely consist of digits.

I've tested it only with my domain so far, but it should work fairly
well. As I said before, I couldn't think of a way to do it all with one
regex. It could probably be done, but would you really want to create a
huge and difficult to read/understand expression just because it's
possible?

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





Thank you for replying, Ash.

I know it may better to pre-deal it with explode()-like, and then we 
will get a less complex regular express. But I just want to know what 
the problem in my Regular express.


And the code you've offered, I don't like the idea of a limited set of 
suffix, for when it may be updated some times. I just want to do format 
validation, not content validation.


And the regular express itself, yes it is complex, but I've checked it 
times very carefully -- letter by letter -- I just don't understand 
what's wrong with it. Or there is some bug in PCRE engine?


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



Re: [PHP] Help with variable variables not being set for a multi-dimensional array

2010-11-10 Thread David Harkness
On Tue, Nov 9, 2010 at 6:55 PM, Daevid Vincent dae...@daevid.com wrote:

 I've used variable variables before but for some reason I can't figure this
 snippet out. Why doesn't $ini_file get set (or appended to).


AFAIK variable variables can only reference actual variables--not array
subscripts or other non-variable syntax elements such as - or ::.
eval() can do this because it parses the code as PHP. Variable variables
take the *variable name* contained in the variable and look it up in the
current scope. This is a variable name:

ini_array

This is not:

ini_array['agis_core']['adapter']

I think you can use references here to do what you need. Warning: I only
tested the basics of this in the interpreter without running this exact
code.

public function explode_ini()
{
$ini_array = array();

foreach($this-ini_array as $heading = $key_vals)
{
foreach ($key_vals as $k = $v)
{
$path = $ini_array[$heading];
$subsection = explode('.', $k);
foreach ($subsection as $ss)
$path = $path[$ss];
$path = $v;
unset($path);
}
}

$this-ini_array = $ini_array;
}

David


Re: [PHP] Help with sending credentials?

2010-10-15 Thread Richard Quadling
On 14 October 2010 21:45, Brian Dunning br...@briandunning.com wrote:
 Gents -

 I'm trying to work with a major vendor's web service, but all my efforts are 
 met with a 401 authentication error response. I can log in manually to this 
 URL using these credentials through a browser, so I know the credentials are 
 good. Unfortunately the support guys at the vendor don't see any problem with 
 my code and have not been able to help.

 $url = https://servername.com/script;;
 $ctx = stream_context_create(array('https' = array(
        'timeout' = 10,
        'header'  = sprintf(Authorization: Basic %s\r\n, 
 base64_encode(myUsername:myPassword))
        )));
 $result = file_get_contents($url, 0, $ctx);
 $http_response = explode(' ', $http_response_header[0]);
 $response_code = $http_response[1];     === This is evaluating to '401'


 Thanks.

Are they using Basic authentication?

Does ...

https://myUsername:mypassw...@http://servername.com/script

work?

Is this a SOAP based web service?

Are they expecting the SOAPHeader to contain the authentication?




-- 
Richard Quadling
Twitter : EE : Zend
@RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY

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



RE: [PHP] Help with sending credentials?

2010-10-15 Thread Tommy Pham
 -Original Message-
 From: Richard Quadling [mailto:rquadl...@gmail.com]
 Sent: Friday, October 15, 2010 1:47 AM
 To: Brian Dunning
 Cc: PHP-General List
 Subject: Re: [PHP] Help with sending credentials?
 
 On 14 October 2010 21:45, Brian Dunning br...@briandunning.com wrote:
  Gents -
 
  I'm trying to work with a major vendor's web service, but all my efforts are
 met with a 401 authentication error response. I can log in manually to this
 URL using these credentials through a browser, so I know the credentials are
 good. Unfortunately the support guys at the vendor don't see any problem
 with my code and have not been able to help.
 
  $url = https://servername.com/script;; $ctx =
  stream_context_create(array('https' = array(
 'timeout' = 10,
 'header'  = sprintf(Authorization: Basic %s\r\n,
  base64_encode(myUsername:myPassword))
 )));
  $result = file_get_contents($url, 0, $ctx); $http_response = explode('
  ', $http_response_header[0]); $response_code = $http_response[1];
  === This is evaluating to '401'
 
 
  Thanks.
 
 Are they using Basic authentication?
 
 Does ...
 
 https://myUsername:mypassw...@http://servername.com/script

Shouldn't that be https://myUsername:mypassw...@servername.com/script ?

 
 work?
 
 Is this a SOAP based web service?
 
 Are they expecting the SOAPHeader to contain the authentication?
 
 
 
 
 --
 Richard Quadling
 Twitter : EE : Zend
 @RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY
 

Regards,
Tommy


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



Re: [PHP] Help with sending credentials?

2010-10-15 Thread Richard Quadling
On 15 October 2010 10:51, Tommy Pham tommy...@gmail.com wrote:
 -Original Message-
 From: Richard Quadling [mailto:rquadl...@gmail.com]
 Sent: Friday, October 15, 2010 1:47 AM
 To: Brian Dunning
 Cc: PHP-General List
 Subject: Re: [PHP] Help with sending credentials?

 On 14 October 2010 21:45, Brian Dunning br...@briandunning.com wrote:
  Gents -
 
  I'm trying to work with a major vendor's web service, but all my efforts 
  are
 met with a 401 authentication error response. I can log in manually to this
 URL using these credentials through a browser, so I know the credentials are
 good. Unfortunately the support guys at the vendor don't see any problem
 with my code and have not been able to help.
 
  $url = https://servername.com/script;; $ctx =
  stream_context_create(array('https' = array(
         'timeout' = 10,
         'header'  = sprintf(Authorization: Basic %s\r\n,
  base64_encode(myUsername:myPassword))
         )));
  $result = file_get_contents($url, 0, $ctx); $http_response = explode('
  ', $http_response_header[0]); $response_code = $http_response[1];
  === This is evaluating to '401'
 
 
  Thanks.

 Are they using Basic authentication?

 Does ...

 https://myUsername:mypassw...@http://servername.com/script

 Shouldn't that be https://myUsername:mypassw...@servername.com/script ?


 work?

 Is this a SOAP based web service?

 Are they expecting the SOAPHeader to contain the authentication?




 --
 Richard Quadling
 Twitter : EE : Zend
 @RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY


 Regards,
 Tommy



Yeah. CNP error. Thanks.



-- 
Richard Quadling
Twitter : EE : Zend
@RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY

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



[PHP] Help with sending credentials?

2010-10-14 Thread Brian Dunning
Gents -

I'm trying to work with a major vendor's web service, but all my efforts are 
met with a 401 authentication error response. I can log in manually to this URL 
using these credentials through a browser, so I know the credentials are good. 
Unfortunately the support guys at the vendor don't see any problem with my code 
and have not been able to help.

$url = https://servername.com/script;;
$ctx = stream_context_create(array('https' = array(
'timeout' = 10,
'header'  = sprintf(Authorization: Basic %s\r\n, 
base64_encode(myUsername:myPassword))
)));
$result = file_get_contents($url, 0, $ctx); 
$http_response = explode(' ', $http_response_header[0]);
$response_code = $http_response[1]; === This is evaluating to '401'


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



Re: [PHP] Help with sending credentials?

2010-10-14 Thread Adam Richardson
On Thu, Oct 14, 2010 at 4:45 PM, Brian Dunning br...@briandunning.comwrote:

 Gents -

 I'm trying to work with a major vendor's web service, but all my efforts
 are met with a 401 authentication error response. I can log in manually to
 this URL using these credentials through a browser, so I know the
 credentials are good. Unfortunately the support guys at the vendor don't see
 any problem with my code and have not been able to help.

 $url = https://servername.com/script;;
 $ctx = stream_context_create(array('https' = array(
'timeout' = 10,
'header'  = sprintf(Authorization: Basic %s\r\n,
 base64_encode(myUsername:myPassword))
)));
 $result = file_get_contents($url, 0, $ctx);
 $http_response = explode(' ', $http_response_header[0]);
 $response_code = $http_response[1]; === This is evaluating to '401'


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


Could the method (POST vs GET) or the content type be causing the issue
(hard to guess beyond this without knowing the service?)  See this simple
twitter function for examples of what I'm wondering about:
http://fabien.potencier.org/article/20/tweeting-from-php

Adam

-- 
Nephtali:  PHP web framework that functions beautifully
http://nephtaliproject.com


RE: [PHP] Help with template file and email

2010-07-26 Thread Carlos Sura





Hello Joey,
No problem, I'm glad you got it working now.  
Any other question. Use php-list.

Regards,
Carlos Sura.


From: j.hendrick...@comcast.net
To: carlos_s...@hotmail.com
Subject: Re: [PHP] Help with template file and email
Date: Sat, 24 Jul 2010 08:29:03 -0500










Hi Carlos,
  I wanted to thank you for all your help!! In the 
function I had to use a foreach() to get the email. Then put the $_GET['email'] 
in when I called the function. Finally got it!

Thank you for your help!!
  
Joey.

  - Original Message - 
  From: 
  Carlos 
  Sura 
  To: j.hendrick...@comcast.net 
  Cc: php-general@lists.php.net 
  Sent: Tuesday, July 13, 2010 10:48 
  AM
  Subject: RE: [PHP] Help with template 
  file and email
  

Let me get this right...

$mymail // If you put an 
  email adress it works, right. You are calling variable $mymail... But, what 
  does contain that var? You are calling $mymail, there has to be a database, 
or 
  something of those 10 mails you said. -If i'm getting you the point right- If 
  not, my mistake.

Or you might use something like 
  this:

?php
// mail list
$to  = 'yourma...@example.com' . ', ';
$to 
  .= 'yourma...@example.com';


If my 
  answer is wrong for you. Plrease reffer to: 
  http://docs.php.net/manual/en/function.mail.php -as Richard 
  said.-





 From: rquadl...@gmail.com
 
  Date: Tue, 13 Jul 2010 15:02:14 +0100
 To: 
  j.hendrick...@comcast.net
 CC: php-general@lists.php.net
 
  Subject: Re: [PHP] Help with template file and email
 
 On 13 
  July 2010 14:56, Joey Hendricks j.hendrick...@comcast.net 
  wrote:
  Hello,
   I have been working on a birtday 
  invite program. The form takes 10 names and 10 email addresses. I think the 
  problem is the $to variable in my function. I get this warning-Warning: 
mail() 
  [function.mail]: SMTP server response: 550 5.5.0 f domain name 
  required in.
  Could someone help me with this my email is 
  j.hendrick...@comcast.net Thank you so very much!
 
 
  ?php
 mail(' j.hendrick...@comcast.net', 'Test email', 'This is a 
  test email');
 ?
 
 and I get the following entry in 
  my PHP's mail.log ...
 
 mail() on [-:2]: To: 
  j.hendrick...@comcast.net -- Headers:
 
 Pretty simple 
  stuff.
 
 
  http://docs.php.net/manual/en/function.mail.php
 
 
  Regards,
 
 Richard.
 
 -- 
 PHP General 
  Mailing List (http://www.php.net/)
 To unsubscribe, visit: 
  http://www.php.net/unsub.php
 


  
  Get a new e-mail account with Hotmail - Free. Sign-up 
  now.
_
http://clk.atdmt.com/UKM/go/19780/direct/01/
Do you have a story that started on Hotmail? Tell us now

Re: [PHP] help using phpadmin

2010-07-19 Thread Isaac Lee
thanks carlos,

but where would i enter that command?

and i tried editing the php.ini file but that didn't accomplish anything.

isaac

On Mon, Jul 19, 2010 at 1:29 AM, Carlos Sura carlos_s...@hotmail.com wrote:
 Hello Isaac Lee.

 Are you running on Linux or Windows?

 You might try:
 mysql SET PASSWORD FOR ‘root’@'localhost’ = PASSWORD(’yourpassword’);

 Then restart your service -if needed-

 If not... Try to edit config.inc.php file.

 Regards,

 Carlos Sura

 -Original Message-
 From: Isaac Lee [mailto:rhinecant...@gmail.com]
 Sent: domingo, 18 de julio de 2010 10:34 p.m.
 Cc: php-general@lists.php.net
 Subject: [PHP] help using phpadmin

 this is the second time that i have made an account and set the
 password. then when i try to reaccess phpadmin, it shows this message:

 Error

 MySQL said:

 #1045 - Access denied for user 'root'@'localhost' (using password: NO)


 What am supposed to do so that my regain access to phpadmin?  edit the
 php.ini file?

 isaac

 --
 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] help using phpadmin

2010-07-19 Thread Isaac Lee
im using windows.

On Mon, Jul 19, 2010 at 12:23 PM, Isaac Lee rhinecant...@gmail.com wrote:
 thanks carlos,

 but where would i enter that command?

 and i tried editing the php.ini file but that didn't accomplish anything.

 isaac

 On Mon, Jul 19, 2010 at 1:29 AM, Carlos Sura carlos_s...@hotmail.com wrote:
 Hello Isaac Lee.

 Are you running on Linux or Windows?

 You might try:
 mysql SET PASSWORD FOR ‘root’@'localhost’ = PASSWORD(’yourpassword’);

 Then restart your service -if needed-

 If not... Try to edit config.inc.php file.

 Regards,

 Carlos Sura

 -Original Message-
 From: Isaac Lee [mailto:rhinecant...@gmail.com]
 Sent: domingo, 18 de julio de 2010 10:34 p.m.
 Cc: php-general@lists.php.net
 Subject: [PHP] help using phpadmin

 this is the second time that i have made an account and set the
 password. then when i try to reaccess phpadmin, it shows this message:

 Error

 MySQL said:

 #1045 - Access denied for user 'root'@'localhost' (using password: NO)


 What am supposed to do so that my regain access to phpadmin?  edit the
 php.ini file?

 isaac

 --
 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] help using phpadmin

2010-07-19 Thread Carlos Sura

Hello Isaac Lee,

I don't remember well, but I think this is the way to do it in Windows.
You can try this:

Start -- Run  cmd   // Write it and press enter key.
It will show you a MS-DOS window,
Write there: mysql

now:
mysql cd c:\location\mysql\bin

Then you might try:
mysqladmin -u root password new_password

Now type:
mysql -u root -p

Write your new password now :)

If none of this work...
Please show me your ini* file.

If you can't show me your ini* file please reffer to: 
http://search.mysql.com/search?q=Resetting_permissions.htmllr=lang_en


Regards,
Carlos Sura.






 Date: Mon, 19 Jul 2010 12:24:26 -0400
 From: rhinecant...@gmail.com
 To: carlos_s...@hotmail.com
 CC: php-general@lists.php.net
 Subject: Re: [PHP] help using phpadmin
 
 im using windows.
 
 On Mon, Jul 19, 2010 at 12:23 PM, Isaac Lee rhinecant...@gmail.com wrote:
  thanks carlos,
 
  but where would i enter that command?
 
  and i tried editing the php.ini file but that didn't accomplish anything.
 
  isaac
 
  On Mon, Jul 19, 2010 at 1:29 AM, Carlos Sura carlos_s...@hotmail.com 
  wrote:
  Hello Isaac Lee.
 
  Are you running on Linux or Windows?
 
  You might try:
  mysql SET PASSWORD FOR ‘root’@'localhost’ = PASSWORD(’yourpassword’);
 
  Then restart your service -if needed-
 
  If not... Try to edit config.inc.php file.
 
  Regards,
 
  Carlos Sura
 
  -Original Message-
  From: Isaac Lee [mailto:rhinecant...@gmail.com]
  Sent: domingo, 18 de julio de 2010 10:34 p.m.
  Cc: php-general@lists.php.net
  Subject: [PHP] help using phpadmin
 
  this is the second time that i have made an account and set the
  password. then when i try to reaccess phpadmin, it shows this message:
 
  Error
 
  MySQL said:
 
  #1045 - Access denied for user 'root'@'localhost' (using password: NO)
 
 
  What am supposed to do so that my regain access to phpadmin?  edit the
  php.ini file?
 
  isaac
 
  --
  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
 
  
_
We want to hear all your funny, exciting and crazy Hotmail stories. Tell us now
http://clk.atdmt.com/UKM/go/195013117/direct/01/

[PHP] help using phpadmin

2010-07-18 Thread Isaac Lee
this is the second time that i have made an account and set the
password. then when i try to reaccess phpadmin, it shows this message:

Error

MySQL said:

#1045 - Access denied for user 'root'@'localhost' (using password: NO)


What am supposed to do so that my regain access to phpadmin?  edit the
php.ini file?

isaac

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



RE: [PHP] help using phpadmin

2010-07-18 Thread Carlos Sura
Hello Isaac Lee.

Are you running on Linux or Windows?

You might try:
mysql SET PASSWORD FOR ‘root’@'localhost’ = PASSWORD(’yourpassword’);

Then restart your service -if needed-

If not... Try to edit config.inc.php file.

Regards,

Carlos Sura

-Original Message-
From: Isaac Lee [mailto:rhinecant...@gmail.com] 
Sent: domingo, 18 de julio de 2010 10:34 p.m.
Cc: php-general@lists.php.net
Subject: [PHP] help using phpadmin

this is the second time that i have made an account and set the
password. then when i try to reaccess phpadmin, it shows this message:

Error

MySQL said:

#1045 - Access denied for user 'root'@'localhost' (using password: NO)


What am supposed to do so that my regain access to phpadmin?  edit the
php.ini file?

isaac

-- 
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] help with sql statement

2010-07-13 Thread Richard Quadling
On 12 July 2010 18:34, Tommy Pham tommy...@gmail.com wrote:
 SELECT srs.Name FROM SMS_R_System srs WHERE srs.SystemOUName IN
 (example.com/COMPUTERS/MAIN CAMPUS/ABC, example.com/COMPUTERS/MAIN
 CAMPUS/XYZ)


As this is a single table query, there is no need for the table alias.

SELECT Name FROM SMS_R_System WHERE LEFT(SystemOUName, 34) =
'example.com/COMPUTERS/MAIN CAMPUS/' AND RIGHT(SystemOUName, 3) IN
('ABC', 'XYZ')

But this will probably take a measurable amount of time longer to
execute - 2 comparisons and 2 string processes. Maybe not for a single
run, but after several hundred.

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



[PHP] Help with template file and email

2010-07-13 Thread Joey Hendricks
Hello,
  I have been working on a birtday invite program. The form takes 10 names and 
10 email addresses. I think the problem is the $to variable in my function. I 
get this warning-Warning: mail() [function.mail]: SMTP server response: 550 
5.5.0 f domain name required in.
Could someone help me with this my email is j.hendrick...@comcast.net Thank you 
so very much!
This is my code-

?php
function mail_message($data_array, $template_file, $deadline_str)
{
$email_message = file_get_contents($template_file);
$email_message = str_replace(#DEADLINE#, $deadline_str, $email_message);
$email_message = str_replace(#DATE#, date(F d, Y h:i a), $email_message);
$email_message = str_replace(#NAME#, $data_array['name'], $email_message);
//I tried many things for this $to variable
//If I put in an email address it works
$to=$mymail;
$from='j.hendrick...@comcast.net';
$email_subject='Bubs Birthday';
 mail($to, $email_subject, $email_message, From: .$from);
 }
if(empty($_GET['name0'])  (empty($_GET['email0'])))
{
   $query_string = $_SERVER['QUERY_STRING'];
   $url = invite_form.php?.$query_string.error=1;
   header(Location: .$url);
   exit();
}
for($i=0;$i=9;$i++)
{
if(!empty($_GET[name.$i])  (empty($_GET[email.$i])))
{
$query_string = $_SERVER['QUERY_STRING'];
   $url = invite_form.php?.$query_string.error=2;
   header(Location: .$url);
   exit();
}
 }
for($i=0;$i=9;$i++)
{
if(empty($_GET[name.$i])  (!empty($_GET[email.$i])))
{
$query_string = $_SERVER['QUERY_STRING'];
   $url = invite_form.php?.$query_string.error=3;
   header(Location: .$url);
   exit();
}
 }
function goodmail($myemail)
{
$goodemail=^([0-9a-zA-Z]+[-._+amp;])*[0-9a-zA-Z]+@([-0-9a-zA-Z]+[.])+[a-zA-Z]{2,6}$;
 if(!ereg($goodemail, $myemail))
 {
 $query_string = $_SERVER['QUERY_STRING'];
$url = invite_form.php?.$query_string.error=4;
header(Location: .$url);
   exit();
 }
return $myemail;
}
for($i=0;$i=9;$i++)
{
if(!empty($_GET[email.$i]))
{
$mail=$_GET[email.$i];
goodmail($mail);
}
 }
extract($_GET, EXTR_PREFIX_SAME, get);
for($i=0;$i=9;$i++)
{
$deadline_array = getdate();
$deadline_day = $deadline_array['mday'] + 7;
$deadline_stamp = 
mktime($deadline_array['hours'],$deadline_array['minutes'],$deadline_array['seconds'],
$deadline_array['mon'],$deadline_day,$deadline_array['year']);
$deadline_str = date(F d, Y, $deadline_stamp);

if(!empty($_GET[email.$i]))
{
mail_message($_GET[email.$i], email_template.txt, $deadline_str);
//mail($to, $email_subject, $email_message, From: .$from);
}
 }

Re: [PHP] Help with template file and email

2010-07-13 Thread Richard Quadling
On 13 July 2010 14:56, Joey Hendricks j.hendrick...@comcast.net wrote:
 Hello,
  I have been working on a birtday invite program. The form takes 10 names and 
 10 email addresses. I think the problem is the $to variable in my function. I 
 get this warning-Warning: mail() [function.mail]: SMTP server response: 550 
 5.5.0 f domain name required in.
 Could someone help me with this my email is j.hendrick...@comcast.net Thank 
 you so very much!

?php
mail(' j.hendrick...@comcast.net', 'Test email', 'This is a test email');
?

and I get the following entry in my PHP's mail.log ...

mail() on [-:2]: To:  j.hendrick...@comcast.net -- Headers:

Pretty simple stuff.

http://docs.php.net/manual/en/function.mail.php

Regards,

Richard.

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



RE: [PHP] Help with template file and email

2010-07-13 Thread Carlos Sura


Let me get this right...



$mymail // If you put an email adress it works, right. You are calling
variable $mymail... But, what does contain that var? You are calling
$mymail, there has to be a database, or something of those 10 mails you
said. -If i'm getting you the point right- If not, my mistake.



Or you might use something like this:



?php
// mail list
$to  = 'yourma...@example.com' . ', ';
$to .= 'yourma...@example.com';



If my answer is wrong for you. Plrease reffer to: 
http://docs.php.net/manual/en/function.mail.php -as Richard said.-





 From: rquadl...@gmail.com
 Date: Tue, 13 Jul 2010 15:02:14 +0100
 To: j.hendrick...@comcast.net
 CC: php-general@lists.php.net
 Subject: Re: [PHP] Help with template file and email
 
 On 13 July 2010 14:56, Joey Hendricks j.hendrick...@comcast.net wrote:
  Hello,
   I have been working on a birtday invite program. The form takes 10 names 
  and 10 email addresses. I think the problem is the $to variable in my 
  function. I get this warning-Warning: mail() [function.mail]: SMTP server 
  response: 550 5.5.0 f domain name required in.
  Could someone help me with this my email is j.hendrick...@comcast.net Thank 
  you so very much!
 
 ?php
 mail(' j.hendrick...@comcast.net', 'Test email', 'This is a test email');
 ?
 
 and I get the following entry in my PHP's mail.log ...
 
 mail() on [-:2]: To:  j.hendrick...@comcast.net -- Headers:
 
 Pretty simple stuff.
 
 http://docs.php.net/manual/en/function.mail.php
 
 Regards,
 
 Richard.
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
  
_
http://clk.atdmt.com/UKM/go/19780/direct/01/
Do you have a story that started on Hotmail? Tell us now

[PHP] help with sql statement

2010-07-12 Thread Adam
I was google searching, and the only SQL mailing list I found is 
currently giving a 503 error, so I hope you don't mind me asking my SQL 
question here, since there are a lot of SQL gurus here.  I am having a 
syntax problem:


Instead of doing a query like this::

select SMS_R_SYSTEM.Name from SMS_R_System where 
(SMS_R_System.SystemOUName = example.com/COMPUTERS/MAIN CAMPUS/ABC) or 
(SMS_R_System.SystemOUName = example.com/COMPUTERS/MAIN CAMPUS/XYZ)


I'd like to shorten it in the where clause to:

select SMS_R_SYSTEM.Name from SMS_R_System where 
(SMS_R_System.SystemOUName = example.com/COMPUTERS/MAIN CAMPUS/ABC, 
example.com/COMPUTERS/MAIN CAMPUS/XYZ)


But I'm getting a syntax error.  Any idea why my SQL syntax isn't valid?



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



Re: [PHP] help with sql statement

2010-07-12 Thread Ashley Sheridan
On Mon, 2010-07-12 at 10:24 -0500, Adam wrote:

 I was google searching, and the only SQL mailing list I found is 
 currently giving a 503 error, so I hope you don't mind me asking my SQL 
 question here, since there are a lot of SQL gurus here.  I am having a 
 syntax problem:
 
 Instead of doing a query like this::
 
 select SMS_R_SYSTEM.Name from SMS_R_System where 
 (SMS_R_System.SystemOUName = example.com/COMPUTERS/MAIN CAMPUS/ABC) or 
 (SMS_R_System.SystemOUName = example.com/COMPUTERS/MAIN CAMPUS/XYZ)
 
 I'd like to shorten it in the where clause to:
 
 select SMS_R_SYSTEM.Name from SMS_R_System where 
 (SMS_R_System.SystemOUName = example.com/COMPUTERS/MAIN CAMPUS/ABC, 
 example.com/COMPUTERS/MAIN CAMPUS/XYZ)
 
 But I'm getting a syntax error.  Any idea why my SQL syntax isn't valid?
 
 
 


The short answer is your syntax isn't valid, which means that what
you've written isn't valid SQL :p

What I think you're looking for instead is something like this:

SELECT SMS_R_SYSTEM.Name FROM SMS_R_System WHERE
SMS_R_System.SystemOUName IN (example.com/COMPUTERS/MAIN CAMPUS/ABC,
example.com/COMPUTERS/MAIN CAMPUS/XYZ)

which lets MySQL compare the field against an array of different values
within the brackets.

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




RE: [PHP] help with sql statement

2010-07-12 Thread Tommy Pham
 -Original Message-
 From: Ashley Sheridan [mailto:a...@ashleysheridan.co.uk]
 Sent: Monday, July 12, 2010 8:26 AM
 To: Adam
 Cc: PHP General
 Subject: Re: [PHP] help with sql statement
 
 On Mon, 2010-07-12 at 10:24 -0500, Adam wrote:
 
  I was google searching, and the only SQL mailing list I found is
  currently giving a 503 error, so I hope you don't mind me asking my
  SQL question here, since there are a lot of SQL gurus here.  I am
  having a syntax problem:
 
  Instead of doing a query like this::
 
  select SMS_R_SYSTEM.Name from SMS_R_System where
  (SMS_R_System.SystemOUName = example.com/COMPUTERS/MAIN
 CAMPUS/ABC)
  or (SMS_R_System.SystemOUName = example.com/COMPUTERS/MAIN
  CAMPUS/XYZ)
 
  I'd like to shorten it in the where clause to:
 
  select SMS_R_SYSTEM.Name from SMS_R_System where
  (SMS_R_System.SystemOUName = example.com/COMPUTERS/MAIN
 CAMPUS/ABC,
  example.com/COMPUTERS/MAIN CAMPUS/XYZ)
 
  But I'm getting a syntax error.  Any idea why my SQL syntax isn't valid?
 
 
 
 
 
 The short answer is your syntax isn't valid, which means that what you've
 written isn't valid SQL :p
 
 What I think you're looking for instead is something like this:
 
 SELECT SMS_R_SYSTEM.Name FROM SMS_R_System WHERE
 SMS_R_System.SystemOUName IN (example.com/COMPUTERS/MAIN
 CAMPUS/ABC, example.com/COMPUTERS/MAIN CAMPUS/XYZ)
 

Even shorter ;)

SELECT srs.Name FROM SMS_R_System srs WHERE srs.SystemOUName IN
(example.com/COMPUTERS/MAIN CAMPUS/ABC, example.com/COMPUTERS/MAIN
CAMPUS/XYZ)

 which lets MySQL compare the field against an array of different values
 within the brackets.

Given his syntax, I'd guess that his RDBMS is MS SQL and he's trying to get
some info from the DB that's populated by MS' SMS.

Regards,
Tommy

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



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



[PHP] Help, FPDI is changing the size of my PDFs

2010-05-21 Thread Brian Dunning
I'm using FPDI to add some stuff to some existing PDF documents. Works great, 
except that it's slightly changing the size of the PDF document (the physical 
page size, not the file size), which is unacceptable since this is for a 
high-end print file. I've stripped out all the code to the bare bones to try 
and debug this. Here is what I have:

$pdf = new fpdi();
$pdf-AddPage();
$pdf-setSourceFile('D:\\DocShare\\'.$filename);
$tplidx = $pdf-importPage(1);
$pdf-useTemplate($tplidx);
$pdf-Output('newpdf.pdf', 'D');

When I have PHP output the raw original PDF file, it measures 8.34x11.12. If 
I process it with the above code, the output measures 8.27x11.7 with a blank 
white band added along the bottom. Any suggestions? I just need the new file to 
be the same size as the original. Thanks!

Re: [PHP] Help, FPDI is changing the size of my PDFs

2010-05-21 Thread Brian Dunning
Solved it. Here's the solution:

$pdf = new fpdi();
$pdf-setSourceFile('D:\\DocShare\\'.$filename);
$tplidx = $pdf-ImportPage(1);
$s = $pdf-getTemplatesize($tplidx);
$pdf-AddPage($s['h']  $s['w'] ? 'P' : 'L', array($s['w'], $s['h'])); // This 
gets it the right dimensions
$pdf-useTemplate($tplidx, 0, 0, 0, 0, true);
$pdf-Output('newpdf.pdf', 'D');



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



[PHP] Re: -----json and php----help

2010-05-11 Thread shahrzad khorrami
thanks Nathan, I think this is a good way


[PHP] Help with exec.

2010-03-03 Thread Paul Halliday
I need to pipe some data to an external application.

I have this:

while ($row = mysql_fetch_array($theData[0])) {
$src_ip[] = $row[0];
$dst_ip[] = $row[1];
$sig_desc[] = $row[2];

$rec ++;
if ( $rec == $recCount ) {
break;
}
}

for ($i = 0; $i  sizeof($src_ip); $i++) {
$tmpResult[] = $sig_desc[$i],$src_ip[$i],$dst_ip[$i]\n;
}


The external program is called like:

cat results.csv | theprogram outputfilename

Is there a way mimic this w/o outputting $tmpResult to a file first?

Thanks.

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



Re: [PHP] Help with exec.

2010-03-03 Thread Richard Quadling
On 3 March 2010 13:01, Paul Halliday paul.halli...@gmail.com wrote:
 I need to pipe some data to an external application.

 I have this:

 while ($row = mysql_fetch_array($theData[0])) {
    $src_ip[] = $row[0];
    $dst_ip[] = $row[1];
    $sig_desc[] = $row[2];

    $rec ++;
    if ( $rec == $recCount ) {
            break;
    }
 }

 for ($i = 0; $i  sizeof($src_ip); $i++) {
    $tmpResult[] = $sig_desc[$i],$src_ip[$i],$dst_ip[$i]\n;
 }


 The external program is called like:

 cat results.csv | theprogram outputfilename

 Is there a way mimic this w/o outputting $tmpResult to a file first?

 Thanks.

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



I believe you can use popen() to open theprogram and pipe to it the
content and read back the results. All without writing to any files.



-- 
-
Richard Quadling
Standing on the shoulders of some very clever giants!
EE : http://www.experts-exchange.com/M_248814.html
EE4Free : http://www.experts-exchange.com/becomeAnExpert.jsp
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731
ZOPA : http://uk.zopa.com/member/RQuadling

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