[PHP] auto converting a $string to ALL Upper Case.

2004-09-16 Thread Louie Miranda
Is there a PHP syntax that can convert a $string result to all UPPER CASE?

-- 
Louie Miranda
http://www.axishift.com

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



Re: [PHP] Coding Blues - Parse Error

2004-09-16 Thread Oliver Kurz
Hello Yusuf,

 ?
 Class fl_SQL
 {
  var $server;
  var $user;
  var $pass;
 
  var $connection;
  var $db;
 
  var $query;
  var $record;
  var $tlist;
  }

The bracket is wrong. Your class only has properties but no methods. 
 
 Function fl_SQL($server, $user, $pass, $db = NULL) {
  $this-server = $server;
  $this-user = $user;
  $this-pass = $pass;
  $this-db = $db;
 }
 
 Function doconnect($db = $this-db){
  $this-db = $db

Missing ;

  $this-connection = mysql_connect($this-server, $this-user, 
 $this-pass);
  if (!$this-connect) die (Could not connect to server!);

$this-connect??? Do you mean $this-connection?

  mysql_select_db($this-db,$this-connection) or die (Could not 
 connect to database!);
 }
 
 Function doquery($query, $db = $this-db){
  $this-db = $db

Missing ;
  $this-connect($this-db);

Do you mean $this-doconnect?

  $this-query = $query
  mysql_query($this-query,$this-connect)

And again: Do you mean $this-connection?

 }
 
 }

Their is the right bracket for the class definition.
 
 ?

Also your default-values for the method-parameters have to be constant. So ... try it 
like in your constructor. And check it with an if-statement. 
And also ... check the names of your properties and methods. It looks like there is a 
big mess.

So long,

Oliver


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

Re: [PHP] auto converting a $string to ALL Upper Case.

2004-09-16 Thread - Edwin -
On Thursday 16 September 2004 15:36, Louie Miranda wrote:
 Is there a PHP syntax that can convert a $string result to
 all UPPER CASE?

  php.net - manual - strings - strtoupper ?

-- 

- E -

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



[PHP] download pdf using php script

2004-09-16 Thread adwinwijaya
Hello PHP Users,

I have files (that protected from direct download) and I put it
outside public_html/ directory (outside web server directory).

and the people from outside could access the file by typing:
www.myweb.com/download.php?filename=xzy.pdf

can someone give me hint how to do this ?

thank u



-- 
Best regards,
adwin
www.kuya-kuya.net

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



[PHP] problem compailing php-4.3.6 please help !!!!! CAn someone PLEA SE HELP !!!!

2004-09-16 Thread Juan Fernandez


Hi, 

  

I am installing php-4.3.6 on Fedora, 

  

When I am compiling I receive the following error : 

  

[EMAIL PROTECTED] php-4.3.6]# make install 

Installing PHP SAPI module:   apache2handler 

/www/build/instdso.sh SH_LIBTOOL='/www/build/libtool' libphp4.la 
/www/modules 

/www/build/libtool --mode=install cp libphp4.la /www/modules/ 

cp .libs/libphp4.lai /www/modules/libphp4.la 

cp .libs/libphp4.a /www/modules/libphp4.a 

ranlib /www/modules/libphp4.a 

chmod 644 /www/modules/libphp4.a 

libtool: install: warning: remember to run `libtool --finish 
/root/snortinstall/php-4.3.6/libs' 

Warning!  dlname not found in /www/modules/libphp4.la. 

Assuming installing a .so rather than a libtool archive. 

chmod 755 /www/modules/libphp4.so 

chmod: failed to get attributes of `/www/modules/libphp4.so': No such file 
or directory 

apxs:Error: Command failed with rc=65536 

. 

make: *** [install-sapi] Error 1 

  

  

what can I do ? 

  

Thanks !!! 

-- 
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] find null character in php

2004-09-16 Thread T UmaShankari
Hello,
 I am having one string variable which has the value fetched from the
mysql table. Is it possible to find '\0' character in that string ?
Regards,
Uma
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Splitting 12345 - 1,2,3,4,5

2004-09-16 Thread Martin Holm
Michael Mao wrote:
Thanks John.
Found what I'm looking for:
Function str_split()
to make it php4 compatible you can use this function:
|?php
if (!function_exists('str_split')) {
  function str_split ($str, $size = 1) {
 $arr = array();
 for ($i = 0 ; $i  strlen($str) ; $i += $size) {
$arr[] = substr($str,$i,$size);
 }
 return $arr;
  }
}
?
works in about the same way as the function in php5.
|
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] problems with different results on count() and select

2004-09-16 Thread Merlin
Hi there,
I am having difficulties to order user into a ranking table. In the listing of 
the users I use a select statement, where I order after points and registration 
date. Then I print out thre results counting the rows. 1,2,3...

SELECT
u.user_name,
FROM
usertable
ORDER BY
points desc, registration_date desc
on another page the user can access his user rank directly. Here I am using a 
count statement where I count all users who have more points than the member and 
have registered earlier (to avoid results with members having the same points)

SELECT count(*) AS c
FROM
usertable
WHERE
points  '$points'
AND registration_date  '$date'
Theoreticly the result number of the first select statement should be identical 
with the count statement, but it is not.

Has anybody an idea how to fix that?
Thanx in advance,
Merlin
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Re: mysql_connect does not connect

2004-09-16 Thread Jason Wong
On Thursday 16 September 2004 10:53, Sam Hobbs wrote:
 Jason Wong [EMAIL PROTECTED] wrote in message
 news:[EMAIL PROTECTED]

  So now are you fully convinced it's your firewall that's the root of your
  problem?

 No, not really. At the moment I am assuming it is a bug in something
 somewhere. The versions of php and MySQL that I am using are not fully
 tested. Therefore it is entirely possible that the problem I had is not
 supposed to be a problem.

sigh Whether it is bug or not, whether it is supposed to be a problem or 
not, the fact is that the firewall was interfering with your ability to 
connect to mysql.

  1) How are you connecting using mysql_connect()? Do you use IP addresses
  or
  hostnames?
  2) What are your exact connection parameters when connecting as an admin
  user?
  3) What are your exact connection parameters when connecting as an
  normal user?

 I am not sure how to determine these things, except to say that I am using
 MySQL as it was installed by the Typical installation option.

I'm not familiar with MySQL under Windows, but I believe that there are 
different installers available from various sources. So saying Typical 
installation option doesn't really mean much.

 Oh, now I understand better. Sorry. The username admin confused me, but I
 should have known.

I didn't say the username admin, I said the admin user.

 There is a slight chance I used a different host than localhost. 

[quote from another Sam HObbs post]
 However I also believe in being methodical and in verifying assumptions. It
 does help to eliminate possilities.
[end quote]

I would've thought that being methodical implied meticulous noting of cause 
and effect.

Using anything other than localhost/127.0.0.1 would almost certainly make you 
hit the firewall.

Note also that for troubleshooting it's probably better to use 127.0.0.1 
rather than localhost. The latter is subject to your system's dns resolution 
mechanism and also to the mysql client library's interpretation.

 Other than that, I used the following
 for both my Administrator and my non-Administrator accounts:

 ?php
 $location = localhost;
 $username = root;
 $password = ;
 $database = mysql;
 $conn = mysql_connect($location, $username, $password);
 if (!$conn) die (pCould not connect to MySQL using $location, $username,
 $password/p\n);
[...]

I would suggest that you use the above code to do the following combination of 
tests:

1) With ZoneAlarm enabled and with it disabled (yes disabled completely, if 
you're worried disconnect from the internet and any other networks)

2) With $location='localhost' and $location='127.0.0.1'

3) With $username='root' and $username='somenormaluser'

That's a total of 12 tests if you're following.

If when you have ZoneAlarm enabled and you can connect with one user and not 
with another (I believe you came across this is a previous post) then show us 
following:

The following should be performed on the 'mysql' database (ie the system 
database which holds all the user related info):


select * from user where User='user_that_can_connect';
select * from db where User='user_that_can_connect';

select * from user where User='user_that_cannot_connect';
select * from db where User='user_that_cannot_connect';

-- 
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
--
/*
Disc space -- the final frontier!
*/

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



Re: [PHP] fopen problem, 5 line script

