avatar probleem
dit is het stuke code die dit zegt:
Code (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
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
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
<?php
if(isset($_POST['submit_avatar']) AND $_POST['avatar'] !== "")
{
if($sql == 1)
{
$afb = @getimagesize($_POST['avatar']);
$width = $afb[0];
$height = $afb[1];
$explode = explode(".", $_POST['avatar']);
$ext = array_pop($explode);
if(!eregi("^http://",$_POST['avatar']))
echo '<b>error:</b> start with http:// !';
elseif(!in_array($ext,$extensie))
{
echo '<b>Error:</b> not the wright extention! ';
for($i = 0; $i < $aantal_extensies; $i++)
echo '<b>'.$possible_extensions[$i].'<b> ';
echo '<br />';
}
elseif($width > $max_width OR $height > $max_heigth)
{
echo '<b>Error:</b> picture is to big!<br />max:<br />';
echo '<b>widht:</b> '.$max_width.' <b>height:</b> '. $max_heigth;
}
elseif(!$afb)
echo '<b>Error:</b> You should choose a other avatar!';
else
{
// unlink($avatar_oud);
mysql_query("UPDATE ".$tabel." SET avatar = '".$_POST['avatar']."' WHERE gebruikersnaam = '".$gebruikersnaam."'");
header("Location: ?p=avatar");
}
}
}
elseif(isset($_POST['submit_upload']) AND $_POST['plaatje'] !== "")
{
$file_size = round($_FILES['plaatje']['size'] / 1024);
$file_type = $_FILES['plaatje']['type'];
$file = basename($_FILES['plaatje']['name']);
$ext = explode(".", $file);
$file_extension = array_pop($ext);
$file_name = $_POST['name'];
$size = getimagesize($_FILES['plaatje']['tmp_name']);
$width = $size[0];
$height = $size[1];
if($sql == 1)
$file_name = $_COOKIE['login'];
else
$file_name = $file_name;
$file2 = $file_name.".".$file_extension;
if($file_size > $groote)
echo '<b>Fout:</b> Your avatar is bigger then <b>'.$groote.'</b> kb.<br />';
// elseif(file_exists("$map$file2"))
// echo '<b>Fout:</b> De naam die u gekozen heeft bestaat al!';
elseif($width > $max_width OR $height > $max_heigth)
{
echo '<b>Error:</b> picture is to big!<br />max:<br />';
echo '<b>widht:</b> '.$max_width.' <b>height:</b> '. $max_heigth;
}
else
{
if(!in_array(strtolower($file_extension),$extensie))
{
echo '<b>Error:</b> not the wright extention! ';
for($i = 0; $i < $aantal_extensies; $i++)
echo '<b>'.$possible_extensions[$i].'<b> ';
echo '<br />';
}
else
{
if(move_uploaded_file($plaatje, $map . $file_name . "." . $file_extension))
{
$file = $map;
$file.= $file_name.".";
$file.= $file_extension;
if($sql == 1)
{
mysql_query("UPDATE ".$tabel." SET avatar = '".$file."' WHERE gebruikersnaam = '".$gebruikersnaam."'");
// @unlink($avatar_oud);
header("Location: ?p=avatar");
}
else
echo 'avatar has been uploaded!<br />';
echo 'watch it here: <a href="'.$map . $file_name . "." . $file_extension.'">avatar</a>';
}
else
{
echo 'error something went wrong';
}
}
}
}
?>
if(isset($_POST['submit_avatar']) AND $_POST['avatar'] !== "")
{
if($sql == 1)
{
$afb = @getimagesize($_POST['avatar']);
$width = $afb[0];
$height = $afb[1];
$explode = explode(".", $_POST['avatar']);
$ext = array_pop($explode);
if(!eregi("^http://",$_POST['avatar']))
echo '<b>error:</b> start with http:// !';
elseif(!in_array($ext,$extensie))
{
echo '<b>Error:</b> not the wright extention! ';
for($i = 0; $i < $aantal_extensies; $i++)
echo '<b>'.$possible_extensions[$i].'<b> ';
echo '<br />';
}
elseif($width > $max_width OR $height > $max_heigth)
{
echo '<b>Error:</b> picture is to big!<br />max:<br />';
echo '<b>widht:</b> '.$max_width.' <b>height:</b> '. $max_heigth;
}
elseif(!$afb)
echo '<b>Error:</b> You should choose a other avatar!';
else
{
// unlink($avatar_oud);
mysql_query("UPDATE ".$tabel." SET avatar = '".$_POST['avatar']."' WHERE gebruikersnaam = '".$gebruikersnaam."'");
header("Location: ?p=avatar");
}
}
}
elseif(isset($_POST['submit_upload']) AND $_POST['plaatje'] !== "")
{
$file_size = round($_FILES['plaatje']['size'] / 1024);
$file_type = $_FILES['plaatje']['type'];
$file = basename($_FILES['plaatje']['name']);
$ext = explode(".", $file);
$file_extension = array_pop($ext);
$file_name = $_POST['name'];
$size = getimagesize($_FILES['plaatje']['tmp_name']);
$width = $size[0];
$height = $size[1];
if($sql == 1)
$file_name = $_COOKIE['login'];
else
$file_name = $file_name;
$file2 = $file_name.".".$file_extension;
if($file_size > $groote)
echo '<b>Fout:</b> Your avatar is bigger then <b>'.$groote.'</b> kb.<br />';
// elseif(file_exists("$map$file2"))
// echo '<b>Fout:</b> De naam die u gekozen heeft bestaat al!';
elseif($width > $max_width OR $height > $max_heigth)
{
echo '<b>Error:</b> picture is to big!<br />max:<br />';
echo '<b>widht:</b> '.$max_width.' <b>height:</b> '. $max_heigth;
}
else
{
if(!in_array(strtolower($file_extension),$extensie))
{
echo '<b>Error:</b> not the wright extention! ';
for($i = 0; $i < $aantal_extensies; $i++)
echo '<b>'.$possible_extensions[$i].'<b> ';
echo '<br />';
}
else
{
if(move_uploaded_file($plaatje, $map . $file_name . "." . $file_extension))
{
$file = $map;
$file.= $file_name.".";
$file.= $file_extension;
if($sql == 1)
{
mysql_query("UPDATE ".$tabel." SET avatar = '".$file."' WHERE gebruikersnaam = '".$gebruikersnaam."'");
// @unlink($avatar_oud);
header("Location: ?p=avatar");
}
else
echo 'avatar has been uploaded!<br />';
echo 'watch it here: <a href="'.$map . $file_name . "." . $file_extension.'">avatar</a>';
}
else
{
echo 'error something went wrong';
}
}
}
}
?>
dit zijn de toegestaane extenties:
kan iemand mij misschien helpen
MvG joachim.
Gewijzigd op 01/01/1970 01:00:00 door Joachim vanthuyne
iemand een oplossing?
zet het even tussen <?php en ?>
done
Code (php)
1
2
3
4
2
3
4
if(!eregi("^http://",$_POST['avatar']))
{
echo '<b>error:</b> start with http:// !';
}
{
echo '<b>error:</b> start with http:// !';
}
Op regel 27 ook
Gewijzigd op 01/01/1970 01:00:00 door Stijn Dumoulin
niet waar, tis 1 uitkomst, dan mag dat