...

View Full Version : Terrible Wordpress Error



Nblufire12
12-09-2008, 09:45 PM
hey guys

I accidently changed a wordpress setting for the URL of my site to wwww.cpumod.net/dota

so now all the pages are broken

at least the login is...

cpumod.net/dota/wp-admin

w/e u type, if u try to login it'll go to wwww.cpumod.net which is horrible

i cant go into the admin panel and edit this, what do i do? where is the setting stored? in the database? or in the actual site settings.php

PappaJohn
12-09-2008, 11:32 PM
The url is stored in the database, in the wp-options table (unless you change the table prefix).

Nblufire12
12-09-2008, 11:38 PM
Uhh that sucks... I don't have phpMyAdmin on 1and1.com hosting...What should I do?

oesxyl
12-09-2008, 11:40 PM
Uhh that sucks... I don't have phpMyAdmin on 1and1.com hosting...What should I do?
this is on the same server with your smf forum?

regards

Nblufire12
12-09-2008, 11:43 PM
Nope, its on a different server :(

PappaJohn
12-09-2008, 11:56 PM
<?php

// edit these as necessary

$db_host = 'localhost';
$db_user = 'dbuser';
$db_password = 'dbpassword';

$db_name = 'wordpressblog';
$table_name = 'wp-options';

$wp_url = 'http://example.com';

// end edit


$link = mysql_connect($db_host, $db_user, $db_password);
if ($link)
{
mysql_select_db($db_name);

$sql = "UPDATE " . $table_name . " SET `option_value` = '" . $wp_url . "' WHERE `option_name` = 'siteurl'";

$result = mysql_query($sql);

if $result echo 'Updated URL successfully';
}

mysql_close($link);
?>


1. Copy the above code into a new php file.
2. Edit the variables at the top to reflect the correct values for your site
3. Save as updateurl.php
4. Upload to your server.
5. Browse to the file. You'll see "Updated URL successfully" when it's completed.
6. Delete the file from your server

Nblufire12
12-10-2008, 12:38 AM
It doesnt work :(

www.CPUMod.net/fix.php

PappaJohn
12-10-2008, 01:41 AM
Well, the script I posted does not perform any redirection. So, the error message you're getting is referring to something else - possibly an .htaccess file.

The only other way I can think of to fix this, would be to access MySQL through the CLI using SSH - assuming you have appropriate access and experience using MySQL through the CLI.

_Aerospace_Eng_
12-10-2008, 07:16 AM
The script posted has some errors in it. The error on the fix.php is not caused by "redirection". Its caused by the if statement on line 26. You need parentheses around the condition. Although just adding in some error checking will suffice. No need for the if statement anymore. If it dies it won't ever get there.

<?php
$db_host = 'localhost';
$db_user = 'dbuser';
$db_password = 'dbpassword';
$db_name = 'wordpressblog';
$table_name = 'wp-options';
$wp_url = 'http://example.com';
$link = mysql_connect($db_host, $db_user, $db_password) or die(mysql_error());
mysql_select_db($db_name);
$sql = "UPDATE $table_name SET `option_value` = '$wp_url' WHERE `option_name` = 'siteurl'";
$result = mysql_query($sql) or die(mysql_error());
echo 'Updated URL successfully';
mysql_close($link);
?>

PappaJohn
12-10-2008, 07:22 AM
Good catch - missed the parentheses

Nblufire12
12-10-2008, 01:33 PM
Thanks i'll get back to you on how it works when I get home.

Nblufire12
12-10-2008, 11:33 PM
LoL another error

cpumod.net/fix.php

_Aerospace_Eng_
12-11-2008, 05:00 AM
Its not going to fix the error but we need to know what variables you are using. Change this

<?php
$db_host = 'localhost';
$db_user = 'dbuser';
$db_password = 'dbpassword';
$db_name = 'wordpressblog';
$table_name = 'wp-options';
$wp_url = 'http://example.com';
$link = mysql_connect($db_host, $db_user, $db_password) or die(mysql_error());
mysql_select_db($db_name);
$sql = "UPDATE $table_name SET `option_value` = '$wp_url' WHERE `option_name` = 'siteurl'";
$result = mysql_query($sql) or die(mysql_error());
echo 'Updated URL successfully';
mysql_close($link);
?>
to this

<?php
$db_host = 'localhost';
$db_user = 'dbuser';
$db_password = 'dbpassword';
$db_name = 'wordpressblog';
$table_name = 'wp-options';
$wp_url = 'http://example.com';
$link = mysql_connect($db_host, $db_user, $db_password) or die(mysql_error());
mysql_select_db($db_name);
$sql = "UPDATE $table_name SET `option_value` = '$wp_url' WHERE `option_name` = 'siteurl'";
$result = mysql_query($sql) or die(mysql_error().'<br>SQL: '.$sql);
echo 'Updated URL successfully';
mysql_close($link);
?>



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum