Re: [PHP] file separator...

2004-02-01 Thread Don Read

On 30-Jan-2004 Dan Joseph wrote:
 Hi Everyone,
 
   Hoping someone can shed a light on this.  I have to send a file
 separator
 in a string that I piece together to a remote system.  I've been told
 this
 is x'1C' ASCII or x'22' HEX.  I have no idea what to really send. 
 I've
 tried several things.  Can someone tell me what it is they're looking
 for?
 

The FS escape is 0x1C or 28 in decimal.

$fs=chr(28);

$files='myfile1.dat' .chr(28);
$files .='myfile2.dat' .chr(28);
$files .='myfile3.dat';

Regards,
-- 
Don Read   [EMAIL PROTECTED]
-- It's always darkest before the dawn. So if you are going to 
   steal the neighbor's newspaper, that's the time to do it.

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



php-general Digest 1 Feb 2004 13:10:08 -0000 Issue 2564

2004-02-01 Thread php-general-digest-help

php-general Digest 1 Feb 2004 13:10:08 - Issue 2564

Topics (messages 176469 through 176500):

Perl script using Inline-octave doesn't run.
176469 by: Paulo Lagrotta

Re: formated text after Submit in MySQL/PHP
176470 by: Burhan Khalid
176478 by: Matt Hedges
176479 by: Stuart
176481 by: John W. Holmes

PHP Apache
176471 by: Ash
176472 by: Anti-Gulu

More info on MikeRoweSoft.com...
176473 by: Alex King
176475 by: Freedomware

Simple script but confusion with comparing strings
176474 by: Ryan A
176480 by: Stuart

Son of Script halts inside imap_fetchstructure
176476 by: Mike Gollub

Re: How do you guys do this?
176477 by: Michal Migurski

Act as a Server
176482 by: Stephen Craton
176484 by: Miles Thompson
176485 by: DvDmanDT
176486 by: Stephen Craton
176489 by: John Nichel

PHP not working with Apache
176483 by: Mark Mark
176496 by: Raditha Dissanayake

mail list/outbound email
176487 by: Dan McCullough

Re: Simple script but confusion with comparing strings (SOLVED)
176488 by: Ryan A

Re: Create a new directory on server.
176490 by: Leif K-Brooks

3 variables not passing to function!!!
176491 by: Ryan A
176492 by: John W. Holmes
176493 by: electroteque
176494 by: Jason Wong
176495 by: Ryan A

search.php
176497 by: John Taylor-Johnston
176498 by: Mike Brum
176499 by: John Taylor-Johnston

Re: file separator...
176500 by: Don Read

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]


--
---BeginMessage---
Hello all,

I'm trying start a perl script from PHP but I'm not getting success.
This script is calling the Inline-octave module (see below an example) to
do some numeric calculus.
The script is started but it doesn't finish. I think that the process is
being killed when the Inline-octave module is called.

Any ideas to solve this problem?
Thanks in advance,
Paulo R. Lagrotta

 Perl Script #


#!/usr/bin/perl

use strict;
use Test;

BEGIN
{
plan tests =1;
}


use Inline Octave = q{
   function x=jnk1(u); x=u+1; endfunction
};

my $v= jnk1(3)-disp();
chomp ($v);
ok( $v, 4 );
print $v\n;
---End Message---
---BeginMessage---
Matt Hedges wrote:
 Hello,
 
 I have a page where users can enter in information about
 themselves...  I want it to maintain its format instead of all
 running together, that is, when they enter a space the space is
 maintained via MySQL and displayed in their webpage (instead of
 having to ask them to type P)
 
 is this possible?
 
 thanks,
 Matt

Yes. See
http://homepages.tesco.net/~J.deBoynePollard/FGA/questions-with-yes-or-no-an
swers.html 

-- 
Burhan Khalid
phplist[at]meidomus[dot]com
---End Message---
---BeginMessage---
Can someone help me with the following?  Preferably someone other than the
wise ass below?

thanks
matt


Burhan Khalid [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Matt Hedges wrote:
  Hello,
 
  I have a page where users can enter in information about
  themselves...  I want it to maintain its format instead of all
  running together, that is, when they enter a space the space is
  maintained via MySQL and displayed in their webpage (instead of
  having to ask them to type P)
 
  is this possible?
 
  thanks,
  Matt

 Yes. See

http://homepages.tesco.net/~J.deBoynePollard/FGA/questions-with-yes-or-no-an
 swers.html

 -- 
 Burhan Khalid
 phplist[at]meidomus[dot]com
---End Message---
---BeginMessage---
Matt Hedges wrote:
Can someone help me with the following?  Preferably someone other than the
wise ass below?
Certainly.

Burhan Khalid [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
Matt Hedges wrote:

Hello,

I have a page where users can enter in information about
themselves...  I want it to maintain its format instead of all
running together, that is, when they enter a space the space is
maintained via MySQL and displayed in their webpage (instead of
having to ask them to type P)
is this possible?
Yes. And one piece of advice, when asking for help don't call the people 
you are asking names. It generally doesn't work. Unless you're going to 
pay us in which case you can call me whatever you want!!

--
Stuart
Wise Ass in Training
(Loathed though I am to help someone with your attitude, you may find 
your answer in the PHP manual. Try http://php.net/nl2br. But to 
reinforce the point, making sure you ask the right questions in the 
right way will make your experience with this group a lot more pleasant.)
---End Message---
---BeginMessage---
Matt Hedges wrote:

Can someone help me with the following?  Preferably someone other than the
wise 

[PHP] HTTP request parameters do not populate variables

2004-02-01 Thread Slava Zinkovski
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.

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


[PHP] Re: HTTP request parameters do not populate variables

2004-02-01 Thread DvDmanDT
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.

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



Re: [PHP] HTTP request parameters do not populate variables

2004-02-01 Thread BAO RuiXian


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

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


[PHP] modify an XML file

2004-02-01 Thread Decapode Azur
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

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



[PHP] Re: HTTP request parameters do not populate variables

2004-02-01 Thread Slava Zinkovski
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..
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: HTTP request parameters do not populate variables

2004-02-01 Thread DvDmanDT
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..
 

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



Re: [PHP] modify an XML file

2004-02-01 Thread Raditha Dissanayake
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.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: HTTP request parameters do not populate variables

2004-02-01 Thread Slava Zinkovski
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
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Nested PHP

2004-02-01 Thread Russell Shaw
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
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] modify an XML file

2004-02-01 Thread Decapode Azur
 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.

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



[PHP] Re: HTTP request parameters do not populate variables

2004-02-01 Thread DvDmanDT
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
 

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



Re: [PHP] Nested PHP

2004-02-01 Thread John Nichel
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
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: HTTP request parameters do not populate variables

2004-02-01 Thread Slava Zinkovski
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.. :)
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] stristr

2004-02-01 Thread Liam
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 


Re: [PHP] Nested PHP

2004-02-01 Thread Robby Russell
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 = bhello 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
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] VERY URGENT.....

2004-02-01 Thread Mr JAMES OKORO

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



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



[PHP] Re: Nested PHP

2004-02-01 Thread DvDmanDT
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

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



[PHP] Passing of querystrings

2004-02-01 Thread Ryan Francis
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



Re: [PHP] Passing of querystrings

2004-02-01 Thread Liam
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



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



Re: [PHP] search.php

2004-02-01 Thread John Taylor-Johnston
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 , 2);
  }
 $bleh = strtolower($bleh);
 $bleh = stripslashes($bleh);
 $bleh = str_replace(br, , $bleh);
 if (stristr($bleh,$search_for))
 {
 echo $counter .) a
 href=$link.$name..$link.$name./abr;
 echo \...;
 $bingo = strstr($bleh, $search_for);
 $bingo = explode ( , $bingo);
 echo b$bingo[0]/b;
 for ($x=1;$x15;$x++)
  echo $bingo[$x] ;
 echo ...\brBr;
 $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; } ?

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



Re: [PHP] modify an XML file

2004-02-01 Thread Marek Kilimajer
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.

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


Re: [PHP] VERY URGENT.....

2004-02-01 Thread Ryan A
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


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



[PHP] Directory Browse Concept

2004-02-01 Thread Paul Furman
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.

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


Re: [PHP] PHP not working with Apache

2004-02-01 Thread Paul Furman
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!
 



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


[PHP] Can't delete cookies

2004-02-01 Thread Andrew Wood
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
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] colisions writing in a file?

2004-02-01 Thread Decapode Azur
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

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



RE: [PHP] VERY URGENT.....

2004-02-01 Thread Martin Towell
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]

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



[PHP] PHP, Windows 2000/IIS MySQL

2004-02-01 Thread S Gex
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

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



[PHP] comparing dates

2004-02-01 Thread Ryan A
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



[PHP] php version difference - local installation very strict

2004-02-01 Thread Phillip Jackson
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

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



[PHP] Re: php version difference - local installation very strict

2004-02-01 Thread DvDmanDT
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

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



RE: [PHP] comparing dates

2004-02-01 Thread Martin Towell
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
 
 
 
 

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



[PHP] Re: php version difference - local installation very strict

2004-02-01 Thread Phillip Jackson
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

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



Re: [PHP] comparing dates

2004-02-01 Thread Justin French
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

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


Re: [PHP] modify an XML file

2004-02-01 Thread Raditha Dissanayake
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.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] php version difference - local installation very strict

2004-02-01 Thread Justin French
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

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


Re: [PHP] colisions writing in a file?

2004-02-01 Thread Michal Migurski
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/cahttp://mike.teczno.com/contact.html

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



Re: [PHP] php version difference - local installation very strict

2004-02-01 Thread Phillip Jackson
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

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



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

2004-02-01 Thread php-general-digest-help

php-general Digest 2 Feb 2004 01:12:52 - 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]


--
---BeginMessage---
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---
---BeginMessage---
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---
---BeginMessage---


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---
---BeginMessage---
Many thanks, man. You are very helpful!
I did try searching this news group. Nothing found.
Will try to do 

Re: [PHP] php version difference - local installation very strict

2004-02-01 Thread DvDmanDT
Once on every page... I include one file once, on each page, and in that one
I have session_start()...

-- 
// DvDmanDT
MSN: dvdmandt¤hotmail.com
Mail: dvdmandt¤telia.com
Phillip Jackson [EMAIL PROTECTED] skrev i meddelandet
news:[EMAIL PROTECTED]
 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



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



Re: [PHP] Nested PHP

2004-02-01 Thread Russell Shaw
Robby Russell wrote:
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.
I am generating dozens of rows of a table with entries from
a database. Each row has an option selector that has dozens
of choices, derived from another database. So, the first php
pass generates the table, then the second pass generates the
choices list in each row.
You can do this:

?php
  $phpcode = bhello world!/b\n;
?
html
  body
?php echo $phpcode; ?
  /body
/html
I have done that a lot.

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


Re: [PHP] stristr

2004-02-01 Thread Russell Shaw
Liam wrote:
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?
One useful diagnostic method is:

  $match = stristr($_SERVER['HTTP_REFERER'],'the-bronze');
  echo $_SERVER['HTTP_REFERER'] br $match;
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] PHP, Windows 2000/IIS MySQL

2004-02-01 Thread Russell Shaw
S Gex wrote:
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?
If you embed the php code into an html file, the file should be renamed
with .php instead of .html so that the web server parses it for php
(unless you set it up to scan .html files too). There's many beginner
books on php/mysql.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Re: php version difference - local installation very strict

2004-02-01 Thread Jason Wong
On Monday 02 February 2004 08:03, Phillip Jackson wrote:
 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?

error_reporting = E_ALL
display_errors = Off
log_errors = On
error_log = /path/to/php.log

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
--
/*
QOTD:
Lack of planning on your part doesn't consitute an emergency
on my part.
*/

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



Re: [PHP] VERY URGENT.....

2004-02-01 Thread Jason Wong
On Monday 02 February 2004 04:01, Ryan A wrote:
 GREAT! The last time I went for the millions, my turn is over...so whose
 turn is it now?

Please do not respond to spam -- and trim your posts!

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
--
/*
You may get an opportunity for advancement today.  Watch it!
*/

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



[PHP] Pulling unique data from database

2004-02-01 Thread Richard Kurth
 I am pulling data from a database that list the Language a person
 speaks. It is in a format like this.

English||Spanish
English
English||Portuguese||Finnish
English||Japanese||German
English
English
German

each time it looks at a new record it list all the languages that that
person speaks with a double pipe in between each language.

What I need to do is find all the unique languages so I can generate a
list of languages that do not have any repeats in it. so the list above
would be   English,Portuguese,Finnish,Japanese,German,Spanish in any
order

How would I go about this. I can not change the format of the database
and there are over 200 people listed in the database.

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



[PHP] Help with files

2004-02-01 Thread Mr. Austin
Hello all,

I am trying to open a file (successful), then rewrite over the file when it is saved 
via a form on a website.  I have used the following code, yet it simple rewrites from 
the file pointer, but does not clear the file before writing.  Thanks for any help.

?php

$buff = fopen(sample.txt, r+);
$text = This is new text for yay;

if(!fwrite($buff, $text)) {
 print(Unable to write to file);
} else {
 print(File written successfully);
}

?


Re: [PHP] Pulling unique data from database

2004-02-01 Thread Jason Wong
On Monday 02 February 2004 10:26, Richard Kurth wrote:
 What I need to do is find all the unique languages so I can generate a
 list of languages that do not have any repeats in it. so the list above
 would be   English,Portuguese,Finnish,Japanese,German,Spanish in any
 order

explode() and array_unique() or array_flip() should get you started.

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
--
/*
A fool must now and then be right by chance.
*/

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



Re: [PHP] Pulling unique data from database

2004-02-01 Thread Raditha Dissanayake
Hello Richard,

Normally the distinct calause in sql serves this purpose  but it seems 
that the way your DB is designed you cannot make use of it. The bad news 
is that you might have to read all the rows split them by the pipe 
symbol and insert them into a list manually. ouch!



Richard Kurth wrote:

I am pulling data from a database that list the Language a person
speaks. It is in a format like this.
English||Spanish
English
English||Portuguese||Finnish
English||Japanese||German
English
English
German
each time it looks at a new record it list all the languages that that
person speaks with a double pipe in between each language.
What I need to do is find all the unique languages so I can generate a
list of languages that do not have any repeats in it. so the list above
would be   English,Portuguese,Finnish,Japanese,German,Spanish in any
order
How would I go about this. I can not change the format of the database
and there are over 200 people listed in the database.
 



--
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.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP] Pulling unique data from database

2004-02-01 Thread Jonathan Rosenberg
Here's some skeleton code showing one way (untested, no error checking shown):

$query = 'SELECT Language FROM whatever';
$result = mysql_query($query);
$languages = array();
while ($row=mysql_fetch_object($result))
$languages = array_merge($languages, explode('||', $row-Language));

$languages = array_unique($languages);

--
Jonathan Rosenberg
President  Founder, Tabby's Place
http://www.tabbysplace.org/
 

 -Original Message-
 From: Richard Kurth [mailto:[EMAIL PROTECTED] 
 Sent: Sunday, February 01, 2004 9:27 PM
 To: [EMAIL PROTECTED]
 Subject: [PHP] Pulling unique data from database
 
 
  I am pulling data from a database that list the Language a person
  speaks. It is in a format like this.
 
 English||Spanish
 English
 English||Portuguese||Finnish
 English||Japanese||German
 English
 English
 German
 
 each time it looks at a new record it list all the languages that that
 person speaks with a double pipe in between each language.
 
 What I need to do is find all the unique languages so I can generate a
 list of languages that do not have any repeats in it. so the 
 list above
 would be   English,Portuguese,Finnish,Japanese,German,Spanish in any
 order
 
 How would I go about this. I can not change the format of the database
 and there are over 200 people listed in the database.
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 

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



Re: [PHP] Help with files

2004-02-01 Thread Jason Wong
On Monday 02 February 2004 10:33, Mr. Austin wrote:

 $buff = fopen(sample.txt, r+);
   ^ 
---+

RTFM to see what other options you can use.

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
--
/*
Give your very best today.  Heaven knows it's little enough.
*/

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



Re: [PHP] Pulling unique data from database

2004-02-01 Thread Adam Bregenzer
On Sun, 2004-02-01 at 21:26, Richard Kurth wrote:
 each time it looks at a new record it list all the languages that that
 person speaks with a double pipe in between each language.
 
 What I need to do is find all the unique languages so I can generate a
 list of languages that do not have any repeats in it. so the list above
 would be   English,Portuguese,Finnish,Japanese,German,Spanish in any
 order

Use explode (http://www.php.net/explode) to split the string and put it
in an array for each row; joining them together to make one big array. 
Then use array_unique (http://www.php.net/array_unique) to remove the
dupes.

-- 
Adam Bregenzer
[EMAIL PROTECTED]

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



Re: [PHP] Help with files

2004-02-01 Thread Mr. Austin
I'm not entirely sure why it is that you assume I did not read the manual or
the online documentation (which is very thorough).  I'll find my answers
elsewhere.

Thank you,
Mr. Austin

- Original Message -
From: Jason Wong [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Sunday, February 01, 2004 8:43 PM
Subject: Re: [PHP] Help with files


 On Monday 02 February 2004 10:33, Mr. Austin wrote:

  $buff = fopen(sample.txt, r+);
^
 ---+

 RTFM to see what other options you can use.

 --
 Jason Wong - Gremlins Associates - www.gremlins.biz
 Open Source Software Systems Integrators
 * Web Design  Hosting * Internet  Intranet Applications Development *
 --
 Search the list archives before you post
 http://marc.theaimsgroup.com/?l=php-general
 --
 /*
 Give your very best today.  Heaven knows it's little enough.
 */

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



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



Re: [PHP] comparing dates

2004-02-01 Thread Ryan A
Hey,
Thanks for replying.

I did find an easier way, but only after going through what you sent
me...the way i found was using substr.
I do read the manual, but not the online one, I have a downloaded windows
helpfile copy, its much faster
and easier to access but one disadvantage is...it does not have the user
comments.
Cheers,
-Ryan


http://Bestwebhosters.com


- Original Message - 
From: Justin French [EMAIL PROTECTED]
To: Ryan A [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Sent: Monday, February 02, 2004 1:21 AM
Subject: Re: [PHP] comparing dates


 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

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




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



Re: [PHP] Help with files

2004-02-01 Thread John Nichel
Mr. Austin wrote:

Hello all,

I am trying to open a file (successful), then rewrite over the file when it is saved via a form on a website.  I have used the following code, yet it simple rewrites from the file pointer, but does not clear the file before writing.  Thanks for any help.

?php

$buff = fopen(sample.txt, r+);
$text = This is new text for yay;
if(!fwrite($buff, $text)) {
 print(Unable to write to file);
} else {
 print(File written successfully);
}
?

Use the manual, Luke.

http://us4.php.net/manual/en/function.fopen.php

The word you're looking for here is 'truncate'.

--
By-Tor.com
It's all about the Rush
http://www.by-tor.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Help with files

2004-02-01 Thread John Nichel
Mr. Austin wrote:

I'm not entirely sure why it is that you assume I did not read the manual or
the online documentation (which is very thorough).
I'm sure Jason has made that assumption because the answer to your 
question is right there in the manual...under one of the functions 
you're using.

I'll find my answers elsewhere.
Try the manual.

http://us4.php.net/manual/en/function.fopen.php

--
By-Tor.com
It's all about the Rush
http://www.by-tor.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP] Help with files

2004-02-01 Thread Martin Towell
Instead of using r+, use w
This will clear the file for you :)

 -Original Message-
 From: Mr. Austin [mailto:[EMAIL PROTECTED]
 Sent: Monday, 2 February 2004 1:51 PM
 To: [EMAIL PROTECTED]
 Subject: Re: [PHP] Help with files
 
 
 I'm not entirely sure why it is that you assume I did not 
 read the manual or
 the online documentation (which is very thorough).  I'll find 
 my answers
 elsewhere.
 
 Thank you,
 Mr. Austin
 
 - Original Message -
 From: Jason Wong [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: Sunday, February 01, 2004 8:43 PM
 Subject: Re: [PHP] Help with files
 
 
  On Monday 02 February 2004 10:33, Mr. Austin wrote:
 
   $buff = fopen(sample.txt, r+);
 ^
  ---+
 
  RTFM to see what other options you can use.
 
  --
  Jason Wong - Gremlins Associates - www.gremlins.biz
  Open Source Software Systems Integrators
  * Web Design  Hosting * Internet  Intranet Applications 
 Development *
  --
  Search the list archives before you post
  http://marc.theaimsgroup.com/?l=php-general
  --
  /*
  Give your very best today.  Heaven knows it's little enough.
  */
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 
 
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 

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



[PHP] Re: Sessions not working.

2004-02-01 Thread The.Rock
If your on IIS, you need to set the session.save_path option in php.ini
file. Then make sure that IIS can actually write to the directory.

Jeff McKeon [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
Pulling my hair out here.

I've got an IIS5 webserver running a php website just fine.

I created another web for a dev version of the first website.  Installed
PHP ect...
When I load up the old websites files on the new site sessions won't
work on the new site.

For some reason on the new site's phpinfo.php page, there is no
HTTP_COOKIE variable set under the environmental section.

Also, under the PHP Variables section, there is no _REQUEST[PHPSESSID]
or _COOKIE[PHPSESSID] variable.

What have I missed!???

Here is a section of the phpinfo() for both sites.

Good Site:

Environment
Variable Value
ALLUSERSPROFILE  C:\Documents and Settings\All Users
CommonProgramFiles  C:\Program Files\Common Files
COMPUTERNAME  WS02TC07927
ComSpec  C:\WINNT\system32\cmd.exe
CONTENT_LENGTH  0
GATEWAY_INTERFACE  CGI/1.1
HTTPS  off
HTTP_ACCEPT  */*
HTTP_ACCEPT_LANGUAGE  en-us
HTTP_CONNECTION  Keep-Alive
HTTP_HOST  opsup.telaurus.net
HTTP_USER_AGENT  Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)
HTTP_COOKIE  PHPSESSID=ed09aa7b20d4032a3553c16a8f4a782f
HTTP_ACCEPT_ENCODING  gzip, deflate
INSTANCE_ID  3
LOCAL_ADDR  10.16.1.21
NUMBER_OF_PROCESSORS  1
Os2LibPath  C:\WINNT\system32\os2\dll;
OS  Windows_NT
Path  C:\WINNT\system32;C:\WINNT;C:\WINNT\System32\Wbem
PATHEXT  .COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH
PATH_INFO  /phpinfo.php
PATH_TRANSLATED  C:\Inetpub\wwwOpSup\phpinfo.php
PROCESSOR_ARCHITECTURE  x86
PROCESSOR_IDENTIFIER  x86 Family 6 Model 8 Stepping 10, GenuineIntel
PROCESSOR_LEVEL  6
PROCESSOR_REVISION  080a
ProgramFiles  C:\Program Files
REMOTE_ADDR  10.16.2.55
REMOTE_HOST  10.16.2.55
REQUEST_METHOD  GET
SCRIPT_NAME  /phpinfo.php
SERVER_NAME  opsup.telaurus.net
SERVER_PORT  80
SERVER_PORT_SECURE  0
SERVER_PROTOCOL  HTTP/1.1
SERVER_SOFTWARE  Microsoft-IIS/5.0
SystemDrive  C:
SystemRoot  C:\WINNT
TEMP  C:\WINNT\TEMP
TMP  C:\WINNT\TEMP
USERPROFILE  C:\Documents and Settings\NetShowServices
windir  C:\WINNT


PHP Variables
Variable Value
_REQUEST[PHPSESSID] ed09aa7b20d4032a3553c16a8f4a782f
_COOKIE[PHPSESSID] ed09aa7b20d4032a3553c16a8f4a782f
_SERVER[ALLUSERSPROFILE] C:\\Documents and Settings\\All Users
_SERVER[CommonProgramFiles] C:\\Program Files\\Common Files
_SERVER[COMPUTERNAME] WS02TC07927
_SERVER[ComSpec] C:\\WINNT\\system32\\cmd.exe
_SERVER[CONTENT_LENGTH] 0
_SERVER[GATEWAY_INTERFACE] CGI/1.1
_SERVER[HTTPS] off
_SERVER[HTTP_ACCEPT] */*
_SERVER[HTTP_ACCEPT_LANGUAGE] en-us
_SERVER[HTTP_CONNECTION] Keep-Alive
_SERVER[HTTP_HOST] opsup.telaurus.net
_SERVER[HTTP_USER_AGENT] Mozilla/4.0 (compatible; MSIE 6.0; Windows NT
5.1)
_SERVER[HTTP_COOKIE] PHPSESSID=ed09aa7b20d4032a3553c16a8f4a782f
_SERVER[HTTP_ACCEPT_ENCODING] gzip, deflate
_SERVER[INSTANCE_ID] 3
_SERVER[LOCAL_ADDR] 10.16.1.21
_SERVER[NUMBER_OF_PROCESSORS] 1
_SERVER[Os2LibPath] C:\\WINNT\\system32\\os2\\dll;
_SERVER[OS] Windows_NT
_SERVER[Path] C:\\WINNT\\system32;C:\\WINNT;C:\\WINNT\\System32\\Wbem
_SERVER[PATHEXT] .COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH
_SERVER[PATH_INFO] /phpinfo.php
_SERVER[PATH_TRANSLATED] C:\\Inetpub\\wwwOpSup\\phpinfo.php
_SERVER[PROCESSOR_ARCHITECTURE] x86
_SERVER[PROCESSOR_IDENTIFIER] x86 Family 6 Model 8 Stepping 10,
GenuineIntel
_SERVER[PROCESSOR_LEVEL] 6
_SERVER[PROCESSOR_REVISION] 080a
_SERVER[ProgramFiles] C:\\Program Files
_SERVER[REMOTE_ADDR] 10.16.2.55
_SERVER[REMOTE_HOST] 10.16.2.55
_SERVER[REQUEST_METHOD] GET
_SERVER[SCRIPT_NAME] /phpinfo.php
_SERVER[SERVER_NAME] opsup.telaurus.net
_SERVER[SERVER_PORT] 80
_SERVER[SERVER_PORT_SECURE] 0
_SERVER[SERVER_PROTOCOL] HTTP/1.1
_SERVER[SERVER_SOFTWARE] Microsoft-IIS/5.0
_SERVER[SystemDrive] C:
_SERVER[SystemRoot] C:\\WINNT
_SERVER[TEMP] C:\\WINNT\\TEMP
_SERVER[TMP] C:\\WINNT\\TEMP
_SERVER[USERPROFILE] C:\\Documents and Settings\\NetShowServices
_SERVER[windir] C:\\WINNT
_SERVER[PHP_SELF] /phpinfo.php
_SERVER[argv] Array
(
)

_SERVER[argc] 0
_ENV[ALLUSERSPROFILE] C:\\Documents and Settings\\All Users
_ENV[CommonProgramFiles] C:\\Program Files\\Common Files
_ENV[COMPUTERNAME] WS02TC07927
_ENV[ComSpec] C:\\WINNT\\system32\\cmd.exe
_ENV[CONTENT_LENGTH] 0
_ENV[GATEWAY_INTERFACE] CGI/1.1
_ENV[HTTPS] off
_ENV[HTTP_ACCEPT] */*
_ENV[HTTP_ACCEPT_LANGUAGE] en-us
_ENV[HTTP_CONNECTION] Keep-Alive
_ENV[HTTP_HOST] opsup.telaurus.net
_ENV[HTTP_USER_AGENT] Mozilla/4.0 (compatible; MSIE 6.0; Windows NT
5.1)
_ENV[HTTP_COOKIE] PHPSESSID=ed09aa7b20d4032a3553c16a8f4a782f
_ENV[HTTP_ACCEPT_ENCODING] gzip, deflate
_ENV[INSTANCE_ID] 3
_ENV[LOCAL_ADDR] 10.16.1.21
_ENV[NUMBER_OF_PROCESSORS] 1
_ENV[Os2LibPath] C:\\WINNT\\system32\\os2\\dll;
_ENV[OS] Windows_NT
_ENV[Path] C:\\WINNT\\system32;C:\\WINNT;C:\\WINNT\\System32\\Wbem
_ENV[PATHEXT] .COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH
_ENV[PATH_INFO] /phpinfo.php
_ENV[PATH_TRANSLATED] C:\\Inetpub\\wwwOpSup\\phpinfo.php

[PHP] search.php

2004-02-01 Thread John Taylor-Johnston
Can anyone give me a heads up on how to recurse for sub-directories please? What 
function can I use?
I'm still kind of new at this,
John


 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.

?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 , 2);
 }
$bleh = strtolower($bleh);
$bleh = stripslashes($bleh);
$bleh = str_replace(br, , $bleh);
if (stristr($bleh,$search_for))
{
echo $counter .) a 
href=$link.$name..$link.$name./abr;
echo \...;
$bingo = strstr($bleh, $search_for);
$bingo = explode ( , $bingo);
echo b$bingo[0]/b;
for ($x=1;$x15;$x++)
 echo $bingo[$x] ;
echo ...\brBr;
$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;
}
?



Re: [PHP] search.php

2004-02-01 Thread Jason Wong
On Monday 02 February 2004 13:07, John Taylor-Johnston wrote:
 Can anyone give me a heads up on how to recurse for sub-directories please?
 What function can I use? I'm still kind of new at this,

The user comments in the online manual for the chapter Directory functions 
should prove useful.

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
--
/*
Time and tide wait for no man.
*/

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



[PHP] Pulling two field from mysql table into an array

2004-02-01 Thread Richard Kurth

What is the best way to pull two fields from a mysql database and add
the two fields to an array for each record in the table
field_name  user_id

I need it so iI can access the array with $key and $value

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



Re: [PHP] search.php

2004-02-01 Thread Raditha Dissanayake
Hi John,
This is the third or fourth thread on this topic that you have started. 
As jason has pointed out you need to start reading.  While people in 
this list will be happy to help you overcome specific problems no one 
has the time to code for you.

John Taylor-Johnston wrote:

Can anyone give me a heads up on how to recurse for sub-directories please? What 
function can I use?
I'm still kind of new at this,
John
 

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.
   

 



--
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.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] search.php

2004-02-01 Thread John Taylor-Johnston
Second actually. Thanks for the answer Jason,
John

Raditha Dissanayake wrote:

 Hi John,
 This is the third or fourth thread on this topic that you have started.
 As jason has pointed out you need to start reading.  While people in
 this list will be happy to help you overcome specific problems no one
 has the time to code for you.

 John Taylor-Johnston wrote:

 Can anyone give me a heads up on how to recurse for sub-directories please? What 
 function can I use?
 I'm still kind of new at this,
 John
 
 
 
 
 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.
 
 
 

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