OSEC

Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com
 
php-general-digest-help_at_lists.php.net
Date: Tue Jul 30 2002 - 22:49:29 CDT

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

    php-general Digest 31 Jul 2002 03:49:29 -0000 Issue 1496

    Topics (messages 110355 through 110451):

    Re: Sorting Output
            110355 by: 1LT John W. Holmes

    Re: Problem of characters with xml_parse
            110356 by: Rasmus Lerdorf

    Hide the undefined offset error for the array?
            110357 by: Scott Fletcher
            110360 by: Rasmus Lerdorf
            110371 by: 1LT John W. Holmes

    Re: php 4.2.2 and 4.0.6
            110358 by: Scott Fletcher
            110363 by: EdwardSPL.ita.org.mo
            110372 by: Scott Fletcher

    Re: apache and php
            110359 by: Scott Fletcher
            110364 by: EdwardSPL.ita.org.mo
            110365 by: Rasmus Lerdorf
            110369 by: Chris Garaffa

    Re: A somewhat unusual session question...
            110361 by: Scott Fletcher
            110374 by: Lars Olsson
            110383 by: Lars Olsson
            110387 by: Tech Support

    Re: What is REGEX ?
            110362 by: Mike Mannakee

    how to debug mail() problem?
            110366 by: Kevin Porter
            110368 by: Manuel Lemos
            110373 by: Lee Doolan

    Re: Sendmail "return-path" from my virtual webhost
            110367 by: Al
            110370 by: Manuel Lemos

    Internationalization
            110375 by: Jeb A. Scarbrough \(home\)

    Re: Good books on sessions
            110376 by: Petre
            110412 by: Petre
            110432 by: Justin French

    Re: Credit Card Validation With Expiration Date
            110377 by: Tech Support

    Dynamic Web Pages
            110378 by: Rolando Morales
            110390 by: Lars Olsson

    enabling mysql support
            110379 by: Joel Lopez
            110380 by: Rasmus Lerdorf

    Re: Auto Increment Problems....
            110381 by: Tony Harrison
            110409 by: Scott Hurring
            110413 by: Joel Boonstra

    mcrypt
            110382 by: Purushotham Komaravolu
            110393 by: Purushotham Komaravolu
            110400 by: Tech Support

    Re: searching an array for words starting with 'p'
            110384 by: Tech Support
            110385 by: Joseph Rosenblum
            110435 by: Evgeny Chuykov

    PHP4 and MS Excel?
            110386 by: Jason Caldwell
            110388 by: Jome
            110394 by: Jason Caldwell
            110408 by: Brian V Bonini
            110410 by: Jason Caldwell
            110433 by: Martin Towell

    PDF_function HELP again!!! :(
            110389 by: Jeffrey
            110391 by: Jeffrey
            110395 by: Rasmus Lerdorf
            110424 by: Jeffrey
            110425 by: Rasmus Lerdorf
            110427 by: Jeffrey

    $row and alias
            110392 by: Saci
            110436 by: 1LT John W. Holmes

    Serialised Data & DBs
            110396 by: Danny Shepherd
            110397 by: Rasmus Lerdorf
            110401 by: 1LT John W. Holmes
            110421 by: Danny Shepherd
            110451 by: Tom Rogers

    how to apply php patch file: 4.2.1 -> 4.2.2
            110398 by: gk.proliberty.com

    Mail Form
            110399 by: Kerry Gray
            110402 by: Kerry Gray
            110404 by: Rasmus Lerdorf
            110405 by: Damian Harouff
            110406 by: Jason Wong
            110407 by: Kerry Gray
            110411 by: Kerry Gray
            110418 by: Kerry Gray
            110450 by: Bob Lockie

    Trouble Making 4.2.2
            110403 by: David Busby
            110422 by: Danny Shepherd

    passing variable via url ( newbye question)
            110414 by: Saci
            110416 by: Martin Clifford
            110419 by: cteubner.ncw-av.com
            110437 by: Martin Towell

    PHP mail() problems
            110415 by: John Williams
            110417 by: Rasmus Lerdorf

    Re: [PHP-DEV] [CROSS POST] PHP Meetup & Texas PHP Users
            110420 by: Gabriel Ricard

    Re: Sessions - Informed Opinions
            110423 by: Danny Shepherd

    Re: open or save problem
            110426 by: Daniel Grace
            110429 by: Dylan Miller

    Re: need help with uploading images
            110428 by: Deadsam

    PDFlib --pixels?
            110430 by: Oscar F

    PDFlib --pixels? 2
            110431 by: Oscar F

    How to become a good PHP coder?
            110434 by: Wee Keat
            110439 by: Justin French
            110440 by: César Aracena
            110441 by: Wee Keat
            110442 by: Martin Towell

    Re: Public Scripts in a commercial product
            110438 by: Danny Shepherd

    help with crash on make
            110443 by: Kirk Babb
            110444 by: Pushkar Pradhan
            110445 by: Kirk Babb

    SMS message ?
            110446 by: Rija
            110448 by: SenthilVelavan

    Re: fullname
            110447 by: CC Zona

    Reg-PHP4.22 and Apache1.3.26 Installation
            110449 by: SenthilVelavan

    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:


    How are you displaying it? Show us some code...

    ---John Holmes...

    ----- Original Message -----
    From: "Brian V Bonini" <b-boninicox.net>
    To: "PHP Lists" <php-generallists.php.net>
    Sent: Tuesday, July 30, 2002 11:52 AM
    Subject: [PHP] Sorting Output

    > I have a db with the following fields:
    >
    > id | month | company | title | name | role | show_company | show_title |
    > show_month
    >
    > sql query is: "select * FROM db ORDER BY month DESC";
    >
    > Output gets formatted like:
    >
    > month
    > - company
    > - title
    > name role
    > name role
    > - title
    > name role
    > - company
    > - title
    > name role
    > name role
    > name role
    >
    >
    > The occurrence of the number of fields within each heading is not static.
    >
    > The oldest data sits at the "beginning" of the db so the order by month
    desc
    > sorts the output from newest to oldest. Fine so far.
    >
    > Now, as new data gets added to the db sometimes some of it refers to past
    > months. So although the order by month clause will move the new data to
    the
    > correct month it will not move it into the correct heading (company) and
    > sub_heading (title). I've tried using group by and using multiple fields
    in
    > the order by but can not get the results I'm looking for, any suggestions?
    >
    > -Brian
    >
    >
    > --
    > PHP General Mailing List (http://www.php.net/)
    > To unsubscribe, visit: http://www.php.net/unsub.php
    >

    attached mail follows:


    Can't you just use CDATA blocks?

    Personally I'd either use an entity reference or base64 the stuff.

    -Rasmus

    On Tue, 30 Jul 2002, Sebastien Mole wrote:

    > Hello,
    >
    > I have a question concerning characters : I use the function xml_parse on a standalone XML file with the encoding "ISO-8859-1"
    > and I want to parse it. It contains all types of characters (including control characters, so ASCII characters from x0000 to x00FF) so as to send and receive images, is it possible?
    > I noticed that special characters such as "&" "<" ">" """ "'" have to be replaced in regard of the W3C definition of XML, and that character such as chr(9) tabulation, chr(10) line feed, and chr(13) carriage return are supported by the function xml_parse (replaced repectively by &#9; &#10; &#13; but when I try to parse characters such as chr(#x0001) or chr(#x001F) (or others) the parser returns me an error even if I replace them by &#x (x is the decimal ASCII code of the character). Have you got an idea about it?
    > I tried to find out an answer in the expat scripts used by the function, without any results.
    >
    > Thank you for your answering.
    >
    >
    >
    > Best regards.
    >
    > Sébastien Molé.
    > reply to: smoleatomis.com
    >
    >

    attached mail follows:


    I have one of the website on windows and I get the undefined offset error, I
    don't have that problem on UNIX / Linux. Anyone know what method would
    work?? Here's the script! In this case, the $raw_data array is empty, so
    window complain of the empty data by displaying hte error message,
    "Undefined offset ........".

    --clip--
    if ($raw_data[$num_count] != $match_array[$x]) {
    --clip--

    Thanks!
     FletchSOD

    attached mail follows:


    Your default error reporting level must be set different on your Windows
    box. If you turn off E_NOTICE warnings on your Windows box it will act
    the same as your Linux box.

    But, in general, to write E_ALL clean code you would check if each exists
    first, or swallow the errors if you know that these indices may not be
    present using something like this:

    if ($raw_data[$num_count] != $match_array[$x]) {

    -Rasmus

    On Tue, 30 Jul 2002, Scott Fletcher wrote:

    > I have one of the website on windows and I get the undefined offset error, I
    > don't have that problem on UNIX / Linux. Anyone know what method would
    > work?? Here's the script! In this case, the $raw_data array is empty, so
    > window complain of the empty data by displaying hte error message,
    > "Undefined offset ........".
    >
    > --clip--
    > if ($raw_data[$num_count] != $match_array[$x]) {
    > --clip--
    >
    > Thanks!
    > FletchSOD
    >
    >
    >
    > --
    > PHP General Mailing List (http://www.php.net/)
    > To unsubscribe, visit: http://www.php.net/unsub.php
    >

    attached mail follows:


    > I have one of the website on windows and I get the undefined offset
    error,
    > I
    > don't have that problem on UNIX / Linux. Anyone know what method
    would
    > work?? Here's the script! In this case, the $raw_data array is
    empty, so
    > window complain of the empty data by displaying hte error message,
    > "Undefined offset ........".
    >
    > --clip--
    > if ($raw_data[$num_count] != $match_array[$x]) {
    > --clip--

    It's now a Windows/Unix thing...your installations of PHP have different
    error reporting levels set in PHP.ini. So, either change the error
    reporting in PHP.ini or with the error_reporting() function, hide the
    warning by using , or check and make sure the variable exists before
    you use it.

    if($raw_data[$num_count] != $match_array[$x])

    or...

    if(isset($raw_data[$num_count]) && $raw_data[$num_count] !=
    $match_array[$x])

    Hmm...what are you doing, btw? Are you use you couldn't make use of
    in_array()??

    ---John Holmes...

    attached mail follows:


    Actually, PHP 4.2.2 just have more features than PHP 4.0.6. Example of
    those are more security and more functions as well as many of the other
    things. One disadvantage to it is some programming script will break
    because some PHP features is decommissioned, like functions or someting.

    <EdwardSPLita.org.mo> wrote in message news:3D4662A9.BD34B129ita.org.mo...
    > Hello,
    >
    > Does php 4.2.2 is better than 4.0.6 ?
    > Thank for your telling !
    >
    > Edward.
    >
    >

    attached mail follows:


    So, do you know apache 1.3.22 and php 4.2.2 are good for work with IMP 3.x (
    http://www.horde.org/imp ) under RH 6.2 system ?

    Scott Fletcher wrote:

    > Actually, PHP 4.2.2 just have more features than PHP 4.0.6. Example of
    > those are more security and more functions as well as many of the other
    > things. One disadvantage to it is some programming script will break
    > because some PHP features is decommissioned, like functions or someting.
    >
    > <EdwardSPLita.org.mo> wrote in message news:3D4662A9.BD34B129ita.org.mo...
    > > Hello,
    > >
    > > Does php 4.2.2 is better than 4.0.6 ?
    > > Thank for your telling !
    > >
    > > Edward.
    > >
    > >
    >
    > --
    > PHP General Mailing List (http://www.php.net/)
    > To unsubscribe, visit: http://www.php.net/unsub.php

    attached mail follows:


    You may will want to use hte later version of Apache, the latest stable
    release is 1.3.26 due to one of hte security hole that affect the previous
    version, this security hole would allow the vrius, like worm virus or
    something to go through the security hole. We wouldn't want that.

    By the way, from the look of the www.horde.org/imp website, if you're going
    to use IMP version 3.1 then the requirement on that website stated the
    minimum are PHP version 4.1.0. I'll tell you what's the easiest way, get
    all stable release with the latest version and you should not have a problem
    with it. It would be rare that anyone would have that problem.

    <EdwardSPLita.org.mo> wrote in message news:3D46BD67.B22C189Aita.org.mo...
    > So, do you know apache 1.3.22 and php 4.2.2 are good for work with IMP 3.x
    (
    > http://www.horde.org/imp ) under RH 6.2 system ?
    >
    > Scott Fletcher wrote:
    >
    > > Actually, PHP 4.2.2 just have more features than PHP 4.0.6. Example of
    > > those are more security and more functions as well as many of the other
    > > things. One disadvantage to it is some programming script will break
    > > because some PHP features is decommissioned, like functions or someting.
    > >
    > > <EdwardSPLita.org.mo> wrote in message
    news:3D4662A9.BD34B129ita.org.mo...
    > > > Hello,
    > > >
    > > > Does php 4.2.2 is better than 4.0.6 ?
    > > > Thank for your telling !
    > > >
    > > > Edward.
    > > >
    > > >
    > >
    > > --
    > > PHP General Mailing List (http://www.php.net/)
    > > To unsubscribe, visit: http://www.php.net/unsub.php
    >
    >

    attached mail follows:


    I wouldn't jump on Apache 2.0.39 for the production website and some PHP
    features does not work for that version. That apache is in beta testing
    stage, so it will be a while.

    "Danny Shepherd" <dannykyboshed.com> wrote in message
    news:024501c237b5$f95d8860$0200a8c0DANNYS...
    >
    > ----- Original Message -----
    > From: <EdwardSPLita.org.mo>
    > To: "Danny Shepherd" <dannykyboshed.com>
    > Cc: <php-generallists.php.net>
    > Sent: Tuesday, July 30, 2002 11:30 AM
    > Subject: Re: [PHP] apache and php
    >
    >
    > > Danny Shepherd wrote:
    > >
    > > > For release systems, the recommended setup is Apache 1.3.26 + PHP4.2.2
    > >
    > > They are good for work under Linux RedHat ( 6.x / 7.x ) system ?
    > >
    > Yeah, should be Ok.
    >
    > Danny.
    >
    >

    attached mail follows:


    So, which version of apache and php are the best for working together under any
    OS system ?

    Scott Fletcher wrote:

    > I wouldn't jump on Apache 2.0.39 for the production website and some PHP
    > features does not work for that version. That apache is in beta testing
    > stage, so it will be a while.
    >
    > "Danny Shepherd" <dannykyboshed.com> wrote in message
    > news:024501c237b5$f95d8860$0200a8c0DANNYS...
    > >
    > > ----- Original Message -----
    > > From: <EdwardSPLita.org.mo>
    > > To: "Danny Shepherd" <dannykyboshed.com>
    > > Cc: <php-generallists.php.net>
    > > Sent: Tuesday, July 30, 2002 11:30 AM
    > > Subject: Re: [PHP] apache and php
    > >
    > >
    > > > Danny Shepherd wrote:
    > > >
    > > > > For release systems, the recommended setup is Apache 1.3.26 + PHP4.2.2
    > > >
    > > > They are good for work under Linux RedHat ( 6.x / 7.x ) system ?
    > > >
    > > Yeah, should be Ok.
    > >
    > > Danny.
    > >
    > >
    >
    > --
    > PHP General Mailing List (http://www.php.net/)
    > To unsubscribe, visit: http://www.php.net/unsub.php

    attached mail follows:


    The latest stable versions of both. Apache 1.3.26 and PHP 4.2.2.

    On Wed, 31 Jul 2002 EdwardSPLita.org.mo wrote:

    > So, which version of apache and php are the best for working together under any
    > OS system ?
    >
    > Scott Fletcher wrote:
    >
    > > I wouldn't jump on Apache 2.0.39 for the production website and some PHP
    > > features does not work for that version. That apache is in beta testing
    > > stage, so it will be a while.
    > >
    > > "Danny Shepherd" <dannykyboshed.com> wrote in message
    > > news:024501c237b5$f95d8860$0200a8c0DANNYS...
    > > >
    > > > ----- Original Message -----
    > > > From: <EdwardSPLita.org.mo>
    > > > To: "Danny Shepherd" <dannykyboshed.com>
    > > > Cc: <php-generallists.php.net>
    > > > Sent: Tuesday, July 30, 2002 11:30 AM
    > > > Subject: Re: [PHP] apache and php
    > > >
    > > >
    > > > > Danny Shepherd wrote:
    > > > >
    > > > > > For release systems, the recommended setup is Apache 1.3.26 + PHP4.2.2
    > > > >
    > > > > They are good for work under Linux RedHat ( 6.x / 7.x ) system ?
    > > > >
    > > > Yeah, should be Ok.
    > > >
    > > > Danny.
    > > >
    > > >
    > >
    > > --
    > > 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:


    I'd recommend:
    http://www.apache.org/dist/httpd/Announcement.html -- Apache 1.3.26
    -and-
    http://www.php.net/release_4_2_2.php -- PHP 4.2.2
    Both include the latest bug fixes and are the latest stable releases.
    I've been running these on a RedHat 7.1 box (64MB RAM, 225mHz Pentium),
    with MySQL as well for about 4 months without any problems that weren't
    my fault.

    HTH
    chris
    cgaraffacreativeaim.com

    On Tuesday, July 30, 2002, at 12:25 PM, EdwardSPLita.org.mo wrote:
    > So, which version of apache and php are the best for working together
    > under any
    > OS system ?

    attached mail follows:


    The session.save_path have nothing to do with it. I have that same problem
    with the default path, "/tmp" when the session became a garbage collection
    when the user quit the browser without logging off. When the user quit the
    browser then there's no way for the server to know that, so the session
    stuffs stay active in the session.save_path. You will have to either
    manually clean it up weekly or use crontab to do the clean up for you at
    night-time with the time-range the website is off-limit to the user. This
    is where people do the maintaince also.

    "Lars Olsson" <lassolassoweb.nu> wrote in message
    news:20020730131108.58369.qmailpb1.pair.com...
    > Hi all!
    >
    > The manual claims here (http://se2.php.net/manual/en/ref.session.php)
    that:
    >
    > </snip>
    > ...If session.save_path's path depth is more than 2, garbage collection
    > will not be performed.
    > </snip>
    >
    > Anyone know why this is the case? And can you get around it? My scripts
    > currently lives on a shered server and I wanted to get away from using
    > /tmp (which is the default). I changed the session_save path in my
    > .htaccess file to:
    >
    > /home/httpd/vhosts/mydomainname/httpdocs/sessions/
    >
    > and created some sessions. The creation and destruction of sessions
    > works fine as long as the user logs out correctly, but PHP fails to
    > garbage collect sessions when the user just quits the browser. I've
    > tried changing the session.gc_probability to 100 (and waited until
    > session.gc_maxlifetime had passed), but it still doesn't work. Now I'm
    > stuck with a bunch of "deserted" session files that don't seem to go
    > away. Any ideas on how to solve this?
    >
    > /Lasso (lassolassoweb.nu)
    >

    attached mail follows:


    I'm aware that the server cannot "know" whenever a user just quits
    without logging out, but I was under the impression that the flags
    session.gc_maxlifetime and session.gc_probability in php.ini would
    control when and how often "leftover" session files would be removed. If
    this isn't true, what are these flags actually used for? Pretty
    confusing if you ask me...

    /lasso

    Scott Fletcher wrote:
    > The session.save_path have nothing to do with it. I have that same problem
    > with the default path, "/tmp" when the session became a garbage collection
    > when the user quit the browser without logging off. When the user quit the
    > browser then there's no way for the server to know that, so the session
    > stuffs stay active in the session.save_path. You will have to either
    > manually clean it up weekly or use crontab to do the clean up for you at
    > night-time with the time-range the website is off-limit to the user. This
    > is where people do the maintaince also.

    attached mail follows:


    Hm...seems it works after all...Tried extremely short
    session.gc_maxlifetime and a 100% session.gc_probability...works like a
    charm! Sorry for not checking this thoroughly enough before whining... ;)

    /lasso (lassolassoweb.nu)

    Lars Olsson wrote:
    > Hi all!
    >
    > The manual claims here (http://se2.php.net/manual/en/ref.session.php) that:
    >
    > </snip>
    > ...If session.save_path's path depth is more than 2, garbage collection
    > will not be performed.
    > </snip>
    >
    > Anyone know why this is the case? And can you get around it? My scripts
    > currently lives on a shered server and I wanted to get away from using
    > /tmp (which is the default). I changed the session_save path in my
    > .htaccess file to:
    >
    > /home/httpd/vhosts/mydomainname/httpdocs/sessions/
    >
    > and created some sessions. The creation and destruction of sessions
    > works fine as long as the user logs out correctly, but PHP fails to
    > garbage collect sessions when the user just quits the browser. I've
    > tried changing the session.gc_probability to 100 (and waited until
    > session.gc_maxlifetime had passed), but it still doesn't work. Now I'm
    > stuck with a bunch of "deserted" session files that don't seem to go
    > away. Any ideas on how to solve this?
    >
    > /Lasso (lassolassoweb.nu)
    >

    attached mail follows:


    That last statement was not entirely true.

    The server does not have to know when someone leaves to clean up.

    You are right about session.gc_maxlifetime and session.gc_probability.

    if the maxlifetime is set to 1200 (20 minutes) and the probability is set to
    1 that means that one percent of the time there is session activity on the
    server it will perform the garbage clean up routine. If you set probability
    to 100 then every time someone refreshed or loaded a page that used sessions
    php will look through the session data and remove anything that's older than
    our 20 minute maxlifetime.

    As for your problem, I do not know what to tell you except that you might
    look for an alternative to file type sessions. It is true that php will not
    perform garbage clean up if the path is beyond two dirs up from root. MySQL
    is a popular alternate choice because it's fast and more secure than any
    file that is world readable.

    Jim Grill
    Support
    Web-1 Hosting
    http://www.web-1hosting.net
    ----- Original Message -----
    From: "Lars Olsson" <lassolassoweb.nu>
    To: <php-generallists.php.net>
    Sent: Tuesday, July 30, 2002 12:09 PM
    Subject: [PHP] Re: A somewhat unusual session question...

    > I'm aware that the server cannot "know" whenever a user just quits
    > without logging out, but I was under the impression that the flags
    > session.gc_maxlifetime and session.gc_probability in php.ini would
    > control when and how often "leftover" session files would be removed. If
    > this isn't true, what are these flags actually used for? Pretty
    > confusing if you ask me...
    >
    > /lasso
    >
    >
    >
    > Scott Fletcher wrote:
    > > The session.save_path have nothing to do with it. I have that same
    problem
    > > with the default path, "/tmp" when the session became a garbage
    collection
    > > when the user quit the browser without logging off. When the user quit
    the
    > > browser then there's no way for the server to know that, so the session
    > > stuffs stay active in the session.save_path. You will have to either
    > > manually clean it up weekly or use crontab to do the clean up for you at
    > > night-time with the time-range the website is off-limit to the user.
    This
    > > is where people do the maintaince also.
    >
    >
    > --
    > PHP General Mailing List (http://www.php.net/)
    > To unsubscribe, visit: http://www.php.net/unsub.php
    >
    >
    >

    attached mail follows:


    Look for "regular expressions" in the manual. Regex is just a shortening of
    that.

    Mike

    "Lord Loh." <lord_lohrediffmail.com> wrote in message
    news:20020730050733.73518.qmailpb1.pair.com...
    > Hello! I am new to REGEX.
    > I tried to read several posts on REGEX. However none were descriptive.
    >
    > What is Regex ?
    > Is it a part of the php? or an additional module?
    > What can it be used for ?
    >
    > Please let me know
    > Thank you.
    >
    > Lord Loh.
    >
    >

    attached mail follows:


    Hi,

    I have a loop that sends out a numbers of emails using the mail() function.

    -- Code start ---------------------
        for ( $i=0, $j=count($responders); $i < $j; $i++ )
        {
            $r = $responders[$i];

            $headers = "MIME-Version: 1.0\r\n";
            $headers .= "Content-type: text/html; charset=iso-8859-1\r\n";

            $headers .= "From: $r->FirstName $r->LastName <$r->Email>\r\n";

            echo "sending email to $r->FirstName $r->LastName ($r->Email)<br>";

            if ( !mail( $r->Email, "Subject", $message, $headers ) )
                echo "Failed to send email to $r->FirstName $r->LastName
    ($r->Email)<br>";
        }
    -- Code end ----------------------

    $responders is an array of Responder objects - a Responder object has Email,
    LastName, FirstName member variables.

    My problem is that although the email is sent on each iteration and reaches
    it's intended recipient, I get the "Failed to send email ...." message on
    every loop!

    Anyone know why? mail() is obviously returning false, but the manual says
    "mail() returns TRUE if the mail was successfully accepted for delivery,
    FALSE otherwise". Yet it _must_ have been successfully accepted for
    delivery, because the emails always get delivered.
    Any help would be appreciated.
    thanks,

    - Kev

    **********************************************************************
    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.
    **********************************************************************

    attached mail follows:


    On 07/30/2002 01:27 PM, Kevin Porter wrote:
    > Hi,
    >
    > I have a loop that sends out a numbers of emails using the mail() function.
    >
    > -- Code start ---------------------
    > for ( $i=0, $j=count($responders); $i < $j; $i++ )
    > {
    > $r = $responders[$i];
    >
    > $headers = "MIME-Version: 1.0\r\n";
    > $headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
    >
    > $headers .= "From: $r->FirstName $r->LastName <$r->Email>\r\n";
    >
    > echo "sending email to $r->FirstName $r->LastName ($r->Email)<br>";
    >
    > if ( !mail( $r->Email, "Subject", $message, $headers ) )
    > echo "Failed to send email to $r->FirstName $r->LastName
    > ($r->Email)<br>";
    > }
    > -- Code end ----------------------
    >
    > $responders is an array of Responder objects - a Responder object has Email,
    > LastName, FirstName member variables.
    >
    > My problem is that although the email is sent on each iteration and reaches
    > it's intended recipient, I get the "Failed to send email ...." message on
    > every loop!
    >
    > Anyone know why? mail() is obviously returning false, but the manual says
    > "mail() returns TRUE if the mail was successfully accepted for delivery,
    > FALSE otherwise". Yet it _must_ have been successfully accepted for
    > delivery, because the emails always get delivered.
    > Any help would be appreciated.
    > thanks,

    Mail() has a track record of being very buggy, especially under Windows.

     From that error message it seems that it is getting an unexpected
    response from your server on the QUIT SMTP command.

    Anyway, if all else fails, you may want to try to use this class:

    http://www.phpclasses.org/smtpclass

    maybe in conjunction with this

    http://www.phpclasses.org/mimemessage

    -- 
    

    Regards, Manuel Lemos

    attached mail follows:


    >>>>> "Manuel" == Manuel Lemos <mlemosacm.org> writes: [. . .]

    Manuel> Anyway, if all else fails, you may want to try to use this Manuel> class:

    Manuel> http://www.phpclasses.org/smtpclass

    Manuel> maybe in conjunction with this

    Manuel> http://www.phpclasses.org/mimemessage

    Just by way of affirmation, here --as _though_ it were actually needed-- I've been using the smtpclass for a while now. It rocks.

    -lee

    -- 
    When the birdcage is open,   | donate to causes I care about: 
    the selfish bird flies away, |    http://svcs.affero.net/rm.php?r=leed_25
    but the virtuous one stays.  |
    

    attached mail follows:


    I was hoping there was a way to fix it without having to modify my php scripts [e.g., phpBB2, postlister, etc.]

    Manuel Lemos wrote: > Hello, > > On 07/29/2002 01:54 PM, Al wrote: > >> Emails sent from my php scripts, using sendmail, all have a goofy >> "return-path" variable in the header. >> >> Is there a way I can correct this, or does it require a change to the >> sendmail config file that I can't get to? > > > Yes, you can use mail() 5th argument or call sendmail directly with the > popen using -f switch. > > Take a look at these classes to learn how to do it in case you have doubts: > > http://www.phpclasses.org/mimemessage > >

    attached mail follows:


    Hello,

    On 07/30/2002 01:30 PM, Al wrote: > I was hoping there was a way to fix it without having to modify my php > scripts [e.g., phpBB2, postlister, etc.]

    There is an explicit php.ini option for that but it only works under Windows.

    On Unix, you may also try defining the sendmail path added -freturn-pathmyaddress.com .

    Regards, Manuel Lemos

    > > > Manuel Lemos wrote: > >> Hello, >> >> On 07/29/2002 01:54 PM, Al wrote: >> >>> Emails sent from my php scripts, using sendmail, all have a goofy >>> "return-path" variable in the header. >>> >>> Is there a way I can correct this, or does it require a change to the >>> sendmail config file that I can't get to? >> >> >> >> Yes, you can use mail() 5th argument or call sendmail directly with >> the popen using -f switch. >> >> Take a look at these classes to learn how to do it in case you have >> doubts: >> >> http://www.phpclasses.org/mimemessage >> >> >

    -- 
    

    Regards, Manuel Lemos

    attached mail follows:


    Can someone provide a good source of information on what PHP can and cannot do in regards to making a site multi-lingual. I've found a little information about using gettext but that's about it. Do you have to using a certain charset? Do all functions work with different languages? String functions for example?

    Thanks.

    attached mail follows:


    Yes , I agree,But that is exactly where my problem comes in, when I link the person forward, it DOES NOT take the new value for the project_id, as it is a form element and it only becomes variable on the action page. This is where I'm unsure about how to "initialize" the variable. As mentioned earlier in my posts, I simply do a session_register("project_id"); on the action page, I DO NOT say anything like

    $_SESSION['project_id'] = "45"; or any other form of assignment whatsoever, as I leave the work to register_globals=on and it's normal expected behaviour. And I think this is where the problem lies. It seems I MUST actually do that for things to work??? Unfortunately I cannot test this yet, as I'm busy with something else, and just trying to get the basic academics right. I understand the way you are explaining sessions 100%, but when I put that knowledge to practise, things doesn't seem to work... :( . I am still to test yours and Rasmus' sugestions and will come back shortly.

    Thanks for the help so far.

    Justin French wrote:

    >*shakes head a bit* > >I'm not REALLY sure what the problem is here, but let's take a step back. > >A session ID is a unique, random number assigned to a user as they kick >around your site. > >To maintain state (a session) across multiple pages, you pass the session id >around. This can be done with the URL or cookies. Yes, trans_sid is in >there as well, but all it does is re-write URLs. > >No surprises so far. > > >You then assign variables to the session. If you're using PHP >= 4.1, I'd >use $_SESSION['varname'] = "value"; rather than session_register(), because >it's a lot more logical, and clearer to think through. > >Furthermore, the manual tells us NOT to mix use of session_register('var') >and $_SESSION['var'] = 'value'... so, pick a method, and stick to it... >since the $_SESSION array is the new way, I'd be going with it. > > >So, the first two session vars YOU assign after the user logs in is the >username and password (I wouldn't register the password). > >$_SESSION['username'] = "justin"; >$_SESSION['password'] = "secret"; > > >Then a few pages later, they pick an option from a pull-down list, and you >assign another variable to the session: > >$_SESSION['project_id'] = "45"; > >The user clicks through a few more pages, and later wants to work on a >different project, so you link them through (forward) to the options page. > >They select a new project from the pull down, so you need to overwrite the >old project_id session var with a new one: > >$_SESSION['project_id'] = "74"; > > >Now, when they kick around through pages, they will be doing it under >project_id 74. > >If you wanted to delete the project_id all together (no project), you could >use unset(). > > >Now, go back, and have a look at your code, check out the logic, and I'm >sure you'll see the mistake(s). > > >As far as the "maintaining session forever" thing, I'd highly recommend >it... it's highly insecure (walk away from your computer, someone else has >access to everything)... besides, sessions are a temporary thing by nature, >with garbage cleanouts, etc etc. > >If you really wanted to maintain state 'forever', you would have to set a >cookie with the username and password to that person's computer, hence your >website would 'remember them' all the time. > >Of course there are plenty of reasons why your shouldn't do this. I guess >the client should be informed of the options here: > >1. log in every so-often as needed (if there is lots of activity, the >session probably won't die all day anyway), and have heaps more security > >2. log in once only, and have the whole system wide-open forever > > >I'd pick 1 over 2 anytime. > >I'd also provide a logout button with either system, so that people CHOOSE >TO DESTROY THEIR SESSION. Personally, I log-out when I leave my desk, just >in case. > >Imagine if you left a session open which disclosed everyone's pay rates in >an office... not good for your career at all :) > > >Hope this all helps, > >Justin French > > > > >on 30/07/02 6:04 PM, Petre (internetvsa.co.za) wrote: > >>Yes, it is a forward link to the page, but as mentioned, that page >>contains a form with the selection options, and on that form's action >>page is where I don't see the values change, so the question should >>probably be something like "how do I change the value in the session_var >>with the newly selected value? >>And oh, I almost forgot: >>Due to that fact that this type of app doesn't really have a logical end >>page, I cannot issue a session_destroy() anywhere logically ( except >>using a logout button), but that's not going to ensure that people use it... >>I would ideally like to have this "app" run on an intranet, where people >>will most probably have this app open indefinately, and thus I also >>battle with my logic of keeping a session alive. >> >>Thanks >>. >> >>Rasmus Lerdorf wrote: >> >>>Well, how exactly do you implement the back button? If it is a normal >>>client-side back, then of course the previous value will be shown. If it >>>is actually a forward-link to the previous page, then your logic on that >>>target page is bogus. >>> >>>By the way, trans-sid is compiled in by default in PHP so should always be >>>available. And it will fallback to sid mangling only if cookies are >>>disabled. You would probably be better off just letting php manage this >>>for you. >>> >>>-Rasmus >>> >>>On Tue, 30 Jul 2002, Petre wrote: >>> >>>>Well, I have asked a couple of questions on this list, but they havn't >>>>really helped alot. Maybe you can help? >>>> >>>>My situation background is as follow: >>>>I have always written my apps in the following way: register_globals=on, >>>>so I allowed PHP to "generate" my variables for me on the action page, >>>>and if I cannot use a form to "send" variables to the next pages, I >>>>added them manually to the url. >>>>So, then I discovered sessions and thought my probelms were solved, only >>>>to discover that it uses cookies by default, and has to have the >>>>--trans-sid option compiled to have PHP handle the app if you don't want >>>>cookies ( like me, don't want cookies at all, or for that matter, >>>>anything that relies on the client's side). So, I couldn't just jump in >>>>and use sessions as I would not be sure that my app would work on any >>>>PHP4 system regardless of the options it was compiled with. ( Oh, I am >>>>writing my apps to work with register_globals=off now, so that shouldn't >>>>be a problem). >>>>So I started to look for a way to code with sessions that will not >>>>require cookies nor require any special compile features; the answer >>>>came in adding <?=SID?> to all relative URL's in my app. >>>>Alas, that is where I'm at, and it's still not working as I would have >>>>expected. >>>>My problem is with the way my proposed app works/should work. >>>> >>>>I am trying to write an app that allows the user to log in, then >>>>add/remove projects to his list, then, when a project is selected, he >>>>should have access to all the relevan documents in that project, again >>>>allowing him to add/remove documents from the project here, and in the >>>>last step, when a document is selected, allows hime to add/remove/edit >>>>chapters to the document. >>>> >>>>My first attempt at using sessions with this failed miserably ( keeping >>>>in mind my approach of adding SID at end of urls). I have a "back" link >>>>on all the pages that takes the user to the previous step(s) and thus >>>>on the last page ( the chpaters edit/remove/add page), there is a link >>>>to go back one level, two and three levels. Yet, using these causes >>>>unexpected results. >>>>I think the problem comes in with overriding the value of the session >>>>variable. >>>>For instance, on the first page you have a login form, on the action >>>>page I session_register("username","password"), and that works fine even >>>>when using the back buttons as the values are never changed. But, on the >>>>2nd page I have the drop down select containing all the project names ( >>>>gets built with a while that reads all the project names from the >>>>project_table) and send over the project_id. >>>>On that actio page, I session_register("project_id"); and it also works >>>>fine for all pages "down stream", however, when I come back to that page >>>>to select a new project, it keeps the old variable... >>>>At first I did nothing special in the sence of assigning a value to the >>>>session variables, as I let the register_globals=on do it's trick, but >>>>later I explicitly said >>>>$project_id = $HTTP_POST_VARS["project_id"]; >>>> >>>>But that also did not overwrite the value of the session var. In the end >>>>I was forced to again add all my variables to the end of the url, >>>>keeping the session solely for the username and password. >>>> >>>>I don't know if you would like me to post my code ( it is quite a bit >>>>already ) but I would really appreciate it if someone could look at it, >>>>and then point out where I'm missing the picture, as then I would have >>>>two pictures that I can compare and see where my reasoning failed. >>>> >>>>Thanks for your time. >>>> >>>> >>>>Rasmus Lerdorf wrote: >>>> >>>>>What issues? Just ask. >>>>> >>>>>-Rasmus >>>>> >>>>>On Mon, 29 Jul 2002, Petre wrote: >>>>> >>>>>>What are good books/websites about sessions. >>>>>>I'm looking for more advanced stuff, I have the Luke Welling/Laura >>>>>>Tompson book, and have read the manual, but I still have issues that are >>>>>>unresolved. >>>>>> >>>>>>Thanks >>>>>> >>>>>> >>>>>> >>>>>>-- >>>>>>PHP General Mailing List (http://www.php.net/) >>>>>>To unsubscribe, visit: http://www.php.net/unsub.php >>>>>> >> > >

    attached mail follows:


    Hi Rasmus Thanks, I think I got it now. Seems my problem with understanding was with the actual setting of the variables. The logic dictated that the session variables should stay the same throughout the session unless "changed" via a form selection, so I simply added a

    session_register("session_var"); if ($_POST["my_var"]) { $session_var = $_POST["my_var"]; }

    to my code and it works like a charm as the $_POST var will be empty if it comes from one of my "back" links to the page...

    Rasmus Lerdorf wrote:

    >Yup, get rid of both ini_set() calls and take out the $sid=... >and <?=$sid?> stuff and it should simply work. > >On Tue, 30 Jul 2002, Petre wrote: > >>Thanks, will work through this immediately. >>Just to be clear. >>If I DO stick with your suggestion of letting PHP do the url mangling, >>and taking your code below, I can simply remove the >> >>ini_set('session.use_trans_sid',false); and <?=$sid?> from your code to make it work exactly as is? >> >>Thanks >> >> >> >>Rasmus Lerdorf wrote: >> >>>The trick is to not name your form vars the same as your session vars. >>>Keep them separate so you have full control of what ends up where. Also, >>>note that if you are not relying on trans_sid or cookies then don't use >>>SID. Call session_id() explicitly to get the session id. So, a quick >>>little mockup to illustrate this. >>> >>>login.php: >>><? >>>ini_set('session.use_cookies',false); >>>ini_set('session.use_trans_sid',false); >>>session_start(); >>>$sid = session_name().'='.session_id(); >>>session_register('username'); >>>$username = 'petre'; >>>?> >>><a href="page1.php?<?=$sid?>">Next Page</a> >>> >>>page1.php: >>><? >>>ini_set('session.use_cookies',false); >>>ini_set('session.use_trans_sid',false); >>>session_start(); >>>$sid = session_name().'='.session_id(); >>>?> >>><form action="page2.php?<?=$sid?>" method="POST"> >>><input type="text" name="form_foo" value="<?=$_SESSION['foo']?>"> >>></form> >>> >>>page2.php: >>><? >>>ini_set('session.use_cookies',false); >>>ini_set('session.use_trans_sid',false); >>>session_start(); >>>$sid = session_name().'='.session_id(); >>>session_register('foo'); >>>$foo = $_POST['form_foo']; >>>echo "You entered $foo<br />\n"; >>>?> >>><a href="page1.php?<?=$sid?>">Back</a> >>> >>> >>>I am ini_setting on each page to force PHP to not do trans-sid/cookies. >>>Would be easier to simply turn these off in the php.ini file. >>> >>>When you hit the back link, $_SESSION['foo'] will exist on page1.php and >>>the form will get filled in with the previous value. You can then change >>>it, hit enter again and the session value will take on the new submitted >>>value because I have decoupled the form data from the session data and I >>>set the session var in page2.php. >>> >>>There are other ways to do this, but this is probably the easiest method >>>to understand. Play with this simple example until you understand how it >>>works. >>> >>>But again, I'd suggest letting PHP do session id handling for you by >>>letting it default to cookies and fall back to url mangling in the few >>>cases where cookies are turned off. >>> >>>-Rasmus >>> >>>On Tue, 30 Jul 2002, Petre wrote: >>> >>>>Yes, it is a forward link to the page, but as mentioned, that page >>>>contains a form with the selection options, and on that form's action >>>>page is where I don't see the values change, so the question should >>>>probably be something like "how do I change the value in the session_var >>>>with the newly selected value? >>>>And oh, I almost forgot: >>>>Due to that fact that this type of app doesn't really have a logical end >>>>page, I cannot issue a session_destroy() anywhere logically ( except >>>>using a logout button), but that's not going to ensure that people use it... >>>>I would ideally like to have this "app" run on an intranet, where people >>>>will most probably have this app open indefinately, and thus I also >>>>battle with my logic of keeping a session alive. >>>> >>>>Thanks >>>>. >>>> >>>>Rasmus Lerdorf wrote: >>>> >>>>>Well, how exactly do you implement the back button? If it is a normal >>>>>client-side back, then of course the previous value will be shown. If it >>>>>is actually a forward-link to the previous page, then your logic on that >>>>>target page is bogus. >>>>> >>>>>By the way, trans-sid is compiled in by default in PHP so should always be >>>>>available. And it will fallback to sid mangling only if cookies are >>>>>disabled. You would probably be better off just letting php manage this >>>>>for you. >>>>> >>>>>-Rasmus >>>>> >>>>>On Tue, 30 Jul 2002, Petre wrote: >>>>> >>>>>>Well, I have asked a couple of questions on this list, but they havn't >>>>>>really helped alot. Maybe you can help? >>>>>> >>>>>>My situation background is as follow: >>>>>>I have always written my apps in the following way: register_globals=on, >>>>>>so I allowed PHP to "generate" my variables for me on the action page, >>>>>>and if I cannot use a form to "send" variables to the next pages, I >>>>>>added them manually to the url. >>>>>>So, then I discovered sessions and thought my probelms were solved, only >>>>>>to discover that it uses cookies by default, and has to have the >>>>>>--trans-sid option compiled to have PHP handle the app if you don't want >>>>>>cookies ( like me, don't want cookies at all, or for that matter, >>>>>>anything that relies on the client's side). So, I couldn't just jump in >>>>>>and use sessions as I would not be sure that my app would work on any >>>>>>PHP4 system regardless of the options it was compiled with. ( Oh, I am >>>>>>writing my apps to work with register_globals=off now, so that shouldn't >>>>>>be a problem). >>>>>>So I started to look for a way to code with sessions that will not >>>>>>require cookies nor require any special compile features; the answer >>>>>>came in adding <?=SID?> to all relative URL's in my app. >>>>>>Alas, that is where I'm at, and it's still not working as I would have >>>>>>expected. >>>>>>My problem is with the way my proposed app works/should work. >>>>>> >>>>>>I am trying to write an app that allows the user to log in, then >>>>>>add/remove projects to his list, then, when a project is selected, he >>>>>>should have access to all the relevan documents in that project, again >>>>>>allowing him to add/remove documents from the project here, and in the >>>>>>last step, when a document is selected, allows hime to add/remove/edit >>>>>>chapters to the document. >>>>>> >>>>>>My first attempt at using sessions with this failed miserably ( keeping >>>>>>in mind my approach of adding SID at end of urls). I have a "back" link >>>>>>on all the pages that takes the user to the previous step(s) and thus >>>>>>on the last page ( the chpaters edit/remove/add page), there is a link >>>>>>to go back one level, two and three levels. Yet, using these causes >>>>>>unexpected results. >>>>>>I think the problem comes in with overriding the value of the session >>>>>>variable. >>>>>>For instance, on the first page you have a login form, on the action >>>>>>page I session_register("username","password"), and that works fine even >>>>>>when using the back buttons as the values are never changed. But, on the >>>>>>2nd page I have the drop down select containing all the project names ( >>>>>>gets built with a while that reads all the project names from the >>>>>>project_table) and send over the project_id. >>>>>>On that actio page, I session_register("project_id"); and it also works >>>>>>fine for all pages "down stream", however, when I come back to that page >>>>>>to select a new project, it keeps the old variable... >>>>>>At first I did nothing special in the sence of assigning a value to the >>>>>>session variables, as I let the register_globals=on do it's trick, but >>>>>>later I explicitly said >>>>>>$project_id = $HTTP_POST_VARS["project_id"]; >>>>>> >>>>>>But that also did not overwrite the value of the session var. In the end >>>>>>I was forced to again add all my variables to the end of the url, >>>>>>keeping the session solely for the username and password. >>>>>> >>>>>>I don't know if you would like me to post my code ( it is quite a bit >>>>>>already ) but I would really appreciate it if someone could look at it, >>>>>>and then point out where I'm missing the picture, as then I would have >>>>>>two pictures that I can compare and see where my reasoning failed. >>>>>> >>>>>>Thanks for your time. >>>>>> >>>>>> >>>>>>Rasmus Lerdorf wrote: >>>>>> >>>>>>>What issues? Just ask. >>>>>>> >>>>>>>-Rasmus >>>>>>> >>>>>>>On Mon, 29 Jul 2002, Petre wrote: >>>>>>> >>>>>>>>What are good books/websites about sessions. >>>>>>>>I'm looking for more advanced stuff, I have the Luke Welling/Laura >>>>>>>>Tompson book, and have read the manual, but I still have issues that are >>>>>>>>unresolved. >>>>>>>> >>>>>>>>Thanks >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>>-- >>>>>>>>PHP General Mailing List (http://www.php.net/) >>>>>>>>To unsubscribe, visit: http://www.php.net/unsub.php >>>>>>>> >> >

    attached mail follows:


    Well, the first thing I recommended was to use $_SESSION rather than session_register(), since it's the way of the future, and also the only method i've put any serious time into.

    With register globals off, you'll then be able to clearly tell the difference between the form variable ($_POST['project_id']) and the session variable ($_SESSION['program_id']) a LOT easier.

    Then to change the session var to the value of the posted form, it's dead easy.

    $_SESSION['program_id'] = $_POST['project_id'];

    session_register is NOT a simple way of using sessions, and can make it harder for people to get the results they want, IMHO.

    Justin French

    on 31/07/02 3:15 AM, Petre (internetvsa.co.za) wrote:

    > Yes , I agree,But that is exactly where my problem comes in, when I link > the person forward, it DOES NOT take the new value for the project_id, > as it is a form element and it only becomes variable on the action page. > This is where I'm unsure about how to "initialize" the variable. As > mentioned earlier in my posts, I simply do a > session_register("project_id"); on the action page, I DO NOT say > anything like > > $_SESSION['project_id'] = "45"; or any other form of assignment whatsoever, as > I leave the work to register_globals=on and it's normal expected behaviour. > And I think this is where the problem lies. > It seems I MUST actually do that for things to work??? Unfortunately I cannot > test this yet, as I'm busy with something else, and just trying to get the > basic academics right. I understand the way you are explaining sessions 100%, > but when I put that knowledge to practise, things doesn't seem to work... :( . > I am still to test yours and Rasmus' sugestions and will come back shortly. > > Thanks for the help so far. > > > > > Justin French wrote: > >> *shakes head a bit* >> >> I'm not REALLY sure what the problem is here, but let's take a step back. >> >> A session ID is a unique, random number assigned to a user as they kick >> around your site. >> >> To maintain state (a session) across multiple pages, you pass the session id >> around. This can be done with the URL or cookies. Yes, trans_sid is in >> there as well, but all it does is re-write URLs. >> >> No surprises so far. >> >> >> You then assign variables to the session. If you're using PHP >= 4.1, I'd >> use $_SESSION['varname'] = "value"; rather than session_register(), because >> it's a lot more logical, and clearer to think through. >> >> Furthermore, the manual tells us NOT to mix use of session_register('var') >> and $_SESSION['var'] = 'value'... so, pick a method, and stick to it... >> since the $_SESSION array is the new way, I'd be going with it. >> >> >> So, the first two session vars YOU assign after the user logs in is the >> username and password (I wouldn't register the password). >> >> $_SESSION['username'] = "justin"; >> $_SESSION['password'] = "secret"; >> >> >> Then a few pages later, they pick an option from a pull-down list, and you >> assign another variable to the session: >> >> $_SESSION['project_id'] = "45"; >> >> The user clicks through a few more pages, and later wants to work on a >> different project, so you link them through (forward) to the options page. >> >> They select a new project from the pull down, so you need to overwrite the >> old project_id session var with a new one: >> >> $_SESSION['project_id'] = "74"; >> >> >> Now, when they kick around through pages, they will be doing it under >> project_id 74. >> >> If you wanted to delete the project_id all together (no project), you could >> use unset(). >> >> >> Now, go back, and have a look at your code, check out the logic, and I'm >> sure you'll see the mistake(s). >> >> >> As far as the "maintaining session forever" thing, I'd highly recommend >> it... it's highly insecure (walk away from your computer, someone else has >> access to everything)... besides, sessions are a temporary thing by nature, >> with garbage cleanouts, etc etc. >> >> If you really wanted to maintain state 'forever', you would have to set a >> cookie with the username and password to that person's computer, hence your >> website would 'remember them' all the time. >> >> Of course there are plenty of reasons why your shouldn't do this. I guess >> the client should be informed of the options here: >> >> 1. log in every so-often as needed (if there is lots of activity, the >> session probably won't die all day anyway), and have heaps more security >> >> 2. log in once only, and have the whole system wide-open forever >> >> >> I'd pick 1 over 2 anytime. >> >> I'd also provide a logout button with either system, so that people CHOOSE >> TO DESTROY THEIR SESSION. Personally, I log-out when I leave my desk, just >> in case. >> >> Imagine if you left a session open which disclosed everyone's pay rates in >> an office... not good for your career at all :) >> >> >> Hope this all helps, >> >> Justin French >> >> >> >> >> on 30/07/02 6:04 PM, Petre (internetvsa.co.za) wrote: >> >>> Yes, it is a forward link to the page, but as mentioned, that page >>> contains a form with the selection options, and on that form's action >>> page is where I don't see the values change, so the question should >>> probably be something like "how do I change the value in the session_var >>> with the newly selected value? >>> And oh, I almost forgot: >>> Due to that fact that this type of app doesn't really have a logical end >>> page, I cannot issue a session_destroy() anywhere logically ( except >>> using a logout button), but that's not going to ensure that people use it... >>> I would ideally like to have this "app" run on an intranet, where people >>> will most probably have this app open indefinately, and thus I also >>> battle with my logic of keeping a session alive. >>> >>> Thanks >>> . >>> >>> Rasmus Lerdorf wrote: >>> >>>> Well, how exactly do you implement the back button? If it is a normal >>>> client-side back, then of course the previous value will be shown. If it >>>> is actually a forward-link to the previous page, then your logic on that >>>> target page is bogus. >>>> >>>> By the way, trans-sid is compiled in by default in PHP so should always be >>>> available. And it will fallback to sid mangling only if cookies are >>>> disabled. You would probably be better off just letting php manage this >>>> for you. >>>> >>>> -Rasmus >>>> >>>> On Tue, 30 Jul 2002, Petre wrote: >>>> >>>>> Well, I have asked a couple of questions on this list, but they havn't >>>>> really helped alot. Maybe you can help? >>>>> >>>>> My situation background is as follow: >>>>> I have always written my apps in the following way: register_globals=on, >>>>> so I allowed PHP to "generate" my variables for me on the action page, >>>>> and if I cannot use a form to "send" variables to the next pages, I >>>>> added them manually to the url. >>>>> So, then I discovered sessions and thought my probelms were solved, only >>>>> to discover that it uses cookies by default, and has to have the >>>>> --trans-sid option compiled to have PHP handle the app if you don't want >>>>> cookies ( like me, don't want cookies at all, or for that matter, >>>>> anything that relies on the client's side). So, I couldn't just jump in >>>>> and use sessions as I would not be sure that my app would work on any >>>>> PHP4 system regardless of the options it was compiled with. ( Oh, I am >>>>> writing my apps to work with register_globals=off now, so that shouldn't >>>>> be a problem). >>>>> So I started to look for a way to code with sessions that will not >>>>> require cookies nor require any special compile features; the answer >>>>> came in adding <?=SID?> to all relative URL's in my app. >>>>> Alas, that is where I'm at, and it's still not working as I would have >>>>> expected. >>>>> My problem is with the way my proposed app works/should work. >>>>> >>>>> I am trying to write an app that allows the user to log in, then >>>>> add/remove projects to his list, then, when a project is selected, he >>>>> should have access to all the relevan documents in that project, again >>>>> allowing him to add/remove documents from the project here, and in the >>>>> last step, when a document is selected, allows hime to add/remove/edit >>>>> chapters to the document. >>>>> >>>>> My first attempt at using sessions with this failed miserably ( keeping >>>>> in mind my approach of adding SID at end of urls). I have a "back" link >>>>> on all the pages that takes the user to the previous step(s) and thus >>>>> on the last page ( the chpaters edit/remove/add page), there is a link >>>>> to go back one level, two and three levels. Yet, using these causes >>>>> unexpected results. >>>>> I think the problem comes in with overriding the value of the session >>>>> variable. >>>>> For instance, on the first page you have a login form, on the action >>>>> page I session_register("username","password"), and that works fine even >>>>> when using the back buttons as the values are never changed. But, on the >>>>> 2nd page I have the drop down select containing all the project names ( >>>>> gets built with a while that reads all the project names from the >>>>> project_table) and send over the project_id. >>>>> On that actio page, I session_register("project_id"); and it also works >>>>> fine for all pages "down stream", however, when I come back to that page >>>>> to select a new project, it keeps the old variable... >>>>> At first I did nothing special in the sence of assigning a value to the >>>>> session variables, as I let the register_globals=on do it's trick, but >>>>> later I explicitly said >>>>> $project_id = $HTTP_POST_VARS["project_id"]; >>>>> >>>>> But that also did not overwrite the value of the session var. In the end >>>>> I was forced to again add all my variables to the end of the url, >>>>> keeping the session solely for the username and password. >>>>> >>>>> I don't know if you would like me to post my code ( it is quite a bit >>>>> already ) but I would really appreciate it if someone could look at it, >>>>> and then point out where I'm missing the picture, as then I would have >>>>> two pictures that I can compare and see where my reasoning failed. >>>>> >>>>> Thanks for your time. >>>>> >>>>> >>>>> Rasmus Lerdorf wrote: >>>>> >>>>>> What issues? Just ask. >>>>>> >>>>>> -Rasmus >>>>>> >>>>>> On Mon, 29 Jul 2002, Petre wrote: >>>>>> >>>>>>> What are good books/websites about sessions. >>>>>>> I'm looking for more advanced stuff, I have the Luke Welling/Laura >>>>>>> Tompson book, and have read the manual, but I still have issues that are >>>>>>> unresolved. >>>>>>> >>>>>>> Thanks >>>>>>> >>>>>>> >>>>>>> >>>>>>> -- >>>>>>> PHP General Mailing List (http://www.php.net/) >>>>>>> To unsubscribe, visit: http://www.php.net/unsub.php >>>>>>> >>> >> >> > >

    attached mail follows:


    That is correct. As long as the expiration date is past present it's fine. I used to work for another hosting company who would just "guess" new expiration dates for monthly recurring customers who had not submitted a cancellation request but who's cards had expired. As long as the date was past present they would go through.

    P.S. Save the flames. It was not my idea to guess new expiration dates ;-)

    Jim Grill Support Web-1 Hosting http://www.web-1hosting.net ----- Original Message ----- From: "Craig Vincent" <2bunnyhoprogers.com> To: "Laurent Drouet" <DrouetLldnegoce.com>; "PHP List" <php-generallists.php.net> Sent: Tuesday, July 30, 2002 3:41 AM Subject: RE: [PHP] Credit Card Validation With Expiration Date

    > > I'm looking for an algorithm or a free PHP Script which enable me > > to verify > > expiration date with a credit card number. > > > > Does anybody knows this ? > > It doesn't exist....credit card number alogrithms do not use the expiry date > in their formulas (at least I'm not aware of any that are). Also there is > no way to actually check if a credit card is valid without using a company > that keeps an online database of active credit cards. The most you can do > is verify that the number provided could potentially be a credit card...and > even then the expiry date has no algorithm attached to it...as long as it is > past the present date there's no way to consider it invalid without > cross-referencing against a database of active cards. > > Sincerely, > > Craig Vincent > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > >

    attached mail follows:


    I would like to have the same page (test.php) have different text in it depending on a database entry. which is easy enough. but I want it to be on the fly. example list would be created on the fly depending on databse entries. which ever entry was picked (lets say STLT) it would open up my template test.php and it would but the STLT info on the page. Is there a way to do this without turning on Global_Variables which come standard off in php4.2.2

    I'm using apache 2.0.39, PHP4.2.2, FreeBSD4.6, Mysql3.23.51

    My database entries would be deparment page artical template ---------------------------------------- stlt 1 <body of page> test.php aps 1 <body of page> test.php srp 1 <body of page> test2.php main 1 <body of page> test.php

    the list would be created by a query that looks for all page 1 entries from there the main page would show up(default), but once you pick from the list it would show the database enteries for that department.

    |-------|------------------------------- |main | |STLT | STLT was picked show STLT "artical" database entry |aps | this is are STLT page |srp | | | |-------|-------------------------------

    |-------|------------------------------- |main | |stlt | APS was picked show APS "artical" database entry |APS | this is are APS page |srp | | | |-------|-------------------------------

    I assume that Gobal_Variables are off for a reason.

    Rolando

    attached mail follows:


    Hi!

    Database queries and global variables are not related to each other. It usually just boils down to the following steps

    1. Collect data that that's needed for the database query (via $_GET or $_POST) 2. Run the query against the database and store the results in some nice variables (arrays/strings depending on data) 3. Display the results within the page by printing the variables at appropiate places inside your template file (test.php).

    Obviously the possibilities are endless, but if you want a starting point you could try the following link:

    http://www.php.net/manual/en/ref.mysql.php (check under Examples)

    Kindly

    /lasso (lassolassoweb.nu)

    Rolando Morales wrote: > I would like to have the same page (test.php) have different text in it > depending on a database entry. which is easy enough. but I want it to > be on the fly. example list would be created on the fly depending on > databse entries. which ever entry was picked (lets say STLT) it would > open up my template test.php and it would but the STLT info on the > page. Is there a way to do this without turning on Global_Variables > which come standard off in php4.2.2 > > I'm using apache 2.0.39, PHP4.2.2, FreeBSD4.6, Mysql3.23.51 > > My database entries would be > deparment page artical template > ---------------------------------------- > stlt 1 <body of page> test.php > aps 1 <body of page> test.php > srp 1 <body of page> test2.php > main 1 <body of page> test.php > > the list would be created by a query that looks for all page 1 entries > from there the main page would show up(default), but once you pick > from the list it would show the database enteries for that department. > > |-------|------------------------------- > |main | > |STLT | STLT was picked show STLT "artical" database entry > |aps | this is are STLT page > |srp | > | | > |-------|------------------------------- > > |-------|------------------------------- > |main | > |stlt | APS was picked show APS "artical" database entry > |APS | this is are APS page > |srp | > | | > |-------|------------------------------- > > I assume that Gobal_Variables are off for a reason. > > Rolando

    attached mail follows:


    Hi,

    I would like to recompile php with mysql support. I am a newbie. I really don't want to have to reinstall RedHat just to be able to use MySQL with php.

    I ran: rpm -qa | frgrep php and I see these: php-4.0.6-15 php-imap-4.0.6-15 asp2php-gtk-0.75.17.1 php-ldap-4.0.6-15 asp2php-0.75.17-1 php-pgsql-4.0.6-15

    thanks.

    attached mail follows:


    Simply install the php-mysql rpm.

    On Mon, 29 Jul 2002, Joel Lopez wrote:

    > Hi, > > I would like to recompile php with mysql support. I am a newbie. I really > don't want to have to reinstall RedHat just to be able to use MySQL with > php. > > I ran: > rpm -qa | frgrep php > and I see these: > php-4.0.6-15 > php-imap-4.0.6-15 > asp2php-gtk-0.75.17.1 > php-ldap-4.0.6-15 > asp2php-0.75.17-1 > php-pgsql-4.0.6-15 > > thanks. > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php >

    attached mail follows:


    Instead of incrementing to find the next row to count them, you dont have to set the ID if it is auto increment. MySQL will do it for you (and i think it might fill the holes too). Also, to get the num. of rows just do this -

    $get_rows = mysql_query("SELECT * FROM `table`"); $num_rows = mysql_num_rows($get_rows);

    "Georgie Casey" <webmasterfilmfind.tv> wrote in message news:20020729194732.70319.qmailpb1.pair.com... > rite, > > my primary key column ("id") is set to auto_increment as usual which is very > handy. But when I delete a row, the auto_increment just keeps incrementing > and there's this 'hole' left where I deleted the row! > > Apart from this looking ugly, it poses another problem. In my PHP script > where I can add new rows, I query the table, checking how many rows in the > table altogether and set the new id as the next number, but this doesnt work > if theres 'holes' in the id field, as the new record tries to overwrite > another id. > > So I've 2 questions > 1) Can the next auto_increment value be 'set' by a SQL query???? > 2) Can I get a SQL query to INSERT INTO the first 'hole' it finds in the ID > column?? > > TIA > >

    attached mail follows:


    If you have an auto_increment mysql field, it's supposed to save you the time of computing the "next" ID. the database will handle it for you.

    Use "0" as the ID for new rows and mysql will automagically compute the next ID.

    All of this info is on the mysql.com/doc/ site... please check there in the future for MySQL questions

    --
    Scott Hurring
    Systems Programmer
    EAC Corporation
    scott (*) eac.com
    --
    "Georgie Casey" <webmasterfilmfind.tv> wrote in message
    news:20020729194732.70319.qmailpb1.pair.com...
    > rite,
    >
    > my primary key column ("id") is set to auto_increment as usual which is very
    > handy. But when I delete a row, the auto_increment just keeps incrementing
    > and there's this 'hole' left where I deleted the row!
    >
    > Apart from this looking ugly, it poses another problem. In my PHP script
    > where I can add new rows, I query the table, checking how many rows in the
    > table altogether and set the new id as the next number, but this doesnt work
    > if theres 'holes' in the id field, as the new record tries to overwrite
    > another id.
    >
    > So I've 2 questions
    > 1) Can the next auto_increment value be 'set' by a SQL query????
    > 2) Can I get a SQL query to INSERT INTO the first 'hole' it finds in the ID
    > column??
    >
    > TIA
    >
    >
    

    attached mail follows:


    [straying OT, but...] > Instead of incrementing to find the next row to count them, you dont have to > set the ID if it is auto increment. MySQL will do it for you (and i think it > might fill the holes too). Also, to get the num. of rows just do this - > > $get_rows = mysql_query("SELECT * FROM `table`"); > $num_rows = mysql_num_rows($get_rows);

    Oh my, don't do that! If you only want to get the number of rows in a table, don't bog down the MySQL server by doing a 'SELECT *' on it. This could be a *ton* of data...

    Why not use MySQL's built-in counting functionality:

    $result = mysql_query('SELECT count(*) AS count FROM table'); $count_arr = mysql_fetch_assoc($result); $count = $count_arr['count'];

    MySQL will be able to simply count rows a lot faster than actually SELECTing all of the data.

    Of course, if you're counting rows just to find out what the next value for an ID is, then, as you already said, you're doing the wrong thing.

    Joel

    -- 
    [ joel boonstra | jboonstragospelcom.net ]
    

    attached mail follows:


    Hello, I am getting some odd errors trying to get an encrypt/decrypt process to work. Looking at the manual examples and some other literature, I have tried the two approaches listed below. For each, I get a sometimes-works, sometimes fails result. The manual entry has a string of user notes with problem like mine, but I still have problems.

    Server API Apache

    mcrypt mcrypt support enabled version 2.4.x Supported ciphers twofish rijndael-128 rijndael-192 rijndael-256 saferplus rc2 xtea serpent safer-sk64 safer-sk128 cast-256 loki97 gost threeway cast-128 des tripledes enigma arcfour panama wake Supported modes ofb cfb nofb cbc ecb stream

    --]

    The first attempt used the following code:

    --> <?php $key = "this is a secret key"; $input = "Let us meet at 9 o'clock at the secret place.";

    $td = mcrypt_module_open ('tripledes', '', 'ecb', ''); $iv = mcrypt_create_iv (mcrypt_enc_get_iv_size ($td), MCRYPT_RAND); mcrypt_generic_init ($td, $key, $iv); $encrypted_data = mcrypt_generic ($td, $input); $decrypted_data = mdecrypt_generic ($td, $encrypted_data); mcrypt_generic_end ($td);

    echo "key: $key<br>input:$input<br>encrypted:$encrypted_data<br>decrypted:$decrypted_da ta"; ?> --]

    This resulted, at first, in "key: this is a secret key input:Let us meet at 9 o'clock at the secret place. encrypted:\ºþêTÏ'áz(v¹FýaõFËU³æç SäÇÚÖzßù5Qì<±_T-:Í decrypted:Let us meet at 9 o'clock at the secret place."

    BUT after I refreshed/reloaded a couple of times, I got this: "Warning: mcrypt_generic_init: Memory allocation error in /home/pndrdrm001/www/administrator/crypt.php on line 64

    Warning: 1 is not a valid MCrypt resource in /home/pndrdrm001/www/administrator/crypt.php on line 65

    Warning: 1 is not a valid MCrypt resource in /home/pndrdrm001/www/administrator/crypt.php on line 66

    Warning: 1 is not a valid MCrypt resource in /home/pndrdrm001/www/administrator/crypt.php on line 67 key: this is a secret key input:Let us meet at 9 o'clock at the secret place. encrypted: decrypted: "

    There were no changes to the code.

    The second try used the following:

    In file 1, the functions: --> <?php

    function my_encrypt($sString) { GLOBAL $sCryptoKey;

    $iIV = mcrypt_create_iv (mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_ECB), MCRYPT_RAND);

    $sEncrypted = mcrypt_encrypt(MCRYPT_RIJNDAEL_256, $sCryptoKey, $sString, MCRYPT_MODE_ECB, $iIV);

    return($sEncrypted); } // End function my_encrypt

    function my_decrypt($sString) { GLOBAL $sCryptoKey;

    $iIV = mcrypt_create_iv(mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_ECB), MCRYPT_RAND);

    $sDecrypted = mcrypt_decrypt(MCRYPT_RIJNDAEL_256, $sCryptoKey, $sString, MCRYPT_MODE_ECB, $iIV);

    return(trim($sDecrypted));

    } // End function my_decrypt ?> --] and in file 2, the main page: --> <?php include "cryption.php"; $sCryptoKey = "key"; $input = "test"; $encrypted = my_encrypt($input); $decrypted = my_decrypt($encrypted);

    echo "key: $sCryptoKey<br>input:$input<br>encrypted:$encrypted<br>decrypted:$decrypted" ;

    ?> --]

    This resulted in "key: key input:test encrypted: &foUÝø§ª~RM¡°Kz à¼O¼¿rw"xnÉ decrypted:test " the first time, but then I got "Fatal error: generic_init failed in /home/pndrdrm001/www/administrator/cryption.php on line 9" on the second refresh.

    Is there a missing call to free resources, or something? What can be done?

    Thanks! Regards,

    Puru

    attached mail follows:


    Hi, Thanks for the prompt answer. But I am still getting the same error.

    ///////////////////////////////////////////////////// original: meet at secret place encrypted: d40d72f1b224b9bf86a7dbc52402c1d02a5cf90adb9050f0

    Warning: mcrypt_generic_init: Memory allocation error in /mount/marsellus/gwolfe/puruclient/staging/vhosts/partnersdev.sec.yaga.com/h tml/time/cancelsubscription/new.php on line 29

    Warning: mdecrypt_generic(): 2 is not a valid MCrypt resource in /mount/marsellus/gwolfe/puruclient/staging/vhosts/partnersdev.sec.yaga.com/h tml/time/cancelsubscription/new.php on line 30

    Warning: mcrypt_generic_end(): 2 is not a valid MCrypt resource in /mount/marsellus/gwolfe/puruclient/staging/vhosts/partnersdev.sec.yaga.com/h tml/time/cancelsubscription/new.php on line 31 decrypted:

    ///////////////////////////////////////////

    Regards,

    Purushotham Komaravolu Software Engineer Yaga, Inc. - "advanced payment services" Direct: 415-901-7343 Fax: 415-901-1586 http://www.yaga.com

    ----- Original Message ----- From: "Tech Support" <jgrillweb-1hosting.net> To: "Purushotham Komaravolu" <purikkhotmail.com> Sent: Tuesday, July 30, 2002 11:34 AM Subject: Re: [PHP] mcrypt

    > Rather than tease you with hints I'll give you some working code ;-) > > Documentation for practical usage of mcrypt is weak. I agree. > > <? > // crypto.inc > $key = "secret key crap"; > > function hex2bin($data) > { > $len = strlen($data); > return pack("H" . $len, $data); > } > > function encrypt($string, $key) > { > // version 2.4.x of lib mcrypt > $td = mcrypt_module_open (MCRYPT_TripleDES, "", MCRYPT_MODE_ECB, ""); > $iv = mcrypt_create_iv (mcrypt_enc_get_iv_size ($td), MCRYPT_RAND); > mcrypt_generic_init ($td, $key, $iv); > $crypted = mcrypt_generic ($td, $string); > mcrypt_generic_end ($td); > return bin2hex($crypted); > } > > function decrypt($string, $key) > { > //version 2.4.x of lib mcrypt > $string = hex2bin($string); > $td = mcrypt_module_open (MCRYPT_TripleDES, "", MCRYPT_MODE_ECB, ""); > $iv = mcrypt_create_iv (mcrypt_enc_get_iv_size ($td), MCRYPT_RAND); > mcrypt_generic_init ($td, $key, $iv); > $decrypted = mdecrypt_generic ($td, $string); > mcrypt_generic_end ($td); > return trim($decrypted); > } > ?> > > > usage: > <? > include ("path/to/crypto.inc"); > $secret = "meet at secret place"; > $encrypted = encrypt($secret, $key); > print "original: " . $secret . "<br>"; > print "encrypted: " . $encrypted . "<br>"; > $decrypted = decrypt($encrypted, $key); > print "decrypted: " . $decrypted . "<br>"; > ?> > > Note: if you are encrypting really secret crap like credit card numbers or > something of that nature then NEVER include the key anywhere in your code. > Make a form where you have to type it in or something in order to display > the results. > > > Jim Grill > Support > Web-1 Hosting > http://www.web-1hosting.net > ----- Original Message ----- > From: "Purushotham Komaravolu" <purikkhotmail.com> > To: <php-generallists.php.net>; <php-devlists.php.net> > Sent: Tuesday, July 30, 2002 12:52 PM > Subject: [PHP] mcrypt > > > Hello, > I am getting some odd errors trying to get an encrypt/decrypt > process to > work. Looking at the manual examples and some other literature, I have > tried > the two approaches listed below. For each, I get a sometimes-works, > sometimes fails result. The manual entry has a string of user notes > with > problem like mine, but I still have problems. > > > > Server API Apache > > > > mcrypt > mcrypt support enabled > version 2.4.x > Supported ciphers twofish rijndael-128 rijndael-192 rijndael-256 > saferplus rc2 xtea serpent safer-sk64 safer-sk128 cast-256 loki97 gost > threeway cast-128 des tripledes enigma arcfour panama wake > Supported modes ofb cfb nofb cbc ecb stream > > > --] > > > > The first attempt used the following code: > > > --> > <?php > $key = "this is a secret key"; > $input = "Let us meet at 9 o'clock at the secret place."; > > > $td = mcrypt_module_open ('tripledes', '', 'ecb', ''); > $iv = mcrypt_create_iv (mcrypt_enc_get_iv_size ($td), > MCRYPT_RAND); > mcrypt_generic_init ($td, $key, $iv); > $encrypted_data = mcrypt_generic ($td, $input); > $decrypted_data = mdecrypt_generic ($td, $encrypted_data); > mcrypt_generic_end ($td); > > > echo "key: > > $key<br>input:$input<br>encrypted:$encrypted_data<br>decrypted:$decrypted_da > ta"; > ?> > --] > > > This resulted, at first, in "key: this is a secret key > input:Let us meet at 9 o'clock at the secret place. > encrypted:\ºþêTÏ'áz(v¹FýaõFËU³æç SäÇÚÖzßù5Qì<±_T-:Í > decrypted:Let us meet at 9 o'clock at the secret place." > > > BUT after I refreshed/reloaded a couple of times, I got this: > "Warning: > mcrypt_generic_init: Memory allocation error in > /home/pndrdrm001/www/administrator/crypt.php on line 64 > > > Warning: 1 is not a valid MCrypt resource in > /home/pndrdrm001/www/administrator/crypt.php on line 65 > > > Warning: 1 is not a valid MCrypt resource in > /home/pndrdrm001/www/administrator/crypt.php on line 66 > > > Warning: 1 is not a valid MCrypt resource in > /home/pndrdrm001/www/administrator/crypt.php on line 67 > key: this is a secret key > input:Let us meet at 9 o'clock at the secret place. > encrypted: > decrypted: " > > > There were no changes to the code. > > > > The second try used the following: > > > In file 1, the functions: > --> > <?php > > > function my_encrypt($sString) > { > GLOBAL $sCryptoKey; > > > $iIV = mcrypt_create_iv (mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, > MCRYPT_MODE_ECB), MCRYPT_RAND); > > > $sEncrypted = mcrypt_encrypt(MCRYPT_RIJNDAEL_256, $sCryptoKey, > $sString, > MCRYPT_MODE_ECB, $iIV); > > > return($sEncrypted); > } // End function my_encrypt > > > function my_decrypt($sString) > { > GLOBAL $sCryptoKey; > > > $iIV = mcrypt_create_iv(mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, > MCRYPT_MODE_ECB), MCRYPT_RAND); > > > $sDecrypted = mcrypt_decrypt(MCRYPT_RIJNDAEL_256, $sCryptoKey, > $sString, > MCRYPT_MODE_ECB, $iIV); > > > return(trim($sDecrypted)); > > > } // End function my_decrypt > ?> > --] > and in file 2, the main page: > --> > <?php > include "cryption.php"; > $sCryptoKey = "key"; > $input = "test"; > $encrypted = my_encrypt($input); > $decrypted = my_decrypt($encrypted); > > > echo "key: > > $sCryptoKey<br>input:$input<br>encrypted:$encrypted<br>decrypted:$decrypted" > ; > > > > ?> > --] > > > This resulted in "key: key > input:test > encrypted: &foUÝø§ª~RM¡°Kz à¼O¼¿rw"xnÉ > decrypted:test " the first time, but then I got "Fatal error: > generic_init > failed in /home/pndrdrm001/www/administrator/cryption.php on line 9" > on the > second refresh. > > > > Is there a missing call to free resources, or something? What can be > done? > > > Thanks! > Regards, > > Puru >

    attached mail follows:


    Cross posting this with php-dev might not be the best idea. The dev list is not for support unless you are trying to code part of the php source.

    So this is only failing on the decrypt side of the code?

    "Memory allocation error" does not sound like a problem specific to this function. All the other errors are just because mcrypt_generic_init failed.

    Try only encrypting in one script and then only decrypting in another script and see what happens.

    What are the specs of your system? compile options, platform, etc.?

    Jim Grill Support Web-1 Hosting http://www.web-1hosting.net ----- Original Message ----- From: "Purushotham Komaravolu" <purikkhotmail.com> To: "Tech Support" <jgrillweb-1hosting.net>; <php-generallists.php.net>; <php-devlists.php.net> Sent: Tuesday, July 30, 2002 1:44 PM Subject: Re: [PHP] mcrypt

    > Hi, > Thanks for the prompt answer. But I am still getting the same error. > > ///////////////////////////////////////////////////// > original: meet at secret place > encrypted: d40d72f1b224b9bf86a7dbc52402c1d02a5cf90adb9050f0 > > Warning: mcrypt_generic_init: Memory allocation error in > /mount/marsellus/gwolfe/puruclient/staging/vhosts/partnersdev.sec.yaga.com/h > tml/time/cancelsubscription/new.php on line 29 > > Warning: mdecrypt_generic(): 2 is not a valid MCrypt resource in > /mount/marsellus/gwolfe/puruclient/staging/vhosts/partnersdev.sec.yaga.com/h > tml/time/cancelsubscription/new.php on line 30 > > Warning: mcrypt_generic_end(): 2 is not a valid MCrypt resource in > /mount/marsellus/gwolfe/puruclient/staging/vhosts/partnersdev.sec.yaga.com/h > tml/time/cancelsubscription/new.php on line 31 > decrypted: > > > /////////////////////////////////////////// > > > Regards, > > Purushotham Komaravolu > Software Engineer > Yaga, Inc. - "advanced payment services" > Direct: 415-901-7343 > Fax: 415-901-1586 > http://www.yaga.com > > > > ----- Original Message ----- > From: "Tech Support" <jgrillweb-1hosting.net> > To: "Purushotham Komaravolu" <purikkhotmail.com> > Sent: Tuesday, July 30, 2002 11:34 AM > Subject: Re: [PHP] mcrypt > > > > Rather than tease you with hints I'll give you some working code ;-) > > > > Documentation for practical usage of mcrypt is weak. I agree. > > > > <? > > // crypto.inc > > $key = "secret key crap"; > > > > function hex2bin($data) > > { > > $len = strlen($data); > > return pack("H" . $len, $data); > > } > > > > function encrypt($string, $key) > > { > > // version 2.4.x of lib mcrypt > > $td = mcrypt_module_open (MCRYPT_TripleDES, "", MCRYPT_MODE_ECB, ""); > > $iv = mcrypt_create_iv (mcrypt_enc_get_iv_size ($td), MCRYPT_RAND); > > mcrypt_generic_init ($td, $key, $iv); > > $crypted = mcrypt_generic ($td, $string); > > mcrypt_generic_end ($td); > > return bin2hex($crypted); > > } > > > > function decrypt($string, $key) > > { > > //version 2.4.x of lib mcrypt > > $string = hex2bin($string); > > $td = mcrypt_module_open (MCRYPT_TripleDES, "", MCRYPT_MODE_ECB, ""); > > $iv = mcrypt_create_iv (mcrypt_enc_get_iv_size ($td), MCRYPT_RAND); > > mcrypt_generic_init ($td, $key, $iv); > > $decrypted = mdecrypt_generic ($td, $string); > > mcrypt_generic_end ($td); > > return trim($decrypted); > > } > > ?> > > > > > > usage: > > <? > > include ("path/to/crypto.inc"); > > $secret = "meet at secret place"; > > $encrypted = encrypt($secret, $key); > > print "original: " . $secret . "<br>"; > > print "encrypted: " . $encrypted . "<br>"; > > $decrypted = decrypt($encrypted, $key); > > print "decrypted: " . $decrypted . "<br>"; > > ?> > > > > Note: if you are encrypting really secret crap like credit card numbers or > > something of that nature then NEVER include the key anywhere in your code. > > Make a form where you have to type it in or something in order to display > > the results. > > > > > > Jim Grill > > Support > > Web-1 Hosting > > http://www.web-1hosting.net > > ----- Original Message ----- > > From: "Purushotham Komaravolu" <purikkhotmail.com> > > To: <php-generallists.php.net>; <php-devlists.php.net> > > Sent: Tuesday, July 30, 2002 12:52 PM > > Subject: [PHP] mcrypt > > > > > > Hello, > > I am getting some odd errors trying to get an encrypt/decrypt > > process to > > work. Looking at the manual examples and some other literature, I > have > > tried > > the two approaches listed below. For each, I get a sometimes-works, > > sometimes fails result. The manual entry has a string of user notes > > with > > problem like mine, but I still have problems. > > > > > > > > Server API Apache > > > > > > > > mcrypt > > mcrypt support enabled > > version 2.4.x > > Supported ciphers twofish rijndael-128 rijndael-192 > rijndael-256 > > saferplus rc2 xtea serpent safer-sk64 safer-sk128 cast-256 loki97 > gost > > threeway cast-128 des tripledes enigma arcfour panama wake > > Supported modes ofb cfb nofb cbc ecb stream > > > > > > --] > > > > > > > > The first attempt used the following code: > > > > > > --> > > <?php > > $key = "this is a secret key"; > > $input = "Let us meet at 9 o'clock at the secret place."; > > > > > > $td = mcrypt_module_open ('tripledes', '', 'ecb', ''); > > $iv = mcrypt_create_iv (mcrypt_enc_get_iv_size ($td), > > MCRYPT_RAND); > > mcrypt_generic_init ($td, $key, $iv); > > $encrypted_data = mcrypt_generic ($td, $input); > > $decrypted_data = mdecrypt_generic ($td, $encrypted_data); > > mcrypt_generic_end ($td); > > > > > > echo "key: > > > > > $key<br>input:$input<br>encrypted:$encrypted_data<br>decrypted:$decrypted_da > > ta"; > > ?> > > --] > > > > > > This resulted, at first, in "key: this is a secret key > > input:Let us meet at 9 o'clock at the secret place. > > encrypted:\ºþêTÏ'áz(v¹FýaõFËU³æç SäÇÚÖzßù5Qì<±_T-:Í > > decrypted:Let us meet at 9 o'clock at the secret place." > > > > > > BUT after I refreshed/reloaded a couple of times, I got this: > > "Warning: > > mcrypt_generic_init: Memory allocation error in > > /home/pndrdrm001/www/administrator/crypt.php on line 64 > > > > > > Warning: 1 is not a valid MCrypt resource in > > /home/pndrdrm001/www/administrator/crypt.php on line 65 > > > > > > Warning: 1 is not a valid MCrypt resource in > > /home/pndrdrm001/www/administrator/crypt.php on line 66 > > > > > > Warning: 1 is not a valid MCrypt resource in > > /home/pndrdrm001/www/administrator/crypt.php on line 67 > > key: this is a secret key > > input:Let us meet at 9 o'clock at the secret place. > > encrypted: > > decrypted: " > > > > > > There were no changes to the code. > > > > > > > > The second try used the following: > > > > > > In file 1, the functions: > > --> > > <?php > > > > > > function my_encrypt($sString) > > { > > GLOBAL $sCryptoKey; > > > > > > $iIV = mcrypt_create_iv (mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, > > MCRYPT_MODE_ECB), MCRYPT_RAND); > > > > > > $sEncrypted = mcrypt_encrypt(MCRYPT_RIJNDAEL_256, $sCryptoKey, > > $sString, > > MCRYPT_MODE_ECB, $iIV); > > > > > > return($sEncrypted); > > } // End function my_encrypt > > > > > > function my_decrypt($sString) > > { > > GLOBAL $sCryptoKey; > > > > > > $iIV = mcrypt_create_iv(mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, > > MCRYPT_MODE_ECB), MCRYPT_RAND); > > > > > > $sDecrypted = mcrypt_decrypt(MCRYPT_RIJNDAEL_256, $sCryptoKey, > > $sString, > > MCRYPT_MODE_ECB, $iIV); > > > > > > return(trim($sDecrypted)); > > > > > > } // End function my_decrypt > > ?> > > --] > > and in file 2, the main page: > > --> > > <?php > > include "cryption.php"; > > $sCryptoKey = "key"; > > $input = "test"; > > $encrypted = my_encrypt($input); > > $decrypted = my_decrypt($encrypted); > > > > > > echo "key: > > > > > $sCryptoKey<br>input:$input<br>encrypted:$encrypted<br>decrypted:$decrypted" > > ; > > > > > > > > ?> > > --] > > > > > > This resulted in "key: key > > input:test > > encrypted: &foUÝø§ª~RM¡°Kz à¼O¼¿rw"xnÉ > > decrypted:test " the first time, but then I got "Fatal error: > > generic_init > > failed in /home/pndrdrm001/www/administrator/cryption.php on line 9" > > on the > > second refresh. > > > > > > > > Is there a missing call to free resources, or something? What can be > > done? > > > > > > Thanks! > > Regards, > > > > Puru > > > >

    attached mail follows:


    try preg_grep() http://www.php.net/manual/en/function.preg-grep.php

    example:

    <? $word = array('alpha', 'beta', 'php'); // match anything beginning with upper or lower case p $matches_array = preg_grep('/^(p|P).*/', $word); print_r($matches_array); ?>

    Jim Grill Support Web-1 Hosting http://www.web-1hosting.net ----- Original Message ----- From: "andy" <news.lettersgmx.de> To: <php-generallists.php.net> Sent: Tuesday, July 30, 2002 10:36 AM Subject: [PHP] searching an array for words starting with 'p'

    > Hi there, > > I am wondering how to search an array for words starting with a certain > character. > > E.G: > > $word = array('alpha', 'beta', 'php'); > > I would like to check if there is a word in the array starting with p > > Is there alrready a function for this? > > Thanx, Andy > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > >

    attached mail follows:


    I don't think there's a builtin that does exactly what you are looking for, but this will do the trick:

    <?php

    $array = array ( "pinaeapple", "orange", "passionfruit"); $newar = array();

    foreach ($array as $val) { if ($val{0} == "p") { $newar[] = $val; } }

    ?>

    -Joseph Rosenblum President, 25th Street Networks Easy, Reliable PHP Web Hosting at: http://www.25thstreet.net/

    -----Original Message----- From: andy [mailto:news.lettersgmx.de] Sent: Tuesday, July 30, 2002 8:37 AM To: php-generallists.php.net Subject: [PHP] searching an array for words starting with 'p'

    Hi there,

    I am wondering how to search an array for words starting with a certain character.

    E.G:

    $word = array('alpha', 'beta', 'php');

    I would like to check if there is a word in the array starting with p

    Is there alrready a function for this?

    Thanx, Andy

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

    attached mail follows:


    See preg_grep() function in the manual.

    a> Hi there,

    a> I am wondering how to search an array for words starting with a certain a> character.

    a> E.G:

    a> $word = array('alpha', 'beta', 'php');

    a> I would like to check if there is a word in the array starting with p

    a> Is there alrready a function for this?

    a> Thanx, Andy

    -- 
    Best regards,
     Evgeny                          mailto:geckabaik.ru
    

    attached mail follows:


    I would like to give my users the ability to send (to my website) a Microsoft Excel file, and then have my server (PHP code) extract that data and turn it into a TAB Delimited Text file -- is this possible with PHP?

    Thanks. Jason

    attached mail follows:


    > I would like to give my users the ability to send (to my website) a > Microsoft Excel file, and then have my server (PHP code) extract that data > and turn it into a TAB Delimited Text file -- is this possible with PHP?

    http://groups.google.com/groups?hl=sv&lr=&ie=ISO-8859-1&q=data+from+excel+ph p

    Google is your friend.

    -Jome

    attached mail follows:


    So -- it looks like I can connect to Excel via COM -- buuutt... anyone have any examples or can anyone point me to any -- that show how to save-out an excel file as a TEXT (.csv) TAB Delimited file?

    I guess if there is a way to see each ROW in the Excel Spreadsheet -- then I can grab that data and easily save it out as a \t delimited file (I know how to do that) -- ***so, then*** I guess my real question is; how can I *see* the data using COM ??? I'm not too familiar with COM.

    Say I have an excel spreadsheet called "Test.xls" and it has three columns:

    Name: Salary: Expense: Jon Doe $63,000 $2,345 Jane Doe $65,234 $3,256

    and so on...

    Thanks Jason

    "Jome" <jomeemoj.net> wrote in message news:20020730182546.28213.qmailpb1.pair.com... > > I would like to give my users the ability to send (to my website) a > > Microsoft Excel file, and then have my server (PHP code) extract that data > > and turn it into a TAB Delimited Text file -- is this possible with PHP? > > http://groups.google.com/groups?hl=sv&lr=&ie=ISO-8859-1&q=data+from+excel+ph > p > > Google is your friend. > > -Jome > >

    attached mail follows:


    file | save as then chose the format you want in the drop down box

    > -----Original Message----- > From: Jason Caldwell [mailto:jasonthinkingman.org] > Sent: Tuesday, July 30, 2002 2:46 PM > To: php-generallists.php.net > Subject: [PHP] Re: PHP4 and MS Excel? > > > So -- it looks like I can connect to Excel via COM -- buuutt... > anyone have > any examples or can anyone point me to any -- that show how to save-out an > excel file as a TEXT (.csv) TAB Delimited file? > > I guess if there is a way to see each ROW in the Excel > Spreadsheet -- then I > can grab that data and easily save it out as a \t delimited file > (I know how > to do that) -- ***so, then*** I guess my real question is; how > can I *see* > the data using COM ??? I'm not too familiar with COM. > > Say I have an excel spreadsheet called "Test.xls" and it has > three columns: > > Name: Salary: Expense: > Jon Doe $63,000 $2,345 > Jane Doe $65,234 $3,256 > > and so on... > > Thanks > Jason > > > "Jome" <jomeemoj.net> wrote in message > news:20020730182546.28213.qmailpb1.pair.com... > > > I would like to give my users the ability to send (to my website) a > > > Microsoft Excel file, and then have my server (PHP code) extract that > data > > > and turn it into a TAB Delimited Text file -- is this > possible with PHP? > > > > > http://groups.google.com/groups?hl=sv&lr=&ie=ISO-8859-1&q=data+fro m+excel+ph > p > > Google is your friend. > > -Jome > >

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

    attached mail follows:


    Are you actually telling me how to SAVE an excel file as text (CSV) format THROUGH excel ?

    Hmmmm....

    Thanks (I guess...) But I learned how to do that, oh I dunno, about 20 years ago. My question was how to do it using PHP and COM.

    "Brian V Bonini" <b-boninicox.net> wrote in message news:LOBBKHJGOJFPJMLKAHKFMEDGFOAB.b-boninicox.net... > file | save as then chose the format you want in the drop down box > > > -----Original Message----- > > From: Jason Caldwell [mailto:jasonthinkingman.org] > > Sent: Tuesday, July 30, 2002 2:46 PM > > To: php-generallists.php.net > > Subject: [PHP] Re: PHP4 and MS Excel? > > > > > > So -- it looks like I can connect to Excel via COM -- buuutt... > > anyone have > > any examples or can anyone point me to any -- that show how to save-out an > > excel file as a TEXT (.csv) TAB Delimited file? > > > > I guess if there is a way to see each ROW in the Excel > > Spreadsheet -- then I > > can grab that data and easily save it out as a \t delimited file > > (I know how > > to do that) -- ***so, then*** I guess my real question is; how > > can I *see* > > the data using COM ??? I'm not too familiar with COM. > > > > Say I have an excel spreadsheet called "Test.xls" and it has > > three columns: > > > > Name: Salary: Expense: > > Jon Doe $63,000 $2,345 > > Jane Doe $65,234 $3,256 > > > > and so on... > > > > Thanks > > Jason > > > > > > "Jome" <jomeemoj.net> wrote in message > > news:20020730182546.28213.qmailpb1.pair.com... > > > > I would like to give my users the ability to send (to my website) a > > > > Microsoft Excel file, and then have my server (PHP code) extract that > > data > > > > and turn it into a TAB Delimited Text file -- is this > > possible with PHP? > > > > > > > > http://groups.google.com/groups?hl=sv&lr=&ie=ISO-8859-1&q=data+fro > m+excel+ph > > p > > > > Google is your friend. > > > > -Jome > > > > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php >

    attached mail follows:


    I don't think you'll be able to o this directly with PHP, unless you know the file format of an .xls file...

    You might be able to use COM somehow (??)

    Might be easier for the user to save the spreadsheet out as a CSV first

    Martin

    -----Original Message----- From: Jason Caldwell [mailto:jasonthinkingman.org] Sent: Wednesday, July 31, 2002 4:06 AM To: php-generallists.php.net Subject: [PHP] PHP4 and MS Excel?

    I would like to give my users the ability to send (to my website) a Microsoft Excel file, and then have my server (PHP code) extract that data and turn it into a TAB Delimited Text file -- is this possible with PHP?

    Thanks. Jason

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

    attached mail follows:


    Here we go again; I posted the message "pdflib, NEED HELP with function problem (newby)" and thank you to all that helped. Even after that help, seems I cant understand scope to well.

    Im trying to make a function that creates another page when I have reached the bottom of a page. For some reason everytime I try to include a PDF_function call inside a function I get an out of scope error message. Like so:

    "Fatal error: PDFlib error: function 'PDF_begin_page' must not be called in 'page' scope"

    The function I created is below

    function next_page($throw) { global $p;

    if ($throw = "open") { PDF_begin_page($p, 600, 800); return; }

    if ($throw = "close")

    PDF_end_page($p); return; } }

    All I do is put in to var $throw open or close and its not working; $p is global, what am I doing wrong? Im really having a terrible time with scope and php, no calles from PDF seem to want to work inside a function. Thanks for any help you guys can give me. Im pulling my hair out. PHP is a great language but this scope stuff is givin me fits.

    Jeff

    attached mail follows:


    Diregard the missing "{" bracket its not the problem, I dont why its missing from my post.

    Jeff

    Jeffrey <dumprelaypoint.net> wrote in message news:20020730184118.35774.qmailpb1.pair.com... > Here we go again; I posted the message "pdflib, NEED HELP with > function problem (newby)" and thank you to all that helped. Even > after that help, seems I cant understand scope to well. > > Im trying to make a function that creates another page when I > have reached the bottom of a page. For some reason everytime I try to > include a PDF_function call inside a function I get an out of scope > error message. Like so: > > "Fatal error: PDFlib error: function 'PDF_begin_page' must not be > called in 'page' scope" > > The function I created is below > > function next_page($throw) > { > global $p; > > if ($throw = "open") > { > PDF_begin_page($p, 600, 800); > return; > } > > if ($throw = "close") > > > PDF_end_page($p); > return; > } > } > > All I do is put in to var $throw open or close and its not > working; $p is global, what am I doing wrong? Im really having a terrible > time > with scope and php, no calles from PDF seem to want to work inside a > function. Thanks for any help you guys can give me. Im pulling my hair out. > PHP is > a great language but this scope stuff is givin me fits. > > Jeff > > >

    attached mail follows:


    Sounds like you didn't call pdf_end_page() before calling your next_page() function.

    -Rasmus

    On Tue, 30 Jul 2002, Jeffrey wrote:

    > Here we go again; I posted the message "pdflib, NEED HELP with > function problem (newby)" and thank you to all that helped. Even > after that help, seems I cant understand scope to well. > > Im trying to make a function that creates another page when I > have reached the bottom of a page. For some reason everytime I try to > include a PDF_function call inside a function I get an out of scope > error message. Like so: > > "Fatal error: PDFlib error: function 'PDF_begin_page' must not be > called in 'page' scope" > > The function I created is below > > function next_page($throw) > { > global $p; > > if ($throw = "open") > { > PDF_begin_page($p, 600, 800); > return; > } > > if ($throw = "close") > > > PDF_end_page($p); > return; > } > } > > All I do is put in to var $throw open or close and its not > working; $p is global, what am I doing wrong? Im really having a terrible > time > with scope and php, no calles from PDF seem to want to work inside a > function. Thanks for any help you guys can give me. Im pulling my hair out. > PHP is > a great language but this scope stuff is givin me fits. > > Jeff > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php >

    attached mail follows:


    Wish it was that easy, here is the call to end the page right above as im trying to trouble shoot this problem.

    // End document PDF_end_page($p);

    // Test document open close function next_page(open); next_page(close);

    I can remove those next_page function calls and just put in the PDF_begin_page and end page calls and it works right away, but it wont work inside the function :(.

    Jeff

    Rasmus Lerdorf <rasmusphp.net> wrote in message news:Pine.LNX.4.44.0207301142210.22879-100000www.lerdorf.com... > Sounds like you didn't call pdf_end_page() before calling your next_page() > function. > > -Rasmus > > On Tue, 30 Jul 2002, Jeffrey wrote: > > > Here we go again; I posted the message "pdflib, NEED HELP with > > function problem (newby)" and thank you to all that helped. Even > > after that help, seems I cant understand scope to well. > > > > Im trying to make a function that creates another page when I > > have reached the bottom of a page. For some reason everytime I try to > > include a PDF_function call inside a function I get an out of scope > > error message. Like so: > > > > "Fatal error: PDFlib error: function 'PDF_begin_page' must not be > > called in 'page' scope" > > > > The function I created is below > > > > function next_page($throw) > > { > > global $p; > > > > if ($throw = "open") > > { > > PDF_begin_page($p, 600, 800); > > return; > > } > > > > if ($throw = "close") > > > > > > PDF_end_page($p); > > return; > > } > > } > > > > All I do is put in to var $throw open or close and its not > > working; $p is global, what am I doing wrong? Im really having a terrible > > time > > with scope and php, no calles from PDF seem to want to work inside a > > function. Thanks for any help you guys can give me. Im pulling my hair out. > > PHP is > > a great language but this scope stuff is givin me fits. > > > > Jeff > > > > > > > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php > > >

    attached mail follows:


    Oh, watch your = vs. == in your if statements.

    On Tue, 30 Jul 2002, Jeffrey wrote:

    > Wish it was that easy, here is the call to end the page right above as im > trying to trouble shoot this problem. > > // End document > PDF_end_page($p); > > // Test document open close function > next_page(open); > next_page(close); > > > I can remove those next_page function calls and just put in the > PDF_begin_page and end page calls and it works right away, but it wont work > inside the function :(. > > Jeff > > > > Rasmus Lerdorf <rasmusphp.net> wrote in message > news:Pine.LNX.4.44.0207301142210.22879-100000www.lerdorf.com... > > Sounds like you didn't call pdf_end_page() before calling your next_page() > > function. > > > > -Rasmus > > > > On Tue, 30 Jul 2002, Jeffrey wrote: > > > > > Here we go again; I posted the message "pdflib, NEED HELP with > > > function problem (newby)" and thank you to all that helped. Even > > > after that help, seems I cant understand scope to well. > > > > > > Im trying to make a function that creates another page when I > > > have reached the bottom of a page. For some reason everytime I try to > > > include a PDF_function call inside a function I get an out of scope > > > error message. Like so: > > > > > > "Fatal error: PDFlib error: function 'PDF_begin_page' must not be > > > called in 'page' scope" > > > > > > The function I created is below > > > > > > function next_page($throw) > > > { > > > global $p; > > > > > > if ($throw = "open") > > > { > > > PDF_begin_page($p, 600, 800); > > > return; > > > } > > > > > > if ($throw = "close") > > > > > > > > > PDF_end_page($p); > > > return; > > > } > > > } > > > > > > All I do is put in to var $throw open or close and its not > > > working; $p is global, what am I doing wrong? Im really having a > terrible > > > time > > > with scope and php, no calles from PDF seem to want to work inside a > > > function. Thanks for any help you guys can give me. Im pulling my hair > out. > > > PHP is > > > a great language but this scope stuff is givin me fits. > > > > > > Jeff > > > > > > > > > > > > > > > -- > > > 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:


    I feel like an idiot. That was it. :( I hate when that happens, at least Im new at php so I can fogive myself for not seeing it.

    Thanks a whole heap; Ive been staring at this problem for days.

    Jeff

    Rasmus Lerdorf <rasmusphp.net> wrote in message news:Pine.LNX.4.44.0207301435570.9563-100000www.lerdorf.com... > Oh, watch your = vs. == in your if statements. > > On Tue, 30 Jul 2002, Jeffrey wrote: > > > Wish it was that easy, here is the call to end the page right above as im > > trying to trouble shoot this problem. > > > > // End document > > PDF_end_page($p); > > > > // Test document open close function > > next_page(open); > > next_page(close); > > > > > > I can remove those next_page function calls and just put in the > > PDF_begin_page and end page calls and it works right away, but it wont work > > inside the function :(. > > > > Jeff > > > > > > > > Rasmus Lerdorf <rasmusphp.net> wrote in message > > news:Pine.LNX.4.44.0207301142210.22879-100000www.lerdorf.com... > > > Sounds like you didn't call pdf_end_page() before calling your next_page() > > > function. > > > > > > -Rasmus > > > > > > On Tue, 30 Jul 2002, Jeffrey wrote: > > > > > > > Here we go again; I posted the message "pdflib, NEED HELP with > > > > function problem (newby)" and thank you to all that helped. Even > > > > after that help, seems I cant understand scope to well. > > > > > > > > Im trying to make a function that creates another page when I > > > > have reached the bottom of a page. For some reason everytime I try to > > > > include a PDF_function call inside a function I get an out of scope > > > > error message. Like so: > > > > > > > > "Fatal error: PDFlib error: function 'PDF_begin_page' must not be > > > > called in 'page' scope" > > > > > > > > The function I created is below > > > > > > > > function next_page($throw) > > > > { > > > > global $p; > > > > > > > > if ($throw = "open") > > > > { > > > > PDF_begin_page($p, 600, 800); > > > > return; > > > > } > > > > > > > > if ($throw = "close") > > > > > > > > > > > > PDF_end_page($p); > > > > return; > > > > } > > > > } > > > > > > > > All I do is put in to var $throw open or close and its not > > > > working; $p is global, what am I doing wrong? Im really having a > > terrible > > > > time > > > > with scope and php, no calles from PDF seem to want to work inside a > > > > function. Thanks for any help you guys can give me. Im pulling my hair > > out. > > > > PHP is > > > > a great language but this scope stuff is givin me fits. > > > > > > > > Jeff > > > > > > > > > > > > > > > > > > > > -- > > > > 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:


    I would like to show some fields based on a Interbase database, everthing is working when i type the fields name usinf $row-> field

    something like this

    while ($row = ibase_fetch_object($sth)) { echo "<TR><TD>$row->RAZAO_SOCI</TD>"; echo"<TD>$row->ENDERECO</TD></TR>\n" ; }

    But I would like to make a generic output without declaring the field name in code.

    I discover that the code bellow show-me the field names and alias for any feetched database

    while ($row = ibase_fetch_object($sth)) { for ($i=0; $i < $coln; $i++) { $col_info = ibase_field_info($sth, $i); echo "name: ".$col_info['name']." "; echo "alias: ".$col_info['alias']."";

    }

    How can I output the data field content based on field alias ( .$col_info['alias'].""; )

    attached mail follows:


    Use ibase_fetch_row() instead... Then you can use count() on it to see how many columns there are and loop through them all.

    ---John Holmes...

    > -----Original Message----- > From: Saci [mailto:nospambol.com.br] > Sent: Tuesday, July 30, 2002 2:44 PM > To: php-generallists.php.net > Subject: [PHP] $row and alias > > I would like to show some fields based on a Interbase database, everthing > is > working when i type the fields name usinf $row-> field > > something like this > > while ($row = ibase_fetch_object($sth)) { > echo "<TR><TD>$row->RAZAO_SOCI</TD>"; > echo"<TD>$row->ENDERECO</TD></TR>\n" ; > } > > But I would like to make a generic output without declaring the field name > in code. > > I discover that the code bellow show-me the field names and alias for any > feetched database > > while ($row = ibase_fetch_object($sth)) { > for ($i=0; $i < $coln; $i++) { > $col_info = ibase_field_info($sth, $i); > echo "name: ".$col_info['name']." "; > echo "alias: ".$col_info['alias'].""; > > } > > > How can I output the data field content based on field alias ( > .$col_info['alias'].""; ) > > > > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php

    attached mail follows:


    Hi,

    Is it necessary to perform addslashes() on serialised data before inserting it into a database?

    Thanks,

    Danny.

    attached mail follows:


    Yes, you would need to. serialize() does not encode any of the variable data.

    -Rasmus

    On Tue, 30 Jul 2002, Danny Shepherd wrote:

    > Hi, > > Is it necessary to perform addslashes() on serialised data before inserting > it into a database? > > Thanks, > > Danny. > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php >

    attached mail follows:


    Yes, it'd be really smart to. If any of the data in the serialized string has a ' or " in it, it could break your query. Or the user being able to enter a ' or " into the data could open you to SQL attacks.

    You want to do addslashes() on the result of serialize(), not the content going into it, too. PHP will introduct double quotes around any strings that are serialized. These should be escaped or they could end up breaking your query.

    Note that you don't have to do stripslashes() on the serialized string when you pull it out.

    ---John Holmes...

    ----- Original Message ----- From: "Danny Shepherd" <dannykyboshed.com> To: "PHP-General" <php-generallists.php.net> Sent: Tuesday, July 30, 2002 2:56 PM Subject: [PHP] Serialised Data & DBs

    > Hi, > > Is it necessary to perform addslashes() on serialised data before inserting > it into a database? > > Thanks, > > Danny. > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php >

    attached mail follows:


    ----- Original Message ----- From: "1LT John W. Holmes" <holmes072000charter.net> To: "Danny Shepherd" <dannykyboshed.com>; "PHP-General" <php-generallists.php.net> Sent: Tuesday, July 30, 2002 8:18 PM Subject: Re: [PHP] Serialised Data & DBs

    > Yes, it'd be really smart to. If any of the data in the serialized string > has a ' or " in it, it could break your query. Or the user being able to > enter a ' or " into the data could open you to SQL attacks. > > You want to do addslashes() on the result of serialize(), not the content > going into it, too. PHP will introduct double quotes around any strings that > are serialized. These should be escaped or they could end up breaking your > query. Yeah, the contents are already stripslashed.

    > Note that you don't have to do stripslashes() on the serialized string when > you pull it out.

    Cool, didn't realise that - would've been hard to track down later too!

    Thanks,

    Danny.

    attached mail follows:


    Hi,

    Wednesday, July 31, 2002, 5:18:05 AM, you wrote: 1JWH> Yes, it'd be really smart to. If any of the data in the serialized string 1JWH> has a ' or " in it, it could break your query. Or the user being able to 1JWH> enter a ' or " into the data could open you to SQL attacks.

    1JWH> You want to do addslashes() on the result of serialize(), not the content 1JWH> going into it, too. PHP will introduct double quotes around any strings that 1JWH> are serialized. These should be escaped or they could end up breaking your 1JWH> query.

    1JWH> Note that you don't have to do stripslashes() on the serialized string when 1JWH> you pull it out.

    1JWH> ---John Holmes...

    1JWH> ----- Original Message ----- 1JWH> From: "Danny Shepherd" <dannykyboshed.com> 1JWH> To: "PHP-General" <php-generallists.php.net> 1JWH> Sent: Tuesday, July 30, 2002 2:56 PM 1JWH> Subject: [PHP] Serialised Data & DBs

    >> Hi, >> >> Is it necessary to perform addslashes() on serialised data before 1JWH> inserting >> it into a database? >> >> Thanks, >> >> Danny. >> >> >> -- >> PHP General Mailing List (http://www.php.net/) >> To unsubscribe, visit: http://www.php.net/unsub.php >>

    Another trap to fall into is if you have magic quotes on you will need to run strip slashes on any GET or POST variables BEFORE you serialize them, otherwise addslashes will escape the escapes.

    -- 
    regards,
    Tom
    

    attached mail follows:


    I couldn't find any adequate instructions on this anywhere on this list or on the php web site so here is for anyone who needs it.

    I had originally tried: patch <patchfile but that doesn't work, even though file names don't require any stripping with -p option, it is still required: -p0

    My php sources are in /usr/local/src

    cp patchfile /usr/local/src cd /usr/local/src cp php-4.2.1 php-4.2.1.copy patch -p0 <patchfile mv php-4.2.1 php-4.2.2 mv php-4.2.1.copy php-4.2.1

    Then you need to reconfigure, re-make php and install, restart apache. - Greg

    attached mail follows:


    Can somebody please tell me why I keep getting this error when using this script...

    Parse error: parse error in /host/g/i/a/8/b/i/giapai3k.8bit.co.uk/mail.php on line 54

    <?php // Read POST request params into global vars $to = $_POST['to']; $from = $_POST['from']; $subject = $_POST['subject']; $message = $_POST['message'];

    // Obtain file upload vars $fileatt = $_FILES['fileatt']['tmp_name']; $fileatt_type = $_FILES['fileatt']['type']; $fileatt_name = $_FILES['fileatt']['name'];

    $headers = "From: $from";

    if (is_uploaded_file($fileatt)) { // Read the file to be attached ('rb' = read binary) $file = fopen($fileatt,'rb'); $data = fread($file,filesize($fileatt)); fclose($file);

    // Generate a boundary string $semi_rand = md5(time()); $mime_boundary = "==Multipart_Boundary_x{$semi_rand}x";

    // Add the headers for a file attachment $headers .= "\nMIME-Version: 1.0\n" . "Content-Type: multipart/mixed;\n" . " boundary=\"{$mime_boundary}\"";

    // Add a multipart boundary above the plain message $message = "This is a multi-part message in MIME format.\n\n" . "--{$mime_boundary}\n" . "Content-Type: text/plain; charset=\"iso-8859-1\"\n" . "Content-Transfer-Encoding: 7bit\n\n" . $message . "\n\n";

    // Base64 encode the file data $data = chunk_split(base64_encode($data));

    // Add file attachment to the message $message .= "--{$mime_boundary}\n" . "Content-Type: {$fileatt_type};\n" . " name=\"{$fileatt_name}\"\n" . //"Content-Disposition: attachment;\n" . //" filename=\"{$fileatt_name}\"\n" . "Content-Transfer-Encoding: base64\n\n" . $data . "\n\n" . "--{$mime_boundary}--\n"; }

    // Send the message $ok = mail($to, $subject, $message, $headers); if ($ok) { echo "<p>Mail sent! Yay PHP!</p>"; } else { echo "<p>Mail could not be sent. Sorry!</p>"; } ?>

    attached mail follows:


    Also , Fatal error: Call to undefined function: is_uploaded_file() in /host/g/i/a/8/b/i/giapai3k.8bit.co.uk/mail.php on line 20

    "Kerry Gray" <Kerry.Simonbtopenworld.com> wrote in message news:20020730190709.65499.qmailpb1.pair.com... > Can somebody please tell me why I keep getting this error when using this > script... > > Parse error: parse error in /host/g/i/a/8/b/i/giapai3k.8bit.co.uk/mail.php > on line 54 > > > > <?php > // Read POST request params into global vars > $to = $_POST['to']; > $from = $_POST['from']; > $subject = $_POST['subject']; > $message = $_POST['message']; > > // Obtain file upload vars > $fileatt = $_FILES['fileatt']['tmp_name']; > $fileatt_type = $_FILES['fileatt']['type']; > $fileatt_name = $_FILES['fileatt']['name']; > > $headers = "From: $from"; > > if (is_uploaded_file($fileatt)) { > // Read the file to be attached ('rb' = read binary) > $file = fopen($fileatt,'rb'); > $data = fread($file,filesize($fileatt)); > fclose($file); > > // Generate a boundary string > $semi_rand = md5(time()); > $mime_boundary = "==Multipart_Boundary_x{$semi_rand}x"; > > // Add the headers for a file attachment > $headers .= "\nMIME-Version: 1.0\n" . > "Content-Type: multipart/mixed;\n" . > " boundary=\"{$mime_boundary}\""; > > // Add a multipart boundary above the plain message > $message = "This is a multi-part message in MIME format.\n\n" . > "--{$mime_boundary}\n" . > "Content-Type: text/plain; charset=\"iso-8859-1\"\n" . > "Content-Transfer-Encoding: 7bit\n\n" . > $message . "\n\n"; > > // Base64 encode the file data > $data = chunk_split(base64_encode($data)); > > // Add file attachment to the message > $message .= "--{$mime_boundary}\n" . > "Content-Type: {$fileatt_type};\n" . > " name=\"{$fileatt_name}\"\n" . > //"Content-Disposition: attachment;\n" . > //" filename=\"{$fileatt_name}\"\n" . > "Content-Transfer-Encoding: base64\n\n" . > $data . "\n\n" . > "--{$mime_boundary}--\n"; > } > > // Send the message > $ok = mail($to, $subject, $message, $headers); > if ($ok) { > echo "<p>Mail sent! Yay PHP!</p>"; > } else { > echo "<p>Mail could not be sent. Sorry!</p>"; > } > ?> > > > >

    attached mail follows:


    Which php version? This code works just fine here.

    On Tue, 30 Jul 2002, Kerry Gray wrote:

    > Also , Fatal error: Call to undefined function: is_uploaded_file() in > /host/g/i/a/8/b/i/giapai3k.8bit.co.uk/mail.php on line 20 > > "Kerry Gray" <Kerry.Simonbtopenworld.com> wrote in message > news:20020730190709.65499.qmailpb1.pair.com... > > Can somebody please tell me why I keep getting this error when using this > > script... > > > > Parse error: parse error in /host/g/i/a/8/b/i/giapai3k.8bit.co.uk/mail.php > > on line 54 > > > > > > > > <?php > > // Read POST request params into global vars > > $to = $_POST['to']; > > $from = $_POST['from']; > > $subject = $_POST['subject']; > > $message = $_POST['message']; > > > > // Obtain file upload vars > > $fileatt = $_FILES['fileatt']['tmp_name']; > > $fileatt_type = $_FILES['fileatt']['type']; > > $fileatt_name = $_FILES['fileatt']['name']; > > > > $headers = "From: $from"; > > > > if (is_uploaded_file($fileatt)) { > > // Read the file to be attached ('rb' = read binary) > > $file = fopen($fileatt,'rb'); > > $data = fread($file,filesize($fileatt)); > > fclose($file); > > > > // Generate a boundary string > > $semi_rand = md5(time()); > > $mime_boundary = "==Multipart_Boundary_x{$semi_rand}x"; > > > > // Add the headers for a file attachment > > $headers .= "\nMIME-Version: 1.0\n" . > > "Content-Type: multipart/mixed;\n" . > > " boundary=\"{$mime_boundary}\""; > > > > // Add a multipart boundary above the plain message > > $message = "This is a multi-part message in MIME format.\n\n" . > > "--{$mime_boundary}\n" . > > "Content-Type: text/plain; charset=\"iso-8859-1\"\n" . > > "Content-Transfer-Encoding: 7bit\n\n" . > > $message . "\n\n"; > > > > // Base64 encode the file data > > $data = chunk_split(base64_encode($data)); > > > > // Add file attachment to the message > > $message .= "--{$mime_boundary}\n" . > > "Content-Type: {$fileatt_type};\n" . > > " name=\"{$fileatt_name}\"\n" . > > //"Content-Disposition: attachment;\n" . > > //" filename=\"{$fileatt_name}\"\n" . > > "Content-Transfer-Encoding: base64\n\n" . > > $data . "\n\n" . > > "--{$mime_boundary}--\n"; > > } > > > > // Send the message > > $ok = mail($to, $subject, $message, $headers); > > if ($ok) { > > echo "<p>Mail sent! Yay PHP!</p>"; > > } else { > > echo "<p>Mail could not be sent. Sorry!</p>"; > > } > > ?> > > > > > > > > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php >

    attached mail follows:


    Things like file uploading and mail functions are disabled on free PHP hosts like 8bit.

    KG> Also , Fatal error: Call to undefined function: is_uploaded_file() in KG> /host/g/i/a/8/b/i/giapai3k.8bit.co.uk/mail.php on line 20

    KG> "Kerry Gray" <Kerry.Simonbtopenworld.com> wrote in message KG> news:20020730190709.65499.qmailpb1.pair.com... >> Can somebody please tell me why I keep getting this error when using this >> script... >> >> Parse error: parse error in /host/g/i/a/8/b/i/giapai3k.8bit.co.uk/mail.php >> on line 54 >> >> >> >> <?php >> // Read POST request params into global vars >> $to = $_POST['to']; >> $from = $_POST['from']; >> $subject = $_POST['subject']; >> $message = $_POST['message']; >> >> // Obtain file upload vars >> $fileatt = $_FILES['fileatt']['tmp_name']; >> $fileatt_type = $_FILES['fileatt']['type']; >> $fileatt_name = $_FILES['fileatt']['name']; >> >> $headers = "From: $from"; >> >> if (is_uploaded_file($fileatt)) { >> // Read the file to be attached ('rb' = read binary) >> $file = fopen($fileatt,'rb'); >> $data = fread($file,filesize($fileatt)); >> fclose($file); >> >> // Generate a boundary string >> $semi_rand = md5(time()); >> $mime_boundary = "==Multipart_Boundary_x{$semi_rand}x"; >> >> // Add the headers for a file attachment >> $headers .= "\nMIME-Version: 1.0\n" . >> "Content-Type: multipart/mixed;\n" . >> " boundary=\"{$mime_boundary}\""; >> >> // Add a multipart boundary above the plain message >> $message = "This is a multi-part message in MIME format.\n\n" . >> "--{$mime_boundary}\n" . >> "Content-Type: text/plain; charset=\"iso-8859-1\"\n" . >> "Content-Transfer-Encoding: 7bit\n\n" . >> $message . "\n\n"; >> >> // Base64 encode the file data >> $data = chunk_split(base64_encode($data)); >> >> // Add file attachment to the message >> $message .= "--{$mime_boundary}\n" . >> "Content-Type: {$fileatt_type};\n" . >> " name=\"{$fileatt_name}\"\n" . >> //"Content-Disposition: attachment;\n" . >> //" filename=\"{$fileatt_name}\"\n" . >> "Content-Transfer-Encoding: base64\n\n" . >> $data . "\n\n" . >> "--{$mime_boundary}--\n"; >> } >> >> // Send the message >> $ok = mail($to, $subject, $message, $headers); >> if ($ok) { >> echo "<p>Mail sent! Yay PHP!</p>"; >> } else { >> echo "<p>Mail could not be sent. Sorry!</p>"; >> } >> ?> >> >> >> >>

    attached mail follows:


    On Wednesday 31 July 2002 03:08, Kerry Gray wrote: > Can somebody please tell me why I keep getting this error when using this > script...

    Because what you wrote is invalid PHP code.

    > Parse error: parse error in /host/g/i/a/8/b/i/giapai3k.8bit.co.uk/mail.php > on line 54

    It's bad enough asking people to 'debug' your invalidly written code (use a decent editor with syntax highlighting), but do you really expect people to count the lines of your code and work out which is line 54? Make it easier for people to help you and indicate which is line 54.

    In the meantime try checking for matching braces/brackets/parantheses/double-quotes/single-quotes, missing semicolons.

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

    /* Gordon's Law: If you think you have the solution, the question was poorly phrased. */

    attached mail follows:


    I didn't write it, it was taken from a code library on a site. i have never used php before in my life, hence why I have no idea whats going on, it's more than likely the only thing i'll use php for.

    "Jason Wong" <php-generalgremlins.com.hk> wrote in message news:200207310321.40894.php-generalgremlins.com.hk... > On Wednesday 31 July 2002 03:08, Kerry Gray wrote: > > Can somebody please tell me why I keep getting this error when using this > > script... > > Because what you wrote is invalid PHP code. > > > Parse error: parse error in /host/g/i/a/8/b/i/giapai3k.8bit.co.uk/mail.php > > on line 54 > > It's bad enough asking people to 'debug' your invalidly written code (use a > decent editor with syntax highlighting), but do you really expect people to > count the lines of your code and work out which is line 54? Make it easier > for people to help you and indicate which is line 54. > > In the meantime try checking for matching > braces/brackets/parantheses/double-quotes/single-quotes, missing semicolons. > > -- > Jason Wong -> Gremlins Associates -> www.gremlins.com.hk > Open Source Software Systems Integrators > * Web Design & Hosting * Internet & Intranet Applications Development * > > /* > Gordon's Law: > If you think you have the solution, the question was poorly phrased. > */ >

    attached mail follows:


    OK, I have changed hosts, and put it on a NON free server php enabled. it tells me that tghe mail has been sent, but no mail arrives....

    Any constructive ideas? PLEASE

    "Damian Harouff" <php-listscekkent.net> wrote in message news:8960900480.20020730142732cekkent.net... > Things like file uploading and mail functions are disabled on free PHP > hosts like 8bit. > > KG> Also , Fatal error: Call to undefined function: is_uploaded_file() in > KG> /host/g/i/a/8/b/i/giapai3k.8bit.co.uk/mail.php on line 20 > > KG> "Kerry Gray" <Kerry.Simonbtopenworld.com> wrote in message > KG> news:20020730190709.65499.qmailpb1.pair.com... > >> Can somebody please tell me why I keep getting this error when using this > >> script... > >> > >> Parse error: parse error in /host/g/i/a/8/b/i/giapai3k.8bit.co.uk/mail.php > >> on line 54 > >> > >> > >> > >> <?php > >> // Read POST request params into global vars > >> $to = $_POST['to']; > >> $from = $_POST['from']; > >> $subject = $_POST['subject']; > >> $message = $_POST['message']; > >> > >> // Obtain file upload vars > >> $fileatt = $_FILES['fileatt']['tmp_name']; > >> $fileatt_type = $_FILES['fileatt']['type']; > >> $fileatt_name = $_FILES['fileatt']['name']; > >> > >> $headers = "From: $from"; > >> > >> if (is_uploaded_file($fileatt)) { > >> // Read the file to be attached ('rb' = read binary) > >> $file = fopen($fileatt,'rb'); > >> $data = fread($file,filesize($fileatt)); > >> fclose($file); > >> > >> // Generate a boundary string > >> $semi_rand = md5(time()); > >> $mime_boundary = "==Multipart_Boundary_x{$semi_rand}x"; > >> > >> // Add the headers for a file attachment > >> $headers .= "\nMIME-Version: 1.0\n" . > >> "Content-Type: multipart/mixed;\n" . > >> " boundary=\"{$mime_boundary}\""; > >> > >> // Add a multipart boundary above the plain message > >> $message = "This is a multi-part message in MIME format.\n\n" . > >> "--{$mime_boundary}\n" . > >> "Content-Type: text/plain; charset=\"iso-8859-1\"\n" . > >> "Content-Transfer-Encoding: 7bit\n\n" . > >> $message . "\n\n"; > >> > >> // Base64 encode the file data > >> $data = chunk_split(base64_encode($data)); > >> > >> // Add file attachment to the message > >> $message .= "--{$mime_boundary}\n" . > >> "Content-Type: {$fileatt_type};\n" . > >> " name=\"{$fileatt_name}\"\n" . > >> //"Content-Disposition: attachment;\n" . > >> //" filename=\"{$fileatt_name}\"\n" . > >> "Content-Transfer-Encoding: base64\n\n" . > >> $data . "\n\n" . > >> "--{$mime_boundary}--\n"; > >> } > >> > >> // Send the message > >> $ok = mail($to, $subject, $message, $headers); > >> if ($ok) { > >> echo "<p>Mail sent! Yay PHP!</p>"; > >> } else { > >> echo "<p>Mail could not be sent. Sorry!</p>"; > >> } > >> ?> > >> > >> > >> > >> >

    attached mail follows:


    I'd like to thank you all, problem has now been solved. It was a problem at THEIR end, not mine...

    thanks again

    Kerry

    "Kerry Gray" <Kerry.Simonbtopenworld.com> wrote in message news:20020730195104.9201.qmailpb1.pair.com... > OK, I have changed hosts, and put it on a NON free server php enabled. it > tells me that tghe mail has been sent, but no mail arrives.... > > Any constructive ideas? PLEASE > > > > "Damian Harouff" <php-listscekkent.net> wrote in message > news:8960900480.20020730142732cekkent.net... > > Things like file uploading and mail functions are disabled on free PHP > > hosts like 8bit. > > > > KG> Also , Fatal error: Call to undefined function: is_uploaded_file() in > > KG> /host/g/i/a/8/b/i/giapai3k.8bit.co.uk/mail.php on line 20 > > > > KG> "Kerry Gray" <Kerry.Simonbtopenworld.com> wrote in message > > KG> news:20020730190709.65499.qmailpb1.pair.com... > > >> Can somebody please tell me why I keep getting this error when using > this > > >> script... > > >> > > >> Parse error: parse error in > /host/g/i/a/8/b/i/giapai3k.8bit.co.uk/mail.php > > >> on line 54 > > >> > > >> > > >> > > >> <?php > > >> // Read POST request params into global vars > > >> $to = $_POST['to']; > > >> $from = $_POST['from']; > > >> $subject = $_POST['subject']; > > >> $message = $_POST['message']; > > >> > > >> // Obtain file upload vars > > >> $fileatt = $_FILES['fileatt']['tmp_name']; > > >> $fileatt_type = $_FILES['fileatt']['type']; > > >> $fileatt_name = $_FILES['fileatt']['name']; > > >> > > >> $headers = "From: $from"; > > >> > > >> if (is_uploaded_file($fileatt)) { > > >> // Read the file to be attached ('rb' = read binary) > > >> $file = fopen($fileatt,'rb'); > > >> $data = fread($file,filesize($fileatt)); > > >> fclose($file); > > >> > > >> // Generate a boundary string > > >> $semi_rand = md5(time()); > > >> $mime_boundary = "==Multipart_Boundary_x{$semi_rand}x"; > > >> > > >> // Add the headers for a file attachment > > >> $headers .= "\nMIME-Version: 1.0\n" . > > >> "Content-Type: multipart/mixed;\n" . > > >> " boundary=\"{$mime_boundary}\""; > > >> > > >> // Add a multipart boundary above the plain message > > >> $message = "This is a multi-part message in MIME format.\n\n" . > > >> "--{$mime_boundary}\n" . > > >> "Content-Type: text/plain; charset=\"iso-8859-1\"\n" . > > >> "Content-Transfer-Encoding: 7bit\n\n" . > > >> $message . "\n\n"; > > >> > > >> // Base64 encode the file data > > >> $data = chunk_split(base64_encode($data)); > > >> > > >> // Add file attachment to the message > > >> $message .= "--{$mime_boundary}\n" . > > >> "Content-Type: {$fileatt_type};\n" . > > >> " name=\"{$fileatt_name}\"\n" . > > >> //"Content-Disposition: attachment;\n" . > > >> //" filename=\"{$fileatt_name}\"\n" . > > >> "Content-Transfer-Encoding: base64\n\n" . > > >> $data . "\n\n" . > > >> "--{$mime_boundary}--\n"; > > >> } > > >> > > >> // Send the message > > >> $ok = mail($to, $subject, $message, $headers); > > >> if ($ok) { > > >> echo "<p>Mail sent! Yay PHP!</p>"; > > >> } else { > > >> echo "<p>Mail could not be sent. Sorry!</p>"; > > >> } > > >> ?> > > >> > > >> > > >> > > >> > > > >

    attached mail follows:


    >use a decent editor with syntax highlighting

    What is a free cross platform syntax highlighting editor? Are there any Open Source ones that you know of?

    attached mail follows:


    List, I get this after make install....is this thing trying to make sapi? I want to run on Apache/RH7.3 so I don't know if I need it...couldn't find how to turn in with ./configure. Please help

    TIA /B

    make[1]: Leaving directory `/usr/src/php-4.2.2/regex' Making install in . make[1]: Entering directory `/usr/src/php-4.2.2' make[1]: *** [install-sapi] Error 1 make[1]: Leaving directory `/usr/src/php-4.2.2' make: *** [install-recursive] Error 1

    attached mail follows:


    I think your actual error is much further up - the sapi appears because you're building PHP as an Apache module.

    The actual error will have a (kind of) English description - post that along with your config options and a more detailed description of your setup and maybe we can help.

    Danny.

    ----- Original Message ----- From: "David Busby" <busbypnts.com> To: <php-generallists.php.net> Sent: Tuesday, July 30, 2002 8:16 PM Subject: [PHP] Trouble Making 4.2.2

    > List, > I get this after make install....is this thing trying to make sapi? I > want to run on Apache/RH7.3 so I don't know if I need it...couldn't find > how to turn in with ./configure. Please help > > TIA > /B > > > make[1]: Leaving directory `/usr/src/php-4.2.2/regex' > Making install in . > make[1]: Entering directory `/usr/src/php-4.2.2' > make[1]: *** [install-sapi] Error 1 > make[1]: Leaving directory `/usr/src/php-4.2.2' > make: *** [install-recursive] Error 1 > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php >

    attached mail follows:


    I can pass one variable using the url on this way

    http://myadress/php/mypage.php?modo=123

    and to read i have the code

    echo $_GET['modo']."<BR";

    That's work fine on 4.21

    How can I pass and read 3 variables instead of one ?

    I nedd to pass mode = 123 color= red size=3

    using the url

    I tried http://myadress/php/mypage.php?modo=123&color=red&size=3

    and to get

    echo $_GET['modo']."<BR"; echo $_GET['color']."<BR"; echo $_GET['size']."<BR";

    but does not work

    How can i do that

    attached mail follows:


    http://myaddress/php/mypage.php?modo=123&color=red&size=3

    Just separate name/value pairs with ampersand (&).

    HTH

    Martin Clifford Homepage: http://www.completesource.net Developer's Forums: http://www.completesource.net/forums/

    >>> "Saci" <nospambol.com.br> 07/30/02 04:09PM >>> I can pass one variable using the url on this way

    http://myadress/php/mypage.php?modo=123

    and to read i have the code

    echo $_GET['modo']."<BR";

    That's work fine on 4.21

    How can I pass and read 3 variables instead of one ?

    I nedd to pass mode = 123 color= red size=3

    using the url

    I tried http://myadress/php/mypage.php?modo=123&color=red&size=3

    and to get

    echo $_GET['modo']."<BR"; echo $_GET['color']."<BR"; echo $_GET['size']."<BR";

    but does not work

    How can i do that

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

    attached mail follows:


    You are passing the variables correctly. If that's your actual code

    echo $_GET['modo']."<BR"; echo $_GET['color']."<BR"; echo $_GET['size']."<BR";

    then you need <br> (note the closing > ) - PHP is doing what you told it, and your browser is confused by the output. If PHP were the problem you'd probably see an error message. Also, upgrade to 4.2.2 please :) Regards, Colin Teubner

    attached mail follows:


    Is this a direct copy from your code? > echo $_GET['modo']."<BR"; > echo $_GET['color']."<BR"; > echo $_GET['size']."<BR"; if so, you'll need to close the <br> tags

    see if that helps Martin

    -----Original Message----- From: Saci [mailto:nospambol.com.br] Sent: Wednesday, July 31, 2002 6:09 AM To: php-generallists.php.net Subject: [PHP] passing variable via url ( newbye question)

    I can pass one variable using the url on this way

    http://myadress/php/mypage.php?modo=123

    and to read i have the code

    echo $_GET['modo']."<BR";

    That's work fine on 4.21

    How can I pass and read 3 variables instead of one ?

    I nedd to pass mode = 123 color= red size=3

    using the url

    I tried http://myadress/php/mypage.php?modo=123&color=red&size=3

    and to get

    echo $_GET['modo']."<BR"; echo $_GET['color']."<BR"; echo $_GET['size']."<BR";

    but does not work

    How can i do that

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

    attached mail follows:


    I'm having a problem getting the mail() function working on php 4.2.2.

    I get the error message: Warning: mail() is not supported in this PHP build

    I'm running Solaris 8 and have set the symlink for sendmail. I have recompiled PHP, set the php.ini to point to sendmail and restarted the web server.

    ; For Unix only. ;You may supply arguments as well (default: 'sendmail -t -i'). sendmail_path = "/usr/sbin/sendmail -t -i"

    (I've tried it with and without quotes)

    Still no luck...

    Any ideas?

    Thanks!

    John

    attached mail follows:


    Try rm config.cache, re-configure and try again

    On Tue, 30 Jul 2002, John Williams wrote:

    > I'm having a problem getting the mail() function working on php 4.2.2. > > I get the error message: > Warning: mail() is not supported in this PHP build > > I'm running Solaris 8 and have set the symlink for sendmail. I have > recompiled PHP, set the php.ini to point to sendmail and restarted the > web server. > > ; For Unix only. > ;You may supply arguments as well (default: 'sendmail -t -i'). > sendmail_path = "/usr/sbin/sendmail -t -i" > > (I've tried it with and without quotes) > > > Still no luck... > > Any ideas? > > Thanks! > > John > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php >

    attached mail follows:


    Jay Blanchard wrote: > Howdy all! > > Just wanted to remind everyone that sign-up for the PHP Meetup is still in > progress at http://php.meetup.com . At latest count there are 289 folks > signed up world-wide with the top 10 cities being; > > Washington DC (9 members) > Toronto (9 members) > Leeds, UK (8 members) > London, England (8 members) > Amsterdam (7 members) > Melbourne (6 members) > Atlanta (5 members) > Oakland-Alameda, CA (5 members) > Manhattan (below 42nd St) (5 members) > Montréal (4 members) > > Why do something like this? Meet other developers, networking (you can never > tell when you're going to need another pair of hands for a project), > networking (you can never tell when someone is going to need to hire extra > hands for a project), and networking (you get the idea). Sign up soon! There > are thousands of PHP folks out there, spread the word. >

    First of all, sorry for the additional cross post. MeetUp.com lacks the ability to let you contact other folks who have signed up. In my general area, Massachusetts, there are a bunch of tiny groups scattered about, and I'd like a chance to get all of them to converge in one place to make the meetup worth it for all of us. I know there's only a few days before the meetup is to take place, but if folks from the following areas could email me, then we can try and work out somewhere we can all meet, instead of there being 5 groups of 2 or 3 people.

    Boston, Ma Hyannis, Ma North Boston Suburbs Springfield, Ma Manchester, NH

    (heck, even people in RI and CT who don't mind driving)

    Meetup.com cancels meetups for groups less than 5 also, so I'd like to see if we can just get one or two big groups.

    Also, anyone else in this area... I've been looking for user groups in the Massachusetts area, and the only one that did exist, was PHPUG New England, which doesn't seem to exist anymore. Anyone interested in getting one going around here?

    Again, sorry for the cross post.

    -- 
    Gabriel Ricard
    gabesumorai.net
    

    attached mail follows:


    ----- Original Message ----- From: "Tech Support" <jgrillweb-1hosting.net> To: "Danny Shepherd" <dannykyboshed.com> Sent: Tuesday, July 30, 2002 6:44 PM Subject: Re: [PHP] Sessions - Informed Opinions

    > If you're on a shared system it's very easy for other users on your machine > to read session data. All you have to do is opendir("/tmp") and then > readdir() and copy the files into something you can read. I have programmed > a few commerce sites and this issue has bothered me a few times and with > each new site I find better and more secure methods.

    Yeah, the whole shared hosting thing has me bothered - until Apache can run as a different user for each vhost (allowing tighter filesystem security on the docroot), I'm steering well clear of the whole situation - thankfully our clients generally own their own boxes :-)

    > The beauty of sessions in php is that the user does not need to accept > cookies for it to work. If you have --enable-trans-sid, which on by default > in 4.2.X you only need to manually add the session id in two cases: > > 1. you are using a full URL in a form or a link. Even if it's your full URL > php will still assume it's off site and thus not append the session id to > the query string. > > 2. You use a header redirect (relative or full URL) > > I use mysql to store session data via session_set_save handler in favor of > file type. It took me a long time to find code that worked because the > documentation is not as clear as it could be. I found some code that half > way worked but it would seg fault apache on my system so I search message > boards and asked questions until I found the problem. I now have a set of > functions that work great. Anyway, what I'm getting at is that, if you want > it, I would be happy to share it with you.

    Thanks for the offer but guess what I've just finished doing? :-) I'll agree that the docs were well flaky though!

    Thanks,

    Danny.

    attached mail follows:


    I've CC'd a copy of your message plus this reply to the PHP mailing list for the benefit of the rest of the PHP community as well. (That and one of them might have a solution to this)

    I never found a clean solution to this problem with PDF files with cache: no-cache set. There are a couple of ways around this that I know of:

    1. Rather than outputting the PDF file, physically create it in a web-accessible directory (with some randomly-generated filename, md5(uniqid("pdf")) . ".pdf" would work) and redirect the user to it.

    2. Better, dump the entire PDF file into a database using some uniqid() to reference it and a timestamp, and redirect to a PHP script that doesn't use sessions/doesn't send the cache-control header (or uses cache-control: private) which pulls the PDF back out of the database and feeds it to the user. The timestamp can be used to automatically delete the file after a short time, 5-30 minutes later depending on the length of the PDF.

    Neither of these solutions are perfect, however, and if the PDF contains security-sensitive information you still have the same problem as they'll be cached.

    If you want to do further research into this, I periodically hear something about an issue between Apache and PDF, but I don't know the details of that. It's possible the problems are related -- if so, there may be a fix somewhere on the Apache site.

    -- Daniel Grace

    ----- Original Message ----- From: "Dylan Miller" <dylan.millersolimarsystems.com> To: <rubeinearthlink.net> Sent: Tuesday, July 30, 2002 1:17 PM Subject: open or save problem

    > Daniel Grace, > > Hi, I saw a post of yours on the php.general message board: > > http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&oe=UTF8&selm=20020302062 > 856.49458.qmail%40pb1.pair.com > > I'm writing a program to send a PDF file to a browser, and I get the exact > problem you describe when I set Cache-Control to no-cache. If I remove the > Cache-Control header, everything works fine, but with it in there, I get the > "open or save" dialog with open grayed out. For security reasons, I'd like > to avoid caching. > > I was just wondering if you ever found out anything more about this. I've > been reading and searching the web, and your post was the only thing I could > find related to this issue. I'd really appreciate any insight you could give > me. > > Thanks, > Dylan Miller > Solimar Systems, Inc. >

    attached mail follows:


    Thanks so much for the quick reply, it was helpful. It sounds like neither of us know WHY the "open or save" thing happens with "no-cache" or "no-store." That's what I'd really like to know. Is this by design, or is it a bug in IE?

    If you run across any more info on this, please let me know.

    Thanks for your help.

    Dylan Miller Solimar Systems, Inc.

    -----Original Message----- From: Daniel Grace [mailto:rubeinearthlink.net] Sent: Tuesday, July 30, 2002 2:59 PM To: Dylan Miller Cc: php-generallists.php.net Subject: Re: open or save problem

    I've CC'd a copy of your message plus this reply to the PHP mailing list for the benefit of the rest of the PHP community as well. (That and one of them might have a solution to this)

    I never found a clean solution to this problem with PDF files with cache: no-cache set. There are a couple of ways around this that I know of:

    1. Rather than outputting the PDF file, physically create it in a web-accessible directory (with some randomly-generated filename, md5(uniqid("pdf")) . ".pdf" would work) and redirect the user to it.

    2. Better, dump the entire PDF file into a database using some uniqid() to reference it and a timestamp, and redirect to a PHP script that doesn't use sessions/doesn't send the cache-control header (or uses cache-control: private) which pulls the PDF back out of the database and feeds it to the user. The timestamp can be used to automatically delete the file after a short time, 5-30 minutes later depending on the length of the PDF.

    Neither of these solutions are perfect, however, and if the PDF contains security-sensitive information you still have the same problem as they'll be cached.

    If you want to do further research into this, I periodically hear something about an issue between Apache and PDF, but I don't know the details of that. It's possible the problems are related -- if so, there may be a fix somewhere on the Apache site.

    -- Daniel Grace

    ----- Original Message ----- From: "Dylan Miller" <dylan.millersolimarsystems.com> To: <rubeinearthlink.net> Sent: Tuesday, July 30, 2002 1:17 PM Subject: open or save problem

    > Daniel Grace, > > Hi, I saw a post of yours on the php.general message board: > > http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&oe=UTF8&selm=20020302062 > 856.49458.qmail%40pb1.pair.com > > I'm writing a program to send a PDF file to a browser, and I get the exact > problem you describe when I set Cache-Control to no-cache. If I remove the > Cache-Control header, everything works fine, but with it in there, I get the > "open or save" dialog with open grayed out. For security reasons, I'd like > to avoid caching. > > I was just wondering if you ever found out anything more about this. I've > been reading and searching the web, and your post was the only thing I could > find related to this issue. I'd really appreciate any insight you could give > me. > > Thanks, > Dylan Miller > Solimar Systems, Inc. >

    attached mail follows:


    wow I like it :) thanks alot Tom you've been a big help and showed me something I never knew before also at the time Thanks to all who help me with this , it's very much appreciated Deadsam

    "Tom Rogers" <trogerskwikin.com> wrote in message news:176145653769.20020730184700kwikin.com... > Hi, > > Tuesday, July 30, 2002, 1:53:50 PM, you wrote: > D> This looks good but I just have one question about it if you don't mind, > D> what if someone was uploading a gif or a PNG file? can it be made to only > D> detect jpgs? > D> Thanks in advance > D> Deadsam > > >> Try it this way, it will check if it is a jpeg and it has a horizontal > >> and vertical size so you can be pretty sure it is an image file. > >> (you do not need the gd package for getimagesize()) > >> > >> > >> /** Check for the type of the image : only allow jpeg's */ > >> $im = getimagesize($_FILES['uploadFile'); > >> if(!($im[2] == 2 && $im[0] > 0 && $im[1] > 0)){ > >> echo "You can only upload jpg images."; > >> exit(); > >> } > > The $im[2] being set to 2 means it is a jpeg other image types have a > different number, have a look at the getimagesize()function for details > > > > > -- > regards, > Tom >

    attached mail follows:


    Hello,

    I'm developing a web app, that needs to generate a PDF file.

    The "background" of the PDF will be a high resolution image (300dpi). and I calculate the scaling factor from the resolution of the image.

    $dpi_x =PDF_get_value($p,"resx",$image); $dpi_y =PDF_get_value($p,"resy",$image); /*calculate scaling factors from the dpi values */ if ($dpi_x >0 && $dpi_y >0){ $scale_x =(72.0)/$dpi_x; $scale_y =(72.0)/$dpi_y;

    Now, I have the pixel coordenates of the text that will be written (I have the text, color, font, textX and textY). This coordenates were taken from the way it looked on a 72 dpi image. How can I get the cordenates that I sould use on the PDF??.. because if I use the same coord I have, it places the text waaaay out of where it's supposed to be. Please advice!.

    Oscar.-

    attached mail follows:


    Sorry, The code wasn't complete for the scaling thing.

    $dpi_x =PDF_get_value($p,"resx",$image); $dpi_y =PDF_get_value($p,"resy",$image); /*calculate scaling factors from the dpi values */ if ($dpi_x >0 && $dpi_y >0){ $scale_x =(72.0)/$dpi_x; $scale_y =(72.0)/$dpi_y; } else if ($dpi_x <0 && $dpi_y < 0){ $scale_x = 1.0; $scale_y = $dpi_y / $dpi_x; } else { $scale_x =1.0; $scale_y =1.0; } PDF_begin_page($p,PDF_get_value($p,"imagewidth",$image)*$scale_x, PDF_get_value($p,"imageheight",$image)*$scale_y); PDF_scale($p,$scale_x,$scale_y); PDF_place_image($p,$image,0.0,0.0,1.0); PDF_close_image($p,$image);

    THANKS! :)

    Oscar.-

    attached mail follows:


    Hi all...

    I want to know how do you guys learn so much about PHP?

    I have just started PHP about a month and a half ago and pior to that, I have ABSOLUTELY NO knowledge in programming.

    I bought 2 books, which is Begining PHP4 (Wrox Press) and Core PHP programming (Prentice Hall). And that's all I can afford now... (I don't have a lot of money.. i learn using my friend's computer). However, I am determined to specialize in PHP.

    Can anyone point me towards a direction on how to do this properly?

    Can anyone guide me through by letting me do a small part (more importantly not critical) of your projects as an excercise so that I can start a journey of discovery?

    Thanks to all of you. And most of all thanks to all of your generosity.

    Yours, Wee Keat

    ------------------------------------------------------------ "Good timber does not grow with ease; the stronger the wind, the stronger the trees."

    attached mail follows:


    on 31/07/02 9:38 AM, Wee Keat (weekeatamorphosium.com) wrote:

    > Hi all... > > I want to know how do you guys learn so much about PHP?

    practice and thinking :)

    > I have just started PHP about a month and a half ago and pior to that, I have > ABSOLUTELY NO knowledge in programming.

    neither did I about 2 years ago... and I only jumped on the MySQL bandwagon a year ago.

    > I bought 2 books, which is Begining PHP4 (Wrox Press) and Core PHP programming > (Prentice Hall). And that's all I can afford now... (I don't have a lot of > money.. i learn using my friend's computer). However, I am determined to > specialize in PHP. > > Can anyone point me towards a direction on how to do this properly? > > Can anyone guide me through by letting me do a small part (more importantly > not critical) of your projects as an excercise so that I can start a journey > of discovery?

    I can honestly say that the best way to learn (IMHO) is to make up a fictitious project (maybe centred around a hobby/interest?), and start working on it.

    Maybe it's a cliche contact database with your friends' names and address' n stuff in it. Maybe your into music, or cars, or whatever. Just make up a project, and start work on it. As you go, you'll want help with certain specific concepts, which you'll be able to find answers to in your books, or in this group, or hundreds of other resources.

    There is no substitute for practice on a real world project. Good planning, smart programming skills, quick problem solving and efficient code doesn't happen over night with a book... it will take HOURS of real world practice.

    Reading a PHP book or two end-to-end will be a valuable thing, but it will make a lot more sense if you can relate it back to a specific project, page or code snippet you've been working on.

    I haven't read any books yet, but I do the following:

    - read almost any article on PHP I can find on the web... even the smallest little snippet of code can really help you learn new stuff

    - read almost every post on this group... it's SOOOO time consuming, and I've backed off a bit now, but I learnt SO MUCH in the early days by reading everyone's posts... you store all the little code snippets and solutions in your head, and it really speeds up the learning

    Like I said, knowledge through books, articles and newsgroups is great, but it'll only "click" if you have a project on the go. Sure, you might re-write the code and re-think the project a few times before you get it right, but you'll have learned a heap if real-world problem solving in that time.

    Good luck,

    Justin French

    attached mail follows:


    Hi Wee. I also started with PHP about 3 months ago and also without having any prior programming experience. Right now, I have a portfolio of 2 network PHP software and working on 2 Internet projects. I think the best advise I or anyone else would give you, is to keep up with this list and others also from php.net (that's what I do... read all of them mails? Of course I do ;)

    As I write this, the response from Justin just came in... and he's right. Try to make your own self-developed project, even if it's never going to be more than a site in your computer (or your friend's). Another good advise, would be to make searches in the web for sites that will share you code snippets (most of them are free because you know... PHP is open source ;) and store them in your favorite's folder... that way you will be able to know how others solved their problems and probably help you save time.

    I also read a couple of books while practicing at home and having fun but one of them is meant to teach you MySQL Data Base usage and administration through PHP... You should also look for the mailing list in www.mysql.com and stick to them... at least the main one (unless of course, you already have made another choice regarding data bases).

    > -----Original Message----- > From: Wee Keat [mailto:weekeatamorphosium.com] > Sent: Tuesday, July 30, 2002 8:39 PM > To: PHP General List > Subject: [PHP] How to become a good PHP coder? > > Hi all... > > I want to know how do you guys learn so much about PHP? > > I have just started PHP about a month and a half ago and pior to that, I > have ABSOLUTELY NO knowledge in programming. > > I bought 2 books, which is Begining PHP4 (Wrox Press) and Core PHP > programming (Prentice Hall). And that's all I can afford now... (I don't > have a lot of money.. i learn using my friend's computer). However, I am > determined to specialize in PHP. > > Can anyone point me towards a direction on how to do this properly? > > Can anyone guide me through by letting me do a small part (more > importantly not critical) of your projects as an excercise so that I can > start a journey of discovery? > > Thanks to all of you. And most of all thanks to all of your generosity. > > > Yours, > Wee Keat > > ------------------------------------------------------------ > "Good timber does not grow with ease; the stronger the wind, the stronger > the trees."

    attached mail follows:


    Hi Cesar...

    Thank you soooo much for your advice... and WOW! That's a great achievement! I don't think I'll be able to achieve like you do! :)

    I'll be following your advice and that of Justin as well as some others who replied to me personally (thanks all again!) ... which has all be very very useful for me. I have all of these advices printed out and stuck on my wall at home as source of guidance and inspiration!

    I would also like to take this opportunity to thank all of you who are contributing actively in this mailing list.. I might be new, but I deeply appreciate the generosity that all of you have given us (those who have problems). The passion that all of you guys have has really been a great source of inspiration to me, as well as a great source of advise, answers and guidances. It's truly admirable.

    Thanks again to all who contributed generously to this mailing list.

    Yours, Wee Keat

    ------------------------------------------------------------ "Good timber does not grow with ease; the stronger the wind, the stronger the trees."

    ----- Original Message ----- From: "César Aracena" <icaamicaam.com.ar> To: "'Wee Keat'" <weekeatamorphosium.com>; "'PHP General List'" <php-generallists.php.net> Sent: 31 July, 2002 10:59 AM Subject: RE: [PHP] How to become a good PHP coder?

    > Hi Wee. I also started with PHP about 3 months ago and also without > having any prior programming experience. Right now, I have a portfolio > of 2 network PHP software and working on 2 Internet projects. I think > the best advise I or anyone else would give you, is to keep up with this > list and others also from php.net (that's what I do... read all of them > mails? Of course I do ;) > > As I write this, the response from Justin just came in... and he's > right. Try to make your own self-developed project, even if it's never > going to be more than a site in your computer (or your friend's). > Another good advise, would be to make searches in the web for sites that > will share you code snippets (most of them are free because you know... > PHP is open source ;) and store them in your favorite's folder... that > way you will be able to know how others solved their problems and > probably help you save time. > > I also read a couple of books while practicing at home and having fun > but one of them is meant to teach you MySQL Data Base usage and > administration through PHP... You should also look for the mailing list > in www.mysql.com and stick to them... at least the main one (unless of > course, you already have made another choice regarding data bases). > > > -----Original Message----- > > From: Wee Keat [mailto:weekeatamorphosium.com] > > Sent: Tuesday, July 30, 2002 8:39 PM > > To: PHP General List > > Subject: [PHP] How to become a good PHP coder? > > > > Hi all... > > > > I want to know how do you guys learn so much about PHP? > > > > I have just started PHP about a month and a half ago and pior to that, > I > > have ABSOLUTELY NO knowledge in programming. > > > > I bought 2 books, which is Begining PHP4 (Wrox Press) and Core PHP > > programming (Prentice Hall). And that's all I can afford now... (I > don't > > have a lot of money.. i learn using my friend's computer). However, I > am > > determined to specialize in PHP. > > > > Can anyone point me towards a direction on how to do this properly? > > > > Can anyone guide me through by letting me do a small part (more > > importantly not critical) of your projects as an excercise so that I > can > > start a journey of discovery? > > > > Thanks to all of you. And most of all thanks to all of your > generosity. > > > > > > Yours, > > Wee Keat > > > > ------------------------------------------------------------ > > "Good timber does not grow with ease; the stronger the wind, the > stronger > > the trees." > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php

    attached mail follows:


    The best way to become proficient in programming (or anything, come to that) is with _lots_ of practice.

    In the case of programming, looking at other ppl's code might help you find new ways of thinking that you'll be able to use at a later stage.

    Personally, I don't bog myself down in code from the start. I think in sorta pseudo-code, then once I have a solution, I then implement in language-specific code.

    HTH Martin

    -----Original Message----- From: Wee Keat [mailto:weekeatamorphosium.com] Sent: Wednesday, July 31, 2002 9:39 AM To: PHP General List Subject: [PHP] How to become a good PHP coder?

    Hi all...

    I want to know how do you guys learn so much about PHP?

    I have just started PHP about a month and a half ago and pior to that, I have ABSOLUTELY NO knowledge in programming.

    I bought 2 books, which is Begining PHP4 (Wrox Press) and Core PHP programming (Prentice Hall). And that's all I can afford now... (I don't have a lot of money.. i learn using my friend's computer). However, I am determined to specialize in PHP.

    Can anyone point me towards a direction on how to do this properly?

    Can anyone guide me through by letting me do a small part (more importantly not critical) of your projects as an excercise so that I can start a journey of discovery?

    Thanks to all of you. And most of all thanks to all of your generosity.

    Yours, Wee Keat

    ------------------------------------------------------------ "Good timber does not grow with ease; the stronger the wind, the stronger the trees."

    attached mail follows:


    ----- Original Message ----- From: "David Freeman" <dfreemanoutbackqld.net.au> To: <php-generallists.php.net> Sent: Tuesday, July 30, 2002 6:09 AM Subject: RE: [PHP] Re: Public Scripts in a commercial product

    > > > Yes, I am afraid that regarding GPL I have to agree with > > Microsoft when they say it is a cancer. The problem is that if you > want to > > distribute something that incorporates GPL licensed components, your > > software also needs to be distributed as GPL and so it gets > contaminated. > > This means that you can't sell your closed source software if you > > incorporate GPL components. > > I'm quite happy to be corrected on this but I have always understood GPL > licensing to mean that any GPL code you include should be available in > source version. The methods by which you use that GPL code doesn't > necessarily have to be included. The only relevant example I can think > of is if you include a class in php that is GPL then you have to > distribute the source even if you compile it with zend for your own > application. > > It is my understanding, in this situation, that you aren't necessarily > required to release the code you have written as GPL though. Basically, > I thought that once something is GPL it is pretty much public forever > but that doesn't stop you from including it in your own proprietory work > as long as you include the source for the GPL stuff.

    Unfortunately, you are required to release your entire project as GPL if you use GPL'd components - the GPL licence is quite clear.

    Quoted from section 2 of the GPL: (http://www.gnu.org/licenses/gpl.txt)

    "b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License."

    I think you're thinking of the much less restrictive LesserGPL (LGPL) which requires you to make the source available for the LGPL components and any changes you've made to those components but doesn't require you to release the entire project.

    Like most people I know, I'm totally against the GPL license and totally for Apache/BSD and LGPL licenses.

    HTH

    Danny.

    attached mail follows:


    I'm attempting to compile php 4.2.2 and apache 2.0.39 (both of which I downloaded today) on mandrake 8.1, mainly as part of a process to help me learn more about linux and installing programs. I've followed the generic unix directions on php.net and at these steps

    >./configure --with-mysql --with-apxs2=/www/bin/apxs

    followed by

    >make

    crashes with errors at the end of the make:

    -DTHREAD=1 -g -O2 -pthread -DZTS -prefer-pic -c php_functions.c php_functions.c:93:27: missing binary operator before '!' make[3]: *** [php_functions.lo] Error 1 make[3]: Leaving directory `/usr/local/php-4.2.2/sapi/apache2filter' make[2]: *** [all-recursive] Error 1 make[2]: Leaving directory `/usr/local/php-4.2.2/sapi/apache2filter' make[1]: *** [all-recursive] Error 1 make[1]: Leaving directory `/usr/local/php-4.2.2/sapi' make: *** [all-recursive] Error 1

    Can somebody point out what I need to do to correct this? It doesn't make sense that the code I downloaded from php.net would have a problem since that's a stable release.

    TIA!

    -Kirk

    -- 
    K.B. BABB
    email: babbk10comcast.net
    

    attached mail follows:


    You chose to compile PHP as a DSO this requires apache to have the mod_so module, you can check this by doing a httpd -l in your apache's bin directory. > I'm attempting to compile php 4.2.2 and apache 2.0.39 (both of which I > downloaded today) on mandrake 8.1, mainly as part of a process to help me > learn more about linux and installing programs. I've followed the generic > unix directions on php.net and at these steps > > >./configure --with-mysql --with-apxs2=/www/bin/apxs > > followed by > > >make > > crashes with errors at the end of the make: > > -DTHREAD=1 -g -O2 -pthread -DZTS -prefer-pic -c php_functions.c > php_functions.c:93:27: missing binary operator before '!' > make[3]: *** [php_functions.lo] Error 1 > make[3]: Leaving directory `/usr/local/php-4.2.2/sapi/apache2filter' > make[2]: *** [all-recursive] Error 1 > make[2]: Leaving directory `/usr/local/php-4.2.2/sapi/apache2filter' > make[1]: *** [all-recursive] Error 1 > make[1]: Leaving directory `/usr/local/php-4.2.2/sapi' > make: *** [all-recursive] Error 1 > > Can somebody point out what I need to do to correct this? It doesn't make > sense that the code I downloaded from php.net would have a problem since > that's a stable release. > > TIA! > > -Kirk > > -- > K.B. BABB > email: babbk10comcast.net > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php >

    -Pushkar S. Pradhan

    attached mail follows:


    Thanks for replying. Yes, I configured apache with mod_so enabled and the module is there.

    -Kirk

    Pushkar Pradhan wrote:

    > You chose to compile PHP as a DSO this requires apache to have the mod_so > module, you can check this by doing a > httpd -l in your apache's bin directory. >> I'm attempting to compile php 4.2.2 and apache 2.0.39 (both of which I >> downloaded today) on mandrake 8.1, mainly as part of a process to help me >> learn more about linux and installing programs. I've followed the >> generic unix directions on php.net and at these steps >> >> >./configure --with-mysql --with-apxs2=/www/bin/apxs >> >> followed by >> >> >make >> >> crashes with errors at the end of the make: >> >> -DTHREAD=1 -g -O2 -pthread -DZTS -prefer-pic -c php_functions.c >> php_functions.c:93:27: missing binary operator before '!' >> make[3]: *** [php_functions.lo] Error 1 >> make[3]: Leaving directory `/usr/local/php-4.2.2/sapi/apache2filter' >> make[2]: *** [all-recursive] Error 1 >> make[2]: Leaving directory `/usr/local/php-4.2.2/sapi/apache2filter' >> make[1]: *** [all-recursive] Error 1 >> make[1]: Leaving directory `/usr/local/php-4.2.2/sapi' >> make: *** [all-recursive] Error 1 >> >> Can somebody point out what I need to do to correct this? It doesn't >> make sense that the code I downloaded from php.net would have a problem >> since that's a stable release. >> >> TIA! >> >> -Kirk >> >> -- >> K.B. BABB >> email: babbk10comcast.net >> >> -- >> PHP General Mailing List (http://www.php.net/) >> To unsubscribe, visit: http://www.php.net/unsub.php >> > > -Pushkar S. Pradhan

    -- 
    K.B. BABB
    email: babbk10comcast.net
    

    attached mail follows:


    Hi all, I'm a newbie, and I'd like some advice, and I don't have any idea, maybe it's a silly question.

    Is-it possible to send SMS message to mobile phone using PHP?

    For example, every monday I send some news about my web site to the mobile phone of my visitors with their approval, of course.

    If possible, how to do it. If not, does anyone have any other ideas how to do this?

    Best regards,

    Ranaivo Rija rijavatu.com BP 1528 Port Vila Vanuatu

    attached mail follows:


    Hi Ranaivo Rija, Try this website http://www.k1m.com/scripts/sms_web_sender/ for more information. It's about "SMS Web Sender" .It is a PHP class which connects to a web site offering free SMS sending, logs you in with your username and password and sends your SMS message to a mobile number.

    regards, SenthilVelavan.P

    ----- Original Message ----- From: "Rija" <rijavatu.com> To: "PHP-General" <php-generallists.php.net> Sent: Wednesday, July 31, 2002 8:25 AM Subject: [PHP] SMS message ?

    Hi all, I'm a newbie, and I'd like some advice, and I don't have any idea, maybe it's a silly question.

    Is-it possible to send SMS message to mobile phone using PHP?

    For example, every monday I send some news about my web site to the mobile phone of my visitors with their approval, of course.

    If possible, how to do it. If not, does anyone have any other ideas how to do this?

    Best regards,

    Ranaivo Rija rijavatu.com BP 1528 Port Vila Vanuatu

    attached mail follows:


    In article <001301c23799$2deb3b30$100a0a0askink>, dfreemanoutbackqld.net.au (David Freeman) wrote:

    > > is there some other easyer way to do in one line than this?: > > > > $fullname = $session["f_name"]; > > $fullname .= " "; > > $fullname .= $session["l_name"]; > > $fullname = $session["f_name"] . " " . $session["l_name"];

    ...or *if* f_name and l_name are guaranteed to be the only elements of array $session *and* they're in the needed order, you could do:

    $fullname=implode(" ", $session);

    But that requires the proper foreknowledge. Simple concatenation, like above, is the safer bet.

    -- 
    CC
    

    attached mail follows:


    Hello All, I have tried to install Apache 1.3.26 and PHP 4.22 (as DSO ).

    By following the below steps my Apache 1.3.26 installation was OK ./configure --enable-module=so make make install

    But while running make for PHP 4.22 i got the following error. [Note : My configure command for PHP 4.22 is ./configure --with-apxs=/usr/local/apache/bin/apxs --with-mysql ] Error : stub.lo: file not recognized: File truncated collect2: ld returned 1 exit status make[1]: *** [libphp4.la] Error 1 make[1]: Leaving directory `/usr/local/php-4.2.2' make: *** [all-recursive] Error 1

    Any help is appreciated.

    Advance thanks and regards, SenthilVelavan.P