Re: [PHP] php converts \ to \\, how can I stop that

2002-05-03 Thread Mike Eheler

You could also set these values in your php.ini:

magic_quotes_gpc = off
magic_quotes_runtime = off

If you do this, then remember when inserting the data into a mysql 
database, it still needs to be escaped:

$sql = sprintf(
 insert into table (id, field) values ('', '%s'),
 mysql_escape_string($fieldvalue)
);

Mike

Mikael Syska wrote:
 [EMAIL PROTECTED] (Jason Wong) wrote in news:php.general-95848
 @news.php.net:
 
 
@news.php.net:

stripslashes()

thanks, now it works

Do read up on /why/ you need it.


 
 ohhh, what do u mean???
 


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




[PHP] Re: Newbie - still working on my first script.

2002-05-03 Thread Mike Eheler

Seems to me that space in the file copy is what's causing problems. Try 
changing ads/ $File_name to ads/${File_Name}.

Just a note that doing things that way can cause big problems, 
especially on unix systems.. imagine if you went to your website and type:

http://site/index.php?File=%2Fetc%2FpasswdFile_name=hacked.txt

Also instead of copying then unlinking the file, you can avoid the above 
problem by using move_uploaded_file().

See the documentation for this command here:

http://www.php.net/manual/en/function.move-uploaded-file.php

Mike

Tgl wrote:
 I got the file to upload to my folder. But when I go to download it to my PC
 using FTP, it tells me NO SUCH FILE, but I can see it in the folder. The
 folder has read, write, execute permissions. I included the script below.
 
 I would appreciate any help.
 
 
 
 
 HTML
 HEAD
 TITLEAdvertisement Application/TITLE
 /HEAD
 BODY
 ?php
 error_reporting(E_ALL);
 /* This next conditional determines whether or not to handle the form,
 depending upon whether or not $File exists. */
 if (isset($File)) {
   print (File name: $File_nameP\n);
   print (File size: $File_sizeP\n);
   if(copy ($File, ads/ $File_name)) {
print (Your file was successfully uploaded!P\n);
   } else {
print (Your file could not be copied.P\n);
   }
   unlink ($File);
 }
 
 print (Upload a file to the server:\n);
 print (FORM ACTION=\ad_app.php\ METHOD=POST
 ENCTYPE=\multipart/form-data\\n);
 print (File INPUT TYPE=FILE NAME=\File\ SIZE=20BR\n);
 print (INPUT TYPE=SUBMIT NAME=\SUBMIT\ VALUE=\Submit!\/FORM\n);
 ?
 /BODY
 /HTML
 
 
 


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




Re: [PHP] phpMyAdmin

2002-05-03 Thread Mike Eheler

I've always found it's good to set numeric primary keys to UNSIGNED. 
Gives you a larger range, and it's not very likely those numbers are 
ever going to be negative.

Also, there is absolutely no need to check Index or Unique when you have 
selected Primary, as Primary implies both (hence why in newer versions, 
Primary/Index/Unique are radio buttons). Lastly, unless you expect to 
have a rediculous amount of records, an INT is more that sufficient 
(giving you a maximum record count of 4,294,967,295). Also, PHP's 
mysql_insert_id() doesn't support BIGINT data types.

So, the more optimised version of the keyfield would be:

  Field: keynum
  Type: INT
  Length/Values: (blank)
  Attributes: UNSIGNED
  Null: NOT NULL
  Default: (blank)
  Extra: AUTO_INCREMENT
  Primary: SELECTED
  Index: UN-SELECTED
  Unique: UN-SELECTED

Mike

Kevin Stone wrote:
 Could be something like..
 
 Field: keynum
 Type: BIGINT
 Length/Values: (blank)
 Attributes: (blank)
 Null: NOT NULL
 Default: (blank)
 Extra: AUTO_INCREMENT
 Primary: CHECKED
 Index: CHECKED
 Unique: CHECKED
 
 Field: username
 Type: VARCHAR
 Length/Values: 20
 Attributes: (blank)
 Null: NOT NULL
 Default: (blank)
 Extra: (blank)
 Primary: UNCHECKED
 Index: UNCHECKED
 Unique: UNCHECKED
 
 Field: password
 Type: VARCHAR
 Length/Values: 20
 Attributes: (blank)
 Null: NOT NULL
 Default: (blank)
 Extra: (blank)
 Primary: UNCHECKED
 Index: UNCHECKED
 Unique: UNCHECKED
 
 Note I prefer to use VARCHAR instead of PASSWORD becuase I am more
 comfortable checking the database contents in PHP rather than SQL.  But you
 can do a PASSWORD field then in your query statment use the SQL funciton
 PASSWORD($pwd) to encrypt the string.  Either way, for security, it is
 imparative that you encrypt it.
 
 The field 'keynum' is just a standard thing that I do.  It's set up to
 auto_increment so you always have a unique key to delete and update records
 on.  For more information view the SQL documentation on www.mysql.com.
 
 Hope this helps!
 -Kevin
 
 - Original Message -
 From: Rodrigo [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: Friday, May 03, 2002 10:18 AM
 Subject: [PHP] phpMyAdmin
 
 
 
Hi guys, I need some help using the phpMyAdmin, I'm trying to create a
table with three fields, one for the indexing of the database, the
second for the logins and the third for the password.

I get the following doubts:

On the table of the phpMyAdmin there are the following fields:

A field for the name of the field.
A field for the kind of information that will be stored in the field
(TINYINT,DOUBLE,TEXT...)
A field for the size of the field.
A field for the atributes of the field (BINARY, UNSIGNED, UNSIGNED ZERO
FILL)
A field for the null option (NULL, NOT NULL).
A field for an information that I don't know...
A field for the Extra(AUTO_INCREMENT).
A selectable field named primary(check it or not).
A selectable field named index(check it or not).
A selectable field named unique(check it or not).
A selectable field named Fulltext(Check it or not).

The information that I would need would be what are the configurations
that I have to put in each of these fields.
And also I would need to know a php script to access the fields, and
write to new fields.

Thanx, Rodrigo


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




Re: [PHP] Controlling Word Files (FDA Concern)

2002-05-03 Thread Mike Eheler

... which still doesn't stop you from taking screenshots of the pages, 
and printing those.

Mike

Jay Blanchard wrote:
 [snip]
 
Does anyone know of how to put a Word file on a web page without the user
being able to save it to their hard drive? And also another issue of making
it so they can't print it.

Thanks, Gary

 Aeh,
 -If one could see the content on a webpage, it has it already on it´s
 machine.
 Then it could make anything with it.
 
 joke
 You could add a VBScript to it, which formats the users harddrive, so they
 cannot
 save it, and cannot print it.
 /joke
 [/snip]
 
 You could make it into a PDF, and there is an option to not allow it to be
 printed or saved when opened. But I can still do a screen print, or I can
 use SnagIt and get a copy of it as a pic that I can print. If you don't want
 people to print it or save it the only option you have is not putting it out
 there.
 
 Jay
 
 Give a man a program, frustrate him for a day. Teach a man to program,
 frustrate him for a lifetime.
 
 
 



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




Re: [PHP] Turning OFF 'auto_prepend_file' on a page by page basis

2002-05-03 Thread Mike Eheler

In .htaccess:

auto_prepend_file /dev/null
auto_append_file /dev/null

Mike

Stefen Lars wrote:
 Usually, I use the Apache directive to add the prepend option.
 
 I already tried setting another prepend option in the apache directives, 
 but it seems one does not overwite the other. I tried prepending a blank 
 file. But that did not work. The other prepend file was prepended.
 
 When you say use ini_set(), do you mean
 
 ini_set(auto_prepend_file, /a/blank/file.php);
 
 ??
 
 
 From: Maxim Maletsky \(PHPBeginner.com\) 
 [EMAIL PROTECTED]
 To: 'Stefen Lars' [EMAIL PROTECTED], [EMAIL PROTECTED]
 Subject: RE: [PHP] Turning OFF 'auto_prepend_file' on a page by page 
 basis
 Date: Fri, 3 May 2002 15:53:16 +0200


 .htaccess


 Not sure if ini_set() will work in your case. But try.



 Sincerely,

 Maxim Maletsky
 Founder, Chief Developer

 www.PHPBeginner.com   // where PHP Begins




 -Original Message-
 From: Stefen Lars [mailto:[EMAIL PROTECTED]]
 Sent: Friday, May 03, 2002 3:02 PM
 To: [EMAIL PROTECTED]
 Subject: [PHP] Turning OFF 'auto_prepend_file' on a page by page basis


 Hello all

 I am using 'auto_prepend_file' to include a load of files.

 This is prepended to all PHP parsed files. The prepend files contain the

 HTML for the framework of my site.

 How I want to create an XML file for other web sites to use. I do this
 by
 getting some data from a database and packaging it as RSS.

 Correctly, PHP appends my prepend file HTML on top of the XML.

 I do not want that, as it produced invalid XML. :-((

 Is there a way to say, for example: Prepend this file to all files, but
 NOT
 this one?

 i.e. is it possible to 'turn off' the prepend functionality on a page by

 page basis??

 Thanks for your comments

 S.


 _
 Get your FREE download of MSN Explorer at
 http://explorer.msn.com/intl.asp.


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


 
 
 
 
 _
 Send and receive Hotmail on your mobile device: http://mobile.msn.com
 


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




Re: [PHP] php/.htaccess/.htpasswd

2002-05-03 Thread Mike Eheler

It's possible, but is it really recommended? Wouldn't the 
.htaccess/.htpasswd file have to be owned by the apache user, which 
might leave it open to being overwritten by any kind of a 
weak/exploitable script?

Mike

Josh  Valerie McCormack wrote:
 I've used the script phtaccess, which I think used the mentioned class. 
 Super easy to use.
 
 Josh
 
 On Wed, 1 May 2002, Kelly Meeks wrote:

 Is is possible to use php to admin a password file used by a 
 .htaccess file?



 You should check the File_Passwd class from PEAR.

 http://chora.php.net/cvs.php/php4/pear/File

 -- 
 Mika Tuupola http://www.appelsiini.net/~tuupola/

 
 



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




Re: [PHP] php/.htaccess/.htpasswd

2002-05-03 Thread Mike Eheler

You also can't overwrite files using the fopen() method. You'd need to 
FTP in, then delete the file, then fopen() it.. or just do the whole 
thing in one FTP session (write to a temp file, upload it, erase the 
temp file).

Mike

Miguel Cruz wrote:
 Thus leaving the FTP account's password in view of the httpd, which is 
 even worse...
 
 miguel
 
 On Fri, 3 May 2002, serj wrote:
 
You could use fopen() to connect to the file via ftp therefore keeping
the .htaccess file owned by the user for increased security. 

Josh Boughner

On Fri, 3 May 2002, Mike Eheler wrote:


It's possible, but is it really recommended? Wouldn't the 
.htaccess/.htpasswd file have to be owned by the apache user, which 
might leave it open to being overwritten by any kind of a 
weak/exploitable script?

Mike

Josh  Valerie McCormack wrote:

I've used the script phtaccess, which I think used the mentioned class. 
Super easy to use.

Josh


On Wed, 1 May 2002, Kelly Meeks wrote:


Is is possible to use php to admin a password file used by a 
.htaccess file?


You should check the File_Passwd class from PEAR.

http://chora.php.net/cvs.php/php4/pear/File

-- 
Mika Tuupola http://www.appelsiini.net/~tuupola/





-- 
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] php/.htaccess/.htpasswd

2002-05-03 Thread Mike Eheler

If someone can overwrite your .htaccess there's a chance they can also 
view files through the same exploit (possibly). They could then get your 
FTP login info, and do a lot more damage than just removing password 
access to an area.

Mike

Serj wrote:
 Im not exactly sure why that is worse, could you elaborate a little?
 Josh
 
 On Fri, 3 May 2002, Miguel Cruz wrote:
 
 
Thus leaving the FTP account's password in view of the httpd, which is 
even worse...

miguel

On Fri, 3 May 2002, serj wrote:

You could use fopen() to connect to the file via ftp therefore keeping
the .htaccess file owned by the user for increased security. 

Josh Boughner

On Fri, 3 May 2002, Mike Eheler wrote:


It's possible, but is it really recommended? Wouldn't the 
.htaccess/.htpasswd file have to be owned by the apache user, which 
might leave it open to being overwritten by any kind of a 
weak/exploitable script?

Mike

Josh  Valerie McCormack wrote:

I've used the script phtaccess, which I think used the mentioned class. 
Super easy to use.

Josh


On Wed, 1 May 2002, Kelly Meeks wrote:


Is is possible to use php to admin a password file used by a 
.htaccess file?


You should check the File_Passwd class from PEAR.

http://chora.php.net/cvs.php/php4/pear/File

-- 
Mika Tuupola http://www.appelsiini.net/~tuupola/





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






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



 



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




[PHP] Re: php/.htaccess/.htpasswd

2002-05-03 Thread Mike Eheler

The problem is not in them being able to overwrite the .htaccess *and* 
getting your FTP password.. those are the cons for both solutions we 
have presented, respectfully.

Right now the ideal solution seems to be this:

save new .htaccess to a temp file
save new .htpasswd to a temp file
use PHP's FTP routines to connect to the FTP server with your 
username/password
delete existing .htaccess
delete existing .htpasswd
upload new .htaccess
upload new .htpasswd
close connection

The biggest problem with this is that you have your FTP password in 
plain text in the script that performs this. If anyone for any reason is 
able to take advantage of some kind of exploit that allows them to view 
the source of that file, you're toast. They get ahold of your FTP 
password and have free reign on your website.

I'm open to suggestions.

serj wrote:
 Being that the files are owned by their respective users, I would imagine 
 that would make it pretty difficult for the .htaccess file to be
 overwritten, if someone found a way to overwrite the file couldn't that 
 person overwrite any file owned by the ftp user anyway? also I don't see  
 how someone being able to overwrite the .htaccess file would allow them to
 grab the ftp password, especially if this is all transmitted over ssl.  I
 apologize, I'm not trying to start a flame war that I'm sure I'll
 lose.  But, I am working on a script that does exactly this and if I'm
 doing it wrong perhaps I should begin recoding it.
 
 josh 
 
 On Fri, 3 May 2002, Mike Eheler wrote:
 
 
If someone can overwrite your .htaccess there's a chance they can also 
view files through the same exploit (possibly). They could then get your 
FTP login info, and do a lot more damage than just removing password 
access to an area.

Mike

Serj wrote:

Im not exactly sure why that is worse, could you elaborate a little?
Josh

On Fri, 3 May 2002, Miguel Cruz wrote:



Thus leaving the FTP account's password in view of the httpd, which is 
even worse...

miguel

On Fri, 3 May 2002, serj wrote:


You could use fopen() to connect to the file via ftp therefore keeping
the .htaccess file owned by the user for increased security. 

Josh Boughner

On Fri, 3 May 2002, Mike Eheler wrote:



It's possible, but is it really recommended? Wouldn't the 
.htaccess/.htpasswd file have to be owned by the apache user, which 
might leave it open to being overwritten by any kind of a 
weak/exploitable script?

Mike

Josh  Valerie McCormack wrote:


I've used the script phtaccess, which I think used the mentioned class. 
Super easy to use.

Josh



On Wed, 1 May 2002, Kelly Meeks wrote:



Is is possible to use php to admin a password file used by a 
.htaccess file?


   You should check the File_Passwd class from PEAR.

   http://chora.php.net/cvs.php/php4/pear/File

-- 
Mika Tuupola http://www.appelsiini.net/~tuupola/




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





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






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



 
 




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




[PHP] Re: php/.htaccess/.htpasswd

2002-05-03 Thread Mike Eheler

Ahh. I didn't really consider that. Excellent idea.

Mike

On Fri, 2002-05-03 at 21:58, serj wrote:
 The way I designed the script was so that each time they want to save
 changes to their htaccess file through the script they have to enter their
 password.  So I never have to actually save the password anywhere in the
 script.
 
 On Fri, 3 May 2002, Mike Eheler wrote:
 
  The problem is not in them being able to overwrite the .htaccess *and* 
  getting your FTP password.. those are the cons for both solutions we 
  have presented, respectfully.
  
  Right now the ideal solution seems to be this:
  
  save new .htaccess to a temp file
  save new .htpasswd to a temp file
  use PHP's FTP routines to connect to the FTP server with your 
  username/password
  delete existing .htaccess
  delete existing .htpasswd
  upload new .htaccess
  upload new .htpasswd
  close connection
  
  The biggest problem with this is that you have your FTP password in 
  plain text in the script that performs this. If anyone for any reason is 
  able to take advantage of some kind of exploit that allows them to view 
  the source of that file, you're toast. They get ahold of your FTP 
  password and have free reign on your website.
  
  I'm open to suggestions.
  
  serj wrote:
   Being that the files are owned by their respective users, I would imagine 
   that would make it pretty difficult for the .htaccess file to be
   overwritten, if someone found a way to overwrite the file couldn't that 
   person overwrite any file owned by the ftp user anyway? also I don't see  
   how someone being able to overwrite the .htaccess file would allow them to
   grab the ftp password, especially if this is all transmitted over ssl.  I
   apologize, I'm not trying to start a flame war that I'm sure I'll
   lose.  But, I am working on a script that does exactly this and if I'm
   doing it wrong perhaps I should begin recoding it.
   
   josh 
   
   On Fri, 3 May 2002, Mike Eheler wrote:
   
   
  If someone can overwrite your .htaccess there's a chance they can also 
  view files through the same exploit (possibly). They could then get your 
  FTP login info, and do a lot more damage than just removing password 
  access to an area.
  
  Mike
  
  Serj wrote:
  
  Im not exactly sure why that is worse, could you elaborate a little?
  Josh
  
  On Fri, 3 May 2002, Miguel Cruz wrote:
  
  
  
  Thus leaving the FTP account's password in view of the httpd, which is 
  even worse...
  
  miguel
  
  On Fri, 3 May 2002, serj wrote:
  
  
  You could use fopen() to connect to the file via ftp therefore keeping
  the .htaccess file owned by the user for increased security. 
  
  Josh Boughner
  
  On Fri, 3 May 2002, Mike Eheler wrote:
  
  
  
  It's possible, but is it really recommended? Wouldn't the 
  .htaccess/.htpasswd file have to be owned by the apache user, which 
  might leave it open to being overwritten by any kind of a 
  weak/exploitable script?
  
  Mike
  
  Josh  Valerie McCormack wrote:
  
  
  I've used the script phtaccess, which I think used the mentioned class. 
  Super easy to use.
  
  Josh
  
  
  
  On Wed, 1 May 2002, Kelly Meeks wrote:
  
  
  
  Is is possible to use php to admin a password file used by a 
  .htaccess file?
  
  
 You should check the File_Passwd class from PEAR.
  
 http://chora.php.net/cvs.php/php4/pear/File
  
  -- 
  Mika Tuupola http://www.appelsiini.net/~tuupola/
  
  
  
  
  -- 
  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
  
  
  
   
   
  
  
  
  
 
 




signature.asc
Description: This is a digitally signed message part


Re: [PHP] Re: case-insensitive str_replace

2002-05-02 Thread Mike Eheler

Well to make it case insensitive, you could change them to '/search/i'. 
Adding that /i makes them case-insensitive.

Mike

Reuben D Budiardja wrote:
 On Thursday 02 May 2002 04:08 pm, J Smith wrote:
 
preg_replace() can be used with arrays.

 
 Yeah, but how to make it case-insensitive beside changing the my search and 
 replace strings to a regular expression? The problem is that I have a big 
 array for search and replace, and it would be most labourious to change them 
 to reg exp.
 
 There should be something simpler and more elegant to do this.
 
 Thanks.
 Rdb
 
  J
 
Reuben D Budiardja wrote:

The feature that I use in str_replace is to put the 'search' and
'replace' argument as an array, as described in the documentation for php

= 4.0.5 Some people suggested some functions in the archive and

documentation, but I cannot find anything that can receive arrays as the
arguments.

So I am wondering if anyone has a function that is fully compatible with
str_replace for php  4.0.5, but case-insensitive (something like
stri_replace). I don't really want to reinvent the wheel here.

Thanks in advance.
Reuben D. Budiardja

 



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




[PHP] session_write_close() bug in 4.1.2?

2002-05-02 Thread Mike Eheler

user-defined session handlers. I'll start with how I have set up the 
handlers, please correct the process if it is wrong:

-- BOF --

function sess_open($save_path, $session_name) {
 // open a database connection
}

function sess_close() {
 // close the database connection
}

function sess_read($id) {
 // return data from saved record in db
}

function sess_write($id, $sess_data) {
 // write $sess_data to record in db
}

function sess_destroy($id) {
 // delete record from db
}

function sess_gc($maxlifetime) {
 // delete expired records from db
}

session_module_name('user');
session_set_save_handler(
 'sess_open', 'sess_close', 'sess_read', 'sess_write',
 'sess_destroy', 'sess_gc'
);

session_start();

// php code for page goes here

-- EOF --

Doing things that way, everything seems to work.. sorta.. one major 
exception, though:

function redirect_page($url){
 session_write_close();
 header(Location: ${url});
 exit();
}

session_write_close() does not call my sess_write() routine. Instead it 
seems to be using PHP's default files method every time.

Because of this, I am forced to call my lower-level routine directly:

sess_write(session_id(), serialize($_SESSION));

This works as a work-a-round, but I would much rather use PHP's 
pre-defined session_write_close(). Is this a bug or am I doing something 
wrong?

Mike


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




[PHP] Re: SESSIONS

2002-05-02 Thread Mike Eheler

Javascript cannot interact with PHP. You have to realise that the PHP 
code has been already executed long before the javascript gets a chance to.

Mike

Morten Nielsen wrote:
 Hi,
 I got a php and a javascript page. In the PHP page I register a SESSION call
 'info'. I would then like to put a value into 'info' in my javascript page.
 Is that possible?
 I have tried the following:
 
 ?php
 $INFO[value]=2;
 ?
 
 And that works fine. But when I have an IF statement like:
 
 if(x==1)
 {
$INFO[value]=1;
 }
 else
 {
$INFO[value]=2;
 }
 
 My INFO always gets the value 2 even though x is 1.
 Can anyone help?
 
 Thanks,
 Morten
 
 
 



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




Re: [PHP] srand thought

2002-05-02 Thread Mike Eheler

Yeah. If I understand correctly, if you do, like:

?php
$seed = time();

srand($seed);
$var = rand(0,50);
echo $var\n;

srand($seed);
$var2 = rand(0,50);
echo $var2\n;
?

Then, I believe, the theory is that you will get the same random 
number twice.

Mike

Miguel Cruz wrote:
 On Thu, 2 May 2002, Gerard Samuel wrote:
 
Quick question.  Im using srand to seed array_rand in a script.
I read that srand should only be called once per script under the srand 
manual page.
Im using ADODB, and that also uses srand.  Now should that warning be a 
literal warning or should that
be 'use srand once per page'??

 
 It's probably not worth worrying about unless both calls use the same seed 
 and you are generating one or more random numbers between the two srand() 
 calls that are part of the same sequence as random numbers generated after 
 the second one.
 
 miguel



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




[PHP] more session bugs?

2002-05-02 Thread Mike Eheler

Here's a test you can try yourself.

On your server, set up these two files:

test.php

?php
session_start();
if ($_REQUEST['var']) $_SESSION['var'] = $_REQUEST['var'];
?
pre?php print_r($_SESSION); ?/pre
a href=test-unset.phpClick here to unset/abr /
a href=test.php?var=valueClick here to set/a

test-unset.php
--
?php
session_start();
unset($_SESSION['var']);
session_write_close();
header(Location: test.php));
exit();
?

What's supposed to happen: You click on the set link, this sets the 
variable. You then click on the unset link. This loads another page 
which unsets the variable, saves the session, then returns you to the 
original page through a redirect.

This does not happen. When you return to test.php, the _SESSION variable 
remains. Why?

Mike


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




[PHP] Re: more session bugs?

2002-05-02 Thread Mike Eheler

Pardon the parse error in test-unset.php.

change: header(Location: test.php));
to: header(Location: test.php);

Mike

Mike Eheler wrote:
 Here's a test you can try yourself.
 
 On your server, set up these two files:
 
 test.php
 
 ?php
 session_start();
 if ($_REQUEST['var']) $_SESSION['var'] = $_REQUEST['var'];
 ?
 pre?php print_r($_SESSION); ?/pre
 a href=test-unset.phpClick here to unset/abr /
 a href=test.php?var=valueClick here to set/a
 
 test-unset.php
 --
 ?php
 session_start();
 unset($_SESSION['var']);
 session_write_close();
 header(Location: test.php));
 exit();
 ?
 
 What's supposed to happen: You click on the set link, this sets the 
 variable. You then click on the unset link. This loads another page 
 which unsets the variable, saves the session, then returns you to the 
 original page through a redirect.
 
 This does not happen. When you return to test.php, the _SESSION variable 
 remains. Why?
 
 Mike
 



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




[PHP] Re: more session bugs?

2002-05-02 Thread Mike Eheler

register_globals *is* off (I haven't touched a global variable since 
_SESSION/POST/GET/REQUEST and the like were introduced), and what about 
this is wrong behaviour?

Mike

Yasuo Ohgaki wrote:
 Disable register_globals. Then it should work.
 BTW, this is wrong behavior, but it's documented.
 
 -- 
 Yasuo Ohgaki
 
 Mike Eheler wrote:
 
 Here's a test you can try yourself.

 On your server, set up these two files:

 test.php
 
 ?php
 session_start();
 if ($_REQUEST['var']) $_SESSION['var'] = $_REQUEST['var'];
 ?
 pre?php print_r($_SESSION); ?/pre
 a href=test-unset.phpClick here to unset/abr /
 a href=test.php?var=valueClick here to set/a

 test-unset.php
 --
 ?php
 session_start();
 unset($_SESSION['var']);
 session_write_close();
 header(Location: test.php));
 exit();
 ?

 What's supposed to happen: You click on the set link, this sets the 
 variable. You then click on the unset link. This loads another page 
 which unsets the variable, saves the session, then returns you to the 
 original page through a redirect.

 This does not happen. When you return to test.php, the _SESSION 
 variable remains. Why?

 Mike



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




[PHP] Re: PHP with MySQL

2002-05-02 Thread Mike Eheler

Typically it's done like:

$db = mysql_connect('localhost','username','password');

The MySQL database detects what host you're connecting from, and appends 
that to your username. I'm not sure if it's possible to specify an 
alternate host.

So if both PHP and MySQL are on the same machine, and you connect to the 
MySQL server as 'username', MySQL will see you as 'username@localhost'.

Mike


Paras Mukadam wrote:
 Hi Gurus,
 one MySQL - PHP query : while granting permissions to particular user in
 MySQL, the administrator has to give username@machine_address !! Then how
 can we connect to MySQL through PHP only by passing username as one of the
 arguments to mysql_connect() ?
 
 Thanks.
 Paras.


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




[PHP] #!/usr/bin/php in output?

2002-03-05 Thread Mike Eheler

Having a bit of a weird problem with using PHP as CGI. The problem is
this.. the output is returning the #!/usr/bin/php line from the file.

Example:

/cgi-bin/test:

#!/usr/bin/php
?
echo Hello World!\n;
?

Then in a web browser: http://www.example.com/cgi-bin/test:

#!/usr/bin/php
Hello World!

Has anyone else experienced this problem or know what's causing it?

Mike

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




[PHP] Re: Help with an error I can't solve!

2002-03-05 Thread Mike Eheler

Is the line within a function? If so, it's possible that $HTTP_POST_VARS
hasn't been globalled.

Check to see if within the function that line is on that the line global
$HTTP_POST_VARS; exists.

Mike

On Tue, 05 Mar 2002 12:32:59 -0800, Lic. Carlos A. Triana Torres wrote:

 Hello all,
  I have been installing an easy webmail client (webmiau) which
  seems
 to work fine and is very light; but I keep receiving this error
 everytime I open a new session:
 
 Warning: Variable passed to reset() is not an array or object in
 /usr/..file.php on line 5
 --
 Line 5 of File.php: reset ($HTTP_POST_VARS);
 
Can anybody help me solve this error? What's happening? Track vars
are
 enabled...what else is missing?
Thanks before hand...
 
 --
 Lic. Carlos A. Triana Torres
 Webmaster. CIGET Sancti Spíritus
 Email: [EMAIL PROTECTED]
 Tel: 23956, 27958

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




[PHP] Re: Webmail

2002-03-05 Thread Mike Eheler

It's really quite simple. Here's a quick script that will dump all
variables sent in a form to an email address:

$email = '[EMAIL PROTECTED]';
$subject = 'Form Posted on ' . date('r');
$from = 'Your Website [EMAIL PROTECTED]';
$message = '';

// PHP up to 4.0.6
foreach ($HTTP_POST_VARS as $key = $value) {
$message .= $key: $value\n;
}

// PHP 4.1.0+
foreach ($_REQUEST as $key = $value) {
$message .= $key: $value\n;
}

mail($email, $subject, $message, From: $from);

More information can be found at
http://www.php.net/manual/en/function.mail.php

Mike

On Tue, 05 Mar 2002 12:48:29 -0800, Webmaster - Myonlinesite.Co.Uk And
.Com wrote:

 Hi
 
 can anyone quickly run through how to use php to send the contents of a
 form via e-mail using sendmail? How do you begin?
 
 thanks
 
 [EMAIL PROTECTED]

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




[PHP] Re: Value of $_* variables

2002-03-05 Thread Mike Eheler

$result = mysql_query(select user from users where id = $_SESSION[id], 
$db);

No need to quote the key name in a string

Mike

James Taylor wrote:
 I'm sure this has been asked before, but at least not within the last 600 
 messages (i checked):
 
 I have the session variable $_SESSION['id'] set  Well, I want to actually 
 check the value of this variable, not just to check if it's set  I would be 
 doing this in a mysql query mainly  Something like:
 
 $result = mysql_query(select user from users where id = $_SESSION['id], 
 $db);
 
 That just doesn't work, so I have to first go:
 
 $sid = $_SESSION['id'];
 $result = mysql_query(select user from users where id = $sid, $db);
 
 Anyway to get around this?
 



-- 
PHP General Mailing List (http://wwwphpnet/)
To unsubscribe, visit: http://wwwphpnet/unsubphp




Re: [PHP] #!/usr/bin/php in output?

2002-03-05 Thread Mike Eheler

-q supresses the output of headers:

Content-type: text/html
X-Powered-By: PHP/4.1.1

But in any event I tried it.. now the page gives me an error:

No input file specified.

The first few lines look like:

#!/usr/bin/php -q
Content-type: text/html

pre

Mike

Aaron Gould wrote:
 Try adding a -p argument to the end of that line:
 
 #!/usr/bin/php -q
 
 --
 Aaron Gould
 [EMAIL PROTECTED]
 Web Developer
 
 
 - Original Message - 
 From: Mike Eheler [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: Tuesday, March 05, 2002 3:43 PM
 Subject: [PHP] #!/usr/bin/php in output?
 
 
 
Having a bit of a weird problem with using PHP as CGI. The problem is
this.. the output is returning the #!/usr/bin/php line from the file.

Example:

/cgi-bin/test:

#!/usr/bin/php
?
echo Hello World!\n;
?

Then in a web browser: http://www.example.com/cgi-bin/test:

#!/usr/bin/php
Hello World!

Has anyone else experienced this problem or know what's causing it?

Mike

-- 
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] #!/usr/bin/php in output?

2002-03-05 Thread Mike Eheler

It needs to run as a CGI script.

The reason is maybe it needs to be a dual-purpose script that can be run 
from the console, or from the web, or maybe it needs to run as a user 
other than the web server. Whatever my actual reason is doesn't matter, 
but trust me, the script must be run as a CGI.

Mike

Anas Mughal wrote:
 Why do you have #!/usr/bin/php in your script?!
 You are running it thru the webserver. You shouldn't
 need that line.
 
 
 
 --- Mike Eheler [EMAIL PROTECTED] wrote:
 
Having a bit of a weird problem with using PHP as
CGI. The problem is
this.. the output is returning the #!/usr/bin/php
line from the file.

Example:

/cgi-bin/test:

#!/usr/bin/php
?
echo Hello World!\n;
?

Then in a web browser:
http://www.example.com/cgi-bin/test:

#!/usr/bin/php
Hello World!

Has anyone else experienced this problem or know
what's causing it?

Mike

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


 
 
 =
 Anas Mughal
 [EMAIL PROTECTED]
 [EMAIL PROTECTED]
 Tel: 973-249-6665
 
 __
 Do You Yahoo!?
 Try FREE Yahoo! Mail - the world's greatest free email!
 http://mail.yahoo.com/
 


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




[PHP] Re: Basic help for radio buttons needed

2002-03-05 Thread Mike Eheler

First, change your form tag to:

form method=post action=adminphp

Post's are better, and to be standard-compliant it should be defined 
lower-case Then in adminphp, just to see what is being returned, do:

pre? print_r($_POST); ?/pre

Replace $_POST with $HTTP_POST_VARS if you're using a version of PHP 
older than 410

If still there is nothing, then change admin_do[] to simply admin_do 
Radio buttons only return the value of the button that was selected, so 
it's not really necessary to make an array out of a radio button

Mike

Wg4- Cook wrote:
 Hi all,
 
 I am sure this is a very simple question, but after reading reams of doco I
 still can't find the answer   I am very new to PHP and HTML coding   
 
 I have a form (html) that uses radio buttons that goes to some PHP code -
 how in the PHP code can I tell which radio button was selected?
 
 My HTML code (which is inside another PHP page) is as follows   
 
 form action=adminphp method=GET
 input type=radio  name=admin_do[] value=Add new userAdd new
 user/br
 input type=radio  name=admin_do[] value=Change User passwordChange
 User password/br
 input type=radio  name=admin_do[] value=Delete userDelete User/br
 input type=radio  name=admin_do[] value=Add new documentAdd new
 document/br
 br
 input type=submit name=submit value=Select
 /form
 
 
 I have tried various things in adminphp but nothing gives me which radio
 button was selected
 
 TIA
 
 Janet
 
 



-- 
PHP General Mailing List (http://wwwphpnet/)
To unsubscribe, visit: http://wwwphpnet/unsubphp




Re: [PHP] timestamp iin MySQL not compatible to the one in PHP???

2002-03-05 Thread Mike Eheler

The long way, but it will help in the understanding of it:

$timestamp = 20020305211704;
$year = substr($timestamp, 0, 4);
$month = substr($timestamp, 4, 2);
$day = substr($timestamp, 6, 2);
$hour = substr($timestamp, 8, 2);
$minute = substr($timestamp, 10, 2);
$second = substr($timestamp, 12, 2);
$utime = mktime($hour, $minute, $second, $month, $day, $year);
$longdate = date('l, F jS, Y @ g:i:sp');

echo $longdate;

Will produce:

Tuesday, March 5th, 2002 @ 9:17:04pm

Mike

Andy wrote:
 So what is the proper function in PHP to convert the MySQL timestamp into a
 proper format like Sonday, Apr. 20th 2002?
 
 Thanx,
 
  Andy
 
 
 Jason Wong [EMAIL PROTECTED] schrieb im Newsbeitrag
 news:[EMAIL PROTECTED]...
 
On Wednesday 06 March 2002 04:31, Andy wrote:

Hi there,

I am playing around with the timestamp functions. I created a timestamp
with mysql ( the row is timestamp)
and do reformat this thing after selecting with php in the folowíng way:

 $date_posted[$i] = strftime(%A, %d-%m-%Y %R, $date_posted[$i]);

This always returns Tuesday, 19-01-2038 but the mysql timestamp says:
20020305211704

They return the time in different formats. Read the MySQL manual then read
the PHP manual (or vice-versa).

The MySQL timestamp is human readable. So in your example above:

20020305211704 == 2002-03-05 21:17:04

time() in PHP is the number of seconds since the Unix Epoch.

--
Jason Wong - Gremlins Associates - www.gremlins.com.hk

/*
But, officer, he's not drunk, I just saw his fingers twitch!
*/

 
 



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




[PHP] Re: Problems with date function

2002-02-01 Thread Mike Eheler

? echo date(m d  
Y,strtotime(odbc_result($resultado,'fechaasignacion')));?

date accepts unix timestamps, not strings, so you have to convert that 
string to a unix time with strtotime.

Mike

Jorge Arechiga wrote:
 Hi everybody
   
 I hope someone can help me in an issue on where i've been stuck for a while.
 I'm trying to show a date from a Table in SQLServer7
 when i use this :
   trtd align=right width=60%? echo
 (odbc_result($resultd1,'date1'));?/td/tr
 
 the browser shows me the date correctly and the result is this:  2002-02-01
 11:31:00
 Obviously i want to format the date so i use the date() function and the
 code is like this:
   trtd align=right width=60%? echo date(m d
 Y,odbc_result($resultado,'fechaasignacion'));?/td/tr
 
 But when i want to see the date in the browser the date doesn´t match with
 the real date and the result is this:
 
   12 31 1969
 Does anybody knows how coul i fix this, so the displayed date matches with
 the one that is in the database?
 Thank a lot
 George
   
 


-- 
We warn the reader in advance that the proof presented here depends on a
clever but highly unmotivated trick.
-- Howard Anton, Elementary Linear Algebra


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




[PHP] getting a list of all php functions

2002-02-01 Thread Mike Eheler

Okay, my goal is to compile an array of *all* functions currently 
defined and available in PHP 4.1.1.

That's a simple task if all I want is functions for the extensions I 
chose to compile into PHP (get_defined_functions()), but what about the 
other ones? Is there a place somewhere that has a text file that I can 
just read line-by-line or perhaps comma separated?

Or maybe a version of PHP I can download which has all extensions built in?

Mike
-- 
Taxes are not levied for the benefit of the taxed.


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




Re: [PHP] getting a list of all php functions

2002-02-01 Thread Mike Eheler

That'll do! Thanks!

Mike

Jason Wong wrote:
 On Saturday 02 February 2002 02:29, Mike Eheler wrote:
 
Okay, my goal is to compile an array of *all* functions currently
defined and available in PHP 4.1.1.

That's a simple task if all I want is functions for the extensions I
chose to compile into PHP (get_defined_functions()), but what about the
other ones? Is there a place somewhere that has a text file that I can
just read line-by-line or perhaps comma separated?

Or maybe a version of PHP I can download which has all extensions built in?


 
 Have you tried the function index in the manual?
 
 
 
 


-- 
When the only tool you have is a hammer, you tend to treat everything as if
it were a nail.
-- Abraham Maslow


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




[PHP] Re: Email Attachment

2002-02-01 Thread Mike Eheler

That's because it's not a specific feature of mail sending/php's mail 
features.

Instead you should look around for code examples that achieve this, as 
it is no small task, and will require that you learn a good deal about 
MIME and how files are attached to emails.. a good place to start 
would be http://phpclasses.upperdesign.com/

Mike Eheler
SearchBC.com Technical Support

Mauricio Sthandier wrote:
 Hello, I'm new in php development... I was wondering how can I attach a Word
 (.doc) Document in an email sent with the mail() function (if I can do it
 just with it).
 
 I know it has to see with the additional headers of the email, but I would
 be grateful If anyone could tell where can i go to for this specific
 information.
 
 I couldn't find it in PHP manual (.pdf version).
 
 Thanxs !
 
 
 
 


-- 
Animals can be driven crazy by putting too many in too small a pen.
Homo sapiens is the only animal that voluntarily does this to himself.
-- Lazarus Long

-BEGIN PGP PUBLIC KEY BLOCK-
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see http://www.gnupg.org

mQGiBDxa9oIRBACuGtJ4G2Clyv695SU3Mw88UG4EO5BoAUrvWaa7263EW6DWpHaB
FxJutSyohKbHwlhpVBo8shQ3mD0WP8lhxZuetPs/KmWDu1Vqln+41MxCX5Pm3INt
64UxM2T/YPIOhjwGNlEtu2mcQGwkNCKzihc2m0yzXvBOeqQXrZXdz93BQwCgrYS8
rO+mXPjoe1QQ5UWHSjye07ED/j7VJSnqNeUuv3ZCJ+DII3n9IhSPrykRkBN4PejD
RT8PDhbqqHb69U/+KVNSw3u7yLqD+6T/deR147G8cJ8/AIckGfgB+SaNXAJ1dDK0
2QH/wQiQp+9qlqJJAgfb2TrdK041z0m9qv5s0EpDEsTxoxLbBWLSE0w1xqrFYUHd
abQPA/9kJgA3yts6M+shtRQSg7QGvChuT5IerDHBZ+TkHnXbpZ5qTW/WBFZMn3oE
pqVtwmArndQYwwgu09j48EXDqnNCRoUwaEg458mi0F3cAqL34l0Hi8OYDkV53+UL
anUaTHFJCSAmfenCyeM+jsNNyq4JU5cAu1B26IetTRgZTNMlsbQjTWlrZSBFaGVs
ZXIgPG1pa2VAaWRlYXJlc291cmNlLmNvbT6IVwQTEQIAFwUCPFr2ggULBwoDBAMV
AwIDFgIBAheAAAoJEKrKiKGSvUb6Sb4AoJR3wyrB/cFRdRixW0pekAOUthxvAJ4k
A1OrTC+CmUqjP4frbdGQ3IreIbkBDQQ8WvaJEAQA7Qtz4irfoq4etWr6uMX1WsTS
G6TK6EL+A1UCOZchK9Hs/cbdKLzP0kr4Ic7NjP2oF925qCi90g/nuKU5rp/Qv9ns
GPaRiczyNRgt3DTK+vqe0zBvgH6JnL4KC1aKdGUESQaJGvsvrHC9oXyjfzQHZRzL
7nM5N7kMjW3oFVxvvwsAAwYD/in3u7k3QQijKGTv3hSuTFy94PqLVTaFPR6wPRvj
2Fkp9siVzg6Jxt2eEpxOK/gEBNe5C5JB1vemMoOesoRg2UGaa/k4t7o+RYop2VKo
wsiCUQ8y/115WZ+4l1vrG0PstfQD3lFUoM6ThGThEZ/k8Hu/dIJE8noZdpAHwCer
X5T9iEYEGBECAAYFAjxa9okACgkQqsqIoZK9RvpR8ACdE6TAt/xh5WnuF6nqcCJy
GmgiO74An27yM1es2sp4uLheLGBpCCcF1fM2
=F/K7
-END PGP PUBLIC KEY BLOCK-


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




[PHP] Reading config files

2002-01-24 Thread Mike Eheler

Hiya,

Just looking for some tips on reading formatted config files. The config 
file is pretty strictly formatted.. here's an example:

# this is a comment. any text on a line after a # should be ignored
section section1 {
 option value;
 option-array {
 value 1;
 1234; # numerical value
 anothervalue; # text without quotes
 };
 option-array-on-one-line { value1; value 2; 46; };
};

That's kind of a worst-case scenario. Most sections will only have 1-2 
options, and not contain subsections, etc.. but some do contain it, so 
is why I constructed this. I'm not looking for actual code, exactly.. 
more or less tips on where to start. Should I come up with a magical 
regexp that can sift through the data, or some kind of recursive 
function that reads values and returns arrays with the values..

Values are always terminated by a ; character, unless of course that ; 
character lies within quotes. Pretty standard stuff, but it's my first 
attempt at parsing something this complex.

Any kind of help on this is appreciated.

Mike
-- 
Most burning issues generate far more heat than light.


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




[PHP] Re: MySQL query question

2002-01-24 Thread Mike Eheler

Let's say you have this table, pseudo-coded:

TABLE table
   tableid int auto_increment,
   value text
;

You could run this query on it:

insert into table values ('','value');

And the id will be auto generated. Same would apply with:

inert into table (value) values ('value');

Mike


Phil Schwarzmann wrote:
 Okay, so when I INSERT a row of information into a MySQL database, I
 don't want it to place it at the first empty row it findsI want it
 to put it after the very last exsisting row.
 
 One of the fields of the database is an AUTO_INCREMENT type, so Im
 assuming Im gonna use that in the query.
 
 How would I write a query to do this??
 
 THANKS!!
 
 


-- 
At no time is freedom of speech more precious than when a man hits his
thumb with a hammer.
-- Marshall Lumsden


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




[PHP] Re: RFE: $HTTP_POST_VARS = $_POST;

2002-01-24 Thread Mike Eheler

I disagree based simply on two points:

a) Ideally, the $HTTP_POST/GET and $_POST/$_GET vars should be treated 
as read only.

b) There is no good reason to mix the two. Consistancy is the ideal. If 
you are working on an existing project, and you have the implied need to 
assign values to keys to request variables, then continue to use 
$HTTP_GET_VARS. There is no reason to *not* use $_GET/POST if you're 
working on a new project, and even less of a reason to MIX 
$HTTP_POST/GET and $_POST/GET.

c) What would you expect to happen if you altered a request variable 
that was stuffed in $_REQUEST?

d) $GLOBALS['HTTP_POST_VARS']['my_form_var'] is waaay too long. When 
I code, I want to complete it as quickly as I can, while maintaining 
quality. Things get too complex when I have to use 40 characters just to 
access a single variable.

