Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 12-09-2008, 08:45 PM   PM User | #1
Nblufire12
Regular Coder

 
Join Date: Apr 2008
Posts: 257
Thanks: 15
Thanked 0 Times in 0 Posts
Nblufire12 is an unknown quantity at this point
Terrible Wordpress Error

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
Nblufire12 is offline   Reply With Quote
Old 12-09-2008, 10:32 PM   PM User | #2
PappaJohn
Senior Coder

 
Join Date: Apr 2007
Location: Quakertown PA USA
Posts: 1,028
Thanks: 1
Thanked 125 Times in 123 Posts
PappaJohn will become famous soon enough
The url is stored in the database, in the wp-options table (unless you change the table prefix).
PappaJohn is offline   Reply With Quote
Old 12-09-2008, 10:38 PM   PM User | #3
Nblufire12
Regular Coder

 
Join Date: Apr 2008
Posts: 257
Thanks: 15
Thanked 0 Times in 0 Posts
Nblufire12 is an unknown quantity at this point
Uhh that sucks... I don't have phpMyAdmin on 1and1.com hosting...What should I do?
Nblufire12 is offline   Reply With Quote
Old 12-09-2008, 10:40 PM   PM User | #4
oesxyl
Master Coder


 
Join Date: Dec 2007
Posts: 6,682
Thanks: 436
Thanked 890 Times in 879 Posts
oesxyl is a jewel in the roughoesxyl is a jewel in the roughoesxyl is a jewel in the rough
Quote:
Originally Posted by Nblufire12 View Post
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
oesxyl is offline   Reply With Quote
Old 12-09-2008, 10:43 PM   PM User | #5
Nblufire12
Regular Coder

 
Join Date: Apr 2008
Posts: 257
Thanks: 15
Thanked 0 Times in 0 Posts
Nblufire12 is an unknown quantity at this point
Nope, its on a different server
Nblufire12 is offline   Reply With Quote
Old 12-09-2008, 10:56 PM   PM User | #6
PappaJohn
Senior Coder

 
Join Date: Apr 2007
Location: Quakertown PA USA
Posts: 1,028
Thanks: 1
Thanked 125 Times in 123 Posts
PappaJohn will become famous soon enough
PHP Code:
<?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
PappaJohn is offline   Reply With Quote
Old 12-09-2008, 11:38 PM   PM User | #7
Nblufire12
Regular Coder

 
Join Date: Apr 2008
Posts: 257
Thanks: 15
Thanked 0 Times in 0 Posts
Nblufire12 is an unknown quantity at this point
It doesnt work

www.CPUMod.net/fix.php
Nblufire12 is offline   Reply With Quote
Old 12-10-2008, 12:41 AM   PM User | #8
PappaJohn
Senior Coder

 
Join Date: Apr 2007
Location: Quakertown PA USA
Posts: 1,028
Thanks: 1
Thanked 125 Times in 123 Posts
PappaJohn will become famous soon enough
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.
PappaJohn is offline   Reply With Quote
Old 12-10-2008, 06:16 AM   PM User | #9
_Aerospace_Eng_
Supreme Master coder!


 
_Aerospace_Eng_'s Avatar
 
Join Date: Dec 2004
Location: In a place far, far away...
Posts: 19,293
Thanks: 2
Thanked 1,044 Times in 1,020 Posts
_Aerospace_Eng_ is a glorious beacon of light_Aerospace_Eng_ is a glorious beacon of light_Aerospace_Eng_ is a glorious beacon of light_Aerospace_Eng_ is a glorious beacon of light_Aerospace_Eng_ is a glorious beacon of light
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 Code:
<?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);
?>
__________________
||||If you are getting paid to do a job, don't ask for help on it!||||
_Aerospace_Eng_ is offline   Reply With Quote
Old 12-10-2008, 06:22 AM   PM User | #10
PappaJohn
Senior Coder

 
Join Date: Apr 2007
Location: Quakertown PA USA
Posts: 1,028
Thanks: 1
Thanked 125 Times in 123 Posts
PappaJohn will become famous soon enough
Good catch - missed the parentheses
PappaJohn is offline   Reply With Quote
Old 12-10-2008, 12:33 PM   PM User | #11
Nblufire12
Regular Coder

 
Join Date: Apr 2008
Posts: 257
Thanks: 15
Thanked 0 Times in 0 Posts
Nblufire12 is an unknown quantity at this point
Thanks i'll get back to you on how it works when I get home.
Nblufire12 is offline   Reply With Quote
Old 12-10-2008, 10:33 PM   PM User | #12
Nblufire12
Regular Coder

 
Join Date: Apr 2008
Posts: 257
Thanks: 15
Thanked 0 Times in 0 Posts
Nblufire12 is an unknown quantity at this point
LoL another error

cpumod.net/fix.php
Nblufire12 is offline   Reply With Quote
Old 12-11-2008, 04:00 AM   PM User | #13
_Aerospace_Eng_
Supreme Master coder!


 
_Aerospace_Eng_'s Avatar
 
Join Date: Dec 2004
Location: In a place far, far away...
Posts: 19,293
Thanks: 2
Thanked 1,044 Times in 1,020 Posts
_Aerospace_Eng_ is a glorious beacon of light_Aerospace_Eng_ is a glorious beacon of light_Aerospace_Eng_ is a glorious beacon of light_Aerospace_Eng_ is a glorious beacon of light_Aerospace_Eng_ is a glorious beacon of light
Its not going to fix the error but we need to know what variables you are using. Change this
PHP Code:
<?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 Code:
<?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);
?>
__________________
||||If you are getting paid to do a job, don't ask for help on it!||||
_Aerospace_Eng_ is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 10:21 AM.


Advertisement
Log in to turn off these ads.