php-general Digest 2 Oct 2004 09:35:22 -0000 Issue 3029

Topics (messages 198446 through 198483):

Re: Image Manipulation
        198446 by: Jason Davidson
        198447 by: Matt M.

Naming conventions
        198448 by: Jensen, Kimberlee
        198451 by: Jason Davidson
        198452 by: Greg Donald
        198454 by: Paul Bissex
        198455 by: Dan Joseph
        198458 by: Greg Beaver

Re: PHP Host with PayFlow Pro
        198449 by: Matt M.
        198456 by: Neal Carmine

Re: mail() and Verizon
        198450 by: Mark

Why won't my attached PDF go through ??
        198453 by: PHP Junkie

Re: UNSUBSCRIBE!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
        198457 by: Michelle Konzack
        198474 by: Mag

exec lynx -dump failure
        198459 by: Compu-Creations

set multiple variables
        198460 by: Joe Szilagyi
        198462 by: Paul Bissex
        198463 by: Marek Kilimajer
        198464 by: Brad Pauly

Re: Zend PHP Certification test
        198461 by: Chris Shiflett

Session handlers
        198465 by: Shawn McKenzie
        198469 by: raditha dissanayake
        198471 by: Vail, Warren

Detecting Mysql server is running
        198466 by: barsalou
        198467 by: Greg Donald
        198483 by: Marek Kilimajer

Re: PHP sandbox discussion
        198468 by: raditha dissanayake
        198470 by: Jason Davidson

Re: php script run by cron job
        198472 by: Andrew Kreps
        198482 by: Merlin

array sort question
        198473 by: Ed Lazor
        198476 by: Paul Bissex

stand alone php
        198475 by: Mag

READ BEFORE REPLYING TO : Re: [PHP] 
UNSUBSCRIBE!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
        198477 by: GH
        198478 by: Robert Restad
        198479 by: Curt Zirzow
        198480 by: Mag
        198481 by: Kevin Waterson

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 ---
Yes there is way, search for GD in the php manual, it will explain a
solution better than i will.

Jason

GH <[EMAIL PROTECTED]> wrote: 
> 
> I would like to know if there is a way to have PHP determine the
> dimensions of an image (i.e. JPG or PNG) and if it more than Xpx wide
> or height have it scale it down proportionally to that width or
> height?
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 

--- End Message ---
--- Begin Message ---
> I would like to know if there is a way to have PHP determine the
> dimensions of an image (i.e. JPG or PNG) and if it more than Xpx wide
> or height have it scale it down proportionally to that width or
> height?

look at

http://us4.php.net/gd

--- End Message ---
--- Begin Message ---
What do you use for your naming conventions for
variables
functions
classes

I'm trying to tell my students what the standard is currently. Are people using camel 
case or underscores or both?


-----Original Message-----
From:   [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent:   Fri 10/1/2004 11:16 AM
To:     [EMAIL PROTECTED]
Cc:     
Subject:        [BULK] - php-general Digest 1 Oct 2004 18:16:29 -0000 Issue 3028

php-general Digest 1 Oct 2004 18:16:29 -0000 Issue 3028

Topics (messages 198379 through 198445):

php script run by cron job
        198379 by: Merlin
        198388 by: Nick Wilson

Re: Zend PHP Certification test
        198380 by: Curt Zirzow
        198391 by: Greg Donald
        198436 by: Jay Blanchard

How do I produce a random database query for each day or week?
        198381 by: I.A. Gray
        198383 by: Merlin
        198386 by: Graham Cossey
        198413 by: -{ Rene Brehmer }-

Zend Optimizer not installed
        198382 by: Ox
        198384 by: Graham Cossey
        198387 by: Wee Keat
        198404 by: Dan Joseph
        198432 by: Ox

Re: list of Months
        198385 by: Marek Kilimajer
        198408 by: afan.afan.net
        198439 by: Paul Bissex

Re: mail() and Verizon
        198389 by: Sam Smith
        198443 by: Sam Smith

How I can get x509 certificate distinguished name?
        198390 by: Diavolo

PHP (anti) crash policy?
        198392 by: Olaf van der Spek
        198393 by: Marek Kilimajer
        198394 by: Manuel Lemos
        198395 by: Olaf van der Spek
        198396 by: Christophe Chisogne
        198397 by: Manuel Lemos
        198398 by: Marek Kilimajer
        198399 by: Olaf van der Spek
        198401 by: Christophe Chisogne
        198403 by: Manuel Lemos
        198405 by: Olaf van der Spek
        198409 by: Manuel Lemos
        198410 by: Olaf van der Spek
        198412 by: Olaf van der Spek
        198417 by: Manuel Lemos
        198418 by: Manuel Lemos
        198420 by: Olaf van der Spek
        198421 by: Olaf van der Spek
        198423 by: Olaf van der Spek
        198424 by: Manuel Lemos
        198425 by: Manuel Lemos
        198426 by: Olaf van der Spek
        198427 by: Manuel Lemos
        198429 by: Manuel Lemos
        198430 by: Olaf van der Spek
        198431 by: Olaf van der Spek
        198433 by: Olaf van der Spek
        198434 by: Manuel Lemos
        198435 by: Manuel Lemos
        198438 by: Marek Kilimajer

Re: Suggestion for "IN()"
        198400 by: Daniel Schierbeck
        198402 by: Christophe Chisogne
        198406 by: Daniel Schierbeck
        198415 by: Ford, Mike

successive imap_open calls result in failure
        198407 by: felix.compsoc.nuigalway.ie
        198411 by: raditha dissanayake
        198419 by: felix.compsoc.nuigalway.ie
        198422 by: Michael Sims

Re: World time convertor
        198414 by: -{ Rene Brehmer }-

Re: UNSUBSCRIBE!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
        198416 by: -{ Rene Brehmer }-

Question about error_reporting()
        198428 by: Al
        198437 by: Greg Donald
        198440 by: Al
        198442 by: Greg Donald

PHP Host with PayFlow Pro
        198441 by: Neal Carmine

Image Manipulation
        198444 by: GH

PHP sandbox discussion
        198445 by: Jason Davidson

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]


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




--- End Message ---
--- Begin Message ---
Oh please dont start a thread on which is better !!!!.. 
but i beleive it was decided that camel case is the standard now.
Jason

"Jensen, Kimberlee" <[EMAIL PROTECTED]> wrote: 
> 
> What do you use for your naming conventions for
> variables
> functions
> classes
> 
> I'm trying to tell my students what the standard is currently. Are people using
> camel case or underscores or both?
> 
> 
> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED]
> Sent: Fri 10/1/2004 11:16 AM
> To:   [EMAIL PROTECTED]
> Cc:   
> Subject:      [BULK] - php-general Digest 1 Oct 2004 18:16:29 -0000 Issue 3028
> 
> php-general Digest 1 Oct 2004 18:16:29 -0000 Issue 3028
> 
> Topics (messages 198379 through 198445):
> 
> php script run by cron job
>       198379 by: Merlin
>       198388 by: Nick Wilson
> 
> Re: Zend PHP Certification test
>       198380 by: Curt Zirzow
>       198391 by: Greg Donald
>       198436 by: Jay Blanchard
> 
> How do I produce a random database query for each day or week?
>       198381 by: I.A. Gray
>       198383 by: Merlin
>       198386 by: Graham Cossey
>       198413 by: -{ Rene Brehmer }-
> 
> Zend Optimizer not installed
>       198382 by: Ox
>       198384 by: Graham Cossey
>       198387 by: Wee Keat
>       198404 by: Dan Joseph
>       198432 by: Ox
> 
> Re: list of Months
>       198385 by: Marek Kilimajer
>       198408 by: afan.afan.net
>       198439 by: Paul Bissex
> 
> Re: mail() and Verizon
>       198389 by: Sam Smith
>       198443 by: Sam Smith
> 
> How I can get x509 certificate distinguished name?
>       198390 by: Diavolo
> 
> PHP (anti) crash policy?
>       198392 by: Olaf van der Spek
>       198393 by: Marek Kilimajer
>       198394 by: Manuel Lemos
>       198395 by: Olaf van der Spek
>       198396 by: Christophe Chisogne
>       198397 by: Manuel Lemos
>       198398 by: Marek Kilimajer
>       198399 by: Olaf van der Spek
>       198401 by: Christophe Chisogne
>       198403 by: Manuel Lemos
>       198405 by: Olaf van der Spek
>       198409 by: Manuel Lemos
>       198410 by: Olaf van der Spek
>       198412 by: Olaf van der Spek
>       198417 by: Manuel Lemos
>       198418 by: Manuel Lemos
>       198420 by: Olaf van der Spek
>       198421 by: Olaf van der Spek
>       198423 by: Olaf van der Spek
>       198424 by: Manuel Lemos
>       198425 by: Manuel Lemos
>       198426 by: Olaf van der Spek
>       198427 by: Manuel Lemos
>       198429 by: Manuel Lemos
>       198430 by: Olaf van der Spek
>       198431 by: Olaf van der Spek
>       198433 by: Olaf van der Spek
>       198434 by: Manuel Lemos
>       198435 by: Manuel Lemos
>       198438 by: Marek Kilimajer
> 
> Re: Suggestion for "IN()"
>       198400 by: Daniel Schierbeck
>       198402 by: Christophe Chisogne
>       198406 by: Daniel Schierbeck
>       198415 by: Ford, Mike
> 
> successive imap_open calls result in failure
>       198407 by: felix.compsoc.nuigalway.ie
>       198411 by: raditha dissanayake
>       198419 by: felix.compsoc.nuigalway.ie
>       198422 by: Michael Sims
> 
> Re: World time convertor
>       198414 by: -{ Rene Brehmer }-
> 
> Re: UNSUBSCRIBE!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
>       198416 by: -{ Rene Brehmer }-
> 
> Question about error_reporting()
>       198428 by: Al
>       198437 by: Greg Donald
>       198440 by: Al
>       198442 by: Greg Donald
> 
> PHP Host with PayFlow Pro
>       198441 by: Neal Carmine
> 
> Image Manipulation
>       198444 by: GH
> 
> PHP sandbox discussion
>       198445 by: Jason Davidson
> 
> 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]
> 
> 
> ----------------------------------------------------------------------
> 
> 
> 
> 