Of course, that's just one LAMP's opinion.

Mike

Robert Ames wrote:
 This is the second time in as many weeks that we have been bitten by the
 fact that $_POST != $HTTP_POST_VARS;  Attached is a real-world example of
 why it is currently bad practice to use the _POST variables.
 
 I cannot recommend that anyone use $_POST[..] in their scripts.
 $GLOBALS['HTTP_POST_VARS'][..] is a much safer, portable, and sane
 solution, unless $HTTP_POST_VARS is marked as depracated, scheduled to be
 phased out.
 
 For those new to the problem, $_GET and $HTTP_GET_VARS are two totally
 separate arrays which happen to hold the same data at the beginning of
 script execution.  After script execution has begun, it is VERY DANGEROUS
 to modify the data contained in either of these arrays, because changes
 in one are not propagated to the other.
 
 The simplest example script is:
 ?php
   echo $_GET['test'];
   echo $HTTP_GET_VARS['test'];
   $_GET['test'] = 'changed.';
   echo $_GET['test'];
   echo $HTTP_GET_VARS['test'];
 ?
 
 ...The second set of echo statements will print two different values.
 
 The situation is worse when you are trying to integrate the usage of
 $_GET/$_POST into scripts which already make use of $HTTP_*_VARS.
 
 The following script is my real-world example of a difficult to trace
 logic bug caused by $_POST != $HTTP_POST_VARS.
 
 The situation is that we have a form with a radio button toggling between
 two input elements as follows.
 
   PRICING:
   
   ( ) Fixed: $[__]
   ( ) Negot: $[__]
 
 The radio field is named option, and the two input fields are named
 asking1 and asking2 respectively.  On the back end, we store whether
 the user selected fixed or negotiable, and then 'push' asking1 or
 asking2 into a variable called asking_price.  We don't care which field
 they type the price into, but asking1 and asking2 must be named
 differently so that the browser will not stomp asking prices over each
 other when posting the information.
 
 Our function gpc stands for Get/Post/Cookie, and is very similar to
 the new $_REQUEST array, except that it returns FALSE if nothing was
 posted, preventing us from having to do: 
   if( isset($_REQUEST['blah']) ) 
 $result = $_REQUEST['blah'];
 
 (because we run with E_NOTICE  E_ALL, and have register_globals turned off)
 ...instead, we can say:
$result = gpc('blah');
 
 ...anyway, we've been using PHP for a while now (since well before 4.1
 ;^), and already have many many scripts and libraries which use the
 HTTP_*_VARS method of accessing things.  It is unsafe to use $_GET and
 $HTTP_GET_VARS in the same environment.
 
 My proposed solutions again:
 
 1) Temporary workaround: $HTTP_GET_VARS = $_GET;
 2) Throw an E_NOTICE if $HTTP_*_VARS or $_* is used as the left-hand side
 of an assignment. (ie: officially discourage changing $HTTP_*_VARS)
 3) Propagate any changes made to $_GET over to $HTTP_GET_VARS and
 $_REQUEST.
 
 #1 works for the most part, but changes is $_GET are not propagated into
 $_REQUEST, which opens the door for more data inconsistency issues.
 
 #2 could possibly be implemented by making $HTTP_*_VARS and $_* into
 constants... forcing them to be read only.
 
 #3 sounds like it would be annoying to implement, but would make it
 easiest for end-users to use PHP, and have some nice things happen
 'magically'.
 
 --Robert
 (crossposting to php.general because I'm sure other people might be
 running into this problem as well).
 
 
 ?PHP
 
 ## example script
 
 /* return the user-submitted value of $varname, or false if not found */
 function gpc( $varname )
 {
   if( isset( $GLOBALS['HTTP_GET_VARS'][$varname] ) )
 return( $GLOBALS['HTTP_GET_VARS'][$varname];
   elseif( isset( $GLOBALS['HTTP_POST_VARS'][$varname] ) )
 return( $GLOBALS['HTTP_POST_VARS'][$varname];
   elseif( isset( $GLOBALS['HTTP_COOKIE_VARS'][$varname] ) )
 return( $GLOBALS['HTTP_COOKIE_VARS'][$varname];
   else
 return( FALSE );
 }
 
 $option = gpc('price_option');
 if ( $option == 'fixed' )
 {
   $_POST['asking_price'] = isset($_POST['asking1']) ? $_POST['asking1'] : '';
 }
 elseif ( $option == 

[PHP] Re: RFE: $HTTP_POST_VARS = $_POST;

2002-01-24 Thread Mike Eheler

Just a correction on that. It started as two points, then grew into 4.. 
I should proof read more often ;)

Mike

Mike Eheler wrote:
 I disagree based simply on two points:
 
 a) Ideally, the $HTTP_POST/GET and $_POST/$_GET vars should be treated 
 as read only.
 
 b) There is no good reason to mix the two. Consistancy is the ideal. If 
 you are working on an existing project, and you have the implied need to 
 assign values to keys to request variables, then continue to use 
 $HTTP_GET_VARS. There is no reason to *not* use $_GET/POST if you're 
 working on a new project, and even less of a reason to MIX 
 $HTTP_POST/GET and $_POST/GET.
 
 c) What would you expect to happen if you altered a request variable 
 that was stuffed in $_REQUEST?
 
 d) $GLOBALS['HTTP_POST_VARS']['my_form_var'] is waaay too long. When 
 I code, I want to complete it as quickly as I can, while maintaining 
 quality. Things get too complex when I have to use 40 characters just to 
 access a single variable.
 
 Of course, that's just one LAMP's opinion.
 
 Mike
 
 Robert Ames wrote:
 
 This is the second time in as many weeks that we have been bitten by the
 fact that $_POST != $HTTP_POST_VARS;  Attached is a real-world example of
 why it is currently bad practice to use the _POST variables.

 I cannot recommend that anyone use $_POST[..] in their scripts.
 $GLOBALS['HTTP_POST_VARS'][..] is a much safer, portable, and sane
 solution, unless $HTTP_POST_VARS is marked as depracated, scheduled to be
 phased out.

 For those new to the problem, $_GET and $HTTP_GET_VARS are two totally
 separate arrays which happen to hold the same data at the beginning of
 script execution.  After script execution has begun, it is VERY DANGEROUS
 to modify the data contained in either of these arrays, because changes
 in one are not propagated to the other.

 The simplest example script is:
 ?php
   echo $_GET['test'];
   echo $HTTP_GET_VARS['test'];
   $_GET['test'] = 'changed.';
   echo $_GET['test'];
   echo $HTTP_GET_VARS['test'];
 ?

 ...The second set of echo statements will print two different values.

 The situation is worse when you are trying to integrate the usage of
 $_GET/$_POST into scripts which already make use of $HTTP_*_VARS.

 The following script is my real-world example of a difficult to trace
 logic bug caused by $_POST != $HTTP_POST_VARS.

 The situation is that we have a form with a radio button toggling between
 two input elements as follows.

   PRICING:
   
   ( ) Fixed: $[__]
   ( ) Negot: $[__]

 The radio field is named option, and the two input fields are named
 asking1 and asking2 respectively.  On the back end, we store whether
 the user selected fixed or negotiable, and then 'push' asking1 or
 asking2 into a variable called asking_price.  We don't care which field
 they type the price into, but asking1 and asking2 must be named
 differently so that the browser will not stomp asking prices over each
 other when posting the information.

 Our function gpc stands for Get/Post/Cookie, and is very similar to
 the new $_REQUEST array, except that it returns FALSE if nothing was
 posted, preventing us from having to do:   if( 
 isset($_REQUEST['blah']) ) $result = $_REQUEST['blah'];

 (because we run with E_NOTICE  E_ALL, and have register_globals 
 turned off)
 ...instead, we can say:
