Connect(SERVEURBASE, USERBASE, USERPASSWD, BASE); //$DB->debug = true; return $DB; } function get_server_name() { $scheme = (isset($_SERVER["HTTPS"]) && $_SERVER["HTTPS"] == "on") ? 'https' : 'http'; $url = sprintf("%s://%s%s", $scheme, STUDS_URL, dirname($_SERVER["SCRIPT_NAME"])); if (!preg_match("|/$|", $url)){ $url = $url."/"; } return $url; } function get_sondage_from_id($id) { global $connect; // Ouverture de la base de données if(preg_match(";^[\w\d]{16}$;i",$id)) { $sql = 'SELECT sondage.*,sujet_studs.sujet FROM sondage LEFT OUTER JOIN sujet_studs ON sondage.id_sondage = sujet_studs.id_sondage WHERE sondage.id_sondage = '.$connect->Param('id_sondage'); $sql = $connect->Prepare($sql); $sondage=$connect->Execute($sql, array($id)); if ($sondage === false) { return false; } $psondage = $sondage->FetchObject(false); $psondage->date_fin = strtotime($psondage->date_fin); return $psondage; } return false; } $connect=connexion_base(); define('COMMENT_EMPTY', 0x0000000001); define('COMMENT_USER_EMPTY', 0x0000000010); define('COMMENT_INSERT_FAILED', 0x0000000100); define('NAME_EMPTY', 0x0000001000); define('NAME_TAKEN', 0x0000010000); define('NO_POLL', 0x0000100000); define('NO_POLL_ID', 0x0001000000); define('INVALID_EMAIL', 0x0010000000); define('TITLE_EMPTY', 0x0100000000); define('INVALID_DATE', 0x1000000000); $err = 0; function is_error($cerr) { global $err; if ( $err == 0 ) return false; return (($err & $cerr) != 0 ); } function is_user() { return isset($_SERVER['REMOTE_USER']) || (isset($_SESSION['nom'])); } function print_header($js = false) { ?>