php-general Digest 11 Jun 2004 23:28:38 -0000 Issue 2816

Topics (messages 188097 through 188140):

Re: Binary math
        188097 by: Mark

patRSS
        188098 by: Edward Peloke
        188133 by: Daniel Guerrier

Re: Gd Library and Special Chars
        188099 by: news.php.net

Changing the directory that PHP runs from (CLI)
        188100 by: Phil Ewington - 43 Plc
        188105 by: Justin Patrin
        188112 by: Phil Ewington - 43 Plc

Re: Limit the number of characters in a string
        188101 by: Daniel Clark

passing a function as a parameter
        188102 by: Bob Lockie
        188103 by: Torsten Roehr
        188104 by: news.php.net
        188106 by: Justin Patrin
        188107 by: Bob Lockie
        188110 by: Daniel Clark
        188126 by: Justin Patrin

fopen successful..cant write to the file though permissions are ok..
        188108 by: mukta telang
        188109 by: Matt Matijevich

Problem with Imagick
        188111 by: Info.Best-IT

PHP pros and cons
        188113 by: Amanda Hemmerich
        188129 by: Chris Shiflett
        188136 by: Steve Douville
        188138 by: Chris Shiflett

Using date() to spit out milliseconds???
        188114 by: Scott Fletcher
        188115 by: Curt Zirzow
        188117 by: Scott Fletcher

gethostbyaddr
        188116 by: Alicia Riggs

nested statement problem
        188118 by: Eric Boerner
        188121 by: Torsten Roehr
        188137 by: Curt Zirzow

Re: choosing another smtpserver with PHPs mail function
        188119 by: Manuel Lemos
        188127 by: Justin Patrin

addslashes
        188120 by: Jough P
        188123 by: Torsten Roehr
        188128 by: Justin Patrin
        188130 by: Chris Shiflett
        188135 by: Justin Patrin

array_rand() not random
        188122 by: Nori Heikkinen

testing array_search
        188124 by: Bob Lockie
        188125 by: Daniel Clark
        188139 by: Curt Zirzow

Re: junk after document element
        188131 by: Jason Barnett

Re: PDA / Normal Browser
        188132 by: Jason Barnett
        188134 by: Pushpinder Singh

Re: Undiscovered Firefox...
        188140 by: Rick Fletcher

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 ---
--- Knightking <[EMAIL PROTECTED]> wrote:
> On Thu, 10 Jun 2004 20:08:08 -0700, Justin Patrin  
> <[EMAIL PROTECTED]> wrote:
> 
> > Mark wrote:
> >
> >> [snip]
> >
> > I'm not sure what's wrong with the code you have, but for the
> 4-digit  
> > one you have:
> >
> > $packed = 4-bit var with ABCD encoded in it
> >
> > $a = $packed & 1;
> > $b = $packed & 2;
> > $c = $packed & 4;
> > $d = $packed & 8;
> >
> Just as a side tip, I highly recommend using hexadecimal for
> bitwise  
> functions where possible, i.e.:
> $a = $packed & 0x1;
> $b = $packed & 0x2;
> $c = $packed & 0x4;
> $d = $packed & 0x8;
> $e = $packed & 0x10;
> $f = $packed & 0x20;
> $g = $packed & 0x40;
> $h = $packed & 0x80;
> $i = $packed & 0x100;

Thanks guys. I never really used bitwise operators, but I knew they'd
come in handy one day. Thanks for the tips. Now I just need to get
this monster working.

Mark
> 
> Using M2, Opera's revolutionary e-mail client:
> http://www.opera.com/m2/
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 


=====
Mark Weinstock
[EMAIL PROTECTED]
***************************************
You can't demand something as a "right" unless you are willing to fight to death to 
defend everyone else's right to the same thing.
***************************************


        
                
__________________________________
Do you Yahoo!?
Friends.  Fun.  Try the all-new Yahoo! Messenger.
http://messenger.yahoo.com/ 

--- End Message ---
--- Begin Message ---
Does anyone use patRSS for the rss feeds?

http://www.php-tools.net/site.php?&PHPSESSID=99dd0269b03bee4046c3395d5561162
1&file=/patMisc/rss.xml

I don't see much online about it.  It seems to work fine, but I now have to
cycle through another array to pull out and format everything.

Thanks,
Eddie

 WARNING:  The information contained in this message and any attachments is
intended only for the use of the individual or entity to which it is
addressed.  This message may contain information that is privileged,
confidential and exempt from disclosure under applicable law.  It may also
contain trade secrets and other proprietary information for which you and
your employer may be held liable for disclosing.  You are hereby notified
that any unauthorized dissemination, distribution or copying of this
communication is strictly prohibited.  If you have received this
communication in error,  please notify [EMAIL PROTECTED] by E-Mail and then
destroy this communication in a manner appropriate for privileged
information.

--- End Message ---
--- Begin Message ---
try
http://magpierss.sourceforge.net/
--- Edward Peloke <[EMAIL PROTECTED]> wrote:
> Does anyone use patRSS for the rss feeds?
> 
>
http://www.php-tools.net/site.php?&PHPSESSID=99dd0269b03bee4046c3395d5561162
> 1&file=/patMisc/rss.xml
> 
> I don't see much online about it.  It seems to work
> fine, but I now have to
> cycle through another array to pull out and format
> everything.
> 
> Thanks,
> Eddie
> 
>  WARNING:  The information contained in this message
> and any attachments is
> intended only for the use of the individual or
> entity to which it is
> addressed.  This message may contain information
> that is privileged,
> confidential and exempt from disclosure under
> applicable law.  It may also
> contain trade secrets and other proprietary
> information for which you and
> your employer may be held liable for disclosing. 
> You are hereby notified
> that any unauthorized dissemination, distribution or
> copying of this
> communication is strictly prohibited.  If you have
> received this
> communication in error,  please notify
> [EMAIL PROTECTED] by E-Mail and then
> destroy this communication in a manner appropriate
> for privileged
> information.
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 



        
                
__________________________________
Do you Yahoo!?
Friends.  Fun.  Try the all-new Yahoo! Messenger.
http://messenger.yahoo.com/ 

--- End Message ---
--- Begin Message --- Ok, i have solved problem with copyright and registered by using imagettftext...

But i still can't print correctly tm symbol :(

On Fri, 11 Jun 2004 11:56:14 +0200, News.Php.Net <[EMAIL PROTECTED]> wrote:

Hi to all,

I need to do parsing of html data from one site for find nick , guild, and some other infos...

The problem is that gd doesn't print correctly chars like trademark, copyright, registered (which are contained in some nicks/guild names)...

Someone know a valid solution???




-- Using Opera's revolutionary e-mail client: http://www.opera.com/m2/

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

I have read the manual page for 'Using PHP from the command line' thoroughly
and cannot find the answer to my problem. I have a script that needs to be
accessed from both the command line and from web browsers. I tested the
script from the command line and all worked well. As soon as I set the
script to run from the crontab, all my includes fail because of paths. I
believe the manual tries to cover forcing PHP to run from an alternative
location but makes no sense to me. Can anyone tell me what changes I need to
make to the following crontab entry...

0 23 * * * /usr/bin/php /path/to/my/script.php arg1 arg2 arg3 > /dev/null

TIA

- Phil.

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.701 / Virus Database: 458 - Release Date: 07/06/2004

--- End Message ---
--- Begin Message ---
Phil Ewington - 43 Plc wrote:

Hi All,

I have read the manual page for 'Using PHP from the command line' thoroughly
and cannot find the answer to my problem. I have a script that needs to be
accessed from both the command line and from web browsers. I tested the
script from the command line and all worked well. As soon as I set the
script to run from the crontab, all my includes fail because of paths. I
believe the manual tries to cover forcing PHP to run from an alternative
location but makes no sense to me. Can anyone tell me what changes I need to
make to the following crontab entry...

0 23 * * * /usr/bin/php /path/to/my/script.php arg1 arg2 arg3 > /dev/null

TIA

- Phil.

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.701 / Virus Database: 458 - Release Date: 07/06/2004

Well, you could put your includes in a central location and set the include_path correctly in your php.ini. If that won't work for you, you can use chdir(dirname(realpath(__FILE))) to change to the script's directory. You could also use ini_set to add whatever directory you need ot the script's include_path.

--
paperCrane <Justin Patrin>

--- End Message ---
--- Begin Message ---
Justin,

I think I will go for the ini_set() option, seems to be the best bet to not
affect anything else. Thanks.

- Phil.

> -----Original Message-----
> From: Justin Patrin [mailto:[EMAIL PROTECTED]
> Sent: 11 June 2004 15:42
> To: [EMAIL PROTECTED]
> Subject: [PHP] Re: Changing the directory that PHP runs from (CLI)
>
>
> Phil Ewington - 43 Plc wrote:
>
> > Hi All,
> >
> > I have read the manual page for 'Using PHP from the command
> line' thoroughly
> > and cannot find the answer to my problem. I have a script that
> needs to be
> > accessed from both the command line and from web browsers. I tested the
> > script from the command line and all worked well. As soon as I set the
> > script to run from the crontab, all my includes fail because of paths. I
> > believe the manual tries to cover forcing PHP to run from an alternative
> > location but makes no sense to me. Can anyone tell me what
> changes I need to
> > make to the following crontab entry...
> >
> > 0 23 * * * /usr/bin/php /path/to/my/script.php arg1 arg2 arg3 >
> /dev/null
> >
> > TIA
> >
> > - Phil.
> >
> > ---
> > Outgoing mail is certified Virus Free.
> > Checked by AVG anti-virus system (http://www.grisoft.com).
> > Version: 6.0.701 / Virus Database: 458 - Release Date: 07/06/2004
>
> Well, you could put your includes in a central location and set the
> include_path correctly in your php.ini. If that won't work for you, you
> can use chdir(dirname(realpath(__FILE))) to change to the script's
> directory. You could also use ini_set to add whatever directory you need
> ot the script's include_path.
>
> --
> paperCrane <Justin Patrin>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
> ---
> Incoming mail is certified Virus Free.
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.701 / Virus Database: 458 - Release Date: 07/06/2004
>
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.701 / Virus Database: 458 - Release Date: 07/06/2004

--- End Message ---
--- Begin Message ---
substr( xxx, 1, 100)

>>
>>Hi
>>
>>Anyone know how to clip the number of characters in a string? For instance,
>>I have a string carrying a long piece of text, say, of 200 characters, but I
>>want to reduce this to just the first 100 characters.
>>
>>
>>Thanks in advance.
>>
>>Russell

--- End Message ---
--- Begin Message ---
I want to pass a function as a parameter and execute it in another function.
A callback. :-)

For example:

function a() {
    echo "a";
}


function b( $func ) { func(); echo "b"; }


The output of "b( a )" will be "ab".
--- End Message ---
--- Begin Message ---
"Bob Lockie" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> I want to pass a function as a parameter and execute it in another
function.
> A callback. :-)
>
> For example:
>
> function a() {
>      echo "a";
> }
>
>
> function b( $func ) {
>      func();
>      echo "b";
> }
>
>
> The output of "b( a )" will be "ab".

Take a look at call_user_func():
http://de3.php.net/manual/en/function.call-user-func.php

You have to pass the name of the function instead of the function itself:

function a() {
     echo "a";
}

function b($func) {
     call_user_func($func);
     echo "b";
}

b('a');

Regards, Torsten

--- End Message ---
--- Begin Message --- I'am not sure what you wanna do, but if you want to send a parameter use something like this one:
<?
function a() {
return "a";
}

function b($val) {
    echo $val."b";
}
b(a());
?>

or you can always use classes...

On Fri, 11 Jun 2004 10:25:54 -0400, Bob Lockie <[EMAIL PROTECTED]> wrote:

I want to pass a function as a parameter and execute it in another function.
A callback. :-)

For example:

function a() {
     echo "a";
}


function b( $func ) { func(); echo "b"; }


The output of "b( a )" will be "ab".



-- Using Opera's revolutionary e-mail client: http://www.opera.com/m2/

--- End Message ---
--- Begin Message ---
Torsten Roehr wrote:

"Bob Lockie" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]

I want to pass a function as a parameter and execute it in another

function.

A callback. :-)

For example:

function a() {
    echo "a";
}


function b( $func ) { func(); echo "b"; }


The output of "b( a )" will be "ab".


Take a look at call_user_func():
http://de3.php.net/manual/en/function.call-user-func.php

You have to pass the name of the function instead of the function itself:

function a() {
     echo "a";
}

function b($func) {
     call_user_func($func);
     echo "b";
}

b('a');

Regards, Torsten

You can also do it this way:

function b($func) {
  $func();
  echo 'b';
}

--
paperCrane <Justin Patrin>

--- End Message ---
--- Begin Message ---
Take a look at call_user_func():
http://de3.php.net/manual/en/function.call-user-func.php

Thanks, I have it working.
--- End Message ---
--- Begin Message ---
Can you use eval() ?

> I want to pass a function as a parameter and execute it in another
> function.
> A callback. :-)
>
> For example:
>
> function a() {
>      echo "a";
> }
>
>
> function b( $func ) {
>      func();
>      echo "b";
> }
>
>
> The output of "b( a )" will be "ab".

--- End Message ---
--- Begin Message ---
call_user_func($func) and $func() are much better alternatives.

Daniel Clark wrote:

Can you use eval() ?


I want to pass a function as a parameter and execute it in another
function.
A callback. :-)

For example:

function a() {
    echo "a";
}


function b( $func ) { func(); echo "b"; }


The output of "b( a )" will be "ab".


--
paperCrane <Justin Patrin>

--- End Message ---
--- Begin Message ---
Hi,
I am facing a strange problem..When I try to create a
file in /tmp directory (using php script) as follows:

$filename"/tmp/newfile");
$filehandle=fopen($filename,"w");
fclose($filehandle);

I get error something like fclose(): ~not a stream~.
All routines like fwrite(), readdir() give errors.
An empty file gets created though.

Its silly, but cant find the reason..
Please help,

Mukta 


        
                
__________________________________
Do you Yahoo!?
Friends.  Fun.  Try the all-new Yahoo! Messenger.
http://messenger.yahoo.com/ 

--- End Message ---
--- Begin Message ---
[snip]
$filename"/tmp/newfile");
$filehandle=fopen($filename,"w");
fclose($filehandle);
[/snip]

is this the exact code you are trying to use?

--- End Message ---
--- Begin Message ---
I am having a problem installing Imagick in PHP 4.3.6.  In the install
instructions:

1) make sure the path to Magick-config (the ImageMagick configuration
   script) is in your PATH environment variable

There is no Magick-config file. Anyone know what �Magick-config� is exactly?
I figure this is why the install is failing.

Thanks!

/T


--- End Message ---
--- Begin Message ---
I am trying to come up with a little speech to use when talking to
potential clients to make a case for using PHP over over languages, such
as perl, ColdFusion, ASP, etc.  I have been looking on the web, but I
would also love to hear from you guys.  How would you make a case for
using PHP?  Also, clients always seem to want to hear a couple of "cons",
just so they know you aren't just blowing smoke - what do you guys think
are some limitations of PHP?

Amanda

--- End Message ---
--- Begin Message ---
--- Amanda Hemmerich <[EMAIL PROTECTED]> wrote:
> what do you guys think are some limitations of PHP?

It's not persistent like ColdFusion.
It doesn't have namespaces.
The object model in PHP 4 is poor.

I'm sure others can pitch in here. :-)

Chris

=====
Chris Shiflett - http://shiflett.org/

PHP Security - O'Reilly
     Coming Fall 2004
HTTP Developer's Handbook - Sams
     http://httphandbook.org/
PHP Community Site
     http://phpcommunity.org/

--- End Message ---
--- Begin Message ---
Easier to learn than Perl, comparable learning curves with CF imo, probably
a bit easier than ASP initially.

Cheaper to deploy than CF since it's free, same for ASP.

As for speed in building applications, I'd say that given someone has the
same ability in any of the 4 (PHP, ASP, CF, Perl) deployment time is about
the same. Maybe a little longer for Perl.

All of the 4 languages have plenty of documentation written about them.

I do like CF's ability to just name data sources on the server and reference
them that way. Think ASP can do the same, not sure.

My 2 cents...

Steve
----- Original Message ----- 
From: "Chris Shiflett" <[EMAIL PROTECTED]>
To: "Amanda Hemmerich" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Friday, June 11, 2004 2:39 PM
Subject: Re: [PHP] PHP pros and cons


> --- Amanda Hemmerich <[EMAIL PROTECTED]> wrote:
> > what do you guys think are some limitations of PHP?
>
> It's not persistent like ColdFusion.
> It doesn't have namespaces.
> The object model in PHP 4 is poor.
>
> I'm sure others can pitch in here. :-)
>
> Chris
>
> =====
> Chris Shiflett - http://shiflett.org/
>
> PHP Security - O'Reilly
>      Coming Fall 2004
> HTTP Developer's Handbook - Sams
>      http://httphandbook.org/
> PHP Community Site
>      http://phpcommunity.org/
>
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
>
>
>

--- End Message ---
--- Begin Message ---
--- Steve Douville <[EMAIL PROTECTED]> wrote:
> I do like CF's ability to just name data sources on the server and
> reference them that way.

You won't be able to reproduce the "cfadmin" stuff with PHP, simply
because PHP isn't a persistent process, but I think great strides will be
made on the database front with this:

http://pecl.php.net/package/PDO

One of ColdFusion's strengths has always been uniforum database access
within the code without the extra cost of a userland database abstraction
layer. PDO should give PHP developers that same mix of consistency and
performance.

Chris

=====
Chris Shiflett - http://shiflett.org/

PHP Security - O'Reilly
     Coming Fall 2004
HTTP Developer's Handbook - Sams
     http://httphandbook.org/
PHP Community Site
     http://phpcommunity.org/

--- End Message ---
--- Begin Message ---
I noticed that date() doesn't provide the option to give me the time in
millisecond, so anyone know of a way to do that or anyone know of a script
that can do something like this.

THanks,
 Scott F.

--- End Message ---
--- Begin Message ---
* Thus wrote Scott Fletcher ([EMAIL PROTECTED]):
> I noticed that date() doesn't provide the option to give me the time in
> millisecond, so anyone know of a way to do that or anyone know of a script
> that can do something like this.

http://php.net/microtime


Curt
-- 
First, let me assure you that this is not one of those shady pyramid schemes
you've been hearing about.  No, sir.  Our model is the trapezoid!

--- End Message ---
--- Begin Message ---
I have decided to take up your suggestion and customize it.

--snip--
date("Y-m-d H:m:s.").substr(microtime(),2,6);
--snip--

This is all I need to create a timestamp.

Thanks...

"Curt Zirzow" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> * Thus wrote Scott Fletcher ([EMAIL PROTECTED]):
> > I noticed that date() doesn't provide the option to give me the time in
> > millisecond, so anyone know of a way to do that or anyone know of a
script
> > that can do something like this.
>
> http://php.net/microtime
>
>
> Curt
> -- 
> First, let me assure you that this is not one of those shady pyramid
schemes
> you've been hearing about.  No, sir.  Our model is the trapezoid!

--- End Message ---
--- Begin Message ---
Title: gethostbyaddr

Hi guys, I am new to this list, and signed up specifically for this problem.  If any one has any ideas it would be greatly appreciated. 

I am writing a function to allow users from a specific intranet permission to view a directory.  I am getting very different results from IE and Netscape.  I have written this in _javascript_ as well as PHP, and I am getting the same error in both languages. 

When I use the gethostbyaddr call, in IE I get a domain name the majority of the time, with a few exceptions. 
When I use the gethostbyaddr call in Netscape I only receive a domain name if there is a DNS entry.  If there is no DNS entry, Netscape returns an IP address. 

I am not sure what IE is using to get the domain names when there is no DNS entry. 

How do I get the correct info to be returned from Netscape? 


Here is the code I am using
***********************************

<?php
//echo "<pre>";
//print_r($_SERVER);
//echo "</pre>";
$hn = gethostbyaddr($_SERVER['REMOTE_ADDR']);
echo "host by addr = " . $hn . "\n<br>";
$darr = explode(".", $hn);
$cnt = count($darr);
$host = $darr[$cnt - 2] . "." . $darr[$cnt - 1];
echo "host = " . $host . "\n<br>";
/*
if($host == "xyz.com")
   header("Location: xyz.html");
else
if($host == "abc.com")
   header("Location: abc.html");
else
   header("Location: error.html");
*/
?>



Thanks in advance for any ideas!

Alicia Riggs
PSG - Web Development Engineer
214-550-7452


--- End Message ---
--- Begin Message ---
I am having a problem with a nested if statement in php. Everything
works fine, but it doesn't display the information that I am trying to
retrieve using a second if statement.

CODE:

if (($fr == 'FR') && ($xe == 'XE') && ($co == 'CO')) { print
"Statement";
        } elseif (($ag == 'AG') && ($rz == 'RZ') && ($sa == 'SA')) {
print "Additional Statement"; 
                if ($sr == 'SR') { print "More Info"; }
         print "Line continuation";
                if (($rx == 'RX') && ($rj == 'RJ') && ($rr == 'RR') &&
($rd == 'RD') && ($ra == 'RA')) { print "additional information"; }

// Everything works except this nested if statement - No php error, it
just doesn't display the information

         print "</font></td></tr><tr>";
} else { print "other information if false"; }


ENDCODE:


Thanks in advance

--- End Message ---
--- Begin Message ---
"Eric Boerner" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> I am having a problem with a nested if statement in php. Everything
> works fine, but it doesn't display the information that I am trying to
> retrieve using a second if statement.
>
> CODE:
>
> if (($fr == 'FR') && ($xe == 'XE') && ($co == 'CO')) { print
> "Statement";
> } elseif (($ag == 'AG') && ($rz == 'RZ') && ($sa == 'SA')) {
> print "Additional Statement";
> if ($sr == 'SR') { print "More Info"; }
> print "Line continuation";
> if (($rx == 'RX') && ($rj == 'RJ') && ($rr == 'RR') &&
> ($rd == 'RD') && ($ra == 'RA')) { print "additional information"; }
>
> // Everything works except this nested if statement - No php error, it
> just doesn't display the information
>
> print "</font></td></tr><tr>";
> } else { print "other information if false"; }

If it doesn't execute your code then the if statement doES NOT evaluate to
true. Have you printed out the values and manually checked them?

By the way, you don't need braces around each condition:
if (($fr == 'FR') && ($xe == 'XE') && ($co == 'CO')) {}
works also as:
if ($fr == 'FR' && $xe == 'XE' && $co == 'CO') {}

Regards,

Torsten Roehr

--- End Message ---
--- Begin Message ---
* Thus wrote Eric Boerner ([EMAIL PROTECTED]):
> I am having a problem with a nested if statement in php. Everything
> works fine, but it doesn't display the information that I am trying to
> retrieve using a second if statement.
> 
> CODE:
> 
> if (($fr == 'FR') && ($xe == 'XE') && ($co == 'CO')) { print
> "Statement";
>       } elseif (($ag == 'AG') && ($rz == 'RZ') && ($sa == 'SA')) {
> print "Additional Statement"; 
>               if ($sr == 'SR') { print "More Info"; }
>        print "Line continuation";
>               if (($rx == 'RX') && ($rj == 'RJ') && ($rr == 'RR') &&
> ($rd == 'RD') && ($ra == 'RA')) { print "additional information"; }
 
Not much I can tell ya except that you might be getting lost in 
what is in an else vs. what is in the if

<?php

if (($fr == 'FR') && 
    ($xe == 'XE') && 
    ($co == 'CO')) {

  print "Statement";

} elseif (
    ($ag == 'AG') && 
    ($rz == 'RZ') && 
    ($sa == 'SA')) {

  print "Additional Statement";

  if ($sr == 'SR') { 
    print "More Info"; 
  }

  print "Line continuation";

  if (($rx == 'RX') && 
      ($rj == 'RJ') && 
      ($rr == 'RR') && 
      ($rd == 'RD') && 
      ($ra == 'RA')) {

    print "additional information"; 

  }

  // Everything works except this nested if statement - 
  // No php error, it just doesn't display the information
  print "</font></td></tr><tr>";

} else { 
  print "other information if false"; 
}



Curt
-- 
First, let me assure you that this is not one of those shady pyramid schemes
you've been hearing about.  No, sir.  Our model is the trapezoid!

--- End Message ---
--- Begin Message ---
Hello,

On 06/10/2004 07:05 PM, O�v as&��nsson wrote:
I having a little problem with PHPs build in function mail().
The mailserver isnt located on the webserver, its on another machine.
I have tryed ini_set("SMTP", "ipaddress"); with no result.

The system I'm on runs on an Linux box.

That does not work on Windows.


Can this be done or must I write an own mail function, with sockets?

Sure, you may want to try this class that comes with a wrapper function named smtp_mail() that works like the mail() but sends messages through a SMTP server of your choice that you can configure in the PHP script smtp_mail.php . If necessary it even supports authentication or even direct delivery, so you do not even have to relay the messages on the SMTP server.

http://www.phpclasses.org/mimemessage

You also need this for the actual SMTP delivery:

http://www.phpclasses.org/smtpclass


--

Regards,
Manuel Lemos

PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/

PHP Reviews - Reviews of PHP books and other products
http://www.phpclasses.org/reviews/

Metastorage - Data object relational mapping layer generator
http://www.meta-language.net/metastorage.html

--- End Message ---
--- Begin Message ---
Manuel Lemos wrote:

Hello,

On 06/10/2004 07:05 PM, O�v as&��nsson wrote:

I having a little problem with PHPs build in function mail().
The mailserver isnt located on the webserver, its on another machine.
I have tryed ini_set("SMTP", "ipaddress"); with no result.

The system I'm on runs on an Linux box.


That does not work on Windows.

It *does* work on Windows, but not on Linux.



Can this be done or must I write an own mail function, with sockets?


Sure, you may want to try this class that comes with a wrapper function named smtp_mail() that works like the mail() but sends messages through a SMTP server of your choice that you can configure in the PHP script smtp_mail.php . If necessary it even supports authentication or even direct delivery, so you do not even have to relay the messages on the SMTP server.

http://www.phpclasses.org/mimemessage

You also need this for the actual SMTP delivery:

http://www.phpclasses.org/smtpclass




--
paperCrane <Justin Patrin>

--- End Message ---
--- Begin Message ---
Greetings all,

I'm doing all my PHP development on my iBook running OS X. I'm currently working on a messaging tool for a website. When the messages are posted on my iBook the single quotes are escaped properly. When I upload the same *.php files to the server the single quotes are preceded by a backslash.
i.e.
Don't
appears:
Don\'t

I presume this has something to do with the way PHP is configured. My goal is to never have to use the addslashes() function. Any suggestions?

Thanks!!
--- End Message ---
--- Begin Message ---
"Jough P" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Greetings all,
>
> I'm doing all my PHP development on my iBook running OS X.  I'm
> currently working on a messaging tool for a website.  When the messages
> are posted on my iBook the single quotes are escaped properly.  When I
> upload the same *.php files to the server the single quotes are
> preceded by a backslash.
> i.e.
> Don't
> appears:
> Don\'t
>
> I presume this has something to do with the way PHP is configured.   My
> goal is to never have to use the addslashes() function.  Any
> suggestions?

See here:
http://de.php.net/addslashes

Pay attention to the notes on magic_quotes.

Regards,

Torsten Roehr

--- End Message ---
--- Begin Message ---
Torsten Roehr wrote:

"Jough P" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]

