Raar probleem [HULP]
Ik heb vandaag een activatie mail script gemaakt. Maar nu stuurt hij contanst mails naar de klant. Met een while erin.
Heeft iemand een idee hoe ik de kan gaan fixen? Heb het echt zo snel mogelijk nodig.
Bedankt
Code:
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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
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
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
<?php
$pageTitle = 'Activeren';
include '../includes/config.php';
include '../includes/header.php';
$activatieQuery = $core->mysql->query("SELECT
id,
naam,
contactpersoon,
activatie,
email
FROM
bedrijven
WHERE
activatie = 0");
if($core->mysql->num_rows($activatieQuery) >= 1)
{
if($_SERVER['REQUEST_METHOD'] == 'POST')
{
if(empty($_POST['uitgaan']))
{
echo 'Je hebt geen uitgaansgelegenheden geselecteerd.';
}
else
{
$core->mysql->query("UPDATE
bedrijven
SET
activatie = 1
WHERE
id = '".$core->mysql->escape($uitgaan)."'");
$uitgaanPostQuery = "SELECT
contactpersoon,
naam
FROM
bedrijven
WHERE
id = '".$_POST['uitgaan']."'";
$result = $core->mysql->query($uitgaanPostQuery);
if($result)
{
$array = array();
$uitgaanPostFetch = $core->mysql->fetch($uitgaanPostQuery);
$array[] = $uitgaanPostFetch['contactpersoon'];
$subject = 'Activatie';
$headers = 'From: TheSpecialDate <[email protected]>' . "\r\n";
$headers .= 'Reply-To: TheSpecialDate <[email protected]>' . "\r\n";
$headers .= 'X-Mailer: PHP/' . phpversion() . "\r\n";
$headers .= 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$bericht = '<table width="668" align="center" cellspacing="0" cellpadding="0">
<tr>
<td width="668" height="60" background="'._ROOT_.'img/header-bg.png" style="font: 11px Tahoma; color: #fff; text-align: center;">
<img src="'._ROOT_.'img/logo.png" alt="logo" /><br />
</td>
</tr>
<tr>
<td style="background: #000; border: 1px dotted #2e2509; padding: 10px; font: 11px Tahoma; color: #fff;">
<strong>Beste '.$array.'</strong>, <br /><br />
Gefeliciteerd, uw uitgaansgelegenheid is succesvol geactiveerd.<br />
U kunt nu <a href="'._ROOT_.'inloggen">inloggen</a>.
<br /><br />
<strong>Met vriendelijke groet</strong>,<br />
- TheSpecialDate
</td>
</tr>
</table>';
foreach($_POST['email'] as $email)
{
mail($email, $subject, $bericht, $headers);
}
echo '<div class="goede-melding">Deze uitgaansgelenheid is succesvol geactiveerd, er is een mail verstuurd naar de contactpersoon.</div>';
}
else
{
echo 'Er is een fout opgetreden.';
}
}
}
?>
<form action="" method="post">
<table width="100%">
<tr>
<td><input type="checkbox" value="" /></td>
<td><strong>Naam bedrijf</strong></td>
<td><strong>Contactpersoon</strong></td>
<td><strong>Email</strong></td>
</tr>
<?php
while($activatieFetch = $core->mysql->fetch($activatieQuery))
{
?>
<tr>
<td><input type="checkbox" value="<?php echo $core->entities($activatieFetch['id']); ?>" name="uitgaan[]" /></td>
<td><?php echo $core->entities($activatieFetch['naam']); ?></td>
<td><input type="hidden" name="persoon[]" value="<?php echo $core->entities($activatieFetch['contactpersoon']); ?>" /><?php echo $core->entities($activatieFetch['contactpersoon']); ?></td>
<td><input type="hidden" name="email[]" value="<?php echo $core->entities($activatieFetch['email']); ?>" /><?php echo $core->entities($activatieFetch['email']); ?></td>
</tr>
<?php
}
?>
</table>
<input type="submit" name="submit" value="Activeer" />
</form>
<?php
}
else
{
echo 'Er zijn geen nieuwe aangemelde uitgaansgelegenheden.';
}
include '../includes/footer.php';
?>
$pageTitle = 'Activeren';
include '../includes/config.php';
include '../includes/header.php';
$activatieQuery = $core->mysql->query("SELECT
id,
naam,
contactpersoon,
activatie,
FROM
bedrijven
WHERE
activatie = 0");
if($core->mysql->num_rows($activatieQuery) >= 1)
{
if($_SERVER['REQUEST_METHOD'] == 'POST')
{
if(empty($_POST['uitgaan']))
{
echo 'Je hebt geen uitgaansgelegenheden geselecteerd.';
}
else
{
$core->mysql->query("UPDATE
bedrijven
SET
activatie = 1
WHERE
id = '".$core->mysql->escape($uitgaan)."'");
$uitgaanPostQuery = "SELECT
contactpersoon,
naam
FROM
bedrijven
WHERE
id = '".$_POST['uitgaan']."'";
$result = $core->mysql->query($uitgaanPostQuery);
if($result)
{
$array = array();
$uitgaanPostFetch = $core->mysql->fetch($uitgaanPostQuery);
$array[] = $uitgaanPostFetch['contactpersoon'];
$subject = 'Activatie';
$headers = 'From: TheSpecialDate <[email protected]>' . "\r\n";
$headers .= 'Reply-To: TheSpecialDate <[email protected]>' . "\r\n";
$headers .= 'X-Mailer: PHP/' . phpversion() . "\r\n";
$headers .= 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$bericht = '<table width="668" align="center" cellspacing="0" cellpadding="0">
<tr>
<td width="668" height="60" background="'._ROOT_.'img/header-bg.png" style="font: 11px Tahoma; color: #fff; text-align: center;">
<img src="'._ROOT_.'img/logo.png" alt="logo" /><br />
</td>
</tr>
<tr>
<td style="background: #000; border: 1px dotted #2e2509; padding: 10px; font: 11px Tahoma; color: #fff;">
<strong>Beste '.$array.'</strong>, <br /><br />
Gefeliciteerd, uw uitgaansgelegenheid is succesvol geactiveerd.<br />
U kunt nu <a href="'._ROOT_.'inloggen">inloggen</a>.
<br /><br />
<strong>Met vriendelijke groet</strong>,<br />
- TheSpecialDate
</td>
</tr>
</table>';
foreach($_POST['email'] as $email)
{
mail($email, $subject, $bericht, $headers);
}
echo '<div class="goede-melding">Deze uitgaansgelenheid is succesvol geactiveerd, er is een mail verstuurd naar de contactpersoon.</div>';
}
else
{
echo 'Er is een fout opgetreden.';
}
}
}
?>
<form action="" method="post">
<table width="100%">
<tr>
<td><input type="checkbox" value="" /></td>
<td><strong>Naam bedrijf</strong></td>
<td><strong>Contactpersoon</strong></td>
<td><strong>Email</strong></td>
</tr>
<?php
while($activatieFetch = $core->mysql->fetch($activatieQuery))
{
?>
<tr>
<td><input type="checkbox" value="<?php echo $core->entities($activatieFetch['id']); ?>" name="uitgaan[]" /></td>
<td><?php echo $core->entities($activatieFetch['naam']); ?></td>
<td><input type="hidden" name="persoon[]" value="<?php echo $core->entities($activatieFetch['contactpersoon']); ?>" /><?php echo $core->entities($activatieFetch['contactpersoon']); ?></td>
<td><input type="hidden" name="email[]" value="<?php echo $core->entities($activatieFetch['email']); ?>" /><?php echo $core->entities($activatieFetch['email']); ?></td>
</tr>
<?php
}
?>
</table>
<input type="submit" name="submit" value="Activeer" />
</form>
<?php
}
else
{
echo 'Er zijn geen nieuwe aangemelde uitgaansgelegenheden.';
}
include '../includes/footer.php';
?>
header injection mogelijk
name="email[]" vind ik wel iets raar
Code (php)
1
2
3
4
5
6
2
3
4
5
6
<?php
ini_set('display_errors', 1); // 0 = uit, 1 = aan
error_reporting(E_ALL);
//rest
?>
ini_set('display_errors', 1); // 0 = uit, 1 = aan
error_reporting(E_ALL);
//rest
?>