php-general Digest 12 Jul 2012 19:09:29 -0000 Issue 7885

Topics (messages 318429 through 318446):

Contribute to PHP
        318429 by: Ziad Jammal
        318430 by: Matijn Woudt
        318431 by: Ziad Jammal
        318432 by: Sebastian Krebs
        318433 by: Mihamina Rakotomandimby

database hell
        318434 by: Nick Edwards
        318435 by: Gibbs
        318436 by: Nick Edwards
        318437 by: Stuart Dallas
        318438 by: Adam Nicholls
        318439 by: Gibbs
        318440 by: Nick Edwards
        318441 by: Nick Edwards
        318442 by: marco.behnke.biz
        318443 by: Ashley Sheridan

vCard Image
        318444 by: Floyd Resler

Reverse DNS testing
        318445 by: Al
        318446 by: Jim Lucas

Administrivia:

To subscribe to the digest, e-mail:
        php-general-digest-subscr...@lists.php.net

To unsubscribe from the digest, e-mail:
        php-general-digest-unsubscr...@lists.php.net

To post to the list, e-mail:
        php-gene...@lists.php.net


----------------------------------------------------------------------
--- Begin Message ---
Deal all phpiers,

It took me a while before I hit the send key.
I have been a php developer for some time and I got certified beginning of this 
year.
I have always wanted to start contributing to php and zend framework, but I am 
unable to find the right docs, examples, and the "how". 
I know it might be a simple task, but I appreciate your support as I really 
want to contribute some good stuff to the php community.

Appreciate if someone can share a reported  bug, how he traced its location and 
how he got it fixed.

Many thanks,
Ziad


--- End Message ---
--- Begin Message ---
On Thu, Jul 12, 2012 at 8:45 AM, Ziad Jammal <z...@eljammal.com> wrote:
> Deal all phpiers,
>
> It took me a while before I hit the send key.
> I have been a php developer for some time and I got certified beginning of 
> this year.
> I have always wanted to start contributing to php and zend framework, but I 
> am unable to find the right docs, examples, and the "how".
> I know it might be a simple task, but I appreciate your support as I really 
> want to contribute some good stuff to the php community.
>
> Appreciate if someone can share a reported  bug, how he traced its location 
> and how he got it fixed.
>
> Many thanks,
> Ziad


Hi Ziad,

This is the PHP users list where people ask their questions about PHP
scripts. If you're interested in contributing to PHP development, you
should use the PHP internals list.

- Matijn

--- End Message ---
--- Begin Message ---
thx Matin and apologies all for my email.
I will check with the other list.

Regards,
Ziad

On Jul 12, 2012, at 10:52 AM, Matijn Woudt wrote:

> On Thu, Jul 12, 2012 at 8:45 AM, Ziad Jammal <z...@eljammal.com> wrote:
>> Deal all phpiers,
>> 
>> It took me a while before I hit the send key.
>> I have been a php developer for some time and I got certified beginning of 
>> this year.
>> I have always wanted to start contributing to php and zend framework, but I 
>> am unable to find the right docs, examples, and the "how".
>> I know it might be a simple task, but I appreciate your support as I really 
>> want to contribute some good stuff to the php community.
>> 
>> Appreciate if someone can share a reported  bug, how he traced its location 
>> and how he got it fixed.
>> 
>> Many thanks,
>> Ziad
> 
> 
> Hi Ziad,
> 
> This is the PHP users list where people ask their questions about PHP
> scripts. If you're interested in contributing to PHP development, you
> should use the PHP internals list.
> 
> - Matijn
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 


--- End Message ---
--- Begin Message ---
Hi,

Nowadays contributing to an OSS-project is (thankfully) often just a matter
of creating a github account and sending a pull request. Because you
mentioned the ZF, have a look at it's github mirror [1]. There is also a
section about contributing in the readme-file. Other projects have similar
documents.

Regards,
Sebastian


[1] https://github.com/zendframework/zf2/

2012/7/12 Ziad Jammal <z...@eljammal.com>

> Deal all phpiers,
>
> It took me a while before I hit the send key.
> I have been a php developer for some time and I got certified beginning of
> this year.
> I have always wanted to start contributing to php and zend framework, but
> I am unable to find the right docs, examples, and the "how".
> I know it might be a simple task, but I appreciate your support as I
> really want to contribute some good stuff to the php community.
>
> Appreciate if someone can share a reported  bug, how he traced its
> location and how he got it fixed.
>
> Many thanks,
> Ziad
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

--- End Message ---
--- Begin Message ---
On 07/12/2012 10:45 AM, Sebastian Krebs wrote:
Nowadays contributing to an OSS-project is (thankfully) often just a matter
of creating a github account and sending a pull request.

Clone, commit, pull, push then send the pull request.

Also note that "contributing" to PHP" means "contributing to the core of PHP" tome: C skills needed then.

Because you
mentioned the ZF, have a look at it's github mirror [1]. There is also a
section about contributing in the readme-file. Other projects have similar
documents.

If it doenst, the contributor could contribute by creating it.

--
RMA.



--- End Message ---
--- Begin Message ---
Hi

We have a program that manages users, throughout all database calls

created as:
$connect = mysql_connect($db_host--other variables);
mysql_query("Delete from clients where id=$User");

All this works good, but, we need, in the delete function to delete
from another database

$connmy=mysql_connect("host","user","pass");
                    mysql_select_db("vsq",$connmy);
                    mysql_query("DELETE from userprefs where clientr='$User'");
$mysql_close($connmy);
this fails, unless we use a mysql_close prior to it, and then
reconnect to original database after we run this delete, how can we
get around this without closing and reopening?
We have a  perl script doing similar for manual runs, and it works
well knowing that $connmy is not $connect, I'm sure there is a simple
way to tell php but  I'm darned if I can see it.

Thanks
Niki

--- End Message ---
--- Begin Message ---
On 12/07/12 12:29, Nick Edwards wrote:
Hi

We have a program that manages users, throughout all database calls

created as:
$connect = mysql_connect($db_host--other variables);
mysql_query("Delete from clients where id=$User");

All this works good, but, we need, in the delete function to delete
from another database

$connmy=mysql_connect("host","user","pass");
                     mysql_select_db("vsq",$connmy);
                     mysql_query("DELETE from userprefs where clientr='$User'");
$mysql_close($connmy);
this fails, unless we use a mysql_close prior to it, and then
reconnect to original database after we run this delete, how can we
get around this without closing and reopening?
We have a  perl script doing similar for manual runs, and it works
well knowing that $connmy is not $connect, I'm sure there is a simple
way to tell php but  I'm darned if I can see it.

Thanks
Niki

You need to make a new link. So you would add TRUE to the end of the second connection.

$connmy=mysql_connect("host","user","pass", TRUE);

http://php.net/manual/en/function.mysql-connect.php

Gibbs

