php-general Digest 2 Aug 2007 07:44:12 -0000 Issue 4938

Topics (messages 260021 through 260044):

Re: Validating Email Conditional
        260021 by: Jim Lucas
        260022 by: Edward Kay
        260035 by: Robin Vickery
        260038 by: Davi
        260042 by: Robin Vickery

addSlashes Question
        260023 by: CK
        260024 by: Jay Blanchard
        260025 by: Robert Cummings
        260026 by: Jim Lucas

Re: Loss of precision in intval()
        260027 by: David Duong
        260028 by: David Duong
        260029 by: David Duong
        260036 by: Mark Summers

Form Validation and DB Query
        260030 by: CK

Question about passing date in sql...
        260031 by: Payne
        260032 by: Brad Bonkoski
        260033 by: Michael Preslar
        260034 by: Stut

Re: audio recorder
        260037 by: Dan

Re: Profile / Debug w/o server modification?
        260039 by: Instruct ICC

[pcre] backreferences to all matches of a repeated subexpression
        260040 by: Jack Bates

mail function
        260041 by: Animesh Joshi
        260043 by: Siavash Miri

PHP and nCurses
        260044 by: Man-wai Chang

Administrivia:

To subscribe to the digest, e-mail:
        [EMAIL PROTECTED]

To unsubscribe from the digest, e-mail:
        [EMAIL PROTECTED]

To post to the list, e-mail:
        [EMAIL PROTECTED]


----------------------------------------------------------------------
--- Begin Message ---
CK wrote:
Hi,

My script is working, but valid returns true even if the user is bogus. What needs changing so both conditions have to match, the following attempt returned "unexpected logical...."

if (getmxrr($domaintld,$mxrecords)) && if(fsockopen($domaintld,25,$errno,$errstr,30)) {
         $valid = true;
         }


Looks like you are trying to nest an if.. inside the conditional of another if.

That doesn't work.

I think what you are wanting here is this

if (    getmxrr($domaintld,$mxrecords) &&
        fsockopen($domaintld,25,$errno,$errstr,30) ) {




The following works, but needs the conditional mentioned...

<?php
$email = "[EMAIL PROTECTED]";
$valid="";

function validate_email($email)


{

   // Create the syntax of email with validation regular expression
$regexp = "^([_a-z0-9-]+)(\.[_a-z0-9-]+)*@([a-z0-9-]+)(\.[a-z0-9-]+)*(\.[a-z]{2,4})$";

   // Presume that the email is invalid
   $valid = false;

   // Validate the syntax
   if (eregi($regexp, $email))
   {
      list($username,$domaintld) = split("@",$email);
      // Validate the domain
      if (getmxrr($domaintld,$mxrecords))
         $valid = true;
         }
    // attempts a socket connection to mail server
  if(fsockopen($domaintld,25,$errno,$errstr,30)) {
        $valid = true;
   } else {
          $valid = false;
  }
     return $valid;
}

if (validate_email($email))
   echo "Email is valid!";
else
   echo "Email is invalid!";

?>



--
Jim Lucas

   "Some men are born to greatness, some achieve greatness,
       and some have greatness thrust upon them."

Twelfth Night, Act II, Scene V
    by William Shakespeare

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


CK wrote:
Hi,

My script is working, but valid returns true even if the user is bogus. What needs changing so both conditions have to match, the following attempt returned "unexpected logical...."

if (getmxrr($domaintld,$mxrecords)) && if(fsockopen($domaintld,25,$errno,$errstr,30)) {
         $valid = true;
         }


You don't need to write the second 'if', just wrap the two conditionals in parentheses:

if ( getmxrr($domaintld,$mxrecords) && fsockopen($domaintld,25,$errno,$errstr,30) )
   $valid = true;

You could equally use nested conditionals:

if (getmxrr($domaintld,$mxrecords)) {
  if (fsockopen($domaintld,25,$errno,$errstr,30))
     $valid = true;
}

There is no need for the second $valid = false in your code below, since you define that at the start.

Edward


The following works, but needs the conditional mentioned...

<?php
$email = "[EMAIL PROTECTED]";
$valid="";

function validate_email($email)


{

   // Create the syntax of email with validation regular expression
$regexp = "^([_a-z0-9-]+)(\.[_a-z0-9-]+)*@([a-z0-9-]+)(\.[a-z0-9-]+)*(\.[a-z]{2,4})$";

   // Presume that the email is invalid
   $valid = false;

   // Validate the syntax
   if (eregi($regexp, $email))
   {
      list($username,$domaintld) = split("@",$email);
      // Validate the domain
      if (getmxrr($domaintld,$mxrecords))
         $valid = true;
         }
    // attempts a socket connection to mail server
  if(fsockopen($domaintld,25,$errno,$errstr,30)) {
        $valid = true;
   } else {
          $valid = false;
  }
     return $valid;
}

if (validate_email($email))
   echo "Email is valid!";
else
   echo "Email is invalid!";

?>

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



--- End Message ---
--- Begin Message ---
On 01/08/07, CK <[EMAIL PROTECTED]> wrote:
> Hi,
>
> My script is working,
[...]
>     $regexp = "^([_a-z0-9-]+)(\.[_a-z0-9-]+)*@([a-z0-9-]+)(\.[a-z0-9-]
> +)*(\.[a-z]{2,4})$";

If your script is using that regular expression to validate email addresses
then your script is most definitely not working.

-robin

(who is fed up with websites that reject perfectly good email
addresses for no good reason)

--- End Message ---
--- Begin Message ---
Em Quarta 01 Agosto 2007 19:56, Robin Vickery escreveu:
> On 01/08/07, CK <[EMAIL PROTECTED]> wrote:
> > Hi,
> >
> > My script is working,
>
> [...]
>
> >     $regexp = "^([_a-z0-9-]+)(\.[_a-z0-9-]+)*@([a-z0-9-]+)(\.[a-z0-9-]
> > +)*(\.[a-z]{2,4})$";
>
> If your script is using that regular expression to validate email addresses
> then your script is most definitely not working.
>
> -robin
>
> (who is fed up with websites that reject perfectly good email
> addresses for no good reason)

        I'm wrong or if I try to use my mail address ([EMAIL PROTECTED]) it 
will be rejected?
        My e-mail address isn't in format [EMAIL PROTECTED]
-- 
Davi Vidal
[EMAIL PROTECTED]
[EMAIL PROTECTED]
--
--------------------------------------------------------
Por favor não faça top-posting, coloque a sua resposta abaixo desta linha.
Eu não respondo top-post/HTML post. Obrigado.
Please don't do top-posting, put your reply below the following line.
I don't reply to top-post/HTML post. Thank you.
--------------------------------------------------------

Attachment: pgpfXf35z7lTu.pgp
Description: PGP signature


--- End Message ---
--- Begin Message ---
On 02/08/07, CK <[EMAIL PROTECTED]> wrote:
> Hi,
>
> Would you point out why?  As I've tested a range of email address,
> and have not found one rejected that is formatted correctly.

ok, here's a few perfectly valid email addresses off the top of my
head. The first one's especially annoying as I use it a lot. The last
one's not so common but can be useful if you've got broken dns.

[EMAIL PROTECTED]
[EMAIL PROTECTED]
o'[EMAIL PROTECTED]
[EMAIL PROTECTED]

-robin

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

Engaged in "cleanup" project, attempting to understand the uncommented decisions of predecessors. Inserting the following contact form values into a DB:


    $first = "'".addslashes($_POST['firstname'])."'";
    $last = "'".addslashes($_POST['lastname'])."'";
    $email = "'".addslashes($_POST['email'])."'";
    $address = "'".addslashes($_POST['address'])."'";
    $city = "'".addslashes($_POST['city'])."'";
    $state = "'".addslashes($_POST['state'])."'";
    $zip = "'".addslashes($_POST['zip'])."'";
    $comments = "'".addslashes($_POST['comments'])."'";
    $newsletter = "'".addslashes($_POST['signup'])."'";
    $contact = "'".addslashes($_POST['contact'])."'";


