php-general Digest 15 Feb 2002 12:31:44 -0000 Issue 1173

Topics (messages 84848 through 84886):

Re: searching key words from a database field
        84848 by: David Robley
        84849 by: Philip J. Newman
        84851 by: Martin Towell
        84857 by: David Robley
        84858 by: Martin Towell

Sessions just not working...
        84850 by: Norman Cates
        84865 by: Yasuo Ohgaki

Re: Sorting an array of arrays....
        84852 by: Toni Kustiana

fopen
        84853 by: John Smythe
        84854 by: Lars Torben Wilson
        84855 by: Martin Towell
        84879 by: Lars Torben Wilson

GOOD, EASY part-time jobs for PROGRAMERS!!!
        84856 by: Balazs Laszlo

Re: good practice
        84859 by: Peter J. Schoenster
        84860 by: Peter J. Schoenster
        84861 by: Philip J. Newman

Imap-uw Horde::IMP
        84862 by: Devin Atencio

Re: class and session identyfier
        84863 by: Yasuo Ohgaki
        84864 by: Yasuo Ohgaki

Looking for optimal coding
        84866 by: Phillip S. Baker
        84867 by: Jason Murray
        84875 by: Joffrey van Wageningen
        84878 by: LuC .

text grabber
        84868 by: Jason Whitaker
        84871 by: hugh danaher

phpTriad
        84869 by: mm fernandez

How get the name of the array variable?
        84870 by: Tomek Golembiewski

Empty form
        84872 by: Ben Clumeck
        84874 by: hugh danaher

Re: Decode Encoded text in phpMyAdmin
        84873 by: David

strange behaviour with output buffering
        84876 by: gaouzief

http header?
        84877 by: marcbey

uuencode
        84880 by: Michael Mehlmann
        84886 by: Mirek Novak

Mail()
        84881 by: André Felix Miertschink

PHP and shadow suite
        84882 by: Dejan Milenkovic

fsockopen timeout
        84883 by: Peter Clarke

Apache - Virtual Name
        84884 by: André Felix Miertschink

Re: array variable name
        84885 by: Tomek Golembiewski

Administrivia:

To subscribe to the digest, e-mail:
        [EMAIL PROTECTED]

To unsubscribe from the digest, e-mail:
        [EMAIL PROTECTED]

To post to the list, e-mail:
        [EMAIL PROTECTED]


----------------------------------------------------------------------
--- Begin Message ---
In article <000801c1b5b0$ee66f180$0401a8c0@philip>, 
[EMAIL PROTECTED] says...
> This works for the loop.  now spliting up the words.  now it searchs for
> just one word in the loop
> 
> any suggestions on this
> 
> 
> ----- Original Message -----
> From: "Jason Wong" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Thursday, February 14, 2002 9:51 PM
> Subject: Re: [PHP] searching key words from a database field
> 
> 
> > On Thursday 14 February 2002 16:38, Philip J. Newman wrote:
> > > I'm trying to make a search engine for my database of links.  I have
> been
> > > using the following.
> > >
> > > SELECT * FROM `hyperlinks` WHERE 1 AND `keywords` LIKE '%$getme%' ORDER
> BY
> > > `id` ASC LIMIT 0, 30
> > >
> > > if $getme = big trees
> > >
> > > then it would only search for key words that are there same "big trees"
> not
> > > for " big and trees"
> >
> >
> > Split up your keywords. Loop through each one to construct something like:
> >
> >  SELECT * FROM `hyperlinks` WHERE 1
> >     AND `keywords` LIKE '%big%'
> >     AND `keywords` LIKE '%trees%'
> >   ORDER BY `id` ASC LIMIT 0, 30
> >
> >
> > This will only match when ALL the specified keywords are present. To match
> on
> > any one of the keywords construct something like:
> >
> >
> >  SELECT * FROM `hyperlinks`
> >   WHERE `keywords` LIKE '%big%'
> >      OR `keywords` LIKE '%trees%'
> >   ORDER BY `id` ASC LIMIT 0, 30
> >
> >
> > --
> > Jason Wong -> Gremlins Associates -> www.gremlins.com.hk

I don't quite understand what you are asking here? You are using explode 
or something to break the input string into separate words, and then 
using the list of words to build your query?

Perhaps showing your problem code might be useful.

-- 
David Robley
Temporary Kiwi!
--- End Message ---
--- Begin Message ---
the problem is there isn't any code yet

and yes what you said is corrent

if text input is: the big tree

would like $string1 = the
would like $string2 = big
would like $string3 = tree

and so on and so on for all the key words entered.  Each key word needs to
have its own string alocated. Any suggestions.

ps: nice to see another kiwi in here.

----- Original Message -----
From: "David Robley" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, February 15, 2002 1:19 PM
Subject: Re: [PHP] searching key words from a database field


> In article <000801c1b5b0$ee66f180$0401a8c0@philip>,
> [EMAIL PROTECTED] says...
> > This works for the loop.  now spliting up the words.  now it searchs for
> > just one word in the loop
> >
> > any suggestions on this
> >
> >
> > ----- Original Message -----
> > From: "Jason Wong" <[EMAIL PROTECTED]>
> > To: <[EMAIL PROTECTED]>
> > Sent: Thursday, February 14, 2002 9:51 PM
> > Subject: Re: [PHP] searching key words from a database field
> >
> >
> > > On Thursday 14 February 2002 16:38, Philip J. Newman wrote:
> > > > I'm trying to make a search engine for my database of links.  I have
> > been
> > > > using the following.
> > > >
> > > > SELECT * FROM `hyperlinks` WHERE 1 AND `keywords` LIKE '%$getme%'
ORDER
> > BY
> > > > `id` ASC LIMIT 0, 30
> > > >
> > > > if $getme = big trees
> > > >
> > > > then it would only search for key words that are there same "big
trees"
> > not
> > > > for " big and trees"
> > >
> > >
> > > Split up your keywords. Loop through each one to construct something
like:
> > >
> > >  SELECT * FROM `hyperlinks` WHERE 1
> > >     AND `keywords` LIKE '%big%'
> > >     AND `keywords` LIKE '%trees%'
> > >   ORDER BY `id` ASC LIMIT 0, 30
> > >
> > >
> > > This will only match when ALL the specified keywords are present. To
match
> > on
> > > any one of the keywords construct something like:
> > >
> > >
> > >  SELECT * FROM `hyperlinks`
> > >   WHERE `keywords` LIKE '%big%'
> > >      OR `keywords` LIKE '%trees%'
> > >   ORDER BY `id` ASC LIMIT 0, 30
> > >
> > >
> > > --
> > > Jason Wong -> Gremlins Associates -> www.gremlins.com.hk
>
> I don't quite understand what you are asking here? You are using explode
> or something to break the input string into separate words, and then
> using the list of words to build your query?
>
> Perhaps showing your problem code might be useful.
>
> --
> David Robley
> Temporary Kiwi!
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
>



--- End Message ---
--- Begin Message ---
try something like this (not tested):

<?
  $getme = "the big  tree";
  $getme_arr = explode(" ", $getme);
  $num = count($getme_arr);

  $sql = "SELECT * FROM `hyperlinks` WHERE 1";

  for ($i = 0; $i < $num; $i++)
    if (strlen($getme_arr[$i]) > 0)
      $sql .= " AND `keywords` LIKE '%".$getme_arr[$i]."%'";

  $sql .= " ORDER BY `id` ASC LIMIT 0, 30";
?>

-----Original Message-----
From: Philip J. Newman [mailto:[EMAIL PROTECTED]]
Sent: Friday, February 15, 2002 11:27 AM
To: David Robley
Cc: David Robley; [EMAIL PROTECTED]; Gareth Hawken
Subject: Re: [PHP] searching key words from a database field


the problem is there isn't any code yet

and yes what you said is corrent

if text input is: the big tree

would like $string1 = the
would like $string2 = big
would like $string3 = tree

and so on and so on for all the key words entered.  Each key word needs to
have its own string alocated. Any suggestions.

ps: nice to see another kiwi in here.

----- Original Message -----
From: "David Robley" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, February 15, 2002 1:19 PM
Subject: Re: [PHP] searching key words from a database field


> In article <000801c1b5b0$ee66f180$0401a8c0@philip>,
> [EMAIL PROTECTED] says...
> > This works for the loop.  now spliting up the words.  now it searchs for
> > just one word in the loop
> >
> > any suggestions on this
> >
> >
> > ----- Original Message -----
> > From: "Jason Wong" <[EMAIL PROTECTED]>
> > To: <[EMAIL PROTECTED]>
> > Sent: Thursday, February 14, 2002 9:51 PM
> > Subject: Re: [PHP] searching key words from a database field
> >
> >
> > > On Thursday 14 February 2002 16:38, Philip J. Newman wrote:
> > > > I'm trying to make a search engine for my database of links.  I have
> > been
> > > > using the following.
> > > >
> > > > SELECT * FROM `hyperlinks` WHERE 1 AND `keywords` LIKE '%$getme%'
ORDER
> > BY
> > > > `id` ASC LIMIT 0, 30
> > > >
> > > > if $getme = big trees
> > > >
> > > > then it would only search for key words that are there same "big
trees"
> > not
> > > > for " big and trees"
> > >
> > >
> > > Split up your keywords. Loop through each one to construct something
like:
> > >
> > >  SELECT * FROM `hyperlinks` WHERE 1
> > >     AND `keywords` LIKE '%big%'
> > >     AND `keywords` LIKE '%trees%'
> > >   ORDER BY `id` ASC LIMIT 0, 30
> > >
> > >
> > > This will only match when ALL the specified keywords are present. To
match
> > on
> > > any one of the keywords construct something like:
> > >
> > >
> > >  SELECT * FROM `hyperlinks`
> > >   WHERE `keywords` LIKE '%big%'
> > >      OR `keywords` LIKE '%trees%'
> > >   ORDER BY `id` ASC LIMIT 0, 30
> > >
> > >
> > > --
> > > Jason Wong -> Gremlins Associates -> www.gremlins.com.hk
>
> I don't quite understand what you are asking here? You are using explode
> or something to break the input string into separate words, and then
> using the list of words to build your query?
>
> Perhaps showing your problem code might be useful.
>
> --
> David Robley
> Temporary Kiwi!
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
>




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
In article <[EMAIL PROTECTED]>, 
[EMAIL PROTECTED] says...
> try something like this (not tested):
> 
> <?
>   $getme = "the big  tree";
>   $getme_arr = explode(" ", $getme);
>   $num = count($getme_arr);
> 
>   $sql = "SELECT * FROM `hyperlinks` WHERE 1";
> 
>   for ($i = 0; $i < $num; $i++)
>     if (strlen($getme_arr[$i]) > 0)
>       $sql .= " AND `keywords` LIKE '%".$getme_arr[$i]."%'";
> 
>   $sql .= " ORDER BY `id` ASC LIMIT 0, 30";
> ?>
> 
> -----Original Message-----
> From: Philip J. Newman [mailto:[EMAIL PROTECTED]]
> Sent: Friday, February 15, 2002 11:27 AM
> To: David Robley
> Cc: David Robley; [EMAIL PROTECTED]; Gareth Hawken
> Subject: Re: [PHP] searching key words from a database field
> 
> 
> the problem is there isn't any code yet
> 
> and yes what you said is corrent
> 
> if text input is: the big tree
> 
> would like $string1 = the
> would like $string2 = big
> would like $string3 = tree
> 
> and so on and so on for all the key words entered.  Each key word needs to
> have its own string alocated. Any suggestions.
> 
> ps: nice to see another kiwi in here.
> 
> ----- Original Message -----
> From: "David Robley" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Friday, February 15, 2002 1:19 PM
> Subject: Re: [PHP] searching key words from a database field
> 
> 
> > In article <000801c1b5b0$ee66f180$0401a8c0@philip>,
> > [EMAIL PROTECTED] says...
> > > This works for the loop.  now spliting up the words.  now it searchs for
> > > just one word in the loop

Guys - can you set your mailer/news thingy to doofollowups at the end of 
the article, please?

Now, let's take Martin's concept a little further. Suppose you want to 
have an option that goes something like

"search for ALL words; search for ANY word" You might also want 'search 
for exact phrase' but the implementation of that is dead easy so I'll 
leave that for you :-)

So this choice might be made via checkbutton, dropdown or whatever, but 
it returns the value AND or OR for ALL words or ANY words respectively. 
Or it can return anything you like, and you test and use AND or OR as 
required.

<?
//ALL or ANY?? Assume passed in as $opval and is either AND or OR
  $getme = "the big  tree";
// You might want to do something here if $getme is empty, or has only
// one word in it??
$sql = "SELECT * FROM hyperlinks";

if(!empty($getme)) {
  $getme_arr = explode(" ", $getme);
  $num = count($getme_arr);
  if(1 == $num) { //Only one word to search on
    $sql.= " WHERE keywords LIKE '$getme_arr' ";
  } else {
    $sql.= " WHERE keywords LIKE '$getme_arr[0]' ";
    for ($i = 1; $i < $num; $i++)
      if (strlen($getme_arr[$i]) > 0)
        $sql .= " $opval keywords LIKE '%".$getme_arr[$i]."%'";
  }
  $sql .= " ORDER BY `id` ASC LIMIT 0, 30";
?>

Hmm, getting a bit rusty; there are probably better/neater ways of doing 
that. But it should give you something to chew on. And I am sure I'm 
missing a } or three in there but you do have to do some of the work :-)

And Philip, sorry, I'm not a real Kiwi - just here for a year or so from 
Oz.

-- 
David Robley
Temporary Kiwi!
--- End Message ---
--- Begin Message ---
Something at the top - :)

-----Original Message-----
From: David Robley [mailto:[EMAIL PROTECTED]]
Sent: Friday, February 15, 2002 2:47 PM
To: [EMAIL PROTECTED]
Subject: RE: [PHP] searching key words from a database field


In article <[EMAIL PROTECTED]>, 
[EMAIL PROTECTED] says...
> try something like this (not tested):
> 
> <?
>   $getme = "the big  tree";
>   $getme_arr = explode(" ", $getme);
>   $num = count($getme_arr);
> 
>   $sql = "SELECT * FROM `hyperlinks` WHERE 1";
> 
>   for ($i = 0; $i < $num; $i++)
>     if (strlen($getme_arr[$i]) > 0)
>       $sql .= " AND `keywords` LIKE '%".$getme_arr[$i]."%'";
> 
>   $sql .= " ORDER BY `id` ASC LIMIT 0, 30";
> ?>
> 
> -----Original Message-----
> From: Philip J. Newman [mailto:[EMAIL PROTECTED]]
> Sent: Friday, February 15, 2002 11:27 AM
> To: David Robley
> Cc: David Robley; [EMAIL PROTECTED]; Gareth Hawken
> Subject: Re: [PHP] searching key words from a database field
> 
> 
> the problem is there isn't any code yet
> 
> and yes what you said is corrent
> 
> if text input is: the big tree
> 
> would like $string1 = the
> would like $string2 = big
> would like $string3 = tree
> 
> and so on and so on for all the key words entered.  Each key word needs to
> have its own string alocated. Any suggestions.
> 
> ps: nice to see another kiwi in here.
> 
> ----- Original Message -----
> From: "David Robley" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Friday, February 15, 2002 1:19 PM
> Subject: Re: [PHP] searching key words from a database field
> 
> 
> > In article <000801c1b5b0$ee66f180$0401a8c0@philip>,
> > [EMAIL PROTECTED] says...
> > > This works for the loop.  now spliting up the words.  now it searchs
for
> > > just one word in the loop

Guys - can you set your mailer/news thingy to doofollowups at the end of 
the article, please?

Now, let's take Martin's concept a little further. Suppose you want to 
have an option that goes something like

"search for ALL words; search for ANY word" You might also want 'search 
for exact phrase' but the implementation of that is dead easy so I'll 
leave that for you :-)

So this choice might be made via checkbutton, dropdown or whatever, but 
it returns the value AND or OR for ALL words or ANY words respectively. 
Or it can return anything you like, and you test and use AND or OR as 
required.

<?
//ALL or ANY?? Assume passed in as $opval and is either AND or OR
  $getme = "the big  tree";
// You might want to do something here if $getme is empty, or has only
// one word in it??
$sql = "SELECT * FROM hyperlinks";

if(!empty($getme)) {
  $getme_arr = explode(" ", $getme);
  $num = count($getme_arr);
  if(1 == $num) { //Only one word to search on
    $sql.= " WHERE keywords LIKE '$getme_arr' ";
  } else {
    $sql.= " WHERE keywords LIKE '$getme_arr[0]' ";
    for ($i = 1; $i < $num; $i++)
      if (strlen($getme_arr[$i]) > 0)
        $sql .= " $opval keywords LIKE '%".$getme_arr[$i]."%'";
  }
  $sql .= " ORDER BY `id` ASC LIMIT 0, 30";
?>

Hmm, getting a bit rusty; there are probably better/neater ways of doing 
that. But it should give you something to chew on. And I am sure I'm 
missing a } or three in there but you do have to do some of the work :-)

And Philip, sorry, I'm not a real Kiwi - just here for a year or so from 
Oz.

-- 
David Robley
Temporary Kiwi!
-- 

database search logic like this can get _REALLY_ complex - you could
1) combine phrase and word search
        eg something "some text together"
2) allow the user to decide which logic function to use
        eg foo and bar or hello not world
3) and combine the two
        eg foo and "bar lala" or "hello world" not anything

I'll let you figure out how to do all that - I've done it once, lost the
code and now have too many white hairs to think about doing it again!!

Martin
(Not-a-Kiwi)
--- End Message ---
--- Begin Message ---
I cannot get session information to work under any circumstances....

I think I've read every single comment on
http://www.php.net/manual/en/ref.session.php

session_start();
Function setup() {

global $HTTP_SESSION_VARS;

if (!(isset($HTTP_SESSION_VARS["notesType"]))){
 $HTTP_SESSION_VARS["notesType"]="DAILY";
}

if (isset($HTTP_GET_VARS["notesTypeFilter"])){
  $HTTP_SESSION_VARS["notesType"]=$HTTP_GET_VARS["notesTypeFilter"];
}

} // End setup Function

//Call the page with page.php?notesTypeFilter=ALL
setup();
//$HTTP_SESSION_VARS["notesType"] returns all

//Call the page with page.php

//Read $HTTP_SESSION_VARS. It's empty. It should return  ALL

I do have register_global set. And I do have track_vars set.

But even reading the comments on the above page, nothing will work. It will
not persist with the session variable...

Am I doing something wrong?

Norman


--- End Message ---
--- Begin Message ---
Norman Cates wrote:
> I cannot get session information to work under any circumstances....
> 
SNIP
> But even reading the comments on the above page, nothing will work. It will
> not persist with the session variable...
> 
> Am I doing something wrong?

If you are using recent PHP, track vars are always on.
Anyway, try E_ALL for error reporting, you might see
some error messages from sessoin module.

-- 
Yasuo Ohgaki

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

try to add to your script:
 
function cmp ($a, $b) {
    return strcmp($a["3"],$b["3"]);
}
usort($data, "cmp");
  "Fifield, Mike" <[EMAIL PROTECTED]> wrote: What I am trying to do is sort a 
array of arrays but I want to sort by one
of the pieces of data stored in the arrays inside the array. For example;
$data[blue] = array("name", "age", "time", "3");
$data[green] = array("name", "age", "time", "7");
$data[red] = array("name", "age", "time", "6");
$data[yellow] = array("name", "age", "time", "2");
$data[white] = array("name", "age", "time", "1");
$data[black] = array("name", "age", "time", "9");

I want to be able to sort this array of arrays by the very last element, the
numbers. 

Mike Fifield
Charles Schwab & Co, Inc.
WARNING: All e-mail sent to or from this address will be received by the
Charles Schwab corporate e-mail system and is subject to archival and review
by someone other than the recipient.



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



---------------------------------
Do You Yahoo!?
Send FREE Valentine eCards with Yahoo! Greetings!
--- End Message ---
--- Begin Message ---
i wanna know if there is a way of opening a file in a certian mode so when i write to 
a txt file it writes at the top of the file, and doesnt overwrite whats at the start 
of the file

Regards,
John Smythe
http://www.smythey.org/  
--- End Message ---
--- Begin Message ---
On Thu, 2002-02-14 at 17:34, John Smythe wrote:
> i wanna know if there is a way of opening a file in a certian mode so when i write 
>to a txt file it writes at the top of the file, and doesnt overwrite whats at the 
>start of the file

No, not with fopen(). What you can do is create a temporary file with 
tempnam(), write the new data to that, *append* the data from the
original file, and rename the temp file over the original file.


Cheers,

Torben


> Regards,
> John Smythe
> http://www.smythey.org/  
-- 
 Torben Wilson <[EMAIL PROTECTED]>
 http://www.thebuttlesschaps.com
 http://www.hybrid17.com
 http://www.inflatableeye.com
 +1.604.709.0506

--- End Message ---
--- Begin Message ---
or read the original file into memory, reopen the file for writing, write
the first prepend bit, then write what you just read

-----Original Message-----
From: Lars Torben Wilson [mailto:[EMAIL PROTECTED]]
Sent: Friday, February 15, 2002 1:18 PM
To: John Smythe
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] fopen


On Thu, 2002-02-14 at 17:34, John Smythe wrote:
> i wanna know if there is a way of opening a file in a certian mode so when
i write to a txt file it writes at the top of the file, and doesnt overwrite
whats at the start of the file

No, not with fopen(). What you can do is create a temporary file with 
tempnam(), write the new data to that, *append* the data from the
original file, and rename the temp file over the original file.


Cheers,

Torben


> Regards,
> John Smythe
> http://www.smythey.org/  
-- 
 Torben Wilson <[EMAIL PROTECTED]>
 http://www.thebuttlesschaps.com
 http://www.hybrid17.com
 http://www.inflatableeye.com
 +1.604.709.0506


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
On Thu, 2002-02-14 at 18:27, Martin Towell wrote:
> or read the original file into memory, reopen the file for writing, write
> the first prepend bit, then write what you just read

