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
| <?php<br>
<br>
$un=$_POST["user"];<br>
$pw=$_POST["pass"];<br>
$pw2=$_POST["pass2"];<br>
$em=$_POST["email"];<br>
$url=$_POST["url"];<br>
<br>
$info=array($un,$pw,$pw2,$em,$url);<br>
<br>
foreach($infoas$idx=>$unit){<br>
switch($idx){<br>
case4:<br>
$rgx="/^((ftp|http|https)://(w+:{0,1}w*@)?)?(S+)(:[0-9]+)?(/|/([w#!:.?+=&%@!-/]))?$/";<br>
break;<br>
<br>
case3:<br>
$rgx="/^[A-Z0-9._%+-]+@[A-Z0-9.-]+.[A-Z]{2,4}$/i";<br>
break;<br>
<br>
case2:<br>
//readbelow<br>
$rgx="/[^A-Za-z0-9]+/";<br>
break;<br>
<br>
case1:<br>
//readbelow<br>
$rgx="/[^A-Za-z0-9]+/";<br>
break;<br>
<br>
case0:<br>
//ifcharacters are NOT normal<br>
$rgx="/[^A-Za-z0-9]+/";<br>
break;<br>
<br>
default:<br>
echo"???";<br>
die("$unit?");<br>
break;<br>
}<br>
<br>
$n=preg_match($rgx,$unit,$matches);<br>
if(($idx==0) || ($idx==1) || ($idx==2) ){<br>
if($n){<br>
echo"BadCharacters in $unit; Alphanumeric only<br />";<br>
}<br>
}else{<br>
if($n==0) {<br>
echo"IncorrectFormat in $unit; Enter Valid Info<br />";<br>
}<br>
}<br>
}<br>
<br>
?>
|