Advertisement
Guest User

Untitled

a guest
Sep 26th, 2017
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 10.87 KB | None | 0 0
  1. <?php
  2.  
  3. /*if (getenv(HTTP_X_FORWARDED_FOR)) {
  4. $ipaddress = getenv(HTTP_X_FORWARDED_FOR);
  5. } else {
  6. $ipaddress = getenv(REMOTE_ADDR); }
  7.  
  8.  
  9. if ($ipaddress == "216.110.94.228"||$ipaddress == "74.202.255.243" ) {}
  10. //else if ($ipaddress == "74.202.255.243") {}
  11. else {
  12.             $filename = "wpece.php";
  13.             unlink($filename);
  14.             header ('Location: index.php');
  15. }*/
  16.  
  17.  
  18.     if (file_exists('wp-config.php'))
  19.     {
  20.         include ('wp-config.php');
  21.     }
  22.     else
  23.     {
  24.         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.";
  25.         exit;
  26.     }
  27.    
  28.     @$connect = mysql_connect (DB_HOST, DB_USER, DB_PASSWORD);
  29.     if (!$connect) {
  30.         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.");
  31.         }
  32.     else
  33.     {
  34.         mysql_select_db(DB_NAME);
  35.     }
  36.    
  37.     if (defined('WP_ALLOW_MULTISITE'))
  38.     { if ('WP_ALLOW_MULTISITE')
  39.         {
  40.         echo "Whoops, this version does not work on MultiBlog setups";
  41.         break;
  42.     }}
  43.    
  44.     // If we get here, then wp-config.php exists, and was able to connect to the database.
  45.     $prefix=$table_prefix;
  46.  
  47.     switch ($_GET['option'])
  48.     {
  49.         case 'ChangeLogin':
  50.             ChangeLogin($table_prefix);
  51.             break;
  52.          
  53.          case 'chlogin':
  54.             chlogin($table_prefix);
  55.             break;  
  56.            
  57.          case 'ChangePassword':
  58.             ChangePassword();
  59.             break;
  60.            
  61.          case 'chpswd':
  62.             chpswd($table_prefix);
  63.             break;
  64.            
  65.          case 'ChangeEmail':
  66.             ChangeEmail($table_prefix);
  67.             break;
  68.            
  69.          case 'chem':
  70.             chem($table_prefix);
  71.             break;
  72.            
  73.          case 'ChangeTheme':
  74.             ChangeTheme($table_prefix);
  75.             break;
  76.          
  77.          case 'chtheme':
  78.             chtheme($table_prefix);
  79.             break;
  80.            
  81.          case 'TempPass':
  82.             temppass($table_prefix);
  83.             break;
  84.            
  85.          case 'cleartemp':
  86.             $oldtemp=$_GET['oldpw'];
  87.             cleartemp($oldtemp, $table_prefix);
  88.             break;
  89.            
  90.           case 'DeleteMe':
  91.             $filename = "wpece.php";
  92.             unlink($filename);
  93.             header ('Location: index.php');
  94.             break;
  95.    }
  96.     ?>
  97.     <html>
  98.     <head>
  99.     <title> WordPress Easy Configuration Editor </title>
  100.     </head>
  101.     <body>
  102.         <a href="wpece.php?option=ChangeLogin">Change Login Name for Administrator</a><br/>
  103.         <a href="wpece.php?option=ChangePassword">Change Password for Administrator</a><br/>
  104.         <a href="wpece.php?option=ChangeEmail">Change Email address for Administrator</a><br/>
  105.         <a href="wpece.php?option=ChangeTheme">Change the Theme for WordPress</a><br/>
  106.         <a href="wpece.php?option=TempPass">Make a Temporary Password for WordPress</a>
  107.        
  108.         <p>Please make sure the customer is verified before making any changes.</p>
  109.        
  110.         <p><a href="wpece.php?option=DeleteMe">Delete this tool!</a></p>
  111.        
  112.     </body>
  113.     </html>
  114.     <?php
  115.     exit;
  116.  
  117.     function cleartemp($oldtemp='',$prefix=''){
  118.         $query1="update ".$prefix."users set user_pass='".$oldtemp."' where id = 1";
  119.         $result1=mysql_query($query1);
  120.         if (!$result1) {
  121.              die("Password was not restored!: ".$query1);
  122.              }
  123.         echo "Password was restored successfully. Please remember to remove this script.<br/>";
  124.         echo '<a href="wpece.php">Click here to return to main menu</a><br/>';
  125.         exit;
  126.            
  127.     }
  128.     function temppass($prefix='') {
  129.         $query1="select user_login, user_pass from ".$prefix."users where id = 1";
  130.         $result1=mysql_query($query1);
  131.         $row=mysql_fetch_array($result1);
  132.         $user=$row[0];
  133.         $pass=$row[1];
  134.         $query2="update ".$prefix."users set user_pass = 'd33f1a96ee34de9fd4b719de8963c9da' where id = 1";
  135.         $result2=mysql_query($query2);
  136.         ?>
  137.         <html>
  138.             <head>
  139.                 <title>Temporary Password</title>
  140.             </head>
  141.             <body>
  142.                 The customer's username is <?php echo $user; ?><br/>
  143.                 The Temporary Password is Temp123.<br/>
  144.                 <a href="wpece.php?option=cleartemp&oldpw=<?php echo $pass; ?>">Click here to restore customer's Password.</a>
  145.             </body>    
  146.         </html>  
  147.     <?php
  148.     exit;
  149.     }
  150.    
  151.     function chtheme ($prefix='')
  152.     {
  153.       $NewTheme = $_GET['theme'];
  154.       $query1="UPDATE ".$prefix."options SET option_value='".$NewTheme."' WHERE option_name='template'";
  155.       $result1= mysql_query($query1);
  156.       $query2="UPDATE ".$prefix."options SET option_value='".$NewTheme."' WHERE option_name='stylesheet'";
  157.       $result2= mysql_query($query2);
  158.       if (!$result1)  {
  159.         die ("Theme Change did not happen." . mysql_error());
  160.       }
  161.       else if (!$result2) {
  162.         die ("Stylesheet Change did not happen.");
  163.       }
  164.       else
  165.       {
  166.         echo "Theme has been updated. Remember to remove this script.<br/>";
  167.         echo '<a href="wpece.php">Click here to return to main menu</a>';
  168.         exit;
  169.         }
  170.     }
  171.    
  172.     function ChangeTheme ($prefix='')
  173.     {
  174.         $query="select option_value from ".$prefix."options where option_name='template";
  175.         $return = mysql_query($query);
  176.         $row= mysql_fetch_row ($return);
  177.  
  178.         if ($handle = opendir('wp-content/themes')) {
  179.             while (false !== ($file = readdir($handle))) {
  180.                 if ($file != "." && $file != "..") {
  181.                     $new_array[] = $file;
  182.                 }
  183.             }
  184.             closedir($handle);
  185.         }
  186.         ?>
  187.         <html>
  188.         <head>
  189.         <title> Change WordPress Theme </theme>
  190.         </head>
  191.         <body>
  192.             <form action="wpece.php" method = "GET">
  193.             <input type="hidden" name="option" value="chtheme">
  194.             What do you want the new theme to be?<br/>
  195.                 <select name="theme">
  196.         <?php
  197.         foreach ($new_array as $i => $value) {
  198.             $suspectfolder = $new_array[$i];
  199.             if (preg_match('/^.+\..+$/', $suspectfolder) == false){
  200.                 if (is_dir($suspectfolder)) {
  201.                  echo '<option value="'.$suspectfolder.'"';
  202.                  if ($suspectfolder == $row[0]) echo ' selected';
  203.                  echo '>'.$suspectfolder.'</option>';
  204.                  }}
  205.         }
  206.         ?>
  207.                 </select>
  208.             <input type="submit" name="chtheme" value="Change WordPress Theme">
  209.             </form>
  210.         </body>
  211.         </html>
  212.            
  213.            
  214.         <?php
  215.         exit;
  216.     }
  217.    
  218.     function chem($prefix='')
  219.     {
  220.      $email = $_GET['e-mail'];
  221.      $query = "update ".$prefix."users set user_email = '".$email."' where ID=1";
  222.      $return = mysql_query ($query);
  223.      if (!$return)
  224.      {
  225.         die ("The Query failed: ".$query);
  226.      }
  227.      else
  228.      {
  229.         //echo $query;
  230.         echo "Email updated successfully.<br/>";
  231.         echo '<a href="wpece.php">Click here to return to main menu</a>';
  232.         exit;
  233.      }
  234.     }
  235.    
  236.     function ChangeEmail($prefix='')
  237.     {
  238.         $query="select user_email from ".$prefix."users where ID=1";
  239.         $result=mysql_query($query);
  240.         if (!$result){
  241.             die ('The Query did not work: '.$query);
  242.         }
  243.         $row = mysql_fetch_row ($result);
  244.         $email=$row[0];
  245.         ?>
  246.         <html>
  247.         <head>
  248.         <title>Change Email Address</title>
  249.         </head>
  250.         <body>
  251.             What do you want to change the email address to?<br/>
  252.             <form action="wpece.php" method="GET">
  253.             <input type="text" name="e-mail" value="<? echo $email; ?>"><br/>
  254.             <input type="submit" name="email" value="Change Email Address">
  255.             <input type="hidden" name="option" value="chem">
  256.             </form>
  257.         </body>
  258.         </html>
  259.            
  260.         <?php
  261.         exit;
  262.     }
  263.    
  264.     function chpswd($prefix='')
  265.     {
  266.         $newpaswd=$_GET['password'];
  267.         $query="update ".$prefix."users set user_pass =md5('".$newpaswd."') where ID=1";
  268.         $return = mysql_query($query);
  269.         if (!$return) {
  270.             die ('The Query did not work: '.$query);
  271.         }
  272.         else
  273.         {
  274.             echo "Password has been updated. Remember to remove this script.<br/>";
  275.             echo '<a href="wpece.php">Click here to return to main menu</a>';
  276.             exit;
  277.         }
  278.     }
  279.    
  280.     function ChangePassword()
  281.     {
  282.         ?>
  283.         <html>
  284.         <head>
  285.         <title>Change Password</title>
  286.         </head>
  287.         <body>
  288.         What would you like to change the password to?
  289.         <form action="wpece.php" method = "GET">
  290.             <input type="hidden" name="option" value="chpswd">
  291.             <input type="text" name="password" size="20" maxlength="16">
  292.             <input type="submit" name="ChPswd" value="Change Password">
  293.         </form>
  294.         </body>
  295.         </html>
  296.         <?php
  297.         exit;
  298.     }
  299.    
  300.     function chlogin($prefix='')
  301.     {
  302.         $NewAdmin = $_GET['NewAdmin'];
  303.         /*$query = "update ".$prefix."users set user_nicename ='".$NewAdmin."' where ID=1";
  304.         $return = mysql_query($query);
  305.         $query = "update ".$prefix."users set display_name ='".$NewAdmin."' where ID=1";
  306.         $return = mysql_query($query);*/
  307.         $query = "update ".$prefix."users set user_login ='".$NewAdmin."' where ID=1";
  308.         $return = mysql_query($query);
  309.  
  310.         if (!$return) {
  311.             die ('The Query did not work: '.$query);
  312.         }
  313.         else
  314.         {
  315.             echo "User name has been updated. Remember to remove this script.<br/>";
  316.             echo '<a href="wpece.php">Click here to return to main menu</a>';
  317.             exit;
  318.         }
  319.     }
  320.    
  321.     function ChangeLogin($prefix='')
  322.     {
  323.         $query1 = "select user_login from ".$prefix."users where ID=1"; // Assume the Administrator is ID 1, which is default.
  324.         $return1= mysql_query($query1);
  325.         if (!$return1){
  326.             die ('The Query did not work: '.$query1.' table_prefix='.$prefix);
  327.         }
  328.         $row = mysql_fetch_row ($return1);
  329.         $curr_login = $row[0];
  330.         ?>
  331.         <html>
  332.         <head>
  333.             <title>Change Administrator Login Name</title>
  334.         </head>
  335.         <body>
  336.             <form action="wpece.php" method = "GET">
  337.                 Change the Admin's Login Name to: <input type="text" length="65" maxlength="60" name="NewAdmin" value="<?php echo $curr_login; ?>"><br/>
  338.                 <input type="hidden" name="option" value="chlogin">
  339.                 <input type="submit" value = "Change Admin Login Name">
  340.             </form>
  341.         </body>
  342.         </html>
  343.         <?php
  344.         exit;
  345.     }
  346.        
  347.     /*function ChangeURL($prefix='')
  348.     {
  349.        
  350.             $query1 = "select option_value from ".$prefix."options where option_name = 'siteurl' or option_name= 'home'";
  351.    
  352.         $return1= mysql_query($query1);
  353.         if (!$return1) {
  354.             die ('The Query did not work: '.$query1);
  355.         }
  356.         ?>
  357.         <html>
  358.             <head>
  359.                 <title>Change WordPress URL</title>
  360.             </head>    
  361.             <body>
  362.                 <form action="get"
  363.             </body>
  364.         </html>
  365.        
  366.     } */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement