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

Stephen O'Connor steve at stevarino.com
Fri Jul 2 02:00:40 UTC 2004


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
> 




More information about the hackers mailing list