I have made this, but it doesn't work:
.htaccess
RewriteEngine On
RewriteRule ^([a-z0-9&=]+)$ album.php?album=$1
album.php
<?php
/**************************************************************************
Database functions
**************************************************************************/
// Connect to the database
mysql_connect (***,***,'***');
mysql_select_db (***');
// Perform a database query
function db_query($query)
{
global $query_stats;
$query_start = getmicrotime();
$result = mysql_query($query);
$query_end = getmicrotime();
$query_stats[] = $query_end - $query_start;
if (!$result) db_error("While executing query \"$query\"");
return $result;
}
// Error message if a query failed
function db_error($the_error)
{
global $CONFIG;
if (!$CONFIG['debug_mode']) {
cpg_die(CRITICAL_ERROR, 'There was an error while processing a database query', __FILE__, __LINE__);
} else {
$the_error .= "\n\nmySQL error: ".mysql_error()."\n";
$out = "<br />There was an error while processing a database query.<br /><br/>
<form name='mysql'><textarea rows=\"8\" cols=\"60\">".htmlspecialchars($the_error)."</textarea></form>";
cpg_die(CRITICAL_ERROR, $out, __FILE__, __LINE__);
}
}
// Fetch all rows in an array
function db_fetch_rowset($result)
{
$rowset = array();
while ($row = mysql_fetch_array($result)) $rowset[] = $row;
return $rowset;
}
function getmicrotime(){
list($usec, $sec) = explode(" ",microtime());
return ((float)$usec + (float)$sec);
}
function cpg_die($msg_code, $msg_text, $error_file, $error_line, $output_buffer = false)
{
$ob = ob_get_contents();
if ($ob) ob_end_clean();
exit;
}
$album = $HTTP_GET_VARS['album'];
$results = mysql_query("SELECT aid FROM cpg00d_albums WHERE title = '$album'");
list($row) = mysql_fetch_row($results);
if (!$row) {
$row = 0;
}
$idnum=$row;
Header("Location: thumbnails.php?album=".$idnum);
exit;
?>
I have replaced my MySQL data by *** for my privacy.