Re: [PHP] undef func

2013-05-10 Thread James Yerge
On 05/10/2013 06:08 PM, Gabriel Ricci wrote:
> pear isntall php-dev
>
>
> Att.
>
> Gabriel Ricci
> 
>
> Website 
> Follow @gabrielricci 
> Facebook profile , GitHub
> profile
> 
>
>
> On Fri, May 10, 2013 at 7:07 PM, georg  wrote:
>
>> **
>> So thanx again, closing in. It turned out that I had tried; yum install
>> php_pear  // i.e. with an underscore, should be with hyphen !
>> so crawling a mm forward; then stuck on; pecl install pdo_odbc// in
>> this case the undrscore is ok (!)
>> which fails as
>>
>> "Cant find php headers in /usr/include/php"  followed by "Error phpize
>> failed"
>>
>> /georg
>>
>> - Original Message -
>> *From:* Serge Fonville 
>> *To:* georg 
>> *Cc:* Gabriel Ricci  ; Daniel 
>> Brown; tamouse
>> mailing lists  ; PHP 
>> General
>> *Sent:* Friday, May 10, 2013 11:41 PM
>> *Subject:* Re: [PHP] undef func
>>
>>  Assuming OP is using a distro that uses yum for package management;
>> A "yum whatprovides pecl" should provide the package name that needs to be
>> installed, in case of an apt based distro, this could be done through
>> aptitude. Either way, it seems what might provide more information is
>> details like the commands executed, the distro used and the errors received
>>
>> HTH
>>
>>  Kind regards/met vriendelijke groet,
>>
>> Serge Fonville
>>
>> http://www.sergefonville.nl
>>
>> Convince Microsoft!
>> They need to add TRUNCATE PARTITION in SQL Server
>>
>> https://connect.microsoft.com/SQLServer/feedback/details/417926/truncate-partition-of-partitioned-table
>>
>>
>> 2013/5/10 georg 
>>
>>> noop, didnt take, no such package, was my reward
>>>
>>> /georg
>>>   - Original Message -
>>>   From: Gabriel Ricci
>>>   To: georg
>>>   Cc: Daniel Brown ; tamouse mailing lists ; PHP General
>>>   Sent: Friday, May 10, 2013 11:06 PM
>>>   Subject: Re: [PHP] undef func
>>>
>>>
>>>   To have pecl, you need to install PEAR first, "yum install php-pear"
>>> (or "yum install php5-pear") should work.
>>>
>>>
>>>   Then you can try "pecl install pdo_odbc."
>>>
>>>
>>>
>>>   Att.
>>>
>>>   Gabriel Ricci
>>>   
>>>
>>>   Website
>>>   Follow @gabrielricci
>>>   Facebook profile, GitHub profile
>>>
>>>
>>>
>>>
>>>
>>>   On Fri, May 10, 2013 at 6:03 PM, georg 
>>> wrote:
>>>
>>> unfortunately that didnt take, pecl is undefined command (my linux is
>>> not so strong)
>>> trying yum renders no such package
>>>
>>>
>>>
>>> - Original Message - From: "Daniel Brown" 
>>> To: "tamouse mailing lists" 
>>> Cc: "georg" ; "PHP General" <
>>> php-general@lists.php.net>
>>> Sent: Friday, May 10, 2013 9:21 PM
>>> Subject: Re: [PHP] undef func
>>>
>>>
>>>
>>>
>>>   On Fri, May 10, 2013 at 3:18 PM, tamouse mailing lists
>>>wrote:
>>>
>>>
>>> Aren't DLLs a Windows thing?
>>>
>>>
>>>  Yeah, I misread the bit about "MS XP" and thought he was using XP
>>>   for this install.  I just realized the remainder of the discussion
>>>   between us was off-list, so - for posterity - my response, when
>>>   finding out it is indeed a Linux box, is: pecl install pdo_odbc.
>>>
>>>   --
>>>   
>>>   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 General Mailing List (http://www.php.net/)
>>> To unsubscribe, visit: http://www.php.net/unsub.php
>>>
>>>
>>>
>>>

Should be yum install php-devel

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



[PHP] Re: htaccess question

2013-04-10 Thread James Moe
On 04/09/2013 11:07 AM, Al wrote:
> I know it's not a php question, but I can't readily find the answer
> elsewhere.
> 
  Try <http://www.apache.org/foundation/mailinglists.html>.

-- 
James Moe
jmm-list at sohnen-moe dot com

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



[PHP] Does Scope-Resolution Operator Always Follow 'parent'?

2013-03-10 Thread Eric James Michael Ritz

Hello everyone,

I have a question about the `parent` keyword: is there any valid
situation where it can appear without the `::` operator following?

I am asking to fix a bug in php-mode[1] for GNU Emacs.  Consider the
following code:

echo $parent;
echo parent::$foo;
echo $this->parent;

The mode incorrectly highlights `parent` in the final line as if it
were the keyword, but PHP itself treats it as a member of an object.
My idea for fixing this incorrect syntax highlighting is to only treat
`parent` as a keyword if the `::` operator follows it.  But I want to
make sure that this assumption is correct.

Thanks in advanced for any help!


[1]: https://github.com/ejmr/php-mode

--
ejmr
南無妙法蓮華經

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



[PHP] A Recent Emacs Mode for PHP

2012-12-22 Thread Eric James Michael Ritz

Hello everyone,

I do not know how many PHP developers use GNU Emacs for writing code.
But I assume it must be a decent amount since there are multiple PHP
modes for Emacs floating around the Internet.  For months I have
worked to improve one of those modes, what seemed to be the most
popular: http://php-mode.sourceforge.net/

Of course, not all of the improvements are my own work.  Many people
have been kind enough to contribute bug fixes and features.  This is
the version of php-mode which I maintain:

https://github.com/ejmr/php-mode

I simply wanted to share this updated mode in case any developers
using Emacs find it useful.

--
ejmr
南無妙法蓮華經

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



Re: Re: [PHP] memory allocation error

2012-11-12 Thread James
> Original Message 
>From: James 
>To: "Carol Peck" , "Jim Lucas" 
>Cc: php-general@lists.php.net
>Sent: Mon, Nov 12, 2012, 12:53 PM
>Subject: Re: [PHP] memory allocation error
>
>This could be an issue with the library you're using, adodb, I'd check to see 
>if it has any debugging options to enable. I'm not familiar with it at all but 
>that may be helpful. I'd also check out adodbs bug tracker, if one exists. 
>Another suggestion would be use a profiler, such as xdebug, I believe thats 
>the name.
>
>Carol Peck  wrote:
>
>>Jim,
>>I just found that the die didn't fix it after all - just ran into it
>>again.
>>So still looking for ideas!
>>thanks,
>>
>>Carol
>>
>>On 11/12/2012 8:09 AM, Jim Lucas wrote:
>>> On 11/11/2012 08:45 AM, Carol Peck wrote:
>>>> Hi all,
>>>> I've been chasing around a memory allocation error for some time and
>>>> can't figure it out. It is somewhat random - I can run the script 3
>>>> times and then it will happen, or sometimes the first time.
>>>>
>>>> It happens at the very end of a script, actually after the script
>>has
>>>> finished running. I will see the following after the closing 
>>
>>>> tag:
>>>>
>>>> Fatal error: Allowed memory size of 268435456 bytes exhausted (tried
>>to
>>>> allocate 494142432 bytes) in Unknown on line 0
>>>>
>>>> Just previous to this my mem usage is 3772104
>>>>
>>>>
>>>> The script itself does some database work (deletes, inserts,
>>selects)
>>>> but nothing very heavy and writes out an XML file. I use adodb 5.18,
>>the
>>>> server is PHP 5.3.18 (this was updated recently) and it is a VPS on
>>>> inmotionhosting.com.
>>>>
>>>> As you can see, the memory limit is 256M so it's really high and I
>>never
>>>> see that I'm using more than 4M. The error doesn't fall through my
>>error
>>>> class - I'm assuming that's because it is happening after the script
>>is
>>>> complete.
>>>>
>>>> I am completely out of ideas on how to trap it or figure it out.
>>>> Any ideas would be appreciated!
>>>>
>>>>
>>>>
>>>>
>>>
>>> Try adding exit or die at the end of what you know is the end of your
>>
>>> scripts. See if the problem continues.  Maybe at the very end of your
>>
>>> customer error handler.
>>>
>>> If the problem stops showing up, you might want to look at your PHP
>>> config to see if anything is setup in the "auto_append_file" section.
>>>
>>
>>
>>--
>>PHP General Mailing List (http://www.php.net/)
>>To unsubscribe, visit: http://www.php.net/unsub.php
>
>--
>Sent from my Android phone with K-9 Mail. Please excuse my brevity.

Sorry for top posting.


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



Re: [PHP] memory allocation error

2012-11-12 Thread James
This could be an issue with the library you're using, adodb, I'd check to see 
if it has any debugging options to enable. I'm not familiar with it at all but 
that may be helpful. I'd also check out adodbs bug tracker, if one exists. 
Another suggestion would be use a profiler, such as xdebug, I believe thats the 
name.

Carol Peck  wrote:

>Jim,
>I just found that the die didn't fix it after all - just ran into it
>again.
>So still looking for ideas!
>thanks,
>
>Carol
>
>On 11/12/2012 8:09 AM, Jim Lucas wrote:
>> On 11/11/2012 08:45 AM, Carol Peck wrote:
>>> Hi all,
>>> I've been chasing around a memory allocation error for some time and
>>> can't figure it out. It is somewhat random - I can run the script 3
>>> times and then it will happen, or sometimes the first time.
>>>
>>> It happens at the very end of a script, actually after the script
>has
>>> finished running. I will see the following after the closing 
>
>>> tag:
>>>
>>> Fatal error: Allowed memory size of 268435456 bytes exhausted (tried
>to
>>> allocate 494142432 bytes) in Unknown on line 0
>>>
>>> Just previous to this my mem usage is 3772104
>>>
>>>
>>> The script itself does some database work (deletes, inserts,
>selects)
>>> but nothing very heavy and writes out an XML file. I use adodb 5.18,
>the
>>> server is PHP 5.3.18 (this was updated recently) and it is a VPS on
>>> inmotionhosting.com.
>>>
>>> As you can see, the memory limit is 256M so it's really high and I
>never
>>> see that I'm using more than 4M. The error doesn't fall through my
>error
>>> class - I'm assuming that's because it is happening after the script
>is
>>> complete.
>>>
>>> I am completely out of ideas on how to trap it or figure it out.
>>> Any ideas would be appreciated!
>>>
>>>
>>>
>>>
>>
>> Try adding exit or die at the end of what you know is the end of your
>
>> scripts. See if the problem continues.  Maybe at the very end of your
>
>> customer error handler.
>>
>> If the problem stops showing up, you might want to look at your PHP 
>> config to see if anything is setup in the "auto_append_file" section.
>>
>
>
>-- 
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, visit: http://www.php.net/unsub.php

-- 
Sent from my Android phone with K-9 Mail. Please excuse my brevity.

Re: [PHP] Differences

2012-10-03 Thread James
All of the images are displaying because you're simply instructing the function 
to print out each file found with your call to glob(). The glob() function 
returns an indexed array containing files found in the path you specified, or 
an empty array if no files were found or false if glob() failed. When I say 
"print" I'm referring to you using the echo language construct, however, print 
is also another language construct.

Therefore using echo in your function allows the foreach loop to continue 
iterating through the array of files returned by glob(). Replacing that echo 
with the return, the function ones one iteration in the foreach loop and stops, 
returning that value. In your case, the function is returning index 0 of the 
array returned by glob().

Make more sense?

David McGlone  wrote:

>On Wednesday, October 03, 2012 08:55:29 PM admin wrote:
>> > Hi everyone, I have been playing around with some code the list
>helped me
>> 
>> with a while back and I'm not grasping the concept between return and
>echo
>> and the PHP manual doesn't answer this, unless I'm missing something.
>There
>> is an > example at the very bottom of PHP's return manual, but it's
>> confusing.
>> 
>> > So now I'm left wondering why return will only give me the first
>result in
>> 
>> an array, but echo will give me all the results of the array. Using
>stuart's
>> example he had sent me a while back I've messed around with it and
>modified
>> it > to better understand it:
>> > function filename($prefix)
>> >
>> >{
>> >
>> >  $matches = glob('images/property_pics/'.$prefix.'*');
>> >  foreach($matches as $filename){
>> >  return $filename;
>> >  
>> > }
>> >
>> >}
>> >
>> >echo completeImageFilename($row['MLS_No']);
>> >
>> >With the above code I only get the first image of each picture name,
>but
>> 
>> when I change return to echo, it groups and displays all the pics
>that have
>> the same picture name.
>> 
>> >--
>> >David M.
>> 
>> The first loop and return is all you will get.
>> Put the information into an array and return the array once the array
>is
>> built.
>
>I think I understand what your saying, but what I don't understand is
>that 
>when I leave the current code intact and replace return $filename with
>echo 
>$filename in the function, all the images display. Is this intended
>behavior 
>between return and echo or is it just bad code on my part?
>
> -- 
>David M.

-- 
Sent from my Android phone with K-9 Mail. Please excuse my brevity.

[PHP] How to catch an exception using SoapClient.

2012-08-06 Thread James Newman
I was wondering how I'd catch an exception using SoapClient.



$data = array(
'Particular'=>'Payment for stuff',
 'Email' =>'e mail address',
 'CardNumber'=>'0000,
'CardType' =>'MC',
 'CardExpiry'=>'0423',
'CardHolderName'=>'James Newman',
 'CardCSC' =>'111',
'StoreCard' =>'true'
 );
 $vars = array(
 'trace' => 1,
'exceptions' => true,
'cache_wsdl' => WSDL_CACHE_NONE,
'features' => SOAP_SINGLE_ELEMENT_ARRAYS);
 $client = new SoapClient("http://XMLSERVICEURLws/paymentws.asmx?WSDL";,
$vars);

#$out = $client->ListCards($text);
 #$this->_result = $client->ProcessPurchase($data);
$this->_result = $client->ProcessAuthorise($data);
 #var_dump($client->__getLastRequestHeaders());
#var_dump($client->__getTypes());
 print_r($this->_result);


Re: [PHP] Creating drop-down menus

2012-07-17 Thread James Newman
Just to put my 2cents in, you might want to try jQuery if you're going to
go down the AJAX road.

James.

On Wed, Jul 18, 2012 at 1:59 AM, Ramiro Barrantes <
ram...@precisionbioassay.com> wrote:

> Thanks to everyone for their help, AJAX is the way to go.
>
> Daevid, it's interesting you welcome me to the year 2000, I actually
> graduated from CS in 1999 and haven't really done much more than simple
> web-programming since (have done scientific programming instead), so I am
> definitely behind the times!!!
>
> 
> From: Jen Rasmussen [j...@cetaceasound.com]
> Sent: Monday, July 16, 2012 4:19 PM
> To: Ramiro Barrantes; php-general@lists.php.net
> Subject: RE: [PHP] Creating drop-down menus
>
> -Original Message-
> From: Ramiro Barrantes [mailto:ram...@precisionbioassay.com]
> Sent: Monday, July 16, 2012 3:17 PM
> To: php-general@lists.php.net
> Subject: [PHP] Creating drop-down menus
>
> Hello,
>
> I am making an application using PHP/Javascript/mysql and had a question.
>
> Sometimes I need to use javascript to fill a drop down box based on the
> value of a previous drop down box.  However, the information to fill the
> latter is stored in mysql and can be a lot, what I have been doing is that,
> using PHP, I create hidden fields with all the possible information that
> might be needed to fill the second drop down.
>
> For example, the user chooses a bank from a drop down, and then a list of
> clients is displayed on the following drop down.  I use PHP to read all
> clients from all the banks and put that as hidden fields on the html page.
> It is very cumbersome.
>
> I do not want to read the database (which changes dynamically) from
> javascript directly due to confidentiality and because a lot of care has
> been taken to create the appropriate  queries with checks and protect
> misuse
> of the information using PHP.
>
> My questions are:
> 1) Do people just normally use hidden fields to store possible information
> to fill the drop downs?
> 2) any suggestions?
>
> Thanks in advance,
> Ramiro
>
> **
>
> You could also store the information as a session variable.
>
> Jen
>
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


Re: [PHP] SOAP and Php question about authentication

2012-07-17 Thread James Newman
I agree with your response, the payment gateway insists that the
authentication I have been given is correct.  My question was more around
"was I using the function correctly".  It says authentication failed but
I've followed he documentation to the letter. Is there a way I can output
what the server is saying when a request is sent?

On Wed, Jul 18, 2012 at 2:32 AM, Curtis Maurand  wrote:

>
>
>
> That's not a helpful answer.  I'd be curious at a real answer
> for this, too.  I'm sure that there is something going on with
> session management on the client side as authentication has probably
> already happened, but the author doesn't know how to handle the response
> to the authentication correctly.
>
> --Curtis
>
> Matijn
> Woudt wrote:
> > Op 17 jul. 2012 05:23 schreef "James
> Newman"
> > 
> >
> het volgende:
> >>
> >> I'm having a few authentication
> issues and I'm not sure if it's my code
> >> or
> >> the
> web service I'm connecting to.  The code below shows what I'm
> >> working
> >> with not sire if I'm going about it the
> right way.
> >>
> >> This is the error I get!
> >>
> >> Fatal error: Uncaught SoapFault exception:
> [soap:Client]
> >> System.Web.Services.Protocols.SoapException:
> Authentication error.
> > Username
> >> and/or Password are
> incorrect at
> >
> > Really.. have you had a look at your
> error before mailing it to this list?
> > This error looks pretty
> clear to me..
> >
> > - Matijn
> >
>


[PHP] SOAP and Php question about authentication

2012-07-16 Thread James Newman
I'm having a few authentication issues and I'm not sure if it's my code or
the web service I'm connecting to.  The code below shows what I'm working
with not sire if I'm going about it the right way.

This is the error I get!

Fatal error: Uncaught SoapFault exception: [soap:Client]
System.Web.Services.Protocols.SoapException: Authentication error. Username
and/or Password are incorrect at
F2CPaymentWS.Shared.Exceptions.ExceptionManager.RaiseSoapException(String
ErrorMessage, Int32 ErrorNumber, ExceptionType Type, FaultCode WhosFault,
String Method) at F2CPaymentWS.PaymentWS.ProcessPayment(String Username,
String Password, Int32 TxType, Int32 AccountId, Decimal Amount, String
Reference, String Particular, String Email, String CardNumber, String
CardType, String CardExpiry, String CardHolderName, String CardCSC, Boolean
StoreCard) at F2CPaymentWS.PaymentWS.ProcessPurchase(String Username,
String Password, Int32 AccountId, Decimal Amount, String Reference, String
Particular, String Email, String CardNumber, String CardType, String
CardExpiry, String CardHolderName, String CardCSC, Boolean StoreCard) in
C:\Development\website\includes\class\Flo2cash_API.php:50 Stack trace: #0
C:\Development\allaboutauckland.com\includes\class in
C:\Development\website\includes\class\Flo2cash_API.php on line *50*
*
*
Can someone point me in the right direction?

$data = array(
'Username' =>'',
 'Password' =>'',
'AccountId' =>'',
 'Amount' =>'10.00',
'Reference' =>'00010',
 'Particular'=>'Test Payment',
'Email' =>'james.new...@gmail.com',
 'CardNumber'=>'5123456789012346',
'CardType' =>'MC',
 'CardExpiry'=>'0513',
'CardHolderName'=>'JamesNewman',
 'CardCSC' =>'111',
'StoreCard' =>'true'
 );
 $vars = array(
 'login'=> '',
'password' => '',
 'trace' => 1,
'exceptions' => true,
'cache_wsdl' => WSDL_CACHE_NONE,
'features' => SOAP_SINGLE_ELEMENT_ARRAYS);
 $client = new SoapClient("http://demo.flo2cash.co.nz/ws/paymentws.asmx?WSDL";,
$vars);
 $text = array('Username' =>'',
  'Password' =>'',
  'AccountId' =>'',
  'Amount' =>'10.00',
  'StoreCard' =>'false');

$out = $client->ProcessPurchase($data);
 var_dump($client->__getFunctions());
var_dump($client->__getLastRequestHeaders());
 var_dump($client->__getTypes());
print_r($client);
  exit;


Re: Re: [PHP] else if vs switch

2012-06-18 Thread James
> Original Message 
>From: April Mains 
>To:
>Cc: "PHP-General list" 
>Sent: Mon, Jun 18, 2012, 9:41 AM
>Subject: Re: [PHP] else if vs switch
>
>This is what I had been using as the check based on the code that had been
>there previously and along with an email validator that sets $email to ""
>if the address isn't valid. The purpose of the form is lead generation. The
>last bit is to prevent spammers from entering urls in the class text box.
>
>iif (($name == "") || ($email == "") || ($phone =="") || ($city=="Select
>your city") || ($class=="") ||
>preg_match("/[^A-Za-z0-9-\\s\\(\\)\\?\\:\\;@\\.™\\,\\–\\&'\\t]/uis",
>$class))
>{...}
>
>Does this do the same thing as isset? Would isset be better?
>
>April
>
>On Sun, Jun 17, 2012 at 7:41 PM, James  wrote:
>
>> Same logical check with my personal preference ;)
>>
>> $toaddress = $mapping['default'];
>>
>> if ( isset($city) && isset($mapping[$city]) ) { ... }
>>
>> --
>> Sent from my Android phone with K-9 Mail. Please excuse my brevity.
>>
>> Jim Lucas  wrote:
>>>
>>> On 6/15/2012 3:29 PM, Joshua Kehn wrote:
>>> > Way easier to just use a map.
>>> >
>>> > $mapping = array(
>>>
>>> >   'Calgary' =>  "abc@emailaddress",
>>> >   'Brooks' =>  "def@emailaddress",
>>> >   // etc
>>> > );
>>> > $toaddress = $mapping[$city];
>>>
>>> I would use this, but add a check to it.
>>>
>>> $mapping = array(
>>>'default' => 'defa...@domain.tld',
>>> ...
>>> );
>>>
>>> ...
>>>
>>> if ( isset($mapping[$city]) ) {
>>>$toaddress = $mapping[$city];
>>>
>>> } else {
>>>$toaddress = $mapping['default'];
>>>
>>> }
>>>
>>> Jim
>>>
>>> --
>>> PHP General Mailing List (http://www.php.net/)
>>> To unsubscribe, visit: http://www.php.net/unsub.php
>>>
>>>
>>>


Technically, no, that's not the same as using isset(). The isset() function 
determines if the variable is set and is not NULL. Your checks, for example, 
will throw a PHP Notice if any one of those variables were never initialized in 
the scope of your script. If you're not going to initialize your variables 
before performing the check, then using isset() would be ideal. However, for 
the sake of correctness, I'd recommend you either initialize your variables or 
use isset(). Take a look at the empty() function in PHP, it may suit your 
needs. http://us3.php.net/manual/en/function.empty.php.

PHP Notice message example:
[18-Jun-2012 13:43:20 UTC] PHP Notice:  Undefined variable: name in 
/root/test.php on line 2

Example of variable initialization

$name = "";
$email = "";
$phone = "";
$city = "Select your city";
$class = "";

James


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



Re: [PHP] else if vs switch

2012-06-17 Thread James
Same logical check with my personal preference ;)

$toaddress = $mapping['default'];

if ( isset($city) && isset($mapping[$city]) ) { ... }

-- 
Sent from my Android phone with K-9 Mail. Please excuse my brevity.

Jim Lucas  wrote:

On 6/15/2012 3:29 PM, Joshua Kehn wrote:
> Way easier to just use a map.
>
> $mapping = array(
>   'Calgary' => "abc@emailaddress",
>   'Brooks' => "def@emailaddress",
>   // etc
> );
> $toaddress = $mapping[$city];

I would use this, but add a check to it.

$mapping = array(
'default' => 'defa...@domain.tld',
...
);

...

if ( isset($mapping[$city]) ) {
$toaddress = $mapping[$city];
} else {
$toaddress = $mapping['default'];
}

Jim

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




Re: [PHP] else if vs switch

