// require_once('./inc/MyWords/Snippet2.php');
// session_start();
// include("config.php");
//Site URL with ending slash - example: $siteurl = "http://www.domain.com/";
$siteurl = "http://www.zocke.es/";
include "inc.php";
// include('./inc/session.php');
$host = "127.0.0.1";
$database = "zocke_es_data";
$username = "zocke_es_admin";
$password = "b01bb5j9";
$pdo = new PDO('mysql:host=' . $host . ';dbname=' . $database . '', $username, $password);
$sql = "SELECT id, title, plays FROM `games` WHERE `active` ='ja' AND`in_random` ='ja' ORDER BY plays ASC LIMIT 5";
$arrayGameID = array();
foreach ($pdo->query($sql) as $row) {
//echo $row['id']." ".$row['title']." ".$row['plays']."
";
//header("Location: $redirURL");
// echo ''. $siteurl . 'game/' . $row['gid'] . '/'.$catCat.'/' . $gameurl . '.html';
$arrayGameID[] = $row['id'];
}
$rndGameID = array_rand($arrayGameID, 1);
//echo $rndGameID . "
";
$sql = "SELECT g.id AS gid, g.code, g.title AS gTitle, c.name AS catName FROM `games` g LEFT JOIN `categories` c ON g.category = c.id WHERE g.id = " . $arrayGameID[$rndGameID] . "";
foreach ($pdo->query($sql) as $row) {
// echo $row['gid']." ".$row['gTitle']."
";
// echo "URL: ".$row['code']."
";
// echo "Kategorie: " . cleanGameCat($row['catName']) . "
";
$catCat = cleanGameCat($row['catName']);
$gameurl = cleanGameURL($row['gTitle']);
$redirURL = $siteurl . 'game/' . $row['gid'] . '/' . $catCat . '/' . $gameurl . '.html';
// header("Location: $redirURL");
//echo ''. $siteurl . 'game/' . $row['gid'] . '/'.$catCat.'/' . $gameurl . '.html';
}
?>
you'll be redirected to: