* $string = 'this sentence is way too long'; * echo neat_trim($string, 16); * * * Output: 'this sentence is' * * @access public * @param string string we are operating with * @param integer character count to cut to * @param string|NULL delimiter. Default: '' * @return string processed string **/ function neat_trim($string, $n) { if (strlen($string) <= $n) { $string = $string; //do nothing } else { $string = wordwrap($string,$n); $string = substr($string, 0, strpos($string, "\n"))."..."; } return $string; /*$len = strlen($str); if ($len > $n) { preg_match('/(.{' . $n . '}.*?)\b/', $str, $matches); if(isset($matches[1])) { return rtrim($matches[1]) . $delim; } } else { return $str; }*/ } function ascii_to_entities($str) { $count = 1; $out = ''; $temp = array(); for ($i = 0, $s = strlen($str); $i < $s; $i++) { $ordinal = ord($str[$i]); $out .= '&#'.$ordinal.';'; } return $out; } // ----------------------------------------------------------------- $mois[1] = "Janvier"; $mois[2] = "Février"; $mois[3] = "Mars"; $mois[4] = "Avril"; $mois[5] = "Mai"; $mois[6] = "Juin"; $mois[7] = "Juillet"; $mois[8] = "Août"; $mois[9] = "Septembre"; $mois[10] = "Octobre"; $mois[11] = "Novembre"; $mois[12] = "Décembre"; $month[1] = "January"; $month[2] = "February"; $month[3] = "March"; $month[4] = "April"; $month[5] = "May"; $month[6] = "June"; $month[7] = "July"; $month[8] = "August"; $month[9] = "September"; $month[10] = "October"; $month[11] = "November"; $month[12] = "December"; function str_rand($length = 16, $seeds = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789') { $str = ''; $seeds_count = strlen($seeds); // Seed list($usec, $sec) = explode(' ', microtime()); $seed = (float) $sec + ((float) $usec * 100000); mt_srand($seed); // Generate for ($i = 0; $length > $i; $i++) { $str .= $seeds{mt_rand(0, $seeds_count - 1)}; } return $str; } function dump_var($varia) { echo "
\n";
	print_r($varia);
	echo "
\n"; } function toggle_valide($oldval) { if ($oldval == "N") { return 'O'; } else { return 'N'; } } function rt2br($val) { $val = str_replace('> ', "
  • ", $val); $val = str_replace('\r', "
    ", $val); return $val; } function removeaccents($string) { return strtr($string, "é", "aaaaaaaaaaaaooooooooooooeeeeeeeecciiiiiiiiuuuuuuuuynn"); } function prepare_name($string) { $no_accent = removeaccents(stripslashes($string)); $bad = array("'", "'", " ", "-","?","&", '"', "@"); $good = array("", "", "_", "_", "","", '', ''); $no_accent = str_replace($bad, $good, $no_accent); return strtolower($no_accent); } function fillform($valeur) { $action = (isset($valeur)) ? '' : $valeur; return $action; } function trimtab($tab) { for ($i=0; $iquery($sql)) {die($db->error());} while($row = $db->fetchAssoc()){ $tab_av['id'][] = stripslashes($row['id']); $tab_av['nom'][] = stripslashes($row['sNom_fr']); } $tab = explode("-", $av); $tab = array_map('trimall', $tab); for ($i=0; $iquery($sql)) {die($db->error());} while($row = $db->fetchAssoc()){ $tab_cat['id'][] = stripslashes($row['id']); $tab_cat['nom'][] = stripslashes($row['sNom_fr']); } $tab = explode(",", $cat); $tab = array_map('trimall', $tab); for ($i=0; $i &resultat=Echec&erreurmsg=La+connexion+au+serveur+MySQL+a+%26eacute%3Bchou%26eacute%3B