--- End Message ---
--- Begin Message ---
On Fri, 1 Oct 2004 11:28:57 -0700, Jensen, Kimberlee
<[EMAIL PROTECTED]> wrote:
> What do you use for your naming conventions for
> variables
> functions
> classes
> 
> I'm trying to tell my students what the standard is currently. Are people using 
> camel case or underscores or both?

You probably want to look at:

http://pear.php.net/manual/en/standards.php

The PEAR guidlines you will find there are what most of us use I think.


-- 
Greg Donald
Zend Certified Engineer
http://gdconsultants.com/
http://destiney.com/

--- End Message ---
--- Begin Message ---
On Fri, 1 Oct 2004 11:28:57 -0700, Jensen, Kimberlee
<[EMAIL PROTECTED]> wrote:
> What do you use for your naming conventions for
> variables
> functions
> classes
> 
> I'm trying to tell my students what the standard is currently. Are people using 
> camel case or underscores or both?
> 

Without getting into personal preferences I'd say that  the closest
thing we have to an industry standard are the PEAR conventions:

  http://pear.php.net/manual/en/standards.naming.php

pb


-- 
paul bissex, e-scribe.com -- database-driven web development
413.585.8095
69.55.225.29
01061-0847
72�39'71"W 42�19'42"N

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

> What do you use for your naming conventions for
> variables
> functions
> classes
> 
> I'm trying to tell my students what the standard is currently. Are people
> using camel case or underscores or both?

        I'm not sure there is a "standard" for naming things.  Here's how I
do it...

        classes:  CHelloWorld { ... }
        function: helloWorld() { .... }
        vars: hello_world

I guess I tend to stick to the camel style for function or class naming,
then use underscores in vars.  I also put a C before each class name.  There
is Hungarian notation that a lot of developers like to use.  You could
google that.

-Dan Joseph

--- End Message ---
--- Begin Message --- Jason Davidson wrote:
Oh please dont start a thread on which is better !!!!.. but i beleive it was decided that camel case is the standard now.
Jason

"Jensen, Kimberlee" <[EMAIL PROTECTED]> wrote:

What do you use for your naming conventions for
variables
functions
classes

I'm trying to tell my students what the standard is currently. Are people using
camel case or underscores or both?

The standard in built-in PHP functions is underscores for procedural code (simplexml_load_string) and studlyCaps/CamelCaps for object-oriented code. classes are named using CamelCaps (SimpleXMLElement) and methods are named using studlyCaps (SimpleXMLElement->attributes(), simpleXMLElement->asXML()). It would be best to adhere to this standard, regardless of personal convictions, as any class that extends a built-in class will otherwise end up with a medley of method-naming conventions.

Regards,
Greg

--- End Message ---
--- Begin Message ---
> I'm trying to locate a PHP web host, preferably one running PHP 5, that also
> supports the PHP payflow pro binaries? Anyone have any recommendations?

have you tried google?

http://www.google.com/search?hl=en&lr=&ie=UTF-8&client=firefox-a&q=PHP5+hosting+payflow&btnG=Search

also, search the mailing list archives

--- End Message ---
--- Begin Message ---
Yes... I tried google but was looking for recommendations, google does not
give you experiences that people on this list may have. Hence the point of
an email list in the first place.

Neal 

-----Original Message-----
From: Matt M. [mailto:[EMAIL PROTECTED] 
Sent: Friday, October 01, 2004 12:31 PM
To: Neal Carmine
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] PHP Host with PayFlow Pro

> I'm trying to locate a PHP web host, preferably one running PHP 5, that
also
> supports the PHP payflow pro binaries? Anyone have any recommendations?

have you tried google?

http://www.google.com/search?hl=en&lr=&ie=UTF-8&client=firefox-a&q=PHP5+host
ing+payflow&btnG=Search

also, search the mailing list archives

--- End Message ---
--- Begin Message ---
--- Sam Smith <[EMAIL PROTECTED]> wrote:

> > have you tried sending the same message, via the same path (i.e.,
> > smtp server), but not generated via php, to this recipient?  by
> > "same" that includes the same rfc821 "from"/return-path.
> 
> I logged on to the web server where php is running and did telnet
> localhost
> 25
> hello ...
> 
> The mail was reported to have not been received.
> 
> > 
> > do make certain that your correspondent doesn't have some funky
> spam
> > filtering of their own.
> 
> Excellent idea.
> 
> > 
> > the bottom line, however, is that this isn't a php issue. you're
> > successfully getting the message, so your script is working fine.
> 
> Yes, thanks.

I  believe the problem is that Verizon checks the MAIL FROM address
during the SMTP session against the domain portion of the From
header. If they don't match, the mail is rejected (or dropped). This
was an issue for a webboard I use...

> 
> -- 
> 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!?
Declare Yourself - Register online to vote today!
http://vote.yahoo.com

--- End Message ---
--- Begin Message ---
Ave,

I created a form which can accept 2 file attachments and send an HTML
Email... Everything works great... The files even get attached and sent, the
ONLY problem is... The PDF file I'm sending attached open up empty! They are
all blank.. Like everything has been wiped off from them!!

Here's my code.. 

<form action=<?php echo $PHP_SELF ?> method=post
ENCTYPE="multipart/form-data" name="f1" id="f1" >
            <table>
              <tr>
                <td align="left" valign="middle" class="style13">From
(Name):</td>
                <td><input name=from_name type=text value="Gerson Bullock"
size="40"></td>
              </tr>
              <tr>
                <td align="left" valign="middle" class="style13">From
(Email):</td>
                <td><input name=from type=text
value="[EMAIL PROTECTED]" size="40"></td>
              </tr>
              <tr>
                <td align="left" valign="middle" class="style13">To
(First,Last):</td>
                <td><input name=to_nameF type=text id="to_nameF" size="15">
                <input name=to_nameL type=text id="to_nameL" size="15"></td>
              </tr>
              <tr>
                <td align="left" valign="middle" class="style13">To
(Email):</td>
                <td><input name=to type=text size="40"></td>
              </tr>
              <tr>
                <td align="left" valign="middle"
class="style13">Subject:</td>
                <td><input name=subject type=text value="Your Conversation
with Gerson Bullock" size="40"></td>
              </tr>
              <tr>
                <td align="left" valign="top" class="style13">Message:</td>
                <td><textarea name=message_html cols="35" rows="4">
                <b>Test Message</b>
                </textarea></td>
              </tr>
              <tr>
                <td align="left" valign="middle" class="style13">Attachment
1 </td>
                <td><input type=file name=file1></td>
              </tr>
              <tr>
                <td align="left" valign="middle" class="style13">Attachment
2 </td>
                <td><input type=file name=file2></td>
              </tr>
            </table>
            <input name="doSubmit" type=submit id="doSubmit" value=Send Mail
Mail>
          </form>

<?php
$message_html = stripslashes($message_html);
  $m = new CMIMEMail("$to_nameF $to_nameL <$to>","$from_name
<$from>",$subject);
             $m->mailbody($message_html, $message_html);
             if( $file1) {
                $m->attachFile_raw($file1,$file1_name,$file1_type);
             };
             if( $file2)
{$m->attachFile_raw($file2,$file2_name,$file2_type);};
             $m->send();
?>

<?php
/*
* $m = new CMIMEMail($to,$from,$subject);
* $m->mailbody("This is simply text","<html><body><h1>This is HTML
text</h1>");
* $m->attach("example.html","text/html",$filebody);
* $m->attachFile("resume.gif","image/gif");
* $m->send();
*/

class CMIMEMail {
 var $to;
 var $boundary;
 var $smtp_headers;
 var $filename_real;
 var $body_plain;
 var $body_html;
 var $atcmnt;
 var $atcmnt_type;
 
 function CMIMEMail($to,$from,$subject,$priority=3) {
   $this->to=$to; $this->from=$from;
   $this->subject=$subject; $this->priority=$priority;
   $this->boundary="----=_NextPart_".time()."_".md5(time())."_";
 }
 function  mailbody( $plain, $html="" ) {
   $this->body_plain=$plain;
   $this->body_html=$html;
 }
 function  attach( $name, $content_type, $data ) {
 }
 function  attachfile_raw( $fname, $mailFileName, $content_type ) {
   if([EMAIL PROTECTED]($fname,"r")) {
    $this->atcmnt[$mailFileName]=fread($f,filesize($fname));
    $this->atcmnt_type[$mailFileName]=$content_type;
    fclose($f);
  } 
 }
 function  attachfile( $fname, $content_type ) {
    attachfile_raw($fname,$fname,$content_type);
 }
 function  clear() {
   unset( $atcmnt );
   unset( $atcmnt_type );
 }
 function  makeheader() {
   $out ="From: ".$this->from."\n";
   $out.="Reply-To: ".$this->from."\n";
   $out.="MIME-Version: 1.0\n".
    "Content-Type: multipart/mixed;\n\t boundary=\"".$this->boundary."\"\n".
        "X-Priority: ".$this->priority."\n".
        "X-Mailer: phpMimeMail ( http://www.informed-sources.com/ )\n";
   return $out;
 }
 function  makebody() {
   $boundary2= "----=_NextAttachedPart_".time()."_".md5(time()+101)."_";
   $out="";
   if( " ".$this->body_html!=" " ) {
     $out="\nThis is a multi-part message in MIME format.\n\n";
     $out.="--".$this->boundary."\nContent-Type:
multipart/alternative;\n\tboundary=\"$boundary2\"\n";
     $out.="$body_plan\n".
       "--$boundary2\nContent-Type: text/plain\n".
#       "Content-Disposition: inline\n".
       "Content-Transfer-Encoding: quoted-printable\n\n".
       $this->body_plain.
       "\n\n--$boundary2\n".
       "Content-Type: text/html\n".
#       "Content-Disposition: attachment;\n\tfilename=\"message.html\"\n".
           "Conent-Transfer-Encoding: quoted-printable\n".
       "\n$this->body_html\n\n".
       "--$boundary2--\n";
   } else {
     $out="\n\n".$this->body_plain."\n\n";
     $out.="--".$this->boundary."\n".
    "Content-Type: text/plain\n".
    "Content-Transfer-Encoding: quoted-printable\n\n".
    $this->body_plain.
    "\n\n--".$this->boundary.
    "\n";
   }
   if( is_array( $this->atcmnt_type ) ) {
     reset( $this->atcmnt_type);
     while( list($name, $content_type) = each($this->atcmnt_type) ) {
       $out.="\n--".$this->boundary."\nContent-Type:
application/pdf\nContent-Transfer-Encoding: base64\nContent-Disposition:
attachment; filename=\"$name\"\n\n".
         chunk_split(base64_encode($this->atcmnt[$name]))."\n";
     }   
   }
   $out.="\n--".$this->boundary."--\n";
   return $out;
 }
 function  send(){
   mail( $this->to, $this->subject, $this->makebody(),$this->makeheader() );
   echo "<b><i><small><Mail Sent Successfully</b></i></small>";
 }
}

?>

--- End Message ---
--- Begin Message ---
Am 2004-10-01 15:57:47, schrieb -{ Rene Brehmer }-:
> At 17:08 30-09-2004, Pankaj Kafley wrote:
> >What an ass !
> 
> And my filters don't even catch the many exclamation marks cuz this list is 
> white-listed ..... *sigh*

I do not get them:

  ____ ( '/home/michelle/.procmail/FLT_spam' ) _________________________
 /
|  :0
|  * ^Subject:.*(subscribe|subscrible|suscribe|unsubcribe)
|  ATTENTION/unsubscribe/
|  # /dev/null
|  
 \______________________________________________________________________

I get every day around 20-30 of them...

Greetings
Michelle

-- 
Linux-User #280138 with the Linux Counter, http://counter.li.org/ 
Michelle Konzack   Apt. 917                  ICQ #328449886
                   50, rue de Soultz         MSM LinuxMichi
0033/3/88452356    67100 Strasbourg/France   IRC #Debian (irc.icq.com)

Attachment: signature.pgp
Description: Digital signature


--- End Message ---
--- Begin Message ---
Prick.

=====
------
- The faulty interface lies between the chair and the keyboard.
- Creativity is great, but plagiarism is faster!
- Smile, everyone loves a moron. :-)


                
__________________________________
Do you Yahoo!?
Read only the mail you want - Yahoo! Mail SpamGuard.
http://promotions.yahoo.com/new_mail 

--- End Message ---
--- Begin Message ---
Hello,
I have a problem in getting lynx to run through the exec function.
Here is my code ...

$cmd = "/usr/bin/lynx -dump http://freebsd.razvan.ca/copydir.php 2>&1";
exec($cmd,$err);
print_r($err);

I'm not sure what the problem is but I get this back ..

Array ( [0] => /root/: No such directory )

Based on the documentation the above code should work ...

If someone can give me a hand with this, I would greatly appreciate it...

Thank you for your time ...

Raz
--- End Message ---
--- Begin Message ---
Hi, I have this working:


if ($REMOTE_ADDR == "212.3.54.65")  {
        header("Location: http://www.google.com/search?&q=huzzah";);
Redirect browser
        exit;
        }


But I want to specify multiple IPs. What's the best recommended way for
doing that?


thanks
Joe

--- End Message ---
--- Begin Message ---
On Fri, 1 Oct 2004 17:38:31 -0400, Joe Szilagyi <[EMAIL PROTECTED]> wrote:
> Hi, I have this working:
> 
> if ($REMOTE_ADDR == "212.3.54.65")  {
>         header("Location: http://www.google.com/search?&q=huzzah";);
> Redirect browser
>         exit;
>         }
> 
> But I want to specify multiple IPs. What's the best recommended way for
> doing that?
> 

Build an array and use in_array():