--- End Message ---
--- Begin Message ---
On 7/12/12, Gibbs <li...@danielgibbs.net> wrote:
> On 12/07/12 12:29, Nick Edwards wrote:
>> Hi
>>
>> We have a program that manages users, throughout all database calls
>>
>> created as:
>> $connect = mysql_connect($db_host--other variables);
>> mysql_query("Delete from clients where id=$User");
>>
>> All this works good, but, we need, in the delete function to delete
>> from another database
>>
>> $connmy=mysql_connect("host","user","pass");
>>                      mysql_select_db("vsq",$connmy);
>>                      mysql_query("DELETE from userprefs where
>> clientr='$User'");
>> $mysql_close($connmy);
>> this fails, unless we use a mysql_close prior to it, and then
>> reconnect to original database after we run this delete, how can we
>> get around this without closing and reopening?
>> We have a  perl script doing similar for manual runs, and it works
>> well knowing that $connmy is not $connect, I'm sure there is a simple
>> way to tell php but  I'm darned if I can see it.
>>
>> Thanks
>> Niki
>>
> You need to make a new link. So you would add TRUE to the end of the
> second connection.
>
> $connmy=mysql_connect("host","user","pass", TRUE);
>
> http://php.net/manual/en/function.mysql-connect.php
>


Thanks, will give that a shot

--- End Message ---
--- Begin Message ---
On 12 Jul 2012, at 12:29, Nick Edwards wrote:

> We have a program that manages users, throughout all database calls
> 
> created as:
> $connect = mysql_connect($db_host--other variables);
> mysql_query("Delete from clients where id=$User");
> 
> All this works good, but, we need, in the delete function to delete
> from another database
> 
> $connmy=mysql_connect("host","user","pass");
>                    mysql_select_db("vsq",$connmy);
>                    mysql_query("DELETE from userprefs where clientr='$User'");
> $mysql_close($connmy);
> this fails, unless we use a mysql_close prior to it, and then
> reconnect to original database after we run this delete, how can we
> get around this without closing and reopening?
> We have a  perl script doing similar for manual runs, and it works
> well knowing that $connmy is not $connect, I'm sure there is a simple
> way to tell php but  I'm darned if I can see it.

The mysql_query method takes a second parameter specifying the MySQL connection 
to which to send the query. If you're dealing with multiple hosts you will want 
to add that to every single mysql_* function call that supports it, otherwise 
you could end up running queries on the wrong database.

You may also want to note that using the mysql_* functions is now discouraged 
in favour of MySQLi or PDO: http://php.net/mysqlinfo.api.choosing

-Stuart

-- 
Stuart Dallas
3ft9 Ltd
http://3ft9.com/

--- End Message ---
--- Begin Message ---

> -----Original Message-----
> From: Nick Edwards [mailto:nick.z.edwa...@gmail.com]
> Sent: 12 July 2012 12:30
> To: php-gene...@lists.php.net
> Subject: [PHP] database hell
> 
> Hi
> 
> We have a program that manages users, throughout all database calls
> 
> created as:
> $connect = mysql_connect($db_host--other variables);
> mysql_query("Delete from clients where id=$User");
> 
> All this works good, but, we need, in the delete function to delete from
> another database
> 
> $connmy=mysql_connect("host","user","pass");
>                     mysql_select_db("vsq",$connmy);
>                     mysql_query("DELETE from userprefs where 
> clientr='$User'");
> $mysql_close($connmy); this fails, unless we use a mysql_close prior to it,
> and then reconnect to original database after we run this delete, how can we
> get around this without closing and reopening?
> We have a  perl script doing similar for manual runs, and it works well
> knowing that $connmy is not $connect, I'm sure there is a simple way to tell
> php but  I'm darned if I can see it.
> 
> Thanks
> Niki
> 
> --
> PHP General Mailing List (http://www.php.net/) To unsubscribe, visit:
> http://www.php.net/unsub.php


Just create a new resource/connection to MySQL and pass the identifier into 
mysql_query().
You'll also want to use mysql_real_escape_string() by the looks of it to 
attempt to stop SQL injection.


Something like this will do it:

$db1 = mysql_connect($host,$user,$pass);
$db2 = mysql_connect($host,$user,$pass);

mysql_select_db('db1',$db1);
mysql_select_db('db2',$db2);

// do your queries with $DB1

$result = mysql_query("delete from userprefs where 
clientr=".mysql_real_escape_string($user,$db1)."", $db1);

// do your queries again with $DB1

mysql_close($db1);//close db1
mysql_close($db2);//close db2


Cheers
Adam.

=============================================================================

This email is intended solely for the recipient and is confidential and not for 
third party unauthorised distribution. If an addressing or transmission error 
has misdirected this email, please notify the author by replying to this email 
or notifying the system manager (online.secur...@hl.co.uk).  If you are not the 
intended recipient you must not disclose, distribute, copy, print or rely on 
this email. 

Any opinions expressed in this document are those of the author and do not 
necessarily reflect the opinions of Hargreaves Lansdown. In addition, staff are 
not authorised to enter into any contract through email and therefore nothing 
contained herein should be construed as such. Hargreaves Lansdown makes no 
warranty as to the accuracy or completeness of any information contained within 
this email. In particular, Hargreaves Lansdown does not accept responsibility 
for any changes made to this email after it was sent. 

Hargreaves Lansdown Asset Management Limited (Company Registration No 1896481), 
Hargreaves Lansdown Fund Managers Limited (No 2707155), Hargreaves Lansdown 
Pensions Direct Limited (No 3509545) and Hargreaves Lansdown Stockbrokers 
Limited (No 1822701) are authorised and regulated by the Financial Services 
Authority and registered in England and Wales. The registered office for all 
companies is One College Square South, Anchor Road, Bristol, BS1 5HL. 
Telephone: 0117 988 9880

______________________________________________________________________
This email has been scanned by the Symantec Email Security.cloud service.
For more information please visit http://www.symanteccloud.com
______________________________________________________________________

--- End Message ---
--- Begin Message ---
On 12/07/12 12:38, Nick Edwards wrote:
On 7/12/12, Gibbs <li...@danielgibbs.net> wrote:
On 12/07/12 12:29, Nick Edwards wrote:
Hi

We have a program that manages users, throughout all database calls

created as:
$connect = mysql_connect($db_host--other variables);
mysql_query("Delete from clients where id=$User");

All this works good, but, we need, in the delete function to delete
from another database

$connmy=mysql_connect("host","user","pass");
                      mysql_select_db("vsq",$connmy);
                      mysql_query("DELETE from userprefs where
clientr='$User'");
$mysql_close($connmy);
this fails, unless we use a mysql_close prior to it, and then
reconnect to original database after we run this delete, how can we
get around this without closing and reopening?
We have a  perl script doing similar for manual runs, and it works
well knowing that $connmy is not $connect, I'm sure there is a simple
way to tell php but  I'm darned if I can see it.

Thanks
Niki

You need to make a new link. So you would add TRUE to the end of the
second connection.

$connmy=mysql_connect("host","user","pass", TRUE);

http://php.net/manual/en/function.mysql-connect.php


Thanks, will give that a shot

I forgot to add your queries will need the new link too. So

mysql_query("DELETE from userprefs where clientr='$User'", $connmy);

Gibbs



--- End Message ---
--- Begin Message ---
On 7/12/12, Adam Nicholls <adam.nicho...@hl.co.uk> wrote:
>
>
>> -----Original Message-----
>> From: Nick Edwards [mailto:nick.z.edwa...@gmail.com]
>> Sent: 12 July 2012 12:30
>> To: php-gene...@lists.php.net
>> Subject: [PHP] database hell
>>
>> Hi
>>
>> We have a program that manages users, throughout all database calls
>>
>> created as:
>> $connect = mysql_connect($db_host--other variables);
>> mysql_query("Delete from clients where id=$User");
>>
>> All this works good, but, we need, in the delete function to delete from
>> another database
>>
>> $connmy=mysql_connect("host","user","pass");
>>                     mysql_select_db("vsq",$connmy);
>>                     mysql_query("DELETE from userprefs where
>> clientr='$User'");
>> $mysql_close($connmy); this fails, unless we use a mysql_close prior to
>> it,
>> and then reconnect to original database after we run this delete, how can
>> we
>> get around this without closing and reopening?
>> We have a  perl script doing similar for manual runs, and it works well
>> knowing that $connmy is not $connect, I'm sure there is a simple way to
>> tell
>> php but  I'm darned if I can see it.
>>
>> Thanks
>> Niki
>>
>> --
>> PHP General Mailing List (http://www.php.net/) To unsubscribe, visit:
>> http://www.php.net/unsub.php
>
>
> Just create a new resource/connection to MySQL and pass the identifier into
> mysql_query().
> You'll also want to use mysql_real_escape_string() by the looks of it to
> attempt to stop SQL injection.
>
>
> Something like this will do it:
>
> $db1 = mysql_connect($host,$user,$pass);
> $db2 = mysql_connect($host,$user,$pass);
>
> mysql_select_db('db1',$db1);
> mysql_select_db('db2',$db2);
>
> // do your queries with $DB1
>
> $result = mysql_query("delete from userprefs where
> clientr=".mysql_real_escape_string($user,$db1)."", $db1);
>
> // do your queries again with $DB1
>
> mysql_close($db1);//close db1
> mysql_close($db2);//close db2
>


We can not immediately close db2?  if we do it seems to close all connections?

Thanks

>
> Cheers
> Adam.
>
> =============================================================================
>
> This email is intended solely for the recipient and is confidential and not
> for third party unauthorised distribution. If an addressing or transmission
> error has misdirected this email, please notify the author by replying to
> this email or notifying the system manager (online.secur...@hl.co.uk).  If
> you are not the intended recipient you must not disclose, distribute, copy,
> print or rely on this email.
>
> Any opinions expressed in this document are those of the author and do not
> necessarily reflect the opinions of Hargreaves Lansdown. In addition, staff
> are not authorised to enter into any contract through email and therefore
> nothing contained herein should be construed as such. Hargreaves Lansdown
> makes no warranty as to the accuracy or completeness of any information
> contained within this email. In particular, Hargreaves Lansdown does not
> accept responsibility for any changes made to this email after it was sent.
>
>
> Hargreaves Lansdown Asset Management Limited (Company Registration No
> 1896481), Hargreaves Lansdown Fund Managers Limited (No 2707155), Hargreaves
> Lansdown Pensions Direct Limited (No 3509545) and Hargreaves Lansdown
> Stockbrokers Limited (No 1822701) are authorised and regulated by the
> Financial Services Authority and registered in England and Wales. The
> registered office for all companies is One College Square South, Anchor
> Road, Bristol, BS1 5HL. Telephone: 0117 988 9880
>

--- End Message ---
--- Begin Message ---
On 7/12/12, Gibbs <li...@danielgibbs.net> wrote:

>>> $connmy=mysql_connect("host","user","pass", TRUE);
>>>
>>> http://php.net/manual/en/function.mysql-connect.php
>>>
>>
>> Thanks, will give that a shot
>>
> I forgot to add your queries will need the new link too. So
>
> mysql_query("DELETE from userprefs where clientr='$User'", $connmy);
>

Got that, ta  :)

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

--- End Message ---
--- Begin Message ---


Nick Edwards <nick.z.edwa...@gmail.com> hat am 12. Juli 2012 um 14:00
geschrieben:

> On 7/12/12, Gibbs <li...@danielgibbs.net> wrote:
> 
> > mysql_query("DELETE from userprefs where clientr='$User'", $connmy);


Sidenote: And don't forget to validate user input and make use of mysql escape
and prepared statements ;)

--- End Message ---
--- Begin Message ---

"ma...@behnke.biz" <ma...@behnke.biz> wrote:

>
>
>
>Nick Edwards <nick.z.edwa...@gmail.com> hat am 12. Juli 2012 um 14:00
>geschrieben:
>
>> On 7/12/12, Gibbs <li...@danielgibbs.net> wrote:
>>
>> > mysql_query("DELETE from userprefs where clientr='$User'",
>$connmy);
>
>
>Sidenote: And don't forget to validate user input and make use of mysql
>escape
>and prepared statements ;)
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, visit: http://www.php.net/unsub.php

Another way if the access credentials are the same would be to specify the full 
'path' to the table in the query:

DELETE FROM database.table WHERE clause


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

--- End Message ---
--- Begin Message ---
I'm trying to extract the image from a vCard and display it.  I'm not having 
any luck.  I saw a sample of putting an image into a vCard via PHP and use 
base64_encode.  So I thought base64_decode would work.  However, still no luck. 
 Anyone have any ideas?

Thanks!
Floyd




--- End Message ---
--- Begin Message --- I want to do a rDNS check on a admin entered host name to insure in-coming mail servers don't reject mail, sent by my app, because the rDNS doesn't exist or doesn't match.

Here is the fundamental code:

$host = $_SERVER['SERVER_NAME']; //site name shared or not
$ip = gethostbyname($host);

$hostName = gethostbyaddr($ip); //May be different on a shared host
$ip2 = gethostbyname($hostName);

The $ip works fine.

However, one of the shared hosts I'm working with returns this instead of the original $host

gethostbyaddr($ip)=> 93.247.128.148-static.foo.com [foo is subs for actual]

gethostbyname($hostName)=> 93.247.128.148-static.foo.com  It appears
gethostbyname() is just returning $hostName because it is not legit.
Using just the foo.com in gethostbyname() returns the host's server IP.

Thus, the typical rDNS check fails for this site. Several online checks also report rDNS fails.

Any suggestions how I can handle this?


--- End Message ---
--- Begin Message ---
On 07/12/2012 11:17 AM, Al wrote:
I want to do a rDNS check on a admin entered host name to insure
in-coming mail servers don't reject mail, sent by my app, because the
rDNS doesn't exist or doesn't match.

Here is the fundamental code:

$host = $_SERVER['SERVER_NAME']; //site name shared or not
$ip = gethostbyname($host);


$hostName = gethostbyaddr($ip); //May be different on a shared host
$ip2 = gethostbyname($hostName);

Throw in a filter_var() check with the FILTER_VALIDATE_IP flag?

if ( filter_var($hostName, FILTER_VALIDATE_IP) === TRUE ) {
        # This is an IP
        # do something
}

Or do a conditional check

if ( $hostName === $ip2 ) {
        # no change...
        # handle no resolution issue.
}


The $ip works fine.

However, one of the shared hosts I'm working with returns this instead
of the original $host

gethostbyaddr($ip)=> 93.247.128.148-static.foo.com [foo is subs for actual]

gethostbyname($hostName)=> 93.247.128.148-static.foo.com It appears
gethostbyname() is just returning $hostName because it is not legit.
Using just the foo.com in gethostbyname() returns the host's server IP.

Thus, the typical rDNS check fails for this site. Several online checks
also report rDNS fails.

Any suggestions how I can handle this?




--
Jim Lucas

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

--- End Message ---

Reply via email to