fout in mail functie
ik heb hier een script gevonden om aan te melden op een site
zonder mysql
nu wil ik een account registeren
geeft die de volgende fout.
Warning: mail() [function.mail]: SAFE MODE Restriction in effect. The fifth parameter is disabled in SAFE MODE. in /storage/mijndomein/users/058605/public/sites/14emontessori.chat2you.eu/register.php on line 50
het script is:
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
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
<head>
<title>14e Montessori Intranet</title>
</head>
<?
include('logo.php');
?>
<?php
function mkpass(){
$letters = array();
$tekens['klein'] = range('a','z');
$tekens['groot'] = range('A','Z');
$tekens['cijfers'] = range(0,9);
foreach($tekens['klein'] as $k => $v){
array_push($letters, $v);
}
foreach($tekens['groot'] as $k => $v){
array_push($letters, $v);
}
foreach($tekens['cijfers'] as $k => $v){
array_push($letters, $v);
}
$aantal = count($letters)-1;
return $letters[rand(0,$aantal)] . $letters[rand(0,$aantal)] . $letters[rand(0,$aantal)] . $letters[rand(0,$aantal)] . $letters[rand(0,$aantal)] . $letters[rand(0,$aantal)] . $letters[rand(0,$aantal)] . $letters[rand(0,$aantal)];
}
if($_SERVER['REQUEST_METHOD'] == 'POST'){
if(empty($_POST['login_name']) OR empty($_POST['email'])){
echo "<h1>Error</h1>\n<p>You did not fill in all required fields!</p>\n";
}else{
$username = htmlentities($_POST['login_name'], ENT_QUOTES);
$password = mkpass();
$email = htmlentities($_POST['email'], ENT_QUOTES);
if(file_exists('members/' . $username . '.php')){
echo "<h1>Fout</h1>\n<p>Gebruikersnaam al in gebruik!</p>\n";
}else{
include('config.php');
$onderwerp = "Registration at " . $website;
$bericht = "Welcome to " . $website . "\r\n\r\nPlease keep this email for your records. Your account information is as follows:\r\n\r\n----------------------------\r\nUsername: " . $username . "\r\nPassword: " . $password . "\r\n----------------------------\r\n\r\nThank you for registering.";
mail($email, $onderwerp, $bericht, "From: " . $afzender . "\nX-Mailer: PHP/" . phpversion(), "-f " . $afzender);
$handle = fopen('members/' . $username . '.php','w');
fwrite($handle, "<?php\n \$password = \"" . md5($password) . "\";\n \$email = \"" . $email . "\";\n ?>");
fclose($handle);
echo "<h1>Registreren is gelukt</h1>\n<p>Kijk voor je wachtwoord op je E-mail.</p>\n";
}
}
}else{
?>
<form method="post" action="#">
<h1>Registreer account</h1>
<p>Gebruikersnaam:<br /><input type="text" name="login_name" maxlength="20" /></p>
<p>E-mail:<br /><input type="text" name="email" /></p>
<p><input type="submit" name="submit" value="Verzenden" /></p>
</form>
<?
}
?>
<title>14e Montessori Intranet</title>
</head>
<?
include('logo.php');
?>
<?php
function mkpass(){
$letters = array();
$tekens['klein'] = range('a','z');
$tekens['groot'] = range('A','Z');
$tekens['cijfers'] = range(0,9);
foreach($tekens['klein'] as $k => $v){
array_push($letters, $v);
}
foreach($tekens['groot'] as $k => $v){
array_push($letters, $v);
}
foreach($tekens['cijfers'] as $k => $v){
array_push($letters, $v);
}
$aantal = count($letters)-1;
return $letters[rand(0,$aantal)] . $letters[rand(0,$aantal)] . $letters[rand(0,$aantal)] . $letters[rand(0,$aantal)] . $letters[rand(0,$aantal)] . $letters[rand(0,$aantal)] . $letters[rand(0,$aantal)] . $letters[rand(0,$aantal)];
}
if($_SERVER['REQUEST_METHOD'] == 'POST'){
if(empty($_POST['login_name']) OR empty($_POST['email'])){
echo "<h1>Error</h1>\n<p>You did not fill in all required fields!</p>\n";
}else{
$username = htmlentities($_POST['login_name'], ENT_QUOTES);
$password = mkpass();
$email = htmlentities($_POST['email'], ENT_QUOTES);
if(file_exists('members/' . $username . '.php')){
echo "<h1>Fout</h1>\n<p>Gebruikersnaam al in gebruik!</p>\n";
}else{
include('config.php');
$onderwerp = "Registration at " . $website;
$bericht = "Welcome to " . $website . "\r\n\r\nPlease keep this email for your records. Your account information is as follows:\r\n\r\n----------------------------\r\nUsername: " . $username . "\r\nPassword: " . $password . "\r\n----------------------------\r\n\r\nThank you for registering.";
mail($email, $onderwerp, $bericht, "From: " . $afzender . "\nX-Mailer: PHP/" . phpversion(), "-f " . $afzender);
$handle = fopen('members/' . $username . '.php','w');
fwrite($handle, "<?php\n \$password = \"" . md5($password) . "\";\n \$email = \"" . $email . "\";\n ?>");
fclose($handle);
echo "<h1>Registreren is gelukt</h1>\n<p>Kijk voor je wachtwoord op je E-mail.</p>\n";
}
}
}else{
?>
<form method="post" action="#">
<h1>Registreer account</h1>
<p>Gebruikersnaam:<br /><input type="text" name="login_name" maxlength="20" /></p>
<p>E-mail:<br /><input type="text" name="email" /></p>
<p><input type="submit" name="submit" value="Verzenden" /></p>
</form>
<?
}
?>
weet iemand een oplossing hiervoor
alvast bedankt
groetjes wesley
Gewijzigd op 01/01/1970 01:00:00 door Stephan Sterrenberg
Zoals de error al aangeeft: De vijfde parameter kan je niet gebruiken bij mail().
en weet je misschien hiervoor een oplossing
want op een andere server doet die het wel
maar die is alleen via netwerk
en niet via internet te berijken
wesley schreef op 01.06.2007 22:53:
en welke is dat
Euh, de vijfde???
mail($email, $onderwerp, $bericht, "From: " . $afzender . "\nX-Mailer: PHP/" . phpversion(), "-f " . $afzender);
veranderen in dit en hopen dat ie het nog doet.
mail($email, $onderwerp, $bericht, "From: " . $afzender . "\nX-Mailer: PHP/" . phpversion());
thanks hij werkt weer
additional_parameters (optional)
The additional_parameters parameter can be used to pass an additional parameter to the program configured to use when sending mail using the sendmail_path configuration setting. For example, this can be used to set the envelope sender address when using sendmail with the -f sendmail option.
The user that the webserver runs as should be added as a trusted user to the sendmail configuration to prevent a 'X-Warning' header from being added to the message when the envelope sender (-f) is set using this method. For sendmail users, this file is /etc/mail/trusted-users.