Re: [PHP] Re: Search like php.net's URL thingy

2008-06-18 Thread Philip Olson
 Why is an ErrorDocument insufficient or not the elegant way?
 It accomplishes the goal in a clean way, no?


 It's *WRONG*.  ErrorDocument still preserves the 404 error code, it just
 gives it a prettier face.  If the page really is there, returning a 404 for
 it is not correct.  Search engines will not index it.  You probably don't
 want that.


You may set it... so for example:

  header('HTTP/1.1 200 OK');

Regards,
Philip


Re: [PHP] Re: Search like php.net's URL thingy [0.T]

2008-06-05 Thread Philip Olson
Hello,

php.net uses a 404 error handler for this, and most mirrors store url data
in an sqlite database. A simple $_SERVER dump in your 404 page will show you
which variables are available.

Regards,
Philip


[PHP] Request for work on the php.net FAQs

2008-02-27 Thread Philip Olson

Hello everyone,

The PHP manual FAQ has not received much attention over these past  
few years, so it's outdated. This needs to be fixed.


If you would like to add questions (and ideally, with answers) to the  
FAQ then please do so by either adding them to this thread, or point  
them out, and if you would like to work on the manual itself then  
please read the HOWTO: http://doc.php.net/php/dochowto/


Note: Each extension will now have its own FAQ, which means the more  
the merrier. So the URLs will be php.net/{extension}/faq.
Note: Questions and Answers should stand the test of time, e.g., not  
require editing with every PHP version.


Regards,
Philip

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



Re: [PHP] Register globals and ini_set

2005-07-11 Thread Philip Olson

 If i use, at the beginning of my scripts,
 ini_set('register_globals', 0), register globals will be
 turned off?

 if you have php = 4.2.3 yes, otherwise no.
 it has to be set in php.ini, .htaccess, or httpd.conf

You may NEVER set register_globals at runtime with
ini_set() regardless of PHP version.

Regards,
Philip

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



Re: [PHP] Splitting Vars from MySQL in PHP

2005-04-29 Thread Philip Olson
  I remember in Perl I used to extract vars from a single fetchrow by adding
  each var name to the beginning (like this). Only this ain'ta workin :)...
  Anyone know the right syntax to do this?
  
  ($var1, $var2, $var3)= mysql_fetch_array($result, MYSQL_ASSOC)
 
 
 list($var1, $var2, $var3) = mysql_fetch_array($result, MYSQL_ASSOC);
 http://us4.php.net/manual/en/function.list.php

But remember that list() only works with numerical 
arrays so use MYSQL_NUM (or array_values()) in the 
above. For associative, extract() can be useful.

Regards,
Philip

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



Re: [PHP] Can I use $_REQUEST for file uploads?

2005-04-23 Thread Philip Olson
 Thanks for the reponse. I tested again, but it was not the problem
 with ENCTYPE. I am getting file with $_FILES. I think this is due to
 CGI configuration if not with php.ini. Because when I check the
 version by using PHP -v command, it shows 4.3.10 (cgi) but when
 check that using phpinfo() function, it is showing as PHP 4.2.2. Why
 the difference? I am working in that view to find the solution.
 Currently I got a temporary solution. I am jsut copying from $_FILES
 to $_REQUEST at the very begining of the script. Because I can't
 change all the scripts now.

Because you have two different versions of PHP installed. In
otherwords, the CGI version and most likely the module
version.

Now to answer your question, here's a quote from the 
PHP Manual:

 Note: Prior to PHP 4.3.0, $_FILES information was 
   also included in $_REQUEST.

So, $_FILES is no longer part of $_REQUEST.

Regards,
Philip

http://php.net/manual/en/reserved.variables.php#reserved.variables.request

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



Re: [PHP] following php development

2005-03-25 Thread Philip Olson

 I used to visit zend.com for the weekly summary but it seems that it
 has not been updated in a while.
 
 Besides the php-devel is there any other source of information about 
 php's development ?

While not about PHP Internals specifically, the following
do touch up on it and other PHP happenings:

 * http://www.phpdeveloper.org/
 * http://www.planet-php.net/
 
Regards,
Philip

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



Re: [PHP] OR statement

2005-03-24 Thread Philip Olson
  This work fine, however, I would like to add to the criteria above. I would
  like to say:
  
   if ($audio == Cool or junk or funky){
  
  ...
  
 
 if (in_array($audio,array(Cool,junk,funky))) {
 ...
 }
 

Yes that's one way but to answer the question:

 if ($a == 'foo' OR $a == 'bar') {


Regards,
Philip

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



Re: [PHP] ODBC Errors and Undefined functions

2005-03-21 Thread Philip Olson
 Oh and Jay... since no one else has found the answer it would be nice if
 you could post your solution here when / if you find it.

Accoding to the source, these two functions require
something to exist:

 #ifdef PHP_ODBC_HAVE_FETCH_HASH
 PHP_FUNCTION(odbc_fetch_array);
 PHP_FUNCTION(odbc_fetch_object);
 #endif

Elsewhere in the source is this:

 #if defined(HAVE_DBMAKER) || defined(PHP_WIN32) ||
 defined(HAVE_IBMDB2) || defined(HAVE_UNIXODBC)
 # define PHP_ODBC_HAVE_FETCH_HASH 1
 #endif

So you need to meet one of the above requirements to have
those two functions available.

According to the changelog, many of these checks were added
in early 2003 (4.3.2) not that this has to do with you but
when documented these should be taken into account. I'll add
this documentation later this week :)

Regards,
Philip

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



RE: [PHP] How from an html/web form I may go to a php script output(of form values)

2005-03-19 Thread Philip Olson

 If is easy please answer and this : when be online AND OPEN A FILE FROM
 A WEB LOCATION HOST - MINE WITH NOTEPAD may after I modify it, save it
 again to my hosting space WITHOUT save it to my PC first ? Please note
 that I mean using NotePad and I mean entering the host usernamepassword
 when OPEN / SAVE ...? ATTENTION: I DO NOT MEAN SAVE IT TO MY HDD FIRST
 AND AFTER UPLOAD IT !!! Please tell me the same[as for NotePad] but for
 Dreamweaver MX ?

It's difficult to know what you mean exactly but I'll assume
you want to setup FTP access with your text editors as to
edit files remotely. Notepad does not have this option but
dreamweaver does (most text editors do, such as jedit,
ultraedit, editplus, etc.). Here's a tutorial for setting up
FTP with dreamweaver:

 http://macromedia.com/cfusion/knowledgebase/index.cfm?id=tn_14787

Regards,
Philip

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



Re: [PHP] OT - C programming

2005-03-16 Thread Philip Olson

For a nice introduction to extension writing, read this
article:

  Part I: Introduction to PHP and Zend
  http://zend.com/php/internals/extension-writing1.php

As well as the various README files found within the php
source files:

  http://cvs.php.net/php-src/

And let's not forget about PECL_Gen. Although it requires
PHP 5 to run, it also allows one to quickly create
extensions that work in both PHP 4/5. There is also ext_skel
but it's slowly being replaced by PECL_Gen:

  http://pecl.php.net/package/PECL_Gen

And of course the Zend API docs:

  http://php.net/manual/en/zend.php

The Zend article above will be a five part series, which is 
pretty cool :)

Regards,
Philip

