php-general Digest 20 Jan 2001 05:22:21 -0000 Issue 465

Topics (messages 35637 through 35780):

Integer division
        35637 by: Todd Cary
        35638 by: Boget, Chris
        35680 by: Marcelo Gulin

Form Problems
        35639 by: Karl J. Stubsjoen

i should have been clearer
        35640 by: Slappy Smith
        35657 by: mwaples.optusnet.com.au

Re: Any good way ?
        35641 by: TV Karthick Kumar
        35745 by: Monte Ohrt

is it possible to communicate javascript and php?
        35642 by: Evelio Martinez
        35676 by: Richard Lynch

Test - please ignore
        35643 by: Jason Bouwmeester

Function / String Problem
        35644 by: Karl J. Stubsjoen
        35645 by: Boget, Chris
        35646 by: Shawn Blaylock
        35682 by: Marcelo Gulin
        35763 by: Chris Mulcahy

Mail Syntax changing problem
        35647 by: Todd H MacPherson

Re: Datasets
        35648 by: Ignacio Vazquez-Abrams
        35651 by: mlemos.acm.org
        35661 by: Marcelo Gulin
        35671 by: Richard Lynch

Re: Running java under php4 (PHP4 ext/java)
        35649 by: Alex Akilov
        35660 by: Fraser MacKenzie
        35683 by: Alex Akilov
        35706 by: Fraser MacKenzie
        35713 by: Alex Akilov
        35739 by: Fraser MacKenzie
        35761 by: Alex Akilov

"but what if.." Function / String Problem
        35650 by: Karl J. Stubsjoen
        35652 by: Boget, Chris
        35653 by: Shawn Blaylock
        35654 by: Boget, Chris
        35656 by: Shawn Blaylock
        35659 by: Ignacio Vazquez-Abrams
        35664 by: Shawn Blaylock
        35678 by: Philip Olson

Re: unserialize() unexpectedly returns a boolean
        35655 by: TR Henigson
        35663 by: Ignacio Vazquez-Abrams

Re: Date/Time Formatting
        35658 by: Ignacio Vazquez-Abrams
        35674 by: Richard Lynch

makerpm
        35662 by: Lou Spironello

Migrating from PHP3 to PHP4 issues
        35665 by: James Atkinson

Re: session_start problem
        35666 by: Ignacio Vazquez-Abrams

Re: Recompile GD ??
        35667 by: Richard Lynch

Re: problems creating a png image from an array{HELP}
        35668 by: Richard Lynch

Re: problem with file upload
        35669 by: Richard Lynch
        35677 by: Ignacio Vazquez-Abrams

Re: Ms SQL  Error with php3.0
        35670 by: Richard Lynch

Re: References in an array
        35672 by: Richard Lynch

Re: how to trigger incomming mail
        35673 by: Richard Lynch

Re: fputs() to save mysql db file
        35675 by: Richard Lynch

Re: question on time-based function
        35679 by: Rudy McDaniel
        35681 by: Ignacio Vazquez-Abrams

Re: PATH_TRANSLATED doesn't work correctly !!!
        35684 by: Heino H. Gehlsen

Re: PHP site on CD-ROM
        35685 by: artwells.inetarena.com
        35747 by: Michael A. Peters
        35749 by: Michael A. Peters

multidemention array question(s)
        35686 by: Michael Zornek
        35688 by: Matt McClanahan
        35689 by: Ignacio Vazquez-Abrams

Re: session_destroy
        35687 by: Håkan Askengren

Profanity Filter
        35690 by: Website4S.aol.com
        35691 by: Ignacio Vazquez-Abrams
        35692 by: Website4S.aol.com
        35694 by: Ignacio Vazquez-Abrams
        35695 by: DanO
        35696 by: Todd H MacPherson
        35697 by: Todd H MacPherson
        35698 by: Sterling Hughes
        35699 by: Ignacio Vazquez-Abrams
        35700 by: Ignacio Vazquez-Abrams
        35701 by: Egan
        35702 by: Ignacio Vazquez-Abrams
        35703 by: Sterling Hughes
        35704 by: Egan
        35705 by: Sterling Hughes
        35708 by: Ignacio Vazquez-Abrams
        35711 by: Ignacio Vazquez-Abrams
        35715 by: Sterling Hughes
        35716 by: Ignacio Vazquez-Abrams
        35717 by: Sterling Hughes
        35718 by: Sterling Hughes
        35720 by: Ignacio Vazquez-Abrams
        35736 by: Stephan Ahonen
        35742 by: Stephan Ahonen

cpdf text wrap
        35693 by: Tom Harris

Re: problems creating a png image from an array{HELP} with the source code
        35707 by: Nikos Tahos

Re: question (as if anything else would be in an email to the list...)
        35709 by: Jason Jacobs
        35710 by: Jason Jacobs
        35712 by: Ignacio Vazquez-Abrams

cookies - not working with Nutscrape
        35714 by: Brian V Bonini
        35759 by: Brian V Bonini

mcal installation
        35719 by: johnny p.
        35728 by: Sam Masiello
        35729 by: johnny p.
        35743 by: Sam Masiello
        35769 by: johnny p.

APC version 1.0.5 released
        35721 by: Daniel Cowgill

PHP4 Mime types Causing Save-As dialog
        35722 by: Todd Goldenbaum
        35726 by: Richard Lynch

Re: Ethics question...
        35723 by: John Hinsley
        35733 by: Egan

Re: [Apc-cache] APC version 1.0.5 released
        35724 by: George Schlossnagle

Question about session_register()
        35725 by: Zenith

Question about new features of PHP4!
        35727 by: Zenith
        35730 by: Ignacio Vazquez-Abrams
        35731 by: Ignacio Vazquez-Abrams

array_intersect()
        35732 by: Chris Lee
        35740 by: Chris Lee

does chdir() change include_path on the fly? HELP
        35734 by: Noah Spitzer-Williams
        35735 by: Ignacio Vazquez-Abrams

Re: below10host.com as webhost?
        35737 by: Jeff Lacy

variable question
        35738 by: Michael Zornek
        35741 by: Joe Stump
        35746 by: Chris Lee

config failure php4.0.4 + apache 1.3.14
        35744 by: John Ryan

php.net's docs are down
        35748 by: szii.sziisoft.com
        35751 by: Rasmus Lerdorf
        35754 by: szii.sziisoft.com
        35756 by: eschmid+sic.s.netic.de
        35762 by: szii.sziisoft.com

BIG PROBLEM WITH SEARCH!!!!!!
        35750 by: Mike Yuen
        35760 by: Chris Lee

Re: (Newbie) String within a string
        35752 by: Chris Hayes
        35755 by: Angus Mann

force page exit with submit button
        35753 by: Chris Hayes

Session problem?
        35757 by: Javier Muniz

Re: Session problem? (Correction)
        35758 by: Javier Muniz

Another Guru's Help Needed...
        35764 by: Dallas Kropka
        35770 by: Michael Kimsal
        35771 by: Dallas Kropka
        35772 by: jeremy brand
        35778 by: Dallas Kropka

problems creating a png image from an array{HELP} including the source code
        35765 by: Nikos Tahos

Using a variable in a variable or as the second part of an array?
        35766 by: April

php4 auto download problem
        35767 by: Thomas Anderson
        35768 by: Rasmus Lerdorf

Image problem
        35773 by: Mike Yuen

PHP Parse MySQL Field???
        35774 by: [ rswfire ]
        35775 by: [ rswfire ]

Php FAQ, Q&A or Knowledge Base
        35776 by: Keith Spiller

Classes question.
        35777 by: James McLaughlin

Help, can't seem to get this write
        35779 by: Christopher Riordan

ibase_num_fields() -a workaround ?
        35780 by: mwaples.waples.net

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]


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


What is the syntax for dividing 7 by 2 and getting 3; not 3.5?

Todd

--
Todd Cary
Ariste Software
[EMAIL PROTECTED]






> What is the syntax for dividing 7 by 2 and getting 3; not 3.5?

you can use:

$intVar = ((int)( 7 / 2 ));

Chris




Hi Todd!

  if $a = 3.5 then

    echo (int)$a   // print 3

regards
Marcelo Gulin



Todd Cary escribió:
> 
> What is the syntax for dividing 7 by 2 and getting 3; not 3.5?
> 
> Todd
> 
> --
> Todd Cary
> Ariste Software
> [EMAIL PROTECTED]
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]




I'm having troubles : (
I can't seem to figure out how to retrieve the posted data.  I'm trying
this:
$HTTP_POST_VARS["Login"]

! WAIT ! as I write this, I'm guesing that maybe my problem is *scope* (and
not the mouthwash).  I'm going to try that right now, set the above var to
global within that function...

Yep, that was it... thanks guys!





>Something along the lines of this?:
>
>"X-Powered-By: PHP/4.0.2-dev Content-type: text/html"
>
>If so, stick this at the top of your script(s):
>
>#!/path/to/php -q
>
>(obviously change the /path/to/php)

This is my error:

Warning: Sybase: Server message: Changed database context to 'foobar'.
(severity 10, procedure N/A) in
/home/httpd/html/foobar/foo.php3 on line 11

-----------------------------------------------------------------------
                    Q: Backstreet Boys or N'Sync? 
          A: Both of them. In a house, on fire, surrounded by 
            trick fire extinguishers filled with gasoline.
-----------------------------------------------------------------------




Slappy Smith wrote:
> 
> >Something along the lines of this?:
> >
> >"X-Powered-By: PHP/4.0.2-dev Content-type: text/html"
> >
> >If so, stick this at the top of your script(s):
> >
> >#!/path/to/php -q
> >
> >(obviously change the /path/to/php)
> 
> This is my error:
> 
> Warning: Sybase: Server message: Changed database context to 'foobar'.
> (severity 10, procedure N/A) in
> /home/httpd/html/foobar/foo.php3 on line 11
> 

If i recall correctly from searching the archives - that warning will
always show - just put an @sybase_connect() to supress it




Hi

    Thanks for your mail. But this is okay if I have only one variable, in
this case as per the manual it is: $i , but what'll happen if I have more
than two, and now I have three variables in my form to be checked and can it
be done in the Switch method ?. If yes, then pls. tell me how.

    Pls. help me. Thanks in advance.

~ Karthick

> maybe I'm over simplifying... my apologies if I am but it looks like
you're
> testing each variable as a boolean value i.e. if(TRUE) so why not use a
> switch/case statement... easier to write and saved on extraneous curly
> syntax... look here
>
> http://www.php.net/manual/en/control-structures.switch.php
>
>
>
> -----Original Message-----
> From: TV Karthick Kumar [mailto:[EMAIL PROTECTED]]
> Sent: Friday, January 19, 2001 10:40 AM
> To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
> Subject: [PHP] Any good way ?
>
>
> Hi all
>
>     I have written the following code, but I dont' think it's a good way
to
> write like this. Is there some other way to do good programming for this
?!
>
>
****************************************************************************
> ******************
>    if ($f)
>    {
>     $SQL .= " (FIRST_NAME like '%$f%') AND ";
>    }
>    if ($l)
>    {
>     $SQL .= " (LAST_NAME like '%$l%') AND ";
>    }
>    if ($em)
>    {
>     $SQL .= " (HOME_EMAIL1 like '%$em%') OR (HOME_EMAIL2 like '%$em%') OR
> (WORK_EMAIL1 like '%$em%') OR (WORK_EMAIL2 like '%$em%') ";
>    }
>
****************************************************************************
> ******************
>
>     Any help is appreciated very much.
>
>     Thanks in adv.
>
> ~ Karthick
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>
>





You want to drop empty where clauses? This will work, although your
syntax will be wrong if $em is empty ( you will get an SQL syntax error
with the extra AND on the end ). You need a dummy clause after the where
clause to make things match up right, something that always returns true
like 1=1.

$query = "select * from TABLE where 1=1 ";

if (empty($f))
        $query .= " AND FIRST_NAME like '%$f%' ";
if (empty($l))
        $query .= " AND LAST_NAME like '%$l%' ";
if (empty($em))
        $query .= " AND ((HOME_EMAIL1 like '%$em%') OR (HOME_EMAIL2 like
'%$em%') OR
        (WORK_EMAIL1 like '%$em%') OR (WORK_EMAIL2 like '%$em%')) ";

// put anything else here
$query .= " group by COLNAME, order by COLNAME ";

You might also want to look into fulltext searches to utilize an index
in the database (is this MySQL?) instead of table scans.

TV Karthick Kumar wrote:
> 
> Hi all
> 
>     I have written the following code, but I dont' think it's a good way to
> write like this. Is there some other way to do good programming for this ?!
> 
> ****************************************************************************
> ******************
>    if ($f)
>    {
>     $SQL .= " (FIRST_NAME like '%$f%') AND ";
>    }
>    if ($l)
>    {
>     $SQL .= " (LAST_NAME like '%$l%') AND ";
>    }
>    if ($em)
>    {
>     $SQL .= " (HOME_EMAIL1 like '%$em%') OR (HOME_EMAIL2 like '%$em%') OR
> (WORK_EMAIL1 like '%$em%') OR (WORK_EMAIL2 like '%$em%') ";
>    }
> ****************************************************************************
> ******************
> 
>     Any help is appreciated very much.
> 
>     Thanks in adv.
> 
> ~ Karthick
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]

--
Monte Ohrt <[EMAIL PROTECTED]>
http://www.ispi.net/




I would like to know if it possible to pass in any way some values

from javascript functions to php variables ?

Any FAQ?

Thanks

--
Evelio Martínez
Testanet. Dept. desarrollo software.
Av. Reino de Valencia, 15 - 5
46005 Valencia (Spain)
Tel: +34 96 395 90 00
Fax: +34 96 316 23 19






> I would like to know if it possible to pass in any way some values
>
> from javascript functions to php variables ?

Yes, but...

You can have JavaScript call another URL using something like:
document.location = 'http://yoursite.com/whatever.php?foo=' . $foo;

But keep this in mind:  PHP lives on the server.  JavaScript lives in your
browser.  PHP exists only long enough to deliver your HTML/JavaScript and
then "dies".  JavaScript runs, long after PHP is gone.  To have them talk
back and forth requires another page hit for each "exchange" in the
conversation.

So PHP spewing out some JavaScript is fairly straight-forward -- It's just
some more text to generate as far as PHP is concerned.
JavaScript talking back to PHP, however, requires a whole 'nother URL to be
loaded, and that's expensive.

By Day:                                |By Night:
    Don't miss the Zend Web Store's    |   There's not enough room here...
    Grand Opening on January 23, 2001! |   Start here:
    http://www.zend.com                |   http://l-i-e.com/artists.htm






Test




Okay, what is wrong with this:

       echo "<br><br>...are you logged in: $LoggedIn()<br><br>";
// outputs:    ...are you logged in: ()

Function is:
function LoggedIn(){
  global $HTTP_POST_VARS
        if ($HTTP_POST_VARS["Login"] == "PHPIsCool")
        {return "YES";}
        else
        {return "NO";}
}







>        echo "<br><br>...are you logged in: $LoggedIn()<br><br>";> //
outputs:    ...are you logged in: ()
> 
> Function is:
> function LoggedIn(){
>   global $HTTP_POST_VARS
>         if ($HTTP_POST_VARS["Login"] == "PHPIsCool")
>         {return "YES";}
>         else
>         {return "NO";}
> }

Change your echo statement to:

echo "<br><br>...are you logged in: " . LoggedIn() . "<br><br>";

"$LoggedIn()" looks to PHP like a variable.  Any variable that is
within a double quoted string gets interpolated.  Plus, you almost
never want to put a '$' in front of a function name because then
it looks like a variable function name to PHP.  IOW, taking the
above function definition, you could do:

$functionName = "LoggedIn";

echo $functionName();

and PHP will run the function 'LoggedIn()'.

HTH

Chris





Try this:

echo "<br><br>...are you logged in: " . LoggedIn() . "<br><br>";

The reason it wasn't working is because it thought LoggedIn was a
variable and () was part of the echo statement.

"Karl J. Stubsjoen" wrote:
> 
> Okay, what is wrong with this:
> 
>        echo "<br><br>...are you logged in: $LoggedIn()<br><br>";
> // outputs:    ...are you logged in: ()
> 
> Function is:
> function LoggedIn(){
>   global $HTTP_POST_VARS
>         if ($HTTP_POST_VARS["Login"] == "PHPIsCool")
>         {return "YES";}
>         else
>         {return "NO";}
> }
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]

-- 

Shawn Blaylock, ClipperNet Software Engineer
[EMAIL PROTECTED]
http://www.clipper.net/
Eugene OR  541-431-3360 x406
Toll Free  866-673-6260 x406




Hi Karl!

 try...

    echo "<br><br>...are you logged in: " . $LoggedIn() . "<br><br>";

regards
Marcelo Gulin


"Karl J. Stubsjoen" escribió:
> 
> Okay, what is wrong with this:
> 
>        echo "<br><br>...are you logged in: $LoggedIn()<br><br>";
> // outputs:    ...are you logged in: ()
> 
> Function is:
> function LoggedIn(){
>   global $HTTP_POST_VARS
>         if ($HTTP_POST_VARS["Login"] == "PHPIsCool")
>         {return "YES";}
>         else
>         {return "NO";}
> }
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]




It's after a variable called $LoggedIn.

You'll have to do:

echo "<br><br>...are you logged in: ".LoggedIn()."<br><br>";

hth
Chris Mulcahy
[EMAIL PROTECTED]

-----Original Message-----
From: Karl J. Stubsjoen [mailto:[EMAIL PROTECTED]]
Sent: Friday, January 19, 2001 11:17 AM
To: PHP Mailing List
Subject: [PHP] Function / String Problem


Okay, what is wrong with this:

       echo "<br><br>...are you logged in: $LoggedIn()<br><br>";
// outputs:    ...are you logged in: ()

Function is:
function LoggedIn(){
  global $HTTP_POST_VARS
        if ($HTTP_POST_VARS["Login"] == "PHPIsCool")
        {return "YES";}
        else
        {return "NO";}
}




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]






I use the following syntax on one site to get the names in the email message
and it works fine:

mail("$we_to<$we_demail>", "$we_subject", StripSlashes($message), "From:
$we_from<$we_semail>");

and it works

BUT On another site I must change it as such to get it to work:

mail("$we_to", "$we_subject", StripSlashes($message), "From: $we_email");

I have even tried \<      \> but it still won't work.

The only difference between the two is the first is Unix and the second is
WindowsNT.

Help please...I have frigged with this all day.

Thanks

Todd





On Fri, 19 Jan 2001, Bruno Freire wrote:

>
> Hi.... My name is Bruno, I'm in Brazil and I'm new in PHP...
>
>
> I wanna know how can I roll in the records of a dataset.
> Like...
> Move First
> Move last
> Move next.....os something like this
> Move previous
>
> Thanks..
>

Move Next is simple; just use xxx_fetch_[array, row, etc.]().

For the other three, some DB interfaces have xxx_data_seek(), but others will
have to be manipulated within an array. However, that's not such a big deal
because you probably shouldn't be moving around arbitrarily like that, should
you? ;)

-- 
Ignacio Vazquez-Abrams  <[EMAIL PROTECTED]>





Hello Bruno,

Bruno Freire wrote:
> 
> Hi.... My name is Bruno, I'm in Brazil and I'm new in PHP...
> 
> I wanna know how can I roll in the records of a dataset.
> Like...
> Move First
> Move last
> Move next.....os something like this
> Move previous

You may want to try this PHP Class that does exactly what you need and
may be more.

http://phpclasses.UpperDesign.com/browse.html/package/130

Manuel Lemos




Hi Bruno!

   what database are you using?
   for mysql, you can use mysql_data_seek function.

regards
Marcelo Gulin

Bruno Freire escribió:
> 
> Hi.... My name is Bruno, I'm in Brazil and I'm new in PHP...
> 
> I wanna know how can I roll in the records in a dataset.
> Like...
> Move First
> Move last
> Move next.....os something like this
> 
> Thanks..




> Hi.... My name is Bruno, I'm in Brazil and I'm new in PHP...
>
>
> I wanna know how can I roll in the records in a dataset.
> Like...
> Move First
> Move last
> Move next.....os something like this

Depends on which database you use...

Assuming it's MySQL, you have http://php.net/mysql_fetch_row and
http://php.net/mysql_fetch_array which are kinda like moveNext, only better
:-)

To move back to the first (or any) record, you can use
http://php.net/mysql_data_seek (I think it's data_seek...)  It's in there
somewhere.

Oh yeah -- You've now triggered a nightmare that can only be expunged by my
singing a verse from my Microsoft Sucks song:

"Can't moveFirst in an empty record set.
Microsoft Sucks.  Microsoft Sucks."

It's a very long song.  Many, many verses.  I used to sing it aloud at work.
:-)

By Day:                                |By Night:
    Don't miss the Zend Web Store's    |   There's not enough room here...
    Grand Opening on January 23, 2001! |   Start here:
    http://www.zend.com                |   http://l-i-e.com/artists.htm






Fraser MacKenzie wrote:

> Alex, Ok...so far, I have progress.  I have PHP recognizing Java... or at
> least, phpinfo() does.
>
> Now, when I try to do a new Java("class");
>
> I get the following error:
>
> Fatal error: Unable to load Java Library
> 
>/home/local/java/jdk1.2.2/jre/lib/i386/classic/libjvm.so:/home/local/java/jdk1.2.2/jre/lib/i386/native_threads/libhpi.so:/home/local/java/jdk1.2.2/jre/lib/i386/classic/libjava.so,
> error:
> 
>/home/local/java/jdk1.2.2/jre/lib/i386/classic/libjvm.so:/home/local/java/jdk1.2.2/jre/lib/i386/native_threads/libhpi.so:/home/local/java/jdk1.2.2/jre/lib/i386/classic/libjava.so:
> cannot
> open shared object file: No such file or directory in
> /home/rondaks_portal/httpd/docs/k2test/index.php3 on line 34
>
It's really confused since you gave it way too much information.  I'm gonna help you 
clean this up a bit and hopefully explain things a bit so that they make sense.  See 
below.

> Here is the appropriate info from my php.ini file:
>
> [Java]
> 
>java.class.path=/home/local/src/php-4.0.4/ext/java/php_java.jar:/home/local/java/jdk1.2.2/jre/lib:/home/local/java/jdk1.2.2/jre/bin
>
Remove the last two directories as they serve no purpose.  This entry is essentially 
an extension to the system CLASSPATH and should only contain directories and jars that 
contain java classes
or java resource files.

> java.home=/home/local/java/jdk1.2.2/bin:/home/local/java/jdk1.2.2/jre/bin
>
There should be only one java.home.  It should point at the base directory of the jdk 
(similar to what you specified on the --with-java=... expression).  In this case, use
java.home=/home/local/java/jdk1.2.2

> 
>java.library.path=/home/local/src/php-4.0.4/ext/java:/home/local/java/jdk1.2.2/jre/lib/i386
>
This entry is essentially equivalent to LD_LIBRARY_PATH.  Not sure if 
/home/local/src/php-4.0.4/ext/java contains any shared libraries (.so extension).  If 
not, it doesn't belong here.  However,
you should have /usr/local/lib/php/extensions/no-debug-non-zts-20001214 (location of 
libphp_java.so) listed here.  Also, you might also need to list the other directories 
in the JDK that may
contain shared libraries that you need (e.g. 
/home/local/java/jdk1.2.2/jre/lib/i386:/home/local/java/jdk1.2.2/jre/lib/i386/classic:/home/local/java/jdk1.2.2/jre/lib/i386/native_threads).
  A good
way to find out what these are is to go into the 
/home/local/java/jdk1.2.2/jre/lib/i386 directory and run ldd libjava.so and then add 
the directories that contain the shared libraries that
libjava.so depends on to the java.library.path (or LD_LIBRARY_PATH).

> 
>java.library=/home/local/java/jdk1.2.2/jre/lib/i386/classic/libjvm.so:/home/local/java/jdk1.2.2/jre/lib/i386/native_threads/libhpi.so:/home/local/java/jdk1.2.2/jre/lib/i386/classic/libjava.so
>
Again, you should only have one entry here and it should simply be the name of the jvm 
shared library (i.e. java.library=libjava.so).  This library will be searched for in 
your LD_LIBRARY_PATH
or java.library.path which you specified above.  Note that on some systems/jdk's you 
might need to specify java.library=libjvm.so.  Specifically, I found I had to do that 
on Solaris or I would
start getting "Cannot locate CreateJavaVM function" errors.

> extension_dir=/usr/local/lib/php/extensions/no-debug-non-zts-20001214
> extension=libphp_java.so
>
This part looks good.

> Any help you can offer is greatly appreciated.
>
You're welcome.  Hope this helps.

> Fraser
>
Alex





Ok.  I have done what you said, but I am now getting:

<b>Fatal error</b>:  Unable to load Java Library
/home/local/java/jdk1.2.2/jre/lib/i386/libjava.so,
error: libhpi.so: cannot open shared object file: No such file or
directory in <b>/home/rondaks_portal/httpd/docs/k2test/index.php3</b> on
line <b>34</b><br

libhpi.so is in the library path...

Here is my configuration now:

[Java]
java.class.path=/home/local/src/php-4.0.4/ext/java/php_java.jar
java.home=/home/local/java/jdk1.2.2
java.library.path=/usr/local/lib/php/extensions/no-debug-non-zts-20001214:/home/local/java/jdk1.2.2/jre/lib/i386:/home/local/java/jdk1.2.2/jre/lib/i386/classic:/home/local/java/jdk1.2.2/jre/lib/i386/green_threads
java.library=/home/local/java/jdk1.2.2/jre/lib/i386/libjava.so
extension_dir=/usr/local/lib/php/extensions/no-debug-non-zts-20001214
extension=libphp_java.so

Fraser

On Fri, 19 Jan 2001, Alex Akilov wrote:

> Fraser MacKenzie wrote:
> 
> > Alex, Ok...so far, I have progress.  I have PHP recognizing Java... or at
> > least, phpinfo() does.
> >
> > Now, when I try to do a new Java("class");
> >
> > I get the following error:
> >
> > Fatal error: Unable to load Java Library
> > 
>/home/local/java/jdk1.2.2/jre/lib/i386/classic/libjvm.so:/home/local/java/jdk1.2.2/jre/lib/i386/native_threads/libhpi.so:/home/local/java/jdk1.2.2/jre/lib/i386/classic/libjava.so,
> > error:
> > 
>/home/local/java/jdk1.2.2/jre/lib/i386/classic/libjvm.so:/home/local/java/jdk1.2.2/jre/lib/i386/native_threads/libhpi.so:/home/local/java/jdk1.2.2/jre/lib/i386/classic/libjava.so:
> > cannot
> > open shared object file: No such file or directory in
> > /home/rondaks_portal/httpd/docs/k2test/index.php3 on line 34
> >
> It's really confused since you gave it way too much information.  I'm gonna help you 
>clean this up a bit and hopefully explain things a bit so that they make sense.  See 
>below.
> 
> > Here is the appropriate info from my php.ini file:
> >
> > [Java]
> > 
>java.class.path=/home/local/src/php-4.0.4/ext/java/php_java.jar:/home/local/java/jdk1.2.2/jre/lib:/home/local/java/jdk1.2.2/jre/bin
> >
> Remove the last two directories as they serve no purpose.  This entry is essentially 
>an extension to the system CLASSPATH and should only contain directories and jars 
>that contain java classes
> or java resource files.
> 
> > java.home=/home/local/java/jdk1.2.2/bin:/home/local/java/jdk1.2.2/jre/bin
> >
> There should be only one java.home.  It should point at the base directory of the 
>jdk (similar to what you specified on the --with-java=... expression).  In this case, 
>use
> java.home=/home/local/java/jdk1.2.2
> 
> > 
>java.library.path=/home/local/src/php-4.0.4/ext/java:/home/local/java/jdk1.2.2/jre/lib/i386
> >
> This entry is essentially equivalent to LD_LIBRARY_PATH.  Not sure if 
>/home/local/src/php-4.0.4/ext/java contains any shared libraries (.so extension).  If 
>not, it doesn't belong here.  However,
> you should have /usr/local/lib/php/extensions/no-debug-non-zts-20001214 (location of 
>libphp_java.so) listed here.  Also, you might also need to list the other directories 
>in the JDK that may
> contain shared libraries that you need (e.g. 
>/home/local/java/jdk1.2.2/jre/lib/i386:/home/local/java/jdk1.2.2/jre/lib/i386/classic:/home/local/java/jdk1.2.2/jre/lib/i386/native_threads).
>  A good
> way to find out what these are is to go into the 
>/home/local/java/jdk1.2.2/jre/lib/i386 directory and run ldd libjava.so and then add 
>the directories that contain the shared libraries that
> libjava.so depends on to the java.library.path (or LD_LIBRARY_PATH).
> 
> > 
>java.library=/home/local/java/jdk1.2.2/jre/lib/i386/classic/libjvm.so:/home/local/java/jdk1.2.2/jre/lib/i386/native_threads/libhpi.so:/home/local/java/jdk1.2.2/jre/lib/i386/classic/libjava.so
> >
> Again, you should only have one entry here and it should simply be the name of the 
>jvm shared library (i.e. java.library=libjava.so).  This library will be searched for 
>in your LD_LIBRARY_PATH
> or java.library.path which you specified above.  Note that on some systems/jdk's you 
>might need to specify java.library=libjvm.so.  Specifically, I found I had to do that 
>on Solaris or I would
> start getting "Cannot locate CreateJavaVM function" errors.
> 
> > extension_dir=/usr/local/lib/php/extensions/no-debug-non-zts-20001214
> > extension=libphp_java.so
> >
> This part looks good.
> 
> > Any help you can offer is greatly appreciated.
> >
> You're welcome.  Hope this helps.
> 
> > Fraser
> >
> Alex
> 
> 





Fraser MacKenzie wrote:

> Here is my configuration now:
>
> [Java]
> java.class.path=/home/local/src/php-4.0.4/ext/java/php_java.jar
> java.home=/home/local/java/jdk1.2.2
> 
>java.library.path=/usr/local/lib/php/extensions/no-debug-non-zts-20001214:/home/local/java/jdk1.2.2/jre/lib/i386:/home/local/java/jdk1.2.2/jre/lib/i386/classic:/home/local/java/jdk1.2.2/jre/lib/i386/green_threads

Not sure if green_threads are supported by PHP/Java.  Try replacing the green_threads 
specification with native_threads (if your JDK has this subdirectory).  If I recall 
correctly, libhpi.so is in native_threads.
Again, I'd suggest setting LD_LIBRARY_PATH temporarily to what you have up in 
java.library.path (after replacing green_threads with native_threads) and then run ldd 
libjava.so from the command line to see if
everything is found.  BTW, if your JDK doesn't have a native_threads subdirectory then 
you might need to use a different JDK for PHP/Java to work correctly.  Did you ever 
mention what JDK you were using?

> java.library=/home/local/java/jdk1.2.2/jre/lib/i386/libjava.so

Simply use java.library=libjava.so (let it do the search).  However, the above might 
work as is.

Alex





If I don't actually specify the entire path to libjava.so, I get the
following error:

Fatal error: Unable to load Java Library libjava.so,
error: libhpi.so: cannot open shared object file: No such file or
directory in /home/rondaks_portal/httpd/docs/k2test/index.php3 on line 34

So, when I actually specify the full path, and change the green_threads to
native_threads I get the same error.

This is driving me nuts.

I appreciate all the help Alex and I hope my madness is helping somebody
else out there.

Fraser


On Fri, 19 Jan 2001, Alex Akilov wrote:

> Fraser MacKenzie wrote:
> 
> > Here is my configuration now:
> >
> > [Java]
> > java.class.path=/home/local/src/php-4.0.4/ext/java/php_java.jar
> > java.home=/home/local/java/jdk1.2.2
> > 
>java.library.path=/usr/local/lib/php/extensions/no-debug-non-zts-20001214:/home/local/java/jdk1.2.2/jre/lib/i386:/home/local/java/jdk1.2.2/jre/lib/i386/classic:/home/local/java/jdk1.2.2/jre/lib/i386/green_threads
> 
> Not sure if green_threads are supported by PHP/Java.  Try replacing the 
>green_threads specification with native_threads (if your JDK has this subdirectory).  
>If I recall correctly, libhpi.so is in native_threads.
> Again, I'd suggest setting LD_LIBRARY_PATH temporarily to what you have up in 
>java.library.path (after replacing green_threads with native_threads) and then run 
>ldd libjava.so from the command line to see if
> everything is found.  BTW, if your JDK doesn't have a native_threads subdirectory 
>then you might need to use a different JDK for PHP/Java to work correctly.  Did you 
>ever mention what JDK you were using?
> 
> > java.library=/home/local/java/jdk1.2.2/jre/lib/i386/libjava.so
> 
> Simply use java.library=libjava.so (let it do the search).  However, the above might 
>work as is.
> 
> Alex
> 
> 
> 





Fraser MacKenzie wrote:

> If I don't actually specify the entire path to libjava.so, I get the
> following error:
>
> Fatal error: Unable to load Java Library libjava.so,
> error: libhpi.so: cannot open shared object file: No such file or
> directory in /home/rondaks_portal/httpd/docs/k2test/index.php3 on line 34
>
> So, when I actually specify the full path, and change the green_threads to
> native_threads I get the same error.
>
> This is driving me nuts.

Relax and believe!  We're almost there but you mustn't lose faith.

Let's leave PHP out of things and just figure out your JDK.  Did you try
ldd libjava.so with LD_LIBRARY_PATH set up as I suggested?
Also, does your native_threads directory contain libhpi.so?
Last but not least, mind telling me what JDK you're using?

Alex





Yep.

ldd libjava.so produces:

        libhpi.so => not found
        libnsl.so.1 => /lib/libnsl.so.1 (0x00143000)
        libdl.so.2 => /lib/libdl.so.2 (0x0015a000)
        libjvm.so => not found
        libc.so.6 => /lib/libc.so.6 (0x0015f000)
        /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000)

Now: libhpi.so is located in: 

./green_threads/libhpi.so
./native_threads/libhpi.so

and libjvm.so is located in:

./classic/libjvm.so

Perhaps I have to set them up in my LD_LIBRARY_PATH for my current shell?

Fraser

On Fri, 19 Jan 2001, Alex Akilov wrote:

> Fraser MacKenzie wrote:
> 
> > If I don't actually specify the entire path to libjava.so, I get the
> > following error:
> >
> > Fatal error: Unable to load Java Library libjava.so,
> > error: libhpi.so: cannot open shared object file: No such file or
> > directory in /home/rondaks_portal/httpd/docs/k2test/index.php3 on line 34
> >
> > So, when I actually specify the full path, and change the green_threads to
> > native_threads I get the same error.
> >
> > This is driving me nuts.
> 
> Relax and believe!  We're almost there but you mustn't lose faith.
> 
> Let's leave PHP out of things and just figure out your JDK.  Did you try
> ldd libjava.so with LD_LIBRARY_PATH set up as I suggested?
> Also, does your native_threads directory contain libhpi.so?
> Last but not least, mind telling me what JDK you're using?
> 
> Alex
> 
> 
> 





Fraser,

Yes, you must set your LD_LIBRARY_PATH prior to running ldd.  In a terminal,
export
LD_LIBRARY_PATH=/home/local/java/jdk1.2.2/jre/lib/i386:/home/local/java/jdk1.2.2/jre/lib/i386/classic:/home/local/java/jdk1.2.2/jre/lib/i386/native_threads

and rerun ldd libjava.so.  If everything works, leave LD_LIBRARY_PATH alone and in
your php.ini reset your java.library.path to the following:

java.library.path=/usr/local/lib/php/extensions/no-debug-non-zts-20001214

Run php <path to php src>/ext/java/jver.php from the command line to verify that
things are working (that is, provided your php and php.ini are visible from
whatever directory you're running).

If everything works, you can try combining LD_LIBRARY_PATH and your
java.library.path into a single specification (i.e.
java.library.path=/usr/local/lib/php/extensions/no-debug-non-zts-20001214:/home/local/java/jdk1.2.2/jre/lib/i386:/home/local/java/jdk1.2.2/jre/lib/i386/classic:/home/local/java/jdk1.2.2/jre/lib/i386/native_threads)

and you should be good to go.  If the latter doesn't work, then your php.ini is
not being found or java.library.path is not being interpreted correctly.  An
alternative is to set LD_LIBRARY_PATH in your (root?) profile to include all the
directories above (or better yet, add them to /etc/ld.so.conf) and restart your
system.

Alex





What if I want the function to be processed within the " " quotes?  Same as
a variable might be interopelated?  IOW, can I call a function without
concantenating the function together with the string?

*being a little stubborn*


----- Original Message -----
From: "Karl J. Stubsjoen" <[EMAIL PROTECTED]>
To: "PHP Mailing List" <[EMAIL PROTECTED]>
Sent: Friday, January 19, 2001 10:17 AM
Subject: [PHP] Function / String Problem


> Okay, what is wrong with this:
>
>        echo "<br><br>...are you logged in: $LoggedIn()<br><br>";
> // outputs:    ...are you logged in: ()
>
> Function is:
> function LoggedIn(){
>   global $HTTP_POST_VARS
>         if ($HTTP_POST_VARS["Login"] == "PHPIsCool")
>         {return "YES";}
>         else
>         {return "NO";}
> }
>
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>
>






> What if I want the function to be processed within the " " 
> quotes?  Same as a variable might be interopelated?  IOW, 
> can I call a function without concantenating the function 
> together with the string?
> *being a little stubborn*

No.  Why would you want to?
You *might* be able to do it if you use single quotes instead,
but I am unsure and personally doubt that it would work.

Chris




It won't work even with single quotes. It'll just echo out LoggedIn() as
part of the string.

"Boget, Chris" wrote:
> 
> > What if I want the function to be processed within the " "
> > quotes?  Same as a variable might be interopelated?  IOW,
> > can I call a function without concantenating the function
> > together with the string?
> > *being a little stubborn*
> 
> No.  Why would you want to?
> You *might* be able to do it if you use single quotes instead,
> but I am unsure and personally doubt that it would work.
> 
> Chris

-- 

Shawn Blaylock, ClipperNet Software Engineer
[EMAIL PROTECTED]
http://www.clipper.net/
Eugene OR  541-431-3360 x406
Toll Free  866-673-6260 x406




> It won't work even with single quotes. It'll just echo out 
> LoggedIn() as part of the string.

Yeah, I didn't think so.  But I knew that '' behaves differently
than "".  I just wasn't sure of the exact details of the differences.

Chris




Yep. I think the only difference is the way it handles variable
interpolation, but I'm not entirely sure on that one.

"Boget, Chris" wrote:
> 
> > It won't work even with single quotes. It'll just echo out
> > LoggedIn() as part of the string.
> 
> Yeah, I didn't think so.  But I knew that '' behaves differently
> than "".  I just wasn't sure of the exact details of the differences.
> 
> Chris

-- 

Shawn Blaylock, ClipperNet Software Engineer
[EMAIL PROTECTED]
http://www.clipper.net/
Eugene OR  541-431-3360 x406
Toll Free  866-673-6260 x406




On Fri, 19 Jan 2001, Shawn Blaylock wrote:

> Yep. I think the only difference is the way it handles variable
> interpolation, but I'm not entirely sure on that one.
>
> "Boget, Chris" wrote:
> >
> > > It won't work even with single quotes. It'll just echo out
> > > LoggedIn() as part of the string.
> >
> > Yeah, I didn't think so.  But I knew that '' behaves differently
> > than "".  I just wasn't sure of the exact details of the differences.
> >
> > Chris
>

Single quotes also don't do escaping (i.e., "\n", "\r", etc.).

-- 
Ignacio Vazquez-Abrams  <[EMAIL PROTECTED]>





Ohhhh yeah! Thanks for pointing that out! =)

Ignacio Vazquez-Abrams wrote:
> 
> On Fri, 19 Jan 2001, Shawn Blaylock wrote:
> 
> > Yep. I think the only difference is the way it handles variable
> > interpolation, but I'm not entirely sure on that one.
> >
> > "Boget, Chris" wrote:
> > >
> > > > It won't work even with single quotes. It'll just echo out
> > > > LoggedIn() as part of the string.
> > >
> > > Yeah, I didn't think so.  But I knew that '' behaves differently
> > > than "".  I just wasn't sure of the exact details of the differences.
> > >
> > > Chris
> >
> 
> Single quotes also don't do escaping (i.e., "\n", "\r", etc.).
> 
> --
> Ignacio Vazquez-Abrams  <[EMAIL PROTECTED]>
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]

-- 

Shawn Blaylock, ClipperNet Software Engineer
[EMAIL PROTECTED]
http://www.clipper.net/
Eugene OR  541-431-3360 x406
Toll Free  866-673-6260 x406





This tutorial will help you guys understand the differences :

    http://www.zend.com/zend/tut/using-strings.php

philip

On Fri, 19 Jan 2001, Shawn Blaylock wrote:

> Yep. I think the only difference is the way it handles variable
> interpolation, but I'm not entirely sure on that one.
> 
> "Boget, Chris" wrote:
> > 
> > > It won't work even with single quotes. It'll just echo out
> > > LoggedIn() as part of the string.
> > 
> > Yeah, I didn't think so.  But I knew that '' behaves differently
> > than "".  I just wasn't sure of the exact details of the differences.
> > 
> > Chris
> 
> -- 
> 
> Shawn Blaylock, ClipperNet Software Engineer
> [EMAIL PROTECTED]
> http://www.clipper.net/
> Eugene OR  541-431-3360 x406
> Toll Free  866-673-6260 x406
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
> 





My original e-mail, unanswered, is referenced below. I am in serious
need of HELP.

To prevent the $SESSION variable from getting set to a boolean, I
wrote the following loop with the idea that if the error happened
in unserializing the data in the database, I would simply query the
database again, and unserialize the data anew:

while(gettype($SESSION)<>"array")
{
        $sessionError++;
        $select=new dbLOCAL;
        $query="SELECT data FROM sessions WHERE id='".$sessid."'";
        $select->query($query);
        $select->next_record();
        $SESSION=unserialize($select->Record["data"]);
        echo $select->Record["data"];
        echo "<br>";
        echo gettype($SESSION);
        echo "<br>";
}

$select is obviously an object. The next_record() method uses the
mysql_fetch_array() function to get put the data into the Record
property. I added the echo statements to see what was happening if
and when the loop executed. Well, it eventually did and I had to
physically terminate the script in my browser as the conditional
for the loop never evaluated TRUE. Echoed out to my browser was
the following:

a:2:{s:4:\"USER\";a:15:{s:8:\"loggedIn\";i:1;s:7:\"user_id\";s:1:\"1\";s:5:\
"admin\";s:3:\"Yes\";s:10:\"contact_id\";s:1:\"1\";s:5:\"first\";s:2:\"AA\";
s:4:\"last\";s:8:\"Aaaaaaaa\";s:7:\"company\";s:3:\"ABC\";s:6:\"street\";s:1
8:\"8158 AAAAAA Avenue\";s:4:\"city\";s:11:\"Los
Angeles\";s:5:\"state\";s:1:\"5\";s:7:\"zipcode\";s:5:\"00000\";s:7:\"countr
y\";s:13:\"United States\";s:5:\"phone\";s:14:\"(000)
000-0000\";s:3:\"fax\";s:0:\"\";s:5:\"email\";s:13:\"[EMAIL PROTECTED]\";}s:7:\"
CONTACT\";a:1:{i:1;a:11:{s:5:\"first\";s:2:\"AA\";s:4:\"last\";s:8:\"Aaaaaaa
a\";s:7:\"company\";s:3:\"ABC\";s:6:\"street\";s:18:\"8158 AAAAAA
Avenue\";s:4:\"city\";s:11:\"Los
Angeles\";s:5:\"state\";s:1:\"5\";s:7:\"zipcode\";s:5:\"00000\";s:7:\"countr
y\";s:13:\"United States\";s:5:\"phone\";s:14:\"(000)
000-0000\";s:3:\"fax\";s:0:\"\";s:5:\"email\";s:13:\"[EMAIL PROTECTED]\";}}}
boolean
a:2:{s:4:\"USER\";a:15:{s:8:\"loggedIn\";i:1;s:7:\"user_id\";s:1:\"1\";s:5:\
"admin\";s:3:\"Yes\";s:10:\"contact_id\";s:1:\"1\";s:5:\"first\";s:2:\"AA\";
s:4:\"last\";s:8:\"Aaaaaaaa\";s:7:\"company\";s:3:\"ABC\";s:6:\"street\";s:1
8:\"8158 AAAAAA Avenue\";s:4:\"city\";s:11:\"Los
Angeles\";s:5:\"state\";s:1:\"5\";s:7:\"zipcode\";s:5:\"00000\";s:7:\"countr
y\";s:13:\"United States\";s:5:\"phone\";s:14:\"(000)
000-0000\";s:3:\"fax\";s:0:\"\";s:5:\"email\";s:13:\"[EMAIL PROTECTED]\";}s:7:\"
CONTACT\";a:1:{i:1;a:11:{s:5:\"first\";s:2:\"AA\";s:4:\"last\";s:8:\"Aaaaaaa
a\";s:7:\"company\";s:3:\"ABC\";s:6:\"street\";s:18:\"8158 AAAAAA
Avenue\";s:4:\"city\";s:11:\"Los
Angeles\";s:5:\"state\";s:1:\"5\";s:7:\"zipcode\";s:5:\"00000\";s:7:\"countr
y\";s:13:\"United States\";s:5:\"phone\";s:14:\"(000)
000-0000\";s:3:\"fax\";s:0:\"\";s:5:\"email\";s:13:\"[EMAIL PROTECTED]\";}}}
boolean

AND SO ON...

Can anyone please tell me why this is happening and what I can
do to correct it??? Thank you,

Ted


> -----Original Message-----
> From: TR Henigson [mailto:[EMAIL PROTECTED]]
> Sent: Friday, January 19, 2001 9:13 AM
> To: T. R. Henigson
> Subject: FW: unserialize() unexpectedly returns a boolean
>
>
> I built an e-commerce application using PHP4 session management.
> I store all data in an array, $SESSION, which I register with the
> session. Most of the time, $SESSION is restored as expected on
> the loading of a new page. Every now and then, however, $SESSION
> is restored as a boolean variable with value 0. All of the
> contents of the original array are, of course, lost. Have I
> encountered a known problem? I attempted to circumvent the issue
> by writing my own session management logic the implementation of
> which follows:
>
> I store a serialized representation of the array $SESSION with
> serialize() in a MySQL database indexed by the session id. On a
> page load, I query the database and unserialize the data with
> unserialize() and thus, $SESSION is restored. At the end of the
> page, I serialize $SESSION again and write it to the database.
> I ultimately experienced the same problem with my code where
> $SESSION was indiscriminately set to a boolean of value 0. This
> error is not reproducible in any predictable way. In my custom
> session management, I was however able to implement debugging
> logic that provides the following information:
>
> PHP is faithfully retrieving the serialized session data from the
> MySQL database. The unserialize() function seems to be the
> problem. Every so often, it results in the boolean variable
> despite the fact that the serialized data it operates on
> represents an array. For example, I determined from my debugging
> log (physical data has been altered for privacy):
>
> 1. raw data extracted from database and stored into $rawData:
> a:2:{s:4:"USER";a:15:{s:8:"loggedIn";i:1;s:7:"user_id";s:1:"1";
> s:5 :"admin";s :3:"Yes";s:10:"contact_id";s:1:"1";s:5:"first";s:
> 4:"John";s:4:"las t";s:3:"Do e";s:7:"company";s:3:"ABC";s:6:
> "street";s:18:"#### XXXXXX Avenue";s:4:"city";s:11:"Los Angeles"
> ;s:5:"state";s:1:"5";s:7:"zipcode";s:5:"######";s:7:"country";s:
> 13:"United States";s:5:"phone";s:14:"(323) 555-5555";s:3:"fax";
> s:0:"";s:5:"email";s:13:"[EMAIL PROTECTED]";}s:7:" CONTACT";a :1:{i
> :1;a:11:{s:5:"first";s:4:"John";s:4:"last";s:3:"Doe";s:7:"company"
> ;s:3: "ABC";s:6:"street";s:18:"#### XXXXXXX Avenue";s:4:"city"
> ;s:11:"Los Angeles";s:5:"state";s:1:"5";s:7:"zipcode";s:5:"#####"
> ;s:7:"country";s:13:"United States";s:5:"phone";s:14:"(323)
> 555-5555";s:3:"fax";s:0:"";s:5:"email";s:13:"[EMAIL PROTECTED]";}}}
>
> 2. then raw data is unserialized into session variable $SESSION=
> unserialize($rawData)
>
> 3. session variable is immediately typed with gettype($SESSION)
> and it's a boolean As I said before, this happens only irregularly.
> Most of the time, gettype() properly determines $SESSION is an
> array which, when examined, contains the unserialized data from
> the database. Every now and then, though, it's a boolean with a
> value of 0. So I guess my first question is does anyone know what
> is going on here? Second, does native PHP4 session management use
> the unserialize() function. And third, is unserialize() broken?
>
> Ted Henigson





On Fri, 19 Jan 2001, TR Henigson wrote:

> My original e-mail, unanswered, is referenced below. I am in serious
> need of HELP.
>
> To prevent the $SESSION variable from getting set to a boolean, I
> wrote the following loop with the idea that if the error happened
> in unserializing the data in the database, I would simply query the
> database again, and unserialize the data anew:
>
> while(gettype($SESSION)<>"array")
> {
>       $sessionError++;
>       $select=new dbLOCAL;
>       $query="SELECT data FROM sessions WHERE id='".$sessid."'";
>       $select->query($query);
>       $select->next_record();
>       $SESSION=unserialize($select->Record["data"]);
>       echo $select->Record["data"];
>       echo "<br>";
>       echo gettype($SESSION);
>       echo "<br>";
> }
>
> $select is obviously an object. The next_record() method uses the
> mysql_fetch_array() function to get put the data into the Record
> property. I added the echo statements to see what was happening if
> and when the loop executed. Well, it eventually did and I had to
> physically terminate the script in my browser as the conditional
> for the loop never evaluated TRUE. Echoed out to my browser was
> the following:
>
> a:2:{s:4:\"USER\";a:15:{s:8:\"loggedIn\";i:1;s:7:\"user_id\";s:1:\"1\";s:5:\
> "admin\";s:3:\"Yes\";s:10:\"contact_id\";s:1:\"1\";s:5:\"first\";s:2:\"AA\";
> s:4:\"last\";s:8:\"Aaaaaaaa\";s:7:\"company\";s:3:\"ABC\";s:6:\"street\";s:1
> 8:\"8158 AAAAAA Avenue\";s:4:\"city\";s:11:\"Los
> Angeles\";s:5:\"state\";s:1:\"5\";s:7:\"zipcode\";s:5:\"00000\";s:7:\"countr
> y\";s:13:\"United States\";s:5:\"phone\";s:14:\"(000)
> 000-0000\";s:3:\"fax\";s:0:\"\";s:5:\"email\";s:13:\"[EMAIL PROTECTED]\";}s:7:\"
> CONTACT\";a:1:{i:1;a:11:{s:5:\"first\";s:2:\"AA\";s:4:\"last\";s:8:\"Aaaaaaa
> a\";s:7:\"company\";s:3:\"ABC\";s:6:\"street\";s:18:\"8158 AAAAAA
> Avenue\";s:4:\"city\";s:11:\"Los
> Angeles\";s:5:\"state\";s:1:\"5\";s:7:\"zipcode\";s:5:\"00000\";s:7:\"countr
> y\";s:13:\"United States\";s:5:\"phone\";s:14:\"(000)
> 000-0000\";s:3:\"fax\";s:0:\"\";s:5:\"email\";s:13:\"[EMAIL PROTECTED]\";}}}
> boolean
> a:2:{s:4:\"USER\";a:15:{s:8:\"loggedIn\";i:1;s:7:\"user_id\";s:1:\"1\";s:5:\
> "admin\";s:3:\"Yes\";s:10:\"contact_id\";s:1:\"1\";s:5:\"first\";s:2:\"AA\";
> s:4:\"last\";s:8:\"Aaaaaaaa\";s:7:\"company\";s:3:\"ABC\";s:6:\"street\";s:1
> 8:\"8158 AAAAAA Avenue\";s:4:\"city\";s:11:\"Los
> Angeles\";s:5:\"state\";s:1:\"5\";s:7:\"zipcode\";s:5:\"00000\";s:7:\"countr
> y\";s:13:\"United States\";s:5:\"phone\";s:14:\"(000)
> 000-0000\";s:3:\"fax\";s:0:\"\";s:5:\"email\";s:13:\"[EMAIL PROTECTED]\";}s:7:\"
> CONTACT\";a:1:{i:1;a:11:{s:5:\"first\";s:2:\"AA\";s:4:\"last\";s:8:\"Aaaaaaa
> a\";s:7:\"company\";s:3:\"ABC\";s:6:\"street\";s:18:\"8158 AAAAAA
> Avenue\";s:4:\"city\";s:11:\"Los
> Angeles\";s:5:\"state\";s:1:\"5\";s:7:\"zipcode\";s:5:\"00000\";s:7:\"countr
> y\";s:13:\"United States\";s:5:\"phone\";s:14:\"(000)
> 000-0000\";s:3:\"fax\";s:0:\"\";s:5:\"email\";s:13:\"[EMAIL PROTECTED]\";}}}
> boolean
>
> AND SO ON...
>
> Can anyone please tell me why this is happening and what I can
> do to correct it??? Thank you,
>
> Ted
>

Yeah, there's your problem. See the output? See all those backslashes? Figured
it out yet? :)

All those backslashes are breaking the unserialization. Use stripslashes(). Or
better yet, turn off magic_quotes_runtime in php.ini.

-- 
Ignacio Vazquez-Abrams  <[EMAIL PROTECTED]>





On Fri, 19 Jan 2001, Jamie wrote:

> I'm fairly new to SQL and PHP and I'm haveing trouble useing the Date
> functions of Both Systems, so I'd be greatfull if someone can help.
> What I'm trying to do is have an 'administrator' be able to enter info
> through a form to a mySQL database. Then on a seperate page have the info
> reread and displayed.  The basic outline is a News page which reads and
> displays from the table and shows the  News topics preceeding and inculding
> the current date (ie if I enter a future Date eg 25/12/2001 and the comment
> Merry christmas, in the databaes I don't want it to appear until the date
> has occured)
>
> The Table looks as follows:
> CREATE TABLE news (
>  news_id          INT         NOT NULL primary key auto_increment,
>  topic               VARCHAR(30) NOT NULL,
>  live_date         date        NOT NULL,
>  news              BLOB        NOT NULL,
>  user_id           VARCHAR(20) NOT NULL);
>
> I've used the MYSQL date type as I think this would be easier for the users
> to be able to manually enter the date in is form on the admin form - also I
> don't think a more accurate date/time method will be more usful.
>
> Currently I'm using this SQL Line:
> SELECT * FROM news ORDER BY live_date DESC LIMIT 4
> (where Live_Date is the date to display the news after)
>
> Also I'd like to if possible to be able to enter and display the date in
> Australian / European Time format (DD,MM,YYYY)
> I'm currently entering it on the form using three text fields and then
> rearanging them to the Format in mySQL and indserting it as a string, but I
> don't know how to 'break' up a mySQL Date value to rearange it.
>
> Hope these arn't in the FAQ as I have spent some time looking through PHP
> script sites and have been unable to find anything that can help.
>

The reason you haven't found anything on PHP sites is that they're not PHP
questions, they're MySQL questions :)

For the future date, add "live_date<=NOW()" to your WHERE clause in your
select queries.

As for the date format, MySQL only supports ANSI format (YYYY-MM-DD) for
input, but you can use the DATE_FORMAT() function to change the output. You'll
have to use substr() in PHP to chop up the input string and rearrange it for
MySQL.

-- 
Ignacio Vazquez-Abrams  <[EMAIL PROTECTED]>






> Also I'd like to if possible to be able to enter and display the date in
> Australian / European Time format (DD,MM,YYYY)
> I'm currently entering it on the form using three text fields and then
> rearanging them to the Format in mySQL and indserting it as a string, but
I
> don't know how to 'break' up a mySQL Date value to rearange it.

The breaking up of a MySQL date would be in the MySQL manual at
http://mysql.org
I dunno what it's called...  In PostgreSQL it's "date_part" though :-)

I'm afraid there was another question in there somewhere, but I couldn't
really discern it -- What you are doing seems quite reasonable to me.






Has anyone used the makerpm script in supplied with the tarbar php distribution
from snap.php.net?
If anyone has, do you know where the documentation is?

Thank you.
Lou Spironello





I'm working on a very large project that has been built in PHP 3. I've been
charged with the task of moving it over to PHP4.

So far everything has been going swimmingly (well, except that I forgot to
compile PHP 4 --with-oci8 insted of --with-oracle). However, I've run into a
couple of wierd issues.

All the old, working perfectly, PHP3 scripts that has this in them:
@unset($var);
Throw a parse error on that..If I take out the @ it works fine. Now this has
me thinking, are there any other little oddities like this that arn't
clearly documented anywhere? (or if they are I can't fine them)

Also have any of the OCI functions changed radically from 3 to 4? (I already
ran into the OCIFreeDescriptor == OCIFreeDesc one), Also have there been any
serious changes to the ereg functions?

(Oh, and on a side note, my company is looking for 2 good PHP developers. If
you live in the Vancouver area, or want to move here, check the site in my
sig or email me.)

Thanks for any input you can give,

---------------------------------------------------------------
James Atkinson                     100world.com Inc.
Senior Developer                             512 - 1529 W. 6th Ave.
Phone: +1-604-637-8122               Vancouver, BC, V6J 1R1
Fax:   +1-604-742-1770             Canada
Email: [EMAIL PROTECTED]  http://www.100world.com





On Fri, 19 Jan 2001, Markus H. Maussner wrote:

> hi...
>
> every time i do a session_start();  with php i get in the first two lines
> of the output this
>
> &PHPSESSID=ba606b5a90dbb4410417b4c612aaf1c9"">Your data      Contact
> LOGOUT
> &PHPSESSID=ba606b5a90dbb4410417b4c612aaf1c9"">Contact      LOGOUT
>
> do i do something wrong ? can i put this message somehow off ?
>
> everything else work fine.. sessions and so.. just this two lines are a
> bit disturbing me...
>
> markus
>

Are you using quotes in your <A> tags?

-- 
Ignacio Vazquez-Abrams  <[EMAIL PROTECTED]>






>How can I do it ???  I installed jpeg-6b, and I readed that before
recompile PHP(with option : --with-jpeg-dir=/.../jpeg-6b), >I must recompile
gd, its really necessary ? If si, how recompile gd.

There should be instructions in the GD source code directory.

By Day:                                |By Night:
    Don't miss the Zend Web Store's    |   There's not enough room here...
    Grand Opening on January 23, 2001! |   Start here:
    http://www.zend.com                |   http://l-i-e.com/artists.htm







> I have a txt file as input.This file has the coordinates for a gas
> network.With php I am creating an array with the above coordinates and
then
> I create from the array the image from the network.When the txt file is
> >21Kb there is no image, else all works perfect{with a smaller txt file).I
> am using php4,apache(sometimes my system hangs with this server) or OMNI
> httpd(works fine).
> If anybody know sth PLEASE HELP ME
> I am newbie in php programming

Post some source code, or put it online as source and post URL.

By Day:                                |By Night:
    Don't miss the Zend Web Store's    |   There's not enough room here...
    Grand Opening on January 23, 2001! |   Start here:
    http://www.zend.com                |   http://l-i-e.com/artists.htm






> <?
> for ($i=0 ; $i < 4 ; $i++)
> {
>     file://do something
>
>     for ($k=0 ; $k < 3 ; $k++)
>    {
>         print "<input type=\"checkbox\" name=\"checkans[$i][$k]\"
> value=\"".$K."\" >"; file://this is working
>         print "<input type=\"file\" name=\"ans[$i][$k]\" >"; file://this
is
> not
>    }
> }

For FORMs, files as arrays were added in later, and then 2-D arrays came
after that.  So probably there is no patch yet for 2-D FILE inputs.

You're probably receiving all the files in a 1-D array, with funky indices
(keys):

$ans['0][0'] is the first file.
$ans['0][1'] is the second file
etc

If so, you can walk that and use explode('][', $key) to determine the
indices you really wanted and re-construct your desired array.

Something like:
while (list($key, $value) = each($ans)){
    $keys = explode('][', $key);
    list($x, $y) = each($keys);
    $realans[$x][$y] = $value;
}


By Day:                                |By Night:
    Don't miss the Zend Web Store's    |   There's not enough room here...
    Grand Opening on January 23, 2001! |   Start here:
    http://www.zend.com                |   http://l-i-e.com/artists.htm






On Fri, 19 Jan 2001, Richard Lynch wrote:

> > <?
> > for ($i=0 ; $i < 4 ; $i++)
> > {
> >     file://do something
> >
> >     for ($k=0 ; $k < 3 ; $k++)
> >    {
> >         print "<input type=\"checkbox\" name=\"checkans[$i][$k]\"
> > value=\"".$K."\" >"; file://this is working
> >         print "<input type=\"file\" name=\"ans[$i][$k]\" >"; file://this
> is
> > not
> >    }
> > }
>
> For FORMs, files as arrays were added in later, and then 2-D arrays came
> after that.  So probably there is no patch yet for 2-D FILE inputs.
>
> You're probably receiving all the files in a 1-D array, with funky indices
> (keys):
>
> $ans['0][0'] is the first file.
> $ans['0][1'] is the second file
> etc
>
> If so, you can walk that and use explode('][', $key) to determine the
> indices you really wanted and re-construct your desired array.
>
> Something like:
> while (list($key, $value) = each($ans)){
>     $keys = explode('][', $key);
>     list($x, $y) = each($keys);
>     $realans[$x][$y] = $value;
> }
>
>
> By Day:                                |By Night:
>     Don't miss the Zend Web Store's    |   There's not enough room here...
>     Grand Opening on January 23, 2001! |   Start here:
>     http://www.zend.com                |   http://l-i-e.com/artists.htm
>

Actually, the patch went in today. Pick up the CVS tomorrow and you should be
laughing.

-- 
Ignacio Vazquez-Abrams  <[EMAIL PROTECTED]>





> Fatal error: Call to unsupported or undefined function
> mssql_connect() in C:\HTTPD\HTDOCS\mssql.php3 on line
> 3
> 
> I have uncommented the ; in the php3.ini file.

Is that DLL actually in your php directory?...

By Day:                                |By Night:
    Don't miss the Zend Web Store's    |   There's not enough room here...
    Grand Opening on January 23, 2001! |   Start here:
    http://www.zend.com                |   http://l-i-e.com/artists.htm






> $overview = imap_fetch_overview($mbox, "1:$last", 0);
> $IDs = array();
> $i = 0;
>
> foreach($overview as $val){
>     $IDs[$i][0] = $val->message_id;
>     $IDs[$i][1] = &$val;
>     $i++;
> }
>
> echo "<table border=\"1\">";
> foreach($IDs as $val){
>     echo "<tr><td>" . $val[1]->subject . "</td></tr>";
> }
> echo "</table>";
>
> Unfortunately I only get an empty table; the subject of the referenced
> header is not printed in the HTML-Code. Where's the error in my thinking ?

I'm  not seeing anything to explain why you don't get your subject, but I do
wonder why you iterate through your $overview array to build an $ID array so
you can iterate through that to write out your table...

Would it not make more sense to just iterate through $overview, writing out
the HTML as you go?

By Day:                                |By Night:
    Don't miss the Zend Web Store's    |   There's not enough room here...
    Grand Opening on January 23, 2001! |   Start here:
    http://www.zend.com                |   http://l-i-e.com/artists.htm






> on this mail I want to trigger mail incomming on this adres so I can start
a
> php script that filters this standaard mail getting the order code and put

Ideally you've got PHP compiled as a CGI as well as a Module.

The trigger part is in your procmail filters, which I've never done, so I
can't help much, except to say "man procmail"

Conceptually, though, the rest is fairly easy:  Something you put in your
.procmail file will look more or less like this:

blahblahblah "/full/path/to/your/script.php XXX"

Where blahblahblah is how procmail identifies which emails to send and XXX
is procmail's secret code for "shove the actual email in here"

Then your script just looks like:

#!/full/path/to/cgi/binary/php -q
<?php
    $email = $arg[0];
    #parse your email here and do your database stuff to it
?>

You'll need to chmod your script to be executable by the process running
procmail, and you'll have to make sure it has Un*x newlines, not Windows,
because that #! line has to have a Un*x newline at the end.

By Day:                                |By Night:
    Don't miss the Zend Web Store's    |   There's not enough room here...
    Grand Opening on January 23, 2001! |   Start here:
    http://www.zend.com                |   http://l-i-e.com/artists.htm






> I am trying to make a tab delimited file of a mysql table so I can open
> it with Excel.
> I select the data - 40 fields, 808 records no prob.
> I view a mysql_num_rows() query to make sure it selects all records; no
prob.
>
> I create a tab delimited format:
> $result = mysql_query("SELECT * FROM $database");
> $rows=mysql_num_rows($result);
> while ($row = mysql_fetch_array($result) )
> {
> $field1="$row[field1]";
> $field2="$row[field2]";  file://etc....
>
> $html.="$field1 $field2 $field3....."

I'm assuming there are TAB characters in there?...

Actually, though, you could save yourself some grief here and just do
explode("\t", $row) to get your line to output.

> }
>
> Then I write it to a file:
> if (! ($myfile=fopen ("tables", "w")))  {echo "file could not be opened";}
> fputs ($myfile, "$html");
> fclose ($myfile);
>
> THE PROBLEM IS...
>
> The file that is written is missing about 400 records!
> If I limit the fields to a few, I get all 808 records written no problem.
> So, I imagine the problem is the file size - the 400 records equate to
> about 131K.
> Is there a problem using the fputs() function for larger files?

There shouldn't be any problem.  A few hundred K is just not that big.

However, you could make this more efficient by opening the file when you do
the query, and spitting out each line as you get it.

I dunno what's going wrong, but you'll have a way better program, and maybe
the gods will smile on you then and let it work. :-)






Thanks Brian, I should have provided that detail.  Unfortunately it is on a
Windows machine.. anyone know of a schedule for IIS that would do the same
thing?

Rudy


----- Original Message -----
From: "Brian Clark" <[EMAIL PROTECTED]>
To: "PHP is not a drug ." <[EMAIL PROTECTED]>
Sent: Friday, January 19, 2001 3:56 AM
Subject: Re: [PHP] question on time-based function


>
> Hello Rudy,
>
> (RM == "Rudy McDaniel") [EMAIL PROTECTED] writes:
>
> RM> Anyone have any ideas on how to make a function reset every
> RM> 24-hours? For example, I have a function that grabs a random quote
> RM> from a file and selects a new one every time the page is reloaded.
> RM> What I want, however, is for the quote to remain the same for a
> RM> day and then reset at some specified time (say midnight) and grab
> RM> a new random quote for the next day. It seems like their should be
> RM> any easy way to do this using mktime( ) or a similar function but
> RM> I'm not fully grasping it. Any ideas on how to do this would be
> RM> much appreciated.
>
> Why not just make cron (once a day) read the quotes file, pick a
> random line, write the quote to a file called quoteoftheday.php, then
> just include() that file into your page?
>
> Unless you're running this one a windows machine.. in that case you
> might be able to do the same thing with some scheduler instead of
> cron, I'm not sure.
>
> -Brian
> --
> Opportunity makes a thief. -Francis Bacon, 1598
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]


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





On Fri, 19 Jan 2001, Rudy McDaniel wrote:

> Thanks Brian, I should have provided that detail.  Unfortunately it is on a
> Windows machine.. anyone know of a schedule for IIS that would do the same
> thing?
>
> Rudy
>

Use the WinNT "at" command. Or better yet, use WinAt or the Task Scheduler.

-- 
Ignacio Vazquez-Abrams  <[EMAIL PROTECTED]>





Hmmm...

Thanks for the info, but I allready know it's a bug.

My problem is that I can't recompile PHP on the the server, so I'm desperatly looking 
for a way to access the real PATH_TRANSLATED...

In my opinion the lack of a working PATH_TRANSLATED makes PHP rether useless for large 
scale sites !!!


Heino H. Gehlsen



----- Oprindelig meddelelse ----- 
> Its a PHP bug, I've attached a patch (that they persistantly ignore :).

> ----- Original Message -----
> I'm trying to use the clasic CGI environment varable PATH_TRANSLATED via
> Apache's Action directive (directing all requests through a script).
> 
> But PHP messes PATH_TRANSLATED up and all I end up with a copy of
> SCRIPT_FILENAME !
> 
> I'm using PHP 4.0.3pl1 on a standard Debian 2.2r2 installation with Apache
> httpd 1.3.9 with these directives in httpd.conf:
>     Options +MultiViews
>     Action  text/html /script.php
> 
> A resuest for "/index" should result in:
>     PATH_TRANSLATED = /path/to/index.html
>     PATH_TRANSLATED = /path/to/index.en.html (for the English version)
>     PATH_TRANSLATED = /path/to/index.X.html (for the X version)
> 
> BUT what I get is:
>     PATH_TRANSLATED = /path/to/script.php (no matter what i request !)
> 
> Can anyone help me getting the real Apache PATH_TRANSLATED (which is actualy
> shown in phpinfo() under "Apache Environment" but not under "PHP Variables")
> 
> 
> Yours hopefully
> Heino H. Gehlsen






I wonder if it's possible to adapt the CGI version of PHP as a Netscape
plugin, or to  associate the extension of php files to some kind of php
wrapper.  This would require distributing a browser with the CD for this
specific CD, but it could work.

For a Unix-only kludge, I found this page, 
 http://home.netscape.com/newsref/std/x-remote.html
It seems to me, by playing with with the application associations, one
could get php to write to a temporary file, and then use netscape's 
-remote openFile to read it.  I imagine, though, that if this works, it
would be rather unstable.

MySQL would be a whole 'nother can of worms.

Just playing with ideas. 

[EMAIL PROTECTED]
http://www.artwells.com/
That which indicates nothing
introduces everything.

On Fri, 19 Jan 2001, Philip Apostol wrote:

> Can I run a PHP/Apache/MySQL services on a CD-ROM.  We have PHP scripts that
> handle queries on a large database.  We would like to distribute it on a
> CD-ROM so they could access the database offline.  Is it possible? Or are
> there any similar solutions for this?  Im thinking of a text-file database
> and access it via javascript but have no much time to study on this.  If php
> can be run on the cd-rom, that would be a better solution.   But any
> solution you posted here will be highly appreciated.  Thanks in advance.
> 
> Philip
> 
> 





I would use thttpd with php support compiled in, rather than a browser.
That way you could use whatever the browser on the users system was- more comfortable 
for the user.

difficulty is what port to run the server at (well, one of the difficulties...) but 
you could search for an unused unpriviliged port number.

Easiest thing to do would be to use /tmp on the users system (is there a Windows 
equivalent? I honestly don't know) for the doc root etc. and then have the users 
browser look at http://127.0.0.1:10185/index.php (or whatever).

I don't know if thttpd builds on windows, but i imagine I could get this working on 
linux in under a day.
Database is a totally different story- I'd just go flat file, if I needed one.

On Friday, January 19, 2001, at 10:38 AM, <[EMAIL PROTECTED]> wrote:

> I wonder if it's possible to adapt the CGI version of PHP as a Netscape 
> plugin, or to  associate the extension of php files to some kind of php 
> wrapper.  This would require distributing a browser with the CD for this 
> specific CD, but it could work. 
>  
> For a Unix-only kludge, I found this page,  
>  http://home.netscape.com/newsref/std/x-remote.html 
> It seems to me, by playing with with the application associations, one 
> could get php to write to a temporary file, and then use netscape's  
> -remote openFile to read it.  I imagine, though, that if this works, it 
> would be rather unstable. 
>  
> MySQL would be a whole 'nother can of worms. 
>  
> Just playing with ideas.  
>  
> [EMAIL PROTECTED] 
> http://www.artwells.com/ 
> That which indicates nothing 
> introduces everything. 
>  
> On Fri, 19 Jan 2001, Philip Apostol wrote: 
>  
> > Can I run a PHP/Apache/MySQL services on a CD-ROM.  We have PHP scripts that 
> > handle queries on a large database.  We would like to distribute it on a 
> > CD-ROM so they could access the database offline.  Is it possible? Or are 
> > there any similar solutions for this?  Im thinking of a text-file database 
> > and access it via javascript but have no much time to study on this.  If php 
> > can be run on the cd-rom, that would be a better solution.   But any 
> > solution you posted here will be highly appreciated.  Thanks in advance. 
> >  
> > Philip 
> >  
> >  
>  
>  
> --  
> PHP General Mailing List (http://www.php.net/) 
> To unsubscribe, e-mail: [EMAIL PROTECTED] 
> For additional commands, e-mail: [EMAIL PROTECTED] 
> To contact the list administrators, e-mail: [EMAIL PROTECTED] 
>  
>  

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Michael A. Peters
Abriasoft Senior Developer

(510)  623-9726x357
Fax: (510) 249-9125




Aditionally you could create a ram disk with you php stuff, mount that in 
/tmp/whatever read-write- and use that for your thttpd document root. May require root 
access to mount the ramdisk, though.

On Friday, January 19, 2001, at 03:12 PM, Michael A. Peters wrote:

> I would use thttpd with php support compiled in, rather than a browser. 
> That way you could use whatever the browser on the users system was- more 
>comfortable for 
> the user. 
>  
> difficulty is what port to run the server at (well, one of the difficulties...) but 
>you 
> could search for an unused unpriviliged port number. 
>  
> Easiest thing to do would be to use /tmp on the users system (is there a Windows 
>equivalent? I 
> honestly don't know) for the doc root etc. and then have the users browser look at 
> http://127.0.0.1:10185/index.php (or whatever). 
>  
> I don't know if thttpd builds on windows, but i imagine I could get this working on 
>linux in 
> under a day. 
> Database is a totally different story- I'd just go flat file, if I needed one. 
>  
> On Friday, January 19, 2001, at 10:38 AM, <[EMAIL PROTECTED]> wrote: 
>  
> > I wonder if it's possible to adapt the CGI version of PHP as a Netscape  
> > plugin, or to  associate the extension of php files to some kind of php  
> > wrapper.  This would require distributing a browser with the CD for this  
> > specific CD, but it could work.  
> >   
> > For a Unix-only kludge, I found this page,   
> >  http://home.netscape.com/newsref/std/x-remote.html  
> > It seems to me, by playing with with the application associations, one  
> > could get php to write to a temporary file, and then use netscape's   
> > -remote openFile to read it.  I imagine, though, that if this works, it  
> > would be rather unstable.  
> >   
> > MySQL would be a whole 'nother can of worms.  
> >   
> > Just playing with ideas.   
> >   
> > [EMAIL PROTECTED]  
> > http://www.artwells.com/  
> > That which indicates nothing  
> > introduces everything.  
> >   
> > On Fri, 19 Jan 2001, Philip Apostol wrote:  
> >   
> > > Can I run a PHP/Apache/MySQL services on a CD-ROM.  We have PHP scripts that  
> > > handle queries on a large database.  We would like to distribute it on a  
> > > CD-ROM so they could access the database offline.  Is it possible? Or are  
> > > there any similar solutions for this?  Im thinking of a text-file database  
> > > and access it via javascript but have no much time to study on this.  If php  
> > > can be run on the cd-rom, that would be a better solution.   But any  
> > > solution you posted here will be highly appreciated.  Thanks in advance.  
> > >   
> > > Philip  
> > >   
> > >   
> >   
> >   
> > --   
> > PHP General Mailing List (http://www.php.net/)  
> > To unsubscribe, e-mail: [EMAIL PROTECTED]  
> > For additional commands, e-mail: [EMAIL PROTECTED]  
> > To contact the list administrators, e-mail: [EMAIL PROTECTED]  
> >   
> >   
>  
> -=-=-=-=-=-=-=-=-=-=-=-=-=-=- 
> Michael A. Peters 
> Abriasoft Senior Developer 
>  
> (510)  623-9726x357 
> Fax: (510) 249-9125 
> --  
> PHP General Mailing List (http://www.php.net/) 
> To unsubscribe, e-mail: [EMAIL PROTECTED] 
> For additional commands, e-mail: [EMAIL PROTECTED] 
> To contact the list administrators, e-mail: [EMAIL PROTECTED] 
>  
>  

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Michael A. Peters
Abriasoft Senior Developer

(510)  623-9726x357
Fax: (510) 249-9125




ok so i set up a multidimensional array with the following code:

<?PHP
// departments.inc
//
// This file defines the switches. All the forms, and return displays are
// based on this table (multidimential array). The first index is the 
switch number,
// then each department has three proporties.
// 1, Can the website use this depatement?
// 2, Can this department be used in the admin pages?
// 3, Its name.

// The idea being when you want to introduce a new department you can turn
// it on for admin editing, make sure enough stories, vendors, 
events, were related,
// then open it to the public a few weeks later.

$departments = array ("s1" => array("On", "On", "The Seybold Report"),
"s2" => array("On", "On", "Publishing Systems"),
"s3" => array("On", "On", "Internet Publishing"),
"s4" => array("On", "On", "The Bulletin"),
"s5" => array("Off", "Off", ""),
"s6" => array("Off", "Off", ""),
"s7" => array("Off", "Off", ""),
"s8" => array("Off", "Off", ""),
"s9" => array("On", "On", "Broadband"),
"s10" => array("On", "On", "Business"),
"s11" => array("On", "On", "Color Management & Proofing"),
"s12" => array("On", "On", "Content & Asset Management"),
"s13" => array("On", "On", "CTP & On-press Imaging"),
"s14" => array("On", "On", "Digital Presses & Variable Data"),
"s15" => array("On", "On", "Digital Rights Management"),
"s16" => array("On", "On", "E-Books"),
"s17" => array("On", "On", "Personalization"),
"s18" => array("On", "On", "Print Workflow"),
"s19" => array("On", "On", "Standards"),
"s20" => array("On", "On", "Wireless"),
"s21" => array("Off", "Off", ""),
"s22" => array("Off", "Off", ""),
"s23" => array("Off", "Off", ""),
"s24" => array("Off", "Off", ""),
"s25" => array("Off", "Off", ""),
"s26" => array("Off", "Off", ""),
"s27" => array("Off", "Off", ""),
"s28" => array("Off", "Off", ""),
"s29" => array("Off", "Off", ""),
"s30" => array("Off", "Off", ""),
"s31" => array("Off", "Off", ""),
"s32" => array("Off", "Off", ""),
"s33" => array("Off", "Off", ""),
"s34" => array("Off", "Off", ""),
"s35" => array("Off", "Off", ""),
"s36" => array("Off", "Off", ""),
"s37" => array("Off", "Off", ""),
"s38" => array("Off", "Off", ""),
"s39" => array("Off", "Off", ""),
"s40" => array("Off", "Off", "")
);

?>

Now I am creating forms and tables and need to retrieve this info I'd 
like to say something like:

if switch s23 is availbe to the admin pages do this, else do that.

and

echo switch 34's name

Little help?

Mike





On Fri, 19 Jan 2001, Michael Zornek wrote:

> ok so i set up a multidimensional array with the following code:
> 
> <?PHP
> // departments.inc
> //
> // This file defines the switches. All the forms, and return displays are
> // based on this table (multidimential array). The first index is the 
> switch number,
> // then each department has three proporties.
> // 1, Can the website use this depatement?
> // 2, Can this department be used in the admin pages?
> // 3, Its name.

> $departments = array ("s1" => array("On", "On", "The Seybold Report"),
> "s2" => array("On", "On", "Publishing Systems"),
> "s3" => array("On", "On", "Internet Publishing"),
> "s4" => array("On", "On", "The Bulletin"),
> "s5" => array("Off", "Off", ""),

(snip)

> Now I am creating forms and tables and need to retrieve this info I'd 
> like to say something like:
> 
> if switch s23 is availbe to the admin pages do this, else do that.

if ($departments['s23'][1] == 'On')
        // This department can be used in the admin pages
else
        // Not

> echo switch 34's name

echo $departments['s34'][2]

If you wanted to make the code a bit more intuitive, you could reconstruct
the array to have string keys:

$departments = Array(
        's1' => Array('live' => 1, 'admin' => 1, 'name' => "Dept's Name"),
        's2' => Array('live' => 0, 'admin' => 1, 'name' => ''),
        and so on
);

At this point, you can simply check if a department is live or admin
available with a boolean, and later on people who look at the code won't
have to wonder what the array field $departments['s23'][1] contains.

if ($departments['s23']['admin'])
        // This department can be used in the admin pages
else
        // Not

echo $departments['s34']['name']

Matt






On Fri, 19 Jan 2001, Michael Zornek wrote:

> ok so i set up a multidimensional array with the following code:
>
> <?PHP
> // departments.inc
> //
> // This file defines the switches. All the forms, and return displays are
> // based on this table (multidimential array). The first index is the
> switch number,
> // then each department has three proporties.
> // 1, Can the website use this depatement?
> // 2, Can this department be used in the admin pages?
> // 3, Its name.
>
> // The idea being when you want to introduce a new department you can turn
> // it on for admin editing, make sure enough stories, vendors,
> events, were related,
> // then open it to the public a few weeks later.
>
> $departments = array ("s1" => array("On", "On", "The Seybold Report"),
> "s2" => array("On", "On", "Publishing Systems"),
> "s3" => array("On", "On", "Internet Publishing"),
> "s4" => array("On", "On", "The Bulletin"),
> "s5" => array("Off", "Off", ""),
> "s6" => array("Off", "Off", ""),
> "s7" => array("Off", "Off", ""),
> "s8" => array("Off", "Off", ""),
> "s9" => array("On", "On", "Broadband"),
> "s10" => array("On", "On", "Business"),
> "s11" => array("On", "On", "Color Management & Proofing"),
> "s12" => array("On", "On", "Content & Asset Management"),
> "s13" => array("On", "On", "CTP & On-press Imaging"),
> "s14" => array("On", "On", "Digital Presses & Variable Data"),
> "s15" => array("On", "On", "Digital Rights Management"),
> "s16" => array("On", "On", "E-Books"),
> "s17" => array("On", "On", "Personalization"),
> "s18" => array("On", "On", "Print Workflow"),
> "s19" => array("On", "On", "Standards"),
> "s20" => array("On", "On", "Wireless"),
> "s21" => array("Off", "Off", ""),
> "s22" => array("Off", "Off", ""),
> "s23" => array("Off", "Off", ""),
> "s24" => array("Off", "Off", ""),
> "s25" => array("Off", "Off", ""),
> "s26" => array("Off", "Off", ""),
> "s27" => array("Off", "Off", ""),
> "s28" => array("Off", "Off", ""),
> "s29" => array("Off", "Off", ""),
> "s30" => array("Off", "Off", ""),
> "s31" => array("Off", "Off", ""),
> "s32" => array("Off", "Off", ""),
> "s33" => array("Off", "Off", ""),
> "s34" => array("Off", "Off", ""),
> "s35" => array("Off", "Off", ""),
> "s36" => array("Off", "Off", ""),
> "s37" => array("Off", "Off", ""),
> "s38" => array("Off", "Off", ""),
> "s39" => array("Off", "Off", ""),
> "s40" => array("Off", "Off", "")
> );
>
> ?>
>
> Now I am creating forms and tables and need to retrieve this info I'd
> like to say something like:
>
> if switch s23 is availbe to the admin pages do this, else do that.

if ($departments["s23"][1]=="On")
{
 ...
}
else
{
 ...
};

>
> and
>
> echo switch 34's name

echo $departments["s34"][2];

>
> Little help?
>
> Mike
>

-- 
Ignacio Vazquez-Abrams  <[EMAIL PROTECTED]>





I always call unset before destroy. Worked fine when I had problems with
destroy.

<?
session_unset(); // Unset global variables in session before destroy
session_destroy();
?>

/Håkan


Brandon Orther <[EMAIL PROTECTED]> skrev i
diskussionsgruppsmeddelandet:CKEMJEADMOCEHPHJKLPAGEGLCDAA.brandon@webintelle
cts.com...
> Hello Everyone,
>
> Can someone please give me example code on how to use session_destroy
> because I can not get it to work.  Also if you have an example for
> gc_probability I would love that too. Thank You :)
>
> Thank you,
>
> --------------------------------------------
> Brandon Orther
> WebIntellects Design/Development Manager
> [EMAIL PROTECTED]
> 800-994-6364
> www.webintellects.com
> --------------------------------------------
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>






Hi,

I`m trying to setup a little profanity filter for a client of mine just 
wondered if anyone could offer some advice on how best to handle it. I was 
thinking of going along these lines...

$filter="moron";

if($Name==$filter)
{
printf...Javascript you can`t use that etc
}

Name is passed from a form, the problem is there are going to be quite a few 
words, so how is the best way to store these words. Something like this??

$filter="moron idiot pratt"

And if $Name was sent through as "moron pratt" would it still pick it up??

TIA for any help

Ade




On Fri, 19 Jan 2001 [EMAIL PROTECTED] wrote:

> Hi,
>
> I`m trying to setup a little profanity filter for a client of mine just
> wondered if anyone could offer some advice on how best to handle it. I was
> thinking of going along these lines...
>
> $filter="moron";
>
> if($Name==$filter)
> {
> printf...Javascript you can`t use that etc
> }
>
> Name is passed from a form, the problem is there are going to be quite a few
> words, so how is the best way to store these words. Something like this??
>
> $filter="moron idiot pratt"
>
> And if $Name was sent through as "moron pratt" would it still pick it up??
>
> TIA for any help
>
> Ade
>

Use a database for the words and say "SELECT 1 WHERE LOWERCASE('$name') LIKE
'%'+word+'%'" and count how many rows are returned. No need to re-invent the
wheel.

-- 
Ignacio Vazquez-Abrams  <[EMAIL PROTECTED]>





In a message dated 19/01/2001 19:03:13 GMT Standard Time, 
[EMAIL PROTECTED] writes:

<< Use a database for the words and say "SELECT 1 WHERE LOWERCASE('$name') 
LIKE
 '%'+word+'%'" and count how many rows are returned. No need to re-invent the
 wheel.
 
 -- 
 Ignacio Vazquez-Abrams >>


Yeah problem is he has no database support from his host

Ade




On Fri, 19 Jan 2001 [EMAIL PROTECTED] wrote:

> In a message dated 19/01/2001 19:03:13 GMT Standard Time,
> [EMAIL PROTECTED] writes:
>
> << Use a database for the words and say "SELECT 1 WHERE LOWERCASE('$name')
> LIKE
>  '%'+word+'%'" and count how many rows are returned. No need to re-invent the
>  wheel.
>
>  --
>  Ignacio Vazquez-Abrams >>
>
>
> Yeah problem is he has no database support from his host
>
> Ade
>

Ouch. All is not lost, however:

$words=Array(
 "f***",
 "s***",
  ...
); // Or use file() to read them from a file.

 ...

$done=false;
while ((list($key, $val)=each($words)) and $done===false)
{
  $done=strpos(strtolower($name), $val);
};
if ($done!==false)
{
  // Oops! Bad name.
}
else
{
  // Okay, valid name.
};

-- 
Ignacio Vazquez-Abrams  <[EMAIL PROTECTED]>







why use a DB?

just create an array of dirty words then loop your input thru it with a
regex.

DanO


-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Friday, January 19, 2001 11:09 AM
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] Profanity Filter


In a message dated 19/01/2001 19:03:13 GMT Standard Time,
[EMAIL PROTECTED] writes:

<< Use a database for the words and say "SELECT 1 WHERE LOWERCASE('$name')
LIKE
 '%'+word+'%'" and count how many rows are returned. No need to re-invent
the
 wheel.

 --
 Ignacio Vazquez-Abrams >>


Yeah problem is he has no database support from his host

Ade

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]






Hi

Perhaps you could write to a flat test file, have your script read from
that. Then I would create an on-line interface for the client so he can
write to/delete from the list. He then would have control of it.

Todd

From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: January 19, 2001 3:09 PM
Subject: Re: [PHP] Profanity Filter


> In a message dated 19/01/2001 19:03:13 GMT Standard Time,
> [EMAIL PROTECTED] writes:
>
> << Use a database for the words and say "SELECT 1 WHERE LOWERCASE('$name')
> LIKE
>  '%'+word+'%'" and count how many rows are returned. No need to re-invent
the
>  wheel.
>
>  --
>  Ignacio Vazquez-Abrams >>
>
>
> Yeah problem is he has no database support from his host
>
> Ade
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>





text file that is..oops!


----- Original Message -----
From: "Todd H MacPherson" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: January 19, 2001 3:23 PM
Subject: Re: [PHP] Profanity Filter


>
> Hi
>
> Perhaps you could write to a flat test file, have your script read from
> that. Then I would create an on-line interface for the client so he can
> write to/delete from the list. He then would have control of it.
>
> Todd
>
> From: <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Cc: <[EMAIL PROTECTED]>
> Sent: January 19, 2001 3:09 PM
> Subject: Re: [PHP] Profanity Filter
>
>
> > In a message dated 19/01/2001 19:03:13 GMT Standard Time,
> > [EMAIL PROTECTED] writes:
> >
> > << Use a database for the words and say "SELECT 1 WHERE
LOWERCASE('$name')
> > LIKE
> >  '%'+word+'%'" and count how many rows are returned. No need to
re-invent
> the
> >  wheel.
> >
> >  --
> >  Ignacio Vazquez-Abrams >>
> >
> >
> > Yeah problem is he has no database support from his host
> >
> > Ade
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> > To contact the list administrators, e-mail: [EMAIL PROTECTED]
> >
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>






> > In a message dated 19/01/2001 19:03:13 GMT Standard Time,
> > [EMAIL PROTECTED] writes:
> >
> > << Use a database for the words and say "SELECT 1 WHERE
LOWERCASE('$name')
> > LIKE
> >  '%'+word+'%'" and count how many rows are returned. No need to
re-invent the
> >  wheel.
> >
> >  --
> >  Ignacio Vazquez-Abrams >>
> >
> >
> > Yeah problem is he has no database support from his host
> >
> > Ade
> >
>
> Ouch. All is not lost, however:
>
> $words=Array(
>  "f***",
>  "s***",
>   ...
> ); // Or use file() to read them from a file.
>
>  ...
>
> $done=false;
> while ((list($key, $val)=each($words)) and $done===false)
> {
>   $done=strpos(strtolower($name), $val);
> };
> if ($done!==false)
> {
>   // Oops! Bad name.
> }
> else
> {
>   // Okay, valid name.
> };
>

all that code, well, geez.   why not store the words in a file, space
delimited, then:

if (preg_match("/" . implode(" ", file($prof_file)) . "/i", $text)) {
    print("Naughty man");
} else {
    print("Well, fuck, you're curse free!  Congrats...");
}

Or just store it in a string and omit the implode and file() function calls
(I'd prefer placing it in a file for easy addition of new curses)...


If you go with the other method (described by Ignacio), see the in_array()
function, which saves you the trouble of looping...

-Sterling





On Fri, 19 Jan 2001, DanO wrote:

>
> why use a DB?
>
> just create an array of dirty words then loop your input thru it with a
> regex.
>
> DanO
>

Because a DB would probably be faster than creating an array and looping
through it with a regex.

-- 
Ignacio Vazquez-Abrams  <[EMAIL PROTECTED]>





On Fri, 19 Jan 2001, Sterling Hughes wrote:

> If you go with the other method (described by Ignacio), see the in_array()
> function, which saves you the trouble of looping...
>
> -Sterling
>

I thought about in_array(), but then I realized that the comparison has to go
the OTHER way :)

-- 
Ignacio Vazquez-Abrams  <[EMAIL PROTECTED]>





On Fri, 19 Jan 2001 14:21:50 -0500 (EST), Ignacio Vazquez-Abrams
<[EMAIL PROTECTED]> wrote:

>>> Use a database for the words and say "SELECT 1 WHERE LOWERCASE('$name')

>> Yeah problem is he has no database support from his host

> Ouch. All is not lost, however:
>
> $words=Array(
> "f***",
> "s***",
>  ...

With a dictionary approach you would exhaust yourself trying to catch
all the combinations of words like goodf***, f***mehard, and so on.

A regular expression solution is needed.

Egan






On Fri, 19 Jan 2001, Egan wrote:

> On Fri, 19 Jan 2001 14:21:50 -0500 (EST), Ignacio Vazquez-Abrams
> <[EMAIL PROTECTED]> wrote:
>
> >>> Use a database for the words and say "SELECT 1 WHERE LOWERCASE('$name')
>
> >> Yeah problem is he has no database support from his host
>
> > Ouch. All is not lost, however:
> >
> > $words=Array(
> > "f***",
> > "s***",
> >  ...
>
> With a dictionary approach you would exhaust yourself trying to catch
> all the combinations of words like goodf***, f***mehard, and so on.
>
> A regular expression solution is needed.
>
> Egan
>

Check the code again. I'm not doing a dictionary approach.

-- 
Ignacio Vazquez-Abrams  <[EMAIL PROTECTED]>





> On Fri, 19 Jan 2001, DanO wrote:
>
> >
> > why use a DB?
> >
> > just create an array of dirty words then loop your input thru it with a
> > regex.
> >
> > DanO
> >
>
> Because a DB would probably be faster than creating an array and looping
> through it with a regex.
>

Not really, a db would be slower....

the advantage to a db is ease of storage, ease of use and improved speed for
*larger* scale applications, for an application as simple as the poster is
describing, a db would be fine, but so would a text file.  I don't like
arrays, because then it requires a programmer to add dirty word...

-sterling





On Fri, 19 Jan 2001 14:34:08 -0500 (EST), Ignacio Vazquez-Abrams
<[EMAIL PROTECTED]> wrote:

>Check the code again. I'm not doing a dictionary approach.

Sorry, guess my speed reading got a little too fast. :-)

Egan







> On Fri, 19 Jan 2001, Sterling Hughes wrote:
>
> > If you go with the other method (described by Ignacio), see the
in_array()
> > function, which saves you the trouble of looping...
> >
> > -Sterling
> >
>
> I thought about in_array(), but then I realized that the comparison has to
go
> the OTHER way :)
>

I'm saying use the same method, but use an array and avoid the strpos()
function:

$words = preg_split("//", $data);
foreach ($words as $word) {
    if (in_array($prof, $words)) {
        echo "BAD WORD";
        echo "BAD WORD";
        echo "I'M TELLING";
    }
}

-Sterling





On Fri, 19 Jan 2001, Sterling Hughes wrote:

> I'm saying use the same method, but use an array and avoid the strpos()
> function:
>
> $words = preg_split("//", $data);
> foreach ($words as $word) {
>     if (in_array($prof, $words)) {
>         echo "BAD WORD";
>         echo "BAD WORD";
>         echo "I'M TELLING";
>     }
> }
>
> -Sterling
>

That method suffers from the dictionary problem that Egan brought up.

-- 
Ignacio Vazquez-Abrams  <[EMAIL PROTECTED]>






On Fri, 19 Jan 2001, Ignacio Vazquez-Abrams wrote:

> On Fri, 19 Jan 2001, Sterling Hughes wrote:
>
> > I'm saying use the same method, but use an array and avoid the strpos()
> > function:
> >
> > $words = preg_split("//", $data);
> > foreach ($words as $word) {
> >     if (in_array($prof, $words)) {
> >         echo "BAD WORD";
> >         echo "BAD WORD";
> >         echo "I'M TELLING";
> >     }
> > }
> >
> > -Sterling
> >
>
> That method suffers from the dictionary problem that Egan brought up.
>

Hey, wait a second...

Does that code even make sense? I must be missing something...

-- 
Ignacio Vazquez-Abrams  <[EMAIL PROTECTED]>







> On Fri, 19 Jan 2001, Ignacio Vazquez-Abrams wrote:
>
> > On Fri, 19 Jan 2001, Sterling Hughes wrote:
> >
> > > I'm saying use the same method, but use an array and avoid the
strpos()
> > > function:
> > >
> > > $words = preg_split("//", $data);
> > > foreach ($words as $word) {
> > >     if (in_array($prof, $words)) {
> > >         echo "BAD WORD";
> > >         echo "BAD WORD";
> > >         echo "I'M TELLING";
> > >     }
> > > }
> > >
> > > -Sterling
> > >
> >
> > That method suffers from the dictionary problem that Egan brought up.
> >
>
> Hey, wait a second...
>
> Does that code even make sense? I must be missing something...
>
> --

well if you have a concussion... :)

Its a whip up of what I was talking about, I didn't mean it as real code
:)...   Switch $words to $word and then swith the argument order to in_array
and yes, it makes sense...

<?php
$profanities = array("fuck", "shit");

$words = preg_split("/\s+/", $data);
foreach ($words as $word) {
    if (in_array($word, $profanities)) {
        echo "you did a naughty thing";
        break;
    }
}
?>


Would be the somewhat sane version...

_Sterling





On Fri, 19 Jan 2001, Sterling Hughes wrote:

> Its a whip up of what I was talking about, I didn't mean it as real code
> :)...   Switch $words to $word and then swith the argument order to in_array
> and yes, it makes sense...
>
> <?php
> $profanities = array("fuck", "shit");
>
> $words = preg_split("/\s+/", $data);
> foreach ($words as $word) {
>     if (in_array($word, $profanities)) {
>         echo "you did a naughty thing";
>         break;
>     }
> }
> ?>
>
>
> Would be the somewhat sane version...
>
> _Sterling
>

It still suffers from failing on "goodf***" and "eats***anddie" because of
the lack of spaces. That's why I had to use strpos().

-- 
Ignacio Vazquez-Abrams  <[EMAIL PROTECTED]>









> On Fri, 19 Jan 2001, Sterling Hughes wrote:
>
> > Its a whip up of what I was talking about, I didn't mean it as real code
> > :)...   Switch $words to $word and then swith the argument order to
in_array
> > and yes, it makes sense...
> >
> > <?php
> > $profanities = array("fuck", "shit");
> >
> > $words = preg_split("/\s+/", $data);
> > foreach ($words as $word) {
> >     if (in_array($word, $profanities)) {
> >         echo "you did a naughty thing";
> >         break;
> >     }
> > }
> > ?>
> >
> >
> > Would be the somewhat sane version...
> >
> > _Sterling
> >
>
> It still suffers from failing on "goodf***" and "eats***anddie" because of
> the lack of spaces. That's why I had to use strpos().
>

true it does take em away, that's why I suggest preg_match as the optimal
choice...  I happen to strongly dislike the strpos() function when used for
more than:

strpos($str, ":");

ie, one character searches...

-Sterling








> On Fri, 19 Jan 2001, Sterling Hughes wrote:
>
> > Its a whip up of what I was talking about, I didn't mean it as real code
> > :)...   Switch $words to $word and then swith the argument order to
in_array
> > and yes, it makes sense...
> >
> > <?php
> > $profanities = array("fuck", "shit");
> >
> > $words = preg_split("/\s+/", $data);
> > foreach ($words as $word) {
> >     if (in_array($word, $profanities)) {
> >         echo "you did a naughty thing";
> >         break;
> >     }
> > }
> > ?>
> >
> >
> > Would be the somewhat sane version...
> >
> > _Sterling
> >
>
> It still suffers from failing on "goodf***" and "eats***anddie" because of
> the lack of spaces. That's why I had to use strpos().
>

