php-general Digest 25 Nov 2011 14:13:24 -0000 Issue 7583

2011-11-25 Thread php-general-digest-help

php-general Digest 25 Nov 2011 14:13:24 - Issue 7583

Topics (messages 315802 through 315806):

Retrieve subjectAltName from client certificate
315802 by: Nelson Teixeira

news and article posts in one table
315803 by: muad shibani
315804 by: Geert Mak

Hi!
315805 by: Jay S

Method argument context resolution syntax
315806 by: Dmitry

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


--
---BeginMessage---
Hello,

 I'm trying to read subjectAltName field from a client certificate with

$x509 = openssl_x509_parse($_SERVER['SSL_CLIENT_CERT']);
$subjectAltName = $x509['extensions']['subjectAltName'];

but the field contains  othername:, othername:, othername:, where the
real data should be. There's valid data there because I can see it in
firefox's certificate view. I already have SSLOptions +StdEnvVars
+ExportCertData configured in apache. I can read correctly serveral other
fields.

How can I receive correctly from apache and extract the real data ?

-Nelson
---End Message---
---BeginMessage---
i wanna to create one table that contains both news and articles posts,
they have similar columns like id, title, content, and date but they are
differ in one column = the source of news or article post
article has  writers that have permanent names and pictures obtained from
another table called writers that supposed to be  left joined with the news
table, while news posts simply have a source as text like AFP
or Reuters and so one.

How I can solve this ?
---End Message---
---BeginMessage---
You do not want to have Reuters as a writer with logo instead of a photo?

On 24.11.2011, at 22:55, muad shibani muad.shib...@gmail.com wrote:

 i wanna to create one table that contains both news and articles posts,
 they have similar columns like id, title, content, and date but they are
 differ in one column = the source of news or article post
 article has  writers that have permanent names and pictures obtained from
 another table called writers that supposed to be  left joined with the news
 table, while news posts simply have a source as text like AFP
 or Reuters and so one.
 
 How I can solve this ?
---End Message---
---BeginMessage---
Hi,

Hope you are doing awesome!

My name is Jay and I am the Affiliate Account
Manager at InstallMonetizer.

I wanted to connect with you and show you
how you can make more money by using our
services to monetize your install path. :)

Currently, I see you are offering your
software on Download.com.

Our payouts will far exceed that.

Below are our sample payouts (eCPM):
**1000 USA offer screens displayed: $380.00
**1000 European offer screens displayed: $230.00
NOTE - We monetize all countries :)

Most publishers run a test with us and
quickly see that we payout 3-4x more
than their current advertiser.

I would love have you run a test on our network. :)

When would be a good time to chat?
Skype: jay.installmonetizer
Yahoo: dhaliwal.jasjeet

Thanks for your time!


-- 
Sincerely,
Jay S.
j...@installmonetizercorp.com j...@installmonetizer.com
Skype: jay.installmonetizer
Yahoo: dhaliwal.jasjeet
---End Message---
---BeginMessage---
Hello, everybody.

What do you think about this? https://bugs.php.net/bug.php?id=60372
---End Message---


[PHP] Method argument context resolution syntax

2011-11-25 Thread Dmitry
Hello, everybody.

What do you think about this? https://bugs.php.net/bug.php?id=60372


[PHP] Is there a decent design app ?

2011-11-25 Thread Andreas

Hi

Is there a decent design app that can automatically update links within 
the pages of a php site whenever a referred file gets moved or renamed?


Like you have /foo.css and for some reason or another you move it to 
/lib/css and rename it to bar.css.
Now it'd be nice if an IDE was aware of all the references within a site 
and update the affected urls.




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



Re: [PHP] Is there a decent design app ?

2011-11-25 Thread muad shibani
you can use find and replace feature in some IDEs to accomplish your task
..
Dreamweaver do the job but with links inside HTML code

