tags around all email addresses in $string return ereg_replace("[_A-Za-z0-9-]+(\.[_A-Za-z0-9-]+)*@[A-Za-z0-9-]+(\.[A-Za-z0-9-]+)*(\.[A-Za-z]{2,3})", "email", $string); } //ip adres opvragen function getUserIP() { if (getenv("HTTP_CLIENT_IP")) $ip = getenv("HTTP_CLIENT_IP"); else { if (getenv("HTTP_X_FORWARDED_FOR")) { $ip = getenv("HTTP_X_FORWARDED_FOR"); } else { $ip = getenv("REMOTE_ADDR"); } } return $ip; } // km stand mooi opmaken function formatkmstand($kmstand) { return number_format($kmstand, 0, ',', '.')." km"; } // cilinhoud stand mooi opmaken function formatcilinhoud($cilinhoud) { return number_format($cilinhoud, 0, ',', '.')." cc"; } // gewicht mooi opmaken function formatgewicht($cilinhoud) { return number_format($cilinhoud, 0, ',', '.')." kg"; } // vermogen omzetten van KW naar PK function formatvermogen($vermogen) { $vermogen = ceil(1.359623*$vermogen); return $vermogen." pk"; } function format_url($url) { // The UTF-8 0.2.x candidate :-) //Short url $url = strtolower($url); $url = str_replace( array('*','','','-','/','_',',','.','','ë','&','"','+','\'\'','\''), array('','o','e',' ',' ',' ',' ',' ','e','e','en',' inch ',' plus ',' inch ',''), $url); $url = str_replace(" "," ", $url); $url = str_replace(" "," ", $url); $url = str_replace(" "," ", $url);//dubbele spaties weg :X $url = substr($url,0,32); return $url; } //db l function q($aSQL) { //include("dbconnect.php"); //$aSQL = safeString($aSQL); $res = mysql_query($aSQL) or die("Ongeldige query: " . mysql_error()); return $res; } // E-mail Checker / Validator function checkmail($email) { if(eregi("^[0-9a-z]([-_.]?[0-9a-z])*@[0-9a-z]([-.]?[0-9a-z])*\\.[a-z]{2,4}$", $email)) { return TRUE; } return FALSE; } //advertentie verwijderen function deleteauto($auto_wijzig,$code) { // verwijderen van autos tabel $delete_ad = "delete from autos where autoid ='$auto_wijzig' AND bedrijfid = '$code' LIMIT 1"; $delete_ad = q($delete_ad); if($delete_ad){ // zoeken naar evt fotos en dan deze ook verwijderen $sql_fotos_tot = "select autofotosmall,autofoto from autofoto where autofotoid = '$auto_wijzig' Limit 10"; $fotos_tot_result = mysql_query($sql_fotos_tot); $fotos_tot_aantal = mysql_num_rows($fotos_tot_result); $testurl = dirname(__FILE__); $testurl = str_replace("/includes","",$testurl); if($fotos_tot_aantal>0){ while ($row_fotos_tot_result = mysql_fetch_array($fotos_tot_result)) { $autofotosmall = $row_fotos_tot_result["autofotosmall"]; $autofoto = $row_fotos_tot_result["autofoto"]; $delfile_s = $testurl."/auto_fotos/".$autofotosmall; $delfile_g = $testurl."/auto_fotos/".$autofoto; $delete_result = @unlink($delfile_s); // @ toevoegen bij productie // XXXXXXXXXXXXXXX $delete_result = @unlink($delfile_g); // XXXXXXXXXXXXXXX } // verwijderen van foto tabel $delete_fotos = "delete from autofoto where autofotoid ='$auto_wijzig' limit 10 "; $delete_fotos = q($delete_fotos); // XXXXXXXXXXXXXXX } }else {echo ERROR; exit;} return TRUE; } //nieuw wachtwoord aanmaken function generatePassword($len) { $al = '012345789ABDEFGHIJKLMNOPQRTUVWYZabdefghijklmnopqrtuvwyz'; $date = "";//date("Hs"); $password = "$date"; for ($index = 1; $index <= $len; $index++) { $randomNumber = rand(1,strlen($al)); $password .= substr($al,$randomNumber-1,1); } return $password; } //url strippen bijv reffere function stripurl($url) { $url = urldecode($_GET["ref"]); $url = htmlspecialchars($url); $url = ereg_replace('"', '', $url); $url = ereg_replace(''', '', $url); $url = ereg_replace('<', '', $url); $url = ereg_replace('>', '', $url); $url = ereg_replace('&', '', $url); $url = ereg_replace('http', '', $url); $url = ereg_replace('www', '', $url); $url = ereg_replace('//', '', $url); $url = ereg_replace(':', '', $url); $url = strip_tags($url); return $url; } // banner ophalen function get_banner($string){ $sql_banner_result = mysql_query ("select code from banners where maat = '$string' order by rand() limit 1"); $row_banner = mysql_fetch_assoc($sql_banner_result); $bannertcode = stripslashes($row_banner["code"]); return $bannertcode; } function seourls($string){ /*$string = str_replace( array('/','\'',' ','.','&'), array('','','-','',''), $string);*/ $string = str_replace(" ","-", $string); $string = str_replace("--","-", $string); // dubbele weg $string = str_replace("--","-", $string); // dubbele weg $string = strtolower($string); $string = urlencode(trim($string)); return $string; } function deurl($string){ $string = str_replace("-"," ", $string); $string = urldecode(trim($string)); $string = trim($string); return $string; } function HeaderMenu($string) { echo "