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

Carthik Sharma carthik at gmail.com
Fri Jul 2 03:18:52 UTC 2004


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



More information about the hackers mailing list