ini_set('display_errors', '1');
session_start();
include("underground/includes/include.inc.php");
$Page = new Page();
$Ann = new AnnonceDsp;
$usr = new UserDisplay;
if ($_POST)
{
if ($_POST["email"] && $_POST["no_email"] == "")
{
$signup = $usr->Load($_POST);
switch($signup)
{
case 1 :
$_SESSION["login_message"] = true;
if ($_SESSION["dest_login"])
header("Location:" . $_SESSION["dest_login"]);
else
header("Location:/compte");
break;
case 3 :
$Message = "
Ce compte n'existe pas ou votre mot de passe est incorrect. Merci de recommencer.
";
break;
}
}
else
$Message = "Ce compte n'existe pas ou votre mot de passe est incorrect. Merci de recommencer.
";
}
if ($_GET["ville"])
{
$tville = $Ann->GetVillebyCpVille($_GET["cp"], $_GET["ville"]);
$tcategorie = $Ann->GetNewCatRewritebyRewrite($_GET["type"]);
$ndep = substr($tville["ville_code_postal"],0,2);
$tDep = $Ann->GetDep($ndep);
$urlmap = $Ann->GetRewriteCatNew($tcategorie["rewrite"]);
$urldep = $Ann->GetRewriteDepNew($tcategorie["rewrite"], utf8_encode($tDep["nom"]), $ndep);
$urlville = $Ann->GetRewriteVilleNew($tcategorie["rewrite"], $tville["ville_nom_reel"], $tville["ville_code_postal"]);
$tlink[] = array("link" => "/", "text" => "Accueil", "active" => true);
$tlink[] = array("link" => $urlmap, "text" => $tcategorie["lib_categorie"], "active" => true);
$tlink[] = array("link" => $urldep, "text" => $tcategorie["desc_categorie"] . " " . $tDep["nom"], "active" => true);
$tlink[] = array("link" => $urlville, "text" => $tville["ville_nom_reel"], "active" => false);
}
else
header("Location:/");
if(!$tville or !$tcategorie or !$tDep)
{
header("HTTP/1.0 404 Not Found");
include("erreur_get.php");
exit();
}
$js["ville_id"] = $tville["ville_id"];
$js["ville"] = $tville["ville_nom_simple"];
$total = $Ann->GetCountResultVille($tcategorie["categorie"], $tville["ville_id"], 1);
$epp = 20; // nombre d'entrées à afficher par page (entries per page)
$nbPages = ceil($total["count(*)"]/$epp); // calcul du nombre de pages $nbPages (on arrondit à l'entier supérieur avec la fonction ceil())
$current = 1;
if (isset($_GET['p'])) {
$page1 = intval($_GET['p']);
if ($page1 >= 1 && $page1 <= $nbPages) {
$current=$page1;
} else if ($page1 < 1) {
$current=1;
} else {
$current = $nbPages;
}
}
$start = ($current * $epp - $epp);
$tres = $Ann->GetResultVille($tcategorie["categorie"], $tville["ville_id"], $total["count(*)"], $start, $epp, 1);
if($_GET["p"] > $nbPages)
{
header("HTTP/1.0 404 Not Found");
include("erreur_get.php");
exit();
}
$title = str_replace("%ville%", $tville["ville_nom_reel"], $tcategorie["meta_titre_ville"]);
$descr = str_replace("%ville%", $tville["ville_nom_reel"], $tcategorie["meta_descr_ville"]);
if ($title)
{
if ($current > 1)
$tMeta["title"] = utf8_encode($title) . " - page " . $current;
else
$tMeta["title"] = utf8_encode($title);
$tMeta["keyword"] = "Hopitaux, clinique, pharmacie, medecins, maternites";
$tMeta["description"] = utf8_encode($descr);
}
else
{
$tMeta["title"] = "Ayouda.com, trouver la bonne personne près de chez vous";
$tMeta["keyword"] = "femme de ménage, baby sitter, aide à domicile, pet sitter";
$tMeta["description"] = "femme de ménage, baby sitter, aide à domicile, pet sitter, retrouver toutes les annonces du service a la personne.";
}
$tCSS = array( "/resources/bootstrap-3.3.5/dist/css/bootstrap.css",
"/resources/bootstrapValidator/dist/css/bootstrapValidator.min.css",
"/resources/js/select2/select2.css",
"/resources/select2-bootstrap.css",
"/resources/style.css");
//$tJS = array("http://cdnjs.cloudflare.com/ajax/libs/less.js/1.7.0/less.min.js");
$Page->Meta($tMeta, $tCSS, "", $tJS);
?>
$city = "[{\"id\":\"". $tville["ville_id"] ."\",\"name\":\"". $tville["ville"] ."\"}]";
$_SESSION["city"] = $city;
$_SESSION["cat"] = $tcategorie["id_categorie"];
// $Page->Header();
$Page->NavBar();
?>