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: Thu Aug 01 2002 - 11:09:35 CDT

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

    php-general Digest 1 Aug 2002 16:09:35 -0000 Issue 1499

    Topics (messages 110619 through 110694):

    Re: Explain?
            110619 by: Rasmus Lerdorf

    Re: mail() problems
            110620 by: dan radom

    Page title changes when call functions!!
            110621 by: Sailom
            110622 by: Justin French
            110641 by: Sailom
            110647 by: Simon Ritchie

    toolbar.google.com
            110623 by: Lord Loh.
            110624 by: Tyler Longren

    include()
            110625 by: Lord Loh.
            110626 by: Jason Wong
            110627 by: Martin Towell
            110628 by: Justin French
            110632 by: Lord Loh.
            110639 by: Peter Bottenberg
            110640 by: Lars Olsson
            110649 by: Simon Ritchie
            110650 by: Andrey Hristov
            110651 by: Simon Ritchie

    Re: String Question
            110629 by: J.F.Kishor
            110637 by: Tim Ward

    Re: passing variable via url ( newbye question)
            110630 by: Lord Loh.

    Creating Image v2... storing thumblains...
            110631 by: mp
            110634 by: mp

    calculating psysical path (a first try)
            110633 by: Lars Olsson
            110654 by: Simon Ritchie

    PROBLEM
            110635 by: Thomas Edison Jr.
            110638 by: Justin French
            110642 by: Markas
            110645 by: John Holmes

    Re: dir to array?
            110636 by: Tim Ward

    Problems with PEAR
            110643 by: andy
            110686 by: electroteque

    Re: Printing a PHP Class
            110644 by: Markas

    Bug reporting site
            110646 by: Richard Black

    Storing script in database??
            110648 by: David Pratt
            110652 by: Justin French
            110653 by: lallous

    Re: Disabling Browser "BACK" button
            110655 by: lallous

    Re: extracting variables from files
            110656 by: lallous

    News to toolbar (ticker)
            110657 by: Jeff Lewis
            110659 by: John Holmes
            110662 by: John Holmes

    Re: More ???s on passing variables
            110658 by: Paul Dionne
            110660 by: Paul Dionne
            110667 by: Jason Wong

    Url of frame in php variable
            110661 by: patrick anderson
            110663 by: Justin French
            110664 by: patrick anderson

    ldap_modify parameters?
            110665 by: Chad Day
            110666 by: Rasmus Lerdorf
            110669 by: Chad Day

    use of COM object
            110668 by: Christophe PIN

    Re: Logging out with authentication
            110670 by: Pete James

    PEAR with lots of trouble
            110671 by: andy

    sort results into two columns
            110672 by: kompresor
            110694 by: Simon Ritchie

    Sablotron error
            110673 by: ctan

    Re: [imp] New version of apache and php are good for work with IMP 3.x ?
            110674 by: EdwardSPL.ita.org.mo

    Form asking to refresh when I hit the back button
            110675 by: DonPro
            110676 by: Danny Shepherd

    Session Problems
            110677 by: eat pasta type fasta

    Getting user's local TZ
            110678 by: Chris Boget

    Re: web services and PHP
            110679 by: Bob Lockie
            110684 by: Danny Shepherd

    mysql_field_flags() problems
            110680 by: Mathieu Dumoulin

    Re: Dynamically check radio buttons
            110681 by: Shew
            110688 by: Mark Middleton
            110689 by: Johnson, Kirk

    test
            110682 by: Daniel Geldres Castro

    mcrypt
            110683 by: Randy Johnson
            110685 by: Danny Shepherd
            110687 by: Darren Gamble
            110690 by: Randy Johnson

    Problem with "<?xml ....>" inside the PHP code, due to "?"
            110691 by: Scott Fletcher
            110692 by: Danny Shepherd
            110693 by: Matt Babineau

    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:


    > Hey php-general,
    >
    > maybe somebody can explain me what happens in this line? because how
    > mutch i read it..thought i don't get it :)
    >
    > list ($date, $laik) = split (' ', $row['time'], 2);

    Well, it is rather inefficient code. Applying a regex just to break a
    string up on a single character is a waste. You should be using explode()
    instead of split() here.

    As for what it does, if you read php.net/list and php.net/split it should
    be pretty obvious.

    php.net/split says:

      Returns an array of strings, each of which is a substring of string
      formed by splitting it on boundaries formed by the regular expression
      pattern. If limit is set, the returned array will contain a maximum of
      limit elements with the last element containing the whole rest of
      string.

    So, in your example it will return a 2 element array. Everything before
    the first space of the string $row['time'] goes in the first element, and
    everything after the first space into the second element.

    php.net/list says:

      list() is used to assign a list of variables in one operation.

    In your case that means that the first element in the array returned from
    the split() call ends up in $date and the second element ends up in $laik.

    -Rasmus

    attached mail follows:


    mailq's empty. i'll try a real address and see if i get a bounce notice.

    * Manuel Lemos (mlemosacm.org) wrote:
    > Hello,
    >
    > On 07/31/2002 11:55 PM, Dan Radom wrote:
    > >nope. all that did was prodice the following warning... Jul 31 20:53:47
    > >mars sendmail[20790]: g712rkA20790: Authentication-Warning:
    > >mars.radom.org: nobody set sender to foobar.net using -f
    >
    > Are you sure the message is not stuck in the mail queue for some reason?
    > Did you do mailq to see if it is still there?
    >
    > If it isn't and it bounced it should have gone to that $email address.
    > If you set to foobar.net, you will not see the bounced message and will
    > probably miss the reason why it bounced.
    >
    >
    >
    >
    >
    > >* Manuel Lemos (mlemosacm.org) wrote:
    > >
    > >>Hello,
    > >>
    > >>On 07/31/2002 10:47 PM, Dan Radom wrote:
    > >>
    > >>>I'm having provblems with the following script...
    > >>>
    > >>>mail("danradom.org", "www form submission", $message, "From: $email");
    > >>>
    > >>>...the variables are being POSTed from a form, which does make it to
    > >>>sendmail. sendmail logs the following...
    > >>>
    > >>>Jul 31 19:32:47 mars sendmail[20605]: g711Wlu20605: from=nobody,
    > >>>size=81, class=0, nrcpts=0,
    > >>>msgid=<200208010132.g711Wlu20605mars.radom.org>, relay=nobodylocalhost
    > >>>
    > >>>
    > >>>the nrcpts=0 is obviously a concern here. This sendmail does handle
    > >>>mail for a few domains and does accept mail for localhost. Any ideas
    > >>>where I've gone wrong? All this was wokring with php 4.2.1 until a hard
    > >>>drive died. I rebuild the machine and installed php 4.2.2 and this is
    > >>>where I'm at. I'm using the same sendmail configuration.
    > >>
    > >>Try setting mail() 5th argument to "-f$email".
    >
    >
    > --
    >
    > Regards,
    > Manuel Lemos
    >
    >
    > --
    > PHP General Mailing List (http://www.php.net/)
    > To unsubscribe, visit: http://www.php.net/unsub.php

    attached mail follows:


    I am a newbie in this area so please be patient for my silly question :)

    I have a bad experience coding in PHP. I create a home page in PHP,
    index.php. Within this PHP code, it calls functions which are placed in
    other file. I notice that the page title changes to something that I don't
    want it to be. My question is..

    1. Why the page title changes?
    2. How to make the title not to change when making function call?

    Thanks

    attached mail follows:


    You'd need to show us some code, preferably not 100's of lines.... perhaps
    put it up on the web somewhere so we can see the source code or something.

    Justin French

    on 01/08/02 2:16 PM, Sailom (amorndetcolorado.edu) wrote:

    > I am a newbie in this area so please be patient for my silly question :)
    >
    > I have a bad experience coding in PHP. I create a home page in PHP,
    > index.php. Within this PHP code, it calls functions which are placed in
    > other file. I notice that the page title changes to something that I don't
    > want it to be. My question is..
    >
    > 1. Why the page title changes?
    > 2. How to make the title not to change when making function call?
    >
    > Thanks
    >
    >

    attached mail follows:


    My code is quite long so I try to make it short by describe it instead of
    posting the code here. Please tell me if you need more information.

    There are two functions in a file named a.inc. One function is named
    output_header($title) and another function is named
    output_content($content). The former is used to set the page title and the
    latter is used to printout the content of the page.

    There are many files that contain HTML code, which assemble for a very nice
    page frame, e.g. file1.inc for the menu bar and file2.inc for the footer.

    In the index.php, it starts by setting the page title to something, for
    example "Home Page". Then comprise the page frame by including file1.inc
    and file2.inc. In between, it calls the function output_content($content)
    to print the content of the page.

    Thus, the code will look like this...

    <?
    ..
    output_header("Home Page");'
    ..
    require(file1.inc); //print the menu bar
    output_content("Some message as a page content");
    ..
    require(file2.inc); //print the footer
    ?>

    When I open the index.php through my IE5, the page title is not "Home Page"
    but http://www.xxx.com/index.php instead.

    Hope this information is good enough and thanks for trying to help.

    Sailom

    "Justin French" <justinindent.com.au> wrote in message
    news:B96EF485.BC9A%justinindent.com.au...
    > You'd need to show us some code, preferably not 100's of lines.... perhaps
    > put it up on the web somewhere so we can see the source code or something.
    >
    > Justin French
    >
    >
    > on 01/08/02 2:16 PM, Sailom (amorndetcolorado.edu) wrote:
    >
    > > I am a newbie in this area so please be patient for my silly question :)
    > >
    > > I have a bad experience coding in PHP. I create a home page in PHP,
    > > index.php. Within this PHP code, it calls functions which are placed in
    > > other file. I notice that the page title changes to something that I
    don't
    > > want it to be. My question is..
    > >
    > > 1. Why the page title changes?
    > > 2. How to make the title not to change when making function call?
    > >
    > > Thanks
    > >
    > >
    >

    attached mail follows:


    > I have a bad experience coding in PHP. I create a home page in PHP,
    > index.php. Within this PHP code, it calls functions which are placed in
    > other file. I notice that the page title changes to something
    > that I don't
    > want it to be.

    This is probably an HTML problem, not a PHP problem. To see what is going
    on, run your program, save the resulting HTML into a file ("save as" in the
    edit menu on your browser) and look at it with a text editor.

    It could be that you are confused about the way your browser displays the
    title. It should appear at the very top of your browser window, not in the
    address line.

    Simon Ritchie

    Download my introduction to PHP for $25:
    http://merrowinternet.com/downloads?source=ml

    attached mail follows:


    Google uses php to make a software download and installs it through the
    browser!

    How does this work ?

    Lord Loh.

    attached mail follows:


    It's called Google Magic.

    I don't really know the answer to your question. Google does a lot of
    really neat things (like converting pdf to html).

    tyler

    On Thu, 1 Aug 2002 08:17:35 +0100
    "Lord Loh." <lord_lohrediffmail.com> wrote:

    > Google uses php to make a software download and installs it through
    > the browser!
    >
    > How does this work ?
    >
    > Lord Loh.
    >
    >
    >
    > --
    > PHP General Mailing List (http://www.php.net/)
    > To unsubscribe, visit: http://www.php.net/unsub.php

    attached mail follows:


    I suppose include() can be used to include files from remote systems(not on
    WINDOWS).

    So, How can I protect my script from unauthorised inclusions ?

    A webmaster on the same server can always use a path like
    "/home/htdocs/.../config.php" and include my config .php which contains my
    database password !!

    Even a web master from a remote server can do the same by probably using
    http://www.xyz.net/config.php

    I am using windows 2000/apache/php so I really have not tried these...but
    the docs say it can be done(remote system inclusion except on win)

    Lord Loh.

    attached mail follows:


    On Thursday 01 August 2002 15:28, Lord Loh. wrote:
    > I suppose include() can be used to include files from remote systems(not on
    > WINDOWS).
    >
    > So, How can I protect my script from unauthorised inclusions ?
    >
    > A webmaster on the same server can always use a path like
    > "/home/htdocs/.../config.php" and include my config .php which contains my
    > database password !!
    >
    > Even a web master from a remote server can do the same by probably using
    > http://www.xyz.net/config.php
    >
    > I am using windows 2000/apache/php so I really have not tried these...but
    > the docs say it can be done(remote system inclusion except on win)

    When you include() a remote file eg:

      http://www.xyz.net/config.php

    it only includes the OUTPUT of http://www.xyz.net/config.php. Thus if all
    config.php does is assign some values to variables, ie produces no output,
    then the result of the include is nothing.

    Basically if you have a correctly configured webserver then there is no need
    to worry about people remotely including your scripts (because all they see
    is the HTML produced by your script).

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

    /* "There is no statute of limitations on stupidity." -- Randomly produced by a computer program called Markov3. */

    attached mail follows:


    To add to this - you should place critical information (like passwords, etc) outside the document root. That way, even if the server is mis-configured, others wont be able to easily gain access to those files

    -----Original Message----- From: Jason Wong [mailto:php-generalgremlins.com.hk] Sent: Thursday, August 01, 2002 3:38 PM To: php-generallists.php.net Subject: Re: [PHP] include()

    On Thursday 01 August 2002 15:28, Lord Loh. wrote: > I suppose include() can be used to include files from remote systems(not on > WINDOWS). > > So, How can I protect my script from unauthorised inclusions ? > > A webmaster on the same server can always use a path like > "/home/htdocs/.../config.php" and include my config .php which contains my > database password !! > > Even a web master from a remote server can do the same by probably using > http://www.xyz.net/config.php > > I am using windows 2000/apache/php so I really have not tried these...but > the docs say it can be done(remote system inclusion except on win)

    When you include() a remote file eg:

    http://www.xyz.net/config.php

    it only includes the OUTPUT of http://www.xyz.net/config.php. Thus if all config.php does is assign some values to variables, ie produces no output, then the result of the include is nothing.

    Basically if you have a correctly configured webserver then there is no need

    to worry about people remotely including your scripts (because all they see is the HTML produced by your script).

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

    /* "There is no statute of limitations on stupidity." -- Randomly produced by a computer program called Markov3. */

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

    attached mail follows:


    All included scripts inherit the variables of the parent script, so you could test for numerous server variables like the name of the parent script (PHP_SELF), or the domain name being used, etc etc. If it's not what you expected, spit out an error.

    something like

    <? if($_SERVER['PHP_SELF'] == "mydir/myscript.php") { // do all this stuff } else { // do nothing } ?>

    $_SERVER['HTTP_HOST'] might be a better option than $PHP_SELF, given that you would include a config file on every page.

    Other users on the same server *shouldn't* be able to include() in this way though, if the server is set-up right.

    Nothing is ever 100% secure, but if your host hasn't even attempted to plug these holes, change hosts.

    As far as people go on other servers, they can only call your script via HTTP, and get the *output* of the script, not the script itself.

    1. if your config file doesn't output any text or HTML to the browser, then they'll get a blank document

    2. if you name all your included PHP scripts with .inc (or anything other than .php) AND set a .htaccess file to forbid *.inc files from being server via HTTP, then there is very little chance of another webmaster obtaining your passwords et al over HTTP.

    My .htaccess file has:

    <Files ~ "\.inc$"> Order Allow,Deny Deny from all </Files>

    Good luck!

    Justin French

    on 01/08/02 5:28 PM, Lord Loh. (lord_lohrediffmail.com) wrote:

    > I suppose include() can be used to include files from remote systems(not on > WINDOWS). > > So, How can I protect my script from unauthorised inclusions ? > > A webmaster on the same server can always use a path like > "/home/htdocs/.../config.php" and include my config .php which contains my > database password !! > > Even a web master from a remote server can do the same by probably using > http://www.xyz.net/config.php > > I am using windows 2000/apache/php so I really have not tried these...but > the docs say it can be done(remote system inclusion except on win) > > Lord Loh. > >

    attached mail follows:


    "Other users on the same server *shouldn't* be able to include() in this way"

    How?

    Would their $_SERVER['HTTP_HOST'] not be the same?

    attached mail follows:


    Maybe you could create an include directory outsite the root of your webpage,

    like this

    <Website Name> <include> <-- Here are your inlcude files <HTDocs> <-- Here is yourwebsite

    then use: include "../include/<include filename>";

    In this way, the only scripts that have acces to these files are the files located on the website. so no other sites, and users on the same server, can include these files.

    Peter

    "Lord Loh." <lord_lohrediffmail.com> schreef in bericht news:20020801052809.39493.qmailpb1.pair.com... > I suppose include() can be used to include files from remote systems(not on > WINDOWS). > > So, How can I protect my script from unauthorised inclusions ? > > A webmaster on the same server can always use a path like > "/home/htdocs/.../config.php" and include my config .php which contains my > database password !! > > Even a web master from a remote server can do the same by probably using > http://www.xyz.net/config.php > > I am using windows 2000/apache/php so I really have not tried these...but > the docs say it can be done(remote system inclusion except on win) > > Lord Loh. > >

    attached mail follows:


    Because the open_basedir directive can make sure other users on the shared server can't read/include your files.

    Take a look here: http://www.php.net/manual/en/configuration.php#ini.open-basedir

    /lasso (lassolassoweb.nu)

    Lord Loh. wrote: > "Other users on the same server *shouldn't* be able to include() in this > way" > > How? > > Would their $_SERVER['HTTP_HOST'] not be the same? > >

    attached mail follows:


    > I suppose include() can be used to include files from remote > systems(not on > WINDOWS).

    Only if the sysadmin running your web server allows it, which they should not.

    > A webmaster on the same server can always use a path like > "/home/htdocs/.../config.php" and include my config .php which contains my > database password !!

    Not quite, but if you are on a shared server hosted by somebody else, there is a potential problem. If somebody can figure out the name of the function that opens the database, they could call it, potemtially giving access to the data. You could use the solution posted by Justin French to make sure that the function does nothing for them when they call it.

    As other people have said, your hosting organisation should set the system up so that nobody can read your PHP code, and that nobody outside the host computer can include it. However, I think it would be difficult for them to stop another user on the same server including your code.

    If you run your own server, you can set it up so that each webmaster is locked into a private environment, but it's messy. According to me, you would need a separate copy of apache for each site, each running under a different user, and they would need to run on separate ports, which is a nuisance.

    Simon Ritchie

    Download my introduction to PHP for $25: http://merrowinternet.com/downloads?source=ml

    attached mail follows:


    > > I suppose include() can be used to include files from remote > > systems(not on > > WINDOWS). > > Only if the sysadmin running your web server allows it, which they should > not. > > > > A webmaster on the same server can always use a path like > > "/home/htdocs/.../config.php" and include my config .php which contains my > > database password !! > > Not quite, but if you are on a shared server hosted by somebody else, there > is a potential problem. If somebody can figure out the name of the function > that opens the database, they could call it, potemtially giving access to > the data. You could use the solution posted by Justin French to make sure > that the function does nothing for them when they call it. But probably the password is in variable so if you can include() the file with the password and cored dump the php you can view it. I've found a bug or two that core dump PHP and saw my secrets there. Even function or variables with mangled names will not help you.

    > If you run your own server, you can set it up so that each webmaster is > locked into a private environment, but it's messy. According to me, you > would need a separate copy of apache for each site, each running under a > different user, and they would need to run on separate ports, which is a > nuisance. > This is called SAFE mode (easy to be done) and the other restriction is open_basedir directive in php.ini

    Andrey

    attached mail follows:


    > "Other users on the same server *shouldn't* be able to include() in this way" > > How? > > Would their $_SERVER['HTTP_HOST'] not be the same?

    You did not specify your circumstances in your original posting, so there is some confusion.

    One web server can handle many domains. An ISP offering shared hosting will run their server this way, because it is cheap.

    So, there are at least two cases:

    (1) Several webmasters running the same domain. They should be part of a disciplined team, so this should not be a problem.

    (2) Several domains, each run by one webmaster (or one team), possibly each in a different organisation. If you run the domain www.somedomainorother.com, that will be in the HTTP_HOST entry. If somebody running another domain calls the function that opens your database, the HTTP_HOST setting will be different. The suggestion is to write your open function to check for this.

    Simon Ritchie

    Download my introduction to PHP for $25: http://merrowinternet.com/downloads?source=ml

    attached mail follows:


    Hi Randy,

    Just copy the following code and execute it, it works as you require, tested works fine.

    <? $string="abcdefghijklmnopqrstuvwxyz"; $length = strlen($string); // Finds the length of the string $octFull = round($length/8); // splits the length and finds how many // times 8 occurs in the length $intStart=0; //initilize the integer start to divided the string into 8's // Loop to divide the $string into 8 and print them. for($i =1;$i < $octFull+2;$i++) { //gets the substring of the string with the length of 8 $strDiv[$i] = substr($string,$intStart,8);

    //increment the start position to take the next 8 among the string $intStart = ($intStart+8);

    echo "<p>string$i : $strDiv[$i]</p>"; } ?>

    - JFK kishor Nilgiri Networks

    On Wed, 31 Jul 2002, Randy Johnson wrote:

    > Hello, > > I would like to be able to do the following but have not figured out a way to handle it > > $string="abcdefghijklmnopqrstuvwxz"; > > I would like to divde the above string into separate strings 8 charactes long , example > > $string1=abcdefgh > $string2=ijklmnop > $string3=qrstuvwx > $string4=yz > > if the string were only 10 long > > $string=abcdefghij > > then > > $string1=abcdefgh > $string2=ij > > any suggestions would be greatly appreciated. > > Thanks, > > > Randy >

    attached mail follows:


    or ... while($new = substr($old, $i++ * $strlen, $strlen)) $array[] = $new;

    Tim Ward www.chessish.com

    > -----Original Message----- > From: Richard Baskett [mailto:phpbaskettcase.com] > Sent: 31 July 2002 20:47 > To: Randy Johnson; PHP General > Subject: Re: [PHP] String Question > > > <? > $string = 'abcdefghijklmnopqrstuvwxyz'; > $strNum = ceil(strlen($string)/8); > > for ($i=0; $i<$strNum; $i++) $newString[] = substr($string, > ($i*8), 8); > > for ($j=0; $j<count($newString); $j++) echo "string$j = > $newString[$j]<br > />"; > ?> > > Rick > > A sense of humor can help you over look the unattractive, tolerate the > unpleasant, cope with the unexpected, and smile through the > unbearable. - > Moshe Waldoks > > > From: "Randy Johnson" <icgphpicecoldgold.com> > > Date: Wed, 31 Jul 2002 15:26:15 -0400 > > To: <php-generallists.php.net> > > Subject: [PHP] String Question > > > > Hello, > > > > I would like to be able to do the following but have not > figured out a way to > > handle it > > > > $string="abcdefghijklmnopqrstuvwxz"; > > > > I would like to divde the above string into separate > strings 8 charactes long > > , example > > > > $string1=abcdefgh > > $string2=ijklmnop > > $string3=qrstuvwx > > $string4=yz > > > > if the string were only 10 long > > > > $string=abcdefghij > > > > then > > > > $string1=abcdefgh > > $string2=ij > > > > any suggestions would be greatly appreciated. > > > > Thanks, > > > > > > Randy > > > >

    attached mail follows:


    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

    ===========HERE=========== import_request_variables("G", "saci_"); echo $saci_modo."<BR>"; echo $saci_color."<BR>"; echo $saci_size."<BR>"; =========================== Tested it! It worked! G stands for GET You can use P or C for POST or COOKIE The order of gpc is important the later overwites the former...see docs(XCVIII. Variable Functions)

    attached mail follows:


    Thanks to those who helped me last time about creating image, but now there is another problem... I'm making a thumblain like this:

    $base_size = 300;

    $size = GetImageSize($image1); $kof = ($size[0] > $size[1]) ? $size[0] : $size[1]; $koef = ($base_size / $kof);

    $new_w = (int) $size[0] * $koef; $new_h = (int) $size[1] * $koef;

    $dst_img = ImageCreate($new_w, $new_h); $src_img = ImageCreateFromJpeg($image1); ImageCopyResized($dst_img, $src_img, 0, 0, 0, 0, $new_w, $new_h, ImageSX($src_img), ImageSY($src_img)); imageJPEG($dst_img, $image2);

    Andf I get $image2 with 0 bytes... If i write imageJPEG($src_img, $image2); I get good image, so there is some problems with ImageCopyResized... Does anybody have any ideas about this?

    attached mail follows:


    Oh don't worry about this... I've already found the mistake...

    > Thanks to those who helped me last time about creating image, but now there > is another problem... > I'm making a thumblain like this: > > $base_size = 300; > > $size = GetImageSize($image1); > $kof = ($size[0] > $size[1]) ? $size[0] : $size[1]; > $koef = ($base_size / $kof); > > $new_w = (int) $size[0] * $koef; > $new_h = (int) $size[1] * $koef; > > $dst_img = ImageCreate($new_w, $new_h); > $src_img = ImageCreateFromJpeg($image1); > ImageCopyResized($dst_img, $src_img, 0, 0, 0, 0, $new_w, $new_h, > ImageSX($src_img), ImageSY($src_img)); > imageJPEG($dst_img, $image2); > > Andf I get $image2 with 0 bytes... > If i write > imageJPEG($src_img, $image2); > I get good image, so there is some problems with ImageCopyResized... > Does anybody have any ideas about this? > > > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > >

    attached mail follows:


    Hi list!

    Something I use quite often when programming in ASP is the Server.MapPath method. This method expects a virtual path (on the web server) and returns the corresponding psysical path. I haven't seen this anywhere in PHP, so I've hacked my own little routine to do this (see below). But I still have two questions:

    a) Is there perhaps a built-in function I can use instead? I browsed through the manual quite a lot, but I haven't found quite like this.

    b) If there isn't a built-in function, perhaps you could help me make my function better? It seems I use a lot of code for this TINY problem...

    Here's the function: <snip> // This function calculates the physical path for a given virtual path. function map_path($virtual_path) { // Deklarera necessary variables as global global $HTTP_SERVER_VARS;

    // Find out where this file is located in the psysical file system $script_filename = $HTTP_SERVER_VARS["SCRIPT_FILENAME"];

    // Find out where this file is located in the virtual file system $script_name = $HTTP_SERVER_VARS["SCRIPT_NAME"];

    // Calculate which folder in the psysical filesystem that corresponds // to the root folder in the virtual filesystem $psychical_root = substr($script_filename, 0, strlen($script_filename) - strlen($script_name));

    // Calculate which folder in the psysical filesystem that corresponds // to the given folder in the virtual filesystem $psychical_path = $psychical_root . $virtual_path;

    return $psychical_path; } </snip>

    Kindly

    /Lasso (lassolassoweb.nu)

    attached mail follows:


    I think that you have something like this:

    $HTTP_SERVER_VARS['SCRIPT_NAME] == '\foo\bar.php'

    $HTTP_SERVER_VARS["SCRIPT_FILENAME"] == 'c:\wwwroot\foo\bar.php'

    and you want to use this to derive the root 'c:\wwwroot'. You can use one of the standard string edit functions. Something like this:

    $baseName = ereg_replace( $HTTP_SERVER_VARS['SCRIPT_NAME' . '$', '', $HTTP_SERVER_VARS["SCRIPT_FILENAME"]);

    The first argument is regular expression. This one matches the script name as long as it appears at the end of the string. The second argument is the replacement string (nothing), the third is the string to search.

    I cover regular expression pattern matching in my introduction to PHP (see below).

    However, the root directory is an Apache variable and these are passed to PHP in another array. I can't remember which right now!

    Simon Ritchie

    Download my introduction to PHP for $25: http://merrowinternet.com/downloads?source=ml

    attached mail follows:


    hi! i have a problem in my project.the problem is that suppose we have the date for the whole of the month and two different files r there. i have to pick one file of the current date that is say today and the other file of the yesterday.but the problem is that if the current date is monday then the in yesterday file i have to pick for saturday and not the sunday.broadly speaking i mean to say that the difference between the today's date and yesterday's is not fixed as there can be a holiday for say 4 days inbetween then in yesterday i need the date 4 days before. so i need some query to handle this as soon as possible as its very urjent.the query should be in MYSQL.that is the query should be such which can pick today's date and the date of the working day before the today's or the current date.

    ===== Rahul S. Johari (Director) ****************************************** Abraxas Technologies Inc. Homepage : http://www.abraxastech.com Email : abraxastechyahoo.com Tel : 91-4546512/4522124 *******************************************

    __________________________________________________ Do You Yahoo!? Yahoo! Health - Feel better, live better http://health.yahoo.com

    attached mail follows:


    I don't store anything in date format (eg YYYY-MM-DD)... I store them as a unix time stamp -- see time() in the manual.

    Then it would be pretty easy to get today's stamp using time(), then look for the two files preceeding that stamp, (ORDER BY in SQL) which would presumably be today's file/row, and the one preceeding it (usually yesterday, but could be a few days before).

    something like: SELECT * FROM table WHERE stamp < $now ORDER BY stamp DESC LIMIT 2

    should give you the two stamps you need... a simular thing could be done with other date formats in MySQL, but I've never worked with them sorry,

    justin french

    on 01/08/02 5:43 PM, Thomas Edison Jr. (thomasedisonjryahoo.com) wrote:

    > hi! > i have a problem in my project.the problem is that > suppose we have the date for the whole of the month > and two different files r there. > i have to pick one file of the current date that is > say today and the other file of the yesterday.but the > problem is that if the current date is monday then the > in yesterday file i have to pick for saturday and not > the sunday.broadly speaking i mean to say that the > difference between the today's date and yesterday's is > not fixed as there can be a holiday for say 4 days > inbetween then in yesterday i need the date 4 days > before. > so i need some query to handle this as soon as > possible as its very urjent.the query should be in > MYSQL.that is the query should be such which can pick > today's date and the date of the working day before > the today's or the current date. > > ===== > Rahul S. Johari (Director) > ****************************************** > Abraxas Technologies Inc. > Homepage : http://www.abraxastech.com > Email : abraxastechyahoo.com > Tel : 91-4546512/4522124 > ******************************************* > > __________________________________________________ > Do You Yahoo!? > Yahoo! Health - Feel better, live better > http://health.yahoo.com

    attached mail follows:


    Yes I always arguing that its better to store date as an ordinary int

    "Justin French" <justinindent.com.au> wrote in message news:B96F27AE.BCBE%justinindent.com.au... > I don't store anything in date format (eg YYYY-MM-DD)... I store them as a > unix time stamp -- see time() in the manual. > > Then it would be pretty easy to get today's stamp using time(), then look > for the two files preceeding that stamp, (ORDER BY in SQL) which would > presumably be today's file/row, and the one preceeding it (usually > yesterday, but could be a few days before). > > something like: > SELECT * FROM table WHERE stamp < $now ORDER BY stamp DESC LIMIT 2 > > should give you the two stamps you need... a simular thing could be done > with other date formats in MySQL, but I've never worked with them sorry, > > > justin french > > > > > > on 01/08/02 5:43 PM, Thomas Edison Jr. (thomasedisonjryahoo.com) wrote: > > > hi! > > i have a problem in my project.the problem is that > > suppose we have the date for the whole of the month > > and two different files r there. > > i have to pick one file of the current date that is > > say today and the other file of the yesterday.but the > > problem is that if the current date is monday then the > > in yesterday file i have to pick for saturday and not > > the sunday.broadly speaking i mean to say that the > > difference between the today's date and yesterday's is > > not fixed as there can be a holiday for say 4 days > > inbetween then in yesterday i need the date 4 days > > before. > > so i need some query to handle this as soon as > > possible as its very urjent.the query should be in > > MYSQL.that is the query should be such which can pick > > today's date and the date of the working day before > > the today's or the current date. > > > > ===== > > Rahul S. Johari (Director) > > ****************************************** > > Abraxas Technologies Inc. > > Homepage : http://www.abraxastech.com > > Email : abraxastechyahoo.com > > Tel : 91-4546512/4522124 > > ******************************************* > > > > __________________________________________________ > > Do You Yahoo!? > > Yahoo! Health - Feel better, live better > > http://health.yahoo.com >

    attached mail follows:


    > i have a problem in my project.the problem is that > suppose we have the date for the whole of the month > and two different files r there. > i have to pick one file of the current date that is > say today and the other file of the yesterday.but the > problem is that if the current date is monday then the > in yesterday file i have to pick for saturday and not > the sunday.broadly speaking i mean to say that the > difference between the today's date and yesterday's is > not fixed as there can be a holiday for say 4 days > inbetween then in yesterday i need the date 4 days > before. > so i need some query to handle this as soon as > possible as its very urjent.the query should be in > MYSQL.that is the query should be such which can pick > today's date and the date of the working day before > the today's or the current date.

    SELECT * FROM your_table WHERE your_date_column <= CURDATE() LIMIT 2

    That assumes there is only one entry per day. Tell us if it's otherwise.

    ---John Holmes...

    attached mail follows:


    > Not sure why this isn't working, any help is appreciated. I > am trying to > read the files in a directory and place them into an array. > Here is the > code: > > /* Function to create array of directory contents */ > function dCNTS($files) { > $dir = opendir("/path/to/directory/"); > while($imgs = readdir($dir)) { > if (($imgs != ".") && ($imgs != "..")) { > $cnt[count($imgs)] = $cnt;

    is this typo in the original code? surely should be " = $imgs;"

    > } else { > print "Cannot create array of files in directory!"; } > } > closedir($dir); > }

    Tim Ward www.chessish.com

    attached mail follows:


    Hi there, I am having trouble to install pear. This seems to be needed by a webmailer called horde. somehow the pear comming with php4.2.2 does not contain a certain log class. Here is what the faq says about this problem: http://horde.org/faq/admin/trouble/index.php#t51 5.1.21 "Fatal error: Undefined class name 'log' in ..." [Horde 2.x]: Your PHP PEAR implementation is missing the PEAR Log package. This is a common problem with the PHP 4.2.1 PEAR for example. You can install it via the network if you have a standalone php/pear command. See the file horde/docs/INSTALL for more information on how to install the required PEAR packages this way. Otherwise you can download the Log package (e.g. from http://pear.php.net/get/Log) and manually install them inside your PEAR directory. You may also need to install the modules Mail_Mime and Net_Socket as well.

    For more detailed instructions on install PEAR modules, see the PEAR documentation at http://pear.php.net/manual/.

    --------- Ok... so far so good :-( I did take a look at the pear php page and this takes me to another step to install a webinstaller:

    http://pear.php.net/manual/en/installation.web.php

    So I did try this to :-( But this results in following error msg:

    capc11-35:/home/andy/sw/horde # lynx -source http://pear.php.net/go-pear | sh sh: ?php: No such file or directory

    YOU NEED TO RUN THIS SCRIPT WITH PHP NOW!

    Try this: lynx -source http://pear.php.net/go-pear | php -q

    capc11-35:/home/andy/sw/horde # lynx -source http://pear.php.net/go-pear | php -q bash: php: command not found capc11-35:/home/andy/sw/horde #

    -------- Has anybody an idea how to get this thing running? It just drives me cracy.

    Thanx for any help,

    andy

    attached mail follows:


    read this site

    http://vulcanonet.com/soft/index.php?pack=pear_tut#ss2

    the best pear tutorial to get me going

    prob try and install via cvs , thats the whole lot though, but it works , also search http://pear.php.net for the package and then copy it to that dir

    also make sure the include dir to pear is setup in php.ini

    usually /usr/local/lib/php or whereever pear is sitting

    there is a whole list regards to pear php.pear "Andy" <news.lettersgmx.de> wrote in message news:20020801083725.32597.qmailpb1.pair.com... > Hi there, > I am having trouble to install pear. This seems to be needed by a webmailer > called horde. somehow the pear comming with php4.2.2 does not contain a > certain log class. Here is what the faq says about this problem: > http://horde.org/faq/admin/trouble/index.php#t51 > 5.1.21 "Fatal error: Undefined class name 'log' in ..." > [Horde 2.x]: Your PHP PEAR implementation is missing the PEAR Log package. > This is a common problem with the PHP 4.2.1 PEAR for example. You can > install it via the network if you have a standalone php/pear command. See > the file horde/docs/INSTALL for more information on how to install the > required PEAR packages this way. Otherwise you can download the Log package > (e.g. from http://pear.php.net/get/Log) and manually install them inside > your PEAR directory. You may also need to install the modules Mail_Mime and > Net_Socket as well. > > For more detailed instructions on install PEAR modules, see the PEAR > documentation at http://pear.php.net/manual/. > > --------- > Ok... so far so good :-( > I did take a look at the pear php page and this takes me to another step to > install a webinstaller: > > http://pear.php.net/manual/en/installation.web.php > > So I did try this to :-( > But this results in following error msg: > > capc11-35:/home/andy/sw/horde # lynx -source http://pear.php.net/go-pear | > sh > sh: ?php: No such file or directory > > YOU NEED TO RUN THIS SCRIPT WITH PHP NOW! > > Try this: lynx -source http://pear.php.net/go-pear | php -q > > capc11-35:/home/andy/sw/horde # lynx -source http://pear.php.net/go-pear | > php -q > bash: php: command not found > capc11-35:/home/andy/sw/horde # > > -------- > Has anybody an idea how to get this thing running? It just drives me cracy. > > Thanx for any help, > > andy > > >

    attached mail follows:


    Its hard to imagine anything better and clear than what print_r() or even var_dump() outputs...

    "Marty McGowan" <marty3mcgowans.org> wrote in message news:1103_1028146508news.php.net... > PHPers, > In a genaology application, where I add individuals to > an array: > > $everyone[] = new Individual($id); > > I'd like to print the indiviuals' attributes. Some of these are > in array's themselves: like a list of event's in one's life. > > My problem is: > when printing the Class Variables using the "standard" approach: > ========= > function print_vars($obj) { > $arr = get_object_vars($obj); > while (list($prop, $val) = each($arr)) > { > echo "$prop\t$val\n"; > } > } > ========= > I see the message: > > Variables: Person: Added RELI attribute > > id I6 > last McGOWAN > first Martin James > suffix Sr. > > sex M > > lifeevent Array > attribute Array > ======== > > My question is: > How does one print out the "Array"? > > My attempt at testing . > > (strcmp($val,"Array") == 0) > > was fruitless, as the print value of > $var is always a string, but not always > in other contexts. > > What am I missing? > > Thanks, > -- Marty McGowan > > >

    attached mail follows:


    Anyone else having trouble getting to http://bugs.php.net ???

    ========================================== Richard Black Systems Programmer, DataVisibility Ltd - http://www.datavisibility.com Tel: 0141 435 3504 Email: rblackdatavisibility.co.uk

    attached mail follows:


    I am creating an application where it would be useful to write and store script in a field in a MySQL database and create a loop to process the array of the code contained in the field. Conceptually, I think it sounds reasonable but I am uncertain of what kind of process I could use to have the code in the field variable read properly within the loop. Somewhat analogous to an include in HTML. The file would be read as though a single script file though the included material has come from a text field.

    This would be really useful for me since the code could be modified in the database outside a smaller application without changing the files. Any ideas here on how I might do this from anyone that has attempted anything similar? I have set everything up but just can't figure out how to bring the script text in the field into the file properly. Help much appreciated.

    --
    

    Dave Pratt dave.prattwebcoursesnow.com

    attached mail follows:


    I'm pretty sure you can use eval() on a string, but tread with caution, and try to look around for security concerns.

    I certainly wouldn't eval() anything supplied by a user... no way.

    Justin French

    on 01/08/02 7:53 PM, David Pratt (dave.prattwebcoursesnow.com) wrote:

    > I am creating an application where it would be useful to write and store > script in a field in a MySQL database and create a loop to process the array > of the code contained in the field. Conceptually, I think it sounds > reasonable but I am uncertain of what kind of process I could use to have > the code in the field variable read properly within the loop. Somewhat > analogous to an include in HTML. > The file would be read as though a single script file though the included > material has come from a text field. > > This would be really useful for me since the code could be modified in the > database outside a smaller application without changing the files. Any > ideas here on how I might do this from anyone that has attempted anything > similar? I have set everything up but just can't figure out how to bring > the script text in the field into the file properly. Help much appreciated. > -- > > Dave Pratt > dave.prattwebcoursesnow.com >

    attached mail follows:


    I agree with Justin!

    Probably your best solution is to write your own mini script and write an interpreter for it!

    Elias "Justin French" <justinindent.com.au> wrote in message news:B96F5431.BCD6%justinindent.com.au... > I'm pretty sure you can use eval() on a string, but tread with caution, and > try to look around for security concerns. > > I certainly wouldn't eval() anything supplied by a user... no way. > > > Justin French > > > on 01/08/02 7:53 PM, David Pratt (dave.prattwebcoursesnow.com) wrote: > > > I am creating an application where it would be useful to write and store > > script in a field in a MySQL database and create a loop to process the array > > of the code contained in the field. Conceptually, I think it sounds > > reasonable but I am uncertain of what kind of process I could use to have > > the code in the field variable read properly within the loop. Somewhat > > analogous to an include in HTML. > > The file would be read as though a single script file though the included > > material has come from a text field. > > > > This would be really useful for me since the code could be modified in the > > database outside a smaller application without changing the files. Any > > ideas here on how I might do this from anyone that has attempted anything > > similar? I have set everything up but just can't figure out how to bring > > the script text in the field into the file properly. Help much appreciated. > > -- > > > > Dave Pratt > > dave.prattwebcoursesnow.com > > >

    attached mail follows:


    see: http://lgwm.org/trap.htm

    try to use the same mechanism.

    Elias "Petre" <internetvsa.co.za> wrote in message news:3D481B52.6020103vsa.co.za... > HI > Is there a way I can disable the client's browser back button, forcing > them to use the navigation I built into the page? > Ideally, when they try to press "BACK" on browser, a popup asking them > to use the navigation instead would win first prize. > > The reason I'm asking is again to do with sessions, I have an app > running 100% now without using cookies, but if the user hits BACK and > ignores the expire warning, the app produces unwanted results ( adds > form data again to the db etc.) > Just want to patch the holes. > > Maybe write my own little browser that has no back button?? > >

    attached mail follows:


    try str_replace() or preg_replace()

    Elias,

    "Nick Wilson" <nicktioka.com> wrote in message news:20020731204112.GA4148explodingnet.com... > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > Hi everyone, > > I break out in a cold sweat just thinking about regex, so I thought I'd > ask you if there was an easier way to do this: > > I want to look through all of the files in a directory and extract a > certain variable from each. > > This is to create a dynamic menu of the directory: The files are php > scripts that assign $title (among others) to Smarty templates. > > I need to get $title from each file > > I had a look through the docs and didn't see anything obvious, which is > why I'm here :-) > > Many thanks... > - -- > Nick Wilson // www.tioka.com > > > > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v1.0.6 (GNU/Linux) > > iD8DBQE9SEtnHpvrrTa6L5oRAuVyAJ4j4jfC4nKKni3S6V5xsmZH2xhPDQCdF7wA > Y0vShZPQ1n5qZE48LIhCVyA= > =DLPZ > -----END PGP SIGNATURE-----

    attached mail follows:


    vBulletin has a file called ticker.php that allows users to have latest posts sent to their toolbar in Windows. An example can be found on this site: http://www.whitesoxinteractive.com/Ticker.htm

    How exactly do they do this? I can't manage to get my hands on the file to take a look but it's something I'd like to look at.

    Jeff

    attached mail follows:


    It just pulls up a PHP page...what's the big deal? Make up a PHP page that pulls the newest post out, displays it, and refreshes itself ever minute or so... It looks extremely annoying to me. Why would to want that on your toolbar? Just open up IE with the same page.....

    ---John Holmes...

    ----- Original Message ----- From: "Jeff Lewis" <jeffhyrum.net> To: <php-generallists.php.net> Sent: Thursday, August 01, 2002 7:27 AM Subject: [PHP] News to toolbar (ticker)

    > vBulletin has a file called ticker.php that allows users to have latest > posts sent to their toolbar in Windows. An example can be found on this > site: http://www.whitesoxinteractive.com/Ticker.htm > > How exactly do they do this? I can't manage to get my hands on the file to > take a look but it's something I'd like to look at. > > Jeff > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php >

    attached mail follows:


    Well, Just make a PHP page that shows what you want. Use a META-REFRESH tag to have it refresh itself every 60 seconds (I'm assuming that'll work in the "toolbar"). I'm not sure of the specifics for vBulletin, but the database structure isn't that difficult. Just pull use LIMIT to pull out the latest post, format it, and display it on the page...

    Do you still need help? Maybe you should get more specific as to what you want...

    ---John Holmes...

    ----- Original Message ----- From: "Jeff Lewis" <jeffhyrum.net> To: "1LT John W. Holmes" <holmes072000charter.net> Sent: Thursday, August 01, 2002 8:34 AM Subject: Re: [PHP] News to toolbar (ticker)

    > I was being sarcastic. Trust me, you won't see me running the thing on my > computer but for the open source project I run, users like all kinds of > weird things :) > > > ----- Original Message ----- > From: "1LT John W. Holmes" <holmes072000charter.net> > To: "Jeff Lewis" <jeffhyrum.net> > Sent: Thursday, August 01, 2002 8:26 AM > Subject: Re: [PHP] News to toolbar (ticker) > > > > I don't know if you're being sarcastic or not. It's hard to tell over > email. > > I didn't mean to discourage you, I was just giving my personal opinion. > > > > ---John Holmes... > > > > ----- Original Message ----- > > From: "Jeff Lewis" <jeffhyrum.net> > > To: "1LT John W. Holmes" <holmes072000charter.net> > > Sent: Thursday, August 01, 2002 8:13 AM > > Subject: Re: [PHP] News to toolbar (ticker) > > > > > > > You're right, it's a stupid idea, I don't know why I ever thought of > > posting > > > it on the list. > > > > > > I don't know what I was thinking, I'll crawl back under my rock now. > > > ----- Original Message ----- > > > From: "1LT John W. Holmes" <holmes072000charter.net> > > > To: "Jeff Lewis" <jeffhyrum.net>; <php-generallists.php.net> > > > Sent: Thursday, August 01, 2002 8:06 AM > > > Subject: Re: [PHP] News to toolbar (ticker) > > > > > > > > > > It just pulls up a PHP page...what's the big deal? Make up a PHP page > > that > > > > pulls the newest post out, displays it, and refreshes itself ever > minute > > > or > > > > so... It looks extremely annoying to me. Why would to want that on > your > > > > toolbar? Just open up IE with the same page..... > > > > > > > > ---John Holmes... > > > > > > > > ----- Original Message ----- > > > > From: "Jeff Lewis" <jeffhyrum.net> > > > > To: <php-generallists.php.net> > > > > Sent: Thursday, August 01, 2002 7:27 AM > > > > Subject: [PHP] News to toolbar (ticker) > > > > > > > > > > > > > vBulletin has a file called ticker.php that allows users to have > > latest > > > > > posts sent to their toolbar in Windows. An example can be found on > > this > > > > > site: http://www.whitesoxinteractive.com/Ticker.htm > > > > > > > > > > How exactly do they do this? I can't manage to get my hands on the > > file > > > to > > > > > take a look but it's something I'd like to look at. > > > > > > > > > > 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:


    Jason Wong wrote:

    > On Wednesday 31 July 2002 22:40, Paul Dionne wrote: >> >> I have a class in my script which has information on specific tables such >> as standard queries, tablenames, Index field... >> >> Then there is a function called StandardDropDown($ItemNum, $Name) which >> gets the info from the appropriate table you want and displays a dropdown >> menu based on the table. >> >> $ItemNum referrs to the table I want to output, $Name is what I want to >> call the dropdown in the HTML output. >> >> When I call the function directly from a page it works great. >> >> When I call it from another function I get an error: >> Fatal error: Call to a member function on a non-object in >> /var/www/html/COMESA/theme/functions.inc on line 61 >> >> This is line 61: $TableName= $ItemNum->get_TableName(); >> >> As I said, I only get this error when I call from a function, not if I >> call >> directly from a page. I don't see why that should make any difference >> though. > > In your function declare your object as global. >

    I will do that and see if it helps, but why should that make a difference? I would like to know what I am doing wrong in general.

    attached mail follows:


    Help still needed.

    I just went back to the code and looked. Making $ItemNum does not make a difference. And the object which is passed to it is part of the class which is global anyway.

    Paul

    Paul Dionne wrote:

    > Hello everyone, > > I have a class in my script which has information on specific tables such > as standard queries, tablenames, Index field... > > Then there is a function called StandardDropDown($ItemNum, $Name) which > gets the info from the appropriate table you want and displays a dropdown > menu based on the table. > > $ItemNum referrs to the table I want to output, $Name is what I want to > call the dropdown in the HTML output. > > When I call the function directly from a page it works great. > > When I call it from another function I get an error: > Fatal error: Call to a member function on a non-object in > /var/www/html/COMESA/theme/functions.inc on line 61 > > This is line 61: $TableName= $ItemNum->get_TableName(); > > As I said, I only get this error when I call from a function, not if I > call > directly from a page. I don't see why that should make any difference > though. > > Paul

    attached mail follows:


    On Thursday 01 August 2002 20:21, Paul Dionne wrote: > Help still needed. > > I just went back to the code and looked. Making $ItemNum does not make a > difference. And the object which is passed to it is part of the class > which is global anyway.

    Use print_r() or var_dump() on $ItemNum outside and inside of the function and compare.

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

    /* What we wish, that we readily believe. -- Demosthenes */

    attached mail follows:


    Hi,

    does anyone know of an elegant way to get the Url of the current frame in a php variable.

    Thanks for any suggestions.

    Patrick

    PS I know that PHP_SELF will provide the url of the main frame

    attached mail follows:


    the only way would be with javascript, but remember, this would be done AFTER the page leaves the server (client side), so it will be quite messy.

    or you could try keeping track of what the sub-frame is doing with sessions... each time you change it's URL, update the session variable.

    or you could re-think your code design so you don't have to rely on something so complicated :)

    I guess knowing the reason why you need to do this might enable us to give you more help.

    Justin French

    on 01/08/02 10:32 PM, patrick anderson (p.d.andersontue.nl) wrote:

    > Hi, > > does anyone know of an elegant way to get the Url of the current frame > in a php variable. > > Thanks for any suggestions. > > Patrick > > PS I know that PHP_SELF will provide the url of the main frame >

    attached mail follows:


    I would like to include a style sheet based on the url; the references to the style sheet are stored in MySQL.

    I guess the way to code this would be to use php to create the javascript code with the list of style sheets.

    thanks,

    patrick

    Justin French wrote:

    > the only way would be with javascript, but remember, this would be done > AFTER the page leaves the server (client side), so it will be quite messy. > > or you could try keeping track of what the sub-frame is doing with > sessions... each time you change it's URL, update the session variable. > > or you could re-think your code design so you don't have to rely on > something so complicated :) > > I guess knowing the reason why you need to do this might enable us to give > you more help. > > Justin French > > on 01/08/02 10:32 PM, patrick anderson (p.d.andersontue.nl) wrote: > > > Hi, > > > > does anyone know of an elegant way to get the Url of the current frame > > in a php variable. > > > > Thanks for any suggestions. > > > > Patrick > > > > PS I know that PHP_SELF will provide the url of the main frame > >

    attached mail follows:


    I think something is wrong with the way I am calling ldap_modify, but I'm not sure exactly what, from the scripts and tutorials I've been looking at/experimenting with:

    $ds=ldap_connect("online-leagues.com"); if ($ds) { $r=ldap_bind($ds, 'username', 'password'); // Search surname entry $sr=ldap_search($ds, 'cn=online-leagues.com', 'uid=testing'); echo "Search result is ".$sr."<p>"; $info = ldap_get_entries($ds, $sr); echo "dn is: ". $info[0]["dn"] ."<br>"; echo "first cn entry is: ". $info[0]["cn"][0] ."<br>"; echo "first email entry is: ". $info[0]["mail"][0] ."<p>"; echo "st = ". $info[0]["st"][0] ."<p>";

    $info[0]["st"][0]="stchanged!";

    ldap_modify($ds, 'uid=testing,cn=online-leagues.com', $info); echo "Closing connection"; ldap_close($ds);

    } else { echo "<h4>Unable to connect to LDAP server</h4>"; }

    The error returned is:

    Fatal error: LDAP: Unknown Attribute in the data in /usr/local/www/sites/online-leagues.com/htdocs/ldapform.php on line 31

    I looked up the error on google but didn't find anything..

    Running ldapsearch from the command line on my box, the record looks like:

    # # filter: (objectclass=*) # requesting: ALL #

    # online-leagues.com dn: cn=online-leagues.com objectclass: top objectclass: organization objectclass: CommuniGateDomain cn: online-leagues.com o: www.online-leagues.com

    # testing, online-leagues.com dn: uid=testing,cn=online-leagues.com objectclass: top objectclass: person objectclass: organizationalPerson objectclass: inetOrgPerson objectclass: CommuniGateAccount cn: rn hostServer: online-leagues.com sn: st: st street: str telephoneNumber: tn uid: testing mail: testingonline-leagues.com

    so I think the dn is right, but I'm not 100% sure now. Any ideas?

    Thanks, Chad

    attached mail follows:


    I think your problem is that you are passing the output of ldap_get_entries() directly back into ldap_modify(). ldap_get_entries() returns an array of result elements whereas ldap_modify() is expecting a single element.

    So, to change the 'st' attribute for the uid=testing record, you should simply do:

    $data['st'] = 'stchanged'; ldap_modify($ds, 'uid=testing,cn=online-leagues.com', $data);

    If st takes multiple values, use:

    $data['st'][0] = 'stchanged'; $data['st'][1] = '2nd value'; ldap_modify($ds, 'uid=testing,cn=online-leagues.com', $data);

    -Rasmus

    On Thu, 1 Aug 2002, Chad Day wrote:

    > I think something is wrong with the way I am calling ldap_modify, but I'm > not sure exactly what, from the scripts and tutorials I've been looking > at/experimenting with: > > $ds=ldap_connect("online-leagues.com"); > if ($ds) { > $r=ldap_bind($ds, 'username', 'password'); > // Search surname entry > $sr=ldap_search($ds, 'cn=online-leagues.com', 'uid=testing'); > echo "Search result is ".$sr."<p>"; > $info = ldap_get_entries($ds, $sr); > echo "dn is: ". $info[0]["dn"] ."<br>"; > echo "first cn entry is: ". $info[0]["cn"][0] ."<br>"; > echo "first email entry is: ". $info[0]["mail"][0] ."<p>"; > echo "st = ". $info[0]["st"][0] ."<p>"; > > $info[0]["st"][0]="stchanged!"; > > ldap_modify($ds, 'uid=testing,cn=online-leagues.com', $info); > echo "Closing connection"; > ldap_close($ds); > > } else { > echo "<h4>Unable to connect to LDAP server</h4>"; > } > > The error returned is: > > Fatal error: LDAP: Unknown Attribute in the data in > /usr/local/www/sites/online-leagues.com/htdocs/ldapform.php on line 31 > > I looked up the error on google but didn't find anything.. > > > Running ldapsearch from the command line on my box, the record looks like: > > > # > # filter: (objectclass=*) > # requesting: ALL > # > > # online-leagues.com > dn: cn=online-leagues.com > objectclass: top > objectclass: organization > objectclass: CommuniGateDomain > cn: online-leagues.com > o: www.online-leagues.com > > > # testing, online-leagues.com > dn: uid=testing,cn=online-leagues.com > objectclass: top > objectclass: person > objectclass: organizationalPerson > objectclass: inetOrgPerson > objectclass: CommuniGateAccount > cn: rn > hostServer: online-leagues.com > sn: > st: st > street: str > telephoneNumber: tn > uid: testing > mail: testingonline-leagues.com > > > so I think the dn is right, but I'm not 100% sure now. Any ideas? > > Thanks, > Chad > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php >

    attached mail follows:


    Also tried that, no success, unless I am missing something.

    ... $info["st"]="stchanged!"; ...

    ldap_modify($ds, 'uid=testing,cn=online-leagues.com', $info);

    Fatal error: LDAP: Unknown Attribute in the data in /usr/local/www/sites/online-leagues.com/htdocs/ldapform.php on line 31

    Chad

    -----Original Message----- From: Rasmus Lerdorf [mailto:rasmusphp.net] Sent: Thursday, August 01, 2002 9:41 AM To: Chad Day Cc: php-generallists.php.net Subject: Re: [PHP] ldap_modify parameters?

    I think your problem is that you are passing the output of ldap_get_entries() directly back into ldap_modify(). ldap_get_entries() returns an array of result elements whereas ldap_modify() is expecting a single element.

    So, to change the 'st' attribute for the uid=testing record, you should simply do:

    $data['st'] = 'stchanged'; ldap_modify($ds, 'uid=testing,cn=online-leagues.com', $data);

    If st takes multiple values, use:

    $data['st'][0] = 'stchanged'; $data['st'][1] = '2nd value'; ldap_modify($ds, 'uid=testing,cn=online-leagues.com', $data);

    -Rasmus

    On Thu, 1 Aug 2002, Chad Day wrote:

    > I think something is wrong with the way I am calling ldap_modify, but I'm > not sure exactly what, from the scripts and tutorials I've been looking > at/experimenting with: > > $ds=ldap_connect("online-leagues.com"); > if ($ds) { > $r=ldap_bind($ds, 'username', 'password'); > // Search surname entry > $sr=ldap_search($ds, 'cn=online-leagues.com', 'uid=testing'); > echo "Search result is ".$sr."<p>"; > $info = ldap_get_entries($ds, $sr); > echo "dn is: ". $info[0]["dn"] ."<br>"; > echo "first cn entry is: ". $info[0]["cn"][0] ."<br>"; > echo "first email entry is: ". $info[0]["mail"][0] ."<p>"; > echo "st = ". $info[0]["st"][0] ."<p>"; > > $info[0]["st"][0]="stchanged!"; > > ldap_modify($ds, 'uid=testing,cn=online-leagues.com', $info); > echo "Closing connection"; > ldap_close($ds); > > } else { > echo "<h4>Unable to connect to LDAP server</h4>"; > } > > The error returned is: > > Fatal error: LDAP: Unknown Attribute in the data in > /usr/local/www/sites/online-leagues.com/htdocs/ldapform.php on line 31 > > I looked up the error on google but didn't find anything.. > > > Running ldapsearch from the command line on my box, the record looks like: > > > # > # filter: (objectclass=*) > # requesting: ALL > # > > # online-leagues.com > dn: cn=online-leagues.com > objectclass: top > objectclass: organization > objectclass: CommuniGateDomain > cn: online-leagues.com > o: www.online-leagues.com > > > # testing, online-leagues.com > dn: uid=testing,cn=online-leagues.com > objectclass: top > objectclass: person > objectclass: organizationalPerson > objectclass: inetOrgPerson > objectclass: CommuniGateAccount > cn: rn > hostServer: online-leagues.com > sn: > st: st > street: str > telephoneNumber: tn > uid: testing > mail: testingonline-leagues.com > > > so I think the dn is right, but I'm not 100% sure now. Any ideas? > > Thanks, > Chad > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php >

    attached mail follows:


    Hello,

    I have to use a COM object with following properties:

    ... Property StationsX(lIndex As Long) As Long Property StationsY(lIndex As Long) As Long ...

    I didn't manage to initialize these properties. I create a new COM object with: $obj = new COM("********");

    If I try $obj->StationX(0)=$val;

    I get an error message ( StationX(0) is then known as a function. So, I can't put a value in it)

    So, I want to use com_propput but it doesn't work.

    Can any one help me, giving me the good syntax for com_propput, or giving me advices...

    I'm using PHP 4.2.2

    Thank u very much

    attached mail follows:


    <?php if(!isset($PHP_AUTH_USER) || (isset($logout))) { header("WWW-Authenticate: Basic realm=\"Your Realm\""); header("HTTP/1.0 401 Unauthorized"); echo "Your custom 401 message here\n"; exit; } else { echo "<p>Hello $PHP_AUTH_USER.</p>"; echo "<p>Your password is $PHP_AUTH_PW.</p>"; echo "<form><input type=submit name=logout value=Logout></form>"; } ?>

    Ray Todd Stevens wrote: > > I am working on a web site that is using php controled www- > authenticate authentication. User ids are specific to users and > different pages and different levels of information for a given page > will be displayed based on the user id used. The problem is how do > you log out without having to quit all browser sessions. Anyone > doing this? Care to share code that makes it work? > -------------------------------------------------------------------- > -------------- > Ray Todd Stevens Specialists in Network and Security > Consulting > Senior Consultant Software audit service available > Stevens Services > Suite 21 > 3754 Old State Rd 37 N > Bedford, IN 47421 > (812) 279-9394 > Raytoddkiva.net > > Thought for the day: > Concerto (n): a fight between a piano and a pianist. > > For PGP public key send message with subject > please send PGP key > > If this message refers to an attachment the attachment > may arrive as a seperate mail message depending on the > type of mail client and gateway software you are using.

    attached mail follows:


    Hi there,

    I am trying to install PEAR. Horde - a webmailer - requires a certain log modul which seams not to come with the recent php installation. I installed a second php version as standalone php version to be able to install the pear class like stated on the php.net site. However I do still get this message:

    a.. Log - No a.. Make sure you're using a recent version of PEAR which includes the Log class

    Can anybody give me a hint on how to install this PEAR successfully on my php version (I guess now it is installed inside the other php standalone version)

    Thanx for any help

    Andy

    attached mail follows:


    hi,

    how can i sort data from mysql into two columns. Thanks.

    eg:

    link1 linka link linke

    attached mail follows:


    > how can i sort data from mysql into two columns. Thanks. > > eg: > > link1 linka > link linke

    Do you mean how can you get MySQL to present the data in sorted order or how can you get the browser to display the results in neat columns?

    Depending upon the question, you either want to use a SELECT query with an ORDER BY clause or you want to output the result within HTML table tags.

    Simon Ritchie

    Download my introduction to PHP for $25: http://merrowinternet.com/downloads?source=ml

    attached mail follows:


    Hi...

    I'm working on XML files where are stored in a MySQL database. With PHP I intend to transform these XML with XSLT. After much difficulty, I managed to sort out everything until the portion about xslt_process. The browser returns:

    Warning: Sablotron error on line 2: 'arg:/argument.dtd' not found in /home/httpd/html/ctan/resultworkingcopy2.php on line 91 XSLT processing error: 'arg:/argument.dtd' not found

    Anyone have any idea what's going on? I'd appreciate any help I can get on this. Thanks in advance.

    Chia

    attached mail follows:


    Hello,

    I have just finished re-compile and re-install apache 1.3.26, php 4.2.2, openssl 0.9.6d and mod_ssl... But when I start the apache by running : apachectl startssl

    php and https can't for work with apache, then I check the file "httpd.conf" : I found : <IfDefine SSL> LoadModule ssl_module libexec/libssl.so LoadModule php4_module libexec/libphp4.so </IfDefine>

    <IfDefine SSL> AddModule mod_ssl.c AddModule mod_php4.c </IfDefine>

    <IfDefine SSL> Listen 80 Listen 443 </IfDefine>

    And there are no the following lines into httpd.conf :

    AddType application/x-httpd-php .php .php AddType application/x-httpd-php-source .phps

    So, I try to modify the setting by these :

    #<IfDefine SSL> LoadModule ssl_module libexec/libssl.so LoadModule php4_module libexec/libphp4.so #</IfDefine>

    #<IfDefine SSL> AddModule mod_ssl.c AddModule mod_php4.c #</IfDefine>

    <IfDefine SSL> #Listen 80 Listen 443 </IfDefine> Listen 80

    And then add these lines into httpd.conf also :

    AddType application/x-httpd-php .php .php AddType application/x-httpd-php-source .phps

    After that, I try to restart the apache by : apachectl startssl...

    OH...php is ok for work with apache, but https can't for work with apache again !

    So, can you help me more ?

    Thanks.

    Cristel Iofciu wrote:

    > I know Apache 1.3.26, PHP 4.2.2 on Slack 8.0 work with IMP. > I suggest you upgrade to Apache 1.3.26 too (take a look at CERT.org for the > reason :)), and don't think RH6.2 will matter in this case... > > Cristel Iofciu > NetAdmin > ------------------------------- > eXonsite srl > Constanta, 8700 > Soveja 19, Bl. V3 ap.24 > -------------------------------------- > [T] +40-0241-638300 > [M] +40-0722-924541 > [E] cristelexonsite.ro > [W] www.exonsite.ro > -------------------------------------------- > > Quoting EdwardSPLita.org.mo: > > > Hello, > > > > Do you know apache 1.3.22 and php 4.2.2 are good for work with IMP 3.x > > under RH 6.2 system ? > > > > Thank for your help ! > > > > Edward. > > > > > > > > > > -- > > IMP mailing list > > Frequently Asked Questions: http://horde.org/faq/ > > To unsubscribe, mail: imp-unsubscribelists.horde.org > > > > ---------------------------------------------------------- > Acest mesaj a fost trimis prin http://webmail.exonsite.ro

    attached mail follows:


    Not sure if this is a PHP question but I've traced the problem to a PHP statement.

    I have a form that when submitted, displays a PDF document in the browser (using a PDF library). When I click on the back button, it should redisplay my form but instead, displays a warning that data has expired and I need to refresh. Now this never happened until recently so I look at recent changes and traced the problem to one single PHP statement at the top of my file:

    session_start();

    I am using sessions to pass values between pages and so added the statement to my page so that I could check the value of a variable. When I comment out the above statement, I am no longer prompted to refresh.

    Question: How can I have my cake and eat it to?

    Thanks, Don

    attached mail follows:


    This is generally caused by using POST as the form's methods. Try using GET instead.

    Danny.

    ----- Original Message ----- From: "DonPro" <donprolclcan.com> To: "php list" <php-generallists.php.net> Sent: Thursday, August 01, 2002 3:57 PM Subject: [PHP] Form asking to refresh when I hit the back button

    > Not sure if this is a PHP question but I've traced the problem to a PHP > statement. > > I have a form that when submitted, displays a PDF document in the browser > (using a PDF library). When I click on the back button, it should redisplay > my form but instead, displays a warning that data has expired and I need to > refresh. Now this never happened until recently so I look at recent changes > and traced the problem to one single PHP statement at the top of my file: > > session_start(); > > I am using sessions to pass values between pages and so added the statement > to my page so that I could check the value of a variable. When I comment > out the above statement, I am no longer prompted to refresh. > > Question: How can I have my cake and eat it to? > > Thanks, > Don > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php >

    attached mail follows:


    What does it mean when PHP forces the session ID into the URL, the host changed something in the configuration without informing me it would seem, (it dind't happen before now does)

    R>

    ________________________--__-______-______________ eat pasta type fasta

    attached mail follows:


    I looked in the predefined variable section of the manual and couldn't find that there was a way to get this information from that. If there was another way you could get this via PHP, I couldn't find it anywhere else in the docs. So, does anyone know of a good method to get the Time Zone local to the end user?

    Chris

    attached mail follows:


    >A'la ASP WebServices perhaps? > >"Bob Lockie" <bjlockielockie.ca> wrote in message >news:200207310445.g6V4jcdN014376gw.lockie.ca... >> >> >I'd like to know if it's possible to use PHP to develop and implement >> >Web Services. If so, please point me to sites, articles, or tutorials >> >that discuss this topic in more detail. Thanks. >> >> How do you define web services?

    I know nothing about ASP.

    attached mail follows:


    I think he means XML WebServices (probably using SOAP)

    It's not too difficult, there are a few SOAP classes for PHP now, simply send your SOAP encoded request to the server, via HTTP, and decode the SOAP response that you get back.

    There's also a SOAP module for PHP (alpha release atm) at http://phpsoaptoolkit.sourceforge.net/phpsoap/

    If you're after an all in 1 solution you might want to look at nusoap - but it was really buggy the last time I used it, so I don't recommend it at this time.

    I've heard something about another all in 1 solution that's quite promising - but it's behind closed doors atm.

    Danny.

    ----- Original Message ----- From: "Bob Lockie" <bjlockielockie.ca> To: <php-generallists.php.net> Sent: Thursday, August 01, 2002 4:09 PM Subject: Re: [PHP] web services and PHP

    > > >A'la ASP WebServices perhaps? > > > >"Bob Lockie" <bjlockielockie.ca> wrote in message > >news:200207310445.g6V4jcdN014376gw.lockie.ca... > >> > >> >I'd like to know if it's possible to use PHP to develop and implement > >> >Web Services. If so, please point me to sites, articles, or tutorials > >> >that discuss this topic in more detail. Thanks. > >> > >> How do you define web services? > > I know nothing about ASP. > > > > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php >

    attached mail follows:


    This is a part of my code for my data interfacer class which takes an SQL RESULT RESOURCE and gets the field from it. Problem is, i can't get the primary key out nor the auto-increment flag out. Before, the same script (or so, it was modified but not that part) was working fine. I tried it on several tables and on several database servers and i still can't get the PRIMARY or AUTO_INCREMENT flag out. In fact the only flag that is returned is: NOT_NULL. (When i ECHO the mysql_field_flags(...) i get only notnull).

    Furthermore, i can't seem to get the data, that i will check more in detail, my most important part IS the primary and auto-increment flags.

    Thanks in advance if you can find something.

    Here is the complete code that you need:

    //Execute the query twice to get the fields and a result for the values $result = $this->mysql_server->send_result_sql($this->query_builder->generate_select() , 1); $fieldlist = $this->mysql_server->send_result_sql($this->query_builder->generate_select() , 1);

    //get the first row to insert values in the interface $data = mysql_fetch_array($result);

    //Used for the field flag fetching $curfield = -1; $fieldcount = mysql_num_fields($fieldlist);

    //Loop the data field definition and add the field in the end for($curfield = 0; $curfield < $fieldcount; $curfield++){ //Get the current field $datadef = mysql_fetch_field($fieldlist, $curfield);

    //Reset the data $primary_key = 0; $auto_increment = 0;

    //Get all the other params from the field definition $fieldname = $datadef->name; $sourcetable = $datadef->table; $datatype = constant("MYSQL_NDT_" . strtoupper($datadef->type)); $fieldvalue = $data[$datadef->name]; $datasize = $datadef->max_length;

    //Get the field flags and explode them immediatly $fieldflags = explode(" ", mysql_field_flags($fieldlist, $curfield));

    //Check all the field flags foreach($fieldflags as $key => $value){ if($value == "primary_key"){ $primary_key = 1; }elseif($value == "auto_increment"){ $auto_increment = 1; } }

    //Add the field to the data_interface $newint->add_field($fieldname, $fieldvalue, $datatype, $datasize, $primary, $autoinc, $sourcetable); }

    attached mail follows:


    OK, changed the subject to what I think it should be about.

    Anybody?

    "Shew" <babydragon4excite.com> wrote in message news:20020731141657.80369.qmailpb1.pair.com... > Hi - I'm a TOTAL php NEWBIE - my 1st bit of code!!!. > > Basically the input form page has 17 sets of radio buttons, each > representing one game with 2 options - team 1 and team 2. What I want to do > is a better way of checking each radio button value instead of using an if > statement for each. This code doesn't really work - it finds that vars > ALWAYS exist. > > IE: > > <INPUT NAME=Game1 VALUE=1>Chicago > <INPUT NAME=Game1 VALUE=2>whatever > > <INPUT NAME=Game2 VALUE=3>Minny > <INPUT NAME=Game2 VALUE=1>Nobody > > Code above is processed by the following code: > > for ($GameIdx = 1; $GameIdx <= 17; $GameIdx++) { > /* instead "hardcoding each radio button name - just do it programmatically > by concatenating / creating the name */ > $frmGame = "Game" + $GameIdx; > if ($frmGame) { > /* U want to check if the length is 5 or 6 bytes because it could be > "game1" or "game14" */ > $Length = strlen($frmGame); > if ($Length == 5) { > $GetNumber = 1; > } > else { > $GetNumber = 2; > } > > $GameID = intval(substr($frmGame, $Length - $GetNumber, $GetNumber)); > print "Game ---> $GameIdx - $frmGame - $GetNumber - $GameID <BR>"; > if ($GameID == $GameIdx) { > print "Yeah Match - $GameID = $GameIdx <BR>"; > /* OK, here is where U want to do the actual insert */ > } > } /* $frmGame endif */ > } > > ?> > > > Thanks > > >

    attached mail follows:


    It looks like your code could use "variable variables" to help you out.

    ::::::::::: OLD CODE ::::::::::::::::

    > > for ($GameIdx = 1; $GameIdx <= 17; $GameIdx++) { > > /* instead "hardcoding each radio button name - just do it > programmatically > > by concatenating / creating the name */ > > $frmGame = "Game" + $GameIdx; > > if ($frmGame) {

    ::::::: END OF OLD CODE :::::::::::::

    ** this check will always be true - because you just set $frmGame equal to a value... *** What you want to do at this point is use variable variables (where the variable name is actually a variable itself.

    ::::::::: NEW CODE :::::::::::

    > > $var_frmGame = "Game" + $GameIdx; > > $frmGame = $$var_frmGame; // The "$$" is used for variable variables > > if ($frmGame) {

    :::::: END OF NEW CODE :::::::

    ** the above snippett is was I wrote to show the results of the dynamic (looped-through) variable $Game1, $Game2, ...

    I use this method when the number of form elements is variable. Instead of hardcoding the number "17" you might make a variable in the incoming form with the count of form elements (simply increment a variable with each printing of the form variable... then at the end of the form make <input type="hidden" name="elementcount" value="$count">)

    Then you can make the above for-statement look like this:

    > > for ($GameIdx = 1; $GameIdx <= $elementcount; $GameIdx++) {

    Does any of this make sense or help in any way?

    -Mark

    attached mail follows:


    If you made an array for your buttons, then you could use PHP's looping constructs to process the array. Write the input tag like this:

    <INPUT NAME=Game[1] VALUE=1>Chicago

    The processing code will then have access to the array $Game indexed by the game number, e.g., $Game[1].

    Good luck!

    Kirk

    > -----Original Message----- > From: Shew [mailto:babydragon4excite.com] > Sent: Thursday, August 01, 2002 9:19 AM > To: php-generallists.php.net > Subject: [PHP] Re: Dynamically check radio buttons > > > OK, changed the subject to what I think it should be about. > > Anybody? > > "Shew" <babydragon4excite.com> wrote in message > news:20020731141657.80369.qmailpb1.pair.com... > > Hi - I'm a TOTAL php NEWBIE - my 1st bit of code!!!. > > > > Basically the input form page has 17 sets of radio buttons, each > > representing one game with 2 options - team 1 and team 2. > What I want to > do > > is a better way of checking each radio button value instead > of using an if > > statement for each. This code doesn't really work - it > finds that vars > > ALWAYS exist. > > > > IE: > > > > <INPUT NAME=Game1 VALUE=1>Chicago > > <INPUT NAME=Game1 VALUE=2>whatever > > > > <INPUT NAME=Game2 VALUE=3>Minny > > <INPUT NAME=Game2 VALUE=1>Nobody > > > > Code above is processed by the following code: > > > > for ($GameIdx = 1; $GameIdx <= 17; $GameIdx++) { > > /* instead "hardcoding each radio button name - just do it > programmatically > > by concatenating / creating the name */ > > $frmGame = "Game" + $GameIdx; > > if ($frmGame) { > > /* U want to check if the length is 5 or 6 bytes because > it could be > > "game1" or "game14" */ > > $Length = strlen($frmGame); > > if ($Length == 5) { > > $GetNumber = 1; > > } > > else { > > $GetNumber = 2; > > } > > > > $GameID = intval(substr($frmGame, $Length - $GetNumber, > $GetNumber)); > > print "Game ---> $GameIdx - $frmGame - $GetNumber - $GameID <BR>"; > > if ($GameID == $GameIdx) { > > print "Yeah Match - $GameID = $GameIdx <BR>"; > > /* OK, here is where U want to do the actual insert */ > > } > > } /* $frmGame endif */ > > } > > > > ?> > > > > > > Thanks > > > > > > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php >

    attached mail follows:


    test

    attached mail follows:


    I am looking into different password encryption solutions.

    i started using crypt()

    then changed to mcrypt()

    which was not any good cause of the high ascii characters

    then i read about converting the high ascii characters to hex .

    Is this the ideal way to encrypt passwords or is their something better.

    Thanks

    Randy

    attached mail follows:


    Just base64 encode the mcrypt output if the non printable chars bother you, though I don't really see what the problem is, unless you're pushing the output to a web page.

    Danny.

    ----- Original Message ----- From: "Randy Johnson" <icgphpicecoldgold.com> Cc: <php-generallists.php.net> Sent: Thursday, August 01, 2002 4:24 PM Subject: [PHP] mcrypt

    > I am looking into different password encryption solutions. > > i started using crypt() > > then changed to mcrypt() > > which was not any good cause of the high ascii characters > > then i read about converting the high ascii characters to hex . > > Is this the ideal way to encrypt passwords or is their something better. > > Thanks > > Randy > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php >

    attached mail follows:


    Good day,

    > i started using crypt() > > then changed to mcrypt() > > which was not any good cause of the high ascii characters > > then i read about converting the high ascii characters to hex . > > Is this the ideal way to encrypt passwords or is their > something better.

    The crypt() function will generate a standard UNIX crypt password that other programs can understand. UNIX crypt has some limitations (only using the first 8 characters is the major one) but it's good enough for most people and is probably the most widely supported.

    If you want something stronger, you can use md5(). The examples on php's documentation for this function should help you if you're interested in having other programs use it (to have it the right format and length).

    ============================ Darren Gamble Planner, Regional Services Shaw Cablesystems GP 630 - 3rd Avenue SW Calgary, Alberta, Canada T2P 4L4 (403) 781-4948

    attached mail follows:


    I found that the some of the high ascii characters would not store right in the database or something cause when i went to compare them, the comparison would fail.

    Randy

    ----- Original Message ----- From: "Danny Shepherd" <dannykyboshed.com> To: "Randy Johnson" <icgphpicecoldgold.com> Cc: <php-generallists.php.net> Sent: Thursday, August 01, 2002 11:31 AM Subject: Re: [PHP] mcrypt

    > Just base64 encode the mcrypt output if the non printable chars bother you, > though I don't really see what the problem is, unless you're pushing the > output to a web page. > > Danny. > > > ----- Original Message ----- > From: "Randy Johnson" <icgphpicecoldgold.com> > Cc: <php-generallists.php.net> > Sent: Thursday, August 01, 2002 4:24 PM > Subject: [PHP] mcrypt > > > > I am looking into different password encryption solutions. > > > > i started using crypt() > > > > then changed to mcrypt() > > > > which was not any good cause of the high ascii characters > > > > then i read about converting the high ascii characters to hex . > > > > Is this the ideal way to encrypt passwords or is their something better. > > > > Thanks > > > > Randy > > > > > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php > > >

    attached mail follows:


    Anyone know the workaround with the situation here? Here is the sample script. The problem is I include the XML tag into the PHP variable and it messed up everything. It all had to do with "?" here since PHP use it also.

    --clip-- <?php $XML = "<?xml version='1.0' encoding='UTF-8'?><Product>Apple</Product>"; echo $XML; ?>

    Thanks, FletchSOD

    attached mail follows:


    Try:

    <?php $XML = "<"."?xml version='1.0' encoding='UTF-8'?><Product>Apple</Product>"; echo $XML; ?>

    HTH

    Danny.

    ----- Original Message ----- From: "Scott Fletcher" <scottabcoa.com> To: <php-generallists.php.net> Sent: Thursday, August 01, 2002 5:03 PM Subject: [PHP] Problem with "<?xml ....>" inside the PHP code, due to "?"

    > Anyone know the workaround with the situation here? Here is the sample > script. The problem is I include the XML tag into the PHP variable and it > messed up everything. It all had to do with "?" here since PHP use it also. > > --clip-- > <?php > $XML = "<?xml version='1.0' encoding='UTF-8'?><Product>Apple</Product>"; > echo $XML; > ?> > > Thanks, > FletchSOD > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php >

    attached mail follows:


    <?php $XML = "<\?xml version='1.0' encoding='UTF-8'\?><Product>Apple</Product>"; echo $XML; ?>

    Try this?

    Matt Babineau MCWD / CCFD ----------------------------------------- e: mattcriticalcode.com p: 603.943.4237 w: http://www.criticalcode.com PO BOX 601 Manchester, NH 03105

    -----Original Message----- From: Scott Fletcher [mailto:scottabcoa.com] Sent: Thursday, August 01, 2002 12:03 PM To: php-generallists.php.net Subject: [PHP] Problem with "<?xml ....>" inside the PHP code, due to "?"

    Anyone know the workaround with the situation here? Here is the sample script. The problem is I include the XML tag into the PHP variable and it messed up everything. It all had to do with "?" here since PHP use it also.

    --clip-- <?php $XML = "<?xml version='1.0' encoding='UTF-8'?><Product>Apple</Product>"; echo $XML; ?>

    Thanks, FletchSOD

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