Greetings all,

I'm doing all my PHP development on my iBook running OS X.  I'm
currently working on a messaging tool for a website.  When the messages
are posted on my iBook the single quotes are escaped properly.  When I
upload the same *.php files to the server the single quotes are
preceded by a backslash.
i.e.
Don't
appears:
Don\'t

I presume this has something to do with the way PHP is configured.   My
goal is to never have to use the addslashes() function.  Any
suggestions?


See here:
http://de.php.net/addslashes

Pay attention to the notes on magic_quotes.

I would suggest turning off all magic_quotes settings and dealwith with it yourself (or letting a package do it for you). Using magic_quotes can lead to many nightmares....


Regards,

Torsten Roehr


--
paperCrane <Justin Patrin>

--- End Message ---
--- Begin Message ---
--- Jough P <[EMAIL PROTECTED]> wrote:
> My goal is to never have to use the addslashes() function. Any 
> suggestions?

There's probably nothing you can do about your Web host, but you can use
the fix_magic_quotes() function listed here:

http://phundamentals.nyphp.org/PH_storingretrieving.php

Hope that helps.

Chris

=====
Chris Shiflett - http://shiflett.org/

PHP Security - O'Reilly
     Coming Fall 2004
HTTP Developer's Handbook - Sams
     http://httphandbook.org/
PHP Community Site
     http://phpcommunity.org/

--- End Message ---
--- Begin Message ---
Chris Shiflett wrote:

--- Jough P <[EMAIL PROTECTED]> wrote:

My goal is to never have to use the addslashes() function. Any suggestions?


There's probably nothing you can do about your Web host, but you can use
the fix_magic_quotes() function listed here:

http://phundamentals.nyphp.org/PH_storingretrieving.php

Hope that helps.


If it's set on your host and you can't get it changed, you may be able to use a .htaccess file in your directory to turn it off as well.

--
paperCrane <Justin Patrin>

--- End Message ---
--- Begin Message ---
hi,

i'm trying to use the array_rand() to return one of six images, culled
from a directory listing.  however, i've noticed that over the past
five days, the log of images accessed is anything but a random
distribution:

     20 /jnl/images/banner/banner_viola.jpg
     32 /jnl/images/banner/bw_banner.jpg
     35 /jnl/images/banner/alyssa_banner.jpg
    104 /jnl/images/banner/coffee_banner.jpg
    147 /jnl/images/banner/banner_bracelets.jpg
    193 /jnl/images/banner/orange_wig_banner.jpg

i'd like to see the others pop up a bit more -- like, ever.  i'm
seeding the random method with srand, even though i'm running php
4.3.3 and shouldn't need to.  i tried the shuffle() method like was
suggested on the manual page for the array_rand() method, but can't
make it work -- it returns an array of the indices(!).

(am i doing this right?  it would just be

    shuffle($banners);

, right?)

is there a common workaroud for this problem?  what do other people do
for more randomized random array selections?

thanks,

