[wp-hackers] Path of wp-config.php in auth.php

Stephen O'Connor steve at stevarino.com
Fri Jul 2 09:12:52 UTC 2004


I hate to say it, but I honestly don't see a way.

The big problem is how WP allows multiple weblogs through multiple installs. If your script did find an auth.php, how could it know whether it found the correct auth.php or not? One directory branch could hold dozens of installs. I think this is a case where either the path to auth.php needs to be hard-coded or WP needs to change how it identifies multiple weblogs. :(

- Stephen

> -----Original Message-----
> From: hackers-bounces at wordpress.org
> [mailto:hackers-bounces at wordpress.org]On Behalf Of Carthik Sharma
> Sent: Thursday, July 01, 2004 11:19 PM
> To: hackers at wordpress.org
> Subject: Re: [wp-hackers] Path of wp-config.php in auth.php
> 
> 
> Thanks Stephen, I am sure this will work, but I am worried about
> having to do the same for including auth.php in files that are in
> different directories.
> If we take index.php as an example, this could be in a different
> directory from the wordpress files altogether, for example.
> Is there a better way to specify the path, in auth.php, which will
> ensure that the WP authentication, or user login details can be used
> by other applications? There have already been some discussions about
> using WP's authentication for other applications, and this is a just a
> specific detail that's now getting in my way.
> 
> Carthik.
> 
> On Thu, 1 Jul 2004 22:00:40 -0400, Stephen O'Connor 
> <steve at stevarino.com> wrote:
> > 
> > I replied to this once already, but it doesn't seem to have 
> sent. If you get this twice, forgive me...
> > 
> > Anyway, here's my php code for that path problem. You would 
> think they do because of all their output buffering tricks and 
> such... but nope.
> > 
> > __________PHP CODE___________
> > 
> > // I'm assuming this is for the root dir only...
> > // if you need more, we'll work that out later
> > 
> > // get the file data...
> > $file_data = implode('', file(ABSPATH."wp-admin/auth.php"));
> > 
> > // then change what you need to.
> > $file_data = str_replace("require_once('../wp-config.php');", 
> "require_once('wp-config.php');", $file_data);
> > 
> > // make a temp file
> > $tmpfile = tempnam("/tmp", "php");
> > $fp = fopen($tmpfile, "w");
> > 
> > // write to the temp file
> > fwrite($fp, $file_data);
> > fclose($fp);
> > 
> > // include your new temp file
> > require( $tmpfile );
> > 
> > // and delete it
> > unlink( $tmpfile );
> > 
> > __________END PHP CODE___________
> > 
> > It might take a little tweaking to get just right, but I think 
> it will work.
> > 
> > - Stephen
> > 
> > 
> > 
> > > -----Original Message-----
> > > From: hackers-bounces at wordpress.org
> > > [mailto:hackers-bounces at wordpress.org]On Behalf Of Carthik Sharma
> > > Sent: Thursday, July 01, 2004 6:39 PM
> > > To: hackers at wordpress.org
> > > Subject: [wp-hackers] Path of wp-config.php in auth.php
> > >
> > >
> > > wp-admin/auth.php has
> > >
> > > require_once('../wp-config.php');
> > >
> > > So this is preventing me from using auth.php in a file in the "root"
> > > directory, like, in index.php, for example.
> > >
> > > I want to use auth.php in the root directory. How do I go about
> > > it? Any ideas?
> > >
> > > Restrictions:
> > > 1. I do not want to modify auth.php, and do not want to put in my
> > > absolute path, cause this is part of a hack that I want to make
> > > available.
> > >
> > > Carthik.
> > >
> > > --
> > > When nothing is done, nothing is left undone -- 老子 Lǎozi
> > >
> > > University of Central Florida
> > > Homepage: http://carthik.net
> > > 
> > > _______________________________________________
> > > hackers mailing list
> > > hackers at wordpress.org
> > > http://wordpress.org/mailman/listinfo/hackers_wordpress.org
> > >
> > 
> > _______________________________________________
> > hackers mailing list
> > hackers at wordpress.org
> > http://wordpress.org/mailman/listinfo/hackers_wordpress.org
> > 
> 
> 
> -- 
> When nothing is done, nothing is left undone -- 老子 Lǎozi
> 
> University of Central Florida
> Homepage: http://carthik.net
> 
> _______________________________________________
> hackers mailing list
> hackers at wordpress.org
> http://wordpress.org/mailman/listinfo/hackers_wordpress.org
> 




More information about the hackers mailing list