/*
+------------------------------------------------------------+
| |
| Arcadwy Arcade Script |
| ======================================== |
| |
| by Arcadwy |
| (c) 2009 Arcadwy Web Development |
| http://www.arcadwy.com |
| Email : support@arcadwy.com |
| Completed on jan , 2009 |
| |
| ======================================== |
| |
+------------------------------------------------------------+
*/
include "./init.php";
$center = "";
$ipp = $settings['set_gam_per_page']; // games per page
$ipr = 2; // games per row
$links = get_links(10);
if(isset($_GET['start']))
$start=$_GET['start'];
else {
$start=1;
$_GET['start'] = 1;
}
$cpage = $start;
$start = ($start * $ipp) - $ipp;
$where = "";
$action_url = "";
if(!isset($_GET['action'])) {
$myquery = mysql_query("SELECT * FROM {$prefix}games ORDER by gam_id DESC LIMIT $start,$ipp;") or report("fetch all games : ");
$from = "FROM {$prefix}games";
}
if(isset($_GET['action'])){
if($_GET['action'] == "featured") {
$myquery = mysql_query("SELECT * FROM {$prefix}games WHERE gam_status='F' ORDER by gam_id DESC LIMIT $start,$ipp;") or report("fetch all games : ");
$where = "WHERE gam_status='F'";
$action_url = "&action=featured";
$from = "FROM {$prefix}games";
}
if($_GET['action'] == "played") {
$myquery = mysql_query("SELECT * FROM {$prefix}games ORDER BY gam_views DESC LIMIT $start,$ipp;") or report();
$action_url = "&action=played";
$from = "FROM {$prefix}games";
}
if($_GET['action'] == "rated") {
$sql = "SELECT COUNT({$prefix}ratings.rat_id) as rates,{$prefix}ratings.rat_game_id,{$prefix}games.* as thenamefield,ROUND(AVG({$prefix}ratings.rat_num),2) as rating
FROM {$prefix}ratings, {$prefix}games WHERE {$prefix}games.gam_id = {$prefix}ratings.rat_game_id GROUP BY rat_game_id
ORDER BY rates DESC,rating DESC LIMIT $start,$ipp";
$myquery = mysql_query("$sql") or report();
$action_url = "&action=rated";
$from = "FROM {$prefix}games gm, {$prefix}ratings ra WHERE gm.gam_id=ra.rat_game_id GROUP BY gm.gam_id";
}
if($_GET['action'] == "commented") {
$myquery= mysql_query("SELECT *, COUNT(*) as total FROM {$prefix}games gm, {$prefix}comments ca WHERE gm.gam_id=ca.cmt_gam_id GROUP BY gm.gam_id ORDER BY total DESC LIMIT $start,$ipp;") or report();
$action_url = "&action=commented";
$from = "FROM {$prefix}games gm, {$prefix}comments ca WHERE gm.gam_id=ca.cmt_gam_id GROUP BY gm.gam_id";
}
}
$header_ad = top_ad();
$left_ad = left_ad();
$right_ad = right_ad();
$head_message = "
$header_ad";
$title = $settings['set_index_title'];
$temp = template("header");
eval("\$header = \"$temp\";");
if($member) {
if($member['user_id'] == 1) $admin_link = "» Admin Panel
";
else
$admin_link = "";
$temp = template("left_logged");
eval("\$user_info = \"$temp\";");
} else {
$temp = template("left_login");
eval("\$user_info = \"$temp\";");
}
$rt = mysql_query("SELECT COUNT(*) as total $from $where") or report();
$ta = mysql_fetch_assoc($rt);
if($ta["total"]==0) {
$list_data = "Estamos trabajando para incluir este juego, por favor envienos los datos del juego del juego ";
$pagination = "";
$total_res = "";
}
else {
$pages = "";
if($ta['total'] > $ipp) {
$pages = "";
$total_pages = ceil($ta['total'] / $ipp);
$pages = pagination2($total_pages, $cpage, 8, "./browse_games.php","$action_url");
}
$fres = $myquery;
if(mysql_num_rows($fres)==0)
$list_data = "";
else {
$list_data = "";
$counter = 0;
while($f_art_row=mysql_fetch_assoc($fres)) {
$gam_url = $settings['set_seo_onoff'] =='on'
? "$root_path/game/".plaintext($f_art_row['gam_title'])."-$f_art_row[gam_id].html"
: "$root_path/game.php?id=$f_art_row[gam_id]";
if($counter == 2) {
$list_data .= "
";
}
if(strstr($f_art_row['gam_thumb_url'], "http"))
$gam_thumb = $f_art_row['gam_thumb_url'];
else
$gam_thumb = "$root_path/gam_previews/$f_art_row[gam_thumb_url]";
if(strlen($f_art_row["gam_desc"])>95) {
$f_art_row["gam_desc"] = str_cut($f_art_row["gam_desc"],95);
$f_art_row["gam_desc"] = $f_art_row["gam_desc"].'..';
}
$list_data .= "
|
| ";
if($counter == 1) {
$list_data .= "
";
$counter = -1;
}
$counter++;
}
$list_data .= "
";
}
$total_res = "
Mostrando todos los juegos Click en la miniatura para jugar |
$pages
|
|
";
$pagination = "
";
}
$cats = get_cats();
$stats = get_stats();
$temp = template("browse_games");
eval("\$center = \"$temp\";");
$temp = template("left");
eval("\$left = \"$temp\";");
$temp = template("right");
eval("\$right = \"$temp\";");
$temp = template("footer");
eval("\$footer = \"$temp\";");
include "./header.php";
mysql_close();?>