I can understand addSlashes for the first and last name, but question the need in the other variables, please inform.

CK

--- End Message ---
--- Begin Message ---
[snip]

     $first = "'".addslashes($_POST['firstname'])."'";
     $last = "'".addslashes($_POST['lastname'])."'";
     $email = "'".addslashes($_POST['email'])."'";
     $address = "'".addslashes($_POST['address'])."'";
     $city = "'".addslashes($_POST['city'])."'";
     $state = "'".addslashes($_POST['state'])."'";
     $zip = "'".addslashes($_POST['zip'])."'";
     $comments = "'".addslashes($_POST['comments'])."'";
     $newsletter = "'".addslashes($_POST['signup'])."'";
     $contact = "'".addslashes($_POST['contact'])."'";


I can understand addSlashes for the first and last name, but question  
the need in the other variables, please inform.
[/snip]

There is safety in numbers! While a lot of these fields may not ever
contain anything that would need to be escaped the name fields and
comments field would definitely need this. Also, if this is filled out
by 'external' users you do not want them to be able to enter anything
(like a SQL injection attack in the comments field) that might cause a
problem of some sort. Another option would be htmlentities()

--- End Message ---
--- Begin Message ---
On Wed, 2007-08-01 at 13:20 -0700, CK wrote:
> Hi,
> 
> Engaged in "cleanup" project, attempting to understand the  
> uncommented decisions of  predecessors.  Inserting the following  
> contact form values into a DB:
> 
> 
>      $first = "'".addslashes($_POST['firstname'])."'";
>      $last = "'".addslashes($_POST['lastname'])."'";
>      $email = "'".addslashes($_POST['email'])."'";
>      $address = "'".addslashes($_POST['address'])."'";
>      $city = "'".addslashes($_POST['city'])."'";
>      $state = "'".addslashes($_POST['state'])."'";
>      $zip = "'".addslashes($_POST['zip'])."'";
>      $comments = "'".addslashes($_POST['comments'])."'";
>      $newsletter = "'".addslashes($_POST['signup'])."'";
>      $contact = "'".addslashes($_POST['contact'])."'";
> 
> 
> I can understand addSlashes for the first and last name, but question  
> the need in the other variables, please inform.

ALWAYS escape user submitted data. Just because you expect a certain
input doesn't mean some Mr. Malicious posted it to your form. That said,
addSlashes() is insecure for database queries. You should use the
database specific escape function to properly escape content that is DB
bound.

Cheers,
Rob.
-- 
...........................................................
SwarmBuy.com - http://www.swarmbuy.com

    Leveraging the buying power of the masses!
...........................................................

--- End Message ---
--- Begin Message ---
CK wrote:
Hi,

Engaged in "cleanup" project, attempting to understand the uncommented decisions of predecessors. Inserting the following contact form values into a DB:


    $first = "'".addslashes($_POST['firstname'])."'";
    $last = "'".addslashes($_POST['lastname'])."'";
    $email = "'".addslashes($_POST['email'])."'";
    $address = "'".addslashes($_POST['address'])."'";
    $city = "'".addslashes($_POST['city'])."'";
    $state = "'".addslashes($_POST['state'])."'";
    $zip = "'".addslashes($_POST['zip'])."'";
    $comments = "'".addslashes($_POST['comments'])."'";
    $newsletter = "'".addslashes($_POST['signup'])."'";
    $contact = "'".addslashes($_POST['contact'])."'";


I can understand addSlashes for the first and last name, but question the need in the other variables, please inform.

CK


More than likely what they were trying to do is prep/escape the data for 
insertion into the DB.

a better thing to use would be the actually DB escape function.

Mysql  http://us2.php.net/mysql_real_escape_string

