php-general Digest 14 Mar 2001 13:57:07 -0000 Issue 566

Topics (messages 43754 through 43829):

Re: tutorials on good database design
        43754 by: Jeff Oien
        43755 by: Andrew Halliday
        43757 by: Justin French

foreach() faster than while()?
        43756 by: Yasuo Ohgaki
        43781 by: Chris Adams
        43786 by: Yasuo Ohgaki

Re: [Q] session variables wouldn't keep contents.
        43758 by: Yasuo Ohgaki
        43783 by: Yasuo Ohgaki
        43787 by: Chung Ha-Nyung
        43791 by: Yasuo Ohgaki
        43794 by: Chung Ha-Nyung
        43798 by: Chung Ha-Nyung
        43802 by: Yasuo Ohgaki
        43809 by: Christian Reiniger

RE:PHP | MySQL Search
        43759 by: Dennis Gearon
        43760 by: Rick St Jean

Authenticating happening on another box.
        43761 by: Brad Kittredge

Re: $HTTP_POST_VARS
        43762 by: Dennis Gearon

Weird problem with Win2k
        43763 by: Tyler Longren

Search & display *.txt files in dir
        43764 by: Andrew V. Romero
        43767 by: David Robley
        43770 by: Andrew V. Romero

software localization with PHP
        43765 by: Tao
        43778 by: Leavell Digital Design
        43795 by: Christian Reiniger

php call java class to update database
        43766 by: vvsalon

Multi-Step Script
        43768 by: Andrew V. Romero
        43771 by: Rick St Jean
        43772 by: David Robley
        43779 by: Leavell Digital Design
        43780 by: Jason Murray
        43782 by: Leavell Digital Design
        43803 by: Jens Nedal

HTML character escape codes from beyond
        43769 by: Rob Salmond

Re: Server side maps
        43773 by: David Robley

Re: Getting name of the main file from external included s
        43774 by: Don Read

I need the command line...
        43775 by: Dhaval Desai
        43776 by: Jacky.lilst
        43777 by: Jack Dempsey

Setting up test station on win 95
        43784 by: Dennis Gearon
        43785 by: Leavell Digital Design

Using sessions
        43788 by: Rosen
        43792 by: Yasuo Ohgaki
        43797 by: Rosen
        43800 by: Stewart Taylor

Re: Getting name of the main file from external included script..
        43789 by: Christian Reiniger

round up number
        43790 by: Jacky.lilst
        43799 by: Johan Holst Nielsen

Re: replacing a line in a file
        43793 by: Tim Ward

Re: [?] Call a function with a button/link click?
        43796 by: Tim Ward

Re: Session problem
        43801 by: Pavel Kalian

I want this magic directory
        43804 by: Alex

Re: update two frames at once?
        43805 by: Jens Nedal

How to include in PHP?
        43806 by: Costas
        43807 by: Tshering Norbu

database abstraction module
        43808 by: Marc Boeren

Execute sql a number of times
        43810 by: Wade Halsey
        43811 by: Jon Haworth

Problems with mail function
        43812 by: Kike

DSO x CGI
        43813 by: Christian Dechery

Linking Libraries ...
        43814 by: James Marshall
        43816 by: Johan Holst Nielsen

switch with multiple case
        43815 by: Christian Dechery
        43817 by: Phil Driscoll
        43818 by: Matt Williams

CGI Question?
        43819 by: Dan Pupek

writing to a text file
        43820 by: george

install
        43821 by: hananet
        43824 by: Jon Haworth

IMAP sort help.
        43822 by: Terrence Wong

(rac)Php dobut with an extension
        43823 by: Celestino Roberto Alejandro

Re: Good Free PHP Editor?
        43825 by: b0ld b0lb

Re: Mysql Show SQL
        43826 by: Jason Stechschulte

Linux/Apache/PHP & Windows/IIS/ColdFusion
        43827 by: Joe Sheble (Wizaerd)

Day of Week??
        43828 by: Bruno Freire
        43829 by: Boget, Chris

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]


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


> I agree - throw us some examples of what you're thinking about, Justin.
> 
> Jason

I'm not Justin but I have a question. I would like to write a billing 
database to keep track of my hours for clients. I would like to 
keep track of what date I've been paid through and then create
a report for the hours that I haven't been paid for yet. How do I 
-best tell the database when I've been paid
  -there may be more than one entry for each day
-create a report for the dates since I was last paid

Jeff Oien




It should be just as simple as understanding the following terms and when
they should be used:
- entity
- attribute
- relationship
- cardinality
- first normal form
- second normal form
- third normal form
- fourth normal form
- boyce-codd normal form (BCNF)
- fifth normal form (could ignore this one if not going hard-core :)

The normal forms are the most important - if you know and understand them,
they will basically build a wholesome relational database for you (up to
fourth normal form) ... the only decisions to be made beyond what fourth
normal form will 'make for you' is how far you want to go in splitting up
entities...

AndrewH

----- Original Message -----
From: "Jason Murray" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Cc: "php" <[EMAIL PROTECTED]>
Sent: Wednesday, March 14, 2001 12:19 PM
Subject: RE: [PHP] tutorials on good database design


> > Hmmmm... while there are abstract ideas which are generally useful
> > and prudent to adhere to, I don't think most people understand them
> > too well as abstracts and need concrete examples to map them to.
> >
> > Hence the employee contact database examples.  And simple
> > shopping cart examples.  :)
>
> True - I find the best way to explain database design to someone is by
> having them design a database (as with someone here last week whom I
> helped out with an office sports tipping database as a little how-to-SQL
> project) and help them out as they go.
>
> > Do you have some real-life examples that you'd care to discuss in the
> > open? Using real-life examples (with the added realism of budgets,
> > legacy code, deadlines, etc.) may help everyone here.
>
> I agree - throw us some examples of what you're thinking about, Justin.
>
> Jason
>
> --
> Jason Murray
> [EMAIL PROTECTED]
> Web Design Team, Melbourne IT
> Fetch the comfy chair!
>
> --
> 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]
>





Jason Murray wrote:

> True - I find the best way to explain database design to someone is by
> having them design a database (as with someone here last week whom I
> helped out with an office sports tipping database as a little how-to-SQL
> project) and help them out as they go.

First up, thanks to everyone for the quick replies!! Went out to lunch,
came back, lot's of replies -- thanks :)

I'll have to dig through the hard drive, and find the data stuff that i
was working on a while back, so that we can discuss a real world example.

I'll probably post it late today or tomorrow.


Justin




It seems foreach() operates much faster than equivalent while() loop. This is result is not what I expect. Foreach() operates on copy of array and I thought it would work a little slower than while(). Anyone has a good explanation why foreach is faster? i.e. What kind of overhead cause this? I'm using PHP4.0.4pl1 as Apache DSO on Linux. and curious about this result. Thanks. ======= output ========= Array ( [0] => Array ( [name] => Start [time] => 984534909.65571400 [diff] => - [total] => 0 ) [1] => Array ( [name] => Marker: FOREACH [time] => 984534913.41161600 [diff] => 3.755902 [total] => 3.755902 ) [2] => Array ( [name] => Marker: WHILE [time] => 984534919.34682700 [diff] => 5.935211 [total] => 9.691113 ) [3] => Array ( [name] => Stop [time] => 984534919.34700000 [diff] => 0.000173 [total] => 9.691286 ) ) ========= end ================ ========= code ========== <html> <head> <title>Foreach & While Bench</title> </head> <body bgcolor="#FFFFFF"> <pre> <?php require_once('classlib/Benchmark/Timer.php'); // PEAR Timer.php $timer = new Benchmark_Timer; $timer->start(); for ($i = 0; $i < 10000; $i++) { foreach($HTTP_SERVER_VARS as $k => $v) { $key = $k; $val = $v; } } $timer->set_marker("Marker: FOREACH"); for ($i = 0; $i < 10000; $i++) { reset($HTTP_SERVER_VARS); while(list($k,$v) = each($HTTP_SERVER_VARS)) { $key = $k; $val = $v; } } $timer->set_marker("Marker: WHILE"); $timer->stop(); $profiling = $timer->get_profiling(); print_r($profiling); ?> </pre> </body> </html> ======== code ========== Yasuo Ohgaki ========================= My favorite links [RFC] http://www.faqs.org/rfcs/ [W3C] http://www.w3.org/ [PHP Manual] http://www.php.net/manual/en/



On 13 Mar 2001 18:10:45 -0800, Yasuo Ohgaki <[EMAIL PROTECTED]> wrote:
>It seems foreach() operates much faster than equivalent while() loop.
>This is result is not what I expect. Foreach() operates on copy of array and I
>thought it would work a little slower than while().

Copies aren't necessarily copies - Zend includes a feature where a new variable
will point at the old one until something changes - if all you're doing is
reading that data, that never happens and it never needs to copy the actual
data.

Your while loop does two variable assignments in each loop and I doubt the
underlying engine is smart enough to play the same trick with the variables in
a list() assignment. Even if it was, it'd still have the difference of doing it
twice with whatever additional overhead list() imposes.

Disclaimer: This is all speculation. I could quite easily be wrong. If you want
a sure answer, take a look at the source.




Thank you for your reply, Chris. ----- Original Message ----- From: "Chris Adams" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Wednesday, March 14, 2001 3:50 PM Subject: Re: [PHP] foreach() faster than while()? > On 13 Mar 2001 18:10:45 -0800, Yasuo Ohgaki <[EMAIL PROTECTED]> wrote: > >It seems foreach() operates much faster than equivalent while() loop. > >This is result is not what I expect. Foreach() operates on copy of array and I > >thought it would work a little slower than while(). > > Copies aren't necessarily copies - Zend includes a feature where a new variable > will point at the old one until something changes - if all you're doing is > reading that data, that never happens and it never needs to copy the actual > data. I completly forgot about this great PHP4 feature!! It raises another question: Huge/large function parameter, that is passed by value, does not have to be a reference unless programmer needs to change the value? I changed the test code to see what happens. The result was the same. This implies programmer should not use pass by reference unless programmer want to change parameter. (This fact makes my PHP code cleaner :-) Function parameter: Pass by Value and Pass by Reference. Parameter: Single 512KB string read from /dev/urandom Iterations: 100,000 times ======= RESULT =========== Array ( [0] => Array ( [name] => Start [time] => 984556336.83792900 [diff] => - [total] => 0 ) [1] => Array ( [name] => Marker: PASS BY VALUE [time] => 984556338.39530900 [diff] => 1.557380 [total] => 1.557380 ) [2] => Array ( [name] => Marker: PASS BY REFERENCE [time] => 984556339.93990100 [diff] => 1.544592 [total] => 3.101972 ) [3] => Array ( [name] => Stop [time] => 984556339.94007500 [diff] => 0.000174 [total] => 3.102146 ) ) ==================================== > Your while loop does two variable assignments in each loop and I doubt the > underlying engine is smart enough to play the same trick with the variables in > a list() assignment. Even if it was, it'd still have the difference of doing it > twice with whatever additional overhead list() imposes. Agreed. list() or/and each() must be making the difference. > Disclaimer: This is all speculation. I could quite easily be wrong. If you want > a sure answer, take a look at the source. I agree with you and it sound fair explanation to me. >From now on, I decided to use foreach instead of while whenever appropriate. I'll look into the source when I have a time. It's a great finding to me that I don't have use "pass by reference" for large parameters. Thanks again. -- Yasuo Ohgaki



SNIP
>
>     YO> You must start session before output anything to browser, or you must
use
>     YO> buffering to do this,
>     YO> or you must use URL mode for session.
>     YO> i.e. This code sends "<html><body>" before starting session and cookie
header
>     YO> must be sent before if session is cookie mode.
>
>     YO> I recommend to write session_start() before programmers do anything.
>
>  I modified that way. But no effect. still not work correctly.
>  After reloading, session variables are emptied. ;(
>
SNIP

Is the session data created? If you are using file or user session handler, you
should be able to see file or record for the session. If you are using file
session handler, what is directory permission for session data storage? Nobody
need to have write permission usually. (You are using Apache on Linux, right?)

Sounds like it is the problem to me.

Regards,

Yasuo Ohgaki





>  As I posted right before, file is created in /tmp.
>  Franlking speaking, I did not make any change to default settings of php.ini
>  In other words,
>     session.save_handler = files
>     session.save_path    = /tmp

Then , as I wrote previous mail, you should at least have session data files
there. (I forgot the exact name. I think it contains session id) Do you see any
session data files? Is your session id changing everytime? or you don't have
session id at all?  Do you see session module info in your phpinfo? Is it
correct? Do you use E_ALL for error reporting? (You may see some errors like
oops header already sent)

Something must be wrong, since your environment is similar to that I have.

Regards,

Yasuo Ohgaki




>>>>> "YO" == Yasuo Ohgaki <[EMAIL PROTECTED]> writes:

    >   As I posted right before, file is created in /tmp.
    >   Franlking speaking, I did not make any change to default settings of php.ini
    >   In other words,
    >      session.save_handler = files
    >      session.save_path    = /tmp

    YO> Then , as I wrote previous mail, you should at least have session data files
    YO> there. (I forgot the exact name. I think it contains session id) Do you see any
    YO> session data files? Is your session id changing everytime? or you don't have
    YO> session id at all?  Do you see session module info in your phpinfo? Is it
    YO> correct? Do you use E_ALL for error reporting? (You may see some errors like
    YO> oops header already sent)

  Certainly are there data files which look like "sess_sessionid" in /tmp and
  changed everytime when I reload the web page. And sessoinid is the same as
  the value of cookie variable, PHPSESSID. Up to this stage does things seem
  to go well. I think so.

  phpinfo result looks correct...almost.
  *THERE'S NO HTTP_SESSION_VARS* in PHP variables!! although I used session_start()
  and session_register()! It is incorrect, isn't it?

  I can see session module info in my phpinfo and it is correct. ;(
  Surely I set
    error_reporting = E_ALL
    display_errors = On
    display_startup_errors = On

  and no error/warning messages in the page. 

    YO> Something must be wrong, since your environment is similar to that I have.

  I found something!
  If I set register_globals to Off in php.ini, then session *seems* to work well.
  In /tmp, session data file contains both of variable name and value and I can
  use $HTTP_SESSION_VARS["variable"].
  BUT, as before is there no HTTP_SESSION_VARS in PHP variables section of phpinfo.

  I'm so confused and think things are getting weirder. ;(

    YO> Regards,

    YO> Yasuo Ohgaki

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

-- 
 Chung Ha-Nyung <[EMAIL PROTECTED]>




----- Original Message -----
From: "Chung Ha-Nyung" <[EMAIL PROTECTED]>
To: "Yasuo Ohgaki" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Wednesday, March 14, 2001 5:07 PM
Subject: Re: [PHP] [Q] session variables wouldn't keep contents.


>
>   I found something!
>   If I set register_globals to Off in php.ini, then session *seems* to work
well.
>   In /tmp, session data file contains both of variable name and value and I
can
>   use $HTTP_SESSION_VARS["variable"].
>   BUT, as before is there no HTTP_SESSION_VARS in PHP variables section of
phpinfo.
>
>   I'm so confused and think things are getting weirder. ;(
>

I set "register_globals = Off" for many reasons.
Session may not work with "register_globals = On"??
It may be a bug. How about post it as a bug, if you don't like it and there is
no such a bug report.

Regards,

--
Yasuo Ohgaki




>>>>> "YO" == Yasuo Ohgaki <[EMAIL PROTECTED]> writes:

    YO> ----- Original Message -----
    YO> From: "Chung Ha-Nyung" <[EMAIL PROTECTED]>
    YO> To: "Yasuo Ohgaki" <[EMAIL PROTECTED]>
    YO> Cc: <[EMAIL PROTECTED]>
    YO> Sent: Wednesday, March 14, 2001 5:07 PM
    YO> Subject: Re: [PHP] [Q] session variables wouldn't keep contents.

    > 
    >    I found something!
    >    If I set register_globals to Off in php.ini, then session *seems* to work
    YO> well.
    >    In /tmp, session data file contains both of variable name and value and I
    YO> can
    >    use $HTTP_SESSION_VARS["variable"].
    >    BUT, as before is there no HTTP_SESSION_VARS in PHP variables section of
    YO> phpinfo.
    > 
    >    I'm so confused and think things are getting weirder. ;(
    > 

    YO> I set "register_globals = Off" for many reasons.
    YO> Session may not work with "register_globals = On"??
    YO> It may be a bug. How about post it as a bug, if you don't like it and there is
    YO> no such a bug report.

  Then, is it not odd that there's no HTTP_SESSION_VARS in PHP Variables
  section of phpinfo?
  
    YO> Regards,

    YO> --
    YO> Yasuo Ohgaki

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

-- 
 Chung Ha-Nyung <[EMAIL PROTECTED]>




>>>>> "YO" == Yasuo Ohgaki <[EMAIL PROTECTED]> writes:

    YO> ----- Original Message -----
    YO> From: "Chung Ha-Nyung" <[EMAIL PROTECTED]>
    YO> To: "Yasuo Ohgaki" <[EMAIL PROTECTED]>
    YO> Cc: <[EMAIL PROTECTED]>
    YO> Sent: Wednesday, March 14, 2001 5:07 PM
    YO> Subject: Re: [PHP] [Q] session variables wouldn't keep contents.

    > 
    >    I found something!
    >    If I set register_globals to Off in php.ini, then session *seems* to work
    YO> well.
    >    In /tmp, session data file contains both of variable name and value and I
    YO> can
    >    use $HTTP_SESSION_VARS["variable"].
    >    BUT, as before is there no HTTP_SESSION_VARS in PHP variables section of
    YO> phpinfo.
    > 
    >    I'm so confused and think things are getting weirder. ;(
    > 

    YO> I set "register_globals = Off" for many reasons.
    YO> Session may not work with "register_globals = On"??
    YO> It may be a bug. How about post it as a bug, if you don't like it and there is
    YO> no such a bug report.

  Then, is it not odd that there's no HTTP_SESSION_VARS in PHP Variables
  section of phpinfo?
  
    YO> Regards,

    YO> --
    YO> Yasuo Ohgaki

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

-- 
 Chung Ha-Nyung <[EMAIL PROTECTED]>





SNIP
>     >
>     >    I found something!
>     >    If I set register_globals to Off in php.ini, then session *seems* to
work
>     YO> well.
>     >    In /tmp, session data file contains both of variable name and value
and I
>     YO> can
>     >    use $HTTP_SESSION_VARS["variable"].
>     >    BUT, as before is there no HTTP_SESSION_VARS in PHP variables section
of
>     YO> phpinfo.
>     >
>     >    I'm so confused and think things are getting weirder. ;(
>     >
>
>     YO> I set "register_globals = Off" for many reasons.
>     YO> Session may not work with "register_globals = On"??
>     YO> It may be a bug. How about post it as a bug, if you don't like it and
there is
>     YO> no such a bug report.
>
>   Then, is it not odd that there's no HTTP_SESSION_VARS in PHP Variables
>   section of phpinfo?
>

I think you might found a new bug in phpinfo().
I don't see HTTP_SESSION_VARS in PHP Variables section neither!! I didn't notice
it.
Question is 'Do developers consider this as a bug or the way it should be'.
How about post a mail to php-dev list?

Regards,
--
Yasuo Ohgaki




On Wednesday 14 March 2001 09:33, you wrote:

> I set "register_globals = Off" for many reasons.
> Session may not work with "register_globals = On"??

Works fine here (php 4.0.4 / Linux / Apache)

-- 
Christian Reiniger
LGDC Webmaster (http://sunsite.dk/lgdc/)

"Never doubt that a small group of thoughtful, committed people can
change the world...
Indeed, it's the only thing that ever has."

- Margaret Mead




I never have luck putting single quotes around anything but strings, or
column names when called for. You might try your SELECT statement
without 's

>Query 1 : 
>
>(I only want result on houses which are in country 2 and in price 3 and
>facility 1 must be included on the spot)
>
>I've used :
>    
>SELECT HouseID FROM Search WHERE CountryID='2' AND PriceID='3' AND
>(FacilityID='5')




If the fields are all integers then it is:

>SELECT HouseID FROM Search WHERE CountryID=2 AND PriceID=3 AND (FacilityID=5)

Rick




At 07:12 PM 3/13/01 -0800, Dennis Gearon wrote:
>I never have luck putting single quotes around anything but strings, or
>column names when called for. You might try your SELECT statement
>without 's
>
> >Query 1 :
> >
> >(I only want result on houses which are in country 2 and in price 3 and
> >facility 1 must be included on the spot)
> >
> >I've used :
> >
> >SELECT HouseID FROM Search WHERE CountryID='2' AND PriceID='3' AND
> >(FacilityID='5')
>
>--
>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]

##########################################################
#  Rick St Jean,
#  [EMAIL PROTECTED]
#  President of Design Shark,
#  http://www.designshark.com/
#  Quick Contact:  http://www.designshark.com/messaging.ihtml
#  Tel: 905-684-2952
##########################################################





I hope I can pose this question sensibly.

I'm working on an application that will supply somewhat sensitive
information to users that are authenticated against another server, and
I'd like to know how this is possible:

The user request a "home" page that will sit on an NT/IIS /ASP server, and
they will be authenticated at that time (I don't know anything about IIS, so
the details are unknown to me).  This "home" page will provide a URL to
pages on my server (which runs UNIX/APACHE/PHP3).  Since the user was
authenticated on the IIS server, I wondering if there is any way for the
USER_AGENT to automatically be authenticated on my server (sort of a
hand-off of the authentication between servers) , without the
necessity of re-entering a userid and password.

Security for this application is important (we're behind a firewall) but
not crucial.  I'm just trying to come up with something reasonable.

Has anyone done this before?

Thanks in advance.

[EMAIL PROTECTED]




Check your browser settings, I had this problem when I had the 'check
page never' setting selected, and it went away when I set it to 'check
every session'

>I am having a similar problem as the original poster.  In my case, I _want_
>the second sumbission to overwrite the first, but it's not happening.  What
>I have is a radio button list all named="update" each with it's own value
>(ie. 2,3,4,5,etc.).  The form is self-submitting and tests on 'update' to
>know how to proceed.  What I'm experiencing is that after the first
>submission, printing out '$HTTP_POST_VARS' array gives the correct update
>value.  Subsequent submissions also show this same value no matter what
>value is selected in the form.




Hello everybody,

I haven't made any changes to my system lately.  This box is running Win2k
w/ SP1.  Whenever I try to run php.exe, I get the following error:
Application popup: php.exe - Entry Point Not Found: The procedure entry
point ??_U@YAPAXI@Z could not be located in the dynamic link library
MSVCRT.dll.

Does anybody have any idea why this occurs?  This also happens when I try to
run Paint Shop Pro.  So it's not PHP itself.  When PHP is started on boot,
the error is logged to the event log.

Anybody seen anything like this before?

Thanks,
Tyler Longren





Is there a way to have php display all the .txt files in a directory?  I
checked in the manual but didn't see anything that would seem to help me
do this.  Thanks for any help.
-Andrew V. Romero
    To reply personally, remove all numbers from my address.





On Wed, 14 Mar 2001 15:20, Andrew V. Romero wrote:
> Is there a way to have php display all the .txt files in a directory? 
> I checked in the manual but didn't see anything that would seem to help
> me do this.  Thanks for any help.

Wasn't this already asked and answered today? Anyhow, see the example for 
readdir; you just need to expand the second example with a test (regex, 
substr, whatever) that tests for .txt on the end of the filename.


-- 
David Robley                        | WEBMASTER & Mail List Admin
RESEARCH CENTRE FOR INJURY STUDIES  | http://www.nisu.flinders.edu.au/
AusEinet                            | http://auseinet.flinders.edu.au/
            Flinders University, ADELAIDE, SOUTH AUSTRALIA




Wow, that exact question was asked.  Sorry everyone.
Thanks anyway.

David Robley wrote:

> On Wed, 14 Mar 2001 15:20, Andrew V. Romero wrote:
> > Is there a way to have php display all the .txt files in a directory?
> > I checked in the manual but didn't see anything that would seem to help
> > me do this.  Thanks for any help.
>
> Wasn't this already asked and answered today? Anyhow, see the example for
> readdir; you just need to expand the second example with a test (regex,
> substr, whatever) that tests for .txt on the end of the filename.
>
> --
> David Robley                        | WEBMASTER & Mail List Admin
> RESEARCH CENTRE FOR INJURY STUDIES  | http://www.nisu.flinders.edu.au/
> AusEinet                            | http://auseinet.flinders.edu.au/
>             Flinders University, ADELAIDE, SOUTH AUSTRALIA
>
> --
> 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 all,

I have a question about localizing PHP scripts.  I understand that for basic
localization one can have a "strings" file for each language, which contains
string variables and values such as:
    <?php
        $title = "Welcome!";
        $error = "An error occurred.";
    ?>

Then, in the scripts just "include" the language file at the beginning and
simply call the strings by their variable names.  The issue I have is when
embedding variables within these strings.  Suppose I need to call the user
by his/her first name, in the strings file I would have a variable like
this:
        $greeting = "Welcome! $first_name";

The problem is, the strings file is loaded at the beginning of the script
before $first_name was set, so the $greeting string will come out as
"Welcome! ", with $first_name being an empty string.  Even if I loaded the
strings file after the $first_name variable is set, the problem still
remains - when $first_name variable is changed, the strings file has to be
reloaded.

What is the best way of dealing with this problem?  Is there a place to find
"best practices" on localizing PHP software?

Tao






You can use constants:

in your language file
define("HELLO", OLA);

in your script  which includes the language file you can write
$greeting = HELLO . " $first_name";

print $greeting;


Kevin Leavell
[EMAIL PROTECTED]
P 406.829.8989
C 406.240.4595

---> -----Original Message-----
---> From: Tao [mailto:[EMAIL PROTECTED]]
---> Sent: Tuesday, March 13, 2001 9:50 PM
---> To: [EMAIL PROTECTED]
---> Subject: [PHP] software localization with PHP
--->
--->
---> Hi all,
--->
---> I have a question about localizing PHP scripts.  I understand
---> that for basic
---> localization one can have a "strings" file for each language,
---> which contains
---> string variables and values such as:
--->     <?php
--->         $title = "Welcome!";
--->         $error = "An error occurred.";
--->     ?>
--->
---> Then, in the scripts just "include" the language file at the
---> beginning and
---> simply call the strings by their variable names.  The issue I
---> have is when
---> embedding variables within these strings.  Suppose I need to
---> call the user
---> by his/her first name, in the strings file I would have a variable like
---> this:
--->         $greeting = "Welcome! $first_name";
--->
---> The problem is, the strings file is loaded at the beginning of
---> the script
---> before $first_name was set, so the $greeting string will come out as
---> "Welcome! ", with $first_name being an empty string.  Even if
---> I loaded the
---> strings file after the $first_name variable is set, the problem still
---> remains - when $first_name variable is changed, the strings
---> file has to be
---> reloaded.
--->
---> What is the best way of dealing with this problem?  Is there a
---> place to find
---> "best practices" on localizing PHP software?
--->
---> Tao
--->
--->
--->
---> --
---> 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 Wednesday 14 March 2001 05:50, you wrote:

> I have a question about localizing PHP scripts.  I understand that for
> basic localization one can have a "strings" file for each language,
> which contains string variables and values such as:
>     <?php
>         $title = "Welcome!";
>         $error = "An error occurred.";
>     ?>

Have a look at the gettext extension for a (IMO more elegant) alternative.

-- 
Christian Reiniger
LGDC Webmaster (http://sunsite.dk/lgdc/)

Pretty cool, the kind of power information technology puts in our hands
these days.

- Securityfocus on probing 36000000 hosts for known problems in 3 weeks




I want to use php to call a java class to update database.
However, seems fail.
I have already specified the database driver on the java.class.path in
php.ini,
and have test the class can work well in dos.
Can anyone tell me where is the problem?
Thx all





Is it possible to use different parts of one php script for multiple
html forms?  I am not seeing how people create multiple pages of html
forms with each form importing information from the previous form.
Right now, for each html form page I have, I create one php script to
handle it but it would be nice to have just one php script in which only
certain parts execute depending on have variables have assignments.  One
way I was thinking of doing this is to have the html forms just keep
posting the information to itself whenever the submit button is hit and
then using a series of if else statements to evaluate where the program
is in relationship to the forms, would this type of system work?
What do you guys do?
-Andrew V. Romero
    To reply personally, remove all numbers from address.





Use switch with includes for each step.

switch()
{
     case 1:
         include(filestep1.php)
         break;
     case 2:
         include(filestep2.php)
         break;
     default:
         include(form.php)
}

but this way you can have a hierarchy....
and possibly run form one section into the next..

switch($step)
{
     case 1:
         include(filestep1.php) //list products
     case 2:
         include(filestep2.php) //list categories
         break;
     default:
         include(form.php)  //show list of options.
}

At 09:59 PM 3/13/01 -0700, you wrote:
>Is it possible to use different parts of one php script for multiple
>html forms?  I am not seeing how people create multiple pages of html
>forms with each form importing information from the previous form.
>Right now, for each html form page I have, I create one php script to
>handle it but it would be nice to have just one php script in which only
>certain parts execute depending on have variables have assignments.  One
>way I was thinking of doing this is to have the html forms just keep
>posting the information to itself whenever the submit button is hit and
>then using a series of if else statements to evaluate where the program
>is in relationship to the forms, would this type of system work?
>What do you guys do?
>-Andrew V. Romero
>     To reply personally, remove all numbers from address.
>
>
>--
>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]

##########################################################
#  Rick St Jean,
#  [EMAIL PROTECTED]
#  President of Design Shark,
#  http://www.designshark.com/
#  Quick Contact:  http://www.designshark.com/messaging.ihtml
#  Tel: 905-684-2952
##########################################################





On Wed, 14 Mar 2001 15:29, Andrew V. Romero wrote:
> Is it possible to use different parts of one php script for multiple
> html forms?  I am not seeing how people create multiple pages of html
> forms with each form importing information from the previous form.
> Right now, for each html form page I have, I create one php script to
> handle it but it would be nice to have just one php script in which
> only certain parts execute depending on have variables have
> assignments.  One way I was thinking of doing this is to have the html
> forms just keep posting the information to itself whenever the submit
> button is hit and then using a series of if else statements to evaluate
> where the program is in relationship to the forms, would this type of
> system work? What do you guys do?

Mmm, that's pretty much how I do it. You can dynamically assign values to 
the Submit button as required and check the value of the Submit variable 
to determine what your next action might be. Couple this with some 
includes also based on the Submit value and voila.....

-- 
David Robley                        | WEBMASTER & Mail List Admin
RESEARCH CENTRE FOR INJURY STUDIES  | http://www.nisu.flinders.edu.au/
AusEinet                            | http://auseinet.flinders.edu.au/
            Flinders University, ADELAIDE, SOUTH AUSTRALIA




use if statements

if( $submit ){
print "I love Montana";
>>>put form #2 in here w/ action = $PHP_SELF make sure you set $submit2 to
some value
)
elseif( $submit2 ){
print "Part two of script";
}
else{
>>>put your form in here w/ action= $PHP_SELF
}

This is a quicky but hopefully you get the idea.  Just assign values to
different variables.  Post the info back to $PHP_SELF and test for the
existence of those variables in your if statements.  Your single php script
could span an unlimited number of pages (as far as the end user is
concerned).

Kevin Leavell
[EMAIL PROTECTED]
P 406.829.8989
C 406.240.4595

---> -----Original Message-----
---> From: Andrew V. Romero [mailto:[EMAIL PROTECTED]]
---> Sent: Tuesday, March 13, 2001 9:59 PM
---> To: [EMAIL PROTECTED]
---> Subject: [PHP] Multi-Step Script
--->
--->
---> Is it possible to use different parts of one php script for multiple
---> html forms?  I am not seeing how people create multiple pages of html
---> forms with each form importing information from the previous form.
---> Right now, for each html form page I have, I create one php script to
---> handle it but it would be nice to have just one php script in
---> which only
---> certain parts execute depending on have variables have
---> assignments.  One
---> way I was thinking of doing this is to have the html forms just keep
---> posting the information to itself whenever the submit button is hit and
---> then using a series of if else statements to evaluate where the program
---> is in relationship to the forms, would this type of system work?
---> What do you guys do?
---> -Andrew V. Romero
--->     To reply personally, remove all numbers from address.
--->
--->
---> --
---> 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]






> if( $submit ){
> print "I love Montana";
> >>>put form #2 in here w/ action = $PHP_SELF make sure you 
> set $submit2 to
> some value
> )
> elseif( $submit2 ){
> print "Part two of script";
> }
> else{
> >>>put your form in here w/ action= $PHP_SELF
> }

Actually - do it in the reverse order, because then you can do error 
checking and gracefully "drop back" to a previous step if there's an
error.

ie:

if ($step == 3)
{
  // do stuff
}
if ($step == 2)
{
  // do stuff
}
if (!$step)
{
  // do stuff
}

Jason




Good point

Kevin Leavell
[EMAIL PROTECTED]
P 406.829.8989
C 406.240.4595 

---> -----Original Message-----
---> From: Jason Murray [mailto:[EMAIL PROTECTED]]
---> Sent: Tuesday, March 13, 2001 11:59 PM
---> To: 'Leavell Digital Design'; [EMAIL PROTECTED]
---> Subject: RE: [PHP] Multi-Step Script
---> 
---> 
---> > if( $submit ){
---> > print "I love Montana";
---> > >>>put form #2 in here w/ action = $PHP_SELF make sure you 
---> > set $submit2 to
---> > some value
---> > )
---> > elseif( $submit2 ){
---> > print "Part two of script";
---> > }
---> > else{
---> > >>>put your form in here w/ action= $PHP_SELF
---> > }
---> 
---> Actually - do it in the reverse order, because then you can do error 
---> checking and gracefully "drop back" to a previous step if there's an
---> error.
---> 
---> ie:
---> 
---> if ($step == 3)
---> {
--->   // do stuff
---> }
---> if ($step == 2)
---> {
--->   // do stuff
---> }
---> if (!$step)
---> {
--->   // do stuff
---> }
---> 
---> Jason
---> 
---> -- 
---> 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 14.03.2001 5:59 Uhr, Andrew V. Romero at [EMAIL PROTECTED]
wrote:

> Is it possible to use different parts of one php script for multiple
> html forms?  I am not seeing how people create multiple pages of html
> forms with each form importing information from the previous form.
> Right now, for each html form page I have, I create one php script to
> handle it but it would be nice to have just one php script in which only
> certain parts execute depending on have variables have assignments.  One
> way I was thinking of doing this is to have the html forms just keep
> posting the information to itself whenever the submit button is hit and
> then using a series of if else statements to evaluate where the program
> is in relationship to the forms, would this type of system work?
> What do you guys do?
> -Andrew V. Romero
> To reply personally, remove all numbers from address.
> 

Like some mentioned, reverse-programming is kinda crucial for error
checking. About FORMS, yes you can have multiple forms aslong as the dont
mismatch, you can even assign names to the forms for them to remain
distinct.
like <form name=bla ..... > I think it might even be possible to get that
formname and then see what you do with each form. The other way round with
if statements or switches works well though.

Jens Nedal





    A curiousity appeared in some code I put together almost six months ago
now.  The site owner emailed me the output of our script which pulls
together a collection of $HTTP_POST_VARS,  and emails them off as a plain
text document with some other information.  Strewn about in one of these
emails was &#somenumber; style html escaped character.  The number 61623
over and over at seemingly random locations.

    Aside from mail(), trim() and some sundry case manipulation functions
I've used nothing I can think of that would cause characters to be altered
this way.  Has anyone got a suggestion that might lead me in the right
direction?

    Much thanks,
    Rob Salmond.





On Wed, 14 Mar 2001 09:45, Kevin Williams wrote:

> >   Is it possible to use server side maps with PHP, as you can in CGI ?
>
>   Also is it possible to determine the x & y co-ords of a mouseclick ?
>
>   regards

If you are using Apache, have a look at the 'AddHandler imap-file map' 
which apparently allows you to use server-parsed imagemap files.

-- 
David Robley                        | WEBMASTER & Mail List Admin
RESEARCH CENTRE FOR INJURY STUDIES  | http://www.nisu.flinders.edu.au/
AusEinet                            | http://auseinet.flinders.edu.au/
            Flinders University, ADELAIDE, SOUTH AUSTRALIA





On 12-Mar-01 Aviv Revach wrote:
> Hey!
> 
> I already asked this once before, but nobody seems to answer. That's why 
> I'm re-writing
> my question.
> 
>      I have a main file named: "main.php3"
>      It includes an external php3 script named: "ext.php3"
> 
> Inside of the 'ext.php3' script - I need to know the full path
> of the file which included it (in this case - 
> 'http://www......./dir1/dir2/main.php3').
> How could I do that?
> 

Err ...  did you look at the output of

<?php
phpinfo();
?>

I'm sure some combination of
$SCRIPT_FILENAME, $SERVER_NAME, $PHP_SELF, or REQUEST_URI is what you
want.

-- 
Don Read                                         [EMAIL PROTECTED]
-- If you are going to sin, sin against God, not the bureaucracy. 
                  God will forgive you but the bureaucrats won't. 




Hi!

CAn anybody give me the command line of Mysql for
doing the following.

I want to have three columns

id
firstname
age

the id field mu auto_inrement..meaning it should
automatically goas 1.2.3.4.5.6 as someone inserts
values into firstname and age.



Thank You
Dhaval Desai


__________________________________________________
Do You Yahoo!?
Yahoo! Auctions - Buy the things you want at great prices.
http://auctions.yahoo.com/




select id,firstname,age from (table name);
this will do
Jack
[EMAIL PROTECTED]
"There is nothing more rewarding than reaching the goal you set for
yourself"
----- Original Message -----
From: Dhaval Desai <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, March 14, 2001 12:05 AM
Subject: [PHP] I need the command line...


> Hi!
>
> CAn anybody give me the command line of Mysql for
> doing the following.
>
> I want to have three columns
>
> id
> firstname
> age
>
> the id field mu auto_inrement..meaning it should
> automatically goas 1.2.3.4.5.6 as someone inserts
> values into firstname and age.
>
>
>
> Thank You
> Dhaval Desai
>
>
> __________________________________________________
> Do You Yahoo!?
> Yahoo! Auctions - Buy the things you want at great prices.
> http://auctions.yahoo.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]
>
>





i'm guessing you want a create clause:

CREATE TABLE foo ( id INT PRIMARY KEY NOT NULL AUTO_INCREMENT, firstname
CHAR(20), age INT);

you'll want to tweak this to meet your needs, but it should do the
trick...

jack
Dhaval Desai wrote:
> 
> Hi!
> 
> CAn anybody give me the command line of Mysql for
> doing the following.
> 
> I want to have three columns
> 
> id
> firstname
> age
> 
> the id field mu auto_inrement..meaning it should
> automatically goas 1.2.3.4.5.6 as someone inserts
> values into firstname and age.
> 
> Thank You
> Dhaval Desai
> 
> __________________________________________________
> Do You Yahoo!?
> Yahoo! Auctions - Buy the things you want at great prices.
> http://auctions.yahoo.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]




Are there binaries around where I could put together:

apache
MySQL
PHP 

on Win95 to run pages on 'localhost' so I could develop at home?
-- 
________________________________________________________________
Sites by friends of mine: http://www.myhiddentreasures.com/
________________________________________________________________
WARNING personal propaganda signature
TAKE WHAT YOU LIKE AND LEAVE THE REST

SINCE OUR GOVERNMENT WON'T PRESERVE OUR CLIMATE, IT'S UP TO US!
Imagine ** yourself ** and your kids now an endangered species
<1>Inflate automobile tires to near maximum in summer, -2psi in winter
<2>add insulation to house and hot water heater, and refrigerator,
<3>combine trips in cars, make less of them <4>buy cars, sports
vehicles and recreational vehicles with good if not best mileage
<4>put awnings over windows is summer, remove in winter. <5> add
solar hot water heating. <6>Push for energy recycling clothes
dryers <7> walk more, play outside with your kids! <8> let your
grass grow to 3-4 inches, chokes weeds, saves water and energy,
keeps house cooler <9> Put WHITE or REFLECTIVE materials on
roofs to send energy back into space. <10> Vote for burial of
logging slash onsite in logging areas for better watersheds
and less burned vegetation. <11> compost your leaves and grass,
bury in flower beds, lawns, gardens, or give away. <12> VOTE
for energy and CO2 ratings on ALL products and foods. KNOW how
much damage your purchases do to the climate. <13> Give your kids 
less stuff and more of you. <14> recycle everything you can <15>
limit your children to an average 1 per adult between all your 
marriages. (Only REPLACE yourself, not expand the population)




http://sourceforge.net/projects/phptriad/

There is also a tutorial over at phpbuilder.com

You can set up different vhosts on your local win machine for each client if
the need comes up.

Kevin Leavell
[EMAIL PROTECTED]
P 406.829.8989
C 406.240.4595

---> -----Original Message-----
---> From: Dennis Gearon [mailto:[EMAIL PROTECTED]]
---> Sent: Wednesday, March 14, 2001 12:31 AM
---> To: [EMAIL PROTECTED]
---> Subject: [PHP] Setting up test station on win 95
--->
--->
---> Are there binaries around where I could put together:
--->
---> apache
---> MySQL
---> PHP
--->
---> on Win95 to run pages on 'localhost' so I could develop at home?
---> --
---> ________________________________________________________________
---> Sites by friends of mine: http://www.myhiddentreasures.com/
---> ________________________________________________________________
---> WARNING personal propaganda signature
---> TAKE WHAT YOU LIKE AND LEAVE THE REST
--->
---> SINCE OUR GOVERNMENT WON'T PRESERVE OUR CLIMATE, IT'S UP TO US!
---> Imagine ** yourself ** and your kids now an endangered species
---> <1>Inflate automobile tires to near maximum in summer, -2psi in winter
---> <2>add insulation to house and hot water heater, and refrigerator,
---> <3>combine trips in cars, make less of them <4>buy cars, sports
---> vehicles and recreational vehicles with good if not best mileage
---> <4>put awnings over windows is summer, remove in winter. <5> add
---> solar hot water heating. <6>Push for energy recycling clothes
---> dryers <7> walk more, play outside with your kids! <8> let your
---> grass grow to 3-4 inches, chokes weeds, saves water and energy,
---> keeps house cooler <9> Put WHITE or REFLECTIVE materials on
---> roofs to send energy back into space. <10> Vote for burial of
---> logging slash onsite in logging areas for better watersheds
---> and less burned vegetation. <11> compost your leaves and grass,
---> bury in flower beds, lawns, gardens, or give away. <12> VOTE
---> for energy and CO2 ratings on ALL products and foods. KNOW how
---> much damage your purchases do to the climate. <13> Give your kids
---> less stuff and more of you. <14> recycle everything you can <15>
---> limit your children to an average 1 per adult between all your
---> marriages. (Only REPLACE yourself, not expand the population)
--->
---> --
---> 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,
When I use sessions, on the URL row of the browser shows
"PHPSESSID=XXXXCXXXXXXX".
Can I hide id ?

Thanks,
Rosen Marinov







"Rosen" <[EMAIL PROTECTED]> wrote in message 98n8ut$m26$[EMAIL PROTECTED]">news:98n8ut$m26$[EMAIL PROTECTED]... > Hi, > When I use sessions, on the URL row of the browser shows > "PHPSESSID=XXXXCXXXXXXX". > Can I hide id ? > > Thanks, > Rosen Marinov Use cookie for session. It seems there are some browsers that will not take cookie on initial request, and fallback to URL mode. See notes session section in Online PHP Manual for details. Regards, -- Yasuo Ohgaki



Thanks,
but cookies are disabled !

Rosen Marinov



""Yasuo Ohgaki"" <[EMAIL PROTECTED]> wrote in message
98nai7$2gb$[EMAIL PROTECTED]">news:98nai7$2gb$[EMAIL PROTECTED]...
> "Rosen" <[EMAIL PROTECTED]> wrote in message
> 98n8ut$m26$[EMAIL PROTECTED]">news:98n8ut$m26$[EMAIL PROTECTED]...
> > Hi,
> > When I use sessions, on the URL row of the browser shows
> > "PHPSESSID=XXXXCXXXXXXX".
> > Can I hide id ?
> >
> > Thanks,
> > Rosen Marinov
>
> Use cookie for session. It seems there are some browsers that will not
take
> cookie on initial request, and  fallback to URL mode. See notes session
section
> in Online PHP Manual for details.
>
> Regards,
> --
> Yasuo Ohgaki
>
>
>
> --
> 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]
>






An idea is to put the session id in your web page addresses.
e.g. http://level1/level2/12123234234234234234/test.php

Then setup your web server to filter all addresses to remove the session id
from the address before it is displayed in the browser window (you can set
apache to do this) so the user won't see it.

You can then write a little code to get the session id from the address (the
full address including session should be passed to your app).  And then
recreate the session etc..

I've got some code at home demonstrating this technique.  I can send it to
you later of you want it.



-Stewart


-----Original Message-----
From: Rosen [mailto:[EMAIL PROTECTED]]
Sent: 14 March 2001 08:52
To: [EMAIL PROTECTED]
Subject: Re: [PHP] Using sessions


Thanks,
but cookies are disabled !

Rosen Marinov



""Yasuo Ohgaki"" <[EMAIL PROTECTED]> wrote in message
98nai7$2gb$[EMAIL PROTECTED]">news:98nai7$2gb$[EMAIL PROTECTED]...
> "Rosen" <[EMAIL PROTECTED]> wrote in message
> 98n8ut$m26$[EMAIL PROTECTED]">news:98n8ut$m26$[EMAIL PROTECTED]...
> > Hi,
> > When I use sessions, on the URL row of the browser shows
> > "PHPSESSID=XXXXCXXXXXXX".
> > Can I hide id ?
> >
> > Thanks,
> > Rosen Marinov
>
> Use cookie for session. It seems there are some browsers that will not
take
> cookie on initial request, and  fallback to URL mode. See notes session
section
> in Online PHP Manual for details.
>
> Regards,
> --
> Yasuo Ohgaki
>
>
>
> --
> 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 Tuesday 13 March 2001 00:14, you wrote:

> I already asked this once before, but nobody seems to answer. That's
> why I'm re-writing
> my question.

Well, you waited about two hours. That's not much, even for a mailinglist 
like php-general.

-- 
Christian Reiniger
LGDC Webmaster (http://sunsite.dk/lgdc/)

Pretty cool, the kind of power information technology puts in our hands
these days.

- Securityfocus on probing 36000000 hosts for known problems in 3 weeks




How do I round up a lot of decimal number like 10.232656898 to be 10.23 ? Should I use 
this?
$num = 10.26564787;
$Rnum = round($num);
What would be the function I am looking for and how?
Jack
[EMAIL PROTECTED]
"There is nothing more rewarding than reaching the goal you set for yourself"




>How do I round up a lot of decimal number like 10.232656898 to be 10.23 ?
Should I use this?
>$num = 10.26564787;
>$Rnum = round($num);
>What would be the function I am looking for and how?


Try:
$num = 10.26564787;
$Rnum = round($num, 2);

/Johan





the point is that you can't replace part of a flat file. you can append to
the content or replace it all. if you want to replace part, you need to read
it all, amend the relevant line and then replace it all.

        Tim Ward
        Senior Systems Engineer

Please refer to the following disclaimer in respect of this message:
http://www.stivesdirect.com/e-mail-disclaimer.html


> -----Original Message-----
> From: enthalpy [mailto:[EMAIL PROTECTED]]
> Sent: 13 March 2001 23:56
> To: Henrik Hansen
> Cc: php general
> Subject: Re: [PHP] replacing a line in a file
> 
> 
> 
> that could work but i dont want to append the new line a the 
> bottom which it looks like thats what your doing.
> i need to replace the line where it is
> 
> <-----CoreComm-Internet-Services---http://core.com----->
> (Jon Marshall                 CoreComm Services Chicago)
> ([EMAIL PROTECTED]         Systems Engineer II)
> ([EMAIL PROTECTED]                   Network Operations)
> <-----Enthalpy.org-------------http://enthalpy.org----->
> ([EMAIL PROTECTED]             The World of Nothing)
> <------------------------------------------------------>
> 
> On Wed, 14 Mar 2001, Henrik Hansen wrote:
> 
> > maybe this?
> > 
> > while($line = fgets($fp, 1024)) {
> >     $line = str_replace("replace_this", "with_this", $line);
> >     $content .= $line;
> > }
> > 
> > fwrite($fp, $content);
> > 
> > --
> > Henrik Hansen
> > ----- Original Message -----
> > From: "enthalpy" <[EMAIL PROTECTED]>
> > To: <[EMAIL PROTECTED]>
> > Sent: Wednesday, March 14, 2001 12:29 AM
> > Subject: [PHP] replacing a line in a file
> > 
> > 
> > >
> > > having problems replacing a line in a file.
> > >
> > > need to search the whole document for a string and then 
> replace that line
> > with a string.
> > >
> > > any ideas?
> > >
> > > this is causing lots of problems now.
> > >
> > > $fpoint3 = fopen ($testshadow, "r+") or die("couldnt open 
> shadow file
> > again");
> > > $contents = fread ($fpoint3, $shadowfilesize);
> > > fputs ($fpoint3, ereg_replace("$data[0]:$shadow[1]", 
> "$data[0]:$data[1]",
> > $contents));
> > > fclose ($fpoint3);
> > >
> > > any ideas?
> > >
> > > <-----CoreComm-Internet-Services---http://core.com----->
> > > (Jon Marshall                 CoreComm Services Chicago)
> > > ([EMAIL PROTECTED]         Systems Engineer II)
> > > ([EMAIL PROTECTED]                   Network Operations)
> > > <-----Enthalpy.org-------------http://enthalpy.org----->
> > > ([EMAIL PROTECTED]             The World of Nothing)
> > > <------------------------------------------------------>
> > >
> > >
> > > --
> > > 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]
> > 
> > 
> 
> 




php works server side. you cannot get user to run anything in php without
resubmitting (posting or whatever) ... you need javascript if this is
something you can do client-side, if not you'll have to live with some sort
of resubmit.

        Tim Ward
        Senior Systems Engineer

Please refer to the following disclaimer in respect of this message:
http://www.stivesdirect.com/e-mail-disclaimer.html


> -----Original Message-----
> From: John Voth [mailto:[EMAIL PROTECTED]]
> Sent: 13 March 2001 18:23
> To: [EMAIL PROTECTED]
> Subject: [?] Call a function with a button/link click?
> 
> 
> 
> I am wondering how to call a function simply by clicking a button
> or a hyperlink?
> 
> I would like to use this technique to avoid passing things in a link
> 
> Presently, I use this technique: 
> <a href="../php/delete_something.php?tid=$thing_id">Delete</a>
> 
> I would like to clean things up by having one central or 
> common include
> file and just call functions out of it. The problem lies in 
> the passing
> of variables to that function - how to set something up so 
> that the user
> can click on something to activate that function with a variable.
> 
> Psuedocode:
> 
> if( buttonclick )
>   delete_thing($thing_id)
> 
> Am I making sense?
> 
> Thanks in advance.
> John
> 
> -- 
> 
> /====================================================================\
> | John Voth       Mobiltex Data Ltd.Calgary, Alberta,Canada, T1Y-4T7 |
> | [EMAIL PROTECTED]     403-291-2770, 403-259-6795 (fax)            |
> \====================================================================/
> 




set the session.save_path to a directory that exists on your system (for
example: session.save_path         = c:\temp)

Pavel


----- Original Message -----
From: "Brandon Orther" <[EMAIL PROTECTED]>
To: "PHP User Group" <[EMAIL PROTECTED]>
Sent: Tuesday, March 13, 2001 10:56 PM
Subject: [PHP] Session problem


> Hello,
>
> Does anyone know how to fix this error?
>
> Warning: open(/tmp\sess_4fb4c5778fe97ab351baca1d8db90abf, O_RDWR) failed:
m
> (2) in c:/htdocs/br/br.php on line 2
>
> 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]
>





I just want every customer on my site get his own unique id as his directory
name but the pages requested are all processed by the root.
Such as: customer1's url is http://www.mysite.com/2000123/
         customer2's url is http://www.mysite.com/2000124/
                                                  ^^^^^^^UID
and the pages requested are actually processed by http://www.mysite.com/

I want it to implement security and personalization. I don't want to use
.php?uid=XXX because of lazy. :)
thanks.










Yes you can and there is even a neater script that does it.
with thise you can update any amount of frames a t the same time.
Just well i got to find it. msg back in a few.....

Jens Nedal

on 12.03.2001 22:15 Uhr, Angerer, Chad at [EMAIL PROTECTED] wrote:

> Yes you can.. use Javascript
> 
> Look here.. http://www.virtualgeoff.com/junkyard/frames/multiple/
> 
> Chad
> 
> -----Original Message-----
> From: Michael George [mailto:[EMAIL PROTECTED]]
> Sent: Monday, March 12, 2001 3:06 PM
> To: [EMAIL PROTECTED]
> Subject: [PHP] update two frames at once?
> 
> 
> Hello al!
> 
> Is it possible to have two frames updated when cliking on one link?  I have
> a
> page that is broken into 4 parts:
> master title
> section title
> d section screen
> i
> r
> .
> 
> what I want is that when a link is clicked on in the directory (the left
> column), I'd like to update the section title *and* the section screen...
> 
> It seemed a cool layout at the time, but I'm thinking this isn't easily
> possible and I might just have to incorporate a section title on the section
> screen...  But before I rewrite it, I thought I'd ask here.
> 
> Thanks!
> 
> -Michael
> 
> P.S. I'd like to commend the regular posters to this list on being SOOO
> informative and patient!  Every small question to this list always
> gets several useful answers, even when I've seen questions asked over
> and again.





Im new to PHP and want to know if it is possible to reference PHP scripts
from a html page,  the equivalent to an <% include%> tag in asp.

If so what is the syntax?

Thanks










<?php
include ("file.php");
?>


NOBBY

>
>
> ----- Original Message -----
> From: Costas <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Wednesday, March 14, 2001 4:37 PM
> Subject: [PHP] How to include in PHP?
>
>
> > Im new to PHP and want to know if it is possible to reference PHP
scripts
> > from a html page,  the equivalent to an <% include%> tag in asp.
> >
> > If so what is the syntax?
> >
> > Thanks
> >
> >
> >
> > --
> > 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'ld like to announce the availability of a database abstraction module,
called 'dbx'.

It gives you the ability to code your database-enabled php-templates once
(for a specific database), and port to a different database later by just
changing the string "odbc" to "mysql" (e.g.) once. This assumes that you
have not built database-specific SQL-statements, of course. It still
actually uses the php database modules, so they are still a requirement.
What is taken of your hands is the looping through rows and fields (for
odbc) or just through rows (mysql) to retrieve your data. It gives you the
data in an array immediately, for both odbc and mysql.
For more info, read the documentation at http://www.guidance.nl/php/dbx/doc

It's freely (well, there is a license :-) available (incl. source and
documentation) at http://www.guidance.nl/php/dbx
Limitations: 
- so far it only supports the odbc and mysql module. Additional databases
could easily be supported too, so if you're a coder...
- only works with php4
- you must compile it yourself (but it compiles on Linux and Windows, I've
tried :-)

Any questions, remarks, whatever, please mail them directly to me
([EMAIL PROTECTED]) as I'm not subscribed to this list. I'ld be happy to
help, though!

Cheerio, Marc.

Guidance Rotterdam BV
http://www.guidance.nl





Hi

I need to execute an sql statement a certain number of times based on a users input

/* number of times to execute
$NumCases = $HTTP_POST_VARS['txtNumCases'];

/* sql to run
$GetDetails = sqlexecute("select b.accno,b.debttype, c.surname, c.initial 
,c.firstname, c.id_number, c.maidenname, c.addr_line1, c.addr_line2, c.addr_line3, 
c.addr_code, c.telnum, c.postaddress1, c.postaddress2, c.postaddress3, c.postpostcode, 
c.bankname, c.accountnumber, c.accounttype,m.magdistrictname from  bad b, client c, 
magdistrict m where b.accno = c.persal and m.code = b.magdistrictcode ");

I presume i need a while loop or someting similar but im really confused as to how to 
implement it.

Please note that I am running an Interbase database

Any help would be greatly appreciated






What about wrapping it in a FOR loop:

for ($counter = 1; $counter <= $NumCases; $counter++) {
        // do the sql stuff
}

(http://www.php.net/manual/en/control-structures.for.php)

I don't think the type of database will make any difference to this.


HTH
Jon


-----Original Message-----
From: Wade Halsey [mailto:[EMAIL PROTECTED]]
Sent: 14 March 2001 06:13
To: [EMAIL PROTECTED]
Subject: [PHP] Execute sql a number of times


Hi

I need to execute an sql statement a certain number of times based on a
users input

/* number of times to execute
$NumCases = $HTTP_POST_VARS['txtNumCases'];

/* sql to run
$GetDetails = sqlexecute("select b.accno,b.debttype, c.surname, c.initial
,c.firstname, c.id_number, c.maidenname, c.addr_line1, c.addr_line2,
c.addr_line3, c.addr_code, c.telnum, c.postaddress1, c.postaddress2,
c.postaddress3, c.postpostcode, c.bankname, c.accountnumber,
c.accounttype,m.magdistrictname from  bad b, client c, magdistrict m where
b.accno = c.persal and m.code = b.magdistrictcode ");

I presume i need a while loop or someting similar but im really confused as
to how to implement it.

Please note that I am running an Interbase database

Any help would be greatly appreciated


**********************************************************************
'The information included in this Email is of a confidential nature and is 
intended only for the addressee. If you are not the intended addressee, 
any disclosure, copying or distribution by you is prohibited and may be 
unlawful. Disclosure to any party other than the addressee, whether 
inadvertent or otherwise is not intended to waive privilege or confidentiality'

**********************************************************************




Hi,
I have a seious problem with the mail function. It does not send the emails.
It returns 1 but does not send them. I think it may be a problem with
sendmail permissions. Can you help me? Please.





What are the main differences of running PHP as a DSO Module or as CGI?

I had some problems running as DSO, cuz I need the mssq70 extension and 
everytime I ran a script it caused a GPF in php4ts.dll. So I switched back 
to CGI and the error disapeared.

I wanna know if I'm loosing something with CGI.
____________________________
. Christian Dechery (lemming)
. http://www.tanamesa.com.br
. Gaita-L Owner / Web Developer





Hi All,

This might be a really dumb question - I'm a bit of a newbie.

I have a hosting account that provides PHP, but it hasn't been compiled with
the IMAP libraries, and I really need these functions. Is there any way to
link the IMAP lib locally (ie: without root permissions)? I've used Perl
before and know that similar is possible.

Any help is much appreciated ...

Many Thanks
James Marshall






>I have a hosting account that provides PHP, but it hasn't been compiled
with
>the IMAP libraries, and I really need these functions. Is there any way to
>link the IMAP lib locally (ie: without root permissions)? I've used Perl
>before and know that similar is possible.

No, you have to compile PHP with the IMAP library! Try to contact your
provider an ask if they could install the library!

/Johan





In ASP, you can have something like:

<snip>
<%
        select case something
                case "this" do that
                case "those","them" do other
                case "crap","doesn't matter","whatever" do nothing
                case else print error
        end select
%>
</snip>

IN PHP you can't do cases like that, because like in C, u must have a 
constant, not a list of them.
Is there anyway to get pass this? Doing a case for each thing even tough it 
does the exact same thing as 10 others is going to get a little stupid code.
____________________________
. Christian Dechery (lemming)
. http://www.tanamesa.com.br
. Gaita-L Owner / Web Developer





Same as C

switch($something)
{
 case "this": do that;break;
 case "those":case "them": do other; break
 ...
 default: print error
}

Cheers
-- 
Phil Driscoll
Dial Solutions
+44 (0)113 294 5112
http://www.dialsolutions.com
http://www.dtonline.org






switch($something)
{
  case "this":
        do this;
        break;
  case "those":
  case "them":
        do other;
        break;
  case "crap":
  case "doesn't matter":
  case "whatever":
        do nothing;
        break;
  default:
        print error;
}

> <snip>
> <%
>       select case something
>               case "this" do that
>               case "those","them" do other
>               case "crap","doesn't matter","whatever" do nothing
>               case else print error
>       end select
> %>
> </snip>
> 
> IN PHP you can't do cases like that, because like in C, u must have a 
> constant, not a list of them.
> Is there anyway to get pass this? Doing a case for each thing 
> even tough it 
> does the exact same thing as 10 others is going to get a little 
> stupid code.
> ____________________________
> . Christian Dechery (lemming)
> . http://www.tanamesa.com.br
> . Gaita-L Owner / Web Developer
> 
> 
> -- 
> 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 the latest version of Apache I have heard you can run Compiled C binaries
from the CGI bin. Is this true? If so how does it work?

--
Dan Pupek

On the Web:
http://www.sunnet.net/dnkp/dan

Email:
[EMAIL PROTECTED]






I have a script which the user enters information into a form and it returns
a enquiry number using mysql_insert_id
 Is it possible when the form is filled in to pull a unique order number
from a text file.

TIA

george






how to install php on windows 98 or iis 5.0




It's truly amazing what you can find three clicks away from the main page
of www.php.net.

http://www.php.net/manual/en/installation.php

HTH
Jon


-----Original Message-----
From: hananet [mailto:[EMAIL PROTECTED]]
Sent: 14 March 2001 12:53
To: [EMAIL PROTECTED]
Subject: [PHP] install


how to install php on windows 98 or iis 5.0


**********************************************************************
'The information included in this Email is of a confidential nature and is 
intended only for the addressee. If you are not the intended addressee, 
any disclosure, copying or distribution by you is prohibited and may be 
unlawful. Disclosure to any party other than the addressee, whether 
inadvertent or otherwise is not intended to waive privilege or
confidentiality'

**********************************************************************


**********************************************************************
'The information included in this Email is of a confidential nature and is 
intended only for the addressee. If you are not the intended addressee, 
any disclosure, copying or distribution by you is prohibited and may be 
unlawful. Disclosure to any party other than the addressee, whether 
inadvertent or otherwise is not intended to waive privilege or confidentiality'

**********************************************************************




This command works without problems on a local unix server.
However, when I tried the exact same code , $sortmail =
imap_sort($mailbox,SORTSIZE,1) on a remote imap server running on mac,
it produces problems. (no error messages)

I am unable to check the error messages as they are none. And adding on
to that, the HTML have been terminated without any error messages
without completing the entire html closing tags.

All functions works, except imap_sort?

Anyone? any ideas?
terrence





Hey !! How are you....
I've tried to do run PHP with JAVA support enabled, (in a Win32 plattform in
this case), and when i uncommented the extension=php_java.dll, all is ok,
then i configure the [JAVA] section, with...

[Java]
java.home = c:\java
java.library = c:\java\jre\bin\classic\jvm.dll
java.library.path = c:\user\php\extensions\
java.class.path="c:\user\php\extensions\php_java.jar;c:\usr\php\java\classes
";

...then, when i run an example as...
///////////////Java
class uno{
 public int numberer(){
   return 800;
 }
 public static void main(String[] args){
  System.out.println("Hello WORLD! Rober trying");
 }
}
/////////////////////
and   i put the .class in c:\usr\php\java\classes (my class path...i suppose
:-))
/////////////////////Php
<?php
  dl("php_java.dll");
  print "Robert Celestino\n";
  $myj = new Java("uno");
  print "Loaded\n";
  print $myj->numberer();
  print "Right Loaded and called\n";

?>
///////////////////////
..then this run, and say...

/*OUTPUT*/
Robert Celestino
security properties not found. using defaults.
Loaded
...and Died...Why?...(...i wait but, some is bad, because its wait, and
wait, and wait....).
..If you can help my.............THANKS!!!!!!!!!!!!!!!!!!!!!!!!!!!!!






UltraEdit-32 does show the whole filename. I wonder what version u have...


>From: Dennis Gearon <[EMAIL PROTECTED]>
>To: [EMAIL PROTECTED]
>Subject: Re: [PHP] Good Free PHP Editor?
>Date: Tue, 13 Mar 2001 08:52:05 -0800
>
>I have tried many editors on windblows for php.
>
>UltraEdit-32 is good, but it doesn't show the whole filename, just the
>msdos version of the filename. Hard to hunt for files that have same
>name almost.
>
>So I didn't bother with it after that.
>
>I use EditPlus-2. Has built in FTP. Almost beyond complaint, except it
>won't let you 'save as' to a different remote file name if the file is
>already a remote file. Other than that, works fine.
>
>It's only 39.00. If you want do download it every 3 days, no problem.
>
>Did I forget to mention that Ultra-32 puts values in your registry that
>prevent you from reusing a new or old copy of the demo download? They
>didn't put much time into the naming of these 'trigger' variables, so
>you can't find them and remove them, but probably not after I post this
>:-)
>
>--
>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]
>

_________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.





On Tue, Mar 13, 2001 at 03:07:45PM -0500, Mike wrote:
> <?php
> require("Connection.php");
> $query="Show Columns from Inventory";
> $result= mysql_query($query);
> while ($row = mysql_fetch_row($result));
> {
> for ($i =1;$i<mysql_num_fields($result);$i++)
> {echo $row[$i];
> }}
> ?>