2004-09-16 Thread Chris Dowell
Irrelevant, Warren
Mag,
the point is that you're trying to use a function (filesize) that uses 
the stat() system call. This function is not supported using the http 
wrapper to fopen (because HTTP doesn't support it at all)

So regardless of whether you should be using the file name or the handle 
(it's the name, btw), the call will fail because you're trying to stat() 
a file which isn't supported.

Thus filesize() is failing (with a warning), and fread() is then failing 
because filesize() returns false, which evaluates to 0.

Hope this has made things clearer, if not, a quick check of the manual 
entries for stat, filesize and Appendix L 
(http://uk.php.net/manual/en/wrappers.php) may help

Cheers
chris
Vail, Warren wrote:
I thought filesize required the file name, and not the fileptr???
Warren Vail
-Original Message-
From: Curt Zirzow [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, September 15, 2004 10:17 AM
To: php php
Subject: Re: [PHP] fopen problem, 5 line script

* Thus wrote Mag:
 

Hi,
Can someone tell me what I am doing wrong here please?
?php
$fileptr =
fopen(http://www.google.com/index.html,r;);
$contents = fread($fileptr, filesize($fileptr));
...
This is the error I get:
Warning: filesize(): Stat failed for Resource id #1
(errno=2 - No such file or directory) in 
/home/quickxxx/public_html/tpg/ check- remote.php on line 4

Warning: fread(): Length parameter must be greater
than 0. in /
home/quickxxx/public_html/tpg/check-remote.php on line
   

filesize() relies on the fact that the file you opened has support for
stat(). the http wrapper does not have such a thing.
see:
 http://php.net/filesize
 http://php.net/wrappers.http
Curt
 

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


Re: [PHP] File Download Problems

2004-09-16 Thread Chris Dowell
Chances are your 1KB file contains an error message - try changing the 
Content-Type to text/plain or text/html to see what PHP is throwing at you

Cheers
Chris
Marek Kilimajer wrote:
PHP Junkie wrote:
Ave,
I've been having a very nagging and frustrating problem for a while 
and I
hope someone can help me out with this.

I created a simple File Manager application, a lot of you already 
know about
it as you helped me with coding at different stages.

The problem is this: The Download.
When you download a file, it's giving problems sometimes. What is 
happening
is, a 1 KB file downloads instead of the actual file. And thus the file
downloaded is no good. The file uploaded is absolutely perfect. Since 
I have
the web server which contains this website, I'm easily able to check all
these things. When a user uploads a file, it's uploaded absolutely 
perfect.
It's not a 1 KB file.. The whole file is uploaded and it's not 
corrupt. But
when a user downloads the file... Most of the time a 1 KB file is
downloaded.. And its' corrupt of course.

The more frustrating part is, it happens sometimes.. Not everytime. 
It is
happening 90% of the time.. But sometimes it is able to download the 
actual
file. If you try the same file from different locations, 15 times... 
1 out
of 15 times the file will download fine.

I've been doing all sorts of testing to narrow down the problem but I 
don't
know the problem.
This is my download script :

?php
$file = $P/$F;
header(Content-Description: File Transfer);
header(Content-Type: application/force-download);
header(Content-Disposition: attachment; filename=.basename($file));
@readfile($file);
?
Which is called using this link on the main page:
a 
href=\imsafm_user_dl.php?ID=$myrow[ID]P=imsafm/$userF=$myrow[filename]\ 

img src=b_newtbl.png border=0/a
What does the 1 KB file contain? Is it the beginning of the wanted 
file? Remove @ while debuging.
Add header('Content-Lenght: ' . filesize($file));
Check server logs.

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


Re: [PHP] mysql_connect does not connect

2004-09-16 Thread Jason Wong
On Thursday 16 September 2004 11:06, Sam Hobbs wrote:

 It is my understanding that the firewall is not supposed to be relevant. I
 have not seen anything saying it is supposed to be. If it is true that it
 is not supposed to be relevant, then simply saying it is just causes
 confusion. If you had said that the firewall is not supposed to be
 relevant, but try disabling it anyway, then I would say that I am totally
 able to think like that too. It is reasonable to try things like that to
 diagnose a bug.

The firewall is relevant depending on your circumstances. In any case it would 
take you all of one minute to disable your firewall to test out this wild 
far out suggestion. At the most you would have lost one minute but you would 
have either:

- gained the satisfaction of saying I told you the firewall was irrelevant, 
now go away and stop wasting my time with your ridiculous suggestions

 or

- you would have found the cause of your problem

Contrast that with the number of posts you have made denying that the firewall 
could be a problem, and stating adamantly that you will not do such-and-such 
a thing because it is 'not supposed' to happen like that.

-- 
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
--
/*
Did it ever occur to you that fat chance and slim chance mean the same thing?

Or that we drive on parkways and park on driveways?
*/

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



Re: [PHP] Re: mysql_connect does not connect

2004-09-16 Thread Jason Wong
On Thursday 16 September 2004 11:51, raditha dissanayake wrote:

 me thinks it's time to look very closely at http://www.postgresql.org
 Not just you sam, all of us.

If everyone subscribes to your reasoning then nobody would be using Windows 
(yay!).

Anyway FWIW I found postgresql's system of granting users access is way more 
complicated to get to grips to than mysql's.

-- 
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
--
/*
Pay no attention to the man behind the curtain.
-- The Wizard Of Oz
*/

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



[PHP] Re: problems with different results on count() and select

2004-09-16 Thread Thomas Seifert
On Thu, 16 Sep 2004 10:43:46 +0200, Merlin wrote:

 Theoreticly the result number of the first select statement should be identical 
 with the count statement, but it is not.
 
 Has anybody an idea how to fix that?
 

It can't be the same number as you are using a where clause in the second
statement so you are missing some rows there.
also your code for ordering in the first part might just be wrong, but you
didn't show this code.


thomas

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



Re: [PHP] Re: mysql_connect does not connect

2004-09-16 Thread raditha dissanayake
Jason Wong wrote:
On Thursday 16 September 2004 11:51, raditha dissanayake wrote:
 

me thinks it's time to look very closely at http://www.postgresql.org
Not just you sam, all of us.
   

If everyone subscribes to your reasoning then nobody would be using Windows 
(yay!).
 

I am a recent convert to postgres so bear with me. last year my religion 
was pretty much mysql.

Anyway FWIW I found postgresql's system of granting users access is way more 
complicated to get to grips to than mysql's.

 


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


[PHP] disabling php info in http headers

2004-09-16 Thread Merlin
Hi there,
I am wondering how to disable the php info inside the response header info.
This might be possible since this info is not for other people. Hackers might 
find all versions to searching for security weaknes.

Here is an example:
X-Powered-By: PHP/4.3.5
X-Accelerated-By: PHPA/1.3.3r2
Thank you for any hint on that,
Merlin
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: problems with different results on count() and select

2004-09-16 Thread Merlin
Thomas Seifert wrote:
On Thu, 16 Sep 2004 10:43:46 +0200, Merlin wrote:

Theoreticly the result number of the first select statement should be identical 
with the count statement, but it is not.

Has anybody an idea how to fix that?

It can't be the same number as you are using a where clause in the second
statement so you are missing some rows there.
also your code for ordering in the first part might just be wrong, but you
didn't show this code.
thomas
Hi,
the where clause is a replacement for the order by clause in the first 
statement. Inside this first select statement I am showing 20 results on each 
page with the limit command as shown here:

SELECT
u.user_name,
FROM
usertable
ORDER BY
points desc, registration_date desc
Limit 20, 40
This should show the members ranked 20 - 40
On the other page I would just like to know which user rank this person has:
But it is never the same as on the other page
SELECT count(*) AS c
FROM
usertable
WHERE
points  '$points'
AND registration_date  '$date'
Any ideas?
Merlin
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: download pdf using php script

2004-09-16 Thread David Robley
On Thu, 16 Sep 2004 16:21, Adwinwijaya wrote:

 Hello PHP Users,
 
 I have files (that protected from direct download) and I put it
 outside public_html/ directory (outside web server directory).
 
 and the people from outside could access the file by typing:
 www.myweb.com/download.php?filename=xzy.pdf
 
 can someone give me hint how to do this ?
 
 thank u

readfile with suitable headers

-- 
David Robley

He who dies with the most toys... is *still* DEAD!

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



Re: [PHP] mysql_connect does not connect

2004-09-16 Thread Markus Mayer
On Thursday 16 September 2004 05:06, Sam Hobbs wrote:
 It is my understanding that the firewall is not supposed to be relevant. I

It is our experience at my employer that the firewall in XP-SP2, as well as 
other firewalls that are available, are very relevant.

 have not seen anything saying it is supposed to be. 

We also have not seen any documentation about problems with such things 
after installing SP2, but we have problems.  Things that worked before don't 
work any more, especially client side things.  Our three small Windoze 
servers have given our Windoze administrator more than enough work recently.

 If it is true that it 
 is not supposed to be relevant, then simply saying it is just causes
 confusion. If you had said that the firewall is not supposed to be
 relevant, but try disabling it anyway, then I would say that I am totally
 able to think like that too. It is reasonable to try things like that to
 diagnose a bug.

flame blocked by firewall.

 If you can find something in the MySQL documentation saying that the
 firewall needs to be disabled eventhough the server and client are the same
 system, then that would sure help. I am not asking you to; I am saying that
 that is what would help.

SP2 is so new that its effects are still being evaluated by a lot of people.  
At the moment, I think the best place to get information about its effects is 
forums like this one.  Formal documentation will be updated in time as more 
experience is gained.  The info I got from our Windows admin is that with 
SP2, the MS SQL server on one machine was apparenty unaffected, but the MySQL 
on another was.  Dropping the MS Firewall in SP2 allowed connections again.

Client side, SP2 has caused nothing but problems for us to the point where we 
as administrators are now saying to our users it was working before you 
installed SP2, and after you installed SP2 it stopped working, so it's your 
problem.  IE is especially problematic, and when someone calls up and says 
they have a problem with IE and have installed SP2, our response is that we 
no longer support IE and tell the users to install Mozilla, and if they still 
have problems when they try Mozilla, they can call us back.  We haven't heard 
from any of them again, and our help desk girls have always been able to 
quickly sort out the problems users have when they first try Mozilla.

I looked back in this thread and saw that you used Zone Alarm as a firewall.  
You need to allow MySQL connections to localhost, and that regardless of 
which firewall you use.  If you filter such connections out, PHP scripts will 
not be able to connect to your MySQL server.  This is because PHP makes a TCP 
connection to the MySQL server, also when it is running on the same machine 
as you PHP/Apache (at least this is my understanding).  You can of course 
continue refuse all external (that is not from localhost) connections to 
whatever service is running on your machine.  I think something to this 
effect has already been said in this thread, but at the moment I don't want 
to search for the post.

While the flame war in this thread has been amusing to read, it's amusement 
value for me has more or less run out.  My impression is that you still don't 
have the thing working, and the only solution left is to configure your 
firewall to allow connections to your MySQL server from localhost.  If you 
would do this, and it works, please post to the list to reflect this.  My 
experience as an administrator tells me with a 99% certainty that this is 
your problem.

regards
Markus

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



[PHP] Re: disabling php info in http headers

2004-09-16 Thread David Robley
On Thu, 16 Sep 2004 18:45, Merlin wrote:

 Hi there,
 
 I am wondering how to disable the php info inside the response header
 info. This might be possible since this info is not for other people.
 Hackers might find all versions to searching for security weaknes.
 
 Here is an example:
 X-Powered-By: PHP/4.3.5
 X-Accelerated-By: PHPA/1.3.3r2
 
 Thank you for any hint on that,
 
 Merlin

php.ini - expose_php

-- 
David Robley

Stand on the toilet, get high on pot.

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



Re: [PHP] mysql_connect does not connect

2004-09-16 Thread Chris Dowell
All this is irrelevant; while you're still trying to use MySQL 5 with 
mysql_connect() instead of mysqli_connect(), it WILL NEVER WORK

Sort that out first before you start worrying about firewalls - you 
can't test the firewall if you can't ever have a successful test case.

Cheers
Chris
Markus Mayer wrote:
On Thursday 16 September 2004 05:06, Sam Hobbs wrote:
 

It is my understanding that the firewall is not supposed to be relevant. I
   

It is our experience at my employer that the firewall in XP-SP2, as well as 
other firewalls that are available, are very relevant.

 

have not seen anything saying it is supposed to be. 
   

We also have not seen any documentation about problems with such things 
after installing SP2, but we have problems.  Things that worked before don't 
work any more, especially client side things.  Our three small Windoze 
servers have given our Windoze administrator more than enough work recently.

 

If it is true that it 
is not supposed to be relevant, then simply saying it is just causes
confusion. If you had said that the firewall is not supposed to be
relevant, but try disabling it anyway, then I would say that I am totally
able to think like that too. It is reasonable to try things like that to
diagnose a bug.
   

flame blocked by firewall.
 

If you can find something in the MySQL documentation saying that the
firewall needs to be disabled eventhough the server and client are the same
system, then that would sure help. I am not asking you to; I am saying that
that is what would help.
   

SP2 is so new that its effects are still being evaluated by a lot of people.  
At the moment, I think the best place to get information about its effects is 
forums like this one.  Formal documentation will be updated in time as more 
experience is gained.  The info I got from our Windows admin is that with 
SP2, the MS SQL server on one machine was apparenty unaffected, but the MySQL 
on another was.  Dropping the MS Firewall in SP2 allowed connections again.

Client side, SP2 has caused nothing but problems for us to the point where we 
as administrators are now saying to our users it was working before you 
installed SP2, and after you installed SP2 it stopped working, so it's your 
problem.  IE is especially problematic, and when someone calls up and says 
they have a problem with IE and have installed SP2, our response is that we 
no longer support IE and tell the users to install Mozilla, and if they still 
have problems when they try Mozilla, they can call us back.  We haven't heard 
from any of them again, and our help desk girls have always been able to 
quickly sort out the problems users have when they first try Mozilla.

I looked back in this thread and saw that you used Zone Alarm as a firewall.  
You need to allow MySQL connections to localhost, and that regardless of 
which firewall you use.  If you filter such connections out, PHP scripts will 
not be able to connect to your MySQL server.  This is because PHP makes a TCP 
connection to the MySQL server, also when it is running on the same machine 
as you PHP/Apache (at least this is my understanding).  You can of course 
continue refuse all external (that is not from localhost) connections to 
whatever service is running on your machine.  I think something to this 
effect has already been said in this thread, but at the moment I don't want 
to search for the post.

While the flame war in this thread has been amusing to read, it's amusement 
value for me has more or less run out.  My impression is that you still don't 
have the thing working, and the only solution left is to configure your 
firewall to allow connections to your MySQL server from localhost.  If you 
would do this, and it works, please post to the list to reflect this.  My 
experience as an administrator tells me with a 99% certainty that this is 
your problem.

regards
Markus
 

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


[PHP] split behaviour differences in perl and php

2004-09-16 Thread Sandip Bhattacharya
This stumped me badly in my present  project. Is this a bug or a feature in
PHP? I am trying to split a string into two, where only one half (and the
delimiter) is present.


IN  PERL
==
[EMAIL PROTECTED] ~]$ cat s1.pl
@t = split(/,/ , a,b);
$len = $#t + 1;
print $len\n;
@t = split(/,/, a,);
$len = $#t + 1;
print $len\n;

[EMAIL PROTECTED] sql]$ perl s1.pl
2
1


IN PHP
===

[EMAIL PROTECTED] ~]$ cat s1.php
?php
 print count(split(',', 'a,b')).\n;
 print count(split(',', 'a,')).\n;
?

[EMAIL PROTECTED] sql]$ php -q s1.php
2
2



-- 
Sandip Bhattacharya*Puroga Technologies   * [EMAIL PROTECTED]
Work: http://www.puroga.com* Home: http://www.sandipb.net

PGP/GPG Signature: 51A4 6C57 4BC6 8C82 6A65 AE78 B1A1 2280 A129 0FF3

BLISS is ignorance.

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



Re: [PHP] split behaviour differences in perl and php

2004-09-16 Thread Burhan Khalid
Sandip Bhattacharya wrote:
This stumped me badly in my present  project. Is this a bug or a feature in
PHP? I am trying to split a string into two, where only one half (and the
delimiter) is present.
[ trim ]
IN PHP
===
[EMAIL PROTECTED] ~]$ cat s1.php
?php
 print count(split(',', 'a,b')).\n;
 print count(split(',', 'a,')).\n;
?
[EMAIL PROTECTED] sql]$ php -q s1.php
2
2
If your expand your example slightly, as I did, you will see why you are 
 getting the expected results:

[EMAIL PROTECTED] burhan $ cat s1.php
?php
 $results = split(',', 'a,b');
 print_r($results);
 print count($results).\n;
 $results = split(',','a,');
 print_r($results);
 print count($results).\n;
?
[EMAIL PROTECTED] burhan $ php -q s1.php
Array
(
[0] = a
[1] = b
)
2
Array
(
[0] = a
[1] =
)
2
As you can see, the array contains an empty second element because 
(correctly) there isn't a second element after the last ,.

So, is this a bug? Not from my point of view. Its more bad input, 
expected result :)

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


[PHP] Re: iguanahost - anyone else being plagued?

2004-09-16 Thread Daniel Schierbeck
Nick Wilson wrote:
Anyone else getting these infuriating italian messages about some muppet
that doesnt exist?
'desintione non existente'?
I've written to [EMAIL PROTECTED] but no joy, everytime i post on the
php list i get half a dozen of the damn things...
Yup, guess some Italian 1337 h4x0r has some shit going on...
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] mysql_connect does not connect

2004-09-16 Thread Jason Wong
On Thursday 16 September 2004 17:52, Chris Dowell wrote:
 All this is irrelevant; while you're still trying to use MySQL 5 with
 mysql_connect() instead of mysqli_connect(), it WILL NEVER WORK

 Sort that out first before you start worrying about firewalls - you
 can't test the firewall if you can't ever have a successful test case.

IIRC the OP did have a successful test case when connecting from the mysql 
client.

-- 
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 need tender loving care once a week - so that I can slap you into shape.
- Ellyn Mustard
*/

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



Re: [PHP] How I can create....

2004-09-16 Thread Yusdaniel Rodriguez Espinosa
Hello Jason

Thanks I understand now, but tell me someting, PHP don't have any function
that create a button???
When I want to clean a DB I have to call another page always

tell me you don't have any code for example that do the same thing that I
want to do???

Thanks again

Yusda

---

Hola Jason

Gracias ahora yo entiendo porque no trabajaba, pero dime una cosa, PHP no
tiene ninguna funcion que cree un botton???
Cuando yo quiero borrar una DB Yo tengo que llamar otra pagina
obligatoriamente???

Dime tu no tienes ningun codigo de ejemplo donde yo pueda ver como se hace
esto que quiero hacer?

Gracias de nuevo

Yusda

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



Re: [PHP] Re: problems with different results on count() and select

2004-09-16 Thread Jason Wong
On Thursday 16 September 2004 17:19, Merlin wrote:

 the where clause is a replacement for the order by clause in the first
 statement. Inside this first select statement I am showing 20 results on
 each page with the limit command as shown here:

 SELECT
  u.user_name,
 FROM
  usertable
 ORDER BY
  points desc, registration_date desc
 Limit 20, 40

 This should show the members ranked 20 - 40

 On the other page I would just like to know which user rank this person
 has: But it is never the same as on the other page

 SELECT count(*) AS c
 FROM
  usertable
 WHERE
  points  '$points'
  AND registration_date  '$date'

If you are sure your queries are correct then please take this off the php 
list. Ask on YOUR DATABASE's mailing list.

-- 
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
--
/*
VMS is like a nightmare about RXS-11M.
*/

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



Re: [PHP] MySQL to OO

2004-09-16 Thread Neo Theone
John Holmes wrote:
From: Neo Theone [EMAIL PROTECTED]
I am searching for a MySQl to Object abstraction class.
I am thinking something like WebObjects does in Java (it is just a 
part) in PHP. I had one for Ruby but now I have to use a DB in MySQL 
and such a class would make it alot easier.

Are you talking about accessing MySQL using an OO interface or receiving 
results/schema/etc in an OO format?
I am looking for a absolute transparent interface to access each field a 
s a object.

So if i would have a table like this:
tablename: namedtable
--
| id | foo | bar |
--
| 01 | aaa | uuu |
--
| 02 | bbb | mmm |
--
I could access it like this:
namedtable-return() would give me the whole table
namedtable-id(all) would give me [01, 02]
namedtable-id(01) would give me [foo=aaa, bar=uuu]
something like this
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] MySQL to OO

2004-09-16 Thread John Holmes
From: Neo Theone [EMAIL PROTECTED]
I am searching for a MySQl to Object abstraction class.
I am thinking something like WebObjects does in Java (it is just a part) 
in PHP. I had one for Ruby but now I have to use a DB in MySQL and such 
a class would make it alot easier.

Are you talking about accessing MySQL using an OO interface or receiving 
results/schema/etc in an OO format?
I am looking for a absolute transparent interface to access each field a s 
a object.
[snip]
I could access it like this:
namedtable-return() would give me the whole table
namedtable-id(all) would give me [01, 02]
namedtable-id(01) would give me [foo=aaa, bar=uuu]
PEAR or ADOdb (along with other abstraction layers, I'm sure) will create an 
interface like that for you for a RESULT SET, i.e. the result of  a query. 
It'd be pretty wasteful to interact with an entire table that way (although 
you could just do select * from table to simulate it, I guess).

Search google for the PEAR::DB and ADOdb manual pages and look into it.
---John Holmes... 

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


Re: [PHP] File Download Problems

2004-09-16 Thread PHP Junkie

Ave,

I made a change last evening, and since the change.. It seems to be working
fine. Thus far I haven't had the 1 KB downloaded file problem. I have been
trying all evening and this morning, from different places, and somehow
right now it seems to be working fine.

What I simply did was this:

Instead of 

a 
href=\imsafm_user_dl.php?ID=$myrow[ID]P=imsafm/$userF=$myrow[filename]\
img src=b_newtbl.png border=0/a

As my link to the download file, I changed it to

a href=\imsafm_user_dl.php?F=imsafm/$user/$myrow[filename]\img
src=b_newtbl.png border=0/a

And changed the code in the download file to

?php
header(Content-Description: File Transfer);
header(Content-Type: application/force-download);
header(Content-Disposition: attachment; filename=.basename($F));
@readfile($F);
? 

I didn¹t need to send the ID var to the download file, and I condensed the
number of Variables I was passing.

Somehow this seems to be working for me. I was just trying this out to one
by one eliminate possibilities. And it works.Since I made this change, the
actual file is being downloaded and not the 1 KB file.
I don¹t really know why though. I understand I didn¹t need to divide the
path into 2 variables. But what if I really needed to send the ID variable?
I don¹t exactly understand how this setup of Variables affected the file
being downloaded.

Thanks anyways.







On 9/15/04 5:35 PM, Marek Kilimajer [EMAIL PROTECTED] wrote:

 PHP Junkie wrote:
 Ave,
 
 I've been having a very nagging and frustrating problem for a while and I
 hope someone can help me out with this.
 
 I created a simple File Manager application, a lot of you already know about
 it as you helped me with coding at different stages.
 
 The problem is this: The Download.
 When you download a file, it's giving problems sometimes. What is happening
 is, a 1 KB file downloads instead of the actual file. And thus the file
 downloaded is no good. The file uploaded is absolutely perfect. Since I have
 the web server which contains this website, I'm easily able to check all
 these things. When a user uploads a file, it's uploaded absolutely perfect.
 It's not a 1 KB file.. The whole file is uploaded and it's not corrupt. But
 when a user downloads the file... Most of the time a 1 KB file is
 downloaded.. And its' corrupt of course.
 
 The more frustrating part is, it happens sometimes.. Not everytime. It is
 happening 90% of the time.. But sometimes it is able to download the actual
 file. If you try the same file from different locations, 15 times... 1 out
 of 15 times the file will download fine.
 
 I've been doing all sorts of testing to narrow down the problem but I don't
 know the problem.
 
 This is my download script :
 
 ?php
 $file = $P/$F;
 header(Content-Description: File Transfer);
 header(Content-Type: application/force-download);
 header(Content-Disposition: attachment; filename=.basename($file));
 @readfile($file);
 ? 
 
 Which is called using this link on the main page:
 
 a 
 href=\imsafm_user_dl.php?ID=$myrow[ID]P=imsafm/$userF=$myrow[filename]\
 img src=b_newtbl.png border=0/a
 
 
 What does the 1 KB file contain? Is it the beginning of the wanted file?
 Remove @ while debuging.
 Add header('Content-Lenght: ' . filesize($file));
 Check server logs.
 
 HTH
 
 

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



RE: [PHP] MySQL to OO

2004-09-16 Thread Jay Blanchard
[snip]
I am looking for a absolute transparent interface to access each field a

s a object.

So if i would have a table like this:

tablename: namedtable
--
| id | foo | bar |
--
| 01 | aaa | uuu |
--
| 02 | bbb | mmm |
--

I could access it like this:
namedtable-return() would give me the whole table
namedtable-id(all) would give me [01, 02]
namedtable-id(01) would give me [foo=aaa, bar=uuu]

something like this
[/snip]

http://pear.php.net

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



Re: [PHP] File Download Problems

2004-09-16 Thread John Holmes
From: PHP Junkie [EMAIL PROTECTED]
As my link to the download file, I changed it to
a href=\imsafm_user_dl.php?F=imsafm/$user/$myrow[filename]\img
src=b_newtbl.png border=0/a
And changed the code in the download file to
?php
header(Content-Description: File Transfer);
header(Content-Type: application/force-download);
header(Content-Disposition: attachment; filename=.basename($F));
@readfile($F);
?
How are you validating $F and ensuring it's not a path to any file on your 
server?

imsafm_user_dl.php?F=/home/path/to/secret/file.txt
---John Holmes... 

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


Re: [PHP] File Download Problems

2004-09-16 Thread Marek Kilimajer
John Holmes wrote:
From: PHP Junkie [EMAIL PROTECTED]
As my link to the download file, I changed it to
a href=\imsafm_user_dl.php?F=imsafm/$user/$myrow[filename]\img
src=b_newtbl.png border=0/a
And changed the code in the download file to
?php
header(Content-Description: File Transfer);
header(Content-Type: application/force-download);
header(Content-Disposition: attachment; filename=.basename($F));
@readfile($F);
?

How are you validating $F and ensuring it's not a path to any file on 
your server?

imsafm_user_dl.php?F=/home/path/to/secret/file.txt
It's a File Manager application, so I guess it's supposed to be 
accessible only to administrators that have (s)ftp access anyway.

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


[PHP] PHP5.0.1 with MySql4.0.2

2004-09-16 Thread yusamv
#For PHP5.0.1 with Apavhe2.050 with Windows XP Home eddition S. Pack2 as a SAPI module.
#In Apache config file httpd add following:
AddType application/x-httpd-php .php
LoadModule php5_module c:/php/php5apache2.dll
PHPIniDir = C:/php
#Then go to control panel, Prformance and Maintenance, System, Advanced, Enviroment 
Variables, 
#and duble click on Path. 
#At the end add: ;C:\php
#To enable MySql: uncomment extension = php_mysql.dll in php.ini file in C:\php folder
#Unfortunatelly libmysql.dll from PHP folder does not work and PHP can not talk with 
MySql.
#  I did try tu put it in Windows or Widows\system, or Windows\System32, or php\ext 
and PHP can not talk with MySql.

[PHP] PHP5.0.1 with MySql4.0.2

2004-09-16 Thread yusamv
#For PHP5.0.1 with Apavhe2.050 with Windows XP Home eddition S. Pack2 as a SAPI module.
#In Apache config file httpd add following:
AddType application/x-httpd-php .php
LoadModule php5_module c:/php/php5apache2.dll
PHPIniDir = C:/php
#Then go to control panel, Prformance and Maintenance, System, Advanced, Enviroment 
Variables, 
#and duble click on Path. 
#At the end add: ;C:\php
#To enable MySql: uncomment extension = php_mysql.dll in php.ini file in C:\php folder
#Unfortunatelly libmysql.dll from PHP folder does not work and PHP can not talk with 
MySql.
#  I did try tu put it in Windows or Widows\system, or Windows\System32, or php\ext 
and PHP can not talk with MySql4.0.2.

Re: [PHP] Re: mysql_connect does not connect

2004-09-16 Thread Curt Zirzow
* Thus wrote Sam Hobbs:
 Janbro [EMAIL PROTECTED] wrote in message 
 news:[EMAIL PROTECTED]
  Hi I connect to a MySQL 4.1 with the following String:
 
 
  if
  ($db_verbin=mysqli_connect($mysql_host,$mysql_user,$mysql_passw,$DB_n
  ame))
 
  watch the i in mysqli_connect!
 
  I think I've read somewhere that you are required to use that for the 4.1
  Versions, but you
 
  better look that up, I might be wrong there.
 
  Hope this helps
 
  JanBro
 
 
 When I do try mysqli_connect, I get:
 
 Fatal error:  Call to undefined function mysqli_connect()
 
 So obviously I need to do something to enable that. I will look into that 
 later, but I am still trying to get mysql_connect to work.

RTFM.

mysql:
  This MySQL extension doesn't support full functionality of MySQL
  versions greater than 4.1.0. For that, use MySQLi.

mysqli:
  The mysqli extension is designed to work with the version 4.1.3 or
  above of MySQL.



Curt
-- 
The above comments may offend you. flame at will.

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



Re: [PHP] find null character in php

2004-09-16 Thread Curt Zirzow
* Thus wrote T UmaShankari:
 
 Hello,
 
  I am having one string variable which has the value fetched from the
 mysql table. Is it possible to find '\0' character in that string ?

http://php.net/strstr
http://php.net/strpos

strstr($nulledstring, \0);
strpos($nulledstring, \0);



Curt
-- 
The above comments may offend you. flame at will.

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



Re: [PHP] split behaviour differences in perl and php

2004-09-16 Thread Curt Zirzow
* Thus wrote Sandip Bhattacharya:
 This stumped me badly in my present  project. Is this a bug or a feature in
 PHP? I am trying to split a string into two, where only one half (and the
 delimiter) is present.
 
 
 IN  PERL
 ==
 [EMAIL PROTECTED] ~]$ cat s1.pl
 @t = split(/,/ , a,b);
 $len = $#t + 1;
 print $len\n;
 @t = split(/,/, a,);
 $len = $#t + 1;
 print $len\n;
 
 [EMAIL PROTECTED] sql]$ perl s1.pl
 2
 1
 
 
 IN PHP
 ===
 
 [EMAIL PROTECTED] ~]$ cat s1.php
 ?php
  print count(split(',', 'a,b')).\n;
  print count(split(',', 'a,')).\n;
 ?
 
 [EMAIL PROTECTED] sql]$ php -q s1.php
 2
 2

split in php isn't the same as perl's split, there is preg_split()
which you can use:

  $results = preg_split('/,/','a,', -1, PREG_SPLIT_NO_EMPTY);
  print(count($results)); //  outputs: 1


Curt
-- 
The above comments may offend you. flame at will.

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



[PHP] PHP accelerators

2004-09-16 Thread Don
Hi,
 
Besides Zend, has anyone successfully used and know of any PHP accelerators
that work with PHP 5.x?
 
Thanks,
Don

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



Re: [PHP] Splitting 12345 - 1,2,3,4,5

2004-09-16 Thread Greg Beaver
Martin Holm wrote:
Michael Mao wrote:
Thanks John.
Found what I'm looking for:
Function str_split()
to make it php4 compatible you can use this function:
|?php
if (!function_exists('str_split')) {
  function str_split ($str, $size = 1) {
 $arr = array();
 for ($i = 0 ; $i  strlen($str) ; $i += $size) {
$arr[] = substr($str,$i,$size);
here, you can also use:
$arr[] = $str{$i};
and use $i++ instead of $i += $size
if you don't need strings larger than 1 character.
 }
 return $arr;
  }
}
?
works in about the same way as the function in php5.
|
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP] split behaviour differences in perl and php

2004-09-16 Thread Andrew Martinez
PHP's string manipulation functions (such as split()) are not guaranteed to
behave exactly like in PERL. The functions that are prefixed by 'preg_' are
(PERL REG (EX)) guaranteed to some extent and well documented where preg_
functions are not PERL compliant.

So, its not a bug, its just PHP being its own language.

Cheers,
Andrew Martinez
RubyBay Inc.
 -Original Message-
 From: Curt Zirzow [mailto:[EMAIL PROTECTED]
 Sent: Thursday, September 16, 2004 10:45 AM
 To: [EMAIL PROTECTED]
 Subject: Re: [PHP] split behaviour differences in perl and php
 
 * Thus wrote Sandip Bhattacharya:
  This stumped me badly in my present  project. Is this a bug or a feature
 in
  PHP? I am trying to split a string into two, where only one half (and
 the
  delimiter) is present.
 
 
  IN  PERL
  ==
  [EMAIL PROTECTED] ~]$ cat s1.pl
  @t = split(/,/ , a,b);
  $len = $#t + 1;
  print $len\n;
  @t = split(/,/, a,);
  $len = $#t + 1;
  print $len\n;
 
  [EMAIL PROTECTED] sql]$ perl s1.pl
  2
  1
 
 
  IN PHP
  ===
 
  [EMAIL PROTECTED] ~]$ cat s1.php
  ?php
   print count(split(',', 'a,b')).\n;
   print count(split(',', 'a,')).\n;
  ?
 
  [EMAIL PROTECTED] sql]$ php -q s1.php
  2
  2
 
 split in php isn't the same as perl's split, there is preg_split()
 which you can use:
 
   $results = preg_split('/,/','a,', -1, PREG_SPLIT_NO_EMPTY);
   print(count($results)); //  outputs: 1
 
 
 Curt
 --
 The above comments may offend you. flame at will.
 
 --
 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_connect does not connect

2004-09-16 Thread John Nichel
Chris Dowell wrote:
All this is irrelevant; while you're still trying to use MySQL 5 with 
mysql_connect() instead of mysqli_connect(), it WILL NEVER WORK

Sort that out first before you start worrying about firewalls - you 
can't test the firewall if you can't ever have a successful test case.

Cheers
Chris
The MySQL functions work fine in php5.  It just doesn't support all the 
features available in MySQL = 4.1.0.  Unlike php4, support for MySQL 
isn't bundled in php5, but when enabled, it works.

--
John C. Nichel
ÜberGeek
KegWorks.com
716.856.9675
[EMAIL PROTECTED]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] download pdf using php script

2004-09-16 Thread Tom Rogers
Hi,

Thursday, September 16, 2004, 4:51:51 PM, you wrote:
a Hello PHP Users,

a I have files (that protected from direct download) and I put it
a outside public_html/ directory (outside web server directory).

a and the people from outside could access the file by typing:
a www.myweb.com/download.php?filename=xzy.pdf

a can someone give me hint how to do this ?

a thank u



a -- 
a Best regards,
a adwin
a www.kuya-kuya.net


Something like this

?php
//need to be careful of ../ in filename so use basename
$filename = /path/to/file/.basename($_GET['filename']);
if(file_exists($filename)){
  $len = filesize($filename);
  header(Content-type: application/pdf);
  header(Content-Length: $len);
  header(Content-Disposition: inline; filename=foo.pdf);
  readfile($filename);
}
? 

-- 
regards,
Tom

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



Re: [PHP] Re: mysql_connect does not connect

2004-09-16 Thread Jason Davidson
woah, full functionality.. it has will still connect, at least, it will
still connect for me.  Where the functionality is missing, im not sure.
 But sinse the error is cant connect to localhost, i would say that it
strying to connect to localhost, and not being allowed.  

That said, im fully open to the idea that this may be the problem, im
just reporting that i have connected to a mysql version greater than
4.1 with mysql_connect.  

Jason

Curt Zirzow [EMAIL PROTECTED] wrote: 
 
 * Thus wrote Sam Hobbs:
  Janbro [EMAIL PROTECTED] wrote in message 
  news:[EMAIL PROTECTED]
   Hi I connect to a MySQL 4.1 with the following String:
  
  
   if
   ($db_verbin=mysqli_connect($mysql_host,$mysql_user,$mysql_passw,$DB_n
   ame))
  
   watch the i in mysqli_connect!
  
   I think I've read somewhere that you are required to use that for the 4.1
   Versions, but you
  
   better look that up, I might be wrong there.
  
   Hope this helps
  
   JanBro
  
  
  When I do try mysqli_connect, I get:
  
  Fatal error:  Call to undefined function mysqli_connect()
  
  So obviously I need to do something to enable that. I will look into that 
  later, but I am still trying to get mysql_connect to work.
 
 RTFM.
 
 mysql:
   This MySQL extension doesn't support full functionality of MySQL
   versions greater than 4.1.0. For that, use MySQLi.
 
 mysqli:
   The mysqli extension is designed to work with the version 4.1.3 or
   above of MySQL.
 
 
 
 Curt
 -- 
 The above comments may offend you. flame at will.
 
 -- 
 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: iguanahost - anyone else being plagued?

2004-09-16 Thread Dennis Gearon
Or better yet, the mail list could be reconfigured to match every other 
mail list on the web, so that sender to the list doesn't get these.

Nick Wilson wrote:
Anyone else getting these infuriating italian messages about some muppet
that doesnt exist?
'desintione non existente'?
I've written to [EMAIL PROTECTED] but no joy, everytime i post on the
php list i get half a dozen of the damn things...
Yup, guess some Italian 1337 h4x0r has some shit going on...
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP] checking multiple URL parameters

2004-09-16 Thread Gryffyn, Trevor
I could have sworn that there was a function that dropped ALL GET values
into an associative array. Kind of the inverse of http_build_query.

At any rate, you can keep doing (isset($_REQUEST['mov']) AND
isset($_REQUEST['year'])) and such.  Is that your question?  How do you
do AND and OR operations?

