RE: [PHP] SESSION VARIABLES ACROSS DIFFERENT WINDOWS/TABS

2009-08-21 Thread Leon du Plessis
Hi Jamie. 

Thanks. Good info. I knew something changed somewhere. This works like a
charm in IE8..never saw the New Session option under file...me bad !!

Greetings.


-Original Message-
From: Jaime Bozza [mailto:jbo...@mindsites.com] 
Sent: 20 August 2009 09:49 PM
To: Leon du Plessis; 'Floyd Resler'
Cc: a...@dotcontent.net; php-general@lists.php.net
Subject: RE: [PHP] SESSION VARIABLES ACROSS DIFFERENT WINDOWS/TABS

Leon,

This is really just a function of the browser.   When a session cookie is
created, if the browser is setup for a single instance, that's the session
cookie it'll use for *any* request to that domain.  This functions
differently depending on what browser you're using.

For example:
Firefox - All windows, tabs, etc, under the same profile will use the same
session.   If you create profiles, you can have different sessions.
IE7, IE6 - All tabs or windows opened from clicks will share the same
instance/session.  Starting IE from the icon will open up a "new"
instance/session.  This worked great if you wanted to run two different
sessions at the same site/domain.  Just start IE up from the icon again and
you'd have a new session.
IE8 - IE8 model changed, so that all browser windows, tabs, etc., run under
the same frame/session, much like Firefox.  Clicking the IE icon again now
just keeps the same frame and thus the same session.  Originally, this
sounded like a big problem, but IE8 introduced a new feature - File Menu ->
New Session.   This will open up a new window that will be a separate frame
that will not use current session cookies.

Here's just one of many links, but gives some helpful hints on the IE side:
http://blogs.msdn.com/ie/archive/2009/05/06/session-cookies-sessionstorage-a
nd-ie8.aspx

And another:
http://blogs.msdn.com/askie/archive/2009/05/08/session-management-within-int
ernet-explorer-8-0.aspx

One of the issues now is that if you close IE, your session does not
disappear.  In the past (IE7/IE6), your session would disappear if you
closed a browser window that you opened yourself, but it *wouldn't*
disappear if you closed a browser window that was opened by a click from
Outlook or another program.  This was a bit inconsistent.  I won't argue
whether or not their "fix" was the best way to go, but now it's at least
consistent.

Note - In Firefox, not even "Private Browsing" separates the session
cookies.  If you start Private Browsing (Firefox 3.5), log into a site, then
start a new browser window from the icon (that isn't in Private Browsing
mode), it shares the session cookies. (Before you ask, I just checked this
to be sure.)

IE8 "InPrivate Mode" is a totally separate session, cookies and all.  This
could possibly be another way for you to run multiple sessions against the
same domain.  OTOH, multiple InPrivate sessions running at the same time
share the same frame, so they share the same session, so it would only be
good for a single new session.  If you need more, just use File - New
Session.

Jaime 


> -Original Message-
> From: Leon du Plessis [mailto:l...@dsgnit.com]
> Sent: Thursday, August 20, 2009 8:16 AM
> To: 'Floyd Resler'
> Cc: a...@dotcontent.net; php-general@lists.php.net
> Subject: [PHP] SESSION VARIABLES ACROSS DIFFERENT WINDOWS/TABS
> 
> It is just strange that I have this "condition" now...maybe I missed it
> a
> year ago ?
> 
> >> "Having a different session start up for each window for tab would
> be a
> major pain."
> 
> Why?
> 
> People must please try and understand what I mean by NEW. It does not
> apply
> to windows/tabs being opened from a link or request.
> 
> Imho, keeping the session per domain "sounds" wrong, it does not mean
> it is.
> It would have been nice if:
> 
> Browser/tab one -> my login detail container A.
> Browser/tab two -> my admin login container B.
> (tabs/windows opened from browser one, then inherits container A
> naturally)
> (Closing browser one, then destroys container A then naturally only)
> 
> NOT
> 
> Domain.com -> one session container only.
> 
> Heck, I am surprised it works that way at all cause it "sounds" like
> the
> domain can then only handle one user a time if arrays are not used or
> profiles not created on FF no matter where the request come from, but,
> then
> I am obviously missing something in this respect as stated. When I have
> time
> I will reconstruct this concept again.
> 
> Thanks anyway guys. I received some helpful advise for future
> reference.
> 
> But please..I do not, like many others, want to start a war. I am ok
> with
> things how they are. We can put this thing to rest.
> 
> -Original Message-
> From: Floyd Resler [mailto:fres...@adex-intl.com]
> Sent: 20 August 2009 02:25 PM
> To: Leon du Plessis
> Cc: a...@dotcontent.net; php-general@lists.php.net
> Subject: Re: [PHP] SESSIONS lost sometimes
> 
> Leon,
>   Sessions are used on a per-domain basis.  So, no matter how many
> windows or tabs you have open for mydomain.com it will be the same
> session for a

[PHP] Invoking functions stored in a separate directory?

2009-08-21 Thread Clancy
I am developing an idea for a website engine which can be shared between 
several different
websites. Each website would have its own directory under a common root 
directory, and the
engine would be in a separate directory Engine:

Root
Website_1.com, Website_2.com, Engine

The website directories would each contain the design data for that website, 
consisting
basically of a mixture of text files and images. The various pages would be 
loaded by
loading index.php from the website root directory, and specifying a number of 
parameters
e.g.

http://www.corybas.com/index.php?path=Holidays&level=0&item=0

I have the minimum amount of code in index.php -- just enough to set some 
parameters to
identify the website, and then include ../Engine/Main_prog.php.  This in turn 
can include
any of a large number of other include files to carry out particular functions. 

I have the prototype working nicely on my PC, and on a stand-alone basis on a 
server, but
now I am trying to upload the multi-website version to a public host, and am 
encountering
a number of problems, mainly because I have never done any serious work with 
UNIX, and the
host support staff don't understand what I am trying to do.

The problems mainly relate to setting permissions to allow the website to 
access the
engine code. I only have a rough idea of how the permissions work, but I think 
that to
include engine code the website has to have read and execute rights to it, and 
I also
think that so far as the engine is concerned the website will count as 'other'. 
 (I can
easily arrange that all temporary files are written in the website directory.)

I suspect that rather than including the engine code in index.php, it would be 
better to
call functions in it, so that the website only required 'execute' rights, but I 
don't know
of any way to do this without having anything running permanently on the 
server. Can
anyone suggest how it can be done?



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



RE: [PHP] PHP/Ajax Framework - Call for Developers & Testers

2009-08-21 Thread Bob McConnell
From: Raymond Irving

> Hi Nathan,
> 
> I agree with you, and I believe that there are many persons
> who don't like the idea of hosting all their applications on
> a third party server. IMO there are some advantages and
> disadvantages to doing so but that's a discussion in itself.

Hosted servers are basically a trade off between doing it yourself and
paying someone else to do it. The initial choice is between installing
your own servers or spend the money to rent servers from someone else.
Most of the time it is actually the network bandwidth issue that decides
this. Can you afford a network connection that will handle the peak
loads but be unused most of the time?

But once you decide to pay someone else, you have another set of trade
offs to negotiate. What services do they provide? What systems do they
offer? How do they manage version control and updates? Are they PCI
compliant? There are a wide range of options available in the market.
Not all of them will fit your specific needs.

We just moved most of our servers from a physical hosting service to a
managed service. Where we used to maintain the OS and all software on
the server, the new service now handles that for us. The trade off is
that now we have to settle for the server package they offer. That means
we get the versions of Apache, PHP and PostgreSQL that were included in
the last production release of RHEL. If we want a newer version of PHP,
we have to take over maintenance of that component. It becomes our
responsibility to install the updates, patches, etc., for that
component.

Once you get beyond a private web site these types of decisions become
part of the management process, just as make or buy decisions are part
of the hardware procurement process. There are people out there making a
good living just guiding companies through this decision making process.