Other DB implementations have similar functions

This will escape the data for insertion into a DB, but do it on all chars that needed to be escaped. Where addSlashes() works on only a subset of most of the chars that need escaping.


--
Jim Lucas

   "Some men are born to greatness, some achieve greatness,
       and some have greatness thrust upon them."

Twelfth Night, Act II, Scene V
    by William Shakespeare

--- End Message ---
--- Begin Message ---
Roberto Mansfield wrote:
Internally, 75.82 can't be stored exactly, so 75.82 * 100 is probably
7581.999992 rather than the expected integer value of 7582. So intval is
behaving properly. Sounds like you want intval(round($a));



[EMAIL PROTECTED] wrote:
Very weird and counter intuitive.  Looking at the php manual, I see this:

Converting to integer from floating point:

"When converting from float to integer, the number will be rounded towards 
zero."

But you'd think the multiplication would happen before the rounding.

if you do:
$a = ceil(75.82 * 100);

you should get the proper answer.

This is what I used for testing:

<?php
$x = 75.82;
$y = 100;

echo "x is " . gettype($x) . "<br>\n";
echo "y is " . gettype($y) . "<br>\n";

$a = ceil($x * $y);

echo "a is " . gettype($a) . "<br>\n";

echo "intval(a) is " . gettype(intval($a)) . "<br>\n";

echo $a . " *** " . intval($a);
?>

Not sure that really helps, but seems to be some kind of order of precedence 
issue.

-TG

= = = Original message = = =

This sort of thing really isn't helpful...

<?php

$a = 75.82 * 100;

echo intval($a);

?>


___________________________________________________________
Sent by ePrompter, the premier email notification software.
Free download at http://www.ePrompter.com.
Better yet: $a + 0, or (int)$a.

--- End Message ---
--- Begin Message ---
Roberto Mansfield wrote:
Internally, 75.82 can't be stored exactly, so 75.82 * 100 is probably
7581.999992 rather than the expected integer value of 7582. So intval is
behaving properly. Sounds like you want intval(round($a));



[EMAIL PROTECTED] wrote:
Very weird and counter intuitive.  Looking at the php manual, I see this:

Converting to integer from floating point:

"When converting from float to integer, the number will be rounded towards 
zero."

But you'd think the multiplication would happen before the rounding.

if you do:
$a = ceil(75.82 * 100);

you should get the proper answer.

This is what I used for testing:

<?php
$x = 75.82;
$y = 100;

echo "x is " . gettype($x) . "<br>\n";
echo "y is " . gettype($y) . "<br>\n";

$a = ceil($x * $y);

echo "a is " . gettype($a) . "<br>\n";

echo "intval(a) is " . gettype(intval($a)) . "<br>\n";

echo $a . " *** " . intval($a);
?>

Not sure that really helps, but seems to be some kind of order of precedence 
issue.

-TG

= = = Original message = = =

This sort of thing really isn't helpful...

<?php

$a = 75.82 * 100;

echo intval($a);

?>


___________________________________________________________
Sent by ePrompter, the premier email notification software.
Free download at http://www.ePrompter.com.
Better yet: $a + 0, or (int)$a.

--- End Message ---
--- Begin Message ---
Roberto Mansfield wrote:
Internally, 75.82 can't be stored exactly, so 75.82 * 100 is probably
7581.999992 rather than the expected integer value of 7582. So intval is
behaving properly. Sounds like you want intval(round($a));



[EMAIL PROTECTED] wrote:
Very weird and counter intuitive.  Looking at the php manual, I see this:

Converting to integer from floating point:

"When converting from float to integer, the number will be rounded towards 
zero."

But you'd think the multiplication would happen before the rounding.

if you do:
$a = ceil(75.82 * 100);

you should get the proper answer.

This is what I used for testing:

<?php
$x = 75.82;
$y = 100;

echo "x is " . gettype($x) . "<br>\n";
echo "y is " . gettype($y) . "<br>\n";

$a = ceil($x * $y);

echo "a is " . gettype($a) . "<br>\n";

echo "intval(a) is " . gettype(intval($a)) . "<br>\n";

echo $a . " *** " . intval($a);
?>

Not sure that really helps, but seems to be some kind of order of precedence 
issue.

-TG

= = = Original message = = =

This sort of thing really isn't helpful...

<?php

$a = 75.82 * 100;

echo intval($a);

?>


___________________________________________________________
Sent by ePrompter, the premier email notification software.
Free download at http://www.ePrompter.com.
Better yet: $a + 0, or (int)$a.

--- End Message ---
--- Begin Message --- I like to think that I'm reasonably aware of the limitations of floating point (famous last words).

To my mind, the ridiculousness (probably not a word) of the example is highlighted by the fact that 75.81 and 75.83 work perfectly.

Roberto Mansfield wrote:
Internally, 75.82 can't be stored exactly, so 75.82 * 100 is probably
7581.999992 rather than the expected integer value of 7582. So intval is
behaving properly. Sounds like you want intval(round($a));



[EMAIL PROTECTED] wrote:
Very weird and counter intuitive.  Looking at the php manual, I see this:

Converting to integer from floating point:

"When converting from float to integer, the number will be rounded towards 
zero."

But you'd think the multiplication would happen before the rounding.

if you do:
$a = ceil(75.82 * 100);

you should get the proper answer.

This is what I used for testing:

<?php
$x = 75.82;
$y = 100;

echo "x is " . gettype($x) . "<br>\n";
echo "y is " . gettype($y) . "<br>\n";

$a = ceil($x * $y);

echo "a is " . gettype($a) . "<br>\n";

echo "intval(a) is " . gettype(intval($a)) . "<br>\n";

echo $a . " *** " . intval($a);
?>

Not sure that really helps, but seems to be some kind of order of precedence 
issue.

-TG

= = = Original message = = =

This sort of thing really isn't helpful...

<?php

$a = 75.82 * 100;

echo intval($a);

?>


___________________________________________________________
Sent by ePrompter, the premier email notification software.
Free download at http://www.ePrompter.com.


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

Being thrust into cleaning after another has me timid. Could some kind soul look over the following solution for form validation and DB query? Any suggestions on security and streamlining is humbly requested.


CK


<?php

   $firstname =$_POST['firstname'];
    $lastname = $_POST['lastname']);
    $email = $_POST['email']);
    $address = $_POST['address']);
    $city = $_POST['city']);
    $state = $_POST['state']);
    $zip = $_POST['zip']);
    $comments = $_POST['comments']);
    $newsletter = $_POST['signup']);
    $contact = $_POST['contact']);
    $dt = "'".date('Y-m-d H:i:s');

    $message = "First Name: ".$firstname."\n";
    $message .= "Last Name: ".$lastname."\n";
    $message .= "Email: ".$email."\n";
    $message .= "Address: ".$address."\n";
    $message .= "City: ".$city."\n";
    $message .= "State: ".$state."\n";
    $message .= "Zip: ".$zip."\n";
    $message .= "Comments: ".$comments."\n";
    $message .= "Newsletter: ".$newsletter."\n";
    $message .= "Contact: ".$contact."\n";
        
        
        
        
function validate_form($email,$firstname,$lastname)
{
if(strlen($firstname)>0){
                $firstname=stripslashes($firstname);
        }else{//If no name was entered.
                $firstname=NULL;
                echo '<p><em>You forgot to enter your first name.</em></p>';
        }       
if(strlen($lastname)>0){
                $lastname=stripslashes($fm_lastname);
        }else{//If no name was entered.
                $lastname=NULL;
                echo '<p><em>You forgot to enter  your last name.</em></p>';
}


   // Create the syntax of email with validation regular expression
$regexp = "^([_a-z0-9-]+)(\.[_a-z0-9-]+)*@([a-z0-9-]+)(\.[a-z0-9-] +)*(\.[a-z]{2,4})$";

   // Presume that the email is invalid
   $valid = false;

   // Validate the syntax
   if (eregi($regexp, $email))
   {
      list($username,$domaintld) = split("@",$email);
      // Validate the domain
      if (getmxrr($domaintld,$mxrecords))
         $valid = true;
                 }
        // attempts a socket connection to mail server
  if(@fsockopen($domaintld,25,$errno,$errstr,15)) {
                $valid = true;
   } else {
        $valid = false;
                echo '<p><em>Please check your email and try again.</em></p>';
  }
         return $valid;
}

if (validate_form($email,$firstname,$lastname))
    @ $db = mysql_connect('mysql_host', 'mysql_user', 'mysql_password);
    if (mysql_errno()) {
      echo '<p>error connecting to database</p>';
      exit;
    }
    if (!mysql_select_db("mysql_user")) {
      echo "<p>There is a system error - please try later</p>";
      exit;
    }

$query = "insert into users values (NULL, ".$firstname.", ". $lastname.", ".$email.", ".$address.", ".$city.", ".$state.", ". $zip.", ".$comments.", ".$newsletter.", ".$contact.", ".$dt.")";
mysql_real_escape_string($firstname, $query),
mysql_real_escape_string($lastname, $query),
mysql_real_escape_string($email, $query),
mysql_real_escape_string($address, $query),
mysql_real_escape_string($city, $query),
mysql_real_escape_string($state, $query),
mysql_real_escape_string($zip, $query),
mysql_real_escape_string($comments, $query),
mysql_real_escape_string($newsletter, $query),
mysql_real_escape_string($contact, $query),
mysql_real_escape_string($dt, $query),
    //echo "<p>".$query."</p>";
    $result = mysql_query($query, $db);
    if (!$result) {
      echo "<p>".mysql_error()."</p>";
      exit;
    } else {
      $to = "[EMAIL PROTECTED]";
      $subject = "CTS Contact";
      mail($to, $subject, $message);
          }
    }
        
        
        
}       
?>

--- End Message ---
--- Begin Message ---
Guys,

Got a quick question. I got a sql statement works when I pass it from the cli. but if I try in php I get nothing.

This is the statement.

Select ip, date, time, CONCAT(city, ', ',country) as location from ips where country !=' ' and date='`date +%Y%m%d`' order by country asc;

I know it has to do with date='`date +%Y%m%d`', because if I remove it works.

Any clue as to why?

Payne

--- End Message ---
--- Begin Message ---
Payne wrote:
Guys,

Got a quick question. I got a sql statement works when I pass it from the cli. but if I try in php I get nothing.

This is the statement.

Select ip, date, time, CONCAT(city, ', ',country) as location from ips where country !=' ' and date='`date +%Y%m%d`' order by country asc;

I know it has to do with date='`date +%Y%m%d`', because if I remove it works.

Any clue as to why?

Payne

why not use the PHP function to format the date?

http://www.php.net/date
-B

--- End Message ---
--- Begin Message ---
> I know it has to do with date='`date +%Y%m%d`', because if I remove it
> works.

Are you trying to use perl's back tic operator in php here?

--- End Message ---
--- Begin Message ---
Michael Preslar wrote:
I know it has to do with date='`date +%Y%m%d`', because if I remove it
works.

Are you trying to use perl's back tic operator in php here?

PHP also supports the that.

However, I think the OP's problem is that it's inside other quotes and is therefore not being executed. But, as someone else pointed out, you should be using the PHP date function to get the date from within PHP.

-Stut

--
http://stut.net/

--- End Message ---
--- Begin Message --- Your best bet is to use flash. Flash has the ability to access user's microphones built in. And since flash is cross platform it works on everything. Also it's pretty simple to do. http://www.adobe.com/support/flash/action_scripts/actionscript_dictionary/actionscript_dictionary479.html explains a bit of Microphone.get. You will want to use this with a Flash Communications server. I think that should let you save the audio.