2012-06-15 Thread James Yerge
On 06/15/2012 06:44 PM, April Mains wrote:
> Ah yes that's it. 
>
> Thank you for your help. Have a good weekend.
>
> April
>
> On 2012-06-15, at 4:29 PM, Joshua Kehn wrote:
>
>> Way easier to just use a map.
>>
>> $mapping = array(
>>  'Calgary' => "abc@emailaddress",
>>  'Brooks' => "def@emailaddress",
>>  // etc
>> );
>> $toaddress = $mapping[$city];
>>
>> Regards,
>>
>> –Josh
>> 
>> Joshua Kehn | @joshkehn  
>> http://joshuakehn.com
>>
>> On Jun 15, 2012, at 6:20 PM, April Mains wrote:
>>
>>> I have 25 cities and am currently using the following to set the $toaddress 
>>> for submitting student pre-registration forms based on the city selected:
>>>
>>> if ($city == "Calgary") {
>>>$toaddress = "abc@emailaddress";
>>> } elseif ($city == "Brooks") {
>>>$toaddress = "def@emailaddress";
>>>
>>> and so on.
>>>
>>>
>>> Would using switch statements like the following make any appreciable 
>>> difference?
>>>
>>> switch ($city) {
>>>case"Calgary":
>>>$toaddress = "abc@emailaddress";
>>>break;
>>>case"Brooks":
>>>$toaddress = "def@emailaddress";
>>>break;
>>>
>>>and so on.
>>>
>>> Is there a more elegant solution?
>>>
>>> Thank you for your help,
>>>
>>> April
>>> --
>>> PHP General Mailing List (http://www.php.net/)
>>> To unsubscribe, visit: http://www.php.net/unsub.php
>>>
>

If a database solution isn't desired, check out the parse_ini_file()
function. You can create a simple INI file containing the necessary
mappings and, instead of having to touch the code every time you need to
update a record, you simply modify the INI file.

Another solution would be to use Joshua's suggestion but instead of
managing the array in the PHP file using that array, throw the array in
a separate PHP file and simply require_once() it.

Of course, these solutions assume that the PHP script reading the INI
file or including the PHP that contains the array has the appropriate
file permissions to do so.

Just my two cents :)

- James

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



Re: [PHP] Exception Handling

2012-06-01 Thread James Colannino
On Fri, Jun 1, 2012 at 12:51 PM, Marco Behnke  wrote:

Ah, I guess that is the problem. Your application framework uses namespaces.
> I guess you should try
>
> catch (\Exception $e)
>
> instead of
>
> catch (Exception $e)
>
> :-)
>

Ah, that was probably it.  Will try it out tonight to confirm.  Thanks!

James


Re: [PHP] Exception Handling

2012-06-01 Thread James Colannino

On 06/01/12 07:32, Mackintosh, Mike wrote:

Hi James,

You would have to catch Database_Exception. It is also good practice to
also always catch exception afterwards.



Hey Mike,

Thanks for the reply!  I saw this comment in the documentation 
(http://www.php.net/manual/en/language.exceptions.extending.php) -- it's 
the first one:


"|It's important to note that subclasses of the Exception class will be 
caught by the default Exception handler"


Of course, I haven't tested the code they posted.  I'll do that tonight 
and confirm or deny the expected result.


James
|


Re: [PHP] Exception Handling

2012-06-01 Thread James Colannino

On 06/01/12 08:08, James Colannino wrote:

On 06/01/12 07:30, ma...@behnke.biz wrote:

James Colannino  hat am 1. Juni 2012 um 16:25
geschrieben:

Hey guys,

Haven't posted in a long time...  Happy Memorial Day!  I have an issue
with exception handling.  I'm using a framework that throws a
"Database_Exception" object.  I was expecting catch (Exception $var) to
be sufficient to catch this, but it doesn't.  I have to do catch
(Database_Exception $var) to make it work.  I've been reading that
Exception should be sufficient, since every exception object is a child
class of Exception.  Did this perhaps change in 5.4?  I think it was
working properly in 5.3, but I'm not sure.
Look at the definition of "Database_Exception" and see if it extends 
Exception,

I'll guess it doesn't.
Nothing changed in PHP 5.4 to that.



Hey Marco,

Thanks for the reply!  That was the first thing I checked.

class Database_Exception extends \FuelException {}
class Fuel_Exception extends \Exception {}

It's extending Exception, as expected.  Also, can you throw classes 
that don't extend Exception?  It was always my understanding that 
doing so would cause a fatal error.


I was right.  From the documentation 
(http://php.net/manual/en/language.exceptions.php):


"The thrown object must be an instance of the Exception 
<http://www.php.net/manual/en/class.exception.php> class or a subclass 
of Exception <http://www.php.net/manual/en/class.exception.php>. Trying 
to throw an object that is not will result in a PHP Fatal Error."


James


Re: [PHP] Exception Handling

2012-06-01 Thread James Colannino

On 06/01/12 07:30, ma...@behnke.biz wrote:

James Colannino  hat am 1. Juni 2012 um 16:25
geschrieben:

Hey guys,

Haven't posted in a long time...  Happy Memorial Day!  I have an issue
with exception handling.  I'm using a framework that throws a
"Database_Exception" object.  I was expecting catch (Exception $var) to
be sufficient to catch this, but it doesn't.  I have to do catch
(Database_Exception $var) to make it work.  I've been reading that
Exception should be sufficient, since every exception object is a child
class of Exception.  Did this perhaps change in 5.4?  I think it was
working properly in 5.3, but I'm not sure.

Look at the definition of "Database_Exception" and see if it extends Exception,
I'll guess it doesn't.
Nothing changed in PHP 5.4 to that.



Hey Marco,

Thanks for the reply!  That was the first thing I checked.

class Database_Exception extends \FuelException {}
class Fuel_Exception extends \Exception {}

It's extending Exception, as expected.  Also, can you throw classes that 
don't extend Exception?  It was always my understanding that doing so 
would cause a fatal error.


James

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



[PHP] Exception Handling

2012-06-01 Thread James Colannino

Hey guys,

Haven't posted in a long time...  Happy Memorial Day!  I have an issue 
with exception handling.  I'm using a framework that throws a 
"Database_Exception" object.  I was expecting catch (Exception $var) to 
be sufficient to catch this, but it doesn't.  I have to do catch 
(Database_Exception $var) to make it work.  I've been reading that 
Exception should be sufficient, since every exception object is a child 
class of Exception.  Did this perhaps change in 5.4?  I think it was 
working properly in 5.3, but I'm not sure.


Any clarification would be greatly appreciated!

James

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



[PHP] Setting allow_url_fopen

2012-05-26 Thread James Moe
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Hello,
  php 5.2.2

  I have need of a remote procedure call the requires
"allow_url_fopen" to be enabled. The remote call works fine on my test
system which does have allow_url_fopen enabled.
  So I thought, "This is a job for ini_set()." It did not work. :-(
  $oldval = ini_set("allow_url_fopen", 1);
  The remote call is made after the above statement. Clearly there is
more to it than I expected.
  What is the correct way to allow URL fopen on the fly?

- -- 
James Moe
moe dot james at sohnen-moe dot com
520.743.3936
-BEGIN PGP SIGNATURE-
Version: GnuPG v2.0.18 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk/Ag00ACgkQzTcr8Prq0ZNpqACgsPg1UcmiXcxxWYhvl0XaUi7N
KDMAn29qcLCYdVDGWWYGTqZhToRtJRfA
=gnCT
-END PGP SIGNATURE-

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



Re: [PHP] Your Citi Credit Card Statement

2012-05-10 Thread James
> Original Message 
>From: "Citi Cards" 
>To: php-general@lists.php.net
>Sent: Thu, May 10, 2012, 1:19 PM
>Subject: [PHP] Your Citi Credit Card Statement
>
>Your Citi Credit Card Statement
>   
> 
>   
> 
>   
>   
> 
>   
>   Add citica...@info.citibank.com to your address book to ensure 
> delivery.
>
>Your Account: Important Notification
>
>
>   
>  Your Citi Credit Card statement is ready to view online
>   
>   
> Dear Cardholder, Your Citi Credit Card statement is now available for you 
> to view online.  Here are some key pieces of information from your 
> statement:Statement Date:May 10, 2012
>Statement Balance:$4815.29
>Minimum Payment Due:$2472.97
>Payment Due Date:June   7, 2012
>Want help remembering your payment due date? Sign up for automated alerts such 
>as Payment Due reminders with Alerting Service.To set up alerts sign on to 
>www.citicards.com and go to Account Profile.I prefer not to have this email 
>contain specific information from my statement.  Please send me just the 
>announcement that my statement is ready to view online. 
>
>   
>
>
>
>
> Privacy | Security
>
>Email PreferencesThis 
> message is from Citi Cards.Your credit card is issued by 
> Citibank, N.A.If you'd like to refine the types of email 
> messages you receive, or if you'd prefer to stop receiving email from us, 
> please go to:http://www.email.citicards.com.  
>   Citibank manages email preferences by line of business. 
> Changing your email preferences with Citi Cards does not change your email 
> preferences for messages from Citibanks other businesses which include retail 
> branch banking among others. 
> Should you want to contact us in writing concerning this email, please direct 
> your correspondence to:Citibank Customer 
> ServiceP. O. Box 6500Sioux Falls, SD 57117
>   Help / Contact Us   If 
> you have questions about your account, please use our secure message center 
> by signing on at www.citicards.com and 
> choosing "Contact Us" from the "Help / Contact Us" menu. You can also call 
> the customer service phone number on the back of your card.   
>  
>© 2012 Citibank, N.A. 
>  All rights reserved.  Citi, Citibank and Citi with 
> Arc Design are registered service marks of Citigroup Inc. 
>20120421C1050004
> 0/L0/050004/001/ZZ/SY/ZP/8000/SYSTEMB /I2012042100166572/24968


Time to start a donation thread? Appears PHP hasn't been keeping up with it's 
bills :P


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



[PHP] Adding Rows In PHPMYADMIN

2012-04-02 Thread Karl James
Hello,

 

Hey guys, I figured out my critical error. I have a table that has a limit
of 30 rows.

How can I add more rows to a table so that we can upload more images?

Below is what I need to change.

 

Thanks, karl

 

 


Indexes:
<http://dev.mysql.com/doc/refman/5.0/en/optimizing-database-structure.html>
Description: Documentation


Keyname

Type

Cardinality

Action

Field


PRIMARY

PRIMARY

30 

 
<http://www.axiton.com:444/phpMyAdmin/tbl_indexes.php?db=axiton&table=produc
t&token=879a7b6914f690825a521dd29c2f0736&goto=tbl_structure.php&back=tbl_str
ucture.php&index=PRIMARY&phpMyAdmin=0b5ebd941a4bbe87db1e38f60fd10dadec30e8e7
> Description: Edit

 
<http://www.axiton.com:444/phpMyAdmin/sql.php?db=axiton&table=product&token=
879a7b6914f690825a521dd29c2f0736&goto=tbl_structure.php&back=tbl_structure.p
hp&sql_query=ALTER+TABLE+%60product%60+DROP+PRIMARY+KEY&zero_rows=The+primar
y+key+has+been+dropped&phpMyAdmin=0b5ebd941a4bbe87db1e38f60fd10dadec30e8e7>
Description: Drop

product_id

    

 

 

 

 <mailto:karlja...@tampabay.rr.com> Karl James

"Need Web Design" Check Out

My Site:  <http://kjwebsitedesign.com/> http://kjwebsitedesign.com

"Flexible in Cost, Time, and Service."

 



[PHP] PHP ISSUE!!!

2012-04-01 Thread Karl James
Is anyone online at the moment.

I need help with a phpmyadmin table issue.

I get a critical error when I try to upload images

>From the web portal admin page.

I can send you a screen shot and allow you access to

The database to help out. Some have told me this is 

A Auto_increment issue, but this table I think has it turned

On if I am reading the website correctly on the options section/tab.

 

MYSQL: duplicate entry '0' for key 1.

MYSQL: Insert Error - Duplicate entry '0' 

 

Can anyone help me walk me through step by step.

I know it's a simple setting I am missing. 

Can anyone please help me at the moment.

OF course you can email instantly then maybe chant via

FB or Aim...Need help really fast.

If I can do this I can get job doing web design and possibly

Reach my goal and be a web designer.

I just really do not know phpmyadmin that well to fix issues like this yet.

 

 

 

 

 

 <mailto:karlja...@tampabay.rr.com> Karl James

 



[PHP] Critical Error

2012-03-28 Thread Karl James
Hey guys,

 

A customer of mind is having issues uploading photos through

A admin portal page. They get "Critical Error"

 

They also get spit out these errors.

 

MYSQL: Duplicate entry for '0' for key 1.

MYSQL: Insert Error - Duplicate entry '0' for key 1,.

 

This person is using a web form to upload his photos to this website.

www.axiton.com admin page.

 

He is trying to add photos up to the Products>accessories.

 

I did a search on google and some articles are to delete the table?

That doesn't make sense.

Pretty sure it had something to do with the primary key, right?

Now keep in mind as some of you I do not claim to be a know php very well.

Just beginning stages.

I wanted  to send a screen shot but don't want to get email bounced.

Any help would be appreciated.

 

 <mailto:karlja...@tampabay.rr.com> Karl James

 



Re: Re: [PHP] Why does this script run out of memory?

2011-10-28 Thread James
> Original Message 
>From: Eric Butera 
>To: "Jim Long" 
>Cc: php-general@lists.php.net
>Sent: Fri, Oct 28, 2011, 1:22 PM
>Subject: Re: [PHP] Why does this script run out of memory?
>
>On Fri, Oct 28, 2011 at 12:38 PM, Jim Long  wrote:
>> I'm running PHP 5.3.8 on FreeBSD 8.2 with MySQL 5.1.55.
>>
>> The script below is designed to be able to WHILE it's way through
>> a MySQL query result set, and process each row.
>>
>> However, it runs out of memory a little after a quarter million
>> rows.  The schema fields total to about 200 bytes per row, so
>> the row size doesn't seem very large.
>>
>> Why is this running out of memory?
>>
>> Thank you!
>>
>> Jim
>>
>> >
>> $test_db_host = "localhost";
>> $test_db_user = "foo";
>> $test_db_pwd  = "bar";
>> $test_db_name = "farkle";
>>
>> $db_host = $test_db_host;
>> $db_user = $test_db_user;
>> $db_name = $test_db_name;
>> $db_pwd  = $test_db_pwd;
>>
>> if (!($db_conn = mysql_connect( $db_host, $db_user, $db_pwd )))
>>        die( "Can't connect to MySQL server\n" );
>>
>> if (!mysql_select_db( $db_name, $db_conn ))
>>        die( "Can't connect to database $db_name\n" );
>>
>> $qry = "select * from test_table order by contract";
>>
>> if ($result = mysql_query( $qry, $db_conn )) {
>>
>>        $n = 0;
>>        while ($row = mysql_fetch_assoc( $result )) {
>> // process row here
>>                $n++;
>>        } // while
>>
>>        mysql_free_result($result);
>>        echo "$n\n";
>>
>> } else {
>>
>>        die( mysql_error() . "\n" );
>>
>> }
>>
>> ?>
>>
>>
>> PHP Fatal error:  Allowed memory size of 134217728 bytes exhausted (tried to 
>> allocate 20 bytes) in xx3.php on line 24
>>
>> Line 24 is:
>>
>>    24          while ($row = mysql_fetch_assoc( $result )) {
>>
>>
>> --
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>>
>
>Not sure what is happening inside "process row here," but I'm sure
>that is where your issue is.  Instead of building some giant structure
>inside of that while statement you should flush it out to the screen.
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, visit: http://www.php.net/unsub.php

Try unsetting the $row variable, you may be fetching extremely large rows but 
that's a big if, because your script is allowed to allocate 128MB of memory 
before puking. Are you dealing with very large data sets from the database? If 
you are dealing with large data sets, then try redefining your query.




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



Re: [PHP] Need help Wth PHP

2011-10-09 Thread James Yerge
On 10/09/2011 08:41 PM, Rod Lindgren wrote:
> I have a hosting account and am trying to get a friend's website up and
> running. We downloaded his existing site from his current host and uploaded
> it to my host. It is currently under a subdomain, www.egypt.aragren.com
>  . When I go there, I get an error message
> that says, "Error establishing a database connection." What causes this and
> how can I fix it? 
>
>
>  
>
> Sensei Rod Lindgren
>
>  
>
> Sent from my Gateway computer
>
>  
>
>  
>
>
This issue isn't related to PHP but the cause of the error is due to the
scripts' inability to make a connection to the database. The error looks
like it's coming from WordPress, I could be wrong but if that's the case
then you need to update the wp-config.php file to reflect the proper
credentials to log into the database.

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



[PHP] PHP process 32 v 64 bit virtual memory

2011-09-22 Thread James
Looking for some explanation (and verification) as to why the virtual memory 
increases by 5 fold (at the minimum) from 32 bit to 64 systems. I'm aware (for 
the most part) of the int, struct, etc changes from 32 to 64 bit. Results from 
running `php -r 'sleep(1000);' &` on 32 and 64 bit systems are below. PHP was 
built by hand.


32 bit
System => Linux kronos 2.6.18-194.el5 #1 SMP Tue Mar 16 21:52:43 EDT 
2010 i686
Build Date => Sep 22 2011 08:50:40
Configure Command =>  './configure'  '--prefix=/opt/php'

Test: php -r 'sleep(1000);' &
root  4863  0.0  0.1   7064  1064 ?Ss   08:21   0:00 
/usr/sbin/sshd
root  5403  0.0  1.0  17736 11048 ?Ss   08:28   0:00  
\_ sshd: root@pts/1
root  5418  0.0  0.1   4540  1488 pts/1Ss   08:28   0:00
  \_ -bash
root  2340  0.0  0.3  13240  3288 pts/1S08:53   0:00
  \_ /opt/php/bin/php -r sleep(1000);
root  2341  0.0  0.0   4224   872 pts/1R+   08:53   0:00
  \_ ps axuf

64 bit
System => Linux ceous 2.6.18-194.el5 #1 SMP Tue Mar 16 21:52:39 EDT 
2010 x86_64
Build Date => Sep 22 2011 08:51:02
Configure Command =>  './configure'  '--prefix=/opt/php'

Test: php -r 'sleep(1000);' &
root  5181  0.0  0.1  62608  1220 ?Ss   08:22   0:00 
/usr/sbin/sshd
root  5724  0.0  1.5 102020 15620 ?Ss   08:27   0:00  
\_ sshd: root@pts/1
root  5726  0.0  0.1  66064  1608 pts/1Ss   08:28   0:00
  \_ -bash
root  2019  0.0  0.4  88864  4200 pts/1S08:54   0:00
  \_ /opt/php/bin/php -r sleep(1000);
root  2021  0.0  0.0  65592   924 pts/1R+   08:54   0:00
  \_ ps axuf


32 v. 64 virtual memory difference: 75624


Thanks!


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



[PHP] Re: XML enabled but not working

2011-09-16 Thread James Moe
On 09/15/2011 01:20 PM, Matthew Pounsett wrote:
> 
> I seems to behaving issues with php5 on one particular server, and I haven't 
> been able to find the issue.  Basically, php says XML is enabled, but xml 
> functions are missing.
> 
>> php -i | grep "XML support"
> libXML support => active
> 
  Perhaps you need to install libxml[2]?

-- 
James Moe
jmm-list at sohnen-moe dot com

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



Re: [PHP] What would you like to see in most in a text editor?

2011-09-13 Thread James Yerge
On 09/13/2011 08:40 PM, Jim Lucas wrote:
> On 9/13/2011 5:23 PM, tamouse mailing lists wrote:
>> On Tue, Sep 13, 2011 at 3:35 PM, Robert Cummings  
>> wrote:
>>> I'm a big fan of editors that work in the terminal.
>> You'll get my emacs when you pry it out of my cold dead hands.
>>
> +1
>
> mg too
>
>
>

I'd have to go agree with the exception of s/emacs/vi/ :P

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



Re: [PHP] dev to production server

2011-09-07 Thread James Yerge
On 09/07/2011 12:24 AM, Chris Stinemetz wrote:
> Does anyone have a procedure or know of any tutorials that explain how
> to take a mac/apache/php/mysql dev environment and converting it to
> production environment?
>
> Basically I want to host my own web site on my local machine now that
> I have finished developing it.
>
> Thanks in advance!
>

I'm not familiar with MAC, however, there are projects out there that
provide everything you need, for the most part. Look up XAMPP, I used to
use this in the past before I setup my own personal server.

http://www.apachefriends.org/en/xampp-macosx.html

This should provide you with an environment necessary for development
and production. I currently run Arch Linux on my personal server and
have installed Apache, PHP, MySQL and so on via the package manager. For
my dev/prod process, I'm using Boilerplate, which provides a default
HTML5/CSS3 template. However, the nice thing about it is, they've also
provided a small build process using ANT. I've modified the ANT build
script to my needs and simply build my production environment using
that, keeping my dev code in tact and readable :) They've integrated the
YUI Compressor into their build process is simply minifies all CSS and
JavaScript.

Anyway, enough about that, just an example of what can be done. There's
always the option of compiling everything from source as well :)

James


Re: [PHP] REQUEST and COOKIE

2011-09-06 Thread James Yerge
On 09/06/2011 05:47 PM, ALEJANDRO ZAPIOLA wrote:
> Seeing the $_REQUEST[] and it is a matrix that has the content of $_GET,
> $_POST and $_COOKIE, I think this can be used maliciously into the script.
> i.e.:
> request1.php
>  setCookie("name","alejandro");
> echo "location.href='request2.php'";
> ?>
>
> In this case, I'm setting the variable 'name' with value 'Alejandro', then
> redirects to request2.php
> request2.php
> ?php
> print_r($_COOKIE);
> echo "";
> print_r($_REQUEST);
> echo "";
> if(@$_REQUEST['name'] == "admin"){
> echo "I am admin";
> }else{
> echo "You can not see this page";
> }
> ?>
>
> Here's the problem. The variable called 'name' is into REQUEST context, and
> this is accessible by GET and POST methods, and it is accessible by the
> COOKIE matrix as well. In this case, use Request is unsafe because I can
> change the variable called 'name' via GET method and it's give me access as
> admin.
>
> Mi question is: I do not see the good practice of using COOKIE values into
> of REQUEST, what I mean is that it can become in a programming bug. Also I
> could not fin answers anywhere else.
>
> thoughts?
> Thanks!
>


Why would you use this method to for authentication or validation? By
default, $_REQUEST is populated with the $_GET, $_POST and $_COOKIE
contents, which could potentially be modified by the remote user, which
in turns makes the data not trustworthy.

Never trust input data, ever, it must be sanitized, scrubbed, etc before
even considering it trustworthy - in my opinion.

As for your question, it makes complete sense to populate $_REQUEST with
$_GET, $_POST and $_COOKIE contents by default because the three call in
the REQUEST category for the HTTP protocol. Since the cookie was sent by
the server, the COOKIE header is going to be evident in the REQUEST headers.

Therefore, the only way a bug is going to be introduced and security
breached is by the author of the code ;)

http://us.php.net/manual/en/reserved.variables.request.php

The PHP team even makes mention that the contents of $_REQUEST cannot be
trusted.

James


Re: Re: [PHP] Re: mysqli sql question

2011-08-31 Thread james
> Original Message 
>From: Louis Huppenbauer 
>To: php-general@lists.php.net
>Sent: Wed, Aug 31, 2011, 10:24 AM
>Subject: Re: [PHP] Re: mysqli sql question
>
>Hi there Richard
>
>It's part of the prepared statements
>http://php.net/manual/de/pdo.prepared-statements.php
>;)
>
>2011/8/31 Richard Riley 
>
>> "Jen Rasmussen"  writes:
>>
>> > Peet,
>> >
>> > Could you do something like this instead? This is using named
>> placeholders
>> > and a separate line for your statement
>> > but I was able to get it to echo the statement in this manner.
>> >
>> > $sql = "UPDATE table SET field1=:field1, field2=:field2 WHERE id=:id";
>> >   $sth = $dbh->prepare($sql);
>> >   $sth->execute(array(":field1"=>$field1,
>> >  ": field2"=>$ field2,
>> >  ": id"=>$id));
>>
>> Hi Jen, could you point me to a document/man page for PHP which explains
>> that : notation in $sql= line please. I'm sure its common to everyone
>> here but, well, I never saw it before ;(
>>
>>
>> --
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>>

These are called SQL Parameters. It's recommended to use them since they help 
eliminate SQL Injections.


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



Re: [PHP] mysqli sql question

2011-08-31 Thread James Yerge
On 08/31/2011 05:23 AM, Peet Grobler wrote:
> Is it possible to get the actual sql that is being used to query or
> update the database?
>
> E.g
> $sth = $dbh->prepare ("update table set field=?, field2=? where id=?);
> mysqli_bind_param ($sth, 'ssi', 'text1', 'text2', 10);
> $sth->execute();
>
> Something like $sth->sql? Or $dbh->sql?
>
> I want to see "update table set field='text1', field2='text2' where id=10;
>
>
> Thanks in advance,
> Peet
>
Look up the EXPLAIN SQL function call.

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



Re: [PHP] (Kinda sorta) PHP related: recovering lost passwords

2011-08-16 Thread James Colannino
On 08/16/11 02:08, Richard Quadling wrote:

> Take a look at https://code.google.com/p/loginsystem-rd/
> 
> Whilst it is just a login system, the techniques here could be adapted
> and probably learned from (if you are new to security).

Ah, that looks interesting.  Thanks for the link!

James

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



Re: [PHP] (Kinda sorta) PHP related: recovering lost passwords

2011-08-16 Thread James Colannino
On 08/16/11 01:30, Lester Caine wrote:

> All the good sites simply don't have that capability ...
> Much safer rather than 'recovering' a password is to identify the user,
> and send them a temporary password which they have to change when they
> log in. This way nobody is allowed access existing passwords ;)

Good point.  I think I'll go that route instead.

James

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



[PHP] (Kinda sorta) PHP related: recovering lost passwords

2011-08-16 Thread James Colannino
Hi everyone,

I don't post all that often, so I hope my (mildly) off-topic question
won't be too unwelcome...  Keep in mind that I'm still pretty new when
it comes to security, so what I propose may or may not sound incredibly
dumb (you have been warned! :-P)

I'm working on a project in PHP, a toy framework, and would really like
to be able to send someone their password should they ever forget it.
The only problem is that it's best not to store the actual password in
the database, or at least to store it unencrypted.

Security-wise, how would the following scenario work out for password
retrieval:

You ask the user to setup a "security question" when they create their
account.  You use the string value of the answer to the question as a
cryptographic key, and encrypt the password with it.  You also generate
a random string of characters, and encrypt it with the same key.  You
store the encrypted password, along with both the encrypted and
unencrypted versions of the randomly generated string, in the database.

When the user goes to retrieve their password, they enter their security
question.  The randomly generated string is then decrypted using the
answer as the key.  If it matches the unencrypted version stored in the
database, you know you have the correct answer, and use it to decrypt
the user's password and send it to the email the user has setup for
their account.

James

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



Re: [PHP] Form Already Filled Out

2011-08-03 Thread James Yerge
On 08/05/2011 12:43 AM, wil prim wrote:
> Hello, S i created a simple login system, and I am using sessions 
> Everything 
> seems to work fine, however; when I upload my files to my server and type my 
> domain name my index.php page comes up and the form is automatically filled 
> out 
> with a username and password. How do i make it empty when I initially enter 
> the 
> site, and yes I did create a logout.php file that destroys a session. Please 
> help, it is hard to explain this when I cant show it in person. Thanks in 
> advance!
>
> Here is the login.php code, i didn't md5() the password yet:
>
>
> 
> if ($_SESSION['user'])
> {
> header("Location: error.php");
> exit();
> }
> include('connect.php');
> if ($_POST['login']){
>
>
> $user=$_POST['user'];
> $pass=$_POST['pass'];
> $sql="SELECT * FROM members WHERE username='$_POST[user]' and 
> password='$_POST[pass]'";
> $result=mysql_query($sql, $con);
> $count=mysql_num_rows($result);
> if ($count==1){
> $_SESSION['user'] = $user;
> header('location: home.php');
> }
> else
> echo "Wrong Username or Password";
> }
>
> ?>
> 
> 
> 
> 
> 
> 
>
> 
> 
> 
> 
> Home
> 
> 
> Topix
> 
> 
> Mission
> 
> 
> 
> 
> 
> Username: 
> 
> Password: 
> 
> 
> 
>  Register? 
>
> 
> 
> 

Your browser is more than likely filling in the username and password
fields for you, automatically. Most modern browsers offer this
functionality by default. What you're looking for isn't relative to PHP.

Have you tried visiting your page from multiple browsers, to see if you
get the same results?

You could set the value of the username and password fields in the form
to NULL.

e.g.;



I doubt your visitors are going to encounter the same issue you are,
unless they allow their browser or some other 3rd party software to
automatically fill in the form values for them.

Another method would consist of using JavaScript, once the DOM is ready
(all elements rendered), have JavaScript reset the form values.



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



Re: [PHP] Top Posting

2011-07-05 Thread James Moe
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On 07/05/2011 07:48 AM, Jim Giner wrote:
> And besides - I'm sure there are PLENTY of people here who despise scrolling
> thru endless repeated paragraphs from a long list of posts just to get the
> the latest contribution to the topic.:)
>
  I often do not bother to read posts from those how cannot trim all of
the irrelevant portions of a response. I have noticed that the response
is usually trivial and not worth scrolling to find.

> This newgroup may have its rules, but if bottom-posting was such a wise and
> preferred method, why do millions of business users subscribe to a product
> such as Outlook, that top-posts by default, to conduct their daily business
> via emails flying back and forth with the latest post at the beginning so
> that readers don't have to re-hash old news unless they want to?
>
  I suspect one reason top posting is popular is that responders do not
have to think about tidying up, just spit out a reply and move on. The
result is a message that grows in size with every reply containing every
useless bit since the thread began. It becomes quite a mess.

- -- 
James Moe
moe dot james at sohnen-moe dot com
520.743.3936
-BEGIN PGP SIGNATURE-
Version: GnuPG v2.0.15 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk4TU/MACgkQzTcr8Prq0ZP2OwCfUj8Hw7cFkkYMey6EdknZ60/E
ahgAoJnaxil40kOqps1WhWF6lP6d/Ve5
=pedd
-END PGP SIGNATURE-

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



Re: [PHP] Upgrade or Die?

2011-06-24 Thread james
Chrome. Enough said. Now, if we can only convince the rest of the world ...


> Original Message 
>From: 
>To: php-general@lists.php.net
>Sent: Fri, Jun 24, 2011, 1:17 PM
>Subject: [PHP] Upgrade or Die?
>
>In shifting gears to a faster pace of development and release, Mozilla has
>opted to abandon security support for Firefox 4 immediately upon the release
>of version 5, which came out this week.
>
>This could be a risky move, since many users neglect to update their
>browsers immediately for various reasons, despite the pop-up reminders
>Firefox periodically displays.
>
>I will never understand this mindset.
>
>
>
>Full story : http://www.technewsworld.com/edpick/72739.html
>
>
>
>
>
>
>
>Richard L. Buskirk


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



Re: [PHP] Memory limit Problem

2011-06-23 Thread james

Check the value of the upload_max_filesize and post_max_size directives in the 
php.ini.


> Original Message 
>From: Graham Drabble 
>To: php-general@lists.php.net
>Sent: Thu, Jun 23, 2011, 9:46 AM
>Subject: [PHP] Memory limit Problem
>
>Hi,
>
>I've got a problem with setting the memory limit in php.ini.
>
>I have
>memory_limit = 1024M  ;
>set in php.ini
>
>Checking with phpinfo says I have
>
>memory_limit 1024M 1024M
>
>However when uploading a large file I get
>
>Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to
>allocate 81439166 bytes)
>
>(ie it seems I only have 128M available).
>
>There's plenty of RAM on the server.
>
>Any ideas?
>--
>Graham Drabble
>http://www.drabble.me.uk/
>
>--
>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] mysqli_query() returns NULL?

2011-06-18 Thread James Colannino
On 06/18/11 13:27, Ashley Sheridan wrote:

> You'll only get an error if there was an error with the query. A query that 
> has no result is still a valid query, so won't return an error. It's quite 
> common to check the value of mysql_num_rows() before trying to use the 
> results of the query.

But in that case it would return boolean true rather than NULL, right?

James

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



[PHP] mysqli_query() returns NULL?

2011-06-17 Thread James Colannino

Hey everyone,

After reading the documentation for mysqli_query(), I was lead to 
believe that on any error it would return false.  However, through a 
stupid mistake, I discovered that when I specify an invalid value for 
the database link identifier (in my case, I accidentally passed an 
integer), instead of false I get a return value of NULL.  Does anyone 
know why?


Thanks!

James

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



Re: [PHP] Explode Question

2011-05-17 Thread James Yerge
On 05/17/2011 09:09 PM, ad...@buskirkgraphics.com wrote:
> That is exactly it.
> Thanks James I knew it was simple just forgot how it was done.
>
>
>
>
>
> Richard L. Buskirk
>
> -Original Message-
> From: James Yerge [mailto:ja...@nixsecurity.org] 
> Sent: Tuesday, May 17, 2011 8:51 PM
> To: ad...@buskirkgraphics.com
> Cc: 'Marc Guay'; php-general@lists.php.net
> Subject: Re: [PHP] Explode Question
>
> On 05/17/2011 07:53 PM, ad...@buskirkgraphics.com wrote:
>> The desired result is.
>>
>> Array
>> (
>>  [0] = > "On the";
>>  [1] = > "course or in the";
>>  [2] = > "of colver";
>> );
>>
>> I am just not sure the delimiter can be an array in the Explode function.
>>
>>
>>
>>
>>
>>
>> Richard L. Buskirk
>>
>> -Original Message-
>> From: Marc Guay [mailto:marc.g...@gmail.com] 
>> Sent: Tuesday, May 17, 2011 7:52 PM
>> To: php-general@lists.php.net
>> Subject: Re: [PHP] Explode Question
>>
>>> $one = array(0 =>'golf', 1 => 'field');
>>> $two = array(0 => "On the golf course or in the field of clover");
>>> $array_exp = explode($one, $two);
>> What's the desired result?
>>
>> array('golf' => "On the golf course or in the field of clover",
>> 'field' =>  "On the golf course or in the field of clover")); ?
>>
>>
>> Marc
>>
> Here's something to mess around with, to fit to your liking.
>
>  $one = array('golf','field');
> $two = array("On the golf course or in the field of clover");
> $result = array_explode($one,$two);
>
> print_r($result);
>
> function array_explode($delimiters,$array)
> {
> if ( !is_array($delimiters) || !is_array($array) ) {
> //bail
> return;
> }
> $string = $array[0];
> $regex = "@(".implode('|',$delimiters).")@";
> return preg_split($regex,$string);
> }
> ?>
>
>
>

Not a problem, glad to be of help.


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



Re: [PHP] Explode Question

2011-05-17 Thread James Yerge
On 05/17/2011 07:53 PM, ad...@buskirkgraphics.com wrote:
> The desired result is.
>
> Array
> (
>   [0] = > "On the";
>   [1] = > "course or in the";
>   [2] = > "of colver";
> );
>
> I am just not sure the delimiter can be an array in the Explode function.
>
>
>
>
>
>
> Richard L. Buskirk
>
> -Original Message-
> From: Marc Guay [mailto:marc.g...@gmail.com] 
> Sent: Tuesday, May 17, 2011 7:52 PM
> To: php-general@lists.php.net
> Subject: Re: [PHP] Explode Question
>
>> $one = array(0 =>'golf', 1 => 'field');
>> $two = array(0 => "On the golf course or in the field of clover");
>> $array_exp = explode($one, $two);
> What's the desired result?
>
> array('golf' => "On the golf course or in the field of clover",
> 'field' =>  "On the golf course or in the field of clover")); ?
>
>
> Marc
>

Here's something to mess around with, to fit to your liking.



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



Re: [PHP] Explode Question

2011-05-17 Thread James Yerge
On 05/17/2011 07:53 PM, ad...@buskirkgraphics.com wrote:
> The desired result is.
>
> Array
> (
>   [0] = > "On the";
>   [1] = > "course or in the";
>   [2] = > "of colver";
> );
>
> I am just not sure the delimiter can be an array in the Explode function.
>
>
>
>
>
>
> Richard L. Buskirk
>
> -Original Message-
> From: Marc Guay [mailto:marc.g...@gmail.com] 
> Sent: Tuesday, May 17, 2011 7:52 PM
> To: php-general@lists.php.net
> Subject: Re: [PHP] Explode Question
>
>> $one = array(0 =>'golf', 1 => 'field');
>> $two = array(0 => "On the golf course or in the field of clover");
>> $array_exp = explode($one, $two);
> What's the desired result?
>
> array('golf' => "On the golf course or in the field of clover",
> 'field' =>  "On the golf course or in the field of clover")); ?
>
>
> Marc
>

explode() takes three parameters; string, string, [int]. Where [int] is
optional.

Ex:
$ipList = '192.168.1.0,192.168.1.1,192.168.1.2';
$ipList = explode(',',$ipList);

Returns an array of strings:

Array
(
[0] => 192.168.1.0,
[1] => 192.168.1.1,
[2] => 192.168.1.2
);



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



[PHP] Upload size limit stays at 8MB

2011-05-05 Thread James Moe
Hello,
  apache v2.2.15 (Linux/SUSE)
  phpv5.3.3
  linux  v2.6.34.7-0.7-desktop #1 SMP

  I updated  to change
upload_max_filesize = 2M
to
upload_max_filesize = 60M.
  php_info() shows the changed value; "echo
ini_get(upload_max_filesize)" shows the changed value. Yet when I
attempt an upload, I get this in the error log:

PHP Warning:  POST Content-Length of 39246714 bytes exceeds the limit of
8388608 bytes in Unknown on line 0, referer: http://www.sma.com/sma/upload/

  Hmm. "Unknown on line 0"? A bit vague.
  8MB max seems a bit less than the 60MB listed.
  Where else could PHP be getting settings info?


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



Re: [PHP] possible variable declaration error

2011-03-25 Thread james
Correct me if I wrong, but you're declaring $id AFTER binding the SQL 
parameter, therefore your :id isn't being bound to anything, hence the empty 
returned array.