Bob McConnell

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



[PHP] about to run PHP script when POST data.

2009-08-21 Thread Jacky
Hi guys,

As I know When we POST a big data(e.g. 500M) to a php script, the php script
only can run after the big data finished POST.

for example:
a.php

> 


and I post 500m data to a.php,  after that a.php cannot be died immediately.
only when the data finished post.

How can I make the a.php die before the 500m data finish?

Thanks in advance.

-- 
Regards,
Jacky


RE: [PHP] Invoking functions stored in a separate directory?

2009-08-21 Thread Arno Kuhl
-Original Message-
From: Clancy [mailto:clanc...@cybec.com.au] 
Sent: 21 August 2009 01:26 PM
To: php-general@lists.php.net
Subject: [PHP] Invoking functions stored in a separate directory?

I am developing an idea for a website engine which can be shared between
several different websites. Each website would have its own directory under
a common root directory, and the engine would be in a separate directory
Engine:

Root
Website_1.com, Website_2.com, Engine

The website directories would each contain the design data for that website,
consisting basically of a mixture of text files and images. The various
pages would be loaded by loading index.php from the website root directory,
and specifying a number of parameters e.g.

http://www.corybas.com/index.php?path=Holidays&level=0&item=0

I have the minimum amount of code in index.php -- just enough to set some
parameters to identify the website, and then include
../Engine/Main_prog.php.  This in turn can include any of a large number of
other include files to carry out particular functions. 

I have the prototype working nicely on my PC, and on a stand-alone basis on
a server, but now I am trying to upload the multi-website version to a
public host, and am encountering a number of problems, mainly because I have
never done any serious work with UNIX, and the host support staff don't
understand what I am trying to do.

The problems mainly relate to setting permissions to allow the website to
access the engine code. I only have a rough idea of how the permissions
work, but I think that to include engine code the website has to have read
and execute rights to it, and I also think that so far as the engine is
concerned the website will count as 'other'.  (I can easily arrange that all
temporary files are written in the website directory.)

I suspect that rather than including the engine code in index.php, it would
be better to call functions in it, so that the website only required
'execute' rights, but I don't know of any way to do this without having
anything running permanently on the server. Can anyone suggest how it can be
done?

-

Using include ../Engine/Main_prog.php won't work for you in a production
environment. You need to create a path.php file that defines the absolute
path to the engine for each website, and include it at the top of your
website script. Then you can do something like:

   include ENGINEPATH."Main_prog.php";

You can have different path files, one for dev and one for live, that allows
you to use the same scripts for both environments and just use the
appropriate path definition script.

E.g. Windows path.php
define('ENGINEPATH','../Engine/');

Linux path.php
define('ENGINEPATH','/usr/home/Engine/');

You shouldn't really have permission problems as long as your website and
engine are on the same server. I do something similar where the bulk of my
code is below doc root, and I use path files to find the main system
directories. The beauty of it is you can change your mind about directory
structures, and just change the path file definitions without making any
changes in the application code (my path file defines about 20 directories).
It also lets you do dev on a Windows pc and deploy on a *nix box without any
problems - just use a different path file for each.

One other advantage it will give you for your particualr design is that you
can have multiple engines per server (e.g. Engine1, Engine2, etc) so that
you can bring one engine down for upgrade while still keeping sites running
on the other engines.

Cheers
Arno



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



RE: [PHP] about to run PHP script when POST data.

2009-08-21 Thread Arno Kuhl
-Original Message-
From: Jacky [mailto:newbde...@gmail.com] 
Sent: 21 August 2009 03:12 PM
To: php-general@lists.php.net
Subject: [PHP] about to run PHP script when POST data.

Hi guys,

As I know When we POST a big data(e.g. 500M) to a php script, the php script
only can run after the big data finished POST.

for example:
a.php

> 


and I post 500m data to a.php,  after that a.php cannot be died immediately.
only when the data finished post.

How can I make the a.php die before the 500m data finish?