-TG

 -Original Message-
 From: Dustin Krysak [mailto:[EMAIL PROTECTED] 
 Sent: Wednesday, September 15, 2004 7:33 PM
 To: PHP
 Subject: [PHP] checking multiple URL parameters
 
 
 Hi there, I am currently using the following code to display content 
 based on the URL parameters
 
  ?php
   if (isset($_REQUEST['mov'])) {
   $movie = ($_REQUEST['mov'])
   ?
 HTML CONTENT
  ?php
}
 
else {
?
OTHER HTML CONTENT
  ?php
 }
 
 ?
 
 now what I need to do is modify the code so that the script checks 2 
 URL parameters, and has 2 variables defined (from the URL 
 parameter)...
 
 So I need to also check if $_REQUEST['year'] is set as well as the 
 original (both need to be set to get the first HTML content) 
 AND I also 
 need to set the variable of $year = ($_REQUEST['year']
 
 direction?
 
 d
 
 -- 
 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_connect does not connect

2004-09-16 Thread Jason Davidson
i am in total agreeance of this post.  Sinse the 'flame' war is
primarily between me and everyone else, especially sam hobbes, (not the
first time either), no more contributiuons to this thread from me.  I
hope it gets resolved, and i hope it gets posted as much so others can
search the archive of this thread for solutions.  

If anyone actually wants to discuss, and not argue, over the relevance
of a firewall in this sitiution, please start a new thread.  

Jason


Markus Mayer [EMAIL PROTECTED] wrote: 
 
 On Thursday 16 September 2004 05:06, Sam Hobbs wrote:
  It is my understanding that the firewall is not supposed to be relevant. I
 
 It is our experience at my employer that the firewall in XP-SP2, as well as 
 other firewalls that are available, are very relevant.
 
  have not seen anything saying it is supposed to be. 
 
 We also have not seen any documentation about problems with such things 
 after installing SP2, but we have problems.  Things that worked before don't 
 work any more, especially client side things.  Our three small Windoze 
 servers have given our Windoze administrator more than enough work recently.
 
  If it is true that it 
  is not supposed to be relevant, then simply saying it is just causes
  confusion. If you had said that the firewall is not supposed to be
  relevant, but try disabling it anyway, then I would say that I am totally
  able to think like that too. It is reasonable to try things like that to
  diagnose a bug.
 
 flame blocked by firewall.
 
  If you can find something in the MySQL documentation saying that the
  firewall needs to be disabled eventhough the server and client are the same
  system, then that would sure help. I am not asking you to; I am saying that
  that is what would help.
 
 SP2 is so new that its effects are still being evaluated by a lot of people.  
 At the moment, I think the best place to get information about its effects is 
 forums like this one.  Formal documentation will be updated in time as more 
 experience is gained.  The info I got from our Windows admin is that with 
 SP2, the MS SQL server on one machine was apparenty unaffected, but the MySQL 
 on another was.  Dropping the MS Firewall in SP2 allowed connections again.
 
 Client side, SP2 has caused nothing but problems for us to the point where we 
 as administrators are now saying to our users it was working before you 
 installed SP2, and after you installed SP2 it stopped working, so it's your 
 problem.  IE is especially problematic, and when someone calls up and says 
 they have a problem with IE and have installed SP2, our response is that we 
 no longer support IE and tell the users to install Mozilla, and if they still 
 have problems when they try Mozilla, they can call us back.  We haven't heard 
 from any of them again, and our help desk girls have always been able to 
 quickly sort out the problems users have when they first try Mozilla.
 
 I looked back in this thread and saw that you used Zone Alarm as a firewall.  
 You need to allow MySQL connections to localhost, and that regardless of 
 which firewall you use.  If you filter such connections out, PHP scripts will 
 not be able to connect to your MySQL server.  This is because PHP makes a TCP 
 connection to the MySQL server, also when it is running on the same machine 
 as you PHP/Apache (at least this is my understanding).  You can of course 
 continue refuse all external (that is not from localhost) connections to 
 whatever service is running on your machine.  I think something to this 
 effect has already been said in this thread, but at the moment I don't want 
 to search for the post.
 
 While the flame war in this thread has been amusing to read, it's amusement 
 value for me has more or less run out.  My impression is that you still don't 
 have the thing working, and the only solution left is to configure your 
 firewall to allow connections to your MySQL server from localhost.  If you 
 would do this, and it works, please post to the list to reflect this.  My 
 experience as an administrator tells me with a 99% certainty that this is 
 your problem.
 
 regards
 Markus
 
 -- 
 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] Re: mysql_connect does not connect

2004-09-16 Thread John Nichel
Jason Davidson wrote:
woah, full functionality.. it has will still connect, at least, it will
still connect for me.  Where the functionality is missing, im not sure.
 But sinse the error is cant connect to localhost, i would say that it
strying to connect to localhost, and not being allowed.  
The missing functionality has to do with new functions added to MySQL 
4.1.x that didn't exist before.  It's safe to say that being able to 
connect to the database existed before MySQL 4.1.x.  Check the MySQL web 
site for changes to 4.1.x

If the error is...
Fatal error:  Call to undefined function mysqli_connect()
Then the problem is that mysqli support is not compiled in.
MySQL functions != MySQLi functions
That said, im fully open to the idea that this may be the problem, im
just reporting that i have connected to a mysql version greater than
4.1 with mysql_connect.  
mysql_connect() != mysqli_connect
--
John C. Nichel
ÜberGeek
KegWorks.com
716.856.9675
[EMAIL PROTECTED]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] problems with different results on count() and select

2004-09-16 Thread Chris Shiflett
--- Merlin [EMAIL PROTECTED] wrote:
 I am having difficulties to order user into a ranking table. In
 the listing of the users I use a select statement, where I order
 after points and registration date. Then I print out thre results
 counting the rows. 1,2,3...
 
 SELECT
   u.user_name,
 FROM
   usertable
 ORDER BY
   points desc, registration_date desc
  
 on another page the user can access his user rank directly. Here
 I am using a count statement where I count all users who have
 more points than the member and have registered earlier (to
 avoid results with members having the same points)
 
 SELECT count(*) AS c
 FROM
   usertable
 WHERE
   points  '$points'
   AND registration_date  '$date'
 
 Theoreticly the result number of the first select statement
 should be identical

That's some wacky theory. :-)

I think you need to study what the where clause does. Also, what version
of PHP are you using?

Chris

=
Chris Shiflett - http://shiflett.org/

PHP Security - O'Reilly
 Coming December 2004
HTTP Developer's Handbook - Sams
 http://httphandbook.org/
PHP Community Site
 http://phpcommunity.org/

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



Re: [PHP] disabling php info in http headers

2004-09-16 Thread Chris Shiflett
--- Merlin [EMAIL PROTECTED] wrote:
 I am wondering how to disable the php info inside the response
 header info.

This page discusses that sort of thing:

http://www.php.net/manual/security.hiding.php

Hope that helps.

Chris

=
Chris Shiflett - http://shiflett.org/

PHP Security - O'Reilly
 Coming December 2004
HTTP Developer's Handbook - Sams
 http://httphandbook.org/
PHP Community Site
 http://phpcommunity.org/

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



RE: [PHP] PHP accelerators

2004-09-16 Thread Dan Joseph
Hi,

 Besides Zend, has anyone successfully used and know of any PHP
 accelerators
 that work with PHP 5.x?

There are others?

-Dan Joseph

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



Re: [PHP] PHP accelerators

2004-09-16 Thread Brad Pauly
On Thu, 16 Sep 2004 12:08:50 -0400, Dan Joseph [EMAIL PROTECTED] wrote:
 
 There are others?

http://www.php-accelerator.co.uk/

http://pecl.php.net/package-info.php?package=APC

http://turck-mmcache.sourceforge.net/

- Brad

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



RE: [PHP] PHP accelerators

2004-09-16 Thread Dan Joseph
Hi,

 http://www.php-accelerator.co.uk/
 
 http://pecl.php.net/package-info.php?package=APC
 
 http://turck-mmcache.sourceforge.net/

Oh wow, I had no idea.

-Dan Joseph

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



[PHP] PHP4 readdir is_dir working incorrectly?

2004-09-16 Thread Kristopher Spencer-Yates
//PHP4
$dir_to_scan = website.com/htdocs;
$dir_handle = opendir($dir_to_scan);
while($filename = readdir($dir_handle)){
   if(is_dir($filename)){
   $files_in_scan[] = $filename;
   }
   else{ echo$filename is not a directory.br\n; }
   }
sort($files_in_scan);
print_r($files_in_scan);
The above script properly reports that ., .., and images are 
drwx[directories] by adding them to the $files_in_scan array.  HOWEVER, 
my problem is that there are other directories.. quite a few actually.. 
and above script will say, as an example:

pdf_directory is not a directory
But I know 'pdf_directory' *is* in fact a directory in 
'website.com/htdocs'.  Is this a problem with PHP4 or have I somehow 
'miscoded' what I'm attempting to do?

I would do this in PHP5 but the admin won't upgrade, so I am stuck in 
PHP4 land w/ this project I am on.

Thanks for any advise,
Kris
--
Kristopher Spencer-Yates
Dev Mgr/Systems Administration
[EMAIL PROTECTED]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] PHP4 readdir is_dir working incorrectly?

2004-09-16 Thread John Holmes
- Original Message - 
From: Kristopher Spencer-Yates [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Thursday, September 16, 2004 12:55 PM
Subject: [PHP] PHP4 readdir is_dir working incorrectly?


//PHP4
$dir_to_scan = website.com/htdocs;
$dir_handle = opendir($dir_to_scan);
while($filename = readdir($dir_handle)){
   if(is_dir($filename)){
   $files_in_scan[] = $filename;
   }
   else{ echo$filename is not a directory.br\n; }
   }
sort($files_in_scan);
print_r($files_in_scan);
The above script properly reports that ., .., and images are 
drwx[directories] by adding them to the $files_in_scan array.  HOWEVER, my 
problem is that there are other directories.. quite a few actually.. and 
above script will say, as an example:

pdf_directory is not a directory
But I know 'pdf_directory' *is* in fact a directory in 
'website.com/htdocs'.  Is this a problem with PHP4 or have I somehow 
'miscoded' what I'm attempting to do?
Your code is checking if pdf_directory is a directly where the scirpt is 
located instead of website.com/htdocs/pdf_directory. Add 
website.com/htdocs/ to is_dir() and this should work.

---John Holmes... 

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


[PHP] Problems with internationalization

2004-09-16 Thread Aaron Gould
I am having an issue with 'setlocale'.  I have created a proper 
messages.po (and compiled .mo) file in the following directory:

$_SERVER['DOCUMENT_ROOT']/locale/fr_FR/LC_MESSAGES
There are only two languages -- English and French.
Here's the snippit of code that handles the langage change.  It's in my 
code just before the header is sent:

$localemsg = setlocale(LC_ALL, 'fr_FR');
bindtextdomain('messages', $_SERVER['DOCUMENT_ROOT'].'/locale');
textdomain('messages');
So, I would expect this code to product French wording.  Well it does -- 
but not all the time!  When reloading the page constantly, the wording 
swaps randomly between English and French; all without changing any code!

Has anyone experienced this before?
--
Aaron Gould
Parts Canada - Web Developer
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] PHP4 readdir is_dir working incorrectly?

2004-09-16 Thread John Nichel
Kristopher Spencer-Yates wrote:
//PHP4
$dir_to_scan = website.com/htdocs;
$dir_handle = opendir($dir_to_scan);
while($filename = readdir($dir_handle)){
   if(is_dir($filename)){
   $files_in_scan[] = $filename;
   }
   else{ echo$filename is not a directory.br\n; }
   }
sort($files_in_scan);
print_r($files_in_scan);
The above script properly reports that ., .., and images are 
drwx[directories] by adding them to the $files_in_scan array.  HOWEVER, 
my problem is that there are other directories.. quite a few actually.. 
and above script will say, as an example:

pdf_directory is not a directory
But I know 'pdf_directory' *is* in fact a directory in 
'website.com/htdocs'.  Is this a problem with PHP4 or have I somehow 
'miscoded' what I'm attempting to do?

I would do this in PHP5 but the admin won't upgrade, so I am stuck in 
PHP4 land w/ this project I am on.

Thanks for any advise,
You have to either supply the root path to the 'suspected' directory, ie 
/path/from/root/pdf_dir, or change the working directory.  Right now, 
it's looking in the directory that php is currently working in.

--
John C. Nichel
ÜberGeek
KegWorks.com
716.856.9675
[EMAIL PROTECTED]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] checking multiple URL parameters

2004-09-16 Thread Andrew Kreps
On Thu, 16 Sep 2004 11:15:13 -0400, Gryffyn, Trevor
[EMAIL PROTECTED] wrote:
 I could have sworn that there was a function that dropped ALL GET values
 into an associative array. Kind of the inverse of http_build_query.


I believe you're thinking of import_request_variables ().

http://us2.php.net/manual/en/function.import-request-variables.php

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



RE: [PHP] checking multiple URL parameters

2004-09-16 Thread Gryffyn, Trevor
That's it!  Thanks!  Beautiful!  :)

Worth noting is the extract() function mentioned at the bottom of that
page too, used for importing any array into the global space.

Thank you very much, Andrew.  I knew I had seen that somewhere.

-TG

 -Original Message-
 From: Andrew Kreps [mailto:[EMAIL PROTECTED] 
 Sent: Thursday, September 16, 2004 1:55 PM
 To: PHP
 Subject: Re: [PHP] checking multiple URL parameters
 
 
 On Thu, 16 Sep 2004 11:15:13 -0400, Gryffyn, Trevor
 [EMAIL PROTECTED] wrote:
  I could have sworn that there was a function that dropped 
 ALL GET values
  into an associative array. Kind of the inverse of 
 http_build_query.
 
 
 I believe you're thinking of import_request_variables ().
 
http://us2.php.net/manual/en/function.import-request-variables.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] checking multiple URL parameters

2004-09-16 Thread Chris Shiflett
--- Andrew Kreps [EMAIL PROTECTED] wrote:
 --- Trevor Gryffyn [EMAIL PROTECTED] wrote:
  I could have sworn that there was a function that dropped ALL
  GET values into an associative array. Kind of the inverse of
  http_build_query.
 
 I believe you're thinking of import_request_variables

That imports variables into the global scope individually. He's probably
just thinking about $_GET, which is already an associative array that
contains all GET data. No function is necessary.

Chris

=
Chris Shiflett - http://shiflett.org/

PHP Security - O'Reilly
 Coming December 2004
HTTP Developer's Handbook - Sams
 http://httphandbook.org/
PHP Community Site
 http://phpcommunity.org/

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



[PHP] syntax questoin

2004-09-16 Thread Victor C.
Hi,
I just started with PHP.  (I used to work on ASP a lot)

What does  the syntax .= do?

i see a line of code that says

$Msg .= Test is complete

I'm thinking it means concatenate $Msg with Test is complete and then
store the new string into $Msg

Am I right?

Thanks.

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



RE: [PHP] syntax questoin

2004-09-16 Thread Jay Blanchard
[snip]
$Msg .= Test is complete

I'm thinking it means concatenate $Msg with Test is complete and then
store the new string into $Msg

Am I right?
[/snip]

Yes. You might see $Msg = (no concatenator) somewhere above it in the
code...we code long SQL statements and things like e-mail bodies using
it.

$sql = SELECT a.`foo`, b.`bar` ;
$sql .= FROM `tblA` a, `tblB` b ;
$sql .= WHERE conditions ;
$sql .= HAVING `stuff` ;
$sql .= ORDER BY a.`foo` ;

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



Re: [PHP] syntax questoin

2004-09-16 Thread Matt M.
 $Msg .= Test is complete
 
 I'm thinking it means concatenate $Msg with Test is complete and then
 store the new string into $Msg
 
 Am I right?

you are correct, same as:
$Msg = $Msg.Test is complete

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



Re: [PHP] syntax questoin

2004-09-16 Thread John Nichel
Victor C. wrote:
Hi,
I just started with PHP.  (I used to work on ASP a lot)
What does  the syntax .= do?
i see a line of code that says
$Msg .= Test is complete
I'm thinking it means concatenate $Msg with Test is complete and then
store the new string into $Msg
Am I right?
Thanks.
It does concatenate the value onto the end of the original string.
http://us4.php.net/manual/en/language.operators.assignment.php
--
John C. Nichel
ÜberGeek
KegWorks.com
716.856.9675
[EMAIL PROTECTED]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] split behaviour differences in perl and php

2004-09-16 Thread Matthew Sims
 * Thus wrote Sandip Bhattacharya:
 This stumped me badly in my present  project. Is this a bug or a feature
 in
 PHP? I am trying to split a string into two, where only one half (and
 the
 delimiter) is present.


 IN  PERL
 ==
 [EMAIL PROTECTED] ~]$ cat s1.pl
 @t = split(/,/ , a,b);
 $len = $#t + 1;
 print $len\n;
 @t = split(/,/, a,);
 $len = $#t + 1;
 print $len\n;

 [EMAIL PROTECTED] sql]$ perl s1.pl
 2
 1


 IN PHP
 ===

 [EMAIL PROTECTED] ~]$ cat s1.php
 ?php
  print count(split(',', 'a,b')).\n;
  print count(split(',', 'a,')).\n;
 ?

 [EMAIL PROTECTED] sql]$ php -q s1.php
 2
 2

 split in php isn't the same as perl's split, there is preg_split()
 which you can use:

   $results = preg_split('/,/','a,', -1, PREG_SPLIT_NO_EMPTY);
   print(count($results)); //  outputs: 1


 Curt


Would explode() provide the same technique?

$var = a,;
$results = explode(,, $var);

$results[0] = a;

-- 
--Matthew Sims
--http://killermookie.org

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



[PHP] MySQL query for average records per day

2004-09-16 Thread Jeff Oien
I have a database with a date field in this format
20041016
I'd like to count how many records were made on each day (except today) 
and average them. Can I do this in one query or will I need to do some 
more PHP stuff after I get some results? Thanks.

Bare bones so far:
$sql = select date1 from $table_name where date1 != '$today';
Jeff
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP] checking multiple URL parameters

2004-09-16 Thread Gryffyn, Trevor
You're right though, $_GET and $_POST and such are already an
associative array.  I actually think I was thinking of a function that
parsed a URL itself, regardless of whether it was submitted or not.  I'm
all kinds of mixed up today, so I apologize for being kind of scrambled
in the brain.

Is there a function that'll take
http://www.server.com/scriptname.php?someparam=somedatasomeparam2=some
data2 and produce:

$someparam == somedata
$someparam2 == somedata2

??

You understand I'm talking about parsing the URL, not juggling $_GET
data, right?

I know you could write a short script that would do it, but I think I
saw a built-in function that did it as well.

-TG

 -Original Message-
 From: Chris Shiflett [mailto:[EMAIL PROTECTED] 
 Sent: Thursday, September 16, 2004 2:19 PM
 To: Andrew Kreps; PHP
 Subject: Re: [PHP] checking multiple URL parameters
 
 
 --- Andrew Kreps [EMAIL PROTECTED] wrote:
  --- Trevor Gryffyn [EMAIL PROTECTED] wrote:
   I could have sworn that there was a function that dropped ALL
   GET values into an associative array. Kind of the inverse of
   http_build_query.
  
  I believe you're thinking of import_request_variables
 
 That imports variables into the global scope individually. 
 He's probably
 just thinking about $_GET, which is already an associative array that
 contains all GET data. No function is necessary.
 
 Chris
 
 =
 Chris Shiflett - http://shiflett.org/
 
 PHP Security - O'Reilly
  Coming December 2004
 HTTP Developer's Handbook - Sams
  http://httphandbook.org/
 PHP Community Site
  http://phpcommunity.org/
 
 -- 
 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 for average records per day

2004-09-16 Thread Gryffyn, Trevor
Select date1,count(date1) group by date1 where date1  '$today'

That'll get you the count of how many records were done on each day
(excluding today).  I don't know what you're trying to average, but you
can probably figure it out from there.

-TG

 -Original Message-
 From: Jeff Oien [mailto:[EMAIL PROTECTED] 
 Sent: Thursday, September 16, 2004 2:35 PM
 To: PHP
 Subject: [PHP] MySQL query for average records per day
 
 
 I have a database with a date field in this format
 20041016
 I'd like to count how many records were made on each day 
 (except today) 
 and average them. Can I do this in one query or will I need 
 to do some 
 more PHP stuff after I get some results? Thanks.
 
 Bare bones so far:
 $sql = select date1 from $table_name where date1 != '$today';
 Jeff
 
 -- 
 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 for average records per day

2004-09-16 Thread John Holmes
From: Jeff Oien [EMAIL PROTECTED]
I have a database with a date field in this format
20041016
I'd like to count how many records were made on each day (except today) 
and average them. Can I do this in one query or will I need to do some 
more PHP stuff after I get some results? Thanks.

Bare bones so far:
$sql = select date1 from $table_name where date1 != '$today';
Jeff
$sql = SELECT date1, COUNT(date1) AS num_records FROM $table_name WHERE 
date1 != CURRENT_DATE GROUP BY date1;

You can't get the average and a count in the same query, so either calculate 
the average in PHP as you extract the results or run another query.

$sql = SELECT AVG(COUNT(date1)) AS avg_records FROM $table_name WHERE date1 
!= CURRENT_DATE GROUP BY date1;

Not sure if that second query is correct or not, though, since this is a PHP 
list.

---John Holmes... 

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


RE: [PHP] MySQL query for average records per day

2004-09-16 Thread Jay Blanchard
[snip]
I have a database with a date field in this format
20041016
I'd like to count how many records were made on each day (except today) 
and average them. Can I do this in one query or will I need to do some 
more PHP stuff after I get some results? Thanks.

Bare bones so far:
$sql = select date1 from $table_name where date1 != '$today';
[/snip]

a. Is a SQL question
2. One query - SELECT (COUNT(date1)/COUNT(DISTINCT(date1))) AS average
FROM $table_name where date1 != '$today';

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



Re: [PHP] PHP4 readdir is_dir working incorrectly?

2004-09-16 Thread Kristopher Spencer-Yates
Jack Gates wrote:
I would do this in PHP5 but the admin won't upgrade, so I am stuck in 
PHP4 land w/ this project I am on.

Thanks for any advise,
   

We are setting up another web hosting server and we are planning to install 
PHP5.

You might consider moving your site to our servers.
http://www.morningstarcom.net/hosting.php
 

Thanks.  Yes, we have PHP5 here on some servers already.  I love it.  I 
think you will too.  My solution is 2 lines of code in PHP5.  Sweet!  
However, my question was related to a programming problem within PHP4, 
not a server problem.

Out of respect for everyone on the list, it is probably best to not use 
this mailing list as a sales tool.  Many of us here on the list are in 
the same business of developing and hosting.  It is wise to assume 
everyone on the list is in the same business (even if it is untrue).  
Just know that if someone is looking for hosting, they will definitely 
post a request specifically looking for such services.  It may also be 
beneficial to you personally if you were to have a working PHP5 server 
online before attempting to sell it as a service.  I hope you take this 
advice kindly, as I mean you no harm.

One thing that I am not sure of is whether or not the PHP.NET group 
already has a mailing list specifically for posting PHP related service 
availability.  If so, you may want to look for business there.

Best of luck in your ventures.  The US economy is starting to pick up 
which is hopefully a benefit to all PHP programmers worldwide.

Respectfully,
--
Kristopher Spencer-Yates
Dev Mgr/Systems Administration
[EMAIL PROTECTED]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] PHP4 readdir is_dir working incorrectly?

2004-09-16 Thread Kristopher Spencer-Yates
John H  John N,
Thanks again.  I am sure that is it, without a doubt.
Laughing at myself - ridiculous oversight on my part!  :)   LMAO cant 
beleive I didnt see that earlier and posted to the list.  Please join in 
laughing at me because I have been slinging PHP since early 99 and 
should have caught that immediately!!  heheh LOL

Cheers,
Kris
John Holmes wrote:
- Original Message - From: Kristopher Spencer-Yates 
[EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Thursday, September 16, 2004 12:55 PM
Subject: [PHP] PHP4 readdir is_dir working incorrectly?


//PHP4
$dir_to_scan = website.com/htdocs;
$dir_handle = opendir($dir_to_scan);
while($filename = readdir($dir_handle)){
   if(is_dir($filename)){
   $files_in_scan[] = $filename;
   }
   else{ echo$filename is not a directory.br\n; }
   }
sort($files_in_scan);
print_r($files_in_scan);
The above script properly reports that ., .., and images are 
drwx[directories] by adding them to the $files_in_scan array.  
HOWEVER, my problem is that there are other directories.. quite a few 
actually.. and above script will say, as an example:

pdf_directory is not a directory
But I know 'pdf_directory' *is* in fact a directory in 
'website.com/htdocs'.  Is this a problem with PHP4 or have I somehow 
'miscoded' what I'm attempting to do?

Your code is checking if pdf_directory is a directly where the 
scirpt is located instead of website.com/htdocs/pdf_directory. Add 
website.com/htdocs/ to is_dir() and this should work.

---John Holmes...
.

--
Kristopher Spencer-Yates
Dev Mgr/Systems Administration
[EMAIL PROTECTED]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] PHP4 readdir is_dir working incorrectly?

2004-09-16 Thread John Holmes
From: Kristopher Spencer-Yates [EMAIL PROTECTED]
Please join in laughing at me because I have been slinging PHP since early 
99 and should have caught that immediately!!
I was already planning to do a lot of laughing at you tonight, anyhow, from 
around 2100 - 2130, so, I hope it helps and everything... ;)
I could add another 15 or so minutes to that if you'd like, also... it's up 
to you.

John 

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


Re: [PHP] PHP4 readdir is_dir working incorrectly?

2004-09-16 Thread John Nichel
John Holmes wrote:
From: Kristopher Spencer-Yates [EMAIL PROTECTED]
Please join in laughing at me because I have been slinging PHP since 
early 99 and should have caught that immediately!!

I was already planning to do a lot of laughing at you tonight, anyhow, 
from around 2100 - 2130, so, I hope it helps and everything... ;)
I could add another 15 or so minutes to that if you'd like, also... it's 
up to you.

John
Just so we're clear, and all on the same page, can you give us that time 
in GMT?  I mean, we don't want to have an unorganized laugh-off again, 
now do we?

--
John C. Nichel
ÜberGeek
KegWorks.com
716.856.9675
[EMAIL PROTECTED]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP] PHP4 readdir is_dir working incorrectly?

2004-09-16 Thread Jay Blanchard
[snip]
Just so we're clear, and all on the same page, can you give us that time

in GMT?  I mean, we don't want to have an unorganized laugh-off again, 
now do we?
[/snip]

-1

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



Re: [PHP] PHP4 readdir is_dir working incorrectly?

2004-09-16 Thread John Holmes
From: John Nichel [EMAIL PROTECTED]
Just so we're clear, and all on the same page, can you give us that time 
in GMT?  I mean, we don't want to have an unorganized laugh-off again, now 
do we?
Man... why do you have to be such as ass John? Can't you just ignore 
people...err.. wait.. wrong discussion.

0200 - 0230 GMT
---John Holmes... 

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


Re: [PHP] MySQL query for average records per day

2004-09-16 Thread Greg Donald
On Thu, 16 Sep 2004 15:15:01 -0400, John Holmes
[EMAIL PROTECTED] wrote:
 You can't get the average and a count in the same query

Sure you can.

 desc numbers;
++-+--+-+-+---+
| Field  | Type| Null | Key | Default | Extra |
++-+--+-+-+---+
| number | int(11) |  | | 0   |   |
++-+--+-+-+---+
1 row in set (0.00 sec)

mysql select * from numbers;
++
| number |
++
|  1 |
|  2 |
|  1 |
|  2 |
|  1 |
|  2 |
|  1 |
|  2 |
|  1 |
|  2 |
|  3 |
|  4 |
|  3 |
|  4 |
|  3 |
|  4 |
|  3 |
|  4 |
++
18 rows in set (0.00 sec)

mysql select count(number), avg(number) from numbers;
+---+-+
| count(number) | avg(number) |
+---+-+
|18 |  2.3889 |
+---+-+
1 row in set (0.00 sec)



-- 
Greg Donald
http://gdconsultants.com/
http://destiney.com/

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



RE: [PHP] checking multiple URL parameters

2004-09-16 Thread Chris Shiflett
--- Gryffyn, Trevor [EMAIL PROTECTED] wrote:
 You're right though, $_GET and $_POST and such are already an
 associative array. I actually think I was thinking of a function
 that parsed a URL itself, regardless of whether it was submitted
 or not.

This makes absolutely no sense to me. What do you mean by submitted? How
would a PHP script be executed at all if the browser never sends a
request?

 I'm all kinds of mixed up today, so I apologize for being kind
 of scrambled in the brain.

No problem. :-)

 You understand I'm talking about parsing the URL, not juggling
 $_GET data, right?

GET data is passed in the query string of the URL. This is what you're
asking:

Is there a way to access GET data? Yes, I know about $_GET,
but I don't want PHP's help - I want to parse the query
string myself. Can PHP help me do this?

I'm not sure how else to explain it, but it seems like you might be
confused about the GET request method. Is there a reason why you don't
want to use $_GET?

Hope that helps.

Chris

=
Chris Shiflett - http://shiflett.org/

PHP Security - O'Reilly
 Coming December 2004
HTTP Developer's Handbook - Sams
 http://httphandbook.org/
PHP Community Site
 http://phpcommunity.org/

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



Re: [PHP] PHP4 readdir is_dir working incorrectly?

2004-09-16 Thread Greg Donald
 http://www.morningstarcom.net/hosting.php

Need sunglasses to view the t50.com graphics.  Heh.


-- 
Greg Donald
http://gdconsultants.com/
http://destiney.com/

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



AW: [PHP] checking multiple URL parameters

2004-09-16 Thread Mario Micklisch
 I know you could write a short script that would do it, but I 
 think I saw a built-in function that did it as well.

I think parse_str is what you're looking for:

http://www.php.net/manual/en/function.parse-str.php

i.e. parse_str(getenv('QUERY_STRING'))

--
Mario



 -Ursprüngliche Nachricht-
 Von: Gryffyn, Trevor [mailto:[EMAIL PROTECTED] 
 Gesendet: Thursday, September 16, 2004 20:47 PM
 An: PHP
 Cc: [EMAIL PROTECTED]; Andrew Kreps
 Betreff: RE: [PHP] checking multiple URL parameters
 
 
 You're right though, $_GET and $_POST and such are already an 
 associative array.  I actually think I was thinking of a 
 function that parsed a URL itself, regardless of whether it 
 was submitted or not.  I'm all kinds of mixed up today, so I 
 apologize for being kind of scrambled in the brain.
 
 Is there a function that'll take 
 http://www.server.com/scriptname.php?someparam=somedatasomep
 aram2=some
 data2 and produce:
 
 $someparam == somedata
 $someparam2 == somedata2
 
 ??
 
 You understand I'm talking about parsing the URL, not 
 juggling $_GET data, right?
 
 I know you could write a short script that would do it, but I 
 think I saw a built-in function that did it as well.
 
 -TG
 
  -Original Message-
  From: Chris Shiflett [mailto:[EMAIL PROTECTED]
  Sent: Thursday, September 16, 2004 2:19 PM
  To: Andrew Kreps; PHP
  Subject: Re: [PHP] checking multiple URL parameters
  
  
  --- Andrew Kreps [EMAIL PROTECTED] wrote:
   --- Trevor Gryffyn [EMAIL PROTECTED] wrote:
I could have sworn that there was a function that 
 dropped ALL GET 
values into an associative array. Kind of the inverse of 
http_build_query.
   
   I believe you're thinking of import_request_variables
  
  That imports variables into the global scope individually.
  He's probably
  just thinking about $_GET, which is already an associative 
 array that
  contains all GET data. No function is necessary.
  
  Chris
  
  =
  Chris Shiflett - http://shiflett.org/
  
  PHP Security - O'Reilly
   Coming December 2004
  HTTP Developer's Handbook - Sams
   http://httphandbook.org/
  PHP Community Site
   http://phpcommunity.org/
  
  --
  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] PHP4 readdir is_dir working incorrectly?

2004-09-16 Thread John Nichel
John Holmes wrote:
From: John Nichel [EMAIL PROTECTED]
Just so we're clear, and all on the same page, can you give us that 
time in GMT?  I mean, we don't want to have an unorganized laugh-off 
again, now do we?

Man... why do you have to be such as ass John? Can't you just ignore 
people...err.. wait.. wrong discussion.

0200 - 0230 GMT
---John Holmes...
No soup for you! ;)
--
John C. Nichel
ÜberGeek
KegWorks.com
716.856.9675
[EMAIL PROTECTED]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP] MySQL query for average records per day OT

2004-09-16 Thread Jay Blanchard
[snip]
 You can't get the average and a count in the same query

Sure you can.

mysql select count(number), avg(number) from numbers;
+---+-+
| count(number) | avg(number) |
+---+-+
|18 |  2.3889 |
+---+-+
1 row in set (0.00 sec)
[/snip]

If it is numbers you can, but the OP wanted to average for dates.

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



Re: [PHP] MySQL query for average records per day

2004-09-16 Thread John Holmes
From: Greg Donald [EMAIL PROTECTED]
You can't get the average and a count in the same query
Sure you can.
mysql select count(number), avg(number) from numbers;
Depends how you interpret his request, I guess. I took it as a request for 
the count of records per day and then the average of those counts.

So, if you had
D1
D1
D1
D1
D2
D2
D3
The count would be
D1 - 4
D2 - 2
D3 - 1
and the average would be (4+2+1)/3 = 2.333. Can you get that in one query?
depends what the OP was after, though...
---John Holmes... 

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


Re: [PHP] MySQL query for average records per day

2004-09-16 Thread Greg Donald
On Thu, 16 Sep 2004 16:08:45 -0400, John Holmes
[EMAIL PROTECTED] wrote:
 Depends how you interpret his request, I guess. I took it as a request for
 the count of records per day and then the average of those counts.
 
 So, if you had
 
 D1
 D1
 D1
 D1
 D2
 D2
 D3
 
 The count would be
 
 D1 - 4
 D2 - 2
 D3 - 1
 
 and the average would be (4+2+1)/3 = 2.333. Can you get that in one query?

mysql desc dates;
+--+-+--+-+-+---+
| Field| Type| Null | Key | Default | Extra |
+--+-+--+-+-+---+
| the_date | date| YES  | | NULL|   |
| number   | int(11) |  | | 0   |   |
+--+-+--+-+-+---+
2 rows in set (0.00 sec)

mysql select * from dates;
+++
| the_date   | number |
+++
| 2004-01-01 |  1 |
| 2004-01-01 |  2 |
| 2004-01-01 |  3 |
| 2004-01-02 |  1 |
| 2004-01-02 |  2 |
| 2004-01-02 |  3 |
| 2004-01-02 |  4 |
| 2004-01-03 |  2 |
| 2004-01-03 |  3 |
| 2004-01-03 |  4 |
| 2004-01-03 |  5 |
+++
11 rows in set (0.00 sec)

mysql select the_date, count(number), avg(number) from dates group by the_date;
++---+-+
| the_date   | count(number) | avg(number) |
++---+-+
| 2004-01-01 | 3 |  2. |
| 2004-01-02 | 4 |  2.5000 |
| 2004-01-03 | 4 |  3.5000 |
++---+-+
3 rows in set (0.01 sec)


-- 
Greg Donald
http://gdconsultants.com/
http://destiney.com/

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



[PHP] Secret Codes in Spam and PHP

2004-09-16 Thread Kristopher Spencer-Yates
As many of you may have noticed, A friend and I have noticed the odd 
text at the bottom of spam.  My friend once stated What if this is some 
secret code.. they send it to everyone to hide that it is code.. but the 
person it is intended for knows how to decipher?   Hmm.. interesting.  
So that got me to coding.. I havent had much time to tinker but I do 
have some Fred Wrixon books.. anyway overall just getting started on 
this off-time project.  If this strange text at bottom of spam is indeed 
some ciphertext, they are probably using some old cipher methods.  This 
thought is based simply on comparing known cipher appearance to that of 
the text in spam and often seeing some similarities.

I was wondering if anyone else has wondered the same thing about the 
wierd text at the bottom of a lot of the spam, and if anyone has ever 
used PHP to create any cipher tools in an attempt to crack the following:

Columnar Transposition ciphers
Word transposition ciphers
Franklin-Dumas cipher
My first round is creating a script that goes through and takes various 
combinations (1st letter of each word, 3rd letter of every 3rd word, 
etc., etc., etc.,)  I guess this is considered letter transposition 
ciphering.  I have some vague ideas to incorporate dictionary database.. 
so if my script attempts to decrypt a peice of text with method 402 
and the result contains actual words from a dictionary, it will flag it 
or save it to a seperate database.. something along those lines.

This is just for fun... no one is sponsoring/financing anything here.. 
just wondering if anyone is interested in sharing ideas and/or code, 
philosophy, etc.  Of course, this could be done in any language, or even 
on paper... I can burn a ream of notebook paper fast doing double 
columnar by hand but my interest is using PHP specifically.   I figure, 
even if my friend is just crazy and no one is sending secret messages 
inside spam, it is at least going to be fun, rewarding in knowledge and 
the sharing of information and ideas.  And if we do crack something, 
maybe Fred Wrixon can mention PHP in his next book.  :)

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


Re: [PHP] MySQL query for average records per day

2004-09-16 Thread Jeff Oien
John Holmes wrote:
From: Greg Donald [EMAIL PROTECTED]
You can't get the average and a count in the same query

Sure you can.
mysql select count(number), avg(number) from numbers;

Depends how you interpret his request, I guess. I took it as a request 
for the count of records per day and then the average of those counts.

So, if you had
D1
D1
D1
D1
D2
D2
D3
The count would be
D1 - 4
D2 - 2
D3 - 1
and the average would be (4+2+1)/3 = 2.333. Can you get that in one query?
depends what the OP was after, though...
---John Holmes...
Jay Blanchard's worked perfectly:
SELECT (COUNT(date1)/COUNT(DISTINCT(date1))) AS average
FROM $table_name where date1 != '$today';
I was looking for the average amount of records (submissions) per day.
Thanks.
Jeff
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] MySQL query for average records per day

2004-09-16 Thread John Holmes
From: Greg Donald [EMAIL PROTECTED]
mysql select the_date, count(number), avg(number) from dates group by 
the_date;
++---+-+
| the_date   | count(number) | avg(number) |
++---+-+
| 2004-01-01 | 3 |  2. |
| 2004-01-02 | 4 |  2.5000 |
| 2004-01-03 | 4 |  3.5000 |
++---+-+
3 rows in set (0.01 sec)
I say again, I took the request as 1) Number of records per day (which you 
show, but can ignore the number column) and 2) The _overall_ average of 
those counts, which would be (3+4+4 records) / (3 days) = 3.666 records/day

We're arguing the same point, really, and trying to guess what the OP was 
after...

---John Holmes... 

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


Re: [PHP] checking multiple URL parameters

2004-09-16 Thread Andrew Kreps
On Thu, 16 Sep 2004 12:47:26 -0700 (PDT), Chris Shiflett
[EMAIL PROTECTED] wrote:
 
 This makes absolutely no sense to me. What do you mean by submitted? How
 would a PHP script be executed at all if the browser never sends a
 request?
 

PHP can be run from the command line, in which case the GET and POST
arrays wouldn't exist.  I use this functionality so that I can take
advantage of Pear's DataObjects when I need to do a flat file data
load.  Also, imagine if you had a database of URL's that you wanted to
dissect for it's component information?

That being said, I'm not aware of a PHP function that performs this
operation for you.  I remember writing a similar one in Perl many
years ago, that was something like:

(sorry for the pseudocode, I figure completely wrong is better than
almost right)

array = regexp_split (/[=]/, uri) // where uri is everything after the ?
for (i = 0; i  count(array); i += 2) {
url_var[array[i]] = array[i+1]  // You may want to do a urldecode here
}

I believe php lets you name vars by adding an additional $ before the
name, such as:

$varname = thing;
$$varname = data;
echo $thing // Produces 'data'

This may be a good starting point.

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



Re: [PHP] Secret Codes in Spam and PHP

2004-09-16 Thread John Holmes
From: Kristopher Spencer-Yates [EMAIL PROTECTED]
I was wondering if anyone else has wondered the same thing about the wierd 
text at the bottom of a lot of the spam, and if anyone has ever used PHP 
to create any cipher tools in an attempt to crack the following:
The text is simply there to get past filters or to pollute adaptive filters 
with good words. If you get a spam that has see spot run as random text in 
it,  you're filter may not mark it as spam. If you manually mark it as spam, 
your filter may think see, spot and run are spam words and start flagging 
legitimate emails as spam which may cause you to turn if off, lighten 
controls, etc, and possibly allow more spam through. Win-win situation for a 
spammer.

Although, you make an interesting point and there's certainly nothing saying 
the text couldn't be used for what you describe. There could be messages 
hidden in the herbal viagra image, also. (that line will probably get this 
marked as spam for a lot of you, heh). So keep working on what you 
described; it could be interesting either way...

---John Holmes... 

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


RE: [PHP] MySQL query for average records per day OT

2004-09-16 Thread Jay Blanchard
[snip]
mysql desc dates;
+--+-+--+-+-+---+
| Field| Type| Null | Key | Default | Extra |
+--+-+--+-+-+---+
| the_date | date| YES  | | NULL|   |
| number   | int(11) |  | | 0   |   |
+--+-+--+-+-+---+
2 rows in set (0.00 sec)

mysql select the_date, count(number), avg(number) from dates group by
the_date;
++---+-+
| the_date   | count(number) | avg(number) |
++---+-+
| 2004-01-01 | 3 |  2. |
| 2004-01-02 | 4 |  2.5000 |
| 2004-01-03 | 4 |  3.5000 |
++---+-+
3 rows in set (0.01 sec)
[/snip]

But the OP didn't have a 'number', just a date so...

mysql select BilledFlag, count(BilledFlag), avg(BilledFlag) from
tblClassOthers group by BilledFlag;
++---+-+
| BilledFlag | count(BilledFlag) | avg(BilledFlag) |
++---+-+
| 2003-10-07 |   251 |2003 |
| 2003-10-14 |   174 |2003 |
| 2003-10-23 |   241 |2003 |
++---+-+

...fails. (count is correct, avg blows up) Without a number column what
is one to do?

mysql SELECT (COUNT(BilledFlag)/COUNT(DISTINCT(BilledFlag))) AS average
FROM tblClassOthers;
+-+
| average |
+-+
|  222.00 |
+-+

Only gives the average. Adding any other count to this, including a
SUM(IF(BilledFlag  '', 1, 0)) [as in a crosstab] causes the
(COUNT(BilledFlag)/COUNT(DISTINCT(BilledFlag))) calculation to fail,
returning only the currect COUNT

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



RE: [PHP] checking multiple URL parameters

2004-09-16 Thread Gryffyn, Trevor
 This makes absolutely no sense to me. What do you mean by 
 submitted? How
 would a PHP script be executed at all if the browser never sends a
 request?

Hah.. I should just let this all go, go home, get some sleep, and start
confusing people again tomorrow, but I want to clarify a little bit.

Imaging you have a URL in a string and you want to find out what
parameters are going to be passed to the script if the URL were to be
called.

?php
$targeturl =
http://www.server.com/script.php?somevar=somevalsomevar2=someval2;;
?


Regardless of how this script is called, is there, or is there not a
function that will take that string and pull the values after the ?
and toss them into an associative array?

  You understand I'm talking about parsing the URL, not juggling
  $_GET data, right?
 
 GET data is passed in the query string of the URL. This is what you're
 asking:
 
 Is there a way to access GET data? Yes, I know about $_GET,
 but I don't want PHP's help - I want to parse the query
 string myself. Can PHP help me do this?
 
 I'm not sure how else to explain it, but it seems like you might be
 confused about the GET request method. Is there a reason why you don't
 want to use $_GET?

Did I really type that indented bit?  Yeah, I am kind of out of it
today.  Read above. Maybe that'll clarify my question.

Thanks :)

-TG

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



[PHP] How can I have a PHP-CLI script which uses stdin open another PHP-CLI that uses stdin.....

2004-09-16 Thread Don Myers
All, I have a PHP Command Line Interface (CLI) script which uses stdin and
stdout for reading and writing to/from the terminal.  Now I need to have
that script open another PHP-CLI script which ALSO needs to uses stdin and
stdout for reading and writing to/from the terminal. This script may in turn
open another... and another Of course after the script ends it returns
to the line in the script that called it and so on. Until it's done

I am writing a bunch of PHP-CLI scripts which open other helper PHP-CLI
scripts which may be called together or apart (so includes don't work)

Don Myers

BTW I am using PHP 4.3.8 (cgi/cli)

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



Re: [PHP] checking multiple URL parameters

2004-09-16 Thread John Holmes
From: Andrew Kreps [EMAIL PROTECTED]
Also, imagine if you had a database of URL's that you wanted to
dissect for it's component information?
That being said, I'm not aware of a PHP function that performs this
operation for you. 
parse_url() and parse_str()
---John Holmes...
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP] checking multiple URL parameters

2004-09-16 Thread Gryffyn, Trevor
Ahh.. Andrew has read my confused mind.  Yeah, that's what I was getting
at.  Solution Accepted or something. :)  Ok, I'm going to go home now
before I cause any more problems.

-TG

 -Original Message-
 From: Andrew Kreps [mailto:[EMAIL PROTECTED] 
 Sent: Thursday, September 16, 2004 4:31 PM
 To: PHP
 Subject: Re: [PHP] checking multiple URL parameters
 
 
 On Thu, 16 Sep 2004 12:47:26 -0700 (PDT), Chris Shiflett
 [EMAIL PROTECTED] wrote:
  
  This makes absolutely no sense to me. What do you mean by 
 submitted? How
  would a PHP script be executed at all if the browser never sends a
  request?
  
 
 PHP can be run from the command line, in which case the GET and POST
 arrays wouldn't exist.  I use this functionality so that I can take
 advantage of Pear's DataObjects when I need to do a flat file data
 load.  Also, imagine if you had a database of URL's that you wanted to
 dissect for it's component information?
 
 That being said, I'm not aware of a PHP function that performs this
 operation for you.  I remember writing a similar one in Perl many
 years ago, that was something like:
 
 (sorry for the pseudocode, I figure completely wrong is better than
 almost right)
 
 array = regexp_split (/[=]/, uri) // where uri is everything 
 after the ?
 for (i = 0; i  count(array); i += 2) {
 url_var[array[i]] = array[i+1]  // You may want to do a 
 urldecode here
 }
 
 I believe php lets you name vars by adding an additional $ before the
 name, such as:
 
 $varname = thing;
 $$varname = data;
 echo $thing // Produces 'data'
 
 This may be a good starting point.
 
 -- 
 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] checking multiple URL parameters

2004-09-16 Thread John Holmes
From: Gryffyn, Trevor [EMAIL PROTECTED]
Regardless of how this script is called, is there, or is there not a
function that will take that string and pull the values after the ?
and toss them into an associative array?
Yes, parse_url() to get the query string and then parse_str() to put it into 
an associative array. Only that's two functions and you asked for a 
function, so the world may very well end if you use them. G'nite... ;)

---John Holmes... 

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


Re: [PHP] checking multiple URL parameters

2004-09-16 Thread Greg Donald
On Thu, 16 Sep 2004 13:31:08 -0700, Andrew Kreps [EMAIL PROTECTED] wrote:
 PHP can be run from the command line, in which case the GET and POST
 arrays wouldn't exist.

$_GET and $_POST exist in CLI php, they are just empty initially:

#!/usr/bin/php
?php

print_r($_GET);
print_r($_POST);

$_GET['x'] = 1;
$_POST['x'] = 1;

print_r($_GET);
print_r($_POST);

?

Array
(
)
Array
(
)
Array
(
[x] = 1
)
Array
(
[x] = 1
)


-- 
Greg Donald
http://gdconsultants.com/
http://destiney.com/

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



Re: [PHP] checking multiple URL parameters

2004-09-16 Thread Andrew Kreps
On Thu, 16 Sep 2004 16:25:31 -0500, Greg Donald [EMAIL PROTECTED] wrote:
 On Thu, 16 Sep 2004 13:31:08 -0700, Andrew Kreps [EMAIL PROTECTED] wrote:
  PHP can be run from the command line, in which case the GET and POST
  arrays wouldn't exist.
 
 $_GET and $_POST exist in CLI php, they are just empty initially:
 

So, can we pass our URL to parse_url with the $_GET array, and then
use $_GET with a URL other than the one posted?  Talk about having
your cake and eating it too... :)

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



Re: [PHP] How can I have a PHP-CLI script which uses stdin open another PHP-CLI that uses stdin.....

2004-09-16 Thread Greg Donald
On Thu, 16 Sep 2004 16:40:13 -0400, Don Myers [EMAIL PROTECTED] wrote:
 All, I have a PHP Command Line Interface (CLI) script which uses stdin and
 stdout for reading and writing to/from the terminal.  Now I need to have
 that script open another PHP-CLI script which ALSO needs to uses stdin and
 stdout for reading and writing to/from the terminal. This script may in turn
 open another... and another Of course after the script ends it returns
 to the line in the script that called it and so on. Until it's done
 
 I am writing a bunch of PHP-CLI scripts which open other helper PHP-CLI
 scripts which may be called together or apart (so includes don't work)


 cat first.php second.php third.php
#!/usr/bin/php
?php
echo I am first.php\n;
system('/usr/bin/php -f ./second.php');
?

#!/usr/bin/php
?php
echo I am second.php\n;
system(/usr/bin/php -f ./third.php);
?

#!/usr/bin/php
?php
echo I am third.php\n;
?

 ./first.php
I am first.php
I am second.php
I am third.php


-- 
Greg Donald
http://gdconsultants.com/
http://destiney.com/

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



[PHP] Novice PHP Variable/Link Question

2004-09-16 Thread revDAVE
How can I use a PHP variable as the destination for a link?

? $mylink = 'thispage.htm'

a href=thispage.htmgo here/a

With var...? How do I write this?

a href=??? $mylink ???go here/a

?

--
Thanks - RevDave
[EMAIL PROTECTED]
[db-lists]

Check out some great Domain Names at:
http://www.domains4days.com

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



Re: [PHP] Novice PHP Variable/Link Question

2004-09-16 Thread Greg Donald
On Thu, 16 Sep 2004 14:54:34 -0700, revDAVE [EMAIL PROTECTED] wrote:
 How can I use a PHP variable as the destination for a link?
 
 ? $mylink = 'thispage.htm'
 
 a href=thispage.htmgo here/a
 
 With var...? How do I write this?
 
 a href=??? $mylink ???go here/a


a href=?php echo $url;??php echo $url;?/a


-- 
Greg Donald
http://gdconsultants.com/
http://destiney.com/

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



  1   2   >