php-general Digest 2 Dec 2010 15:50:24 -0000 Issue 7066
Topics (messages 309809 through 309818):
Re: code quest
309809 by: Kirk Bailey
309810 by: Kirk Bailey
309817 by: Daniel P. Brown
309818 by: Steve Staples
Centralizled Authentication
309811 by: AmirBehzad Eslami
309812 by: Per Jessen
309813 by: AmirBehzad Eslami
309814 by: Per Jessen
309815 by: Ken Guest
309816 by: Bostjan Skufca
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 ---
OK, answered my own question; no, an ssi statement inside a php echo
statement is simply sent out as is, unparxsed. But if it is external to
the php area, it works fine, so we have to include a function in there
that will read anything I want to spew- like the 1 line contents of a
desciptor file in a particular directory.
The idea is to create a directory lister which reads a descriptor for
that folder and uses it as the text for the link.
Daniel P. Brown wrote:
On Sat, Nov 27, 2010 at 12:36, Daniel P. Brown
<[email protected]> wrote:
If you want something more powerful - and often quicker - check
into SPL: specifically FilesystemIterator[1], DirectoryIterator[2],
and RecursiveDirectoryIterator[3]. A quick example to link all child
files and directories with relative linking:
Might help to provide the key as well, eh? Sorry....
^1: http://php.net/filesystemiterator
^2: http://php.net/directoryiterator
^3: http://php.net/recursivedirectoryiterator
--
end
Very Truly yours,
- Kirk Bailey,
Largo Florida
kniht
+-----+
| BOX |
+-----+
think
--- End Message ---
--- Begin Message ---
OK, the quest thus far:
<html>
<head>
<TITLE>php experimental page</TITLE>
<style TYPE="text/css">
body { margin-left: 5%; margin-right: 5%; }
A:link, A:visited, A:active { text-decoration:none; }
A:hover { text-decoration:underline; }
</style>
</head>
<BODY text="000000" bgcolor="FFFFFF">
<h2 align="center">Subdirectory listing experimental menuing page</h1><P>
<ul>
<?php
$ls = scandir(dirname(__FILE__));
foreach ($ls as $d) {
if (is_dir($d) && $d != '.' && $d != '..') {
echo '<li><a href="'.$d.'">'.$d.'</a><br/>'.PHP_EOL;
}
}
?>
</ul>
<P>
</body>
</html>
The results may be seen on this page:
http://www.howlermonkey.net/dirlisting.php
Can this be improved to exclude anything with a '.' or a '-' in it's
name? This will exclude the smileys and cgi-bin and such. If it can be
persuaded to read a 1 line description from each subdirectory it could
then use THAT as the text in the link, instead of the name. This could
be useful in many settings.
Daniel P. Brown wrote:
On Fri, Nov 26, 2010 at 19:03, Kirk Bailey <[email protected]> wrote:
I need a routine that will return a list of every directory immediately
under the current directory- but nothing else, just a list of directories, 1
lev
Very Truly yours,
- Kirk Bailey,
Largo Florida
kniht
+-----+
| BOX |
+-----+
think
--- End Message ---
--- Begin Message ---
On Wed, Dec 1, 2010 at 23:13, Kirk Bailey <[email protected]> wrote:
[snip!]
>
> Can this be improved to exclude anything with a '.' or a '-' in it's name?
> This will exclude the smileys and cgi-bin and such. If it can be persuaded
> to read a 1 line description from each subdirectory it could then use THAT
> as the text in the link, instead of the name. This could be useful in many
> settings.
Sure. Change:
if (is_dir($d) && $d != '.' && $d != '..') {
To:
if (is_dir($d) && !preg_match('/[\.\-]/',$d)) {
Keep in mind, though, that the change will no longer show anything
that matches the below either:
example.directory
example-directory
special-images
css.files
In other words, you may instead want to explicitly state which
directories to omit, and then drop anything that begins with a dot as
well (hidden directories on *NIX-like boxes) like so:
<?php
$excludes[] = 'cgi-bin';
$excludes[] = 'vti_cnf';
$excludes[] = 'private';
$excludes[] = 'thumbnail';
$ls = scandir(dirname(__FILE__));
foreach ($ls as $d) {
if (is_dir($d) && !preg_match('/^\./',basename($d)) &&
!in_array(basename($d),$excludes)) {
echo '<li><a href="'.$d.'">'.$d.'</a><br/>'.PHP_EOL;
}
}
?>
--
</Daniel P. Brown>
Dedicated Servers, Cloud and Cloud Hybrid Solutions, VPS, Hosting
(866-) 725-4321
http://www.parasane.net/
--- End Message ---
--- Begin Message ---
On Thu, 2010-12-02 at 10:07 -0500, Daniel P. Brown wrote:
> On Wed, Dec 1, 2010 at 23:13, Kirk Bailey <[email protected]> wrote:
> [snip!]
> >
> > Can this be improved to exclude anything with a '.' or a '-' in it's name?
> > This will exclude the smileys and cgi-bin and such. If it can be persuaded
> > to read a 1 line description from each subdirectory it could then use THAT
> > as the text in the link, instead of the name. This could be useful in many
> > settings.
>
> Sure. Change:
>
> if (is_dir($d) && $d != '.' && $d != '..') {
>
> To:
>
> if (is_dir($d) && !preg_match('/[\.\-]/',$d)) {
>
> Keep in mind, though, that the change will no longer show anything
> that matches the below either:
>
> example.directory
> example-directory
> special-images
> css.files
>
> In other words, you may instead want to explicitly state which
> directories to omit, and then drop anything that begins with a dot as
> well (hidden directories on *NIX-like boxes) like so:
>
> <?php
> $excludes[] = 'cgi-bin';
> $excludes[] = 'vti_cnf';
> $excludes[] = 'private';
> $excludes[] = 'thumbnail';
>
> $ls = scandir(dirname(__FILE__));
> foreach ($ls as $d) {
> if (is_dir($d) && !preg_match('/^\./',basename($d)) &&
> !in_array(basename($d),$excludes)) {
> echo '<li><a href="'.$d.'">'.$d.'</a><br/>'.PHP_EOL;
> }
> }
> ?>
>
> --
> </Daniel P. Brown>
> Dedicated Servers, Cloud and Cloud Hybrid Solutions, VPS, Hosting
> (866-) 725-4321
> http://www.parasane.net/
>
damn you Daniel... I was just about to reply with almost the EXACT same
answer!!!
I think the last example would probably be the best one to use, that way
you can still have some directories with the . or - or even the _ in the
names, and still be able to display them.
Steve
ps thanks for saving me type it all out Daniel :)
--- End Message ---
--- Begin Message ---
Dear list,
We have dozen of applications, mostly written in PHP and Python.
They're distributed on different servers, but i'm trying to integrate them
somehow.
Each application has its own users.
Is there a way to store all username/passwords into a single datasource
and give each user, her proper permissions?
Since i'm just a php-programmer, i *thought* of a MySQL database to
hold these data, and then use a SOAP-Server to handle the authentication
across those applications.
Once a user provides her username/password, a SOAP Request will be
made to a PHP-Driven Authentication Server, which handles the job to
check the permissions and user's identity.
It sounds slow, isn't it? Is there a better solution?
How do you make authentication across a network of applications?
--
Kind regards,
-behzad
--- End Message ---
--- Begin Message ---
AmirBehzad Eslami wrote:
> Dear list,
>
> We have dozen of applications, mostly written in PHP and Python.
> They're distributed on different servers, but i'm trying to integrate
> them somehow.
>
> Each application has its own users.
> Is there a way to store all username/passwords into a single
> datasource and give each user, her proper permissions?
>
> Since i'm just a php-programmer, i *thought* of a MySQL database to
> hold these data, and then use a SOAP-Server to handle the
> authentication across those applications.
>
> Once a user provides her username/password, a SOAP Request will be
> made to a PHP-Driven Authentication Server, which handles the job to
> check the permissions and user's identity.
>
> It sounds slow, isn't it? Is there a better solution?
> How do you make authentication across a network of applications?
Central directory service accessed with LDAP. Typical examples include
Microsofts Active Directory, Novells eDirectory and openLDAP.
--
Per Jessen, Zürich (-1.4°C)
--- End Message ---
--- Begin Message ---
Suppose you're running phpBB with another php-driven application.
phpBB has a "user" table where the username/password/email/.. of each user
is stored at mysql. Once a user logs-in to the website, the "Last Login"
timestamp updates
on the "users" table at mysql.
How do I use LDAP in this type of application?
1) Move entire records of "Users" and their attributes (e.g.
last_login_time) to LDAP server?
In this mehtod, after each successfull login request, I also need to update
the related record on LDAP.
2) Should I use LDAP to store only the username and passwords?
In this method, I need to update the record on MySQL database, but I should
keep the MySQL
and LDAP syncronized, since a user may want to change her password.
What do you think guys? Please let me know.
--- End Message ---
--- Begin Message ---
AmirBehzad Eslami wrote:
> Suppose you're running phpBB with another php-driven application.
> phpBB has a "user" table where the username/password/email/.. of each
> user is stored at mysql. Once a user logs-in to the website, the "Last
> Login" timestamp updates on the "users" table at mysql.
>
> How do I use LDAP in this type of application?
>
> 1) Move entire records of "Users" and their attributes (e.g.
> last_login_time) to LDAP server?
> In this mehtod, after each successfull login request, I also need to
> update the related record on LDAP.
> 2) Should I use LDAP to store only the username and passwords?
> In this method, I need to update the record on MySQL database, but I
> should keep the MySQL and LDAP syncronized, since a user may want to
> change her password.
LDAP is only the access method, you can store the information whichever
way you want. mysql is probably not a bad idea.
--
Per Jessen, Zürich (-0.9°C)
--- End Message ---
--- Begin Message ---
On Thu, Dec 2, 2010 at 8:06 AM, AmirBehzad Eslami
<[email protected]>wrote:
> Dear list,
>
> We have dozen of applications, mostly written in PHP and Python.
> They're distributed on different servers, but i'm trying to integrate them
> somehow.
>
> Each application has its own users.
> Is there a way to store all username/passwords into a single datasource
> and give each user, her proper permissions?
>
> Since i'm just a php-programmer, i *thought* of a MySQL database to
> hold these data, and then use a SOAP-Server to handle the authentication
> across those applications.
>
> Once a user provides her username/password, a SOAP Request will be
> made to a PHP-Driven Authentication Server, which handles the job to
> check the permissions and user's identity.
>
> It sounds slow, isn't it? Is there a better solution?
> How do you make authentication across a network of applications?
>
>
OAuth comes to mind...
--
http://blogs.linux.ie/kenguest/
--- End Message ---
--- Begin Message ---
Or OpenID.
b.
On 2 December 2010 11:48, Ken Guest <[email protected]> wrote:
> On Thu, Dec 2, 2010 at 8:06 AM, AmirBehzad Eslami
> <[email protected]>wrote:
>
>> Dear list,
>>
>> We have dozen of applications, mostly written in PHP and Python.
>> They're distributed on different servers, but i'm trying to integrate them
>> somehow.
>>
>> Each application has its own users.
>> Is there a way to store all username/passwords into a single datasource
>> and give each user, her proper permissions?
>>
>> Since i'm just a php-programmer, i *thought* of a MySQL database to
>> hold these data, and then use a SOAP-Server to handle the authentication
>> across those applications.
>>
>> Once a user provides her username/password, a SOAP Request will be
>> made to a PHP-Driven Authentication Server, which handles the job to
>> check the permissions and user's identity.
>>
>> It sounds slow, isn't it? Is there a better solution?
>> How do you make authentication across a network of applications?
>>
>>
>
> OAuth comes to mind...
>
>
> --
> http://blogs.linux.ie/kenguest/
>
--- End Message ---