OSEC

Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com
 
php-general Digest 17 Nov 2005 10:45:27 -0000 Issue 3799

php-general-digest-helplists.php.net
Date: Thu Nov 17 2005 - 04:45:27 CST


php-general Digest 17 Nov 2005 10:45:27 -0000 Issue 3799

Topics (messages 225942 through 225961):

Loading Images from PHP broken on Redhat Enterprise
        225942 by: Kevin Smith
        225943 by: Robert Cummings
        225944 by: Kevin Smith
        225945 by: Curt Zirzow
        225947 by: Robert Cummings
        225948 by: Curt Zirzow
        225949 by: Kevin Smith
        225951 by: Kevin Smith

Re: better way to mix html and php code?
        225946 by: David Tulloh
        225955 by: Roman Ivanov

Re: Shared Memory Problem
        225950 by: Yaswanth Narvaneni

Re: Developement Environment for PHP?
        225952 by: John Nichel

Re: Regex for Amateur Radio Callsigns
        225953 by: Leif Gregory
        225954 by: Leonard Burton

Re: Error "Command failed for target 'ext/xml/xml.lo'" during make process (Solaris 8)
        225956 by: Curt Zirzow

Re: PHP PDO functions
        225957 by: Curt Zirzow

Re: Set Timezone to localtime in php.ini
        225958 by: Curt Zirzow

Re: Validating Email addrs
        225959 by: Curt Zirzow

Server Client Architecture, best parctice
        225960 by: Yaswanth Narvaneni
        225961 by: gOLeM

Administrivia:

To subscribe to the digest, e-mail:
        php-general-digest-subscribelists.php.net

To unsubscribe from the digest, e-mail:
        php-general-digest-unsubscribelists.php.net

To post to the list, e-mail:
        php-generallists.php.net

----------------------------------------------------------------------

attached mail follows:


Hi All,

Ok, before we start, I know this topic has been flogged to death on how
to load images from a database using PHP. So, before we start, I have
had this method of loading images in this way working for years. :)
However, the problem I've come across has given me a major headache and
can't find a solution to the problem.

So on to the problem....

I have 2 servers (setup details below). Server #1 loads the images from
the MySQL database using PHP perfectly. However, Server #2, which has
identical versions of Apache, MySQL, PHP and were compiled with the
exact same parameters, doesn't want to even bother working. The PHP
scripts just outputs a bunch of text, which I have seen before if
certain headers are incorrectly built. However, there is no difference
in the installation of the software, apart from the OS and that fact
that Server #2's MySQL RPM was built specifically for Redhat Enterprise 4.

Server #1
================
Fedora Core 2 (fully patched)
Apache 2.0.55 (compiled from source)
MySQL-4.1.5 (RPM glibc 2.3)
PHP-4.4.1 (compiled from source)

Server #2
================
Redhat Enterprise 4 (fully patched)
Apache 2.0.55 (compiled from source)
MySQL-4.1.5 (RPM Redhat Enterprise 4 version)
PHP-4.4.1 (compiled from source)

If I export the data from the MySQL database into a file and then call
it from the browser, the image shows perfectly, so we're not dealing
with corrupt data. I use SQLYog to also administer the databases,
viewing the BLOB field using this tool allows me to view the image
stored, and it shows perfectly well.

Data returned from "httpd -l", "httpd -V", "php -v" and "php -m" show
identical builds.

Has anyone come across this problem before? Also the httpd.conf and
php.ini files are identical in everyway, apart from IP addresses.

Many thanks,

Kevin Smith

attached mail follows:


On Wed, 2005-11-16 at 18:01, Kevin Smith wrote:
>
> Has anyone come across this problem before? Also the httpd.conf and
> php.ini files are identical in everyway, apart from IP addresses.

Did you double check in the phpinfo() output for each server that the
php.ini is being loaded for where you think it's being loaded?

Cheers,
Rob.
--
.------------------------------------------------------------.
| InterJinn Application Framework - http://www.interjinn.com |
:------------------------------------------------------------:
| An application and templating framework for PHP. Boasting |
| a powerful, scalable system for accessing system services |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for |
| creating re-usable components quickly and easily. |
`------------------------------------------------------------'

attached mail follows:


HI Robert,

I have checked both phpinfo() and php -i via the cli as follows and both
produce the expected results. Also phpinfo() shows the exact same
"Configure Command" data for both servers.

Server #1
[rootde006102 limiteds_v2]# php -i | grep ini
Configuration File (php.ini) Path => /usr/local/Zend/etc/php.ini

Server #2
[rootS76017 domains]# php -i | grep ini
Configuration File (php.ini) Path => /usr/local/Zend/etc/php.ini

Also both php.ini files have PHPSESSID specifically set to only work
with cookies. If this was not the case, the website wouldn't work very
well, which the sites do, apart from the images on Server #2. :(

Any other ideas? This is a very strange one.

To show you what happens, here's the site that works and the one that
doesn't:

Server #1 (working)
http://www.limiteds.com/includes/image_load.php?image_id=8522&field_id=image_full_2

Server #2 (sad and not working)
http://www.limitedshop.co.uk/includes/image_load.php?image_id=8522&field_id=image_full_2

Regards,

Kevin

Robert Cummings wrote:
> On Wed, 2005-11-16 at 18:01, Kevin Smith wrote:
>
>> Has anyone come across this problem before? Also the httpd.conf and
>> php.ini files are identical in everyway, apart from IP addresses.
>>
>
> Did you double check in the phpinfo() output for each server that the
> php.ini is being loaded for where you think it's being loaded?
>
> Cheers,
> Rob.
>

attached mail follows:


On Wed, Nov 16, 2005 at 11:44:27PM +0000, Kevin Smith wrote:
> HI Robert,
>
> Server #1 (working)
> http://www.limiteds.com/includes/image_load.php?image_id=8522&field_id=image_full_2
>
Headers for this one:
Content-Transfer-Encoding: binary
Vary: Accept-Encoding,User-Agent
Content-Encoding: gzip
P3P: CP="NOI DSP COR NID CUR OUR NOR"
Content-Length: 12547
Keep-Alive: timeout=15, max=100
Connection: Keep-Alive
Content-Type: image/jpeg

> Server #2 (sad and not working)
> http://www.limitedshop.co.uk/includes/image_load.php?image_id=8522&field_id=image_full_2
 
And This one:
P3P: CP="NOI DSP COR NID CUR OUR NOR"
Keep-Alive: timeout=15, max=100
Connection: Keep-Alive
Transfer-Encoding: chunked
Content-Type: text/html; charset=ISO-8859-1

Something is different.

Curt.

attached mail follows:


On Wed, 2005-11-16 at 18:44, Kevin Smith wrote:
>
> Any other ideas? This is a very strange one.

The headers aren't the same, specifically the second one doesn't send
the type as image/jpeg.

Here's the first one:

-----------------------------------------------------------------
sudsblobule:~/sjhdsjhdsa> wget -S
"http://www.limiteds.com/includes/image_load.php?image_id=8522&field_id=image_full_2"
--19:01:33--
http://www.limiteds.com/includes/image_load.php?image_id=8522&field_id=image_full_2
           => `image_load.php?image_id=8522&field_id=image_full_2'
Resolving www.limiteds.com... 217.168.144.110
Connecting to www.limiteds.com[217.168.144.110]:80... connected.
HTTP request sent, awaiting response...
 1 HTTP/1.1 200 OK
 2 Date: Thu, 17 Nov 2005 00:01:12 GMT
 3 Server: Apache/2.0.55 (Unix) mod_ssl/2.0.55 OpenSSL/0.9.7a DAV/2
PHP/4.4.1
 4 X-Powered-By: PHP/4.4.1
 5 Content-Transfer-Encoding: binary
 6 Content-Length: 13184
 7 Vary: Accept-Encoding,User-Agent
 8 P3P: CP="NOI DSP COR NID CUR OUR NOR"
 9 Keep-Alive: timeout=15, max=100
10 Connection: Keep-Alive
11 Content-Type: image/jpeg

100%[===================================================================>] 13,184 55.98K/s

19:01:33 (55.77 KB/s) -
`image_load.php?image_id=8522&field_id=image_full_2' saved [13184/13184]
-----------------------------------------------------------------

Here's the second one:

-----------------------------------------------------------------
sudsblobule:~/sjhdsjhdsa> wget -S
"http://www.limitedshop.co.uk/includes/image_load.php?image_id=8522&field_id=image_full_2"
--19:01:37--
http://www.limitedshop.co.uk/includes/image_load.php?image_id=8522&field_id=image_full_2
           => `image_load.php?image_id=8522&field_id=image_full_2.1'
Resolving www.limitedshop.co.uk... 83.138.141.171
Connecting to www.limitedshop.co.uk[83.138.141.171]:80... connected.
HTTP request sent, awaiting response...
 1 HTTP/1.1 200 OK
 2 Date: Thu, 17 Nov 2005 00:01:17 GMT
 3 Server: Apache/2.0.55 (Unix) mod_ssl/2.0.55 OpenSSL/0.9.7a DAV/2
PHP/4.4.1
 4 X-Powered-By: PHP/4.4.1
 5 Vary: Accept-Encoding,User-Agent
 6 P3P: CP="NOI DSP COR NID CUR OUR NOR"
 7 Connection: close
 8 Content-Type: text/html; charset=ISO-8859-1

    [ <=>
] 13,185 52.99K/s

19:01:38 (52.94 KB/s) -
`image_load.php?image_id=8522&field_id=image_full_2.1' saved [13185]
-----------------------------------------------------------------

--
.------------------------------------------------------------.
| InterJinn Application Framework - http://www.interjinn.com |
:------------------------------------------------------------:
| An application and templating framework for PHP. Boasting |
| a powerful, scalable system for accessing system services |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for |
| creating re-usable components quickly and easily. |
`------------------------------------------------------------'

attached mail follows:


On Wed, Nov 16, 2005 at 11:44:27PM +0000, Kevin Smith wrote:
> HI Robert,
>
> I have checked both phpinfo() and php -i via the cli as follows and both
> produce the expected results. Also phpinfo() shows the exact same
> "Configure Command" data for both servers.
>
> Server #1
> [rootde006102 limiteds_v2]# php -i | grep ini
> Configuration File (php.ini) Path => /usr/local/Zend/etc/php.ini
>
> Server #2
> [rootS76017 domains]# php -i | grep ini
> Configuration File (php.ini) Path => /usr/local/Zend/etc/php.ini

Oh and also, you really should check the output of the phpinfo()
through the browser, the php cli file could be reading a different
file.

>
> Also both php.ini files have PHPSESSID specifically set to only work
> with cookies. If this was not the case, the website wouldn't work very
> well, which the sites do, apart from the images on Server #2. :(

PHP by default uses cookies.

Curt.
--

attached mail follows:


Hi Curt,

In that case, what on earth is going on. This is the script which is on
both servers: However, I noticed that if I moved the following lines to
the top of the script:

header("Content-Type: image/jpeg");
header("Content-Transfer-Encoding: binary");

..and hard-code the mime type, it outputs the correct headers, apart
from "Transfer-Encoding:chunked". Which seems to still screw it up.
The content length is wrong (13198), it should be 13184. Looking at the
RAW output of the image data, there is a difference. I noticed 3381 was
output as part of the image data, yet this is not so on the Server #1,
that works. Even if I fix the content-length header to what it should
be, it still has some differences.

It still bugs me that the data is absolutely fine in the database, as I
can save the data out of it into a file and view that file as an image
with no problems at all.

Anything else you can think of?

Thanks,

Kevin

<?php
require('../classes/housekeeping.php');
$db_conn = new HOUSEKEEPING;
$limiteds = $db_conn->database();

require('../classes/categories.php');

if ( isset($_GET['image_id']) && isset($_GET['field_id']) &&
isset($_GET['mime_type']) )
{
    $image_info = new CATEGORY;
    $image_info->LINK = $limiteds;
    $image_info->IMAGE_ID = $_GET['image_id'];
    $image_info->FIELD_ID = $_GET['field_id'];
    $image_info->get_thumb_image();
   
    header("Content-Type: ".$_GET['mime_type']);
    header("Content-Transfer-Encoding: binary");
    header("Content-Length: ".strlen($image_info->IMAGE_THUMB));
    echo $image_info->IMAGE_THUMB;
}
elseif ( isset($_GET['image_id']) && isset($_GET['field_id']) )
{
    $image_info = new CATEGORY;
    $image_info->LINK = $limiteds;
    $image_info->IMAGE_ID = $_GET['image_id'];
    $image_info->FIELD_ID = $_GET['field_id'];
    $image_info->get_thumb_image();
   
    header("Content-Type: $image_info->MIME_TYPE");
    header("Content-Transfer-Encoding: binary");
    header("Content-Length: ".strlen($image_info->IMAGE_THUMB));
    echo $image_info->IMAGE_THUMB;
}
?>

Curt Zirzow wrote:
> On Wed, Nov 16, 2005 at 11:44:27PM +0000, Kevin Smith wrote:
>> HI Robert,
>>
>> Server #1 (working)
>> http://www.limiteds.com/includes/image_load.php?image_id=8522&field_id=image_full_2
>>
> Headers for this one:
> Content-Transfer-Encoding: binary
> Vary: Accept-Encoding,User-Agent
> Content-Encoding: gzip
> P3P: CP="NOI DSP COR NID CUR OUR NOR"
> Content-Length: 12547
> Keep-Alive: timeout=15, max=100
> Connection: Keep-Alive
> Content-Type: image/jpeg
>
>
>> Server #2 (sad and not working)
>> http://www.limitedshop.co.uk/includes/image_load.php?image_id=8522&field_id=image_full_2
>
> And This one:
> P3P: CP="NOI DSP COR NID CUR OUR NOR"
> Keep-Alive: timeout=15, max=100
> Connection: Keep-Alive
> Transfer-Encoding: chunked
> Content-Type: text/html; charset=ISO-8859-1
>
>
> Something is different.
>
> Curt.
>

attached mail follows:


Solved!

I don't believe it, there was an extra carriage return in the require
file "housekeeping.php". This carriage return "is" present on Server
#1, but Server #2 obviously doesn't like it.

I am now going to stick my head out of my window and scream for not
thinking that that could have been a possibility.

Severely in need of some therapy.

Thank you for all your help, Curt and Robert!!!! :)

Regards,

Kevin

Curt Zirzow wrote:
> On Wed, Nov 16, 2005 at 11:44:27PM +0000, Kevin Smith wrote:
>
>> HI Robert,
>>
>> I have checked both phpinfo() and php -i via the cli as follows and both
>> produce the expected results. Also phpinfo() shows the exact same
>> "Configure Command" data for both servers.
>>
>> Server #1
>> [rootde006102 limiteds_v2]# php -i | grep ini
>> Configuration File (php.ini) Path => /usr/local/Zend/etc/php.ini
>>
>> Server #2
>> [rootS76017 domains]# php -i | grep ini
>> Configuration File (php.ini) Path => /usr/local/Zend/etc/php.ini
>>
>
> Oh and also, you really should check the output of the phpinfo()
> through the browser, the php cli file could be reading a different
> file.
>
>
>> Also both php.ini files have PHPSESSID specifically set to only work
>> with cookies. If this was not the case, the website wouldn't work very
>> well, which the sites do, apart from the images on Server #2. :(
>>
>
> PHP by default uses cookies.
>
>
> Curt.
>

attached mail follows:


Curt Zirzow wrote:
> On Wed, Nov 16, 2005 at 10:12:53AM -0600, afanafan.net wrote:
>
>>Hi to all,
>>always wondered what's better way to mix html and php code. Here are
>>three "ways" of the same code. Which one you prefer? (And why, of caurse :))
>>

Personally, I present solution 2b. I also don't like the idea of
a(nother) templating language either. When doing html like this I also
like using short tags because it looks better and the colon syntax for
ifs as I find it easier for non-programmers and easier to follow in
large blocks of html. That should be enough to get everyone here screaming.

I would also wrap this file inside a layout script and/or use prepend
and append files. Depending on the overall use I'd consider pushing
some of it into another file. There is too much php code in there at
the moment.

