[PHP] PHP 4.2

2002-06-23 Thread Simon Troup

I've written a small freeware script that gets installed on a variety of
different platforms running various PHP versions.

I've read through the manual about the super global arrays and how post and
get vars are no longer registered by default, but am confused about when it
would be a good idea to "upgrade" the script.

If I change everything in the script and use $_GET and $_POST etc. then
those people who are still using earlier versions won't be able to upgrade.

Does anyone know what the uptake of the latest version is? What is everyone
else doing about this? If I were developing for one client it wouldn't be a
problem as obviously you'd know what you were developing for.

I'd just like some feedback on when would be a good time to upgrade the
scripts while causing the minimum disruption and maintaining maximum happy
users.

Thanks

Zim


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




[PHP] .htpasswd

2002-07-02 Thread Simon Troup

Does anyone know what encryption is used on passwords in a .htpasswd file?

Zim


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




[PHP] help with session_decode in PHP 4.20 (fairly urgent)

2002-07-05 Thread Simon Troup

My web host has just upgraded to PHP 4.20. My MySQL database is full of
session_encoded fields, but since the upgrade I can no longer session_decode
them.

After doing phpinfo I find the following settings ...

register_argc_argvon on
register_globals  on on


I've been through the manual regarding predefined variables but must be
missing the point somewhere.

How do I get the session_encoded fields back as useable variables?

Thanks

Zim


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




[PHP] Opening and Editing Quark Binaries

2002-07-14 Thread Simon Troup

I've been trying to open and end some of the ascii portions of Quark Express
binary files, (I'm using PHP4 on MacOSX, the quark files are OS9 files).

Even if I make the simplest eregi_replace () having done ...

$fd = fopen ($file, "rb+");
$contents = fread ($fd, filesize ($file));
fclose ($fd);

 ... then the edits ... 
 
 ... and then ...
 
touch ($new_filename);
$fd = fopen ($new_filename, "ab+");
fwrite ($fd, $contents);
fclose ($fd);

... quark reports things like unexpected EOF (even though when I open the file
in a text editor they have same number of lines and "look" identical), I've also
tried a few things with the Mac resource forks to no avail.

Has anyone tried something like this before? Does the fread() fwrite() change
line endings from mac to unix or something?

Kind of an obscure subject, but hoping for a clue from somewhere.

Zim

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




[PHP] How info is passed to $vars

2002-05-29 Thread Simon Troup

I know that if you call a page like this ...

http://www.domain.com/index.php?thisvar=1&thatvar=2

... that you get $thisvar and $thatvar to use in your script, but exactly 
what conditions are necessary for a "POST" and "GET" to be passed as 
variables into the PHP engine. I presume that there is a header that flags 
an incoming result as a post or get?

The reason I ask is that I am receiving a kind of form "POST" that is 
failing to register the $vars in the usual way, and I presume that this is 
because they are using a different header. I know that this company will 
not change their script (for reasons too boring to explain) and so I would 
like to know how I can get PHP accept special header info, is it apache 
that is responsible in this case or PHP ? I understand that the 
information is the same format as a "POST" but that the header is a little 
different.

Zim


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




[PHP] Form content type missing, how to fetch variables?

2002-05-31 Thread Simon Troup

How do you fetch posted form variables from a request that does not have
content type in the headers? I mean, instead of having Content-Type:
x-www-form-urlencoded or something similar, there is nothing - just the raw
data. How can I parse that?

Regards

SImon


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




Re: [PHP] Form content type missing, how to fetch variables?

2002-05-31 Thread Simon Troup

Thanks Dan, but I don't think I'm explaining well.

Submitting that form will produce, from most browsers, a request that has in
one of it's headers:

content-type: x-www-form-urlencoded

... the variable $Foo will automatically be available within PHP for use in
any script that form is directed to, however, I have to write a script that
will accept raw data, it's input comes from a server that is not kind enough
to put in the header content-type: x-www-form-urlencoded and so is not
automatically being passed by PHP into the script.

The page content is just raw data like this ...

foo=boo&name=joe&action=jump

... but php does not pass them into variables as content-type is not
x-www-form-urlencoded

The answer could be "tell the people to add the content type" but they say
"by the end of june" and I need to read this stuff today!

Sorry if my explanation inadequate, I'm trying my best.

Thanks

Simon

> Simon:
> 
> 
> 
> 
>  if ( isset($_POST['Foo']) ) {
> echo '' . $_POST['Foo'] . '';
> }
> ?>
> 
> Viewing that the first time will show the form.  Submitting the form
> will show you the form again and then the value of Foo.
> 
> --Dan


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




Re: [PHP] Form content type missing, how to fetch variables?

2002-05-31 Thread Simon Troup

This "non form" is a posted response from a commercial server quoting the
results of various transactions as pretty much a basic text dump. Weird I
know, and it is their problem/fault, however, I'm still left having to work
with it until such a time as they fix it (4 weeks, who knows why!). Also, it
is not a browser calling my script, it's just that, a raw text dump from a
server aimed at myscript.php

Thanks

Simon

> So is it even a web page that's returned? Or is it more like a text
> file?
> 
> Will getallheaders() help you at all?
> 
> www.php.net/getallheaders
> 
> ---John Holmes...
> 
>> -Original Message-
>> From: Simon Troup [mailto:[EMAIL PROTECTED]]
>> Sent: Friday, May 31, 2002 8:23 PM
>> To: [EMAIL PROTECTED]
>> Subject: Re: [PHP] Form content type missing, how to fetch variables?
>> 
>> Thanks Dan, but I don't think I'm explaining well.
>> 
>> Submitting that form will produce, from most browsers, a request that
> has
>> in
>> one of it's headers:
>> 
>> content-type: x-www-form-urlencoded
>> 
>> ... the variable $Foo will automatically be available within PHP for
> use
>> in
>> any script that form is directed to, however, I have to write a script
>> that
>> will accept raw data, it's input comes from a server that is not kind
>> enough
>> to put in the header content-type: x-www-form-urlencoded and so is not
>> automatically being passed by PHP into the script.
>> 
>> The page content is just raw data like this ...
>> 
>> foo=boo&name=joe&action=jump
>> 
>> ... but php does not pass them into variables as content-type is not
>> x-www-form-urlencoded
>> 
>> The answer could be "tell the people to add the content type" but they
> say
>> "by the end of june" and I need to read this stuff today!
>> 
>> Sorry if my explanation inadequate, I'm trying my best.
>> 
>> Thanks
>> 
>> Simon
>> 
>>> Simon:
>>> 
>>> 
>>> 
>>> 
>>> >> if ( isset($_POST['Foo']) ) {
>>> echo '' . $_POST['Foo'] . '';
>>> }
>>> ?>
>>> 
>>> Viewing that the first time will show the form.  Submitting the form
>>> will show you the form again and then the value of Foo.
>>> 
>>> --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] 'Pure' php vs 'mixed' (html + php)

2002-06-02 Thread Simon Troup

I would ask the question "How much HTML before you break out of PHP and into
HTML". My answer is "any". Surely you're making the engine work just to echo
stuff out? But are you asking for more by making it jump in and out between
all those tags?!

Short tags ...



... easier to read in Mixed? I think so.

Also, "pure" coding breaks the HTML syntax coloring in my text editor!

Simon

> Thanks Bogdan,
> 
> That's what I thought, but I was beginning to feel 'guilty' the more I
> understood php. It seems to me, from my limited experience, that there's much
> mor chance for error using 'pure' php (as in forgetting ' or " or closing
> with ; -- but . . .
> 
> Actually I've found that the 'mixed' is easier to read and understand -- less
> quotes, less 'print' to read with every line. But that's just personal taste
> on my part.
> 
> While I'm at it, I've also noticed that coders tend to integrate 'result'
> pages with the 'calling' page. (That is, I have a text input, and use a php
> function to verify it on the same page). I've tended to keep them separate
> for de-bugging purposes. Should I consider re-writing them as well?
> 
> Regards,
> Andre
> 
> On Sunday 02 June 2002 08:16 pm, you wrote:
>> No *real* reason - just two not-so-important ones:
>> 
>> 1. Clarity
>> Please compare these two:
>> -- "MIXED"
>> 
>> 
>> 
>> 
>> 
>> -- "PURE"
>> > echo("\n");
>> $fldcontent=$myrow[0]?$myrow[0]:"no data";
>> echo("\n");
>> ?>
>> 
>> The second is much easier to read and understand, you must agree.
>> 
>> 2. Speed
>> There's an urban legend saying that switching php tags on and off would
>> slow parsing down. I don't know if that's true and try to write "pure"
>> php as you call it due to the first reason.
>> 
>> Bogdan
>> 
>> Andre Dubuc wrote:
>>> I've noticed that many people on the list code in 'pure' php, i.e.
>>> 
>>> >> print "";
>>> 
>>> // etc
>>> ?>
>>> 
>>> Since most of my code is a mixture (the early stuff is 'mixed' html +
>>> php), I've been wondering why code in 'pure' php? Is there some
>>> compelling reason (that I'm unaware of) for doing so? Should I rewrite
>>> all my earlier code into its 'pure' form? If so, what do I do with the
>>> ' statement -- put it in quotes too?
>>> 
>>> I would like to understand the reasons for writing code in this manner,
>>> when all my code works fine, displays great: am I missing something
>>> important here? Btw, I use the 'php' ending for all file names.
>>> 
>>> Your thoughts, opinions and suggestions would be greatly appreciated --
>>> I'd like to do what is best.
>>> 
>>> Tia,
>>> Andre


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