Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
#1 2009-01-13 21:58:34
- kez2
- New Member
- Registered: 2009-01-13
- Posts: 5
How can I temporarily disable a textpattern site?
Hello,
I’ve had a problem with a non-paying client.
After the works been done, he’s changed the txp and hosting account passwords, but I still have access to the site via ftp.
Should we be unable to resolve the situation, what is the simplest way for me to disable the site (using fetch)- but in a way that it can be restored later it later if need be.
Is it a good idea to drag the whole textpattern directory off the server, and onto my hard drive. Then delete the server copy? Would I then be able to drag it back on to the server at a later date, or would this mess things up?
Or is there a specific file, I can drag onto my hard drive, and delete from the server that would do the job just as well?
Thanks very much.
Kez
Last edited by kez2 (2009-01-14 01:21:00)
Offline
Re: How can I temporarily disable a textpattern site?
Removing the files won’t get rid of the TXP content; you’ll need to backup and remove the database. If exec()
is enabled, this might work. Save the following as “ctrl.php” (or something) and upload it to the “textpattern” directory:
<?php
require 'config.php';
require 'lib/txplib_misc.php';
require 'lib/txplib_db.php';
$creds = '-u ' . $txpcfg['user'] . ' -p ' . $txpcfg['pass'];
if ($_GET['a'] === "bak")
exec("mysqldump $creds > bak.sql");
else if ($_GET['a'] === "rm")
exec("mysql $creds -e 'drop database {$txpcfg['db']}'");
else
echo '<a href="?a=bak">Backup</a>, <a href="?a=rm">Remove (caution!)</a>';
?>
The visit http://example.com/textpattern/ctrl.php
. Backing up should create “bak.sql” in textpattern/. Removing will drop the database.
Offline
#3 2009-01-14 01:11:32
- kez2
- New Member
- Registered: 2009-01-13
- Posts: 5
Re: How can I temporarily disable a textpattern site?
Thanks jm, but isn’t there a simpler way to do it? Strictly speaking, I don’t need to remove the database – just make the site temporarily unusable.
Offline
#4 2009-01-14 01:16:34
- kez2
- New Member
- Registered: 2009-01-13
- Posts: 5
Re: How can I temporarily disable a textpattern site?
Sorry to trouble you again, but if I click “backup” and then “remove” how, exactly do I go about reinstalling the site later? I’m quite inexperienced in this area and I’m worried about this going wrong and losing the data, or not being able to get it back to how it was!
Last edited by kez2 (2009-01-14 01:19:22)
Offline
Re: How can I temporarily disable a textpattern site?
TXPDream – A Textpattern Tag Library for Adobe Dreamweaver. (updated for 4.2.0) | jdw_if_ajax – Only serve certain parts of a page when requested with AJAX
Offline
Re: How can I temporarily disable a textpattern site?
Hmm, interesting. Of course if your client knows enough to have backed up everything, db included, you’re out of luck. Probably not, since they didn’t change the FTP account. But then some web hosts automatically back up databases.
If they haven’t been so diligent, and if they don’t know so much, it might be enough simply to go into the txp_users table and remove their account(s), adding one for yourself at the same time. You could then do something simple such as password protecting the site or putting it into maintenance mode with the rvm_maintenance plugin.
Yes, you could remove files via FTP, but there’s nothing they couldn’t replace rather easily. If they’re really clueless you could just remove some key file, config.php perhaps, and that would do it.
Code is topiary
Offline
#7 2009-01-14 03:31:53
- kez2
- New Member
- Registered: 2009-01-13
- Posts: 5
Re: How can I temporarily disable a textpattern site?
Thanks jsoo, and JanDW
Is there a way of accessing and changing the txp_users table using fetch? The tutorials required something like “myphpadmin” – I presume this is a control panel; part of the host’s website, which alas I now no longer have access to.
Offline
Re: How can I temporarily disable a textpattern site?
I’m not entirely sure and somebody more experienced in php/mysql should confirm, but maybe this helps to reset a users password
the info to connect to the database can be found in config.php
<?php
$dbhost = 'localhost';
$dbuser = 'login';
$dbpass = 'password';
$conn = mysql_connect($dbhost, $dbuser, $dbpass) or die ('Error connecting to mysql');
$dbname = 'nameofdatabase';
mysql_select_db($dbname);
UPDATE txp_users SET pass = PASSWORD('newpass') WHERE name = 'loginName';
mysql_close($conn);
?>
Last edited by JanDW (2009-01-14 04:19:50)
TXPDream – A Textpattern Tag Library for Adobe Dreamweaver. (updated for 4.2.0) | jdw_if_ajax – Only serve certain parts of a page when requested with AJAX
Offline
Re: How can I temporarily disable a textpattern site?
kez2 wrote:
Thanks jsoo, and JanDW
Is there a way of accessing and changing the txp_users table using fetch?
If FTP is the only access you have, no, not directly. You’d have to try uploading a script as jm and JanDW have suggested. But with the db login and hostname info from config.php you ought to be able to mysql in directly, from the command line (shell).
Code is topiary
Offline
#10 2009-01-14 14:44:02
- kez2
- New Member
- Registered: 2009-01-13
- Posts: 5
Re: How can I temporarily disable a textpattern site?
Thanks very much for your help guys.
Kez
Last edited by kez2 (2009-01-14 14:44:18)
Offline