I think:
$d_series_fetch = $db->prepare("SELECT * FROM defaultseries WHERE publisher >> 
:id");
$id = 'DC Comics';
$d_series_fetch->bindParam(':id',$id);

*should* work.


> Original Message 
>From: matty jones 
>To: php-general@lists.php.net
>Sent: Fri, Mar 25, 2011, 8:19 AM
>Subject: [PHP] possible variable declaration error
>
>I get the following error " PHP Notice:  Undefined index: publisher in
>/var/www/testfunctions.php on line 65" and I have narrowed it down to what I
>*think* is a variable not being declared.  Here is the code.
>
>
>//this will fetch the data from a table
>$d_series_fetch = $db->prepare("SELECT * FROM defaultseries WHERE publisher
>= :id");
>$d_series_fetch ->bindParam(':id', $id);
>$id = 'DC Comics';
>
>
>if ($d_series_fetch ->execute(array($_GET['publisher']))) {
>while ($row = $d_series_fetch -> fetch()) {
>print_r($row);
>}
>}
>
>I have prepared statements to open a connection and insert data and they
>work fine if I comment the preceding block out so I am fairly certain the
>problem is in there somewhere.  I am using the latest version of PHP and am
>running Postgres8.4 as my db.  If I use the isset() function and add an echo
>(code below) I get no errors but the query still  doesn't work so again I am
>fairly certain that I am forgetting to declare something somewhere.
>
>//this will fetch the data from a table
>$d_series_fetch = $db->prepare("SELECT * FROM defaultseries WHERE publisher
>= :id");
>$d_series_fetch ->bindParam(':id', $id);
>$id = 'DC Comics';
>
>$publisher = '';
>
>if (isset($_GET['publisher']))
>{
>
>if ($d_series_fetch ->execute(array($_GET['publisher']))) {
>while ($row = $d_series_fetch -> fetch()) {
>print_r($row);
>
>}
>}
>}
>
>else {echo"this didn't work";}
>
>$dbh = null;  //close the database connection by setting the PDO object to
>NULL
>   }
>
>I am fairly new to PHP and have very little idea on PDO's so this is most
>likely a simple error(s) I know.
>Thank
>
>Matt


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



Re: [PHP] Connection Handling - unreliable at best?

2011-02-20 Thread James Green
Hm.

Commented out the line & re-tested. Absolutely no change whatsoever :(
Even made it false.

I'm really hoping I've been an idiot on this one. Makes no sense
otherwise but this is where I am.

Hope to hear further suggestions.

James

On 20 February 2011 03:05, Daniel Brown  wrote:
> On Fri, Feb 18, 2011 at 10:21, James Green  wrote:
>> Been reading through
>> http://uk.php.net/manual/en/features.connection-handling.php and
>> trying to implement a solution using it. So far the documented
>> behaviour rarely occurs.
>>
>> This code is a minimal test case: http://codepad.org/GqNlcWiM
>>
>> I run this behind Apache 2.2 with PHP 5.3 on Linux. The in-line
>> comments explain the problem. I load in the browser and hit stop
>> pretty much immediately but PHP does not get signalled that the user
>> has aborted and continues.
>>
>> From memory of having to restart apache after hitting long-running
>> scripts in the past, I don't ever believe I've had a script terminate
>> on a user abort. And I've never switched the behaviour from default.
>>
>> I read several people explain this behaviour would only ever work in
>> writing back to the client and to flush the buffer, which is included
>> in the test case. I've also removed any compression from within
>> Apache.
>>
>> Can anyone explain what I've seeing? I've tried this using Lighttpd/Windows 
>> too.
>
>    Look at line #4.  You're telling PHP that you don't give a damn if
> someone tries to quit, you're going to continue anyway.  You storm
> trooper, you.
>
>    If PHP is instructed to ignore the user's (futile) attempts to
> abort, why should it try to gentlemanly and politely respect a
> shutdown function?  Essentially, you're damning it to zombiehood.
>
> --
> 
> Network Infrastructure Manager
> Documentation, Webmaster Teams
> http://www.php.net/
>

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



[PHP] Connection Handling - unreliable at best?

2011-02-18 Thread James Green
Been reading through
http://uk.php.net/manual/en/features.connection-handling.php and
trying to implement a solution using it. So far the documented
behaviour rarely occurs.

This code is a minimal test case: http://codepad.org/GqNlcWiM

I run this behind Apache 2.2 with PHP 5.3 on Linux. The in-line
comments explain the problem. I load in the browser and hit stop
pretty much immediately but PHP does not get signalled that the user
has aborted and continues.

>From memory of having to restart apache after hitting long-running
scripts in the past, I don't ever believe I've had a script terminate
on a user abort. And I've never switched the behaviour from default.

I read several people explain this behaviour would only ever work in
writing back to the client and to flush the buffer, which is included
in the test case. I've also removed any compression from within
Apache.

Can anyone explain what I've seeing? I've tried this using Lighttpd/Windows too.

Thanks,

James

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



[PHP] DOMDocument depth limit

2011-02-16 Thread James Devine
Is there any way to pass LIBXML_PARSEHUGE to DOMDocument::loadHTML ?
I'm trying to load an in-memory html document and I'm hitting this
limit, DOMDocument::load and DOMDocument::loadXML both look like they
accept options but DOMDocument::loadHTML does not.

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



Re: [PHP] Eclipse, Komodo, Netbeans, Zend Studio, PHP Storm, other?

2010-10-13 Thread James Diamond
Hey Mike,

I use zend eclipse, love it.

What I love about it is what I love about any IDE, code complete, project 
configurations, customizable preferences of the editor, etc.

I have used Eclipse (Pre-Zend), Zend Eclipse, Zend Studio, Komodo, and 
Easyclipse.

James


On Oct 13, 2010, at 12:58 PM, Hansen, Mike wrote:

> I'm about to do a lot of work on an existing code base and I think I'd like 
> to try an IDE. I currently use VIM for most editing.
> 
> What IDE are you using? 
> 
> What do you like about the one you are using? 
> 
> Which ones have you tried?
> 
> Mike
> 
> 
> 
> --
> 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] Unexpected behaviour from define()

2010-06-25 Thread James Long
Thank you very much!  Once I realized the source of the problem,
I was dismayed that one could declare a constant and have the
interpreter absolutely ignore it without warning.  I already had
error_reporting to E_ALL in php.ini, so was unaware of what else
I could do.  Didn't think to look for 'display_errors = 1' in
php.ini since I was seeing error messages for other errors.

Thanks again.

Jim

On Fri, Jun 25, 2010 at 10:38:39AM +0100, Richard Quadling wrote:
> On 24 June 2010 22:41, James Long  wrote:
>  error_reporting(-1);
> ini_set('display_errors', 1);
> 
> define( 'LOG_NORMAL',  0 );
> define( 'LOG_WARNING', 1 );
> define( 'LOG_ERROR',   2 );
> 
> echo 'LOG_NORMAL '  . LOG_NORMAL  . "\n";
> echo 'LOG_WARNING ' . LOG_WARNING . "\n";
> echo 'LOG_ERROR '   . LOG_ERROR   . "\n";
> ?>
> 
> outputs ...
> 
> Notice: Constant LOG_WARNING already defined in - on line 4
> LOG_NORMAL 0
> LOG_WARNING 5
> LOG_ERROR 2
> 
> I'm on Win32 PHP 5.3.3-RC1 (cli) (built: Jun 17 2010 22:43:29)
> 
> 
> 
> 
> 
> -- 
> -
> 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=ZEND002498&r=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



[PHP] Re: Unexpected behaviour from define()

2010-06-24 Thread James Long
On Thu, Jun 24, 2010 at 02:41:51PM -0700, James Long wrote:
> Perhaps I am missing something basic here.
> 
> Why does the LOG_WARNING constant take on a value of 4, when
> it is defined with a value of 1?
> 
> Thank you!
> 
> Jim

Answering my own question here

LOG_WARNING is already defined elsewhere it seems, by the
Network function define_syslog_variables:

$ cat bug.php

$ php bug.php
LOG_NORMAL LOG_NORMAL
LOG_WARNING 4
LOG_ERROR LOG_ERROR
$


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



[PHP] Unexpected behaviour from define()

2010-06-24 Thread James Long
Perhaps I am missing something basic here.

Why does the LOG_WARNING constant take on a value of 4, when
it is defined with a value of 1?

Thank you!

Jim


$ cat bug.php

$ php bug.php
LOG_NORMAL 0
LOG_WARNING 4
LOG_ERROR 2
$

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



Re: [PHP] Question about logins and locking

2010-06-22 Thread James Colannino
Tommy Pham wrote:

> 1) Set an encrypted (to prevent hijacking and eavesdropping) cookie to
> expire when browser closes
> 2) Have a table in the DB backend to keep track if the user is logged in or
> not and when was the last time the validated user access your site (this
> gets updated when the user visit a link on your site by checking the cookie
> and the DB entry of the session ID)
> 3) Set your session timeout accordingly to you security requirement
> 4) Have a javascript on a timeout to self-logoff should the user is AFK
> longer than your session timeout.
> 
> If another user or if the same user tries to login with a different browser,
> you can check the status of the user.  If the user is logged in, you can
> deny it after the authentication.  Should the user closes the browser
> without having to logoff, you can check when was the last time the user
> accessed your site and see if it's been longer than your session timeout.
> For security purposes, you can optionally send a courtesy email notifying
> that the user didn't logout properly since last accessed.  This way, you can
> track whether if the user's system is compromised in some way or not.  It
> all depends on what kind of application, service, user level access, and the
> strict security you require.

Thanks Tommy.  That was very helpful, and some of it is similar to how I
was thinking of doing it.

James

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



[PHP] Question about logins and locking

2010-06-22 Thread James Colannino
Hey everyone,

I have a question about logins.  Let's say that I want to allow each
user account to login only once at a time.  I would then need some kind
of locking mechanism to make sure that the same user can't login again
somewhere else until first logging off.  What's a good way to achieve
this?  I want to be able to handle situations in which the user closes
their browser without first logging off, where I would want to count
that as a logout.

Perhaps I could do some kind of periodic polling in Javascript, combined
with a query to the database that sets a value when the user logs in and
when the user logs out?  I'm just looking for some conceptual ideas. 
Thanks everyone!

James

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



Re: [PHP] var_dump( (0 == 'heading') ) == TRUE ?!

2010-05-14 Thread James Colannino
I'm pretty sure this is the right answer.  If not, someone please
correct me.  PHP will compare the 0 against the integer represented by
the string.  So, for example, 0 == "0" would test true.  0 == "1" would
test false.  However, 'heading' doesn't represent a valid integer, so it
appears on the right hand side as just 0, which is equal to the left
hand side.

James

Daevid Vincent wrote:
> Can someone explain why an integer 0 compared to a string evaluates to
> boolean true??
> 
> var_dump( (0 == 'heading') );
> 
> Yet, 
> 
> var_dump( (1 == 'heading') );
> 
> Is FALSE.
> 
> WTF? I would expect the 0 one to be FALSE too.

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



Re: [PHP] MySQL: Return Number of Matched Rows

2010-03-25 Thread James Colannino
Floyd Resler wrote:
> As for as I know, MySQL simply just doesn't report a row as being affected if 
> nothing has changed in it.  To get the number of matched rows, try doing a 
> SELECT query before you do the UPDATE query.  I don't know if that will 
> produce the results you're looking for, but it might.
>   

Yeah, the extra select is what I was hoping to avoid :-P  The MySQL
client will return both the number of rows matched and the number of
rows affected by the query; I was hoping perhaps the PHP API offered a
way for me to do the same.  Ah well...  Thanks!

James


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



[PHP] MySQL: Return Number of Matched Rows

2010-03-25 Thread James Colannino
Hey everyone,

I have a question.  If I do a mysql query that updates a column in a row
to the same value, I get 0 rows affected.  However, I also get 1 or more
 matched rows.  Is there a way that I can return the number of matched
rows, rather than the number of rows affected?

I'm trying to get something done with as few SQL queries as possible.
Thanks!

James

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



Re: [PHP] Deleting multiple backslashes; regex?

2010-03-15 Thread james stojan
Double check your code I came up with the same solution as Ash did and it
worked fine in Wamp.

On Mon, Mar 15, 2010 at 3:30 PM, Ashley Sheridan
wrote:

> On Mon, 2010-03-15 at 15:35 -0400, Al Rider wrote:
>
> >
> >
> > On 3/15/2010 3:11 PM, Ashley Sheridan wrote:
> >
> > > On Mon, 2010-03-15 at 15:03 -0400, Al wrote:
> > >
> > > > Anyone have a regex pattern for deleting multiple backslashes e.g.,
> \\\
> > > >
> > > > I pretty good with regex; but, be damned if I can delete them with
> preg_replace()
> > > >
> > > > I've tried "" as the manual says
> > > >
> > > > preg_replace("//", '', $str);
> > > >
> > > > preg_replace("/()+/", '', $str);
> > > >
> > > > preg_replace("/\x5C/", '', $str);
> > > >
> > > > preg_replace("/\\x5c/", '', $str);
> > > >
> > > > And lots of others.
> > > >
> > > > stripslashes() and stripcslashes() are limited.
> > > >
> > > >
> > > >
> > > >
> > >
> > >
> > > What about this:
> > >
> > > $str = 'text\\dfnfg\\dhdsg';
> > > echo preg_replace('/\\\{2,}/', '', $str);
> > >
> > > I think what was catching you out was that you were escaping the \
> > > once for the regex, but then it needed it again because it was in a
> > > single quoted string, meaning 3 slashes in total. Took me a little
> > > while to figure that out as well!
> > >
> > > The {2,} part just tells it to only remove the slashes where they
> > > occur in runs of two or more.
> > >
> >
> >
> > I agree, it should work; but, it doesn't.
> >
> > Most everything that looks reasonable works in The Regex Coach,
> > including you suggestion.
> >
> > I'm starting to think there is a bug in the regex engine; haven't
> > looked yet.  It's doubtful though because the bug would screw existing
> > code.
> >
> > > Thanks,
> > > Ash
> > > http://www.ashleysheridan.co.uk
> > >
> > >
> > >
>
>
> I tried the code I just gave you and it's working, so I'm not sure now
> what issue you're having with it?
>
> Thanks,
> Ash
> http://www.ashleysheridan.co.uk
>
>
>


Re: [PHP] Revision control?

2010-03-09 Thread James McLean
On Wed, Mar 10, 2010 at 11:14 AM, Tom Sparks  wrote:
> --- On Wed, 10/3/10, Phpster  wrote:
>
>> I believe pear has some stuff for subversion.
>
> Don't want to use subversion or any third-party app

Why re-invent the wheel? Just use SVN, existing libraries out there,
easy to use, easy to access and portable.

> I forgot to say needs to support media files (images/sounds/etc) as well as 
> text based files.
> I don't care if it flat-file based or database based

I have stored binary data in SVN many times. No issues. IIRC it simply
stores a new copy of the entire file for each instance of binary data,
rather than storing the changes as it would with a Text file.

Cheers,

James

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



Re: [PHP] Mail Function In PHP

2010-03-08 Thread james . stojan
Any volume of mail sent direct to mx records is a red flag for anti spammers 
and without an smtp spf dkim and rdns you are wasting your time. The logic is 
that only people sending spam would be sending direct to mx like that. Fair or 
not that is just how life works. Oh and most mail servers do check rdns spf 
etc. 

It is kind of pointless to send emails if they end up in the spam folder or 
worse don't get delivered at all. Do it right the first time use an smtp rdns 
and spf at the very least. 


Sent via BlackBerry from T-Mobile

-Original Message-
From: Richard Quadling 
Date: Mon, 8 Mar 2010 10:21:53 
To: Kannan
Cc: 
Subject: Re: [PHP] Mail Function In PHP
On 7 March 2010 04:54, Kannan  wrote:
> Hello
>           I am creating a application for our college using the
> php.In that i want to send mail to all who are all the list.
>
> For that i am just simply use the mail function in php without
> configuring any mail system in the system.But the mail didn't send.
> For sending the mails wat are requirements and if u have any tutorials
> send it to me?
>
> Thanks..
>
>
>
>
>
>
>
>
>
>
> --
> With regards,
>
> Kannan. R. P,
> Blog @: http://kannan4k.wordpress.com/
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

Contrary to popular belief, to send an email you do not need to have
your own SMTP server. All you need to know is the SMTP server
responsible for your recipients email.

This information is held as part of the domain registration details
and is known as the MX records (as I understand it).

PHP has a function called getmxrr() [1]. This allows you to supply a
domain name and get back the list of MX records suitable for handling
the SMTP mail.

This function wasn't available on Windows until recently, and I
created a userland version utilising Windows nslookup.exe program [2].

So, once you've got the list of SMTP servers for the domain you are
sending email to, you can use the ini_set('SMTP', 'xx'); function
to set the server to handle the mail() call you are about to make.

Upside : No local SMTP server - you are not responsible for
maintaining/administering/etc. any aspect of the SMTP process.
Upside : If the mail() call fails, you can try the other MX records (I
tend to sort the results based upon weight and try them in sequence).
If it fails all of them, you know straight away and can deal with it.
Upside : No relaying. No permission issues to worry about. You are
simply talking to the public SMTP servers just like any other SMTP
server or sender.

Downside : No queuing. Without a_LOCAL_ SMTP server, you can only
deal with sending email in real time.
Downside : One domain at a time. You cannot send email to
a...@domain1.com, b...@domain2.com_and_ c...@domain3.com in the 1 email.

None of these steps affect the use of mail() or a mail sending class
(phpmailer, RMail, html_mime_mail5, etc.).

Regards,

Richard.

[1] http://docs.php.net/getmxrr
[2] http://docs.php.net/getmxrr#53182

Richard.

-- 
-
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=ZEND002498&r=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



Re: [PHP] PHP Syntax Help - Check?

2010-02-24 Thread James McLean
On Thu, Feb 25, 2010 at 4:22 PM, Rick Dwyer  wrote:
> OK... external function... that would explain why I could not locate it.
>
> Let me get right to the problem I am having with this code as someone may be
> able to help directly.
>
> I have a link on a page that opens a contact form.  The link is
> mypage.php?my_id=5
>
> So on mypage.php, I capture this value with:
> $my_id=$_GET['my_id'];
>
> I understand this much.  But when the end user submits this contact form
> they do so to formcheck.php and if formcheck.php sees a required field is
> blank, it throws it back to mypage.php with an alert.  BUT, I lose the value
> of the variable $my_id.  SO, I created a hidden field on mypate.php with
>  value="" and on formcheck.php, I added $my_id =
> $_Post['my_id'];
>
> However, when formcheck.php returns me to mypage.php, $my_id is still blank.

Use the right varialble for the method you're using, so if you're
posting, use $_POST, if you're getting use $_GET..

Going by your example, $_GET is what you should probably be using,
this is usually the default method if no method is specified on the
form tag.

Cheers

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



Re: [PHP] Mysql statement works in phpmyadmin but not in php page

2010-02-11 Thread James McLean
On Fri, Feb 12, 2010 at 9:31 AM, Joseph Thayne  wrote:
> As for the backticks, they are required because of MySQL, not because of
> phpMyAdmin.  The issue was not that phpMyAdmin uses backticks, it is that
> MySQL pretty much requires them when naming a field the same as an internal
> function to my knowledge.  If someone else knows of another way to designate
> to MySQL that a field named HOUR is the name of a field rather than the name
> of the internal function, I would love to know.

Ahh I see :) Wasn't aware of that. Personally i've always been
over-descriptive when designing my tables which is possibly why I've
never run into that limitation :)

Thanks.

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



Re: [PHP] Mysql statement works in phpmyadmin but not in php page

2010-02-11 Thread James McLean
On Fri, Feb 12, 2010 at 9:31 AM, Jochem Maas  wrote:
> Op 2/11/10 10:51 PM, James McLean schreef:
>> My personal preference these days is to use Curly braces around
>> variables in strings such as this, I always find excessive string
>> concatenation such as is often used when building SQL queries hard to
>> read, and IIRC there was performance implications to it as well
>> (though I don't have access to concrete stats right now).
>>
>> In your case, the variable would be something like this:
>>
>> $query="INSERT INTO upload_history (v_id,hour,visits,date) VALUES
>> ({$v_id}, {$hour}, {$visits}, '{$date}')";
>
> actually IIRC the engine compiles that to OpCodes that equate to:
>
> $query = 'INSERT INTO upload_history (v_id,hour,visits,date) VALUES 
> ('.$v_id.', '.$hour.', '.$visits.', '\''.{$date}.'\')';

Interesting point, but the original code is still more readable, the
opcode's aren't our problem (at least in this case) :)

Cheers

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



Re: [PHP] Mysql statement works in phpmyadmin but not in php page

2010-02-11 Thread James McLean
On Fri, Feb 12, 2010 at 8:27 AM, Joseph Thayne  wrote:
>
> Actually, the syntax is just fine.  I personally would prefer it the way you
> mention, but there actually is nothing wrong with the syntax.
>
>> The ,'$date1'"." is not correct syntax, change it to ,'".$date."'

My personal preference these days is to use Curly braces around
variables in strings such as this, I always find excessive string
concatenation such as is often used when building SQL queries hard to
read, and IIRC there was performance implications to it as well
(though I don't have access to concrete stats right now).

In your case, the variable would be something like this:

$query="INSERT INTO upload_history (v_id,hour,visits,date) VALUES
({$v_id}, {$hour}, {$visits}, '{$date}')";

Much more readable and maintainable IMO.

No need for the trailing semicolon in SQL that uses an API like you
are using so save another char there too.
Backticks around column names are not required and IMO again they just
make the code hard to read. Just because phpMyAdmin uses them, doesn't
mean we all need to.

Cheers

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



Re: [PHP] Mysql statement works in phpmyadmin but not in php page

2010-02-11 Thread james stojan
Thank you.
You were right on the money, "hour" was the problem and the tick marks
solved it. I spent 3 hours trying to figure out why I never got an error but
there was no insert and  php myadmin does add the tick marks automatically.
 Probably a good habit to always use the tick marks.

Learn something new everyday.

On Thu, Feb 11, 2010 at 4:26 PM, Joseph Thayne wrote:

> Try putting tick marks (`) around the field and table names.  So your SQL
> query would then look like:
>
>
> INSERT INTO `history` (`v_id`, `hour`, `visits`, `date`) VALUES (45, 0, 59,
> '2010 01 27');
>
> This is a good practice to get into.  The problem is that MySQL allows you
> to create tables and fields with the same name as functions.  If the tick
> marks are not there, then it assumes you mean to try using the function.  In
> your case, hour is a function in mysql.  I would assume that the reason it
> works in phpmyadmin is that it filters the query somehow to add the tick
> marks in.
>
> Joseph
>
>
> james stojan wrote:
>
>> I'm at my wits end trying to make this mysql statement insert work in
>> PHP. I'm not getting any errors from PHP or mysql but the insert fails
>> (nothing is inserted) error reporting is on and is reporting other
>> errors. When I echo out the query and manually paste it into PHP
>> myAdmin the query inserts without a problem. I know that I am
>> connecting to the database as well part of the data being inserted
>> comes from the same database and that the mysql user has permission to
>> do inserts (even tried as root no luck).
>>
>> $query="INSERT INTO upload_history (v_id,hour,visits,date) VALUES
>> (".$v_id.",".$hour.",".$visits.",'$date1'".");";
>>
>> $r2=mysql_query($query) or die("A fatal MySQL error
>> occured.\nQuery: " . $query . "\nError: (" .
>> mysql_errno() . ") " . mysql_error());
>>
>> This is an echo of $query and runs in phpmyadmin.
>>
>> INSERT INTO history (v_id,hour,visits,date) VALUES (45,0,59,'2010 01 27');
>>
>>
>> Any idea what is going on here?
>>
>>
>>
>


[PHP] Mysql statement works in phpmyadmin but not in php page

2010-02-11 Thread james stojan
I'm at my wits end trying to make this mysql statement insert work in
PHP. I'm not getting any errors from PHP or mysql but the insert fails
(nothing is inserted) error reporting is on and is reporting other
errors. When I echo out the query and manually paste it into PHP
myAdmin the query inserts without a problem. I know that I am
connecting to the database as well part of the data being inserted
comes from the same database and that the mysql user has permission to
do inserts (even tried as root no luck).

$query="INSERT INTO upload_history (v_id,hour,visits,date) VALUES
(".$v_id.",".$hour.",".$visits.",'$date1'".");";

$r2=mysql_query($query) or die("A fatal MySQL error
occured.\nQuery: " . $query . "\nError: (" .
mysql_errno() . ") " . mysql_error());

This is an echo of $query and runs in phpmyadmin.

INSERT INTO history (v_id,hour,visits,date) VALUES (45,0,59,'2010 01 27');


Any idea what is going on here?

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



Re: [PHP] Owner or other; permissions for webpage users

2010-02-09 Thread James McLean
On Wed, Feb 10, 2010 at 2:51 PM,   wrote:
> I'm basically familiar with the UNIX permissions - 'owner', 'group', or 
> 'other', but I
> have no real idea how these apply to webpage users under PHP. I know that if 
> I FTP to the
> server I am the owner, and I think that if I, or anyone else, opens one of my 
> webpages I
> am 'other'.

Almost right. It's UGO, User Group and Other.

When you view a PHP page, it's (usually) served by Apache, the process
will be owned by a user, usually 'apache'; who is also a member of a
group, usually 'apache'. On some systems these users/groups can be
'httpd', 'www-data' etc. When you or I look at a PHP file served from
Apache, there is no concept of users/groups/others outside those that
apply to the Apache process that served the data.

> However what I would like to do is assign certain users, who have logged in 
> through a
> security portal, to 'group', so that they (but not 'others') have permission 
> to write to
> data files on the site.

It's a seperate thing, because once again inside PHP there is no
concept of users/groups outside the Apache process itself. It would be
up to your PHP code to manage who has access to what, the files will
all be read from and written to disk by the Apache process.

HTH.

Cheers

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



Re: [PHP] PHP Manual problems

2010-02-09 Thread James McLean
On Wed, Feb 10, 2010 at 2:26 PM,   wrote:
> On Thu, 04 Feb 2010 02:39:03 +0100, joc...@iamjochem.com (Jochem Maas) wrote:
>>as for using IE6 ... WTF ... you do realise this is essentially a web 
>>developers mailing list right?
>
> The interesting things in my websites go on behind-the-scenes, in the PHP, 
> and produce
> relatively straightforward HTML. I have avoided the well-known bugs in IE6, 
> and think my
> webpages display correctly on any of the modern browsers, but as Microsoft 
> delights in
> rearranging everything in every update, and making the features you need ever 
> harder to
> find, I stick to IE6 for my everyday work.

Wow. Ignoring the issue that IE6 will soon be EOL (finally), and
ignoring how bad it is at handling anything even remotely modern, your
workstation must be a haven for virii, spyware and malware... IE6 has
just about the worst security track record out there, at least on the
desktop anyway.

If you must have IE6 for whatever reason, stick it on Windows
installed on a VM and upgrade your main workstation browser to
something more recent. At least a VM can be backed up at a known-good
point and if^H^Hwhen it gets compromised it can be deleted easily and
replaced with your backup.

I'll make it easy for you: http://www.getfirefox.com :)

Cheers

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



Re: [PHP] database abstraction layer

2010-02-02 Thread James Colannino

Lars Nielsen wrote:

Is it save to assume that I can use the same SQL, or should i make some
exceptions?


Standard SQL should work across all SQL servers with only a few 
exceptions (for example, MySQL doesn't support full outer joins.)  
Anything that has to do with server administration, however, such as 
dealing with users and permissions, will be unique to the db engine.


James

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



Re: [PHP] Good source for sample data?

2010-01-28 Thread james stojan
Fakenamegenerator.com is pretty good for these kinds of records, alot of
variety and can change order/formating for them but they do limit free
orders to 50k records.

http://www.fakenamegenerator.com/order.php

On Thu, Jan 28, 2010 at 8:06 PM, TG  wrote:

> I remembered a coworker found an online resource that generated sample data
> for you.  I hit google and I think I found it:
>
> http://www.generatedata.com/
>
> I I found it on a list of resources for data generation:
>
> http://www.webresourcesdepot.com/test-sample-data-generators/
>
>
> I've never used any of these, but once again.. Google is your friend.
>
> -TG
>
> - Original Message -
> From: Brian Dunning 
> To: php-general@lists.php.net, my...@lists.mysql.com
> Date: Thu, 28 Jan 2010 15:52:41 -0800
> Subject: [PHP] Good source for sample data?
>
> > Hey all -
> >
> > I need a few million sample contact records - name, company, address,
> email, web, phone, fax. ZIP codes and area codes and street addresses
> should be correct and properly formatted, but preferably not real people
> or companies or email addresses. But they'd work if you did address
> validation or mapping. Anyone have a suggestion?
> >
> > - Brian
> > --
> > 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] Do you use a public framework or roll your own?

2010-01-26 Thread James McLean
On Wed, Jan 27, 2010 at 4:50 PM, Michael Kubler  wrote:
> I read somewhere (can't find the link at the moment) that there's probably
> 2.5 frameworks per PHP developer.

There would be a lot of truth to that, I hacked up a smaller & simpler
PHP4-centric framework back in the days when it was supported
alongside PHP5 - but the webhost wouldn't move to PHP5. So i've
written at least 2 myself :) Weather they are any good is a totally
different matter of course :D

Cheers

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



Re: [PHP] Do you use a public framework or roll your own?

2010-01-26 Thread James McLean
On Wed, Jan 27, 2010 at 10:47 AM, Daevid Vincent  wrote:
>
> I'm not looking to start a holy war here or re-hash the tired debate.
> I just want some hard cold numbers to look at.
>
> "Do you use a public framework or roll your own?"
> http://www.rapidpoll.net/8opnt1e

I have rolled my own in the past in the time before Zend Framework
(and others) and I was quite proud of it to be honest. It was MVC
based with PHPTal templates and I used a lot of concepts I learned
from a hardcore Java developer when building it. I tweaked and refined
it to a point where I was very very happy with its performance (I used
it for my performance benchmarking as part of my presentation on APC
at OSDC Sydney 2008) and was intending to roll it out to power a
commercial project of mine. Didn't happen as I planned, however I
still have the codebase. I wrote it when I was rather new to OOP so it
has undergone quite a bit of refactoring over time.

I may open source it now that I have no major plans for it, perhaps
someone may find the code useful in some way shape or form. Includes a
rather simple ORM that ties into APC with it's variable caching
abilities (I am aware of the limitations this provides now),
reasonably simple MVC concepts and the ability to run multiple
websites & domains from a single installation. Other basics are there
like XML reading etc etc.

In hindsight, it's a little clunky now. But I was proud of it and I
still am to a point :) Personally I believe any PHP developer who
wants to be taken seriously should have written thier own framework :)

I am actually planning another project, however it will use Zend
Framework as a base. No need to re-invent the wheel, again, as fun as
it would be :)

Cheers

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



Re: [PHP] Site Moved From PHP4 to PHP5 Server - header, location no longer working

2010-01-06 Thread James McLean
On Thu, Jan 7, 2010 at 1:35 PM, Vernon Webb  wrote:
> I move a number of sites from one server to another and one the one server we 
> had php4 and now we have php5 and since then my server seems to hang every 
> time there is a header, location redirect. Anyone have any ideas on how to 
> resolve this? Is there something I can easily change in the php.ini file that 
> will resolve this issue?

Off the top of my head it sounds like something is being output before
the header, which causes an error. If you also have error display
turned off, you will likely just see a white screen with no useful
information.

Make sure none of your includes have trailing whitespace or are trying
to print out information before the header itself.

Best bet is to turn on errors and log them, then you will see where
the output started if infact that is your issue.

Cheers

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



Re: [PHP] Happy New Year

2009-12-31 Thread James Colannino
tedd wrote:

> May 2010 > 2009.

Fortunately, I think that's automatically true by definition :-D

James


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



Re: [PHP] PHP + ODBC

2009-12-14 Thread James McLean
On Tue, Dec 15, 2009 at 10:03 AM, Philip Thompson
 wrote:
> My head hurts from hitting it on my desk all day, so I thought I'd turn to a 
> fresher set of eyes. The issue I'm having is getting PHP to connect ODBC. I 
> can get it to work using isql from the command line. Can you verify my 
> settings:
>
[snipped]
>
> I've tried the above DSNs and many other versions of it ad nauseum. The 
> specific error I'm getting is... "[unixODBC][Driver Manager]Data source name 
> not found, and no default driver specified." I really have searched high and 
> low for a solution, but to no avail. Any thoughts?

Why not just use the built in MySQL libraries or PDO?

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



Re: [PHP] Emergency! Performance downloading big files

2009-12-01 Thread James McLean
On Wed, Dec 2, 2009 at 9:18 AM, Brian Dunning  wrote:
> This is a holiday-crunch emergency.

Aren't they all! :)

> It's WAY TOO SLOW. I can paste the URL into a browser and download even the 
> largest files quite quickly, but the PHP method bottlenecks and cannot keep 
> up.

Are you certain you also have the bandwidth to support it as well?

The suggestion from other users of off-loading the PDF downloading to
Apache (or another webserver) is a good idea also.

Cheers

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



Re: [PHP] php htaccess logins and logouts

2009-11-26 Thread James McLean
On Fri, Nov 27, 2009 at 12:12 AM, Ashley Sheridan
 wrote:
> Hi all,
>
> I've got a site set up that is using an htaccess file to provide secure
> access to a directory. That is working fine. What I wondered was, is
> there a way to log out via PHP. As I understand it, the login mechanism
> is part of Apache, so I guess what I'm really asking is, is there a way
> that I can get Apache to end the 'session' that Apache has set up, using
> PHP?
>
> I'm sure I've seen cPanel do it, so I was wondering how easy this would
> be to do myself.

IIRC if you unset $_SERVER['PHP_AUTH_USER'] and
$_SERVER['PHP_AUTH_PW'] it will log you out.

Cheers.

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



Re: [PHP] PHP Equivalent to Java Jar or Python Eggs

2009-11-25 Thread James McLean
On Thu, Nov 26, 2009 at 11:50 AM,   wrote:
>
> Has anyone done any work towards packaging of PHP in a manner similar to jar 
> or eggs? I was working on a project the other day with a lot of class files 
> and thought this would be a cool, simple way to deploy the app.

Yes; Greg Beaver has done a lot of work with PHAR, which is very
similar. See http://au2.php.net/phar

Cheers

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



Re: [PHP] php mail() function

2009-11-25 Thread James Prentice
It looks like using XAMPP wasn't strictly necessary. I tried running
this example again using my previous versions of mysql and apache and
it worked fine. So the key is to configure Sendmail as described at
the URL I gave.

On Wed, Nov 25, 2009 at 10:58 AM, James Prentice  wrote:
> After a long delay, I've finally got mail working. I had decided to
> move on in the book that I'm working through (Head First PHP & MySQL)
> but doubled back to address the mail issue again. This is how I
> finally got it to work:
>
> 1. Switched to XAMPP for linux rather than using my existing versions
> of mysql, php and apache.
>
> 2. Uninstalled Postfix and reinstalled Sendmail. Then I followed the
> instructions here:
>
> http://dbaron.org/linux/sendmail
>
> I can't vouch that the method described at that link is completely
> safe and secure, but it worked for me and was very easy. I've spent
> many hours and days trying to get this to work so am very relieved.
>
> My only complaint is that there is quite a long delay after submitting
> report.html (from Ch. 1) while it says 'waiting for localhost...'. It
> can take up to 20 seconds or so before sending and giving
> confirmation.
>
> Thanks for all your help.
>
> On Mon, Oct 26, 2009 at 4:37 AM, Bob McConnell  wrote:
>> From: James Prentice
>>
>>> I have tried setting both $to and $email to be the same shaw address
>>> since I assumed it should be recognized by the mail server, but it's
>>> still getting bounced. So why is 'www-d...@homemade' being listed as
>>> the sender? Any ideas?
>>
>> I strongly recommend you call the help desk at Shaw and ask them to
>> explain what is happening. They should know what is going on with their
>> servers. Everyone on this list appears to be guessing at the problem,
>> which is not likely to help you.
>>
>> Bob McConnell
>>
>

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



Re: [PHP] php mail() function

2009-11-25 Thread James Prentice
After a long delay, I've finally got mail working. I had decided to
move on in the book that I'm working through (Head First PHP & MySQL)
but doubled back to address the mail issue again. This is how I
finally got it to work:

1. Switched to XAMPP for linux rather than using my existing versions
of mysql, php and apache.

2. Uninstalled Postfix and reinstalled Sendmail. Then I followed the
instructions here:

http://dbaron.org/linux/sendmail

I can't vouch that the method described at that link is completely
safe and secure, but it worked for me and was very easy. I've spent
many hours and days trying to get this to work so am very relieved.

My only complaint is that there is quite a long delay after submitting
report.html (from Ch. 1) while it says 'waiting for localhost...'. It
can take up to 20 seconds or so before sending and giving
confirmation.

Thanks for all your help.

On Mon, Oct 26, 2009 at 4:37 AM, Bob McConnell  wrote:
> From: James Prentice
>
>> I have tried setting both $to and $email to be the same shaw address
>> since I assumed it should be recognized by the mail server, but it's
>> still getting bounced. So why is 'www-d...@homemade' being listed as
>> the sender? Any ideas?
>
> I strongly recommend you call the help desk at Shaw and ask them to
> explain what is happening. They should know what is going on with their
> servers. Everyone on this list appears to be guessing at the problem,
> which is not likely to help you.
>
> Bob McConnell
>

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



Re: [PHP] How to call a vc++ dll from a HTML form

2009-11-17 Thread James McLean
On Wed, Nov 18, 2009 at 3:21 PM, Peter  wrote:
> Thanks to All.
>
> I want to call a vc++ dll from a HTML form. The dll need to be triggered on
> a button click in the HTML form.
>
> I want to access the dll from the client end(javascrript) without using the
> server.
>
> Tell me whether its possible to call dll directly or through any interface ?
>
> Please provide me your valuable inputs to solve this issue.

What does this have to do with PHP?

Oh, and it's a bad idea. Don't do it...

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



Re: [PHP] Netbeans IDE 6.5

2009-10-29 Thread James McLean
On Thu, Oct 29, 2009 at 8:13 PM, John Black
 wrote:
> James McLean wrote:
>>
>> I myself and I'm sure many others will agree that sticking to 'around'
>> 80 chars is best-practice, it's handy for those times when you need to
>> fix code in an emergency in an 80 col terminal, among other reasons.
>> Personally the 80 col marker (I set it to 78 cols actually) is one of
>> the first things I enable in Eclipse PDT..
>
> I only use a character limit for email but I have a wide screen so write
> code to the edge of the screen.
> Updating code via a terminal connection is no problem either because vim
> will wrap long lines.
> So 80chars may have been a good idea a long time ago but I think that the
> rule is a bit outdated.

Personally I find wrapped vi/vim lines very annoying, hence why I
stick to short lines where possible :)

Cheers

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



Re: [PHP] Netbeans IDE 6.5

2009-10-28 Thread James McLean
On Thu, Oct 29, 2009 at 4:05 AM, Skip Evans  wrote:
> Now, if I can just get rid of that red line at the 80 column mark. I haven't
> bothered with 80 columns since I wrote assembly on a terminal connected to a
> PDP-11 in college.

I myself and I'm sure many others will agree that sticking to 'around'
80 chars is best-practice, it's handy for those times when you need to
fix code in an emergency in an 80 col terminal, among other reasons.
Personally the 80 col marker (I set it to 78 cols actually) is one of
the first things I enable in Eclipse PDT..

Zend would (mostly) agree:
http://framework.zend.com/manual/en/coding-standard.php-file-formatting.html

Cheers,

James

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



Re: [PHP] Re: Converting tables into forms

2009-10-27 Thread James McLean
On Wed, Oct 28, 2009 at 2:37 PM, ben...@gmail.com  wrote:
> I am trying to take MySQL tables and use the table structure to create
> HTML/PHP forms in as few steps as possible for further development. I
> have a project that has hundreds of tables and requires hundreds of
> forms to be created and don't want to do so field by field by hand.

With a little coding, Zend_Form should do what you need.

http://framework.zend.com/manual/en/zend.form.html

Cheers,

James

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



Re: [PHP] What would stop header("Location...) from working?

2009-10-27 Thread James McLean
On Wed, Oct 28, 2009 at 10:01 AM, tedd  wrote:
> I just had a script stop following this statement:
>
>   header("Location:users.php");
>
> It *was* working, but now instead of running "users.php", it defaults to the
> parent script.
>
> When I place exit() after it, such as:
>
>   header("Location:users.php");
>   exit();
>
> The script simply exits. It does not continue to users.php -- BUT -- it did.
>
> What would stop this statement from working?

Any text output before the header() statement would stop it, this
includes spaces after closing ?> in any included files before the
header() as well, not just text from echos or prints.

If you have errors hidden or disabled, then you would not see the
warning from header(), try it with all errors enabled.

Cheers,

James

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



Re: [PHP] php mail() function

2009-10-24 Thread James Prentice
But it seems like the 'From:' address being given to the PHP mail()
function is maybe being ignored, because the error log lists
'www-d...@homemade' as being the sender, rather than listing the shaw
address.

The snippet from the PHP code:

$email = $_POST['email'];
...
mail($to, $subject, $msg, 'From:' . $email);

I have tried setting both $to and $email to be the same shaw address
since I assumed it should be recognized by the mail server, but it's
still getting bounced. So why is 'www-d...@homemade' being listed as
the sender? Any ideas?


On Sat, Oct 24, 2009 at 9:17 PM, James Prentice  wrote:
> I also suspect that the problem is due to the sender address, but I
> have tried using the shaw email address for the From: address that's
> given to the mail() function and it still gets bounced. It seems like
> the ISP should consider that address valid.
>
>
>
> On Sat, Oct 24, 2009 at 2:20 PM, Per olof Ljungmark  wrote:
>> James Prentice wrote:
>>>
>>> It sends the bounced message to /var/mail/www-data and I get this:
>>>
>>> --19BE8A70109.1256417846/homemade
>>> Content-Description: Delivery report
>>> Content-Type: message/delivery-status
>>>
>>> Reporting-MTA: dns; homemade
>>> X-Postfix-Queue-ID: 19BE8A70109
>>> X-Postfix-Sender: rfc822; www-d...@homemade
>>> Arrival-Date: Sat, 24 Oct 2009 13:57:26 -0700 (PDT)
>>>
>>> Final-Recipient: rfc822; x...@shaw.ca
>>> Action: failed
>>> Status: 5.0.0
>>> Diagnostic-Code: X-Postfix; shawmail.vc.shawcable.net
>>>
>>> --19BE8A70109.1256417846/homemade
>>> Content-Description: Undelivered Message
>>> Content-Type: message/rfc822
>>>
>>> Received: by homemade (Postfix, from userid 33)
>>>        id 19BE8A70109; Sat, 24 Oct 2009 13:57:26 -0700 (PDT)
>>> To: x...@shaw.ca
>>
>> Although 5.0.0 actually means something else I'm pretty sure you are
>> rejected because of an invalid sender address or domain. Use a sender
>> address that is valid with your ISP's mail relay.
>>
>> Just my $0.02
>>
>> --
>> per
>>
>

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



Re: [PHP] php mail() function

2009-10-24 Thread James Prentice
I also suspect that the problem is due to the sender address, but I
have tried using the shaw email address for the From: address that's
given to the mail() function and it still gets bounced. It seems like
the ISP should consider that address valid.



On Sat, Oct 24, 2009 at 2:20 PM, Per olof Ljungmark  wrote:
> James Prentice wrote:
>>
>> It sends the bounced message to /var/mail/www-data and I get this:
>>
>> --19BE8A70109.1256417846/homemade
>> Content-Description: Delivery report
>> Content-Type: message/delivery-status
>>
>> Reporting-MTA: dns; homemade
>> X-Postfix-Queue-ID: 19BE8A70109
>> X-Postfix-Sender: rfc822; www-d...@homemade
>> Arrival-Date: Sat, 24 Oct 2009 13:57:26 -0700 (PDT)
>>
>> Final-Recipient: rfc822; x...@shaw.ca
>> Action: failed
>> Status: 5.0.0
>> Diagnostic-Code: X-Postfix; shawmail.vc.shawcable.net
>>
>> --19BE8A70109.1256417846/homemade
>> Content-Description: Undelivered Message
>> Content-Type: message/rfc822
>>
>> Received: by homemade (Postfix, from userid 33)
>>        id 19BE8A70109; Sat, 24 Oct 2009 13:57:26 -0700 (PDT)
>> To: x...@shaw.ca
>
> Although 5.0.0 actually means something else I'm pretty sure you are
> rejected because of an invalid sender address or domain. Use a sender
> address that is valid with your ISP's mail relay.
>
> Just my $0.02
>
> --
> per
>

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



Re: [PHP] php mail() function

2009-10-24 Thread James Prentice
It sends the bounced message to /var/mail/www-data and I get this:

--19BE8A70109.1256417846/homemade
Content-Description: Delivery report
Content-Type: message/delivery-status

Reporting-MTA: dns; homemade
X-Postfix-Queue-ID: 19BE8A70109
X-Postfix-Sender: rfc822; www-d...@homemade
Arrival-Date: Sat, 24 Oct 2009 13:57:26 -0700 (PDT)

Final-Recipient: rfc822; x...@shaw.ca
Action: failed
Status: 5.0.0
Diagnostic-Code: X-Postfix; shawmail.vc.shawcable.net

--19BE8A70109.1256417846/homemade
Content-Description: Undelivered Message
Content-Type: message/rfc822

Received: by homemade (Postfix, from userid 33)
id 19BE8A70109; Sat, 24 Oct 2009 13:57:26 -0700 (PDT)
To: x...@shaw.ca

I will investigate how to change the loglevel of postfix, because
right now the error messages don't seem very helpful (at least to me).
Cheers

On Sat, Oct 24, 2009 at 1:27 PM, John Black
 wrote:
> James Prentice wrote:
>  > Also, I notice that in the mail.log file, the 'from:' value is
>>
>> 'www-d...@homemade'. The actual 'from:' value is provided to the php
>> mail() function via a web form, so should be somebody's email address
>> (e.g. my own in this case).
>
> I think PHP will use the apache user and domain to generate the email
> address. I use my own smtp function so I can't say for certain.
>
> One thing you could try is to use a valid email account on the server for
> the FROM address so that you can receive the bounced message. The actual
> message should contain more information.
> Alternatively attempt to increase the loglevel of postfix so you get exact
> feedback of why the connection is failing.
>
> As far as which server to use. I think this page lists the correct one:
> http://www.shaw.ca/en-ca/CustomerCare/InternetSupport/Residential/RoutersandShawServerNames.htm
>
> --
> John
>

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



Re: [PHP] php mail() function

2009-10-24 Thread James Prentice
Thanks, John. I set up the sasl_passwd file as per your instructions
but am still getting status=bounced. I'm wondering, what should the
values in main.cf be for 'myhostname' and 'mydestination'?

These pages give some info on the Shaw mail servers, but I'm not
certain which I should be using:

http://www.shaw.ca/en-ca/CustomerCare/InternetSupport/Residential/Email/ServiceDetails.htm

http://www.shaw.ca/en-ca/CustomerCare/InternetSupport/Residential/RoutersandShawServerNames.htm

Also, I notice that in the mail.log file, the 'from:' value is
'www-d...@homemade'. The actual 'from:' value is provided to the php
mail() function via a web form, so should be somebody's email address
(e.g. my own in this case).


from=, size=523, nrcpt=1 (queue active)
Oct 24 12:49:40 homemade postfix/error[7530]: B80B7A70109:
to=, relay=none, delay=0.04, delays=0.03/0/0/0.01,
dsn=5.0.0, status=bounced (shawmail)

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



Re: [PHP] php mail() function

2009-10-23 Thread James Prentice
I found the mail server for my ISP (shawmail.vc.shawcable.net) and
edited main.cf in the following manner:

myhostname = shawcable.net
relayhost = [shawmail.vc.shawcable.net]

I still don't receive the mail from the PHP script though. The error
log from /var/log/mail.log is this:

Oct 23 21:00:31 homemade postfix/pickup[7044]: 6CA44A70109: uid=33
from=
Oct 23 21:00:31 homemade postfix/cleanup[7107]: 6CA44A70109:
message-id=<20091024040031.6ca44a70...@shawcable.net>
Oct 23 21:00:31 homemade postfix/qmgr[7045]: 6CA44A70109:
from=, size=527, nrcpt=1 (queue active)
Oct 23 21:00:31 homemade postfix/error[7109]: 6CA44A70109:
to=, relay=none, delay=0.04, delays=0.03/0/0/0.01,
dsn=5.0.0, status=bounced ([shawmail.vc.shawcable.net])
Oct 23 21:00:31 homemade postfix/cleanup[7107]: 75517A7010A:
message-id=<20091024040031.75517a70...@shawcable.net>
Oct 23 21:00:31 homemade postfix/bounce[7110]: 6CA44A70109: sender
non-delivery notification: 75517A7010A
Oct 23 21:00:31 homemade postfix/qmgr[7045]: 75517A7010A: from=<>,
size=2219, nrcpt=1 (queue active)
Oct 23 21:00:31 homemade postfix/qmgr[7045]: 6CA44A70109: removed
Oct 23 21:00:31 homemade postfix/error[7109]: 75517A7010A:
to=, relay=none, delay=0.03,
delays=0.02/0/0/0.01, dsn=5.0.0, status=bounced
([shawmail.vc.shawcable.net])
Oct 23 21:00:31 homemade postfix/qmgr[7045]: 75517A7010A: removed

Have I edited main.cf incorrectly, or are there other values that need
to be edited?
Cheers

On Thu, Oct 22, 2009 at 6:24 PM, James Prentice  wrote:
> How would I determine my ISP's SMPT server ID? And do I need to edit
> main.cf in order to use that server?
>
> Also, is there a way to test the script just sending an email locally?
> I tried sending the email to use...@localhost, but the email was still
> not received.
>
>
>
> On Thu, Oct 22, 2009 at 4:15 PM, LinuxManMikeC  
> wrote:
>> The problem is you won't be trusted to deliver mail directly to most
>> mail servers unless you have a static IP.  Even then thats no
>> guarantee.  What you have to do is relay through your ISP's SMTP
>> server where you're "trusted".  You should also be able to setup PHP
>> to use your ISP's SMTP server and never touch the SMTP service on your
>> local machine (if you don't feel like playing with Postfix).
>>
>> On Thu, Oct 22, 2009 at 3:56 PM, James Prentice  
>> wrote:
>>> I'm trying to use the php mail() function to send a mail within a php
>>> script. This is using PHP 5.2.4 and Ubuntu Hardy Heron linux. The
>>> script runs fine and the return value of the mail function is TRUE,
>>> but the mail is never received. I'm trying to send an email to my
>>> gmail account via the local server on my machine, just to test if this
>>> script works.
>>>
>>> I installed postfix because I read in several places that people have
>>> had good luck with that mail program. From what I can tell, postfix is
>>> working. I can do:
>>>
>>> telnet localhost 25
>>> Trying 127.0.0.1...
>>> Connected to localhost.
>>> Escape character is '^]'.
>>> 220 homemade ESMTP Postfix (Ubuntu)
>>> ehlo localhost
>>> 250-homemade
>>> 250-PIPELINING
>>> 250-SIZE 1024
>>> 250-VRFY
>>> 250-ETRN
>>> 250-STARTTLS
>>> 250-ENHANCEDSTATUSCODES
>>> 250-8BITMIME
>>> 250 DSN
>>>
>>> After the php script runs, I type 'mailq' and get the result 'mail
>>> queue is empty.' If I check /var/log/mail.log, this is what I see:
>>>
>>> Oct 21 23:54:35 homemade postfix/pickup[5735]: 2A31EA70109: uid=33
>>> from=
>>> Oct 21 23:54:35 homemade postfix/cleanup[7997]: 2A31EA70109:
>>> message-id=<20091022065435.2a31ea70...@homemade>
>>> Oct 21 23:54:35 homemade postfix/qmgr[5736]: 2A31EA70109:
>>> from=, size=499, nrcpt=1 (queue active)
>>> Oct 21 23:54:35 homemade postfix/error[7999]: 2A31EA70109:
>>> to=, relay=none, delay=0.04, delays=0.03/0/0/0.01,
>>> dsn=5.0.0, status=bounced (gmail.com)
>>> Oct 21 23:54:35 homemade postfix/cleanup[7997]: 3217DA7010A:
>>> message-id=<20091022065435.3217da70...@homemade>
>>> Oct 21 23:54:35 homemade postfix/qmgr[5736]: 3217DA7010A: from=<>,
>>> size=2095, nrcpt=1 (queue active)
>>> Oct 21 23:54:35 homemade postfix/bounce[8000]: 2A31EA70109: sender
>>> non-delivery notification: 3217DA7010A
>>> Oct 21 23:54:35 homemade postfix/qmgr[5736]: 2A31EA70109: removed
>>> Oct 21 23:54:35 homemade postfix/local[8001]: 3217DA7010A:
>>> to=, relay=local, delay=0.03, delays=0/0.02/0/0.01,
>>> dsn=2.0.0, status=sent (delivered to command: procmail -a
>>> "$EXTENSION")
>>> Oct 21 23:54:35 homemade postfix/qmgr[5736]: 3217DA7010A: removed
>>>
>>> Any ideas? I am new both to php and postfix. Thanks for any help.
>>>
>>> --
>>> PHP General Mailing List (http://www.php.net/)
>>> To unsubscribe, visit: http://www.php.net/unsub.php
>>>
>>>
>>
>

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



Re: [PHP] php mail() function

2009-10-22 Thread James Prentice
How would I determine my ISP's SMPT server ID? And do I need to edit
main.cf in order to use that server?

Also, is there a way to test the script just sending an email locally?
I tried sending the email to use...@localhost, but the email was still
not received.



On Thu, Oct 22, 2009 at 4:15 PM, LinuxManMikeC  wrote:
> The problem is you won't be trusted to deliver mail directly to most
> mail servers unless you have a static IP.  Even then thats no
> guarantee.  What you have to do is relay through your ISP's SMTP
> server where you're "trusted".  You should also be able to setup PHP
> to use your ISP's SMTP server and never touch the SMTP service on your
> local machine (if you don't feel like playing with Postfix).
>
> On Thu, Oct 22, 2009 at 3:56 PM, James Prentice  
> wrote:
>> I'm trying to use the php mail() function to send a mail within a php
>> script. This is using PHP 5.2.4 and Ubuntu Hardy Heron linux. The
>> script runs fine and the return value of the mail function is TRUE,
>> but the mail is never received. I'm trying to send an email to my
>> gmail account via the local server on my machine, just to test if this
>> script works.
>>
>> I installed postfix because I read in several places that people have
>> had good luck with that mail program. From what I can tell, postfix is
>> working. I can do:
>>
>> telnet localhost 25
>> Trying 127.0.0.1...
>> Connected to localhost.
>> Escape character is '^]'.
>> 220 homemade ESMTP Postfix (Ubuntu)
>> ehlo localhost
>> 250-homemade
>> 250-PIPELINING
>> 250-SIZE 1024
>> 250-VRFY
>> 250-ETRN
>> 250-STARTTLS
>> 250-ENHANCEDSTATUSCODES
>> 250-8BITMIME
>> 250 DSN
>>
>> After the php script runs, I type 'mailq' and get the result 'mail
>> queue is empty.' If I check /var/log/mail.log, this is what I see:
>>
>> Oct 21 23:54:35 homemade postfix/pickup[5735]: 2A31EA70109: uid=33
>> from=
>> Oct 21 23:54:35 homemade postfix/cleanup[7997]: 2A31EA70109:
>> message-id=<20091022065435.2a31ea70...@homemade>
>> Oct 21 23:54:35 homemade postfix/qmgr[5736]: 2A31EA70109:
>> from=, size=499, nrcpt=1 (queue active)
>> Oct 21 23:54:35 homemade postfix/error[7999]: 2A31EA70109:
>> to=, relay=none, delay=0.04, delays=0.03/0/0/0.01,
>> dsn=5.0.0, status=bounced (gmail.com)
>> Oct 21 23:54:35 homemade postfix/cleanup[7997]: 3217DA7010A:
>> message-id=<20091022065435.3217da70...@homemade>
>> Oct 21 23:54:35 homemade postfix/qmgr[5736]: 3217DA7010A: from=<>,
>> size=2095, nrcpt=1 (queue active)
>> Oct 21 23:54:35 homemade postfix/bounce[8000]: 2A31EA70109: sender
>> non-delivery notification: 3217DA7010A
>> Oct 21 23:54:35 homemade postfix/qmgr[5736]: 2A31EA70109: removed
>> Oct 21 23:54:35 homemade postfix/local[8001]: 3217DA7010A:
>> to=, relay=local, delay=0.03, delays=0/0.02/0/0.01,
>> dsn=2.0.0, status=sent (delivered to command: procmail -a
>> "$EXTENSION")
>> Oct 21 23:54:35 homemade postfix/qmgr[5736]: 3217DA7010A: removed
>>
>> Any ideas? I am new both to php and postfix. Thanks for any help.
>>
>> --
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>>
>

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



[PHP] php mail() function

2009-10-22 Thread James Prentice
I'm trying to use the php mail() function to send a mail within a php
script. This is using PHP 5.2.4 and Ubuntu Hardy Heron linux. The
script runs fine and the return value of the mail function is TRUE,
but the mail is never received. I'm trying to send an email to my
gmail account via the local server on my machine, just to test if this
script works.

I installed postfix because I read in several places that people have
had good luck with that mail program. From what I can tell, postfix is
working. I can do:

telnet localhost 25
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
220 homemade ESMTP Postfix (Ubuntu)
ehlo localhost
250-homemade
250-PIPELINING
250-SIZE 1024
250-VRFY
250-ETRN
250-STARTTLS
250-ENHANCEDSTATUSCODES
250-8BITMIME
250 DSN

After the php script runs, I type 'mailq' and get the result 'mail
queue is empty.' If I check /var/log/mail.log, this is what I see:

Oct 21 23:54:35 homemade postfix/pickup[5735]: 2A31EA70109: uid=33
from=
Oct 21 23:54:35 homemade postfix/cleanup[7997]: 2A31EA70109:
message-id=<20091022065435.2a31ea70...@homemade>
Oct 21 23:54:35 homemade postfix/qmgr[5736]: 2A31EA70109:
from=, size=499, nrcpt=1 (queue active)
Oct 21 23:54:35 homemade postfix/error[7999]: 2A31EA70109:
to=, relay=none, delay=0.04, delays=0.03/0/0/0.01,
dsn=5.0.0, status=bounced (gmail.com)
Oct 21 23:54:35 homemade postfix/cleanup[7997]: 3217DA7010A:
message-id=<20091022065435.3217da70...@homemade>
Oct 21 23:54:35 homemade postfix/qmgr[5736]: 3217DA7010A: from=<>,
size=2095, nrcpt=1 (queue active)
Oct 21 23:54:35 homemade postfix/bounce[8000]: 2A31EA70109: sender
non-delivery notification: 3217DA7010A
Oct 21 23:54:35 homemade postfix/qmgr[5736]: 2A31EA70109: removed
Oct 21 23:54:35 homemade postfix/local[8001]: 3217DA7010A:
to=, relay=local, delay=0.03, delays=0/0.02/0/0.01,
dsn=2.0.0, status=sent (delivered to command: procmail -a
"$EXTENSION")
Oct 21 23:54:35 homemade postfix/qmgr[5736]: 3217DA7010A: removed

Any ideas? I am new both to php and postfix. Thanks for any help.

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



Re: [PHP] Plotting a Line Graph

2009-10-16 Thread James Ausmus
jpgraph:

http://www.aditus.nu/jpgraph/

On Fri, Oct 16, 2009 at 10:32 AM,   wrote:
> (sorry about the long Subject line typo - resending)
>
> I have a data file that stores about 500 numbers in a record - meant to plot
> a basic line graph (left to right). The numbers can be imported into a
> record with 500 fields or just stored in a text field - which ever is
> better.
>
> The user might want to pick a few random records and plot them together - so
> the line graph may compare the few records together.
>
> It seems that the google charts work from a url - so 500 points would be way
> to long for any url - so I guess that option is out.
>
> Q: what is the best way to create / display line graphs in with PHP?
>
> Thanks in advance for your help - dave
>
>
>
>
> Thanks,
> c...@hosting4days.com
>
>
>
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

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



Re: [PHP] security/deployment issue

2009-10-11 Thread James McLean
On Mon, Oct 12, 2009 at 4:06 PM, Augusto Flavio  wrote:
> i have a doubt about my security and deployment methods. Today i manage
> several projects and these projects are versioned with subversion. My
> environment is something like this:
>
> 1. The developer make some update in the source code of a project. (from
> your IDE, generally netbeans)
> 2. The developer commit the modifications to the subversion server after
> test it(sure).
> 3. The project manager sync the files from the dev server to the prod
> server(using rsync).

Sounds mostly fine. I assume you have other testing going on before
deployment to production, though.

> Well, my questions are 2. All about the rsync:
>
> 1. For each project we have a ssh user that is used to sync the files(source
> code) to the prod server. The problem that i see here is that for each
> project i need to have a ssh account to sync these files. This is not so
> cool because i need to have severals actived ssh accounts in my prod server.
> I'm thinking about the root account to do this work. Is this a good
> practice?

The root account is not a very good idea for this. You could create a
'service' account that is used exclusively for transferring the files
to the server. To allow this user access to the various source
directories you can use something like ACL's or perhaps even regular
UNIX file permissions may work if your needs aren't very complex.

> 2. Does have some another way, more better than the rsync for this
> deployment issue?

Rsync should work fine, but personally I like to see exactly which
changes are being deployed especially when deploying to production.
While I realise this recommendation is not Open Source software, I
have found it to be an excellent piece of software for this task. I
use Beyond Compare which has the ability to connect over SFTP or SCP
as well as regular FTP. It allows you to 'diff' the files as you go
and view exact changes and you can transfer only the changes you want
or whole files if you choose to. I would not be surprised if an Open
Source equivalent exists.

Cheers,

James

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



Re: [PHP] utf8_decode() and mixed character sets

2009-10-10 Thread James Colannino
Andrew Ballard wrote:

> Have you tried iconv or mb_string? Is it a  option to update the
> database to use UTF-8?

I'll look into those functions.  And, I suppose I could in fact convert my
database to use UTF-8 if necessary.

James

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



[PHP] utf8_decode() and mixed character sets

2009-10-10 Thread James Colannino
Hey everyone.  I'd been troubled for a while by the fact that inserting
cut-pasted special characters such as ä caused truncation when passed to
MySQL, then discovered that it was because I was cutting and pasting unicode
values into non-unicode Latin-1 strings.

Since Latin-1 also has equivalent values, I was hoping that filtering my mixed
unicode/non-unicode string through utf8_decode() would solve the problem, but
instead, where the unicode character used to be, I now get a '?', followed by a
few characters being taken out of the middle.  I'm guessing that this is because
utf8_decode() assumes the whole string is unicode and therefore removes a bunch
of extra bytes from the string and corrupts it.  At least, that's my guess.  I
could be very wrong (I have pretty much no experience with different character
sets...)

My question is, what's a good way to translate unicode characters in a
non-unicode string to their Latin-1 equivalents?  I need to be able to do this
in order to sanitize a fairly common form of input.

Thanks!

James

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



[PHP] Converting print_r() output to an array

2009-09-30 Thread James Colannino
Hey everyone, I was pretty sure there was an easy built-in solution for
what I want to do, but I've been googling around with no luck.
Basically, I just want to take a string containing the output of
print_r() and convert it back into an array again.

That is possible, right?  If so, how do I go about it?  If not, what's a
quick and easy way to parse a string and turn it into an array (I don't
necessarily need the string to be in the format print_r returns).

Thanks!

James

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



Re: [PHP] Sorting an array of sub-arrays based on a sub-array's key

2009-09-06 Thread James Colannino
Eddie Drapkin wrote:

> http://us3.php.net/uasort

Exactly what I was looking for.  Thanks.

James

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