Monthly archives: December 2006

Entries found: 4

Restoring SQL bak for data backed up on a different machine

 ”the physical file name” “may be incorrect”RESTORE DATABASE DBName
FROM DISK = ‘C:\mypath\backedUpDb.bak’
WITH
MOVE
‘backedUpDb_dat’ TO ‘C:\mypath\DBName.mdf’,
MOVE ‘backedUpDb_log’ TO ‘C:\mypath\DBName.ldf’
GO

Where
DBName is the name the db will have on your local machine
backedUpDb.bak is the backup with the wrong physical path
backedUpDb_dat and backedUpDb_log are described below
mdf and ldf are the names and locations you want DBName to have after restoration

 Get backedUpDb_dat from:
SQL Enterprise or Management Studio
Databases
Restore Database
To Database [DBName]
From Device: [click ...]
Backup Media
File
Add
Browse to backedUpDb.bak
OK
Select Restore checkbox
Options
The Original Filename is you backedUpDb_dat and backedUpDb_log
Options
 

 

.htaccess mod_rewrite to eliminate non-www domain and index.php

#Redirect any bogartcomputing.com request to http://www.bogartcomputing.com
rewritecond %{HTTP_HOST} ^bogartcomputing\.com
rewriterule (.*) http://www.bogartcomputing.com/$1 [R=301,L] 
#Redirect any index.php request to /
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /.*index\.php\ HTTP/
RewriteRule ^(.*)index\.php /$1 [R=301,L]
#redirect any home/ request to /
RewriteRule ^(.*)home/ /$1 [R=301,L]

Joomla You are not authorized to view this resource – com_frontpage

The Joomla You Are Not Authorized to View This Resource error has many causes. You will not find this one in any standard Joomla forum.

I added a titletag column to the jos_content table. I used it in components/com_content/content.php to set a custom title tag per content item.

 

$query = “SELECT a.id, a.title, a.title_alias, a.titletag, a.introtext, a.sectionid, a.state, a.catid, a.created, a.created_by, a.created_by_alias, a.modified, a.modified_by,” . “n a.checked_out, a.checked_out_time, a.publish_up, a.publish_down, a.images, a.urls, a.ordering, a.metakey, a.metadesc, a.access, a.hits,” . “n CHAR_LENGTH( a.fulltext ) AS readmore, u.name AS author, u.usertype, s.name AS section, cc.name AS category, g.name AS groups” . $voting['select'] . “n FROM #__content AS a” . “n INNER JOIN #__content_frontpage AS f ON f.content_id = a.id” . “n INNER JOIN #__categories AS cc ON cc.id = a.catid” . “n INNER JOIN #__sections AS s ON s.id = a.sectionid” . “n LEFT JOIN #__users AS u ON u.id = a.created_by” . “n LEFT JOIN #__groups AS g ON a.access = g.id” . $voting['join'] . $where . “n ORDER BY $order_pri $order_sec” ;

$database->setQuery( $query, $limitstart, $limit );

$rows = $database->loadObjectList();

// Dynamic Page Title

// ctb 9/26/06 added meta key words to title

$titletag=$rows[0]->titletag;

if (strlen($titletag)< =0) {$titletag=$rows[0]->metakey;

} $mainframe->SetPageTitle( $menu->name .” ” . $rows[0]->titletag);

Then I copied content.php to a site that did not have the $titletag hack. The result was a home page (com_frontpage) that displayed “You are not authorized to view this item” for each of the home page items.

2013 © Web Programming Answers