On Sat, Nov 26, 2011 at 2:17 AM, Andreas maps...@gmx.net wrote:

 Hi

 Is there a decent design app that can automatically update links within
 the pages of a php site whenever a referred file gets moved or renamed?

 Like you have /foo.css and for some reason or another you move it to
 /lib/css and rename it to bar.css.
 Now it'd be nice if an IDE was aware of all the references within a site
 and update the affected urls.



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




-- 
*___*
*
*
السجل .. كل الأخبار من كل مكان

www.alsjl.com

صفحة السجل على فيسبوك
http://www.facebook.com/alsjl

*Muad Shibani*
*
*
Aden Yemen
Mobile: 00967 733045678

www.muadshibani.com


[PHP] Howto detect the hostname of the server?

2011-11-25 Thread Andreas

Hi,
how could I identify the server the script runs on?

I've got a testserver on Windows and a remote system on Linux that need 
a couple of different settings like IP and port of db-server or folder 
to store logfiles.


I'd like to do something like:

if ( $_SERVER['some_key'] = 'my_test_box' ) {
$db_host = '1.1.1.1';
$db_port = 1234;
} else {
$db_host = '2.2.2.2';
$db_port = 4321;
}


I looked into phpinfo() but haven't found anything helpful, yet.
Have I overlooked something or is there another way to identify the server?

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



Re: [PHP] Howto detect the hostname of the server?

2011-11-25 Thread Stuart Dallas
On 26 Nov 2011, at 00:14, Andreas wrote:
 Hi,
 how could I identify the server the script runs on?
 
 I've got a testserver on Windows and a remote system on Linux that need a 
 couple of different settings like IP and port of db-server or folder to store 
 logfiles.
 
 I'd like to do something like:
 
 if ( $_SERVER['some_key'] = 'my_test_box' ) {
$db_host = '1.1.1.1';
$db_port = 1234;
 } else {
$db_host = '2.2.2.2';
$db_port = 4321;
 }
 
 
 I looked into phpinfo() but haven't found anything helpful, yet.
 Have I overlooked something or is there another way to identify the server?


This should work on most Linux variants, so long as the hostname command exists 
and the PHP process has permission to execute it.

function getServerHostname($full = false)
{
$retval = `hostname`;
if (!$full) {
$retval = array_shift(explode('.', $retval));
}
return $retval;
}

-Stuart

-- 
Stuart Dallas
3ft9 Ltd
http://3ft9.com/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Howto detect the hostname of the server?

2011-11-25 Thread Mark Kelly
Hi.

On Saturday 26 Nov 2011 at 00:14 Andreas wrote:

 how could I identify the server the script runs on?

[snip]
 
 I looked into phpinfo() but haven't found anything helpful, yet.
 Have I overlooked something or is there another way to identify the server?

Wouldn't the server IP address in $_SERVER['SERVER_ADDR'] or the hostname in 
$_SERVER['SERVER_NAME'] do the trick? That's what I use. The second one is 
handy for differentiating between sites when using Apache name-based virtual 
hosts on the same IP.

Full list here:

http://uk.php.net/manual/en/reserved.variables.server.php

Cheers,

Mark

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



Re: [PHP] Howto detect the hostname of the server?

2011-11-25 Thread Stuart Dallas
On 26 Nov 2011, at 00:24, Stuart Dallas wrote:
 On 26 Nov 2011, at 00:14, Andreas wrote:
 Hi,
 how could I identify the server the script runs on?
 
 I've got a testserver on Windows and a remote system on Linux that need a 
 couple of different settings like IP and port of db-server or folder to 
 store logfiles.
 
 I'd like to do something like:
 
 if ( $_SERVER['some_key'] = 'my_test_box' ) {
   $db_host = '1.1.1.1';
   $db_port = 1234;
 } else {
   $db_host = '2.2.2.2';
   $db_port = 4321;
 }
 
 
 I looked into phpinfo() but haven't found anything helpful, yet.
 Have I overlooked something or is there another way to identify the server?
 
 This should work on most Linux variants, so long as the hostname command 
 exists and the PHP process has permission to execute it.
 
 function getServerHostname($full = false)
 {
   $retval = `hostname`;
   if (!$full) {
   $retval = array_shift(explode('.', $retval));
   }
   return $retval;
 }


I should add that it would be better to put the server hostname into the 
environment in which PHP runs. That way it will be available via the $_ENV 
superglobal and fetching it will not cost a process execution. How you would do 
this depends on how you are running PHP.

-Stuart

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


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



Re: [PHP] Howto detect the hostname of the server?

2011-11-25 Thread Stuart Dallas
On 26 Nov 2011, at 00:24, Stuart Dallas wrote:
 On 26 Nov 2011, at 00:14, Andreas wrote:
 Hi,
 how could I identify the server the script runs on?
 
 I've got a testserver on Windows and a remote system on Linux that need a 
 couple of different settings like IP and port of db-server or folder to 
 store logfiles.
 
 I'd like to do something like:
 
 if ( $_SERVER['some_key'] = 'my_test_box' ) {
   $db_host = '1.1.1.1';
   $db_port = 1234;
 } else {
   $db_host = '2.2.2.2';
   $db_port = 4321;
 }
 
 
 I looked into phpinfo() but haven't found anything helpful, yet.
 Have I overlooked something or is there another way to identify the server?
 
 
 This should work on most Linux variants, so long as the hostname command 
 exists and the PHP process has permission to execute it.
 
 function getServerHostname($full = false)
 {

This line should have a trim...

   $retval = trim(`hostname`);

Without that, the full hostname will have a new line on the end which is less 
than ideal.

   if (!$full) {
   $retval = array_shift(explode('.', $retval));
   }
   return $retval;
 }

-Stuart

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


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



Re: [PHP] Howto detect the hostname of the server?

2011-11-25 Thread Simon J Welsh
On 26/11/2011, at 1:14 PM, Andreas wrote:

 Hi,
 how could I identify the server the script runs on?
 
 I've got a testserver on Windows and a remote system on Linux that need a 
 couple of different settings like IP and port of db-server or folder to store 
 logfiles.
 
 I'd like to do something like:
 
 if ( $_SERVER['some_key'] = 'my_test_box' ) {
$db_host = '1.1.1.1';
$db_port = 1234;
 } else {
$db_host = '2.2.2.2';
$db_port = 4321;
 }
 
 
 I looked into phpinfo() but haven't found anything helpful, yet.
 Have I overlooked something or is there another way to identify the server?


php_uname('n'); http://php.net/php_uname
---
Simon Welsh
Admin of http://simon.geek.nz/


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



[PHP] Tutorial for the structure of an php-app ?

2011-11-25 Thread Andreas

Hi again,
is there a tutorial for the structure of an php-app?

There are more than enough books and online docs that teach the basics 
of PHP and of course the native mysql commands.


I'd now rather need a help to figure out how to pull up a wee bit more 
complex app.
I know how to connect to a DB even though it might not be mysql. I can 
select stuff and dump it into a HTML table.

Actually I prefer PDO and PostgreSQL.

Is there a tutorial that teaches how to construct a app with a 2-column 
design.

E.g. a menue frame on the left and a bigger content area on the right.
So a click on a menue item would dynamically display a form or a list in 
the content area.

What is a good way to glue everthing together between login and logout.
I know cookies and sessions and I suspect those were a way to do it.
How would I integrate a template system like smarty?
It weren't bad if there were clues about AJAX, too.

I'm in search of a way to extend the knowledge about bricks, tubes and 
cables to the wisdom to actually build a house out of those things.


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



Re: [PHP] Howto detect the hostname of the server?

2011-11-25 Thread Andreas

Am 26.11.2011 01:35, schrieb Simon J Welsh:

On 26/11/2011, at 1:14 PM, Andreas wrote:


how could I identify the server the script runs on?



php_uname('n'); http://php.net/php_uname



Great, that even works on a ssh-tunnel.
I got derailed by the fact that my tunnel maps the remote server to 
localhost:80 so

