-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathfunctions.php
executable file
·61 lines (49 loc) · 1.48 KB
/
functions.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
<?php
function sql($req){
$q=mysql_query($req); // envoi de la requête
$res="";
if (mysql_num_rows($q) ==0)
$res = "";
else{
while ($r = mysql_fetch_array($q)){
$cl="na";
if ( filter_var($r[5], FILTER_VALIDATE_INT) and strlen($r[5])==8 ) {$cl="tel";}
if ( filter_var($r[5], FILTER_VALIDATE_EMAIL) ) {$cl="email";}
if ( filter_var($r[5], FILTER_VALIDATE_URL) and strrpos($r[5], "facebook.com/")>0 ){
$cl="fb";
$r[5]= "<a href='$r[5]' target='_tab'>$r[1] $r[2]</a>";
}
$res.="<tr>";
$res.="<td>$r[1]</td>";
$res.="<td>$r[2]</td>";
$res.="<td>$r[3]</td>";
$res.="<td>$r[4]</td>";
$res.="<td class=\"".$cl."\">".$r[5]."</td>";
$res.="</tr>";
}
}
echo $res;
}
function sec($in){
$in = mysql_real_escape_string($in);
$in = addcslashes($in, '%_');
$in=trim($in);
$in=strip_tags($in);
return $in;
}
function check_class_correspondency($from, $to){
$from_numbers = array();
preg_match_all('/([0-9]+)/', $from, $from_numbers);
$from_level = $from_numbers[0][0];
$from_groupe = $from_numbers[0][1];
$from_specialty = array();
preg_match('/([A-Z]+)/', $from, $from_specialty);
$to_numbers = array();
preg_match_all('/([0-9]+)/', $to, $to_numbers);
$to_level = $to_numbers[0][0];
$to_groupe = $to_numbers[0][1];
$to_specialty = array();
preg_match('/([A-Z]+)/', $to, $to_specialty);
return (($from_level == $to_level) && ($from_specialty[0] == $to_specialty[0]) && ($from_groupe != $to_groupe));
}
?>