function login() { $email = $_POST["username"]; $password = $_POST["password"]; $sessionid = $_POST["sessionid"]; if (trim($email) != "" and $password != "") { $clienti = new Clienti(); $arrCl = $clienti->getAll(" and cl_email='" . $email . "' and cl_password='******'"); if (count($arrCl) == 0) { print 0; } else { $_SESSION["idCliente"] = $arrCl[0]["cl_id"]; //se è un rivenditore, salvo il gruppo if ($arrCl[0]["cl_fkrivenditore"] != 0) { $_SESSION["rivenditore"] = $arrCl[0]["cl_fkrivenditore"]; } //aggiorno il carrello $objCar = new Carrello(); $objCar->updateUtente($sessionid, $_SESSION["idCliente"]); $objCar->updateSession($sessionid, $_SESSION["idCliente"]); print 1; } } else { print 0; } }
<?php //controllo se si sta facendo un inserimento if (isset($_POST["save"]) and $_POST["save"] == "si") { $nome = $_POST["nome"]; $cognome = $_POST["cognome"]; $email = $_POST["email"]; $partitaiva = $_POST["partitaiva"]; $azienda = $_POST["azienda"]; $sito = $_POST["sito"]; $telefono = $_POST["telefono"]; $rivenditore = $_POST["rivenditore"]; $object = new Clienti(); $id = aggiusta_post($_GET["id"]); //controllo che la mail sia univoca $arrCl = $object->getAll(" and cl_email='" . trim(aggiusta_post($email)) . "' and cl_id<>" . $id); $numCl = count($arrCl); if ($numCl != 0) { $strPar = "errore=mail"; } else { $object->update($id, $nome, $cognome, $email, $partitaiva, $azienda, $sito, $telefono, $rivenditore); $strPar = "ins=si"; //se è stato confermata la richiesta di un rivenditore, mando la mail if ($_SESSION["tipo"] == 2) { if ($array["cl_lingua"] == "ita") { require ROOT_APATH . "config/lingue/italiano.php"; } else { require ROOT_APATH . "config/lingue/inglese.php"; } if ($array["cl_fkrivenditore"] == 0 and $rivenditore != 0) { $bodyMsg = file_get_contents('../tpl_mail/' . $array["cl_lingua"] . '/conferma_rivenditore.html');