Avater is fout???
Ik heb dit script hieronder maar hij geeft steeds aan als iemand zich wilt aanmelden dat het de verkeerde extensie is. Hoe komt dit en hoe kan ik dit verhelpen?
het staat op www.beadsandmore.nl/ILA/com/aanmelden.php
EDIT: Dit is dan de belangrijkste stuk.
-- connect.php --
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
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
<?php
@session_start();
include 'functions.php';
$rDatabaseConnection = @mysql_connect('localhost', 'root', '');
// Ja, we rammen we er een @ voor, want de foutafhandeling is goed genoeg (vind ik)
if(!$rDatabaseConnection)
{
myErrorHandler('mysql_connect()', mysql_error($rDatabaseConnection));
}
$rDatabaseSelection = @mysql_select_db('profiel');
if(!$rDatabaseSelection)
{
myErrorHandler('mysql_select_db()', mysql_error($rDatabaseConnection), FALSE);
}
////////////////\\\\\\\\\\\\\\\\\\\\\\\\\\///////////// Configuratie: \\/////\\\\\\\\\/////////\\\\\\\\\//////////
$iMaxFileSize = 100000;
$sUploadDir = 'avatars';
$aExtensions = array( '/jpg', '/gif', '/png', '/bmp' );
//////////\\\\\\\\\\////////////////////\\\\\\\\\\\\\\\////////////////\\\\\\\\\\\\\\///////////\\\\\\\///////\\\\
if(!file_exists('pm/connect.php'))
{
copy('connect.php','pm/connect.php');
}
if(!file_exists('pm/functions.php'))
{
copy('functions.php','pm/functions.php');
}
?>
@session_start();
include 'functions.php';
$rDatabaseConnection = @mysql_connect('localhost', 'root', '');
// Ja, we rammen we er een @ voor, want de foutafhandeling is goed genoeg (vind ik)
if(!$rDatabaseConnection)
{
myErrorHandler('mysql_connect()', mysql_error($rDatabaseConnection));
}
$rDatabaseSelection = @mysql_select_db('profiel');
if(!$rDatabaseSelection)
{
myErrorHandler('mysql_select_db()', mysql_error($rDatabaseConnection), FALSE);
}
////////////////\\\\\\\\\\\\\\\\\\\\\\\\\\///////////// Configuratie: \\/////\\\\\\\\\/////////\\\\\\\\\//////////
$iMaxFileSize = 100000;
$sUploadDir = 'avatars';
$aExtensions = array( '/jpg', '/gif', '/png', '/bmp' );
//////////\\\\\\\\\\////////////////////\\\\\\\\\\\\\\\////////////////\\\\\\\\\\\\\\///////////\\\\\\\///////\\\\
if(!file_exists('pm/connect.php'))
{
copy('connect.php','pm/connect.php');
}
if(!file_exists('pm/functions.php'))
{
copy('functions.php','pm/functions.php');
}
?>
_______________-
-- aanmelden.php --
<h3>Aanmelden</h3>
Code (php)
<script language='javascript'>
alert("Je hebt het formulier niet juist ingevuld:\n\n");
location = '?page=aanmelden';
</script>
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
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
<?php
exit;
}
if( $_FILES['profiel_avatar'] != '' )
{
if(! in_array( stristr( $_FILES['profiel_avatar']['type'], '/' ) , $aExtensions ) )
{
echo 'Je avatar is niet geupload, want je hebt een verkeerde extensie voor je avatar gekozen.<br>';
}
else
{
if( $_FILES['profiel_avatar']['size'] > $iMaxFileSize )
{
echo 'Je avatar is niet geupload, want het maximale aantal bytes is '. $iMaxFileSize .'.';
}
else
{
move_uploaded_file( $_FILES['profiel_avatar']['tmp_name'], $sUploadDir.'/'.$_POST['profiel_name'].'.jpg' );
}
}
}
$sMySQLQuery = "INSERT INTO profiel
(profiel_id,profiel_name,profiel_password,
profiel_woonplaats,profiel_email,profiel_homepage,
profiel_handtekening)
VALUES(
'',
'".myaddslashes($_POST['profiel_name'])."',
'".myaddslashes(md5($_POST['profiel_password']))."',
'".myaddslashes($_POST['profiel_woonplaats'])."',
'".myaddslashes($_POST['profiel_email'])."',
'".myaddslashes($_POST['profiel_homepage'])."',
'".myaddslashes($_POST['profiel_handtekening'])."'
);
";
$rMySQLQuery = @mysql_query( $sMySQLQuery, $rDatabaseConnection );
if(!$rMySQLQuery && mysql_errno() == 1062)
{
echo 'De gebruikersnaam die je hebt ingevuld is al in gebruik!';
}
elseif(!$rMySQLQuery)
{
myErrorHandler( 'mysql_query()', mysql_error($rDatabaseConnection), TRUE );
}
else
{
echo 'Je bent succesvol aangemeld met de nickname \''.htmlspecialchars($_POST['profiel_name']).'\'.<br>
Veel geluk met je profiel!';
}
}
else
{
?>
exit;
}
if( $_FILES['profiel_avatar'] != '' )
{
if(! in_array( stristr( $_FILES['profiel_avatar']['type'], '/' ) , $aExtensions ) )
{
echo 'Je avatar is niet geupload, want je hebt een verkeerde extensie voor je avatar gekozen.<br>';
}
else
{
if( $_FILES['profiel_avatar']['size'] > $iMaxFileSize )
{
echo 'Je avatar is niet geupload, want het maximale aantal bytes is '. $iMaxFileSize .'.';
}
else
{
move_uploaded_file( $_FILES['profiel_avatar']['tmp_name'], $sUploadDir.'/'.$_POST['profiel_name'].'.jpg' );
}
}
}
$sMySQLQuery = "INSERT INTO profiel
(profiel_id,profiel_name,profiel_password,
profiel_woonplaats,profiel_email,profiel_homepage,
profiel_handtekening)
VALUES(
'',
'".myaddslashes($_POST['profiel_name'])."',
'".myaddslashes(md5($_POST['profiel_password']))."',
'".myaddslashes($_POST['profiel_woonplaats'])."',
'".myaddslashes($_POST['profiel_email'])."',
'".myaddslashes($_POST['profiel_homepage'])."',
'".myaddslashes($_POST['profiel_handtekening'])."'
);
";
$rMySQLQuery = @mysql_query( $sMySQLQuery, $rDatabaseConnection );
if(!$rMySQLQuery && mysql_errno() == 1062)
{
echo 'De gebruikersnaam die je hebt ingevuld is al in gebruik!';
}
elseif(!$rMySQLQuery)
{
myErrorHandler( 'mysql_query()', mysql_error($rDatabaseConnection), TRUE );
}
else
{
echo 'Je bent succesvol aangemeld met de nickname \''.htmlspecialchars($_POST['profiel_name']).'\'.<br>
Veel geluk met je profiel!';
}
}
else
{
?>
<form method='post' action='?page=aanmelden' enctype='multipart/form-data'>
<table border='0'>
<tr><td>Je gebruikersnaam:</td> <td><input type='text' name='profiel_name' size='40' maxlength='50'></td></tr>
<tr><td>Je wachtwoord:</td> <td><input type='password' name='profiel_password' size='40' maxlength='50'></td></tr>
<tr><td>Je woonplaats:</td> <td><input type='text' name='profiel_woonplaats' size='40' maxlength='50'></td></tr>
<tr><td>Je email-adres:</td> <td><input type='text' name='profiel_email' size='40' maxlength='60'></td></tr>
<tr><td>Je homepage:</td> <td><input type='text' name='profiel_homepage' size='40' maxlength='60'></td></tr>
<tr><td>Je handtekening:</td> <td><textarea rows='6' cols='50' name='profiel_handtekening'></textarea></td></tr>
<tr><td>Je avatar:</td> <td><input type='file' name='profiel_avatar'></td></tr>
<tr><td><input type='submit' value='Aanmelden'></td></tr>
</table>
</form>
Gewijzigd op 11/01/2006 22:14:00 door Thom
oh wacht
toch wel
doe ff relevante code weergeven, en niet meer
De hint is dus dat je niet zoveel code moet plaatsen, alleen 5 à tien regels rondom de regel(s) waar de foutmelding zit...
Ja, wat betreft Prince Of Chaos kolopt het wel :-D