On Tue, 15 Mar 2005, Brian wrote:

 To understand the *'s just google for c pointer tutorial, you're
 likely to find alot of helpful material.
 
 
 On Tue, 15 Mar 2005 11:37:26 -0500, Jason Barnett
 [EMAIL PROTECTED] wrote:
  Rasmus Lerdorf wrote:
   Jason Barnett wrote:
  
   Jay Blanchard wrote:
  ...
   In the end you are probably much better off learning a bit of C or C++
   and writing your own PHP extensions than hoping that someone will make a
   compiler that will magically speed everything up.  PHP was designed
   specifically with this in mind.  The idea is to keep things that don't
  ...
   better performance than any PHP Compiler ever will.  And it really
   isn't that hard to write a PHP extension.
  
   -Rasmus
  
  I actually looked into building my own extension before.  I saw some of
  the docs from the talks.php.net site and most of it made sense to me.
  So I agree that the PHP - extensions interface is simple enough for a
  poor slob like myself to understand.
  
  Can you (or anyone else for that matter) give me a book recommendation
  that explains C coding to someone with intermediate PHP skills?
  
  I already have George Schlossnagle's book and it's great (it taught me a
  lot of what I know about the source), but it assumes a level of
  proficiency in C that I just don't have.
  
  I know that you have to allocate memory for variables, you have strict
  types (although I'm vaguely familiar with a zval), but some things like
  all of those **'s I see in the source code just don't make sense to me.
Recommendations, anyone?
  
  --
  Teach a man to fish...
  
  NEW? | http://www.catb.org/~esr/faqs/smart-questions.html
  STFA | http://marc.theaimsgroup.com/?l=php-generalw=2
  STFM | http://php.net/manual/en/index.php
  STFW | http://www.google.com/search?q=php
  LAZY |
  http://mycroft.mozdev.org/download.html?name=PHPsubmitform=Find+search+plugins
  
  
 
 
 -- 
 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: recommending a PHP book?

2005-03-15 Thread Philip Olson



Do.  Not.  Cross.  Post.

Use ONE mailing list at a time.



Please have all further replies to this unfortunate thread
go to php-general and only php-general.

Regards,
Philip

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



Re: [PHP] CLI CGI

2005-02-04 Thread Philip Olson
 Can I use the CGI executable at the command-line?

Yes.

 In other words, what is the diference between the CLI
 and CGI Version?

See the manual, it explains the differences:

  http://php.net/features.commandline

Regards,
Philip

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



RE: [PHP] escaping quotes

2005-01-27 Thread Philip Olson

What also works is this:

 print 'value='. $foo['bar'] . '';

Read the manual section on strings:

 http://php.net/types.string

Regards,
Philip

On Thu, 27 Jan 2005, Giles wrote:

 Thanks, that works great.
 
 Knew that worked for JavaScript but didn't know it worked for PHP.
 
  print(value=\ . $attributes[messageSubject] . \);
 
 Slight typo there:
 
 value=\ . ...

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



Re: [PHP] Is a PECL a black whole?

2004-09-03 Thread Philip Olson
  It took me a while to find an explanation of what a PECL is. I kept 
  reading
  comments about things being moved to a PECL but I saw nothing about what 
  is
  in a PECL or how to get anything out of a (the?) PECL. As far as I knew,
  there is a danger of all of PHP being in a PECL.
 
  There is documentation on the way for what to do with these PECL
  extension on how to install and upgrade them.
 
 
 Perhaps you did not read everything I said, since there is more to what I 
 said than what you quoted, and in the other part of what I said, I did say 
 there is documentation as you say. Is that more or less muddy?
 
 So in other words, yes, there is documentation. The point I was making is 
 that the documentation is not as easy to find as it could be. So the issue 
 is not about use of PECL as much as it is use of the PHP documentation to 
 find the PECL (documentation).

All PECL extensions are or will be documented at php.net/manual/ but
currently this is not the case, for several reasons, most notably lack
of people to create said documentation. While the current state is
less than ideal, don't think it's how it will continue to be nor how
it's intended to be. And eventually links to this documentation will
exist at pecl.php.net/{extname}, there is an open bug report on this.

No, PECL is not a black hole, but it is a new hole looking to be filled.

Regards,
Philip

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



RE: [PHP] Fatal error: Call to undefined function

2004-08-28 Thread Philip Olson
  It's been awhile since I've done php on Windows, but I think 
  you have to uncomment the mysql dll in the php.ini file (make 
  sure you're editing the right one as per phpinfo), and restart 
  your web server. 

 Thanks, John. I have the line uncommented, am editing php.ini in my winnt
 directory and have restarted the server. No magic, yet. 

And make sure libmysql.dll is available in your systems PATH
and a nice way to do that is adding the PHP dir to your PATH
but a less cool way would be to copy libmysql.dll into the
Windows sytem directory because that directory is in the
PATH.  Don't do that though..

The manual talks about all of this, read the installation
section:

  http://php.net/manual/en/install.windows.manual.php

It says how to set your PATH (via system environmetn variables)
and the MySQL documentation also refers to all of this:

  http://www.php.net/mysql

Both of the above manual pages link to related FAQs so read
those as well.

Regards,
Philip

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



Re: [PHP] Cannot Load DLLs (WinXP, Apache 2, PHP 5)

2004-08-19 Thread Philip Olson
  I can't get PHP to load php_mysql.dll, required to use the mysql_*() 
  functions.
  
  I have tried a variety of values for extension_dir, including 
  C:/php/ext, C:\php\ext, C:\php\, ./ext/, ext/. I have copied 
  php_mysql to all these directories, but it is not loading it.
  
  PHP is stored in C:/php, and works perfectly apart from not finding the 
  MySQL dll file.
  
  If you could advise me for how to get PHP to load this DLL, I would be 
  very grateful!
 
 This was just disussed a few days ago. Copy the libmysql.dll file **that 
 comes with PHP5** into the windows/system32/ directory.

New installation instructions exist that recommend never copying any
files to the Windows system directory.  It's preferred to leave all files
in the PHP directory and make it (the PHP folder) available to the systems
PATH by editing the appropriate system environment variable.  People copy
files into the Windows system directory because it's in the PATH so no
additional setup is required.  Do not fall into this trap.  Add the PHP
directory to your PATH as doing so will make the world a better place.
The updated manual is as follows:

 http://php.net/manual/en/install.windows.manual.php

If setup this way the above problem would not exist, PHP will find
libmysql.dll.  A FAQ on editing the systems path is here:

 http://php.net/manual/en/faq.installation.php#faq.installation.addtopath

Regards,
Philip

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



Re: [PHP] Need Someone to Develop a Project

2004-08-19 Thread Philip Olson
 It is possible that this newsgroup is not the appropriate forum for this
 request. Is there a site somewhere where I can post the spec and invite
 bids? I recall that there are several, but I cannot remember where they
 are.

http://www.php.net/links.php#jobs

Regards,
Philip

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



Re: [PHP] Looking for article

2004-08-13 Thread Philip Olson

Read this faqts:

  How can I pass variables to a script in the url 
  like /script/var1/var2
   http://www.faqts.com/knowledge_base/view.phtml/aid/124/fid/6

Regards,
Philip


On Thu, 12 Aug 2004, Ashley M. Kirchner wrote:

 
 Anyone have an article written, or can point me to one that talks 
 about converting URLS from:
 
 http://www.domain.com/script.php?var=1var=2
 
 ...to:
 
 http://www.domain.com/script/var1/var2
 
 -- 
 M | I haven't lost my mind; it's backed up on tape somewhere.
   +
   Ashley M. Kirchner mailto:[EMAIL PROTECTED]   .   303.442.6410 x130
   IT Director / SysAdmin / WebSmith . 800.441.3873 x130
   Photo Craft Laboratories, Inc.. 3550 Arapahoe Ave. #6
   http://www.pcraft.com . .  ..   Boulder, CO 80303, U.S.A.
 
 -- 
 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] Is there a brian I can pick?

2004-07-26 Thread Philip Olson

 I've run into a small bump in some code I'm writing for a membership 
 database. The first thing that needs to be done is an index of all 
 states in the US with members. The fun part is that the state 
 information is stored as the abbreviation in the database (ie MI, WI) 
 and the HTML page needs to display the full name of the State. I want to 
 display the information in a four column table that kicks out as many 
 rows as needed. Now in order to get the full name of the state, I'm 
 running the state result through a switch statement. Actaully, it's 
 working rather well expect for this little issue:
 
 Row 8: South Dakota Tennessee Texas Virgina
 Row 9: West Virgina Wisconsin Texas Virgina
 
 I need to kill that extra Texas and Virgina.here's how I'm doing this:
 
 table border=1
 ?
 $query=mysql_query(SELECT DISTINCT state FROM members WHERE 
 country='US' ORDER BY state ASC);  

Try something more like this:

table
 tr
?php
// Assuming this ($statenames) is a full list
// and that uppercase appreviations come from the DB
// and that you implement error handling
$statenames = array('WA' = 'Washington', 'OR' = 'Oregon');
$i  = 1;
$count  = mysql_num_rows($query);
while ($row = mysql_fetch_assoc($query)) {
echo \ttd. $statenames[$row['state']] ./td\n;
if (($i % 4) === 0  $count !== $i++) {
echo /tr\ntr\n;
}
}
?
 /tr
/table

Regards,
Philip

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



Re: [PHP] Unexpected T_ENCAPSED...

2004-07-24 Thread Philip Olson
 Sorry, let me clearify.. unless UserId is an integer, quote it !!

And quoting integers is not a problem, I even prefer it.  IMHO we should
tell people to quote all values so if someone forgets to do any sort of
input validation (i.e. make sure it's actually an integer) there won't be
a major problem otherwise problems (including SQL injection) may arise.

Regards,
Philip

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



Re: [PHP] Unexpected T_ENCAPSED...

2004-07-24 Thread Philip Olson
  And quoting integers is not a problem, I even prefer it.  IMHO we should
  tell people to quote all values so if someone forgets to do any sort of
  input validation (i.e. make sure it's actually an integer) there won't be
  a major problem otherwise problems (including SQL injection) may arise.
 
 I wouldn't recommend that you recommend that to everyone. Not all 
 databases will allow you to enter a STRING into an numeric field. MySQL 
 may be lenient on it, but that doesn't mean you should get in the habit 
 of using it that way. Properly validate your data and none of this is an 
 issue. :)

Yeah, we all know you want magic_quotes_gpc off by default too but can
PHP coders really be that trusted? ;)  I was only referring to MySQL, will
look into the string/int index issue a bit later.  Yes it would be nice if
people validated data but having to write about that everytime gets old.
My advice wasn't ideal, I'll admit that.

Regards,
Philip

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



Re: [PHP] good PHP to PDF libary?

2004-07-23 Thread Philip Olson
 Im looking for some good and complete and advanced PHP to PDF libarary.
 
 So far, i have seen pdflib and ros pdf class. But i really would like
 to hear from you guys what is best?
 
 my only main goal for this is to create a low - res pdf and a hi - res
 business card pdf template.

Several are listed in this faq:

  http://www.php.net/manual/en/faq.using.php#faq.using.freepdf

Regards,
Philip

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



Re: [PHP] PHP-5 book

2004-07-21 Thread Philip Olson
 Can someone advise me of a very good PHP-5 book.

Hands down the best:

 Advanced PHP Programming
 by George Schlossnagle

Regards,
Philip

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



Re: [PHP] Won't get $_SERVER['PHP_AUTH_USER']

2004-07-20 Thread Philip Olson
 Has there been any changes concerning $_SERVER['PHP_AUTH_USER'] in PHP5? 
 My news-script won't let me login after I changed from PHP 4.3.7 to 
 5.0.0 (Win32, Apache 1.3.31, php as module). I've checked 
 var_dump($_SERVER) and there's no PHP_AUTH_USER in the list, just 
 PHP_AUTH_PW. How come?
 
 It's called from this:
 header(WWW-Authenticate: Basic realm=\My Site\);

This is a bug in PHP 5.0.0, here's the report:

  http://bugs.php.net/bug.php?id=29132

Regards,
Philip

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



Re: [PHP] Re: newbie needs help in getting php and MySQL integrated

2004-07-20 Thread Philip Olson
  Windows XP SP1
  Norton Antivirus and Internet Security
  Apache 2
  PHP 5
  MySQL 4.0.16
  
  All seem to work. I can run PHP scripts on the Apache server without any trouble.  
  I have MySQL running as a service and the basic SQL command line commands and 
  winmysqladmin shows all ok (to my limited knowledge so far).  
  
  So as the PHP installation instructions stated :
  
Since PHP 4.0.5 MySQL, ODBC, FTP, Calendar, BCMath, COM, PCRE,
Session, WDDX and XML support is built-in. You don't need to
load any additional extensions in order to use these functions.
 
 MySQL extension is included with PHP5, BUT NOT BUILT IN - thankfully ;)
 It needs enabling in php.ini
 
 The next beginner step is 'phpinfo();' which should be your first page 
 to build, THEN you will see what is actually loaded ;)

Actually the next step (or perhaps the first step :) would be to read the
following:

  http://www.php.net/mysql

It links to this faq:

  http://www.php.net/manual/en/faq.databases.php#faq.databases.mysql.php5

Which mentions the libmySQL.dll DLL, a very important DLL!  This faq (or a
different/similar one) will soon mention this error and solution, and the
mysql docs will soon make it even clearer.  The Windows extension docs
will also be updated, I am surpised they have not been.

Regards,
Philip

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



Re: [PHP] PHP error catching....

2004-07-20 Thread Philip Olson
 What are those php functions that catch the PHP errors, not display it and
 do something to it while the user load a webpage.   I don't remember what
 those are.  :-(

Look around set_error_handler()

Regards,
Philip

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



Re: [PHP] file_exists() to search for *.xml file with a wild card???

2004-07-20 Thread Philip Olson
 I would like to use the file_exists() or something similar to check for the
 existance of any of the xml files regardless of what filename it use.   Like
 file_exist(*.xml) for example.  Anyone know??

You may use glob(), 

  http://www.php.net/glob

Regards,
Philip

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



Re: [PHP] [php] error in manual?

2004-07-20 Thread Philip Olson

Yes you're correct, this was fixed about a week ago and will show up when
the manual is next built (which should be soon), here's the diff:

http://cvs.php.net/diff.php/phpdoc/en/language/oop5/visibility.xml?r1=1.2r2=1.3

When you find errors like this be sure to file a doc bug report at
bugs.php.net but be sure to search the bug database first!  For example
here's the report for this very bug:

http://bugs.php.net/bug.php?id=29187

Regards,
Philip

On Tue, 20 Jul 2004, Nick W wrote:

 On the page
 http://www.php.net/manual/en/language.oop5.visibility.php
 
 the first part reads:
 
  The visibility of a member or method can be defined by prefixing the 
 declaration with the keywords: public, protected or private. Public declared 
 items can be allow access to any caller. Protected limits access access to 
 only classes inherited. Protected limits visiblity only to the class that 
 defines the item.
 
 
 should be [I think]
 
  The visibility of a member or method can be defined by prefixing the 
 declaration with the keywords: public, protected or private. Public declared 
 items can be allow access to any caller. Protected limits access access to 
 only classes inherited. PRIVATE limits visiblity only to the class that 
 defines the item.
 
 -- 
 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] stripslashes() when reading from the DB

2004-07-12 Thread Philip Olson

  I usually stripslashes() when I read the info from the database (MySQL).
Because the information was inserted after adding slashes, or the
  system has magic_quotes_gpc set to ON.
  
  I'd like to know, if I can do stripslashes() directly, as it is suposed
  that all data was inserted into DB after slashing the vars. I mean,
  should I check or not before if magic_quotes_gpc are on ?
  
  As I know, magic_quotes_gpc has nothing to do with info readed from the
  DB, as it only affects Get/Post/Cookie values.
  
  I think to make a check like this:
  
  $result = mysql_query(SELECT );
  $row = mysql_fetch_assoc($result);
  
  foreach ($row as $key = $value) {
   $row[$key] = stripslashes($value);
  }
  
  But not sure if it really necessary, as i'm getting some confusing results.
  
 
 What you *should* be doing is check for magic quotes when inserting into the DB.
 
 if(!get_magic_quotes_gpc()) {
   $value = mysql_real_escape_string($value);
 }
 
 $query = 'INSERT INTO table (field) VALUES ('.$value.')';
 mysql_query($query);

To add further comment.  If you're required to run stripslashes() on
data coming out of your database then you did something wrong.  Your
code would have essentially looked like the following before insertion:

  $var = addslashes(addslashes($var));

Where 'magic_quotes_gpc = on' essentially executed one of those
addslashes().  The above use of get_magic_quotes_gpc() shows you 
how to add slashes just once thus not having a bunch of \' type 
badness inside your database.  Remember backslashes are only 
added to make proper strings for db insertion so the backslashes 
should never actually make it into the database.

Regards,
Philip

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



Re: [PHP] Malicious SQL

2004-07-08 Thread Philip Olson

  on the contrary:
  sql = mysql_query(select * from users where name='.$name.');
 
  will simply look for a user with a name of Jim; delete from users; and
  return no results found.
 
 But I can also enter:
 jim'; delete from users
 
 You need to catch if there's a quote in the $name too, and escape that.

One thing to remember is mysql_query() will execute just one (the first)
query so use of ; won't do anything in the above except break the
query.  Still though the point is well taken, be sure to add slashes
(once) and put single quotes around the criteria ($name) and life will be
grand.  Quotes around numerical values won't hurt (such as id = '$id')
although it's not required.  If you choose not to do that then be sure
it's numerical before use (like cast it as an int, or check 
is_numeric(), etc. ...).  Some people check for ';' in the request
variable and if found yell at the user, that can be fun.  bugs.php.net
does this.

In regards to the controversial magic_quotes_gpc PHP directive, I feel it
should remain on by default but if you know what you're doing then set it
yourself.  Scripts that work everywhere should of course work perfectly
with it on or off.  php.ini-dist (the default php.ini) has it on while the
php.ini-recommended has it off.  You must know what you're doing to use
the 'recommended' version of php.ini.  PHP is a newbie friendly language
and newbies are for the most part clueless and don't know what strings or
integers are, or why data should be escaped, or what data validation is or
why it's important.  This is why magical quotes exist as without them
just think how many people would keep getting malicious SQL in their
code and blame PHP, or how seemingly random SQL syntax errors would crop
up.  For these reasons dealing with Why do I get \' everywhere type
questions is worth it, and why magic_quotes_gpc exists as a php.ini 
directive.

Regards,
Philip

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



Re: [PHP] import_request_variables

2004-07-06 Thread Philip Olson

 I get error : import_request_variables while I make a script to call a
 variable.
 
 This my header (in my script -- error) :
 
 import_request_variables( GPC );
 
 anybody knows why this happen ?


So, what's the exact error PHP gives you?

Regards,
Philip

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



Re: [PHP] import_request_variables

2004-07-06 Thread Philip Olson

   I get error : import_request_variables while I make a script to call a
   variable.
  
   This my header (in my script -- error) :
  
   import_request_variables( GPC );
  
   anybody knows why this happen ?
 
 
  So, what's the exact error PHP gives you?


 I got this error at browser :
 
 Fatal error: Call to undefined function: import_request_variables() in
 /var/www/html/zm.php on line 21


The import_request_variables() function became available 
in PHP 4.1.0 so you have an older version then this (which 
is a bad idea!), consider upgrading.  The manual has version
information, and phpinfo() tells all (including the PHP
version you're using).

Also, your code is *essentially* a runtime version of the much
hated register_globals PHP directive so you have the following
options to mimick the above behavior:

 1) Upgrade PHP! (preferred)
 2) Turn on register_globals in php.ini or .htaccess
 3) Use extract() on various $HTTP_*_VARS variables

Ideally you'd upgrade PHP and use either the superglobals
and/or use import_requests_variables() by using its second 
parameter, something like:

  import_request_variables('gpc', 'r_');

  echo $r_somevariable;

Adding the prefix is a good idea here as you will KNOW these
variables came via the REQUEST as opposed to being 
somewhere from within your script.  Why do you want to
know this?  Read:

  http://www.php.net/manual/en/security.globals.php

So in short you really should upgrade PHP and then use these
request variables as explained here:

  http://www.php.net/manual/en/language.variables.external.php

Regards,
Philip

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



Re: [PHP] Help with array / list looping syntax

2004-06-29 Thread Philip Olson
  I need some help with a looping syntax. In english, a is used before
  words that begin with consonants - an is used before words that start
  with vowels. I'm trying to create a loop that checks this state and inserts
  the correct word in the echo line. Below is the sloppy version of what I'm
  trying to do...
  
  ?php
  if (substr($table['field'], 0, 1)==a) OR (substr($table['field'], 0,
  1)==e) OR (substr($table['field'], 0, 1)==i) OR
  (substr($table['field'], 0, 1)==u) OR (substr($table['field'], 0,
  1)==y) }
  echo 'Member has an ' . $table['field'] . ' who is...';
  } else {
  echo 'Member has a ' . $table['field'] . 'who is...';
  }
  ?
  
  There's got to a cleaner way to do this. Perhaps using a list or array
  containing the vowels and steping through it checking the first letter of
  the field contents against each member of the list. But, I don't know how
  to code this system. Please help.
  
 
 How about this?
 
 $vowels = array('a', 'e', 'i', 'o', 'u');
 echo 'Member has a'.(in_array($table['field'][0], $vowels) ? 'n' :
 '').' '.$table['field'].' who is...';

Yet another solution (just for fun):

$vowels = 'aeiou';
if (false !== strpos($vowels,strtolower($table['field']{0}))) echo 'n'; 

Regards,
Philip

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



RE: [PHP] Re: getting query string from referer website

2004-06-28 Thread Philip Olson

 $referer =
 http://search.yahoo.com/search?p=pianist+web+sites+designei=UTF-8fr=fp-ta
 b-web-tcop=msstab=;
 if (strpos($referer, q=) != FALSE) { $query = q=;} else if
 (strpos($referer, p=) != FALSE) { $query = p=;}
 $searcharray = explode(, substr($referer, (strpos($referer, $query)+2)));
  $searchstring = urldecode($searcharray[0]);
 echo Your search words are: $searchstringbr /br /;

Consider this example, not well tested but it should 
also work:

// This is the key, these functions are sexy
$url = parse_url($referer);
parse_str($url['query'], $query);

$search_keywords = '';
if (is_array($query)) {
foreach ($query as $type = $keywords) {
if (in_array($type, array('q','query','p','qkw'))) {
$search_keywords = urldecode($keywords);
break;
}
}
}
if (empty($search_keywords)) {
echo Unknown keywords, perhaps you didn't use a SE;
} else {
echo Your searchwords are: {$search_keywords} br /\n;
echo You used the host: {$url['host']} to get here.;
}

Regards,
Philip

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



Re: [PHP] Re: Error Reporting

2004-06-28 Thread Philip Olson
On Mon, 28 Jun 2004, Daniel Kullik wrote:

 Tom Chubb wrote:
  I ave a strange problem with my error reporting!
  I have set php.ini to: error_reporting  =  E_ALL but I don't see any errors.
  (After I was happy things were working on my Apache Test Server, I uploaded
  to my web host and discovered errors.)
  Thanks,
  
  Tom
 
 Make sure that display_errors in your php.ini is set to On.
 You might also use ini_set() to set it to On at the beginning of each 
 of your scripts. Some prepend-file is suggested.
 
 
 Note (php.ini):
 
 For production web sites, you're strongly encouraged to turn this 
 feature off, and use error logging instead (see below).  Keeping 
 display_errors enabled on a production web site may reveal security 
 information to end users, such as file paths on your Web server, your 
 database schema or other information.

Also note that turning it on at runtime (ini_set) won't 
work if a parse error exists as the code want execute so 
the errors won't be displayed

Regards,
Philip

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



RE: [PHP] a stupid question

2004-06-25 Thread Philip Olson

 I cant figureout the syntax please help
 
 echo Some text.aFunction().some more text;
 
 The function is not working.

 Your problem is the paren's
 
 echo 'some text' $aFunction 'some more text';
 
 You need double quotes for the entire string, but single 
 quotes around the text so it knows it is text.  

This is very much incorrect, not sure where to begin
but please ignore this advice.  A string is a string
is a string is a string:

  http://www.php.net/types.string

I'm 99% sure the problem is aFunction() is echoing
a value as opposed to returning one, this is a
common question answered here:

  http://www.php.net/manual/en/faq.using.php#faq.using.wrong-order

If that doesn't answer your question then please
post the code.

Regarding the subject of this thread you should consider
asking smart questions by reading the following in its
entirety:

  http://www.catb.org/~esr/faqs/smart-questions.html

Very useful for all parties involved! :)

Regards,
Philip

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



Re: [PHP] string function that adds before and after

2004-06-25 Thread Philip Olson
 There's a number of functions in PHP that will give me the position of
 the *first* instance of the matched string, but it doesn't look like the
 function would keep searching after the first match.  Anyway, am I
 overlooking a function that already has the functionality that I'm
 searching for?  Or does anyone have any ideas how I can accomplish this
 efficiently since my search strings can be quite long?
  
  
  try this
  
  preg_replace('/(weather)/i', strong$1/strong, 'This is the worst
  weather ever.  Weather around
  here is terrible. ')
 
 Thanks Matt.  I think that will do the trick.  Let me see if I 
 understand it correctly.  the i will make the search case-INsensitive, 
 and the parenthesis around weather will store what it finds in the 
 variable $1?  Is that right?

Also consider str_replace() as it's faster albeit case
sensitive.  str_ireplace() exists in PHP 5.  Just another
option, I'm surprised you didn't find it when looking
around strpos() and friends.

Your assumptions above are correct, sorry Matt for stepping
in! :)  I prefer cold weather.

Regards,
Philip

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



Re: [PHP] socket_set_block undefined

2004-06-25 Thread Philip Olson

 I'm trying to use socket_set_block and php.net says (php4 = 4.2, php5).
 
 I'm using version 4.3.1 but I get this error
 
 Fatal error: Call to undefined function:  socket_set_block() in .
 
 Any idea why this is? Has the name changed or been something else?
 
 socket_set_nonblock() work fine.

Strange as the name has not changed and the function
requires nothing special (no IF block around it), here's 
the source:

 http://lxr.php.net/source/php-src/ext/sockets/sockets.c#715

Since socket_set_nonblock() exists you must have
the socket extension available so this is odd.
Are you sure this problem exists and it's not
something silly?  Seems like an impossible problem
assuming your php source wasn't modified :)

Regards,
Philip

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



RE: [PHP] socket_set_block undefined

2004-06-25 Thread Philip Olson

Perhaps you have multiple PHP versions on your system?  Like 
an old CLI or CGI laying around somewhere?  Maybe try checking
the PHP version in the code as well.  If it's not that then
I have no idea.

Regards,
Philip

On Fri, 25 Jun 2004, Josh Close wrote:

 Well, here's the code i'm using. Let me know if I'm doing something silly.
 
 if(!socket_set_nonblock($this-socket)){
   if($this-logging){ syslog(LOG_ERR, Could not set socket to nonblock.); }
   exit();
 }
 
 //connection part goes here
 
 if(!socket_set_block($this-socket)){
   if($this-logging){ syslog(LOG_ERR, Could not set socket to block.); }
   exit();
 }
 if($this-loggging){ syslog(LOG_INFO, Socket set to block.); }
 
 
 
  and here's the error
 
 Fatal error: Call to undefined function:  socket_set_block()
 
 -Josh
 
  -Original Message-
  From: Philip Olson [mailto:[EMAIL PROTECTED]
  Sent: Friday, June 25, 2004 2:11 PM
  To: Josh Close
  Cc: PHP (E-mail)
  Subject: Re: [PHP] socket_set_block undefined
 
 
 
   I'm trying to use socket_set_block and php.net says (php4
  = 4.2, php5).
  
   I'm using version 4.3.1 but I get this error
  
   Fatal error: Call to undefined function:
  socket_set_block() in .
  
   Any idea why this is? Has the name changed or been something else?
  
   socket_set_nonblock() work fine.
 
  Strange as the name has not changed and the function
  requires nothing special (no IF block around it), here's
  the source:
 
   http://lxr.php.net/source/php-src/ext/sockets/sockets.c#715
 
  Since socket_set_nonblock() exists you must have
  the socket extension available so this is odd.
  Are you sure this problem exists and it's not
  something silly?  Seems like an impossible problem
  assuming your php source wasn't modified :)
 
  Regards,
  Philip
 
  --
  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] [Q]PHP not taking input values from forms

2004-02-12 Thread Philip Olson
On Thu, 12 Feb 2004, Dan Aloma wrote:

 that tag is working fine and shows me the info. For some reason php will 
 take input values only from the URL, not from the html code. any ideas?

A few questions:

  a) What's the exact version of PHP?
  b) Please post the smallest possible form that creates this 
 problem.
  c) And how are you attempting to access these form values?

If you're interested in some working examples and related
information, have a look at the following manual page:

  http://www.php.net/variables.external

Regards,
Philip

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



Re: [PHP] [Q]PHP not taking input values from forms

2004-02-12 Thread Philip Olson

   that tag is working fine and shows me the info. For some reason php will
   take input values only from the URL, not from the html code. any ideas?
 
 A few questions:
 
a) What's the exact version of PHP?
b) Please post the smallest possible form that creates this
   problem.
c) And how are you attempting to access these form values?
 
 If you're interested in some working examples and related
 information, have a look at the following manual page:
 
http://www.php.net/variables.external

 Thanks for the suggestions, first of all. I tried that exact code from the 
 code you included and I cut and pasted the Simple HTML Form, and below 
 that I pasted the Accessing Data... php code. When I go to the page, all 
 it does after I hit the submit button with data in the fields, is say no 
 input file specified. But when I run it through the url giving the input 
 names with values, it returns them. I tried getting it working with like ten 
 people so far, and no one's been able to figure out... I am running PHP 
 4.3.4, btw.


Be sure you rename the action part of the simple html form 
to whatever page you are using, instead of foo.php, as otherwise 
it will literally attempt to access foo.php  I'm guessing this 
is what's happening by seeing no input file specified.

Either fix that or on that same manual page is the example 
titled More complex form variables, this prints to itself
as it demonstrates a use of the popular $_SERVER['PHP_SELF'] 
variable.

Also, it's important you realize the difference between POST
and GET, and how to access them, so you may want to read that
manual page too. (hint: GET is through the URL's QUERY_STRING
(the stuff after the ?) while POST is not).

Regards,
Philip

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



Re: [PHP] Looking for Spam free php form

2003-11-17 Thread Philip Olson
  I am looking for a canned php form which hides the recipient email from
  prying eyes. Everything I have found uses a hidden field.
 
 If you only need the email address on the back end, why not encode it
 (using your flavor of choice) and stick that value in the hidden field.  Then,
 upon submission, just decode and use.

Maybe I am misreading this question but why not just use id's
instead.  For example, in your database you might have:

  id name  email
  1  john  [EMAIL PROTECTED]
  2  fred  [EMAIL PROTECTED]

In the form you use the names, and unique ids, and the backend
will get the email addresses from the ids.  This way they choose 
names to send to but don't see the email addresses.

Regards,
Philip

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



Re: [PHP] how do i get assosciative name in foreach

2003-08-14 Thread Philip Olson


$arr = array('key' = 'value');
foreach ($arr as $k = $v) {
echo $k is the name/key, $v is the value;
}

Regards,
Philip


On 8 Aug 2003, Dan Anderson wrote:

 I want to send an assosciative array to a foreach loop.  Is there any
 way to get the name?
 
 For instance, now I have:
 
 ?php
 
 $array['element1']['name'] = 'element1';
 $array['element1']['value'] = 'value1';
 $array['element2']['name'] = 'element2';
 $array['element2']['value'] = 'value1';
 
 foreach ($array as $element)
 {
   if ($element['name'] == 'element1')
 { do_something(); }
   elseif ($element['name'] == 'element1')
 { do_somethingelse(); }
 }
 
 ?
 
 I want to do:
 
 ?php
 
 $array['element1'] = 'element1';
 $array['element2'] = 'element2';
 
 foreach ($array as $element)
 {
   // assuming get_assoc gets the assosciative name
   if (get_assoc($element) == 'element1')
 {get_assoc($element) do_something(); }
   elseif ( == 'element1')
 { do_somethingelse(); }
 }
 
 ?
 
 Is what I want possible?
 
 Thanks in advance,
 
 Dan
 
 
 -- 
 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] Old version of PHP

2003-08-10 Thread Philip Olson
   Thanks for all the feedback, guys. Is there an errata page somewhere
   lists known bugs in the PHP interpretter?
 
  google  php bugs

 I appreciate the (rather indirect) pointer to the PHP bug tracking site - I
 didn't know about that. Errata, it seems to me anyway, perform a different
 purpose. I don't mind RTFM-style responses, but please at least read my
 question more closely.
 
 I find the reporting bugs link on the PHP website a bit misleading since
 that page serves more purposes than simply reporting bugs.

There is no Errata per se, but there is a changelog that
lists bugs/fixes and even links to the bug reports in
question.  One day the manual will have its own changelog
that will list every change, such as new parameters, 
name changes, default value changes, etc.  But it doesn't
exist yet.

Here are the changelogs:

  http://www.php.net/ChangeLog-4.php
  http://www.php.net/ChangeLog-5.php

Regards,
Philip


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



Re: [PHP] Trouble getting $HTTP_RAW_POST_DATA

2003-08-01 Thread Philip Olson

Your script should work fine, and to fix claims made in
this thread:

  a) $HTTP_RAW_POST_DATA is NOT an array, it's a string.
  b) It does not live in $_SERVER, or rely on register_globals.

Your code is wrong because you don't provide names for your
fields, so there is no POST data.  Assign your text field
a name, and your submit field a name, and it will work.
Also, keep in mind that $PHP_SELF existing requires the
PHP directive register_globals to be on.

Regards,
Philip

p.s. input type=text name=foo value=bar



On Fri, 1 Aug 2003, Balazs Halasy wrote:

 I need to have the contents of $HTTP_RAW_POST_DATA because of
 non-regular uploads (from browser to my home-made WevDAV server implementation 
 (done in PHP)). However, no matter what I
 do, it is always NULL. I guess the following script should return
 SOMETHING in $HTTP_RAW_POST DATA if always_populate_raw_post_data = On is
 added to the php.ini file (and yes, I've restarted apache :-)... so, why
 is it empty and how can I get the RAW post data? My PHP version is 4.3.2.
 
 test.php: 
 
 form action=?echo($PHP_SELF)? method=post 
 input type=text value=you-suck 
 input type=submit 
 /form 
 ?php 
 echo(Raw post data: .$HTTP_RAW_POST_DATA.br\n); 
 echo(Raw post data decoded:
 .base64_decode($HTTP_RAW_POST_DATA).br\n); 
 echo(hr); 
 phpinfo(); 
 ? 
 
 
 
 Allman
 
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 



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



Re: [PHP] Missing php.ini file

2003-07-14 Thread Philip Olson
On 14 Jul 2003, Chris Blake wrote:

 On Mon, 2003-07-14 at 14:13, John W. Holmes wrote:
  .
  
  You can normally just get a new php.ini from here:
  
  http://cvs.php.net/co.php/php4/php.ini-dist
  
  but it's giving a 505 error right now. May have to wait a bit.
  
  First, create a PHP page with just the function ? phpinfo(); ? on it. 
  Load up that page and look in the first block. Look for the line that 
  says: Configuration File (php.ini) Path. If a php.ini file is listed 
  there, that's the one that PHP is using. If just a path is shown, then 
  PHP is using its defaults and that's where you should place the php.ini 
  file when you get one. You can download the appropriate distro for your 
  OS and just copy the php.ini from there, also. They are normally called 
  php.ini-dist and php.ini-recommended that you rename into php.ini.
  
  -- 
  ---John Holmes...
 
 
 Thanks John,
 
 I`m also getting the 505 and will check back later..
 
 Thanks for the tip/link, much appreciated...

You'll be waiting a long time, until the end of time :)
Because the php4 module is now named php-src, so change
that in the url and you'll be set.

Regards,
Philip


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



Re: [PHP] Strange Problem

2003-07-14 Thread Philip Olson

This is an IIS issue.  The install.txt has specific
information on this topic, have a look.  Also, this comes
up a lot and the following bug report is full of newbies
asking bogus questions but it also contains some good info:

 http://bugs.php.net/bug.php?id=12061

So it looks like security/permission settings where the
php cgi lacks permission.  Also:

 http://php.net/manual/en/faq.installation.php#faq.installation.cgierror

Regards,
Philip



On Mon, 14 Jul 2003, Curt Zirzow wrote:

 Haseeb [EMAIL PROTECTED] wrote:
   
   
  Hi all,
  this is a very strange problem. i don't know where i am doing something that
  is causing this. the problem is that i am working on a web portal  entirely
  in  php. i have a few hidden pages. that do the queries to the DB. now when
  i redirect to any page for query i get this error
  CGI Error
  The specified CGI application misbehaved by not returning a complete set of
  HTTP headers. The headers it did return are:
   
  strangely  when i hit F5 or refresh the page i get redirected to the desired
  page. i have checked for any whitespaces. there are none. i have checked and
  double checked this. i am using win2k,IIS, php 4.3.0
   
 
 Have you checked your log file, usually there is an error in the log
 file telling you what went wrong.
 
 
  again i have checked all the files for any space left that could be causing
  problem but i found none.
 
 This usually happens when non http headers are sent to the server when
 it wasnt expecting them, php should be handling this. But to check this
 make sure you try sending out a header('Content-Type: text/plain') first
 thing in the script then dont do a redirect and see if some text is
 showing up that shouldn't be.
 
   
  i hope i make my self clear.
  Haseeb
   
 
 Curt.
 -- 
 
 
 -- 
 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] Missing php.ini file

2003-07-14 Thread Philip Olson
  You'll be waiting a long time, until the end of time :)
  Because the php4 module is now named php-src, so change
  that in the url and you'll be set.
 
 Thanks. Someone needs to change the link in the Configuration chapter of the
 manual, too, b/c that's how I always find it. :)

Done, fixed in CVS!

Regards,
Philip


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



Re: [PHP] imagecreate() error

2003-07-12 Thread Philip Olson
Hello Michelle-

a) Only enable one GD dll, so use php_gd2.dll.
b) Consider using imagecreatetruecolor() instead but
   either will work.
c) When asking support questions, it's important to
   say exactly what version, although in this case
   we know it's 4.3.0-1 as php_gd.dll was removed in
   PHP 4.3.2

Anyway, enable just one dll and it should work.  Be sure
to restart the web server afterwards.

Regards,
Philip


On Sat, 12 Jul 2003, Michelle Bernard wrote:

 Hi there,
 
 I am running PHP 4.3 something or other, I have enabled php_gd.dll and
 php_gd2.dll, pointed the extension directory to the right place, looked at
 the phpinfo and it has the correct information about the gd's being enabled,
 I have tried reintalling apache and php...but still get errors on all simple
 scripts that i have tried...
 
 this is the error I get..
 
 Fatal error: Call to undefined function: imagecreate()
 
 any suggestions or tips?
 
 Thank you!!!
 
 Sincerely
 Michelle
 
 
 
 -- 
 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] Configuration Problems

2003-07-12 Thread Philip Olson

Here's a faq:

  http://www.faqts.com/knowledge_base/view.phtml/aid/15670/fid/30

You need to upgrade your old DCOM.

Regards,
Philip


On Sat, 12 Jul 2003, Arun wrote:

 I have installed Apache 2.0.47 and php 4.3.2 in Windows 98. Downloaded the
 php in the .zip format.
 
 The Apache server works properly without the inclusion of php.
 The problem is apache dosent even start with php in the SAPI mode,it gives a
 error stating that:
 
 One of the device attached to the system isnt functioning properly
 (or)
 Library files missing
 
 and in the CGI mode the apache server starts and it executes the .html files
 but it dosent execute the .php file or the .html files with php commands
 giving an error statement:
 
 Internal Server Error
 The server encountered an internal error or misconfiguration and was  unable
 to complete your request.
 with a dialog box message stating that
 The PHP4TS.DLL file is linked to missing export OLEAUT32.DLL:77.
 (I do have the OLEAUT32.DLL file in the same folder as the PHP4TS.DLL file)
 
 I have copied all the .dlls and php.ini to their respective places as given
 in the manual but still dosent work.
 I am hoping some one could give me a suggestion or a solution to my problem.
 
 
 
 -- 
 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 mysql array question

2003-07-11 Thread Philip Olson
On Fri, 11 Jul 2003, CPT John W. Holmes wrote:

  Is there any php function to pull a query into an array?  I know there is
 a
  way to get the first row of the results in an array, but I'm having to
 loop
  through each row pushing the row onto an array to get the result I'm
 looking
  for and it seems like a lot of code for something that I would think is
 used
  a lot.
 
 There's no PHP function to do so. Some abastraction layers provide this, but
 it's just doing a loop like you're doing.
 
 Show your code and we can offer tips on how to improve performance.

I'm glad this feature doesn't exist.  Just think how abused it would 
be, how many people would use it, when few would actually need it.  
Most people can use the data while in the loop, not after.  Or do
what is needed in the sql, not php.  Maybe I'm a little too parental 
though, but so be it. :)

Regards,
Philip


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



Re: [PHP] What's this talk about ASP to PHP?

2003-07-10 Thread Philip Olson
On 10 Jul 2003, Jonathan Villa wrote:

 I've read somewhere about some asptophp convertor/tool/methodology...?? 
 Don't know what it is, that's why I'm asking.
 
 I've been asked to help out on a project which might include some
 already developed basic ASP code.  I would rather do it in PHP.

  2. Is there an ASP to PHP converter?
  http://www.php.net/manual/en/faq.languages.php

Regards,
Philip


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



Re: [PHP] Password + login from the AND Basic-Authenticate form

2003-07-10 Thread Philip Olson
On Thu, 10 Jul 2003, Seigo wrote:

 Please tell me can users login with the html-page form and
 Basic-authentication?

  Chapter 16. HTTP authentication with PHP
  
  http://www.php.net/features.http-auth

Regards,
Philip


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



RE: [PHP] $_POST problem

2003-07-09 Thread Philip Olson

The only time you want to use {braces} like that is
when you are in a string.  None of the suggestions
here are in strings, so the use of {braces} is bogus.
The following is good:

  echo Hello {$there['friend']} is good;

Note how we're in a string.  This topic is very much
discussed (with loads of examples) here:

  http://www.php.net/types.string

Regarding the question in this thread, it's not clear
what you're problem is.  If the form is method POST,
and you have at least PHP version 4.1.0, there is a
100% chance that the name/value will live in $_POST.

  input type=text name=foo

  echo $_POST['foo'];

Not sure what the question is, could you be a little
more clear?  It seems you are mixing up img_keywords
and new_keywords, maybe that's it.  Debugging101
would say to check what's in $_POST, which could be:

  print_r($_POST);

Regards,
Philip



On Wed, 9 Jul 2003, Aaron Axelsen wrote:

  
 -BEGIN PGP SIGNED MESSAGE-
 Hash: SHA1
 
 Sometimes in situatinos like that, it does the trick for me, im not
 really sure why though .., I just now it works :)
 
 - ---
 Aaron Axelsen
 AIM: AAAK2
 Email: [EMAIL PROTECTED]
 
 Want reliable web hosting at affordable prices?
 www.modevia.com
  
 Web Dev/Design Community/Zine
 www.developercube.com
 
 
 
 - -Original Message-
 From: Joe Harman [mailto:[EMAIL PROTECTED] 
 Sent: Wednesday, July 09, 2003 11:09 PM
 To: 'Micah Montoy'; [EMAIL PROTECTED]
 Subject: RE: [PHP] $_POST problem
 
 
 Hey... Just for Sh** and giggles... Try removing the quotes from
 keywords
 
 Make it look like this...
 
 $img_keywords = trim({$_POST[keywords]})
 
 Hmmm. Something is up here... Never seen curly brackets used like
 this... But that would probably be normal for me LOLjust
 thought I point out anything unusual...
 
 
 
 - -Original Message-
 From: Micah Montoy [mailto:[EMAIL PROTECTED] 
 Sent: Wednesday, July 09, 2003 11:57 PM
 To: [EMAIL PROTECTED]
 Subject: Re: [PHP] $_POST problem
 
 
 Nope.  That didn't do it.  The errors I'm receiving are:
 
 Notice: Undefined index: keywords in
 c:\inetpub\wwwroot\webpage10\example\v_images\dsp_update_image.php on
 line 22 and
 
 Notice: Undefined variable: img_keywords in
 c:\inetpub\wwwroot\webpage10\example\v_images\dsp_update_image.php on
 line 29
 
 thanks
 
 Aaron Axelsen [EMAIL PROTECTED] wrote in message
 news:[EMAIL PROTECTED]
 
  -BEGIN PGP SIGNED MESSAGE-
  Hash: SHA1
 
  Try:
 
  $img_keywords = trim({$_POST[keywords]});
 
  - ---
  Aaron Axelsen
  AIM: AAAK2
  Email: [EMAIL PROTECTED]
 
  Want reliable web hosting at affordable prices? www.modevia.com
 
  Web Dev/Design Community/Zine
  www.developercube.com
 
 
 
  - -Original Message-
  From: Micah Montoy [mailto:[EMAIL PROTECTED]
  Sent: Wednesday, July 09, 2003 10:26 PM
  To: [EMAIL PROTECTED]
  Subject: [PHP] $_POST problem
 
 
  Anyone see what when I submit this, I can't do a $_POST on it?  I
  check with the DB first to see if there is a value and if so, I
  fill  it, otherwise, it will return a blank for the user to fill if
  they  want.
 
  input type=text name=keywords value=?php
  echo($new_keywords);  
 
  ? size=53 maxlength=500
 
  On the page that it goes to when it is submitted, the post looks
  like this:
 
  $img_keywords = trim($_POST[keywords]);
 
 
  thanks
 
 
 
  - --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 
 
  -BEGIN PGP SIGNATURE-
  Version: PGPfreeware 7.0.3 for non-commercial use
  http://www.pgp.com 
 
  iQA/AwUBPwzdn7rnDjSLw9ADEQIcCQCgkktDGf9u26bOntsqMPw93lpINdcAoM9h
  tVqNcesMuM/L3fZaXmIdKdId
  =fJlG
  -END PGP SIGNATURE-
 
 
 
 
 
 - -- 
 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
 
 -BEGIN PGP SIGNATURE-
 Version: PGPfreeware 7.0.3 for non-commercial use http://www.pgp.com
 
 iQA+AwUBPwzqPLrnDjSLw9ADEQKPYgCgjokK/dQZwk10ylF+5Pjpz2YANisAmNGk
 LTtC/a1boJlKfxXawTNyDPs=
 =ptOt
 -END PGP SIGNATURE-
 
 
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 


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



Re: [PHP] MySQL Results - display issue :S

2003-07-09 Thread Philip Olson
On Thu, 10 Jul 2003, Brenton Dobell wrote:

 I know im probibly getting irritating to most of you :P but i thought i may
 ask another thing that is on my mind!
 
 I have a sql query bringing back 200 rows for arguments sake, From this i
 would like an answer to 2 issues i have.
 
 1) I know how to display it row after row going down :P duh of course :P,
 but i have seen sites where it goes across then down across then down ect
 ect like X - X then next row ect. How is this done??

  http://www.faqts.com/knowledge_base/view.phtml/aid/8583

 
 2) How can i alternate the colours for each row?? row 1 eg light blue and
 the 2nd row dark blue then back to light blue ect ect.

  http://www.faqts.com/knowledge_base/view.phtml/aid/783

Regards,
Philip


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



RE: [PHP] $_POST problem

2003-07-09 Thread Philip Olson
On Thu, 10 Jul 2003, Joe Harman wrote:

 Yeah, me too... LOL... Although, I don't understand the curly
 brackets... I don't see any examples using them in the manual either...

Actually, the manual is pretty clear on this, and with tons
of examples:

  http://www.php.net/types.string
  http://www.php.net/types.array

It's just a matter of where to look :)

Regards,
Philip


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



Re: [PHP] print vs heredoc

2003-07-08 Thread Philip Olson
 As to which is faster is does not really matter as the speed of echo
 print and heredoc is dictated by the connection speed to the
 requesting client. If this is a factor in your overall operation you
 can use output buffering to save the contents and output them at the end of
 your script.

Although really, heredoc can't be compared to either
echo or print, as it's just a string definition that
eventually will be printed.  So I guess you guys are
really comparing  vs heredoc?  And I agree that any
speed difference (if there is one) isn't a good reason
to choose when readablity may suffer.  So it all
depends on the situation, and the programmer.

 btw what would be nice is a print_raw command that does no
 parsing just sends the stuff :)
 (Would be good for template systems where you know there is no php
 hidden in there.) ... might gain a couple of micro seconds

I believe this is called breaking out of PHP mode
and into HTML mode, which can be done anywhere, at
any time.

Regards,
Philip


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



Re: [PHP] Reading from remote file

2003-07-06 Thread Philip Olson

This is already fixed in CVS.  The entire example is bogus, 
it should not be using filesize($filename) either.

Here's what's in CVS (the manual will be rebuilt sometime
in the next week):

?php
$handle = fopen (http://www.example.com/;, rb);
$contents = ;
do {
$data = fread($handle, 8192);
if (strlen($data) == 0) {
break;
}
$contents .= $data;
} while(true);
fclose ($handle);
?

And the whole point is to demonstrate the following note:

 When reading from network streams or pipes, such as those 
  returned when reading remote files or from popen() and 
  proc_open(), reading will stop after a packet is available. 
  This means that you should collect the data together in 
  chunks as shown in the example below.

Have fun :)

Regards, 
Philip


On Sun, 6 Jul 2003, Daniele Baroncelli wrote:

 Hi guys,
 I am trying to read from a remote file, by using an example reported at the
 manual page for the fread function:
 
 ?php
 $handle = fopen (http://www.php.net/;, rb);
 $contents = ;
 do {
 $data = fread ($handle, filesize ($filename));
 if (strlen($data) == 0) {
 break;
 }
 $contents .= $data;
 }
 fclose ($handle);
 ?
 
 
 Unfortunately this example is incorrect, as it gives me a parse error. The
 mistake should be in the fact that there is a do keyword without a
 while.
 Would anyone suggest me the correct version?
 
 Cheers
 
 Daniele
 
 
 
 
 -- 
 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] how to modify in the db

2003-07-06 Thread Philip Olson


use UPDATE

Also, be sure to learn basic SQL before use:

http://www.w3schools.com/sql/
http://www.sqlcourse.com/
http://www.onlamp.com/pub/ct/19

Regards,
Philip


On Sun, 6 Jul 2003, Kevin Fradkin wrote:

 hi...
 i have this secuence to insert data to my db
 
 mysql_query
 (INSERT INTO my_table(
  number,name,surname
 )
  values ('$number','$name','$surname'
 ));
 
 i want to ask what do i have to do if i want to modify instead of insert
 when this data already exists...
  for example.. i have in my_table
 number name surname
 1jhon smith
 
 and i want to change the name...jhon -- john
 
 and if that not exist create it...
 number name surname
 0  mary   duke
 1  charles emmerson
 
 and add john's one.. ( to check if i can use only modify to add )
 
 thnx!..
 
 
 
 -- 
 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] Warning: Invalid argument supplied for foreach()

2003-07-06 Thread Philip Olson

On Sun, 6 Jul 2003, arnaud gonzales wrote:

 Hi all,
 I am getting crazy, can't understand what i missed!
 Does anybody know?
 
 $champs = array (titre_art = h3 ,nom = bleu, 
  prenom = green, resume = bold);
 
 foreach($champs as $key = $value) {
 echo td class='$value'$row($key))/td;
 }

It works fine, you are using different code then the above.
In your actual code, make sure you pass in an array that
exists, as currently you are not.

One example reason, the foreach is inside a function and
$champs isn't available in the functions scope (global).

At any rate, before your foreach, var_dump($champs) and
it'll let you know what is up.

Regards,
Philip

p.s. In case $row is an array, you actually mean to write
it as $row[$key], but this is unrelated to the error that
foreach is providing.



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



Re: [PHP] Q on echo phpinfo() ;

2003-07-05 Thread Philip Olson

You may set the location of php.ini by using the PHPRC 
environment variable or during ./configure use the
--with-config-file-path directive.  Maybe you should
just copy a php.ini into the directory PHP is looking for
it in, which appears to be C:\WINNIT.  If PHP was actually
reading a php.ini, you would have instead seen it as
C:\WINNIT\php.ini as opposed to just a directory path.  So
because no php.ini is being read, PHP is using all default
values as per a stock php.ini-dist.

http://www.php.net/manual/en/configuration.php
http://www.php.net/manual/en/faq.installation.php#faq.installation.phpini

Regards,
Philip


On Sat, 5 Jul 2003, jsWalter wrote:

 I ran this as a script from my Apache and it gave me a beautiful web page
 just full of wonderful information!
 
 But I have a question on just 1 item...
 
 Configuration File (piping) Path C:\WINNIT
 
 How does this value get set?
 
 My PHP is installed at 'G:\etc\php'
 
 My php.ini is there as well.
 
 The paths are set (in that ini file) as...
 
 include_path = .;G:\etc\php\extensions;G:\etc\php\pear
 
 extension_dir = G:\etc\php\extensions
 
 Even My Apache is told to look there as well...
 
 # Windows Win32 version
 
 LoadFile /etc/php/gnu_gettext.dll
 
 LoadModule php4_module /etc/php/sapi/php4apache2.dll
 
 Action application/x-httpd-php /etc/php/php.exe
 
 ScriptAlias /php/ /etc/php/
 
 (pls don't comment about there being volume letters missing to this block,
 
 I want to focus on the issue of a path being defined from out of the blue)
 
 Is this being hard coded somewhere?
 
 If so, then why does my PHP work at all?
 
 I have nothing that belongs to PHP in the system directory.
 
 Well, not completely true.
 
 PEAR installed a pear.ini in the system directory itself (I wish it didn't,
 
 but my PEAR not working properly is a different issue.)
 
 Nothing I've read from the web or the documentation has given me any
 understand on how this is set and why PHP file are needed in the location
 that the says to place them.
 
 I guess, this is a question for the folks who wrote the executables for
 Windows.
 
 Thanks for any help and enlightenment.
 
 Walter
 
 
 
 
 
 
 -- 
 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] how to :: multi select

2003-07-04 Thread Philip Olson
On Fri, 4 Jul 2003, Thomas Hochstetter wrote:

 Hi guys,
  
 This might just be off the topic, but here it goes anyway:
  
 How can one multi select check boxes and pass them through in php,
 without getting mixed up with variables (email multi select style).

Read these faqs:
http://www.php.net/manual/en/faq.html.php#faq.html.arrays
http://www.php.net/manual/en/faq.html.php#faq.html.select-multiple

Regards,
Philip


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



Re: [PHP] date() function and timestamps

2003-07-03 Thread Philip Olson

:)

You are using an m where you want an i.

Regards,
Philip


On Thu, 3 Jul 2003, Garrick Linn wrote:

 Hello all,
 
 I seem to be running into a problem where the date() function appears not 
 to differentiate properly between unix timestamps.
 
 For example, the code:
 
 ?php
 
 $seconds = 1054278483;
 echo $secondsbr;
 echo date(d-m-Y H:m:s, $seconds);
 echo brbr;
 
 $seconds = ($seconds - 60);
 echo $secondsbr;
 echo date(d-m-Y H:m:s, $seconds);
 echo brbr;
 
 ?
 
 outputs
 
 1054278483
 30-05-2003 02:05:03
 
 1054278423
 30-05-2003 02:05:03
 
 I would expect the second date() to output 30-05-2003 02:04:03 as the 
 second timestamp is exactly 60 seconds behind the first, but I might be 
 missing something.  I see the same behavior on two redhat linux machines 
 running Apache 2.0.40 + PHP 4.2.2 and Apache 1.3.26 + PHP 4.3.2 
 respectively.  Any ideas?
 
 Thanks,
 
 Garrick Linn
 
 
 
 -- 
 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] states

2003-07-01 Thread Philip Olson
 Does anyone know of any built in functions or options for the US states?
 I want to make a drop down menu and some other things which have the 50
 states in it.  Is there any shortcut for this with PHP, or do I need to
 do it all manually in HTML?  Please let me know.  Thanks.

Here's one:
  http://px.sklar.com/code.html?id=164

Regards,
Philip


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



Re: [PHP] Concatenate

2003-06-30 Thread Philip Olson
 how can i concatenate two strings?  i cant seem to find the
 function...  thanks :)

Read this:

 http://www.php.net/manual/en/language.operators.string.php

And then this:

 http://www.php.net/manual/en/language.types.string.php

Regards,
Philip


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



RE: [PHP] $_POST problem SUPERGLOBALS

2003-06-29 Thread Philip Olson

It would be best to read the manual pages on superglobals
and retrieving external variables as the manual explains
these topics in detail:

  http://www.php.net/reserved.variables
  http://www.php.net/variables.external

Regards,
Philip


On Sun, 29 Jun 2003, esctoday.com | Wouter van Vliet wrote:

 Let's explain this thing with the superglobals now once again .. so that
 everybody knows it ...
 
 In newer versions of PHP some superglobal arrays are available...
 
 $_GET[] - For any variable passed through the query string (in the URL,
 or address bar in a http://www.domain.com/page.php?foo=barfoo2=bar2 syntax)
 but also fields submitted through a form with a tag like FORM method=GET
 $_POST[]- For any field submitted from a form with tag like FORM
 method=POST
 $_COOKIE[]  - For any cookie set and available for the script you're
 running.
 ---
 $_REQUEST[] - Merges the above three together. I think I mentioned them in
 the default order of importance. Post overriding cookie, get overriding
 post.
 
 $_FILES[]   - Also for information send by a form, but now only the INPUT
 type=FILE name=fieldname entries are listed. Remember to use this kind
 of form tag: form enctype=multipart/form-data action=_URL_
 method=post .. espeically method=post and enctype=multipart/form-data
 are essential. Prior to PHP4.3 the $_FILES superglobal was also included in
 $_REQUEST, but don't rely on that to happen since it will make your scripts
 fail in a newer version and have you look for a bug which is almost
 impossible to find.
 
 $_SESSION[] - Session vars set. When using $_SESSION, you should not use
 session_start() of functions like that. A session usually exists untill a
 user closes his/her browser window. Or 30 minutes has expired, whatever
 comes first. (The 30 minutes is a setting in php.ini and can be overriden,
 if i'm right about that)
 
 $_ENV[] - info about the user's default shell, homedir and stuff like
 that. The user as which your PHP script is running on the server, that is.
 NOT the user visiting your page.
 
 $_SERVER[]  - info about the server and the script which is running.. For
 example $_SERVER['php_self'] gives you the filename of the script,
 $_SERVER['PHP_AUTH_USER'] for the apache basic authentication username..
 
 -
 
 So, now I hope this has been cleared out for everybody.. And that I'll still
 be in time to see my fav bands play at ParkPop, one of the biggest free open
 air pop festivals I think in Europe.. just around the corner of my house
 here in The Hague.
 
 Salutes,
 Wouter
 
 -Oorspronkelijk bericht-
 Van: Jason Wong [mailto:[EMAIL PROTECTED]
 Verzonden: vrijdag 27 juni 2003 22:46
 Aan: [EMAIL PROTECTED]
 Onderwerp: Re: [PHP] $_POST problem
 
 
 On Saturday 28 June 2003 04:32, Sparky Kopetzky wrote:
 
  I've got my script kinda running but am unable to retrieve any values with
  $_POST. I turned on register_globals in the php.ini and am using this url:
 
 If you're going to be using $_POST (which you should) then you should
 *disable* register_globals.
 
  http://www.fttta.com/auction.php?action=reg. (Sorry, it's local for
 now...)
 
  I'm using this kind of line to check for values:
  elseif ('reg' == $_POST['action'])
  {
  do something;
  }
 
 Does print_r($_POST) show your variables?
 
 If not are you using the POST method in your form?
 
 If so what version of PHP are you using?
 
 --
 Jason Wong - Gremlins Associates - www.gremlins.biz
 Open Source Software Systems Integrators
 * Web Design  Hosting * Internet  Intranet Applications Development *
 --
 Search the list archives before you post
 http://marc.theaimsgroup.com/?l=php-general
 --
 /*
 Even the best of friends cannot attend each other's funeral.
   -- Kehlog Albran, The Profit
 */
 
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 


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



Re: [PHP] PHP5 with MySQL on windows

2003-06-29 Thread Philip Olson
Hello Janet-

Currently you have two choices:

  a) Compile PHP 5 on Windows yourself, with MySQL support
  b) Wait for a DLL to exist

There isn't a DLL right now, nor do I know when one will
exist.  But, you can be pretty sure that one will 
eventually exist, especially before PHP 5 is officially
released.

PHP 5 beta 1 was released today, there isn't a MySQL DLL
in there either.

In PHP 4, MySQL is of course built in.  That all changed
in PHP 5 where it's no longer built in to the Windows
binaries, nor is it bundled or enabled by default in *nix.

Regards,
Philip



On Sun, 29 Jun 2003 [EMAIL PROTECTED] wrote:

 I can't seem to figure out how to get PHP5 working with MySQL support. I just
 downloaded the latest PHP5 from snaps (which seems to be yesterday's build)
 and it's installed fine, but I can't seem to get MySQL support.
 
 The php.ini file still says 
 ;Note that MySQL and ODBC support is now built in, so no dll is needed for it.
 
 However, MySQL support is no longer there. There doesn't seem to by any dll
 for mysql in the extensions subdirectory. 
 
 There's a libmySQL.dll in dlls, but copying that into my system directory and
 adding an extension line for it in the php.ini file doesn't work. I get an
 error that says invalid library. Besides, it obviously has a different name
 that the other extension dlls.
 
 I am using Windows 2000. I am running MySQL 3.23.54. 
 
 I can find nothing about this on the PHP web site. Everything I find still
 says that MySQL support is built-in. Can someone tell me what I need to do to
 use MySQL. 
 
 Janet
 
 -- 
 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] ?xml version=1.0 encoding=UTF-8

2003-06-23 Thread Philip Olson
On Mon, 23 Jun 2003, Doug Essinger-Hileman wrote:

 
 On 23 Jun 2003 at 13:22, CPT John W. Holmes wrote:
 
  The first two characters are opening up a PHP block of code, so you
  get a parse error. Either disable short open tags in php.ini, 
 
 I don't have access to php.ini. Can I do this on a script by script
 basis with
 
 ini_set(short_open_tag, off)

No.  (btw, be sure to quote your strings). In reading 
the table found here:

  http://www.php.net/ini_set

You will notice short_open_tag has this level:

  PHP_INI_SYSTEM|PHP_INI_PERDIR

And according to the documentation, most namely the
documenation found here:

  http://www.php.net/configuration.changes

It can be set in the following (in Apache) or similar
depending your web server:

  .htaccess
  php.ini
  httpd.conf

Closest you have is .htaccess  But, if you don't want
to worry about it, just use echo as someone already
suggested, instead of embedding it.  Something like:

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

Btw, the question proposed in this thread is also a
documented FAQ here:

  http://www.php.net/manual/en/faq.using.php#faq.using.mixml

Regards,
Philip


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



Re: [PHP] Variable from hidden fields shortens.

2003-06-22 Thread Philip Olson
For example:

$a = 'a b c';
print $a;// a b c
print urlencode($a); // a+b+c

So, you want to urlencode your url (the query string).

Regards,
Philip

On Sun, 22 Jun 2003, Denis L. Menezes wrote:

 I have a form called feedback which has a hidden field as follows :
 ?php
 Printinput type=\text\ name=\SubCategoryName\
 value=\$SubCategoryName\;
 ?
 
 I send this hidden field as a variable in form2 which sends an email with
 the following code :
 ?php
// Build up email header fields
  $mailFrom = $SenderName;
 $mailTo = [EMAIL PROTECTED];
 $mailSubject = Message form mydomain.com;
  $link=Please follow this link
 .http://www.mydomain.com/findbymember.php?SubCategoryName=.$SubCategoryNa
 me;
 
  $Message=$SenderName had searched for '$SubCategoryName'. His/her details
 are as follows : .\n.Telephone number : .$SenderTelNumber.\n;
  $Message=$Message.Mobile number : .$SenderMobNumber.\n.Email address :
 .$SenderEmailAddress.\n;
  $Message=$Message.Address : .$SenderAddress;
 
 // Send email to member company
 mail($mailTo, $mailSubject, $Message,$link);
 ?
 
 When my variable in form 1 is Large Format Print, the mail that arrives is
 as follows :
 Please follow this
 linkhttp://www.findusnow.com/findbymember.php?SubCategoryName=Large Format
 Print
 
 Jack had searched for 'Large Format Print'. His/her details are as follows :
 Telephone number : 454588445
 Email address : 989855564
 Address : some address1, some home, some street, some city
 
 As you can see the link does not show the full variable at the end and shows
 only the word large instead of large Format Print
 
 can any of you help?
 
 Thanks
 denis
 
 
 
 
 
 
 ---
 Outgoing mail is certified Virus Free.
 Checked by AVG anti-virus system (http://www.grisoft.com).
 Version: 6.0.491 / Virus Database: 290 - Release Date: 6/18/2003
 
 
 
 -- 
 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] Is there a way to get rid of \' and \ ?

2003-06-22 Thread Philip Olson
On Sun, 22 Jun 2003, Jason Wong wrote:

 On Sunday 22 June 2003 06:00, Dan Anderson wrote:
  I have a form which feeds into an e-mail.  When I use the mail function
  all 's turn into \'s and all s turn into \s.  
 
 Are you sure it's the mail() function that's doing it? I doubt it.
 
  I tried
  set_magic_quotes_runtime(0) and it didn't do anything, 
 
 In php.ini:
 
   magic_quotes_gpc = Off

Btw, magic_quotes_gpc and magic_quotes_runtime are totally
different beasts.  You cannot set magic_quotes_gpc at
runtime but may use php.ini as Jason suggests or .htaccess

Before you set it off, be sure you know how it will affect
your SQL queries though.

Regards,
Philip


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



Re: [PHP] Re: Difference between $_POST[foo] and $_POST['foo']?

2003-06-18 Thread Philip Olson
 print $_POST['foo']; // generates a warning

The above is only true in PHP 4.3.0-1 as there was a
bug that caused the E_NOTICE there.  In all other PHP
versions, the above will cause a parse error.

Regards,
Philip


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



Re: [PHP] mySQL: Rows and columns

2003-06-18 Thread Philip Olson

On Wed, 18 Jun 2003, zavaboy wrote:
 I know this is more of a mySQL question but, how do I delete and add rows
 and columns?

Before you touch MySQL or attempt to access it through
PHP, you really should learn basic SQL:

  http://www.sqlcourse.com/
  http://www.w3schools.com/sql/
  http://linux.oreillynet.com/pub/ct/19

Spend some time learning basic SQL syntax and your life
will drastically improve.  Also, perhaps the most popular
tool on this subject is phpmyadmin, it shows the actual
queries as you go which also helps with learning:

  http://www.phpmyadmin.net/

Be sure to keep it secure though as it's a powerful tool.

Regards,
Philip


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



Re: [PHP] User's Screen Resolution Size

2003-06-18 Thread Philip Olson

  I what to be able to set a variable based on user's screen resolution.
  
  Can anyone tell me who to do that?

 Use javascript to get the screen resolution and pass it back to your php script thru 
 a 
 hidden form field or some other means.

And awhile back someone used this as an example for
passing Javascript information into PHP.  The example
passes in screen width and height:

http://www.php.net/manual/en/faq.html.php#faq.html.javascript-variable

Regards,
Philip


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



RE: [PHP] Re: Difference between $_POST[foo] and $_POST['foo']?

2003-06-17 Thread Philip Olson

This is explained in the manual with tons of examples:

  http://www.php.net/types.string
  http://www.php.net/types.array
  http://www.php.net/types.array#language.types.array.foo-bar

Regards,
Philip


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



[PHP] Re: your mail

2003-06-12 Thread Philip Olson
  Looks still broken to me :)
 
 yup, but I don't get the problem, everything seems fine on my box.. maybe
 a problem with vim comments ? can you commit the _right_ WS fix ?
 
 thanks in advance :)

TABS are EVIL! :)

Regards,
Philip


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



Re: [PHP] Re: Using register_globals

2003-06-12 Thread Philip Olson

Won't this topic just die? :)

register_globals is not insecure, users are insecure.  Yes, you
can write insecure code with it on or off, and secure code with
it on or off.  By users I mean people who write code, and people
who use it (the evil users are the ones that use the website,
and pass along evil REQUEST data).

In short, read these:

  http://www.php.net/variables.external
  http://www.php.net/security.registerglobals

It should be pretty clear that register_globals = off is preferred
but it's up to you, this is why we have PHP directives.  Turning
of your computer is indeed the ideal security measure!

Regards,
Philip


On Thu, 12 Jun 2003, Jim McNeely wrote:

 I'm a bit of a neophyte with php, and I've read through lots of prior 
 posts and the php.net online docs, but some of this is still not 
 registering in my head. TIA for your patience.
 
 I've got a script I include at the head of each of my scripts that 
 checks $_POST['username'] and $_POST['password'] against a database, 
 and exits to an error page if it doesn't check out. Every link is a 
 post where it passes these two values. So if you open any page in the 
 whole thing it has to have the actual value of a real username and 
 password or it exits to an error page asking for these values.
 
 This seems to have been working fine, but when I installed a newer 
 version of php it started making noise about register globals being 
 off. Upon further reading, it seems SESSIONS are insecure, COOKIES are 
 insecure, POSTS and GETS are insecure. It seems to me that you would 
 have to write some exceptionally stupid code for these things to be 
 really openly insecure, so I must be missing something.
 
 After a point it seems like if you leave your machine off or disconnect 
 it from the network that would be the most secure but you have to pass 
 this info somehow. What is the accepted practice for passing user info 
 into variables?
 
 
 -- 
 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] array

2003-06-12 Thread Philip Olson
On Thu, 12 Jun 2003, Diana Castillo wrote:

 If I write a code like this,
 $room_type=array();
 $room_type[0][0]=4;
 echo BRvalue in array is .$room_type[0][0];
 yet I dont get any results out, what did i do wrong?

Nothing wrong with this code, it will work.  Your
error must be somewhere else.

var_dump($room_type);

Regards,
Philip


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



Re: [PHP] Vmailmgr Functions

2003-06-12 Thread Philip Olson
On Thu, 12 Jun 2003, John Nichel wrote:

 On PHPBuilder.com, they have functions listed for Vmailmgr in their 
 manual, whereas on PHP.net, no such functions exist.  Do these functions 
 exist but not documented on PHP.net?

The manual over at phpbuilder is useless, and very old.  Do
not use that manual, use php.net/manual

Anyway, this extension was removed from the manual 2.5 years
ago, this extension is specific to PHP 3.

Regards,
Philip


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



Re: [PHP] mysql_fetch_array(): supplied argument is not a validMySQL result resource

2003-06-12 Thread Philip Olson

It has to do with you assuming everything will work 100% 
of the time.  It won't.  mysql_query() returns false on 
failure, check for that.  Read this recent thread:

 http://marc.theaimsgroup.com/?l=php-generalm=105517588819420

Also, this faq explains it:

 http://www.php.net/manual/en/faq.databases.php#faq.databases.mysqlresource

Btw, what do you expect: $register_globals; to do in your
code?  It won't do anything useful.

Regards,
Philip





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



Re: [PHP] Re: Re: if ($xxxxx) { function not working?

2003-06-10 Thread Philip Olson



On Tue, 10 Jun 2003, Ben Houlton wrote:

 Now I get a blank page and all the code... that I can think of is the same...
 Look here:
 HTML
 
 BODY
 
 ?php
 
 $db = mysql_connect(localhost,root);
 
 mysql_select_db(kangaroo,$db);
 
 if ($submit) {
 
 if ($id) {
[snip]

Do this, to help us and you know your settings:

$info = array('rg'   = ini_get('register_globals'),
  'er'   = ini_get('error_reporting'),
  'de'   = ini_get('display_errors'),
  'id'   = $id,
  'id2'  = $_REQUEST['id'],
  'sub'  = $submit,
  'sub2' = $_REQUEST['submit']);

var_dump($info);

And now, read this entire page:

  http://www.php.net/variables.external

As you are not yet understanding what register_globals is and
btw it has nothing to do with the global keyword.  I am guessing
the above will show register_globals off and the variables you
assume exist do not really exist.  Read that manual page
for why, it should explain all of this to you.

Regards,
Philip



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



Re: [PHP] Array[array]

2003-06-10 Thread Philip Olson
On Tue, 10 Jun 2003, Erich Kolb wrote:

 How do I get a value from an array thats inside of an array?

$array = array('a' = 'apple');

print $array['a']; // apple

$array = array('a' = array('b' = 'banana'));

print $array['a']['b']; // banana

$array = array(array(array(array('c' = 'cranberry';

print $array[0][0][0]['c']; // cranberry

Regards,
Philip


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



Re: [PHP] stripping newlines from a string

2003-06-09 Thread Philip Olson
On Mon, 9 Jun 2003, Charles Kline wrote:

 Yes. Is weird. I thought this would work too, but for some reason it 
 was not removing them all. I wonder if re-saving the files with UNIX 
 linebreaks (or try DOS) would have any effect. Will report back.

$str = str_replace (array(\r, \n), '', $str);

Regards,
Philip


 
 On Monday, June 9, 2003, at 02:24 AM, Joe Pemberton wrote:
 
  http://www.php.net/str_replace
 
  $newstr = str_replace(\n, , $oldstr);
 
  - Original Message -
  From: Charles Kline [EMAIL PROTECTED]
  To: [EMAIL PROTECTED]
  Sent: Sunday, June 08, 2003 10:44 PM
  Subject: [PHP] stripping newlines from a string
 
 
  Hi all,
 
  How would i go about stripping all newlines from a string?
 
  Thanks,
  Charles
 
 
  -- 
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 
 
 
 
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 


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



Re: [PHP] Warning: mysql_fetch_row(): supplied argument is not avalid MySQL result resource in f:\.....\none.php on line 286

2003-06-09 Thread Philip Olson
On Mon, 9 Jun 2003, Thomas Seifert wrote:

 On Mon, 9 Jun 2003 07:35:16 -0300 [EMAIL PROTECTED] (Marcelo Luiz De Laia) wrote:
 
  I use phpnuke and it have a sql_layer.php. You are correct, for mysql is
  mysql_query. But this dont is the problem, I change it and the problem
  continue!
  
  Any tip??
 
 I think you are mixing the layer and native functions.
 You should use ONE of these, either the layer from phpnuke OR 
 the native functions.
 I don't know how the layer handles the results but from the layout you had it looks 
 just wrong.
 
 The standard-way using native mysql_*-functions for a select (with some basic 
 error checking) is as follows:

It's one way, not standard imho :)  My additions below are of
course just one way out of many.  In a production environment
you won't be printing out mysql errors, or sql statements, but
instead will give the user some pretty error.  The code below
is for a development environment and doesn't include a debug
mode.

The reason I use @ is because we are implementing our own
error handling so having PHP print out the errors too isn't
needed.  So choose one or the other, PHP's errors or your
own, or, turn down error reporting for the entire script
but I'll just use @.

The reason for the error is your are assuming $result is
a valid MySQL result resource when it's not, it's most
likely boolean false because for some reason (like the
connection failed, couldn't select database, invalid
query, etc) it's not valid.  phpnuke is known for having 
crappy code so that's unfortunate for you but anyway the 
words below will explain how to avoid this error, or why 
it may exist.

 [... connection and so on ...]

Making sure the connection and database selection works is
pretty important too:

$conn = @mysql_connect(host, user, pass);
if (!$conn) {
echo Could not connect to MySQL;
exit;
}
if ([EMAIL PROTECTED]('dbname')) {
echo Could not select database:  . mysql_error();
exit;
}

 $result = mysql_query(select * from ...);
 
 if(!mysql_error()) {
echo mysql_error();
 }

Instead of calling mysql_error() twice, it's more common
and efficient to check the return value of mysql_query() 
(in this case we put it in $result) as mysql_query returns
boolean false on failure:

$sql = SELECT foo, bar FROM sometable;
if (!$result = @mysql_query($sql)) {
echo Could not run query ($sql):  . mysql_error();
exit;
}

And next, before fetching rows, make sure there are actually
rows to fetch.  Instead of my silly echo statement, consider
including the search form again, or have them press the
back button, or whatever:

if (mysql_num_rows($result)  1) { 
echo No results match your query, please try again;
exit;
}

Now it's finally time to fetch some rows as we now know that
$result is a valid mysql resource and rows exist.  This is 
the basic idea of checking if everything worked instead of 
just assuming everything will be perfect 100% of the time 
because it won't.

Regards,
Philip
 


 while($row=mysql_fetch_row($result)) {
   [... output ...]
 }
 
 You are either not transferring the result-identifier correctly or your query 
 returns an error.




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



Re: [PHP] how to count memory used by a script

2003-06-09 Thread Philip Olson
On Mon, 9 Jun 2003,  Peter Berglund wrote:

 How do I count the memory usage of a script/page.

As of 4.3.2, if you compile PHP with --enable-memory-limit
you may use memory_get_usage().  This is documented and
will show up when the next PHP manual is built.

Regards,
Philip


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



Re: [PHP] Re: Using register_globals

2003-06-08 Thread Philip Olson
[snip]
 rant
 
 register_globals=off won't make good code any better --it's just 
 a safety net for the sloppy coders.
[snip]

In some sense, register_globals = off makes both bad and
good code better, because it means less pollution.   So
many unused variables get defined with register_globals
on and this means wasted memory/resources.  Pollution 
makes any environment worse!  Granted this isn't what you
meant, but still... ;)

Regards,
Philip



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



Re: [PHP] popen() in 4.3.2

2003-06-08 Thread Philip Olson

PHP 4.3.0-1 has a bug that made your previous code work,
have a look at the fread() docs for why, here's a quote:

  Note:  When reading from network streams or pipes, such
   as those returned when reading remote files or from 
   popen() and proc_open(), reading will stop after a packet 
   is available.  This means that you should collect the data 
   together in chunks as shown in the example below.

It goes on to show that you must loop threw it to get
fread() to do what you want in the below code.  Although,
the example it eludes to is wrong (a correct example will
show when the manual next builds), you get the point... :)

Regards,
Philip


On Sat, 7 Jun 2003, Jeff Harris wrote:

 My webhost just upgraded to php 4.3.2, and now I have a problem with
 popen. I'm opening an output buffer then piping it through htmltidy to
 make nice looking output.
 
 ?php
 ob_start();
 // Other unimportant coding goes here
 
  $str=addslashes(ob_get_contents());
  $fp=popen(echo \ . $str . \ | /bin/tidy - config /my/home/htmlrc, r);
  @$newstr=fread($fp, 99);
  ob_end_clean();
  header(Last-Modified:  . $gmt_modtime);
  header( Content-length:  . strlen( $newstr ) );
  echo stripslashes($newstr);
 ?
 
 
 This code worked perfectly before the upgrade, now strlen( $newstr ) is
 only getting back 4096 bytes. Is anybody else having this issue, and how
 can I fix this? I don't see any configuration setting that looks like it
 fits to this situation. It is running under redhat with Apache/1.3.27
 
 Thanks, Jeff
 --
 Registered Linux user #304026. lynx -source
 http://jharris.rallycentral.us/jharris.asc | gpg --import Key fingerprint
 = 52FC 20BD 025A 8C13 5FC6 68C6 9CF9 46C2 B089 0FED Responses to this
 message should conform to RFC 1855.
 
 
 
 -- 
 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] FILE UPLOAD Q

2003-06-08 Thread Philip Olson

That article is pretty old, and the code sucks.  
Read this instead:

  http://www.php.net/features.file-upload

It will explain everything.

Regards,
Philip


On Sun, 8 Jun 2003, nabil wrote:

 Please help me , I want to make any user on my website to submit his CV , or
 any file to a temp folder, the following script create a fupload file ,
 and I don't want to dump the original in it, I want to upload the file as it
 is, with its extension...
 
 by example
 
 
 html
 head
 titleListing 9.14 A file upload script/title
 /head
 ?php
 
 $file_dir = C:\\Inetpub\\wwwroot\\temps\\uploads;
 $file_url = http://localhost/temps\uploads;;
 
 foreach( $HTTP_POST_FILES as $file_name = $file_array ) {
  print path: .$file_array['tmp_name'].br\n;
  print name: .$file_array['name'].br\n;
  print type: .$file_array['type'].br\n;
  print size: .$file_array['size'].br\n;
 
  if ( is_uploaded_file( $file_array['tmp_name'] )
$file_array['type'] == text/plain ) {
   move_uploaded_file( $file_array['tmp_name'], $file_dir/$file_name)
or die (Couldn't copy);
   print img src=\$file_url/$file_name\p\n\n;
  }
 }
 
 ?
 body
 form enctype=multipart/form-data method=POST
 input type=hidden name=MAX_FILE_SIZE value=51200
 input type=file name=fuploadbr
 input type=submit value=Send file!
 /form
 /body
 /html
 
 
 /
 
 
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 


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



Re: [PHP] Re: Using register_globals

2003-06-08 Thread Philip Olson
 On 08-Jun-2003 Philip Olson wrote:
  [snip]
  rant
  
  register_globals=off won't make good code any better --it's just 
  a safety net for the sloppy coders.
  [snip]
  
  In some sense, register_globals = off makes both bad and
  good code better, because it means less pollution.   So
  many unused variables get defined with register_globals
  on and this means wasted memory/resources.  Pollution 
  makes any environment worse!  Granted this isn't what you
  meant, but still... ;)
  
 
 Also true. 
 
 On namespace pollution  --based on some of the replies I've seen on the
 list, there's a sizable number of neophyte (and too many veteran) coders
 that are starting scripts with:
 
 ?php
 extract($_GET); extract($_POST); extract($_COOKIE);
 ...
 
 And so far, I don't recall anybody mention that you need to
 unset($admin, $internal_var, $nukenewyork, ...) afterwards.
 
 So nothing's really changed. 
 Bad code will mysteriously go tits-up (or worse) and good code will 
 keep on cranking.
 
 No matter what register_globals= is set to.

Anyone that would suggest using extract() like that would
only do so to quickly make a register_globals dependent
script work (using .htaccess would be preferred there). I
doubt people actually do that for new code, well, at least 
anyone with half a brain.

Regards,
Philip


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



Re: [PHP] file upload script

2003-06-08 Thread Philip Olson

What PHP version?  You should rewrite your code to more
reflect what's being used in the manual.

  a) use move_uploaded_file() and not copy()
  b) check what ['error'] has to say
  c) set action in the form
  d) print_r($_FILES) is great for debugging
  e) only show the form is it's not yet submitted,
 or at least print something only if the form
 hasn't yet submitted so you know... debug. As
 for all know, $Submit may never be set.

Regards,
Philip



On Sun, 8 Jun 2003, Rodney Green wrote:

 Sorry, here's the code:
 
 form name=form1 method=post action= enctype=multipart/form-data
 input type=file name=imagefile
 br
 input type=submit name=Submit value=Submit
 
 ?php
 $filesdir = /PIVOT;
 
 echo $_FILES['imagefile']['name'];
 echo $_FILES['imagefile']['tmp_name'];
 
 if(isset( $Submit )) {
 
 
 
 if ($_FILES['imagefile']['type'] == image/gif) {
 
 copy ($_FILES['imagefile']['tmp_name'],
 $filesdir/.$_FILES['imagefile']['name'])
 or die (Could not copy);
 
 
 echo brbr;
 echo Name: .$_FILES['imagefile']['name'].br;
 echo Size: .$_FILES['imagefile']['size'].br;
 echo Type: .$_FILES['imagefile']['type'].br;
 echo Copy Done;
 }
 
 
 else
 {
 echo brbr;
 echo Could Not Copy, Wrong Filetype
 (.$_FILES['imagefile']['name'].)br;
 }
 }
 
 
 ?
 
 /form
 
 
 - Original Message - 
 From: Philip Olson [EMAIL PROTECTED]
 To: Rodney Green [EMAIL PROTECTED]
 Cc: [EMAIL PROTECTED]
 Sent: Sunday, June 08, 2003 1:21 AM
 Subject: Re: [PHP] file upload script
 
 
 
  By no errors, do you mean you have a PHP version greater
  than PHP 4.2.0 and checked the ['error'] code, and it
  has a value of 0?  Are you sure you want the filename
  to be $file_name?  I doubt you do.
 
  Regards,
  Philip
 
  ref: http://www.php.net/features.file-upload
 
  On Sat, 7 Jun 2003, Rodney Green wrote:
 
   Hello. I'm attempting to upload a file using the script below and I'm
 not
   having any success. The temp directory I'm using does exist and is
   writeable. When I browse for the file then hit the send button it
 appears to
   be working then displays the form again with no errors. I look for the
 file
   on the server and it isn't there. Any advice on how to get this working?
  
   Thanks!
   Rod
  
  
   ---
  
   html
   head
   titleListing 9.14 A file upload script/title
   /head
   ?php
   $file_dir = /home/corrdev/htdocs/php24/scrap/uploads;
   $file_url = http://corros.colo.hosteurope.com/dev/php24/scrap/uploads;;
  
   foreach( $HTTP_POST_FILES as $file_name = $file_array ) {
print path: .$file_array['tmp_name'].br\n;
print name: .$file_array['name'].br\n;
print type: .$file_array['type'].br\n;
print size: .$file_array['size'].br\n;
  
if ( is_uploaded_file( $file_array['tmp_name'] )
  $file_array['type'] == image/gif ) {
 move_uploaded_file( $file_array['tmp_name'], $file_dir/$file_name)
  or die (Couldn't copy);
 print img src=\$file_url/$file_name\p\n\n;
}
   }
  
   ?
   body
   form enctype=multipart/form-data method=POST
   input type=hidden name=MAX_FILE_SIZE value=51200
   input type=file name=fuploadbr
   input type=submit value=Send file!
   /form
   /body
   /html
  
  
  
   -- 
   PHP General Mailing List (http://www.php.net/)
   To unsubscribe, visit: http://www.php.net/unsub.php
  
 
 
 
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 


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



Re: [PHP] Gracefully dealing with Cookies OFF

2003-06-07 Thread Philip Olson
On Sat, 7 Jun 2003, Bix wrote:

 Monty,
 
 The best way to avoid SID Hijacks is to assign an IP variable, and an
 expiration
 
 session_register(USERIP);
 $_SESSION['USERIP'] = $_SERVER['REMOTE_ADDR'];
 session_register(EXPIRES);
 $_SESSION['expires'] = time() + 900; // 900 seconds (15 mins)

[snip]
I've not followed this thread (nor do I want to get involved
with his touchy and difficult topic) but must make a general 
comment on the above code.  One should never mix use of the 
deprecated session_register() function with $_SESSION.  If 
you're going to use $_SESSION, also use it to assign session 
variables.  There is NO need for use of session_register() in 
the above code.

From the manual (various versions of this text is also in
the manual):

  If you are using $_SESSION (or $HTTP_SESSION_VARS), do not 
   use session_register(), session_is_registered(), and
   session_unregister(). 

And btw, EXPIRES != expires. 

And lastly, there is now session_regenerate_id() although it
won't set session cookies until PHP 4.3.3.

Regards,
Philip


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



Re: [PHP] mod_rewrite rules for the php.net rewritten urls

2003-06-07 Thread Philip Olson
On Sat, 7 Jun 2003, Tularis wrote:

 I was wondering where I could get the rewrite urls for the rewriting of 
 urls like here on php.net.
 
 - Tularis
 
 P.S. I don't think they're in the phpweb on CVS, I checked that already

What you see in phpweb is what you get, there is no
mod_rewrite, just a huge 404 handler.  For the related
sqlite stuff, see the systems cvs module.

Regards,
Philip


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



Re: [PHP] Sorry, I cannot run apxs

2003-06-07 Thread Philip Olson
 I can't build php-4.3.2 with apache 2.0 under a RedHat 9 box.

Okay, Apache2 has some issues, and Redhat itself always
has issues with it's unique setups...

[snip]

 php compilation fails even when I try just:
 
 [EMAIL PROTECTED] php-4.3.2]# ./configure  --with-apxs2=/usr/sbin/apxs

Okay

[snip]

 Configuring SAPI modules
 checking for AOLserver support... no
 checking for Apache 1.x module support via DSO through APXS... no
 checking for Apache 1.x module support... no
 checking for member fd in BUFF *... no
 checking for mod_charset compatibility option... no
 checking for Apache 2.0 module support via DSO through APXS... no
 checking for Apache 2.0 handler-module support via DSO through APXS...
 
 Sorry, I cannot run apxs.  Possible reasons follow:

[snip]

What do these commands output?

# /usr/sbin/httpd -v
# /usr/sbin/apxs -q SBINDIR
# /usr/sbin/apxs -q TARGET


Regards,
Philip


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



Re: [PHP] fsockopen and SSL

2003-06-07 Thread Philip Olson
[snip]
 but I get following error:
 
 Warning: fsockopen() [function.fsockopen]: no SSL support in this build
 in
 /usr/home/trivisions/html/sextoymerchant.com/payment/checkout_confirm.ph
 p on line 64
 
 So does this mean that my PHP installation does not support SSL, and
 that I have to recompile PHP again?
 
 I looked at the PHP installation configure options but did not see
 anything regarding SSL, so how would I install this?

From the manual:

  php.net/fsockopen

  As of PHP 4.3.0, if you have compiled in OpenSSL support, you
   may prefix the hostname with either 'ssl://' or 'tls://' to 
   use an SSL or TLS client connection over TCP/IP to connect 
   to the remote host.

  php.net/openssl

  To use PHP's OpenSSL support you must also compile PHP
--with-openssl[=DIR].

Regards,
Philip




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



Re: [PHP] thumbnail program

2003-06-07 Thread Philip Olson

On Sat, 7 Jun 2003, Artoo wrote:

 Anyone know of a good free thumbnail program that can be called from a PHP
 script using the exec() call or something similar?

By far, the most popular are the tools offered by 
ImageMagick, such as mogrify:

  http://www.imagemagick.org/www/mogrify.html

Regards,
Philip


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



Re: [PHP] file upload script

2003-06-07 Thread Philip Olson

By no errors, do you mean you have a PHP version greater
than PHP 4.2.0 and checked the ['error'] code, and it
has a value of 0?  Are you sure you want the filename
to be $file_name?  I doubt you do.

Regards,
Philip

ref: http://www.php.net/features.file-upload

On Sat, 7 Jun 2003, Rodney Green wrote:

 Hello. I'm attempting to upload a file using the script below and I'm not
 having any success. The temp directory I'm using does exist and is
 writeable. When I browse for the file then hit the send button it appears to
 be working then displays the form again with no errors. I look for the file
 on the server and it isn't there. Any advice on how to get this working?
 
 Thanks!
 Rod
 
 
 ---
 
 html
 head
 titleListing 9.14 A file upload script/title
 /head
 ?php
 $file_dir = /home/corrdev/htdocs/php24/scrap/uploads;
 $file_url = http://corros.colo.hosteurope.com/dev/php24/scrap/uploads;;
 
 foreach( $HTTP_POST_FILES as $file_name = $file_array ) {
  print path: .$file_array['tmp_name'].br\n;
  print name: .$file_array['name'].br\n;
  print type: .$file_array['type'].br\n;
  print size: .$file_array['size'].br\n;
 
  if ( is_uploaded_file( $file_array['tmp_name'] )
$file_array['type'] == image/gif ) {
   move_uploaded_file( $file_array['tmp_name'], $file_dir/$file_name)
or die (Couldn't copy);
   print img src=\$file_url/$file_name\p\n\n;
  }
 }
 
 ?
 body
 form enctype=multipart/form-data method=POST
 input type=hidden name=MAX_FILE_SIZE value=51200
 input type=file name=fuploadbr
 input type=submit value=Send file!
 /form
 /body
 /html
 
 
 
 -- 
 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] XML Parser Problem

2003-06-07 Thread Philip Olson
On Sun, 8 Jun 2003, Dustin Pate wrote:

 Fatal error: Call to undefined function: xml_parser_create() in
 /home/httpd/rootdir/sstats/includes/XPath.class.php on line 1410
 
 I now get this error on my phpsysinfo page.  I have changed nothing in my
 install except for updating recently.  My Linux Flavor is Gentoo if that
 helps.  If you need further information, just ask. ;)

Your new PHP lacks XML support, otherwise this (and all
the other php.net/xml functions) will be defined.  Look
at a call to phpinfo(), you should see something like
--disable-xml in the configure line, or maybe it's 
shared and not included...  Anyway, bottom line is, your
PHP must now lack XML support.

Regards,
Philip


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



Re: [PHP] thumbnail program

2003-06-07 Thread Philip Olson
On Sun, 8 Jun 2003, Artoo wrote:

 thanks.  I'll give that a try.  Happen to know where to get sample code that
 uses this program?

After doing a google search for the terms mogrify php:

  http://www.google.com/search?q=mogrify+php

The first result was this article, it appears to touch
on the subject:
  
  Resizing Images with PHP and Mogrify
  http://www.phpbuilder.com/columns/michael20020712.php3

I'm sure there are many more examples around, and
including PHP in the search field of google is very 
much optional.  But, I guess this all depends on your
knowledge of PHP...  Maybe thumbnail is another good
search term to throw into the mix.

Regards,
Philip

 Philip Olson [EMAIL PROTECTED] wrote in message
 news:[EMAIL PROTECTED]
 
  On Sat, 7 Jun 2003, Artoo wrote:
 
   Anyone know of a good free thumbnail program that can be called from a
 PHP
   script using the exec() call or something similar?
 
  By far, the most popular are the tools offered by
  ImageMagick, such as mogrify:
 
http://www.imagemagick.org/www/mogrify.html
 
  Regards,
  Philip
 
 
 
 
 -- 
 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] PDF

2003-06-06 Thread Philip Olson

Odds are you don't need PDFlib at all.  The docs at php.net/pdf
link to the following faq:

   How can I generate PDF files without using the non-free and 
   commercial libraries ClibPDF and PDFLib? I'd like something 
   that's free and doesn't require external PDF libraries.
 
   http://us2.php.net/manual/en/faq.using.php#faq.using.freepdf

Consider using one of these alternatives.

Regards,
Philip


On Thu, 5 Jun 2003, Lukas Gerhold wrote:

 Hy!
 
 I have an existing pdf formular, which I have to fill up with data from a
 mysql database.
 Now, I know, that there are these pdf funktions which could do all the work.
 But to use these functions I needed the PDFlib.
 Only the 'lite PDFlib' is an open source product, and the full version
 espezially PDFlib+PDI or PDFlib Personalization Server (PPS) costs an
 amazing mount of money.
 
 So my questions, is it possible, to fill in data using the 'lite PDFlib' in
 an existing pdf form?
 And if not, are there any other possibillities than to buy 'PDFlib+PDI' or
 'PDFlib Personalization Server (PPS)' to do so?
 
 I'm thankful for every post!
 greetings to all of you!
 lukas
 
 
 
 -- 
 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 - File Edit

2003-06-06 Thread Philip Olson
On Fri, 6 Jun 2003, Matt Zur wrote:

 Does anyone know of a simple program that will let me specify a file 
 within a certain directory to load into a textarea field, let me make 
 changes, then export/replace that file with the changed contents?
 
 I tried writing one myself in PHP, but I ran into a problem with quotes. 
 If I had tags in in the text area e.g. table width=500  it would 
 mess up the quotes by adding back slashes etc.

Strip them backslashes :)

http://www.php.net/stripslashes

Regards,
Philip


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



  1   2   3   4   5   6   >