Tags
Categories
- Computers (13)
- Electronics (4)
- Internet (3)
- Musings (1)
- Photography (2)
- Uncategorized (1)
- Vehicles (3)
Meta
Archives
- March 2020 (1)
- November 2011 (3)
- October 2011 (1)
- August 2010 (1)
- February 2010 (1)
- April 2009 (1)
- March 2009 (1)
- February 2009 (1)
- December 2008 (1)
- November 2008 (2)
- October 2008 (1)
- September 2008 (1)
- June 2008 (1)
- March 2008 (3)
- February 2008 (2)
-
Recent Posts
Tag Archives: php
KFile, a simple download-link generator for WordPress
After finally finding a nice CMS to use for my homepage, I was searching for a simple plugin that lets me
- upload files manually using scp or other means from the command line
- display a nice link to the file, stating name, size etc. after adding a text like [file=foo.tar.bz2]
All I found were quite large plugins using databases, using quite elaborate administration front ends. So I started writing one myself.
Usage
- Install and activate the plugin.
- Create a directory wordpressurl/download (alternatively, change the constant in kfile.php)
- Upload files there
Deleting multiple tables with a common prefix
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | <?php //Connect to the database server and select our database $link = mysql_connect('rdbms.strato.de', 'UXXXX', 'epsilon eridani') or die('Could not connect: ' . mysql_error()); mysql_select_db('DBXXXX') or die('Could not select database'); //get table list $result = mysql_query("SHOW TABLES") or die(mysql_error()); //kill tables $tokillprefix = "jos_"; while($row=mysql_fetch_array($result)){ if(substr($row[0],0,strlen($tokillprefix)) == $tokillprefix){ echo "killing $row[0] <br>\n"; mysql_query("DROP TABLE $row[0]") or die(mysql_error()); } } ?>done |