2 problems. 

1. Delete the ';' after the while loop.  With that there the for loop will
never run.  

2. If you want to print everything, you will need to change $i =1 to 
$i =0 in the for loops.

-- 
Jason Stechschulte
[EMAIL PROTECTED]
--
Anyway, my money is still on use strict vars . . .
             -- Larry Wall in <[EMAIL PROTECTED]>




Currently in-house our intranet is made up of Windows NT, IIS, and 
ColdFusion.  We've also settled on MS IE as our standard browser, and use 
advanced authentication for logging into the intranet.  This provides 
employees with one click access to the intranet without having to manually 
and physically login.

We've been tossing around the idea of switching our Intranet to Linux, 
Apache and PHP but we would then lose that Advanced Atuthentication 
process, no?  And to even complicate it even a bit more, if accessing the 
intranet internally through the network (a combination of Novell and NT) 
nobody should be forced to login (it being an automatic process) but if 
they access the intranet externally though the internet they have to be 
prompted for their normal network login information.

Are my managers smoking crack, or do the advanced developers here think 
this is do-able?  And if so, where could I find more information on setting 
this all up?





Hi It's me again!
Bruno.......From Brazil.......

Hi wanna know How can i take the day of week of aany date...

Example:

How to know that 14 of march of 2001 is a Wednesday??

Thanks...
Bruno.




> Hi wanna know How can i take the day of week of aany date...
> Example:
> How to know that 14 of march of 2001 is a Wednesday??

date( "l", $timeStamp );  // lowercase "L", or you could use "D"

Look up the date() function.  The documentation is your friend.

Chris


Reply via email to