Created
January 21, 2014 07:15
-
-
Save stefanbc/8535655 to your computer and use it in GitHub Desktop.
WordPress reset Install
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// HOW TO USE: | |
// Simply type in the url in the text box to reset the WordPress site url. | |
// WARNING: | |
// This file can be a HUGE security risk and has the potential to seriously | |
// mess up your site's database. Please use with caution and DELETE THIS FILE when you | |
// are done resetting your website. | |
// First, get database settings from wp-config.php... | |
require_once("wp-config.php"); | |
// Create a new database object... | |
$db=new mysqli(DB_HOST,DB_USER,DB_PASSWORD,DB_NAME); | |
// Was the form submitted? | |
if (isset($_POST['url'])) { | |
$url=$_POST['url']; | |
$query="UPDATE wp_options SET option_value='$url' WHERE option_name='home'"; //or siteurl | |
$result=$db->query($query); | |
echo "THERE WERE <b>" . $db->affected_rows . "</b> ROWS IN THE DATABASE AFFECTED!<br/><br/>"; | |
// Did the database query update anything? If so, then stop the application... | |
if ($db->affected_rows != 0) { | |
die("Be Sure To Delete This File From Your Server When Complete!!!"); | |
} | |
} | |
// Query the current information in the database... | |
$query="SELECT option_value FROM wp_options WHERE option_name='home'"; //or siteurl | |
$result=$db->query($query); | |
$row=$result->fetch_object(); | |
// Display the form and print out what is in the database... | |
?> | |
<form action="sitereset.php" method="post"> | |
<b>Home URL:</b> <input type="text" name="url" size="60" value="<?php echo $row->option_value ?>" /> | |
<br /> | |
<br /> | |
<input type="submit" value="RESET WORDPRESS" /> | |
</form> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment