Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /*if (getenv(HTTP_X_FORWARDED_FOR)) {
- $ipaddress = getenv(HTTP_X_FORWARDED_FOR);
- } else {
- $ipaddress = getenv(REMOTE_ADDR); }
- if ($ipaddress == "216.110.94.228"||$ipaddress == "74.202.255.243" ) {}
- //else if ($ipaddress == "74.202.255.243") {}
- else {
- $filename = "wpece.php";
- unlink($filename);
- header ('Location: index.php');
- }*/
- if (file_exists('wp-config.php'))
- {
- include ('wp-config.php');
- }
- else
- {
- echo "<h1>Whoops.... </h1><br/>Unable to locate the wp-config.php file; make sure you put this script in the same directory as your blog.";
- exit;
- }
- @$connect = mysql_connect (DB_HOST, DB_USER, DB_PASSWORD);
- if (!$connect) {
- die ("<h1>Whoops... </h1><br/>Either the Database login information in wp-config.php is wrong, or you have this file in the wrong blog folder, or the MySQL server is not responding.");
- }
- else
- {
- mysql_select_db(DB_NAME);
- }
- if (defined('WP_ALLOW_MULTISITE'))
- { if ('WP_ALLOW_MULTISITE')
- {
- echo "Whoops, this version does not work on MultiBlog setups";
- break;
- }}
- // If we get here, then wp-config.php exists, and was able to connect to the database.
- $prefix=$table_prefix;
- switch ($_GET['option'])
- {
- case 'ChangeLogin':
- ChangeLogin($table_prefix);
- break;
- case 'chlogin':
- chlogin($table_prefix);
- break;
- case 'ChangePassword':
- ChangePassword();
- break;
- case 'chpswd':
- chpswd($table_prefix);
- break;
- case 'ChangeEmail':
- ChangeEmail($table_prefix);
- break;
- case 'chem':
- chem($table_prefix);
- break;
- case 'ChangeTheme':
- ChangeTheme($table_prefix);
- break;
- case 'chtheme':
- chtheme($table_prefix);
- break;
- case 'TempPass':
- temppass($table_prefix);
- break;
- case 'cleartemp':
- $oldtemp=$_GET['oldpw'];
- cleartemp($oldtemp, $table_prefix);
- break;
- case 'DeleteMe':
- $filename = "wpece.php";
- unlink($filename);
- header ('Location: index.php');
- break;
- }
- ?>
- <html>
- <head>
- <title> WordPress Easy Configuration Editor </title>
- </head>
- <body>
- <a href="wpece.php?option=ChangeLogin">Change Login Name for Administrator</a><br/>
- <a href="wpece.php?option=ChangePassword">Change Password for Administrator</a><br/>
- <a href="wpece.php?option=ChangeEmail">Change Email address for Administrator</a><br/>
- <a href="wpece.php?option=ChangeTheme">Change the Theme for WordPress</a><br/>
- <a href="wpece.php?option=TempPass">Make a Temporary Password for WordPress</a>
- <p>Please make sure the customer is verified before making any changes.</p>
- <p><a href="wpece.php?option=DeleteMe">Delete this tool!</a></p>
- </body>
- </html>
- <?php
- exit;
- function cleartemp($oldtemp='',$prefix=''){
- $query1="update ".$prefix."users set user_pass='".$oldtemp."' where id = 1";
- $result1=mysql_query($query1);
- if (!$result1) {
- die("Password was not restored!: ".$query1);
- }
- echo "Password was restored successfully. Please remember to remove this script.<br/>";
- echo '<a href="wpece.php">Click here to return to main menu</a><br/>';
- exit;
- }
- function temppass($prefix='') {
- $query1="select user_login, user_pass from ".$prefix."users where id = 1";
- $result1=mysql_query($query1);
- $row=mysql_fetch_array($result1);
- $user=$row[0];
- $pass=$row[1];
- $query2="update ".$prefix."users set user_pass = 'd33f1a96ee34de9fd4b719de8963c9da' where id = 1";
- $result2=mysql_query($query2);
- ?>
- <html>
- <head>
- <title>Temporary Password</title>
- </head>
- <body>
- The customer's username is <?php echo $user; ?><br/>
- The Temporary Password is Temp123.<br/>
- <a href="wpece.php?option=cleartemp&oldpw=<?php echo $pass; ?>">Click here to restore customer's Password.</a>
- </body>
- </html>
- <?php
- exit;
- }
- function chtheme ($prefix='')
- {
- $NewTheme = $_GET['theme'];
- $query1="UPDATE ".$prefix."options SET option_value='".$NewTheme."' WHERE option_name='template'";
- $result1= mysql_query($query1);
- $query2="UPDATE ".$prefix."options SET option_value='".$NewTheme."' WHERE option_name='stylesheet'";
- $result2= mysql_query($query2);
- if (!$result1) {
- die ("Theme Change did not happen." . mysql_error());
- }
- else if (!$result2) {
- die ("Stylesheet Change did not happen.");
- }
- else
- {
- echo "Theme has been updated. Remember to remove this script.<br/>";
- echo '<a href="wpece.php">Click here to return to main menu</a>';
- exit;
- }
- }
- function ChangeTheme ($prefix='')
- {
- $query="select option_value from ".$prefix."options where option_name='template";
- $return = mysql_query($query);
- $row= mysql_fetch_row ($return);
- if ($handle = opendir('wp-content/themes')) {
- while (false !== ($file = readdir($handle))) {
- if ($file != "." && $file != "..") {
- $new_array[] = $file;
- }
- }
- closedir($handle);
- }
- ?>
- <html>
- <head>
- <title> Change WordPress Theme </theme>
- </head>
- <body>
- <form action="wpece.php" method = "GET">
- <input type="hidden" name="option" value="chtheme">
- What do you want the new theme to be?<br/>
- <select name="theme">
- <?php
- foreach ($new_array as $i => $value) {
- $suspectfolder = $new_array[$i];
- if (preg_match('/^.+\..+$/', $suspectfolder) == false){
- if (is_dir($suspectfolder)) {
- echo '<option value="'.$suspectfolder.'"';
- if ($suspectfolder == $row[0]) echo ' selected';
- echo '>'.$suspectfolder.'</option>';
- }}
- }
- ?>
- </select>
- <input type="submit" name="chtheme" value="Change WordPress Theme">
- </form>
- </body>
- </html>
- <?php
- exit;
- }
- function chem($prefix='')
- {
- $email = $_GET['e-mail'];
- $query = "update ".$prefix."users set user_email = '".$email."' where ID=1";
- $return = mysql_query ($query);
- if (!$return)
- {
- die ("The Query failed: ".$query);
- }
- else
- {
- //echo $query;
- echo "Email updated successfully.<br/>";
- echo '<a href="wpece.php">Click here to return to main menu</a>';
- exit;
- }
- }
- function ChangeEmail($prefix='')
- {
- $query="select user_email from ".$prefix."users where ID=1";
- $result=mysql_query($query);
- if (!$result){
- die ('The Query did not work: '.$query);
- }
- $row = mysql_fetch_row ($result);
- $email=$row[0];
- ?>
- <html>
- <head>
- <title>Change Email Address</title>
- </head>
- <body>
- What do you want to change the email address to?<br/>
- <form action="wpece.php" method="GET">
- <input type="text" name="e-mail" value="<? echo $email; ?>"><br/>
- <input type="submit" name="email" value="Change Email Address">
- <input type="hidden" name="option" value="chem">
- </form>
- </body>
- </html>
- <?php
- exit;
- }
- function chpswd($prefix='')
- {
- $newpaswd=$_GET['password'];
- $query="update ".$prefix."users set user_pass =md5('".$newpaswd."') where ID=1";
- $return = mysql_query($query);
- if (!$return) {
- die ('The Query did not work: '.$query);
- }
- else
- {
- echo "Password has been updated. Remember to remove this script.<br/>";
- echo '<a href="wpece.php">Click here to return to main menu</a>';
- exit;
- }
- }
- function ChangePassword()
- {
- ?>
- <html>
- <head>
- <title>Change Password</title>
- </head>
- <body>
- What would you like to change the password to?
- <form action="wpece.php" method = "GET">
- <input type="hidden" name="option" value="chpswd">
- <input type="text" name="password" size="20" maxlength="16">
- <input type="submit" name="ChPswd" value="Change Password">
- </form>
- </body>
- </html>
- <?php
- exit;
- }
- function chlogin($prefix='')
- {
- $NewAdmin = $_GET['NewAdmin'];
- /*$query = "update ".$prefix."users set user_nicename ='".$NewAdmin."' where ID=1";
- $return = mysql_query($query);
- $query = "update ".$prefix."users set display_name ='".$NewAdmin."' where ID=1";
- $return = mysql_query($query);*/
- $query = "update ".$prefix."users set user_login ='".$NewAdmin."' where ID=1";
- $return = mysql_query($query);
- if (!$return) {
- die ('The Query did not work: '.$query);
- }
- else
- {
- echo "User name has been updated. Remember to remove this script.<br/>";
- echo '<a href="wpece.php">Click here to return to main menu</a>';
- exit;
- }
- }
- function ChangeLogin($prefix='')
- {
- $query1 = "select user_login from ".$prefix."users where ID=1"; // Assume the Administrator is ID 1, which is default.
- $return1= mysql_query($query1);
- if (!$return1){
- die ('The Query did not work: '.$query1.' table_prefix='.$prefix);
- }
- $row = mysql_fetch_row ($return1);
- $curr_login = $row[0];
- ?>
- <html>
- <head>
- <title>Change Administrator Login Name</title>
- </head>
- <body>
- <form action="wpece.php" method = "GET">
- Change the Admin's Login Name to: <input type="text" length="65" maxlength="60" name="NewAdmin" value="<?php echo $curr_login; ?>"><br/>
- <input type="hidden" name="option" value="chlogin">
- <input type="submit" value = "Change Admin Login Name">
- </form>
- </body>
- </html>
- <?php
- exit;
- }
- /*function ChangeURL($prefix='')
- {
- $query1 = "select option_value from ".$prefix."options where option_name = 'siteurl' or option_name= 'home'";
- $return1= mysql_query($query1);
- if (!$return1) {
- die ('The Query did not work: '.$query1);
- }
- ?>
- <html>
- <head>
- <title>Change WordPress URL</title>
- </head>
- <body>
- <form action="get"
- </body>
- </html>
- } */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement