php-general Digest 28 Sep 2009 10:29:26 -0000 Issue 6362
Topics (messages 298377 through 298381):
Re: Web Site Directory Layout
298377 by: George Langley
intl extension on os x
298378 by: Tom Worster
298379 by: Tommy Pham
Re: Issue of upgrading from to 5.x
298380 by: Lars Torben Wilson
Text similarity
298381 by: Merlin Morgenstern
Administrivia:
To subscribe to the digest, e-mail:
[email protected]
To unsubscribe from the digest, e-mail:
[email protected]
To post to the list, e-mail:
[email protected]
----------------------------------------------------------------------
--- Begin Message ---
On 26-Sep-09, at 2:38 AM, Ashley Sheridan wrote:
I tend to usually go with the following, using what fits with the
project:
index.php
styles/
images/
scripts/
includes/
---------------
Add files/ for any download-able files.
Then for multi-lingual projects, I'll add a content/[language]/
structure, to put my content php files in, while leaving the
structural php files on the root. User preferences and cookies form
the path to grab the content, but this way you get similar (and
shorter) URLs.
George Langley
Multimedia Developer
www.georgelangley.ca
--- End Message ---
--- Begin Message ---
does anyone know how to install intl on os x 10.5?
it seems a libicu binary is included in os x but not with headers. fink has
a package for installing the headers. maybe that would allow pecl to install
the intl extension.
has anyone done this successfully? or know any other way to get intl running
on 10.5?
--- End Message ---
--- Begin Message ---
----- Original Message ----
> From: Tom Worster <[email protected]>
> To: PHP General List <[email protected]>
> Sent: Sunday, September 27, 2009 5:34:45 PM
> Subject: [PHP] intl extension on os x
>
> does anyone know how to install intl on os x 10.5?
>
> it seems a libicu binary is included in os x but not with headers. fink has
> a package for installing the headers. maybe that would allow pecl to install
> the intl extension.
>
> has anyone done this successfully? or know any other way to get intl running
> on 10.5?
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
When Apple made the big change of OS a few years back, they switch to *BSD
based OS, with the GUI from NeXT, which Apple bought. You should be able to
compile most linux/unix codes on Mac though. Have you looked at Apple's
developer's resources/documentation?
Regards,
Tommy
--- End Message ---
--- Begin Message ---
Chris Streatfield wrote:
Here's a little problem I'm just discovering.
The issue has been brought to my attention by a couple of my clients when
their mail() replies were suddenly turning up with zero variable content.
I have several html/php contact/subscribe forms which return a mail reply to
the web site owner. These have recently been turning up with none of the
variables being picked up from the html form. The mail() library is still
sending the reply correctly. All the material is hosted on commercial ISP web
servers. A couple of them have clearly upgraded to PHP 5.x recently.
When a user fills out the form and presses the submit button the process page
picks up the variables from the input and mails the output back to the site
owner. Recently some of these replies have started to show up with the
variables not being picked up. On looking through the official PHP
documentation it would seem to be an issue of the change in the use of
globals being turned off by default in 5.x onwards. I found an example of a
function in the documentation to include that simulates globals being turned
on but this does not seem to be working as expected.
Hi Chris,
Don't worry; globals have not been disabled. However, what you're
referring to (registering input data as global variables) has been
disabled by default since PHP 4.2. It has always been possible to
disable it (and for a long time, recommended to disable it) via the
register_globals ini directive, and it's still possible to enable it
using register_globals.
However: like I said, it's not recommended. It's a security risk, and
registering input data as global variables will be removed entirely in
PHP 6. As of PHP 5.3 it is officially deprecated.
Have a look at the following page in the documentation for more
information on this:
http://www.php.net/manual/en/ini.core.php#ini.register-globals
In a case like yours, I'd recommend leaving register_globals disabled
and either fixing your scripts, or prepending an included file which
would gather the needed data from $_GET, $_POST, or $_REQUEST, sanitize
it, and *then* create the needed global variables using that data. This
second option would likely require the fewest changes to your existing
scripts.
Regards,
Torben
While this is a very simple (and possibly only a bit irritating) problem the
nightmare scenario for me is that I have a great many files (read several Ks)
that rely on the same functionality, as the access to several MySql
databases. I have very quickly tested a couple of these database constructs
on one of the hosting sites where the mail() forms have failed and the
database constructs do not work either. I really would prefer not to have to
spend the whole of the next year re-writing all these files especially as
this work is all voluntary.
Now if these very simple html form / php processing structures are now going
to fail by not retrieving the variables what are we supposed to do to create
web site contact forms or data entry pages for database access. I have tried
constructing the forms as hybrid php/html and included the function noted
above and this did not work either. In fact on one of the servers running the
upgrade even logging on to the database construct froze at the first
processing page. I think that either this <quote>
header("Location: adminhome.php");
exit(); </quote> failed to trigger or the "session_register();" failed.raised
Any suggestions advice would be most welcome.
I have included an example snippet of code from one of the mailback forms that
has been working correctly for several years.
A snippet of example code--------
The Form:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0
Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="stylesheet" href="css/formpage.css" type="text/css" />
<title>On-line Membership form</title>
</head>
<body>
<form method="post" action="psubscription1.php">
<h3>Join the Campaign</h3>
<p><b>ON-LINE ANNUAL SUBSCRIPTION FORM</b></p>
<fieldset>
<legend>Contact Details</legend>
<ul>
<li><label for="firstname">Name</label>
<input name="firstname" id="firstname" class="text" type="text"
size="35" /></li>
<li><label for="address">Address</label>
<input name="address" id="address" class="text" type="text" size="35" /></li>
<li><label for="suburb">Suburb</label>
<input name="suburb" id="suburb" class="text" type="text" size="35" /></li>
<li><label for="city">City/Postcode</label>
<input name="city" id="city" class="text" type="text" size="35" /></li>
<li><label for="tel">Phone</label>
......
</form>
</body>
</html>
---------------------ENDS---------------
The processing done in <psubscription1.php>-----
<?php
$toaddress="[email protected]";
$subject = "On-line Membership subscription";
$mailcontent="This is the reply from the on-line membership subscription form
on the web-site.
Contact Details---------\n
Name:----- $firstname
Address:------
$address
$suburb
$city\n
Phone:------- $tel
...
--------------";
$additionalheaders="From: [email protected]\n";
mail($toaddress, $subject, $mailcontent, $additionalheaders);
?>
-------------------ENDS----------------
All the best
Chris
--- End Message ---
--- Begin Message ---
Hi there,
I am trying to find out similarity between 2 strings. Somehow the
similar_text function returns 33% similarity on strings that are not
even close and on the other hand it returns 21% on strings that have a
matching word.
E.G:
'gemütliche sofas'
Wohngemeinschaften - similarity: 33.333333333333
Sofas & Sessel - similarity: 31.25
I am using this code:
similar_text($data[txt], $categories[$i], $similarity);
Does anybody have an idea why it gives back 33% similarity on the first
string?
Thank you for any help,
Merlin
--- End Message ---