OSEC

Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com
 
From: php-general-digest-helplists.php.net
Date: Thu Apr 25 2002 - 07:04:41 CDT

  • Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

    php-general Digest 25 Apr 2002 12:04:41 -0000 Issue 1307

    Topics (messages 94469 through 94538):

    To store or not to store . . .
            94469 by: PHP List
            94471 by: John Holmes
            94476 by: Julio Nobrega
            94482 by: Richard Archer
            94491 by: Maxim Maletsky \(PHPBeginner.com\)
            94502 by: Dennis Moore

    Re: Regular Expressions
            94470 by: Evan Nemerson
            94474 by: Miguel Cruz
            94480 by: Evan Nemerson
            94481 by: Miguel Cruz
            94486 by: John Holmes
            94487 by: Evan Nemerson
            94488 by: Evan Nemerson

    Re: embedding php into html
            94472 by: Chris Wesley
            94473 by: Miguel Cruz
            94475 by: Larry Brown
            94477 by: Larry Brown

    OT - linux/htaccess question..
            94478 by: Kelly Meeks

    read text file into mysql
            94479 by: Rodrigo Peres
            94492 by: Maxim Maletsky \(PHPBeginner.com\)

    Re: need help sorting an array...tricky
            94483 by: Chaviano

    Re: Mailing to numerous with mail()
            94484 by: Smileyq

    Re: Not A PHP question but I need help in a big way...
            94485 by: [-^-!-%-
            94489 by: Maxim Maletsky \(PHPBeginner.com\)

    Misleading VeriSign domain name expiration notice
            94490 by: Evan Nemerson

    Re: SourceForge. Whats the worst part about it?
            94493 by: Maxim Maletsky \(PHPBeginner.com\)

    Re: --> I N C L U D E < -- O R --> F O P E N < -- ?
            94494 by: Maxim Maletsky \(PHPBeginner.com\)

    Re: Setcookie problems...
            94495 by: Maxim Maletsky \(PHPBeginner.com\)

    Why is imageTTFtext function useless?
            94496 by: zhaoxd
            94497 by: Jason Wong
            94498 by: Rasmus Lerdorf
            94499 by: zhaoxd

    Parse Error - Help?
            94500 by: Jason Soza
            94501 by: Tyler Longren
            94503 by: Jason Wong
            94504 by: Jason Soza

    Re: php in a layer trouble
            94505 by: Justin French

    Re: Parse Error - Help? (AGAIN)
            94506 by: Jason Soza
            94530 by: Ford, Mike [LSS]

    compiling on freebsd
            94507 by: Larry Brown
            94509 by: Evan Nemerson
            94511 by: Larry Brown
            94513 by: Rasmus Lerdorf
            94514 by: Larry Brown
            94515 by: Rasmus Lerdorf
            94517 by: Eugene Lee
            94519 by: Christopher Riordan

    alternatives to mail()
            94508 by: John Hughes
            94510 by: Evan Nemerson
            94520 by: Miguel Cruz
            94521 by: Peter Janett

    session_start() times and resets?
            94512 by: Smileyq

    Re: Why is imageTTFtext function useless?(again)
            94516 by: zhaoxd
            94518 by: Rasmus Lerdorf

    Getting page with fopen
            94522 by: Martin Thoma
            94523 by: Jason Wong
            94524 by: Martin Thoma
            94528 by: heinisch.creaction.de

    Re: Solved Getting page with fopen
            94525 by: Martin Thoma

    Unlucky Situation Involving CURL
            94526 by: Jason

    Problem with Apache/SSL/Perl/PHP + LDAP
            94527 by: Andrew McCall

    Predefined variables in PHP 4.2 vs. older version
            94529 by: Pekka Saarinen
            94531 by: Ford, Mike [LSS]

    Sorry, this is relate to subscription problem but cant solve it
            94532 by: M VM

    Displaying dates
            94533 by: Craig
            94538 by: Justin French

    Re: searching terms non adjacent
            94534 by: David Robley

    Need help with File Upload
            94535 by: Walter Enzenhofer
            94536 by: Craig

    Session.save_path in php.ini
            94537 by: Tim Loram

    Administrivia:

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

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

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

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

    attached mail follows:


    Hi,
    I was wondering about the following:
    Should I store a picture directly in a MySQL table? Or just store the link
    to a file on the system somewhere?

    I would think that leaving the picture as an actual file and just storing
    the link would be quicker. But what are the dis/advantages of storing right
    in the table? I like the idea of not cluttering up my file system. Pictures
    would only be about in the 20K range.

    Thanks,
    Chris

    attached mail follows:


    Store a link to it. I see no advantage at all to storing binary data in
    a database. It just creates a lot more work for you by putting the data
    in a table. You have to create an "interface" to get at the data...or
    select it out into a file to get back the image, etc.

    ---John Holmes...

    > -----Original Message-----
    > From: PHP List [mailto:php_listibcnetwork.net]
    > Sent: Wednesday, April 24, 2002 4:45 PM
    > To: php
    > Subject: [PHP] To store or not to store . . .
    >
    > Hi,
    > I was wondering about the following:
    > Should I store a picture directly in a MySQL table? Or just store the
    link
    > to a file on the system somewhere?
    >
    > I would think that leaving the picture as an actual file and just
    storing
    > the link would be quicker. But what are the dis/advantages of storing
    > right
    > in the table? I like the idea of not cluttering up my file system.
    > Pictures
    > would only be about in the 20K range.
    >
    > Thanks,
    > Chris
    >
    >
    > --
    > PHP General Mailing List (http://www.php.net/)
    > To unsubscribe, visit: http://www.php.net/unsub.php

    attached mail follows:


      Store a link to the file!

      Mainly because filesystems are designed to store, er.. files ;-)

      There's a note on Mysql's manual, under Optimizations, that recommends
    this.

    --
    Julio Nobrega.
    

    Tô chegando: http://www.inerciasensorial.com.br "Php List" <php_listibcnetwork.net> wrote in message news:051c01c1ebea$165b2070$01c8c8c8ibcserver.local... > Hi, > I was wondering about the following: > Should I store a picture directly in a MySQL table? Or just store the link > to a file on the system somewhere? > > I would think that leaving the picture as an actual file and just storing > the link would be quicker. But what are the dis/advantages of storing right > in the table? I like the idea of not cluttering up my file system. Pictures > would only be about in the 20K range. > > Thanks, > Chris >

    attached mail follows:


    At 4:45 PM -0700 24/4/02, PHP List wrote:

    >I was wondering about the following: >Should I store a picture directly in a MySQL table? Or just store the link >to a file on the system somewhere?

    This should be a FAQ.

    If you allow people to upload files via a web form, your only secure option is to store the images in a database.

    In order to allow uploaded files to be stored in the file system the upload directory must be writable by the web server process.

    Anyone with access to PHP on the system can upload a script which alters or deletes the files in this directory.

    If the server is an ISP's server, you're giving access to these files to every other client of the ISP.

    If you are the only person with access to the PHP server, this may be a valid option. And if you are 100% sure the code will never be required to run under different circumstances.

    Personally I think databases these days (MySQL in my experience at least) are more than reliable enough and fast enough to serve up binary data in quite large quantities. If you run into performance issues, implement a caching solution run from a crontab.

    ...R.

    attached mail follows:


    > Personally I think databases these days (MySQL in my experience at > least) are more than reliable enough and fast enough to serve up > binary data in quite large quantities. If you run into performance > issues, implement a caching solution run from a crontab.

    I had a very, very bad experience with mySQL when a very simple table (inserts at 99%) that got over 350.000 rows (100MB). So I wouldn't say "MySQL in my experience at least". As I migrated that barely-lost table to postgreSQL (almost identical designs) it still goes on and currently has over 1.000.000 rows (400MB)

    Just my .002 EuroCents.

    The rest on why to keep the images in Db is a very good answer. Actually, it is so good that I might even write an article on this issue.

    Sincerely,

    Maxim Maletsky Founder, Chief Developer

    www.PHPBeginner.com // where PHP Begins

    attached mail follows:


    If your page is frequently access and the data does not change then by all means store the image in the file system.

    however, I have found it useful to store the images in the database for certain applications which I want to maintain an additional level of security over the images when using sessions management. For example, if I want certain users access to certain images. It is up to you to balance performance with referential integrity and additional coding.

    ----- Original Message ----- From: "PHP List" <php_listibcnetwork.net> To: "php" <php-generallists.php.net> Sent: Wednesday, April 24, 2002 7:45 PM Subject: [PHP] To store or not to store . . .

    > Hi, > I was wondering about the following: > Should I store a picture directly in a MySQL table? Or just store the link > to a file on the system somewhere? > > I would think that leaving the picture as an actual file and just storing > the link would be quicker. But what are the dis/advantages of storing right > in the table? I like the idea of not cluttering up my file system. Pictures > would only be about in the 20K range. > > Thanks, > Chris > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php >

    attached mail follows:


    Okay if you just want to do a REGEX something like

    ereg("([_a-zA-Z\-]+|\*)\[\.a-zA-Z\-]+\.com",$variable);

    should work, but test it. I'm not 100% the wildcard part will work.

    If you want to make sure the domain is valid, well that's much more fun ;)...

    function validateAddr($addr) { /* UNTESTED- whipped together in about 2 mins, so test before use */ if ( !ereg("[_a-zA-Z\-]+\[\.a-zA-Z\-]+\.com",$addr) ) { exit("eMail address format invalid."); } else { $host = explode("",$addr); $host = $host[1]; if ( !getmxrr($host, $array) ) { exit("Invalid eMail address- domain $host does not exist..."); } } }

    I hope your eMail client doesn't wrap that. If it does eMail me and I'll send you a text file. Meanwhile, it is untested so test before use.

    If you want to get really in-depth, you could try to send $host:25 EXPN or VRFY requests, but they SHOULDN'T respond to those so I wouldn't do that if I were you.

    On Wednesday 24 April 2002 09:29 am, you wrote: > Hey Evan, > > I need it so that I would accept any valid domain, so domain.com, > or domain.net, or domain.org, domain.biz, etc. Also I need it so > that before the sign or after the at sign it can have a '*' for > wildcard. > > Could you help me with this? > > Devin > > > -----Original Message----- > From: Evan Nemerson [mailto:evancoeus-group.com] > Sent: Tuesday, April 23, 2002 4:38 PM > To: Devin Atencio; php-generallists.php.net > Subject: Re: [PHP] Regular Expressions > > > Uhhh... something like > > ereg("[_a-zA-Z\-]+\[\.a-zA-Z\-]+\.com",$variable); > > SHOULD work... If you want to make sure they're domain.com instead of any > domain, try... > > ereg("[_a-zA-Z\-]+\[\.a-zA-Z\-]+domain\.com",$variable); > > if you want to validate e-mail address formats, there is (if memory serves) > a > discussion in the comments on php.net/eregi of how to do this best. > > > I need to check a variable to see if the format fits one > > of the following: > > > > usernamedomain.com > > or > > *domain.com > > or > > **.domain.com > > > > How can I do this with regex? Any help would be greatly > > appreciated. > > > > Devin Atencio

    -- 
    Nobody realizes that some people expend tremendous energy merely to be 
    normal.
    

    Albert Casmus

    attached mail follows:


    On Wed, 24 Apr 2002, Evan Nemerson wrote: > ereg("([_a-zA-Z\-]+|\*)\[\.a-zA-Z\-]+\.com",$variable); > should work, but test it. I'm not 100% the wildcard part will work.

    An internet domain name cannot contain an underscore ( _ ).

    ...and a whole lot of them don't end in .com!

    miguel

    attached mail follows:


    A domain cannot contain an underscore, but unless i'm mistaken the USERNAME can. the domain name REGEX is [\.a-zA-Z\-]+

    You're right about the .com. senior moment. here's a better version

    ereg("([_a-zA-Z\-]+|\*)\[\.a-zA-Z\-]+\.[\.a-zA-Z\-]+",$variable);

    won't make sure there are letters between the dots, but it will do.

    On Wednesday 24 April 2002 17:07 pm, you wrote: > On Wed, 24 Apr 2002, Evan Nemerson wrote: > > ereg("([_a-zA-Z\-]+|\*)\[\.a-zA-Z\-]+\.com",$variable); > > should work, but test it. I'm not 100% the wildcard part will work. > > An internet domain name cannot contain an underscore ( _ ). > > ...and a whole lot of them don't end in .com! > > miguel

    -- 
    Rather fail with honor than succeed by fraud.
    

    Sophocles

    attached mail follows:


    On Wed, 24 Apr 2002, Evan Nemerson wrote: > A domain cannot contain an underscore, but unless i'm mistaken the > USERNAME can. the domain name REGEX is [\.a-zA-Z\-]+ > > ereg("([_a-zA-Z\-]+|\*)\[\.a-zA-Z\-]+\.[\.a-zA-Z\-]+",$variable);

    Right you are. I spaced out right past the .

    But on the other hand usernames can contain all sorts of other characters too. = and + are popular among people who give out multiple addresses for mailbox filtering.

    miguel

    attached mail follows:


    I don't know what the original question was, but there is a parse_url function that'll break apart a url into it's various parts. Quote from manual:

    www.php.net/parse_url

    ------- Here is a good example of how it would parse this url:

    127.0.0.1:6667/pages/page.php?foo=bar#bookmark">http://name:pass127.0.0.1:6667/pages/page.php?foo=bar#bookmark

    (URL is fake)

    This URL uses HTTP, the HTAccess name and password are name and pass, it's a localhost, on port 6667. The file page.php is being queried with foo=bar. It is also set to scroll to the 'bookmark' anchor

    Parse URL would give us

    [scheme] = 'http' [host] = '127.0.0.1' [port] = 6667 (Is an INT, not a STRING) [user] = 'user' [path] = '/pages/page.php' [query] = 'foo=bar' [fragment] = 'bookmark'

    Hopefully this will help someone. --------

    I don't know if it does any checking or validating or what...but maybe it'll help??

    ---John Holmes...

    > -----Original Message----- > From: Miguel Cruz [mailto:mncstoic.net] > Sent: Wednesday, April 24, 2002 5:17 PM > To: Evan Nemerson > Cc: php-generallists.php.net > Subject: Re: [PHP] Regular Expressions > > On Wed, 24 Apr 2002, Evan Nemerson wrote: > > A domain cannot contain an underscore, but unless i'm mistaken the > > USERNAME can. the domain name REGEX is [\.a-zA-Z\-]+ > > > > ereg("([_a-zA-Z\-]+|\*)\[\.a-zA-Z\-]+\.[\.a-zA-Z\-]+",$variable); > > Right you are. I spaced out right past the . > > But on the other hand usernames can contain all sorts of other characters > too. = and + are popular among people who give out multiple addresses for > mailbox filtering. > > miguel > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php

    attached mail follows:


    its about validating eMail address, but thanks anyways!

    evan

    On Wednesday 24 April 2002 20:46 pm, you wrote: > I don't know what the original question was, but there is a parse_url > function that'll break apart a url into it's various parts. Quote from > manual: > > www.php.net/parse_url > > ------- > Here is a good example of how it would parse this url: > > 127.0.0.1:6667/pages/page.php?foo=bar#bookmark">http://name:pass127.0.0.1:6667/pages/page.php?foo=bar#bookmark > > (URL is fake) > > This URL uses HTTP, the HTAccess name and password are name and pass, > it's > a localhost, on port 6667. The file page.php is being queried with > foo=bar. It is also set to scroll to the 'bookmark' anchor > > Parse URL would give us > > [scheme] = 'http' > [host] = '127.0.0.1' > [port] = 6667 (Is an INT, not a STRING) > [user] = 'user' > [path] = '/pages/page.php' > [query] = 'foo=bar' > [fragment] = 'bookmark' > > Hopefully this will help someone. > -------- > > I don't know if it does any checking or validating or what...but maybe > it'll help?? > > ---John Holmes... > > > -----Original Message----- > > From: Miguel Cruz [mailto:mncstoic.net] > > Sent: Wednesday, April 24, 2002 5:17 PM > > To: Evan Nemerson > > Cc: php-generallists.php.net > > Subject: Re: [PHP] Regular Expressions > > > > On Wed, 24 Apr 2002, Evan Nemerson wrote: > > > A domain cannot contain an underscore, but unless i'm mistaken the > > > USERNAME can. the domain name REGEX is [\.a-zA-Z\-]+ > > > > > > ereg("([_a-zA-Z\-]+|\*)\[\.a-zA-Z\-]+\.[\.a-zA-Z\-]+",$variable); > > > > Right you are. I spaced out right past the . > > > > But on the other hand usernames can contain all sorts of other > > characters > > > too. = and + are popular among people who give out multiple addresses > > for > > > mailbox filtering. > > > > miguel > > > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php

    -- 
    Only one who devotes himself to a cause with his whole strength and soul can 
    be a true master. For this reason mastery demands all of a person.
    

    Albert Einstein

    attached mail follows:


    Okay...

    ereg("([_a-zA-Z\-\=\+0-9]+|\*)\[\.a-zA-Z\-0-9]+\.[\.a-zA-Z\-0-9]+",$variable);

    Anything else? That one works, right???

    So far we've got a-z, A-Z, underscores, hyphens, equals, and pluses. Oh crap numbers! Okay added it in up there. Anything else?

    On Wednesday 24 April 2002 17:17 pm, you wrote: > On Wed, 24 Apr 2002, Evan Nemerson wrote: > > A domain cannot contain an underscore, but unless i'm mistaken the > > USERNAME can. the domain name REGEX is [\.a-zA-Z\-]+ > > > > ereg("([_a-zA-Z\-]+|\*)\[\.a-zA-Z\-]+\.[\.a-zA-Z\-]+",$variable); > > Right you are. I spaced out right past the . > > But on the other hand usernames can contain all sorts of other characters > too. = and + are popular among people who give out multiple addresses for > mailbox filtering. > > miguel

    -- 
    And in knowing that you know nothing, that makes you the smartest of all.
    

    Socrates

    attached mail follows:


    On Wed, 24 Apr 2002, Larry Brown wrote:

    > problems. I have a client whose specific need to to keep the .html > extention. I want to embed a php script into the html but the script won't > run. I've tried two php enabled servers running apache and neither picks it > out. Is there a trick I'm missing? > > Larry S. Brown MCSE

    In your Apache config, add .html to the list of extensions handled by php. e.g. - AddType application/x-httpd-php .phtml .php .php3 .html .php4

    g.luck, ~Chris /"\ \ / Microsoft Security Specialist: X The moron in Oxymoron. / \ http://www.thebackrow.net

    attached mail follows:


    On Wed, 24 Apr 2002, Larry Brown wrote: > I have run many .php documents and generated html from them without > problems. I have a client whose specific need to to keep the .html > extention. I want to embed a php script into the html but the script won't > run. I've tried two php enabled servers running apache and neither picks it > out. Is there a trick I'm missing?

    Find the line in your httpd.conf file that looks like:

    AddType application/x-httpd-php .php

    and add .html to it so that it looks more like:

    AddType application/x-httpd-php .php .html

    This will cause PHP to get a crack at files ending with .html. As far as anyone seems to be able to tell, this doesn't slow anything down particularly.

    miguel

    attached mail follows:


    Chris Wesley wrote:

    >In your Apache config, add .html to the list of extensions handled by php. >e.g. - >AddType application/x-httpd-php .phtml .php .php3 .html .php4

    This works great in my test site here. Will this cause a lot of overhead if I add that to the httpd.conf of a production server with 1000's of users hitting html all day? Like 10% hit in performance, 20...30...? No noticeable? :)

    Larry S. Brown MCSE Dimension Networks, Inc. Member ICCA (727) 723-8388

    -----Original Message----- From: Chris Wesley [mailto:cwwesleyudlug.org] Sent: Wednesday, April 24, 2002 7:57 PM To: php-generallists.php.net Cc: Larry Brown Subject: Re: [PHP] embedding php into html

    On Wed, 24 Apr 2002, Larry Brown wrote:

    > problems. I have a client whose specific need to to keep the .html > extention. I want to embed a php script into the html but the script won't > run. I've tried two php enabled servers running apache and neither picks it > out. Is there a trick I'm missing? > > Larry S. Brown MCSE

    g.luck, ~Chris /"\ \ / Microsoft Security Specialist: X The moron in Oxymoron. / \ http://www.thebackrow.net

    attached mail follows:


    It looks like Miquel got to the performance issue already. Thanks guys for helping me on this.

    Larry S. Brown MCSE Dimension Networks, Inc. Member ICCA (727) 723-8388

    -----Original Message----- From: Miguel Cruz [mailto:mncstoic.net] Sent: Wednesday, April 24, 2002 8:00 PM To: Larry Brown Cc: PHP List Subject: Re: [PHP] embedding php into html

    On Wed, 24 Apr 2002, Larry Brown wrote: > I have run many .php documents and generated html from them without > problems. I have a client whose specific need to to keep the .html > extention. I want to embed a php script into the html but the script won't > run. I've tried two php enabled servers running apache and neither picks it > out. Is there a trick I'm missing?

    Find the line in your httpd.conf file that looks like:

    AddType application/x-httpd-php .php

    and add .html to it so that it looks more like:

    AddType application/x-httpd-php .php .html

    This will cause PHP to get a crack at files ending with .html. As far as anyone seems to be able to tell, this doesn't slow anything down particularly.

    miguel

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

    attached mail follows:


    Sorry for the off topic post.

    I know that you can setup a .htaccess file that will provide basic security access to a directory.

    Is it possible to create a .htaccess file that will provide username and password security for a specific file in a directory, without effecting the other files?

    Here's an example of an .htaccess file to protect a particular directory:

    # Access file order allow,deny allow from all require valid-user Authname secure AuthPAM_Enabled off Authtype Basic AuthUserFile /home/sites/site6/web/manage/.htpasswd

    What would you have to change to make it protect a single file if possible?

    Thanks in advance,

    Kelly

    attached mail follows:


    Hi list,

    I need to read a txt file and insert it lineas a record in mysql. My list in the format aa|bbbbb bbbb| cccccc | fffffff|hhdhdhdh|jsjjsjs

    in other words my separator is "|" and the lines have a return at the end of each one.

    I'm new to PHP, so can anyone help me with and Idea???

    thank's in advance

    Rodrigo

    -- 
    

    attached mail follows:


    Do this:

    $contents = file($file);

    foreach($contents as $line_num=>$line_data) { $data = explode('|', $line_data);

    // now data contains: // [0] = aa // [1] = bb // [2] = cc // nd so on

    }

    Sincerely,

    Maxim Maletsky Founder, Chief Developer

    www.PHPBeginner.com // where PHP Begins

    > -----Original Message----- > From: Rodrigo Peres [mailto:rperesmac.com] > Sent: Thursday, April 25, 2002 2:14 AM > To: PHP > Subject: [PHP] read text file into mysql > > Hi list, > > I need to read a txt file and insert it lineas a record in mysql. > My list in the format > aa|bbbbb bbbb| cccccc | > fffffff|hhdhdhdh|jsjjsjs > > in other words my separator is "|" and the lines have a return at the end of > each one. > > I'm new to PHP, so can anyone help me with and Idea??? > > thank's in advance > > Rodrigo > -- > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php

    attached mail follows:


    this worked for me.. might be useful to someone...

    // sort the array.. $current = 0; // we begin at the top $totals = forum_count_values($r);

    while ( $current < sizeof($r)) {

    $c = $r[$current][FORUM_POST_FIELD_ID];

    // count the number of posts that are replies to current. $total = $totals[$c];

    $j=0; $i=$current + 1; // we start after current.. while (true) {

    $id = $r[$i][FORUM_POST_FIELD_ID]; $p = $r[$i][FORUM_POST_FIELD_PARENT]; // set parent.

    if ($p != $c) { // if parent not equal to current move to last array_push($r, $r[$i]); // add a copy of element last array_splice($r,$i,1); // remove the old element } else { $j++; // if current and parent are equal move one step closer to total $i++; }

    if ($j==$total) break;

    }

    $current++; // move to next position } // end while

    "Leif HöGberg" <leifkajen.com> wrote in message news:20020423085104.19256.qmailpb1.pair.com... > I have an array where each element contains an array that in turn contains > 2 numbers indexed by "id" and "parent". > > Every id except for the first one belongs to another, its parent. > > What I want to do now is sort the array so that every id is put after its > parent starting with id 1. > > Example: > arr1 = ( > 0 => array("id" => 1, "parent" => 0), > 1 => array("id" => 2, "parent" => 1), > 2 => array("id" => 3, "parent" => 1), > 3 => array("id" => 4, "parent" => 2), > 4 => array("id" => 5, "parent" => 3), > 5 => array("id" => 6, "parent" => 2), > 6 => array("id" => 7, "parent" => 1), > 7 => array("id" => 8, "parent" => 4), > 8 => array("id" => 9, "parent" => 5) > ) > > In other words they are in the following order.. > 1=0 > 2=1 > 3=1 > 4=2 > 5=3 > 6=2 > 7=1 > 8=4 > 9=5 > > After the sort I want them to be in the following order.. > 1=0 > 2=1 > 4=2 > 8=4 > 6=2 > 3=1 > 5=3 > 9=5 > 7=1 > > Note that id 6 isn't placed right after id 4 since id 4 has parents of its > own which have precedence. > > An easier way to illustrate this would be by indenting the list.. > > > > 1=0 > 2=1 > 4=2 > 8=4 > 6=2 > 3=1 > 5=3 > 9=5 > 7=1 > > > The index of $arr1 makes no difference so the array can be shifted or > rebuilt.. > > If you are wondering I need this for a forum that im building. If you have > any suggestions as how to do this better feel free to tell me all about it > :) > > > > Thanks in advance. > > > > // Leif Högberg > > > > >

    attached mail follows:


    You can do two things.. First you can use $to = "elinmail.is, davidatom.is, jonmundurmail.is";

    or you could use a loop such as for or while to mail to each address using a function or not whatever way you wanted to.

    In article <009a01c1eb9c$9b5cf2b0$6501a8c0gandalf>, davidatom.is (David Orn Johannsson) wrote:

    > I’m trying to send an email useing mutible email addresses, could any > one tell me why this isn’t working, it works when I only use one address > ($to = davidatom.is) > but not when I use the following code. > > > > $to = "elinmail.is", " ; > $to .= "davidatom.is" . ", " ; > $to .= "jonmundur mail.is"; > > $subject = "Subject”; > $body = "Body”; > > mail($to, $subject, $body, "From: mailmail.is "); > > <http://www.atom.is/> ------------------------ > Davíð Örn Jóhannssson > Vefforritari > ------------------------ > Atómstöðin hf. > Garðastræti 37 > 101 Reykjavík > ------------------------ > sími: 595-3643 > fax: 595-3649 > <mailto:davidatom.is> davidatom.is > <http://www.atom.is/> http://www.atom.is > ------------------------ > > >

    attached mail follows:


    You can do ASP on Apache via the ChiliSOFT module/component/plugin ( or whatever it's considered).

    www.chilisoft.com

    __________John Monfort_________________ _+-----------------------------------+_ P E P I E D E S I G N S www.pepiedesigns.com "The world is waiting, are you ready?" -+___________________________________+-

    On Mon, 22 Apr 2002, Chuck PUP Payne wrote:

    > Hi, > > I just got finish will a meeting from HELL, I need to ask can some one tell > me is there an Apache Mailing List like this. I have to ask if I can do ASP > page on Apache, I know I know please don't flame me, I kept trying to get > them to switch to PHP, but I been told to shut my mouth and just find out > this information. So I am sorry that I am asking but I not sure where to > start. > > Chuck Payne > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php >

    attached mail follows:


    There was some kind of ASP for Linux. I only heard of it. Search.

    Also, for apache's mailing list look on the Groups of Google.

    May god have mercy on your soul... Amen

    Sincerely,

    Maxim Maletsky Founder, Chief Developer

    www.PHPBeginner.com // where PHP Begins

    > -----Original Message----- > From: [-^-!-%- [mailto:monfortengineering.sdsu.edu] > Sent: Thursday, April 25, 2002 2:37 AM > To: Chuck PUP Payne > Cc: php-generallists.php.net > Subject: Re: [PHP] Not A PHP question but I need help in a big way... > > > > You can do ASP on Apache via the ChiliSOFT module/component/plugin ( or > whatever it's considered). > > www.chilisoft.com > > > > __________John Monfort_________________ > _+-----------------------------------+_ > P E P I E D E S I G N S > www.pepiedesigns.com > "The world is waiting, are you ready?" > -+___________________________________+- > > On Mon, 22 Apr 2002, Chuck PUP Payne wrote: > > > Hi, > > > > I just got finish will a meeting from HELL, I need to ask can some one tell > > me is there an Apache Mailing List like this. I have to ask if I can do ASP > > page on Apache, I know I know please don't flame me, I kept trying to get > > them to switch to PHP, but I been told to shut my mouth and just find out > > this information. So I am sorry that I am asking but I not sure where to > > start. > > > > Chuck Payne > > > > > > -- > > 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

    attached mail follows:


    This isn't directly PHP related, but I feel it is appropriate.

    I just got a letter from VeriSign- a "Domain Name Expiration Notice". It was EXTREMELY misleading. I looked like an invoice demanding $29 by 5/15/02. Basically, they made it seem like I already had a service with them and this was a renewal of that service. I suppose this is remotely true since they run the A root server... Nah it's still way out of line.

    My domain ( coeus-group.com ) expires 6/6/02 (according to the whois records). The 5/15 deadline makes it seem like they're trying to get in before the compitition, so their chicanery will work. As you can tell from the whois records, my domain is registered through bulkregister.com, via nomonthlyfees.com (well, you can't tell the second part, but you have my word on it ;)). Neither of these companies, to the best of my knowledge, are associate in any way with VeriSign.

    I called the billing department nomonthlyfees, and they said that this was happening to lots of people, and not to worry about it (DNS renewal is included in my hosting charges).

    I'm on my way to bbb.org after I finish this eMail. I just wanted to give you guys warning.

    Evan Nemerson

    -- 
    The probability that we may fail in the struggle ought not to deter us from 
    the support of a cause we believe to be just.
    

    Abraham Lincoln

    attached mail follows:


    SF is OK, as every other software it itself may have some problems from time to time. But overall it always works. You might be frustrated abut the security precautions it takes, but this is only for your best.

    Sincerely,

    Maxim Maletsky Founder, Chief Developer

    www.PHPBeginner.com // where PHP Begins

    > -----Original Message----- > From: David Duong [mailto:davidduong1hotmail.com] > Sent: Thursday, April 25, 2002 12:56 AM > To: php-generallists.php.net > Subject: [PHP] SourceForge. Whats the worst part about it? > > Hello, > > Currently I am using SourceForge for a variety of Projects and now some > issues have surfaced concerning SF quality. Now I am now wonder what is the > worst downfall about SF? Now SourceForge is a very great tool as mention > earlier, it is a very useful tool in Open Source and I am quite sure many > people believe that also, I would also like to hear from this side. > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php

    attached mail follows:


    > Hi, > > I am not a PHP programmer. (Sorry Guys;-) > Although, I am working on a PHP portal type site, where I need to > integrate as seemlessly(?) as possible an outside specialized leased > Search Engine Service done with ASP (I suppose? ".asp").

    yup, probably ASP. > I have been looking everywhere for this info. Just can't seem to get > it all together. > I done some tests but the images acompanying the Search form are not > following. I suppose if I ask the them to put absolute paths... ?

    you can combine your own. If the images returned have an absolute path, not URL (without http://..., like: /dir/file.png) all you have to do is to figure out what the URL is and then compose it yourself. > --- 1. Is it technically possible with PHP to interact with the > engine's pages and the results it pushs so that it feels as if it was > part of the site?

    Yes

    > --- 2. I don't understand the differences between "include" , > "fopen" and even "fopen". > What would be the best way to do the job if it is "doable" of course ;-)

    For remote access they are kind of similar. Use include, it is easier to learn. Try this;

    <? Include('http://www.google.com'); ?>

    you will see the whole google under your domain name.

    Sincerely,

    Maxim Maletsky Founder, Chief Developer

    www.PHPBeginner.com // where PHP Begins

    attached mail follows:


    From the manual (and with honor):

    int setcookie ( string name [, string value [, int expire [, string path [, string domain [, int secure]]]]])

    so <? setcookie ("TestCookie", $value,time()+3600, "/~rasmus/", ".utoronto.ca", 1); ?>

    limits the cookie to work on only one specified folder

    see for more: www.php.net/setcookie

    Sincerely,

    Maxim Maletsky Founder, Chief Developer

    www.PHPBeginner.com // where PHP Begins

    > -----Original Message----- > From: Erik Price [mailto:priceehhbrown.com] > Sent: Wednesday, April 24, 2002 9:32 PM > To: Pusta > Cc: php-generallists.php.net > Subject: Re: [PHP] Setcookie problems... > > > On Wednesday, April 24, 2002, at 03:27 PM, Pusta wrote: > > > When we are setting a cookie in a PHP page, that cookie cannot be > > accessed > > by any page in a different folder. When we move the pages into the same > > folder, the cookies worked fine. Can anyone shed some light on this?? > > Is the different directory pointed to by a different virtual host? I > could be completely mistaken, but don't cookies only work on a > per-domain name basis? > > If that's not it, I don't know what else it could be. > > Erik > > > > > ---- > > Erik Price > Web Developer Temp > Media Lab, H.H. Brown > priceehhbrown.com > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php

    attached mail follows:


    hello,all: I have already installed gd-1.8.4 in php-4.1.2 with some libraries,such as libpng -1.2.0,freetype-1.3,zlib-1.1.4,freetype2,in my apache server which version is 1.3.24,and "phpinfo()" display php can support such soft,as follow: GD Support---------------------------enabled GD Version---------------------------1.6.2 or higher FreeType Support---------------------enabled FreeType Linkage---------------------with freetype JPG Support--------------------------enabled PNG Support--------------------------enabled WBMP Support-------------------------enabled But when I used the function related with ttf,like ImageTTFText or ImageTTFBox,I found it useless,in other words,no pictures were displayed in my IE. I don't understand why,is gd-1.8.4 can not support these functions? ps:my test code <? //define the type of inputting picture; Heder("content-type:image/png"); //create picture $pic=imagecreate(240,30); //define color $black=imagecolorallocate($pic,0,0,0); $white=imagecolorallocate($pic,255,255,255); //define font copied from windows2000 $font="fonts/simhei.ttf"; //define characters to output $str = chr(0xE8).chr(0xB5).chr(0x9B).chr(0xE8).chr(0xBF).chr(0xAA).chr(0xE7).chr(0xBD).chr(0 x91)." www.ccidnet.com"; //write ttf in picture imageTTFText($pic,20,0,10,20,$white,$font,$str); //create png picture imagepng($pic); //release the memory occupied by the picture imagedestroy($pic); ?> Can anybody give a reply? Thank you zhaoxd

    attached mail follows:


    On Thursday 25 April 2002 10:08, zhaoxd wrote: > <? > //define the type of inputting picture; > Heder("content-type:image/png");

    Is this a typo? Should be Header(...).

    > //create picture > $pic=imagecreate(240,30); > //define color > $black=imagecolorallocate($pic,0,0,0); > $white=imagecolorallocate($pic,255,255,255); > //define font copied from windows2000 > $font="fonts/simhei.ttf"; > //define characters to output > $str = > chr(0xE8).chr(0xB5).chr(0x9B).chr(0xE8).chr(0xBF).chr(0xAA).chr(0xE7).chr(0 >xBD).chr(0 x91)." www.ccidnet.com"; > //write ttf in picture > imageTTFText($pic,20,0,10,20,$white,$font,$str); > //create png picture > imagepng($pic); > //release the memory occupied by the picture > imagedestroy($pic); > ?>

    I tried this and it works. However the font I used didn't have those chr(0xE8), etc defined so I can only see "www.ccidnet.com".

    -- 
    Jason Wong -> Gremlins Associates -> www.gremlins.com.hk
    Open Source Software Systems Integrators
    * Web Design & Hosting * Internet & Intranet Applications Development *
    

    /* You are only young once, but you can stay immature indefinitely. */

    attached mail follows:


    It works fine. Spell Header() right, or remove the header altogether so you can see the error message. I predict you will see a message telling you it couldn't open the font file.

    -Rasmus

    On Thu, 25 Apr 2002, zhaoxd wrote:

    > hello,all: > > I have already installed gd-1.8.4 in php-4.1.2 with some libraries,such as libpng -1.2.0,freetype-1.3,zlib-1.1.4,freetype2,in my apache server which version is 1.3.24,and "phpinfo()" display php can support such soft,as follow: > GD Support---------------------------enabled > GD Version---------------------------1.6.2 or higher > FreeType Support---------------------enabled > FreeType Linkage---------------------with freetype > JPG Support--------------------------enabled > PNG Support--------------------------enabled > WBMP Support-------------------------enabled > > But when I used the function related with ttf,like ImageTTFText or ImageTTFBox,I found it useless,in other words,no pictures were displayed in my IE. > I don't understand why,is gd-1.8.4 can not support these functions? > > ps:my test code > <? > //define the type of inputting picture; > Heder("content-type:image/png"); > //create picture > $pic=imagecreate(240,30); > //define color > $black=imagecolorallocate($pic,0,0,0); > $white=imagecolorallocate($pic,255,255,255); > //define font copied from windows2000 > $font="fonts/simhei.ttf"; > //define characters to output > $str = chr(0xE8).chr(0xB5).chr(0x9B).chr(0xE8).chr(0xBF).chr(0xAA).chr(0xE7).chr(0xBD).chr(0 > x91)." www.ccidnet.com"; > //write ttf in picture > imageTTFText($pic,20,0,10,20,$white,$font,$str); > //create png picture > imagepng($pic); > //release the memory occupied by the picture > imagedestroy($pic); > ?> > > Can anybody give a reply? > > Thank you > zhaoxd > >

    attached mail follows:


    > > <? > > //define the type of inputting picture; > > Heder("content-type:image/png"); > > Is this a typo? Should be Header(...). > Sorry, I did a wrong copy.But when I cut this line,it output a warning words: "libgd was not built with FreeType font support in /usr/local/apache/htdocs/test.php on line 14", I guess my compiling is not right,when I installed the php,my parameter of configuration is "./configure --with-mysql=/usr/local/mysql --with-apache=../apache-1.3.24 --enable-track-vars --with-gd=../gd-1.8.4 --with-imap=../imap-4.7c --enable-ftp --with-ldap=/usr/local/ldap --with-zlib-dir=../zlib --with-png-dir=../libpng --with-freetype-dir=../freetype2.1.0 --with-ttf=/usr/local/lib" Did I use freetype2.1.0 right? Maybe I shall try freetype-1.3. right? > > //create picture > > $pic=imagecreate(240,30); > > //define color > > $black=imagecolorallocate($pic,0,0,0); > > $white=imagecolorallocate($pic,255,255,255); > > //define font copied from windows2000 > > $font="fonts/simhei.ttf"; > > //define characters to output > > $str = > > chr(0xE8).chr(0xB5).chr(0x9B).chr(0xE8).chr(0xBF).chr(0xAA).chr(0xE7).chr(0 > >xBD).chr(0 x91)." www.ccidnet.com"; > > //write ttf in picture > > imageTTFText($pic,20,0,10,20,$white,$font,$str); > > //create png picture > > imagepng($pic); > > //release the memory occupied by the picture > > imagedestroy($pic); > > ?> > > I tried this and it works. I can only see "www.ccidnet.com". Thank you, zhaoxd

    attached mail follows:


    Can someone take a look at this code for me? I'm pretty new to programming, but looking at it I think it should work. I'm not saying there aren't plenty of errors, because I'm sure there are. I'm getting a parse error on the last line, and I can't see any reason for it. All of my ifs and functions are closed as far as I see. I guess I'm just looking for an unbiased eye here, I've been staring at this for a couple hours now. If you have comments on to how I could simplify this code, that'd be great too. Otherwise, I just need it to get it working. Thanks in advance -

    Jason Soza ------------------------------------

    <?php

    // general config

    $timestamp = date("mdY"); $id = time(); $upload_path = "incoming/"; // path to your upload directory $extval_use = 1; // turns on/off extension validation

    // mail config

    $xmailer = "userhere.com"; $xsender = "userhere.com"; $from = "userhere.com"; $to = "userhere.com"; $subject = "Form submission"; $boundary = "b".md5(uniqid(time()));

    // form config

    $name = $_POST["name"]; $email = $_POST["email"]; $location = $_POST["location"]; $color = $_POST["color"]; $year = $_POST["year"]; $misc = $_POST["misc"];

    // extension config

    $extval = array("php", "php3", "asp", "bat", "exe", "com", "jsp", "cfml", "shtml", "dtcl"); $filesize_limit_use = 1; // turns on/off size check $filesize_limit = 2048; // file size limit (in kB)

    // messages $message["fileisbig"] = "File is bigger than upload limit (" . $filesize_limit . "kB)"; $message["invext"] = "Files of this type are not allowed, sorry."; $message["incomplete"] = "Upload is incomplete."; $message["complete"] = "Upload succesfully completed."; $message["uploadbutton"] = "Upload"; $message["uploadtxt"] = "File for upload: "; $message["fileexists"] = "File already exists";

    // Define functions

    function filesize_check ($filesize) {

    if($filesize_limit < $filesize) { echo "<p><font color='red'><center>" . $message["fileisbig"]."</font></center></p>"; $rc = 1; }

    }

    function ext_valid ($filename) {

    $extget = substr( strrchr($filename, "."), 1);

    $found = in_array($extget, $extval);

    if ( $found ) { echo "<p><font color='red'><center>" . $message["invext"]."</font></center></p>";

    $rc = 2; }

    function file_upload ($filename) {

    if ( file_exists($upload_path.$timestamp."-".$id."-".$filename) ) { echo "<p><font color='red'><center>" . $message["fileexists"]."</font></center></p>";

    } else { if( move_uploaded_file($HTTP_POST_FILES['userfile']['tmp_name'], $upload_path.$timestamp."-".$id."-".$filename) ) { echo "<p><center>" . $message["complete"]."</center></p>"; } else { echo "<p><font color='red'><center>" . $message["incomplete"]."</font></center></p>"; }

    } }

    function filename_mod ($filename) { ereg_replace("[^a-z0-9._]", "", ereg_replace (" ", "_", ereg_replace("%20", "_", strtolower($orig_name)))); }

    $rc = 0;

    if($filesize_limit_use=1) { $filesize1 = $HTTP_POST_FILES['userfile1']['name'] / 1024; //filesize in kB $filesize2 = $HTTP_POST_FILES['userfile2']['name'] / 1024; //filesize in kB $filesize3 = $HTTP_POST_FILES['userfile3']['name'] / 1024; //filesize in kB $filesize4 = $HTTP_POST_FILES['userfile4']['name'] / 1024; //filesize in kB }

    if ( isset($HTTP_POST_VARS["upload"]) ) {

    if ($HTTP_POST_FILES['userfile1']['name']) { $orig_name1 = $HTTP_POST_FILES['userfile1']['name']; $filename1 = filename_mod ($orig_name1); filesize_check ($filesize1); if ( $rc == 0 ) { if($extval_use=1) { ext_valid ($filename1); } } if ( $rc == 0 ) { file_upload ($filename1); } }

    if ($HTTP_POST_FILES['userfile2']['name']) { $orig_name2 = $HTTP_POST_FILES['userfile2']['name']; $filename2 = filename_mod ($orig_name2); filesize_check ($filesize2); if ( $rc == 0 ) { if($extval_use=1) { ext_valid ($filename2); } } if ( $rc == 0 ) { file_upload ($filename2); } }

    if ($HTTP_POST_FILES['userfile3']['name']) { $orig_name3 = $HTTP_POST_FILES['userfile3']['name']; $filename3 = filename_mod ($orig_name3); filesize_check ($filesize3); if ( $rc == 0 ) { if($extval_use=1) { ext_valid ($filename3); } } if ( $rc == 0 ) { file_upload ($filename3); } }

    if ($HTTP_POST_FILES['userfile4']['name']) { $orig_name4 = $HTTP_POST_FILES['userfile4']['name']; $filename4 = filename_mod ($orig_name4); filesize_check ($filesize4); if ( $rc == 0 ) { if($extval_use=1) { ext_valid ($filename4); } } if ( $rc == 0 ) { file_upload ($filename4); } } }

    // Setup e-mail message

    $body = "Date: $timestamp\n"; $body .= "Name: $name\n"; $body .= "E-mail: $email\n"; $body .= "Location: $location\n"; $body .= "Color: $color\n"; $body .= "Year: $year\n"; $body .= "Misc: $misc\n"; $body .= "File 1: $timestamp-$id-$filename1\n"; $body .= "File 2: $timestamp-$id-$filename2\n"; $body .= "File 3: $timestamp-$id-$filename3\n"; $body .= "File 4: $timestamp-$id-$filename4\n";

    $mime = "From: $from\n"; $mime .= "Reply-To: $from\n"; $mime .= "X-Mailer: $xmailer\n"; $mime .= "X-Sender: $xsender\n"; $mime .= "Content-type: multipart/mixed; "; $mime .= "boundary = $boundary\r\n\r\n"; $mime .= "This is a MIME encoded message.\r\n\r\n"; $mime .= "--$boundary\r\n"; $mime .= "Content-type: text/plain\r\n"; $mime .= "Content-Transfer-Encoding: base64"; $mime .= "\r\n\r\n".chunk_split(base64_encode($body))."\r\n";

    // Send e-mail

    mail ($to, $subject, "", $mime);

    ?>

    attached mail follows:


    Copy and paste the parse error into your e-mail. Also, try placing another "}" at the end of the code. If you're missing a closing bracket somewhere, that will take care of it.

    Tyler Longren Captain Jack Communications www.captainjack.com tylercaptainjack.com

    ----- Original Message ----- From: "Jason Soza" <soljagci.net> To: <php-generallists.php.net> Sent: Wednesday, April 24, 2002 10:20 PM Subject: [PHP] Parse Error - Help?

    > Can someone take a look at this code for me? I'm pretty new to programming, > but looking at it I think it should work. I'm not saying there aren't plenty > of errors, because I'm sure there are. I'm getting a parse error on the last > line, and I can't see any reason for it. All of my ifs and functions are > closed as far as I see. I guess I'm just looking for an unbiased eye here, > I've been staring at this for a couple hours now. If you have comments on to > how I could simplify this code, that'd be great too. Otherwise, I just need > it to get it working. Thanks in advance - > > Jason Soza > ------------------------------------ > > <?php > > // general config > > $timestamp = date("mdY"); > $id = time(); > $upload_path = "incoming/"; // path to your upload directory > $extval_use = 1; // turns on/off extension validation > > // mail config > > $xmailer = "userhere.com"; > $xsender = "userhere.com"; > $from = "userhere.com"; > $to = "userhere.com"; > $subject = "Form submission"; > $boundary = "b".md5(uniqid(time())); > > // form config > > $name = $_POST["name"]; > $email = $_POST["email"]; > $location = $_POST["location"]; > $color = $_POST["color"]; > $year = $_POST["year"]; > $misc = $_POST["misc"]; > > // extension config > > $extval = array("php", "php3", "asp", "bat", "exe", "com", "jsp", "cfml", > "shtml", "dtcl"); > $filesize_limit_use = 1; // turns on/off size check > $filesize_limit = 2048; // file size limit (in kB) > > // messages > $message["fileisbig"] = "File is bigger than upload limit (" . > $filesize_limit . "kB)"; > $message["invext"] = "Files of this type are not allowed, sorry."; > $message["incomplete"] = "Upload is incomplete."; > $message["complete"] = "Upload succesfully completed."; > $message["uploadbutton"] = "Upload"; > $message["uploadtxt"] = "File for upload: "; > $message["fileexists"] = "File already exists"; > > // Define functions > > function filesize_check ($filesize) { > > if($filesize_limit < $filesize) { > echo "<p><font color='red'><center>" > . $message["fileisbig"]."</font></center></p>"; > $rc = 1; > } > > } > > function ext_valid ($filename) { > > $extget = substr( strrchr($filename, "."), 1); > > $found = in_array($extget, $extval); > > if ( $found ) { > echo "<p><font color='red'><center>" > . $message["invext"]."</font></center></p>"; > > $rc = 2; > } > > function file_upload ($filename) { > > if ( file_exists($upload_path.$timestamp."-".$id."-".$filename) ) { > echo "<p><font color='red'><center>" > . $message["fileexists"]."</font></center></p>"; > > } else { > if( move_uploaded_file($HTTP_POST_FILES['userfile']['tmp_name'], > $upload_path.$timestamp."-".$id."-".$filename) ) { > echo "<p><center>" . $message["complete"]."</center></p>"; > } else { > echo "<p><font color='red'><center>" > . $message["incomplete"]."</font></center></p>"; > } > > } > } > > function filename_mod ($filename) { > ereg_replace("[^a-z0-9._]", "", > ereg_replace (" ", "_", > ereg_replace("%20", "_", > strtolower($orig_name)))); > } > > $rc = 0; > > if($filesize_limit_use=1) { > $filesize1 = $HTTP_POST_FILES['userfile1']['name'] / 1024; //filesize > in kB > $filesize2 = $HTTP_POST_FILES['userfile2']['name'] / 1024; //filesize > in kB > $filesize3 = $HTTP_POST_FILES['userfile3']['name'] / 1024; //filesize > in kB > $filesize4 = $HTTP_POST_FILES['userfile4']['name'] / 1024; //filesize > in kB > } > > > if ( isset($HTTP_POST_VARS["upload"]) ) { > > > if ($HTTP_POST_FILES['userfile1']['name']) { > $orig_name1 = $HTTP_POST_FILES['userfile1']['name']; > $filename1 = filename_mod ($orig_name1); > filesize_check ($filesize1); > if ( $rc == 0 ) { > if($extval_use=1) { > ext_valid ($filename1); > } > } > if ( $rc == 0 ) { > file_upload ($filename1); > } > } > > if ($HTTP_POST_FILES['userfile2']['name']) { > $orig_name2 = $HTTP_POST_FILES['userfile2']['name']; > $filename2 = filename_mod ($orig_name2); > filesize_check ($filesize2); > if ( $rc == 0 ) { > if($extval_use=1) { > ext_valid ($filename2); > } > } > if ( $rc == 0 ) { > file_upload ($filename2); > } > } > > if ($HTTP_POST_FILES['userfile3']['name']) { > $orig_name3 = $HTTP_POST_FILES['userfile3']['name']; > $filename3 = filename_mod ($orig_name3); > filesize_check ($filesize3); > if ( $rc == 0 ) { > if($extval_use=1) { > ext_valid ($filename3); > } > } > if ( $rc == 0 ) { > file_upload ($filename3); > } > } > > if ($HTTP_POST_FILES['userfile4']['name']) { > $orig_name4 = $HTTP_POST_FILES['userfile4']['name']; > $filename4 = filename_mod ($orig_name4); > filesize_check ($filesize4); > if ( $rc == 0 ) { > if($extval_use=1) { > ext_valid ($filename4); > } > } > if ( $rc == 0 ) { > file_upload ($filename4); > } > } > } > > // Setup e-mail message > > $body = "Date: $timestamp\n"; > $body .= "Name: $name\n"; > $body .= "E-mail: $email\n"; > $body .= "Location: $location\n"; > $body .= "Color: $color\n"; > $body .= "Year: $year\n"; > $body .= "Misc: $misc\n"; > $body .= "File 1: $timestamp-$id-$filename1\n"; > $body .= "File 2: $timestamp-$id-$filename2\n"; > $body .= "File 3: $timestamp-$id-$filename3\n"; > $body .= "File 4: $timestamp-$id-$filename4\n"; > > $mime = "From: $from\n"; > $mime .= "Reply-To: $from\n"; > $mime .= "X-Mailer: $xmailer\n"; > $mime .= "X-Sender: $xsender\n"; > $mime .= "Content-type: multipart/mixed; "; > $mime .= "boundary = $boundary\r\n\r\n"; > $mime .= "This is a MIME encoded message.\r\n\r\n"; > $mime .= "--$boundary\r\n"; > $mime .= "Content-type: text/plain\r\n"; > $mime .= "Content-Transfer-Encoding: base64"; > $mime .= "\r\n\r\n".chunk_split(base64_encode($body))."\r\n"; > > // Send e-mail > > mail ($to, $subject, "", $mime); > > ?> > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php >

    attached mail follows:


    On Thursday 25 April 2002 11:20, Jason Soza wrote: > Can someone take a look at this code for me? I'm pretty new to programming, > but looking at it I think it should work. I'm not saying there aren't > plenty of errors, because I'm sure there are. I'm getting a parse error on > the last line, and I can't see any reason for it. All of my ifs and > functions are closed as far as I see. I guess I'm just looking for an > unbiased eye here, I've been staring at this for a couple hours now. If you > have comments on to how I could simplify this code, that'd be great too. > Otherwise, I just need it to get it working. Thanks in advance -

    > if ( isset($HTTP_POST_VARS["upload"]) ) { > > > if ($HTTP_POST_FILES['userfile1']['name']) { > $orig_name1 = $HTTP_POST_FILES['userfile1']['name']; > $filename1 = filename_mod ($orig_name1); > filesize_check ($filesize1); > if ( $rc == 0 ) { > if($extval_use=1) { > ext_valid ($filename1); > } > } > if ( $rc == 0 ) { > file_upload ($filename1); > } <--------------------- HERE > }

    Could it be this extra closing brace?

    -- 
    Jason Wong -> Gremlins Associates -> www.gremlins.com.hk
    Open Source Software Systems Integrators
    * Web Design & Hosting * Internet & Intranet Applications Development *
    

    /* Semper Fi, dude. */

    attached mail follows:


    Found it - just added another curly brace to the end of the code and it worked, so I searched up from there and found:

    function ext_valid ($filename) {

    $extget = substr( strrchr($filename, "."), 1);

    $found = in_array($extget, $extval);

    if ( $found ) { echo "<p><font color='red'><center>" . $message["invext"]."</font></center></p>";

    $rc = 2; }

    This function should have another curly brace at the end. Aha! Thanks for your help!

    Jason

    -----Original Message----- From: Tyler Longren [mailto:tylercaptainjack.com] Sent: Wednesday, April 24, 2002 7:22 PM To: Jason Soza; php-generallists.php.net Subject: Re: [PHP] Parse Error - Help?

    Copy and paste the parse error into your e-mail. Also, try placing another "}" at the end of the code. If you're missing a closing bracket somewhere, that will take care of it.

    Tyler Longren Captain Jack Communications www.captainjack.com tylercaptainjack.com

    attached mail follows:


    I don't believe there is such a problem, because

    <DIV><? echo "foo"; ?></DIV>

    will get replaced with <DIV>foo</DIV> by the PHP parser. >> Thus by the time the content gets to the browser, it ISN'T PHP anymore -- it's HTML, or text.

    What you should do is view the source of your processed page, to ensure that your HTML around the problem area is valid, and correctly parsed. You may even want to run a HTML validator over it.

    Remember, once the page hits the browser, the code is the RESULT of the PHP code, not the php code itself, thus, PHP code that produces correctly formatted HTML should not break any page. PHP code that creates poorly formatted or invalid HTML will break a page, just as if you did it yourself with a text editor on a raw HTML page.

    Good luck.

    Justin French -------------------- Creative Director http://Indent.com.au --------------------

    on 25/04/02 4:52 AM, Robert (robertnrc.net) wrote:

    > Has anyone ever had trouble with Netscape not displaying a layer with you > put any php code in it? Anyone know a source for reading more about it? > >

    attached mail follows:


    Yike, now I wish I hadn't found it:

    [Wed Apr 24 19:42:18 2002] [error] PHP Warning: Wrong datatype for second argument in call to in_array in beta_up.asp on line 61 [Wed Apr 24 19:42:18 2002] [error] PHP Warning: Undefined variable: upload_path in beta_up.php on line 73 [Wed Apr 24 19:42:18 2002] [error] PHP Warning: Undefined variable: timestamp in beta_up.php on line 73 [Wed Apr 24 19:42:18 2002] [error] PHP Warning: Undefined variable: id in beta_up.php on line 73 [Wed Apr 24 19:42:18 2002] [error] PHP Warning: Undefined variable: HTTP_POST_FILES in beta_up.php on line 78 [Wed Apr 24 19:42:18 2002] [error] PHP Warning: Undefined variable: upload_path in beta_up.php on line 79 [Wed Apr 24 19:42:18 2002] [error] PHP Warning: Undefined variable: timestamp in beta_up.php on line 79 [Wed Apr 24 19:42:18 2002] [error] PHP Warning: Undefined variable: id in beta_up.php on line 79 [Wed Apr 24 19:42:18 2002] [error] PHP Warning: Undefined variable: message in beta_up.php on line 83 [Wed Apr 24 19:42:18 2002] [error] PHP Warning: Undefined variable: filename3 in beta_up.php on line 177 [Wed Apr 24 19:42:18 2002] [error] PHP Warning: Undefined variable: filename4 in beta_up.php on line 178

    What more do I have to do to define variables? I name what each variable is with normal conventions - what would cause the above error messages? I think the one that's most disturbing is the in_array() warning, need that to work!

    Again, any help would be greatly appreciated!

    Jason

    -----Original Message----- From: Jason Soza [mailto:soljagci.net] Sent: Wednesday, April 24, 2002 7:56 PM To: php-generallists.php.net Subject: RE: [PHP] Parse Error - Help?

    Found it - just added another curly brace to the end of the code and it worked, so I searched up from there and found:

    function ext_valid ($filename) {

    $extget = substr( strrchr($filename, "."), 1);

    $found = in_array($extget, $extval);

    if ( $found ) { echo "<p><font color='red'><center>" . $message["invext"]."</font></center></p>";

    $rc = 2; }

    This function should have another curly brace at the end. Aha! Thanks for your help!

    Jason

    -----Original Message----- From: Tyler Longren [mailto:tylercaptainjack.com] Sent: Wednesday, April 24, 2002 7:22 PM To: Jason Soza; php-generallists.php.net Subject: Re: [PHP] Parse Error - Help?

    Copy and paste the parse error into your e-mail. Also, try placing another "}" at the end of the code. If you're missing a closing bracket somewhere, that will take care of it.

    Tyler Longren Captain Jack Communications www.captainjack.com tylercaptainjack.com

    attached mail follows:


    > -----Original Message----- > From: Jason Soza [mailto:soljagci.net] > Sent: 25 April 2002 05:06 > > Yike, now I wish I hadn't found it: > > [Wed Apr 24 19:42:18 2002] [error] PHP Warning: Wrong > datatype for second > argument in call to in_array in beta_up.asp on line 61

    57 function ext_valid ($filename) { 58 59 $extget = substr( strrchr($filename, "."), 1); 60 61 $found = in_array($extget, $extval); 62 63 if ( $found ) { 64 echo "<p><font color='red'><center>" 65 . $message["invext"]."</font></center></p>"; 66 67 $rc = 2; 68 } 69 }

    $extval is undefined on line 61 -- it's neither a parameter to the function nor a variable defined in the function. If you are intending to refer to the $extval defined in the global scope, you need to global it in the function:

    57 function ext_valid ($filename) { 58 59 global $extval;

    etc.

    > [Wed Apr 24 19:42:18 2002] [error] PHP Warning: Undefined variable: > upload_path in beta_up.php on line 73

    Same.

    > [Wed Apr 24 19:42:18 2002] [error] PHP Warning: Undefined variable: > timestamp in beta_up.php on line 73

    Same.

    ... and, I'd guess, same for most of the others. Try globalling all the global variables you're using in functions, or passing them as parameters, and then try again.

    Cheers!

    Mike

    --------------------------------------------------------------------- Mike Ford, Electronic Information Services Adviser, Learning Support Services, Learning & Information Services, JG125, James Graham Building, Leeds Metropolitan University, Beckett Park, LEEDS, LS6 3QS, United Kingdom Email: m.fordlmu.ac.uk Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211

    attached mail follows:


    I am trying to get php installed and working on a freebsd server and I'm used to using linux where it hasn't failed me before. After running ./configure make and make install there is no libphp4.so anywhere on the server. I ran just ./configure and make and then checked the current directories for the file with no positive results.

    Larry S. Brown MCSE Dimension Networks, Inc. Member ICCA (727) 723-8388

    attached mail follows:


    ./configure make make install

    On Wednesday 24 April 2002 22:08 pm, you wrote: > I am trying to get php installed and working on a freebsd server and I'm > used to using linux where it hasn't failed me before. After running > ./configure make and make install there is no libphp4.so anywhere on the > server. I ran just ./configure and make and then checked the current > directories for the file with no positive results. > > Larry S. Brown MCSE > Dimension Networks, Inc. > Member ICCA > (727) 723-8388

    -- 
    Common sense is not so common.
    

    Voltaire

    attached mail follows:


    I don't mean to be rude but as I mentioned in my post "After running ./configure make and make install...". Please review my post for the actual problem.

    Larry S. Brown MCSE Dimension Networks, Inc. Member ICCA (727) 723-8388

    -----Original Message----- From: Evan Nemerson [mailto:evancoeus-group.com] Sent: Thursday, April 25, 2002 1:25 AM To: Larry Brown; php-generallists.php.net Subject: Re: [PHP] compiling on freebsd

    ./configure make make install

    On Wednesday 24 April 2002 22:08 pm, you wrote: > I am trying to get php installed and working on a freebsd server and I'm > used to using linux where it hasn't failed me before. After running > ./configure make and make install there is no libphp4.so anywhere on the > server. I ran just ./configure and make and then checked the current > directories for the file with no positive results. > > Larry S. Brown MCSE > Dimension Networks, Inc. > Member ICCA > (727) 723-8388

    --
    Common sense is not so common.
    

    Voltaire

    attached mail follows:


    Please read the INSTALL file. The default is to make the command line php binary if you do not provide any ./configure flags, so simply typing ./configure && make && make install should have installed /usr/local/bin/php and it would not have built a libphp4.so. For that you need to add --with-apxs

    -Rasmus

    On Thu, 25 Apr 2002, Larry Brown wrote:

    > I don't mean to be rude but as I mentioned in my post "After running > ./configure make and make install...". Please review my post for the actual > problem. > > Larry S. Brown MCSE > Dimension Networks, Inc. > Member ICCA > (727) 723-8388 > > -----Original Message----- > From: Evan Nemerson [mailto:evancoeus-group.com] > Sent: Thursday, April 25, 2002 1:25 AM > To: Larry Brown; php-generallists.php.net > Subject: Re: [PHP] compiling on freebsd > > ./configure > make > make install > > > > On Wednesday 24 April 2002 22:08 pm, you wrote: > > I am trying to get php installed and working on a freebsd server and I'm > > used to using linux where it hasn't failed me before. After running > > ./configure make and make install there is no libphp4.so anywhere on the > > server. I ran just ./configure and make and then checked the current > > directories for the file with no positive results. > > > > Larry S. Brown MCSE > > Dimension Networks, Inc. > > Member ICCA > > (727) 723-8388 > > -- > Common sense is not so common. > > Voltaire > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php >

    attached mail follows:


    I ended up using a port which eventually worked. I parsed the INSTALL file and it didn't mention anything about specifically adding libphp4.so. It mentioned checking the flags available with ./configure -help which I ran. But I had no way of knowing what apxs means. It mentioned -with-apxs in the INSTALL description but stated that if I got an error to physically locate apxs and tell configure where it is. I did a search for apxs* with no results. Anyway, I did get it going. Thank you for the input.

    Larry S. Brown MCSE Dimension Networks, Inc. Member ICCA (727) 723-8388

    -----Original Message----- From: Rasmus Lerdorf [mailto:rasmuslerdorf.ca] Sent: Thursday, April 25, 2002 12:40 AM To: Larry Brown Cc: PHP List Subject: RE: [PHP] compiling on freebsd

    Please read the INSTALL file. The default is to make the command line php binary if you do not provide any ./configure flags, so simply typing ./configure && make && make install should have installed /usr/local/bin/php and it would not have built a libphp4.so. For that you need to add --with-apxs

    -Rasmus

    On Thu, 25 Apr 2002, Larry Brown wrote:

    > I don't mean to be rude but as I mentioned in my post "After running > ./configure make and make install...". Please review my post for the actual > problem. > > Larry S. Brown MCSE > Dimension Networks, Inc. > Member ICCA > (727) 723-8388 > > -----Original Message----- > From: Evan Nemerson [mailto:evancoeus-group.com] > Sent: Thursday, April 25, 2002 1:25 AM > To: Larry Brown; php-generallists.php.net > Subject: Re: [PHP] compiling on freebsd > > ./configure > make > make install > > > > On Wednesday 24 April 2002 22:08 pm, you wrote: > > I am trying to get php installed and working on a freebsd server and I'm > > used to using linux where it hasn't failed me before. After running > > ./configure make and make install there is no libphp4.so anywhere on the > > server. I ran just ./configure and make and then checked the current > > directories for the file with no positive results. > > > > Larry S. Brown MCSE > > Dimension Networks, Inc. > > Member ICCA > > (727) 723-8388 > > -- > Common sense is not so common. > > Voltaire > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php >

    attached mail follows:


    You really are not reading the instructions carefully enough. Or perhaps my writing is horrible. It says:

    === A popular choice is to build the Apache module version. In order to build PHP as a dynamic module for Apache-1.3.x you have to first have Apache installed. Assuming Apache is already installed, make sure the shared object module is enabled. To check this, type: httpd -l You should see something like:

    Compiled-in modules: http_core.c mod_so.c

    You will most likely have a lot more modules than what is shown here. As long as mod_so.c shows up in the list, PHP should be happy.

    Now, type: ./configure --with-mysql --with-apxs

    If you get an error telling you that the apxs script could not be found, look for it on your system and if you find it, provide the full path to it as: --with-apxs=/path/to/apxs

    You might also want other flags on this configure line. --with-mysql is just an example. ===

    Now why would you assume that you could build the Apache module version without the --with-apxs flag?

    -Rasmus

    On Thu, 25 Apr 2002, Larry Brown wrote:

    > I ended up using a port which eventually worked. I parsed the INSTALL file > and it didn't mention anything about specifically adding libphp4.so. It > mentioned checking the flags available with ./configure -help which I ran. > But I had no way of knowing what apxs means. It mentioned -with-apxs in the > INSTALL description but stated that if I got an error to physically locate > apxs and tell configure where it is. I did a search for apxs* with no > results. Anyway, I did get it going. Thank you for the input. > > Larry S. Brown MCSE > Dimension Networks, Inc. > Member ICCA > (727) 723-8388 > > -----Original Message----- > From: Rasmus Lerdorf [mailto:rasmuslerdorf.ca] > Sent: Thursday, April 25, 2002 12:40 AM > To: Larry Brown > Cc: PHP List > Subject: RE: [PHP] compiling on freebsd > > Please read the INSTALL file. The default is to make the command line php > binary if you do not provide any ./configure flags, so simply typing > ./configure && make && make install should have installed > /usr/local/bin/php and it would not have built a libphp4.so. For that you > need to add --with-apxs > > -Rasmus > > On Thu, 25 Apr 2002, Larry Brown wrote: > > > I don't mean to be rude but as I mentioned in my post "After running > > ./configure make and make install...". Please review my post for the > actual > > problem. > > > > Larry S. Brown MCSE > > Dimension Networks, Inc. > > Member ICCA > > (727) 723-8388 > > > > -----Original Message----- > > From: Evan Nemerson [mailto:evancoeus-group.com] > > Sent: Thursday, April 25, 2002 1:25 AM > > To: Larry Brown; php-generallists.php.net > > Subject: Re: [PHP] compiling on freebsd > > > > ./configure > > make > > make install > > > > > > > > On Wednesday 24 April 2002 22:08 pm, you wrote: > > > I am trying to get php installed and working on a freebsd server and I'm > > > used to using linux where it hasn't failed me before. After running > > > ./configure make and make install there is no libphp4.so anywhere on the > > > server. I ran just ./configure and make and then checked the current > > > directories for the file with no positive results. > > > > > > Larry S. Brown MCSE > > > Dimension Networks, Inc. > > > Member ICCA > > > (727) 723-8388 > > > > -- > > Common sense is not so common. > > > > Voltaire > > > > > > > > -- > > 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 >

    attached mail follows:


    On Thu, Apr 25, 2002 at 01:50:17AM -0400, Larry Brown wrote: : : I ended up using a port which eventually worked. I parsed the INSTALL file : and it didn't mention anything about specifically adding libphp4.so. It : mentioned checking the flags available with ./configure -help which I ran. : But I had no way of knowing what apxs means. It mentioned -with-apxs in the : INSTALL description but stated that if I got an error to physically locate : apxs and tell configure where it is. I did a search for apxs* with no : results. Anyway, I did get it going. Thank you for the input.

    Here's the relevants bits of INSTALL, with line numbers to boot.

    % grep -C1 -n libphp4 php-4.2.0/INSTALL 102-$ cd ../apache_1.3.x 103:$ ./configure --prefix=/www --activate-module=src/modules/php4/libphp4.a 104: (The above line is correct! Yes, we know libphp4.a does not exist at this 105- stage. It isn't supposed to. It will be created.)

    --
    226-       ./configure --prefix=/<path>/apache \
    227:                   --activate-module=src/modules/php4/libphp4.a
    228-       make
    --
    239-
    240:      AddModule modules/php4/libphp4.a
    241-
    --
    248-
    249:   For Apache 1.2.x you will also have to look in the libphp4.module file,
    250-   which was copied to the src directory. The EXTRA_LIBS line in the Apache
    251-   Configuration file needs to be set to use the same libs as specified on
    252:   the LIBS line in libphp4.module. You also need to make sure to add
    253-   "-L." to the beginning of the EXTRA_LIBS line.
    --
    259-   NOTE: You should not enclose the EXTRA_LIBS line in double-quotes, as it
    260:   is in the libphp4.module file.
    261-
    262:   Also, look at the RULE_WANTHSREGEX setting in the libphp4.module file 
    263-   and set the WANTHSREGEX directive accordingly in your Configuration file.
    --
    282-
    283:      LoadModule php4_module libexec/libphp4.so
    284-
    285:   The actual path before the libphp4.so part might differ slightly.  This
    286-   is likely fine.  If you are paranoid you can examine the output from the
    287:   make install step to see where the libphp4.so file was actually put and
    288-   place the full path to this file on this LoadModule line.
    

    -- Eugene Lee eugenefsck.net

    attached mail follows:


    what are you using for your flags when you do ./configure

    normal should be ./configure --with-apxs=/usr/local/apache/bin/apxs

    Things like that. if you ran ./configure nothing will compile the libphp4 for you. there is a Install file which will walk you thru the setup also on the manual on php.net under installation there is a freebsd section.

    Christopher Riordan http://www.hal-9000.net

    ----- Original Message ----- From: "Larry Brown" <larry.browndimensionnetworks.com> To: "PHP List" <php-generallists.php.net> Sent: Thursday, April 25, 2002 1:30 AM Subject: RE: [PHP] compiling on freebsd

    > I don't mean to be rude but as I mentioned in my post "After running > ./configure make and make install...". Please review my post for the actual > problem. > > Larry S. Brown MCSE > Dimension Networks, Inc. > Member ICCA > (727) 723-8388 > > -----Original Message----- > From: Evan Nemerson [mailto:evancoeus-group.com] > Sent: Thursday, April 25, 2002 1:25 AM > To: Larry Brown; php-generallists.php.net > Subject: Re: [PHP] compiling on freebsd > > ./configure > make > make install > > > > On Wednesday 24 April 2002 22:08 pm, you wrote: > > I am trying to get php installed and working on a freebsd server and I'm > > used to using linux where it hasn't failed me before. After running > > ./configure make and make install there is no libphp4.so anywhere on the > > server. I ran just ./configure and make and then checked the current > > directories for the file with no positive results. > > > > Larry S. Brown MCSE > > Dimension Networks, Inc. > > Member ICCA > > (727) 723-8388 > > -- > Common sense is not so common. > > Voltaire > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > >

    attached mail follows:


    The commercial server where my pages are hosted is having trouble with the lastest version of PHP and as a result the mail() function is not working. E-mailing from PHP is critical for my postcard and other functions on my site. (I might as well shut four of my sites without e-mail.)

    Is there a fall-back option from PHP to send mail when the mail() function is not working?

    John Hughes

    __________________________________________________ Do You Yahoo!? Yahoo! Games - play chess, backgammon, pool and more http://games.yahoo.com/

    attached mail follows:


    php.net/fsockopen php.net/sockets

    Have fun ;

    On Wednesday 24 April 2002 22:14 pm, you wrote: > The commercial server where my pages are hosted is having trouble > with the lastest version of PHP and as a result the mail() function > is not working. E-mailing from PHP is critical for my postcard and > other functions on my site. (I might as well shut four of my sites > without e-mail.) > > Is there a fall-back option from PHP to send mail when the mail() > function is not working? > > John Hughes > > __________________________________________________ > Do You Yahoo!? > Yahoo! Games - play chess, backgammon, pool and more > http://games.yahoo.com/

    -- 
    The search for truth is more precious than its possession.
    

    Albert Einstein

    attached mail follows:


    Just to flesh it out a little more....

    Split the address up and get the domain name (the part after the ).

    Do a DNS lookup on that domain name for an MX record.

    If that fails, look for an A record.

    If that fails, give up.

    If you got an address, open a socket connection to that address, port 25.

    Wait for a line beginning with 2

    Send HELO\n

    Wait for a line beginning with 250

    Send MAIL FROM:<originatingaddress.org>\n

    Wait for a line beginning with 250

    Send RCPT TO:<destinationaddress.org>\n

    Wait for a line beginning with 250

    Send DATA\n

    Wait for a line beginning with 3

    Send your entire message, including headers.

    Send a blank line containing only a period followed by \n

    Wait for a line beginning with 250

    Send QUIT\n

    Close connection.

    miguel

    On Wed, 24 Apr 2002, Evan Nemerson wrote: > php.net/fsockopen > php.net/sockets > > Have fun ; > > > > On Wednesday 24 April 2002 22:14 pm, you wrote: > > The commercial server where my pages are hosted is having trouble > > with the lastest version of PHP and as a result the mail() function > > is not working. E-mailing from PHP is critical for my postcard and > > other functions on my site. (I might as well shut four of my sites > > without e-mail.) > > > > Is there a fall-back option from PHP to send mail when the mail() > > function is not working? > > > > John Hughes > > > > __________________________________________________ > > Do You Yahoo!? > > Yahoo! Games - play chess, backgammon, pool and more > > http://games.yahoo.com/ > >

    attached mail follows:


    I would think even if your host can't get the mail function in PHP to work, they probably have a functioning SMTP server you can use, in which case this class should do the trick for you: http://www.phpclasses.org/browse.html/package/264.html

    Let me know if you want a hosting provider that provides PHP working with the mail function! :)

    HTH,

    Peter Janett

    New Media One Web Services ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ New Upgrades Are Now Live!!! Windows 2000 accounts - Cold Fusion 5.0 and Imail 7.1 Sun Solaris (UNIX) accounts - PHP 4.1.2, mod_perl/1.25, Stronghold/3.0 (Apache/1.3.22), MySQL 3.23.43 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ PostgreSQL coming soon!

    http://www.newmediaone.net webmasternewmediaone.net (303)828-9882

    ----- Original Message ----- From: "Miguel Cruz" <mncstoic.net> To: "John Hughes" <jlhughesyahoo.com> Cc: <php-generallists.php.net> Sent: Thursday, April 25, 2002 1:06 AM Subject: Re: [PHP] alternatives to mail()

    > Just to flesh it out a little more.... > > Split the address up and get the domain name (the part after the ). > > Do a DNS lookup on that domain name for an MX record. > > If that fails, look for an A record. > > If that fails, give up. > > If you got an address, open a socket connection to that address, port 25. > > Wait for a line beginning with 2 > > Send HELO\n > > Wait for a line beginning with 250 > > Send MAIL FROM:<originatingaddress.org>\n > > Wait for a line beginning with 250 > > Send RCPT TO:<destinationaddress.org>\n > > Wait for a line beginning with 250 > > Send DATA\n > > Wait for a line beginning with 3 > > Send your entire message, including headers. > > Send a blank line containing only a period followed by \n > > Wait for a line beginning with 250 > > Send QUIT\n > > Close connection. > > miguel > > On Wed, 24 Apr 2002, Evan Nemerson wrote: > > php.net/fsockopen > > php.net/sockets > > > > Have fun ; > > > > > > > > On Wednesday 24 April 2002 22:14 pm, you wrote: > > > The commercial server where my pages are hosted is having trouble > > > with the lastest version of PHP and as a result the mail() function > > > is not working. E-mailing from PHP is critical for my postcard and > > > other functions on my site. (I might as well shut four of my sites > > > without e-mail.) > > > > > > Is there a fall-back option from PHP to send mail when the mail() > > > function is not working? > > > > > > John Hughes > > > > > > __________________________________________________ > > > Do You Yahoo!? > > > Yahoo! Games - play chess, backgammon, pool and more > > > http://games.yahoo.com/ > > > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php >

    attached mail follows:


    I have one question that I've been working about. When you setup a session to last a particular time say 1 week. If the user comes back to that page because the week is over to reset the session does the user then at that time reset the timer to yet another week. I'm trying to figure out a way to set something like this up so that if they choose not to come back for a period of time the session will delete but if they do come back it will just reset for another week . If i'm just blabbing at the mouth and this doesn't make any sense let me know. Thanks for the help.

    --Smileyq

    attached mail follows:


    Whatever I tried ,it is also useless,why? This time I compile it with freetype-1.3.1.when I used the test code , it also said "libgd was not built with FreeType font support in /usr/local/apache/htdocs/test.php on line 14". Would you mind tell me how you do this? I just wanna support FreeType font in my gd so as to use gd function like ImageTTFText ,etc. Thank you zhaoxd > It works fine. Spell Header() right, or remove the header altogether so > you can see the error message. I predict you will see a message telling > you it couldn't open the font file. > > -Rasmus > > On Thu, 25 Apr 2002, zhaoxd wrote: > > > hello,all: > > > > I have already installed gd-1.8.4 in php-4.1.2 with some libraries,such as libpng -1.2.0,freetype-1.3,zlib-1.1.4,freetype2,in my apache server which version is 1.3.24,and "phpinfo()" display php can support such soft,as follow: > > GD Support---------------------------enabled > > GD Version---------------------------1.6.2 or higher > > FreeType Support---------------------enabled > > FreeType Linkage---------------------with freetype > > JPG Support--------------------------enabled > > PNG Support--------------------------enabled > > WBMP Support-------------------------enabled > > > > But when I used the function related with ttf,like ImageTTFText or ImageTTFBox,I found it useless,in other words,no pictures were displayed in my IE. > > I don't understand why,is gd-1.8.4 can not support these functions? > > > > ps:my test code > > <? > > //define the type of inputting picture; > > Heder("content-type:image/png"); > > //create picture > > $pic=imagecreate(240,30); > > //define color > > $black=imagecolorallocate($pic,0,0,0); > > $white=imagecolorallocate($pic,255,255,255); > > //define font copied from windows2000 > > $font="fonts/simhei.ttf"; > > //define characters to output > > $str = chr(0xE8).chr(0xB5).chr(0x9B).chr(0xE8).chr(0xBF).chr(0xAA).chr(0xE7).chr(0xBD).chr(0 > > x91)." www.ccidnet.com"; > > //write ttf in picture > > imageTTFText($pic,20,0,10,20,$white,$font,$str); > > //create png picture > > imagepng($pic); > > //release the memory occupied by the picture > > imagedestroy($pic); > > ?> > > > > Can anybody give a reply? > > > > Thank you > > zhaoxd > > > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > >

    attached mail follows:


    No idea, check your config.log and see why it is failing.

    On Thu, 25 Apr 2002, zhaoxd wrote:

    > > Whatever I tried ,it is also useless,why? > > This time I compile it with freetype-1.3.1.when I used the test code , it also said "libgd was not built with FreeType font support in /usr/local/apache/htdocs/test.php on line 14". > > Would you mind tell me how you do this? I just wanna support FreeType font in my gd so as to use gd function like ImageTTFText ,etc. > > Thank you > zhaoxd > > > It works fine. Spell Header() right, or remove the header altogether so > > you can see the error message. I predict you will see a message telling > > you it couldn't open the font file. > > > > -Rasmus > > > > On Thu, 25 Apr 2002, zhaoxd wrote: > > > > > hello,all: > > > > > > I have already installed gd-1.8.4 in php-4.1.2 with some libraries,such as libpng -1.2.0,freetype-1.3,zlib-1.1.4,freetype2,in my apache server which version is 1.3.24,and "phpinfo()" display php can support such soft,as follow: > > > GD Support---------------------------enabled > > > GD Version---------------------------1.6.2 or higher > > > FreeType Support---------------------enabled > > > FreeType Linkage---------------------with freetype > > > JPG Support--------------------------enabled > > > PNG Support--------------------------enabled > > > WBMP Support-------------------------enabled > > > > > > But when I used the function related with ttf,like ImageTTFText or ImageTTFBox,I found it useless,in other words,no pictures were displayed in my IE. > > > I don't understand why,is gd-1.8.4 can not support these functions? > > > > > > ps:my test code > > > <? > > > //define the type of inputting picture; > > > Heder("content-type:image/png"); > > > //create picture > > > $pic=imagecreate(240,30); > > > //define color > > > $black=imagecolorallocate($pic,0,0,0); > > > $white=imagecolorallocate($pic,255,255,255); > > > //define font copied from windows2000 > > > $font="fonts/simhei.ttf"; > > > //define characters to output > > > $str = chr(0xE8).chr(0xB5).chr(0x9B).chr(0xE8).chr(0xBF).chr(0xAA).chr(0xE7).chr(0xBD).chr(0 > > > x91)." www.ccidnet.com"; > > > //write ttf in picture > > > imageTTFText($pic,20,0,10,20,$white,$font,$str); > > > //create png picture > > > imagepng($pic); > > > //release the memory occupied by the picture > > > imagedestroy($pic); > > > ?> > > > > > > Can anybody give a reply? > > > > > > Thank you > > > zhaoxd > > > > > > > > > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > > >

    attached mail follows:


    Hello!

    I'm trying to find out on which rank my side is at google automatically. I'm trying the following code, but I get a strange error:

    $Url = "http://www.google.de/search?q=MySearchWord"; // Gives "Warning: No error on line [where fopen is]" $Url = "http://www.google.de/"; // Works

    for ($i = 0; $i < 100; $i += 10) { $fp = fopen($Url, "r"); while($fp && !feof($fp)) { $sLine .= fgets($fp, 4096); } ... do some further things with $sLine fclose($fp); }

    How can I get more information about the error occuring? "Warning: No error" is not much information...

    Martin

    attached mail follows:


    On Thursday 25 April 2002 16:39, Martin Thoma wrote: > Hello! > > I'm trying to find out on which rank my side is at google automatically. > I'm trying the following code, but I get a strange error: > > $Url = "http://www.google.de/search?q=MySearchWord"; // Gives "Warning: > No error on line [where fopen is]" > $Url = "http://www.google.de/"; // Works > > for ($i = 0; $i < 100; $i += 10) > { $fp = fopen($Url, "r"); > while($fp && !feof($fp)) > { $sLine .= fgets($fp, 4096); > } > ... do some further things with $sLine > fclose($fp); > } > > How can I get more information about the error occuring? "Warning: No > error" is not much information...

    Google is probably trying to send you a cookie in which case you cannot use fopen. You need to use curl or snoopy(?).

    -- 
    Jason Wong -> Gremlins Associates -> www.gremlins.com.hk
    Open Source Software Systems Integrators
    * Web Design & Hosting * Internet & Intranet Applications Development *
    

    /* When the wind is great, bow before it; when the wind is heavy, yield to it. */

    attached mail follows:


    > Google is probably trying to send you a cookie in which case you cannot use > fopen. You need to use curl or snoopy(?).

    Thanx, that could be the problem. Unfortunatly, curl is not compiled in my php-version, and what is snoopy?! ;-) Any other ideas/examples?

    Martin

    attached mail follows:


    At 25.04.2002 11:01, you wrote: > > > Google is probably trying to send you a cookie in which case you cannot use > > fopen. You need to use curl or snoopy(?). > >Thanx, that could be the problem. Unfortunatly, curl is not compiled in my >php-version, and what is snoopy?! ;-) Any other ideas/examples? > >Martin snoopy is a class which lets you fetch pages from the web, like you want to do. It supports cookies,https and some other stuff useful for fetching pages from the web. Look at sourceforge to get the latest release. This is one of my favours ;-) Oliver

    attached mail follows:


    Ah, it works with fsockopen:

    $fp = fsockopen ("www.google.com", 80, $errno, $errstr, 30); if (!$fp) { print "Fehler: $errstr ($errno)\n"; } else { fputs ($fp, "GET / HTTP/1.0\r\nHost: $Url\r\n\r\n"); while (!feof($fp)) { $sLine .= fgets ($fp, 4096); } } fclose ($fp);

    attached mail follows:


    I'm developing a website that has the unlucky situation of being situated on a host that does not have CURL installed on it.

    This is basically what I'm trying to do:

    $ch = curl_init(); /// initialize a cURL session curl_setopt ($ch, CURLOPT_URL,"https://www.ups.com/ups.app/xml/Rate"); /// set the post-to url (do not include the ?query+string here!) curl_setopt ($ch, CURLOPT_HEADER, 0); /// Header control curl_setopt($ch, CURLOPT_POST, 1); /// tell it to make a POST, not a GET curl_setopt($ch, CURLOPT_POSTFIELDS, "$y"); /// put the query string here starting with "?" curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1); /// This allows the output to be set into a variable $xyz $xyz = curl_exec ($ch); /// execute the curl session and return the output to a variable $xyz curl_close ($ch); /// close the curl session

    Basically what this will do is send an XML file to UPS, to get shipping rates which are returned as an XML file from UPS. The script has to sit and wait for an answer from the UPS servers. Does anybody know of a way of doing this without using CURL?

    Jason Cathcart

    attached mail follows:


    Hi All,

    I have searched all over the web for an answer to this, but I can't seem to find one :(

    I have a custom Apache installation with mod_ssl, mod_perl mod_php and Chili!Soft's mod_casp.

    When I originally compiled this, I didn't need LDAP support from php, so it wasn't compiled into it. Now I need LDAP support, I have tried re-compiling and am having problems.

    When I compile with --with-ldap everytime I start Apache, it fails and reports this error in error_log :

    Syntax error on line 1158 of /usr/local/apache/conf/httpd.conf: Invalid command 'SSLEngine', perhaps mis-spelled or defined by a module not included in the server configuration

    If I compile without --with-ldap then Apache works with no problems.

    Does anyone have an idea what I am doing wrong? Is this a common problem? Does anyone know what I can do to fix it? I have tried using PHP 4.2.0, but this produces the same problem...

    I have included my compile options below :

    OpenSSL (v 0.9.6b) # cd /usr/src/openssl-0.9.6b/ # sh config no-idea no-threads -fPIC # make # make test

    mod_ssl (v2.8.5-1.3.22) # cd ../mod_ssl-2.8.5-1.3.22/ # ./configure --with-apache=/usr/src/apache_1.3.22

    mod_perl (v1.26) # cd ../mod_perl-1.26/ # perl Makefile.PL \ > EVERYTHING=1 \ > APACHE_SRC=../apache_1.3.22/src \ > USE_APACI=1 \ > PREP_HTTPD=1 \ > DO_HTTPD=1

    Apache (v1.3.22) # cd ../apache_1.3.22/ # SSL_BASE=/usr/src/openssl-0.9.6b \ ./configure \ --prefix=/usr/local/apache/ \ --enable-module=env \ --enable-module=setenvif \ --enable-module=mime \ --enable-module=mime_magic \ --enable-module=negotiation \ --enable-module=alias \ --enable-module=userdir \ --enable-module=dir \ --enable-module=autoindex \ --enable-module=access \ --enable-module=auth \ --enable-module=asis \ --enable-module=include \ --enable-module=cgi \ --enable-module=actions \ --enable-module=status \ --enable-module=info \ --enable-module=log_config \ --enable-module=imap \ --activate-module=src/modules/perl/libperl.a \ --add-module=mod_frontpage.c \ --enable-module=ssl \ --enable-shared=max \ --disable-shared=perl # make # make certificate # make install

    PHP # cd php # ./configure \ > --with-apxs=/usr/local/apache/bin/apxs \ > --with-mysql=/usr/local/mysql > --with-ldap # make # make install # cp php.ini-dist /usr/local/lib/php.ini

    -- 
    Thanks
    

    Andrew McCall Internet System Administrator I.C.T. Division Oldham MBC Civic Centre West Street Oldham OL1 1UU

    Tel : 0161 911 3990 Fax : 0161 911 3998 Email : it.andrew.mccalloldham.gov.uk

    ********************************************************************** This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify the system manager.

    This footnote also confirms that this email message has been swept by MIMEsweeper for the presence of computer viruses.

    www.oldham.gov.uk **********************************************************************

    attached mail follows:


    http://www.php.net/manual/en/language.variables.predefined.php says:

    -------------- In PHP 4.2.0 and later, the default set of predefined variables which are available in the global scope has changed. Individual input and server variables are by default no longer placed directly into the global scope; rather, they are placed into the following superglobal arrays. You can still force the old behaviour by setting register_globals to 'On' in your php.ini file. --------------

    Changing php.ini is not an option in most virtual servers.

    Is there a way to reliably detect PHP version and have $PHP_SELF replaced with $_SERVER['PHP_SELF'] when executed in 4.2 or newer?

    This way I would avoid putting out separate versions for PHP 4.2 or newer.

    Thanks,

    Pekka http://photography-on-the.net/ee/

    ------------------------- Pekka Saarinen http://photography-on-the.net -------------------------

    attached mail follows:


    > -----Original Message----- > From: Pekka Saarinen [mailto:contactssci.fi] > Sent: 25 April 2002 11:05 > > Is there a way to reliably detect PHP version and have > $PHP_SELF replaced > with $_SERVER['PHP_SELF'] when executed in 4.2 or newer?

    What about:

    if (isset($_SERVER)) $PHP_SELF = $_SERVER['PHP_SELF'];

    Cheers!

    Mike

    --------------------------------------------------------------------- Mike Ford, Electronic Information Services Adviser, Learning Support Services, Learning & Information Services, JG125, James Graham Building, Leeds Metropolitan University, Beckett Park, LEEDS, LS6 3QS, United Kingdom Email: m.fordlmu.ac.uk Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211

    attached mail follows:


    Hello, sorry this off-topic msg but I don't know how to solve subscription problem to this list. Due yahoo email changes (no more pop services), I am trying to subscribe this list using alternate email address (meumeucat.com) but receive

    ========= Hi. This is the qmail-send program at pb1.pair.com. I'm afraid I wasn't able to deliver your message to the following addresses. This is a permanent error; I've given up. Sorry it didn't work out.

    <php-general-digestlists.php.net>: ezmlm-manage: fatal: I don't accept messages at this address (inlocal and/or inhost don't match) (#5.1.1) =========

    Does anybody know the reason for this one?

    Thanks

    Mig

    (please cc to meumeucat.com )

    _______________________________________________________________________________________________ Yahoo! Empregos O trabalho dos seus sonhos pode estar aqui. Cadastre-se hoje mesmo no Yahoo! Empregos e tenha acesso a milhares de vagas abertas! http://br.empregos.yahoo.com/

    attached mail follows:


    How can i display a dynamic page showing last month and next month and the month before

    eg this moth is <?php echo date("j-M-Y H:i"); ?> how do i add 1 to the month or -1 to the month?

    attached mail follows:


    I strongly recommend reading the date section of the manual... it takes all of 5 minutes, and you would have come across strtodate():

    http://www.php.net/manual/en/function.strtotime.php

    ... which can accept almost any English date/time phrase (like "next month"), and convert it to a Unix time stamp... combined with date()'s ability to accept a given timestamp (as well as the current time), you get exactly what you want in three lines :)

    <?

    $today = date("j-M-Y H:i"); $next_month = date("j-M-Y H:i",strtotime("next month")); $last_month = date("j-M-Y H:i",strtotime("last month"));

    echo "Last Month: $last_month <BR>"; echo "Today: $today <BR>"; echo "Next Month: $next_month <BR>";

    ?>

    It gets a little more complex when you're not dealing with the current server time I think... but that wasn't your question.

    Justin French -------------------- Creative Director http://Indent.com.au --------------------

    on 25/04/02 8:46 PM, Craig (craigsitedesign.net) wrote:

    > How can i display a dynamic page showing last month and next month and the > month before > > eg > this moth is <?php echo date("j-M-Y H:i"); ?> > how do i add 1 to the month or -1 to the month? > >

    attached mail follows:


    In article <3CC6D8E4.4080706mdah.state.ms.us>, jtatemdah.state.ms.us says... > What's the best programming method to use to search terms that are non > adjacent?

    What exactly do you mean? Are you looking at a SQL query, or...

    -- 
    David Robley
    Temporary Kiwi!
    

    Quod subigo farinam

    attached mail follows:


    hi there,

    i´m sorry to post that stupid message, but i really need help in finding the solution to a maybe small problem.

    I´m trying to do a simple file upload (jpeg) with the "copy" function. the destination directory is set to chmod 0777, the files are copied to this directory (with the correct extension .jpg), but if i try to open them, the files seem to be corrupt. (the filesize seems to be o.k.). i tried several upload-scripts to test the situation, but the result is everytime the same.

    on my test-server, i´m running Yellow Dog Linux (PPC) with PHP4.0.4pl1. I tried the uploads from different browsers.

    Can anybody pls help me find the bug ??

    thanx!!!!

    best regards,

    walter

    attached mail follows:


    have you included the MAX_FILE_SIZE hidden field? If yes try increasng the value to above the image size "Walter Enzenhofer" <officebildlauf.at> wrote in message news:B8EDAD10.1EB%officebildlauf.at... > hi there, > > i´m sorry to post that stupid message, but i really need help in finding the > solution to a maybe small problem. > > > I´m trying to do a simple file upload (jpeg) with the "copy" function. > the destination directory is set to chmod 0777, the files are copied to this > directory (with the correct extension .jpg), but if i try to open them, the > files seem to be corrupt. (the filesize seems to be o.k.). i tried several > upload-scripts to test the situation, but the result is everytime the same. > > on my test-server, i´m running Yellow Dog Linux (PPC) with PHP4.0.4pl1. > I tried the uploads from different browsers. > > > Can anybody pls help me find the bug ?? > > > thanx!!!! > > best regards, > > walter >

    attached mail follows:


    Hi,

    Having some issues with the session.save_path value in php.ini

    Whatever I change this value to it always ends up trying to save the temporary session info in /tmp (the default setting in php.ini).

    I can overide the value by settin