php-general Digest 15 Dec 2005 10:39:52 -0000 Issue 3851
Topics (messages 227443 through 227460):
Re: MIME E-mail message
227443 by: Oli Howson
227459 by: Richard Heyes
227460 by: Oli Howson
XmlReader & XInclude
227444 by: Jared Williams
227446 by: Rob Richards
XML Parsing german special chars
227445 by: Norbert Wenzel
i18n maybe?
227447 by: Richard Lynch
227448 by: Richard Lynch
Re: Questions from a ColdFusion Developer
227449 by: Christopher Jordan
227450 by: Robert Cummings
227451 by: Christopher Jordan
227452 by: Robert Cummings
Re: looking for php programmers in mumbai / bombay
227453 by: mailing
227458 by: Hristo Yankov
Re: Accessing photos outside the web folder
227454 by: Dave Carrera
Re: php file upload permission query
227455 by: Angelo Zanetti
227456 by: Hristo Yankov
227457 by: Hristo Yankov
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 ---
>> Oh and cheers for the info someone gave me the other day, it inspired
>> me to just connect to the pop3 server using a raw socket, SOOOOO much
easier!!!
>share the code please, I'm interested :)
Ok... It's a bit rough and ready, never expected anyone else to want to look
at this (at least not yet!)
$host = 'mail.myserver.com';
$port = '110';
$user = '[EMAIL PROTECTED]';
$pass = 'itsasecret';
$socket = fsockopen($host,$port);
if (!$socket)
{
echo "Couldn't connect!";
}
else
{
//is it connected?
$res=getinfo($socket);
echo "Testing connection... ".$res;
echo "Send user...";
fputs($socket,"USER $user\n");
$res=getinfo($socket);
echo $res;
echo "Send pass...";
fputs($socket,"PASS $pass\n");
$res=getinfo($socket);
echo $res;
echo "Let's get the number of messages...";
fputs($socket,"STAT\n");
$res=getinfo($socket);
$res = split(' ',$res);
$res = $res[1];
echo trim($res)." messages\n";
if (trim($res) > 0)
{
echo "Let's get the array of messages...\n";
fputs($socket,"LIST\n");
$res=getinfo($socket);//gets rid of the OK
$res=getinfo($socket);
$res = split("\n",$res);
//print_r($res);
foreach ($res as $key => $value)
{
if ((trim($value) != '.') and (trim($value != "")))
{
$value = split(" ",$value);
$mids[] = $value[0];
}
}
//print_r($mids);
echo "Now we have a list of message IDs, we'll extract each message\nand
save under it's MID\n";
foreach ($mids as $key => $value)
{
echo "Requesting $value\n";
fputs($socket,"RETR $value\n");
$res=getinfo($socket);//gets rid of the OK
$res=getinfo($socket);
$res = split("\n",$res);
$cont = true;
foreach ($res as $key2 => $value2)
{
if ((trim($value) != '.') and ($cont == true))
{
$msg[] = $value2;
}
else
{
$cont = false;
}
}
$res = join("\n",$res);
echo "Saving $value\n";
file_put_contents('my/save/folder/'.$value.'.txt',$res);
}
}
echo "Finally, let's quit...";
fputs($socket,"QUIT\n");
$res=getinfo($socket);
echo $res;
}
function getinfo($socket)
{
$buff = '';
$continue = true;
while (!feof($socket) and ($continue==true))
{
$buffer = fgets($socket);
if (substr($buffer,0,4) == '-ERR')
{
$res = 'error';
$continue = false;
}
if (substr($buffer,0,3) == '+OK')
{
$res = 'ok';
$continue = false;
}
if (trim($buffer) == '.')
{
$res = 'end';
$continue = false;
}
$buff .= $buffer;
}
return $buff;
}
This was designed to run as a CLI app, may need tweaking to run through
http. Not fully tested, but does what I want!
--- End Message ---
--- Begin Message ---
Oli Howson wrote:
I'm working on a private webmail (and other) system, and am struggling a
little with MIME mails. I've got a script to save all the attachments, but
the thing I can't figure out is how I decide which "part" is the main email
message itself (and hence which to display).
Oh and cheers for the info someone gave me the other day, it inspired me to
just connect to the pop3 server using a raw socket, SOOOOO much easier!!!
Than what? The imap extension is faster and has parsing functionality
built in.
Also there's a PEAR Net_POP3 library if you insist on using sockets
which handles lots of menial tasks for you.
--
Richard Heyes
http://www.phpguru.org
--- End Message ---
--- Begin Message ---
Than what? The imap extension is faster and has parsing functionality
built in.
True, but the parsing is to be done at a completely different time, and
then imap extension can't be >that< much faster, when you consider that
my method is doing very little processing, and basically getting the
messages as fast as they can download!
Also there's a PEAR Net_POP3 library if you insist on using sockets
which handles lots of menial tasks for you.
But where's the fun in that?
--- End Message ---
--- Begin Message ---
Hi,
Does PHPs XmlReader support Xinclude ? Seems libxml does reading this
post
http://mail.gnome.org/archives/xml/2004-February/msg00190.html , but the
corresponding constant seems missing in PHP
Jared
--- End Message ---
--- Begin Message ---
Only the version of XMLReader in CVS HEAD does at the moment.
Rob
Jared Williams wrote:
Hi,
Does PHPs XmlReader support Xinclude ? Seems libxml does reading this
post
http://mail.gnome.org/archives/xml/2004-February/msg00190.html , but the
corresponding constant seems missing in PHP
--- End Message ---
--- Begin Message ---
I did some easy xml parsing on the last.fm[1] recent tracklist.
I do read in all the tracks and output them encoded with htmlentities().
A lot of german special chars like the Ä (Ä) are transfered to
strange followings of an A with any sort of available accent. But it
isn't replaced by Ä
The xml file does not contain any character encoding information, so how
could I tell htmlentities(), there might be some character in the
string, which might be a german special char.
I never encountered any problems when writing htmlentities('Ähre'); or
$var = 'Ähre';
htmlentities($var);
but only if I take the strings out of the xml file.
If I output the whole xml file all characters are shown as they are
supposed to, only if i do the encoding by htmlentities() I get those
weird accented letters.
any suggestions how to fix this?
thanks,
Norbert
PS: code and link to the output page can be given if needed.
[1] www.last.fm
--- End Message ---
--- Begin Message ---
I have a table like this:
artist_id | artistname | artistname_alpha
1 | The Doors |
2 | The The |
3 | 100 Monkeys |
4 | 3�16 |
That last artistname is not in ASCII/English... Dunno what your email
client is showing you, but it's:
the digit 3
capital A with umlauts
US cents sign
capital A with carat
question mark
capital A with carat
US cents sign
the digit 1
the digit 6
THAT ought to get through any email client/mta okay. :-)
Now, my goal is to fill in artistname_alpha with things such as:
Doors, The
The, The
one hundred monkeys
3�16 (???)
I've written a nifty function for this:
function alpha ($string){
//$string = utf8_decode($string);
$string = preg_replace_callback('/(\\$[0-9\\.]+)/',
create_function('$s', 'return
Numbers_Words::toCurrency(str_replace("$", "", $s[1]));'), $string);
$string = preg_replace_callback('/([0-9]+)/', create_function('$s',
'return Numbers_Words::toWords($s[1]);'), $string);
if (stristr(substr($string, 0, 4), 'The ')) return (substr($string,
4) . ', ' . substr($string, 0, 4));
elseif (stristr(substr($string, 0, 3), 'An ')) return
(substr($string, 3) . ', ' . substr($string, 0, 3));
elseif (stristr(substr($string, 0, 2), 'A ')) return
(substr($string, 2) . ', ' . substr($string, 0, 2));
else return $string;
}
Now, the tricky part is that I don't really know what
'3�16' is.
It looks like it might be UTF-8, but utf8_decode() had no effect on
it, which is why I've commented that out in the function.
SO my function currently converts it to:
'three�sixteen'
That ain't right.
So, does anybody who understands this i18n stuff want to clue me in
the right direction?...
Things you should know:
I'm not trying to provide support for anything but English here,
unless it's trivial to do so.
The table has 150,000 rows.
I have no real control over fancy MySQL settings, as it's a $20 shared
host deal.
Every day, at 6 am, I get a new file of this data, and run through
with a script that does an UPDATE or INSERT. REPLACE is not suitable
due to primary key field size of source data. Anyway, I haven't even
checked if the function as-is will be too slow, but whatever I do to
fix the i18n issue can't have too much overhead, as it will be called
150,000 times every morning at 6 am.
If it helps, here is what my data-source dumps out when he encounters
this band name:
http://cdbaby.com/cd/316live
Here is the band's web-site:
http://316live.com/
And, here, possibly, is HTML source for what somebody copied/pasted
into the FORM to fill in the band name:
3·16
So, possibly, this is not i18n at all, and just somebody really really
really silly copying and pasting an HTML entity 'middot' from their
website into a form input and expecting it to render...
Would '·' output by a browser turn into 'âÂ�¢' ???
If so, what can I do about it?
--
Like Music?
http://l-i-e.com/artists.htm
--- End Message ---
--- Begin Message ---
UPDATE:
What's actually in the database is:
3â¢16
So in this case, it's not i18n, and my function is doing the correct
thing.
Why the band wants those characters in their band name is beyond my
ken, but you know those flaky musicians :-)
Apologies for my failure to detect this sooner -- I was having trouble
finding the actual record in the 150,000 in the first place.
I guess I should still be concerned about those international artists
who do place non-ASCII characters in their band names, so any insight
you want to provide is still most welcome and will not be wasted.
On Wed, December 14, 2005 6:26 pm, Richard Lynch wrote:
> I have a table like this:
> artist_id | artistname | artistname_alpha
> 1 | The Doors |
> 2 | The The |
> 3 | 100 Monkeys |
> 4 | 3�16 |
>
> That last artistname is not in ASCII/English... Dunno what your email
> client is showing you, but it's:
>
> the digit 3
> capital A with umlauts
> US cents sign
> capital A with carat
> question mark
> capital A with carat
> US cents sign
> the digit 1
> the digit 6
>
> THAT ought to get through any email client/mta okay. :-)
>
> Now, my goal is to fill in artistname_alpha with things such as:
> Doors, The
> The, The
> one hundred monkeys
> 3�16 (???)
>
> I've written a nifty function for this:
>
> function alpha ($string){
> //$string = utf8_decode($string);
>
> $string = preg_replace_callback('/(\\$[0-9\\.]+)/',
> create_function('$s', 'return
> Numbers_Words::toCurrency(str_replace("$", "", $s[1]));'), $string);
> $string = preg_replace_callback('/([0-9]+)/', create_function('$s',
> 'return Numbers_Words::toWords($s[1]);'), $string);
>
> if (stristr(substr($string, 0, 4), 'The ')) return (substr($string,
> 4) . ', ' . substr($string, 0, 4));
> elseif (stristr(substr($string, 0, 3), 'An ')) return
> (substr($string, 3) . ', ' . substr($string, 0, 3));
> elseif (stristr(substr($string, 0, 2), 'A ')) return
> (substr($string, 2) . ', ' . substr($string, 0, 2));
> else return $string;
> }
>
> Now, the tricky part is that I don't really know what
> '3�16' is.
>
> It looks like it might be UTF-8, but utf8_decode() had no effect on
> it, which is why I've commented that out in the function.
>
> SO my function currently converts it to:
> 'three�sixteen'
>
> That ain't right.
>
> So, does anybody who understands this i18n stuff want to clue me in
> the right direction?...
>
> Things you should know:
>
> I'm not trying to provide support for anything but English here,
> unless it's trivial to do so.
>
> The table has 150,000 rows.
>
> I have no real control over fancy MySQL settings, as it's a $20 shared
> host deal.
>
> Every day, at 6 am, I get a new file of this data, and run through
> with a script that does an UPDATE or INSERT. REPLACE is not suitable
> due to primary key field size of source data. Anyway, I haven't even
> checked if the function as-is will be too slow, but whatever I do to
> fix the i18n issue can't have too much overhead, as it will be called
> 150,000 times every morning at 6 am.
>
> If it helps, here is what my data-source dumps out when he encounters
> this band name:
> http://cdbaby.com/cd/316live
>
> Here is the band's web-site:
> http://316live.com/
>
> And, here, possibly, is HTML source for what somebody copied/pasted
> into the FORM to fill in the band name:
>
> 3·16
>
> So, possibly, this is not i18n at all, and just somebody really really
> really silly copying and pasting an HTML entity 'middot' from their
> website into a form input and expecting it to render...
>
> Would '·' output by a browser turn into 'âÂ�¢' ???
>
> If so, what can I do about it?
>
> --
> Like Music?
> http://l-i-e.com/artists.htm
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
--
Like Music?
http://l-i-e.com/artists.htm
--- End Message ---
--- Begin Message ---
Jochem,
Thanks so much for your advice.
In the end, I managed to find why that little EZSql tool wasn't working for me,
and thus what I'm *really* putting into the session variable is an array.
I understand also that each user would get a copy of the same session
variables, but this is for a small antique dealer and there will only ever be
one or two people using the admin screen which started this mess in the first
place.
Also, I'm using the auto_prepend_file to simulate the CF concept of an
application.cfm which gets included at the start of every page. I've configured
it such that if the include file doesn't exist in the application's directory,
it then goes and gets an empty file of the same name to prepend from the
default include path... pretty neat, actually.
When you said:
"...the strength and simplicity of PHP stem from the decision to make/keep
PHP a 'share nothing' architecture."
What did you mean, by that? I've not heard of this "share nothing" idea. What
is the idea of "share nothing" and why is it a strength? I'd like to understand
so if I'm doing something ass-backwards (read: inefficiently), that I can
change what I'm doing.
So far, things seem to be working for me, but perhaps there's an easier way to
accomplish some of the stuff I'm doing, you know?
I'd appreciate any time you could spend answering my questions.
Thanks,
Chris
Jochem Maas <[EMAIL PROTECTED]> wrote: CF has an application scope - PHP does
not.
the strength and simplicity of PHP stem from the decision to make/keep
PHP a "share nothing" architecture.
with regard to shoving stuff in the SESSION superglobal:
1. it not shared between requests by different users - meaning
that the SQL query you gave as an exmaple would still be run once
by every visitor and each visitor would have a copy of the
result set object.
2. performance-wise sticking objects in the session is possibly
something to be avoided is possible - storage and retrieval of 'complex'
structure (i.e. objects in this case) comes with a certain performance
penalty (you might want to consider using an array to store the query results)
3. you MUST load the class definitions of ALL the objects that are in your
session
BEFORE you start the session.
Christopher Jordan wrote:
> Hi folks,
>
> I'm a ColdFusion developer, but I'm branching out into PHP because alot
> of my smaller clients don't want to pay for CF.
>
> Anyway, a bit of background:
>
> I've got a page that does a search on one of my tables. I'm using Justin
> Vincent's ezSQL (http://php.justinvincent.com) to fetch the result set into
> an object that can be referenced nicely. Here's what his example code looks
> like:
>
> // Select multiple records from the database and print them out..
> $users = $db->get_results("SELECT name, email FROM users");
> foreach ( $users as $user ){
> // Access data using object syntax
> echo $user->name;
> echo $user->email;
> }
>
> So far so good. So I've got an iframe on the page which (I hope) will
> eventually display the results of the search. The user will then click on
> the search result for which they want to view the details, and the
> information from that row will be populated inside the main page (the one
> that houses the iframe).
>
> Hope that makes sense.
>
> Okay, so my trouble is that I don't know how to enable the page inside the
> iframe to have access to the result object created by Justin Vincent's nifty
> little class. In CF I can just say:
>
> session.oResults = queryname
>
> CF automatically returns any query as an object with the name of the query
> as the object name (i.e. queryname.MyIdField, or queryname.EmployeeNumber,
> etc.) Using a line like the one above (assigning the query object to a
> session variable) all of my subsequent requests would have access to that
> result set simply by using the object.
>
> I'm *sure* there's a way to do this in PHP. I'm just falling short of
> finding the answer. I've tried:
>
> $_SESSION["SearchResult"] = $db->get_results($query);
>
> But it doesn't seem to work. I may have some other problem using the
> object. I just re-read my error and it says:
>
> Fatal error: Call to a member function get_results() on a non-object in
> inventorymanager.php on line 93
>
> hmm... I sure would appreciate a little guidence here. Even if my problem
> is with the way I'm using the object, is the idea of assigning that object
> to the session scope the right way to do this or is there a better approach.
> To that end, I suppose I'm looking for an idea of the best practice.
>
> Thanks!
> Christopher Jordan
> Planet Access
> Arlington, TX
>
>
>
> ---------------------------------
> Yahoo! Shopping
> Find Great Deals on Holiday Gifts at Yahoo! Shopping
---------------------------------
Yahoo! Shopping
Find Great Deals on Holiday Gifts at Yahoo! Shopping
--- End Message ---
--- Begin Message ---
On Wed, 2005-12-14 at 20:50, Christopher Jordan wrote:
>
> When you said:
>
> "...the strength and simplicity of PHP stem from the decision to make/keep
> PHP a 'share nothing' architecture."
>
> What did you mean, by that? I've not heard of this "share nothing"
> idea. What is the idea of "share nothing" and why is it a strength?
> I'd like to understand so if I'm doing something ass-backwards
> (read: inefficiently), that I can change what I'm doing.
"Share nothing" refers to the PHP philosophy of not tying any data
sharing system to the engine itself. In this way developers are free to
create applications in such a way that if they need more power, they can
just add more computers. This becomes a much more difficult issue when a
program holds private data in memory that requires a specific way to
access it. For instance if you stored some kind of application variable
in memory (a la ColdFusion, Java, ASP) then this value would not be
normally transparent to other computers without some kind of
synchronization system to transfer it around. Then you run into race
condition and deadlock issues. Using the share nothing philosophy such
data doesn't generally exist, and if it does, then it is stored in a
database. Databases are a better system for such data since they were
designed for heterogeneous external access and quite handily solve the
race condition and deadlock issues. That said, you can also use database
replication so that multiple databases servers have an image of the same
database, thus allowing even the database server to scale horizontally.
So how does this relate to your mom and pop requirements... it doesn't
really *lol*, but if you ever create something that becomes the next
Google, it might just scale to a server farm of thousands of computers.
Cheers,
Rob.
--
.------------------------------------------------------------.
| InterJinn Application Framework - http://www.interjinn.com |
:------------------------------------------------------------:
| An application and templating framework for PHP. Boasting |
| a powerful, scalable system for accessing system services |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for |
| creating re-usable components quickly and easily. |
`------------------------------------------------------------'
--- End Message ---
--- Begin Message ---
Rob,
Thanks for responding. :) I have more questions. I hope that's okay. :)
You said:
"Share nothing" refers to the PHP philosophy of not tying any data
sharing system to the engine itself.
In this way developers are free to create applications in such a way that if
they need more power, they can just add more computers.
-----
I guess I'm a little confused, by this and by what Jochem originally posted.
I'm not sharing data between different computers within the application (if
that makes sense). In other words, of course all my data (in this case
inventory data) is in a MySQL table, and so multiple users could be accessing
the data simultaneously. The session variable only serves to store (for display
purposes, really) the results of the users last search. I also maintain a
$_SESSION["LoggedIn"] variable to keep track of whether the user has access in
this session.
You said:
This becomes a much more difficult issue when a program holds private data in
memory that requires a specific way to access it. For instance if you stored
some kind of application variable in memory (a la ColdFusion, Java, ASP) then
this value would not be normally transparent to other computers without some
kind of synchronization system to transfer it around.
----
Perhaps I'm being dense (it wouldn't be the first time), or maybe a bit
unimaginative, but I can't think of an instance where while a user is logged
into an app and using it, that another computer (besides the web server,
database server and the client machine), would need to have access to that data.
Are you referring to "state" here? Or.... well other than passing data around
between browser windows, I'm not really sure what you mean. I'd love it if you
could find the time to expand on that.
You Said:
Using the share nothing philosophy such data doesn't generally exist, and if it
does, then it is stored in a database. Databases are a better system for such
data since they were designed for heterogeneous external access and quite
handily solve the race condition and deadlock issues.
---
Typically I think of the session variable scope as a way to preserve state. Are
you suggesting that state be preserved by dumping information down to and then
reading it again from a database? For example my session variable which
indicates the user has successfully logged in...
In speaking of *large* scale applications I suppose I might be able to see
where you'd want something different than the session superglobal since the
more users you have accessing the app and using that scope, the more memory
it's taking up on the server. I thought cookies might be used in such cases. I
don't usually use cookies, because ColdFusion has an configuration option of
storing session data in the system registry (windows version obviously)...
which alleviates the problem of running out of memory via the session scope.
Have I completely missed your point? :)
Thanks again,
Chris
Robert Cummings <[EMAIL PROTECTED]> wrote: On Wed, 2005-12-14 at 20:50,
Christopher Jordan wrote:
>
> When you said:
>
> "...the strength and simplicity of PHP stem from the decision to make/keep
> PHP a 'share nothing' architecture."
>
> What did you mean, by that? I've not heard of this "share nothing"
> idea. What is the idea of "share nothing" and why is it a strength?
> I'd like to understand so if I'm doing something ass-backwards
> (read: inefficiently), that I can change what I'm doing.
"Share nothing" refers to the PHP philosophy of not tying any data
sharing system to the engine itself. In this way developers are free to
create applications in such a way that if they need more power, they can
just add more computers. This becomes a much more difficult issue when a
program holds private data in memory that requires a specific way to
access it. For instance if you stored some kind of application variable
in memory (a la ColdFusion, Java, ASP) then this value would not be
normally transparent to other computers without some kind of
synchronization system to transfer it around. Then you run into race
condition and deadlock issues. Using the share nothing philosophy such
data doesn't generally exist, and if it does, then it is stored in a
database. Databases are a better system for such data since they were
designed for heterogeneous external access and quite handily solve the
race condition and deadlock issues. That said, you can also use database
replication so that multiple databases servers have an image of the same
database, thus allowing even the database server to scale horizontally.
So how does this relate to your mom and pop requirements... it doesn't
really *lol*, but if you ever create something that becomes the next
Google, it might just scale to a server farm of thousands of computers.
Cheers,
Rob.
--
.------------------------------------------------------------.
| InterJinn Application Framework - http://www.interjinn.com |
:------------------------------------------------------------:
| An application and templating framework for PHP. Boasting |
| a powerful, scalable system for accessing system services |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for |
| creating re-usable components quickly and easily. |
`------------------------------------------------------------'
---------------------------------
Yahoo! Shopping
Find Great Deals on Holiday Gifts at Yahoo! Shopping
--- End Message ---
--- Begin Message ---
On Wed, 2005-12-14 at 21:34, Christopher Jordan wrote:
> Rob,
>
> Thanks for responding. :) I have more questions. I hope that's okay. :)
*lol* No problem :)
>
> You said:
> "Share nothing" refers to the PHP philosophy of not tying any data
> sharing system to the engine itself.
> In this way developers are free to create applications in such a way that if
> they need more power, they can just add more computers.
> -----
> I guess I'm a little confused, by this and by what Jochem originally posted.
> I'm not sharing data between different computers within the application (if
> that makes sense). In other words, of course all my data (in this case
> inventory data) is in a MySQL table, and so multiple users could be accessing
> the data simultaneously. The session variable only serves to store (for
> display purposes, really) the results of the users last search. I also
> maintain a $_SESSION["LoggedIn"] variable to keep track of whether the user
> has access in this session.
Sorry, I was merely responding to your question about what "share
nothing" meant.
With respect to how this relates to you, your sessions and what Jochem
wrote... If I read your above comment correctly it doesn't really sound
like it applies to your problem only that you used ColdFusion to
describe what you would have done in that environment. Sessions by
nature are per user only and not application scoped.
>
> You said:
> This becomes a much more difficult issue when a program holds private data in
> memory that requires a specific way to access it. For instance if you stored
> some kind of application variable in memory (a la ColdFusion, Java, ASP) then
> this value would not be normally transparent to other computers without some
> kind of synchronization system to transfer it around.
> ----
> Perhaps I'm being dense (it wouldn't be the first time), or maybe a bit
> unimaginative, but I can't think of an instance where while a user is logged
> into an app and using it, that another computer (besides the web server,
> database server and the client machine), would need to have access to that
> data.
> Are you referring to "state" here? Or.... well other than passing data around
> between browser windows, I'm not really sure what you mean. I'd love it if
> you could find the time to expand on that.
Imagine a configuration system loaded from a slow medium and cached in
the running process for all subsequent page requests. The speed
advantage is immense, but it violates the "share nothing" rule. To
emulate this in PHP one would punt the cached data to a database so that
it could be retrieved in a single lightweight query. In this respect PHP
often differs from Java or ASP that often load configuration data and
keep it resident for some time. That said, PHP merely forces the user
into the share nothing philosophy, whereas Java lets the developer
choose since anyone can write their code to share nothing if they want.
In this regard-- protect the users from shooting themselves in the
foot-- PHP often takes an arguably overzealous position.
> You Said:
> Using the share nothing philosophy such data doesn't generally exist, and if
> it does, then it is stored in a database. Databases are a better system for
> such data since they were designed for heterogeneous external access and
> quite handily solve the race condition and deadlock issues.
> ---
> Typically I think of the session variable scope as a way to preserve state.
> Are you suggesting that state be preserved by dumping information down to and
> then reading it again from a database? For example my session variable which
> indicates the user has successfully logged in...
Nope you are right, I think perhaps Jochem unintentionally confused the
issue by bringing up the "share nothing" philosophy. I merely spoke to
that when I described it.
> In speaking of *large* scale applications I suppose I might be able to see
> where you'd want something different than the session superglobal since the
> more users you have accessing the app and using that scope, the more memory
> it's taking up on the server. I thought cookies might be used in such cases.
> I don't usually use cookies, because ColdFusion has an configuration option
> of storing session data in the system registry (windows version obviously)...
> which alleviates the problem of running out of memory via the session scope.
>
> Have I completely missed your point? :)
Nope, we're just off track :)
Cheers,
Rob.
--
.------------------------------------------------------------.
| InterJinn Application Framework - http://www.interjinn.com |
:------------------------------------------------------------:
| An application and templating framework for PHP. Boasting |
| a powerful, scalable system for accessing system services |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for |
| creating re-usable components quickly and easily. |
`------------------------------------------------------------'
--- End Message ---
--- Begin Message ---
Derek Williams wrote:
not quite PC, but why do you need to be in mumbai or bombay, is the
client located there?
mailing wrote:
we are looking for experienced php programemers in mumbai or bombay.
full time or freelance...
please contact at [EMAIL PROTECTED]
sumeet shroff
yes..i am the client....i would prefer a local person.
sumeet shroff
--- End Message ---
--- Begin Message ---
I am from Alaska, can I apply? :D
===========================================
Hristo Yankov, Developer at Portellus, Inc.
ICQ - 191445567
Yahoo! - yankov_hristo
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
--- End Message ---
--- Begin Message ---
Philip Hallstrom wrote:
I'm writing a content management application which saves file paths in
a database and allows users to search the database for those files.
Problem I'm having is that although the PHP script that handles the
database queries works fine, when the search results get to the
browser, all the paths are off limits.
I can't just move the photos inside the web folder as we're talking
tens of thousands of images that are already organized into a folder
structure that must be maintained as is.
Is there a way to allow the web page to see these photos?
The images are stored on a Windows box and all the web server stuff is
on a G5 Macintosh running OS 10.4 3 (in case that has any bearing on
the matter).
Hi Philip,
Can you make a mac accessable share to your windows organized photo
directory ?
http://www.apple.com/macosx/features/windows/
if so and if your using apache this link might help
http://httpd.apache.org/docs/2.0/urlmapping.html
That may or may not help, but please read any relevant security papers
for both mac and windows on this.
Dave C
--- End Message ---
--- Begin Message ---
thanks, but Im sure there is something that is messing up the file
permissions that I can change before the upload, instead of trying to
cure the problem by setting the chmod of the file after its uplaoded....
Hristo Yankov wrote:
Use chmod() on the uploaded file.
===========================================
Hristo Yankov, Developer at Portellus, Inc.
ICQ - 191445567
Yahoo! - yankov_hristo
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
--- End Message ---
--- Begin Message ---
Use chmod() on the uploaded file.
===========================================
Hristo Yankov, Developer at Portellus, Inc.
ICQ - 191445567
Yahoo! - yankov_hristo
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
--- End Message ---
--- Begin Message ---
The remote PHP machine maybe forces the files to
change their permission when uploaded. This would be
security measure. And I think that if this is the
case, you won't be able to change the permissions.
===========================================
Hristo Yankov, Developer at Portellus, Inc.
ICQ - 191445567
Yahoo! - yankov_hristo
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
--- End Message ---