true it does take em away, that's why I suggest preg_match as the optimal
choice...  I happen to strongly dislike the strpos() function when used for
more than:

strpos($str, ":");

ie, one character searches...

-Sterling





On Fri, 19 Jan 2001, Sterling Hughes wrote:

> true it does take em away, that's why I suggest preg_match as the optimal
> choice...  I happen to strongly dislike the strpos() function when used for
> more than:
>
> strpos($str, ":");
>
> ie, one character searches...
>
> -Sterling
>

Huh? Whu? Okay, now I'm confused. What do you mean by "take em away"?

BTW, I dug through the PHP source, and strpos() with any length search is as
efficient as the underlying system's memcmp() implementation. It doesn't do
any special cases for single-character searches.

-- 
Ignacio Vazquez-Abrams  <[EMAIL PROTECTED]>





I'd make it an array:

$filter = array(moron, idiot, pratt);

foreach($filter as $badword) {
 if (strstr($name, $badword)) {
  do this if it contains one of the bad words
 }
 else {
  do this if it doesn't
 }
}





> I don't like
> arrays, because then it requires a programmer to add dirty word...

You could probably make an addbadwords.php that loads the
filterbadwords.php, does some stupid PHP tricks(tm) to find the line that
defines the array, then writes the filterbadwords.php back out with the new
words added to the array... I did something similar with a news adder script
for wheezebucket.com.





