image-validatie

Gesponsorde koppelingen

PHP script bestanden

  1. image-validatie

« Lees de omschrijving en reacties

Code (php)
PHP script in nieuw venster Selecteer het PHP script
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
<?

// Gemaakt door Grizz :: Gfunited.net

    $bron = @file_get_contents($_POST['url']);
    
 $in_content = array("html","SESSION","COOKIE","javascript");
foreach ($in_content as $value){
if(eregi($value,$bron)){
 $source_error = 1;
 }
}

function
image_validation($string){

    $fopen = @fopen($string, "r");
    if ($fopen){

 if(eregi("jpg$",$string)){
 $image = 1;
 }
elseif(eregi("gif$",$string)){
 $image = 1;
 }
elseif(eregi("png$",$string)){
 $image = 1;
 }
}

 
 if(!empty($image)){
 return TRUE;
 }
}


 $source = "<textarea name=\"textarea\" cols=\"60\" rows=\"15\" class=\"textbox\">$bron</textarea>";
 
 if(isset($_POST['submit']) && !empty($_POST['url'])){
 
$check = image_validation($_POST['url']);

 if($check == 1 && $source_error == 0){
 
 echo "<div align=\"center\"><img src=\"".$_POST['url']."\"></div>";

$error_code = "<br /> <font color=\"green\">** This is a valid image!</font>";
 

 }
else {
 
$error_code = "<br /><font color=\"red\">** This is not a valid image!</font>";
  
 }
}

  
?>


<style type="text/css">
<!--
body,td,th {
    font-family: Verdana, Arial, Helvetica, sans-serif;
}
.style2 {font-size: 10; }
.style3 {color: #FFFFFF}

.textbox {background-color: #ffffff;
color: #000000;
border-left: 1px solid #000000;
border-right: 1px solid #000000;
border-top: 1px solid #000000;
border-bottom: 1px solid #000000;
font-size: 7.5pt; font-weight: bold;
    font-family : verdana, helvetica, arial, times new roman, sans-serif;
padding-left: 3px;
padding-right: 3px;}

-->
</style>

 <form action="<? echo "".$_SERVER['PHP_SELF'].""; ?>" method="POST">
   <table width="50%" border="0" align="center" cellpadding="2" cellspacing="0">
    <tr>
      <td valign="top"><div align="center">
        <table border="1" cellpadding="2" cellspacing="0" bordercolor="#000000">
            <tr>
              <td colspan="2" bgcolor="#000000"><div align="center" class="style3"> Image validation :: </div></td>
            </tr>
            <tr>
              <td><span class="style2">Url</span></td>
              <td><input name="url" type="text" class="textbox" id="url" value="http://" /></td>
            </tr>
            <tr>
              <td colspan="2"><div align="right" class="style2">
                  <input name="submit" type="submit" class="textbox" id="submit" value="Submit" />
              </div></td>
            </tr>
              </table>
              
         <? echo $error_code; ?>      
              
      </div></td>
      <td valign="top">
      
        <div align="center">
          <table border="1" cellpadding="2" cellspacing="0" bordercolor="#000000">
            <tr>
              <td bgcolor="#000000"><div align="center"><span class="style3">File content :: </span></div></td>
            </tr>
            <tr>
              <td><? echo $source; ?></td>
            </tr>
            <tr>
              <td><? if(empty($_POST['url'])){ echo "Link ::"; } else {  echo "".$_POST['url'].""; } ?></td>
            </tr>
          </table>
        </div>
        
     </td>
    </tr>
  </table>
 </form>    

 
 

Om de gebruiksvriendelijkheid van onze website en diensten te optimaliseren maken wij gebruik van cookies. Deze cookies gebruiken wij voor functionaliteiten, analytische gegevens en marketing doeleinden. U vindt meer informatie in onze privacy statement.