One thing that you may not have thought of though. Do users really want to be using your flash or whatever script to record their audio? Wouldn't it be nice if they could record it using their own recorder, for example on windows there's sound recorder built right in. Then they could have a few takes and upload the best one. And all you would have to do is handle the mp3 or wav upload.

- Dan

""John Pillion"" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED]
Not exactly a php question. but I'm doing the project in php, so does that
count? ;-)



A client of mine wants a simple audio recorder for users to record a short
clip/message for other users. anyone recommend any simple audio recorder
applets or similar that can easily be integrated with php?



Thanks!



J



--- End Message ---
--- Begin Message ---
From: "Richard Lynch" <[EMAIL PROTECTED]>
Your dev box should only match in software versions (okay, and any
really funky specialized hardware like a hardware random number
generator MAYBE).

Regarding duplicating the box versus software:
I'm working on a C++ project on a Mac Pro and a MacBook Pro.

Phew!

When I archived my sources and makefiles rather than reproducing them from memory, it built the same successfully on both. As I would hope.

_________________________________________________________________
Puzzles, trivia teasers, word scrambles and more. Play for your chance to win! http://club.live.com/home.aspx?icid=CLUB_hotmailtextlink
--- End Message ---
--- Begin Message ---
I'm trying to pull all the components out of strings structured like:
word followed by any number of ( dot word or square bracketed string )

This is an example: foo.bar[ab.cd].baz

>From the above example, I want: array('foo', 'bar', 'ab.cd', 'baz');

A regular expression to match these strings, including parenthesis
around the parts I want to pull out:

preg_match('/(^\w+)(?:\.(\w+)|\[([^]]+)\])*/', $subject, $matches);

However applied to the above example:

$matches[1] = 'foo'; // First subexpression
$matches[2] = 'baz'; // Last value of second subexpression
$matches[3] = 'ab.cd'; // Last value of third subexpression

I'm not sure how to get an array of all subexpression matches, in the
order matches appear in the subject, instead of the order expressions
appear in the pattern.

I think I might be able to do something using the Perl (?{code})
construction, e.g. ...(?:\.(\w+)(?{$parts[] = \2})|\[([^]]+)(?{$parts[]
= \3})\])*... but I haven't thought about it too much because PHP
doesn't support this construction.

Any ideas much appreciated. Thanks, Jack

--- End Message ---
--- Begin Message ---
I've installed IIS (Internet information services on my windows XP machine. 
I've also installed php 5.0 from www.php.net. I'm trying to use the mail() 
function in a simple php script which uses a html form. However, i'm not able 
to send the mail using the mail($to, $subject, $message, $headers); function. I 
wonder what's wrong. Please help, i'm new to php.

Animesh Joshi

--- End Message ---
--- Begin Message --- Check to see if you can send mail out of your server aside from the php script. Also, check the logs: error_log, maillog, messages to see what's wrong with the script or the mail function. I'm not sure if these logs exist on IIS or where they are.

Siavash

----- Original Message ----- From: "Animesh Joshi" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, August 01, 2007 3:20 AM
Subject: [PHP] mail function


I've installed IIS (Internet information services on my windows XP machine. I've also installed php 5.0 from www.php.net. I'm trying to use the mail() function in a simple php script which uses a html form. However, i'm not able to send the mail using the mail($to, $subject, $message, $headers); function. I wonder what's wrong. Please help, i'm new to php.

Animesh Joshi
--- End Message ---
--- Begin Message ---
Anyone ever coded a full business app using PHP and nCurses?    

-- 
  @~@   Might, Courage, Vision, SINCERITY.
 / v \  Simplicity is Beauty! May the Force and Farce be with you!
/( _ )\ (Xubuntu 7.04)  Linux 2.6.22.1
  ^ ^   15:43:01 up 21 days 17:47 2 users load average: 0.01 0.04 0.00
news://news.3home.net news://news.hkpcug.org news://news.newsgroup.com.hk

--- End Message ---

Reply via email to