Re: [PHP] Mysql query and PHP loops

2003-08-01 Thread Nicholas Robinson
I think this does what you want. You can probably extend it to do the final 
check for val3 vs. val2 

select distinct t1.val1, max( t1.id ), t1.val2 from table as t1, table as t2 
where t1.val2 = t2.val2 group by t1.val1;

HTH

On Thursday 31 Jul 2003 3:22 pm, Petre Agenbag wrote:
 Hi List

 I've been trying to do something with one MySQL query, but I don't think
 it is possible, so, I would need to probably do multiple queries, and
 possibly have queries inside loops, but I am rather weary of that so,
 I'd like your views/possible solutions to doing the following:


 Consider this:

 idval1val2val3
 1 a   1   1
 2 b   2   3
 3 a   1   2
 4 b   2   1
 5 c   3   3
 6 c   2   1

 I need to query this table to return this:

 idval1val2val3
 3 a   1   2
 4 b   2   1
 6 c   2   1

 Thus, I need to firstly only return ONE row for each val1, and that row
 MUST be that last row (ie, the row with the highest id, OR, should val3
 for instance be a date, then with the highest date).


 if I do a

 select distinct val1, MAX(id) from table order by val1, then it returns

 idval1
 3 a
 4 b
 6 c

 which is correct, BUT
 select distinct val1, MAX(id), val2 from table order by val1

 it returns

 idval1val2
 3 a   1
 4 b   2
 6 c   3   --- incorrect

 it then returns the FIRST hit for val2 in the db, and NOT the one in
 the row with the max id...

 Can I do this with one query? ( PS, I cannot use MAX on val2 or val3,
 they are text)


 Thanks


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



Re: [PHP] Opinions on Micro$oft .NET

2003-08-01 Thread Joel Rees
I hate to rain on this parade, but, 

 I'm a pretty good PHP programmer, and things
 I could knock out in a couple of hours seem to be WAY more difficult to
 do in .Net.  

This is the pith of the question. If you knew what you're doing,
anything from Microsoft takes longer to do than doing it the right way.

If you don't know what you're doing, M$ gets you most of the way there
for a cost.

Management has historically actually preferred that labor not know
anything. 

Therefore, Microsoft is Business.

If management thinks that's okay and you think that's okay, jump into
bed with them.

If you don't like the deepening recession, run like hell, because if you
think about it, it's exactly that kind of business that sucks all the
value out of things. (And that's exactly what recession and depression
are all about.)

-- 
Joel Rees
(The above opinion probably does not reflect the opinions of my employer.)


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



[PHP] Please Help

2003-08-01 Thread Sathiyabama
Dear PHP Team,

I request your help to sort some issues in using PHP.

1.Chennai IIT has developed one recorder.We can record our voice and
video.Its user defined extenion is MV4.

My requirement is

1.I want to send video file using mail() function in PHP.So how to send
it.What is the procedure?

2.How to delete one folder using PHP?


Please help me ...

Regards,
Sathiyabama







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



Re: [PHP] Please Help

2003-08-01 Thread John Manko
umm... ok.

www.google.com
www.php.net
that should get you started.

Sathiyabama wrote:

Dear PHP Team,

I request your help to sort some issues in using PHP.

1.Chennai IIT has developed one recorder.We can record our voice and
video.Its user defined extenion is MV4.
My requirement is

1.I want to send video file using mail() function in PHP.So how to send
it.What is the procedure?
2.How to delete one folder using PHP?

Please help me ...

Regards,
Sathiyabama






 



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


Re: [PHP] PHP or CGI in C/C++

2003-08-01 Thread Decapode Azur
 I would expect compiled C/C++ to be faster as there is no need for
 the code to be interperated and compiled on each request.


Is it possible to compile PHP to improve the speed execution ?



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



[PHP] eval

2003-08-01 Thread Decapode Azur

Is it possible to put PHP code in eval ?
Or just vars ?


?php

$string = 'The result of ?php $a=2; $b=3; $c=$a+$b; echo $a + $b is $c; 
?';

eval ($string);

?

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



Re: [PHP] PHP or CGI in C/C++

2003-08-01 Thread John Manko
i did a quick google, and found the following.  hope it helps

http://phpcomplete.com/articles.php?sec=readArticleid=306
http://www.php-accelerator.co.uk
plus, there is something called PHP bcompiler (byte compiler).

I dont know the details of any of these, but should help.  maybe others 
can expand on the details.

- John Manko

Decapode Azur wrote:

I would expect compiled C/C++ to be faster as there is no need for
the code to be interperated and compiled on each request.
   



Is it possible to compile PHP to improve the speed execution ?



 



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


Re: [PHP] Please Help

2003-08-01 Thread Joona Kulmala
My requirement is

1.I want to send video file using mail() function in PHP.So how to send
it.What is the procedure?
http://fi2.php.net/manual/en/ref.mail.php

Check out the templates, there is described how to build mail headers with
attachments. PHPs own mail function doesn't support this by default, thought.

2.How to delete one folder using PHP?
http://fi2.php.net/manual/en/function.unlink.php
http://fi2.php.net/manual/en/function.rmdir.php
Cheers, Joona
--
Joona Kulmala [EMAIL PROTECTED]
PHP Finland
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] eval

2003-08-01 Thread Adrian
PHP-Code:
eval('?'.$string)

Vars:

eval('$string='.str_replace('','\\',$string).';');



 Is it possible to put PHP code in eval ?
 Or just vars ?


 ?php

 $string = 'The result of ?php $a=2; $b=3; $c=$a+$b; echo $a + $b is $c; 
?';

 eval ($string);

?



-- 
Adrian
mailto:[EMAIL PROTECTED]
www: http://www.planetcoding.net
www: http://www.webskyline.de



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



Re: [PHP] eval

2003-08-01 Thread Joona Kulmala
Decapode Azur wrote:

Is it possible to put PHP code in eval ?
Or just vars ?
?php

$string = 'The result of ?php $a=2; $b=3; $c=$a+$b; echo $a + $b is $c; 
?';

eval ($string);

?
It should go like:

[code]

eval('$var = The result of; $a=2; $b=3; $c = $a + $b; $var .= $a + $b is $c;');

[/code]

Just a question, what are you really trying to do?

Cheers, Joona
--
Joona Kulmala [EMAIL PROTECTED]
PHP Finland
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP] Please Help

2003-08-01 Thread Joseph Blythe
Sathiyabama,

Is always a good idea to read the manual, search google and the list
archives before posting to this list, the below links should help you get
started.

http://www.php.net/manual/en/function.mail.php

and:

http://www.php.net/manual/en/function.rmdir.php

Regards,

Joseph


 -Original Message-
 From: John Manko [mailto:[EMAIL PROTECTED]
 Sent: Friday, 1 August 2003 3:56 PM
 To: Sathiyabama
 Cc: [EMAIL PROTECTED]
 Subject: Re: [PHP] Please Help


 umm... ok.

 www.google.com
 www.php.net

 that should get you started.


 Sathiyabama wrote:

 Dear PHP Team,
 
 I request your help to sort some issues in using PHP.
 
 1.Chennai IIT has developed one recorder.We can record our voice and
 video.Its user defined extenion is MV4.
 
 My requirement is
 
 1.I want to send video file using mail() function in PHP.So
 how to send
 it.What is the procedure?
 
 2.How to delete one folder using PHP?
 
 
 Please help me ...
 
 Regards,
 Sathiyabama
 
 
 
 
 
 
 
 
 



 --
 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] jabber - chmod on files

2003-08-01 Thread desa15

To change the rights from a php script put the following lines


define('CHMOD_FILES', 0666);
//define('CHMOD_DIRS', 0777);

@chmod(Your file name, CHMOD_FILES);



Un saludo, Danny


   

  Carlos Castillo  

  [EMAIL PROTECTED]  Para: '[EMAIL PROTECTED]' [EMAIL 
PROTECTED] 
  com.co  cc: 

   Asunto:   [PHP] jabber - chmod on files 

  31/07/2003 23:51 

   

   





HI,





I'm using jabber but I have one problem, I did an administrator webpage for
it, so I create the users for jabber in that page, when I create the user,
it creates a xml file with permission of 644 and the owner is apache, but
when I connect on the jabber or that user connects the xml file changes to
600 and the owner to root.





The problem is that I have to read that file after he connects but when I
try I don't have access, because the perm is on 600,





How can I change the perm from the php page, so I change with chmod 644
.xml before I open itor how can I modify jabber so it doesn't
change the perm of the files?





Thanks!





Carlos A. Castillo.
Ingeniero de desarrollo
[EMAIL PROTECTED]




Su Aliado Efectivo en Internet
www.imagine.com.co
(57 1)2182064 - (57 1)6163218
Bogotá - Colombia

- Soluciones web para Internet e Intranet


- Soluciones para redes
- Licenciamiento de Software
- Asesoría y Soporte Técnico













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



Re: [PHP] PHP or CGI in C/C++

2003-08-01 Thread desa15

You can install Zend Optimizer from www.zend.com is free but with comercial
license.

Perform some optimizations in your code to not compile the same code in
each request.


Un saludo, Danny


   

  John Manko   

  [EMAIL PROTECTED]  Para: Decapode Azur [EMAIL 
PROTECTED]  
  cc: [EMAIL PROTECTED]   

   Asunto:   Re: [PHP] PHP or CGI in C/C++ 

  01/08/2003 08:45 

   

   





i did a quick google, and found the following.  hope it helps

http://phpcomplete.com/articles.php?sec=readArticleid=306
http://www.php-accelerator.co.uk

plus, there is something called PHP bcompiler (byte compiler).

I dont know the details of any of these, but should help.  maybe others
can expand on the details.

- John Manko


Decapode Azur wrote:

I would expect compiled C/C++ to be faster as there is no need for
the code to be interperated and compiled on each request.




Is it possible to compile PHP to improve the speed execution ?








--
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] Mysql query and PHP loops

2003-08-01 Thread Nicholas Robinson
On further reflection, my first attempt works for the specific example but may 
not in the general case. Try using a combination of max( ...id ) and min( 
...val2 ) and add t1.val2 to the group by clause. This might work, but I've 
deleted my test files now!

On Friday 01 Aug 2003 7:04 am, Nicholas Robinson wrote:
 I think this does what you want. You can probably extend it to do the final
 check for val3 vs. val2 

 select distinct t1.val1, max( t1.id ), t1.val2 from table as t1, table as
 t2 where t1.val2 = t2.val2 group by t1.val1;

 HTH

 On Thursday 31 Jul 2003 3:22 pm, Petre Agenbag wrote:
  Hi List
 
  I've been trying to do something with one MySQL query, but I don't think
  it is possible, so, I would need to probably do multiple queries, and
  possibly have queries inside loops, but I am rather weary of that so,
  I'd like your views/possible solutions to doing the following:
 
 
  Consider this:
 
  id  val1val2val3
  1   a   1   1
  2   b   2   3
  3   a   1   2
  4   b   2   1
  5   c   3   3
  6   c   2   1
 
  I need to query this table to return this:
 
  id  val1val2val3
  3   a   1   2
  4   b   2   1
  6   c   2   1
 
  Thus, I need to firstly only return ONE row for each val1, and that row
  MUST be that last row (ie, the row with the highest id, OR, should val3
  for instance be a date, then with the highest date).
 
 
  if I do a
 
  select distinct val1, MAX(id) from table order by val1, then it returns
 
  id  val1
  3   a
  4   b
  6   c
 
  which is correct, BUT
  select distinct val1, MAX(id), val2 from table order by val1
 
  it returns
 
  id  val1val2
  3   a   1
  4   b   2
  6   c   3   --- incorrect
 
  it then returns the FIRST hit for val2 in the db, and NOT the one in
  the row with the max id...
 
  Can I do this with one query? ( PS, I cannot use MAX on val2 or val3,
  they are text)
 
 
  Thanks


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



Re: [PHP] Re: include help please

2003-08-01 Thread LoonySalmon
nope, it doesn't work.  it'll only call up the variables that were specified
in my files.inc.php...well so far at least



Curt Zirzow [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 * Thus wrote LoonySalmon ([EMAIL PROTECTED]):
 
  i want to call up my contact page, but how do i do it?
 
  http://localhost/index.php?page=$contact

 I hope you cant use something like:
   http://localhost/index.php?page=%2Fetc%2Fpasswd


 Curt
 --
 I used to think I was indecisive, but now I'm not so sure.



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



Re: [PHP] load the PHP script last on the page

2003-08-01 Thread Sek-Mun Wong
I agree with Chris' method, but if you don't have cron, then what I do is a
page-based cache.

Since weather does not change with every page hit, you could store the
parsed page inside a database, or even write it to a flat file, so if the
page is hit 100 times an hour, and you do an hourly refresh on the cached
version, you only get 1 slow page per hour, instead of 100. if the page
gets hit 1000 times... you get the idea.

You could check timestamps of the file (using file based caching) or add a
timestamp field in your sql table.

This sort of caching mechanism is used quite extensively on large sites, but
it's easy enough to implement for smaller sites too.

Of course, what you're doing is totally illegal, unless you have an
agreement with msn to scrape their site g I know we don't like microsoft,
but the law's the law ;-)

Chris W. Parker [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
DougD mailto:[EMAIL PROTECTED]
on Thursday, July 31, 2003 11:18 AM said:

 If it were possible I want the include to occur after the rest of the
 page is loaded.

Maybe instead of including the file that does the processing and waiting
forever for it to finish, you might consider setting up that same  page
as a cron job and have it create another page on your sever that you can
quickly read/parse into your web page.

You could have the cron job run every 1/2/3/4/5/10/15 minutes depending
on how accurate it needs to be. Each time the page is loaded by the
browser the server will grab the latest version and display it.


hth,
Chris.


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



RE: [PHP] learning php - problem already

2003-08-01 Thread Ford, Mike [LSS]
 -Original Message-
 From: CPT John W. Holmes [mailto:[EMAIL PROTECTED]
 Sent: 31 July 2003 15:54
 
 you basically
 have this:
 
 list($k,$v,$key,$value) = array(1='abc', 'value'='abc', 0='a',
 'key'='a');
 
 So, how this works is that list starts with $value. $value is 
 at position
 number four, so since arrays start at zero, it's going to 
 look in the array
 that was passed for an element at [3]. Since there is no [3] 
 in the passed
 array, you get a NOTICE about undefined offset.
 
 Next it moves on to $key and looks for element [2]. Again you 
 get a warning
 since there is no element [2] in the passed array.
 
 Next is $v and list is looking for [1]. Since [1] does exist 
 and has a value
 of 'abc', now $v = 'abc'
 
 Last is $k and [0] and you get $k = 'a'.
 
 That's how it works. :)
 
 That's why this code:
 
 list($a, $b, $c, $d) = array(4='four', 3='three', 2='two', 
 1='one',
 0='zero');
 echo $a, $b, $c, $d;
 
 gives:
 
 zero, one, two, three

Ho, thanks for that -- I must admit I hardly ever use each() or list(), and
taking a quick look at the current manual page for list() does seem to have
changed quite a bit since I originally read it -- so I guess my
understanding of it was faulty.  I still think it's quite confusing -- your
explanation here is much better -- so I might see if I can't put together
something even better for incorporation in the manual!

Cheers!

Mike

-
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning  Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, LEEDS,  LS6 3QS,  United Kingdom
Email: [EMAIL PROTECTED]
Tel: +44 113 283 2600 extn 4730  Fax:  +44 113 283 3211 

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



[PHP] Display question

2003-08-01 Thread John T. Beresford
Hi All,

I'm having a hard time wrapping my head around this. I have a query 
that returns the following (Sorted by col2):

col1col2
-
house1  Com1
house2  Com1
house3  Com2
house4  Com2
house5  Com3
house6  Com3
I would like to display it as shown below:

Com 1
house1 - Com1
house2 - Com1
Com 2
house3 - Com2
house4 - Com2
Com 3
house5 - Com3
house6 - Com3
I'm having a problem with the header for each 'com'

Thanks for any pointers,
John
--
===
John T. Beresford, Owner
Digital Studio Design
Edmond, OK
http://www.digitalstudiodesign.com/
405.760.0794
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Redirect to HTTPS

2003-08-01 Thread desa15
I have a stupid question.

I need if i be in a http make a redirect to https.
Http is a 80 port and ssl is a 443 port

if ($HTTP_SERVER_VARS['SERVER_PORT']==80)
{

 header(Location: https://mynet.com/pay.php;);
 exit;
 }

Is the correct way to do this ??? Exist any function to make this ???



Excuse my broken English, Regards from Spain

Un saludo, Danny



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



[PHP] howto set variablevalue with link?

2003-08-01 Thread Kalle Saarinen
Hello,

I was wondering is it possible to set a variable value with html link?

I would like to have link button in my page that changes the language. I
thought to set $lang variable with the button and later use it to detedmine
what to fetch from the database.

What wound be the smartest solution?

Thanks

-Kalle




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



Re: [PHP] Redirect to HTTPS

2003-08-01 Thread Richard Baskett
This is how I do it:

if ($_SERVER['HTTPS']!='on') {
  header(Location: https://mynet.com/pay.php;);
  exit;
}


It is my ambition to say in ten sentences; what others say in a whole
book. - Friedrich Nietzsche

 From: [EMAIL PROTECTED]
 Date: Fri, 1 Aug 2003 10:20:58 +0200
 To: [EMAIL PROTECTED]
 Subject: [PHP] Redirect to HTTPS
 
 I have a stupid question.
 
 I need if i be in a http make a redirect to https.
 Http is a 80 port and ssl is a 443 port
 
 if ($HTTP_SERVER_VARS['SERVER_PORT']==80)
 {
 
header(Location: https://mynet.com/pay.php;);
exit;
 }
 
 Is the correct way to do this ??? Exist any function to make this ???
 
 
 
 Excuse my broken English, Regards from Spain
 
 Un saludo, Danny
 
 
 
 -- 
 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: howto set variablevalue with link?

2003-08-01 Thread Craig Roberts
Yeah -

a href=page.php?lang=en

then access the variable in page.php -
$_GET['lang'] == en;

You could then store the language variable in a cookie, session or just pass
it from page to page by calling each page with page.php?lang=xx.

Craig Roberts

Kalle Saarinen [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Hello,

 I was wondering is it possible to set a variable value with html link?

 I would like to have link button in my page that changes the language. I
 thought to set $lang variable with the button and later use it to
detedmine
 what to fetch from the database.

 What wound be the smartest solution?

 Thanks

 -Kalle







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



Re: [PHP] howto set variablevalue with link?

2003-08-01 Thread Richard Baskett
yeah you can set a variable this way:

http://www.example.com/test.php?var=something

This sets the variables $var equal to something and you can use them
accordingly within your script.  If you have safe mode on then you'll need
to access the $var variable by using the $_GET array like so:

$_GET['var']

Cheers!

Rick

What lies behind us and what lies before us are tiny matters compared to
what lies within us. - Oliver Wendell Holmes

 From: Kalle Saarinen [EMAIL PROTECTED]
 Reply-To: Kalle Saarinen [EMAIL PROTECTED]
 Date: Fri, 1 Aug 2003 11:21:23 +0300
 To: [EMAIL PROTECTED]
 Subject: [PHP] howto set variablevalue with link?
 
 Hello,
 
 I was wondering is it possible to set a variable value with html link?
 
 I would like to have link button in my page that changes the language. I
 thought to set $lang variable with the button and later use it to detedmine
 what to fetch from the database.
 
 What wound be the smartest solution?
 
 Thanks
 
 -Kalle
 
 
 
 
 -- 
 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] COUNT(*)

2003-08-01 Thread Yury B .
Hi

I used to use old fashioned mysql quieries but moderm mysql 
apparently became more flexible so. I want to understand how to use 
some of the new features like COUNT(*)

Let's say I have
$result=SELECT COUNT(*) FROM pet;
$sql=mysql_query($result);
while ($row=mysql_fetch_array($sql)){
$pet_name=$row['pet_name'];
echo ..;
}

the question is how do I actually retrieve the number of rows of sql 
query result?

Yury

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



[PHP] Re: COUNT(*)

2003-08-01 Thread Craig Roberts
use mysql_fetch_rows();

$result=SELECT COUNT(*) FROM pet;
$sql=mysql_query($result);
$number_of_rows = mysql_fetch_rows($sql);
while ($row=mysql_fetch_array($sql)){
$pet_name=$row['pet_name'];
echo ..;
}

Craig Roberts


Yury B . [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Hi

 I used to use old fashioned mysql quieries but moderm mysql
 apparently became more flexible so. I want to understand how to use
 some of the new features like COUNT(*)

 Let's say I have
 $result=SELECT COUNT(*) FROM pet;
 $sql=mysql_query($result);
 while ($row=mysql_fetch_array($sql)){
 $pet_name=$row['pet_name'];
 echo ..;
 }

 the question is how do I actually retrieve the number of rows of sql
 query result?

 Yury



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



Re: [PHP] howto set variablevalue with link?

2003-08-01 Thread Kalle Saarinen
Jep, that did it Thanks!

-Kalle


- Original Message - 
From: Richard Baskett [EMAIL PROTECTED]
To: PHP General [EMAIL PROTECTED]
Sent: Friday, August 01, 2003 11:28 AM
Subject: Re: [PHP] howto set variablevalue with link?


 yeah you can set a variable this way:

 http://www.example.com/test.php?var=something

 This sets the variables $var equal to something and you can use them
 accordingly within your script.  If you have safe mode on then you'll need
 to access the $var variable by using the $_GET array like so:

 $_GET['var']

 Cheers!

 Rick

 What lies behind us and what lies before us are tiny matters compared to
 what lies within us. - Oliver Wendell Holmes

  From: Kalle Saarinen [EMAIL PROTECTED]
  Reply-To: Kalle Saarinen [EMAIL PROTECTED]
  Date: Fri, 1 Aug 2003 11:21:23 +0300
  To: [EMAIL PROTECTED]
  Subject: [PHP] howto set variablevalue with link?
 
  Hello,
 
  I was wondering is it possible to set a variable value with html link?
 
  I would like to have link button in my page that changes the language. I
  thought to set $lang variable with the button and later use it to
detedmine
  what to fetch from the database.
 
  What wound be the smartest solution?
 
  Thanks
 
  -Kalle
 
 
 
 
  -- 
  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] Multiple targets with fscanf

2003-08-01 Thread Denis 'Alpheus' Cahuk
Hello!

I'll get strait to the point:
I want to include a header from another site ($fp = 
fopen(www.something.info/news.html, r)) using the fscanf command,
The headers are in li... tags and I'm usign $a = fscanf($fp, 
li%s). the problem is, that if I use this, I get only the first
word in the header, but I would like to get the whole line until the 
next li.

Thanks in advance

Denis 'Alpheus' Cahuk

P.S: I am not suscribed to the ML so reply to the mail directly please.

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


Re: [PHP] COUNT(*)

2003-08-01 Thread Richard Baskett
Actually that does retrieve the number of rows..

// Query
$query = SELECT COUNT(*) AS count FROM pet;

// Execute Query
$result = mysql_query($query);

// Get the result of query named count
$count = mysql_result($result,0);

echo $count. is the number of rows;

Cheers!

Rick

In order to seek truth it is necessary once in the course of our life
to doubt as far as possible all things. - Rene Descartes

 From: Yury B. [EMAIL PROTECTED]
 Reply-To: [EMAIL PROTECTED]
 Date: Thu, 31 Jul 2003 19:46:40 +0200
 To: [EMAIL PROTECTED]
 Subject: [PHP] COUNT(*)
 
 Hi
 
 I used to use old fashioned mysql quieries but moderm mysql
 apparently became more flexible so. I want to understand how to use
 some of the new features like COUNT(*)
 
 Let's say I have
 $result=SELECT COUNT(*) FROM pet;
 $sql=mysql_query($result);
 while ($row=mysql_fetch_array($sql)){
 $pet_name=$row['pet_name'];
 echo ..;
 }
 
 the question is how do I actually retrieve the number of rows of sql
 query result?
 
 Yury
 
 -- 
 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] Deleteing one session

2003-08-01 Thread Ford, Mike [LSS]
 -Original Message-
 From: Ryan A [mailto:[EMAIL PROTECTED]
 Sent: 31 July 2003 00:34
 
 
 have around 20 sessions setup and want to delete one of them...
 eg:
 I have the following sessions:

Can I just make a little correction to your terminology, as every time I
read your questions about sessions I experience a temporary disorientation
until I adjust myself to how you're using the word?

 one
 two
 three
 four
 five
 etc

These are session variables, not sessions.  A session is -- ummm,
well, roughly -- the period of time a user spends browsing the site between
the very first session_start() and the point where the session is destroyed
(explicitly by session_destroy() or by the session garbage collector
deleting an expired session).  The entire set of data stored in the
$_SESSION[] would typically be called session data or the session array.

 
 which is better? I am starting my sessions with this kind of 
 statement:
 $_SESSION['blah'] = $_GET['blah'];

That's registering a session variable.  Sessions are started with the
initial session_start() call.

 Also any idea how many sessions I can have on at one time? 
 or is there no
 limit? I couldnt find anything on that in the manual.

The number of session variables you can register in your session will be
determined by the storage capacity of the session mechanism you are using.
If it's the default files that will be the maximum size of a file on your
server's file system.  Given this overall restraint, you would (if you could
ever manage to register that many session variables!) be able to store far
more session variables containing simple values (such as integers) than ones
containing complex data (such as arrays or long strings).

Short answer -- you'll probably never have to worry about hitting that
limit!

Cheers!

Mike

-
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning  Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, LEEDS,  LS6 3QS,  United Kingdom
Email: [EMAIL PROTECTED]
Tel: +44 113 283 2600 extn 4730  Fax:  +44 113 283 3211 

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



RE: [PHP] Re: include help please

2003-08-01 Thread Ford, Mike [LSS]
 -Original Message-
 From: Jennifer Goodie [mailto:[EMAIL PROTECTED]
 Sent: 31 July 2003 22:42
 
  if (isset($page)) {
  include $$_GET['page'];
  } else {
  $page = $home;
  include $page;
  }
 
  would that be right?
  or should i use
 
  if (isset($page)) {
  include $$_GET['page'];
  } else {
  include $home;
  }
 
  hopefully that's right.  if so, pretty good for a n00b
 
 
 I don't think I'd let someone pass any page they wanted via a 
 get and just
 include that page.
 
 If you have URL fopen wrappers on I can create a page on my server and
 include it to your page and pretty much execute any code I 
 want on your
 server.
 
 example:
 
 http://www.yourdomain.com?yourscript.php?page=http://mydomain.
com/myscript.p
hp

Take a closer look -- that's a double $$ in front of _GET['page'], not a single one -- 
that means he must have a variable defined with the name of whatever you put as the 
value of page=, and I think he's very unlikely to have a 
$http://mydomain.com/myscript.php...!!

But, you're right, there should be some error checking for invalid page values, just 
in case someone (or something!) should try this -- something like (not tested!):

   if (isset($_GET['page'])) {
  if (isset($$_GET['page']))
 include $$_GET['page'];
  else
 include('no_such_page.inc');
   } else {
  include $home;
   }

And, as a final BTW, I'd do this with an array:

   $pages = array('fred'='fred.php',
  'barney'='barney.php',
  'rubble'='quarry/mr_rubble.inc');

   --

   if (isset($_GET['page'])) {
  if (isset($pages[$_GET['page']]))
 include $pages[$_GET['page']];
  else
 include('no_such_page.inc');
   } else {
  include $home;
   }

Cheers!

Mike

-
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning  Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, LEEDS,  LS6 3QS,  United Kingdom
Email: [EMAIL PROTECTED]
Tel: +44 113 283 2600 extn 4730  Fax:  +44 113 283 3211 

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



Re: [PHP] Redirect to HTTPS

2003-08-01 Thread Nicholas Robinson
It might also be worth making sure that your web server is configured to force 
https on this page if this is what you want. Otherwise a user could type the 
URL in without the HTTPS and still get the page.


On Friday 01 Aug 2003 9:20 am, [EMAIL PROTECTED] wrote:
 I have a stupid question.

 I need if i be in a http make a redirect to https.
 Http is a 80 port and ssl is a 443 port

 if ($HTTP_SERVER_VARS['SERVER_PORT']==80)
 {

  header(Location: https://mynet.com/pay.php;);
  exit;
  }

 Is the correct way to do this ??? Exist any function to make this ???



 Excuse my broken English, Regards from Spain

 Un saludo, Danny


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



[PHP] Re: eval

2003-08-01 Thread Bogdan Stancescu
You can put whatever you want in eval:

?
  $foo='foo';
  $bar='bar';
  echo(foo is $foo; bar is $bar);
  $myCode='$foo=checking eval statements; ';
  $myCode.='$bar=str_replace( ,--,$foo);';
  eval($myCode);
  echo(foo is $foo; bar is $bar);
?
You could even do this:

?
  $foo='$i++;';
  $bar='eval($foo);';
  $i=1;
  eval($foo);
  echo(i=$i);
  eval($bar);
  echo(i=$i);
?
HTH

Bogdan

Decapode Azur wrote:

Is it possible to put PHP code in eval ?
Or just vars ?
?php

$string = 'The result of ?php $a=2; $b=3; $c=$a+$b; echo $a + $b is $c; 
?';

eval ($string);

?


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


RE: [PHP] Re: Opinions on Micro$oft .NET

2003-08-01 Thread Adrian Teasdale
I'd just like to say that I've found this discussion to be very interesting
and enlightning.  It also makes a change to see people not microsoft
bashing but taking an objective view on everything.  We keep getting more
and more requests to develop products for .net because our clients want
software which runs under windows, online or (more recently) for handheld
devices. So far we've concentrated on PHP for web development and Delphi for
application development, but I think that .net cannot be ignored.

Even though I didn't start the thread, I found it very useful to follow

Best

Ade


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



Re: [PHP] Display question

2003-08-01 Thread messju mohr
On Fri, Aug 01, 2003 at 03:00:23AM -0500, John T. Beresford wrote:
 Hi All,
 
 I'm having a hard time wrapping my head around this. I have a query 
 that returns the following (Sorted by col2):
 
 col1  col2
 -
 house1Com1
 house2Com1
 house3Com2
 house4Com2
 house5Com3
 house6Com3
 
 
 I would like to display it as shown below:
 
 Com 1
 house1 - Com1
 house2 - Com1
 
 Com 2
 house3 - Com2
 house4 - Com2
 
 Com 3
 house5 - Com3
 house6 - Com3
 
 
 I'm having a problem with the header for each 'com'
 
 Thanks for any pointers,
 John

i think this is a common task. you can try something like:

$last = null;
while ( list($col1, $col2) = fetch_next_row() ) {
if ($last != $col2) {
echo \n$col2\n;
$last = $col2;
}
echo $col1 - $col2\n;
}



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



[PHP] reading variables in other script files

2003-08-01 Thread Kalle Saarinen
Hello

I was just wondering how can I get value of a variable in php code located
in a different file?

ie.

I have file1.php wich stores $var1
how can I read the value of $var1 in file2.php

I have database and I can put it in there (I quess) but is that the only
way?

-Kalle


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



[PHP] Re: reading variables in other script files

2003-08-01 Thread Craig Roberts
2 ways come to mind - one's messy one isnt!

Non-Messy:
You could put $var1 into an include file, and include it in both file1.php
and file2.php, eg:

//Inc.php
$var1 = some value;

//file1.php
include('Inc.php');
$var1 == some value;

//file2.php
include('inc.php');
$var1 == some value;

$var1 will be avaliable in both files. inc.php could, of course have some
code in it to set the variable (for example a random number etc). $var1
would also be avaliable to any other scripts that may need it in the future,
just by including the inc.php file.

Messy:
Open file1.php from file2.php and read the variable out of it... ***MESSY,
SLOW AND DIRTY***

Craig Roberts


Kalle Saarinen [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Hello

 I was just wondering how can I get value of a variable in php code located
 in a different file?

 ie.

 I have file1.php wich stores $var1
 how can I read the value of $var1 in file2.php

 I have database and I can put it in there (I quess) but is that the only
 way?

 -Kalle




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



[PHP] force load of ldap.conf

2003-08-01 Thread Turbo Fredriksson
It seems like the OpenLDAP libs is forcing a load of
the ldap.conf file... In that there's the BASE option
(which tells the clients where/what the base is).

In my development systems, I use LDAP as database for
users etc (together with Kerberos).

The problem is that I also run development database(s) on
localhost, with different base(s), sometimes different
ports etc. When (trying) to get the namingContexts from
the database, I can't retreive them if BASE is set...

Is there a way to get ldap_read() to NOT use this value,
OR is my string wrong ($attrib here is 'namingcontexts')?

- s n i p -
$sr = @ldap_read($this-ldap_linkid, NULL, '(objectClass=*)', array($attrib));
if(! $sr) die(Can't find base dn - .ldap_error($this-ldap_linkid));
$entry = ldap_get_entries($this-ldap_linkid, $sr);
print_r($entry); die();
- s n i p -

By having 'BASE dc=com' in ldap.conf (which is the only
base I have in my non-development system), I will get
this:

- s n i p -
   Array ( [count] = 1 [0] = Array ( [count] = 0 [dn] = dc=com ) )
- s n i p -

Uncommenting the BASE value from ldap.conf and restart
apache, I get the intended values:

- s n i p -
   Array ( [count] = 1 [0] = Array ( [namingcontexts] = Array ( [count] = 2 [0] = 
c=SE [1] = dc=com ) [0] =
   namingcontexts [count] = 1 [dn] = ) )
- s n i p -

The intention is to copy the behaviour of the following
shell command:

ldapsearch -x -LLL -h localhost -s base -b '' objectclass=* namingContexts

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



[PHP] Search Engine

2003-08-01 Thread imran
Hi,

Does anyone know any free search engine for web application


imee





[PHP] Multiple targets with fscanf

2003-08-01 Thread Denis 'Alpheus' Cahuk
Hello!

I'll get strait to the point:
I want to include a header from another site ($fp =
fopen(www.something.info/news.html, r)) using the fscanf command,
The headers are in li... tags and I'm usign $a = fscanf($fp,
li%s). the problem is, that if I use this, I get only the first
word in the header, but I would like to get the whole line until the
next li.
Thanks in advance

Denis 'Alpheus' Cahuk

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


Re: [PHP] Multiple targets with fscanf

2003-08-01 Thread Marek Kilimajer
Try (untested)
$a = fscanf($fp,li%sli);
if that does not work use regular expresions

Denis 'Alpheus' Cahuk wrote:

Hello!

I'll get strait to the point:
I want to include a header from another site ($fp =
fopen(www.something.info/news.html, r)) using the fscanf command,
The headers are in li... tags and I'm usign $a = fscanf($fp,
li%s). the problem is, that if I use this, I get only the first
word in the header, but I would like to get the whole line until the
next li.
Thanks in advance

Denis 'Alpheus' Cahuk




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


Re: [PHP] Multiple targets with fscanf

2003-08-01 Thread Dan Anderson
Is there any reason you couldn't do something like:

?php
$buffer = implode(\n,file($somesite));
while (strstr($buffer,li);
{
$li_tag_start_position = strpos($buffer,li);
$li_tag_end_position = strpos($buffer,/li);
$data = substr($buffer,(4 + $li_tag_start_position),(4 +
$li_tag_end_position));
$buffer = substr($buffer, (4 + $li_tag_end_position));
}
?

Note that you could significantly compact the code by putting the strpos
calls in substr.  This would, however, obfusicate it.

-Dan

On Fri, 2003-08-01 at 07:15, Denis 'Alpheus' Cahuk wrote:
 Hello!
 
 I'll get strait to the point:
 I want to include a header from another site ($fp =
 fopen(www.something.info/news.html, r)) using the fscanf command,
 The headers are in li... tags and I'm usign $a = fscanf($fp,
 li%s). the problem is, that if I use this, I get only the first
 word in the header, but I would like to get the whole line until the
 next li.
 
 Thanks in advance
 
 Denis 'Alpheus' Cahuk
 


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



Re: [PHP] What is $$

2003-08-01 Thread Ryan A
Hi all,
thanks for replying.
I guess i have to read the manaul in a little more detail now and also
update the manualam using last years one, i didnt think there was a big
differience but i guess there is.
Thanks again.
Cheers,
-Ryan


We will slaughter you all! - The Iraqi (Dis)information ministers site
http://MrSahaf.com


- Original Message -
From: Jason Wong [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Friday, August 01, 2003 5:13 AM
Subject: Re: [PHP] What is $$


 On Friday 01 August 2003 10:59, Ryan A wrote:

  I have just found this in my book: $$var = $value
  what is the double dollar for? or is that a typo?
  Thanks,

 Search manual for variable variables (and no, that is not a typo).

 --
 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
 --
 /*
 If you can't be good, be careful.  If you can't be careful, give me a
call.
 */


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

2003-08-01 Thread Jay Blanchard
[snip]
Does anyone know any free search engine for web application
[/snip]

Google for web application? It's free. Oh, I get it!

Google for free search engine for web application.

HTH!

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



FW: [PHP] Search Engine

2003-08-01 Thread Ryan Gibson
Hi,

http://www.conceptx.co.uk/rpgproducts/index.php?pid=1

I made this some time ago, it could do with some work (if I remember
rightly, it doesn't cut off after X amount of results, what can I say I'm
lazy) id does order by relevance but requires indexing after changes.


On 2/8/03 12:14 am, imran [EMAIL PROTECTED] wrote:

 Hi,
 
 Does anyone know any free search engine for web application
 
 
 imee
 
 
 
 

Ryan Gibson
---
[EMAIL PROTECTED]


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



[PHP] Trouble getting $HTTP_RAW_POST_DATA

2003-08-01 Thread Balazs Halasy
I need to have the contents of $HTTP_RAW_POST_DATA because of
non-regular uploads (from browser to my home-made WevDAV server implementation 
(done in PHP)). However, no matter what I
do, it is always NULL. I guess the following script should return
SOMETHING in $HTTP_RAW_POST DATA if always_populate_raw_post_data = On is
added to the php.ini file (and yes, I've restarted apache :-)... so, why
is it empty and how can I get the RAW post data? My PHP version is 4.3.2.

test.php: 

form action=?echo($PHP_SELF)? method=post 
input type=text value=you-suck 
input type=submit 
/form 
?php 
echo(Raw post data: .$HTTP_RAW_POST_DATA.br\n); 
echo(Raw post data decoded:
.base64_decode($HTTP_RAW_POST_DATA).br\n); 
echo(hr); 
phpinfo(); 
? 



Allman


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



Re: [PHP] Trouble getting $HTTP_RAW_POST_DATA

2003-08-01 Thread John W. Holmes
Balazs Halasy wrote:
I need to have the contents of $HTTP_RAW_POST_DATA because of
non-regular uploads (from browser to my home-made WevDAV server implementation 
(done in PHP)). However, no matter what I
do, it is always NULL. I guess the following script should return
SOMETHING in $HTTP_RAW_POST DATA if always_populate_raw_post_data = On is
added to the php.ini file (and yes, I've restarted apache :-)... so, why
is it empty and how can I get the RAW post data? My PHP version is 4.3.2.
Is register globals ON or OFF? Either way, maybe try 
$_SERVER['HTTP_RAW_POST_DATA']...

--
---John Holmes...
Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/

PHP|Architect: A magazine for PHP Professionals  www.phparch.com





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


[PHP] Frames and variables

2003-08-01 Thread Kalle Saarinen
Hi,

I have a site that uses frames. On one frame i  have buttons to select the
language. When user hits the button to select the language it is supposed to
change in both frames.

Any idea how to do this?



Thanks

-Kalle


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



Re: [PHP] Upload scripts timing out

2003-08-01 Thread Marek Kilimajer
check php.ini for max_input_time

Josh Abernathy wrote:

My current upload script times out too quickly when users are uploading
large files. How can I stop this from happening?
Thanks!




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


RE: [PHP] Frames and variables

2003-08-01 Thread Jay Blanchard
[snip]
I have a site that uses frames. On one frame i  have buttons to select
the
language. When user hits the button to select the language it is
supposed to
change in both frames.

Any idea how to do this?
[/snip]

Please read http://www.w3.org/TR/html4/present/frames.html

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



Re: [PHP] Trouble getting $HTTP_RAW_POST_DATA

2003-08-01 Thread Baroiller Pierre-Emmanuel
Hi,
$HTTP_RAW_POST_DATA is an array...
with echo you'll only get array..

To get something into $HTTP_RAW_POST_DATA, you need to submit your form
before...

Your script will only display something if you post the form before.

Regards,
P.E. Baroiller


John W. Holmes [EMAIL PROTECTED] a écrit dans le message de
news:[EMAIL PROTECTED]
 Balazs Halasy wrote:
  I need to have the contents of $HTTP_RAW_POST_DATA because of
  non-regular uploads (from browser to my home-made WevDAV server
implementation
  (done in PHP)). However, no matter what I
  do, it is always NULL. I guess the following script should return
  SOMETHING in $HTTP_RAW_POST DATA if always_populate_raw_post_data = On
is
  added to the php.ini file (and yes, I've restarted apache :-)... so, why
  is it empty and how can I get the RAW post data? My PHP version is
4.3.2.

 Is register globals ON or OFF? Either way, maybe try
 $_SERVER['HTTP_RAW_POST_DATA']...

 -- 
 ---John Holmes...

 Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/

 PHP|Architect: A magazine for PHP Professionals - www.phparch.com







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



RE: [PHP] Trouble getting $HTTP_RAW_POST_DATA

2003-08-01 Thread Donald Tyler
You should encase the $HTTP_RAW_POST_DATA in print_r() or you will just get
the word Array printed. But I doubt that will solver your problem because
it seems that $HTTP_RAW_POST_DATA is empty.

Also, print_r() does not include any HTML formatting, so you will need to
look at the source for the page in the browser to make it readable.

-Original Message-
From: Balazs Halasy [mailto:[EMAIL PROTECTED] 
Sent: Friday, August 01, 2003 7:28 AM
To: [EMAIL PROTECTED]
Subject: [PHP] Trouble getting $HTTP_RAW_POST_DATA

I need to have the contents of $HTTP_RAW_POST_DATA because of
non-regular uploads (from browser to my home-made WevDAV server
implementation 
(done in PHP)). However, no matter what I
do, it is always NULL. I guess the following script should return
SOMETHING in $HTTP_RAW_POST DATA if always_populate_raw_post_data = On is
added to the php.ini file (and yes, I've restarted apache :-)... so, why
is it empty and how can I get the RAW post data? My PHP version is 4.3.2.

test.php: 

form action=?echo($PHP_SELF)? method=post 
input type=text value=you-suck 
input type=submit 
/form 
?php 
echo(Raw post data: .$HTTP_RAW_POST_DATA.br\n); 
echo(Raw post data decoded:
.base64_decode($HTTP_RAW_POST_DATA).br\n); 
echo(hr); 
phpinfo(); 
? 



Allman


-- 
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] Purging old files from directories

2003-08-01 Thread Verdon vaillancourt
Hi :)

I need to write a script that will scan/read a given directory's contents
and delete files older than a certain date. Ideally, this will be a script
that runs via cron once a week and deletes all files it finds in the
directory older than 2 weeks from the current date. I do currently have
scripts running via cron and that's no problem. I'm not sure where to begin
with the other components

I'm not looking to be spoon-fed, but I was hoping that someone could point
me in the right direction to start researching.

Best regards,
Verdon


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



[PHP] Undefined variable problem

2003-08-01 Thread Ryan A
Hi,
This is the following code given to me by Jenniffer Goodie (thank you) which
is working great but is throwing this notice:

Notice: Undefined variable: email1 in c:\phpdev\www\bwh\project\compare.php
on line 117
Notice: Undefined variable: address1 in
c:\phpdev\www\bwh\project\compare.php on line 117
Notice: Undefined variable: city1 in c:\phpdev\www\bwh\project\compare.php
on line 117
etc (30+ notices)

This is the code:
   $m = 1;
   while ($line = mysql_fetch_assoc($rs)) { //dumping into an array
 foreach ($line as $field = $value) {
 $tmp = $field.$m;
$$tmp.= $value;  /* This is the error line 117*** */
 }
 $m++;
   }

This is basically so that i can use the array via variables like so:
if($tcl2==1){echo $tcl2;}
instead of: if($arrayname['tcl']['1']==1){echo $arrayname['tcl']['1'];} and
so onesp since i have 38 fields.

I can of course just shut off error reporting...but thats not the best
solution right? and i still wouldnt know whats causing these notices...

Any ideas?

Cheers,
-Ryan



We will slaughter you all! - The Iraqi (Dis)information ministers site
http://MrSahaf.com



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



Re: [PHP] Undefined variable problem

2003-08-01 Thread David Nicholson
Hello,

This is a reply to an e-mail that you wrote on Fri, 1 Aug 2003 at
14:47, lines prefixed by '' were originally written by you.

 Notice: Undefined variable: email1 in
 c:phpdevwwwbwhprojectcompare.php
 on line 117

 $$tmp.= $value;  /* This is the error line 117*** */

You are trying to append to the variable instead of create it, change
this line to:
$$tmp = $value;

David.

--
phpmachine :: The quick and easy to use service providing you with
professionally developed PHP scripts :: http://www.phpmachine.com/

  Professional Web Development by David Nicholson
http://www.djnicholson.com/

QuizSender.com - How well do your friends actually know you?
 http://www.quizsender.com/
(developed entirely in PHP)

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



Re: [PHP] Undefined variable problem

2003-08-01 Thread Joona Kulmala
Hello

This is the code:
   $m = 1;
   while ($line = mysql_fetch_assoc($rs)) { //dumping into an array
 foreach ($line as $field = $value) {
 $tmp = $field.$m;
$$tmp.= $value;  /* This is the error line 117*** */
 }
 $m++;
   }
This is basically so that i can use the array via variables like so:
if($tcl2==1){echo $tcl2;}
instead of: if($arrayname['tcl']['1']==1){echo $arrayname['tcl']['1'];} and
so onesp since i have 38 fields.
I can of course just shut off error reporting...but thats not the best
solution right? and i still wouldnt know whats causing these notices...
Simply define $$tmp -variable before adding stuff in it.

[code]
   $m = 1;
   while ($line = mysql_fetch_assoc($rs)) { //dumping into an array
 foreach ($line as $field = $value) {
$tmp = $field.$m;
$$tmp = ;
	 $$tmp .= $value; 
 }
 $m++;
   }
[/code]

No it should whine about undefined vars.

Cheers, Joona
--
Joona Kulmala [EMAIL PROTECTED]
PHP Finland
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Undefined variable problem

2003-08-01 Thread Ryan A
IT WORKS!!!
Thanks for replying and the solution.
Cheers,
-Ryan


Hello,

This is a reply to an e-mail that you wrote on Fri, 1 Aug 2003 at
14:47, lines prefixed by '' were originally written by you.

 Notice: Undefined variable: email1 in
 c:phpdevwwwbwhprojectcompare.php
 on line 117

 $$tmp.= $value;  /* This is the error line 117*** */

You are trying to append to the variable instead of create it, change
this line to:
$$tmp = $value;

David.

--
phpmachine :: The quick and easy to use service providing you with
professionally developed PHP scripts :: http://www.phpmachine.com/

  Professional Web Development by David Nicholson
http://www.djnicholson.com/

QuizSender.com - How well do your friends actually know you?
 http://www.quizsender.com/
(developed entirely in PHP)



We will slaughter you all! - The Iraqi (Dis)information ministers site
http://MrSahaf.com



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



Re: [PHP] [PHP-WIN] http://www.zend.com/manual/function.memory-get-usage.php(fwd)

2003-08-01 Thread Miha Nedok

The function doesn't exist but it should since 4.3.2, i'm using the
official win32 builds from PHP.

Yes, win32 :) Hmmm... we have to do what we have to do to pay the bills,
don't you agree ? :))

-Mike


On Wed, 30 Jul 2003, Evan Nemerson wrote:

 Date: Wed, 30 Jul 2003 19:32:11 -0700
 From: Evan Nemerson [EMAIL PROTECTED]
 To: Miha Nedok [EMAIL PROTECTED], [EMAIL PROTECTED]
 Subject: Re: [PHP] [PHP-WIN]
 http://www.zend.com/manual/function.memory-get-usage.php (fwd)

 Was php configured with --enable-memory-limit?
 function_exists('memory_get_usage')??? function_exists('get_memory_usage')???
 Did the function even exist in 4.3.3 RC1?

 Why is your address @ unix-systems.net and you're asking about win32?


 On Wednesday 30 July 2003 04:36 pm, Miha Nedok wrote:
  I asked this one on php-windoows, can someone here tell the answer.
 
  -Mike
 
  -- Forwarded message --
  Date: Tue, 29 Jul 2003 15:56:25 +0200 (CEST)
  From: Miha Nedok [EMAIL PROTECTED]
  To: [EMAIL PROTECTED]
  Subject: [PHP-WIN] http://www.zend.com/manual/function.memory-get-usage.php
 
 
  Any ideas with this one on Win32 ? I'm running 4.3.3RC1.
 
  -Mike


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



Re: [PHP] Trouble getting $HTTP_RAW_POST_DATA

2003-08-01 Thread skate

 Also, print_r() does not include any HTML formatting, so you will need to
 look at the source for the page in the browser to make it readable.

or your could use pre.../pre



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



Re: [PHP] Purging old files from directories

2003-08-01 Thread Marek Kilimajer


Verdon vaillancourt wrote:

Hi :)

I need to write a script that will scan/read a given directory's contents
and delete files older than a certain date. Ideally, this will be a script
that runs via cron once a week and deletes all files it finds in the
directory older than 2 weeks from the current date. I do currently have
scripts running via cron and that's no problem. I'm not sure where to begin
with the other components
Begin in the manual:
Directory functions
Filesystem functions - filemtime()
I'm not looking to be spoon-fed, but I was hoping that someone could point
me in the right direction to start researching.
Best regards,
Verdon



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


Re: [PHP] Purging old files from directories

2003-08-01 Thread Jason Wong
On Friday 01 August 2003 21:40, Verdon vaillancourt wrote:

 I need to write a script that will scan/read a given directory's contents
 and delete files older than a certain date. Ideally, this will be a script
 that runs via cron once a week and deletes all files it finds in the
 directory older than 2 weeks from the current date. I do currently have
 scripts running via cron and that's no problem. I'm not sure where to begin
 with the other components

 I'm not looking to be spoon-fed, but I was hoping that someone could point
 me in the right direction to start researching.

Reading

  manual  Directory functions
  manual  Filesystem functions
  manual  Date and Time functions

should get you started.

If possible, it's a lot easier and more efficient to use a shell script 
instead. A single find command will do the job.

-- 
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
--
/*
Do it by the book
-- Anti- Murphy's Laws n5
*/


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



Re: [PHP] Purging old files from directories

2003-08-01 Thread Verdon vaillancourt
Thank you :)

On 8/1/03 10:06 AM, Marek Kilimajer [EMAIL PROTECTED] wrote:

 Begin in the manual:
 Directory functions
 Filesystem functions - filemtime()


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



[PHP] Simple Math Calculation Problem....

2003-08-01 Thread Scott Fletcher
Hi!

I'm a little stuck with this simple math problem.  I'm trying to get a
number of days in integer, not float.

--snip--
   $input_date = 12/16/2002;
   $UserInput = explode(/, $input_date);

   $UserInputMonth = $UserInput[0];
   $UserInputDay = $UserInput[1];
   $UserInputYear = $UserInput[2];

   $clockDate = mktime(0,0,0,date(m),date(d),date(Y));
   $inputDate = mktime(0,0,0,$UserInputMonth,$UserInputDay,$UserInputYear);

   $Days = (($clockDate - $inputDate) / (24 * 3600));
   //$Days = round(Days);
--snip--

But then I get the idea of doing the round function but it only return a
'0' value.  Anyone know?



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



Re: [PHP] Simple Math Calculation Problem....

2003-08-01 Thread skate

$Days = (($clockDate - $inputDate) / (24 * 3600));

$Days = int(($clockDate - $inputDate) / (24 * 3600));

you tried that? 



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



RE: [PHP] Simple Math Calculation Problem....

2003-08-01 Thread Buntin, Seth - KATE
I used your snip you just posted and changed the $Days = round(Days) to
$Days = round($Days) and got 228.

-Original Message-
From: Scott Fletcher [mailto:[EMAIL PROTECTED] 
Sent: Friday, August 01, 2003 9:18 AM
To: [EMAIL PROTECTED]
Subject: [PHP] Simple Math Calculation Problem


Hi!

I'm a little stuck with this simple math problem.  I'm trying to get
a number of days in integer, not float.

--snip--
   $input_date = 12/16/2002;
   $UserInput = explode(/, $input_date);

   $UserInputMonth = $UserInput[0];
   $UserInputDay = $UserInput[1];
   $UserInputYear = $UserInput[2];

   $clockDate = mktime(0,0,0,date(m),date(d),date(Y));
   $inputDate =
mktime(0,0,0,$UserInputMonth,$UserInputDay,$UserInputYear);

   $Days = (($clockDate - $inputDate) / (24 * 3600));
   //$Days = round(Days);
--snip--

But then I get the idea of doing the round function but it only
return a '0' value.  Anyone know?



-- 
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] Simple Math Calculation Problem....

2003-08-01 Thread Scott Fletcher
The int() function is for C/C++ programming only.  This Int() function is
not supported in PHP.  In PHP it would be Intval().  For float, Floatval().
For double, DoubleVal().  Etc.   But beware of the Octual numbers.

Skate [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]

 $Days = (($clockDate - $inputDate) / (24 * 3600));

 $Days = int(($clockDate - $inputDate) / (24 * 3600));

 you tried that?





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



Re: [PHP] Simple Math Calculation Problem....

2003-08-01 Thread Scott Fletcher
Gee!  I forgot the '$'.   It's been right there in my face.  Thanks!  I hope
the round() function work without a problem because I saw in some posting
that some people have this problem where if 3.51 is rounded, it return a 3.

Seth - Kate Buntin [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
I used your snip you just posted and changed the $Days = round(Days) to
$Days = round($Days) and got 228.

-Original Message-
From: Scott Fletcher [mailto:[EMAIL PROTECTED]
Sent: Friday, August 01, 2003 9:18 AM
To: [EMAIL PROTECTED]
Subject: [PHP] Simple Math Calculation Problem


Hi!

I'm a little stuck with this simple math problem.  I'm trying to get
a number of days in integer, not float.

--snip--
   $input_date = 12/16/2002;
   $UserInput = explode(/, $input_date);

   $UserInputMonth = $UserInput[0];
   $UserInputDay = $UserInput[1];
   $UserInputYear = $UserInput[2];

   $clockDate = mktime(0,0,0,date(m),date(d),date(Y));
   $inputDate =
mktime(0,0,0,$UserInputMonth,$UserInputDay,$UserInputYear);

   $Days = (($clockDate - $inputDate) / (24 * 3600));
   //$Days = round(Days);
--snip--

But then I get the idea of doing the round function but it only
return a '0' value.  Anyone know?



-- 
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] Simple Math Calculation Problem....

2003-08-01 Thread skate
 The int() function is for C/C++ programming only.  This Int() function is
 not supported in PHP.  In PHP it would be Intval().  For float,
Floatval().
 For double, DoubleVal().  Etc.   But beware of the Octual numbers.


sorry, confusing my flash action script again :(



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



[PHP] Using eregi_replace()

2003-08-01 Thread Anthony Ritter
Using eregi_replace(), is there a way to take out a piece of a sentence -
which has spaces - and then return the new sentence?

For example, to return the new sentence:

hello I must be going

from the original sentence:

blah blah blah hello I must be going blah blah.

I tried:
...
?
$text=blah blah blah hello I must be going blah blah;
$text= eregi_replace((hello.)(.going),$newtext,$text);
echo $newtext;
?
...

Thank you.
Tony Ritter




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



[PHP] Re: Search Engine

2003-08-01 Thread DvDmanDT
I use to write my own search engines... That way they get customized
easier... You can write one that spiders like google... Hell, it even found
my private server... And there's not a single link ther afaik..

Now, is it for web or site search? If site, just get a MySQL table with a
longtext in it and then some varchars to store meta data... Or do it like
php.net does for function searching..

-- 
// DvDmanDT
MSN: [EMAIL PROTECTED]
Mail: [EMAIL PROTECTED]
Imran [EMAIL PROTECTED] skrev i meddelandet
news:[EMAIL PROTECTED]
Hi,

Does anyone know any free search engine for web application


imee







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



[PHP] Re: What is $$

2003-08-01 Thread DvDmanDT
Well, it's a variable that tells php what variable to use... so it's like
if $var is hello, then $$var is the same as $hello...

-- 
// DvDmanDT
MSN: [EMAIL PROTECTED]
Mail: [EMAIL PROTECTED]
Ryan A [EMAIL PROTECTED] skrev i meddelandet
news:[EMAIL PROTECTED]
 Hi,
 I have just found this in my book: $$var = $value
 what is the double dollar for? or is that a typo?
 Thanks,
 -Ryan


 We will slaughter you all! - The Iraqi (Dis)information ministers site
 http://MrSahaf.com





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



Re: [PHP] Using eregi_replace()

2003-08-01 Thread messju mohr
On Fri, Aug 01, 2003 at 10:33:50AM -0400, Anthony Ritter wrote:
 Using eregi_replace(), is there a way to take out a piece of a sentence -
 which has spaces - and then return the new sentence?
 
 For example, to return the new sentence:
 
 hello I must be going
 
 from the original sentence:
 
 blah blah blah hello I must be going blah blah.
 
 I tried:
 ...
 ?
 $text=blah blah blah hello I must be going blah blah;
 $text= eregi_replace((hello.)(.going),$newtext,$text);

you mean
$newtext= ereg_replace(.*?(hello.*going).*,\\1,$text);
??

i would suggest preg_replace in favour to ereg_replace:
$newtext= preg_replace(!.*?(hello.*going).*!,$1,$text);

it is more powerfull, faster and widely available.

greetings
messju


 echo $newtext;
 ?
 ...
 
 Thank you.
 Tony Ritter
 
 
 
 
 -- 
 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] Trouble getting $HTTP_RAW_POST_DATA

2003-08-01 Thread Curt Zirzow
* Thus wrote Donald Tyler ([EMAIL PROTECTED]):
 
 Also, print_r() does not include any HTML formatting, so you will need to
 look at the source for the page in the browser to make it readable.

This is a problem I run into all the time, I am curious of how many
people have run into this.  I've been considering writting a patch
for php that will enable an option to htmlentity the strings. The
alternative would be to write a function that loops through all the
results:

function my_print_r($var) {
  $r = print_r($var, true);
  foreach($var as $key = $val) {
if (is_string($val) ) {
  $val = htmlentities($val);
} elseif (is_array($val) {
  $val = my_print_r($val);
}
$r[$key] = $val;
  }
  return $r;
}

Since print_r is usually used for debugging, it would be nice that
php does this for you.  Any comments on this before i throw the
idea to the php-dev list?

Curt
-- 
I used to think I was indecisive, but now I'm not so sure.

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



Re: [PHP] Using eregi_replace()

2003-08-01 Thread Curt Zirzow
* Thus wrote messju mohr ([EMAIL PROTECTED]):
 On Fri, Aug 01, 2003 at 10:33:50AM -0400, Anthony Ritter wrote:
 
 i would suggest preg_replace in favour to ereg_replace:
 $newtext= preg_replace(!.*?(hello.*going).*!,$1,$text);

Doesn't the $1 need to be escaped or in single quotes so php
doesn't touch it.

 $newtext= preg_replace(!.*?(hello.*going).*!,\$1,$text);
 or 
 $newtext= preg_replace(!.*?(hello.*going).*!,'$1',$text);

I cant test it at the moment.

Thanks

 
 it is more powerfull, faster and widely available.

I agree, I like now that PREC is now compiled by default.

Curt
-- 
I used to think I was indecisive, but now I'm not so sure.

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



[PHP] XmlRPC Extension in Apache 4.2.3

2003-08-01 Thread Donald Tyler
Hi Everyone,

I posted this on the PHP install list but didn't get a reply. I hope you
guys/gals can be more helpful.

I am having trouble getting the XmlRpc extension working with PnP 4.2.3.

SYSTEM:
Windows XP Pro
PHP 4.2.3 (Running as Apache module)
Apache 2.0.44

When Apache starts I get the following error:

Unknown(): Unable to load dynamic link library 'c:\program files\apache
group\php\extensions\php_xmlrpc.dll' - The specified module could not be
found.

The error.log after a clean start:

[Fri Jul 18 17:08:29 2003] [notice] Parent: Created child process 3420 PHP
Warning:  Unknown(): Unable to load dynamic library 'c:\program files\apache
group\php\extensions\php_xmlrpc.dll' - The specified module could not be
found.  in Unknown on line 0 [Fri Jul 18 17:08:32 2003] [notice] Child 3420:
Child process is running [Fri Jul 18 17:08:32 2003] [notice] Child 3420:
Acquired the start mutex. [Fri Jul 18 17:08:32 2003] [notice] Child 3420:
Starting 250 worker threads.

I know the dll exists in the correct location and the extension path is
specified correctly in the php.ini file because other extensions load fine.

Anyone have any suggestions?

Thanks.


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



Re: [PHP] Using eregi_replace()

2003-08-01 Thread Marek Kilimajer
And besides ereg_replace would not work becase it's greedy, .* would 
match going, than going would not be found and the whole match would 
fail.

messju mohr wrote:

you mean
$newtext= ereg_replace(.*?(hello.*going).*,\\1,$text);
??
i would suggest preg_replace in favour to ereg_replace:
$newtext= preg_replace(!.*?(hello.*going).*!,$1,$text);
it is more powerfull, faster and widely available.

greetings
messju


echo $newtext;
?
...
Thank you.
Tony Ritter


--
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] Simple Math Calculation Problem....

2003-08-01 Thread Curt Zirzow
* Thus wrote Scott Fletcher ([EMAIL PROTECTED]):
 The int() function is for C/C++ programming only.  This Int() function is
 not supported in PHP.  In PHP it would be Intval().  For float, Floatval().
 For double, DoubleVal().  Etc.   But beware of the Octual numbers.

You can cast like you can in C/C++

$Days = (int) $value;  // C compatible
$Days = (integer) $value;  // php method 

Curt
-- 
I used to think I was indecisive, but now I'm not so sure.

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



Re: [PHP] Simple Math Calculation Problem....

2003-08-01 Thread Curt Zirzow
* Thus wrote Scott Fletcher ([EMAIL PROTECTED]):
 Hi!
 
 I'm a little stuck with this simple math problem.  I'm trying to get a
 number of days in integer, not float.
 
 --snip--
$input_date = 12/16/2002;
$UserInput = explode(/, $input_date);
 
$UserInputMonth = $UserInput[0];
$UserInputDay = $UserInput[1];
$UserInputYear = $UserInput[2];
 
$clockDate = mktime(0,0,0,date(m),date(d),date(Y));
$inputDate = mktime(0,0,0,$UserInputMonth,$UserInputDay,$UserInputYear);

I think strtotime might be more efficient..


$clockDate = strtotime(date(m/d/Y)); 
$inputDate = strtotime(12/16/2002);

 
$Days = (($clockDate - $inputDate) / (24 * 3600));
You can cast it:
$Days = (integer)(($clockDate - $inputDate) / (24 * 3600));

//$Days = round(Days);
 --snip--

HTH,

Curt
-- 
I used to think I was indecisive, but now I'm not so sure.

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



Re: [PHP] Trouble getting $HTTP_RAW_POST_DATA

2003-08-01 Thread skate
 Since print_r is usually used for debugging, it would be nice that
 php does this for you.  Any comments on this before i throw the
 idea to the php-dev list?


if it's just used for debugging, can't you just use the pre tags around
it? i mean, it's no big deal, and you don't really need it formatted to look
pretty.

that's how i use it anyway...



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



Re: [PHP] Undefined variable problem

2003-08-01 Thread Curt Zirzow
* Thus wrote Ryan A ([EMAIL PROTECTED]):
 
 Notice: Undefined variable: email1 in c:\phpdev\www\bwh\project\compare.php
 on line 117
 [...]

$m = 1;
while ($line = mysql_fetch_assoc($rs)) { //dumping into an array
  foreach ($line as $field = $value) {
  $tmp = $field.$m;
 $$tmp.= $value;  /* This is the error line 117*** */

Your concating a variable that doesnt exist.


Curt
-- 
I used to think I was indecisive, but now I'm not so sure.

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



Re: [PHP] Using eregi_replace()

2003-08-01 Thread Anthony Ritter
Messju Mohr [EMAIL PROTECTED] writes:

 you mean
 $newtext= ereg_replace(.*?(hello.*going).*,\\1,$text);
 ??
..

Thank you but I get:

Warning: REG_BADRPT: in c:\apache\htdocs\string.php on line 3

Using:
.

?
$text=blah blah blah hello I must be going blah blah;
$newtext= eregi_replace(.*?(hello.*going).*,\\1,$text);
echo $newtext;
?


Regards,
TR




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



Re: [PHP] Search Engine

2003-08-01 Thread Curt Zirzow
* Thus wrote Jay Blanchard ([EMAIL PROTECTED]):
 
 Google for free search engine for web application.

I always find it hard to search for the term 'free'.  I'd like to
see the day when you can do this in google:

free search engine for web application -ignore_stupid_sites

cheers,

Curt
-- 
I used to think I was indecisive, but now I'm not so sure.

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



Re: [PHP] Using eregi_replace()

2003-08-01 Thread messju mohr
On Fri, Aug 01, 2003 at 03:13:53PM +, Curt Zirzow wrote:
 * Thus wrote messju mohr ([EMAIL PROTECTED]):
  On Fri, Aug 01, 2003 at 10:33:50AM -0400, Anthony Ritter wrote:
  
  i would suggest preg_replace in favour to ereg_replace:
  $newtext= preg_replace(!.*?(hello.*going).*!,$1,$text);
 
 Doesn't the $1 need to be escaped or in single quotes so php
 doesn't touch it.

sorry, i wanted to say '$1' and not $1.

 
  $newtext= preg_replace(!.*?(hello.*going).*!,\$1,$text);
  or 
  $newtext= preg_replace(!.*?(hello.*going).*!,'$1',$text);
 
 I cant test it at the moment.
 
 Thanks
 
  
  it is more powerfull, faster and widely available.
 
 I agree, I like now that PREC is now compiled by default.
 
 Curt
 -- 
 I used to think I was indecisive, but now I'm not so sure.
 
 -- 
 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] XmlRPC Extension in Apache 4.2.3

2003-08-01 Thread Marek Kilimajer
If I remember well this error is output even if the php_*.dll is found, 
but php fails to load it, possibly because of missing library/dll. Maybe 
xmlrpc.dll?

Donald Tyler wrote:

Hi Everyone,

I posted this on the PHP install list but didn't get a reply. I hope you
guys/gals can be more helpful.
I am having trouble getting the XmlRpc extension working with PnP 4.2.3.

SYSTEM:
Windows XP Pro
PHP 4.2.3 (Running as Apache module)
Apache 2.0.44
When Apache starts I get the following error:

Unknown(): Unable to load dynamic link library 'c:\program files\apache
group\php\extensions\php_xmlrpc.dll' - The specified module could not be
found.
The error.log after a clean start:

[Fri Jul 18 17:08:29 2003] [notice] Parent: Created child process 3420 PHP
Warning:  Unknown(): Unable to load dynamic library 'c:\program files\apache
group\php\extensions\php_xmlrpc.dll' - The specified module could not be
found.  in Unknown on line 0 [Fri Jul 18 17:08:32 2003] [notice] Child 3420:
Child process is running [Fri Jul 18 17:08:32 2003] [notice] Child 3420:
Acquired the start mutex. [Fri Jul 18 17:08:32 2003] [notice] Child 3420:
Starting 250 worker threads.
I know the dll exists in the correct location and the extension path is
specified correctly in the php.ini file because other extensions load fine.
Anyone have any suggestions?

Thanks.




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


Re: [PHP] Using eregi_replace()

2003-08-01 Thread messju mohr
On Fri, Aug 01, 2003 at 11:25:07AM -0400, Anthony Ritter wrote:
 Messju Mohr [EMAIL PROTECTED] writes:
 
  you mean
  $newtext= ereg_replace(.*?(hello.*going).*,\\1,$text);
  ??
 ..
 
 Thank you but I get:
 
 Warning: REG_BADRPT: in c:\apache\htdocs\string.php on line 3

grr, of course. ereg doesn't know .*?. you will have to use .*, but
this will match the most right hello not the most left one. as i
said: use preg_replace.

 Using:
 .
 
 ?
 $text=blah blah blah hello I must be going blah blah;
 $newtext= eregi_replace(.*?(hello.*going).*,\\1,$text);
 echo $newtext;
 ?
 
 
 Regards,
 TR
 
 
 
 
 -- 
 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] Trouble getting $HTTP_RAW_POST_DATA

2003-08-01 Thread Chris Shiflett
--- Curt Zirzow [EMAIL PROTECTED] wrote:
 Since print_r is usually used for debugging, it would be nice that
 php does this for you. Any comments on this before i throw the
 idea to the php-dev list?

As of 4.3.0, you can store the output of print_r() in a variable, so that
allows developers to do whatever they want. For example, you can apply
htmlentities() with something like the following:

echo 'pre' . htmlentities(print_r($_POST, 1)) . '/pre';

Hope that helps.

Chris

=
Become a better Web developer with the HTTP Developer's Handbook
http://httphandbook.org/

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



Re: [PHP] Using eregi_replace()

2003-08-01 Thread messju mohr
On Fri, Aug 01, 2003 at 05:13:05PM +0200, Marek Kilimajer wrote:
 And besides ereg_replace would not work becase it's greedy, .* would 
 match going, than going would not be found and the whole match would 
 fail.

nope, it would backtrace then. but the first .* ist greedy so it would
match the last hello, not the first one if there is more than one
hello in the string.

 
 messju mohr wrote:
 
 you mean
 $newtext= ereg_replace(.*?(hello.*going).*,\\1,$text);
 ??
 
 i would suggest preg_replace in favour to ereg_replace:
 $newtext= preg_replace(!.*?(hello.*going).*!,$1,$text);
 
 it is more powerfull, faster and widely available.
 
 greetings
 messju
 
 
 
 echo $newtext;
 ?
 ...
 
 Thank you.
 Tony Ritter
 
 
 
 
 -- 
 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



Re: [PHP] Using eregi_replace()

2003-08-01 Thread Anthony Ritter
However, this works using:
preg_replace()

.

?
$text=blah blah blah hello I must be going blah blah;
$newtext= preg_replace(!.*?(hello.*going).*!,$1,$text);
echo $newtext;
?

Thank you all.

Is there a way I can be sure of the syntax?

!.*?(hello.*going).*!,  // the pattern which - I think - reads as follows:

!.*? //
do not use any character or characters before the grouping of hello

(hello.*going) //
get the grouping of hello and any character after that word to going

.*! //
do not use any character or characters after the grouping of going - not
sure why the exclamation is at the end if it is a negation symbol.

Please advise.

Thank you.
TR


$1, // the grouping
$text // the original string







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



Re: [PHP] Trouble getting $HTTP_RAW_POST_DATA

2003-08-01 Thread Curt Zirzow
* Thus wrote skate ([EMAIL PROTECTED]):
  Since print_r is usually used for debugging, it would be nice that
  php does this for you.  Any comments on this before i throw the
  idea to the php-dev list?
 
 
 if it's just used for debugging, can't you just use the pre tags around
 it? i mean, it's no big deal, and you don't really need it formatted to look
 pretty.
 
 that's how i use it anyway...

True, but the pre tags dont stop the browser from rendering html
code. I dont have any problems wrapping pre around the print_r.

$var = img src=\/image.jpg\
print_r($var);

Yields an image not the actual string in $var.


Curt
-- 
I used to think I was indecisive, but now I'm not so sure.

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



Re: [PHP] Trouble getting $HTTP_RAW_POST_DATA

2003-08-01 Thread Curt Zirzow
* Thus wrote Chris Shiflett ([EMAIL PROTECTED]):
 --- Curt Zirzow [EMAIL PROTECTED] wrote:
  Since print_r is usually used for debugging, it would be nice that
  php does this for you. Any comments on this before i throw the
  idea to the php-dev list?
 
 As of 4.3.0, you can store the output of print_r() in a variable, so that
 allows developers to do whatever they want. For example, you can apply
 htmlentities() with something like the following:
 
 echo 'pre' . htmlentities(print_r($_POST, 1)) . '/pre';

hmmm.. that should work. I was kinda under the impression that
print_r returns an array with that second paramter passed.  

 
 Hope that helps.

Thanks


Curt
-- 
I used to think I was indecisive, but now I'm not so sure.

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



Re: [PHP] Using eregi_replace()

2003-08-01 Thread messju mohr
On Fri, Aug 01, 2003 at 11:36:29AM -0400, Anthony Ritter wrote:
 However, this works using:
 preg_replace()
 
 .
 
 ?
 $text=blah blah blah hello I must be going blah blah;
 $newtext= preg_replace(!.*?(hello.*going).*!,$1,$text);
 echo $newtext;
 ?
 
 Thank you all.
 
 Is there a way I can be sure of the syntax?
 
 !.*?(hello.*going).*!,  // the pattern which - I think - reads as follows:
 
 !.*? //
 do not use any character or characters before the grouping of hello
 
 (hello.*going) //
 get the grouping of hello and any character after that word to going
 
 .*! //
 do not use any character or characters after the grouping of going - not
 sure why the exclamation is at the end if it is a negation symbol.


nearly all that. but the ! are not part of the expression, they are
the delimiters that sourround the expression:

you could also use different delimiters and write for example:
'/.*?(hello.*going).*/' or '[.*?(hello.*going).*]' the regular
expression itself is merely .*?(hello.*going).* which matches the
whole string and replaces it by the first matching expression
sourrounded in by ()s (thats the '$1').

 
 Please advise.
 
 Thank you.
 TR
 
 $1, // the grouping
 $text // the original string
 
 
 
 
 
 
 
 -- 
 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] Using eregi_replace()

2003-08-01 Thread skate

 you could also use different delimiters and write for example:
 '/.*?(hello.*going).*/' or '[.*?(hello.*going).*]' the regular
 expression itself is merely .*?(hello.*going).* which matches the
 whole string and replaces it by the first matching expression
 sourrounded in by ()s (thats the '$1').



just a minor correction, i don't believe you could use
'[.*?(hello.*going).*]' as the delimiters have to be the same character.

the reason you use delimiters is so that you can use PREG modifiers after
the last delimiter, but still inside the expression. read up in the manual,
as the posibilities of PREG are enourmous...

-skate-



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



RE: [PHP] Please Help

2003-08-01 Thread Chris W. Parker
John Manko mailto:[EMAIL PROTECTED]
on Thursday, July 31, 2003 11:26 PM said:

 umm... ok.
 
 www.google.com
 www.php.net
 
 that should get you started.

It's always funny how people think these kinds of posts are helpful.


c.

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



RE: [PHP] Please Help

2003-08-01 Thread Jay Blanchard
[snip]
John Manko mailto:[EMAIL PROTECTED]
on Thursday, July 31, 2003 11:26 PM said:

 umm... ok.
 
 www.google.com
 www.php.net
 
 that should get you started.

It's always funny how people think these kinds of posts are helpful.
[/snip]

They're not?

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



RE: [PHP] Please Help

2003-08-01 Thread Chris W. Parker
Jay Blanchard mailto:[EMAIL PROTECTED]
on Friday, August 01, 2003 8:54 AM said:

 It's always funny how people think these kinds of posts are helpful.
 [/snip]
 
 They're not?

Yes, they are not.


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



Re: [PHP] Using eregi_replace()

2003-08-01 Thread messju mohr
On Fri, Aug 01, 2003 at 04:51:38PM +0100, skate wrote:
 
  you could also use different delimiters and write for example:
  '/.*?(hello.*going).*/' or '[.*?(hello.*going).*]' the regular
  expression itself is merely .*?(hello.*going).* which matches the
  whole string and replaces it by the first matching expression
  sourrounded in by ()s (thats the '$1').
 
 
 
 just a minor correction, i don't believe you could use
 '[.*?(hello.*going).*]' as the delimiters have to be the same character.


http://php.net/manual/en/ref.pcre.php :

... Since PHP 4.0.4, you can also use Perl-style (), {}, [],
and  matching delimiters. ...


 the reason you use delimiters is so that you can use PREG modifiers after
 the last delimiter, but still inside the expression. read up in the manual,
 as the posibilities of PREG are enourmous...

full ACK :)
 
 -skate-

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



RE: [PHP] Please Help

2003-08-01 Thread Jay Blanchard
[snip]
 It's always funny how people think these kinds of posts are helpful.
 [/snip]
 
 They're not?

Yes, they are not.
[/snip]

Hmmm, let's see. The post had no clarity in the subject line, the post
showed no sense of I tried to look it up, the post was vague, shall I
go on? Folks on the list act as if they are entitled to the help that
the receive here. Sheesh.

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



RE: [PHP] Please Help

2003-08-01 Thread Chris W. Parker
Jay Blanchard mailto:[EMAIL PROTECTED]
on Friday, August 01, 2003 9:02 AM said:

 Hmmm, let's see. The post had no clarity in the subject line, the post
 showed no sense of I tried to look it up, the post was vague

You have three options:

1. Explain to them how they could have made their post better. Maybe
point them to one of the how to be a good netizen articles and not try
to answer their question(s).

2. Do your best with answering their question. (Telling them to RTFM
does not count as your best.)

(Joseph Blythe made a perfect example of this one in his post to this
thread. His was much more helpful and useful to the original poster (I'd
imagine) than John.)

3. Say RTFM! RTFM!!

Answer these two questions:

1. Which do you think is most helpful and benefits the list the most?
2. Which makes you feel better?

The answer to question 1 is point 2 above. The answer to question 2 is
point 3 above. When the list is concerned it's better to benefit
everyone than to make yourself feel better.

 , shall
 I go on?

Nahh...

 Folks on the list act as if they are entitled to the help
 that the receive here. Sheesh.

I agree with that statement. But the best way to make them not feel that
way is by not replying at all.


Shall I go on? Sheesh.


Chris.

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



Re: [PHP] Purging old files from directories

2003-08-01 Thread Curt Zirzow
* Thus wrote Verdon vaillancourt ([EMAIL PROTECTED]):
 Hi :)
 
 I need to write a script that will scan/read a given directory's contents
 and delete files older than a certain date. Ideally, this will be a script
 that runs via cron once a week and deletes all files it finds in the
 directory older than 2 weeks from the current date. I do currently have
 scripts running via cron and that's no problem. I'm not sure where to begin
 with the other components

hm.. there are tools aleady available that do this on unix.

find /path/to/files/ -type f -mtime '+14' -exec rm {} \;

 
 I'm not looking to be spoon-fed, but I was hoping that someone could point
 me in the right direction to start researching.

If you still desire to write a php script:
  php.net/dir  - for directory reading stuff
  php.net/stat - gets the stats on files.


HTH,

Curt
-- 
I used to think I was indecisive, but now I'm not so sure.

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



RE: [PHP] Please Help

2003-08-01 Thread Jay Blanchard
[snip]
1. Which do you think is most helpful and benefits the list the most?
[/snip]

Give a man a program, frustrate him for a day, teach a man to program,
frustrate him for a lifetime. IOW send a person to start learning. The
question was so vague that the answers given were appropriate.

[snip]
2. Which makes you feel better?

The answer to question 1 is point 2 above. The answer to question 2 is
point 3 above. When the list is concerned it's better to benefit
everyone than to make yourself feel better.
[/snip]

Must.stopflame.

[snip]
I agree with that statement. But the best way to make them not feel that
way is by not replying at all.
[/snip]

Why? So they will re-post and re-post until someone really does tell
them where to stick it? The reply didn't even say RTFM, STFW, or STFA,
it was clear and concise, and downright nice.

[snip]
Shall I go on? Sheesh.
[/snip]

Sigh.

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



RE: [PHP] Please Help

2003-08-01 Thread Chris W. Parker
Jay Blanchard mailto:[EMAIL PROTECTED]
on Friday, August 01, 2003 9:24 AM said:

 Sigh.

What happened to the two *'s?


I'm going to take this opportunity to be the bigger man and say I
respect your opinion. ;)


Chris.

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



  1   2   >