$_SERVER['SERVER_ADDR']   and
$_SERVER['SERVER_NAME']   wouldn't help.
On the other hand for everyone on the remote LAN $_SERVER['...'] would 
work ok, though I didn't realise that before.


Thanks   :)

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



Re: [PHP] Tutorial for the structure of an php-app ?

2011-11-25 Thread Tommy Pham
On Fri, Nov 25, 2011 at 4:38 PM, Andreas maps...@gmx.net wrote:
 Hi again,
 is there a tutorial for the structure of an php-app?

 There are more than enough books and online docs that teach the basics of
 PHP and of course the native mysql commands.

 I'd now rather need a help to figure out how to pull up a wee bit more
 complex app.
 I know how to connect to a DB even though it might not be mysql. I can
 select stuff and dump it into a HTML table.
 Actually I prefer PDO and PostgreSQL.

 Is there a tutorial that teaches how to construct a app with a 2-column
 design.
 E.g. a menue frame on the left and a bigger content area on the right.
 So a click on a menue item would dynamically display a form or a list in the
 content area.

What you're asking has nothing to do PHP.  It's all UI and client
side.  That's all relative to:

* who are the visitors
* amount of information to be display
* type of application such as functions and features
* tools in your belt, ie: ajax, flash, etc...

to name a few and not necessarily in that order.

 What is a good way to glue everthing together between login and logout.
 I know cookies and sessions and I suspect those were a way to do it.
 How would I integrate a template system like smarty?
 It weren't bad if there were clues about AJAX, too.

 I'm in search of a way to extend the knowledge about bricks, tubes and
 cables to the wisdom to actually build a house out of those things.


More importantly, shouldn't you need to find out the properties of
each materials prior to building a house as it will affect the design
and structural integrity?  How strong is the brick?  What kind of
tubes?  Can they be easily bended?  What about prone to rust or
chemical reactions with long term exposure to chlorinated water?  What
cables are needed for each purpose and is the proper gauge of the
cable being used?  Insufficient gauge will lead to fire.  After you
have a firm understanding of the materials/technologies/skills
involved, then Google programming design patterns...

HTH,
Tommy

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



Re: [PHP] Tutorial for the structure of an php-app ?

2011-11-25 Thread Bastien


On 2011-11-25, at 7:38 PM, Andreas maps...@gmx.net wrote:

 Hi again,
 is there a tutorial for the structure of an php-app?
 
 There are more than enough books and online docs that teach the basics of PHP 
 and of course the native mysql commands.
 
 I'd now rather need a help to figure out how to pull up a wee bit more 
 complex app.
 I know how to connect to a DB even though it might not be mysql. I can select 
 stuff and dump it into a HTML table.
 Actually I prefer PDO and PostgreSQL.
 
 Is there a tutorial that teaches how to construct a app with a 2-column 
 design.
 E.g. a menue frame on the left and a bigger content area on the right.
 So a click on a menue item would dynamically display a form or a list in the 
 content area.
 What is a good way to glue everthing together between login and logout.
 I know cookies and sessions and I suspect those were a way to do it.
 How would I integrate a template system like smarty?
 It weren't bad if there were clues about AJAX, too.
 
 I'm in search of a way to extend the knowledge about bricks, tubes and cables 
 to the wisdom to actually build a house out of those things.
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 

Why not download some and dig into them? Something from sourceforge or a cms 
like pyrocms? See how they stuck it all together. 

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



Re: [PHP] Howto detect the hostname of the server?

2011-11-25 Thread Curtis Maurand

On 11/25/2011 7:35 PM, Simon J Welsh wrote:

On 26/11/2011, at 1:14 PM, Andreas wrote:


Hi,
how could I identify the server the script runs on?

I've got a testserver on Windows and a remote system on Linux that need a 
couple of different settings like IP and port of db-server or folder to store 
logfiles.

I'd like to do something like:

if ( $_SERVER['some_key'] = 'my_test_box' ) {
$db_host = '1.1.1.1';
$db_port = 1234;
} else {
$db_host = '2.2.2.2';
$db_port = 4321;
}


I looked into phpinfo() but haven't found anything helpful, yet.
Have I overlooked something or is there another way to identify the server?


php_uname('n'); http://php.net/php_uname


folks  try:

 $_SERVER['SERVER_NAME']

Cheers,
Curtis



[PHP] PHP exercises

2011-11-25 Thread Larry Garfield
Hi folks.  A friend of mine is trying to learn PHP.  She already knows 
programming basics, but wants to learn PHP specifically.  However, she 
learns much better with assignments or exercises than just from reading 
articles or books.


The only site I've found so far is PHP Exercises 
(http://phpexercises.com/), but it of course went offline the day after 
I found it.  Fail!


Can anyone recommend other sources for tutorial-based or exercise-based 
PHP learning?  Paid is OK if it's not too expensive and it's worth the 
money, although free is always preferred.


TIA and all that.

--Larry Garfield

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



Re: [PHP] PHP exercises

2011-11-25 Thread shiplu
On Sat, Nov 26, 2011 at 11:54 AM, Larry Garfield la...@garfieldtech.comwrote:

 Hi folks.  A friend of mine is trying to learn PHP.  She already knows
 programming basics, but wants to learn PHP specifically.  However, she
 learns much better with assignments or exercises than just from reading
 articles or books.

 The only site I've found so far is PHP Exercises (http://phpexercises.com/),
 but it of course went offline the day after I found it.  Fail!

 Can anyone recommend other sources for tutorial-based or exercise-based
 PHP learning?  Paid is OK if it's not too expensive and it's worth the
 money, although free is always preferred.


IMO, the best way is to learn something is by cloning. Convince your friend
to clone a simple website. If you exercise it, your target would be to pass
in the exercise. After you pass, you forget it. When it comes to real deal,
you never forget it.

-- 
Shiplu Mokadd.im
Follow me, http://twitter.com/shiplu
Innovation distinguishes between follower and leader


Re: [PHP] Howto detect the hostname of the server?

2011-11-25 Thread Tamara Temple
Andreas maps...@gmx.net wrote:

 Am 26.11.2011 01:35, schrieb Simon J Welsh:
  On 26/11/2011, at 1:14 PM, Andreas wrote:
 
  how could I identify the server the script runs on?
 
 
  php_uname('n'); http://php.net/php_uname
 
 
 Great, that even works on a ssh-tunnel.
 I got derailed by the fact that my tunnel maps the remote server to
 localhost:80 so
 $_SERVER['SERVER_ADDR']   and
 $_SERVER['SERVER_NAME']   wouldn't help.
 On the other hand for everyone on the remote LAN $_SERVER['...'] would
 work ok, though I didn't realise that before.

This may work in some circumstances, but not others. 

For example, I have a VPS with several sites hosted on it. php_uname
will always return the default host name, which very likely might be
different than the virtual host's hostname.

I'm not doing any ssh tunnelling in my local setups, so looking at
$_SERVER['SERVER_NAME'] works for me, but obviously won't for you. I
simply set up the /etc/hosts file with a lot of aliases, and then they
can become virtual hosts.

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



Re: [PHP] Tutorial for the structure of an php-app ?

2011-11-25 Thread Tamara Temple
Bastien phps...@gmail.com wrote:
 Why not download some and dig into them? Something from sourceforge or a cms 
 like pyrocms? See how they stuck it all together. 

This is not a bad idea at all. Learning from something concrete, how
they do things, looking into why they chose to do it that, etc. Don't
pick just one, though, as there are many examples to learn from. CMSes
(Drupal, Joomla), Wikis (Mediawiki, PmWiki), Blog software
(Wordpress). These all solve similar and different problems.

Also, I cannot stress Tommy's point about learning design patterns
enough. It isn't enough to be able to just cable together code, you have
to know the structures and architecture to building something that won't
fall down. Programming isn't something you learn in a weekend
project. It's also not something you learn just by reading a language
manual, even one as good as PHP's. No language manual is going to give
you any insight into deciding among the many options that are available.

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