$result = gpc('blah');

 ...anyway, we've been using PHP for a while now (since well before 4.1
 ;^), and already have many many scripts and libraries which use the
 HTTP_*_VARS method of accessing things.  It is unsafe to use $_GET and
 $HTTP_GET_VARS in the same environment.

 My proposed solutions again:

 1) Temporary workaround: $HTTP_GET_VARS = $_GET;
 2) Throw an E_NOTICE if $HTTP_*_VARS or $_* is used as the left-hand side
 of an assignment. (ie: officially discourage changing $HTTP_*_VARS)
 3) Propagate any changes made to $_GET over to $HTTP_GET_VARS and
 $_REQUEST.

 #1 works for the most part, but changes is $_GET are not propagated into
 $_REQUEST, which opens the door for more data inconsistency issues.

 #2 could possibly be implemented by making $HTTP_*_VARS and $_* into
 constants... forcing them to be read only.

 #3 sounds like it would be annoying to implement, but would make it
 easiest for end-users to use PHP, and have some nice things happen
 'magically'.

 --Robert
 (crossposting to php.general because I'm sure other people might be
 running into this problem as well).


 ?PHP

 ## example script

 /* return the user-submitted value of $varname, or false if not found */
 function gpc( $varname )
 {
   if( isset( $GLOBALS['HTTP_GET_VARS'][$varname] ) )
 return( $GLOBALS['HTTP_GET_VARS'][$varname];
   elseif( isset( $GLOBALS['HTTP_POST_VARS'][$varname] ) )
 return( $GLOBALS['HTTP_POST_VARS'][$varname];
   elseif( isset( $GLOBALS['HTTP_COOKIE_VARS'][$varname] ) )
 return( $GLOBALS['HTTP_COOKIE_VARS'][$varname];
   else
 return( FALSE );
 }

 $option = gpc('price_option

[PHP] Re: Speed test: mysql query vs. file_exists()

2002-01-24 Thread Mike Eheler

That would probably give you more control over the data.. however is not 
really an ideal solution. Also, if you want speed.. go with the file method.

That's how I'd do it, anyhow.

Mike

Qartis wrote:
 I'm running a logs system where log entries are .log files with filenames
 like 03012002.log for January 3rd, 2002. You can view when logs have been
 posted with a calendar, which will make the particular day a link if that
 day's log file exists. I'm thinking of storing the log entries in a mysql
 database, using code somewhat like the following:
 
 $query = select username, log, date_format(date, '%a %b %D') as date, from
 logswhere username = $username;
 $dates =  mysql_db_query($bb_news_db, $query) or die(Select Failed!);
 while ($row = mysql_fetch_array($dates)) {
 $date[row[$dates]]=1;
 }
 
 So that each log entry would be put in the $date[] array, and then when the
 calendar script wanted to find out if there was an entry by that user on
 that particular day, it would just have to check the $date[] array.Will
 there be any speed difference between this and my current (file_exists();)
 method?
 
 
 
 
 


-- 
Today when a man gets married he gets a home, a housekeeper, a cook, a 
cheering
squad and another paycheck.  When a woman marries, she gets a boarder.


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




[PHP] Re: wierd function behavior within classes.. Bug?

2002-01-24 Thread Mike Eheler

PHP doesn't support that.

Dunno if it plans to, either.

There are workarounds.. can't remember exactly how it's done, but I 
think I saw it on phpbuilder.com in a tutorial somewhere.

Mike

Marc Swanson wrote:
 I'm not sure if this is a known feature in php.. but the following code will 
 generate this warning:  Warning: Missing argument 2 for foo() in 
 /raid/htdocs/test.php on line 7
 -
 ?
 class Foo {
 function Foo($bar) {
 // no argument constructor
 echoOne argument Constructor.\nbr\n;
 }
 function Foo($bar,$baz) {
 // one argument constructor
 echoTwo argument constructor.\nbr\n;
 }
 }
 
 $foo = new Foo(foobared constructor);
 ?
 -
 while simply swapping the functions around removes the warning
 
 -
 ?
 class Foo {
 function Foo($bar,$baz) {
 // one argument constructor
 echoTwo argument constructor.\nbr\n;
 }
 function Foo($bar) {
 // no argument constructor
 echoOne argument Constructor.\nbr\n;
 }
 
 }
 $foo = new Foo(foobared constructor);
 ?
 --
 
 
 This is running on php version 4.0.3pl1
 Is it supposed to be this way for some reason or is this a bug?  I believe I 
 found that it happens with all functions within a class (not just 
 constructors).
 
 Thanks
 
 
 


-- 
It is Fortune, not Wisdom, that rules man's life.


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




[PHP] Re: Feature Suggestion

2002-01-18 Thread Mike Eheler

range() is good, but what I was getting at was a 
shorthand/shortcut/alternate syntax kinda thing.

Mike

Julio Nobrega Trabalhando wrote:

 ?php
 $array = range('a','z');
 ?
 
   As usual your mileage may vary but it worked here :-)
 
 --
 
 Julio Nobrega.
 
 Um dia eu chego lá:
 http://sourceforge.net/projects/toca
 
 Ajudei? Salvei? Que tal um presentinho?
 http://www.submarino.com.br/wishlistclient.asp?wlid=664176742884
 
 
 Mike Eheler [EMAIL PROTECTED] wrote in message
 [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 
If this is the wrong place for it, please point me to the right place.
This is real small, though.. I'd like to see a shorthand for defining
arrays.. for example

$ucase_alphabet = array(['A'..'Z']); (creates an array of all alphabet
characters, uppercase)
$numeric = array([1..100]);

Or something of that sort. Just something that popped into my mind. PHP
feels like a language that has been built on little suggestions like
this, so I thought I'd post it. :)

Mike


 
 


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




[PHP] Feature Suggestion

2002-01-17 Thread Mike Eheler

If this is the wrong place for it, please point me to the right place. 
This is real small, though.. I'd like to see a shorthand for defining 
arrays.. for example

$ucase_alphabet = array(['A'..'Z']); (creates an array of all alphabet 
characters, uppercase)
$numeric = array([1..100]);

Or something of that sort. Just something that popped into my mind. PHP 
feels like a language that has been built on little suggestions like 
this, so I thought I'd post it. :)

Mike


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




[PHP] Compiling PHP with imap recode support

2002-01-15 Thread Mike Eheler

I get this error when compiling php with ./configure 
--with-imap=../imap-2001a --with-record

Any ideas on a workaround for this?

/web/src/imap-2001a/c-client/libc-client.a(misc.o): In function 
`hash_lookup':
/web/src/imap-2001a/c-client/misc.c:311: multiple definition of 
`hash_lookup'
/usr/lib/gcc-lib/i586-mandrake-linux-gnu/2.96/../../../librecode.a(hash.o)(.text+0xa20):
 
first defined here
/usr/bin/ld: Warning: size of symbol `hash_lookup' changed from 126 to 
112 in misc.o

Mike


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




[PHP] Re: Compiling PHP with imap recode support

2002-01-15 Thread Mike Eheler

Of course by --with-record I meant --with-recode

Mike

Mike Eheler wrote:

 I get this error when compiling php with ./configure 
 --with-imap=../imap-2001a --with-record
 
 Any ideas on a workaround for this?
 
 /web/src/imap-2001a/c-client/libc-client.a(misc.o): In function 
 `hash_lookup':
 /web/src/imap-2001a/c-client/misc.c:311: multiple definition of 
 `hash_lookup'
 
/usr/lib/gcc-lib/i586-mandrake-linux-gnu/2.96/../../../librecode.a(hash.o)(.text+0xa20):
 
 first defined here
 /usr/bin/ld: Warning: size of symbol `hash_lookup' changed from 126 to 
 112 in misc.o
 
 Mike
 


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




[PHP] Limiting CPU usage/time of spawned processes

2002-01-09 Thread Mike Eheler

Hi There,

Okay, I have a server that allows a couple hundred virtual hosts that we 
have run websites as we are a hosting company. Recently one of our 
customers decided to spawn lynx through PHP. The process was running at 
80% cpu for over 400 minutes, and it appears that Apache's RLimitCPU 
directive had no effect on this.

Is there any directives in PHP which can perform the same feat (i.e. 
killing a process for running for too long, or limiting it's CPU usage).

Thanks,
 Mike


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




[PHP] Re: PHP vs. ASP

2002-01-09 Thread Mike Eheler

Well being a former ASP programmer and a current PHP programmer I think 
I can help you there.

The key point is ease of use. PHP provides far more functionality than 
ASP (try finding a function to print out the date in ASP.. yeah, I 
thought so), while at the same time giving you access to low-level areas 
of the language so that you can really make it do whatever you want.

Oh yeah, and it's OpenSource. Make it do what you want, and if that 
doesn't suit your fancy, then change it :)

ASP costs  -- the server (be it Windows or Unix-based) is gonna cost 
ya, any extensions to do more advanced things (such as creating images 
on the fly) is gonna cost ya.. cost cost cost.

With ASP I was constantly running into roadblocks because of the way it 
works. Let's take form submission.. or beyond that.. uploading FILES. 
You can do it the long, hard way (write your own MIME handler and parse 
the incoming binary data), or the easy way (shell out $$$ to pay for a 
professional activex com object to do the job for you).

And if that wasn't enough. ASP is just plain slower.

Well, that's my 2 cents. There's plenty of more points that could be 
said, but I think this should give you some good arguments to start with.

Mike

Jake wrote:

 Hello there, I need some help.
 
 I have to do a technical report(about 2200 words) comparing PHP to ASP.  I
 have already decided to make PHP the winner becasue it is superior.  But I
 am kinda stumped on what areas to compare the two.
 
 If you could help me out in suggesting some possible areas of comparison.
 Keeping in mind that I need about the same amount of info on both PHP and
 ASP.  Also if you could point me in the right direction by including some
 web links that deal with the topic.
 
 Thank You,
 Jake
 
 
 


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




[PHP] PHP 4.1 crypt()

2002-01-08 Thread Mike Eheler

Is there any way to force PHP 4.1's crypt to generate crypt's with 
2-letter salts? We've written some apps that do things the hack way -- 
if (crypt($pass,substr($pass,0,2)) == $cryptpass) -- and changing all of 
them to work the extended way is a real pain the arse. That includes 
changing all our password generation code to create 2-letter salts.

Any help much appreciated.

In short -- I want crypt() to work like it did in 4.0.6.

Mike


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




Re: [PHP] PHP 4.1 crypt()

2002-01-08 Thread Mike Eheler

It's too late for that. And I don't believe that the system's crypt() 
function just magically changed at exactly the same time we upgraded to 
PHP 4.1

Mike

Patrik Wallstrom wrote:

 On Tue, 8 Jan 2002, Mike Eheler wrote:
 
 
Is there any way to force PHP 4.1's crypt to generate crypt's with
2-letter salts? We've written some apps that do things the hack way --
if (crypt($pass,substr($pass,0,2)) == $cryptpass) -- and changing all of
them to work the extended way is a real pain the arse. That includes
changing all our password generation code to create 2-letter salts.

Any help much appreciated.

In short -- I want crypt() to work like it did in 4.0.6.

 
 This is exactly the reason you should use a specific standard hash
 algorithm like MD5 or SHA-1 when encrypting passwords. The PHP crypt()
 call uses the system call crypt(), which might vary between different
 systems.
 
 Look at the PHP man pages for crypt() and the mcrypt package for more info
 on the subject. With mcrypt you can use whatever crypto function you need
 for compatibility.
 
 http://www.php.net/manual/en/function.crypt.php
 http://www.php.net/manual/en/ref.mcrypt.php
 
 --
 patrik_wallstrom-foodfight-[EMAIL PROTECTED]+46-709580442
 
 


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




Re: [PHP] PHP 4.1 crypt()

2002-01-08 Thread Mike Eheler

Too late for that, too.. in addition to providing web hosting for 
hundreds of sites, we are also a web development company and have 2 
major websites out there using extended php 4.1 features.

We need STD_DES, and it appears that PHP 4.1 has switched to using MD5 
by default.

Thanks for your help! I'll see what I can do.

Mike

Patrik Wallstrom wrote:

 On Tue, 8 Jan 2002, Mike Eheler wrote:
 
 
It's too late for that. And I don't believe that the system's crypt()
function just magically changed at exactly the same time we upgraded to
PHP 4.1

 
 According to the crypt() man page, crypt() can use four methods of
 encryption:
 
   CRYPT_STD_DES - Standard DES-based encryption with a two character salt
   CRYPT_EXT_DES - Extended DES-based encryption with a nine character salt
   CRYPT_MD5 - MD5 encryption with a twelve character salt starting with $1$
   CRYPT_BLOWFISH - Blowfish encryption with a sixteen character salt starting with 
$2$
 
 You should check which method your crypt() method used before changing
 PHP version, and use the mcrypt specific method. You did backup the old
 php installation, right?
 
 --
 patrik_wallstrom-foodfight-[EMAIL PROTECTED]+46-709580442
 
 


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




[PHP] Re: Date

2002-01-08 Thread Mike Eheler

echo date('m/d/Y', strtotime('September 1, 2002'));

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

Mike

Aurelio wrote:

 hi,
 
 how i make to catch a future date, with this formatting 09/01/2002.???
 
 thanks,
 Aurélio Sabino
 
 


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




[PHP] IMP 3.0 out!

2002-01-03 Thread Mike Eheler

So is Horde 2.0.
And Turba 1.0

I think Chora 1.0 is due any day, as well.

Just noticed this at http://www.horde.org/

For anyone who doesn't know, Horde is an application framework built 
upon the PEAR style of coding. IMP is *the* webmail solution for anyone 
looking to provide webmail to their users, and Turba is a contact list 
manager that integrates with IMP and Horde. For more info, go check out 
their site.

Mike


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




[PHP] Re: More on images...

2002-01-03 Thread Mike Eheler

$HTTP_SERVER_VARS['HTTP_REFERER']

or (php 4.1.x)

$_SERVER['HTTP_REFERER']

Mike

Matthew Walker wrote:

 Related to my last question about the cookies in images, is there any
 way to get the referrer from the calling page without passing it as an
 argument to the image generation script?
  
 Matthew Walker
 Ecommerce Project Manager
 Mountain Top Herbs



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




[PHP] An idea for a PHP tool

2002-01-03 Thread Mike Eheler

Like google has it's toolbar, why not have a PHP Manual toolbar? That 
would be *great*. Just type in the function name and hit go and the 
manual comes up.

One for Moz  one for IE I'm sure would be appreciated.

I'd do it myself, but I have not the ability to code in C (or C++ for 
that matter), nor the time. So I donate this idea to the PHP community 
in hopes that someone out there has the knowledge and the ambition to 
make it happen.

Mike


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




[PHP] User-friendly URI's

2002-01-03 Thread Mike Eheler

http://www.somesite.com/news/2002/01/02/keyword

I've seen some sites do this with other scripting languages (maybe even 
PHP.. I just don't know).. I like the look of this *way* better. Anyone 
have any insight as to how I can make that work with an Apache 1.3.xx + 
PHP 4.1.x setup?

news would actually be a PHP script, of course. I know how to handle 
/2002/01/02/keyword as parameters, my question is on making news be 
interpreted through PHP.

Mike


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




Re: [PHP] User-friendly URI's

2002-01-03 Thread Mike Eheler

A 404 ErrorDoc would still reply with a 404 code, which could mess up 
some search engines.

I was thinking of the .htaccess solution, but I'm not sure if that's 
possible to force only certain files or perhaps all files in just a 
certain directory to all be application/x-httpd-php?

I guess that would be the best solution. :)

Or would it? What if I have an images/ subfolder.. I certainly wouldn't 
want all my images being thrown through PHP. That could cause some 
ugliness. So I guess it would have to be un-doable. Is it?

Mike

Jason Murray wrote:

news would actually be a PHP script, of course. I know how 
to handle /2002/01/02/keyword as parameters, my question is on 
making news be interpreted through PHP.

 
 Off the top of my head...
 
 You could either use a .htaccess to force Apache to recognise
 news as a PHP script, or you could use a Custom 404 page to
 figure out what the heck the original URL was trying to get at
 and silently substitute in the resulting page.
 
 A Custom 404 might be easier, but would have a bit more supporting
 infrastructure at the code end for a big site.
 
 Apologies if this is incorrect, I just may not be thinking
 too clearly today :)
 
 Jason
 


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




[PHP] Re: User-friendly URI's

2002-01-03 Thread Mike Eheler

I don't want to mess with the whole site, just a file or 10, or one 
directory, etc.

Mike

Jason Murray wrote:

True, but if I remember right, the hit will end up in your 
error_log not in your access_log.

 
 Ah. Bugger.
 
 But since this would require messing with your Apache config
 you could adjust that anyway surely?
 
 J
 


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




[PHP] Re: User-friendly URI's

2002-01-03 Thread Mike Eheler

That's the whole point of this thread.. that's what I want to avoid. I 
want to have a URI that is easier to remember, and less ugly, and also 
provides a sense of security (even if it is only a faint sense) through 
obscurity.

Mike

Philip Hallstrom wrote:

 Why not just make the script name news.php and not worry about it?
 
 On Thu, 3 Jan 2002, Mike Eheler wrote:
 
 
A 404 ErrorDoc would still reply with a 404 code, which could mess up
some search engines.

I was thinking of the .htaccess solution, but I'm not sure if that's
possible to force only certain files or perhaps all files in just a
certain directory to all be application/x-httpd-php?

I guess that would be the best solution. :)

Or would it? What if I have an images/ subfolder.. I certainly wouldn't
want all my images being thrown through PHP. That could cause some
ugliness. So I guess it would have to be un-doable. Is it?

Mike

Jason Murray wrote:


news would actually be a PHP script, of course. I know how
to handle /2002/01/02/keyword as parameters, my question is on
making news be interpreted through PHP.


Off the top of my head...

You could either use a .htaccess to force Apache to recognise
news as a PHP script, or you could use a Custom 404 page to
figure out what the heck the original URL was trying to get at
and silently substitute in the resulting page.

A Custom 404 might be easier, but would have a bit more supporting
infrastructure at the code end for a big site.

Apologies if this is incorrect, I just may not be thinking
too clearly today :)

Jason



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


 


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




Re: [PHP] An idea for a PHP tool

2002-01-03 Thread Mike Eheler

Through suggestions of people here is the code I produced for a bookmark:

javascript:void(srch=prompt('Function Name?',''));if(srch) 
{self.location.href='http://download.php.net/search.php?pattern=' +srch+ 
'show=quickref';};

Of course that should all go on one line. That is a good hack for now, 
but I still think it would be great to have the PHP site's search bar 
kind of in my browser, and it would launch a new window or whatever 
(with the drop-down to select function ref/online manual/etc)

Mike

Jason Murray wrote:

Like google has it's toolbar, why not have a PHP Manual toolbar? That 
would be *great*. Just type in the function name and hit go and the 
manual comes up.

 
 You could probably work a bit of javascript magic in a bookmark to
 do the same thing.
 
 I've seen bookmarks that pop up a javascript input window and then
 use the input in the resulting URL. So, take the manual query via
 javascript input and then append it to the www.php.net url.
 
 At least, I *think* I have :)
 
 J
 


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




[PHP] Re: Select box won't display in Netscape 4.xx

2001-12-31 Thread Mike Eheler

This happens when a select tag is not within a form block in 
netscape 4.. if the select isn't meant to be part of a form, and is just 
for navigation (javascript onchange or whatever), then just do 
formselect.../select/form

Mike

Edwin Boersma wrote:

 Hi,
 
 I'm developing a website for multiple browsers. In Netscape 4.xx (both
 Win98 and Linux versions), the php-scripts display the select boxes in
 my forms only as plain text. I cannot make any selections. In other
 browsers (NS 6 and IE5), it works fine.
 
 Anyone seen this behavior before?
 
 Regards,
 Edwin
 
 


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




[PHP] Re: web mail clients?

2001-12-31 Thread Mike Eheler

Depends what you want to do with it.

If you want it to grab messages from a POP server, and download them to 
your local machine, then some sort of cyclic folders database structure 
would help:

int auto_inc folderid
int default(0) parentid (= 0 if root, otherwise id of parent folder)
str foldername

Then your mail database:

int auto_inc mailid
int default(0) folderid
subject
... etc ...

I would suggest setting up an IMAP server somewhere.. in which case all 
you really need to do is grab Horde/IMP from http://www.horde.org/imp 
and use that. The latest version is quite good.

Mike

Philip Jeffs wrote:

 Hi,
 
 I'm looking into setting up a web based mail client for personal use.
 
 I've got most of it figured out (sending, recieving, forwarding etc..). 
 
 I need to be able to use folders in the mail client to organise the messages. Whats 
the best way of moving messages around?
 
 Do i need to store them as files / in a database or is there an easier way to do it?
 
 Thanks.
 
 -
 Philip Jeffs
 
 The Tickle Group
 The Gate House
 Summerseat
 Bury
 Lancashire
 BL9 5PE
 United Kingdom
 W: http://www.tickle.co.uk
 T: 01706 823456
 F: 01706 829500
 E: [EMAIL PROTECTED] (daytime)
 [EMAIL PROTECTED] (evening)
 -
 
 
 


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




[PHP] Re: How to strip off all html-comments

2001-12-31 Thread Mike Eheler

Checkout the preg_replace page in the PHP manual (at 
http://www.php.net/manual/en). There is an example there on removing all 
HTML tags. You can just modify it to work on just comments.

Mike

Martin wrote:

 Hello! How can I easily strip off all html-comments (! Comment ) from
 a string?
 
 Martin
 
 
 


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




[PHP] Re: Exec as user

2001-12-27 Thread Mike Eheler

There's no way that I have found to actually execute a script as a 
specified user, however:

?php
 passthru('whoami');
?

Should tell you what user the web server is running as.

Mike

Charlesk wrote:

 I have been looking through the docs and found no help on either finding which user 
the EXEC'ed commands run as, or how to specify which user they should run as.  I 
tried exec, system, and passthru running a batch file that would write %USERNAME% to 
a file.  And all three functions wrote nothing.  They would however write hello 
world.  Has anybody else run into this.  
 
 I tried exec(test.bat);
 test.bat:
 echo %USERNAME%  test.txt
 
 when run from a command line it resulting in Charles
 when run from a webpage it resulted in ECHO is on.
 if I added a line echo off above the echo username it resulted in ECHO is off. 
again only from the webpage.
 
 In essense I need to update a DNS server through a web page.  It works if the script 
is local but not if it has to update a different server.
 
 Charles Killmer
 Windows 2000 Server, IIS 5.0, PHP 4.1.0
 


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




[PHP] Re: php code beautifier

2001-12-27 Thread Mike Eheler

I'm working php script that would perform such a feat. I'll post news on 
php.general when/if it's finished.

Mike

George Nicolae wrote:

 do you know if exist a php code beautifier for win32? pls tell me the
 address.
 
 --
 
 
 Best regards,
 George Nicolae
 IT Manager
 ___
 X-Playin - Professional Web Design
 www.x-playin.f2s.com
 
 
 
 
 
 


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




Re: [PHP] Exec as user

2001-12-27 Thread Mike Eheler

Try doing this

?
 echo 'pre';
 print_r(array($HTTP_SERVER_VARS,$HTTP_ENV_VARS));
 echo '/pre';
?

And see if the information you want is in there anywhere.

Mike

 I don't believe that the system variables are available to php.  I work on
 *nix mostly, but I have a windows machine at home running php and I can't
 access any of my system var's.
 - Original Message -
 From: charlesk  [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: Thursday, December 27, 2001 11:33 AM
 Subject: [PHP] Exec as user
 
 
 
I have been looking through the docs and found no help on either finding

 which user the EXEC'ed commands run as, or how to specify which user they
 should run as.  I tried exec, system, and passthru running a batch file that
 would write %USERNAME% to a file.  And all three functions wrote nothing.
 They would however write hello world.  Has anybody else run into this.
 
I tried exec(test.bat);
test.bat:
echo %USERNAME%  test.txt

when run from a command line it resulting in Charles
when run from a webpage it resulted in ECHO is on.
if I added a line echo off above the echo username it resulted in ECHO

 is off. again only from the webpage.
 
In essense I need to update a DNS server through a web page.  It works if

 the script is local but not if it has to update a different server.
 
Charles Killmer
Windows 2000 Server, IIS 5.0, PHP 4.1.0

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



 


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




[PHP] Re: PHP 4.1.0 patch for Quanta IDE, The Sequel

2001-12-20 Thread Mike Eheler

Cool, however PHP is not case sensitive, nor is ASP or HTML for that 
matter, therefore case sensitive syntax highlighting will not be good 
for these languages.

Mike

J Smith wrote:

 I sumbitted a similar patch to the Quanta team about a week ago. It may 
 appear in an upcoming release, possibly Quanta 3, which will come with KDE 
 3.0.
 
 A few other additions I made:
 
 - highlighting is now case-insensitive for everything. I believe older 
 versions were case-sensitive for keywords, like function, class, etc.
 
 - support for ASP-style opening and closing tags (% and % instead of 
 ?php, ?, etc.)
 
 I'm also working on porting a newer editor from Kate/ktexteditor into 
 Quanta. It's been slow going, but things have picked up (it compiles and 
 runs now, albeit with a bunch of segfaults). This will make adding syntax 
 highlighting instructions much easier, as the latest versions of Kate allow 
 you to define highlighting rules in XML files, and the highlighting 
 instructions are set up at run-time rather than compile time. 
 
 Maybe over the XMas break I'll be able to finish it up.
 
 J
 
 
 Mike Eheler wrote:
 
 
 
http://sourceforge.net/tracker/index.php?func=detailaid=495239group_id=4113atid=304113
 
Download the attached file, and run

patch -p1 -i quanta-2.0.1-php-4.1.0.diff

That will patch your source tree.. then just configure, make, install.

I've actually tested this one, so go nuts people. :) Please let me know
if you find any functions that should be keywords or keywords that
shouldn't be keywords, or functions/keywords that just plain aren't in
the list.

Mike

 


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




Re: [PHP] Re: PHP 4.1.0 patch for Quanta IDE, The Sequel

2001-12-20 Thread Mike Eheler

?
echo (null == Null);
eCho (NULL == NuLl);
eCHo (FALSE == false);

prINt(pre);
Print_R(GET_defined_VaRs());
sPrinTF('%s','/pre');
?

Variable names are the *only* exception.

So yes, $var != $Var;

And variable names are not syntax highlighted specifically (other than 
the fact that variables are highlighted). So by case-sensitizing keyword 
and function references, that is making a lot of scripts *not* syntax 
highlight properly, because only people who use FALSE will be 
highlighted, while people who use False or false or even FalsE will be 
left in the dark.

Or perhaps you prefer to code using MySQL_Connect().. people driven to 
PHP from ASP might code like this when they start.

Mike

Jack Dempsey wrote:

 really?
 ?
 $THIS_IS_A_VARIABLE=1;
 $this_is_a_variable=2;
 
 echo $THIS_IS_A_VARIABLE\n;
 echo $this_is_a_variable\n;
 ?
 
 seems sensitive to me...
 
 Mike Eheler wrote:
 
 
Cool, however PHP is not case sensitive, nor is ASP or HTML for that
matter, therefore case sensitive syntax highlighting will not be good
for these languages.

Mike

J Smith wrote:


I sumbitted a similar patch to the Quanta team about a week ago. It may
appear in an upcoming release, possibly Quanta 3, which will come with KDE
3.0.

A few other additions I made:

- highlighting is now case-insensitive for everything. I believe older
versions were case-sensitive for keywords, like function, class, etc.

- support for ASP-style opening and closing tags (% and % instead of
?php, ?, etc.)

I'm also working on porting a newer editor from Kate/ktexteditor into
Quanta. It's been slow going, but things have picked up (it compiles and
runs now, albeit with a bunch of segfaults). This will make adding syntax
highlighting instructions much easier, as the latest versions of Kate allow
you to define highlighting rules in XML files, and the highlighting
instructions are set up at run-time rather than compile time.

Maybe over the XMas break I'll be able to finish it up.

J


Mike Eheler wrote:


http://sourceforge.net/tracker/index.php?func=detailaid=495239group_id=4113atid=304113


Download the attached file, and run

patch -p1 -i quanta-2.0.1-php-4.1.0.diff

That will patch your source tree.. then just configure, make, install.

I've actually tested this one, so go nuts people. :) Please let me know
if you find any functions that should be keywords or keywords that
shouldn't be keywords, or functions/keywords that just plain aren't in
the list.

Mike


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

 


-- 
Long life is in store for you.


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




[PHP] Re: undefined function: ftp_connect()

2001-12-20 Thread Mike Eheler

You need to compile with ftp support. --with-ftp is not the right 
command, it should be --enable-ftp

Mike

Sam Schenkman-Moore wrote:

 I've compiled php 4.0.6 on Darwin as CGI. --with-ftp shows up in the php
 configuration display but I still get this message:
 
 undefined function: ftp_connect()
 
 I've read a couple past articles with people having this problem but I did
 not spot a solution.
 
 Any suggestions? 
 
 Thanks, Sam
 
 


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




[PHP] Quanta IDE - PHP Highlighing for 4.0.1

2001-12-19 Thread Mike Eheler

Attached is a text file that will update Quanta IDE 2.0.1 syntax 
highlighting for PHP.

Simply use your favourite text edit quanta/kwrite/highlight.cpp in your 
quanta-2.0.1 source tree, and paste the text from this attached file 
overtop of the phpKeywords and phpTypes variables.

If anyone knows how I can make a real patch (diff or whatever) lemme 
know cuz I've never done it before.

Also if you notice anything that shouldn't be a keyword, or is missing 
from either keywords or functions (currently there are 2499 functions 
defined in this file) let me know.

Mike



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


[PHP] Re: Quanta IDE - PHP Highlighing for 4.0.1

2001-12-19 Thread Mike Eheler

Shoot.. it didn't attach.

That's probably a good thing.

I'll put together a diff patch and put it somewhere for download.

Mike

Mike Eheler wrote:

 Attached is a text file that will update Quanta IDE 2.0.1 syntax 
 highlighting for PHP.
 
 Simply use your favourite text edit quanta/kwrite/highlight.cpp in your 
 quanta-2.0.1 source tree, and paste the text from this attached file 
 overtop of the phpKeywords and phpTypes variables.
 
 If anyone knows how I can make a real patch (diff or whatever) lemme 
 know cuz I've never done it before.
 
 Also if you notice anything that shouldn't be a keyword, or is missing 
 from either keywords or functions (currently there are 2499 functions 
 defined in this file) let me know.
 
 Mike


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




[PHP] PHP 4.1.0 patch for Quanta IDE, The Sequel

2001-12-19 Thread Mike Eheler

http://sourceforge.net/tracker/index.php?func=detailaid=495239group_id=4113atid=304113

Download the attached file, and run

patch -p1 -i quanta-2.0.1-php-4.1.0.diff

That will patch your source tree.. then just configure, make, install.

I've actually tested this one, so go nuts people. :) Please let me know 
if you find any functions that should be keywords or keywords that 
shouldn't be keywords, or functions/keywords that just plain aren't in 
the list.

Mike


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




[PHP] Re: Slash problem

2001-12-19 Thread Mike Eheler

This is done because magic_quotes_gpc is turned on. This makes it 
possible to just insert submitted data into a MySQL database, without 
preparing it first.

You can turn it off if you have access to the server config, or.. you 
can do this:

if (get_magic_quotes_gpc()) {
foreach ($HTTP_POST_VARS as $key = $value) {
   // if you're into globals
   $$key = stripslashes($value);
   // otherwise -- not sure if this'll work or not
   // if $HTTP_POST_VARS is read-only then it won't.
   $HTTP_POST_VARS[$key] = stripslashes($value);
}
}

At the beginning of your scripts. If you do that, don't forget to *not* 
use global values.

Mike

Evansville Scene wrote:

 I'm fairly new @ PHP, so forgive me if the answer is trivial ...
 
 In many cases, if I take in data from a form and the user uses an apostrophe, the 
data that is sent to me has a slash in it.  For example: Jones\' Auto Repair
 
 Is there an easy fix?  I'm not sure why this is occurring ... 
 It\'s been quite a pain :)
 
 Adam
 
 


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




Re: [PHP] Slash problem

2001-12-19 Thread Mike Eheler

I disagree.

That doesn't affect whether or not GPC variables are addslashes()'d.

Mike

Bas Van Rooijen wrote:

 
 set_magic_quotes_runtime (false)
 
 bvr.
 
 On Thu, 20 Dec 2001 09:43:28 +1100, Martin Towell wrote:
 
 
either set magic_quotes_gpc to off in you .ini file - or use
stripslashes() on the variable

 
 
 
 
 
 


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




[PHP] Working with designers...

2001-12-18 Thread Mike Eheler

Hi There,

I'm looking for some community feedback on being a coder working with 
designers. Techniques that work that allow my php-inept page/graphic 
designer comrade make changes to the layout of the page without 
destroying my code, or requiring me to make any changes whatsoever.

Or what is the best process? Code the dynamicity (heh -- sad thing is 
you know what i mean by it) of the site, then integrate a designers HTML 
into your code, *or* the other way around.. have the designer create the 
site using all static html files, then go in and remove sample data to 
be replaced with dynamic data (pulled from a DB, for example).

I'm about to enter a very large project working with about 3 or 4 
designers and 2 other coders and any suggestions on making this 
relationship work is greatly appreciated.

Mike


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




[PHP] Re: sql password

2001-12-18 Thread Mike Eheler

yeah

if you just installed, root doesn't have a password.. so you need to not 
specify -p (this tells the server to try and authenticate with an empty 
password, as opposed to attempting to authenticate with no password.. 
there is a difference):

mysqladmin -u root password mypassword

Mike

Jeremiah Jester wrote:

 Im attempting to install mysql. The service started and everything seems to
 be going ok except for that I can't set the root password for the mysql
 server.
 
 To reset password i type:
 
 /usr/bin/mysqladmin -u root -p mypassword
 
 Then I get the following error:
 
 /usr/bin/mysqladmin: connect to server at 'localhost' failed
 error: 'Access denied for user: 'root@localhost' (Using password: YES)'
 
 Can anyone help?
 Thanks,
 JJ
 
 


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




Re: [PHP] Working with designers...

2001-12-18 Thread Mike Eheler

They sound like good ideas, with one quisp.. the sites are currently 
being designed in *shudder* Dreamweaver.

They absolutely refuse to chop files up into header/footer includes, and 
they want to be able to do all their colour customisation through their 
beloved .css files.

Mike

Jimtronic wrote:

 
 I try to seperate the php code from the html as much as possible. So, if 
 a page is dynamic, have php figure out the dynamic parts first, put them 
 into variables such as $html, or $pull_down_menu, or whatever. Then all 
 that needs to replaced in the html is that section. HTML coders aren't 
 dumb, so they can be trusted with a simple ?= $html ? placement.
 
 Additionally, I try to seperate php logic from php presentation as much 
 as possible. This means creating as many variables as possible that 
 affect how things look and then including a conf.php file that the 
 coders can also change pretty easily with good documentation.
 
 Moving even further in this direction, my logic code calls many 
 presentation functions which I find HTML coders can also decipher rather 
 well. You can put these in another include file so your designers don't 
 ever have to touch any of your precious logic.
 
 Then ... if you have time ... you can make an admin screen to change, 
 edit, and preview the finished product.
 
 Jim
 
 Hi There,

 I'm looking for some community feedback on being a coder working with 
 designers. Techniques that work that allow my php-inept page/graphic 
 designer comrade make changes to the layout of the page without 
 destroying my code, or requiring me to make any changes whatsoever.

 Or what is the best process? Code the dynamicity (heh -- sad thing is 
 you know what i mean by it) of the site, then integrate a designers 
 HTML into your code, *or* the other way around.. have the designer 
 create the site using all static html files, then go in and remove 
 sample data to be replaced with dynamic data (pulled from a DB, for 
 example).

 I'm about to enter a very large project working with about 3 or 4 
 designers and 2 other coders and any suggestions on making this 
 relationship work is greatly appreciated.

 Mike


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


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




Re: [PHP] Working with designers...

2001-12-18 Thread Mike Eheler

LOL.

Use Netscape 4.

Now there's a condtradiction you don't hear every day.

Mike

Jim Lucas wrote:

 hope you don't plan to use that example table in netscape 4.x
 
 - Original Message - 
 From: Mark [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
 Sent: Tuesday, December 18, 2001 4:10 PM
 Subject: Re: [PHP] Working with designers...
 
 
 On Tue, 18 Dec 2001 16:00:09 -0800, Fred wrote:
 
Mark [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
well, you don't have to wade through all that html, just put an
include() in there to a file that has all the php in it. then
dreamweaver should leave it alone.

Huh?

Obviously the logic can be included, but the output functions need
to be
burried deep in dreamweaver created nested tables and javascripts.

 
 hmm,
 I'm assuming that javascript is the programmer's responsibility, not 
 the designer's. Maybe the javascript needs to be dynamically 
 generated, probably it doesn't. either way it's in a separate file 
 doesn't get edited in dreamweaver.
 
 I understand that the php will probably have to be in a table and the 
 designer's will want to be able to change it's appearance, and that's 
 where css comes in. i.e.:
 
 table class=php_table_class
   tr class=php_tr_class
 td class=php_td_class
   div class=php_content_class?echo $dynamic_content?/div
 /td
   /tr
 /table
 
 yes, there's some html in the included file, but the designer's don't 
 need to have access to it because they can just change how it looks 
 in the stylesheet.
 
 
 


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




[PHP] Re: streaming media via php

2001-12-17 Thread Mike Eheler

Try re-writing your script to accept the url as such:

http://server/content.php/media/file.asf

Mike

Stephen Vandyke wrote:

 Hello PHP people :)
 
 I have a tough one here, I wrote a content script that plays media files,
 but I can't seem to get things to actually buffer and stream as they should.
 Here's the conundrum:
 
 http://server/media/file.asf - Media player will buffer and start playing
 before download completes
 http://server/content.php?f=media/file.asf - Media player has to download
 entire file before it starts trying to play
 
 Here's the source of content.php, anyone see anything obvious that I'm
 missing? I've been all over the HTTP/1.1 spec and media RFCs trying to
 figure out what the heck I'm missing. Windows Media Player interprets the
 media name as content if that's any help. Alse, the mime types are all
 correct so that's not the issue, I'm just trying to figure out how to make
 the players buffer+play instead of download+play.
 
 ?php
 $mime_type = strtolower(strrchr($f,'.'));
 $mime_type_array = array(
 '.asf'  = 'application/vnd.ms-asf',
 '.avi'  = 'video/x-msvideo',
 '.gif'  = 'image/gif',
 '.jpg'  = 'image/jpeg',
 '.mov'  = 'video/quicktime',
 '.mpe'  = 'video/mpeg',
 '.mpeg' = 'video/mpeg',
 '.mpg'  = 'video/mpeg',
 '.ra'   = 'audio/x-pn-realaudio',
 '.ram'  = 'audio/x-pn-realaudio',
 '.rm'   = 'audio/x-pn-realaudio',
 '.wmv'  = 'audio/x-ms-wmv'
 );
 
 // this is our security, bleh
 if(!in_array($mime_type,array_keys($mime_type_array)))
 {
 header(Location: /error.php);
 }
 $filename = '/path/to/'.$f;
 $dlname = substr(strrchr($filename,'/'),1);
 $offset = (isset($nocache)?0:(86400 * 3));
 header(Accept-Ranges: bytes);
 header(Expires: .gmdate(D, d M Y H:i:s \G\M\T, time() + $offset));
 header(Cache-Control: max-age=.$offset);
 header(Last-modified : .gmdate(D, d M Y H:i:s \G\M\T,
 filemtime($filename)));
 header(Content-Length: .filesize($filename));
 header(Content-Disposition: filename=$dlname);
 if($debugx==1)
 {
 phpinfo();
 }
 else
 {
 header(Content-Type: .$mime_type_array[$mime_type]);
 @readfile($filename);
 }
 ?
 
 Thanks in advance for any help,
 Please cc me on any replies since I am not on this mailing list.
 
 Stephen VanDyke
 
 


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




[PHP] Filenames with spaces in them

2001-12-14 Thread Mike Eheler

Consider this code for traversing through a directory structure:

?php

function traverse($path='.') {
   $path = realpath($path);
   $dir = opendir($path);

   echo \nDirectory : $path\n;
   echo str_pad('',76,'-').\n;

   while (false !== ($file = readdir($dir))) {
 if (is_dir($file)  $file != '.'  $file != '..') {
   traverse($path/$file);
   echo $file;
 }
   }

   closedir($dir);
}

echo 'pre';
traverse();
echo '/pre';

?

Now when I run it in a directory that has a file with spaces in it's 
name.. for examples purposes, the file willbe called file name with 
spaces.

Directory : /home/mike/php/test

Warning:  stat failed for file name with spaces (errno=2 - No such file 
or directory) in /home/mike/php/dirdump.php on line 10

Any ideas why this error happens and what I can do to get around it?

Mike


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




[PHP] Re: Filenames with spaces in them

2001-12-14 Thread Mike Eheler

I'll note that the erroneous command is the is_dir($file).. this causes 
the problem.

Mike

Mike Eheler wrote:

 Consider this code for traversing through a directory structure:
 
 ?php
 
 function traverse($path='.') {
   $path = realpath($path);
   $dir = opendir($path);
 
   echo \nDirectory : $path\n;
   echo str_pad('',76,'-').\n;
 
   while (false !== ($file = readdir($dir))) {
 if (is_dir($file)  $file != '.'  $file != '..') {
   traverse($path/$file);
   echo $file;
 }
   }
 
   closedir($dir);
 }
 
 echo 'pre';
 traverse();
 echo '/pre';
 
 ?
 
 Now when I run it in a directory that has a file with spaces in it's 
 name.. for examples purposes, the file willbe called file name with 
 spaces.
 
 Directory : /home/mike/php/test
  
 
 Warning:  stat failed for file name with spaces (errno=2 - No such file 
 or directory) in /home/mike/php/dirdump.php on line 10
 
 Any ideas why this error happens and what I can do to get around it?
 
 Mike
 


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




[PHP] Re: Filenames with spaces in them

2001-12-14 Thread Mike Eheler

Ahh forget it .. I figured it out

change to is_dir($path/$file).. *smack*

ignore this altogether

mike

Mike Eheler wrote:

 Consider this code for traversing through a directory structure:
 
 ?php
 
 function traverse($path='.') {
   $path = realpath($path);
   $dir = opendir($path);
 
   echo \nDirectory : $path\n;
   echo str_pad('',76,'-').\n;
 
   while (false !== ($file = readdir($dir))) {
 if (is_dir($file)  $file != '.'  $file != '..') {
   traverse($path/$file);
   echo $file;
 }
   }
 
   closedir($dir);
 }
 
 echo 'pre';
 traverse();
 echo '/pre';
 
 ?
 
 Now when I run it in a directory that has a file with spaces in it's 
 name.. for examples purposes, the file willbe called file name with 
 spaces.
 
 Directory : /home/mike/php/test
  
 
 Warning:  stat failed for file name with spaces (errno=2 - No such file 
 or directory) in /home/mike/php/dirdump.php on line 10
 
 Any ideas why this error happens and what I can do to get around it?
 
 Mike
 


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




Re: [PHP] Performance

2001-12-13 Thread Mike Eheler

Yes! Please release some of these results. I am *very* interested. I 
have been coding using the method you demonstrate (terminating PHP any 
time possible, and rarely, if ever, using echo and print).

I would love to know how much, if any, difference it makes.

Mike

Jim Lucas wrote:

 the site that I design for has converted all of the echo; print()  and any
 other printing function of php into a simple breakout into HTML.
 
 ie:
 ?
 for($i=0;$i10;$i++)
 {
 ?We have done ?=$i? loop.?
 }
 ?
 
 We have done performance testing on most everything that can be done out put
 and include()/require() stuff.  If you would like information on the
 performance results I might be able to round up some of the data. It is
 faster and cleaner.
 
 Jim Lucas
 www.bend.com
 
 
 - Original Message -
 From: René Fournier [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
 Sent: Tuesday, November 13, 2001 9:05 AM
 Subject: [PHP] Performance
 
 
 Is it true that mixing HTML and PHP--switching back and forth with
 ?php ?  tags--slows down performance? (I'm using PHP4.) Is it better
 to echo output than to drop out of PHP mode?
 
 And concerning database connections, my ISP asks that I always close a
 MySQL connection with a mysql_close()--which I can understand. But I'm
 curious, if I have to make, say, 10 SELECTs throughout a page (in the
 header, body, and footer), is it perhaps faster to use the mysql_close()
 at the very end of the page (in the bottom of the footer.inc)? In other
 words, is there any disadvantage performance-wise (or stability reason)
 to open and immediately thereafter close mysql connections?
 
 Can anyone recommend an article or two on coding techniques for
 improving PHP and MySQL performance? I don't wan to spend the rest of my
 life optimizing my php code, but if I knew a few basic rules about its
 performance characteristics, I might be able to make better decisions
 when coding. Thanks.
 
 ...Rene
 
 ---
 René Fournier,
 [EMAIL PROTECTED]
 
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]
 
 
 
 


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




[PHP] Re: ordered alpabeticaly list

2001-12-13 Thread Mike Eheler

If I understand you correctly, you want to put a separator when the 
letter changes.

Try this:

$result = mysql_query('select name from people order by name');
$lastletter = '';
while ($data = mysql_fetch_array($result)) {
 $curletter = strtolower(substr($data['name'],0,1));
 if ($curletter != $lastletter) {
 // Put code to insert a separator here
 }
 // put code to display the name here
 $lastletter = $curletter;
}

Mike

Rodrigo Peres wrote:

 Hi list,
 
 I have a mysql tables, with names on it. I'd like to select this names
 ordered by name and output it to a html in alphabetical order, but separates
 by letter, ex: a, names with a, b
 I've done the select, but I can't figure out how to output the respective
 letters separated.
 
 
 Thank's in advance
 
 Rodrigo Peres
 
 


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




Re: [PHP] Performance

2001-12-13 Thread Mike Eheler

The problem with that is giving feedback to the user. If you're busy 
generating a string to display to the user and the mysql server is 
running slow, or for whatever reason, the user is looking at a blank 
page until the process is completed entirely, then they have all the 
data dumped on them at once.

For someone on a modem, this is a bad thing, because first they're 
waiting for the page to be created, then they're waiting for the data to 
download.

I've always been taught by people who have been working in this industry 
for years (even back in my ASP days) that it's always best to send data 
to the user's browser as soon as possible.

Mike

Dan McCullough wrote:

 Here is one thing that I do, of course there is 50 ways you can do anything.
 All coding, well 90% of the PHP is done in the head, all output in coposed in 
variables, and
 outputted through the code.  All SQL is done there as well, and an mysql close is 
done at the end
 of that area.  If there is any logic in the where the html is, its smallish if else 
statments.
 
 Small example.
 ?
 all php logic.
 $sql = ;
 $cat_output = tabletr
 while ($category = mysql($result)) {
 $cat_output .= td.$category['name']./td;
 }
 $cat_output = /tr/table
 $sql = ;
 if () {
 $subcat_output .= ;
 } else {
 $subcat_output .= ;
 }
 $sql = ;
 $sql = ;
 $sql = ;
 mysql_close();
 ?
 
 !DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.0 Transitional//EN
 
 html
 head
   titleUntitled/title
 /head
 
 body
 
 ?print $cat_output; ?
 
 /body
 /html
 
 
 Something a little like that
 
 
 
 --- René_Fournier [EMAIL PROTECTED] wrote:
 
Is it true that mixing HTML and PHP--switching back and forth with 
?php ?  tags--slows down performance? (I'm using PHP4.) Is it better 
to echo output than to drop out of PHP mode?

And concerning database connections, my ISP asks that I always close a 
MySQL connection with a mysql_close()--which I can understand. But I'm 
curious, if I have to make, say, 10 SELECTs throughout a page (in the 
header, body, and footer), is it perhaps faster to use the mysql_close() 
at the very end of the page (in the bottom of the footer.inc)? In other 
words, is there any disadvantage performance-wise (or stability reason) 
to open and immediately thereafter close mysql connections?

Can anyone recommend an article or two on coding techniques for 
improving PHP and MySQL performance? I don't wan to spend the rest of my 
life optimizing my php code, but if I knew a few basic rules about its 
performance characteristics, I might be able to make better decisions 
when coding. Thanks.

...Rene

---
René Fournier,
[EMAIL PROTECTED]


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


 
 
 __
 Do You Yahoo!?
 Check out Yahoo! Shopping and Yahoo! Auctions for all of
 your unique holiday gifts! Buy at http://shopping.yahoo.com
 or bid at http://auctions.yahoo.com
 


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




[PHP] Re: very urgent assistance

2001-12-13 Thread Mike Eheler

http://home.rica.net/alphae/419coal/

Mike

Adewale.Johnson wrote:

 Dr.Adewale.Johnson.
 16 Kingsway Road 
 Ikoyi, Lagos 
 Nigeria.. 
 [EMAIL PROTECTED]
 6th, December , 2001. 
  
 Sir, 
  
 Request for Urgent Business Relationship. 
  
 First I must solicit your confidence in this transaction. This is by 
 virtue of its nature as being utterly confidential and top secret. We shall 
 be counting on your ability and reliability to prosecute a transaction of 
 great magnitude  involving a pending business transaction requiring 
 maximum confidence. 
  
 We are top officials of the Federal Government Contract Review Panel who 
 are interested  in importation of goods into our country with 
 funds which are presently trapped in Nigeria. In order to commence this 
 business we solicit  your assistance to enable us RECIEVE the 
 said trapped funds ABROAD. 
  
 The source of this fund is as follows : During the regime of our late 
 head of state, Gen.  Sani Abacha, the government officials set up 
 companies and awarded themselves contracts which were grossly 
 over-invoiced in various  Ministries. The NEW CIVILIAN Government 
 set up a Contract Review Panel (C.R.P) and we have identified a lot of 
 inflated contract  funds which are presently floating in the Central 
 Bank of Nigeria (C.B.N). However, due to our position as civil servants 
 and members of this  panel, we cannot acquire this money in our 
 names. I have therefore, been delegated as a matter of trust by my 
 colleagues of the panel  to look for an Overseas partner INTO whose 
 ACCOUNT the sum of US$31,000,000.00 (Thirty one Million United States 
 Dollars) WILL  BE PAID BY TELEGRAPHIC TRANSFER. 
 Hence we are writing you this letter.  
 We have agreed to share the money thus: 
 70% for us (the officials) 
 20% for the FOREIGN PARTNER (you) 
 10% to be used in settling taxation and all local and foreign expenses. 
  
 It is from this 70% that we wish to commence the importation business. 
 Please note that this  transaction is 100% safe and we hope that the funds arrive 
your 
 account in latest ten (10)  banking days from  the date of reciept of the following 
 information  by email: A suitable name and bank account into which the funds can 
 be paid. 
  
 The above information will enable us write letters of claim and job 
 description respectively. 
 This way we will use your company's name to 
 apply for payments and re-award the contract in your company name. 
  
 We are looking forward to doing business with you and solicit your 
 confidentiality in this  transaction. 
  
 For security reasons, please respond only to the above email address or fax number 
234 
 1 7747907. I will bring you  into the complete picture of this pending project when 
I have 
 heard from you. 
  
 Yours Faithfully, 
 Dr.Adewale.Johnson.
 Tel/fax: 234 1 7747907 
 
 


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




[PHP] Re: test

2001-12-12 Thread Mike Eheler

Syntax error

Andrey Hristov wrote:

 test
 
 


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




[PHP] Re: CDBaby.com

2001-12-12 Thread Mike Eheler

I'm not sure what to make of this? Is it spam? Is it an acclaim? What is it?

Mike

Richard Lynch wrote:

 As you may know, I run a tiny record label No Genre in Chicago.
 
 Ulele's Seed CD released last week on No Genre has been selected as 
 a Featured CD on the FRONT PAGE of http://cdbaby.com/
 
 This is a HUGE DEAL in the independent music world!
 
 CDBaby is the 2nd-largest on-line retailer of music CDs, only behind 
 Amazon.com, and gets God knows how much traffic.
 
 Since 1996 when he started it to sell his own CDs and a few bands he was 
 friends with CDBaby has built up to:
 
 o  11,810 artists sell their CD at CD Baby.
 o  149,538 CDs sold online to customers.
 o  $903,821.30 paid to artists.
 
 They get about 40 CDs *every* day, so it's a pretty big honor.
 
 Oh, did I mention this site and the admin site at http://cdbaby.net; 
 and the community site at http://cdbaby.org are all *ENTIRELY* 
 PHP-based, and written by a musician who isn't really a programmer?  He 
 picked PHP as the only language that didn't scare him away.
 
 Anyway, if you like music or just want to see how slick a PHP site from 
 a non-programmer can be, check out his sites.
 
 http://cdbaby.com/ulele/


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




[PHP] Re: PHP 4.x on Apache 2.x?

2001-12-12 Thread Mike Eheler

You can build php as an apache2 DSO by using 
--with-apxs2=/path/to/apache/bin/apxs

make sure you have built apache with the 'so' module enabled.

mike

Jon Niola wrote:

 With all the architectural changes to the Apache platform for 2.x, will 
 PHP 4.x run as a module still, or is that TBD?
 
 --Jon
 


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




[PHP] Re: Searching for a new provider

2001-12-12 Thread Mike Eheler

What's a speicherplatz?

Mike

Andy wrote:

 Hi there, I am searching for a provider who fullfills those criterias and
 does not cost a fortune:
 
 
- PHP = 4.06 bzw. PHP 4.x mit GDLibrary ab 2.0

 
- GDLibrary = 2.0

 
   - PHP installed as module
 
 
- mind 5 Subdomains

 
- mind 100 MB Speicherplatz

 
- evtl. Java VM

 
- MySQL

 
 
 
 Thanx andy
 
 
 
 


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




[PHP] PHP 4.1.0 actually out this time -- questions about zend products

2001-12-11 Thread Mike Eheler

Does anyone here subscribe to the Zend developer's suite? We have the 
optimizer and debugger installed with a 4.0.5 installation and are 
looking into upgrading to 4.1.0 but being a production machine, we don't 
want to do anything that would jeopardize the stability of the machine. 
Has anyone here had experience using PHP 4.1 with the optimizer and 
debugger?

Mike


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




[PHP] Re: deleting file contents

2001-12-11 Thread Mike Eheler

$fp = fopen('/var/mail/myaccount','w');
fwrite($fp,'');
fclose($fp);

that could work. I was going to suggest doing:
unlink('/var/mail/myaccount');
touch('/var/mail/myaccount');

But I assume that since you're against deleting it, then there must be 
some sort of permissions in place that you don't want changed.

Mike

--
Sex is like air. It's not important unless you're not getting any.
   -- Unknown

Digitalkoala wrote:

 Hi Everyone,
 
 I'm running a script that automatically reads lines from
 /var/mail/myaccount, parses the lines then insert specific items into a
 database this is in a loop
 
 What i want to do is then delete the contents of the file, but not the file
 itself...can you tell me the best way to do this?
 
 many thanks
 anna
 
 
 
 
 


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




[PHP] Re: File Name and Path

2001-12-11 Thread Mike Eheler

Do a variable dump and see if any variables have that value:

pre?php print_r(get_defined_vars()) ?/pre

Mike

Pong-Tc wrote:

 Hello Listers
 
 I have a question on how to get the full path of source file.  I have a
 form like this:
 
 form enctype=multipart/form-data action=myupload.php method=post
 input type=hidden name=MAX_FILE_SIZE value=1
 Send this file:br input name=userfile type=filebr
 input type=submit value=Send File
 /form
 
 I pass the request to myupload.php.  If my source file's path is
 c:/result.txt, how can I know it in myupload.php?  I know that I can get
 the file name result.txt, but I don't know how to get the full path.  
 
 Anyone, please help.
 
 Pong
 
 


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




[PHP] Re: Emailing attachments upload to a form

2001-12-11 Thread Mike Eheler

Yeah.. code to divide the message into multiple parts, base64_encode the 
file, and attach it that way.

I suggest looking for some kind of Email class that can do that for you. 
Try http://phpclasses.upperdesign.net/

Mike

Ben Clumeck wrote:

 When I use the script to upload an attachment to my form it does not email
 the attachment.  I am using the mail() function to email the results of the
 form to me. Is there any other code I need to put in my mail() function to
 make this work, if so where would I put it?
 
 I am currently using the following code:
 ?
 mail ([EMAIL PROTECTED], Form Results, Name: $name\nMessage:
 $message\nAttachment: $attachment, From: $fromemail);
 ?
 
 Thanks,
 
 Ben
 


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




[PHP] Re: PHP 4.1.0 actually out this time -- questions about zend products

2001-12-11 Thread Mike Eheler

Excellent.

Keep me up to date on your findings. Our license only allows for the 
software to be used on one machine so I can't build a test machine. :/

Mike

J Smith wrote:

 Seconds after I write this, I see on zend.com that the Optimizer has a new 
 version for 4.1.0. Don't see anything about the Debug Server. I'm going to 
 give the Optimizer a whirl and see if stuff encoded with our old Encoder 
 word with 4.1.0...
 
 J
 
 
 
 J Smith wrote:
 
 
We have the developer suite at my work, and as far as I know, the
Optimizer, Debug Server, Encoder, etc. don't work with 4.1.0 at all. When
you try using the Optimizer, for instance, it spits out a line in your
Apache log (or whatever log) saying that this version of the Optimizer is
for Zend Engine blah blah, go to Zend.com to upgrade, or something to
that effect.

Hopefully when you buy the suite you get access to updated versions of the
software that are compatible with 4.1.0, otherwise, it's going to suck for
us, since we use some of the new features in 4.1.0 in the app we're
writing. It would seem like a waste of money in our case, as we're
dropping 4.0.6, and that's all the Developer Suite we have covers at the
moment. We used to use 4.0.6 on an older version of this thing we're
developing, but there were enough nicities in 4.1.0 that I decided to
start using the dev versions and RCs for 4.0.7/4.1.0, just so we'd be
up-to-date when 4.1.0 actually came out.

J



 


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




[PHP] Re: replacing Carriage Return

2001-12-11 Thread Mike Eheler

Could this be solved in any way by using nl2br()?

Mike

Phantom wrote:

 I solicit information from a text field and save the data in mysql to be 
 pulled out later and displayed as text on a webpage.
 
 However, Carrage Returns in the text field do not appear in the webpage 
 text.
 
 With ereg_replace() I can replace the Carriage Returns with  \n, so 
 what is this the character I need to find in the text field to replace? 
 chr(13) ???
 
 ereg_replace(chr(13), \n, $TextFieldData) 
 
 Thanks.
 


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




[PHP] Re: Date

2001-12-11 Thread Mike Eheler

If you only have the text directory listing and don't have access to the 
file to do a filetime() call on, you can try this:

$modified = stat('header.php');
echo 'Last Modified: ' . date('F j, Y, g:i a', 
strtotime(substr($modified[9],35,12)));

Tha's a really long way around it, and a much better way is to just use 
filetime() function.

Mike

Brian V Bonini wrote:

 Why is this:
 
 ?php
 $modified = stat(header.php);
 echo Last Modified: .date(F j, Y, g:i a,$modified[9]);
 ?
 
 returning this:
 
 Last Modified: December 31, 1969, 7:00 pm
 
 from this:
 
 -rw-r--r--  1 gfxdesi  vuser  1196 Dec 11 09:22 header.php
 
 Anyone?
 


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




[PHP] Re: [ADMIN] spam protection for lists.php.net lists

2001-12-11 Thread Mike Eheler

I was a bit surprised by it when I posted to the newsgroup earlier, but 
I think it's a great idea.

Mike

Jim Winstead wrote:

 as some of you may have noticed over the last few days, a new method of
 spam protection has been implemented on lists.php.net.
 
 if you post to one of the lists.php.net lists (via mail or the news
 server at news.php.net) from a mail address that is not subscribed to
 the mailing list, you will receive an email with information on how to
 confirm that you are a real person trying to send mail to the list, and
 not just some drive-by spammer. once you have responded to the
 confirmation, your original message to the list will be let through to
 the list, and your email address will be stored as one that is allowed
 to post so that future postings from you to any of the lists.php.net
 lists will be passed through without requiring confirmation.
 
 note that this means it is no longer possible to post to the list using
 an invalid smtp sender (or using an invalid email address in the 'From'
 header of a post via the news server).
 
 if you encounter problems posting to the list, feel free to drop a note
 to the list administrators at [EMAIL PROTECTED]
 
 jim
 


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




Re: [PHP] PHP XML

2001-12-07 Thread Mike Eheler

You could also do it like:

?= '?xml version=1.0 encoding=UTF-8?' ?

Mike

Steve Haemelinck wrote:

Hi Guys

I am developing with PHP and XML. Now I experience some problem with the
processing instructions of xml (?xml version=1.0 encoding=UTF-8?)
which causes PHP to return a parsing error.
This is logical because ? is also the short-tag processing instruction for
PHP.  Does anybody got an idea how to solve this problem without disabling
the short-tags in the php.ini fiel ?

Thx





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




Re: [PHP] Using HEADER to redirect

2001-12-06 Thread Mike Eheler

More than likely not. Putting an exit statement after a header redirect 
is just good practice and ensures that nothing gets executed after 
redirecting.

Mike

Don wrote:

Hi,

I have a PHP script that uses the following code to redirect to a page of the user's 
choice:

header(Location: http://www.mypage.net/;); 

In examples of this type of coding in various scriots,  the above line is always 
followed by the statement:

exit;

I am wondering why.  When executing a Header(Location); statement, does control 
return to the PHP script after execution?  In that case, I assume that the exit; 
statement is there in order to terminate the php script.  In that event, can I 
execute code within my script after calling the Header(Location) page?




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




Re: [PHP] Creating multidimensional array dynamically

2001-12-06 Thread Mike Eheler

$result = mysql_query(select NAME,ATTEMPTS,COMPLETIONS,YARDS,TD,INT 
from players where pos = 'QB');
// or whatever it takes to get just qb's
while ($data = mysql_fetch_array($result)) {
foreach ($data as $key = $value) {
// I've noticed that $data stores numeric and text keys, this 
filters the numeric ones
if (!is_numeric($key)) {
$quarterbacks[$name][$key] = $value;
}
}
}

That's how I'd do it.. a little extra work, but it keeps only the data 
you want on hand.

It's also a good idea to store the name so you can reference later if 
you want to spew forth all the qbs..

Mike

J. Roberts wrote:

I can't seem to figure out how to create a multidimensional array from
a database query.  Here is an example of what I was looking for, using
NFL quarterbacks as a statistical foundation...
A record contains the following fields:

NAME, ATTEMPTS, COMPLETIONS, YARDS, TD, INT

Now I would like to be able to create an array with NAME as a key containing
the array(ATTEMPTS, COMPLETIONS, YARDS, TD, INT).

That way I would be able to do the following:

echo $quarterbacks[GARCIA][YARDS];

and get the output of 3,100 or whatever the case may be.

Thanks,
-Jamison.






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




Re: [PHP] Creating multidimensional array dynamically

2001-12-06 Thread Mike Eheler

Oops.. my bad
$quarterbacks[$data['NAME']][$key] = $value;

Mike

Mike Eheler wrote:

 $result = mysql_query(select NAME,ATTEMPTS,COMPLETIONS,YARDS,TD,INT 
 from players where pos = 'QB');
 // or whatever it takes to get just qb's
 while ($data = mysql_fetch_array($result)) {
foreach ($data as $key = $value) {
// I've noticed that $data stores numeric and text keys, this 
 filters the numeric ones
if (!is_numeric($key)) {
$quarterbacks[$name][$key] = $value;
}
}
 }

 That's how I'd do it.. a little extra work, but it keeps only the data 
 you want on hand.

 It's also a good idea to store the name so you can reference later if 
 you want to spew forth all the qbs..

 Mike

 J. Roberts wrote:

 I can't seem to figure out how to create a multidimensional array from
 a database query.  Here is an example of what I was looking for, using
 NFL quarterbacks as a statistical foundation...
 A record contains the following fields:

 NAME, ATTEMPTS, COMPLETIONS, YARDS, TD, INT

 Now I would like to be able to create an array with NAME as a key 
 containing
 the array(ATTEMPTS, COMPLETIONS, YARDS, TD, INT).

 That way I would be able to do the following:

 echo $quarterbacks[GARCIA][YARDS];

 and get the output of 3,100 or whatever the case may be.

 Thanks,
 -Jamison.









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




Re: [PHP] multi-dimensional array

2001-12-05 Thread Mike Eheler

Should work. Why not give it a try, and let the good people of this list 
know?

Mike

Jordan wrote:

Is there any way to pass a multi-dimenstional through a url.  something like
/cart.exe?item[1][1]=3

just curious.

-Jordan






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




Re: [PHP] multi-dimensional array

2001-12-05 Thread Mike Eheler

Sorry, I sent that too soon.. here's my test results:

http://localhost/test.php?var[test][5][]=test

[HTTP_GET_VARS] = Array
(
[var] = Array
(
[test] = Array
(
[5] = Array
(
[0] = test
)

)

)

)


Jordan wrote:

Is there any way to pass a multi-dimenstional through a url.  something like
/cart.exe?item[1][1]=3

just curious.

-Jordan






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




Re: [PHP] Compare strings

2001-12-05 Thread Mike Eheler

if ($str1 == $str2) ?

If that's not it, check http://download.php.net/manual/en/ref.strings.php

Mike

Mainolfi, Joe wrote:

Is there another way to compare the values of 2 strings other than strcmp().
This function is not consistent with its results and is causing so many
headaches.  I am somewhat new to Php so any help is appreciated.  Thanks

__   
Joseph D. Mainolfi Jr.
IT Specialist
American Bridge Company
1000 American Bridge Way
Coraopolis, PA 15108
(412) 631-1018 phone
(412) 631-2000 fax
[EMAIL PROTECTED]
http://www.americanbridge.net





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




Re: [PHP] RE: MySQL ORDER BY or PHP Sort?

2001-12-03 Thread Mike Eheler

Don't forget LIMIT 0,25 (I want to select about 25 rows from a table...)

SELECT * FROM mytable ORDER BY series,price LIMIT 0,25

Mike

Rick Emery wrote:

SELECT * FROM mytable ORDER BY series,price;


-Original Message-
From: René Fournier [mailto:[EMAIL PROTECTED]]
Sent: Monday, December 03, 2001 4:27 PM
To: [EMAIL PROTECTED]
Subject: MySQL ORDER BY or PHP Sort?


I want to select about 25 rows from a table, and sort them by two 
criteria. First, by each row's Series field (Baby, Genesis, Super, 
Predator, Millennium are the various Series, and the order I'd like 
the rows in the array). Within each Series, I'd like the rows sorted by 
their Price field, ascending. For example:

Baby $5
Baby $10
Baby $15
Genesis $20
Genesis $35
Genesis $50

...and so on.

Now, I know how to structure my MySQL Select statment such that the rows 
it pulls from the table will be either sorted by Price OR by Series, but 
not both, in the way I'd like. Does anyone know if it's possibly to do 
this in the Select statement itself? (I'd rather do it that way, than 
resort in PHP.)

Thanks!

...Rene

---
René Fournier
[EMAIL PROTECTED]


-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




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




  1   2   >