php-general Digest 2 Feb 2004 01:12:52 -0000 Issue 2565

Topics (messages 176501 through 176538):

HTTP request parameters do not populate variables
        176501 by: Slava Zinkovski
        176502 by: DvDmanDT
        176503 by: BAO RuiXian
        176505 by: Slava Zinkovski
        176506 by: DvDmanDT
        176508 by: Slava Zinkovski
        176511 by: DvDmanDT
        176513 by: Slava Zinkovski

modify an XML file
        176504 by: Decapode Azur
        176507 by: Raditha Dissanayake
        176510 by: Decapode Azur
        176521 by: Marek Kilimajer
        176535 by: Raditha Dissanayake

Nested PHP
        176509 by: Russell Shaw
        176512 by: John Nichel
        176515 by: Robby Russell
        176517 by: DvDmanDT

stristr
        176514 by: Liam

VERY URGENT.....
        176516 by: Mr JAMES OKORO
        176522 by: Ryan A
        176527 by: Martin Towell

Passing of querystrings
        176518 by: Ryan Francis
        176519 by: Liam

Re: search.php
        176520 by: John Taylor-Johnston

Directory Browse Concept
        176523 by: Paul Furman

Re: PHP not working with Apache
        176524 by: Paul Furman

Can't delete cookies
        176525 by: Andrew Wood

colisions writing in a file?
        176526 by: Decapode Azur
        176537 by: Michal Migurski

PHP, Windows 2000/IIS  & MySQL
        176528 by: S Gex

comparing dates
        176529 by: Ryan A
        176532 by: Martin Towell
        176534 by: Justin French

php version difference - local installation very strict
        176530 by: Phillip Jackson
        176531 by: DvDmanDT
        176533 by: Phillip Jackson
        176536 by: Justin French
        176538 by: Phillip Jackson

Administrivia:

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

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

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


----------------------------------------------------------------------
--- Begin Message --- Hi, everybody!

I've just installed PHP on my workstation and it seems as I have some trouble. The simplest code does not work! Here it is:

<?
print_r($HTTP_GET_VARS);
print("param = " . $param);
?>

I run it with URL like this http://localhost/myApp/test.php?param=qqq:
I expect it to print 'param=qqq' string, though it does not! :(((
Here is the output:

    Array ( [param] => qqq )
    Notice: Undefined variable: param in d:\phptest\test.php on line 4
    param =

Though, the script produces expected output when uploaded to a production server.

Where is the bug? Any ideas are greatly appreciated.
--- End Message ---
--- Begin Message ---
And once again, someone didn't search the archives before posting like you
are told to do on the mailing list page (this question is answered several
times daily)..

The bug is called register_globals being on on you production server and off
onn you development server.. Learn not to use register globals.. Use
$_GET['param'] instead... I'll quote myself:

"The reason is the register_globals defaults to off last years or so, which
it says in the FAQ and in the manual, as well as in the mailing list
archives, which
you must have ignored even though it's a notice saying 'Check the archives
before posting a question, chances are it has already been asked and
answered a few times.' This question has been answered just about a million
times before.."

-- 
// DvDmanDT
MSN: dvdmandt€hotmail.com
Mail: dvdmandt€telia.com
"Slava Zinkovski" <[EMAIL PROTECTED]> skrev i meddelandet
news:[EMAIL PROTECTED]
> Hi, everybody!
>
> I've just installed PHP on my workstation and it seems as I have some
> trouble. The simplest code does not work! Here it is:
>
> <?
> print_r($HTTP_GET_VARS);
> print("param = " . $param);
> ?>
>
> I run it with URL like this http://localhost/myApp/test.php?param=qqq:
> I expect it to print 'param=qqq' string, though it does not! :(((
> Here is the output:
>
>      Array ( [param] => qqq )
>      Notice: Undefined variable: param in d:\phptest\test.php on line 4
>      param =
>
> Though, the script produces expected output when uploaded to a
> production server.
>
> Where is the bug? Any ideas are greatly appreciated.

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

Slava Zinkovski wrote:

[snip...]
I run it with URL like this http://localhost/myApp/test.php?param=qqq:
I expect it to print 'param=qqq' string, though it does not! :(((
Here is the output:

    Array ( [param] => qqq )
    Notice: Undefined variable: param in d:\phptest\test.php on line 4
    param =

Though, the script produces expected output when uploaded to a production server.

Where is the bug? Any ideas are greatly appreciated.

No bug. You cannot directly get the value for $param because you have 'register_globals' set off while this is good for security. Now you can get the value for 'param' by either $_REQUEST["param"] or $_GET["param"].


Hope this helps.

Best

Bao
--- End Message ---
--- Begin Message ---
Many thanks, man. You are very helpful!
I did try searching this news group. Nothing found.
Will try to do my best next time to not upset you.
Anyway, thanks for help.

Dvdmandt wrote:
And once again, someone didn't search the archives before posting like you
are told to do on the mailing list page (this question is answered several
times daily)..

The bug is called register_globals being on on you production server and off
onn you development server.. Learn not to use register globals.. Use
$_GET['param'] instead... I'll quote myself:

"The reason is the register_globals defaults to off last years or so, which
it says in the FAQ and in the manual, as well as in the mailing list
archives, which
you must have ignored even though it's a notice saying 'Check the archives
before posting a question, chances are it has already been asked and
answered a few times.' This question has been answered just about a million
times before.."


--- End Message ---
--- Begin Message ---
lol, I'm not upset.. But follow this group a month and you'll understand..
I've been following 8 months or so... Just about everyone asks... Many ppl
on php.windows as well.. Ppl in forums.. I'm thinking about suggesting the
solution to this problem should be posted on the mailing-lists.php page.. :p

-- 
// DvDmanDT
MSN: dvdmandt€hotmail.com
Mail: dvdmandt€telia.com
"Slava Zinkovski" <[EMAIL PROTECTED]> skrev i meddelandet
news:[EMAIL PROTECTED]
> Many thanks, man. You are very helpful!
> I did try searching this news group. Nothing found.
> Will try to do my best next time to not upset you.
> Anyway, thanks for help.
>
> Dvdmandt wrote:
> > And once again, someone didn't search the archives before posting like
you
> > are told to do on the mailing list page (this question is answered
several
> > times daily)..
> >
> > The bug is called register_globals being on on you production server and
off
> > onn you development server.. Learn not to use register globals.. Use
> > $_GET['param'] instead... I'll quote myself:
> >
> > "The reason is the register_globals defaults to off last years or so,
which
> > it says in the FAQ and in the manual, as well as in the mailing list
> > archives, which
> > you must have ignored even though it's a notice saying 'Check the
archives
> > before posting a question, chances are it has already been asked and
> > answered a few times.' This question has been answered just about a
million
> > times before.."
> >

--- End Message ---
--- Begin Message --- I will follow, sure. The problem is that until last week i knew nothing about PHP (I used to practice java). And in a few weeks i have to be ready with a PHP application and possibly it should utilize fusebox framework. There are so many stuff to get to know in short time that sometimes it is easier just to ask than to search for something that you even don't know where to search, which terms to use.

Dvdmandt wrote:
lol, I'm not upset.. But follow this group a month and you'll understand..
I've been following 8 months or so... Just about everyone asks... Many ppl
on php.windows as well.. Ppl in forums.. I'm thinking about suggesting the
solution to this problem should be posted on the mailing-lists.php page.. :p


--- End Message ---
--- Begin Message ---
Yes, I know what you mean.. :)

If you use windows (or some other msn client), feel free to add me on MSN
and I'll be glad to help you out if you get problems.. :)

-- 
// DvDmanDT
MSN: dvdmandt€hotmail.com
Mail: dvdmandt€telia.com
"Slava Zinkovski" <[EMAIL PROTECTED]> skrev i meddelandet
news:[EMAIL PROTECTED]
> I will follow, sure. The problem is that until last week i knew nothing
> about PHP (I used to practice java). And in a few weeks i have to be
> ready with a PHP application and possibly it should utilize fusebox
> framework. There are so many stuff to get to know in short time that
> sometimes it is easier just to ask than to search for something that you
> even don't know where to search, which terms to use.
>
> Dvdmandt wrote:
> > lol, I'm not upset.. But follow this group a month and you'll
understand..
> > I've been following 8 months or so... Just about everyone asks... Many
ppl
> > on php.windows as well.. Ppl in forums.. I'm thinking about suggesting
the
> > solution to this problem should be posted on the mailing-lists.php
page.. :p
> >

--- End Message ---
--- Begin Message --- OK! Thanks!

Dvdmandt wrote:
Yes, I know what you mean.. :)

If you use windows (or some other msn client), feel free to add me on MSN
and I'll be glad to help you out if you get problems.. :)


--- End Message ---
--- Begin Message ---
hello!

What is the best solution to modify an XML file?
(Modification such as change the content of a tag or of an attribute)

I think there would be several methods.
What is the best one for small files? (something about 20Ko)
What is the best one for large files? (something about 8Mo)
What should be the weight limit of an XML file which have to be parsed through 
PHP?

-- 
Cheers

--- End Message ---
--- Begin Message --- Decapode Azur wrote:

hello!


Hi there.

What is the best solution to modify an XML file?

depends

(Modification such as change the content of a tag or of an attribute)

I think there would be several methods.

you said it.

What is the best one for small files? (something about 20Ko)

DOM (if you don't mind the API)

What is the best one for large files? (something about 8Mo)

Parse with SAX, use printf to produce output. If you are not worried about scalability you can still use DOM.

What should be the weight limit of an XML file which have to be parsed through PHP?

If you use SAX there wouldn't be an upper limit (at least theorectically) i have parsed the odp dump using the sax parser functions available in PHP and that's several hundred megabytes.






--
Raditha Dissanayake.
------------------------------------------------------------------------
http://www.radinks.com/sftp/         | http://www.raditha.com/megaupload
Lean and mean Secure FTP applet with | Mega Upload - PHP file uploader
Graphical User Inteface. Just 150 KB | with progress bar.

--- End Message ---
--- Begin Message ---
> >What is the best one for large files? (something about 8Mo)
>
> Parse with SAX, use printf to produce output.

Ok, it seems this method is defenitly a good one.
I was wondering if it was a good one too, to read the XML file with fgets,
and using ereg fonctions to make the modifications?


-- 
Thanks a lot for your answer.

--- End Message ---
--- Begin Message --- Decapode Azur wrote:
What is the best one for large files? (something about 8Mo)

Parse with SAX, use printf to produce output.


Ok, it seems this method is defenitly a good one.
I was wondering if it was a good one too, to read the XML file with fgets,
and using ereg fonctions to make the modifications?

You can do it as an exercise :-)


There are xml parsing classes that do not depend on any xml extension, but they are certainly slower.
--- End Message ---
--- Begin Message --- Decapode Azur wrote:

What is the best one for large files? (something about 8Mo)


Parse with SAX, use printf to produce output.



Ok, it seems this method is defenitly a good one. I was wondering if it was a good one too, to read the XML file with fgets, and using ereg fonctions to make the modifications?



If you have only a 2-3 tags you might find it easy but beyond that you code will end up looking like a sax parser's source code.



--
Raditha Dissanayake.
------------------------------------------------------------------------
http://www.radinks.com/sftp/         | http://www.raditha.com/megaupload
Lean and mean Secure FTP applet with | Mega Upload - PHP file uploader
Graphical User Inteface. Just 150 KB | with progress bar.

--- End Message ---
--- Begin Message ---
Hi,
I have php code embedded in html, that is read by apache.

Is nested php code allowable such as:

<?
  $phpcode="<? echo \"< some html >\" ?>";
?>
...
<html>
...
  <body>
    <? echo "$phpcode" ?>
  </body>
</html>

--- End Message ---
--- Begin Message --- Russell Shaw wrote:

Hi,
I have php code embedded in html, that is read by apache.

Is nested php code allowable such as:
<?
  $phpcode="<? echo \"< some html >\" ?>";
?>
...
<html>
...
  <body>
    <? echo "$phpcode" ?>
  </body>
</html>


Yes.


--
By-Tor.com
It's all about the Rush
http://www.by-tor.com

--- End Message ---
--- Begin Message --- Russell Shaw wrote:

Hi,
I have php code embedded in html, that is read by apache.

Is nested php code allowable such as:

<?
  $phpcode="<? echo \"< some html >\" ?>";
?>
...
<html>
...
  <body>
    <? echo "$phpcode" ?>
  </body>
</html>


Not sure what you're trying to do there.


You can do this:

<?php
  $phpcode = "<b>hello world!</b>\n";
?>

<html>
  <body>
    <?php echo $phpcode; ?>
  </body>
</html>

--
Robby Russell,  |  Sr. Administrator / Lead Programmer
Command Prompt, Inc.   |  http://www.commandprompt.com
[EMAIL PROTECTED] | Telephone: (503) 222.2783

--- End Message ---
--- Begin Message ---
I think you are looking for the function eval()... Or
preg_replace('!e!e',$phpcode,'e');

-- 
// DvDmanDT
MSN: dvdmandt€hotmail.com
Mail: dvdmandt€telia.com
"Russell Shaw" <[EMAIL PROTECTED]> skrev i meddelandet
news:[EMAIL PROTECTED]
> Hi,
> I have php code embedded in html, that is read by apache.
>
> Is nested php code allowable such as:
>
> <?
>    $phpcode="<? echo \"< some html >\" ?>";
> ?>
> ...
> <html>
> ...
>    <body>
>      <? echo "$phpcode" ?>
>    </body>
> </html>

--- End Message ---
--- Begin Message ---
I've been trying to make this error logger for hours now,

I get my webserver to forward all errors to error.php?message=404 etc.. 

The source can be found here
http://the-bronze.me.uk/ID/error.txt

Now Im at my wits end, I want all errors that come internaly eg from the-bronze.me.uk 
to be put into onserver.txt and all other ones to be put into 404.txt 

Unfortuantly I seem to be a little lost and confusded, can anyone see where im going 
wrong as far as my stristr(); usage is and if so what is the problem?

Liam 

--- End Message ---
--- Begin Message ---
Mr JAMES OKORO
Bank Of The North,
Victoria Island Branch,
Lagos, Nigeria.
ATTN: MD/CEO
I am Mr JAMES OKORO , Branch Manager with Bank of
the North, Victoria Island Branch, Lagos,  Nigeria.
I have an urgent and very profitable business
proposition for you that should be handled with
extreme confidentiality.

On January 6,1998 a Foreign contractor with the
Nigerian Railway corporation(N.R.C) Mr. James Herbert by name made a
numbered time Fixed Deposit for twelve calendar months
valued at US$38.6M (Thirty Eight Million, Six Hundred
United States Dollars Only) in my branch.
Upon maturity I sent a routine notification in
accordance with the Bank policy to his forwarding
address but got no reply.

After a month we sent a reminder and finally we
discovered from his contract employers the Nigerian
Railway Corporation (NRC) that Mr. James
Herbert died from an automobile accident.

On further investigation, we found out that he died
without making a Will and all attempts to trace his
next of kin was fruitless. I therefore made further
investigations and discovered that Mr. James Herbert
did not declare any next of kin or relations in all
his official documents including his Bank Deposit
paperwork in my Bank.

This sum of US$38.6M has been carefully  moved out of
my bank to a Security Company in Europe for
safekeeping.

No one will ever come forward to claim it and
according to Nigerian Law, at the expiration of 5
years the money will revert to the ownership of the
Nigerian Government if nobody applies to claim the
fund.

This prompted us to contact you.We will like to front
you as the next of kin of our late client thereby
making you the legal beneficiary of the sum of $38.6
million U.S Dollars that is presently in a Security
Company in Europe.
I contacted you because it is against our code of
ethics to own and operate foreign accounts and your
assistance would be needed to claim the money in the
Security Company in Europe.

We have unanimously agreed that 25% of the entire sum
would be for you if you agree to take part in this
profitable transaction,70% for me and 2 of my
colleagues while the remaining 5% would be used to pay
back the expenses that may be incurred during the
course of the transaction by both parties after the
fund has been claimed and lodged in your account.
In the event that you are genuinely interested in the
transaction,the following information would be needed
from you to expedite action.

1) Your Full Name and Address that would be used to
establish you as the next of kin of our late client
thereby making you the legal beneficiary of the fund.
This would ensure that the Security Company in Europe
releases the Consignment/Fund to you.
2) Your Private Mobile,Telphone and Fax numbers where
you can be reached at all time because this
transaction entails constant communication.

The transaction is 100% risk free as all modalities
has been perfected to ensure the hitch free success of
the transaction.
If you are interested, send the requested information
via email so that we can proceed.


I await your response urgently.
Regards,
Mr JAMES OKORO



--- End Message ---
--- Begin Message ---
GREAT! The last time I went for the millions, my turn is over...so whose
turn is it now?
Cheers,
-Ryan


> Mr JAMES OKORO
> Bank Of The North,
> Victoria Island Branch,
> Lagos, Nigeria.
> ATTN: MD/CEO
> I am Mr JAMES OKORO , Branch Manager with Bank of
> the North, Victoria Island Branch, Lagos,  Nigeria.
> I have an urgent and very profitable business
> proposition for you that should be handled with
> extreme confidentiality.
>
> On January 6,1998 a Foreign contractor with the
> Nigerian Railway corporation(N.R.C) Mr. James Herbert by name made a
> numbered time Fixed Deposit for twelve calendar months
> valued at US$38.6M (Thirty Eight Million, Six Hundred
> United States Dollars Only) in my branch.
> Upon maturity I sent a routine notification in
> accordance with the Bank policy to his forwarding
> address but got no reply.
>
> After a month we sent a reminder and finally we
> discovered from his contract employers the Nigerian
> Railway Corporation (NRC) that Mr. James
> Herbert died from an automobile accident.
>
> On further investigation, we found out that he died
> without making a Will and all attempts to trace his
> next of kin was fruitless. I therefore made further
> investigations and discovered that Mr. James Herbert
> did not declare any next of kin or relations in all
> his official documents including his Bank Deposit
> paperwork
............................

--- End Message ---
--- Begin Message ---
Ooo! Ooo! Me, Me! Can I be scammed this time? :/

> -----Original Message-----
> From: Ryan A [mailto:[EMAIL PROTECTED]
> Sent: Monday, 2 February 2004 7:02 AM
> To: [EMAIL PROTECTED]
> Subject: Re: [PHP] VERY URGENT.....
> 
> 
> GREAT! The last time I went for the millions, my turn is 
> over...so whose
> turn is it now?
> Cheers,
> -Ryan
> 
> 
> > Mr JAMES OKORO
> > Bank Of The North,
> > Victoria Island Branch,
> > Lagos, Nigeria.
> > ATTN: MD/CEO
> > I am Mr JAMES OKORO , Branch Manager with Bank of
> > the North, Victoria Island Branch, Lagos,  Nigeria.
> > I have an urgent and very profitable business
> > proposition for you that should be handled with
> > extreme confidentiality.
> >
[snip]

--- End Message ---
--- Begin Message ---
Hi,

I am new to php and trying to learn it for some university work.  The
problem I am having is this:

I have read on a webmonkey tutorial that when you call a php file and
name-value querystrings are automatically created into variables in your
script.

I have a example url :  http://localhost/output2.php?id=1
Which I hoped would make a variable, $id, and set the value to 1.  However
it doesnt work, the variable is not created.

Any help would be greatly appreciated.  I have Appache 2.0.48, MySQL 4.0.17,
and PHP 4.3.4


Many Thanks


Ryan Francis

--- End Message ---
--- Begin Message ---
The variable is infact created, but rather than being $id
the variable will be $_GET['id']

because it is part of the $_GET array,
so if  you had output2.php?name=fred

the variable to acsses the word fred would be $_GET['name']

Hope that helps
Liam
----- Original Message -----
From: "Ryan Francis" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Sunday, February 01, 2004 6:12 PM
Subject: [PHP] Passing of querystrings


> Hi,
>
> I am new to php and trying to learn it for some university work.  The
> problem I am having is this:
>
> I have read on a webmonkey tutorial that when you call a php file and
> name-value querystrings are automatically created into variables in your
> script.
>
> I have a example url :  http://localhost/output2.php?id=1
> Which I hoped would make a variable, $id, and set the value to 1.  However
> it doesnt work, the variable is not created.
>
> Any help would be greatly appreciated.  I have Appache 2.0.48, MySQL
4.0.17,
> and PHP 4.3.4
>
>
> Many Thanks
>
>
> Ryan Francis
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

--- End Message ---
--- Begin Message ---
Where or what recursive function would I need to get all sub-directories?
If not, can someone suggest another script?
Much appreciated,

John Taylor-Johnston
-----------------------------------------------------------------------------
Université de Sherbrooke
http://compcanlit.ca/


Mike Brum wrote:

> John, since you're looking to modify this script and not build your own or
> search for another, here's some tips on how one might go about doing this.
>
> 1) set $which_one to the directory you want to search.
> 2) create a recursive funtion (many on php.net) to get all subdirectories
> under it and build an array with their paths as the elements.
> 3)  now, take that arrary and add a foreach before the line "$directory =
> opendir($which_one);" replacing "$which_one" with your foreach array
> element.
>
> This is the *easy* way that I can think to do this - just do it for each
> subdir in the array. It probably is far from the most elegant way, but
> offers the least amount of real editing/manipulation.
>
> I welcome any/all flaming for my suggestion :)
>
> -M
>
> -----Original Message-----
> From: John Taylor-Johnston [mailto:[EMAIL PROTECTED]
> Sent: Sunday, February 01, 2004 12:09 AM
> To: [EMAIL PROTECTED]
> Cc: John Taylor-Johnston
> Subject: [PHP] search.php
>
> I found this script. I would like to modify it so it searches in not just
> the current directory, but also any other subdirectories.
> There are maybe better scripts out there, but I like this one for its
> simplicity. Can anyone lend a hand please?
> John
>
> <?php
> $counter=1;
> $not_found=0;
> $which_one="."; // use a "." to search in this directory, or type in the
> folder name $link = "www.glquebec.org"; // this is your base url
> //$search_for="Search for something here!!!"; // comment this whole line out
> if you are using a form to search $search_for="nice word"; $directory =
> opendir($which_one);
>
> while($file = readdir( $directory)){$file_ar[] = $file;} foreach( $file_ar
> as $file ) {
>         $type= strrchr($file,'.');
>         $name=$which_one;
>         $name.="/";
>         $name.=$file;
>         $file_name=fopen($name,"r");
>         $bleh ="";
> #        if ($type==".php" || $type==".txt" || $type==".html")
> #        if ($type==".htm" || $type==".txt" || $type==".html")
>         if ($type==".htm" || $type==".html")
>                 {
>                 while ((!feof($file_name)))
>                          {
>                                  $bleh .= fgets($file_name , 20000);
>                          }
>                         $bleh = strtolower($bleh);
>                         $bleh = stripslashes($bleh);
>                         $bleh = str_replace("<br>"," ", $bleh);
>                         if (stristr($bleh,$search_for))
>                                 {
>                                         echo "$counter .) <a
> href=$link".$name.">".$link.$name."</a><br>";
>                                         echo "\"...";
>                                         $bingo = strstr($bleh, $search_for);
>                                         $bingo = explode (" ", $bingo);
>                                         echo "<b>$bingo[0]</b>";
>                                         for ($x=1;$x<15;$x++)
>                                          echo "$bingo[$x] ";
>                                         echo "...\"<br><Br>";
>                                         $counter++;
>                                         $not_found=2;
>                                 }
>                         else{}
>                 }
>         fclose($file_name);
>     }
>
> if ($not_found==0)
> {
> echo "Sorry... $search_for was not found!!!<Br> <a
> href=javascript:history.go(-1)>Search Again</a>"; } ?>

--- End Message ---
--- Begin Message --- I'm beginning to learn PHP to rebuild my web site in such a way that I can update it more easily (...and add some other dynamic features ...and utilize a database). I like the idea of a simple directory structure and it's a sensible way to organize my various projects and topics. So what I want is to place some simple text/htm files and jpegs in nested folders and have PHP read them onto a template page with header, footer & dynamic folder navigation. Sort of a hybrid between a threaded discussion group and a photo album generator.

I'm not sure if It's wise to follow the folder structure literally. 'Gallery' is a php photo album program http://gallery.menalto.com that simulates nested folders with a flat-file pseudo-database. Probably they had reasons for not using actual nested folders?

Another reason not to use actual nested folders is that I will probably want to have alternative views of the same pictures/pages. I'm a gardener so I've got a database of plant descriptions sorted by family/genus/species but I also have photo shoots in folders sorted by location/date. Then I want to be able to set up pages for my clients where I pull out a selection of plants from my list and show them particular pictures from my photo collection... so this kind of thing is strictly relational database. I like the nested folders because of my photo collection, there are many 'seconds' & unedited originals, etc & I keep all those under location/date folders and need to go back sometimes. Once it becomes a database the folder structure is superfluous baggage.

So, if I take the folder route, I guess I'd just nest things under my public_html and the url would reflect the current location within the folders. But the way I'm being taught to set up a PHP site in class is to use a single index.php at the root & hide everything else outside of public_html. In this case I would have to create a global variable or SCREEN vars in the url with ?SCREEN to keep track of where the visitor is located. It would look so much nicer to have nested folder names in the url, even if they got long, I like the clear unmistakable logic of that.

www.edgehill.net/plants/poacea/festuca/californica
better than
www.edgehill.net?FOLDER=plants/poacea/festuca/californica

But to get the first option, I would then have to somehow set the template. 'Gallery' urls always look like one folder deep with some other optional settings sometimes:

www.edgehill.net/gallery/festuca-californica
(even if that folder is nested under:
plants/poacea/festuca/festuca-californica)

Each flat folder contains pictures and a data file with fields for various settings. I don't know how PHP knows to take all this to the 'Gallery' template. Somehow they say anything under that gallery folder should be presented through the gallery templates???

Thanks for any thoughts if you made it this far <g>.
--- End Message ---
--- Begin Message --- The php installer doesn't do everything for a windows installation. You'll need to edit php.ini & httpd.config for apache, as described in the installation guide.

Raditha Dissanayake wrote:

Yes sounds like you have not read the installation guide.

Mark Mark wrote:

I am running Apache 1.3.29 and PHP 4.3.3. I installed apache first and got it to work. Then, I install the php installer and and copied the windows binary files. I followed the instruction to run as a module and I even uninstalled the php files and tried to run PHP as just a CGI binary, both methods failured. I created a test php script called hello.php and the web page was blank when I tried to access it. I could view the code... Any ideas? I am running WIN 2K server sp4.

Thanks in adavnce


---------------------------------
Do you Yahoo!?
Yahoo! SiteBuilder - Free web site building tool. Try it!





--- End Message ---
--- Begin Message --- Can anyone fathom out why I can't get the setcookie function to delete a cookie?

I'm calling it with the same arguments as I used to set it originally, but with a null string value & an expiry time in the past but the cookie persistently remains in the browser.

This how I set it:
setcookie ("hhubpassword", md5($newpassword) , time() + 1209600, "/xchange/");


And this is how I'm trying to delete it:
setcookie ("hhubpassword", "", time() -3600, "/xchange/");

Thanks
Andrew

--- End Message ---
--- Begin Message ---
Hello,

Are Problems of colisions with a script writing in a file possible?
For exemple for a PHP script reading a file, and rewriting it with 
modifications, when it is called a lot of times simultaneously, are conflicts 
possible? (over-writing the modifications)
or does each session of this script wait for the previous one to close the 
file before to handle it?

-- 
Thanks

--- End Message ---
--- Begin Message ---
>Are Problems of colisions with a script writing in a file possible?

Absolutely.


>For exemple for a PHP script reading a file, and rewriting it with
>modifications, when it is called a lot of times simultaneously, are
>conflicts possible? (over-writing the modifications) or does each session
>of this script wait for the previous one to close the file before to
>handle it?

Only if you use file-locking to eliminate conflicts, see:
        http:/php.net/manual/en/function.flock.php

---------------------------------------------------------------------
michal migurski- contact info and pgp key:
sf/ca            http://mike.teczno.com/contact.html

--- End Message ---
--- Begin Message ---
I'm trying to install PHP on my system. I know absolutely nothing about it.
I installed MySQL and PHP, (PHP said that it configured IIS) When I attempt
to write a PHP statement and an HTML statement, the HTML statement runs, but
the PHP does not...Any suggestions?

Thank You

--- End Message ---
--- Begin Message ---
Hi,
Am a bit confused as to how to do this, I have some dates in the database as
"expire_login timestamp(14)".
I am entering dates 1 day,11 hours,59 minutes in advance.
The user can sign in anytime and it should display how many days, hours and
mins before his account expires...

I am selecting the data as "select expire_login, now() from allow_logins";

which gives me two 14 numberic characters strings like:
20040202091212
20040201070500

How do I compare it to display something like this to the visitor:
You have $xdays day/s, $xhours hours and $xmins minutes before your account
expires

Been hitting the manual, but have either been searching in the wrong places
or....?
I think I will have to use "explode","strtotime" on this...but am not sure.

Any help appreciated.

Thanks,
-Ryan

--- End Message ---
--- Begin Message ---
Is it possible to pull that dates out as unix time stamps?

Then all you need to do is subtract one from the other, convert the results
to days/hours/minutes and Bob's your uncle.

If not, then you'll need to do some string manipulation to get the string
into a format that strtotime() understands and repeat the above..

HTH
Martin

> -----Original Message-----
> From: Ryan A [mailto:[EMAIL PROTECTED]
> Sent: Monday, 2 February 2004 10:04 AM
> To: [EMAIL PROTECTED]
> Subject: [PHP] comparing dates
> 
> 
> Hi,
> Am a bit confused as to how to do this, I have some dates in 
> the database as
> "expire_login timestamp(14)".
> I am entering dates 1 day,11 hours,59 minutes in advance.
> The user can sign in anytime and it should display how many 
> days, hours and
> mins before his account expires...
> 
> I am selecting the data as "select expire_login, now() from 
> allow_logins";
> 
> which gives me two 14 numberic characters strings like:
> 20040202091212
> 20040201070500
> 
> How do I compare it to display something like this to the visitor:
> You have $xdays day/s, $xhours hours and $xmins minutes 
> before your account
> expires
> 
> Been hitting the manual, but have either been searching in 
> the wrong places
> or....?
> I think I will have to use "explode","strtotime" on 
> this...but am not sure.
> 
> Any help appreciated.
> 
> Thanks,
> -Ryan
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> __________ Information from NOD32 1.614 (20040129) __________
> 
> This message was checked by NOD32 for Exchange e-mail monitor.
> http://www.nod32.com
> 
> 
> 
> 

--- End Message ---
--- Begin Message --- On Monday, February 2, 2004, at 10:04 AM, Ryan A wrote:

which gives me two 14 numberic characters strings like:
20040202091212
20040201070500

How do I compare it to display something like this to the visitor:
You have $xdays day/s, $xhours hours and $xmins minutes before your account
expires


Been hitting the manual, but have either been searching in the wrong places
or....?
I think I will have to use "explode","strtotime" on this...but am not sure.

Ryan,


explode() won't help (nothing to explode on)
strtotime() won't help, as it can't work directly with the above date format


There's a decent comment on http://php.net/strtotime (RTFM????) by 'tobi at schluer dot de'
"...You can read the db using the UNIX_TIMESTAMP()-function, which returns the timestamp from the date(time) field. So you don't need to convert the dates in PHP, but let SQL do that job."


So, you can do it with MySQL. Otherwise, a function like this in PHP would do it:

<?
function mysqlToUnixStamp($in)
        {
        $y = substr($in,0,4);
        $m = substr($in,4,2);
        $d = substr($in,6,2);
        $h = substr($in,8,2);
        $i = substr($in,10,2);
        $s = substr($in,12,2);
        return mktime($h,$i,$s,$m,$d,$y);
        }
?>

So then pass your mysql stamps to it like this:

<?
$d1 = '20040202091212';
$d2 = '20040201070500';

$d1 = mysqlToUnixStamp($d1);
$d2 = mysqlToUnixStamp($d2);
?>

An you can then compare them (for example):

<?
if($d1 >= $d2) { /*something*/ }
?>

Or find the difference in seconds:

<?
$diff = $d1 - $d2;
?>

Converting this into a human readable "$xdays day/s, $xhours hours and $xmins minutes" is not exactly easy, but here's some hints for you to build on:

<?
function secondsToString($in)
        {
        $secsInDay = (60 * 60) * 24;
        $secsInHour = 60 * 60;
        $secsInMin = 60;
        $ret = '';
        
        if($in > $secsInDay)
                {
                $days = round($in / $secsInDay);
                $remainder = $in % $secsInDay;
                $ret .= "{$days} days, ";
                }
                
        if($remainder > $secsInHour)
                {
                $hours = round($remainder / $secsInHour);
                $remainder = $in % $secsInHour;
                $ret .= "{$hours} hours, ";
                }
                
        if($remainder > $secsInMin)
                {
                $mins = round($remainder / $secsInMin);
                $remainder = $in % $secsInMin;
                $ret .= "{$mins} mins, ";
                }
        
        // strip off last ', '
        $ret = substr($ret,0,-2);
        
        return $ret;
        }

// converting to human readable
$timeLeft = secondsToString($diff);

// print to screen
echo "you have {$timeLeft} remain on your membership";
?>


Out of all this, what you need to look-up in the manual and understand is the modulus (%), an arithmetic operator & substr().


http://www.php.net/manual/en/language.operators.arithmetic.php
http://www.php.net/substr


Justin French

--- End Message ---
--- Begin Message ---
Hi all,

It seems that the version on my local apache installation is more strict
than the version on my production server. How can i counteract this without
potentially having to upgrade 300+ pages in my entire app? is there a
setting in php.ini that i could locally kill some of this debugging info?
Some examples of errors i'm getting locally:


Notice: A session had already been started - ignoring session_start() in
%siteroot%\admin\menu.php on line 9

Notice: Undefined index: success in %siteroot%\admin\menu.php on line 18

Warning: Cannot modify header information - headers already sent by (output
started at c:\inetpub\www\tommiezito\admin\data_entry\start.php:14) in
%siteroot%\admin\data_entry\start.php on line 37

these errors are foreign to me as i have combed my code 100's of times
before i deployed my app online 3 months ago. do i NEED this newer,stricter
version or can i install a deprecated one?

any help would be amazing.

~pj

--- End Message ---
--- Begin Message ---
Yes..
error_reporting=E_ALL & ~E_NOTICE
in php.ini is most likely what your server uses.. :p
Also, register_globals might give you problems.. :p

-- 
// DvDmanDT
MSN: dvdmandt€hotmail.com
Mail: dvdmandt€telia.com
"Phillip Jackson" <[EMAIL PROTECTED]> skrev i meddelandet
news:[EMAIL PROTECTED]
> Hi all,
>
> It seems that the version on my local apache installation is more strict
> than the version on my production server. How can i counteract this
without
> potentially having to upgrade 300+ pages in my entire app? is there a
> setting in php.ini that i could locally kill some of this debugging info?
> Some examples of errors i'm getting locally:
>
>
> Notice: A session had already been started - ignoring session_start() in
> %siteroot%\admin\menu.php on line 9
>
> Notice: Undefined index: success in %siteroot%\admin\menu.php on line 18
>
> Warning: Cannot modify header information - headers already sent by
(output
> started at c:\inetpub\www\tommiezito\admin\data_entry\start.php:14) in
> %siteroot%\admin\data_entry\start.php on line 37
>
> these errors are foreign to me as i have combed my code 100's of times
> before i deployed my app online 3 months ago. do i NEED this
newer,stricter
> version or can i install a deprecated one?
>
> any help would be amazing.
>
> ~pj

--- End Message ---
--- Begin Message ---
i don't use register_globals - i have a function that massages data that
mimics register globals' behaivior via dynamically named variables.

which one should i set it to - E_NOTICE?

~Phillip Jackson


"Dvdmandt" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Yes..
> error_reporting=E_ALL & ~E_NOTICE
> in php.ini is most likely what your server uses.. :p
> Also, register_globals might give you problems.. :p
>
> -- 
> // DvDmanDT
> MSN: dvdmandt€hotmail.com
> Mail: dvdmandt€telia.com
> "Phillip Jackson" <[EMAIL PROTECTED]> skrev i meddelandet
> news:[EMAIL PROTECTED]
> > Hi all,
> >
> > It seems that the version on my local apache installation is more strict
> > than the version on my production server. How can i counteract this
> without
> > potentially having to upgrade 300+ pages in my entire app? is there a
> > setting in php.ini that i could locally kill some of this debugging
info?
> > Some examples of errors i'm getting locally:
> >
> >
> > Notice: A session had already been started - ignoring session_start() in
> > %siteroot%\admin\menu.php on line 9
> >
> > Notice: Undefined index: success in %siteroot%\admin\menu.php on line 18
> >
> > Warning: Cannot modify header information - headers already sent by
> (output
> > started at c:\inetpub\www\tommiezito\admin\data_entry\start.php:14) in
> > %siteroot%\admin\data_entry\start.php on line 37
> >
> > these errors are foreign to me as i have combed my code 100's of times
> > before i deployed my app online 3 months ago. do i NEED this
> newer,stricter
> > version or can i install a deprecated one?
> >
> > any help would be amazing.
> >
> > ~pj

--- End Message ---
--- Begin Message --- On Monday, February 2, 2004, at 10:14 AM, Phillip Jackson wrote:

these errors are foreign to me as i have combed my code 100's of times
before i deployed my app online 3 months ago. do i NEED this newer,stricter
version or can i install a deprecated one?

It's not newer and stricter, and it's not Apache -- it's PHP error notices set to a higher level that your production server.


This is really around the wrong way -- your local (dev) server should be set to a high level of warning (mine's set to the highest) to encourage good programming practices, and should be set to none on the production (live) server to keep error messages out of the user experience.

The long answer is to fix your application, and hunt down all these notices/warnings, so that your application is of better quality.

The short answer is to set the error reporting on the live server to a lower level, so that these messages are suppressed. You can do this either with ini_set()[1] or error_reporting()[2] at the top of every script (or in a header include for example), or at an application level with a .htaccess file in root directory.

A sample of a .htaccess file would be:

<IfModule mod_php4.c>
        php_flag register_globals off
        php_flag magic_quotes_runtime off
        php_flag magic_quotes_gpc on
        php_value url_rewriter.tags 'a=href'
        php_value error_reporting 'E_ALL & ~E_NOTICE'
</IfModule>

I'm not 100% sure the last line is correct, because I'v always done it with ini_set() in my PHP application.
[1] http://www.php.net/ini_set
[2] http://www.php.net/error-reporting



I would encourage you to fix your code as well as apply error reporting levels for both the production and live servers.



Good luck,


Justin French
--- End Message ---
--- Begin Message ---
That's great advice... the only questions i have then:

I only need to call session_start ONCE in my entire application per instance
of a session? when i published the application months ago to my production
server i had errors on every page notifying me that a session had not been
started so i could not call $_SESSION...

~pj


"Justin French" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> On Monday, February 2, 2004, at 10:14  AM, Phillip Jackson wrote:
>
> > these errors are foreign to me as i have combed my code 100's of times
> > before i deployed my app online 3 months ago. do i NEED this
> > newer,stricter
> > version or can i install a deprecated one?
>
> It's not newer and stricter, and it's not Apache -- it's PHP error
> notices set to a higher level that your production server.
>
> This is really around the wrong way -- your local (dev) server should
> be set to a high level of warning (mine's set to the highest) to
> encourage good programming practices, and should be set to none on the
> production (live) server to keep error messages out of the user
> experience.
>
> The long answer is to fix your application, and hunt down all these
> notices/warnings, so that your application is of better quality.
>
> The short answer is to set the error reporting on the live server to a
> lower level, so that these messages are suppressed.  You can do this
> either with ini_set()[1] or error_reporting()[2] at the top of every
> script (or in a header include for example), or at an application level
> with a .htaccess file in root directory.
>
> A sample of a .htaccess file would be:
>
> <IfModule mod_php4.c>
> php_flag register_globals off
> php_flag magic_quotes_runtime off
> php_flag magic_quotes_gpc on
> php_value url_rewriter.tags 'a=href'
> php_value error_reporting 'E_ALL & ~E_NOTICE'
> </IfModule>
>
> I'm not 100% sure the last line is correct, because I'v always done it
> with ini_set() in my PHP application.
> [1] http://www.php.net/ini_set
> [2] http://www.php.net/error-reporting
>
>
> I would encourage you to fix your code as well as apply error reporting
> levels for both the production and live servers.
>
>
> Good luck,
>
> Justin French

--- End Message ---

Reply via email to