Thanks in advance.

--
Regards,
Jacky

---

Your script will die ungracefully when it runs out of execution time
(defined in php.ini)

Cheers
Arno


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



[PHP] Re: Extract column names from a (my)SQL query

2009-08-21 Thread Nisse Engström
On Wed, 19 Aug 2009 22:42:36 +0300, דניאל דנון wrote:

> Lets assume I have the following string:
> "SELECT field1, field2, field3 FROM tablename WHERE field1 = 'something' "
> 
> Is there any way to get "field1, field2, field3"? assuming it might also
> have join, left join - things like that.

If you're using MySQL, you can try mysql_field_name()
and see if it gets you anywhere. I don't think it works
on empty results though.


/Nisse

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



[PHP] PHP Shopping Cart Recommendation

2009-08-21 Thread sono-io
	I'd like to get everyone's opinion on a good PHP shopping cart.  We  
need something that will handle a lot of similar items and can be  
geared for an industrial site selling products from different  
manufacturers.  It needs to be PCI compliant and able to handle at  
least 5 sub-category levels.  I'd also  prefer to have it _not_  
display the items until after you've drilled down to the final sub- 
category.


	The cart needs to be rock solid and should look professional.  We're  
not looking for wizz-bang, look-at-me fancy.  We're selling commercial  
items here, not women's shoes. (My apologies to the women on the  
list.  =;)


Real world experience, hearsay, or just gut reactions are all welcome.

Thanks for your help,
Frank

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



Re: [PHP] PHP Shopping Cart Recommendation

2009-08-21 Thread Ashley Sheridan
On Fri, 2009-08-21 at 08:06 -0700, sono...@fannullone.us wrote:
>   I'd like to get everyone's opinion on a good PHP shopping cart.  We  
> need something that will handle a lot of similar items and can be  
> geared for an industrial site selling products from different  
> manufacturers.  It needs to be PCI compliant and able to handle at  
> least 5 sub-category levels.  I'd also  prefer to have it _not_  
> display the items until after you've drilled down to the final sub- 
> category.
> 
>   The cart needs to be rock solid and should look professional.  We're  
> not looking for wizz-bang, look-at-me fancy.  We're selling commercial  
> items here, not women's shoes. (My apologies to the women on the  
> list.  =;)
> 
>   Real world experience, hearsay, or just gut reactions are all welcome.
> 
> Thanks for your help,
> Frank
> 
The only e-commerce site I've worked on was based on OSCommerce. It's
pretty good, easy to integrate new functionality into, and not too much
trouble to style up to look the way you want with CSS.


Thanks,
Ash
http://www.ashleysheridan.co.uk




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



[PHP] PHP 5.x magic mathods quick question

2009-08-21 Thread Ralph Deffke
do I understand the doc right, that magic methods do exist in any object?
creating one (like __set() ) ovewrites the standard one?



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



Re: [PHP] PHP 5.x magic mathods quick question

2009-08-21 Thread Martin Scotta
I think not, but why don't we ask this to PHP ?



*<< __set()* is run when writing data to inaccessible members. >>
http://php.net/__set

So, I think that when you write data to an non-existent member php will
first try is the object has an __set method, if not it'll raise a Fatal
Error

example 1:
a = 'b'; # <-- add public property
print_r( $t );

example 2:
a = 'b'; # <-- fatal error

example 3:
a = 'b'; # <-- trigger __set

example 4:
a = '1'; # <-- set the public property (don't trigger __set)
$t->b = '2'; # <-- trigger __set (property does not exists)
$t->c = '3'; # <-- trigger __set (property is private)

print_r( $t );


On Fri, Aug 21, 2009 at 12:45 PM, Ralph Deffke wrote:

> do I understand the doc right, that magic methods do exist in any object?
> creating one (like __set() ) ovewrites the standard one?
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


-- 
Martin Scotta


RE: [PHP] Is there limitation for switch case: argument's value?

