//PARSE QUERY STRING
//global $REQUEST_URI; // Define our global variables
$query = explode("/",$REQUEST_URI);
//$query = array_reverse($query);
if(strlen(trim($query[2])) > 0){
$_GET['sortby'] = $query[2];
$sortby = $_GET['sortby'];
}
if(strlen(trim($query[3])) > 0){
$_GET['author'] = $query[3];
$author = $_GET['author'];
}
if(strlen(trim($query[4])) > 0){
$_GET['page'] = $query[4];
$page = $_GET['page'];
}
include "includes/header.php";
?>
Welcome to beader.org's free beading pattern gallery.
You can use our pattern designer software to create your own patterns, and post them for others to see!
All beading patterns have been created by our users, so please give credit where credit is due.
Please note that patterns open in a new window. You must have javascript and pop-ups enabled.
require "admin/sql.php";
function multi_sort()
{
$arguments = func_get_args();
$arrays = $arguments[0];
for ($c = (count($arguments)-1); $c > 0; $c--)
{
if (in_array($arguments[$c], array(SORT_ASC , SORT_DESC)))
{
continue;
}
$compare = create_function('$a,$b','return strcasecmp($a["'.$arguments[$c].'"], $b["'.$arguments[$c].'"]);');
usort($arrays, $compare);
if ($arguments[$c+1] == SORT_DESC)
{
$arrays = array_reverse($arrays);
}
}
return $arrays ;
}
$link = mysql_connect("localhost", $dbname, $dbpassword);
if (! $link) die("Couldn't connect to MySQL");
mysql_select_db($db , $link) or die("Couldn't open $db: ".mysql_error());
if($_GET['sortby'] == 'author' || $_GET['sortby'] == 'name' || $_GET['sortby'] == 'date'){
$sortby = $_GET['sortby'];
}else{
$sortby = 'date';
}
if(!empty($author)){ $author = ereg_replace("[^0-9^A-z^a-z^\-\']", "", $author); $auth = "WHERE author='$author'"; }
$result = mysql_query("SELECT ID, name, description, author FROM gallery $auth ORDER BY $sortby DESC")or die("SELECT Error: ".mysql_error());
$col = 1;
$c = 0;
while($get_info = mysql_fetch_row($result)){
$galleryitem[$c] = $get_info;
if(!isset($authors[$get_info[3]])){
$res = mysql_query("SELECT name FROM users WHERE ID = '".$get_info[3]."'")or die("SELECT Error: ".mysql_error());
$res = mysql_fetch_row($res);
$authors[$get_info[3]] = $res[0];
}
$galleryitem[$c]['author'] = $authors[$get_info[3]];
$c++;
}
if($sortby == 'author'){ $galleryitem = multi_sort($galleryitem, 'author'); }
$author2 = $author;
$numperpage = 12;
if(!isset($page)){ $page = 1; }
for($i=($page-1)*$numperpage;$i\r\n"; }
$desc = str_replace("\r\n", " ", $get_info[2]);
$desc = str_replace("\t", " ", $desc);
//$res = mysql_query("SELECT name FROM users WHERE ID = '".$get_info[3]."'")or die("SELECT Error: ".mysql_error());
//$res = mysql_fetch_row($res);
$author = $authors[$get_info[3]];
echo "| |  | \r\n";
echo "\r\n";
echo "Name : ".$get_info[1]." \r\n";
echo "Author : ".$author." \r\n";
echo "Description : ".stripslashes($desc)." \r\n";
echo " | \r\n";
if($col == 2){ echo "\r\n"; }
$col++;
if($col > 2){ $col = 1; }
}
?>
Page
echo $page;
?> of
$numpages = ceil(sizeof($galleryitem) / $numperpage);
echo $numpages." | ";
for($j=1;$j<=$numpages;$j++){
if($j!==$page){ echo ""; }
echo $j;
if($j!==$page){ echo ""; }
if($j < $numpages){ echo ", "; }
}
?>
|
$cd = check_donated();
if($cd !== true){ ?>
| |  |
|
|  |
|
} ?>
include "includes/footer.php";
?>