When I create a pdf with the cpdf functions my text keeps going off the edge
of the page.  How do I make it wrap to the next line?

Thanks






convert.php
<?
$size_x=1000;
$size_y=1000;
$ECODE=12;

file://$filename='list.txt';
echo "<p style=\"font-family : 'Courier New';font-size : 'x-small'\">";
$id=1;
$i=1;
echo "<h1>?? ?????? $filename ?? ????? ETNA</h1>";
if ($fp=fopen($filename, "r"))
{
  while (!feof($fp))
  {
    $trimmed_line=trim($line=fgets($fp, 80));
    if (strstr($trimmed_line, "Handle"))
    {
      $handle=substr($trimmed_line, 9, 4);
      $trimmed_line=trim($line=fgets($fp, 80));
      if (!strstr($trimmed_line, "from point"))
        $trimmed_line=trim($line=fgets($fp, 80));
      $from_x=trim(substr($trimmed_line, 14, 9));
      $from_y=trim(substr($trimmed_line, 27, 9));
      $trimmed_line=trim($line=fgets($fp, 80));
      if (!strstr($trimmed_line, "to point"))
        $trimmed_line=trim($line=fgets($fp, 80));
      $to_x=trim(substr($trimmed_line, 12, 9));
      $to_y=trim(substr($trimmed_line, 25, 9));
      $pipes[$i][0]=($from_x);
      $pipes[$i++][1]=($from_y);
      $pipes[$i][0]=($to_x);
      $pipes[$i++][1]=($to_y);
      $id++;
    }
  }
}

$nodes=array_values(array_unique($pipes));
for ($i=0;$i<sizeof($nodes);$i++)
{
  $k=$i+1;
  echo "$k,";
  echo $nodes[$i][0];
  echo ",";
  echo $nodes[$i][1];
  echo "/<br>";
}
echo "-1//<br>";
$temp_pipes=$pipes;

$i=sizeof($temp_pipes);
$size=$i;
$pipe_id=1;
while(!empty($temp_pipes))
{
  $current_node=array_shift($temp_pipes);
  reset($nodes);
  while((current($nodes))!=$current_node)
  {next($nodes);}
  $pipes_nodes[$size-$i+1][0]=key($nodes)+1;
  echo ($pipe_id++).",$ECODE,".$pipes_nodes[$size-$i+1][0];

  $current_node=array_shift($temp_pipes);
  reset($nodes);
  while((current($nodes))!=$current_node)
  {next($nodes);}
  $pipes_nodes[$size-$i+1][1]=key($nodes)+1;

  echo ",".$pipes_nodes[$size-$i+1][1]."/<br>";
}
echo "-1//<br>";
if (!isset($pressure_drop_nodes))
{    
    echo "<form action='convert.php' method='post' name='form_convert' id='1'>";
    echo "<TABLE border=0 width='80%'>";
    echo 
"  <TR>";
    echo "      <TD width='30%'>?????? ????? ??????? ??????? ?????
??????:</TD>";
    echo "      <TD width='50%'><INPUT size=50 value=''
name=pressure_drop_nodes></TD>";
    echo "  </TR>";
    echo "  <TR>";
    echo "      <TD width='30%'>&nbsp;</TD>";
    echo "      <TD width='50%'>(?? ?????? ?? ?????????? ?? ?????, ?.?.
'1,2,12,5')</TD>";
    echo "  </TR>";
    echo "  <TR>";
    echo "      <TD width='30%'>?????????????? ??? ??????:</TD>";
    echo "      <TD width='50%'>1,".sizeof($nodes).",1,'ELD','DI',<INPUT
size=4 value='' name=diameter>,'RK',<INPUT size=6 value=''
name=traxitita></TD>";
    echo "  </TR>";
    echo "  <TR>";
    echo "      <TD width='30%'>&nbsp;</TD>";
    echo "      <TD width='50%'>&nbsp;</TD>";
    echo "  </TR>";
    echo "  <TR>";
    echo "      <TD width='30%'></TD>";
    echo "      <TD width='50%'></TD>";
    echo "  </TR>";
    echo "</table>";
    echo "  <INPUT type='Hidden' value='$filename' name='filename'>";
}
// -------------------------------------------------------------------------
----
file://phpinfo();
if (isset($pressure_drop_nodes))
{
    echo "1/<br>";
    $individual_nodes=explode(",", $pressure_drop_nodes);
    for($i=0;$i<sizeof($individual_nodes);$i++)
    {
        echo "$individual_nodes[$i]/<br>";
    }
    echo "-1//<br>";
    echo
"1,".sizeof($nodes).",1,'ELD','DI',".$diameter.",'RK',".$traxitita."/<br>";
}
echo "-1//<br>";
echo "-1/<br>";
echo "-1/<br>";
echo "-1/<br>";
echo "-1/<br>";
echo "1,0/<br>";

if (!isset($pressure_drop_nodes))
{    
    echo "<TABLE border=0 width='80%'>";
    echo "  <TR>";
    echo "      <TD width='30%'>?????? ??????:</TD>";
    echo "      <TD align=right width='50%'></TD>";
    echo "  </TR>";     
    $y=0;
    for($i=0;$i<sizeof($nodes);$i++)
    {
        $y=$i+1;
        echo "  <TR>\n";
        echo "      <TD width='30%'>$y</TD>\n";
        echo "      <TD width='50%' align=right >\n";
        echo "          $y,<INPUT siz
e=4 value='' name=to_node".$y.">,1,'\n";
        echo "          <select name=type".$y.">\n";
        echo "              <option value='PRE' selected>PRE</option>\n";
        echo "              <option value='DIS'>DIS</option>\n";
        echo "          </select>',\n";
        echo "          '<select name=units".$y.">\n";
        echo "              <option value='BAR' selected>BAR</option>\n";
        echo "              <option value='M3H'>M3/H</option>\n";
        echo "          </select>',\n";
        echo "          <INPUT size=4 value='' name=pre_dis".$y.">\n";
        echo "      </TD>\n";
        echo "  </TR>\n";
    }
    echo "  <TR>";
    echo "      <TD width='30%'></TD>";
    echo "      <TD width='50%'><input type='submit' value='Continue'
name='submit'>&nbsp;<input type='Reset'></TD>";
    echo "  </TR>";
    echo "  <INPUT type='Hidden' value='$y' name='no_of_loads'>";
    echo "</table>";
    echo "</form>";
}
else if (isset($pressure_drop_nodes))
{

  for ($i=1;$i<=$no_of_loads;$i++)
  {
    $to_node='to_node'.$i;
    $type='type'.$i;
    $units='units'.$i;
    $value='pre_dis'.$i;
    $to_node =$HTTP_POST_VARS[$to_node];
    $type    =$HTTP_POST_VARS[$type];
    $units   =$HTTP_POST_VARS[$units];
    $value   =$HTTP_POST_VARS[$value];

    if ($type=='PRE')
    {
        if($to_node!='')
        {
            echo "$i, $to_node, $type, $units, $value<br>\n";
            $temp=$to_node;
        }
        else if ($to_node!=='')
        {
            if ($i<=$temp)
            {
              echo "$i, $i, $type, $units, $value<br>\n";
            }
        }
    }
  }

  for ($i=1;$i<=$no_of_loads;$i++)
  {
    $to_node='to_node'.$i;
    $type='type'.$i;
    $units='units'.$i;
    $value='pre_dis'.$i;
    $to_node =$HTTP_POST_VARS[$to_node];
    $type    =$HTTP_POST_VARS[$type];
    $units   =$HTTP_POST_VARS[$units];
    $value   =$HTTP_POST_VARS[$value];

    if ($type=='DIS')
    {
        if($to_node!='')
        {
            echo "$i, $to_node, $type, $units, $value<br>\n";
            $temp=$to_node;
        }
        else if ($to_node!=='')
        {
            if ($i<=$temp)
            {
              echo "$i, $i, $type, $units, $value<br>\n";
            }
        }
     }
  }

}


echo "-1/<br>";
echo "-1/<br>";
echo "-1/<br>";

for ($i=1;$i<=sizeof($nodes);$i++)
{
  $temp1[2*($i-1)]=$nodes[$i][0];
  $temp2[2*($i-1)]=$nodes[$i][1];
}
$merged=array_merge($temp1, $temp2);
$max=max($merged);
$min=min($merged);
$points=$pipes;
for ($i=1;$i<=sizeof($points);$i++)
{
  $points[$i][0]=floor( ($points[$i][0]*($size_x-10)/$max) );
  $points[$i][1]=floor( ($points[$i][1]*($size_y-10)/$max) );
}

$point_ids=$nodes;
for ($i=0;$i<sizeof($point_ids);$i++)
{
  $point_ids[$i][0]=floor( ($point_ids[$i][0]*($size_x-10)/$max) );
  $point_ids[$i][1]=floor( ($point_ids[$i][1]*($size_y-10)/$max) );
}


@fclose($fp);

for ($i=1;$i<=sizeof($points);$i++)
{
  $string=$string."&x".$i."=".$points[$i][0]."&y".$i."=".$points[$i][1];
}
for ($i=0;$i<sizeof($point_ids);$i++)
{

$string=$string."&id_x".$i."=".$point_ids[$i][0]."&id_y".$i."=".$point_ids[$
i][1];
}
$string=substr($string,
1)."&size=".sizeof($points)."&size_ids=".sizeof($point_ids);
$string="display.php?".$string."&size_x=".$size_x."&size_y=".$size_y;

echo "<MAP name=\"map\">";
for ($i=0;$i<sizeof($point_ids);$i++)
{
  echo "<AREA coords='".($point_ids[$i][0]+2).",";
  echo ($point_ids[$i][1]+2).",".
($point_ids[$i][0]-2).",".($point_ids[$i][1]-2);
//  echo "' alt=\"".($i+1)."\" href=\"".$i."\">";
echo "' alt=\"".($i+1)."\"
href=\"".$string."&zoom_x=".($point_ids[$i][0])."&zoom_y=".($point_ids[$i][1
])."\">";

}
echo "</MAP>";

echo "<img src='$string' usemap='#map' style='border-color:black'>";
file://echo "<a href='$string' usemap='#map'>link</a>";

display.php
<?
$factor=3.5;

for ($i=1;$i<=$size;$i++)
{
  $x='x'.$i;
  $y='y'.$i;
  $points[$i][0]=$HTTP_GET_VARS[$x];
  $points[$i][1]=$HTTP_GET_VARS[$y];
}

for ($i=0;$i<$size_ids;$i++)
{
  $x='id_x'.$i;
  $y='id_y'.$i;
  $point_ids[$i][0]=$HTTP_GET_VARS[$x];
  $point_ids[$i][1]=$HTTP_GET_VARS[$y];
}

if (isset($zoom_x) && isset($zoom_y))
{
  for($i=0;$i<sizeof($point_ids);$i++)
  {
 $x=($point_ids[$i][0]-($zoom_x-$size_x/2))*$factor-(($size_x/4)*$factor);
 $y=($point_ids[$i][1]-($zoom_y-$size_y/2))*$factor-(($size_y/4)*$factor);
    if ((($x>0)&&($x<$size_x))&&(($y>0)&&($y<$size_y)))
 {
   $n_point_ids[$i][0]=$x;
   $n_point_ids[$i][1]=$y;
 }
 else
 {
   $n_point_ids[$i][0]=-1;
   $n_point_ids[$i][1]=-1;
 }
  }
  for($i=1;$i<=sizeof($points);$i++)
  {
 $x=($points[$i][0]-($zoom_x-$size_x/2))*$factor-(($size_x/4)*$factor);
 $y=($points[$i][1]-($zoom_y-$size_y/2))*$factor-(($size_y/4)*$factor);
    if ((($x>0)&&($x<$size_x))&&(($y>0)&&($y<$size_y)))
 {
   $points[$i][0]=$x;
   $points[$i][1]=$y;
 }
 else
 {
   $points[$i][0]=-1;
   $points[$i][1]=-1;
 }
  }
}

file://Header("Content-type: image/gif");

$im=@imagecreate($size_x, $size_y);
$background_color = ImageColorAllocate ($im, 255, 255, 255);
$orange = ImageColorAllocate($im, 220, 210, 60);
$black  = ImageColorAllocate($im, 0, 0, 0);
$red    = ImageColorAllocate($im, 255, 0, 0);
$green  = ImageColorAllocate($im, 0, 255, 0);

if (!isset($zoom_x))
{
  for ($i=1;$i<=sizeof($points);$i=$i+2)
  {
   imageline($im, $points[$i][0], $points[$i][1], $points[$i+1][0],
$points[$i+1][1], $orange);
    ImageString($im, 7, ($points[$i][0]+$points[$i+1][0])/2-5,
($points[$i][1]+$points[$i+1][1])/2, ($i+1)/2,   $red);
  }
  for ($i=0;$i<sizeof($point_ids);$i++)


    $str=strval($i+1);
    ImageString($im, 7, $point_ids[$i][0]+1,   $point_ids[$i][1]+1,   $str,
$black);
    ImageRectangle($im,$point_ids[$i][0]+2,  $point_ids[$i][1]+2,
$point_ids[$i][0]-2,  $point_ids[$i][1]-2,  $black);
    imagefilltoborder ($im,$point_ids[$i][0],$point_ids[$i][1], $black,
$black);
  }
}
if (isset($zoom_x))
{
  for ($i=1;$i<=sizeof($points);$i=$i+2)
  {
    if(($points[$i][0]>0)&&($points[$i+1][0]>0))
 {
      imageline($im, $points[$i][0], $points[$i][1], $points[$i+1][0],
$points[$i+1][1], $orange);
      ImageString($im, 7, ($points[$i][0]+$points[$i+1][0])/2-5,
($points[$i][1]+$points[$i+1][1])/2, ($i+1)/2,   $red);
    }
  }
  for ($i=0;$i<sizeof($n_point_ids);$i++)


    if($n_point_ids[$i][0]>0)
 {
      $str=strval($i+1);
      ImageString($im, 7, $n_point_ids[$i][0]+1,   $n_point_ids[$i][1]+1,
$str,   $black);
      ImageRectangle($im,$n_point_ids[$i][0]+5,  $n_point_ids[$i][1]+5,
$n_point_ids[$i][0]-5,  $n_point_ids[$i][1]-5,  $black);
      file://imagefilltoborder ($im,$n_point_ids[$i][0],$n_point_ids[$i][1],
$black, $black);
 }
  }
}
Imagepng($im);
Imagepng($im, "map.png");
?>
?>
> > I create from the array the image from the network.When the txt file is
> > >21Kb there is no image, else all works perfect{with a smaller txt
file).I
> > am using php4,apache(sometimes my system hangs with this server) or OMNI
> > httpd(works fine).
> > If anybody know sth PLEASE HELP ME
> > I am newbie in php programming







I tried this, but it didn't work.  I need the value inside the form still
because the value of the select will be written to an array that gets passed
to the next page (as hidden inputs), which will in turn be compiled into a
value list for a db query.  I tried making the name of  the select be the
array posistion (value[7] in this case), but when I changed values, IE
errored and said that value.7 isn't an object.  If I don't change the
option, ie, I use the default select value, the code works.  But as soon as
I change the option, IE gives me an error and can't change the value.  Would
this work: make the onChange event trigger a page refresh to set the form
values?  Or will that simply draw the page again?  Thanks.

Here is the code I'm using...all of the php variables have values that work,
the problem is in changing the value of the select
-----BEGIN--------
<script>
<!--
function changeValue(newValue) {
document.addstuff.value[7].value = newValue;
}
file://-->
</script>

echo "<td colspan=\"$numfields\"> Select which location you want this to
apply to.<br><select name=\"pickloc\"
onChange=\"changeValue(this.options[this.selectedIndex].value);\">";

 $i=0;

 while ($locidval = mysql_fetch_object($locinfo)){
      echo "<option value=\"$locidval->LocationID\">Location:
$locidval->Area</option><br>\n";
 }//end while

 echo "</td></select><input type=\"hidden\"
name=\"value[$locidnum]\"></tr><tr>\n";

------END-----------


> just write a js function like:
>
> --cut here--
>
> <script>
> <!--
> function changeValue(newValue) {
> document.formname.inputNameToChange.value = newValue;
>
> file://here is alert to show you the thingy
> alert(document.formname.inputNameToChange.value);
> }
> file://-->
> </script>
>
> <form name=formname>
> <input type=hidden name=inputNameToChange>
> <select onChange="changeValue(this.options[this.selectedIndex].value);">
> <option value=value1>label1
> <option value=value2>label2
> </select>
> </form>
>
> --end cutting--
>
> DanO (javascript is your friend, not your enemy!)
>
>
> -----Original Message-----
> From: Jason Jacobs [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, January 18, 2001 1:33 PM
> To: [EMAIL PROTECTED]
> Subject: [PHP] question (as if anything else would be in an email to the
> list...)
>
>
> Hi again.  I have a new problem.  I have a form with a drop down list.
When
> the user chooses something from the list, I need a variable to change
values
> so it can be used upon submission of the form.  I thought maybe I could
> throw a little line of code into an onChange() function in the <select  >
> tag, but I got the MS Debugger thrown up on me.  Anyone got an idea of how
> to do this?  Is it possible to call a javascript function and change the
> variable in there?  Or an easier way (like inline php code...)?  Thanks
>
> Jason





I tried this, but it didn't work.  I need the value inside the form still
because the value of the select will be written to an array that gets passed
to the next page (as hidden inputs), which will in turn be compiled into a
value list for a db query.  I tried making the name of  the select be the
array posistion (value[7] in this case), but when I changed values, IE
errored and said that value.7 isn't an object.  If I don't change the
option, ie, I use the default select value, the code works.  But as soon as
I change the option, IE gives me an error and can't change the value.  Would
this work: make the onChange event trigger a page refresh to set the form
values?  Or will that simply draw the page again?  Thanks.

Here is the code I'm using...all of the php variables have values that work,
the problem is in changing the value of the select
-----BEGIN--------
<script>
<!--
function changeValue(newValue) {
document.addstuff.value[7].value = newValue;
}
file://-->
</script>

echo "<td colspan=\"$numfields\"> Select which location you want this to
apply to.<br><select name=\"pickloc\"
onChange=\"changeValue(this.options[this.selectedIndex].value);\">";

 $i=0;

 while ($locidval = mysql_fetch_object($locinfo)){
      echo "<option value=\"$locidval->LocationID\">Location:
$locidval->Area</option><br>\n";
 }//end while

 echo "</td></select><input type=\"hidden\"
name=\"value[$locidnum]\"></tr><tr>\n";

------END-----------


> just write a js function like:
>
> --cut here--
>
> <script>
> <!--
> function changeValue(newValue) {
> document.formname.inputNameToChange.value = newValue;
>
> file://here is alert to show you the thingy
> alert(document.formname.inputNameToChange.value);
> }
> file://-->
> </script>
>
> <form name=formname>
> <input type=hidden name=inputNameToChange>
> <select onChange="changeValue(this.options[this.selectedIndex].value);">
> <option value=value1>label1
> <option value=value2>label2
> </select>
> </form>
>
> --end cutting--
>
> DanO (javascript is your friend, not your enemy!)
>
>
> -----Original Message-----
> From: Jason Jacobs [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, January 18, 2001 1:33 PM
> To: [EMAIL PROTECTED]
> Subject: [PHP] question (as if anything else would be in an email to the
> list...)
>
>
> Hi again.  I have a new problem.  I have a form with a drop down list.
When
> the user chooses something from the list, I need a variable to change
values
> so it can be used upon submission of the form.  I thought maybe I could
> throw a little line of code into an onChange() function in the <select  >
> tag, but I got the MS Debugger thrown up on me.  Anyone got an idea of how
> to do this?  Is it possible to call a javascript function and change the
> variable in there?  Or an easier way (like inline php code...)?  Thanks
>
> Jason





On Fri, 19 Jan 2001, Jason Jacobs wrote:

> I tried this, but it didn't work.  I need the value inside the form still
> because the value of the select will be written to an array that gets passed
> to the next page (as hidden inputs), which will in turn be compiled into a
> value list for a db query.  I tried making the name of  the select be the
> array posistion (value[7] in this case), but when I changed values, IE
> errored and said that value.7 isn't an object.  If I don't change the
> option, ie, I use the default select value, the code works.  But as soon as
> I change the option, IE gives me an error and can't change the value.  Would
> this work: make the onChange event trigger a page refresh to set the form
> values?  Or will that simply draw the page again?  Thanks.
>
> Here is the code I'm using...all of the php variables have values that work,
> the problem is in changing the value of the select
> -----BEGIN--------
> <script>
> <!--
> function changeValue(newValue) {
> document.addstuff.value[7].value = newValue;

Whoops. Try:

  document.addstuff["value[7]"].value = newValue;

> }
> file://-->
> </script>
>
> echo "<td colspan=\"$numfields\"> Select which location you want this to
> apply to.<br><select name=\"pickloc\"
> onChange=\"changeValue(this.options[this.selectedIndex].value);\">";
>
>  $i=0;
>
>  while ($locidval = mysql_fetch_object($locinfo)){
>       echo "<option value=\"$locidval->LocationID\">Location:
> $locidval->Area</option><br>\n";
>  }//end while
>
>  echo "</td></select><input type=\"hidden\"
> name=\"value[$locidnum]\"></tr><tr>\n";
>
> ------END-----------
>

-- 
Ignacio Vazquez-Abrams  <[EMAIL PROTECTED]>





Why would this work in IE but not NN (4.08)?

If I remove "/" ".mydomain.com" it works with
NN but not IE. Vice versa if I leave it in.

Thanks,
-Brian
***********

<?
if (isset($ecb)) {
    if ($ecb >= 5) {
        $val = 0;
    } else {
        $val = $ecb;
    }
} else {
    $val = 0;
}
setcookie("ecb", $val+1,mktime(12, 00, 00, 12, 31, 2005), "/",
".mydomain.com");
?>





Why would this work in IE but not NN (4.08)?

If I remove "/" ".mydomain.com" it works with
NN but not IE. Vice versa if I leave it in.

Thanks,
-Brian
***********

<? 
if (isset($ecb)) {
    if ($ecb >= 5) {
        $val = 1;
    } else {
        $val = $ecb;
        $val++;
    }
} else {
    $val = 1;
}
$expires = mktime(12, 00, 00, 12, 31, 2005);
setcookie("ecb",$val,$expires,"/",".eastcoastbicycles.com",0);
?>




Hi,

I am working on a site that requires extensive calendar math on it and read
about PHP and using mcal with it.  I tried configuring mcal to work with it
and was wondering if anyone has had any success getting it to work.  I
followed all the steps I could find, but I have no idea how to set up
individual user directories or even if the thing works.  I don't even get
any errors or output.  I make the mcal function calls and... nothing.  If
anyone has any experience with getting this installed and configured, I
would be much appreciated.

thanks,

johnny p.

-----------------------
John Patton, CTO
[EMAIL PROTECTED]

Gameloop, Inc.
http://www.gameloop.com
Austin, TX 512-699-5534






Since you didn't mention it specifically, I thought I should ask:

Did you also download the mcal library or did you only include -with-mcal
when you compiled PHP?

Sam Masiello
Systems Analyst
Chek.Com
(716) 853-1362 x289
[EMAIL PROTECTED]

 -----Original Message-----
From:   johnny p. [mailto:[EMAIL PROTECTED]]
Sent:   Friday, January 19, 2001 3:27 PM
To:     [EMAIL PROTECTED]
Subject:        [PHP] mcal installation

Hi,

I am working on a site that requires extensive calendar math on it and read
about PHP and using mcal with it.  I tried configuring mcal to work with it
and was wondering if anyone has had any success getting it to work.  I
followed all the steps I could find, but I have no idea how to set up
individual user directories or even if the thing works.  I don't even get
any errors or output.  I make the mcal function calls and... nothing.  If
anyone has any experience with getting this installed and configured, I
would be much appreciated.

thanks,

johnny p.

-----------------------
John Patton, CTO
[EMAIL PROTECTED]

Gameloop, Inc.
http://www.gameloop.com
Austin, TX 512-699-5534


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]





yes.  I installed both the libraries.  I followed all the directions on the
mcal web site for installing it.

johnny p.

> -----Original Message-----
> From: Sam Masiello [mailto:[EMAIL PROTECTED]]
> Sent: Friday, January 19, 2001 3:17 PM
> To: johnny p.; [EMAIL PROTECTED]
> Subject: RE: [PHP] mcal installation
>
>
>
> Since you didn't mention it specifically, I thought I should ask:
>
> Did you also download the mcal library or did you only include -with-mcal
> when you compiled PHP?
>
> Sam Masiello
> Systems Analyst
> Chek.Com
> (716) 853-1362 x289
> [EMAIL PROTECTED]
>
>  -----Original Message-----
> From:         johnny p. [mailto:[EMAIL PROTECTED]]
> Sent: Friday, January 19, 2001 3:27 PM
> To:   [EMAIL PROTECTED]
> Subject:      [PHP] mcal installation
>
> Hi,
>
> I am working on a site that requires extensive calendar math on
> it and read
> about PHP and using mcal with it.  I tried configuring mcal to
> work with it
> and was wondering if anyone has had any success getting it to work.  I
> followed all the steps I could find, but I have no idea how to set up
> individual user directories or even if the thing works.  I don't even get
> any errors or output.  I make the mcal function calls and... nothing.  If
> anyone has any experience with getting this installed and configured, I
> would be much appreciated.
>
> thanks,
>
> johnny p.
>
> -----------------------
> John Patton, CTO
> [EMAIL PROTECTED]
>
> Gameloop, Inc.
> http://www.gameloop.com
> Austin, TX 512-699-5534
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>
>






Did you restart your web server after recompiling PHP?

Please be more specific on the steps that you did along the way (perhaps do
them again and copy and paste your command lines to the screen so we can see
exactly what you did).  More often than not, people say "I followed all of
the steps in the manual", but then learn to find out that they either did
something wrong or skipped a step along the way.

Sam Masiello
Systems Analyst
Chek.Com
(716) 853-1362 x289
[EMAIL PROTECTED]

 -----Original Message-----
From:   johnny p. [mailto:[EMAIL PROTECTED]]
Sent:   Friday, January 19, 2001 4:18 PM
To:     Sam Masiello; [EMAIL PROTECTED]
Subject:        RE: [PHP] mcal installation

yes.  I installed both the libraries.  I followed all the directions on the
mcal web site for installing it.

johnny p.

> -----Original Message-----
> From: Sam Masiello [mailto:[EMAIL PROTECTED]]
> Sent: Friday, January 19, 2001 3:17 PM
> To: johnny p.; [EMAIL PROTECTED]
> Subject: RE: [PHP] mcal installation
>
>
>
> Since you didn't mention it specifically, I thought I should ask:
>
> Did you also download the mcal library or did you only include -with-mcal
> when you compiled PHP?
>
> Sam Masiello
> Systems Analyst
> Chek.Com
> (716) 853-1362 x289
> [EMAIL PROTECTED]
>
>  -----Original Message-----
> From:         johnny p. [mailto:[EMAIL PROTECTED]]
> Sent: Friday, January 19, 2001 3:27 PM
> To:   [EMAIL PROTECTED]
> Subject:      [PHP] mcal installation
>
> Hi,
>
> I am working on a site that requires extensive calendar math on
> it and read
> about PHP and using mcal with it.  I tried configuring mcal to
> work with it
> and was wondering if anyone has had any success getting it to work.  I
> followed all the steps I could find, but I have no idea how to set up
> individual user directories or even if the thing works.  I don't even get
> any errors or output.  I make the mcal function calls and... nothing.  If
> anyone has any experience with getting this installed and configured, I
> would be much appreciated.
>
> thanks,
>
> johnny p.
>
> -----------------------
> John Patton, CTO
> [EMAIL PROTECTED]
>
> Gameloop, Inc.
> http://www.gameloop.com
> Austin, TX 512-699-5534
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>
>





Ok, I think I might have it installed correctly, but I'm not sure how to use
it.  Does anyone have an example on how to create a calendar mailbox, create
a calendar event in that mailbox, and then list it?  I think that might be
my problem.  I might not be creating the calendar correctly.

thanks,

johnny p.

> -----Original Message-----
> From: Sam Masiello [mailto:[EMAIL PROTECTED]]
> Sent: Friday, January 19, 2001 4:23 PM
> To: johnny p.; [EMAIL PROTECTED]
> Subject: RE: [PHP] mcal installation
>
>
>
> Did you restart your web server after recompiling PHP?
>
> Please be more specific on the steps that you did along the way
> (perhaps do
> them again and copy and paste your command lines to the screen so
> we can see
> exactly what you did).  More often than not, people say "I followed all of
> the steps in the manual", but then learn to find out that they either did
> something wrong or skipped a step along the way.
>
> Sam Masiello
> Systems Analyst
> Chek.Com
> (716) 853-1362 x289
> [EMAIL PROTECTED]
>
>  -----Original Message-----
> From:         johnny p. [mailto:[EMAIL PROTECTED]]
> Sent: Friday, January 19, 2001 4:18 PM
> To:   Sam Masiello; [EMAIL PROTECTED]
> Subject:      RE: [PHP] mcal installation
>
> yes.  I installed both the libraries.  I followed all the
> directions on the
> mcal web site for installing it.
>
> johnny p.
>
> > -----Original Message-----
> > From: Sam Masiello [mailto:[EMAIL PROTECTED]]
> > Sent: Friday, January 19, 2001 3:17 PM
> > To: johnny p.; [EMAIL PROTECTED]
> > Subject: RE: [PHP] mcal installation
> >
> >
> >
> > Since you didn't mention it specifically, I thought I should ask:
> >
> > Did you also download the mcal library or did you only include
> -with-mcal
> > when you compiled PHP?
> >
> > Sam Masiello
> > Systems Analyst
> > Chek.Com
> > (716) 853-1362 x289
> > [EMAIL PROTECTED]
> >
> >  -----Original Message-----
> > From:       johnny p. [mailto:[EMAIL PROTECTED]]
> > Sent:       Friday, January 19, 2001 3:27 PM
> > To: [EMAIL PROTECTED]
> > Subject:    [PHP] mcal installation
> >
> > Hi,
> >
> > I am working on a site that requires extensive calendar math on
> > it and read
> > about PHP and using mcal with it.  I tried configuring mcal to
> > work with it
> > and was wondering if anyone has had any success getting it to work.  I
> > followed all the steps I could find, but I have no idea how to set up
> > individual user directories or even if the thing works.  I
> don't even get
> > any errors or output.  I make the mcal function calls and...
> nothing.  If
> > anyone has any experience with getting this installed and configured, I
> > would be much appreciated.
> >
> > thanks,
> >
> > johnny p.
> >
> > -----------------------
> > John Patton, CTO
> > [EMAIL PROTECTED]
> >
> > Gameloop, Inc.
> > http://www.gameloop.com
> > Austin, TX 512-699-5534
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> > To contact the list administrators, e-mail: [EMAIL PROTECTED]
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> > To contact the list administrators, e-mail: [EMAIL PROTECTED]
> >
> >
>
>





New features/fixes:

* support for relative include paths
* support for the include_path setting in php.ini
* new php function 'apc_cache_index'
* default initialization of class member data (as arrays) now works

Note: to enable support for either relative paths OR the include_path
setting, you must set apc.relative_includes to 1 in your php.ini file.
Check the FAQ for more details.

APC homepage: http://apc.communityconnect.com/

Dan





hi,

It appears php4 has a bug in it, such that when I install it with apache
1.3.9, then add the proper lines to httpd.conf for the php mime types,
whenever i hit a page of one of those types (.php, .html, etc) my browser
brings up a 'Save As' dialog, indicating to me that apache has successfully
handed off the file to php, but php has fouled up in serving it... 

any ideas?  

thanks
todd





> It appears php4 has a bug in it, such that when I install it with apache
> 1.3.9, then add the proper lines to httpd.conf for the php mime types,
> whenever i hit a page of one of those types (.php, .html, etc) my browser
> brings up a 'Save As' dialog, indicating to me that apache has
successfully
> handed off the file to php, but php has fouled up in serving it...

There's a bazillion sites where that doesn't happen...

I'd have to guess you got the httpd.conf wrong somehow, or maybe your
compilation didn't go right.

By Day:                                |By Night:
    Don't miss the Zend Web Store's    |   There's not enough room here...
    Grand Opening on January 23, 2001! |   Start here:
    http://www.zend.com                |   http://l-i-e.com/artists.htm






Rasmus Lerdorf wrote:
> 
> > I think the single most importand piece of software that saves us the
> > most money is thttpd.  That all runs in a single thread and uses
> > select to pump out content.  Since it is a single thread, it never
> > chews up tons of memory forking children.
> 
> By the way, there is a PHP module for thttpd.
> 
> -Rasmus


Interesting. But (and I'm unsure of *exactly* what thttpd does) 2.4 also
has a httpd built into the kernel, capable of rendering static content
at "blistering" speed. So you could use Apache for dynamic, the kernel
daemon for static.

Without any benchmarks (or even a hardware profile!) I can't really add
much more. But it's worth looking into.

Incidentally, the must 2.4 gung ho distro seems to be SuSE, which I rate
well above RedHat in terms of value, support and stability.
-- 
******************************************************************************
Marx: "Why do Anarchists only drink herbal tea?"
Proudhon: "Because all proper tea is theft."
******************************************************************************




On Fri, 19 Jan 2001 20:55:12 +0000, John Hinsley
<[EMAIL PROTECTED]> wrote:

>Incidentally, the must 2.4 gung ho distro seems to be SuSE, which I rate
>well above RedHat in terms of value, support and stability.

I like the way SuSE makes it easy to build and save a custom install
config which can be later repeated.  And the older text based YaST
package selection tool is easy to use when I need to add a package I
overlooked on the initial install.


Egan






Also, this incorporates the patch to correctly support multi-tier class
hierachies posted to apc-cache yesterday.


Daniel Cowgill wrote:
> 
> New features/fixes:
> 
> * support for relative include paths
> * support for the include_path setting in php.ini
> * new php function 'apc_cache_index'
> * default initialization of class member data (as arrays) now works
> 
> Note: to enable support for either relative paths OR the include_path
> setting, you must set apc.relative_includes to 1 in your php.ini file.
> Check the FAQ for more details.
> 
> APC homepage: http://apc.communityconnect.com/
> 
> Dan
> 
> _______________________________________________
> Apc-cache mailing list
> [EMAIL PROTECTED]
> http://lists.communityconnect.com/mailman/listinfo/apc-cache





I have a question about session_register(), and the following is the
background....

When I read a tutorial about session. I know that, once the
"session_start()" is called, it will check the session id. If it's not
valid, create a new one, and it will responible to retrieve the variable.
I also learns about the usage of session_register(). It is a function to
register a variable which will be used throughout a session.

My question is, when the user first visit, a session created, and I register
the variable. On the second, or following hits, to use the session variable,
I also need "session_start", but should I still need to call
session_register() for each hit?

e.g. in script 1, I have a $foo, which should be a session variable, then
<?
    session_start();
    session_register(foo);
    ......
?>

in script 2, I still have to use that "$foo", as what I have read from the
tutorial, a session_start() is already prepare that sesson variable for me,
when the script is being parsed,
<?
    session_start();
    //should I still have to add such a statement?
    session_register(foo);
?>

I know my english is poor, so I use a lot of words to show my question, pls
forgive!!!






When I first meet PHP, it still in 3.0 version. just after I bought a book
abuot PHP3, for a few weeks, PHP4 is released.

for now, I have fimilar with some basic of PHP, and I try to find some
useful tutorial about the PHP4, I fail.

I have look about the PHP manual (pdf version), I find that, there is many
many function is added to PHP4, like, session, corba, shockwave flash, XSLT,
new function for OO.... But the manual does only provide limited
information. I also heard about Zend, and the xxx engine, but just heard.
not really know what's that.

Can anyone tell me where can I got some article or tutorial, dicussion the
new features in PHP4, online (I am a poor student!)

Right, I still any another two question, it may be cross post,sorry first.

1. What is "Referer" in a HTTP header, what does it mean?

2. If I have question about mySQL, where can I raise question?
    Is there any newsgroup which is specially for mysql?

Thanks very much!!







On Sat, 20 Jan 2001, Zenith wrote:

> When I first meet PHP, it still in 3.0 version. just after I bought a book
> abuot PHP3, for a few weeks, PHP4 is released.
>
> for now, I have fimilar with some basic of PHP, and I try to find some
> useful tutorial about the PHP4, I fail.
>
> I have look about the PHP manual (pdf version), I find that, there is many
> many function is added to PHP4, like, session, corba, shockwave flash, XSLT,
> new function for OO.... But the manual does only provide limited
> information. I also heard about Zend, and the xxx engine, but just heard.
> not really know what's that.
>
> Can anyone tell me where can I got some article or tutorial, dicussion the
> new features in PHP4, online (I am a poor student!)

Try http://www.zend.com/.

>
> Right, I still any another two question, it may be cross post,sorry first.
>
> 1. What is "Referer" in a HTTP header, what does it mean?

It's the web page that the browser was just at.

>
> 2. If I have question about mySQL, where can I raise question?
>     Is there any newsgroup which is specially for mysql?

Try http://www.mysql.com/.

>
> Thanks very much!!
>

-- 
Ignacio Vazquez-Abrams  <[EMAIL PROTECTED]>





On Fri, 19 Jan 2001, Andrew Rush wrote:

>
> On Friday, January 19, 2001, at 04:20 PM, Ignacio Vazquez-Abrams wrote:
>
> > > 1. What is "Referer" in a HTTP header, what does it mean?
> >
> > It's the web page that the browser was just at.
>
> my understanding is that this value is only present if the user clicked on a 
>hyperlink. if i am at my start page (google) and then i go to a bookmark, there is no 
>referer sent.
>
> have a great day,
> andy
>
> :: Andrew Rush :: Lead Systems Developer :: MaineToday.com ::
> **************************************************************************
> "Crippled but free, blind all the time, i was learning to see"
>
> - J. Garcia / R. Hunter
> **************************************************************************
>
> The  views expressed herein are not necessarily those of my employer, but they let 
>me have them anyway.
>

True. I forgot to make that tiny little distinction. My bad :)

-- 
Ignacio Vazquez-Abrams  <[EMAIL PROTECTED]>








Ok I thought array_intersect() was the function I was looking for, I might
have to write my own.

I want an array with ONLY the keys/values that are present in all the
variables; ie.

<?
    $test_a[] = '974806802083190501';
    $test_a[] = '974806802083190503';
    $test_a[] = '974806802083190504';

    $test_b[] = '974806802083190501';

    $new_array = array_intersect($test_a, $test_b);

    print_r($new_array);
?>

Array
(
    [0] => 974806802083190501
    [1] => 974806802083190503
    [2] => 974806802083190504
)

<?
    $test_a[] = '501';
    $test_a[] = '503';
    $test_a[] = '504';

    $test_b[] = '501';

    $new_array = array_intersect($test_a, $test_b);

    print_r($new_array);
?>

Array
(
    [0] => 501
)

array_insersect() only seems to work with small numbers... or small text.

Chris Lee
Mediawaveonline.com






ok, Ive got my code to work, but its a big jerry-rig haha. because I am
using mtime() (the last two chars are allways 00) I substr the last two
chars off, array_insersect() them, then add 00 the the end of all the values
in the result array. dumb eh.

Chris Lee
Mediawaveonline.com



"Chris Lee" <[EMAIL PROTECTED]> wrote in message
94abie$j8q$[EMAIL PROTECTED]">news:94abie$j8q$[EMAIL PROTECTED]...
>
> Ok I thought array_intersect() was the function I was looking for, I might
> have to write my own.
>
> I want an array with ONLY the keys/values that are present in all the
> variables; ie.
>
> <?
>     $test_a[] = '974806802083190501';
>     $test_a[] = '974806802083190503';
>     $test_a[] = '974806802083190504';
>
>     $test_b[] = '974806802083190501';
>
>     $new_array = array_intersect($test_a, $test_b);
>
>     print_r($new_array);
> ?>
>
> Array
> (
>     [0] => 974806802083190501
>     [1] => 974806802083190503
>     [2] => 974806802083190504
> )
>
> <?
>     $test_a[] = '501';
>     $test_a[] = '503';
>     $test_a[] = '504';
>
>     $test_b[] = '501';
>
>     $new_array = array_intersect($test_a, $test_b);
>
>     print_r($new_array);
> ?>
>
> Array
> (
>     [0] => 501
> )
>
> array_insersect() only seems to work with small numbers... or small text.
>
> Chris Lee
> Mediawaveonline.com
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>






my problem is i have an include file in a parent directory which includes
other files. i want these other files to be in the same directory as this
parent directory file..(hope your gettin me here...). the prob is the parent
directory file looks for its include files in the current directory.

example:
current path is:
www.blah.com/blahdir

a file in blahdir called blah1.php includes blah2.php which is located in
www.blah.com
blah2.php includes blah3.php and blah4.php which are also located in
www.blah.com
the problem is blah2.php looks for blah3.php and blah4.php in
www.blah.com/blahdir

will chdir() fix this? or is there another way?

Thanks!!

- Noah






On Fri, 19 Jan 2001, Noah Spitzer-Williams wrote:

> my problem is i have an include file in a parent directory which includes
> other files. i want these other files to be in the same directory as this
> parent directory file..(hope your gettin me here...). the prob is the parent
> directory file looks for its include files in the current directory.
>
> example:
> current path is:
> www.blah.com/blahdir
>
> a file in blahdir called blah1.php includes blah2.php which is located in
> www.blah.com
> blah2.php includes blah3.php and blah4.php which are also located in
> www.blah.com
> the problem is blah2.php looks for blah3.php and blah4.php in
> www.blah.com/blahdir
>
> will chdir() fix this? or is there another way?
>
> Thanks!!
>
> - Noah
>

Two solutions come to mind:

1) Use a variable to store the directory you want to include from.
2) Use absolute paths.

-- 
Ignacio Vazquez-Abrams  <[EMAIL PROTECTED]>





Okay.  I'll tell you a little more information.  The 'friend' of mine is
actually my local church.  I need ~20 email accounts because there should be
15 staff people (who will want/need email) and 5 for the future.  Since it
is a church, they don't have a lot of money to spend on stuff (i.e. a
website).  Their current host is at www.poconos.net, and the website of my
church is www.st-thomas-aquinas.com.  Poconos charges 19.95 a month, and I
was hoping they could get something less than that.

Does anyone know how to find out how much bandwidth my/my church's website
it getting?  Analog is installed, if that would help anyone figure something
out.  The stat's page is at www.st-thomas-aquinas.com/analog.html.

Right now I am thinking of going with CIS Management as the web host as they
seem to offer everything I need.  I am a little concerned about reliability
and stuff like that, so if someone with experience with them could say
something...

P.S. -- Could anyone give me advice/critics on the church's web site
(www.st-thomas-aquinas.com)?  The site really isn't much, but, not to
rationalize or anything, that isn't all my fault.  I am not a graphics
designer.  A few pics would probably make it look infinitely nicer, but I
don't know how to do them.

Thanks,

Jeff



""Jeff Lacy"" <[EMAIL PROTECTED]> wrote in message
948icc$9vs$[EMAIL PROTECTED]">news:948icc$9vs$[EMAIL PROTECTED]...
> I'm sorry, but why do you say webservpro doesn't make a lot of money?
>
> I am really looking for a good host for a 'friend' of mine.   He has a
small
> website (<20mb) and I don't think it gets too many hits.  He doesn't have
> very much money to spend on a web host, so it must be something cheap.  It
> needs php (4 would be better), and at least 20 email accounts.  A mysql
> database would be really, really good.  Ftp access (to upload pages) is a
> must, but telnet/ssh is always a plus.  The host need to allow domain
names.
> I think this is about what my friend is looking for.  Does anyone have any
> ideas (besides below10host.com or phpwebhosting.com)?  Thanks again :-)
>
> Jeff
>
>
>
> "Egan" <[EMAIL PROTECTED]> wrote in message
> [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > On Thu, 18 Jan 2001 01:54:28 -0600, "Jeff Lacy"
> > <[EMAIL PROTECTED]> wrote:
> >
> > >anyone had thought/opinions on below10host.com as a web host?
> >
> > I'm speaking as a budding competitor, so keep that in mind. :-)
> >
> > According to their web page, below10host.com gives you 6GB per month
> > for $9.95.  By way of comparison, webservpro charges $49.95 per month
> > for the same 6GB.
> >
> > My analysis of costs tells me that at $49.95 for 6GB, webservpro does
> > not have a large margin of profit in their price.  How can any hosting
> > company sell the same 6GB per month for $9.95 and make enough profit
> > to stay in business?
> >
> > At such a low price, I don't know how it's possible, unless a large
> > majority of their customers consume so little of their quota so as to
> > offset the loss incurred from customers who consume it all.
> >
> > 6GB per month is a fairly active site.  If you really have that much
> > traffic, to me at least, $49.95 would seem affordable.  OTOH, if you
> > have much less traffic, you could choose a lower priced plan.
> >
> > I believe in the adage of getting what you pay for.  Value is a
> > balance between low price on the one hand, vs. high quality on the
> > other.  The lowest price is not necessarily the best value.
> >
> > Egan
> >
> >
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> > To contact the list administrators, e-mail: [EMAIL PROTECTED]
> >
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>






ok so i have an object that has (among other things) the following properties:

$vendor_data->s9
$vendor_data->s10
$vendor_data->s11
$vendor_data->s12
...
$vendor_data->s40

The values are 1 or 0

I'd like to write a loop to say:

for ($count=9; $count>40; $count++) {
        if ($vendor_data->s(insert_number_here) == 1) {
                echo something;
        }
}

any thoughts?

Mike




Put them in an array? PHP allows for variable variables, but I'm not sure they
work with classes.

This works:

 $foo0 = 'a';
 $foo1 = 'b';
 $foo2 = 'c';
 $foo3 = 'd';
 $foo4 = 'e';

 for($i = 0 ; $i < 5 ; ++$i)
 {
   $var = 'foo'.$i;
   echo $$var;
 }

Try it with an object...

--Joe


On Fri, Jan 19, 2001 at 05:15:25PM -0500, Michael Zornek wrote:
> ok so i have an object that has (among other things) the following properties:
> 
> $vendor_data->s9
> $vendor_data->s10
> $vendor_data->s11
> $vendor_data->s12
> ...
> $vendor_data->s40
> 
> The values are 1 or 0
> 
> I'd like to write a loop to say:
> 
> for ($count=9; $count>40; $count++) {
>       if ($vendor_data->s(insert_number_here) == 1) {
>               echo something;
>       }
> }
> 
> any thoughts?
> 
> Mike
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]

-- 

Joe Stump, PHP Hacker
[EMAIL PROTECTED]
http://www.miester.org/





thats right you could do that, but it sucks. (IMHO)

$test->s0
$test->s1
$test->s2

for($c = 0; $c < 3; $c++)
{
    $name = "s$c";
    echo $test->$name;
}

but this is better, more modular.

$test->s[0]
$test->s[1]
$test->s[2]

foreach($test->s as $pos => $val)
    echo $val;

with the second example you can add another element to $test->s and the loop
will auto adjust for this.

but both methods work.

Chris Lee
Mediawaveonline.com



Joe Stump <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Put them in an array? PHP allows for variable variables, but I'm not sure
they
> work with classes.
>
> This works:
>
>  $foo0 = 'a';
>  $foo1 = 'b';
>  $foo2 = 'c';
>  $foo3 = 'd';
>  $foo4 = 'e';
>
>  for($i = 0 ; $i < 5 ; ++$i)
>  {
>    $var = 'foo'.$i;
>    echo $$var;
>  }
>
> Try it with an object...
>
> --Joe
>
>
> On Fri, Jan 19, 2001 at 05:15:25PM -0500, Michael Zornek wrote:
> > ok so i have an object that has (among other things) the following
properties:
> >
> > $vendor_data->s9
> > $vendor_data->s10
> > $vendor_data->s11
> > $vendor_data->s12
> > ...
> > $vendor_data->s40
> >
> > The values are 1 or 0
> >
> > I'd like to write a loop to say:
> >
> > for ($count=9; $count>40; $count++) {
> > if ($vendor_data->s(insert_number_here) == 1) {
> > echo something;
> > }
> > }
> >
> > any thoughts?
> >
> > Mike
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> > To contact the list administrators, e-mail: [EMAIL PROTECTED]
>
> --
>
> Joe Stump, PHP Hacker
> [EMAIL PROTECTED]
> http://www.miester.org/
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>






I'm getting the same problem on 2 machines, but I can't figure out what I'm 
doing wrong.

OS is FreeBSD 4.2-STABLE i386
IMAP installed from port is imap-uw-4.5

For php4 (php4.0.4pl1) I'm doing:
/configure  --with-apache=../apache_1.3.14 --with-mysql \
--with-imap=/usr/local/libexec/imapd --with-ftp --enable-track-vars

For Apache I'm doing:
/configure --enable-module=all --enable-shared=max \
--add-module=mod_frontpage.c \
--activate-module=src/modules/php4/libphp4.a

(without the --activate-module=src/modules/php4/libphp4.a, it compiles okay)

I get the following trying to configure Apache:

** A test compilation with your Makefile configuration
** failed.  The below error output from the compilation
** test will give you an idea what is failing. Note that
** Apache requires an ANSI C Compiler, such as gcc.

cd ..; gcc  -funsigned-char -I/usr/local/src/php-4.0.4pl1 -
I/usr/local/src/php-4
0.4pl1/main -I/usr/local/src/php-4.0.4pl1/main -I/usr/local/src/php-
4.0.4pl1/Ze
nd -I/usr/local/src/php-4.0.4pl1/Zend -I/usr/local/src/php-4.0.4pl1/TSRM -
I/usr/
local/src/php-4.0.4pl1/TSRM -I/usr/local/src/php-4.0.4pl1 -DUSE_EXPAT -
I./lib/ex
pat-lite `./apaci`     -o helpers/dummy helpers/dummy.c   -R/usr/local/lib  -
rdy
namic -L/usr/local/lib -Lmodules/php4 -L../modules/php4 -L../../modules/php4 -
lm
odphp4  -lpam -lc-client4  -lm -lcrypt    -lcrypt
/usr/local/lib/libc-client4.so: undefined reference to `mm_expunged'
/usr/local/lib/libc-client4.so: undefined reference to `mm_diskerror'
/usr/local/lib/libc-client4.so: undefined reference to `mm_lsub'
/usr/local/lib/libc-client4.so: undefined reference to `mm_flags'
/usr/local/lib/libc-client4.so: undefined reference to `mm_fatal'
/usr/local/lib/libc-client4.so: undefined reference to `mm_nocritical'
/usr/local/lib/libc-client4.so: undefined reference to `mm_notify'
/usr/local/lib/libc-client4.so: undefined reference to `mm_searched'
/usr/local/lib/libc-client4.so: undefined reference to `mm_status'
/usr/local/lib/libc-client4.so: undefined reference to `mm_login'
/usr/local/lib/libc-client4.so: undefined reference to `mm_list'
/usr/local/lib/libc-client4.so: undefined reference to `mm_critical'
/usr/local/lib/libc-client4.so: undefined reference to `mm_exists'
/usr/local/lib/libc-client4.so: undefined reference to `mm_log'
/usr/local/lib/libc-client4.so: undefined reference to `mm_dlog'
*** Error code 1

Stop in /usr/local/src/apache_1.3.14/src/helpers.
======== Error Output for sanity check ========
============= End of Error Report =============

Your help will be appreciated
John Ryan
Systems Manager
King George V School





Fatal error: Failed opening required 'shared.inc'
(include_path='.:./include:../include') in
/local/Web/sites/phpweb/manual/html/index.php on line 2

Peace, love, code.

-Szii





Which URL did you use?  Looks like you were trying to get to the plain
html version at http://www.php.net/manual/en/html/ and it seems to work ok
for me.

-Rasmus

On Fri, 19 Jan 2001, [EMAIL PROTECTED] wrote:

> Fatal error: Failed opening required 'shared.inc'
> (include_path='.:./include:../include') in
> /local/Web/sites/phpweb/manual/html/index.php on line 2
>
> Peace, love, code.
>
> -Szii
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>





I tried the plain html, and the PHP manual online.  The Annotated manual
was working okay.

They're all working now for me. *shrug*

-Szii

----- Original Message -----
From: Rasmus Lerdorf <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED] <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Friday, January 19, 2001 3:24 PM
Subject: Re: [PHP] php.net's docs are down


> Which URL did you use?  Looks like you were trying to get to the plain
> html version at http://www.php.net/manual/en/html/ and it seems to work ok
> for me.
>
> -Rasmus
>
> On Fri, 19 Jan 2001, [EMAIL PROTECTED] wrote:
>
> > Fatal error: Failed opening required 'shared.inc'
> > (include_path='.:./include:../include') in
> > /local/Web/sites/phpweb/manual/html/index.php on line 2
> >
> > Peace, love, code.
> >
> > -Szii
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> > To contact the list administrators, e-mail: [EMAIL PROTECTED]
> >
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]





On Fri, Jan 19, 2001 at 03:24:00PM -0800, Rasmus Lerdorf wrote:
> Which URL did you use?  Looks like you were trying to get to the plain
> html version at http://www.php.net/manual/en/html/ and it seems to work ok
> for me.

Append in the include path a :../../include and it should work. It is a
common failure with private mirrors.

-Egon

> On Fri, 19 Jan 2001, [EMAIL PROTECTED] wrote:
> 
> > Fatal error: Failed opening required 'shared.inc'
> > (include_path='.:./include:../include') in
> > /local/Web/sites/phpweb/manual/html/index.php on line 2
> >
> > Peace, love, code.
> >
> > -Szii
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> > To contact the list administrators, e-mail: [EMAIL PROTECTED]
> >
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
> 

-- 
-- 
http://www.linuxtag.de/
http://php.net/books.php 
http://www.concert-band.de/
mailto:[EMAIL PROTECTED]




Wasn't a private mirror.  =)

----- Original Message -----
From: <[EMAIL PROTECTED]>
To: Rasmus Lerdorf <[EMAIL PROTECTED]>; [EMAIL PROTECTED] <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Friday, January 19, 2001 3:44 PM
Subject: Re: [PHP] php.net's docs are down


> On Fri, Jan 19, 2001 at 03:24:00PM -0800, Rasmus Lerdorf wrote:
> > Which URL did you use?  Looks like you were trying to get to the plain
> > html version at http://www.php.net/manual/en/html/ and it seems to work
ok
> > for me.
>
> Append in the include path a :../../include and it should work. It is a
> common failure with private mirrors.
>
> -Egon
>
> > On Fri, 19 Jan 2001, [EMAIL PROTECTED] wrote:
> >
> > > Fatal error: Failed opening required 'shared.inc'
> > > (include_path='.:./include:../include') in
> > > /local/Web/sites/phpweb/manual/html/index.php on line 2
> > >
> > > Peace, love, code.
> > >
> > > -Szii
> > >
> > >
> > > --
> > > PHP General Mailing List (http://www.php.net/)
> > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > For additional commands, e-mail: [EMAIL PROTECTED]
> > > To contact the list administrators, e-mail:
[EMAIL PROTECTED]
> > >
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> > To contact the list administrators, e-mail: [EMAIL PROTECTED]
> >
>
> --
> --
> http://www.linuxtag.de/
> http://php.net/books.php
> http://www.concert-band.de/
> mailto:[EMAIL PROTECTED]
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]





I'm developing a site that requires people to sign up.  During this time,
we get their name, email, city, etc.  There is also optional informational
like (age, education) that they don't have to fill in.

Now, the problem we have is we allow people search through the database
using mostly the same criteria people filled in during their sign up.
However, if someone does not have a preference in Education or age, how do
we create a query that selects all the records.  Currently, the SQL
statement has several "OR" clauses in between the optional fields 
(ie: select * form clients where (CID='$CID' AND CUserName='$CUserName')
OR CAge='$CAge' OR CEducation='$CEducation').

You can see from the query that if someone has no preference, it will take
the value from the form and search just on that value - NOT everything.

I'm stumped on how to solve this problem.  Can anyone help me out?

Thanks,
Mike





best way is this.

if ($CID)
    $query[] = "CID = '$CID'";
if ($CUserName)
    $query[] = "CUserName = '$CUserName'";
if ($CAge)
    $query[] = "CAge = '$CAge'";
if ($CEducation)
    $query[] = "CEducation = '$CEducation'";

if (isset($query))
    $query = "SELECT * FROM clients WHERE CID = '$CID' AND CUserName =
'$CUserName' " . implode(' AND ', $query);
else
    $query = "SELECT * FROM clients WHERE CID = '$CID' AND CUserName =
'$CUserName' ";


but this works too...

$query = "SELECT * FROM clients WHERE CID = '$CID' AND CUserName =
'$CUserName' ";
if ($CAge)
    $query .= " AND CAge = '$CAge'";
if ($CEducation)
    $query .= " AND CEducation = '$CEducation'";

the latter only works if there is at LEAST one variable to be used.

Is this what you meant? no? email me k.

Chris Lee
Mediawaveonline.com




Mike Yuen <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> I'm developing a site that requires people to sign up.  During this time,
> we get their name, email, city, etc.  There is also optional informational
> like (age, education) that they don't have to fill in.
>
> Now, the problem we have is we allow people search through the database
> using mostly the same criteria people filled in during their sign up.
> However, if someone does not have a preference in Education or age, how do
> we create a query that selects all the records.  Currently, the SQL
> statement has several "OR" clauses in between the optional fields
> (ie: select * form clients where (CID='$CID' AND CUserName='$CUserName')
> OR CAge='$CAge' OR CEducation='$CEducation').
>
> You can see from the query that if someone has no preference, it will take
> the value from the form and search just on that value - NOT everything.
>
> I'm stumped on how to solve this problem.  Can anyone help me out?
>
> Thanks,
> Mike
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>







original question jalist:
> > I'm trying to grab a string from within a string based on a matching word
> > or phrase. 

In the middle of the night i was thinking hey, why not use a regexp,
look for the pattern word-space-word-space-SEARCHWORD-space-word-space-word
something like 

$toshow = 
        regexp ( "( [alphanum]+ [alphanum]+ [$YOURWORD] [alphanum]+ [alphanum]+ 
)", $totalstring);


I am totally bad with regexps, but that 's the idea. Might be faster than 
the array? You'll have to take care of comma's etc.




From:                   "jalist" <[EMAIL PROTECTED]>
To:                     "PHP" <[EMAIL PROTECTED]>
Date sent:              Thu, 18 Jan 2001 16:12:31 -0000
Subject:                RE: [PHP] (Newbie) String within a string

> Excellent, thanks a lot Chris.
> 
> Steve
> (jalist)
> [EMAIL PROTECTED]
> http://ls2k.org
> 
> -----Original Message-----
> From: Chris Hayes [mailto:[EMAIL PROTECTED]]
> Sent: 18 January 2001 15:43
> To: jalist; PHP
> Subject: Re: [PHP] (Newbie) String within a string
> 
> 
> 
> jalist:
> > I'm trying to grab a string from within a string based on a matching word
> or
> > phrase. Example...
> 
> You say you want the middle, not two words before and two words after.
> 
> I see several ways.
> 
> 
>  1. Explode into an word-array and use that:
>  1. prepare string
>    a) add spaces after comma's and fullstops by some replace
>     operation (replace ',' by ', ').
>    b) remove double spaces
>  2. split to an array using explode (space as string separator)
>   Now you have every word in a separate place in the array
>  3. Get # of words by count($array)
>     4. Divide by two and get nearest integer (hence floor and +0.5!)
>   $mid= floor(count($array)/2 + 0.5)
>   OH NO, correction, that's the middle, you wanted a specific word.
>   I'm afraid you'll have to walk thorugh the array to find the word
>   you need.
> 
>    for (i=0;i<count($array);i++)
>    {
>    if ($array[$i]==$searchword)
>     {   $fragment= "...".
>       $array[$mid-2] ." "
>        $array[$mid-1] ." "
>       $array[$mid]   ." "
>       $array[$mid+1] ." "
>       $array[$mid+2] ."...";
>       ##extra job for you: make sure  $i >= 2
>      ##                                                       and $i <= count-2
>      ## or you'll get an error
> 
>     [exit the for loop somehow, maybe drop
>      this in a function and RETURN;]
>     }
> 
>    }
> 
> 
> 
> OR
> 
>  2. Continue with the strpos and strrpos, organize it a bit better.
>  For instance find the middle of the string. Split at nearest
>  space in leftstring and rightstring.
> 
>   Make a function chop_last_word, chop last two or three words from
>   leftstring and add to resultstring in right order.
> 
>   Same for rightstring.
> 
>      I think the array way is cleaner.
> 
> Chris
> 
> --------------------------------------------------------------------
> --  C.Hayes  Droevendaal 35  6708 PB Wageningen  the Netherlands  --
> --------------------------------------------------------------------
> 
> 
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
> 
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]



--------------------------------------------------------------------
--  C.Hayes  Droevendaal 35  6708 PB Wageningen  the Netherlands  --
--------------------------------------------------------------------

 




At 13:48 18/01/01 +0000, jalist wrote:
>I'm trying to grab a string from within a string based on a matching word or
>phrase. Example...
>
>$string = "This is a string I need to grab the middle out of"
>$query_word = "need"
>
>I need to get x amount of characters either side of $query_word, so the
>result string would be like...
>
>"string I need to grab the"
>
>And I need the result string to be full words, not like..."ing I need to
>grab th"
>
>I've half managed to do it using strpos and substr but the code is really
>messy and I'm getting half-formed words back. Anyone got any suggestion on
>how to accomplish this?
>
>Thanks very much in advance.

I'd suggest using regular expressions (ereg, or preg_match). It's a little 
too early in the morning on a weekend for me to come up with the best 
example of what would work, sorry :)

Angus.





Dear group,
i'm planning to change a javascript shoppingcart site to a PHP site.
For the javascritp shoppingcart it was convenient to have an index so i made 
it with frames, menu on the left, content on the right, data automatically 
updated to the index as soon as some field was unfocused.

I would like to keep the frame structure.

Now I'm afraid users will fill in one page, and not push the submit button 
but use the menu to change to another order page, so the orders of the first 
order page are lost. Are there other ways than a combination of unload and 
javascript?

groetjes,
Chris

 

--------------------------------------------------------------------
--  C.Hayes  Droevendaal 35  6708 PB Wageningen  the Netherlands  --
--------------------------------------------------------------------

 




I am using the following function to add a serialized object to a
session:

function add_toCart($id,$array) {
        session_register("OBJECT");
        $c = new Configurator;
        $c->readConfig($id);
        $OBJECT = serialize($c);
        header("Location: Cart.php");
        echo "Redirecting..."
}

Unfortunately, the session file (in /tmp) is always empty after this
function executes.  I'm using PHP 4.0.4 with --enable-trans-sid.

Any help is greatly appreciated.

Cheers,

-jm




The session file is not empty :)  the OBJECT portion of the session file
is empty. i.e. cat'ing /tmp/sess_whatever yields:

!OBJECT|

-jm

-----Original Message-----
From: Javier Muniz [mailto:[EMAIL PROTECTED]]
Sent: Friday, January 19, 2001 3:57 PM
To: '[EMAIL PROTECTED]'
Subject: [PHP] Session problem?


I am using the following function to add a serialized object to a
session:

function add_toCart($id,$array) {
        session_register("OBJECT");
        $c = new Configurator;
        $c->readConfig($id);
        $OBJECT = serialize($c);
        header("Location: Cart.php");
        echo "Redirecting..."
}

Unfortunately, the session file (in /tmp) is always empty after this
function executes.  I'm using PHP 4.0.4 with --enable-trans-sid.

Any help is greatly appreciated.

Cheers,

-jm

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]





I need to grab the referring search engines keywords used in the search. I
need to be able to determine what the keywords were, and what the engine
was... (Lycos, AltaVista etc...).

How can I do this, where can I find info on this, or is there something that
will do this already that I can integrate into my code?





Isn't this info in the HTTP_REFERER field normally?


Dallas Kropka wrote:

> I need to grab the referring search engines keywords used in the search. I
> need to be able to determine what the keywords were, and what the engine
> was... (Lycos, AltaVista etc...).
>
> How can I do this, where can I find info on this, or is there something that
> will do this already that I can integrate into my code?





Most likely but how do I strip it to determine the string of keywords?

Note to list: I cant depend on site logs.

-----Original Message-----
From: Michael Kimsal [mailto:[EMAIL PROTECTED]]
Sent: Friday, January 19, 2001 7:33 PM
To: Dallas Kropka
Cc: PHP LIST
Subject: Re: [PHP] Another Guru's Help Needed...


Isn't this info in the HTTP_REFERER field normally?


Dallas Kropka wrote:

> I need to grab the referring search engines keywords used in the search. I
> need to be able to determine what the keywords were, and what the engine
> was... (Lycos, AltaVista etc...).
>
> How can I do this, where can I find info on this, or is there something
that
> will do this already that I can integrate into my code?





You are going to have to research the query string for each search
engine that you intend to support, and then parse it out.

for example: go to google.  search for [jeremy brand], notice the
REQUEST_URI:
/search?q=jeremy+brand

In google's case, since they always use q=, you can parse this out.

You'll need to do this and write a module for each search engine
(since they all will have their own behavior).

Maybe someone has done this work, but you always have to keep curent
because search engines are free to chenge their own code any time they
want.

Jeremy

Jeremy Brand :: Sr. Software Engineer :: 408-245-9058 :: [EMAIL PROTECTED]
http://www.JeremyBrand.com/Jeremy/Brand/Jeremy_Brand.html for more 
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    "LINUX is obsolete"  -- Andy Tanenbaum, January 29th, 1992
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
       http://www.JEEP-FOR-SALE.com/ -- I need a buyer
  Get your own Free, Private email at http://www.smackdown.com/

On Fri, 19 Jan 2001, Dallas Kropka wrote:

> Date: Fri, 19 Jan 2001 20:06:27 -0600
> From: Dallas Kropka <[EMAIL PROTECTED]>
> To: Michael Kimsal <[EMAIL PROTECTED]>
> Cc: PHP LIST <[EMAIL PROTECTED]>
> Subject: RE: [PHP] Another Guru's Help Needed...
> 
> Most likely but how do I strip it to determine the string of keywords?
> 
> Note to list: I cant depend on site logs.
> 
> -----Original Message-----
> From: Michael Kimsal [mailto:[EMAIL PROTECTED]]
> Sent: Friday, January 19, 2001 7:33 PM
> To: Dallas Kropka
> Cc: PHP LIST
> Subject: Re: [PHP] Another Guru's Help Needed...
> 
> 
> Isn't this info in the HTTP_REFERER field normally?
> 
> 
> Dallas Kropka wrote:
> 
> > I need to grab the referring search engines keywords used in the search. I
> > need to be able to determine what the keywords were, and what the engine
> > was... (Lycos, AltaVista etc...).
> >
> > How can I do this, where can I find info on this, or is there something
> that
> > will do this already that I can integrate into my code?
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
> 
> 





Ya know, I was afraid you were going to say something like that.... does
anyone know of anything like this that has been done? And does anyone know
where I can find a list of Search Engine IP adds?

BTW Jeremy, Thanks.


-----Original Message-----
From: jeremy brand [mailto:[EMAIL PROTECTED]]
Sent: Friday, January 19, 2001 8:14 PM
To: Dallas Kropka
Cc: Michael Kimsal; PHP LIST
Subject: RE: [PHP] Another Guru's Help Needed...


You are going to have to research the query string for each search
engine that you intend to support, and then parse it out.

for example: go to google.  search for [jeremy brand], notice the
REQUEST_URI:
/search?q=jeremy+brand

In google's case, since they always use q=, you can parse this out.

You'll need to do this and write a module for each search engine
(since they all will have their own behavior).

Maybe someone has done this work, but you always have to keep curent
because search engines are free to chenge their own code any time they
want.

Jeremy

Jeremy Brand :: Sr. Software Engineer :: 408-245-9058 :: [EMAIL PROTECTED]
http://www.JeremyBrand.com/Jeremy/Brand/Jeremy_Brand.html for more
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    "LINUX is obsolete"  -- Andy Tanenbaum, January 29th, 1992
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
       http://www.JEEP-FOR-SALE.com/ -- I need a buyer
  Get your own Free, Private email at http://www.smackdown.com/

On Fri, 19 Jan 2001, Dallas Kropka wrote:

> Date: Fri, 19 Jan 2001 20:06:27 -0600
> From: Dallas Kropka <[EMAIL PROTECTED]>
> To: Michael Kimsal <[EMAIL PROTECTED]>
> Cc: PHP LIST <[EMAIL PROTECTED]>
> Subject: RE: [PHP] Another Guru's Help Needed...
>
> Most likely but how do I strip it to determine the string of keywords?
>
> Note to list: I cant depend on site logs.
>
> -----Original Message-----
> From: Michael Kimsal [mailto:[EMAIL PROTECTED]]
> Sent: Friday, January 19, 2001 7:33 PM
> To: Dallas Kropka
> Cc: PHP LIST
> Subject: Re: [PHP] Another Guru's Help Needed...
>
>
> Isn't this info in the HTTP_REFERER field normally?
>
>
> Dallas Kropka wrote:
>
> > I need to grab the referring search engines keywords used in the search.
I
> > need to be able to determine what the keywords were, and what the engine
> > was... (Lycos, AltaVista etc...).
> >
> > How can I do this, where can I find info on this, or is there something
> that
> > will do this already that I can integrate into my code?
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>
>


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]





convert.php
<?
$size_x=1000;
$size_y=1000;
$ECODE=12;

file://$filename='list.txt';
echo "<p style=\"font-family : 'Courier New';font-size : 'x-small'\">";
$id=1;
$i=1;
echo "<h1>?? ?????? $filename ?? ????? ETNA</h1>";
if ($fp=fopen($filename, "r"))
{
  while (!feof($fp))
  {
    $trimmed_line=trim($line=fgets($fp, 80));
    if (strstr($trimmed_line, "Handle"))
    {
      $handle=substr($trimmed_line, 9, 4);
      $trimmed_line=trim($line=fgets($fp, 80));
      if (!strstr($trimmed_line, "from point"))
        $trimmed_line=trim($line=fgets($fp, 80));
      $from_x=trim(substr($trimmed_line, 14, 9));
      $from_y=trim(substr($trimmed_line, 27, 9));
      $trimmed_line=trim($line=fgets($fp, 80));
      if (!strstr($trimmed_line, "to point"))
        $trimmed_line=trim($line=fgets($fp, 80));
      $to_x=trim(substr($trimmed_line, 12, 9));
      $to_y=trim(substr($trimmed_line, 25, 9));
      $pipes[$i][0]=($from_x);
      $pipes[$i++][1]=($from_y);
      $pipes[$i][0]=($to_x);
      $pipes[$i++][1]=($to_y);
      $id++;
    }
  }
}

$nodes=array_values(array_unique($pipes));
for ($i=0;$i<sizeof($nodes);$i++)
{
  $k=$i+1;
  echo "$k,";
  echo $nodes[$i][0];
  echo ",";
  echo $nodes[$i][1];
  echo "/<br>";
}
echo "-1//<br>";
$temp_pipes=$pipes;

$i=sizeof($temp_pipes);
$size=$i;
$pipe_id=1;
while(!empty($temp_pipes))
{
  $current_node=array_shift($temp_pipes);
  reset($nodes);
  while((current($nodes))!=$current_node)
  {next($nodes);}
  $pipes_nodes[$size-$i+1][0]=key($nodes)+1;
  echo ($pipe_id++).",$ECODE,".$pipes_nodes[$size-$i+1][0];

  $current_node=array_shift($temp_pipes);
  reset($nodes);
  while((current($nodes))!=$current_node)
  {next($nodes);}
  $pipes_nodes[$size-$i+1][1]=key($nodes)+1;

  echo ",".$pipes_nodes[$size-$i+1][1]."/<br>";
}
echo "-1//<br>";
if (!isset($pressure_drop_nodes))
{    
    echo "<form action='convert.php' method='post' name='form_convert' id='1'>";
    echo "<TABLE border=0 width='80%'>";
    echo 
"
  <TR>";
    echo "      <TD width='30%'>?????? ????? ??????? ??????? ?????
??????:</TD>";
    echo "      <TD width='50%'><INPUT size=50 value=''
name=pressure_drop_nodes></TD>";
    echo "  </TR>";
    echo "  <TR>";
    echo "      <TD width='30%'>&nbsp;</TD>";
    echo "      <TD width='50%'>(?? ?????? ?? ?????????? ?? ?????, ?.?.
'1,2,12,5')</TD>";
    echo "  </TR>";
    echo "  <TR>";
    echo "      <TD width='30%'>?????????????? ??? ??????:</TD>";
    echo "      <TD width='50%'>1,".sizeof($nodes).",1,'ELD','DI',<INPUT
size=4 value='' name=diameter>,'RK',<INPUT size=6 value=''
name=traxitita></TD>";
    echo "  </TR>";
    echo "  <TR>";
    echo "      <TD width='30%'>&nbsp;</TD>";
    echo "      <TD width='50%'>&nbsp;</TD>";
    echo "  </TR>";
    echo "  <TR>";
    echo "      <TD width='30%'></TD>";
    echo "      <TD width='50%'></TD>";
    echo "  </TR>";
    echo "</table>";
    echo "  <INPUT type='Hidden' value='$filename' name='filename'>";
}
// -------------------------------------------------------------------------
----
file://phpinfo();
if (isset($pressure_drop_nodes))
{
    echo "1/<br>";
    $individual_nodes=explode(",", $pressure_drop_nodes);
    for($i=0;$i<sizeof($individual_nodes);$i++)
    {
        echo "$individual_nodes[$i]/<br>";
    }
    echo "-1//<br>";
    echo
"1,".sizeof($nodes).",1,'ELD','DI',".$diameter.",'RK',".$traxitita."/<br>";
}
echo "-1//<br>";
echo "-1/<br>";
echo "-1/<br>";
echo "-1/<br>";
echo "-1/<br>";
echo "1,0/<br>";

if (!isset($pressure_drop_nodes))
{    
    echo "<TABLE border=0 width='80%'>";
    echo "  <TR>";
    echo "      <TD width='30%'>?????? ??????:</TD>";
    echo "      <TD align=right width='50%'></TD>";
    echo "  </TR>";     
    $y=0;
    for($i=0;$i<sizeof($nodes);$i++)
    {
        $y=$i+1;
        echo "  <TR>\n";
        echo "      <TD width='30%'>$y</TD>\n";
        echo "      <TD width='50%' align=right >\n";
        echo "          $y,<INPUT siz
e=4 value='' nam
e=to_node".$y.">,1,'\n";
        echo "          <select name=type".$y.">\n";
        echo "              <option value='PRE' selected>PRE</option>\n";
        echo "              <option value='DIS'>DIS</option>\n";
        echo "          </select>',\n";
        echo "          '<select name=units".$y.">\n";
        echo "              <option value='BAR' selected>BAR</option>\n";
        echo "              <option value='M3H'>M3/H</option>\n";
        echo "          </select>',\n";
        echo "          <INPUT size=4 value='' name=pre_dis".$y.">\n";
        echo "      </TD>\n";
        echo "  </TR>\n";
    }
    echo "  <TR>";
    echo "      <TD width='30%'></TD>";
    echo "      <TD width='50%'><input type='submit' value='Continue'
name='submit'>&nbsp;<input type='Reset'></TD>";
    echo "  </TR>";
    echo "  <INPUT type='Hidden' value='$y' name='no_of_loads'>";
    echo "</table>";
    echo "</form>";
}
else if (isset($pressure_drop_nodes))
{

  for ($i=1;$i<=$no_of_loads;$i++)
  {
    $to_node='to_node'.$i;
    $type='type'.$i;
    $units='units'.$i;
    $value='pre_dis'.$i;
    $to_node =$HTTP_POST_VARS[$to_node];
    $type    =$HTTP_POST_VARS[$type];
    $units   =$HTTP_POST_VARS[$units];
    $value   =$HTTP_POST_VARS[$value];

    if ($type=='PRE')
    {
        if($to_node!='')
        {
            echo "$i, $to_node, $type, $units, $value<br>\n";
            $temp=$to_node;
        }
        else if ($to_node!=='')
        {
            if ($i<=$temp)
            {
              echo "$i, $i, $type, $units, $value<br>\n";
            }
        }
    }
  }

  for ($i=1;$i<=$no_of_loads;$i++)
  {
    $to_node='to_node'.$i;
    $type='type'.$i;
    $units='units'.$i;
    $value='pre_dis'.$i;
    $to_node =$HTTP_POST_VARS[$to_node];
    $type    =$HTTP_POST_VARS[$type];
    $units   =$HTTP_POST_VARS[$units];
    $value   =$HTTP_POST_VARS[$value];

    if ($type=='DIS')
    {
        if($to_node!='')
        {
            echo "$i, $to_node, $type, $units, $value<br>\n";
            $temp=$to_node;
        }
        else if ($to_node!=='')
        {
            if ($i<=$temp)
            {
              echo "$i, $i, $type, $units, $value<br>\n";
            }
        }
     }
  }

}


echo "-1/<br>";
echo "-1/<br>";
echo "-1/<br>";

for ($i=1;$i<=sizeof($nodes);$i++)
{
  $temp1[2*($i-1)]=$nodes[$i][0];
  $temp2[2*($i-1)]=$nodes[$i][1];
}
$merged=array_merge($temp1, $temp2);
$max=max($merged);
$min=min($merged);
$points=$pipes;
for ($i=1;$i<=sizeof($points);$i++)
{
  $points[$i][0]=floor( ($points[$i][0]*($size_x-10)/$max) );
  $points[$i][1]=floor( ($points[$i][1]*($size_y-10)/$max) );
}

$point_ids=$nodes;
for ($i=0;$i<sizeof($point_ids);$i++)
{
  $point_ids[$i][0]=floor( ($point_ids[$i][0]*($size_x-10)/$max) );
  $point_ids[$i][1]=floor( ($point_ids[$i][1]*($size_y-10)/$max) );
}


@fclose($fp);

for ($i=1;$i<=sizeof($points);$i++)
{
  $string=$string."&x".$i."=".$points[$i][0]."&y".$i."=".$points[$i][1];
}
for ($i=0;$i<sizeof($point_ids);$i++)
{

$string=$string."&id_x".$i."=".$point_ids[$i][0]."&id_y".$i."=".$point_ids[$
i][1];
}
$string=substr($string,
1)."&size=".sizeof($points)."&size_ids=".sizeof($point_ids);
$string="display.php?".$string."&size_x=".$size_x."&size_y=".$size_y;

echo "<MAP name=\"map\">";
for ($i=0;$i<sizeof($point_ids);$i++)
{
  echo "<AREA coords='".($point_ids[$i][0]+2).",";
  echo ($point_ids[$i][1]+2).",".
($point_ids[$i][0]-2).",".($point_ids[$i][1]-2);
//  echo "' alt=\"".($i+1)."\" href=\"".$i."\">";
echo "' alt=\"".($i+1)."\"
href=\"".$string."&zoom_x=".($point_ids[$i][0])."&zoom_y=".($point_ids[$i][1
])."\">";

}
echo "</MAP>";

echo "<img src='$string' usemap='#map' style='border-color:black'>";
file://echo "<a href='$string' usemap='#map'>link</a>";

display.php
<?
$factor=3.5;

for ($i=1;$i<=$size;$i++)
{
  $x='x'.$i;
  $y='y'.$i;
  $points[$i][0]=$HTTP_GET_VARS[$x];
  $points[$i][1]=$HTTP_GET_VARS[$y];
}

for ($i=0;$i<$size_ids;$i++)
{
  $x='id_x'.$i;
  $y='id_y'.$i;
  $point_ids[$i][0]=$HTTP_GET_VARS[$x];
  $point_ids[$i][1]=$HTTP_GET_VARS[$y];
}

if (isset($zoom_x) && isset($zoom_y))
{
  for($i=0;$i<sizeof($point_ids);$i++)
  {
 $x=($point_ids[$i][0]-($zoom_x-$size_x/2))*$factor-(($size_x/4)*$factor);
 $y=($point_ids[$i][1]-($zoom_y-$size_y/2))*$factor-(($size_y/4)*$factor);
    if ((($x>0)&&($x<$size_x))&&(($y>0)&&($y<$size_y)))
 {
   $n_point_ids[$i][0]=$x;
   $n_point_ids[$i][1]=$y;
 }
 else
 {
   $n_point_ids[$i][0]=-1;
   $n_point_ids[$i][1]=-1;
 }
  }
  for($i=1;$i<=sizeof($points);$i++)
  {
 $x=($points[$i][0]-($zoom_x-$size_x/2))*$factor-(($size_x/4)*$factor);
 $y=($points[$i][1]-($zoom_y-$size_y/2))*$factor-(($size_y/4)*$factor);
    if ((($x>0)&&($x<$size_x))&&(($y>0)&&($y<$size_y)))
 {
   $points[$i][0]=$x;
   $points[$i][1]=$y;
 }
 else
 {
   $points[$i][0]=-1;
   $points[$i][1]=-1;
 }
  }
}

file://Header("Content-type: image/gif");

$im=@imagecreate($size_x, $size_y);
$background_color = ImageColorAllocate ($im, 255, 255, 255);
$orange = ImageColorAllocate($im, 220, 210, 60);
$black  = ImageColorAllocate($im, 0, 0, 0);
$red    = ImageColorAllocate($im, 255, 0, 0);
$green  = ImageColorAllocate($im, 0, 255, 0);

if (!isset($zoom_x))
{
  for ($i=1;$i<=sizeof($points);$i=$i+2)
  {
   imageline($im, $points[$i][0], $points[$i][1], $points[$i+1][0],
$points[$i+1][1], $orange);
    ImageString($im, 7, ($points[$i][0]+$points[$i+1][0])/2-5,
($points[$i][1]+$points[$i+1][1])/2, ($i+1)/2,   $red);
  }
  for ($i=0;$i<sizeof($point_ids);$i++)


    $str=strval($i+1);
    ImageString($im, 7, $point_ids[$i][0]+1,   $point_ids[$i][1]+1,   $str,
$black);
    ImageRectangle($im,$point_ids[$i][0]+2,  $point_ids[$i][1]+2,
$point_ids[$i][0]-2,  $point_ids[$i][1]-2,  $black);
    imagefilltoborder ($im,$point_ids[$i][0],$point_ids[$i][1], $black,
$black);
  }
}
if (isset($zoom_x))
{
  for ($i=1;$i<=sizeof($points);$i=$i+2)
  {
    if(($points[$i][0]>0)&&($points[$i+1][0]>0))
 {
      imageline($im, $points[$i][0], $points[$i][1], $points[$i+1][0],
$points[$i+1][1], $orange);
      ImageString($im, 7, ($points[$i][0]+$points[$i+1][0])/2-5,
($points[$i][1]+$points[$i+1][1])/2, ($i+1)/2,   $red);
    }
  }
  for ($i=0;$i<sizeof($n_point_ids);$i++)


    if($n_point_ids[$i][0]>0)
 {
      $str=strval($i+1);
      ImageString($im, 7, $n_point_ids[$i][0]+1,   $n_point_ids[$i][1]+1,
$str,   $black);
      ImageRectangle($im,$n_point_ids[$i][0]+5,  $n_point_ids[$i][1]+5,
$n_point_ids[$i][0]-5,  $n_point_ids[$i][1]-5,  $black);
      file://imagefilltoborder ($im,$n_point_ids[$i][0],$n_point_ids[$i][1],
$black, $black);
 }
  }
}
Imagepng($im);
Imagepng($im, "map.png");
?>
?>
> > I create from the array the image from the network.When the txt file is
> > >21Kb there is no image, else all works perfect{with a smaller txt
file).I
> > am using php4,apache(sometimes my system hangs with this server) or OMNI
> > httpd(works fine).
> > If anybody know sth PLEASE HELP ME
> > I am newbie in php programming




--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]







I need to simulate this effect:  $array[$i] or \$something . $i, and have it
return $checkbox1 $checkbox2 etc. on up in a while loop.
Just doing it doesn't seem to work, but does anyone know of any work
arounds?  Or just the keyword I should be looking for to search the manual?

I have a form being generated from a database.  For every entry in the
database, there'll be a checkbox in the form.  Basically, I need a way of
accessing the values of that checkbox (any or all of the checkboxes can be
checked, too). The names of the checkbox would increment up like checkbox1
checkbox2 etc.  Since I have no clue how many people are in the database,
that increment needs to be some sort of variable, so I can read the value
from that checkbox (whether or not it's checked) when the form is submitted.
Did that make any sense?  Sorry I was so vague.





I installed php4 and supposidly configured it with apache and mysql.

When I go to a page with php in it it doesn't load it. Instead it
automatically prompts me to download it. I know this has to be an error on
my part and a common overlooked error on installation.

I did edit httpd.conf with the:

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

lines and since it prompts me to download instead of loading the page php
has to be recognized by the server. So what did I overlook that doesn't load
the .php file immidiately?


Any help would be appreciated.

Thanks,

-Jesse


______________________________________________
FREE Personalized Email at Mail.com
Sign up at http://www.mail.com/?sr=signup




Do you have a LoadModule line to load the PHP module?

On Fri, 19 Jan 2001, Thomas Anderson wrote:

> I installed php4 and supposidly configured it with apache and mysql.
>
> When I go to a page with php in it it doesn't load it. Instead it
> automatically prompts me to download it. I know this has to be an error on
> my part and a common overlooked error on installation.
>
> I did edit httpd.conf with the:
>
> AddType application/x-httpd-php .php
> AddType application/x-httpd-php-source .phps
>
> lines and since it prompts me to download instead of loading the page php
> has to be recognized by the server. So what did I overlook that doesn't load
> the .php file immidiately?
>
>
> Any help would be appreciated.
>
> Thanks,
>
> -Jesse
>
>
> ______________________________________________
> FREE Personalized Email at Mail.com
> Sign up at http://www.mail.com/?sr=signup
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>





Can anyone tell me how to display both jpg and gif images.  Basically,
what i've got is:
<img src="$filedir/$CUserName".jpg>

Now, I know I probably need slashes in there and I played around with it
but no luck. Where do I put them?

Thanks,
Mike






I have a BLOB field in a MySQL database that I want to parse into my page using PHP.  
For instance, in this field might be the following:

<?  echo "test";  ?>

So when I access this field in PHP I want it to display "test".

Is this possible?




Please email me directly with your response.  I am not subscribed to the list.  Thankz 
in advance.


----- Original Message ----- 
From: [ rswfire ] 
To: 
Sent: Friday, January 19, 2001 9:56 PM
Subject: PHP Parse MySQL Field???


I have a BLOB field in a MySQL database that I want to parse into my page using PHP.  
For instance, in this field might be the following:

<?  echo "test";  ?>

So when I access this field in PHP I want it to display "test".

Is this possible?




Can anyone recommend a good FAQ, Q&A or Knowledge Base script written in PHP?
Preferably one with an administration section and a queue for questions to be answered.

Larentium




I get an error when doing this....

class Something
{
    var $something;

    function Something($this->something)
    {
        More somethings
    }

}

The error tells me that I need a ")" in the line the function call is in.  If I take 
the "$this->something" it will parse fine.  Can you not do this?


James




I'm trying to make it so I can download the image from a given URL and
rewrite it locally on the server. I can connect to the server and get the
image and display it. but as soon as I write it it doesn't work, I get
either an empty image or a string holder. The code is bleow. the hard coding
is just for testing purposes

Chris



function downloadfile($url, $imageDir)
 {
  if(!$file = fopen($url , "r"))
   {
    echo ("couldn't open $url\n");
   }
  else
   {
    #fpassthru($file);
    if($file2 = fopen("/www/sinead/images/Full/Sinead200.jpg", "w"))
     {
      $content=fread($file, filesize("$file"));
      fwrite($file2, $content, filesize("$file"));
      echo ("$file2 created");
     }
   }
 }
?>







ibase_num_fields() isn't functional in php 4 - anyone have any ideas to
work around this ?

I'm checking the number of results for a query to check if a
user/password is correct -I suppose I could just do a fetch_row() on the
result and test if thats empty or not - but I'll only do that  as a last
resort


Reply via email to