</nori>

-- 
    .~.      nori @ sccs.swarthmore.edu
    /V\  http://www.sccs.swarthmore.edu/~nori
   // \\          @ maenad.net
  /(   )\       www.maenad.net/jnl
   ^`~'^

Attachment: pgpdo973Umjxv.pgp
Description: PGP signature


--- End Message ---
--- Begin Message ---
I'm having a very hard time testing array_search.

$j = array_search( $i, $errList );
echo "j=" . $j;
if (($j != false) && ($j >= 0)) {

--- End Message ---
--- Begin Message ---
What output do you get?

> I'm having a very hard time testing array_search.
>
> $j = array_search( $i, $errList );
> echo "j=" . $j;
> if (($j != false) && ($j >= 0)) {

--- End Message ---
--- Begin Message ---
* Thus wrote Bob Lockie ([EMAIL PROTECTED]):
> I'm having a very hard time testing array_search.
> 
> $j = array_search( $i, $errList );
> echo "j=" . $j;
> if (($j != false) && ($j >= 0)) {

<snip>
mixed array_search ( mixed needle, array haystack [, bool strict])

Searches haystack for needle and returns the key if it is found in
the array, FALSE otherwise. 
</snip>

When ever you see that a function that returns mixed with a possible
FALSE Boolean value. You must always test your result as follows:

if ($j !== FALSE) {
  // found an item
} else {
  // no item found
}


Curt
-- 
First, let me assure you that this is not one of those shady pyramid schemes
you've been hearing about.  No, sir.  Our model is the trapezoid!

--- End Message ---
--- Begin Message ---
Richard Davey wrote:

Hi guys,

Does anyone know what the most common cause for the following error
from the XML parser built into PHP 4.3.6: "junk after document
element"

I am parsing data that has been returned to me via https, this is
stage 6 in a multi-step process and the first stages went okay
sending/receiving the data. Any ideas? I don't know if I can fix the
error my end or if it has to be done on the gateway?

Best regards,

Richard Davey


I get this a lot when PHP spits out an error while creating XML from one of my other scripts. Try looking at stage 5 in your process (or wherever you generated your XML data) and see what errors you have there. Another possibility is that you have some XML entities that have been incorrectly translated in the submission process.
--- End Message ---
--- Begin Message ---
Shaun wrote:

Hi,

Is it possible to use PHP to detect the type of browser accessing my site.
For example if a PDA is using it I would prefer not to include large
graphics...

Many thanks for your help

Yes you can do this. ;)
--- End Message ---
--- Begin Message ---
Use javascript -- browser object

hth
/pS
On Friday, June 11, 2004, at 03:09  PM, Jason Barnett wrote:

Shaun wrote:

Hi,
Is it possible to use PHP to detect the type of browser accessing my site.
For example if a PDA is using it I would prefer not to include large
graphics...
Many thanks for your help

Yes you can do this. ;)

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


--- End Message ---
--- Begin Message ---
When you pasted that PHP code firefox did a google "I'm feeling lucky"
search on it.  If you go to google and manually do the I'm feeling lucky
search you should end up at the same place.

Yet another reason firefox deserves the top of the heap.

--Rick

> -----Original Message-----
> From: John Nichel [mailto:[EMAIL PROTECTED] 
> Sent: Thursday, June 10, 2004 8:15p
> To: PHP List
> Subject: [PHP] Undiscovered Firefox...
> 
> Okay, I'm sitting at home, writing a bit of code for one of 
> my personal 
> sites, and I'm currently working on a function to detect different 
> browser types.  Well, I think I have the URL to a page on one of my 
> boxes which echo's out the HTTP_USER_AGENT in my clipboard.  However, 
> what I have there is....
> 
> elseif ( preg_match ( "/Firefox/", $_SERVER['HTTP_USER_AGENT'] ) ) {
> 
> Well, I paste this into Firefox's URL bar and hit enter 
> before my brain 
> can tell my hands that this is not what I want to do.  Do I 
> get a "could 
> not find server" error from Firefox?  Nope.  It forwards me 
> to this page....
> 
> http://itangersjack.com/oddball/cheese.htm
> 
> Nothing really special about the page, except it's revealing 
> source code 
> to something I'm currently working on (not in the way I'm 
> doing it, but 
> it's there).  Okay, it's late, and I'm easily amused. ;)
> 
> -- 
> By-Tor.com
> It's all about the Rush
> http://www.by-tor.com
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 

--- End Message ---

Reply via email to