$redirect_me = array ('212.3.54.65', '127.0.0.1', '192'168.0.1');
if (in_array ($_SERVER['REMOTE_ADDR'], $redirect_me))
    {
    header ("Location: ...");
    exit;
    }

If the addresses you are targeting are ranges in CIDR format (e.g.
192.168.0.0/24), take a look at the PEAR package Net_IPv4.

pb

-- 
paul bissex, e-scribe.com -- database-driven web development
413.585.8095
69.55.225.29
01061-0847
72�39'71"W 42�19'42"N

--- End Message ---
--- Begin Message --- Joe Szilagyi wrote:
Hi, I have this working:


if ($REMOTE_ADDR == "212.3.54.65") { header("Location: http://www.google.com/search?&q=huzzah";); Redirect browser exit; }


But I want to specify multiple IPs. What's the best recommended way for doing that?

There was one request for IN() fuction few hours ago. You ca either use the function suplied in the thread or use || operator:

if ($REMOTE_ADDR == "212.3.54.65" || $REMOTE_ADDR == "212.3.54.64" ...) {
--- End Message ---
--- Begin Message ---
On Fri, 1 Oct 2004 17:38:31 -0400, Joe Szilagyi <[EMAIL PROTECTED]> wrote:
> Hi, I have this working:
> 
> if ($REMOTE_ADDR == "212.3.54.65")  {
>         header("Location: http://www.google.com/search?&q=huzzah";);
> Redirect browser
>         exit;
>         }
> 
> But I want to specify multiple IPs. What's the best recommended way for
> doing that?

One way would be to create an array of ips and look for it in that array:

$ips = array('127.0.0.1','192.168.1.50');

if (in_array($REMOTE_ADDR, $ips)) {

    // do stuff

}

- Brad

--- End Message ---
--- Begin Message ---
--- Jay Blanchard <[EMAIL PROTECTED]> wrote:
> Anyone see that sneaky Shiflett character this morning? I sent in
> the answer....

Several people, including Jay, are very close, but no one has solved it
yet.

If you were thinking of taking the Zend Certification exam anyway, this
could save you $200. :-)

Chris

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

PHP Security - O'Reilly     HTTP Developer's Handbook - Sams
Coming December 2004        http://httphandbook.org/

--- End Message ---
--- Begin Message --- Just curious, what is the advantage of using a custom session handler, such as saving session data in MySQL?

TIA,
Shawn

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

Shawn McKenzie wrote:

Just curious, what is the advantage of using a custom session handler, such as saving session data in MySQL?

The main reason you might want to store session informaton in a database instead of in files is that you can then load balance your site across multiple servers. If you save your session data in a file and the user is transferred from one load balanced server to another (eg with dns round robin) in the middle of a transaction the session data is lost.

If you are on a shared server it may also be possible for other users to take a peek at the contents of the session data if they are stored in files. (of course you should not save sensitive data in the session anyway).


TIA, Shawn



--
Raditha Dissanayake.
------------------------------------------------------------------------
http://www.radinks.com/sftp/         | http://www.raditha.com/megaupload
Lean and mean Secure FTP applet with | Mega Upload - PHP file uploader
Graphical User Inteface. Just 128 KB | with progress bar.

--- End Message ---
--- Begin Message ---
I have used MySQL sessions and session handler routines to perform the
following;

1.  I was able to set different session timeouts for different applications
as long as each application used a different session table.  The garbage
cleanup routines could be programmed to ignore the global session limit and
use different session life times for the different tables (a different set
of routines for each application).

2.  I was able to use session table to look over site users shoulders (so to
speak) and by watching key session variables was able to monitor who was
using different areas of the site.  Obviously this kind of thing would be
totally unmanageable for a public site, but on an intranet, I had phone
numbers for all users and when something got hung, I was able to identify
the user and give them a call while the problem was occurring.  I also used
this over the shoulder technique once to identify a hacker, and kicked him
off the site by deleting his session entry, forcing him to logon again,
course his password had been changed, and this only slowed him down for a
little while, but it sure felt good.

I'm sure there are many other uses, so I'll be watching this thread.

Warren Vail
(415) 667-0240
SF211-07-434
 


-----Original Message-----
From: Shawn McKenzie [mailto:[EMAIL PROTECTED] 
Sent: Friday, October 01, 2004 5:11 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Session handlers


Just curious, what is the advantage of using a custom session handler, 
such as saving session data in MySQL?

TIA,
Shawn

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

--- End Message ---
--- Begin Message ---
I know I can see if php has the ability to talk with the Mysql server,
but is there a way to determine if the Mysql server is running.  In some
cases, I wouldn't have passwords, so a mysql_connect wouldn't work.

Anyone have ideas?

Thanks for the help.

Mike B.

--- End Message ---
--- Begin Message ---
On Fri, 01 Oct 2004 16:13:23 -0800, barsalou <[EMAIL PROTECTED]> wrote:
> I know I can see if php has the ability to talk with the Mysql server,
> but is there a way to determine if the Mysql server is running.  In some
> cases, I wouldn't have passwords, so a mysql_connect wouldn't work.
> 
> Anyone have ideas?

system('telnet localhost 3306');


-- 
Greg Donald
Zend Certified Engineer
http://gdconsultants.com/
http://destiney.com/

--- End Message ---
--- Begin Message --- barsalou wrote:
I know I can see if php has the ability to talk with the Mysql server,
but is there a way to determine if the Mysql server is running.  In some
cases, I wouldn't have passwords, so a mysql_connect wouldn't work.

I'm sure, at any given time, there is a mysql server running somewhere in the world.

If you mean if it is running on your server, run

ps ax |grep mysqld | grep -v grep
--- End Message ---
--- Begin Message ---

Jason Davidson wrote:

Anywys.. heres the question.. what do you think is the most viable
solution for security. 1. run apache in chroot envirnment.
2. run php in safe_mode
3. simply str_replace all filesystem functions with nothing.
4. use the disable_function settings to disable filesystem functions...

5. .all of these
6. none of these....
7 . other.




All of those and a many more things besides!
for example the mail() function can send mail through the localy installed smtp server without a username and password so you need to watch for the mail function or perhaps even attempts to open a socket on localhost host. You will then need to watch out for include or fopen urls that will eat up bandwidth or worse.
all in all i think this is pretty dangerous.

THanks
Jason





--
Raditha Dissanayake.
------------------------------------------------------------------------
http://www.radinks.com/sftp/         | http://www.raditha.com/megaupload
Lean and mean Secure FTP applet with | Mega Upload - PHP file uploader
Graphical User Inteface. Just 128 KB | with progress bar.

--- End Message ---
--- Begin Message ---
Hey, yup it is kind of dangerous, there is no argument there.  
Currenly i have php running safemode, and apache is running with user
nobody.  This combination makes it imposible for any filesystem
commands to work on anything that isnt owned by nobody.. its an
interesting situatoin i beleive... ive enjoyed reading documentaiton on
these things.

Jason

[EMAIL PROTECTED] wrote: 
> 
> 
> Jason Davidson wrote:
> 
> >Anywys.. heres the question.. what do you think is the most viable
> >solution for security. 
> >1.  run apache in chroot envirnment.
> >2.  run php in safe_mode
> >3.  simply str_replace all filesystem functions with nothing.
> >4.  use the disable_function settings to disable filesystem functions...
> >
> >5. .all of these
> >6. none of these....
> >7 . other.
> >
> >
> >  
> >
> All of those and a many more things besides!
> for example the mail() function can send mail through the localy 
> installed smtp server without a username and password so you need to 
> watch for the mail function or perhaps even attempts to open a socket on 
> localhost host. You will then need to watch out for include or fopen 
> urls that will eat up bandwidth or worse.
> all in all i think this is pretty dangerous.
> 
> >THanks
> >Jason
> >
> >  
> >
> 
> 
> -- 
> Raditha Dissanayake.
> ------------------------------------------------------------------------
> http://www.radinks.com/sftp/         | http://www.raditha.com/megaupload
> Lean and mean Secure FTP applet with | Mega Upload - PHP file uploader
> Graphical User Inteface. Just 128 KB | with progress bar.
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 

--- End Message ---
--- Begin Message ---
On Fri, 01 Oct 2004 08:18:55 +0200, Merlin <[EMAIL PROTECTED]> wrote:
> Here is the how I did it:
> 14 8 * * *      root  /usr/local/bin/php /home/www/cron/statistics.php
> 
> Does anybody see an error in this?
> 

I'm not familiar with a crontab format that allows you to specify a
username as you have there.  If you'd like the process to run as root,
login as root, do a crontab -e, and paste this in there:

14 8 * * * /usr/local/bin/php /home/www/cron/statistics.php

see if that works for you.

--- End Message ---
--- Begin Message --- Andrew Kreps wrote:
On Fri, 01 Oct 2004 08:18:55 +0200, Merlin <[EMAIL PROTECTED]> wrote:

Here is the how I did it:
14 8 * * *      root  /usr/local/bin/php /home/www/cron/statistics.php

Does anybody see an error in this?



I'm not familiar with a crontab format that allows you to specify a
username as you have there.  If you'd like the process to run as root,
login as root, do a crontab -e, and paste this in there:

14 8 * * * /usr/local/bin/php /home/www/cron/statistics.php

see if that works for you.

Thank you that solved the problem

Merlin
--- End Message ---
--- Begin Message ---
Any ideas on how I could sort this array by Title?

 

$menu[1]["ID"] = 5;

$menu[1]["Title"] = "Test 1";

$menu[2]["ID"] = 3;

$menu[2]["Title"] = "Test 4";

$menu[3]["ID"] = 56;

$menu[3]["Title"] = "Test 8";

$menu[4]["ID"] = 44;

$menu[4]["Title"] = "Test 3";

 

 

Thanks,

 

-Ed

 

 


--- End Message ---
--- Begin Message ---
On Fri, 1 Oct 2004 19:12:30 -0700, Ed Lazor <[EMAIL PROTECTED]> wrote:
> Any ideas on how I could sort this array by Title?
> 
> $menu[1]["ID"] = 5;
> 
> $menu[1]["Title"] = "Test 1";
> 
> $menu[2]["ID"] = 3;
> 
> $menu[2]["Title"] = "Test 4";


uasort() is what you need here.

Also see the usort() documentation page for an example of how to write
the comparison callback function that you pass to uasort().

pb



-- 
paul bissex, e-scribe.com -- database-driven web development
413.585.8095
69.55.225.29
01061-0847
72�39'71"W 42�19'42"N

--- End Message ---
--- Begin Message ---
Hi,
Is there any app that converts php to a stand alone
version?

like a windows .exe program.


Just curious.

Thanks,
Mag

=====
------
- The faulty interface lies between the chair and the keyboard.
- Creativity is great, but plagiarism is faster!
- Smile, everyone loves a moron. :-)


                
_______________________________
Do you Yahoo!?
Declare Yourself - Register online to vote today!
http://vote.yahoo.com

--- End Message ---
--- Begin Message ---
Dear EVERYONE WHO HAS POSTED OR WANTS TO POST IN THIS THREAD...

If Ms. Holland managed to get herself off of this list she is not
seeing any of this... however you seem to be FLAMING the rest of the
board with information that is NOT PHP related NOR is it relevant to
ANY DISCUSSION that pertains to a PHP related topic... i.e.
PEAR/DataBase/Servers etc...

CAN WE PLEASE CONSIDER THIS MATTER TO BE CLOSED?
Twenty Four Messages (not counting this #25)  of which almost 18 of
them have been not relavent to this subject. Yes, yesterday it could
be said that it was nice to have a joke at her blatent inability to
not read the unsubscribe instructions even if they are at the end of
each message! However, these messages have been either (1) Beating
around the same bush again and again... or (2) Personal and Rude
attacks at an individual.

Can we please move on to more PHP related discussions... 

Thank You
Gary


On Fri, 1 Oct 2004 19:22:26 -0700 (PDT), Mag <[EMAIL PROTECTED]> wrote:
> Prick.
> 
> =====
> ------
> - The faulty interface lies between the chair and the keyboard.
> - Creativity is great, but plagiarism is faster!
> - Smile, everyone loves a moron. :-)
> 
> 
> __________________________________
> Do you Yahoo!?
> Read only the mail you want - Yahoo! Mail SpamGuard.
> http://promotions.yahoo.com/new_mail 
> 
> 
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
>

--- End Message ---
--- Begin Message ---
I am posting, obviously, the 26th message in this thread. (or maybe
higher). 

And I couldnt care less. I have efficiently deleted 20 000 messages from
the PHP board (or around this number) last year without even getting
close to read them.

So, would you please tell me why the first message (out of 20 000 or so)
I read contains -anything but PHP related crap- ...

Actually, me - and you - are simply increasing the amount of total
B**LSHIT in this list. Go figure why... you are actually not inclined to
reply to whatever idiot actually writing to it..

Cheers
Rob.

-----Original Message-----
From: GH [mailto:[EMAIL PROTECTED] 
Sent: Friday, October 01, 2004 11:54 PM
To: Mag
Cc: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: [PHP] READ BEFORE REPLYING TO : Re: [PHP]
UNSUBSCRIBE!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!


Dear EVERYONE WHO HAS POSTED OR WANTS TO POST IN THIS THREAD...

If Ms. Holland managed to get herself off of this list she is not seeing
any of this... however you seem to be FLAMING the rest of the board with
information that is NOT PHP related NOR is it relevant to ANY DISCUSSION
that pertains to a PHP related topic... i.e. PEAR/DataBase/Servers
etc...

CAN WE PLEASE CONSIDER THIS MATTER TO BE CLOSED?
Twenty Four Messages (not counting this #25)  of which almost 18 of them
have been not relavent to this subject. Yes, yesterday it could be said
that it was nice to have a joke at her blatent inability to not read the
unsubscribe instructions even if they are at the end of each message!
However, these messages have been either (1) Beating around the same
bush again and again... or (2) Personal and Rude attacks at an
individual.

Can we please move on to more PHP related discussions... 

Thank You
Gary


On Fri, 1 Oct 2004 19:22:26 -0700 (PDT), Mag <[EMAIL PROTECTED]> wrote:
> Prick.
> 
> =====
> ------
> - The faulty interface lies between the chair and the keyboard.
> - Creativity is great, but plagiarism is faster!
> - Smile, everyone loves a moron. :-)
> 
> 
> __________________________________
> Do you Yahoo!?
> Read only the mail you want - Yahoo! Mail SpamGuard. 
> http://promotions.yahoo.com/new_mail
> 
> 
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
>

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

--- End Message ---
--- Begin Message ---
* Thus wrote GH:
> Dear EVERYONE WHO HAS POSTED OR WANTS TO POST IN THIS THREAD...
> 
> If Ms. Holland managed to get herself off of this list she is not
> seeing any of this... however you seem to be FLAMING the rest of the
> board with information that is NOT PHP related NOR is it relevant to
> ANY DISCUSSION that pertains to a PHP related topic... i.e.
> PEAR/DataBase/Servers etc...

Um.. i have no clue why you are complaining, You contributed to the
posts. By replying to the thread and requesting not to post any
more messages, you simply open the topic back up and now you have
to read Yet Another Thread


Curt
-- 
The above comments may offend you. flame at will.

--- End Message ---
--- Begin Message ---
--- Curt Zirzow <[EMAIL PROTECTED]> wrote:

> * Thus wrote GH:
> > Dear EVERYONE WHO HAS POSTED OR WANTS TO POST IN
> THIS THREAD...
> > 
> > If Ms. Holland managed to get herself off of this
> list she is not
> > seeing any of this... however you seem to be
> FLAMING the rest of the
> > board with information that is NOT PHP related NOR
> is it relevant to
> > ANY DISCUSSION that pertains to a PHP related
> topic... i.e.
> > PEAR/DataBase/Servers etc...
> 
> Um.. i have no clue why you are complaining, You
> contributed to the
> posts. By replying to the thread and requesting not
> to post any
> more messages, you simply open the topic back up and
> now you have
> to read Yet Another Thread
 

True :-)

=====
------
- The faulty interface lies between the chair and the keyboard.
- Creativity is great, but plagiarism is faster!
- Smile, everyone loves a moron. :-)


                
_______________________________
Do you Yahoo!?
Declare Yourself - Register online to vote today!
http://vote.yahoo.com

--- End Message ---
--- Begin Message ---
This one time, at band camp, "Robert Restad" <[EMAIL PROTECTED]> wrote:

> I am posting, obviously, the 26th message in this thread. (or maybe
> higher). 

Look, he knew what he was getting into when he subscribed. There's no
backing out now. I say, make him stick it out!

Kevin


---------
"Democracy is two wolves and a lamb voting on what to have for lunch. 
Liberty is a well-armed lamb contesting the vote."

--- End Message ---

Reply via email to