2009-08-21 Thread Daevid Vincent
Whoa! I didn't even know you could use a switch statement like that. In 20
years of coding, I've never ever used a switch like that first "if/else"
style. PHP never ceases to amaze me in it's flexibility (and ability to
shoot yourself in the foot ;-p ) 

And remember, all your base are belong to Adam.

> -Original Message-
> From: Adam Randall [mailto:randa...@gmail.com] 
> Sent: Thursday, August 20, 2009 11:20 PM
> To: Keith
> Cc: php-general@lists.php.net
> Subject: Re: [PHP] Is there limitation for switch case: 
> argument's value?
> 
> I've never understood why people use switch statements like this as in
> reality you are using it more like an if/else block, but anyway.
> 
> The reason why your code is not working is that you are passing into
> the switch the value of 0, or false, which means that when any of
> those $sum == N conditionals comes up as false (say $sum == 8 ), then
> that is what is returned because they match up. In PHP's eyes, 0 ==
> false in switch statements.
> 
> To fix your code, change the switch( $sum ) to switch( true ):
> 
> switch( true )
> {
>   case ($sum == 8):
>   echo "sum=8\n";
>   break;
>   case ($sum == 7 || $sum == 6):
>   echo "sum=7 or 6\n";
>   break;
>   case ($sum == 2 || $sum == 1):
>   echo "sum=2 or 1\n";
>   break;
>   case ($sum == 0):
>   echo "sum=0\n";
>   break;
>   default:
>   echo "sum=3/4/5\n";
>   break;
> }
> 
> Or, write your switch like this:
> 
> switch( $sum )
> {
>   case 8:
>   echo "sum=8\n";
>   break;
>   case 6:
>   case 7:
>   echo "sum=7 or 6\n";
>   break;
>   case 1:
>   case 2:
>   echo "sum=2 or 1\n";
>   break;
>   case 0:
>   echo "sum=0\n";
>   break;
>   default:
>   echo "sum=3/4/5\n";
>   break;
> }
> 
> Regards,
> 
> Adam.
> 
> On Thu, Aug 20, 2009 at 8:40 PM, 
> Keith wrote:
> > Hi,
> > I encounter a funny limitation here with switch case as below:
> > The value for $sum is worked as expected for 1 to 8, but not for 0.
> > When the $sum=0, the first case will be return, which is "sum=8".
> > Is there any limitation / rules for switch case? Thanks for advice!
> >
> > Keith
> >
> > $sum=0;
> > switch($sum)
> > {
> >   case ($sum==8):
> >   echo "sum=8";
> >   break;
> >       case ($sum==7 || $sum==6):
> >       echo "sum=7 or 6";
> >       break;
> >   case ($sum==2 || $sum==1):
> >   echo "sum=2 or 1";
> >   break;
> >       case 0:
> >       echo "sum=0";
> >       break;
> >   default:
> >   echo "sum=3/4/5";
> >   break;
> > }
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
> 
> 
> 
> -- 
> Adam Randall
> http://www.xaren.net
> AIM: blitz574
> 
> -- 
> 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: Extract column names from a (my)SQL query

2009-08-21 Thread Daevid Vincent
> -Original Message-
> From: Nisse Engström [mailto:news.nospam.0ixbt...@luden.se] 
>
> If you're using MySQL, you can try mysql_field_name()
> and see if it gets you anywhere. I don't think it works
> on empty results though.


FYI. It will.


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



Re: [PHP] Re: Extract column names from a (my)SQL query

2009-08-21 Thread דניאל דנון
You all misunderstood my question, please read my replies above...

I'm looking to extract it from a string - *I'm not executing the queries, I
only get them as a string*

And to the topic:

Since everything I found was very complicated to parse, I've crafted my own
preg pattern,

"/^(\*|[a-z_, \(\)0-9]+)[\s]+FROM[\s]+([a-z_\.
]+)\s+(WHERE[\s]+(.+)|)\s*(|ORDER BY ([a-z0-9,
])(|\s(DESC|ASC)))\s*(|LIMIT\s+([0-9]+)\s*,\s*([0-9]+))\s*$/Ui"

(Assuming this is a SELECT string, and the subject is something similar to:
* FROM table WHERE field2='field3' LIMIT 0,10

(Yes, no SELECT - I've got another function to determine whether its select,
insert, update, delete from - etc, and it returns to query without the name
of the command - "SELECT field FROM table" => "field FROM table")

(Without using joins or things like that)

But I don't have much experience crafting patterns like that - or working
with them so I'd be glad if  you think of a better way of doing it,

and problem is since I'm using sub-brackets, its hard to process it
since if there is WHERE and a LIMIT, then LIMIT (...) will be on $result[$n]
(for example),
But if there is no WHERE, then LIMIT (...) will be on $result[$n - 2];

How should I overcome this problem?


2009/8/21 Daevid Vincent 

> > -Original Message-
> > From: Nisse Engström [mailto:news.nospam.0ixbt...@luden.se]
> >
> > If you're using MySQL, you can try mysql_field_name()
> > and see if it gets you anywhere. I don't think it works
> > on empty results though.
>
>
> FYI. It will.
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


-- 
Use ROT26 for best security


Re: [PHP] Re: Extract column names from a (my)SQL query

2009-08-21 Thread דניאל דנון
Update: I've changed it into

"/^(\*|[a-z_,
\(\)0-9]+)[\s]+FROM[\s]+([a-z_\.]+)(\s+)?(WHERE[\s]+(.+))?\s*(LIMIT\s+([0-9]+)\s*,\s*([0-9]+))?\s*(ORDER
BY ([a-z0-9, ]+)?(\s*(DESC|ASC)))?$/Ui"


Only problem that on:
SELECT * FROM table WHERE field2='field3' ORDER BY id DESC LIMIT 0,10
it outputs

Array
(
[0] => * FROM table WHERE field2='field3' ORDER BY id DESC LIMIT 0,10
[1] => *
[2] => table
[3] =>
[4] => WHERE field2='field3' ORDER BY id DESC
[5] => field2='field3' ORDER BY id DESC
[6] => LIMIT 0,10
[7] => 0
[8] => 10
)



On Fri, Aug 21, 2009 at 9:38 PM, דניאל דנון  wrote:

> You all misunderstood my question, please read my replies above...
>
> I'm looking to extract it from a string - *I'm not executing the queries,
> I only get them as a string*
>
> And to the topic:
>
> Since everything I found was very complicated to parse, I've crafted my own
> preg pattern,
>
> "/^(\*|[a-z_, \(\)0-9]+)[\s]+FROM[\s]+([a-z_\.
> ]+)\s+(WHERE[\s]+(.+)|)\s*(|ORDER BY ([a-z0-9,
> ])(|\s(DESC|ASC)))\s*(|LIMIT\s+([0-9]+)\s*,\s*([0-9]+))\s*$/Ui"
>
> (Assuming this is a SELECT string, and the subject is something similar to:
> * FROM table WHERE field2='field3' LIMIT 0,10
>
> (Yes, no SELECT - I've got another function to determine whether its
> select, insert, update, delete from - etc, and it returns to query without
> the name of the command - "SELECT field FROM table" => "field FROM table")
>
> (Without using joins or things like that)
>
> But I don't have much experience crafting patterns like that - or working
> with them so I'd be glad if  you think of a better way of doing it,
>
> and problem is since I'm using sub-brackets, its hard to process it
> since if there is WHERE and a LIMIT, then LIMIT (...) will be on $result[$n]
> (for example),
> But if there is no WHERE, then LIMIT (...) will be on $result[$n - 2];
>
> How should I overcome this problem?
>
>
> 2009/8/21 Daevid Vincent 
>
> > -Original Message-
>> > From: Nisse Engström [mailto:news.nospam.0ixbt...@luden.se]
>> >
>> > If you're using MySQL, you can try mysql_field_name()
>> > and see if it gets you anywhere. I don't think it works
>> > on empty results though.
>>
>>
>> FYI. It will.
>>
>>
>> --
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>>
>
>
> --
> Use ROT26 for best security
>



-- 
Use ROT26 for best security


Re: [PHP] HTML text extraction

2009-08-21 Thread Manuel Lemos
Hello,

on 08/18/2009 05:37 AM leledumbo said the following:
> Usually, a website gives preview of its articles by extracting some of the
> first characters. This is easy if the article is a pure text, but what if
> it's a HTML text? For instance, if I have the full text:
> 
> 
>   bla bla bla
>   
> item 1
> item 2
> item 3
>   
> 
> 
> and I take the first 40 characters, it would result in:
> 
> 
>   bla bla bla
>   
> item
> 
> As you can see, the tags are incomplete and it might break other texts below
> it (I mean, other than this preview). I need a way to solve this problem.

You may want to try these HTML parser classes. They can parse (and even
validate) HTML and return an array of tag or data elements. You can use
it to pick the first tags and data you. Then you you the RewriteElement
function to regenerate the HTML.

http://www.phpclasses.org/secure-html-filter

-- 

Regards,
Manuel Lemos

Find and post PHP jobs
http://www.phpclasses.org/jobs/

PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/

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



[PHP] Re: Tidy on a shared host

2009-08-21 Thread Manuel Lemos
Hello,

on 08/20/2009 09:47 PM Al said the following:
> Or, does anyone know of a stand-alone php class that emulates the tidy
> extension. I've looked; but, not found any.

Yes, you may want to try this Secure HTML parser filter package. It
comes with parser and a filter class that validates HTML against an
eventually auto-detected DTD. It returns an array of tag and data
elements that you can use to rebuild a valid HTML document using the
RewriteElement function.

http://www.phpclasses.org/secure-html-filter


-- 

Regards,
Manuel Lemos

Find and post PHP jobs
http://www.phpclasses.org/jobs/

PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/

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



Re: [PHP] Re: How to download and configure php mvc website locally

2009-08-21 Thread Paul M Foster
On Wed, Aug 19, 2009 at 11:00:46PM -1000, Sumit Sharma wrote:

> Hi all,
> The site I have download was developed using cake php. Now when trying to
> access the website it is showing a blank page. As Sudheer suggested I went
> to error log and noted down the errors there, which are as follows:
> 
> [Thu Aug 20 14:10:16 2009] [error] [client 127.0.0.1] File does not exist:
> F:/Rabin/xampp/htdocs/favicon.ico
> 
> I think there is no file called favicon.ico but how to create this file. Is
> this something related to cakephp configuration.
> 
> Regards,
> Sumit

Lack of favicon.ico will show up in your logs if the file isn't there,
but it will do nothing to prevent your site from showing up.

Frameworks like CakePHP require additional files and database tables to
be created by the programmer, before anything will show up on the
screen. There are either omitted files or missing tables (or missing
table rows).

Paul

-- 
Paul M. Foster

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



[PHP] Re: How do I extract link text from anchor tag as well as the URL from the "href" attribute

2009-08-21 Thread Manuel Lemos
Hello,

on 08/16/2009 04:33 AM chrysanhy said the following:
> I have the following code to extract the URLs from the anchor tags of an
> HTML page:
> 
> $html = new DOMDocument();
> $htmlpage->loadHtmlFile($location);
> $xpath = new DOMXPath($htmlpage);
> $links = $xpath->query( '//a' );
> foreach ($links as $link)
> { $int_url_list[$i++] = $link->getAttribute( 'href' ) . "\n"; }
> 
> If I have a link http://X.com";>, how do I extract the
> corresponding  which is displayed to the user as the text of the link
> (if it's an image tag, I would like a DOMElement for that).
> Thanks

You may want to try this HTML parser class that comes with filter class
and an example script named test_get_html_links.php  that does exactly
what you ask.

http://www.phpclasses.org/secure-html-filter

-- 

Regards,
Manuel Lemos

Find and post PHP jobs
http://www.phpclasses.org/jobs/

PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/

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