David

Solution 2b:
############################################################################################

<table class="table-heading"><!-- should probably be a div -->
        <tr>
                <td>
                         <?=$cat_parent_name?> ::
                         <?=$cat_id_name?>
                 </td>
                 <td>
                         <a href="new_product.php?cat_id=<?php echo $cat_id
?>&cat_parent=<?php echo $cat_parent?>">[ Add New Product ]</a>
                 </td>
         </tr>
</table>

<table class="table-results">
<? foreach ($products as $product): ?>
          <tr>
                 <td class="prod_name">&raquo; <?=product_name'?></td>
                 <td class="prod_no">[ <?=$product_number?> ]</td>
                 <td class="prod_action">
                         <img src="../images/icon_edit2.gif" alt="EDIT" width="14" height="14">

                         <a onclick="return confirm('Do you really want to delete this
product?');"
                                 href="<?=$del_link?>">
                                 <img src="../images/icon_delete.gif" alt="DELETE" width="14"
height="14">
                         </a>

                         <? if($status_link): ?>
                                 <a href="<?=$status_link?>">
                                         <img src="../images/status_<?=$status_img?>.gif"
                                                 alt="<?=$status_img?>" width="13" height="13">
                                 </a>
                         <? else: ?>
                                <img src="../images/status_<?=$status_img?>.gif"
                                         alt="<?=$status_img?>" width="13" height="13">
                         <? endif; ?>

                 </td>
         </tr>

<? endforeach; ?>
</table>

attached mail follows:


For long strings I suggest using
echo <<<EOTHML
EOHTML;

attached mail follows:


Hi!

I found the solution to my prob. SELinux was enabled in the server
which needs disabling. After disabling SELinux it was working great.
Thanks for your help guys.

Another small query though, is there anyway to enable SELinux and as
well use shared memory between PHP and C++? I know using Zend engine
would solve the prob, but we need to buy zend which is very costly for
me, any other solution is welcome.

Regards,
Yaswanth

On 11/16/05, Curt Zirzow <czirzowgmail.com> wrote:
> On Wed, Nov 16, 2005 at 03:33:22AM +0530, Yaswanth Narvaneni wrote:
> > Hi!
> >
> > I have a server written in C++ and my webpages are in PHP. The PHP has
> > to communicate with the server using shared memory. This was working
> > fine on the server running FC-1 with php-4.3.8. We recently migrated
> > to CentOS 4.1 (Equivalent to RHEL 4.1) running php-4.3.9. The error it
> > displays is as follows:
> >
> > shmop_open(): unable to attach or create shared memory segment in
> > /var/www/html/sharedmem.php on line 2
> >
> > The server opens the shm in 666 (originally was 644) even then it was
> > not working. I can see the shared mem open using 'ipcs' command.
> >
> > ...
> > $shm_id = shmop_open($shm_key, "a",0,0) or die("FATAL ERROR:: Unable
> > to Access Shared Memory");
>
> You might want to try to open it within the same mode that the
> server created it in:
>
> 1)
> $shm_id = shmop_open($shm_key, "a",0666,0);
>
> 2)
> are you 100% sure the key is valid? the error message you are
> getting seems to point in this direction since the shmop_open is
> failing on the C call to shmget(), wich usually fails when either
> you dont have enough memory to create it (which you arn't doing),
> some other creation problems, or that the key supplied wasn't
> found.
>
>
> Curt.
> --
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

--
"In theory there is no difference between theory and practice.
In practice there is." -- Fortune Cookie

attached mail follows:


Tom Cruickshank wrote:
> Hello,
> I'm not sure if this has been asked before or not (probably has) but I
> can't seem to find it. I'm looking for a Development Environment for PHP
> other then vi. What I'm looking for is an environment which has powerful
> debugging techniques and resources. Preferably using a Unix based platform
> (that's what I'm developing on).
>
> Would anyone have any suggestions?

Yeah, it's been asked once or twice....

http://marc.theaimsgroup.com/?l=php-general&w=2&r=1&s=php+editor&q=t

I'll just say I used Zend Studio, give you this link...

http://www.thelinuxconsultancy.co.uk/phpeditors.php

...and watch Pandora's box come fully open from afar.

--
By-Tor.com
...it's all about the Rush
http://www.by-tor.com

attached mail follows:


Hello Leonard,

Tuesday, November 15, 2005, 8:39:19 PM, you wrote:
> Here are how they look
> W1W
> W1AW
> WA1W
> AD4HZ
> N9URK
> WB6NOA
> 4N1UBG

Let's do it this way... What are the rules for a valid callsign?

i.e.
- If it's only three characters, it must start with a letter.
- All callsigns must have both alpha and numeric components.
- A callsign can not have to identical letters next to each other
- A callsign is always written in uppercase

etc.

If we know what the rules are that constitute a valid callsign, then
we can help you write a regexp.

--
                          TBUDL/BETA/DEV/TECH Lists Moderator / PGP 0x6C0AB16B
 __ ____ ____ ____ Geocaching: http://gps.PCWize.com
( ) ( ___)(_ _)( ___) TBUDP Wiki Site: http://www.PCWize.com/thebat/tbudp
 )(__ )__) _)(_ )__) Roguemoticons & Smileys: http://PCWize.com/thebat
(____)(____)(____)(__) PHP Tutorials and snippets: http://www.DevTek.org

Do not disturb. Already disturbed!

attached mail follows:


HI,

> Tuesday, November 15, 2005, 8:39:19 PM, you wrote:
> > Here are how they look
> > W1W
> > W1AW
> > WA1W
> > AD4HZ
> > N9URK
> > WB6NOA
> > 4N1UBG
>
> Let's do it this way... What are the rules for a valid callsign?

Basicly, you see an example of each different type of callsign. Other
than the patterns you see above there are no real rules. A letter in
the example above means that there can only be a letter in the spot
and a number in a spot means there can only be a number in that spot.
There are 7 different formats and you see the one above.

Did you see the regex I had in a previous post?

Thanks for your response.

--
Leonard Burton, N9URK
leonardburtongmail.com

"The prolonged evacuation would have dramatically affected the
survivability of the occupants."

attached mail follows:


On Tue, Nov 15, 2005 at 09:20:54PM +0100, Age Bosma wrote:
> Hi,
>
> I'm trying to compile php 4.4.1 on Solaris 8 but I'm getting the error
> "Command failed for target 'ext/xml/xml.lo'" during the make process.
>
> [snip]
> /nfs/dm11-fs22/work/training/dj365/php-4.4.1/ext/xml/xml.c:1582:
> `XML_Char' undeclared (first use in this function)
> ...
> make: Fatal error: Command failed for target 'ext/xml/xml.lo'
>
> If I look in the 'ext/xml/' folder, there's no file called 'xml.lo'.
> What can be the problem here?

It is trying to make the xml.lo file, the errors prior to that
explain why.

>
> I used the following configuration with gcc 3.2.3:
>
> configure --prefix=/work/training/dg432/servsoft/php4
> --with-apxs2=/work/training/dg432/servsoft/apache2/bin/apxs
> --with-mysql=/work/training/dg432/servsoft/mysql4 --enable-calendar
> --enable-ftp --with-gettext --with-iconv
> --with-dom=/work/training/dg432/servsoft
> --with-dom-xslt=/work/training/dg432/servsoft

This is an odd configure line, i'm guessing this is some sort of
package thing. At first glance at the the errors above, i would
guess that this package has some version issues.

> Except for gettext and iconv I manually compiled all packaged myself.
>
> In addition to this, I got two warnings during the configuration process:
> "configure: warning: You will need bison 1.28" and "configure: warning:
> You will need bison 1.28 if you want to regenerate the Zend parser
> (found 1.27)"
> Could this have anything to do with it?

most likely not.

Curt.
--

attached mail follows:


On Wed, Nov 16, 2005 at 07:29:18PM +0200, Yonatan Ben-Nes wrote:
> Hi all,
>
> After searching for a framework which work with PostgreSQL & PHP I've
> found Framewerk (http://svn.framewerk.org/) which seem to fit my needs,
> the only problem that I've found is that it use the PDO functions.
>
> Now maybe I'm wrong but I understood that database abstraction layers
> like PEAR::DB got their disadvantages, does PDO got disadvantages also
> compared for using specific pg_ functions?

If you are using the framework I'm not sure how it talks to a
database matters.

Curt.
--

attached mail follows:


On Tue, Nov 15, 2005 at 09:49:10PM -0700, The Doctor wrote:
> IS their a way to set the time to localtime instead of GMT in
> the ini file?

No.

>
> Some users are complaining that they are seeing GMT, which this server
> is set to.

What timezone are the users expecting the time to be displayed in?
Do they get to specify what TZ they are in?

For starters i would suggest looking into the setlocale() function.

Curt.
--

attached mail follows:


On Wed, Nov 16, 2005 at 07:39:28AM -0000, George Pitcher wrote:
> I grabbed the following from a web-published article (sorry, can't remember
> where):

There a few things wrong with it as well.

>
> function validate_email($email) {
> if(preg_match("/^( [a-zA-Z0-9] )+( [a-zA-Z0-9\._-] )*( [a-zA-Z0-9_-] )+(
> \.[a-zA-Z0-9_-] +)+$/" , $email)){
 
Problem #1
  - with those spaces in the expression i would assume it really
    needs to have the /x modifier, i would hardly thing that anyone
    will type:
    ' c zirzow gmail .c '
  - it doesn't consider emails like foofoo.us.gov

I think there was a 300+ line regex to catch all cases, posted
earlier.

> list($username,$domain)=split('',$email);
> if(!customCheckDnsrr($domain)){
> ...
> function customCheckDnsrr($host,$recType='') {
> if(!empty($host)) {
> if($recType=='') $recType="MX";
> exec("nslookup -type=$recType $host",$output);
> ...

Problem #2
 - an MX record isn't required to deliver email. Try a:
    nslookup -type=MX zirzow.dyndns.org then send an email to
    curtzirzow.dyndns.org, i will get it.

> foreach($output as $line) {
> if(preg_match("/^$host/", $line)) {

Problem #3
 - MX hosts dont *have* to resolve to the same host it is doing
   mail for, it generally does resolve that way, in most cases.
   
>
> Never tested this, so can't comment on usefulness.

Uh.. well, i hope problems 1-3 should contribute to its (un)usefulness.

Curt.
--

attached mail follows:


Hi!

I would like to know what does the community think of the best
architecture for server client communication and why? That is, if
there is a server in C++ (say a game server) and the PHP has to 'read'
data 'from' the server then what is the best form of communication?

a) Shared Memory : Server opens the shared memory in write and the PHP
scripts open it in read and gets the data
b) TMPFS (just like shared memory): Server opens a file in tmpfs in
write and PHP in read
c) Databases: Server Updates a table in the DB and client reads from the table
d) Files: Same as TMPFS

Regards,
Yaswanth

--
"In theory there is no difference between theory and practice.
In practice there is." -- Fortune Cookie

attached mail follows:


my friend here forgot to add that it will be a pretty busy website
with lots of requests.
And i would also like to know if there are any other forms of
communication other than the 4 that my friend here specified. Anything
that you people think will be efficient.

On 11/17/05, Yaswanth Narvaneni <yaswanthgmail.com> wrote:
> Hi!
>
> I would like to know what does the community think of the best
> architecture for server client communication and why? That is, if
> there is a server in C++ (say a game server) and the PHP has to 'read'
> data 'from' the server then what is the best form of communication?
>
> a) Shared Memory : Server opens the shared memory in write and the PHP
> scripts open it in read and gets the data
> b) TMPFS (just like shared memory): Server opens a file in tmpfs in
> write and PHP in read
> c) Databases: Server Updates a table in the DB and client reads from the table
> d) Files: Same as TMPFS
>
> Regards,
> Yaswanth
>
> --
> "In theory there is no difference between theory and practice.
> In practice there is." -- Fortune Cookie
>

--
Quitters never win and Winners never quit -- Napolean Hill
In any moment of decision, the best thing you can do is the right
thing, the next best thing is the wrong thing, and the worst thing you
can do is nothing. --Teddy Roosevelt