The problem with that is that you have a time lag (perhaps only
in microseconds, but it still is a problem) while you're writing
the new data to the file. If some other process--say, another
invocation of the same script--tries to read from that file while
you're still overwriting it--you've got problems, since it'll find
only a partially-written file.

That's called a 'race condition'. The other method avoids that,
since while you're writing data to the temp file, processes just
keep using the original. Once you're done, the rename happens 
atomically, preventing the race condition.


Torben

> -----Original Message-----
> From: Lars Torben Wilson [mailto:[EMAIL PROTECTED]]
> Sent: Friday, February 15, 2002 1:18 PM
> To: John Smythe
> Cc: [EMAIL PROTECTED]
> Subject: Re: [PHP] fopen
> 
> 
> On Thu, 2002-02-14 at 17:34, John Smythe wrote:
> > i wanna know if there is a way of opening a file in a certian mode so when
> i write to a txt file it writes at the top of the file, and doesnt overwrite
> whats at the start of the file
> 
> No, not with fopen(). What you can do is create a temporary file with 
> tempnam(), write the new data to that, *append* the data from the
> original file, and rename the temp file over the original file.
> 
> 
> Cheers,
> 
> Torben
> 
> 
> > Regards,
> > John Smythe
> > http://www.smythey.org/  
> -- 
>  Torben Wilson <[EMAIL PROTECTED]>
>  http://www.thebuttlesschaps.com
>  http://www.hybrid17.com
>  http://www.inflatableeye.com
>  +1.604.709.0506
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
-- 
 Torben Wilson <[EMAIL PROTECTED]>
 http://www.thebuttlesschaps.com
 http://www.hybrid17.com
 http://www.inflatableeye.com
 +1.604.709.0506

--- End Message ---
--- Begin Message ---
Hi!

You can find many part-time jobs for you at:

http://endi.go.ro/ml.htm

__________________________________________________
Do You Yahoo!?
Got something to say? Say it better with Yahoo! Video Mail 
http://mail.yahoo.com
--- End Message ---
--- Begin Message ---
On 14 Feb 2002, at 16:26, J Smith wrote:

> 
> Using "global" in the global scope (i.e. "global $Config;") does
> nothing. If something is declared in the global scope of a file and
> then included into another file, it's still global. You don't need to
> actually say "global $whatever" unless you're in a function.

Thanks. I've been coding and learning, coding and learning.

> Also, if you're including a file named "CONFIG.inc" from the same
> directory as the script itself, please, please tell me you have your
> web server set up not to serve CONFIG.inc to the outside world. (i.e.
> you have a .htaccess file or something to send DENY to a request for
> CONFIG.inc or something.) Otherwise somebody could just grab
> http://example.com/CONFIG.inc and see it's contents without
> restriction.

Guilty as charged. Not that CONFIG.inc has anything of value in it 
but nonetheless I've just made it off limits.

Peter
http://www.readbrazil.com/
Answering Your Questions About Brazil
--- End Message ---
--- Begin Message ---
On 14 Feb 2002, at 16:40, Michael Kimsal wrote:

> On that same topic, *why* do people name files with both .inc and
> .php? 
>   Your .inc file has PHP code in it, right?  Why not just call it .php
>   and
> spare the server reconfiguration.  If knowing which files are
> "include" files (long time since I've made that distinction!) just
> prepend them with inc_ or put them all in an includes/ directory.

Heck, I've seen inc,cls,html,php3,php4

Whoever started this thread was on the right track. Where are the 
global coding conventions for PHP?


http://www.linuxdoc.org/HOWTO/PHP-HOWTO-12.html
http://utvikler.start.no/code/php_coding_standard.html

Any othes out there?

I know I have my pet peeves about Perl but Perl, as hard as it may 
seem, appears more rigid than PHP :)

Peter
http://www.readbrazil.com/
Answering Your Questions About Brazil
--- End Message ---
--- Begin Message ---
WHo really cares, if it works it don't matter what they call it.

----- Original Message ----- 
From: "Peter J. Schoenster" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, February 15, 2002 5:36 PM
Subject: Re: [PHP] good practice


> On 14 Feb 2002, at 16:40, Michael Kimsal wrote:
> 
> > On that same topic, *why* do people name files with both .inc and
> > .php? 
> >   Your .inc file has PHP code in it, right?  Why not just call it .php
> >   and
> > spare the server reconfiguration.  If knowing which files are
> > "include" files (long time since I've made that distinction!) just
> > prepend them with inc_ or put them all in an includes/ directory.
> 
> Heck, I've seen inc,cls,html,php3,php4
> 
> Whoever started this thread was on the right track. Where are the 
> global coding conventions for PHP?
> 
> 
> http://www.linuxdoc.org/HOWTO/PHP-HOWTO-12.html
> http://utvikler.start.no/code/php_coding_standard.html
> 
> Any othes out there?
> 
> I know I have my pet peeves about Perl but Perl, as hard as it may 
> seem, appears more rigid than PHP :)
> 
> Peter
> http://www.readbrazil.com/
> Answering Your Questions About Brazil
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 
> 



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

I am currently running an old version of imap v4 from FreeBSD 4.1, and
I was going to install the latest 2001c library onto my computer. I realize
that after installing the library i should recompile PHP, but is there any
problems that anyone knows that will affect anything by doing this
upgrade?
--- End Message ---
--- Begin Message ---
Sasza wrote:
> hi
> I've got session identyfier in $session_id. In all sites it can be see very
> well. But in one site I use class in this form:
> class name {
> function1();
> function2(); etc.
> } and inside it the $session_id is unknown(outside class is OK). What should
> I do inside class that my session idetyfier will be known??
> thx
> sasza
> 
> 
> 

Read the manual
http://www.php.net/manual/en/

PHP has a little different concept for globals.

-- 
Yasuo Ohgaki

--- End Message ---
--- Begin Message ---
Sasza wrote:
> hi
> I've got session identyfier in $session_id. In all sites it can be see very
> well. But in one site I use class in this form:
> class name {
> function1();
> function2(); etc.
> } and inside it the $session_id is unknown(outside class is OK). What should
> I do inside class that my session idetyfier will be known??
> thx
> sasza
> 
> 
> 

Read the manual
http://www.php.net/manual/en/

PHP has a little different concept for globals.

-- 
Yasuo Ohgaki


_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com

--- End Message ---
--- Begin Message ---
This is not a big thing.
But I am looking at this thinking there is a way to make the code take up 
even less lines.
Just want to stick this in my cap for future reference.

for($i=01;$i<=50;$i++)  {
         if (!empty($content))   {
                 if ($row[$content]==$states[$i])
                         echo "<option value=\"$states[$i]\" 
selected>$nstates[$i]\n";
                 else
                         echo "<option value=\"$states[$i]\">$nstates[$i]\n";
         }
         else    {
                 if ($dstate == $states[$i])
                         echo "<option value=\"$states[$i]\" 
selected>$nstates[$i]\n";
                 else
                         echo "<option value=\"$states[$i]\">$nstates[$i]\n";
         }
}

Basically I want to check for two possible conditions to make an item selected.
If the first one is valid then do not check for the other.

Get what I mean?
Any expert programmers out there with the way to chop this even further?


Thanks

Phillip

+++++++++++++++++++++++++++++++++++++++++++++++++++
IMPORTANT: This email message (including attachments, if any) is intended
for the use of the individual addressee(s) named above and may contain
information that is confidential, privileged or unsuitable for overly sensitive
persons with low self-esteem, no sense of humor or irrational religious
beliefs. If you are not the intended recipient, any dissemination, 
distribution
or copying of this email is not authorized (either explicitly or 
implicitly) and
constitutes an irritating social faux pas. Unless the word absquatulation
has been used in its correct context somewhere other than in this warning,
it does not have any legal or no grammatical use and may be ignored. No
animals were harmed in the transmission of this email, although the barking
dachshund next door is living on borrowed time, let me tell you. Those of
you with an overwhelming fear of the unknown will be gratified to learn that
there is no hidden message revealed by reading this warning backwards,
so just ignore that Alert Notice from Microsoft. However, by pouring a
complete circle of salt around yourself and your computer you can ensure
that no harm befalls you, your family or your pets. If you have received this
email in error, please add some nutmeg and egg whites, whisk and place
in a warm oven for 40 minutes.
+++++++++++++++++++++++++++++++++++++++++++++++++++

--- End Message ---
--- Begin Message ---
> Any expert programmers out there with the way to chop this 
> even further?

I would suspect that chopping this further would make it
even harder to understand/maintain in the future...

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

> This is not a big thing.
> But I am looking at this thinking there is a way to make the code take up
> even less lines.

> for($i=01;$i<=50;$i++)  {
>          if (!empty($content))   {
>                  if ($row[$content]==$states[$i])
>                          echo "<option value=\"$states[$i]\"
> selected>$nstates[$i]\n";
>                  else
>                          echo "<option
value=\"$states[$i]\">$nstates[$i]\n";
>          }
>          else    {
>                  if ($dstate == $states[$i])
>                          echo "<option value=\"$states[$i]\"
> selected>$nstates[$i]\n";
>                  else
>                          echo "<option
value=\"$states[$i]\">$nstates[$i]\n";
>          }
> }

i would try:

for($i=01;$i<=50;$i++) {
    if(!empty($content) && $row[$content] == $states[$i])
        $selected = " selected";
    elseif($dstate == $states[$i])
        $selected = " selected";
    else
        $selected = "";
    echo "<option
value=\"".$states[$i]."\"".$selected.">".$nstates[$i]."</option>";
}

trading four echo's for a one echo and a extra var and nest the ifs

> Basically I want to check for two possible conditions to make an item
selected.
> If the first one is valid then do not check for the other.
>
> Get what I mean?
> Any expert programmers out there with the way to chop this even further?

test it :)

mvgr,
Joffrey van Wageningen

--
.-[ Joffrey van Wageningen | WoLFjuh | [EMAIL PROTECTED] ]--------------
| Networking Event 2000 - www.ne2000.nl - IRCnet:#ne2000, Undernet:#clue
| PGP:1024D/C6BA5863 - 3B93 52D3 CB91 9CB7 C50D FA79 865F 628A C6BA 5863
| * We demand guaranteed rigidly defined areas of doubt and uncertainty.
|                                                       -- Douglas Adams

--- End Message ---
--- Begin Message ---
for($i=1;$i<=50;$i++)
{
        if ((!empty($content) && $row[$content] == $states[$i]) || ($dstate == 
$states[$i]))
                $selected="SELECTED";
        else
                $selected="";
        printf("<option
value=\"%s\" %s>%s</option>", $states[$i], $selected, $nstates[$i]);
}




I always prefer to use printf to mix content and data.
And why not use the || your reaching a single solution


Jerry Verhoef

>-----Original Message-----
>From: Joffrey van Wageningen [mailto:[EMAIL PROTECTED]]
>Sent: Friday, February 15, 2002 10:00 AM
>To: PHP Email List
>Subject: Re: [PHP] Looking for optimal coding
>
>
>
> > This is not a big thing.
> > But I am looking at this thinking there is a way to make the code take 
>up
> > even less lines.
>
> > for($i=01;$i<=50;$i++)  {
> >          if (!empty($content))   {
> >                  if ($row[$content]==$states[$i])
> >                          echo "<option value=\"$states[$i]\"
> > selected>$nstates[$i]\n";
> >                  else
> >                          echo "<option
>value=\"$states[$i]\">$nstates[$i]\n";
> >          }
> >          else    {
> >                  if ($dstate == $states[$i])
> >                          echo "<option value=\"$states[$i]\"
> > selected>$nstates[$i]\n";
> >                  else
> >                          echo "<option
>value=\"$states[$i]\">$nstates[$i]\n";
> >          }
> > }
>
>i would try:
>
>for($i=01;$i<=50;$i++) {
>     if(!empty($content) && $row[$content] == $states[$i])
>         $selected = " selected";
>     elseif($dstate == $states[$i])
>         $selected = " selected";
>     else
>         $selected = "";
>     echo "<option
>value=\"".$states[$i]."\"".$selected.">".$nstates[$i]."</option>";
>}
>
>trading four echo's for a one echo and a extra var and nest the ifs
>
> > Basically I want to check for two possible conditions to make an item
>selected.
> > If the first one is valid then do not check for the other.
> >
> > Get what I mean?
> > Any expert programmers out there with the way to chop this even further?
>
>test it :)
>
>mvgr,
>Joffrey van Wageningen
>
>--
>.-[ Joffrey van Wageningen | WoLFjuh | [EMAIL PROTECTED] ]--------------
>| Networking Event 2000 - www.ne2000.nl - IRCnet:#ne2000, Undernet:#clue
>| PGP:1024D/C6BA5863 - 3B93 52D3 CB91 9CB7 C50D FA79 865F 628A C6BA 5863
>| * We demand guaranteed rigidly defined areas of doubt and uncertainty.
>|                                                       -- Douglas Adams
>
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, visit: http://www.php.net/unsub.php
>

_________________________________________________________________
Chat on line met vrienden en probeer MSN Messenger uit: 
http://messenger.msn.nl

--- End Message ---
--- Begin Message ---
How do i pull text from one file and have it print to another?

example:

I have a site where i use a table alot on alot of different pages but i dont
want to type out the table each time but rather use php to grab the table
from file-1.txt and print it on file-2.php?


--

Jason Whitaker


--- End Message ---
--- Begin Message ---
you can try something like:

<?php include("file_with_just_the_table_and_html_tags.txt"); ?>

put your table in the above file (of course with a different name!) then
call it when ever you need to.  Other's will disagree but you also need to
give the destination file a .php extension.

Hugh

----- Original Message -----
From: "Jason Whitaker" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, February 14, 2002 11:32 PM
Subject: [PHP] text grabber


> How do i pull text from one file and have it print to another?
>
> example:
>
> I have a site where i use a table alot on alot of different pages but i
dont
> want to type out the table each time but rather use php to grab the table
> from file-1.txt and print it on file-2.php?
>
>
> --
>
> Jason Whitaker
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

--- End Message ---
--- Begin Message ---
hi, can someone please help? i've installed phpTriad on my pc here at the 
office. i've tried it at home and everything works fine. here in the office 
though, i can only run the apache server. but i cannot start the mySQL 
server. i don't get any error messages...just that nothing happens whenever 
i click on start MySql. i've tried reinstalling it but still the same. what 
can possibly be wrong?

// MM

_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp.

--- End Message ---
--- Begin Message ---
I got the problem , I want make preety debug function that shows array keys 
and values and name of the variable containing array:
Here it is:

function show_arr($array)
//wyswietla wartosci z tablicy wraz z kluczami (przeznaczone do debugowania)
{
        if(DABUG)
        {
        echo "<b>-------------------------------------------</b><br>";
        echo "Array contents<b>".strval($array)."</b><br>";
                while(list($k,$v)=each($array))
                {
                        echo "$k = $v<br>"; 
                }
        echo "<b>-------------------------------------------</b>";
        }
}

unfortunatly strval want work with arrays...
Any possible solution how to get name of the array variable?
--- End Message ---
--- Begin Message ---
I am trying to have my form redirect back to my form, if the 'name' field is
not filled in or the submit button is not pushed.  Can someone tell me what
my problem is with the script below that I have in my header:

<?
if(!isset($name)||($HTTP_POST_VARS[submit]))
{
    header("Location: form.htm");
}
?>

Thanks,

Ben

--- End Message ---
--- Begin Message ---
Using header() to return will clear the entire form where all you want is
the person to fill in missing data.  Yes?

I'd use something like:

if(!isset($name) die("Use the Browser's Back Button, fill in your name and
hit the \"Submit\" Button");

if(!isset($address) die("Use the Browser's Back Button, fill in your address
and hit the \"Submit\" Button");
etc.

This way, the user fills in only the missing data.
Hope this helps.
Hugh

----- Original Message -----
From: "Ben Clumeck" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, February 15, 2002 12:24 AM
Subject: [PHP] Empty form


> I am trying to have my form redirect back to my form, if the 'name' field
is
> not filled in or the submit button is not pushed.  Can someone tell me
what
> my problem is with the script below that I have in my header:
>
> <?
> if(!isset($name)||($HTTP_POST_VARS[submit]))
> {
>     header("Location: form.htm");
> }
> ?>
>
> Thanks,
>
> Ben
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

--- End Message ---
--- Begin Message ---
So then there's no way to get it decoded :(. Ah well, thanks for your help
anyway.

--
 - Dave
Visit http://www.geocities.com/earthtohorny/ for info on Computers and
Upgrading.

"Joffrey Van Wageningen" <[EMAIL PROTECTED]> wrote in message
00f101c1b570$d4697450$[EMAIL PROTECTED]">news:00f101c1b570$d4697450$[EMAIL PROTECTED]...
> > Hello,
> >          How can I decode encoded text/numbers in my phpMyAdmin? I
looked
> at
> > BASE64, but thats not it. Any help is great. Thanks
> >
> > Example: 8e73b27568cb3be29e2da74d42eab6dd
>
> i dont wanna spoil your day, but your looking at a md5 hash... md5 is a
one
> way encoding scheme, no way back... md5 is used to make a sum of a load of
> data and compared by a second sum to see if the data matches (like
passwords
> or file integrety)
>
> if you want 7bit encoding try base64_encoding and _decoding
>
> hope you can have a good night sleep :)
>
> mvgr,
> Joffrey van Wageningen
>
> --
> .-[ Joffrey van Wageningen | WoLFjuh | [EMAIL PROTECTED] ]--------------
> | Networking Event 2000 - www.ne2000.nl - IRCnet:#ne2000, Undernet:#clue
> | PGP:1024D/C6BA5863 - 3B93 52D3 CB91 9CB7 C50D FA79 865F 628A C6BA 5863
> | * We demand guaranteed rigidly defined areas of doubt and uncertainty.
> |                                                       -- Douglas Adams
>


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

i'm working on content management sytem entirely written in Object oriented PHP using 
templates
i used output buffering to be able to send header calls in the middle of my classes
i have noticed that performance has become "random" meaning that the same script could 
take from 1 up to 30 seconds in the same conditions, passing 
exactly the same parms. 

while trying to find a solution, i removed the ob_end_flush() call while keeping the 
ob_start() call at the beginning of the script
and strangely speed of execution came back to normal.

output buffering is still on
i am not flushing it out
the pages are generated just fine without freeing the buffer ??!!!!

i would like to know if anyone has had similr experiences with output buffering
this behaviour occured on a windows and a linux box both with php 4.1.1 and pretty 
much the same php.ini settings

Regards

________________________________
Hassan El Forkani
http://WarmAfrica.com EveryOne's Africa
_________________________________


--- End Message ---
--- Begin Message ---
hello php guys,

how can i get the http header ?


greetings marc


--
-------------------------------------------------------
magic garden GmbH - Agentur für Informationsarchitektur

Hermannstr. 15 - 70178 Stuttgart (Am Feuersee)

www.magic-garden.de ¦ [EMAIL PROTECTED]

Tel. (07 11) 619 57-42 ¦ Fax (07 11) 615 01 38



--- End Message ---
--- Begin Message ---
Hi!

All I want is, to call my php with a URL in my querystring!
myphp.php?URL=http....

my php should download the "URL", uuencode it, and then return the uuencoded
text!
as this should be binary-safe, it thought of using the linux-included
uuencode!
But how to get the (perhaps large binary) file and use uuencode like
"uuencode < input > output"?

thanks
Michi

-- 
GMX - Die Kommunikationsplattform im Internet.
http://www.gmx.net

--- End Message ---
--- Begin Message ---
to convert take a look at http://www.php.net/manual/en/function.popen.php

IMHO
M.N.
---

Michael Mehlmann wrote:

>Hi!
>
>All I want is, to call my php with a URL in my querystring!
>myphp.php?URL=http....
>
>my php should download the "URL", uuencode it, and then return the uuencoded
>text!
>as this should be binary-safe, it thought of using the linux-included
>uuencode!
>But how to get the (perhaps large binary) file and use uuencode like
>"uuencode < input > output"?
>


--- End Message ---
--- Begin Message ---
I have been installing NuSphere (Apache and PHP 4.0.6). As that I configure 
the
Apache or PHP, so that I get to use and to test the command mail in my 
computer?

André  

--- End Message ---
--- Begin Message ---
Can PHP directly work with shadow password suite on Linux machines (reading
and writing shadow file)?
I supose that some module or extension should be activate so PHP could read
and write to files owned by root.

--- End Message ---
--- Begin Message ---
According to the manual;
http://www.php.net/manual/en/function.fsockopen.php
Depending on the environment, optional connect timeout may not be available.

Does anyone know what environment is needed for it to be available?
I have Redhat Linux 7.1 - and the timeout doen't seem to work.

Any ideas?

Peter

--- End Message ---
--- Begin Message ---
How can I configure the apache, so that my local access is different from 
http://localhost. I want to access my local server through a virtual name 
(Example: http://www.test.com). I only want to change the name "localhost" 
for any other name.
I already possess a domain (Example: www.test.com) and I want to use this 
same name also in my local server in case I am not connected in the 
internet, only to simulate some cases of PHP.

Thanks,

André

--- End Message ---
--- Begin Message ---
Dnia czwartek 14 luty 2002 21:14, Rick Emery napisał:

>> How can I get the name of array variable into str?
> what are your trying to do with it??
This:


function show_arr($array)
//wyswietla wartosci z tablicy wraz z kluczami (przeznaczone do debugowania)
{
        if(DABUG)
        {
        echo "<b>-------------------------------------------</b><br>";
        echo "Array contents<b>".strval($array)."</b><br>";
                while(list($k,$v)=each($array))
                {
                        echo "$k = $v<br>"; 
                }
        echo "<b>-------------------------------------------</b>";
        }
}

quite useful when making big project with lots of array and debuging
--- End Message ---

Reply via email to